showai-reader 0.11.0-reader.jgiagmrq → 0.11.0-reader.llcxplii
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/chunks/{RichTextEditor-2BRZ4QVM.js → RichTextEditor-LUXV3UQC.js} +1 -1
- package/chunks/{chunk-D2XEAY66.js → chunk-W6XN463T.js} +8 -8
- package/index.js +1 -1
- package/manifest.json +4 -4
- package/package.json +1 -1
- package/{reader-JGIAGMRQ.js → reader-LLCXPLII.js} +42 -42
- /package/{reader-JGIAGMRQ.js.LEGAL.txt → reader-LLCXPLII.js.LEGAL.txt} +0 -0
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
The [ShowAI](https://showai.renaissancemind.ai) page reader, built from ShowAI 0.11.0 as code-split ES modules. Inline conversation pages written by `render-artifact --cdn` import it and load each component's code only when the page uses it.
|
|
4
4
|
|
|
5
5
|
```js
|
|
6
|
-
const { mount } = await import("https://cdn.jsdelivr.net/npm/showai-reader@0.11.0-reader.
|
|
6
|
+
const { mount } = await import("https://cdn.jsdelivr.net/npm/showai-reader@0.11.0-reader.llcxplii/index.js");
|
|
7
7
|
mount(document.getElementById("page"), { artifact });
|
|
8
8
|
```
|
|
9
9
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as Qs,d as Zs,hb as Vu,jb as Fu,ob as Ko,pb as ze,qb as Uo,sb as Wu,tb as Gu,ua as rn,ub as Ju,va as el,wa as Pu,ya as Iu}from"./chunk-D2XEAY66.js";import"./chunk-3RZMLHCB.js";import"./chunk-JXKAISUX.js";import"./chunk-C4JCEMQN.js";import{A as on,B as Kr,C as q,D as oe,E as zu,G as Hu,K as rl,d as V,e as $u,f as ae,g as Ho,h as tl,i as Nn,j as Rn,k as _o,l as Bu,m as Dn,n as At,o as _t,p as ar,q as pt,r as wt,s as cr,t as Vo,u as jo,v as Fo,w as Q,x as nl,y as L,z as j}from"./chunk-KQR52I3G.js";import"./chunk-SNEZ3O5V.js";import"./chunk-77DN5DLU.js";import"./chunk-AIBH6MTQ.js";import"./chunk-4XYNKR7T.js";import"./chunk-354XB5AI.js";import{b as lr,c as Tu,d as Nu,e as Ru}from"./chunk-TRRO25IC.js";import{a as il,b as qo,c as Ku,e as Uu}from"./chunk-7G6RMB6W.js";import{a as hb,b as mb}from"./chunk-AW4RA5UH.js";import"./chunk-GLP5VV7P.js";import{a as _u}from"./chunk-5AW2WUSZ.js";import{a as Xu}from"./chunk-7NZRTGJL.js";import"./chunk-DG67SWQA.js";import"./chunk-KF47DKNH.js";import{b as ol,c as ju}from"./chunk-2YLUVQCJ.js";import{$a as Xs,A as sr,B as Po,Cb as Re,Db as qu,Ea as Ht,H as tu,Ha as Ks,I as nu,Ia as yu,K as ru,L as ou,N as iu,P as su,Pa as Us,Q as lu,Qa as qs,Ra as wu,S as au,Ua as ku,Wa as Gs,Xa as vu,Ya as Js,Za as Cu,_ as cu,_a as xu,a as Lo,aa as uu,ab as Mn,ba as du,bb as An,c as zt,ca as fu,cb as Su,da as pu,db as Tn,ea as Io,eb as Bo,ga as hu,gb as zo,hb as Eu,ib as Mu,ka as Fr,kb as Au,la as Fs,m as Xc,na as Ws,nb as Wr,o as Yc,ob as Fe,pb as Ys,q as Qc,r as js,s as Zc,sa as mu,ta as $o,ua as gu,vb as Du,wb as Ou,z as eu,za as bu,zb as Lu}from"./chunk-IJTLAUEC.js";import{a as Wo,f as ur}from"./chunk-J6IRWTF7.js";import{a as pb,c as pe}from"./chunk-DCANE7XH.js";var Sg=pb((ON,xg)=>{function dg(e){return e instanceof Map?e.clear=e.delete=e.set=function(){throw new Error("map is read-only")}:e instanceof Set&&(e.add=e.clear=e.delete=function(){throw new Error("set is read-only")}),Object.freeze(e),Object.getOwnPropertyNames(e).forEach(t=>{let n=e[t],r=typeof n;(r==="object"||r==="function")&&!Object.isFrozen(n)&&dg(n)}),e}var Rs=class{constructor(t){t.data===void 0&&(t.data={}),this.data=t.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}};function fg(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function yn(e,...t){let n=Object.create(null);for(let r in e)n[r]=e[r];return t.forEach(function(r){for(let o in r)n[o]=r[o]}),n}var vS="</span>",ig=e=>!!e.scope,CS=(e,{prefix:t})=>{if(e.startsWith("language:"))return e.replace("language:","language-");if(e.includes(".")){let n=e.split(".");return[`${t}${n.shift()}`,...n.map((r,o)=>`${r}${"_".repeat(o+1)}`)].join(" ")}return`${t}${e}`},Mc=class{constructor(t,n){this.buffer="",this.classPrefix=n.classPrefix,t.walk(this)}addText(t){this.buffer+=fg(t)}openNode(t){if(!ig(t))return;let n=CS(t.scope,{prefix:this.classPrefix});this.span(n)}closeNode(t){ig(t)&&(this.buffer+=vS)}value(){return this.buffer}span(t){this.buffer+=`<span class="${t}">`}},sg=(e={})=>{let t={children:[]};return Object.assign(t,e),t},Ac=class e{constructor(){this.rootNode=sg(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(t){this.top.children.push(t)}openNode(t){let n=sg({scope:t});this.add(n),this.stack.push(n)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(t){return this.constructor._walk(t,this.rootNode)}static _walk(t,n){return typeof n=="string"?t.addText(n):n.children&&(t.openNode(n),n.children.forEach(r=>this._walk(t,r)),t.closeNode(n)),t}static _collapse(t){typeof t!="string"&&t.children&&(t.children.every(n=>typeof n=="string")?t.children=[t.children.join("")]:t.children.forEach(n=>{e._collapse(n)}))}},Tc=class extends Ac{constructor(t){super(),this.options=t}addText(t){t!==""&&this.add(t)}startScope(t){this.openNode(t)}endScope(){this.closeNode()}__addSublanguage(t,n){let r=t.root;n&&(r.scope=`language:${n}`),this.add(r)}toHTML(){return new Mc(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}};function To(e){return e?typeof e=="string"?e:e.source:null}function pg(e){return nr("(?=",e,")")}function xS(e){return nr("(?:",e,")*")}function SS(e){return nr("(?:",e,")?")}function nr(...e){return e.map(n=>To(n)).join("")}function ES(e){let t=e[e.length-1];return typeof t=="object"&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function Os(...e){return"("+(ES(e).capture?"":"?:")+e.map(r=>To(r)).join("|")+")"}function hg(e){return new RegExp(e.toString()+"|").exec("").length-1}function MS(e,t){let n=e&&e.exec(t);return n&&n.index===0}var AS=new RegExp(Os(/\[(?:[^\\\]]|\\.)*\]/,/\(\?<(?![=!])[^>]+>/,/\(\?'[^']+'/,/\(\??/,/\\([1-9][0-9]*)/,/\\./));function Rc(e,{joinWith:t}){let n=0;return e.map(r=>{n+=1;let o=n,i=To(r),s="";for(;i.length>0;){let l=AS.exec(i);if(!l){s+=i;break}s+=i.substring(0,l.index),i=i.substring(l.index+l[0].length),l[0][0]==="\\"&&l[1]?s+="\\"+String(Number(l[1])+o):(s+=l[0],(l[0]==="("||/^\(\?[<']/.test(l[0]))&&n++)}return s}).map(r=>`(${r})`).join(t)}var TS=/\b\B/,mg="[a-zA-Z]\\w*",Dc="[a-zA-Z_]\\w*",gg="\\b\\d+(\\.\\d+)?",bg="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",yg="\\b(0b[01]+)",NS="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",RS=(e={})=>{let t=/^#![ ]*\//;return e.binary&&(e.begin=nr(t,/.*\b/,e.binary,/\b.*/)),yn({scope:"meta",begin:t,end:/$/,relevance:0,"on:begin":(n,r)=>{n.index!==0&&r.ignoreMatch()}},e)},No={begin:"\\\\[\\s\\S]",relevance:0},DS={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[No]},OS={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[No]},LS={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},Ls=function(e,t,n={}){let r=yn({scope:"comment",begin:e,end:t,contains:[]},n);r.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});let o=Os("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return r.contains.push({begin:nr(/[ ]+/,"(",o,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),r},PS=Ls("//","$"),IS=Ls("/\\*","\\*/"),$S=Ls("#","$"),BS={scope:"number",begin:gg,relevance:0},zS={scope:"number",begin:bg,relevance:0},HS={scope:"number",begin:yg,relevance:0},_S={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[No,{begin:/\[/,end:/\]/,relevance:0,contains:[No]}]},VS={scope:"title",begin:mg,relevance:0},jS={scope:"title",begin:Dc,relevance:0},FS={begin:"\\.\\s*"+Dc,relevance:0},WS=function(e){return Object.assign(e,{"on:begin":(t,n)=>{n.data._beginMatch=t[1]},"on:end":(t,n)=>{n.data._beginMatch!==t[1]&&n.ignoreMatch()}})},Ns=Object.freeze({__proto__:null,APOS_STRING_MODE:DS,BACKSLASH_ESCAPE:No,BINARY_NUMBER_MODE:HS,BINARY_NUMBER_RE:yg,COMMENT:Ls,C_BLOCK_COMMENT_MODE:IS,C_LINE_COMMENT_MODE:PS,C_NUMBER_MODE:zS,C_NUMBER_RE:bg,END_SAME_AS_BEGIN:WS,HASH_COMMENT_MODE:$S,IDENT_RE:mg,MATCH_NOTHING_RE:TS,METHOD_GUARD:FS,NUMBER_MODE:BS,NUMBER_RE:gg,PHRASAL_WORDS_MODE:LS,QUOTE_STRING_MODE:OS,REGEXP_MODE:_S,RE_STARTERS_RE:NS,SHEBANG:RS,TITLE_MODE:VS,UNDERSCORE_IDENT_RE:Dc,UNDERSCORE_TITLE_MODE:jS});function KS(e,t){e.input[e.index-1]==="."&&t.ignoreMatch()}function US(e,t){e.className!==void 0&&(e.scope=e.className,delete e.className)}function qS(e,t){t&&e.beginKeywords&&(e.begin="\\b("+e.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",e.__beforeBegin=KS,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords,e.relevance===void 0&&(e.relevance=0))}function GS(e,t){Array.isArray(e.illegal)&&(e.illegal=Os(...e.illegal))}function JS(e,t){if(e.match){if(e.begin||e.end)throw new Error("begin & end are not supported with match");e.begin=e.match,delete e.match}}function XS(e,t){e.relevance===void 0&&(e.relevance=1)}var YS=(e,t)=>{if(!e.beforeMatch)return;if(e.starts)throw new Error("beforeMatch cannot be used with starts");let n=Object.assign({},e);Object.keys(e).forEach(r=>{delete e[r]}),e.keywords=n.keywords,e.begin=nr(n.beforeMatch,pg(n.begin)),e.starts={relevance:0,contains:[Object.assign(n,{endsParent:!0})]},e.relevance=0,delete n.beforeMatch},QS=["of","and","for","in","not","or","if","then","parent","list","value"],ZS="keyword";function wg(e,t,n=ZS){let r=Object.create(null);return typeof e=="string"?o(n,e.split(" ")):Array.isArray(e)?o(n,e):Object.keys(e).forEach(function(i){Object.assign(r,wg(e[i],t,i))}),r;function o(i,s){t&&(s=s.map(l=>l.toLowerCase())),s.forEach(function(l){let a=l.split("|");r[a[0]]=[i,e1(a[0],a[1])]})}}function e1(e,t){return t?Number(t):t1(e)?0:1}function t1(e){return QS.includes(e.toLowerCase())}var lg={},tr=e=>{console.error(e)},ag=(e,...t)=>{console.log(`WARN: ${e}`,...t)},$r=(e,t)=>{lg[`${e}/${t}`]||(console.log(`Deprecated as of ${e}. ${t}`),lg[`${e}/${t}`]=!0)},Ds=new Error;function kg(e,t,{key:n}){let r=0,o=e[n],i={},s={};for(let l=1;l<=t.length;l++)s[l+r]=o[l],i[l+r]=!0,r+=hg(t[l-1]);e[n]=s,e[n]._emit=i,e[n]._multi=!0}function n1(e){if(Array.isArray(e.begin)){if(e.skip||e.excludeBegin||e.returnBegin)throw tr("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),Ds;if(typeof e.beginScope!="object"||e.beginScope===null)throw tr("beginScope must be object"),Ds;kg(e,e.begin,{key:"beginScope"}),e.begin=Rc(e.begin,{joinWith:""})}}function r1(e){if(Array.isArray(e.end)){if(e.skip||e.excludeEnd||e.returnEnd)throw tr("skip, excludeEnd, returnEnd not compatible with endScope: {}"),Ds;if(typeof e.endScope!="object"||e.endScope===null)throw tr("endScope must be object"),Ds;kg(e,e.end,{key:"endScope"}),e.end=Rc(e.end,{joinWith:""})}}function o1(e){e.scope&&typeof e.scope=="object"&&e.scope!==null&&(e.beginScope=e.scope,delete e.scope)}function i1(e){o1(e),typeof e.beginScope=="string"&&(e.beginScope={_wrap:e.beginScope}),typeof e.endScope=="string"&&(e.endScope={_wrap:e.endScope}),n1(e),r1(e)}function s1(e){function t(s,l){return new RegExp(To(s),"m"+(e.case_insensitive?"i":"")+(e.unicodeRegex?"u":"")+(l?"g":""))}class n{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(l,a){a.position=this.position++,this.matchIndexes[this.matchAt]=a,this.regexes.push([a,l]),this.matchAt+=hg(l)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);let l=this.regexes.map(a=>a[1]);this.matcherRe=t(Rc(l,{joinWith:"|"}),!0),this.lastIndex=0}exec(l){this.matcherRe.lastIndex=this.lastIndex;let a=this.matcherRe.exec(l);if(!a)return null;let u=a.findIndex((d,f)=>f>0&&d!==void 0),c=this.matchIndexes[u];return a.splice(0,u),Object.assign(a,c)}}class r{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(l){if(this.multiRegexes[l])return this.multiRegexes[l];let a=new n;return this.rules.slice(l).forEach(([u,c])=>a.addRule(u,c)),a.compile(),this.multiRegexes[l]=a,a}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(l,a){this.rules.push([l,a]),a.type==="begin"&&this.count++}exec(l){let a=this.getMatcher(this.regexIndex);a.lastIndex=this.lastIndex;let u=a.exec(l);if(this.resumingScanAtSamePosition()&&!(u&&u.index===this.lastIndex)){let c=this.getMatcher(0);c.lastIndex=this.lastIndex+1,u=c.exec(l)}return u&&(this.regexIndex+=u.position+1,this.regexIndex===this.count&&this.considerAll()),u}}function o(s){let l=new r;return s.contains.forEach(a=>l.addRule(a.begin,{rule:a,type:"begin"})),s.terminatorEnd&&l.addRule(s.terminatorEnd,{type:"end"}),s.illegal&&l.addRule(s.illegal,{type:"illegal"}),l}function i(s,l){let a=s;if(s.isCompiled)return a;[US,JS,i1,YS].forEach(c=>c(s,l)),e.compilerExtensions.forEach(c=>c(s,l)),s.__beforeBegin=null,[qS,GS,XS].forEach(c=>c(s,l)),s.isCompiled=!0;let u=null;return typeof s.keywords=="object"&&s.keywords.$pattern&&(s.keywords=Object.assign({},s.keywords),u=s.keywords.$pattern,delete s.keywords.$pattern),u=u||/\w+/,s.keywords&&(s.keywords=wg(s.keywords,e.case_insensitive)),a.keywordPatternRe=t(u,!0),l&&(s.begin||(s.begin=/\B|\b/),a.beginRe=t(a.begin),!s.end&&!s.endsWithParent&&(s.end=/\B|\b/),s.end&&(a.endRe=t(a.end)),a.terminatorEnd=To(a.end)||"",s.endsWithParent&&l.terminatorEnd&&(a.terminatorEnd+=(s.end?"|":"")+l.terminatorEnd)),s.illegal&&(a.illegalRe=t(s.illegal)),s.contains||(s.contains=[]),s.contains=[].concat(...s.contains.map(function(c){return l1(c==="self"?s:c)})),s.contains.forEach(function(c){i(c,a)}),s.starts&&i(s.starts,l),a.matcher=o(a),a}if(e.compilerExtensions||(e.compilerExtensions=[]),e.contains&&e.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return e.classNameAliases=yn(e.classNameAliases||{}),i(e)}function vg(e){return e?e.endsWithParent||vg(e.starts):!1}function l1(e){return e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map(function(t){return yn(e,{variants:null},t)})),e.cachedVariants?e.cachedVariants:vg(e)?yn(e,{starts:e.starts?yn(e.starts):null}):Object.isFrozen(e)?yn(e):e}var a1="11.12.0",Nc=class extends Error{constructor(t,n){super(t),this.name="HTMLInjectionError",this.html=n}},Ec=fg,cg=yn,ug=Symbol("nomatch"),c1=7,Cg=function(e){let t=Object.create(null),n=Object.create(null),r=[],o=!0,i="Could not find the language '{}', did you forget to load/include a language module?",s={disableAutodetect:!0,name:"Plain text",contains:[]},l={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:Tc};function a(N){return l.noHighlightRe.test(N)}function u(N){let _=N.className+" ";_+=N.parentNode?N.parentNode.className:"";let ee=l.languageDetectRe.exec(_);if(ee){let ue=O(ee[1]);return ue||(ag(i.replace("{}",ee[1])),ag("Falling back to no-highlight mode for this block.",N)),ue?ee[1]:"no-highlight"}return _.split(/\s+/).find(ue=>a(ue)||O(ue))}function c(N,_,ee){let ue="",Se="";typeof _=="object"?(ue=N,ee=_.ignoreIllegals,Se=_.language):($r("10.7.0","highlight(lang, code, ...args) has been deprecated."),$r("10.7.0",`Please use highlight(code, options) instead.
|
|
1
|
+
import{c as Qs,d as Zs,hb as Vu,jb as Fu,ob as Ko,pb as ze,qb as Uo,sb as Wu,tb as Gu,ua as rn,ub as Ju,va as el,wa as Pu,ya as Iu}from"./chunk-W6XN463T.js";import"./chunk-3RZMLHCB.js";import"./chunk-JXKAISUX.js";import"./chunk-C4JCEMQN.js";import{A as on,B as Kr,C as q,D as oe,E as zu,G as Hu,K as rl,d as V,e as $u,f as ae,g as Ho,h as tl,i as Nn,j as Rn,k as _o,l as Bu,m as Dn,n as At,o as _t,p as ar,q as pt,r as wt,s as cr,t as Vo,u as jo,v as Fo,w as Q,x as nl,y as L,z as j}from"./chunk-KQR52I3G.js";import"./chunk-SNEZ3O5V.js";import"./chunk-77DN5DLU.js";import"./chunk-AIBH6MTQ.js";import"./chunk-4XYNKR7T.js";import"./chunk-354XB5AI.js";import{b as lr,c as Tu,d as Nu,e as Ru}from"./chunk-TRRO25IC.js";import{a as il,b as qo,c as Ku,e as Uu}from"./chunk-7G6RMB6W.js";import{a as hb,b as mb}from"./chunk-AW4RA5UH.js";import"./chunk-GLP5VV7P.js";import{a as _u}from"./chunk-5AW2WUSZ.js";import{a as Xu}from"./chunk-7NZRTGJL.js";import"./chunk-DG67SWQA.js";import"./chunk-KF47DKNH.js";import{b as ol,c as ju}from"./chunk-2YLUVQCJ.js";import{$a as Xs,A as sr,B as Po,Cb as Re,Db as qu,Ea as Ht,H as tu,Ha as Ks,I as nu,Ia as yu,K as ru,L as ou,N as iu,P as su,Pa as Us,Q as lu,Qa as qs,Ra as wu,S as au,Ua as ku,Wa as Gs,Xa as vu,Ya as Js,Za as Cu,_ as cu,_a as xu,a as Lo,aa as uu,ab as Mn,ba as du,bb as An,c as zt,ca as fu,cb as Su,da as pu,db as Tn,ea as Io,eb as Bo,ga as hu,gb as zo,hb as Eu,ib as Mu,ka as Fr,kb as Au,la as Fs,m as Xc,na as Ws,nb as Wr,o as Yc,ob as Fe,pb as Ys,q as Qc,r as js,s as Zc,sa as mu,ta as $o,ua as gu,vb as Du,wb as Ou,z as eu,za as bu,zb as Lu}from"./chunk-IJTLAUEC.js";import{a as Wo,f as ur}from"./chunk-J6IRWTF7.js";import{a as pb,c as pe}from"./chunk-DCANE7XH.js";var Sg=pb((ON,xg)=>{function dg(e){return e instanceof Map?e.clear=e.delete=e.set=function(){throw new Error("map is read-only")}:e instanceof Set&&(e.add=e.clear=e.delete=function(){throw new Error("set is read-only")}),Object.freeze(e),Object.getOwnPropertyNames(e).forEach(t=>{let n=e[t],r=typeof n;(r==="object"||r==="function")&&!Object.isFrozen(n)&&dg(n)}),e}var Rs=class{constructor(t){t.data===void 0&&(t.data={}),this.data=t.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}};function fg(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function yn(e,...t){let n=Object.create(null);for(let r in e)n[r]=e[r];return t.forEach(function(r){for(let o in r)n[o]=r[o]}),n}var vS="</span>",ig=e=>!!e.scope,CS=(e,{prefix:t})=>{if(e.startsWith("language:"))return e.replace("language:","language-");if(e.includes(".")){let n=e.split(".");return[`${t}${n.shift()}`,...n.map((r,o)=>`${r}${"_".repeat(o+1)}`)].join(" ")}return`${t}${e}`},Mc=class{constructor(t,n){this.buffer="",this.classPrefix=n.classPrefix,t.walk(this)}addText(t){this.buffer+=fg(t)}openNode(t){if(!ig(t))return;let n=CS(t.scope,{prefix:this.classPrefix});this.span(n)}closeNode(t){ig(t)&&(this.buffer+=vS)}value(){return this.buffer}span(t){this.buffer+=`<span class="${t}">`}},sg=(e={})=>{let t={children:[]};return Object.assign(t,e),t},Ac=class e{constructor(){this.rootNode=sg(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(t){this.top.children.push(t)}openNode(t){let n=sg({scope:t});this.add(n),this.stack.push(n)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(t){return this.constructor._walk(t,this.rootNode)}static _walk(t,n){return typeof n=="string"?t.addText(n):n.children&&(t.openNode(n),n.children.forEach(r=>this._walk(t,r)),t.closeNode(n)),t}static _collapse(t){typeof t!="string"&&t.children&&(t.children.every(n=>typeof n=="string")?t.children=[t.children.join("")]:t.children.forEach(n=>{e._collapse(n)}))}},Tc=class extends Ac{constructor(t){super(),this.options=t}addText(t){t!==""&&this.add(t)}startScope(t){this.openNode(t)}endScope(){this.closeNode()}__addSublanguage(t,n){let r=t.root;n&&(r.scope=`language:${n}`),this.add(r)}toHTML(){return new Mc(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}};function To(e){return e?typeof e=="string"?e:e.source:null}function pg(e){return nr("(?=",e,")")}function xS(e){return nr("(?:",e,")*")}function SS(e){return nr("(?:",e,")?")}function nr(...e){return e.map(n=>To(n)).join("")}function ES(e){let t=e[e.length-1];return typeof t=="object"&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function Os(...e){return"("+(ES(e).capture?"":"?:")+e.map(r=>To(r)).join("|")+")"}function hg(e){return new RegExp(e.toString()+"|").exec("").length-1}function MS(e,t){let n=e&&e.exec(t);return n&&n.index===0}var AS=new RegExp(Os(/\[(?:[^\\\]]|\\.)*\]/,/\(\?<(?![=!])[^>]+>/,/\(\?'[^']+'/,/\(\??/,/\\([1-9][0-9]*)/,/\\./));function Rc(e,{joinWith:t}){let n=0;return e.map(r=>{n+=1;let o=n,i=To(r),s="";for(;i.length>0;){let l=AS.exec(i);if(!l){s+=i;break}s+=i.substring(0,l.index),i=i.substring(l.index+l[0].length),l[0][0]==="\\"&&l[1]?s+="\\"+String(Number(l[1])+o):(s+=l[0],(l[0]==="("||/^\(\?[<']/.test(l[0]))&&n++)}return s}).map(r=>`(${r})`).join(t)}var TS=/\b\B/,mg="[a-zA-Z]\\w*",Dc="[a-zA-Z_]\\w*",gg="\\b\\d+(\\.\\d+)?",bg="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",yg="\\b(0b[01]+)",NS="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",RS=(e={})=>{let t=/^#![ ]*\//;return e.binary&&(e.begin=nr(t,/.*\b/,e.binary,/\b.*/)),yn({scope:"meta",begin:t,end:/$/,relevance:0,"on:begin":(n,r)=>{n.index!==0&&r.ignoreMatch()}},e)},No={begin:"\\\\[\\s\\S]",relevance:0},DS={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[No]},OS={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[No]},LS={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},Ls=function(e,t,n={}){let r=yn({scope:"comment",begin:e,end:t,contains:[]},n);r.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});let o=Os("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return r.contains.push({begin:nr(/[ ]+/,"(",o,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),r},PS=Ls("//","$"),IS=Ls("/\\*","\\*/"),$S=Ls("#","$"),BS={scope:"number",begin:gg,relevance:0},zS={scope:"number",begin:bg,relevance:0},HS={scope:"number",begin:yg,relevance:0},_S={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[No,{begin:/\[/,end:/\]/,relevance:0,contains:[No]}]},VS={scope:"title",begin:mg,relevance:0},jS={scope:"title",begin:Dc,relevance:0},FS={begin:"\\.\\s*"+Dc,relevance:0},WS=function(e){return Object.assign(e,{"on:begin":(t,n)=>{n.data._beginMatch=t[1]},"on:end":(t,n)=>{n.data._beginMatch!==t[1]&&n.ignoreMatch()}})},Ns=Object.freeze({__proto__:null,APOS_STRING_MODE:DS,BACKSLASH_ESCAPE:No,BINARY_NUMBER_MODE:HS,BINARY_NUMBER_RE:yg,COMMENT:Ls,C_BLOCK_COMMENT_MODE:IS,C_LINE_COMMENT_MODE:PS,C_NUMBER_MODE:zS,C_NUMBER_RE:bg,END_SAME_AS_BEGIN:WS,HASH_COMMENT_MODE:$S,IDENT_RE:mg,MATCH_NOTHING_RE:TS,METHOD_GUARD:FS,NUMBER_MODE:BS,NUMBER_RE:gg,PHRASAL_WORDS_MODE:LS,QUOTE_STRING_MODE:OS,REGEXP_MODE:_S,RE_STARTERS_RE:NS,SHEBANG:RS,TITLE_MODE:VS,UNDERSCORE_IDENT_RE:Dc,UNDERSCORE_TITLE_MODE:jS});function KS(e,t){e.input[e.index-1]==="."&&t.ignoreMatch()}function US(e,t){e.className!==void 0&&(e.scope=e.className,delete e.className)}function qS(e,t){t&&e.beginKeywords&&(e.begin="\\b("+e.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",e.__beforeBegin=KS,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords,e.relevance===void 0&&(e.relevance=0))}function GS(e,t){Array.isArray(e.illegal)&&(e.illegal=Os(...e.illegal))}function JS(e,t){if(e.match){if(e.begin||e.end)throw new Error("begin & end are not supported with match");e.begin=e.match,delete e.match}}function XS(e,t){e.relevance===void 0&&(e.relevance=1)}var YS=(e,t)=>{if(!e.beforeMatch)return;if(e.starts)throw new Error("beforeMatch cannot be used with starts");let n=Object.assign({},e);Object.keys(e).forEach(r=>{delete e[r]}),e.keywords=n.keywords,e.begin=nr(n.beforeMatch,pg(n.begin)),e.starts={relevance:0,contains:[Object.assign(n,{endsParent:!0})]},e.relevance=0,delete n.beforeMatch},QS=["of","and","for","in","not","or","if","then","parent","list","value"],ZS="keyword";function wg(e,t,n=ZS){let r=Object.create(null);return typeof e=="string"?o(n,e.split(" ")):Array.isArray(e)?o(n,e):Object.keys(e).forEach(function(i){Object.assign(r,wg(e[i],t,i))}),r;function o(i,s){t&&(s=s.map(l=>l.toLowerCase())),s.forEach(function(l){let a=l.split("|");r[a[0]]=[i,e1(a[0],a[1])]})}}function e1(e,t){return t?Number(t):t1(e)?0:1}function t1(e){return QS.includes(e.toLowerCase())}var lg={},tr=e=>{console.error(e)},ag=(e,...t)=>{console.log(`WARN: ${e}`,...t)},$r=(e,t)=>{lg[`${e}/${t}`]||(console.log(`Deprecated as of ${e}. ${t}`),lg[`${e}/${t}`]=!0)},Ds=new Error;function kg(e,t,{key:n}){let r=0,o=e[n],i={},s={};for(let l=1;l<=t.length;l++)s[l+r]=o[l],i[l+r]=!0,r+=hg(t[l-1]);e[n]=s,e[n]._emit=i,e[n]._multi=!0}function n1(e){if(Array.isArray(e.begin)){if(e.skip||e.excludeBegin||e.returnBegin)throw tr("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),Ds;if(typeof e.beginScope!="object"||e.beginScope===null)throw tr("beginScope must be object"),Ds;kg(e,e.begin,{key:"beginScope"}),e.begin=Rc(e.begin,{joinWith:""})}}function r1(e){if(Array.isArray(e.end)){if(e.skip||e.excludeEnd||e.returnEnd)throw tr("skip, excludeEnd, returnEnd not compatible with endScope: {}"),Ds;if(typeof e.endScope!="object"||e.endScope===null)throw tr("endScope must be object"),Ds;kg(e,e.end,{key:"endScope"}),e.end=Rc(e.end,{joinWith:""})}}function o1(e){e.scope&&typeof e.scope=="object"&&e.scope!==null&&(e.beginScope=e.scope,delete e.scope)}function i1(e){o1(e),typeof e.beginScope=="string"&&(e.beginScope={_wrap:e.beginScope}),typeof e.endScope=="string"&&(e.endScope={_wrap:e.endScope}),n1(e),r1(e)}function s1(e){function t(s,l){return new RegExp(To(s),"m"+(e.case_insensitive?"i":"")+(e.unicodeRegex?"u":"")+(l?"g":""))}class n{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(l,a){a.position=this.position++,this.matchIndexes[this.matchAt]=a,this.regexes.push([a,l]),this.matchAt+=hg(l)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);let l=this.regexes.map(a=>a[1]);this.matcherRe=t(Rc(l,{joinWith:"|"}),!0),this.lastIndex=0}exec(l){this.matcherRe.lastIndex=this.lastIndex;let a=this.matcherRe.exec(l);if(!a)return null;let u=a.findIndex((d,f)=>f>0&&d!==void 0),c=this.matchIndexes[u];return a.splice(0,u),Object.assign(a,c)}}class r{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(l){if(this.multiRegexes[l])return this.multiRegexes[l];let a=new n;return this.rules.slice(l).forEach(([u,c])=>a.addRule(u,c)),a.compile(),this.multiRegexes[l]=a,a}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(l,a){this.rules.push([l,a]),a.type==="begin"&&this.count++}exec(l){let a=this.getMatcher(this.regexIndex);a.lastIndex=this.lastIndex;let u=a.exec(l);if(this.resumingScanAtSamePosition()&&!(u&&u.index===this.lastIndex)){let c=this.getMatcher(0);c.lastIndex=this.lastIndex+1,u=c.exec(l)}return u&&(this.regexIndex+=u.position+1,this.regexIndex===this.count&&this.considerAll()),u}}function o(s){let l=new r;return s.contains.forEach(a=>l.addRule(a.begin,{rule:a,type:"begin"})),s.terminatorEnd&&l.addRule(s.terminatorEnd,{type:"end"}),s.illegal&&l.addRule(s.illegal,{type:"illegal"}),l}function i(s,l){let a=s;if(s.isCompiled)return a;[US,JS,i1,YS].forEach(c=>c(s,l)),e.compilerExtensions.forEach(c=>c(s,l)),s.__beforeBegin=null,[qS,GS,XS].forEach(c=>c(s,l)),s.isCompiled=!0;let u=null;return typeof s.keywords=="object"&&s.keywords.$pattern&&(s.keywords=Object.assign({},s.keywords),u=s.keywords.$pattern,delete s.keywords.$pattern),u=u||/\w+/,s.keywords&&(s.keywords=wg(s.keywords,e.case_insensitive)),a.keywordPatternRe=t(u,!0),l&&(s.begin||(s.begin=/\B|\b/),a.beginRe=t(a.begin),!s.end&&!s.endsWithParent&&(s.end=/\B|\b/),s.end&&(a.endRe=t(a.end)),a.terminatorEnd=To(a.end)||"",s.endsWithParent&&l.terminatorEnd&&(a.terminatorEnd+=(s.end?"|":"")+l.terminatorEnd)),s.illegal&&(a.illegalRe=t(s.illegal)),s.contains||(s.contains=[]),s.contains=[].concat(...s.contains.map(function(c){return l1(c==="self"?s:c)})),s.contains.forEach(function(c){i(c,a)}),s.starts&&i(s.starts,l),a.matcher=o(a),a}if(e.compilerExtensions||(e.compilerExtensions=[]),e.contains&&e.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return e.classNameAliases=yn(e.classNameAliases||{}),i(e)}function vg(e){return e?e.endsWithParent||vg(e.starts):!1}function l1(e){return e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map(function(t){return yn(e,{variants:null},t)})),e.cachedVariants?e.cachedVariants:vg(e)?yn(e,{starts:e.starts?yn(e.starts):null}):Object.isFrozen(e)?yn(e):e}var a1="11.12.0",Nc=class extends Error{constructor(t,n){super(t),this.name="HTMLInjectionError",this.html=n}},Ec=fg,cg=yn,ug=Symbol("nomatch"),c1=7,Cg=function(e){let t=Object.create(null),n=Object.create(null),r=[],o=!0,i="Could not find the language '{}', did you forget to load/include a language module?",s={disableAutodetect:!0,name:"Plain text",contains:[]},l={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:Tc};function a(N){return l.noHighlightRe.test(N)}function u(N){let _=N.className+" ";_+=N.parentNode?N.parentNode.className:"";let ee=l.languageDetectRe.exec(_);if(ee){let ue=O(ee[1]);return ue||(ag(i.replace("{}",ee[1])),ag("Falling back to no-highlight mode for this block.",N)),ue?ee[1]:"no-highlight"}return _.split(/\s+/).find(ue=>a(ue)||O(ue))}function c(N,_,ee){let ue="",Se="";typeof _=="object"?(ue=N,ee=_.ignoreIllegals,Se=_.language):($r("10.7.0","highlight(lang, code, ...args) has been deprecated."),$r("10.7.0",`Please use highlight(code, options) instead.
|
|
2
2
|
https://github.com/highlightjs/highlight.js/issues/2277`),Se=N,ue=_),ee===void 0&&(ee=!0);let Y={code:ue,language:Se};_e("before:highlight",Y);let Ve=Y.result?Y.result:d(Y.language,Y.code,ee);return Ve.code=Y.code,_e("after:highlight",Ve),Ve}function d(N,_,ee,ue){let Se=Object.create(null);function Y(D,z){return D.keywords[z]}function Ve(){if(!J.keywords){Ce.addText(ge);return}let D=0;J.keywordPatternRe.lastIndex=0;let z=J.keywordPatternRe.exec(ge),G="";for(;z;){G+=ge.substring(D,z.index);let be=U.case_insensitive?z[0].toLowerCase():z[0],w=Y(J,be);if(w){let[ft,or]=w;if(Ce.addText(G),G="",Se[be]=(Se[be]||0)+1,Se[be]<=c1&&(yt+=or),ft.startsWith("_"))G+=z[0];else{let Vr=U.classNameAliases[ft]||ft;je(z[0],Vr)}}else G+=z[0];D=J.keywordPatternRe.lastIndex,z=J.keywordPatternRe.exec(ge)}G+=ge.substring(D),Ce.addText(G)}function Ze(){if(ge==="")return;let D=null;if(typeof J.subLanguage=="string"){if(!t[J.subLanguage]){Ce.addText(ge);return}D=d(J.subLanguage,ge,!0,_r[J.subLanguage]),_r[J.subLanguage]=D._top}else D=p(ge,J.subLanguage.length?J.subLanguage:null);J.relevance>0&&(yt+=D.relevance),Ce.__addSublanguage(D._emitter,D.language)}function me(){J.subLanguage!=null?Ze():Ve(),ge=""}function je(D,z){D!==""&&(Ce.startScope(z),Ce.addText(D),Ce.endScope())}function zr(D,z){let G=1,be=z.length-1;for(;G<=be;){if(!D._emit[G]){G++;continue}let w=U.classNameAliases[D[G]]||D[G],ft=z[G];w?je(ft,w):(ge=ft,Ve(),ge=""),G++}}function wn(D,z){return D.scope&&typeof D.scope=="string"&&Ce.openNode(U.classNameAliases[D.scope]||D.scope),D.beginScope&&(D.beginScope._wrap?(je(ge,U.classNameAliases[D.beginScope._wrap]||D.beginScope._wrap),ge=""):D.beginScope._multi&&(zr(D.beginScope,z),ge="")),J=Object.create(D,{parent:{value:J}}),J}function Hr(D,z,G){let be=MS(D.endRe,G);if(be){if(D["on:end"]){let w=new Rs(D);D["on:end"](z,w),w.isMatchIgnored&&(be=!1)}if(be){for(;D.endsParent&&D.parent;)D=D.parent;return D}}if(D.endsWithParent)return Hr(D.parent,z,G)}function Ct(D){return J.matcher.regexIndex===0?(ge+=D[0],1):(Et=!0,0)}function Do(D){let z=D[0],G=D.rule,be=new Rs(G),w=[G.__beforeBegin,G["on:begin"]];for(let ft of w)if(ft&&(ft(D,be),be.isMatchIgnored))return Ct(z);return G.skip?ge+=z:(G.excludeBegin&&(ge+=z),me(),!G.returnBegin&&!G.excludeBegin&&(ge=z)),wn(G,D),G.returnBegin?0:z.length}function kn(D){let z=D[0],G=_.substring(D.index),be=Hr(J,D,G);if(!be)return ug;let w=J;J.endScope&&J.endScope._wrap?(me(),je(z,J.endScope._wrap)):J.endScope&&J.endScope._multi?(me(),zr(J.endScope,D)):w.skip?ge+=z:(w.returnEnd||w.excludeEnd||(ge+=z),me(),w.excludeEnd&&(ge=z));do J.scope&&Ce.closeNode(),!J.skip&&!J.subLanguage&&(yt+=J.relevance),J=J.parent;while(J!==be.parent);return be.starts&&wn(be.starts,D),w.returnEnd?0:z.length}function tn(){let D=[];for(let z=J;z!==U;z=z.parent)z.scope&&D.unshift(z.scope);D.forEach(z=>Ce.openNode(z))}let xt={};function at(D,z){let G=z&&z[0];if(ge+=D,G==null)return me(),0;if(xt.type==="begin"&&z.type==="end"&&xt.index===z.index&&G===""){if(ge+=_.slice(z.index,z.index+1),!o){let be=new Error(`0 width match regex (${N})`);throw be.languageName=N,be.badRule=xt.rule,be}return 1}if(xt=z,z.type==="begin")return Do(z);if(z.type==="illegal"&&!ee){let be=new Error('Illegal lexeme "'+G+'" for mode "'+(J.scope||"<unnamed>")+'"');throw be.mode=J,be}else if(z.type==="end"){let be=kn(z);if(be!==ug)return be}if(z.type==="illegal"&&G==="")return z.index===_.length||(ge+=`
|
|
3
3
|
`),1;if(et>1e5&&et>z.index*3)throw new Error("potential infinite loop, way more iterations than matches");return ge+=G,G.length}let U=O(N);if(!U)throw tr(i.replace("{}",N)),new Error('Unknown language: "'+N+'"');let Le=s1(U),St="",J=ue||Le,_r={},Ce=new l.__emitter(l);tn();let ge="",yt=0,qe=0,et=0,Et=!1;try{if(U.__emitTokens)U.__emitTokens(_,Ce);else{for(J.matcher.considerAll();;){et++,Et?Et=!1:J.matcher.considerAll(),J.matcher.lastIndex=qe;let D=J.matcher.exec(_);if(!D)break;let z=_.substring(qe,D.index),G=at(z,D);qe=D.index+G}at(_.substring(qe))}return Ce.finalize(),St=Ce.toHTML(),{language:N,value:St,relevance:yt,illegal:!1,_emitter:Ce,_top:J}}catch(D){if(D.message&&D.message.includes("Illegal"))return{language:N,value:Ec(_),illegal:!0,relevance:0,_illegalBy:{message:D.message,index:qe,context:_.slice(qe-100,qe+100),mode:D.mode,resultSoFar:St},_emitter:Ce};if(o)return{language:N,value:Ec(_),illegal:!1,relevance:0,errorRaised:D,_emitter:Ce,_top:J};throw D}}function f(N){let _={value:Ec(N),illegal:!1,relevance:0,_top:s,_emitter:new l.__emitter(l)};return _._emitter.addText(N),_}function p(N,_){_=_||l.languages||Object.keys(t);let ee=f(N),ue=_.filter(O).filter(he).map(me=>d(me,N,!1));ue.unshift(ee);let Se=ue.sort((me,je)=>{if(me.relevance!==je.relevance)return je.relevance-me.relevance;if(me.language&&je.language){if(O(me.language).supersetOf===je.language)return 1;if(O(je.language).supersetOf===me.language)return-1}return 0}),[Y,Ve]=Se,Ze=Y;return Ze.secondBest=Ve,Ze}function h(N,_,ee){let ue=_&&n[_]||ee;N.classList.add("hljs"),N.classList.add(`language-${ue}`)}function g(N){let _=null,ee=u(N);if(a(ee))return;if(_e("before:highlightElement",{el:N,language:ee}),N.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",N);return}if(N.children.length>0&&(l.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(N)),l.throwUnescapedHTML))throw new Nc("One of your code blocks includes unescaped HTML.",N.innerHTML);_=N;let ue=_.textContent,Se=ee?c(ue,{language:ee,ignoreIllegals:!0}):p(ue);N.innerHTML=Se.value,N.dataset.highlighted="yes",h(N,ee,Se.language),N.result={language:Se.language,re:Se.relevance,relevance:Se.relevance},Se.secondBest&&(N.secondBest={language:Se.secondBest.language,relevance:Se.secondBest.relevance}),_e("after:highlightElement",{el:N,result:Se,text:ue})}function m(N){l=cg(l,N)}let b=()=>{S(),$r("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function k(){S(),$r("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let C=!1;function S(){function N(){S()}if(document.readyState==="loading"){C||window.addEventListener("DOMContentLoaded",N,!1),C=!0;return}document.querySelectorAll(l.cssSelector).forEach(g)}function M(N,_){let ee=null;try{ee=_(e)}catch(ue){if(tr("Language definition for '{}' could not be registered.".replace("{}",N)),o)tr(ue);else throw ue;ee=s}ee.name||(ee.name=N),t[N]=ee,ee.rawDefinition=_.bind(null,e),ee.aliases&&X(ee.aliases,{languageName:N})}function T(N){delete t[N];for(let _ of Object.keys(n))n[_]===N&&delete n[_]}function E(){return Object.keys(t)}function O(N){return N=(N||"").toLowerCase(),t[N]||t[n[N]]}function X(N,{languageName:_}){typeof N=="string"&&(N=[N]),N.forEach(ee=>{n[ee.toLowerCase()]=_})}function he(N){let _=O(N);return _&&!_.disableAutodetect}function Ne(N){N["before:highlightBlock"]&&!N["before:highlightElement"]&&(N["before:highlightElement"]=_=>{N["before:highlightBlock"](Object.assign({block:_.el},_))}),N["after:highlightBlock"]&&!N["after:highlightElement"]&&(N["after:highlightElement"]=_=>{N["after:highlightBlock"](Object.assign({block:_.el},_))})}function $e(N){Ne(N),r.push(N)}function xe(N){let _=r.indexOf(N);_!==-1&&r.splice(_,1)}function _e(N,_){let ee=N;r.forEach(function(ue){ue[ee]&&ue[ee](_)})}function Me(N){return $r("10.7.0","highlightBlock will be removed entirely in v12.0"),$r("10.7.0","Please use highlightElement now."),g(N)}Object.assign(e,{highlight:c,highlightAuto:p,highlightAll:S,highlightElement:g,highlightBlock:Me,configure:m,initHighlighting:b,initHighlightingOnLoad:k,registerLanguage:M,unregisterLanguage:T,listLanguages:E,getLanguage:O,registerAliases:X,autoDetection:he,inherit:cg,addPlugin:$e,removePlugin:xe}),e.debugMode=function(){o=!1},e.safeMode=function(){o=!0},e.versionString=a1,e.regex={concat:nr,lookahead:pg,either:Os,optional:SS,anyNumberOfTimes:xS};for(let N in Ns)typeof Ns[N]=="object"&&dg(Ns[N]);return Object.assign(e,Ns),e},Br=Cg({});Br.newInstance=()=>Cg({});xg.exports=Br;Br.HighlightJS=Br;Br.default=Br});var Qu=pe(zt(),1);var Yu=Wo("primitives",{"zh-CN":{sharedData:"\u5171\u4EAB\u6570\u636E\u2026",imageFrame:"\u56FE\u7247",appearance:"\u5916\u89C2",color:"\u6587\u5B57\u989C\u8272",backgroundColor:"\u80CC\u666F\u989C\u8272",fontSize:"\u5B57\u53F7",padding:"\u5185\u8FB9\u8DDD",radius:"\u5706\u89D2",title:"\u6807\u9898",language:"\u8BED\u8A00",plainText:"\u7EAF\u6587\u672C",copy:"\u590D\u5236\u4EE3\u7801",copied:"\u5DF2\u590D\u5236",width:"\u5BBD\u5EA6",height:"\u9AD8\u5EA6",fit:"\u56FE\u7247\u9002\u914D",contain:"\u5B8C\u6574\u663E\u793A",cover:"\u88C1\u5207\u586B\u5145",addImage:"\u6DFB\u52A0\u56FE\u7247",editImage:"\u7F16\u8F91\u56FE\u7247",imageSrc:"\u56FE\u7247\u5730\u5740",imageAlt:"\u66FF\u4EE3\u6587\u5B57",imageCaption:"\u56FE\u6CE8",table:"\u57FA\u7840\u8868\u683C",scrollTable:"{title}\uFF1A\u5DE6\u53F3\u6EDA\u52A8\u67E5\u770B\u5168\u90E8\u5217",comparisonTable:"\u5BF9\u7167\u8868",columnName:"\u5217 {column} \u540D\u79F0",cell:"\u7B2C {row} \u884C\u7B2C {column} \u5217",addRow:"\u6DFB\u52A0\u884C",removeLastRow:"\u79FB\u9664\u672B\u884C",callout:"\u63D0\u793A\u6846",toggleSummary:"\u5C55\u5F00\u5185\u5BB9",code:"\u4EE3\u7801\u5757",codeContent:"\u4EE3\u7801\u5185\u5BB9"},en:{sharedData:"Shared data\u2026",imageFrame:"Image",appearance:"Appearance",color:"Text color",backgroundColor:"Background",fontSize:"Font size",padding:"Padding",radius:"Corner radius",title:"Title",language:"Language",plainText:"Plain text",copy:"Copy code",copied:"Copied",width:"Width",height:"Height",fit:"Image fit",contain:"Contain",cover:"Cover",addImage:"Add image",editImage:"Edit image",imageSrc:"Image URL",imageAlt:"Alt text",imageCaption:"Caption",table:"Basic table",scrollTable:"{title}: scroll sideways to see all columns",comparisonTable:"Comparison table",columnName:"Column {column} name",cell:"Row {row}, column {column}",addRow:"Add row",removeLastRow:"Remove last row",callout:"Callout",toggleSummary:"Show content",code:"Code block",codeContent:"Code"}});var ye=pe(Fe(),1),Zu="showai:shared-data";function gb(){if(typeof window>"u")return!1;let e=new CustomEvent(Zu,{cancelable:!0,detail:null});return window.dispatchEvent(e),e.defaultPrevented}function ed({editor:e,position:t,onDone:n}){let r=Re(Yu),[o,i]=(0,Qu.useState)(""),s=e.state.doc.nodeAt(t);if(!s||!e.isEditable)return null;let l=s.type.name,a=(p,h)=>{e.view.dispatch(e.state.tr.setNodeAttribute(t,p,h))},u=(p,h)=>(0,ye.jsxs)("label",{children:[h,(0,ye.jsx)("input",{value:s.attrs[p]??"",onChange:g=>a(p,g.target.value)})]},p),c=["image","table","codeBlock","callout","toggle","stepper","horizontalRule"].includes(l),d=s.attrs.componentStyle??{},f=(p,h)=>{let g={...d};h===void 0?delete g[p]:g[p]=h,a("componentStyle",g)};if(l==="widget"&&s.attrs.kind!=="text"&&gb()){let p=s.attrs.id,h=g=>{let m=-1;e.state.doc.descendants((b,k)=>(m<0&&b.attrs?.id===p&&(m=k),m<0)),m>=0&&e.view.dispatch(e.state.tr.setNodeAttribute(m,"data",g))};return(0,ye.jsxs)("button",{type:"button",onClick:()=>{window.dispatchEvent(new CustomEvent(Zu,{cancelable:!0,detail:{kind:s.attrs.kind,data:s.attrs.data,apply:h}})),n?.()},children:[(0,ye.jsx)(ou,{size:15}),r("sharedData")]})}return(0,ye.jsxs)("div",{className:"content-node-fields",children:[l==="image"&&(0,ye.jsxs)(ye.Fragment,{children:[u("src",r("imageSrc")),u("alt",r("imageAlt")),u("caption",r("imageCaption")),["width","height"].map(p=>(0,ye.jsxs)("label",{children:[r(p),(0,ye.jsx)("input",{inputMode:"decimal",value:s.attrs[p]??"",onChange:h=>{let g=h.target.value;(!g||/^\d+(?:px|%)?$/.test(g)&&parseInt(g)>0&&parseInt(g)<=1e4)&&a(p,g?/^\d+$/.test(g)?Number(g):g:null)}})]},p)),(0,ye.jsxs)("label",{children:[r("fit"),(0,ye.jsxs)("select",{value:s.attrs.fit??"contain",onChange:p=>a("fit",p.target.value),children:[(0,ye.jsx)("option",{value:"contain",children:r("contain")}),(0,ye.jsx)("option",{value:"cover",children:r("cover")})]})]})]}),["table","callout","toggle"].includes(l)&&u("title",r("title")),l==="codeBlock"&&(0,ye.jsxs)(ye.Fragment,{children:[(0,ye.jsxs)("label",{children:[r("language"),(0,ye.jsxs)("select",{value:qo(s.attrs.language),onChange:p=>a("language",p.target.value),children:[(0,ye.jsx)("option",{value:"plaintext",children:r("plainText")}),!il.includes(qo(s.attrs.language))&&(0,ye.jsxs)("option",{value:qo(s.attrs.language),children:[s.attrs.language,Ku(s.attrs.language)?"":` (${r("plainText")})`]}),il.filter(p=>p!=="plaintext").map(p=>(0,ye.jsx)("option",{value:p,children:p},p))]})]}),(0,ye.jsx)("button",{onClick:()=>{navigator.clipboard.writeText(s.textContent).then(()=>i(r("copied"))).catch(p=>i(p.message))},children:r("copy")}),o&&(0,ye.jsx)("span",{role:"status",children:o})]}),c&&(0,ye.jsxs)("details",{children:[(0,ye.jsx)("summary",{children:r("appearance")}),["color","backgroundColor"].map(p=>(0,ye.jsxs)("label",{children:[r(p),(0,ye.jsx)("input",{value:d[p]??"",onChange:h=>f(p,h.target.value||void 0)})]},p)),["fontSize","padding","radius"].map(p=>(0,ye.jsxs)("label",{children:[r(p),(0,ye.jsx)("input",{type:"number",min:p==="fontSize"?8:0,max:"200",value:d[p]??"",onChange:h=>{let g=h.target.value;(!g||Number(g)>=(p==="fontSize"?8:0)&&Number(g)<=200)&&f(p,g?Number(g):void 0)}})]},p))]})]})}var bb=new Set(["chart","database","metrics","playground","gallery","bookmark","references","video","audio","pdf","archify","diagram-design","fireworks-tech-graph"]),yb=new Set(["mindmap","flowchart","text"]);function td(e){return bb.has(e)||yb.has(e)||e.startsWith("g2-")}var Go=Wo("richTextNotes",{"zh-CN":{"format.note":"\u6CE8\u91CA","dialog.addNote":"\u6DFB\u52A0\u6CE8\u91CA","dialog.editNote":"\u4FEE\u6539\u6CE8\u91CA","dialog.noteText":"\u6CE8\u91CA\u5185\u5BB9\uFF08\u8BFB\u8005\u628A\u9F20\u6807\u79FB\u5230\u6240\u9009\u6587\u5B57\u4E0A\u65F6\u663E\u793A\uFF09","dialog.noteFormula":"\u6CE8\u91CA\u5185\u5BB9\uFF08\u8BFB\u8005\u628A\u9F20\u6807\u79FB\u5230\u8FD9\u4E2A\u516C\u5F0F\u4E0A\u65F6\u663E\u793A\uFF09","dialog.notePlaceholder":"\u4F8B\u5982\uFF1A\u7B2C t \u6B65\u7684\u5E26\u566A\u6F5C\u53D8\u91CF\uFF0C\u5F62\u72B6\u4E0E\u56FE\u50CF\u6F5C\u53D8\u91CF\u76F8\u540C","dialog.noteHint":"\u53EF\u7528 $\u2026$ \u5199\u516C\u5F0F\uFF1B\u53EA\u6CE8\u91CA\u516C\u5F0F\u4E2D\u7684\u67D0\u4E2A\u53D8\u91CF\u65F6\uFF0C\u5728\u516C\u5F0F\u6E90\u7801\u91CC\u5199 \\note{x_t}{\u2026}\u3002\u2318\u21A9 \u4FDD\u5B58\u3002","dialog.removeNote":"\u5220\u9664\u6CE8\u91CA","dialog.noteNeedsSelection":"\u5148\u9009\u4E2D\u8981\u52A0\u6CE8\u91CA\u7684\u6587\u5B57\u6216\u516C\u5F0F\u3002","dialog.noteTargetMissing":"\u8981\u6CE8\u91CA\u7684\u516C\u5F0F\u5DF2\u7ECF\u4E0D\u5728\u539F\u4F4D\u7F6E\uFF0C\u8BF7\u91CD\u65B0\u9009\u62E9\u3002","dialog.noteTooLong":"\u6CE8\u91CA\u6700\u591A {max} \u4E2A\u5B57\u7B26\u3002"},en:{"format.note":"Note","dialog.addNote":"Add note","dialog.editNote":"Edit note","dialog.noteText":"Note (shown when readers hover the selected text)","dialog.noteFormula":"Note (shown when readers hover this formula)","dialog.notePlaceholder":"For example: the noisy latent at step t, shaped like the image latent","dialog.noteHint":"Use $\u2026$ for formulas. To annotate one variable inside a formula, write \\note{x_t}{\u2026} in its source. \u2318\u21A9 saves.","dialog.removeNote":"Remove note","dialog.noteNeedsSelection":"Select the text or formula to annotate first.","dialog.noteTargetMissing":"The formula moved. Select it again.","dialog.noteTooLong":"Notes can have at most {max} characters."}});function nd(e,t){let n=e.cut(0,t).toJSON().content??[],r=e.cut(t).toJSON().content??[],o=l=>l?.type==="paragraph"&&!l.content?.length||l?.type==="richText"&&!Object.keys(l.attrs?.data??{}).length&&(l.content??[]).every(o);o(n.at(-1))&&n.pop(),o(r[0])&&r.shift();let i=new Set,s=l=>{let a=l.attrs?.id;a&&(i.has(a)&&(l.attrs={...l.attrs,id:crypto.randomUUID()}),i.add(l.attrs.id)),l.content?.forEach(s)};return n.forEach(s),r.forEach(s),{before:n,after:r}}var P=pe(zt(),1),Vc=pe(Ys(),1);var re=pe(zt(),1);var Ei=pe(Ys(),1),Yp=pe(hb(),1);var rd=Object.defineProperty,od=(e,t)=>{let n={};for(var r in e)rd(n,r,{get:e[r],enumerable:!0});return t||rd(n,Symbol.toStringTag,{value:"Module"}),n};var sd=(e,t)=>e.selection.empty?!1:(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function ld(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("backward",e):n.parentOffset>0)?null:n}var ll=(e,t,n)=>{let r=ld(e,n);if(!r)return!1;let o=cl(r);if(!o){let s=r.blockRange(),l=s&&_t(s);return l==null?!1:(t&&t(e.tr.lift(s,l).scrollIntoView()),!0)}let i=o.nodeBefore;if(gd(e,o,t,-1))return!0;if(r.parent.content.size==0&&(dr(i,"end")||j.isSelectable(i)))for(let s=r.depth;;s--){let l=jo(e.doc,r.before(s),r.after(s),ae.empty);if(l&&l.slice.size<l.to-l.from){if(t){let a=e.tr.step(l);a.setSelection(dr(i,"end")?Q.findFrom(a.doc.resolve(a.mapping.map(o.pos,-1)),-1):j.create(a.doc,o.pos-i.nodeSize)),t(a.scrollIntoView())}return!0}if(s==1||r.node(s-1).childCount>1)break}return i.isAtom&&o.depth==r.depth-1?(t&&t(e.tr.delete(o.pos-i.nodeSize,o.pos).scrollIntoView()),!0):!1},ad=(e,t,n)=>{let r=ld(e,n);if(!r)return!1;let o=cl(r);return o?ud(e,o,t):!1},cd=(e,t,n)=>{let r=dd(e,n);if(!r)return!1;let o=fl(r);return o?ud(e,o,t):!1};function ud(e,t,n){let r=t.nodeBefore,o=r,i=t.pos-1;for(;!o.isTextblock;i--){if(o.type.spec.isolating)return!1;let c=o.lastChild;if(!c)return!1;o=c}let s=t.nodeAfter,l=s,a=t.pos+1;for(;!l.isTextblock;a++){if(l.type.spec.isolating)return!1;let c=l.firstChild;if(!c)return!1;l=c}let u=jo(e.doc,i,a,ae.empty);if(!u||u.from!=i||u instanceof Dn&&u.slice.size>=a-i)return!1;if(n){let c=e.tr.step(u);c.setSelection(L.create(c.doc,i)),n(c.scrollIntoView())}return!0}function dr(e,t,n=!1){for(let r=e;r;r=t=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}var al=(e,t,n)=>{let{$head:r,empty:o}=e.selection,i=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",e):r.parentOffset>0)return!1;i=cl(r)}let s=i&&i.nodeBefore;return!s||!j.isSelectable(s)?!1:(t&&t(e.tr.setSelection(j.create(e.doc,i.pos-s.nodeSize)).scrollIntoView()),!0)};function cl(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){if(e.index(t)>0)return e.doc.resolve(e.before(t+1));if(e.node(t).type.spec.isolating)break}return null}function dd(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("forward",e):n.parentOffset<n.parent.content.size)?null:n}var ul=(e,t,n)=>{let r=dd(e,n);if(!r)return!1;let o=fl(r);if(!o)return!1;let i=o.nodeAfter;if(gd(e,o,t,1))return!0;if(r.parent.content.size==0&&(dr(i,"start")||j.isSelectable(i))){let s=jo(e.doc,r.before(),r.after(),ae.empty);if(s&&s.slice.size<s.to-s.from){if(t){let l=e.tr.step(s);l.setSelection(dr(i,"start")?Q.findFrom(l.doc.resolve(l.mapping.map(o.pos)),1):j.create(l.doc,l.mapping.map(o.pos))),t(l.scrollIntoView())}return!0}}return i.isAtom&&o.depth==r.depth-1?(t&&t(e.tr.delete(o.pos,o.pos+i.nodeSize).scrollIntoView()),!0):!1},dl=(e,t,n)=>{let{$head:r,empty:o}=e.selection,i=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",e):r.parentOffset<r.parent.content.size)return!1;i=fl(r)}let s=i&&i.nodeAfter;return!s||!j.isSelectable(s)?!1:(t&&t(e.tr.setSelection(j.create(e.doc,i.pos)).scrollIntoView()),!0)};function fl(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){let n=e.node(t);if(e.index(t)+1<n.childCount)return e.doc.resolve(e.after(t+1));if(n.type.spec.isolating)break}return null}var fd=(e,t)=>{let n=e.selection,r=n instanceof j,o;if(r){if(n.node.isTextblock||!wt(e.doc,n.from))return!1;o=n.from}else if(o=cr(e.doc,n.from,-1),o==null)return!1;if(t){let i=e.tr.join(o);r&&i.setSelection(j.create(i.doc,o-e.doc.resolve(o).nodeBefore.nodeSize)),t(i.scrollIntoView())}return!0},pd=(e,t)=>{let n=e.selection,r;if(n instanceof j){if(n.node.isTextblock||!wt(e.doc,n.to))return!1;r=n.to}else if(r=cr(e.doc,n.to,1),r==null)return!1;return t&&t(e.tr.join(r).scrollIntoView()),!0},hd=(e,t)=>{let{$from:n,$to:r}=e.selection,o=n.blockRange(r),i=o&&_t(o);return i==null?!1:(t&&t(e.tr.lift(o,i).scrollIntoView()),!0)},pl=(e,t)=>{let{$head:n,$anchor:r}=e.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(t&&t(e.tr.insertText(`
|
|
4
4
|
`).scrollIntoView()),!0)};function hl(e){for(let t=0;t<e.edgeCount;t++){let{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}var ml=(e,t)=>{let{$head:n,$anchor:r}=e.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let o=n.node(-1),i=n.indexAfter(-1),s=hl(o.contentMatchAt(i));if(!s||!o.canReplaceWith(i,i,s))return!1;if(t){let l=n.after(),a=e.tr.replaceWith(l,l,s.createAndFill());a.setSelection(Q.near(a.doc.resolve(l),1)),t(a.scrollIntoView())}return!0},gl=(e,t)=>{let n=e.selection,{$from:r,$to:o}=n;if(n instanceof on||r.parent.inlineContent||o.parent.inlineContent)return!1;let i=hl(o.parent.contentMatchAt(o.indexAfter()));if(!i||!i.isTextblock)return!1;if(t){let s=(!r.parentOffset&&o.index()<o.parent.childCount?r:o).pos,l=e.tr.insert(s,i.createAndFill());l.setSelection(L.create(l.doc,s+1)),t(l.scrollIntoView())}return!0},bl=(e,t)=>{let{$cursor:n}=e.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let i=n.before();if(pt(e.doc,i))return t&&t(e.tr.split(i).scrollIntoView()),!0}let r=n.blockRange(),o=r&&_t(r);return o==null?!1:(t&&t(e.tr.lift(r,o).scrollIntoView()),!0)};function wb(e){return(t,n)=>{if(t.selection instanceof j&&t.selection.node.isBlock){let{$from:p}=t.selection;return!p.parentOffset||!pt(t.doc,p.pos)?!1:(n&&n(t.tr.split(p.pos).scrollIntoView()),!0)}if(!t.selection.$from.depth)return!1;let r=t.tr;!t.selection.empty&&(t.selection instanceof L||t.selection instanceof on)&&r.deleteSelection();let{$from:o}=r.selection,i=r.steps.length,s=[],l,a,u=!1,c=!1;for(let p=o.depth;;p--)if(o.node(p).isBlock){u=o.end(p)==o.pos+(o.depth-p),c=o.start(p)==o.pos-(o.depth-p),a=hl(o.node(p-1).contentMatchAt(o.indexAfter(p-1)));let g=e&&e(o.parent,u,o);s.unshift(g||(u&&a?{type:a}:null)),l=p;break}else{if(p==1)return!1;s.unshift(null)}let d=o.pos,f=pt(r.doc,d,s.length,s);if(f||(s[0]=a?{type:a}:null,f=pt(r.doc,d,s.length,s)),!f)return!1;if(r.split(d,s.length,s),!u&&c&&o.node(l).type!=a){let p=r.mapping.slice(i),h=p.map(o.before(l)),g=r.doc.resolve(h);a&&o.node(l-1).canReplaceWith(g.index(),g.index()+1,a)&&r.setNodeMarkup(p.map(o.before(l)),a)}return n&&n(r.scrollIntoView()),!0}}var kb=wb();var md=(e,t)=>{let{$from:n,to:r}=e.selection,o,i=n.sharedDepth(r);return i==0?!1:(o=n.before(i),t&&t(e.tr.setSelection(j.create(e.doc,o))),!0)},vb=(e,t)=>(t&&t(e.tr.setSelection(new on(e.doc))),!0);function Cb(e,t,n){let r=t.nodeBefore,o=t.nodeAfter,i=t.index();return!r||!o||!r.type.compatibleContent(o.type)?!1:!r.content.size&&t.parent.canReplace(i-1,i)?(n&&n(e.tr.delete(t.pos-r.nodeSize,t.pos).scrollIntoView()),!0):!t.parent.canReplace(i,i+1)||!(o.isTextblock||wt(e.doc,t.pos))?!1:(n&&n(e.tr.join(t.pos).scrollIntoView()),!0)}function gd(e,t,n,r){let o=t.nodeBefore,i=t.nodeAfter,s,l,a=o.type.spec.isolating||i.type.spec.isolating;if(!a&&Cb(e,t,n))return!0;let u=!a&&t.parent.canReplace(t.index(),t.index()+1);if(u&&(s=(l=o.contentMatchAt(o.childCount)).findWrapping(i.type))&&l.matchType(s[0]||i.type).validEnd){if(n){let p=t.pos+i.nodeSize,h=V.empty;for(let b=s.length-1;b>=0;b--)h=V.from(s[b].create(null,h));h=V.from(o.copy(h));let g=e.tr.step(new At(t.pos-1,p,t.pos,p,new ae(h,1,0),s.length,!0)),m=g.doc.resolve(p+2*s.length);m.nodeAfter&&m.nodeAfter.type==o.type&&wt(g.doc,m.pos)&&g.join(m.pos),n(g.scrollIntoView())}return!0}let c=i.type.spec.isolating||r>0&&a?null:Q.findFrom(t,1),d=c&&c.$from.blockRange(c.$to),f=d&&_t(d);if(f!=null&&f>=t.depth)return n&&n(e.tr.lift(d,f).scrollIntoView()),!0;if(u&&dr(i,"start",!0)&&dr(o,"end")){let p=o,h=[];for(;h.push(p),!p.isTextblock;)p=p.lastChild;let g=i,m=1;for(;!g.isTextblock;g=g.firstChild)m++;if(p.canReplace(p.childCount,p.childCount,g.content)){if(n){let b=V.empty;for(let C=h.length-1;C>=0;C--)b=V.from(h[C].copy(b));let k=e.tr.step(new At(t.pos-h.length,t.pos+i.nodeSize,t.pos+m,t.pos+i.nodeSize-m,new ae(b,h.length,0),0,!0));n(k.scrollIntoView())}return!0}}return!1}function bd(e){return function(t,n){let r=t.selection,o=e<0?r.$from:r.$to,i=o.depth;for(;o.node(i).isInline;){if(!i)return!1;i--}return o.node(i).isTextblock?(n&&n(t.tr.setSelection(L.create(t.doc,e<0?o.start(i):o.end(i)))),!0):!1}}var yl=bd(-1),wl=bd(1);function yd(e,t=null){return function(n,r){let{$from:o,$to:i}=n.selection,s=o.blockRange(i),l=s&&ar(s,e,t);return l?(r&&r(n.tr.wrap(s,l).scrollIntoView()),!0):!1}}function kl(e,t=null){return function(n,r){let o=!1;for(let i=0;i<n.selection.ranges.length&&!o;i++){let{$from:{pos:s},$to:{pos:l}}=n.selection.ranges[i];n.doc.nodesBetween(s,l,(a,u)=>{if(o)return!1;if(!(!a.isTextblock||a.hasMarkup(e,t)))if(a.type==e)o=!0;else{let c=n.doc.resolve(u),d=c.index();o=c.parent.canReplaceWith(d,d+1,e)}})}if(!o)return!1;if(r){let i=n.tr;for(let s=0;s<n.selection.ranges.length;s++){let{$from:{pos:l},$to:{pos:a}}=n.selection.ranges[s];i.setBlockType(l,a,e,t)}r(i.scrollIntoView())}return!0}}function vl(...e){return function(t,n,r){for(let o=0;o<e.length;o++)if(e[o](t,n,r))return!0;return!1}}var sl=vl(sd,ll,al),id=vl(sd,ul,dl),sn={Enter:vl(pl,gl,bl,kb),"Mod-Enter":ml,Backspace:sl,"Mod-Backspace":sl,"Shift-Backspace":sl,Delete:id,"Mod-Delete":id,"Mod-a":vb},xb={"Ctrl-h":sn.Backspace,"Alt-Backspace":sn["Mod-Backspace"],"Ctrl-d":sn.Delete,"Ctrl-Alt-Backspace":sn["Mod-Delete"],"Alt-Delete":sn["Mod-Delete"],"Alt-d":sn["Mod-Delete"],"Ctrl-a":yl,"Ctrl-e":wl};for(let e in sn)xb[e]=sn[e];var bE=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform?os.platform()=="darwin":!1;function wd(e,t=null){return function(n,r){let{$from:o,$to:i}=n.selection,s=o.blockRange(i);if(!s)return!1;let l=r?n.tr:null;return Sb(l,s,e,t)?(r&&r(l.scrollIntoView()),!0):!1}}function Sb(e,t,n,r=null){let o=!1,i=t,s=t.$from.doc;if(t.depth>=2&&t.$from.node(t.depth-1).type.compatibleContent(n)&&t.startIndex==0){if(t.$from.index(t.depth-1)==0)return!1;let a=s.resolve(t.start-2);i=new Ho(a,a,t.depth),t.endIndex<t.parent.childCount&&(t=new Ho(t.$from,s.resolve(t.$to.end(t.depth)),t.depth)),o=!0}let l=ar(i,n,r,t);return l?(e&&Eb(e,t,l,o,n),!0):!1}function Eb(e,t,n,r,o){let i=V.empty;for(let c=n.length-1;c>=0;c--)i=V.from(n[c].type.create(n[c].attrs,i));e.step(new At(t.start-(r?2:0),t.end,t.start,t.end,new ae(i,0,0),n.length,!0));let s=0;for(let c=0;c<n.length;c++)n[c].type==o&&(s=c+1);let l=n.length-s,a=t.start+n.length-(r?2:0),u=t.parent;for(let c=t.startIndex,d=t.endIndex,f=!0;c<d;c++,f=!1)!f&&pt(e.doc,a,l)&&(e.split(a,l),a+=2*l),a+=u.child(c).nodeSize;return e}function kd(e){return function(t,n){let{$from:r,$to:o}=t.selection,i=r.blockRange(o,s=>s.childCount>0&&s.firstChild.type==e);return i?n?r.node(i.depth-1).type==e?Mb(t,n,e,i):Ab(t,n,i):!0:!1}}function Mb(e,t,n,r){let o=e.tr,i=r.end,s=r.$to.end(r.depth);i<s&&(o.step(new At(i-1,s,i,s,new ae(V.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new Ho(o.doc.resolve(r.$from.pos),o.doc.resolve(s),r.depth));let l=_t(r);if(l==null)return!1;o.lift(r,l);let a=o.doc.resolve(o.mapping.map(i,-1)-1);return wt(o.doc,a.pos)&&a.nodeBefore.type==a.nodeAfter.type&&o.join(a.pos),t(o.scrollIntoView()),!0}function Ab(e,t,n){let r=e.tr,o=n.parent;for(let p=n.end,h=n.endIndex-1,g=n.startIndex;h>g;h--)p-=o.child(h).nodeSize,r.delete(p-1,p+1);let i=r.doc.resolve(n.start),s=i.nodeAfter;if(r.mapping.map(n.end)!=n.start+i.nodeAfter.nodeSize)return!1;let l=n.startIndex==0,a=n.endIndex==o.childCount,u=i.node(-1),c=i.index(-1);if(!u.canReplace(c+(l?0:1),c+1,s.content.append(a?V.empty:V.from(o))))return!1;let d=i.pos,f=d+s.nodeSize;return r.step(new At(d-(l?1:0),f+(a?1:0),d+1,f-1,new ae((l?V.empty:V.from(o.copy(V.empty))).append(a?V.empty:V.from(o.copy(V.empty))),l?0:1,a?0:1),l?0:1)),t(r.scrollIntoView()),!0}function vd(e){return function(t,n){let{$from:r,$to:o}=t.selection,i=r.blockRange(o,u=>u.childCount>0&&u.firstChild.type==e);if(!i)return!1;let s=i.startIndex;if(s==0)return!1;let l=i.parent,a=l.child(s-1);if(a.type!=e)return!1;if(n){let u=a.lastChild&&a.lastChild.type==l.type,c=V.from(u?e.create():null),d=new ae(V.from(e.create(null,V.from(l.type.create(null,c)))),u?3:1,0),f=i.start,p=i.end;n(t.tr.step(new At(f-(u?3:1),p,f,p,d,1,!0)).scrollIntoView())}return!0}}var We=function(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t},mr=function(e){let t=e.assignedSlot||e.parentNode;return t&&t.nodeType==11?t.host:t},Ml=null,jt=function(e,t,n){let r=Ml||(Ml=document.createRange());return r.setEnd(e,n??e.nodeValue.length),r.setStart(e,t||0),r},Tb=function(){Ml=null},Hn=function(e,t,n,r){return n&&(Cd(e,t,n,r,-1)||Cd(e,t,n,r,1))},Nb=/^(img|br|input|textarea|hr)$/i;function Cd(e,t,n,r,o){for(var i;;){if(e==n&&t==r)return!0;if(t==(o<0?0:Je(e))){let s=e.parentNode;if(!s||!W(s)||eo(e)||Nb.test(e.nodeName)||e.contentEditable=="false")return!1;t=We(e)+(o<0?0:1),e=s}else if(W(e)){let s=e.childNodes[t+(o<0?-1:0)];if(W(s)&&s.contentEditable=="false")if(!((i=s.pmViewDesc)===null||i===void 0)&&i.ignoreForSelection)t+=o;else return!1;else e=s,t=o<0?Je(e):0}else return!1}}function Je(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function W(e){return e.nodeType==1}function Pe(e){return e.nodeType==3}function _n(e,t){return t?e.contains(W(t)?t:t.parentNode):!1}function Rb(e,t){for(;;){if(Pe(e)&&t)return e;if(W(e)&&t>0){if(e.contentEditable=="false")return null;e=e.childNodes[t-1],t=Je(e)}else if(e.parentNode&&!eo(e))t=We(e),e=e.parentNode;else return null}}function Db(e,t){for(;;){if(Pe(e)&&t<e.nodeValue.length)return e;if(W(e)&&t<e.childNodes.length){if(e.contentEditable=="false")return null;e=e.childNodes[t],t=0}else if(e.parentNode&&!eo(e))t=We(e)+1,e=e.parentNode;else return null}}function Ob(e,t,n){for(let r=t==0,o=t==Je(e);r||o;){if(e==n)return!0;let i=We(e);if(e=e.parentNode,!e)return!1;r=r&&i==0,o=o&&i==Je(e)}}function eo(e){let t;for(let n=e;n&&!(t=n.pmViewDesc);n=n.parentNode);return t&&t.node&&t.node.isBlock&&(t.dom==e||t.contentDOM==e)}var ii=function(e){return e.focusNode&&Hn(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function On(e,t){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=e,n.key=n.code=t,n}function Lb(e){let t=e.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}function Pb(e,t,n){if(e.caretPositionFromPoint)try{let r=e.caretPositionFromPoint(t,n);if(r)return{node:r.offsetNode,offset:Math.min(Je(r.offsetNode),r.offset)}}catch{}if(e.caretRangeFromPoint){let r=e.caretRangeFromPoint(t,n);if(r)return{node:r.startContainer,offset:Math.min(Je(r.startContainer),r.startOffset)}}}var Tt=typeof navigator<"u"?navigator:null,xd=typeof document<"u"?document:null,dn=Tt&&Tt.userAgent||"",Al=/Edge\/(\d+)/.exec(dn),Qd=/MSIE \d/.exec(dn),Tl=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(dn),it=!!(Qd||Tl||Al),cn=Qd?document.documentMode:Tl?+Tl[1]:Al?+Al[1]:0,ct=!it&&/gecko\/(\d+)/i.test(dn);ct&&+(/Firefox\/(\d+)/.exec(dn)||[0,0])[1];var Nl=!it&&/Chrome\/(\d+)/.exec(dn),Ke=!!Nl,Zd=Nl?+Nl[1]:0,Xe=!it&&!!Tt&&/Apple Computer/.test(Tt.vendor),gr=Xe&&(/Mobile\/\w+/.test(dn)||!!Tt&&Tt.maxTouchPoints>2),ht=gr||(Tt?/Mac/.test(Tt.platform):!1),ef=Tt?/Win/.test(Tt.platform):!1,Ft=/Android \d/.test(dn),si=!!xd&&"webkitFontSmoothing"in xd.documentElement.style,Ib=si?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function $b(e){let t=e.defaultView&&e.defaultView.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}function Vt(e,t){return typeof e=="number"?e:e[t]}function Bb(e){let t=e.getBoundingClientRect(),n=t.width/e.offsetWidth||1,r=t.height/e.offsetHeight||1;return{left:t.left,right:t.left+e.clientWidth*n,top:t.top,bottom:t.top+e.clientHeight*r}}function Sd(e,t,n){if(!Rl(t)&&t.left==0)return;let r=e.someProp("scrollThreshold")||0,o=e.someProp("scrollMargin")||5,i=e.dom.ownerDocument;for(let s=n||e.dom;s;){if(!W(s)){s=mr(s);continue}let l=s==i.body,a=l?$b(i):Bb(s),u=0,c=0;if(t.top<a.top+Vt(r,"top")?c=-(a.top-t.top+Vt(o,"top")):t.bottom>a.bottom-Vt(r,"bottom")&&(c=t.bottom-t.top>a.bottom-a.top?t.top+Vt(o,"top")-a.top:t.bottom-a.bottom+Vt(o,"bottom")),t.left<a.left+Vt(r,"left")?u=-(a.left-t.left+Vt(o,"left")):t.right>a.right-Vt(r,"right")&&(u=t.right-a.right+Vt(o,"right")),u||c)if(l)i.defaultView.scrollBy(u,c);else{let f=s.scrollLeft,p=s.scrollTop;c&&(s.scrollTop+=c),u&&(s.scrollLeft+=u);let h=s.scrollLeft-f,g=s.scrollTop-p;t={left:t.left-h,top:t.top-g,right:t.right-h,bottom:t.bottom-g}}let d=l?"fixed":getComputedStyle(s).position;if(/^(fixed|sticky)$/.test(d))break;s=d=="absolute"?s.offsetParent:mr(s)}}function zb(e){let t=e.dom.getBoundingClientRect(),n=Math.max(0,t.top),r,o;for(let i=(t.left+t.right)/2,s=n+1;s<Math.min(innerHeight,t.bottom);s+=5){let l=e.root.elementFromPoint(i,s);if(!l||l==e.dom||!e.dom.contains(l))continue;let a=l.getBoundingClientRect();if(a.top>=n-20){r=l,o=a.top;break}}return{refDOM:r,refTop:o,stack:tf(e.dom)}}function tf(e){let t=[],n=e.ownerDocument;for(let r=e;r&&(t.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),e!=n);r=mr(r));return t}function Hb({refDOM:e,refTop:t,stack:n}){let r=e?e.getBoundingClientRect().top:0;nf(n,r==0?0:r-t)}function nf(e,t){for(let n=0;n<e.length;n++){let{dom:r,top:o,left:i}=e[n];r.scrollTop!=o+t&&(r.scrollTop=o+t),r.scrollLeft!=i&&(r.scrollLeft=i)}}var fr=null;function _b(e){if(e.setActive)return e.setActive();if(fr)return e.focus(fr);let t=tf(e);e.focus(fr==null?{get preventScroll(){return fr={preventScroll:!0},!0}}:void 0),fr||(fr=!1,nf(t,0))}function rf(e,t){let n,r=2e8,o,i=0,s=t.top,l=t.top,a,u;for(let c=e.firstChild,d=0;c;c=c.nextSibling,d++){let f;if(W(c))f=c.getClientRects();else if(Pe(c))f=jt(c).getClientRects();else continue;for(let p=0;p<f.length;p++){let h=f[p];if(h.top<=s&&h.bottom>=l){s=Math.max(h.bottom,s),l=Math.min(h.top,l);let g=h.left>t.left?h.left-t.left:h.right<t.left?t.left-h.right:0;if(g<r){n=c,r=g,o=g&&Pe(n)?{left:h.right<t.left?h.right:h.left,top:t.top}:t,W(c)&&g&&(i=d+(t.left>=(h.left+h.right)/2?1:0));continue}}else h.top>t.top&&!a&&h.left<=t.left&&h.right>=t.left&&(a=c,u={left:Math.max(h.left,Math.min(h.right,t.left)),top:h.top});!n&&(t.left>=h.right&&t.top>=h.top||t.left>=h.left&&t.top>=h.bottom)&&(i=d+1)}}return!n&&a&&(n=a,o=u,r=0),n&&Pe(n)?Vb(n,o):!n||r?{node:e,offset:i}:rf(n,o)}function Vb(e,t){let n=e.nodeValue.length,r=document.createRange(),o;for(let i=0;i<n;i++){r.setEnd(e,i+1),r.setStart(e,i);let s=ln(r,1);if(s.top!=s.bottom&&Ul(t,s)){o={node:e,offset:i+(t.left>=(s.left+s.right)/2?1:0)};break}}return r.detach(),o||{node:e,offset:0}}function Ul(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function jb(e,t){let n=e.parentNode;return n&&/^li$/i.test(n.nodeName)&&t.left<e.getBoundingClientRect().left?n:e}function Fb(e,t,n){let{node:r,offset:o}=rf(t,n),i=-1;if(W(r)&&!r.firstChild){let s=r.getBoundingClientRect();i=s.left!=s.right&&n.left>(s.left+s.right)/2?1:-1}return e.docView.posFromDOM(r,o,i)}function Wb(e,t,n,r){let o=-1;for(let i=t,s=!1;i!=e.dom;){let l=e.docView.nearestDesc(i,!0),a;if(!l)return null;if(W(l.dom)&&(l.node.isBlock&&l.parent||!l.contentDOM)&&((a=l.dom.getBoundingClientRect()).width||a.height)&&(l.node.isBlock&&l.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(l.dom.nodeName)&&(!s&&a.left>r.left||a.top>r.top?o=l.posBefore:(!s&&a.right<r.left||a.bottom<r.top)&&(o=l.posAfter),s=!0),!l.contentDOM&&o<0&&!l.node.isText))return(l.node.isBlock?r.top<(a.top+a.bottom)/2:r.left<(a.left+a.right)/2)?l.posBefore:l.posAfter;i=l.dom.parentNode}return o>-1?o:e.docView.posFromDOM(t,n,-1)}function of(e,t,n){let r=e.childNodes.length;if(r&&n.top<n.bottom)for(let o=Math.max(0,Math.min(r-1,Math.floor(r*(t.top-n.top)/(n.bottom-n.top))-2)),i=o;;){let s=e.childNodes[i];if(W(s)){let l=s.getClientRects();for(let a=0;a<l.length;a++){let u=l[a];if(Ul(t,u))return of(s,t,u)}}if((i=(i+1)%r)==o)break}return e}function Kb(e,t){let n=e.dom.ownerDocument,r,o=0,i=Pb(n,t.left,t.top);i&&({node:r,offset:o}=i);let s=(e.root.elementFromPoint?e.root:n).elementFromPoint(t.left,t.top),l;if(!s||!e.dom.contains(s)){let u=e.dom.getBoundingClientRect();if(!Ul(t,u)||(s=of(e.dom,t,u),!s))return null}if(Xe)for(let u=s;r&&u;u=mr(u))u.draggable&&(r=void 0);if(s=jb(s,t),r){if(ct&&W(r)&&(o=Math.min(o,r.childNodes.length),o<r.childNodes.length)){let c=r.childNodes[o],d;c.nodeName=="IMG"&&(d=c.getBoundingClientRect()).right<=t.left&&d.bottom>t.top&&o++}let u;si&&o&&W(r)&&W(u=r.childNodes[o-1])&&u.contentEditable=="false"&&u.getBoundingClientRect().top>=t.top&&o--,r==e.dom&&o==r.childNodes.length-1&&W(r.lastChild)&&t.top>r.lastChild.getBoundingClientRect().bottom?l=e.state.doc.content.size:(o==0||!W(r)||r.childNodes[o-1].nodeName!="BR")&&(l=Wb(e,r,o,t))}l==null&&(l=Fb(e,s,t));let a=e.docView.nearestDesc(s,!0);return{pos:l,inside:a?a.posAtStart-a.border:-1}}function Rl(e){return e.top<e.bottom||e.left<e.right}function ln(e,t){let n=e.getClientRects();if(n.length){let r=n[t<0?0:n.length-1];if(Rl(r))return r}return Array.prototype.find.call(n,Rl)||e.getBoundingClientRect()}var Ub=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function sf(e,t,n){let{node:r,offset:o,atom:i}=e.docView.domFromPos(t,n<0?-1:1),s=si||ct;if(Pe(r))if(s&&(Ub.test(r.nodeValue)||(n<0?!o:o==r.nodeValue.length))){let a=ln(jt(r,o,o),n);if(ct&&o&&/\s/.test(r.nodeValue[o-1])&&o<r.nodeValue.length){let u=ln(jt(r,o-1,o-1),-1);if(u.top==a.top){let c=ln(jt(r,o,o+1),-1);if(c.top!=a.top)return Ur(c,c.left<u.left)}}return a}else{let a=o,u=o,c=n<0?1:-1;return n<0&&!o?(u++,c=-1):n>=0&&o==r.nodeValue.length?(a--,c=1):n<0?a--:u++,Ur(ln(jt(r,a,u),c),c<0)}if(!e.state.doc.resolve(t-(i||0)).parent.inlineContent){if(i==null&&o&&(n<0||o==Je(r))){let a=r.childNodes[o-1];if(W(a))return Cl(a.getBoundingClientRect(),!1)}if(i==null&&o<Je(r)){let a=r.childNodes[o];if(W(a))return Cl(a.getBoundingClientRect(),!0)}return Cl(r.getBoundingClientRect(),n>=0)}if(i==null&&o&&(n<0||o==Je(r))){let a=r.childNodes[o-1],u=Pe(a)?jt(a,Je(a)-(s?0:1)):W(a)&&(a.nodeName!="BR"||!a.nextSibling)?a:null;if(u)return Ur(ln(u,1),!1)}if(i==null&&o<Je(r)){let a=r.childNodes[o];for(;a.pmViewDesc&&a.pmViewDesc.ignoreForCoords;)a=a.nextSibling;let u=a?Pe(a)?jt(a,0,s?0:1):W(a)?a:null:null;if(u)return Ur(ln(u,-1),!0)}return Ur(ln(Pe(r)?jt(r):r,-n),n>=0)}function Ur(e,t){if(e.width==0)return e;let n=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:n,right:n}}function Cl(e,t){if(e.height==0)return e;let n=t?e.top:e.bottom;return{top:n,bottom:n,left:e.left,right:e.right}}function lf(e,t,n){let r=e.state,o=e.root.activeElement;r!=t&&e.updateState(t),o!=e.dom&&e.focus();try{return n()}finally{r!=t&&e.updateState(r),o!=e.dom&&o&&o.focus()}}function qb(e,t,n){let r=t.selection,o=n=="up"?r.$from:r.$to;return lf(e,t,()=>{let{node:i}=e.docView.domFromPos(o.pos,n=="up"?-1:1);for(;;){let l=e.docView.nearestDesc(i,!0);if(!l)break;if(l.node.isBlock){i=l.contentDOM||l.dom;break}i=l.dom.parentNode}let s=sf(e,o.pos,1);for(let l=i.firstChild;l;l=l.nextSibling){let a;if(W(l))a=l.getClientRects();else if(Pe(l))a=jt(l,0,l.nodeValue.length).getClientRects();else continue;for(let u=0;u<a.length;u++){let c=a[u];if(c.bottom>c.top+1&&(n=="up"?s.top-c.top>(c.bottom-s.top)*2:c.bottom-s.bottom>(s.bottom-c.top)*2))return!1}}return!0})}var Gb=/[\u0590-\u08ac]/;function Jb(e,t,n){let{$head:r}=t.selection;if(!r.parent.isTextblock)return!1;let o=r.parentOffset,i=!o,s=o==r.parent.content.size,l=e.domSelection();return l?!Gb.test(r.parent.textContent)||!l.modify?n=="left"||n=="backward"?i:s:lf(e,t,()=>{let{focusNode:a,focusOffset:u,anchorNode:c,anchorOffset:d}=e.domSelectionRange(),f=l.caretBidiLevel;l.modify("move",n,"character");let p=r.depth?e.docView.domAfterPos(r.before()):e.dom,{focusNode:h,focusOffset:g}=e.domSelectionRange(),m=h&&!_n(p,h)||a==h&&u==g;try{l.collapse(c,d),a&&(a!=c||u!=d)&&l.extend&&l.extend(a,u)}catch{}return f!=null&&(l.caretBidiLevel=f),m}):r.pos==r.start()||r.pos==r.end()}var Ed=null,Md=null,Ad=!1;function Xb(e,t,n){return Ed==t&&Md==n?Ad:(Ed=t,Md=n,Ad=n=="up"||n=="down"?qb(e,t,n):Jb(e,t,n))}var mt=0,Td=1,Ln=2,kt=3,Vn=class{constructor(t,n,r,o){this.parent=t,this.children=n,this.dom=r,this.contentDOM=o,this.dirty=mt,r.pmViewDesc=this}matchesWidget(t){return!1}matchesMark(t){return!1}matchesNode(t,n,r){return!1}matchesHack(t){return!1}parseRule(t){return null}stopEvent(t){return!1}get size(){let t=0;for(let n=0;n<this.children.length;n++)t+=this.children[n].size;return t}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let t=0;t<this.children.length;t++)this.children[t].destroy()}posBeforeChild(t){for(let n=0,r=this.posAtStart;;n++){let o=this.children[n];if(o==t)return r;r+=o.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(t,n,r){if(this.contentDOM&&_n(this.contentDOM,t))if(r<0){let i,s;if(t==this.contentDOM)i=t.childNodes[n-1];else{for(;t.parentNode!=this.contentDOM;)t=t.parentNode;i=t.previousSibling}for(;i&&!((s=i.pmViewDesc)&&s.parent==this);)i=i.previousSibling;return i?this.posBeforeChild(s)+s.size:this.posAtStart}else{let i,s;if(t==this.contentDOM)i=t.childNodes[n];else{for(;t.parentNode!=this.contentDOM;)t=t.parentNode;i=t.nextSibling}for(;i&&!((s=i.pmViewDesc)&&s.parent==this);)i=i.nextSibling;return i?this.posBeforeChild(s):this.posAtEnd}let o;if(t==this.dom&&this.contentDOM)o=n>We(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))o=!!(t.compareDocumentPosition(this.contentDOM)&4);else if(this.dom.firstChild){if(n==0)for(let i=t;;i=i.parentNode){if(i==this.dom){o=!1;break}if(i.previousSibling)break}if(o==null&&n==t.childNodes.length)for(let i=t;;i=i.parentNode){if(i==this.dom){o=!0;break}if(i.nextSibling)break}}return o??r>0?this.posAtEnd:this.posAtStart}nearestDesc(t,n=!1){for(let r=!0,o=t;o;o=o.parentNode){let i=this.getDesc(o),s;if(i&&(!n||i.node))if(r&&(s=i.nodeDOM)&&!(W(s)?_n(s,t):s==t))r=!1;else return i}}getDesc(t){let n=t.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(t,n,r){for(let o=t;o;o=o.parentNode){let i=this.getDesc(o);if(i)return i.localPosFromDOM(t,n,r)}return-1}descAt(t){for(let n=0,r=0;n<this.children.length;n++){let o=this.children[n],i=r+o.size;if(r==t&&i!=r){for(;!o.border&&o.children.length;)for(let s=0;s<o.children.length;s++){let l=o.children[s];if(l.size){o=l;break}}return o}if(t<i)return o.descAt(t-r-o.border);r=i}}domFromPos(t,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:t+1};let r=0,o=0;for(let i=0;r<this.children.length;r++){let s=this.children[r],l=i+s.size;if(l>t){o=t-i;break}i=l}if(o)return this.children[r].domFromPos(o-this.children[r].border,n);for(;r>0;r--){let i=this.children[r-1];if(i.size||!(i instanceof Yo||i instanceof Jo&&i.side>=0))break}if(n<=0){let i,s=!0;for(;i=r?this.children[r-1]:null,!(!i||i.dom.parentNode==this.contentDOM);r--,s=!1);return i&&n&&s&&!i.border&&!i.domAtom?i.domFromPos(i.size,n):{node:this.contentDOM,offset:i?We(i.dom)+1:0}}else{let i,s=!0;for(;i=r<this.children.length?this.children[r]:null,!(!i||i.dom.parentNode==this.contentDOM);r++,s=!1);return i&&s&&!i.border&&!i.domAtom?i.domFromPos(0,n):{node:this.contentDOM,offset:i?We(i.dom):this.contentDOM.childNodes.length}}}parseRange(t,n,r=0){if(this.children.length==0)return{node:this.contentDOM,from:t,to:n,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let o=-1,i=-1;for(let s=r,l=0;;l++){let a=this.children[l],u=s+a.size;if(o==-1&&t<=u){let c=s+a.border;if(t>=c&&n<=u-a.border&&a.node&&a.contentDOM&&this.contentDOM.contains(a.contentDOM))return a.parseRange(t,n,c);t=s;for(let d=l;d>0;d--){let f=this.children[d-1];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(1)){o=We(f.dom)+1;break}t-=f.size}o==-1&&(o=0)}if(o>-1&&(u>n||l==this.children.length-1)){n=u;for(let c=l+1;c<this.children.length;c++){let d=this.children[c];if(d.size&&d.dom.parentNode==this.contentDOM&&!d.emptyChildAt(-1)){i=We(d.dom);break}n+=d.size}i==-1&&(i=this.contentDOM.childNodes.length);break}s=u}return{node:this.contentDOM,from:t,to:n,fromOffset:o,toOffset:i}}emptyChildAt(t){if(this.border||!this.contentDOM||!this.children.length)return!1;let n=this.children[t<0?0:this.children.length-1];return n.size==0||n.emptyChildAt(t)}domAfterPos(t){let{node:n,offset:r}=this.domFromPos(t,0);if(!W(n)||r==n.childNodes.length)throw new RangeError("No node after pos "+t);return n.childNodes[r]}setSelection(t,n,r,o=!1){let i=Math.min(t,n),s=Math.max(t,n);for(let p=0,h=0;p<this.children.length;p++){let g=this.children[p],m=h+g.size;if(i>h&&s<m)return g.setSelection(t-h-g.border,n-h-g.border,r,o);h=m}let l=this.domFromPos(t,t?-1:1),a=n==t?l:this.domFromPos(n,n?-1:1),u=r.root.getSelection(),c=r.domSelectionRange(),d=!1;if((ct||Xe)&&t==n){let{node:p,offset:h}=l;if(Pe(p)){if(d=!!(h&&p.nodeValue[h-1]==`
|