var D0=Object.create;var Qa=Object.defineProperty;var L0=Object.getOwnPropertyDescriptor;var q0=Object.getOwnPropertyNames;var V0=Object.getPrototypeOf,$0=Object.prototype.hasOwnProperty;var Oi=(i=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(i,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):i)(function(i){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+i+'" is not supported')});var we=(i,e)=>()=>(e||i((e={exports:{}}).exports,e),e.exports),B0=(i,e)=>{for(var t in e)Qa(i,t,{get:e[t],enumerable:!0})},X0=(i,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of q0(e))!$0.call(i,n)&&n!==t&&Qa(i,n,{get:()=>e[n],enumerable:!(r=L0(e,n))||r.enumerable});return i};var Mu=(i,e,t)=>(t=i!=null?D0(V0(i)):{},X0(e||!i||!i.__esModule?Qa(t,"default",{value:i,enumerable:!0}):t,i));var XO=we((HC,Fk)=>{Fk.exports=`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-arrow-repeat" viewBox="0 0 16 16">
  <path d="M11.534 7h3.932a.25.25 0 0 1 .192.41l-1.966 2.36a.25.25 0 0 1-.384 0l-1.966-2.36a.25.25 0 0 1 .192-.41m-11 2h3.932a.25.25 0 0 0 .192-.41L2.692 6.23a.25.25 0 0 0-.384 0L.342 8.59A.25.25 0 0 0 .534 9"/>
  <path fill-rule="evenodd" d="M8 3c-1.552 0-2.94.707-3.857 1.818a.5.5 0 1 1-.771-.636A6.002 6.002 0 0 1 13.917 7H12.9A5 5 0 0 0 8 3M3.1 9a5.002 5.002 0 0 0 8.757 2.182.5.5 0 1 1 .771.636A6.002 6.002 0 0 1 2.083 9z"/>
</svg>`});var NO=we((GC,Hk)=>{Hk.exports=`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-exclamation-circle" viewBox="0 0 16 16">
  <path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14m0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16"/>
  <path d="M7.002 11a1 1 0 1 1 2 0 1 1 0 0 1-2 0M7.1 4.995a.905.905 0 1 1 1.8 0l-.35 3.507a.552.552 0 0 1-1.1 0z"/>
</svg>
`});var jO=we((YC,Gk)=>{Gk.exports=`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-lightbulb" viewBox="0 0 16 16">
  <path d="M2 6a6 6 0 1 1 10.174 4.31c-.203.196-.359.4-.453.619l-.762 1.769A.5.5 0 0 1 10.5 13a.5.5 0 0 1 0 1 .5.5 0 0 1 0 1l-.224.447a1 1 0 0 1-.894.553H6.618a1 1 0 0 1-.894-.553L5.5 15a.5.5 0 0 1 0-1 .5.5 0 0 1 0-1 .5.5 0 0 1-.46-.302l-.761-1.77a2 2 0 0 0-.453-.618A5.98 5.98 0 0 1 2 6m6-5a5 5 0 0 0-3.479 8.592c.263.254.514.564.676.941L5.83 12h4.342l.632-1.467c.162-.377.413-.687.676-.941A5 5 0 0 0 8 1"/>
</svg>`});var IO=we((ZC,Yk)=>{Yk.exports=`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-play" viewBox="0 0 16 16">
  <path d="M10.804 8 5 4.633v6.734zm.792-.696a.802.802 0 0 1 0 1.392l-6.363 3.692C4.713 12.69 4 12.345 4 11.692V4.308c0-.653.713-.998 1.233-.696z"/>
</svg>`});var Su=we((OE,eT)=>{eT.exports={Aacute:"\xC1",aacute:"\xE1",Abreve:"\u0102",abreve:"\u0103",ac:"\u223E",acd:"\u223F",acE:"\u223E\u0333",Acirc:"\xC2",acirc:"\xE2",acute:"\xB4",Acy:"\u0410",acy:"\u0430",AElig:"\xC6",aelig:"\xE6",af:"\u2061",Afr:"\u{1D504}",afr:"\u{1D51E}",Agrave:"\xC0",agrave:"\xE0",alefsym:"\u2135",aleph:"\u2135",Alpha:"\u0391",alpha:"\u03B1",Amacr:"\u0100",amacr:"\u0101",amalg:"\u2A3F",amp:"&",AMP:"&",andand:"\u2A55",And:"\u2A53",and:"\u2227",andd:"\u2A5C",andslope:"\u2A58",andv:"\u2A5A",ang:"\u2220",ange:"\u29A4",angle:"\u2220",angmsdaa:"\u29A8",angmsdab:"\u29A9",angmsdac:"\u29AA",angmsdad:"\u29AB",angmsdae:"\u29AC",angmsdaf:"\u29AD",angmsdag:"\u29AE",angmsdah:"\u29AF",angmsd:"\u2221",angrt:"\u221F",angrtvb:"\u22BE",angrtvbd:"\u299D",angsph:"\u2222",angst:"\xC5",angzarr:"\u237C",Aogon:"\u0104",aogon:"\u0105",Aopf:"\u{1D538}",aopf:"\u{1D552}",apacir:"\u2A6F",ap:"\u2248",apE:"\u2A70",ape:"\u224A",apid:"\u224B",apos:"'",ApplyFunction:"\u2061",approx:"\u2248",approxeq:"\u224A",Aring:"\xC5",aring:"\xE5",Ascr:"\u{1D49C}",ascr:"\u{1D4B6}",Assign:"\u2254",ast:"*",asymp:"\u2248",asympeq:"\u224D",Atilde:"\xC3",atilde:"\xE3",Auml:"\xC4",auml:"\xE4",awconint:"\u2233",awint:"\u2A11",backcong:"\u224C",backepsilon:"\u03F6",backprime:"\u2035",backsim:"\u223D",backsimeq:"\u22CD",Backslash:"\u2216",Barv:"\u2AE7",barvee:"\u22BD",barwed:"\u2305",Barwed:"\u2306",barwedge:"\u2305",bbrk:"\u23B5",bbrktbrk:"\u23B6",bcong:"\u224C",Bcy:"\u0411",bcy:"\u0431",bdquo:"\u201E",becaus:"\u2235",because:"\u2235",Because:"\u2235",bemptyv:"\u29B0",bepsi:"\u03F6",bernou:"\u212C",Bernoullis:"\u212C",Beta:"\u0392",beta:"\u03B2",beth:"\u2136",between:"\u226C",Bfr:"\u{1D505}",bfr:"\u{1D51F}",bigcap:"\u22C2",bigcirc:"\u25EF",bigcup:"\u22C3",bigodot:"\u2A00",bigoplus:"\u2A01",bigotimes:"\u2A02",bigsqcup:"\u2A06",bigstar:"\u2605",bigtriangledown:"\u25BD",bigtriangleup:"\u25B3",biguplus:"\u2A04",bigvee:"\u22C1",bigwedge:"\u22C0",bkarow:"\u290D",blacklozenge:"\u29EB",blacksquare:"\u25AA",blacktriangle:"\u25B4",blacktriangledown:"\u25BE",blacktriangleleft:"\u25C2",blacktriangleright:"\u25B8",blank:"\u2423",blk12:"\u2592",blk14:"\u2591",blk34:"\u2593",block:"\u2588",bne:"=\u20E5",bnequiv:"\u2261\u20E5",bNot:"\u2AED",bnot:"\u2310",Bopf:"\u{1D539}",bopf:"\u{1D553}",bot:"\u22A5",bottom:"\u22A5",bowtie:"\u22C8",boxbox:"\u29C9",boxdl:"\u2510",boxdL:"\u2555",boxDl:"\u2556",boxDL:"\u2557",boxdr:"\u250C",boxdR:"\u2552",boxDr:"\u2553",boxDR:"\u2554",boxh:"\u2500",boxH:"\u2550",boxhd:"\u252C",boxHd:"\u2564",boxhD:"\u2565",boxHD:"\u2566",boxhu:"\u2534",boxHu:"\u2567",boxhU:"\u2568",boxHU:"\u2569",boxminus:"\u229F",boxplus:"\u229E",boxtimes:"\u22A0",boxul:"\u2518",boxuL:"\u255B",boxUl:"\u255C",boxUL:"\u255D",boxur:"\u2514",boxuR:"\u2558",boxUr:"\u2559",boxUR:"\u255A",boxv:"\u2502",boxV:"\u2551",boxvh:"\u253C",boxvH:"\u256A",boxVh:"\u256B",boxVH:"\u256C",boxvl:"\u2524",boxvL:"\u2561",boxVl:"\u2562",boxVL:"\u2563",boxvr:"\u251C",boxvR:"\u255E",boxVr:"\u255F",boxVR:"\u2560",bprime:"\u2035",breve:"\u02D8",Breve:"\u02D8",brvbar:"\xA6",bscr:"\u{1D4B7}",Bscr:"\u212C",bsemi:"\u204F",bsim:"\u223D",bsime:"\u22CD",bsolb:"\u29C5",bsol:"\\",bsolhsub:"\u27C8",bull:"\u2022",bullet:"\u2022",bump:"\u224E",bumpE:"\u2AAE",bumpe:"\u224F",Bumpeq:"\u224E",bumpeq:"\u224F",Cacute:"\u0106",cacute:"\u0107",capand:"\u2A44",capbrcup:"\u2A49",capcap:"\u2A4B",cap:"\u2229",Cap:"\u22D2",capcup:"\u2A47",capdot:"\u2A40",CapitalDifferentialD:"\u2145",caps:"\u2229\uFE00",caret:"\u2041",caron:"\u02C7",Cayleys:"\u212D",ccaps:"\u2A4D",Ccaron:"\u010C",ccaron:"\u010D",Ccedil:"\xC7",ccedil:"\xE7",Ccirc:"\u0108",ccirc:"\u0109",Cconint:"\u2230",ccups:"\u2A4C",ccupssm:"\u2A50",Cdot:"\u010A",cdot:"\u010B",cedil:"\xB8",Cedilla:"\xB8",cemptyv:"\u29B2",cent:"\xA2",centerdot:"\xB7",CenterDot:"\xB7",cfr:"\u{1D520}",Cfr:"\u212D",CHcy:"\u0427",chcy:"\u0447",check:"\u2713",checkmark:"\u2713",Chi:"\u03A7",chi:"\u03C7",circ:"\u02C6",circeq:"\u2257",circlearrowleft:"\u21BA",circlearrowright:"\u21BB",circledast:"\u229B",circledcirc:"\u229A",circleddash:"\u229D",CircleDot:"\u2299",circledR:"\xAE",circledS:"\u24C8",CircleMinus:"\u2296",CirclePlus:"\u2295",CircleTimes:"\u2297",cir:"\u25CB",cirE:"\u29C3",cire:"\u2257",cirfnint:"\u2A10",cirmid:"\u2AEF",cirscir:"\u29C2",ClockwiseContourIntegral:"\u2232",CloseCurlyDoubleQuote:"\u201D",CloseCurlyQuote:"\u2019",clubs:"\u2663",clubsuit:"\u2663",colon:":",Colon:"\u2237",Colone:"\u2A74",colone:"\u2254",coloneq:"\u2254",comma:",",commat:"@",comp:"\u2201",compfn:"\u2218",complement:"\u2201",complexes:"\u2102",cong:"\u2245",congdot:"\u2A6D",Congruent:"\u2261",conint:"\u222E",Conint:"\u222F",ContourIntegral:"\u222E",copf:"\u{1D554}",Copf:"\u2102",coprod:"\u2210",Coproduct:"\u2210",copy:"\xA9",COPY:"\xA9",copysr:"\u2117",CounterClockwiseContourIntegral:"\u2233",crarr:"\u21B5",cross:"\u2717",Cross:"\u2A2F",Cscr:"\u{1D49E}",cscr:"\u{1D4B8}",csub:"\u2ACF",csube:"\u2AD1",csup:"\u2AD0",csupe:"\u2AD2",ctdot:"\u22EF",cudarrl:"\u2938",cudarrr:"\u2935",cuepr:"\u22DE",cuesc:"\u22DF",cularr:"\u21B6",cularrp:"\u293D",cupbrcap:"\u2A48",cupcap:"\u2A46",CupCap:"\u224D",cup:"\u222A",Cup:"\u22D3",cupcup:"\u2A4A",cupdot:"\u228D",cupor:"\u2A45",cups:"\u222A\uFE00",curarr:"\u21B7",curarrm:"\u293C",curlyeqprec:"\u22DE",curlyeqsucc:"\u22DF",curlyvee:"\u22CE",curlywedge:"\u22CF",curren:"\xA4",curvearrowleft:"\u21B6",curvearrowright:"\u21B7",cuvee:"\u22CE",cuwed:"\u22CF",cwconint:"\u2232",cwint:"\u2231",cylcty:"\u232D",dagger:"\u2020",Dagger:"\u2021",daleth:"\u2138",darr:"\u2193",Darr:"\u21A1",dArr:"\u21D3",dash:"\u2010",Dashv:"\u2AE4",dashv:"\u22A3",dbkarow:"\u290F",dblac:"\u02DD",Dcaron:"\u010E",dcaron:"\u010F",Dcy:"\u0414",dcy:"\u0434",ddagger:"\u2021",ddarr:"\u21CA",DD:"\u2145",dd:"\u2146",DDotrahd:"\u2911",ddotseq:"\u2A77",deg:"\xB0",Del:"\u2207",Delta:"\u0394",delta:"\u03B4",demptyv:"\u29B1",dfisht:"\u297F",Dfr:"\u{1D507}",dfr:"\u{1D521}",dHar:"\u2965",dharl:"\u21C3",dharr:"\u21C2",DiacriticalAcute:"\xB4",DiacriticalDot:"\u02D9",DiacriticalDoubleAcute:"\u02DD",DiacriticalGrave:"`",DiacriticalTilde:"\u02DC",diam:"\u22C4",diamond:"\u22C4",Diamond:"\u22C4",diamondsuit:"\u2666",diams:"\u2666",die:"\xA8",DifferentialD:"\u2146",digamma:"\u03DD",disin:"\u22F2",div:"\xF7",divide:"\xF7",divideontimes:"\u22C7",divonx:"\u22C7",DJcy:"\u0402",djcy:"\u0452",dlcorn:"\u231E",dlcrop:"\u230D",dollar:"$",Dopf:"\u{1D53B}",dopf:"\u{1D555}",Dot:"\xA8",dot:"\u02D9",DotDot:"\u20DC",doteq:"\u2250",doteqdot:"\u2251",DotEqual:"\u2250",dotminus:"\u2238",dotplus:"\u2214",dotsquare:"\u22A1",doublebarwedge:"\u2306",DoubleContourIntegral:"\u222F",DoubleDot:"\xA8",DoubleDownArrow:"\u21D3",DoubleLeftArrow:"\u21D0",DoubleLeftRightArrow:"\u21D4",DoubleLeftTee:"\u2AE4",DoubleLongLeftArrow:"\u27F8",DoubleLongLeftRightArrow:"\u27FA",DoubleLongRightArrow:"\u27F9",DoubleRightArrow:"\u21D2",DoubleRightTee:"\u22A8",DoubleUpArrow:"\u21D1",DoubleUpDownArrow:"\u21D5",DoubleVerticalBar:"\u2225",DownArrowBar:"\u2913",downarrow:"\u2193",DownArrow:"\u2193",Downarrow:"\u21D3",DownArrowUpArrow:"\u21F5",DownBreve:"\u0311",downdownarrows:"\u21CA",downharpoonleft:"\u21C3",downharpoonright:"\u21C2",DownLeftRightVector:"\u2950",DownLeftTeeVector:"\u295E",DownLeftVectorBar:"\u2956",DownLeftVector:"\u21BD",DownRightTeeVector:"\u295F",DownRightVectorBar:"\u2957",DownRightVector:"\u21C1",DownTeeArrow:"\u21A7",DownTee:"\u22A4",drbkarow:"\u2910",drcorn:"\u231F",drcrop:"\u230C",Dscr:"\u{1D49F}",dscr:"\u{1D4B9}",DScy:"\u0405",dscy:"\u0455",dsol:"\u29F6",Dstrok:"\u0110",dstrok:"\u0111",dtdot:"\u22F1",dtri:"\u25BF",dtrif:"\u25BE",duarr:"\u21F5",duhar:"\u296F",dwangle:"\u29A6",DZcy:"\u040F",dzcy:"\u045F",dzigrarr:"\u27FF",Eacute:"\xC9",eacute:"\xE9",easter:"\u2A6E",Ecaron:"\u011A",ecaron:"\u011B",Ecirc:"\xCA",ecirc:"\xEA",ecir:"\u2256",ecolon:"\u2255",Ecy:"\u042D",ecy:"\u044D",eDDot:"\u2A77",Edot:"\u0116",edot:"\u0117",eDot:"\u2251",ee:"\u2147",efDot:"\u2252",Efr:"\u{1D508}",efr:"\u{1D522}",eg:"\u2A9A",Egrave:"\xC8",egrave:"\xE8",egs:"\u2A96",egsdot:"\u2A98",el:"\u2A99",Element:"\u2208",elinters:"\u23E7",ell:"\u2113",els:"\u2A95",elsdot:"\u2A97",Emacr:"\u0112",emacr:"\u0113",empty:"\u2205",emptyset:"\u2205",EmptySmallSquare:"\u25FB",emptyv:"\u2205",EmptyVerySmallSquare:"\u25AB",emsp13:"\u2004",emsp14:"\u2005",emsp:"\u2003",ENG:"\u014A",eng:"\u014B",ensp:"\u2002",Eogon:"\u0118",eogon:"\u0119",Eopf:"\u{1D53C}",eopf:"\u{1D556}",epar:"\u22D5",eparsl:"\u29E3",eplus:"\u2A71",epsi:"\u03B5",Epsilon:"\u0395",epsilon:"\u03B5",epsiv:"\u03F5",eqcirc:"\u2256",eqcolon:"\u2255",eqsim:"\u2242",eqslantgtr:"\u2A96",eqslantless:"\u2A95",Equal:"\u2A75",equals:"=",EqualTilde:"\u2242",equest:"\u225F",Equilibrium:"\u21CC",equiv:"\u2261",equivDD:"\u2A78",eqvparsl:"\u29E5",erarr:"\u2971",erDot:"\u2253",escr:"\u212F",Escr:"\u2130",esdot:"\u2250",Esim:"\u2A73",esim:"\u2242",Eta:"\u0397",eta:"\u03B7",ETH:"\xD0",eth:"\xF0",Euml:"\xCB",euml:"\xEB",euro:"\u20AC",excl:"!",exist:"\u2203",Exists:"\u2203",expectation:"\u2130",exponentiale:"\u2147",ExponentialE:"\u2147",fallingdotseq:"\u2252",Fcy:"\u0424",fcy:"\u0444",female:"\u2640",ffilig:"\uFB03",fflig:"\uFB00",ffllig:"\uFB04",Ffr:"\u{1D509}",ffr:"\u{1D523}",filig:"\uFB01",FilledSmallSquare:"\u25FC",FilledVerySmallSquare:"\u25AA",fjlig:"fj",flat:"\u266D",fllig:"\uFB02",fltns:"\u25B1",fnof:"\u0192",Fopf:"\u{1D53D}",fopf:"\u{1D557}",forall:"\u2200",ForAll:"\u2200",fork:"\u22D4",forkv:"\u2AD9",Fouriertrf:"\u2131",fpartint:"\u2A0D",frac12:"\xBD",frac13:"\u2153",frac14:"\xBC",frac15:"\u2155",frac16:"\u2159",frac18:"\u215B",frac23:"\u2154",frac25:"\u2156",frac34:"\xBE",frac35:"\u2157",frac38:"\u215C",frac45:"\u2158",frac56:"\u215A",frac58:"\u215D",frac78:"\u215E",frasl:"\u2044",frown:"\u2322",fscr:"\u{1D4BB}",Fscr:"\u2131",gacute:"\u01F5",Gamma:"\u0393",gamma:"\u03B3",Gammad:"\u03DC",gammad:"\u03DD",gap:"\u2A86",Gbreve:"\u011E",gbreve:"\u011F",Gcedil:"\u0122",Gcirc:"\u011C",gcirc:"\u011D",Gcy:"\u0413",gcy:"\u0433",Gdot:"\u0120",gdot:"\u0121",ge:"\u2265",gE:"\u2267",gEl:"\u2A8C",gel:"\u22DB",geq:"\u2265",geqq:"\u2267",geqslant:"\u2A7E",gescc:"\u2AA9",ges:"\u2A7E",gesdot:"\u2A80",gesdoto:"\u2A82",gesdotol:"\u2A84",gesl:"\u22DB\uFE00",gesles:"\u2A94",Gfr:"\u{1D50A}",gfr:"\u{1D524}",gg:"\u226B",Gg:"\u22D9",ggg:"\u22D9",gimel:"\u2137",GJcy:"\u0403",gjcy:"\u0453",gla:"\u2AA5",gl:"\u2277",glE:"\u2A92",glj:"\u2AA4",gnap:"\u2A8A",gnapprox:"\u2A8A",gne:"\u2A88",gnE:"\u2269",gneq:"\u2A88",gneqq:"\u2269",gnsim:"\u22E7",Gopf:"\u{1D53E}",gopf:"\u{1D558}",grave:"`",GreaterEqual:"\u2265",GreaterEqualLess:"\u22DB",GreaterFullEqual:"\u2267",GreaterGreater:"\u2AA2",GreaterLess:"\u2277",GreaterSlantEqual:"\u2A7E",GreaterTilde:"\u2273",Gscr:"\u{1D4A2}",gscr:"\u210A",gsim:"\u2273",gsime:"\u2A8E",gsiml:"\u2A90",gtcc:"\u2AA7",gtcir:"\u2A7A",gt:">",GT:">",Gt:"\u226B",gtdot:"\u22D7",gtlPar:"\u2995",gtquest:"\u2A7C",gtrapprox:"\u2A86",gtrarr:"\u2978",gtrdot:"\u22D7",gtreqless:"\u22DB",gtreqqless:"\u2A8C",gtrless:"\u2277",gtrsim:"\u2273",gvertneqq:"\u2269\uFE00",gvnE:"\u2269\uFE00",Hacek:"\u02C7",hairsp:"\u200A",half:"\xBD",hamilt:"\u210B",HARDcy:"\u042A",hardcy:"\u044A",harrcir:"\u2948",harr:"\u2194",hArr:"\u21D4",harrw:"\u21AD",Hat:"^",hbar:"\u210F",Hcirc:"\u0124",hcirc:"\u0125",hearts:"\u2665",heartsuit:"\u2665",hellip:"\u2026",hercon:"\u22B9",hfr:"\u{1D525}",Hfr:"\u210C",HilbertSpace:"\u210B",hksearow:"\u2925",hkswarow:"\u2926",hoarr:"\u21FF",homtht:"\u223B",hookleftarrow:"\u21A9",hookrightarrow:"\u21AA",hopf:"\u{1D559}",Hopf:"\u210D",horbar:"\u2015",HorizontalLine:"\u2500",hscr:"\u{1D4BD}",Hscr:"\u210B",hslash:"\u210F",Hstrok:"\u0126",hstrok:"\u0127",HumpDownHump:"\u224E",HumpEqual:"\u224F",hybull:"\u2043",hyphen:"\u2010",Iacute:"\xCD",iacute:"\xED",ic:"\u2063",Icirc:"\xCE",icirc:"\xEE",Icy:"\u0418",icy:"\u0438",Idot:"\u0130",IEcy:"\u0415",iecy:"\u0435",iexcl:"\xA1",iff:"\u21D4",ifr:"\u{1D526}",Ifr:"\u2111",Igrave:"\xCC",igrave:"\xEC",ii:"\u2148",iiiint:"\u2A0C",iiint:"\u222D",iinfin:"\u29DC",iiota:"\u2129",IJlig:"\u0132",ijlig:"\u0133",Imacr:"\u012A",imacr:"\u012B",image:"\u2111",ImaginaryI:"\u2148",imagline:"\u2110",imagpart:"\u2111",imath:"\u0131",Im:"\u2111",imof:"\u22B7",imped:"\u01B5",Implies:"\u21D2",incare:"\u2105",in:"\u2208",infin:"\u221E",infintie:"\u29DD",inodot:"\u0131",intcal:"\u22BA",int:"\u222B",Int:"\u222C",integers:"\u2124",Integral:"\u222B",intercal:"\u22BA",Intersection:"\u22C2",intlarhk:"\u2A17",intprod:"\u2A3C",InvisibleComma:"\u2063",InvisibleTimes:"\u2062",IOcy:"\u0401",iocy:"\u0451",Iogon:"\u012E",iogon:"\u012F",Iopf:"\u{1D540}",iopf:"\u{1D55A}",Iota:"\u0399",iota:"\u03B9",iprod:"\u2A3C",iquest:"\xBF",iscr:"\u{1D4BE}",Iscr:"\u2110",isin:"\u2208",isindot:"\u22F5",isinE:"\u22F9",isins:"\u22F4",isinsv:"\u22F3",isinv:"\u2208",it:"\u2062",Itilde:"\u0128",itilde:"\u0129",Iukcy:"\u0406",iukcy:"\u0456",Iuml:"\xCF",iuml:"\xEF",Jcirc:"\u0134",jcirc:"\u0135",Jcy:"\u0419",jcy:"\u0439",Jfr:"\u{1D50D}",jfr:"\u{1D527}",jmath:"\u0237",Jopf:"\u{1D541}",jopf:"\u{1D55B}",Jscr:"\u{1D4A5}",jscr:"\u{1D4BF}",Jsercy:"\u0408",jsercy:"\u0458",Jukcy:"\u0404",jukcy:"\u0454",Kappa:"\u039A",kappa:"\u03BA",kappav:"\u03F0",Kcedil:"\u0136",kcedil:"\u0137",Kcy:"\u041A",kcy:"\u043A",Kfr:"\u{1D50E}",kfr:"\u{1D528}",kgreen:"\u0138",KHcy:"\u0425",khcy:"\u0445",KJcy:"\u040C",kjcy:"\u045C",Kopf:"\u{1D542}",kopf:"\u{1D55C}",Kscr:"\u{1D4A6}",kscr:"\u{1D4C0}",lAarr:"\u21DA",Lacute:"\u0139",lacute:"\u013A",laemptyv:"\u29B4",lagran:"\u2112",Lambda:"\u039B",lambda:"\u03BB",lang:"\u27E8",Lang:"\u27EA",langd:"\u2991",langle:"\u27E8",lap:"\u2A85",Laplacetrf:"\u2112",laquo:"\xAB",larrb:"\u21E4",larrbfs:"\u291F",larr:"\u2190",Larr:"\u219E",lArr:"\u21D0",larrfs:"\u291D",larrhk:"\u21A9",larrlp:"\u21AB",larrpl:"\u2939",larrsim:"\u2973",larrtl:"\u21A2",latail:"\u2919",lAtail:"\u291B",lat:"\u2AAB",late:"\u2AAD",lates:"\u2AAD\uFE00",lbarr:"\u290C",lBarr:"\u290E",lbbrk:"\u2772",lbrace:"{",lbrack:"[",lbrke:"\u298B",lbrksld:"\u298F",lbrkslu:"\u298D",Lcaron:"\u013D",lcaron:"\u013E",Lcedil:"\u013B",lcedil:"\u013C",lceil:"\u2308",lcub:"{",Lcy:"\u041B",lcy:"\u043B",ldca:"\u2936",ldquo:"\u201C",ldquor:"\u201E",ldrdhar:"\u2967",ldrushar:"\u294B",ldsh:"\u21B2",le:"\u2264",lE:"\u2266",LeftAngleBracket:"\u27E8",LeftArrowBar:"\u21E4",leftarrow:"\u2190",LeftArrow:"\u2190",Leftarrow:"\u21D0",LeftArrowRightArrow:"\u21C6",leftarrowtail:"\u21A2",LeftCeiling:"\u2308",LeftDoubleBracket:"\u27E6",LeftDownTeeVector:"\u2961",LeftDownVectorBar:"\u2959",LeftDownVector:"\u21C3",LeftFloor:"\u230A",leftharpoondown:"\u21BD",leftharpoonup:"\u21BC",leftleftarrows:"\u21C7",leftrightarrow:"\u2194",LeftRightArrow:"\u2194",Leftrightarrow:"\u21D4",leftrightarrows:"\u21C6",leftrightharpoons:"\u21CB",leftrightsquigarrow:"\u21AD",LeftRightVector:"\u294E",LeftTeeArrow:"\u21A4",LeftTee:"\u22A3",LeftTeeVector:"\u295A",leftthreetimes:"\u22CB",LeftTriangleBar:"\u29CF",LeftTriangle:"\u22B2",LeftTriangleEqual:"\u22B4",LeftUpDownVector:"\u2951",LeftUpTeeVector:"\u2960",LeftUpVectorBar:"\u2958",LeftUpVector:"\u21BF",LeftVectorBar:"\u2952",LeftVector:"\u21BC",lEg:"\u2A8B",leg:"\u22DA",leq:"\u2264",leqq:"\u2266",leqslant:"\u2A7D",lescc:"\u2AA8",les:"\u2A7D",lesdot:"\u2A7F",lesdoto:"\u2A81",lesdotor:"\u2A83",lesg:"\u22DA\uFE00",lesges:"\u2A93",lessapprox:"\u2A85",lessdot:"\u22D6",lesseqgtr:"\u22DA",lesseqqgtr:"\u2A8B",LessEqualGreater:"\u22DA",LessFullEqual:"\u2266",LessGreater:"\u2276",lessgtr:"\u2276",LessLess:"\u2AA1",lesssim:"\u2272",LessSlantEqual:"\u2A7D",LessTilde:"\u2272",lfisht:"\u297C",lfloor:"\u230A",Lfr:"\u{1D50F}",lfr:"\u{1D529}",lg:"\u2276",lgE:"\u2A91",lHar:"\u2962",lhard:"\u21BD",lharu:"\u21BC",lharul:"\u296A",lhblk:"\u2584",LJcy:"\u0409",ljcy:"\u0459",llarr:"\u21C7",ll:"\u226A",Ll:"\u22D8",llcorner:"\u231E",Lleftarrow:"\u21DA",llhard:"\u296B",lltri:"\u25FA",Lmidot:"\u013F",lmidot:"\u0140",lmoustache:"\u23B0",lmoust:"\u23B0",lnap:"\u2A89",lnapprox:"\u2A89",lne:"\u2A87",lnE:"\u2268",lneq:"\u2A87",lneqq:"\u2268",lnsim:"\u22E6",loang:"\u27EC",loarr:"\u21FD",lobrk:"\u27E6",longleftarrow:"\u27F5",LongLeftArrow:"\u27F5",Longleftarrow:"\u27F8",longleftrightarrow:"\u27F7",LongLeftRightArrow:"\u27F7",Longleftrightarrow:"\u27FA",longmapsto:"\u27FC",longrightarrow:"\u27F6",LongRightArrow:"\u27F6",Longrightarrow:"\u27F9",looparrowleft:"\u21AB",looparrowright:"\u21AC",lopar:"\u2985",Lopf:"\u{1D543}",lopf:"\u{1D55D}",loplus:"\u2A2D",lotimes:"\u2A34",lowast:"\u2217",lowbar:"_",LowerLeftArrow:"\u2199",LowerRightArrow:"\u2198",loz:"\u25CA",lozenge:"\u25CA",lozf:"\u29EB",lpar:"(",lparlt:"\u2993",lrarr:"\u21C6",lrcorner:"\u231F",lrhar:"\u21CB",lrhard:"\u296D",lrm:"\u200E",lrtri:"\u22BF",lsaquo:"\u2039",lscr:"\u{1D4C1}",Lscr:"\u2112",lsh:"\u21B0",Lsh:"\u21B0",lsim:"\u2272",lsime:"\u2A8D",lsimg:"\u2A8F",lsqb:"[",lsquo:"\u2018",lsquor:"\u201A",Lstrok:"\u0141",lstrok:"\u0142",ltcc:"\u2AA6",ltcir:"\u2A79",lt:"<",LT:"<",Lt:"\u226A",ltdot:"\u22D6",lthree:"\u22CB",ltimes:"\u22C9",ltlarr:"\u2976",ltquest:"\u2A7B",ltri:"\u25C3",ltrie:"\u22B4",ltrif:"\u25C2",ltrPar:"\u2996",lurdshar:"\u294A",luruhar:"\u2966",lvertneqq:"\u2268\uFE00",lvnE:"\u2268\uFE00",macr:"\xAF",male:"\u2642",malt:"\u2720",maltese:"\u2720",Map:"\u2905",map:"\u21A6",mapsto:"\u21A6",mapstodown:"\u21A7",mapstoleft:"\u21A4",mapstoup:"\u21A5",marker:"\u25AE",mcomma:"\u2A29",Mcy:"\u041C",mcy:"\u043C",mdash:"\u2014",mDDot:"\u223A",measuredangle:"\u2221",MediumSpace:"\u205F",Mellintrf:"\u2133",Mfr:"\u{1D510}",mfr:"\u{1D52A}",mho:"\u2127",micro:"\xB5",midast:"*",midcir:"\u2AF0",mid:"\u2223",middot:"\xB7",minusb:"\u229F",minus:"\u2212",minusd:"\u2238",minusdu:"\u2A2A",MinusPlus:"\u2213",mlcp:"\u2ADB",mldr:"\u2026",mnplus:"\u2213",models:"\u22A7",Mopf:"\u{1D544}",mopf:"\u{1D55E}",mp:"\u2213",mscr:"\u{1D4C2}",Mscr:"\u2133",mstpos:"\u223E",Mu:"\u039C",mu:"\u03BC",multimap:"\u22B8",mumap:"\u22B8",nabla:"\u2207",Nacute:"\u0143",nacute:"\u0144",nang:"\u2220\u20D2",nap:"\u2249",napE:"\u2A70\u0338",napid:"\u224B\u0338",napos:"\u0149",napprox:"\u2249",natural:"\u266E",naturals:"\u2115",natur:"\u266E",nbsp:"\xA0",nbump:"\u224E\u0338",nbumpe:"\u224F\u0338",ncap:"\u2A43",Ncaron:"\u0147",ncaron:"\u0148",Ncedil:"\u0145",ncedil:"\u0146",ncong:"\u2247",ncongdot:"\u2A6D\u0338",ncup:"\u2A42",Ncy:"\u041D",ncy:"\u043D",ndash:"\u2013",nearhk:"\u2924",nearr:"\u2197",neArr:"\u21D7",nearrow:"\u2197",ne:"\u2260",nedot:"\u2250\u0338",NegativeMediumSpace:"\u200B",NegativeThickSpace:"\u200B",NegativeThinSpace:"\u200B",NegativeVeryThinSpace:"\u200B",nequiv:"\u2262",nesear:"\u2928",nesim:"\u2242\u0338",NestedGreaterGreater:"\u226B",NestedLessLess:"\u226A",NewLine:`
`,nexist:"\u2204",nexists:"\u2204",Nfr:"\u{1D511}",nfr:"\u{1D52B}",ngE:"\u2267\u0338",nge:"\u2271",ngeq:"\u2271",ngeqq:"\u2267\u0338",ngeqslant:"\u2A7E\u0338",nges:"\u2A7E\u0338",nGg:"\u22D9\u0338",ngsim:"\u2275",nGt:"\u226B\u20D2",ngt:"\u226F",ngtr:"\u226F",nGtv:"\u226B\u0338",nharr:"\u21AE",nhArr:"\u21CE",nhpar:"\u2AF2",ni:"\u220B",nis:"\u22FC",nisd:"\u22FA",niv:"\u220B",NJcy:"\u040A",njcy:"\u045A",nlarr:"\u219A",nlArr:"\u21CD",nldr:"\u2025",nlE:"\u2266\u0338",nle:"\u2270",nleftarrow:"\u219A",nLeftarrow:"\u21CD",nleftrightarrow:"\u21AE",nLeftrightarrow:"\u21CE",nleq:"\u2270",nleqq:"\u2266\u0338",nleqslant:"\u2A7D\u0338",nles:"\u2A7D\u0338",nless:"\u226E",nLl:"\u22D8\u0338",nlsim:"\u2274",nLt:"\u226A\u20D2",nlt:"\u226E",nltri:"\u22EA",nltrie:"\u22EC",nLtv:"\u226A\u0338",nmid:"\u2224",NoBreak:"\u2060",NonBreakingSpace:"\xA0",nopf:"\u{1D55F}",Nopf:"\u2115",Not:"\u2AEC",not:"\xAC",NotCongruent:"\u2262",NotCupCap:"\u226D",NotDoubleVerticalBar:"\u2226",NotElement:"\u2209",NotEqual:"\u2260",NotEqualTilde:"\u2242\u0338",NotExists:"\u2204",NotGreater:"\u226F",NotGreaterEqual:"\u2271",NotGreaterFullEqual:"\u2267\u0338",NotGreaterGreater:"\u226B\u0338",NotGreaterLess:"\u2279",NotGreaterSlantEqual:"\u2A7E\u0338",NotGreaterTilde:"\u2275",NotHumpDownHump:"\u224E\u0338",NotHumpEqual:"\u224F\u0338",notin:"\u2209",notindot:"\u22F5\u0338",notinE:"\u22F9\u0338",notinva:"\u2209",notinvb:"\u22F7",notinvc:"\u22F6",NotLeftTriangleBar:"\u29CF\u0338",NotLeftTriangle:"\u22EA",NotLeftTriangleEqual:"\u22EC",NotLess:"\u226E",NotLessEqual:"\u2270",NotLessGreater:"\u2278",NotLessLess:"\u226A\u0338",NotLessSlantEqual:"\u2A7D\u0338",NotLessTilde:"\u2274",NotNestedGreaterGreater:"\u2AA2\u0338",NotNestedLessLess:"\u2AA1\u0338",notni:"\u220C",notniva:"\u220C",notnivb:"\u22FE",notnivc:"\u22FD",NotPrecedes:"\u2280",NotPrecedesEqual:"\u2AAF\u0338",NotPrecedesSlantEqual:"\u22E0",NotReverseElement:"\u220C",NotRightTriangleBar:"\u29D0\u0338",NotRightTriangle:"\u22EB",NotRightTriangleEqual:"\u22ED",NotSquareSubset:"\u228F\u0338",NotSquareSubsetEqual:"\u22E2",NotSquareSuperset:"\u2290\u0338",NotSquareSupersetEqual:"\u22E3",NotSubset:"\u2282\u20D2",NotSubsetEqual:"\u2288",NotSucceeds:"\u2281",NotSucceedsEqual:"\u2AB0\u0338",NotSucceedsSlantEqual:"\u22E1",NotSucceedsTilde:"\u227F\u0338",NotSuperset:"\u2283\u20D2",NotSupersetEqual:"\u2289",NotTilde:"\u2241",NotTildeEqual:"\u2244",NotTildeFullEqual:"\u2247",NotTildeTilde:"\u2249",NotVerticalBar:"\u2224",nparallel:"\u2226",npar:"\u2226",nparsl:"\u2AFD\u20E5",npart:"\u2202\u0338",npolint:"\u2A14",npr:"\u2280",nprcue:"\u22E0",nprec:"\u2280",npreceq:"\u2AAF\u0338",npre:"\u2AAF\u0338",nrarrc:"\u2933\u0338",nrarr:"\u219B",nrArr:"\u21CF",nrarrw:"\u219D\u0338",nrightarrow:"\u219B",nRightarrow:"\u21CF",nrtri:"\u22EB",nrtrie:"\u22ED",nsc:"\u2281",nsccue:"\u22E1",nsce:"\u2AB0\u0338",Nscr:"\u{1D4A9}",nscr:"\u{1D4C3}",nshortmid:"\u2224",nshortparallel:"\u2226",nsim:"\u2241",nsime:"\u2244",nsimeq:"\u2244",nsmid:"\u2224",nspar:"\u2226",nsqsube:"\u22E2",nsqsupe:"\u22E3",nsub:"\u2284",nsubE:"\u2AC5\u0338",nsube:"\u2288",nsubset:"\u2282\u20D2",nsubseteq:"\u2288",nsubseteqq:"\u2AC5\u0338",nsucc:"\u2281",nsucceq:"\u2AB0\u0338",nsup:"\u2285",nsupE:"\u2AC6\u0338",nsupe:"\u2289",nsupset:"\u2283\u20D2",nsupseteq:"\u2289",nsupseteqq:"\u2AC6\u0338",ntgl:"\u2279",Ntilde:"\xD1",ntilde:"\xF1",ntlg:"\u2278",ntriangleleft:"\u22EA",ntrianglelefteq:"\u22EC",ntriangleright:"\u22EB",ntrianglerighteq:"\u22ED",Nu:"\u039D",nu:"\u03BD",num:"#",numero:"\u2116",numsp:"\u2007",nvap:"\u224D\u20D2",nvdash:"\u22AC",nvDash:"\u22AD",nVdash:"\u22AE",nVDash:"\u22AF",nvge:"\u2265\u20D2",nvgt:">\u20D2",nvHarr:"\u2904",nvinfin:"\u29DE",nvlArr:"\u2902",nvle:"\u2264\u20D2",nvlt:"<\u20D2",nvltrie:"\u22B4\u20D2",nvrArr:"\u2903",nvrtrie:"\u22B5\u20D2",nvsim:"\u223C\u20D2",nwarhk:"\u2923",nwarr:"\u2196",nwArr:"\u21D6",nwarrow:"\u2196",nwnear:"\u2927",Oacute:"\xD3",oacute:"\xF3",oast:"\u229B",Ocirc:"\xD4",ocirc:"\xF4",ocir:"\u229A",Ocy:"\u041E",ocy:"\u043E",odash:"\u229D",Odblac:"\u0150",odblac:"\u0151",odiv:"\u2A38",odot:"\u2299",odsold:"\u29BC",OElig:"\u0152",oelig:"\u0153",ofcir:"\u29BF",Ofr:"\u{1D512}",ofr:"\u{1D52C}",ogon:"\u02DB",Ograve:"\xD2",ograve:"\xF2",ogt:"\u29C1",ohbar:"\u29B5",ohm:"\u03A9",oint:"\u222E",olarr:"\u21BA",olcir:"\u29BE",olcross:"\u29BB",oline:"\u203E",olt:"\u29C0",Omacr:"\u014C",omacr:"\u014D",Omega:"\u03A9",omega:"\u03C9",Omicron:"\u039F",omicron:"\u03BF",omid:"\u29B6",ominus:"\u2296",Oopf:"\u{1D546}",oopf:"\u{1D560}",opar:"\u29B7",OpenCurlyDoubleQuote:"\u201C",OpenCurlyQuote:"\u2018",operp:"\u29B9",oplus:"\u2295",orarr:"\u21BB",Or:"\u2A54",or:"\u2228",ord:"\u2A5D",order:"\u2134",orderof:"\u2134",ordf:"\xAA",ordm:"\xBA",origof:"\u22B6",oror:"\u2A56",orslope:"\u2A57",orv:"\u2A5B",oS:"\u24C8",Oscr:"\u{1D4AA}",oscr:"\u2134",Oslash:"\xD8",oslash:"\xF8",osol:"\u2298",Otilde:"\xD5",otilde:"\xF5",otimesas:"\u2A36",Otimes:"\u2A37",otimes:"\u2297",Ouml:"\xD6",ouml:"\xF6",ovbar:"\u233D",OverBar:"\u203E",OverBrace:"\u23DE",OverBracket:"\u23B4",OverParenthesis:"\u23DC",para:"\xB6",parallel:"\u2225",par:"\u2225",parsim:"\u2AF3",parsl:"\u2AFD",part:"\u2202",PartialD:"\u2202",Pcy:"\u041F",pcy:"\u043F",percnt:"%",period:".",permil:"\u2030",perp:"\u22A5",pertenk:"\u2031",Pfr:"\u{1D513}",pfr:"\u{1D52D}",Phi:"\u03A6",phi:"\u03C6",phiv:"\u03D5",phmmat:"\u2133",phone:"\u260E",Pi:"\u03A0",pi:"\u03C0",pitchfork:"\u22D4",piv:"\u03D6",planck:"\u210F",planckh:"\u210E",plankv:"\u210F",plusacir:"\u2A23",plusb:"\u229E",pluscir:"\u2A22",plus:"+",plusdo:"\u2214",plusdu:"\u2A25",pluse:"\u2A72",PlusMinus:"\xB1",plusmn:"\xB1",plussim:"\u2A26",plustwo:"\u2A27",pm:"\xB1",Poincareplane:"\u210C",pointint:"\u2A15",popf:"\u{1D561}",Popf:"\u2119",pound:"\xA3",prap:"\u2AB7",Pr:"\u2ABB",pr:"\u227A",prcue:"\u227C",precapprox:"\u2AB7",prec:"\u227A",preccurlyeq:"\u227C",Precedes:"\u227A",PrecedesEqual:"\u2AAF",PrecedesSlantEqual:"\u227C",PrecedesTilde:"\u227E",preceq:"\u2AAF",precnapprox:"\u2AB9",precneqq:"\u2AB5",precnsim:"\u22E8",pre:"\u2AAF",prE:"\u2AB3",precsim:"\u227E",prime:"\u2032",Prime:"\u2033",primes:"\u2119",prnap:"\u2AB9",prnE:"\u2AB5",prnsim:"\u22E8",prod:"\u220F",Product:"\u220F",profalar:"\u232E",profline:"\u2312",profsurf:"\u2313",prop:"\u221D",Proportional:"\u221D",Proportion:"\u2237",propto:"\u221D",prsim:"\u227E",prurel:"\u22B0",Pscr:"\u{1D4AB}",pscr:"\u{1D4C5}",Psi:"\u03A8",psi:"\u03C8",puncsp:"\u2008",Qfr:"\u{1D514}",qfr:"\u{1D52E}",qint:"\u2A0C",qopf:"\u{1D562}",Qopf:"\u211A",qprime:"\u2057",Qscr:"\u{1D4AC}",qscr:"\u{1D4C6}",quaternions:"\u210D",quatint:"\u2A16",quest:"?",questeq:"\u225F",quot:'"',QUOT:'"',rAarr:"\u21DB",race:"\u223D\u0331",Racute:"\u0154",racute:"\u0155",radic:"\u221A",raemptyv:"\u29B3",rang:"\u27E9",Rang:"\u27EB",rangd:"\u2992",range:"\u29A5",rangle:"\u27E9",raquo:"\xBB",rarrap:"\u2975",rarrb:"\u21E5",rarrbfs:"\u2920",rarrc:"\u2933",rarr:"\u2192",Rarr:"\u21A0",rArr:"\u21D2",rarrfs:"\u291E",rarrhk:"\u21AA",rarrlp:"\u21AC",rarrpl:"\u2945",rarrsim:"\u2974",Rarrtl:"\u2916",rarrtl:"\u21A3",rarrw:"\u219D",ratail:"\u291A",rAtail:"\u291C",ratio:"\u2236",rationals:"\u211A",rbarr:"\u290D",rBarr:"\u290F",RBarr:"\u2910",rbbrk:"\u2773",rbrace:"}",rbrack:"]",rbrke:"\u298C",rbrksld:"\u298E",rbrkslu:"\u2990",Rcaron:"\u0158",rcaron:"\u0159",Rcedil:"\u0156",rcedil:"\u0157",rceil:"\u2309",rcub:"}",Rcy:"\u0420",rcy:"\u0440",rdca:"\u2937",rdldhar:"\u2969",rdquo:"\u201D",rdquor:"\u201D",rdsh:"\u21B3",real:"\u211C",realine:"\u211B",realpart:"\u211C",reals:"\u211D",Re:"\u211C",rect:"\u25AD",reg:"\xAE",REG:"\xAE",ReverseElement:"\u220B",ReverseEquilibrium:"\u21CB",ReverseUpEquilibrium:"\u296F",rfisht:"\u297D",rfloor:"\u230B",rfr:"\u{1D52F}",Rfr:"\u211C",rHar:"\u2964",rhard:"\u21C1",rharu:"\u21C0",rharul:"\u296C",Rho:"\u03A1",rho:"\u03C1",rhov:"\u03F1",RightAngleBracket:"\u27E9",RightArrowBar:"\u21E5",rightarrow:"\u2192",RightArrow:"\u2192",Rightarrow:"\u21D2",RightArrowLeftArrow:"\u21C4",rightarrowtail:"\u21A3",RightCeiling:"\u2309",RightDoubleBracket:"\u27E7",RightDownTeeVector:"\u295D",RightDownVectorBar:"\u2955",RightDownVector:"\u21C2",RightFloor:"\u230B",rightharpoondown:"\u21C1",rightharpoonup:"\u21C0",rightleftarrows:"\u21C4",rightleftharpoons:"\u21CC",rightrightarrows:"\u21C9",rightsquigarrow:"\u219D",RightTeeArrow:"\u21A6",RightTee:"\u22A2",RightTeeVector:"\u295B",rightthreetimes:"\u22CC",RightTriangleBar:"\u29D0",RightTriangle:"\u22B3",RightTriangleEqual:"\u22B5",RightUpDownVector:"\u294F",RightUpTeeVector:"\u295C",RightUpVectorBar:"\u2954",RightUpVector:"\u21BE",RightVectorBar:"\u2953",RightVector:"\u21C0",ring:"\u02DA",risingdotseq:"\u2253",rlarr:"\u21C4",rlhar:"\u21CC",rlm:"\u200F",rmoustache:"\u23B1",rmoust:"\u23B1",rnmid:"\u2AEE",roang:"\u27ED",roarr:"\u21FE",robrk:"\u27E7",ropar:"\u2986",ropf:"\u{1D563}",Ropf:"\u211D",roplus:"\u2A2E",rotimes:"\u2A35",RoundImplies:"\u2970",rpar:")",rpargt:"\u2994",rppolint:"\u2A12",rrarr:"\u21C9",Rrightarrow:"\u21DB",rsaquo:"\u203A",rscr:"\u{1D4C7}",Rscr:"\u211B",rsh:"\u21B1",Rsh:"\u21B1",rsqb:"]",rsquo:"\u2019",rsquor:"\u2019",rthree:"\u22CC",rtimes:"\u22CA",rtri:"\u25B9",rtrie:"\u22B5",rtrif:"\u25B8",rtriltri:"\u29CE",RuleDelayed:"\u29F4",ruluhar:"\u2968",rx:"\u211E",Sacute:"\u015A",sacute:"\u015B",sbquo:"\u201A",scap:"\u2AB8",Scaron:"\u0160",scaron:"\u0161",Sc:"\u2ABC",sc:"\u227B",sccue:"\u227D",sce:"\u2AB0",scE:"\u2AB4",Scedil:"\u015E",scedil:"\u015F",Scirc:"\u015C",scirc:"\u015D",scnap:"\u2ABA",scnE:"\u2AB6",scnsim:"\u22E9",scpolint:"\u2A13",scsim:"\u227F",Scy:"\u0421",scy:"\u0441",sdotb:"\u22A1",sdot:"\u22C5",sdote:"\u2A66",searhk:"\u2925",searr:"\u2198",seArr:"\u21D8",searrow:"\u2198",sect:"\xA7",semi:";",seswar:"\u2929",setminus:"\u2216",setmn:"\u2216",sext:"\u2736",Sfr:"\u{1D516}",sfr:"\u{1D530}",sfrown:"\u2322",sharp:"\u266F",SHCHcy:"\u0429",shchcy:"\u0449",SHcy:"\u0428",shcy:"\u0448",ShortDownArrow:"\u2193",ShortLeftArrow:"\u2190",shortmid:"\u2223",shortparallel:"\u2225",ShortRightArrow:"\u2192",ShortUpArrow:"\u2191",shy:"\xAD",Sigma:"\u03A3",sigma:"\u03C3",sigmaf:"\u03C2",sigmav:"\u03C2",sim:"\u223C",simdot:"\u2A6A",sime:"\u2243",simeq:"\u2243",simg:"\u2A9E",simgE:"\u2AA0",siml:"\u2A9D",simlE:"\u2A9F",simne:"\u2246",simplus:"\u2A24",simrarr:"\u2972",slarr:"\u2190",SmallCircle:"\u2218",smallsetminus:"\u2216",smashp:"\u2A33",smeparsl:"\u29E4",smid:"\u2223",smile:"\u2323",smt:"\u2AAA",smte:"\u2AAC",smtes:"\u2AAC\uFE00",SOFTcy:"\u042C",softcy:"\u044C",solbar:"\u233F",solb:"\u29C4",sol:"/",Sopf:"\u{1D54A}",sopf:"\u{1D564}",spades:"\u2660",spadesuit:"\u2660",spar:"\u2225",sqcap:"\u2293",sqcaps:"\u2293\uFE00",sqcup:"\u2294",sqcups:"\u2294\uFE00",Sqrt:"\u221A",sqsub:"\u228F",sqsube:"\u2291",sqsubset:"\u228F",sqsubseteq:"\u2291",sqsup:"\u2290",sqsupe:"\u2292",sqsupset:"\u2290",sqsupseteq:"\u2292",square:"\u25A1",Square:"\u25A1",SquareIntersection:"\u2293",SquareSubset:"\u228F",SquareSubsetEqual:"\u2291",SquareSuperset:"\u2290",SquareSupersetEqual:"\u2292",SquareUnion:"\u2294",squarf:"\u25AA",squ:"\u25A1",squf:"\u25AA",srarr:"\u2192",Sscr:"\u{1D4AE}",sscr:"\u{1D4C8}",ssetmn:"\u2216",ssmile:"\u2323",sstarf:"\u22C6",Star:"\u22C6",star:"\u2606",starf:"\u2605",straightepsilon:"\u03F5",straightphi:"\u03D5",strns:"\xAF",sub:"\u2282",Sub:"\u22D0",subdot:"\u2ABD",subE:"\u2AC5",sube:"\u2286",subedot:"\u2AC3",submult:"\u2AC1",subnE:"\u2ACB",subne:"\u228A",subplus:"\u2ABF",subrarr:"\u2979",subset:"\u2282",Subset:"\u22D0",subseteq:"\u2286",subseteqq:"\u2AC5",SubsetEqual:"\u2286",subsetneq:"\u228A",subsetneqq:"\u2ACB",subsim:"\u2AC7",subsub:"\u2AD5",subsup:"\u2AD3",succapprox:"\u2AB8",succ:"\u227B",succcurlyeq:"\u227D",Succeeds:"\u227B",SucceedsEqual:"\u2AB0",SucceedsSlantEqual:"\u227D",SucceedsTilde:"\u227F",succeq:"\u2AB0",succnapprox:"\u2ABA",succneqq:"\u2AB6",succnsim:"\u22E9",succsim:"\u227F",SuchThat:"\u220B",sum:"\u2211",Sum:"\u2211",sung:"\u266A",sup1:"\xB9",sup2:"\xB2",sup3:"\xB3",sup:"\u2283",Sup:"\u22D1",supdot:"\u2ABE",supdsub:"\u2AD8",supE:"\u2AC6",supe:"\u2287",supedot:"\u2AC4",Superset:"\u2283",SupersetEqual:"\u2287",suphsol:"\u27C9",suphsub:"\u2AD7",suplarr:"\u297B",supmult:"\u2AC2",supnE:"\u2ACC",supne:"\u228B",supplus:"\u2AC0",supset:"\u2283",Supset:"\u22D1",supseteq:"\u2287",supseteqq:"\u2AC6",supsetneq:"\u228B",supsetneqq:"\u2ACC",supsim:"\u2AC8",supsub:"\u2AD4",supsup:"\u2AD6",swarhk:"\u2926",swarr:"\u2199",swArr:"\u21D9",swarrow:"\u2199",swnwar:"\u292A",szlig:"\xDF",Tab:"	",target:"\u2316",Tau:"\u03A4",tau:"\u03C4",tbrk:"\u23B4",Tcaron:"\u0164",tcaron:"\u0165",Tcedil:"\u0162",tcedil:"\u0163",Tcy:"\u0422",tcy:"\u0442",tdot:"\u20DB",telrec:"\u2315",Tfr:"\u{1D517}",tfr:"\u{1D531}",there4:"\u2234",therefore:"\u2234",Therefore:"\u2234",Theta:"\u0398",theta:"\u03B8",thetasym:"\u03D1",thetav:"\u03D1",thickapprox:"\u2248",thicksim:"\u223C",ThickSpace:"\u205F\u200A",ThinSpace:"\u2009",thinsp:"\u2009",thkap:"\u2248",thksim:"\u223C",THORN:"\xDE",thorn:"\xFE",tilde:"\u02DC",Tilde:"\u223C",TildeEqual:"\u2243",TildeFullEqual:"\u2245",TildeTilde:"\u2248",timesbar:"\u2A31",timesb:"\u22A0",times:"\xD7",timesd:"\u2A30",tint:"\u222D",toea:"\u2928",topbot:"\u2336",topcir:"\u2AF1",top:"\u22A4",Topf:"\u{1D54B}",topf:"\u{1D565}",topfork:"\u2ADA",tosa:"\u2929",tprime:"\u2034",trade:"\u2122",TRADE:"\u2122",triangle:"\u25B5",triangledown:"\u25BF",triangleleft:"\u25C3",trianglelefteq:"\u22B4",triangleq:"\u225C",triangleright:"\u25B9",trianglerighteq:"\u22B5",tridot:"\u25EC",trie:"\u225C",triminus:"\u2A3A",TripleDot:"\u20DB",triplus:"\u2A39",trisb:"\u29CD",tritime:"\u2A3B",trpezium:"\u23E2",Tscr:"\u{1D4AF}",tscr:"\u{1D4C9}",TScy:"\u0426",tscy:"\u0446",TSHcy:"\u040B",tshcy:"\u045B",Tstrok:"\u0166",tstrok:"\u0167",twixt:"\u226C",twoheadleftarrow:"\u219E",twoheadrightarrow:"\u21A0",Uacute:"\xDA",uacute:"\xFA",uarr:"\u2191",Uarr:"\u219F",uArr:"\u21D1",Uarrocir:"\u2949",Ubrcy:"\u040E",ubrcy:"\u045E",Ubreve:"\u016C",ubreve:"\u016D",Ucirc:"\xDB",ucirc:"\xFB",Ucy:"\u0423",ucy:"\u0443",udarr:"\u21C5",Udblac:"\u0170",udblac:"\u0171",udhar:"\u296E",ufisht:"\u297E",Ufr:"\u{1D518}",ufr:"\u{1D532}",Ugrave:"\xD9",ugrave:"\xF9",uHar:"\u2963",uharl:"\u21BF",uharr:"\u21BE",uhblk:"\u2580",ulcorn:"\u231C",ulcorner:"\u231C",ulcrop:"\u230F",ultri:"\u25F8",Umacr:"\u016A",umacr:"\u016B",uml:"\xA8",UnderBar:"_",UnderBrace:"\u23DF",UnderBracket:"\u23B5",UnderParenthesis:"\u23DD",Union:"\u22C3",UnionPlus:"\u228E",Uogon:"\u0172",uogon:"\u0173",Uopf:"\u{1D54C}",uopf:"\u{1D566}",UpArrowBar:"\u2912",uparrow:"\u2191",UpArrow:"\u2191",Uparrow:"\u21D1",UpArrowDownArrow:"\u21C5",updownarrow:"\u2195",UpDownArrow:"\u2195",Updownarrow:"\u21D5",UpEquilibrium:"\u296E",upharpoonleft:"\u21BF",upharpoonright:"\u21BE",uplus:"\u228E",UpperLeftArrow:"\u2196",UpperRightArrow:"\u2197",upsi:"\u03C5",Upsi:"\u03D2",upsih:"\u03D2",Upsilon:"\u03A5",upsilon:"\u03C5",UpTeeArrow:"\u21A5",UpTee:"\u22A5",upuparrows:"\u21C8",urcorn:"\u231D",urcorner:"\u231D",urcrop:"\u230E",Uring:"\u016E",uring:"\u016F",urtri:"\u25F9",Uscr:"\u{1D4B0}",uscr:"\u{1D4CA}",utdot:"\u22F0",Utilde:"\u0168",utilde:"\u0169",utri:"\u25B5",utrif:"\u25B4",uuarr:"\u21C8",Uuml:"\xDC",uuml:"\xFC",uwangle:"\u29A7",vangrt:"\u299C",varepsilon:"\u03F5",varkappa:"\u03F0",varnothing:"\u2205",varphi:"\u03D5",varpi:"\u03D6",varpropto:"\u221D",varr:"\u2195",vArr:"\u21D5",varrho:"\u03F1",varsigma:"\u03C2",varsubsetneq:"\u228A\uFE00",varsubsetneqq:"\u2ACB\uFE00",varsupsetneq:"\u228B\uFE00",varsupsetneqq:"\u2ACC\uFE00",vartheta:"\u03D1",vartriangleleft:"\u22B2",vartriangleright:"\u22B3",vBar:"\u2AE8",Vbar:"\u2AEB",vBarv:"\u2AE9",Vcy:"\u0412",vcy:"\u0432",vdash:"\u22A2",vDash:"\u22A8",Vdash:"\u22A9",VDash:"\u22AB",Vdashl:"\u2AE6",veebar:"\u22BB",vee:"\u2228",Vee:"\u22C1",veeeq:"\u225A",vellip:"\u22EE",verbar:"|",Verbar:"\u2016",vert:"|",Vert:"\u2016",VerticalBar:"\u2223",VerticalLine:"|",VerticalSeparator:"\u2758",VerticalTilde:"\u2240",VeryThinSpace:"\u200A",Vfr:"\u{1D519}",vfr:"\u{1D533}",vltri:"\u22B2",vnsub:"\u2282\u20D2",vnsup:"\u2283\u20D2",Vopf:"\u{1D54D}",vopf:"\u{1D567}",vprop:"\u221D",vrtri:"\u22B3",Vscr:"\u{1D4B1}",vscr:"\u{1D4CB}",vsubnE:"\u2ACB\uFE00",vsubne:"\u228A\uFE00",vsupnE:"\u2ACC\uFE00",vsupne:"\u228B\uFE00",Vvdash:"\u22AA",vzigzag:"\u299A",Wcirc:"\u0174",wcirc:"\u0175",wedbar:"\u2A5F",wedge:"\u2227",Wedge:"\u22C0",wedgeq:"\u2259",weierp:"\u2118",Wfr:"\u{1D51A}",wfr:"\u{1D534}",Wopf:"\u{1D54E}",wopf:"\u{1D568}",wp:"\u2118",wr:"\u2240",wreath:"\u2240",Wscr:"\u{1D4B2}",wscr:"\u{1D4CC}",xcap:"\u22C2",xcirc:"\u25EF",xcup:"\u22C3",xdtri:"\u25BD",Xfr:"\u{1D51B}",xfr:"\u{1D535}",xharr:"\u27F7",xhArr:"\u27FA",Xi:"\u039E",xi:"\u03BE",xlarr:"\u27F5",xlArr:"\u27F8",xmap:"\u27FC",xnis:"\u22FB",xodot:"\u2A00",Xopf:"\u{1D54F}",xopf:"\u{1D569}",xoplus:"\u2A01",xotime:"\u2A02",xrarr:"\u27F6",xrArr:"\u27F9",Xscr:"\u{1D4B3}",xscr:"\u{1D4CD}",xsqcup:"\u2A06",xuplus:"\u2A04",xutri:"\u25B3",xvee:"\u22C1",xwedge:"\u22C0",Yacute:"\xDD",yacute:"\xFD",YAcy:"\u042F",yacy:"\u044F",Ycirc:"\u0176",ycirc:"\u0177",Ycy:"\u042B",ycy:"\u044B",yen:"\xA5",Yfr:"\u{1D51C}",yfr:"\u{1D536}",YIcy:"\u0407",yicy:"\u0457",Yopf:"\u{1D550}",yopf:"\u{1D56A}",Yscr:"\u{1D4B4}",yscr:"\u{1D4CE}",YUcy:"\u042E",yucy:"\u044E",yuml:"\xFF",Yuml:"\u0178",Zacute:"\u0179",zacute:"\u017A",Zcaron:"\u017D",zcaron:"\u017E",Zcy:"\u0417",zcy:"\u0437",Zdot:"\u017B",zdot:"\u017C",zeetrf:"\u2128",ZeroWidthSpace:"\u200B",Zeta:"\u0396",zeta:"\u03B6",zfr:"\u{1D537}",Zfr:"\u2128",ZHcy:"\u0416",zhcy:"\u0436",zigrarr:"\u21DD",zopf:"\u{1D56B}",Zopf:"\u2124",Zscr:"\u{1D4B5}",zscr:"\u{1D4CF}",zwj:"\u200D",zwnj:"\u200C"}});var FO=we((yE,tT)=>{tT.exports={Aacute:"\xC1",aacute:"\xE1",Acirc:"\xC2",acirc:"\xE2",acute:"\xB4",AElig:"\xC6",aelig:"\xE6",Agrave:"\xC0",agrave:"\xE0",amp:"&",AMP:"&",Aring:"\xC5",aring:"\xE5",Atilde:"\xC3",atilde:"\xE3",Auml:"\xC4",auml:"\xE4",brvbar:"\xA6",Ccedil:"\xC7",ccedil:"\xE7",cedil:"\xB8",cent:"\xA2",copy:"\xA9",COPY:"\xA9",curren:"\xA4",deg:"\xB0",divide:"\xF7",Eacute:"\xC9",eacute:"\xE9",Ecirc:"\xCA",ecirc:"\xEA",Egrave:"\xC8",egrave:"\xE8",ETH:"\xD0",eth:"\xF0",Euml:"\xCB",euml:"\xEB",frac12:"\xBD",frac14:"\xBC",frac34:"\xBE",gt:">",GT:">",Iacute:"\xCD",iacute:"\xED",Icirc:"\xCE",icirc:"\xEE",iexcl:"\xA1",Igrave:"\xCC",igrave:"\xEC",iquest:"\xBF",Iuml:"\xCF",iuml:"\xEF",laquo:"\xAB",lt:"<",LT:"<",macr:"\xAF",micro:"\xB5",middot:"\xB7",nbsp:"\xA0",not:"\xAC",Ntilde:"\xD1",ntilde:"\xF1",Oacute:"\xD3",oacute:"\xF3",Ocirc:"\xD4",ocirc:"\xF4",Ograve:"\xD2",ograve:"\xF2",ordf:"\xAA",ordm:"\xBA",Oslash:"\xD8",oslash:"\xF8",Otilde:"\xD5",otilde:"\xF5",Ouml:"\xD6",ouml:"\xF6",para:"\xB6",plusmn:"\xB1",pound:"\xA3",quot:'"',QUOT:'"',raquo:"\xBB",reg:"\xAE",REG:"\xAE",sect:"\xA7",shy:"\xAD",sup1:"\xB9",sup2:"\xB2",sup3:"\xB3",szlig:"\xDF",THORN:"\xDE",thorn:"\xFE",times:"\xD7",Uacute:"\xDA",uacute:"\xFA",Ucirc:"\xDB",ucirc:"\xFB",Ugrave:"\xD9",ugrave:"\xF9",uml:"\xA8",Uuml:"\xDC",uuml:"\xFC",Yacute:"\xDD",yacute:"\xFD",yen:"\xA5",yuml:"\xFF"}});var ku=we((bE,iT)=>{iT.exports={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'}});var HO=we((wE,rT)=>{rT.exports={"0":65533,"128":8364,"130":8218,"131":402,"132":8222,"133":8230,"134":8224,"135":8225,"136":710,"137":8240,"138":352,"139":8249,"140":338,"142":381,"145":8216,"146":8217,"147":8220,"148":8221,"149":8226,"150":8211,"151":8212,"152":732,"153":8482,"154":353,"155":8250,"156":339,"158":382,"159":376}});var YO=we(ts=>{"use strict";var nT=ts&&ts.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(ts,"__esModule",{value:!0});var GO=nT(HO()),sT=String.fromCodePoint||function(i){var e="";return i>65535&&(i-=65536,e+=String.fromCharCode(i>>>10&1023|55296),i=56320|i&1023),e+=String.fromCharCode(i),e};function oT(i){return i>=55296&&i<=57343||i>1114111?"\uFFFD":(i in GO.default&&(i=GO.default[i]),sT(i))}ts.default=oT});var Pu=we(_t=>{"use strict";var wa=_t&&_t.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(_t,"__esModule",{value:!0});_t.decodeHTML=_t.decodeHTMLStrict=_t.decodeXML=void 0;var Tu=wa(Su()),aT=wa(FO()),lT=wa(ku()),ZO=wa(YO()),cT=/&(?:[a-zA-Z0-9]+|#[xX][\da-fA-F]+|#\d+);/g;_t.decodeXML=KO(lT.default);_t.decodeHTMLStrict=KO(Tu.default);function KO(i){var e=e0(i);return function(t){return String(t).replace(cT,e)}}var JO=function(i,e){return i<e?1:-1};_t.decodeHTML=function(){for(var i=Object.keys(aT.default).sort(JO),e=Object.keys(Tu.default).sort(JO),t=0,r=0;t<e.length;t++)i[r]===e[t]?(e[t]+=";?",r++):e[t]+=";";var n=new RegExp("&(?:"+e.join("|")+"|#[xX][\\da-fA-F]+;?|#\\d+;?)","g"),s=e0(Tu.default);function o(a){return a.substr(-1)!==";"&&(a+=";"),s(a)}return function(a){return String(a).replace(n,o)}}();function e0(i){return function(t){if(t.charAt(1)==="#"){var r=t.charAt(2);return r==="X"||r==="x"?ZO.default(parseInt(t.substr(3),16)):ZO.default(parseInt(t.substr(2),10))}return i[t.slice(1,-1)]||t}}});var Eu=we(Ie=>{"use strict";var t0=Ie&&Ie.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(Ie,"__esModule",{value:!0});Ie.escapeUTF8=Ie.escape=Ie.encodeNonAsciiHTML=Ie.encodeHTML=Ie.encodeXML=void 0;var hT=t0(ku()),i0=n0(hT.default),r0=s0(i0);Ie.encodeXML=l0(i0);var uT=t0(Su()),Cu=n0(uT.default),fT=s0(Cu);Ie.encodeHTML=pT(Cu,fT);Ie.encodeNonAsciiHTML=l0(Cu);function n0(i){return Object.keys(i).sort().reduce(function(e,t){return e[i[t]]="&"+t+";",e},{})}function s0(i){for(var e=[],t=[],r=0,n=Object.keys(i);r<n.length;r++){var s=n[r];s.length===1?e.push("\\"+s):t.push(s)}e.sort();for(var o=0;o<e.length-1;o++){for(var a=o;a<e.length-1&&e[a].charCodeAt(1)+1===e[a+1].charCodeAt(1);)a+=1;var l=1+a-o;l<3||e.splice(o,l,e[o]+"-"+e[a])}return t.unshift("["+e.join("")+"]"),new RegExp(t.join("|"),"g")}var o0=/(?:[\x80-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/g,dT=String.prototype.codePointAt!=null?function(i){return i.codePointAt(0)}:function(i){return(i.charCodeAt(0)-55296)*1024+i.charCodeAt(1)-56320+65536};function va(i){return"&#x"+(i.length>1?dT(i):i.charCodeAt(0)).toString(16).toUpperCase()+";"}function pT(i,e){return function(t){return t.replace(e,function(r){return i[r]}).replace(o0,va)}}var a0=new RegExp(r0.source+"|"+o0.source,"g");function mT(i){return i.replace(a0,va)}Ie.escape=mT;function gT(i){return i.replace(r0,va)}Ie.escapeUTF8=gT;function l0(i){return function(e){return e.replace(a0,function(t){return i[t]||va(t)})}}});var h0=we(X=>{"use strict";Object.defineProperty(X,"__esModule",{value:!0});X.decodeXMLStrict=X.decodeHTML5Strict=X.decodeHTML4Strict=X.decodeHTML5=X.decodeHTML4=X.decodeHTMLStrict=X.decodeHTML=X.decodeXML=X.encodeHTML5=X.encodeHTML4=X.escapeUTF8=X.escape=X.encodeNonAsciiHTML=X.encodeHTML=X.encodeXML=X.encode=X.decodeStrict=X.decode=void 0;var xa=Pu(),c0=Eu();function OT(i,e){return(!e||e<=0?xa.decodeXML:xa.decodeHTML)(i)}X.decode=OT;function yT(i,e){return(!e||e<=0?xa.decodeXML:xa.decodeHTMLStrict)(i)}X.decodeStrict=yT;function bT(i,e){return(!e||e<=0?c0.encodeXML:c0.encodeHTML)(i)}X.encode=bT;var Wi=Eu();Object.defineProperty(X,"encodeXML",{enumerable:!0,get:function(){return Wi.encodeXML}});Object.defineProperty(X,"encodeHTML",{enumerable:!0,get:function(){return Wi.encodeHTML}});Object.defineProperty(X,"encodeNonAsciiHTML",{enumerable:!0,get:function(){return Wi.encodeNonAsciiHTML}});Object.defineProperty(X,"escape",{enumerable:!0,get:function(){return Wi.escape}});Object.defineProperty(X,"escapeUTF8",{enumerable:!0,get:function(){return Wi.escapeUTF8}});Object.defineProperty(X,"encodeHTML4",{enumerable:!0,get:function(){return Wi.encodeHTML}});Object.defineProperty(X,"encodeHTML5",{enumerable:!0,get:function(){return Wi.encodeHTML}});var pi=Pu();Object.defineProperty(X,"decodeXML",{enumerable:!0,get:function(){return pi.decodeXML}});Object.defineProperty(X,"decodeHTML",{enumerable:!0,get:function(){return pi.decodeHTML}});Object.defineProperty(X,"decodeHTMLStrict",{enumerable:!0,get:function(){return pi.decodeHTMLStrict}});Object.defineProperty(X,"decodeHTML4",{enumerable:!0,get:function(){return pi.decodeHTML}});Object.defineProperty(X,"decodeHTML5",{enumerable:!0,get:function(){return pi.decodeHTML}});Object.defineProperty(X,"decodeHTML4Strict",{enumerable:!0,get:function(){return pi.decodeHTMLStrict}});Object.defineProperty(X,"decodeHTML5Strict",{enumerable:!0,get:function(){return pi.decodeHTMLStrict}});Object.defineProperty(X,"decodeXMLStrict",{enumerable:!0,get:function(){return pi.decodeXML}})});var Ru=we((TE,w0)=>{"use strict";function wT(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function u0(i,e){for(var t=0;t<e.length;t++){var r=e[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(i,r.key,r)}}function vT(i,e,t){return e&&u0(i.prototype,e),t&&u0(i,t),i}function O0(i,e){var t=typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(!t){if(Array.isArray(i)||(t=xT(i))||e&&i&&typeof i.length=="number"){t&&(i=t);var r=0,n=function(){};return{s:n,n:function(){return r>=i.length?{done:!0}:{done:!1,value:i[r++]}},e:function(c){throw c},f:n}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var s=!0,o=!1,a;return{s:function(){t=t.call(i)},n:function(){var c=t.next();return s=c.done,c},e:function(c){o=!0,a=c},f:function(){try{!s&&t.return!=null&&t.return()}finally{if(o)throw a}}}}function xT(i,e){if(i){if(typeof i=="string")return f0(i,e);var t=Object.prototype.toString.call(i).slice(8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return Array.from(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return f0(i,e)}}function f0(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,r=new Array(e);t<e;t++)r[t]=i[t];return r}var ST=h0(),d0={fg:"#FFF",bg:"#000",newline:!1,escapeXML:!1,stream:!1,colors:kT()};function kT(){var i={0:"#000",1:"#A00",2:"#0A0",3:"#A50",4:"#00A",5:"#A0A",6:"#0AA",7:"#AAA",8:"#555",9:"#F55",10:"#5F5",11:"#FF5",12:"#55F",13:"#F5F",14:"#5FF",15:"#FFF"};return Sa(0,5).forEach(function(e){Sa(0,5).forEach(function(t){Sa(0,5).forEach(function(r){return TT(e,t,r,i)})})}),Sa(0,23).forEach(function(e){var t=e+232,r=y0(e*10+8);i[t]="#"+r+r+r}),i}function TT(i,e,t,r){var n=16+i*36+e*6+t,s=i>0?i*40+55:0,o=e>0?e*40+55:0,a=t>0?t*40+55:0;r[n]=PT([s,o,a])}function y0(i){for(var e=i.toString(16);e.length<2;)e="0"+e;return e}function PT(i){var e=[],t=O0(i),r;try{for(t.s();!(r=t.n()).done;){var n=r.value;e.push(y0(n))}}catch(s){t.e(s)}finally{t.f()}return"#"+e.join("")}function p0(i,e,t,r){var n;return e==="text"?n=AT(t,r):e==="display"?n=ET(i,t,r):e==="xterm256Foreground"?n=Ta(i,r.colors[t]):e==="xterm256Background"?n=Pa(i,r.colors[t]):e==="rgb"&&(n=CT(i,t)),n}function CT(i,e){e=e.substring(2).slice(0,-1);var t=+e.substr(0,2),r=e.substring(5).split(";"),n=r.map(function(s){return("0"+Number(s).toString(16)).substr(-2)}).join("");return ka(i,(t===38?"color:#":"background-color:#")+n)}function ET(i,e,t){e=parseInt(e,10);var r={"-1":function(){return"<br/>"},0:function(){return i.length&&b0(i)},1:function(){return mi(i,"b")},3:function(){return mi(i,"i")},4:function(){return mi(i,"u")},8:function(){return ka(i,"display:none")},9:function(){return mi(i,"strike")},22:function(){return ka(i,"font-weight:normal;text-decoration:none;font-style:normal")},23:function(){return g0(i,"i")},24:function(){return g0(i,"u")},39:function(){return Ta(i,t.fg)},49:function(){return Pa(i,t.bg)},53:function(){return ka(i,"text-decoration:overline")}},n;return r[e]?n=r[e]():4<e&&e<7?n=mi(i,"blink"):29<e&&e<38?n=Ta(i,t.colors[e-30]):39<e&&e<48?n=Pa(i,t.colors[e-40]):89<e&&e<98?n=Ta(i,t.colors[8+(e-90)]):99<e&&e<108&&(n=Pa(i,t.colors[8+(e-100)])),n}function b0(i){var e=i.slice(0);return i.length=0,e.reverse().map(function(t){return"</"+t+">"}).join("")}function Sa(i,e){for(var t=[],r=i;r<=e;r++)t.push(r);return t}function RT(i){return function(e){return(i===null||e.category!==i)&&i!=="all"}}function m0(i){i=parseInt(i,10);var e=null;return i===0?e="all":i===1?e="bold":2<i&&i<5?e="underline":4<i&&i<7?e="blink":i===8?e="hide":i===9?e="strike":29<i&&i<38||i===39||89<i&&i<98?e="foreground-color":(39<i&&i<48||i===49||99<i&&i<108)&&(e="background-color"),e}function AT(i,e){return e.escapeXML?ST.encodeXML(i):i}function mi(i,e,t){return t||(t=""),i.push(e),"<".concat(e).concat(t?' style="'.concat(t,'"'):"",">")}function ka(i,e){return mi(i,"span",e)}function Ta(i,e){return mi(i,"span","color:"+e)}function Pa(i,e){return mi(i,"span","background-color:"+e)}function g0(i,e){var t;if(i.slice(-1)[0]===e&&(t=i.pop()),t)return"</"+e+">"}function QT(i,e,t){var r=!1,n=3;function s(){return""}function o(w,P){return t("xterm256Foreground",P),""}function a(w,P){return t("xterm256Background",P),""}function l(w){return e.newline?t("display",-1):t("text",w),""}function c(w,P){r=!0,P.trim().length===0&&(P="0"),P=P.trimRight(";").split(";");var C=O0(P),_;try{for(C.s();!(_=C.n()).done;){var $=_.value;t("display",$)}}catch(q){C.e(q)}finally{C.f()}return""}function h(w){return t("text",w),""}function u(w){return t("rgb",w),""}var f=[{pattern:/^\x08+/,sub:s},{pattern:/^\x1b\[[012]?K/,sub:s},{pattern:/^\x1b\[\(B/,sub:s},{pattern:/^\x1b\[[34]8;2;\d+;\d+;\d+m/,sub:u},{pattern:/^\x1b\[38;5;(\d+)m/,sub:o},{pattern:/^\x1b\[48;5;(\d+)m/,sub:a},{pattern:/^\n/,sub:l},{pattern:/^\r+\n/,sub:l},{pattern:/^\r/,sub:l},{pattern:/^\x1b\[((?:\d{1,3};?)+|)m/,sub:c},{pattern:/^\x1b\[\d?J/,sub:s},{pattern:/^\x1b\[\d{0,3};\d{0,3}f/,sub:s},{pattern:/^\x1b\[?[\d;]{0,3}/,sub:s},{pattern:/^(([^\x1b\x08\r\n])+)/,sub:h}];function d(w,P){P>n&&r||(r=!1,i=i.replace(w.pattern,w.sub))}var m=[],p=i,g=p.length;e:for(;g>0;){for(var O=0,y=0,x=f.length;y<x;O=++y){var v=f[O];if(d(v,O),i.length!==g){g=i.length;continue e}}if(i.length===g)break;m.push(0),g=i.length}return m}function MT(i,e,t){return e!=="text"&&(i=i.filter(RT(m0(t))),i.push({token:e,data:t,category:m0(t)})),i}var _T=function(){function i(e){wT(this,i),e=e||{},e.colors&&(e.colors=Object.assign({},d0.colors,e.colors)),this.options=Object.assign({},d0,e),this.stack=[],this.stickyStack=[]}return vT(i,[{key:"toHtml",value:function(t){var r=this;t=typeof t=="string"?[t]:t;var n=this.stack,s=this.options,o=[];return this.stickyStack.forEach(function(a){var l=p0(n,a.token,a.data,s);l&&o.push(l)}),QT(t.join(""),s,function(a,l){var c=p0(n,a,l,s);c&&o.push(c),s.stream&&(r.stickyStack=MT(r.stickyStack,a,l))}),n.length&&o.push(b0(n)),o.join("")}}]),i}();w0.exports=_T});var x0=we((DE,DT)=>{DT.exports="CmltcG9ydCBweW9kaWRlICMgdHlwZTog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luZyBmb3IgZXZhbHVhdGUgYW5kIGtuaXRyCm9wdGlvbnMoIndlYnIuZXZhbHVhdGUuaGFuZGxlciIgPSBldmFsdWF0ZTo6bmV3X291dHB1dF9oYW5kbGVyKAogIHZhbHVlID0gZnVuY3Rpb24oeCwgdmlzaWJsZSkgewogICAga25pdF9vcHRpb25zID0gbGlzdChzY3JlZW5zaG90LmZvcmNlID0gRkFMU0UpCiAgICByZXMgPC0gaWYgKHZpc2libGUpIHsKICAgICAgd2l0aFZpc2libGUoCiAgICAgICAga25pdHI6OmtuaXRfcHJpbnQoCiAgICAgICAgICBpZiAoaW5oZXJpdHMoeCwgImRhdGEuZnJhbWUiKSkgewogICAgICAgICAgICBzd2l0Y2goCiAgICAgICAgICAgICAgZ2V0T3B0aW9uKCJ3ZWJyLnJlbmRlci5kZiIsICJkZWZhdWx0IiksCiAgICAgICAgICAgICAgImthYmxlIiA9IGtuaXRyOjprYWJsZSh4KSwKICAgICAgICAgICAgICAiZHQiID0gRFQ6OmRhdGF0YWJsZSh4KSwKICAgICAgICAgICAgICAicGFnZWQtdGFibGUiID0gcm1hcmtkb3duOjpwYWdlZF90YWJsZSh4KSwKICAgICAgICAgICAgICAiZ3QiID0gZ3Q6Omd0KHgpLAogICAgICAgICAgICAgICJndC1pbnRlcmFjdGl2ZSIgPSBndDo6b3B0X2ludGVyYWN0aXZlKGd0OjpndCh4KSksCiAgICAgICAgICAgICAgInJlYWN0YWJsZSIgPSByZWFjdGFibGU6OnJlYWN0YWJsZSh4KSwKICAgICAgICAgICAgICB4CiAgICAgICAgICAgICkKICAgICAgICAgIH0gZWxzZSB4LAogICAgICAgIG9wdGlvbnMgPSBrbml0X29wdGlvbnMpCiAgICAgICkKICAgIH0gZWxzZSBsaXN0KHZhbHVlID0geCwgdmlzaWJsZSA9IEZBTFNFKQogICAgcmVzJGNsYXNzIDwtIGNsYXNzKHJlcyR2YWx1ZSkKICAgIGNsYXNzKHJlcykgPC0gInJlc3VsdCIKICAgIHJlcw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eUNhdGNoKHsKICAgICMgUGFyc2UgcHJvdmlkZWQgY2hlY2sgY29kZQogICAgcGFyc2VkX2NoZWNrX2NvZGUgPC0gcGFyc2UodGV4dCA9IGNoZWNrX2NvZGUpCgogICAgIyBFdmFsdWF0ZSBwcm92aWRlZCBjaGVjayBjb2RlCiAgICBldmFsKHBhcnNlZF9jaGVja19jb2RlKQogIH0sIGVycm9yID0gZnVuY3Rpb24oZSkgewogICAgbGlzdCgKICAgICAgbWVzc2FnZSA9IHBhc3RlMCgiRXJyb3IgaW4gY2hlY2tpbmcgY29kZSBmb3IgYCIsIGxhYmVsLCAiYDogIiwgZSRtZXNzYWdlKSwKICAgICAgY29ycmVjdCA9IEZBTFNFLAogICAgICBsb2NhdGlvbiA9ICJhcHBlbmQiLAogICAgICB0eXBlID0gIndhcm5pbmciCiAgICApCiAgfSkKfSkK"});var M0=we((cR,BT)=>{BT.exports="aW1wb3J0IHN5cwppbXBvcnQgb3MKaW1wb3J0IHB5b2RpZGVfaHR0cCAgIyB0eXBlOiBpZ25vcmVbYXR0ci1kZWZpbmVkXQpweW9kaWRlX2h0dHAucGF0Y2hfYWxsKCkKc3lzLnBhdGguaW5zZXJ0KDAsICIvcHlvZGlkZS8iKQpvcy5ta2Rpcihvcy5wYXRoLmV4cGFuZHVzZXIoIn4vLm1hdHBsb3RsaWIiKSkKZiA9IG9wZW4ob3MucGF0aC5leHBhbmR1c2VyKCJ+Ly5tYXRwbG90bGliL21hdHBsb3RsaWJyYyIpLCAiYSIpCmYud3JpdGUoImJhY2tlbmQ6IG1vZHVsZTovL21hdHBsb3RsaWJfZGlzcGxheSIpCmYuY2xvc2UoKQo="});var _0=we((hR,XT)=>{XT.exports=" "});var Ol={};B0(Ol,{ChannelType:()=>qt,Console:()=>_y,Shelter:()=>il,WebR:()=>Af,WebRChannelError:()=>ct,WebRError:()=>wi,WebRPayloadError:()=>Wr,WebRWorkerError:()=>ht,isRCall:()=>ks,isRCharacter:()=>Zi,isRComplex:()=>Ry,isRDouble:()=>Ey,isREnvironment:()=>Ty,isRFunction:()=>Ts,isRInteger:()=>Cy,isRList:()=>ut,isRLogical:()=>Py,isRNull:()=>Ae,isRObject:()=>ie,isRPairlist:()=>ky,isRRaw:()=>gl,isRSymbol:()=>Sy,isShelterID:()=>sy});var N0=Object.create,Xu=Object.defineProperty,j0=Object.getOwnPropertyDescriptor,I0=Object.getOwnPropertyNames,W0=Object.getPrototypeOf,z0=Object.prototype.hasOwnProperty,Nu=i=>{throw TypeError(i)},Ui=(i=>typeof Oi<"u"?Oi:typeof Proxy<"u"?new Proxy(i,{get:(e,t)=>(typeof Oi<"u"?Oi:e)[t]}):i)(function(i){if(typeof Oi<"u")return Oi.apply(this,arguments);throw Error('Dynamic require of "'+i+'" is not supported')}),Te=(i,e)=>()=>(e||i((e={exports:{}}).exports,e),e.exports),U0=(i,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of I0(e))!z0.call(i,n)&&n!==t&&Xu(i,n,{get:()=>e[n],enumerable:!(r=j0(e,n))||r.enumerable});return i},ns=(i,e,t)=>(t=i!=null?N0(W0(i)):{},U0(e||!i||!i.__esModule?Xu(t,"default",{value:i,enumerable:!0}):t,i)),rl=(i,e,t)=>e.has(i)||Nu("Cannot "+t),S=(i,e,t)=>(rl(i,e,"read from private field"),t?t.call(i):e.get(i)),V=(i,e,t)=>e.has(i)?Nu("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(i):e.set(i,t),ue=(i,e,t,r)=>(rl(i,e,"write to private field"),r?r.call(i,t):e.set(i,t),t),tt=(i,e,t)=>(rl(i,e,"access private method"),t),vs=Te(i=>{"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.getUint64=i.getInt64=i.setInt64=i.setUint64=i.UINT32_MAX=void 0,i.UINT32_MAX=4294967295;function e(s,o,a){let l=a/4294967296,c=a;s.setUint32(o,l),s.setUint32(o+4,c)}i.setUint64=e;function t(s,o,a){let l=Math.floor(a/4294967296),c=a;s.setUint32(o,l),s.setUint32(o+4,c)}i.setInt64=t;function r(s,o){let a=s.getInt32(o),l=s.getUint32(o+4);return a*4294967296+l}i.getInt64=r;function n(s,o){let a=s.getUint32(o),l=s.getUint32(o+4);return a*4294967296+l}i.getUint64=n}),nl=Te(i=>{"use strict";var e,t,r;Object.defineProperty(i,"__esModule",{value:!0}),i.utf8DecodeTD=i.TEXT_DECODER_THRESHOLD=i.utf8DecodeJs=i.utf8EncodeTE=i.TEXT_ENCODER_THRESHOLD=i.utf8EncodeJs=i.utf8Count=void 0;var n=vs(),s=(typeof process>"u"||((e=process==null?void 0:process.env)===null||e===void 0?void 0:e.TEXT_ENCODING)!=="never")&&typeof TextEncoder<"u"&&typeof TextDecoder<"u";function o(p){let g=p.length,O=0,y=0;for(;y<g;){let x=p.charCodeAt(y++);if((x&4294967168)===0){O++;continue}else if((x&4294965248)===0)O+=2;else{if(x>=55296&&x<=56319&&y<g){let v=p.charCodeAt(y);(v&64512)===56320&&(++y,x=((x&1023)<<10)+(v&1023)+65536)}(x&4294901760)===0?O+=3:O+=4}}return O}i.utf8Count=o;function a(p,g,O){let y=p.length,x=O,v=0;for(;v<y;){let w=p.charCodeAt(v++);if((w&4294967168)===0){g[x++]=w;continue}else if((w&4294965248)===0)g[x++]=w>>6&31|192;else{if(w>=55296&&w<=56319&&v<y){let P=p.charCodeAt(v);(P&64512)===56320&&(++v,w=((w&1023)<<10)+(P&1023)+65536)}(w&4294901760)===0?(g[x++]=w>>12&15|224,g[x++]=w>>6&63|128):(g[x++]=w>>18&7|240,g[x++]=w>>12&63|128,g[x++]=w>>6&63|128)}g[x++]=w&63|128}}i.utf8EncodeJs=a;var l=s?new TextEncoder:void 0;i.TEXT_ENCODER_THRESHOLD=s?typeof process<"u"&&((t=process==null?void 0:process.env)===null||t===void 0?void 0:t.TEXT_ENCODING)!=="force"?200:0:n.UINT32_MAX;function c(p,g,O){g.set(l.encode(p),O)}function h(p,g,O){l.encodeInto(p,g.subarray(O))}i.utf8EncodeTE=l!=null&&l.encodeInto?h:c;var u=4096;function f(p,g,O){let y=g,x=y+O,v=[],w="";for(;y<x;){let P=p[y++];if((P&128)===0)v.push(P);else if((P&224)===192){let C=p[y++]&63;v.push((P&31)<<6|C)}else if((P&240)===224){let C=p[y++]&63,_=p[y++]&63;v.push((P&31)<<12|C<<6|_)}else if((P&248)===240){let C=p[y++]&63,_=p[y++]&63,$=p[y++]&63,q=(P&7)<<18|C<<12|_<<6|$;q>65535&&(q-=65536,v.push(q>>>10&1023|55296),q=56320|q&1023),v.push(q)}else v.push(P);v.length>=u&&(w+=String.fromCharCode(...v),v.length=0)}return v.length>0&&(w+=String.fromCharCode(...v)),w}i.utf8DecodeJs=f;var d=s?new TextDecoder:null;i.TEXT_DECODER_THRESHOLD=s?typeof process<"u"&&((r=process==null?void 0:process.env)===null||r===void 0?void 0:r.TEXT_DECODER)!=="force"?200:0:n.UINT32_MAX;function m(p,g,O){let y=p.subarray(g,g+O);return d.decode(y)}i.utf8DecodeTD=m}),ju=Te(i=>{"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.ExtData=void 0;var e=class{constructor(t,r){this.type=t,this.data=r}};i.ExtData=e}),sl=Te(i=>{"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.DecodeError=void 0;var e=class Da extends Error{constructor(r){super(r);let n=Object.create(Da.prototype);Object.setPrototypeOf(this,n),Object.defineProperty(this,"name",{configurable:!0,enumerable:!1,value:Da.name})}};i.DecodeError=e}),Iu=Te(i=>{"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.timestampExtension=i.decodeTimestampExtension=i.decodeTimestampToTimeSpec=i.encodeTimestampExtension=i.encodeDateToTimeSpec=i.encodeTimeSpecToTimestamp=i.EXT_TIMESTAMP=void 0;var e=sl(),t=vs();i.EXT_TIMESTAMP=-1;var r=4294967296-1,n=17179869184-1;function s({sec:h,nsec:u}){if(h>=0&&u>=0&&h<=n)if(u===0&&h<=r){let f=new Uint8Array(4);return new DataView(f.buffer).setUint32(0,h),f}else{let f=h/4294967296,d=h&4294967295,m=new Uint8Array(8),p=new DataView(m.buffer);return p.setUint32(0,u<<2|f&3),p.setUint32(4,d),m}else{let f=new Uint8Array(12),d=new DataView(f.buffer);return d.setUint32(0,u),(0,t.setInt64)(d,4,h),f}}i.encodeTimeSpecToTimestamp=s;function o(h){let u=h.getTime(),f=Math.floor(u/1e3),d=(u-f*1e3)*1e6,m=Math.floor(d/1e9);return{sec:f+m,nsec:d-m*1e9}}i.encodeDateToTimeSpec=o;function a(h){if(h instanceof Date){let u=o(h);return s(u)}else return null}i.encodeTimestampExtension=a;function l(h){let u=new DataView(h.buffer,h.byteOffset,h.byteLength);switch(h.byteLength){case 4:return{sec:u.getUint32(0),nsec:0};case 8:{let f=u.getUint32(0),d=u.getUint32(4),m=(f&3)*4294967296+d,p=f>>>2;return{sec:m,nsec:p}}case 12:{let f=(0,t.getInt64)(u,4),d=u.getUint32(0);return{sec:f,nsec:d}}default:throw new e.DecodeError(`Unrecognized data size for timestamp (expected 4, 8, or 12): ${h.length}`)}}i.decodeTimestampToTimeSpec=l;function c(h){let u=l(h);return new Date(u.sec*1e3+u.nsec/1e6)}i.decodeTimestampExtension=c,i.timestampExtension={type:i.EXT_TIMESTAMP,encode:a,decode:c}}),ol=Te(i=>{"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.ExtensionCodec=void 0;var e=ju(),t=Iu(),r=class{constructor(){this.builtInEncoders=[],this.builtInDecoders=[],this.encoders=[],this.decoders=[],this.register(t.timestampExtension)}register({type:n,encode:s,decode:o}){if(n>=0)this.encoders[n]=s,this.decoders[n]=o;else{let a=1+n;this.builtInEncoders[a]=s,this.builtInDecoders[a]=o}}tryToEncode(n,s){for(let o=0;o<this.builtInEncoders.length;o++){let a=this.builtInEncoders[o];if(a!=null){let l=a(n,s);if(l!=null){let c=-1-o;return new e.ExtData(c,l)}}}for(let o=0;o<this.encoders.length;o++){let a=this.encoders[o];if(a!=null){let l=a(n,s);if(l!=null){let c=o;return new e.ExtData(c,l)}}}return n instanceof e.ExtData?n:null}decode(n,s,o){let a=s<0?this.builtInDecoders[-1-s]:this.decoders[s];return a?a(n,s,o):new e.ExtData(s,n)}};i.ExtensionCodec=r,r.defaultCodec=new r}),Wu=Te(i=>{"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.createDataView=i.ensureUint8Array=void 0;function e(r){return r instanceof Uint8Array?r:ArrayBuffer.isView(r)?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):r instanceof ArrayBuffer?new Uint8Array(r):Uint8Array.from(r)}i.ensureUint8Array=e;function t(r){if(r instanceof ArrayBuffer)return new DataView(r);let n=e(r);return new DataView(n.buffer,n.byteOffset,n.byteLength)}i.createDataView=t}),zu=Te(i=>{"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.Encoder=i.DEFAULT_INITIAL_BUFFER_SIZE=i.DEFAULT_MAX_DEPTH=void 0;var e=nl(),t=ol(),r=vs(),n=Wu();i.DEFAULT_MAX_DEPTH=100,i.DEFAULT_INITIAL_BUFFER_SIZE=2048;var s=class{constructor(o=t.ExtensionCodec.defaultCodec,a=void 0,l=i.DEFAULT_MAX_DEPTH,c=i.DEFAULT_INITIAL_BUFFER_SIZE,h=!1,u=!1,f=!1,d=!1){this.extensionCodec=o,this.context=a,this.maxDepth=l,this.initialBufferSize=c,this.sortKeys=h,this.forceFloat32=u,this.ignoreUndefined=f,this.forceIntegerToFloat=d,this.pos=0,this.view=new DataView(new ArrayBuffer(this.initialBufferSize)),this.bytes=new Uint8Array(this.view.buffer)}reinitializeState(){this.pos=0}encodeSharedRef(o){return this.reinitializeState(),this.doEncode(o,1),this.bytes.subarray(0,this.pos)}encode(o){return this.reinitializeState(),this.doEncode(o,1),this.bytes.slice(0,this.pos)}doEncode(o,a){if(a>this.maxDepth)throw new Error(`Too deep objects in depth ${a}`);o==null?this.encodeNil():typeof o=="boolean"?this.encodeBoolean(o):typeof o=="number"?this.encodeNumber(o):typeof o=="string"?this.encodeString(o):this.encodeObject(o,a)}ensureBufferSizeToWrite(o){let a=this.pos+o;this.view.byteLength<a&&this.resizeBuffer(a*2)}resizeBuffer(o){let a=new ArrayBuffer(o),l=new Uint8Array(a),c=new DataView(a);l.set(this.bytes),this.view=c,this.bytes=l}encodeNil(){this.writeU8(192)}encodeBoolean(o){o===!1?this.writeU8(194):this.writeU8(195)}encodeNumber(o){Number.isSafeInteger(o)&&!this.forceIntegerToFloat?o>=0?o<128?this.writeU8(o):o<256?(this.writeU8(204),this.writeU8(o)):o<65536?(this.writeU8(205),this.writeU16(o)):o<4294967296?(this.writeU8(206),this.writeU32(o)):(this.writeU8(207),this.writeU64(o)):o>=-32?this.writeU8(224|o+32):o>=-128?(this.writeU8(208),this.writeI8(o)):o>=-32768?(this.writeU8(209),this.writeI16(o)):o>=-2147483648?(this.writeU8(210),this.writeI32(o)):(this.writeU8(211),this.writeI64(o)):this.forceFloat32?(this.writeU8(202),this.writeF32(o)):(this.writeU8(203),this.writeF64(o))}writeStringHeader(o){if(o<32)this.writeU8(160+o);else if(o<256)this.writeU8(217),this.writeU8(o);else if(o<65536)this.writeU8(218),this.writeU16(o);else if(o<4294967296)this.writeU8(219),this.writeU32(o);else throw new Error(`Too long string: ${o} bytes in UTF-8`)}encodeString(o){if(o.length>e.TEXT_ENCODER_THRESHOLD){let a=(0,e.utf8Count)(o);this.ensureBufferSizeToWrite(5+a),this.writeStringHeader(a),(0,e.utf8EncodeTE)(o,this.bytes,this.pos),this.pos+=a}else{let a=(0,e.utf8Count)(o);this.ensureBufferSizeToWrite(5+a),this.writeStringHeader(a),(0,e.utf8EncodeJs)(o,this.bytes,this.pos),this.pos+=a}}encodeObject(o,a){let l=this.extensionCodec.tryToEncode(o,this.context);if(l!=null)this.encodeExtension(l);else if(Array.isArray(o))this.encodeArray(o,a);else if(ArrayBuffer.isView(o))this.encodeBinary(o);else if(typeof o=="object")this.encodeMap(o,a);else throw new Error(`Unrecognized object: ${Object.prototype.toString.apply(o)}`)}encodeBinary(o){let a=o.byteLength;if(a<256)this.writeU8(196),this.writeU8(a);else if(a<65536)this.writeU8(197),this.writeU16(a);else if(a<4294967296)this.writeU8(198),this.writeU32(a);else throw new Error(`Too large binary: ${a}`);let l=(0,n.ensureUint8Array)(o);this.writeU8a(l)}encodeArray(o,a){let l=o.length;if(l<16)this.writeU8(144+l);else if(l<65536)this.writeU8(220),this.writeU16(l);else if(l<4294967296)this.writeU8(221),this.writeU32(l);else throw new Error(`Too large array: ${l}`);for(let c of o)this.doEncode(c,a+1)}countWithoutUndefined(o,a){let l=0;for(let c of a)o[c]!==void 0&&l++;return l}encodeMap(o,a){let l=Object.keys(o);this.sortKeys&&l.sort();let c=this.ignoreUndefined?this.countWithoutUndefined(o,l):l.length;if(c<16)this.writeU8(128+c);else if(c<65536)this.writeU8(222),this.writeU16(c);else if(c<4294967296)this.writeU8(223),this.writeU32(c);else throw new Error(`Too large map object: ${c}`);for(let h of l){let u=o[h];this.ignoreUndefined&&u===void 0||(this.encodeString(h),this.doEncode(u,a+1))}}encodeExtension(o){let a=o.data.length;if(a===1)this.writeU8(212);else if(a===2)this.writeU8(213);else if(a===4)this.writeU8(214);else if(a===8)this.writeU8(215);else if(a===16)this.writeU8(216);else if(a<256)this.writeU8(199),this.writeU8(a);else if(a<65536)this.writeU8(200),this.writeU16(a);else if(a<4294967296)this.writeU8(201),this.writeU32(a);else throw new Error(`Too large extension object: ${a}`);this.writeI8(o.type),this.writeU8a(o.data)}writeU8(o){this.ensureBufferSizeToWrite(1),this.view.setUint8(this.pos,o),this.pos++}writeU8a(o){let a=o.length;this.ensureBufferSizeToWrite(a),this.bytes.set(o,this.pos),this.pos+=a}writeI8(o){this.ensureBufferSizeToWrite(1),this.view.setInt8(this.pos,o),this.pos++}writeU16(o){this.ensureBufferSizeToWrite(2),this.view.setUint16(this.pos,o),this.pos+=2}writeI16(o){this.ensureBufferSizeToWrite(2),this.view.setInt16(this.pos,o),this.pos+=2}writeU32(o){this.ensureBufferSizeToWrite(4),this.view.setUint32(this.pos,o),this.pos+=4}writeI32(o){this.ensureBufferSizeToWrite(4),this.view.setInt32(this.pos,o),this.pos+=4}writeF32(o){this.ensureBufferSizeToWrite(4),this.view.setFloat32(this.pos,o),this.pos+=4}writeF64(o){this.ensureBufferSizeToWrite(8),this.view.setFloat64(this.pos,o),this.pos+=8}writeU64(o){this.ensureBufferSizeToWrite(8),(0,r.setUint64)(this.view,this.pos,o),this.pos+=8}writeI64(o){this.ensureBufferSizeToWrite(8),(0,r.setInt64)(this.view,this.pos,o),this.pos+=8}};i.Encoder=s}),F0=Te(i=>{"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.encode=void 0;var e=zu(),t={};function r(n,s=t){return new e.Encoder(s.extensionCodec,s.context,s.maxDepth,s.initialBufferSize,s.sortKeys,s.forceFloat32,s.ignoreUndefined,s.forceIntegerToFloat).encodeSharedRef(n)}i.encode=r}),H0=Te(i=>{"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.prettyByte=void 0;function e(t){return`${t<0?"-":""}0x${Math.abs(t).toString(16).padStart(2,"0")}`}i.prettyByte=e}),G0=Te(i=>{"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.CachedKeyDecoder=void 0;var e=nl(),t=16,r=16,n=class{constructor(s=t,o=r){this.maxKeyLength=s,this.maxLengthPerKey=o,this.hit=0,this.miss=0,this.caches=[];for(let a=0;a<this.maxKeyLength;a++)this.caches.push([])}canBeCached(s){return s>0&&s<=this.maxKeyLength}find(s,o,a){let l=this.caches[a-1];e:for(let c of l){let h=c.bytes;for(let u=0;u<a;u++)if(h[u]!==s[o+u])continue e;return c.str}return null}store(s,o){let a=this.caches[s.length-1],l={bytes:s,str:o};a.length>=this.maxLengthPerKey?a[Math.random()*a.length|0]=l:a.push(l)}decode(s,o,a){let l=this.find(s,o,a);if(l!=null)return this.hit++,l;this.miss++;let c=(0,e.utf8DecodeJs)(s,o,a),h=Uint8Array.prototype.slice.call(s,o,o+a);return this.store(h,c),c}};i.CachedKeyDecoder=n}),al=Te(i=>{"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.Decoder=i.DataViewIndexOutOfBoundsError=void 0;var e=H0(),t=ol(),r=vs(),n=nl(),s=Wu(),o=G0(),a=sl(),l=p=>{let g=typeof p;return g==="string"||g==="number"},c=-1,h=new DataView(new ArrayBuffer(0)),u=new Uint8Array(h.buffer);i.DataViewIndexOutOfBoundsError=(()=>{try{h.getInt8(0)}catch(p){return p.constructor}throw new Error("never reached")})();var f=new i.DataViewIndexOutOfBoundsError("Insufficient data"),d=new o.CachedKeyDecoder,m=class{constructor(p=t.ExtensionCodec.defaultCodec,g=void 0,O=r.UINT32_MAX,y=r.UINT32_MAX,x=r.UINT32_MAX,v=r.UINT32_MAX,w=r.UINT32_MAX,P=d){this.extensionCodec=p,this.context=g,this.maxStrLength=O,this.maxBinLength=y,this.maxArrayLength=x,this.maxMapLength=v,this.maxExtLength=w,this.keyDecoder=P,this.totalPos=0,this.pos=0,this.view=h,this.bytes=u,this.headByte=c,this.stack=[]}reinitializeState(){this.totalPos=0,this.headByte=c,this.stack.length=0}setBuffer(p){this.bytes=(0,s.ensureUint8Array)(p),this.view=(0,s.createDataView)(this.bytes),this.pos=0}appendBuffer(p){if(this.headByte===c&&!this.hasRemaining(1))this.setBuffer(p);else{let g=this.bytes.subarray(this.pos),O=(0,s.ensureUint8Array)(p),y=new Uint8Array(g.length+O.length);y.set(g),y.set(O,g.length),this.setBuffer(y)}}hasRemaining(p){return this.view.byteLength-this.pos>=p}createExtraByteError(p){let{view:g,pos:O}=this;return new RangeError(`Extra ${g.byteLength-O} of ${g.byteLength} byte(s) found at buffer[${p}]`)}decode(p){this.reinitializeState(),this.setBuffer(p);let g=this.doDecodeSync();if(this.hasRemaining(1))throw this.createExtraByteError(this.pos);return g}*decodeMulti(p){for(this.reinitializeState(),this.setBuffer(p);this.hasRemaining(1);)yield this.doDecodeSync()}async decodeAsync(p){let g=!1,O;for await(let w of p){if(g)throw this.createExtraByteError(this.totalPos);this.appendBuffer(w);try{O=this.doDecodeSync(),g=!0}catch(P){if(!(P instanceof i.DataViewIndexOutOfBoundsError))throw P}this.totalPos+=this.pos}if(g){if(this.hasRemaining(1))throw this.createExtraByteError(this.totalPos);return O}let{headByte:y,pos:x,totalPos:v}=this;throw new RangeError(`Insufficient data in parsing ${(0,e.prettyByte)(y)} at ${v} (${x} in the current buffer)`)}decodeArrayStream(p){return this.decodeMultiAsync(p,!0)}decodeStream(p){return this.decodeMultiAsync(p,!1)}async*decodeMultiAsync(p,g){let O=g,y=-1;for await(let x of p){if(g&&y===0)throw this.createExtraByteError(this.totalPos);this.appendBuffer(x),O&&(y=this.readArraySize(),O=!1,this.complete());try{for(;yield this.doDecodeSync(),--y!==0;);}catch(v){if(!(v instanceof i.DataViewIndexOutOfBoundsError))throw v}this.totalPos+=this.pos}}doDecodeSync(){e:for(;;){let p=this.readHeadByte(),g;if(p>=224)g=p-256;else if(p<192)if(p<128)g=p;else if(p<144){let y=p-128;if(y!==0){this.pushMapState(y),this.complete();continue e}else g={}}else if(p<160){let y=p-144;if(y!==0){this.pushArrayState(y),this.complete();continue e}else g=[]}else{let y=p-160;g=this.decodeUtf8String(y,0)}else if(p===192)g=null;else if(p===194)g=!1;else if(p===195)g=!0;else if(p===202)g=this.readF32();else if(p===203)g=this.readF64();else if(p===204)g=this.readU8();else if(p===205)g=this.readU16();else if(p===206)g=this.readU32();else if(p===207)g=this.readU64();else if(p===208)g=this.readI8();else if(p===209)g=this.readI16();else if(p===210)g=this.readI32();else if(p===211)g=this.readI64();else if(p===217){let y=this.lookU8();g=this.decodeUtf8String(y,1)}else if(p===218){let y=this.lookU16();g=this.decodeUtf8String(y,2)}else if(p===219){let y=this.lookU32();g=this.decodeUtf8String(y,4)}else if(p===220){let y=this.readU16();if(y!==0){this.pushArrayState(y),this.complete();continue e}else g=[]}else if(p===221){let y=this.readU32();if(y!==0){this.pushArrayState(y),this.complete();continue e}else g=[]}else if(p===222){let y=this.readU16();if(y!==0){this.pushMapState(y),this.complete();continue e}else g={}}else if(p===223){let y=this.readU32();if(y!==0){this.pushMapState(y),this.complete();continue e}else g={}}else if(p===196){let y=this.lookU8();g=this.decodeBinary(y,1)}else if(p===197){let y=this.lookU16();g=this.decodeBinary(y,2)}else if(p===198){let y=this.lookU32();g=this.decodeBinary(y,4)}else if(p===212)g=this.decodeExtension(1,0);else if(p===213)g=this.decodeExtension(2,0);else if(p===214)g=this.decodeExtension(4,0);else if(p===215)g=this.decodeExtension(8,0);else if(p===216)g=this.decodeExtension(16,0);else if(p===199){let y=this.lookU8();g=this.decodeExtension(y,1)}else if(p===200){let y=this.lookU16();g=this.decodeExtension(y,2)}else if(p===201){let y=this.lookU32();g=this.decodeExtension(y,4)}else throw new a.DecodeError(`Unrecognized type byte: ${(0,e.prettyByte)(p)}`);this.complete();let O=this.stack;for(;O.length>0;){let y=O[O.length-1];if(y.type===0)if(y.array[y.position]=g,y.position++,y.position===y.size)O.pop(),g=y.array;else continue e;else if(y.type===1){if(!l(g))throw new a.DecodeError("The type of key must be string or number but "+typeof g);if(g==="__proto__")throw new a.DecodeError("The key __proto__ is not allowed");y.key=g,y.type=2;continue e}else if(y.map[y.key]=g,y.readCount++,y.readCount===y.size)O.pop(),g=y.map;else{y.key=null,y.type=1;continue e}}return g}}readHeadByte(){return this.headByte===c&&(this.headByte=this.readU8()),this.headByte}complete(){this.headByte=c}readArraySize(){let p=this.readHeadByte();switch(p){case 220:return this.readU16();case 221:return this.readU32();default:{if(p<160)return p-144;throw new a.DecodeError(`Unrecognized array type byte: ${(0,e.prettyByte)(p)}`)}}}pushMapState(p){if(p>this.maxMapLength)throw new a.DecodeError(`Max length exceeded: map length (${p}) > maxMapLengthLength (${this.maxMapLength})`);this.stack.push({type:1,size:p,key:null,readCount:0,map:{}})}pushArrayState(p){if(p>this.maxArrayLength)throw new a.DecodeError(`Max length exceeded: array length (${p}) > maxArrayLength (${this.maxArrayLength})`);this.stack.push({type:0,size:p,array:new Array(p),position:0})}decodeUtf8String(p,g){var O;if(p>this.maxStrLength)throw new a.DecodeError(`Max length exceeded: UTF-8 byte length (${p}) > maxStrLength (${this.maxStrLength})`);if(this.bytes.byteLength<this.pos+g+p)throw f;let y=this.pos+g,x;return this.stateIsMapKey()&&!((O=this.keyDecoder)===null||O===void 0)&&O.canBeCached(p)?x=this.keyDecoder.decode(this.bytes,y,p):p>n.TEXT_DECODER_THRESHOLD?x=(0,n.utf8DecodeTD)(this.bytes,y,p):x=(0,n.utf8DecodeJs)(this.bytes,y,p),this.pos+=g+p,x}stateIsMapKey(){return this.stack.length>0?this.stack[this.stack.length-1].type===1:!1}decodeBinary(p,g){if(p>this.maxBinLength)throw new a.DecodeError(`Max length exceeded: bin length (${p}) > maxBinLength (${this.maxBinLength})`);if(!this.hasRemaining(p+g))throw f;let O=this.pos+g,y=this.bytes.subarray(O,O+p);return this.pos+=g+p,y}decodeExtension(p,g){if(p>this.maxExtLength)throw new a.DecodeError(`Max length exceeded: ext length (${p}) > maxExtLength (${this.maxExtLength})`);let O=this.view.getInt8(this.pos+g),y=this.decodeBinary(p,g+1);return this.extensionCodec.decode(y,O,this.context)}lookU8(){return this.view.getUint8(this.pos)}lookU16(){return this.view.getUint16(this.pos)}lookU32(){return this.view.getUint32(this.pos)}readU8(){let p=this.view.getUint8(this.pos);return this.pos++,p}readI8(){let p=this.view.getInt8(this.pos);return this.pos++,p}readU16(){let p=this.view.getUint16(this.pos);return this.pos+=2,p}readI16(){let p=this.view.getInt16(this.pos);return this.pos+=2,p}readU32(){let p=this.view.getUint32(this.pos);return this.pos+=4,p}readI32(){let p=this.view.getInt32(this.pos);return this.pos+=4,p}readU64(){let p=(0,r.getUint64)(this.view,this.pos);return this.pos+=8,p}readI64(){let p=(0,r.getInt64)(this.view,this.pos);return this.pos+=8,p}readF32(){let p=this.view.getFloat32(this.pos);return this.pos+=4,p}readF64(){let p=this.view.getFloat64(this.pos);return this.pos+=8,p}};i.Decoder=m}),Uu=Te(i=>{"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.decodeMulti=i.decode=i.defaultDecodeOptions=void 0;var e=al();i.defaultDecodeOptions={};function t(n,s=i.defaultDecodeOptions){return new e.Decoder(s.extensionCodec,s.context,s.maxStrLength,s.maxBinLength,s.maxArrayLength,s.maxMapLength,s.maxExtLength).decode(n)}i.decode=t;function r(n,s=i.defaultDecodeOptions){return new e.Decoder(s.extensionCodec,s.context,s.maxStrLength,s.maxBinLength,s.maxArrayLength,s.maxMapLength,s.maxExtLength).decodeMulti(n)}i.decodeMulti=r}),Y0=Te(i=>{"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.ensureAsyncIterable=i.asyncIterableFromStream=i.isAsyncIterable=void 0;function e(s){return s[Symbol.asyncIterator]!=null}i.isAsyncIterable=e;function t(s){if(s==null)throw new Error("Assertion Failure: value must not be null nor undefined")}async function*r(s){let o=s.getReader();try{for(;;){let{done:a,value:l}=await o.read();if(a)return;t(l),yield l}}finally{o.releaseLock()}}i.asyncIterableFromStream=r;function n(s){return e(s)?s:r(s)}i.ensureAsyncIterable=n}),Z0=Te(i=>{"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.decodeStream=i.decodeMultiStream=i.decodeArrayStream=i.decodeAsync=void 0;var e=al(),t=Y0(),r=Uu();async function n(l,c=r.defaultDecodeOptions){let h=(0,t.ensureAsyncIterable)(l);return new e.Decoder(c.extensionCodec,c.context,c.maxStrLength,c.maxBinLength,c.maxArrayLength,c.maxMapLength,c.maxExtLength).decodeAsync(h)}i.decodeAsync=n;function s(l,c=r.defaultDecodeOptions){let h=(0,t.ensureAsyncIterable)(l);return new e.Decoder(c.extensionCodec,c.context,c.maxStrLength,c.maxBinLength,c.maxArrayLength,c.maxMapLength,c.maxExtLength).decodeArrayStream(h)}i.decodeArrayStream=s;function o(l,c=r.defaultDecodeOptions){let h=(0,t.ensureAsyncIterable)(l);return new e.Decoder(c.extensionCodec,c.context,c.maxStrLength,c.maxBinLength,c.maxArrayLength,c.maxMapLength,c.maxExtLength).decodeStream(h)}i.decodeMultiStream=o;function a(l,c=r.defaultDecodeOptions){return o(l,c)}i.decodeStream=a}),J0=Te(i=>{"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.decodeTimestampExtension=i.encodeTimestampExtension=i.decodeTimestampToTimeSpec=i.encodeTimeSpecToTimestamp=i.encodeDateToTimeSpec=i.EXT_TIMESTAMP=i.ExtData=i.ExtensionCodec=i.Encoder=i.DataViewIndexOutOfBoundsError=i.DecodeError=i.Decoder=i.decodeStream=i.decodeMultiStream=i.decodeArrayStream=i.decodeAsync=i.decodeMulti=i.decode=i.encode=void 0;var e=F0();Object.defineProperty(i,"encode",{enumerable:!0,get:function(){return e.encode}});var t=Uu();Object.defineProperty(i,"decode",{enumerable:!0,get:function(){return t.decode}}),Object.defineProperty(i,"decodeMulti",{enumerable:!0,get:function(){return t.decodeMulti}});var r=Z0();Object.defineProperty(i,"decodeAsync",{enumerable:!0,get:function(){return r.decodeAsync}}),Object.defineProperty(i,"decodeArrayStream",{enumerable:!0,get:function(){return r.decodeArrayStream}}),Object.defineProperty(i,"decodeMultiStream",{enumerable:!0,get:function(){return r.decodeMultiStream}}),Object.defineProperty(i,"decodeStream",{enumerable:!0,get:function(){return r.decodeStream}});var n=al();Object.defineProperty(i,"Decoder",{enumerable:!0,get:function(){return n.Decoder}}),Object.defineProperty(i,"DataViewIndexOutOfBoundsError",{enumerable:!0,get:function(){return n.DataViewIndexOutOfBoundsError}});var s=sl();Object.defineProperty(i,"DecodeError",{enumerable:!0,get:function(){return s.DecodeError}});var o=zu();Object.defineProperty(i,"Encoder",{enumerable:!0,get:function(){return o.Encoder}});var a=ol();Object.defineProperty(i,"ExtensionCodec",{enumerable:!0,get:function(){return a.ExtensionCodec}});var l=ju();Object.defineProperty(i,"ExtData",{enumerable:!0,get:function(){return l.ExtData}});var c=Iu();Object.defineProperty(i,"EXT_TIMESTAMP",{enumerable:!0,get:function(){return c.EXT_TIMESTAMP}}),Object.defineProperty(i,"encodeDateToTimeSpec",{enumerable:!0,get:function(){return c.encodeDateToTimeSpec}}),Object.defineProperty(i,"encodeTimeSpecToTimestamp",{enumerable:!0,get:function(){return c.encodeTimeSpecToTimestamp}}),Object.defineProperty(i,"decodeTimestampToTimeSpec",{enumerable:!0,get:function(){return c.decodeTimestampToTimeSpec}}),Object.defineProperty(i,"encodeTimestampExtension",{enumerable:!0,get:function(){return c.encodeTimestampExtension}}),Object.defineProperty(i,"decodeTimestampExtension",{enumerable:!0,get:function(){return c.decodeTimestampExtension}})}),wi=class extends Error{constructor(i){super(i),this.name=this.constructor.name,Object.setPrototypeOf(this,new.target.prototype)}},ht=class extends wi{},ct=class extends wi{},Wr=class extends wi{},ze=typeof process<"u"&&process.release&&process.release.name==="node",Ma;if(globalThis.document)Ma=i=>new Promise((e,t)=>{let r=document.createElement("script");r.src=i,r.onload=()=>e(),r.onerror=t,document.head.appendChild(r)});else if(globalThis.importScripts)Ma=async i=>{try{globalThis.importScripts(i)}catch(e){if(e instanceof TypeError)await Promise.resolve().then(()=>ns(Ui(i)));else throw e}};else if(ze)Ma=async i=>{let e=(await Promise.resolve().then(()=>ns(Ui("path")))).default;await Promise.resolve().then(()=>ns(Ui(e.resolve(i))))};else throw new wi("Cannot determine runtime environment");var bt={null:0,symbol:1,pairlist:2,closure:3,environment:4,promise:5,call:6,special:7,builtin:8,string:9,logical:10,integer:13,double:14,complex:15,character:16,dots:17,any:18,list:19,expression:20,bytecode:21,pointer:22,weakref:23,raw:24,s4:25,new:30,free:31,function:99};function ll(i){return!!i&&typeof i=="object"&&Object.keys(bt).includes(i.type)}function Ur(i){return!!i&&typeof i=="object"&&"re"in i&&"im"in i}var k={};function K0(i){Object.keys(i).forEach(e=>k._free(i[e]))}function ss(i){return k._Rf_protect(Vt(i)),i}function le(i,e){return k._Rf_protect(Vt(i)),++e.n,i}function ey(i){let e=k._malloc(4);return k._R_ProtectWithIndex(Vt(i),e),{loc:k.getValue(e,"i32"),ptr:e}}function ty(i){k._Rf_unprotect(1),k._free(i.ptr)}function iy(i,e){return k._R_Reprotect(Vt(i),e.loc),i}function be(i){k._Rf_unprotect(i)}function _u(i,e,t){k._Rf_defineVar(Vt(e),Vt(t),Vt(i))}function Du(i,e){let t={},r={n:0};try{let n=new tf(e);le(n,r),t.code=k.allocateUTF8(i);let s=k._R_ParseEvalString(t.code,n.ptr);return U.wrap(s)}finally{K0(t),be(r.n)}}function xs(i,e){return k.getWasmTableEntry(k.GOT.ffi_safe_eval.value)(Vt(i),Vt(e))}var ry=new WeakMap;function ny(i,e){return ry.set(i,e),i}function sy(i){return typeof i=="string"&&i.length===Fu}var Fu=63;function Hu(){let i=Array.from({length:4},oy).join("-");if(i.length!==Fu)throw new Error("comlink internal error: UUID has the wrong length");return i}function oy(){let i=Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16),e=15-i.length;return e>0&&(i=Array.from({length:e},()=>0).join("")+i),i}function Vt(i){return ms(i)?i.ptr:i}function vi(i,e){if(k._TYPEOF(i.ptr)!==bt[e])throw new Error(`Unexpected object type "${i.type()}" when expecting type "${e}"`)}function Gu(i){if(ll(i))return new(Of(i.type))(i);if(typeof i>"u")return new qa;if(i&&typeof i=="object"&&"type"in i&&i.type==="null")return new qa;if(i===null)return new zr({type:"logical",names:null,values:[null]});if(typeof i=="boolean")return new zr(i);if(typeof i=="number")return new fl(i);if(typeof i=="string")return new bi(i);if(Ur(i))return new uf(i);if(ArrayBuffer.isView(i)||i instanceof ArrayBuffer)return new gf(i);if(Array.isArray(i))return ay(i);if(typeof i=="object")return hl.fromObject(i);throw new Error("R object construction for this JS object is not yet supported.")}function ay(i){let e={n:0};if(i.every(t=>t&&typeof t=="object"&&!ms(t)&&!Ur(t))){let t=i,r=t.every(s=>Object.keys(s).filter(o=>!Object.keys(t[0]).includes(o)).length===0&&Object.keys(t[0]).filter(o=>!Object.keys(s).includes(o)).length===0),n=t.every(s=>Object.values(s).every(o=>bf(o)||yf(o)));if(r&&n)return hl.fromD3(t)}if(i.every(t=>typeof t=="boolean"||t===null))return new zr(i);if(i.every(t=>typeof t=="number"||t===null))return new fl(i);if(i.every(t=>typeof t=="string"||t===null))return new bi(i);try{let t=new Hi([new wt("c"),...i]);return le(t,e),t.eval()}finally{be(e.n)}}var Oe=class{constructor(i){this.ptr=i}type(){let i=k._TYPEOF(this.ptr);return Object.keys(bt).find(e=>bt[e]===i)}},Vr,os,La=class as extends Oe{constructor(e){if(!(e instanceof Oe))return Gu(e);super(e.ptr),V(this,Vr)}static wrap(e){let t=k._TYPEOF(e),r=Object.keys(bt)[Object.values(bt).indexOf(t)];return new(Of(r))(new Oe(e))}get[Symbol.toStringTag](){return`RObject:${this.type()}`}static getPersistentObject(e){return ke[e]}getPropertyValue(e){return this[e]}inspect(){Du(".Internal(inspect(x))",{x:this})}isNull(){return k._TYPEOF(this.ptr)===bt.null}isNa(){try{let e=Du("is.na(x)",{x:this});return ss(e),e.toBoolean()}finally{be(1)}}isUnbound(){return this.ptr===ke.unboundValue.ptr}attrs(){return cl.wrap(k._ATTRIB(this.ptr))}class(){let e={n:0},t=new Hi([new wt("class"),this]);le(t,e);try{return t.eval()}finally{be(e.n)}}setNames(e){let t;if(e===null)t=ke.null;else if(Array.isArray(e)&&e.every(r=>typeof r=="string"||r===null))t=new bi(e);else throw new Error("Argument to setNames must be null or an Array of strings or null");return k._Rf_setAttrib(this.ptr,ke.namesSymbol.ptr,t.ptr),this}names(){let e=bi.wrap(k._Rf_getAttrib(this.ptr,ke.namesSymbol.ptr));return e.isNull()?null:e.toArray()}includes(e){let t=this.names();return t&&t.includes(e)}toJs(e={depth:0},t=1){throw new Error("This R object cannot be converted to JS")}subset(e){return tt(this,Vr,os).call(this,e,ke.bracketSymbol.ptr)}get(e){return tt(this,Vr,os).call(this,e,ke.bracket2Symbol.ptr)}getDollar(e){return tt(this,Vr,os).call(this,e,ke.dollarSymbol.ptr)}pluck(...e){let t=ey(ke.null);try{let r=(s,o)=>{let a=s.get(o);return iy(a,t)},n=e.reduce(r,this);return n.isNull()?void 0:n}finally{ty(t)}}set(e,t){let r={n:0};try{let n=new as(e);le(n,r);let s=new as(t);le(s,r);let o=new wt("[[<-"),a=k._Rf_lang4(o.ptr,this.ptr,n.ptr,s.ptr);return le(a,r),as.wrap(xs(a,ke.baseEnv))}finally{be(r.n)}}static getMethods(e){let t=new Set,r=e;do Object.getOwnPropertyNames(r).map(n=>t.add(n));while(r=Object.getPrototypeOf(r));return[...t.keys()].filter(n=>typeof e[n]=="function")}};Vr=new WeakSet,os=function(i,e){let t={n:0};try{let r=new La(i);le(r,t);let n=k._Rf_lang3(e,this.ptr,r.ptr);return le(n,t),La.wrap(xs(n,ke.baseEnv))}finally{be(t.n)}};var U=La,qa=class extends U{constructor(){return super(new Oe(k.getValue(k._R_NilValue,"*"))),this}toJs(){return{type:"null"}}},wt=class extends U{constructor(i){if(i instanceof Oe){vi(i,"symbol"),super(i);return}let e=k.allocateUTF8(i);try{super(new Oe(k._Rf_install(e)))}finally{k._free(e)}}toJs(){let i=this.toObject();return{type:"symbol",printname:i.printname,symvalue:i.symvalue,internal:i.internal}}toObject(){return{printname:this.printname().isUnbound()?null:this.printname().toString(),symvalue:this.symvalue().isUnbound()?null:this.symvalue().ptr,internal:this.internal().isNull()?null:this.internal().ptr}}toString(){return this.printname().toString()}printname(){return ul.wrap(k._PRINTNAME(this.ptr))}symvalue(){return U.wrap(k._SYMVALUE(this.ptr))}internal(){return U.wrap(k._INTERNAL(this.ptr))}},cl=class Yu extends U{constructor(e){if(e instanceof Oe)return vi(e,"pairlist"),super(e),this;let t={n:0};try{let{names:r,values:n}=Yi(e),s=Yu.wrap(k._Rf_allocList(n.length));le(s,t);for(let[o,a]=[0,s];!a.isNull();[o,a]=[o+1,a.cdr()])a.setcar(new U(n[o]));s.setNames(r),super(s)}finally{be(t.n)}}get length(){return this.toArray().length}toArray(e={depth:1}){return this.toJs(e).values}toObject({allowDuplicateKey:e=!0,allowEmptyKey:t=!1,depth:r=-1}={}){let n=this.entries({depth:r}),s=n.map(([o])=>o);if(!e&&new Set(s).size!==s.length)throw new Error("Duplicate key when converting pairlist without allowDuplicateKey enabled");if(!t&&s.some(o=>!o))throw new Error("Empty or null key when converting pairlist without allowEmptyKey enabled");return Object.fromEntries(n.filter((o,a)=>n.findIndex(l=>l[0]===o[0])===a))}entries(e={depth:1}){let t=this.toJs(e);return t.values.map((r,n)=>[t.names?t.names[n]:null,r])}toJs(e={depth:0},t=1){let r=[],n=!1,s=[];for(let o=this;!o.isNull();o=o.cdr()){let a=o.tag();a.isNull()?r.push(""):(n=!0,r.push(a.toString())),e.depth&&t>=e.depth?s.push(o.car()):s.push(o.car().toJs(e,t+1))}return{type:"pairlist",names:n?r:null,values:s}}includes(e){return e in this.toObject()}setcar(e){k._SETCAR(this.ptr,e.ptr)}car(){return U.wrap(k._CAR(this.ptr))}cdr(){return U.wrap(k._CDR(this.ptr))}tag(){return U.wrap(k._TAG(this.ptr))}},Hi=class Zu extends U{constructor(e){if(e instanceof Oe)return vi(e,"call"),super(e),this;let t={n:0};try{let{values:r}=Yi(e),n=r.map(o=>le(new U(o),t)),s=Zu.wrap(k._Rf_allocVector(bt.call,r.length));le(s,t);for(let[o,a]=[0,s];!a.isNull();[o,a]=[o+1,a.cdr()])a.setcar(n[o]);super(s)}finally{be(t.n)}}setcar(e){k._SETCAR(this.ptr,e.ptr)}car(){return U.wrap(k._CAR(this.ptr))}cdr(){return U.wrap(k._CDR(this.ptr))}eval(){return k.webr.evalR(this,{env:ke.baseEnv})}capture(e={}){return k.webr.captureR(this,e)}deparse(){let e={n:0};try{let t=k._Rf_lang2(new wt("deparse1").ptr,k._Rf_lang2(new wt("quote").ptr,this.ptr));le(t,e);let r=bi.wrap(xs(t,ke.baseEnv));return le(r,e),r.toString()}finally{be(e.n)}}},Va=class Ju extends U{constructor(e,t=null){if(e instanceof Oe){if(vi(e,"list"),super(e),t){if(t.length!==this.length)throw new Error("Can't construct named `RList`. Supplied `names` must be the same length as the list.");this.setNames(t)}return this}let r={n:0};try{let n=Yi(e),s=k._Rf_allocVector(bt.list,n.values.length);le(s,r),n.values.forEach((a,l)=>{uy(a)?k._SET_VECTOR_ELT(s,l,new Ju(a).ptr):k._SET_VECTOR_ELT(s,l,new U(a).ptr)});let o=t||n.names;if(o&&o.length!==n.values.length)throw new Error("Can't construct named `RList`. Supplied `names` must be the same length as the list.");U.wrap(s).setNames(o),super(new Oe(s))}finally{be(r.n)}}get length(){return k._LENGTH(this.ptr)}isDataFrame(){let e=cl.wrap(k._ATTRIB(this.ptr)).get("class");return!e.isNull()&&e.toArray().includes("data.frame")}toArray(e={depth:1}){return this.toJs(e).values}toObject({allowDuplicateKey:e=!0,allowEmptyKey:t=!1,depth:r=-1}={}){let n=this.entries({depth:r}),s=n.map(([o])=>o);if(!e&&new Set(s).size!==s.length)throw new Error("Duplicate key when converting list without allowDuplicateKey enabled");if(!t&&s.some(o=>!o))throw new Error("Empty or null key when converting list without allowEmptyKey enabled");return Object.fromEntries(n.filter((o,a)=>n.findIndex(l=>l[0]===o[0])===a))}toD3(){if(!this.isDataFrame())throw new Error("Can't convert R list object to D3 format. Object must be of class 'data.frame'.");return this.entries().reduce((e,t)=>(t[1].forEach((r,n)=>e[n]=Object.assign(e[n]||{},{[t[0]]:r})),e),[])}entries(e={depth:-1}){let t=this.toJs(e);return this.isDataFrame()&&e.depth<0&&(t.values=t.values.map(r=>r.toArray())),t.values.map((r,n)=>[t.names?t.names[n]:null,r])}toJs(e={depth:0},t=1){return{type:"list",names:this.names(),values:[...Array(this.length).keys()].map(r=>e.depth&&t>=e.depth?this.get(r+1):this.get(r+1).toJs(e,t+1))}}},hl=class $a extends Va{constructor(e){if(e instanceof Oe){if(super(e),!this.isDataFrame())throw new Error("Can't construct `RDataFrame`. Supplied R object is not a `data.frame`.");return this}return $a.fromObject(e)}static fromObject(e){let{names:t,values:r}=Yi(e),n={n:0};try{let s=!!t&&t.length>0&&t.every(a=>a),o=r.length>0&&r.every(a=>Array.isArray(a)||ArrayBuffer.isView(a)||a instanceof ArrayBuffer);if(s&&o){let a=r,l=a.every(h=>h.length===a[0].length),c=a.every(h=>bf(h[0])||yf(h[0]));if(l&&c){let h=new Va({type:"list",names:t,values:a.map(f=>Gu(f))});le(h,n);let u=new Hi([new wt("as.data.frame"),h]);return le(u,n),new $a(u.eval())}}}finally{be(n.n)}throw new Error("Can't construct `data.frame`. Source object is not eligible.")}static fromD3(e){return this.fromObject(Object.fromEntries(Object.keys(e[0]).map(t=>[t,e.map(r=>r[t])])))}},rs=class extends U{exec(...i){let e={n:0};try{let t=new Hi([this,...i]);return le(t,e),t.eval()}finally{be(e.n)}}capture(i={},...e){let t={n:0};try{let r=new Hi([this,...e]);return le(r,t),r.capture(i)}finally{be(t.n)}}},Ku=class ef extends U{constructor(e){if(e instanceof Oe){vi(e,"string"),super(e);return}let t=k.allocateUTF8(e);try{super(new Oe(k._Rf_mkCharCE(t,ef.CEType.CE_UTF8)))}finally{k._free(t)}}toString(){let e=k._vmaxget();try{return k.UTF8ToString(k._Rf_translateCharUTF8(this.ptr))}finally{k._vmaxset(e)}}toJs(){return{type:"string",value:this.toString()}}};Ku.CEType={CE_NATIVE:0,CE_UTF8:1,CE_LATIN1:2,CE_BYTES:3,CE_SYMBOL:5,CE_ANY:99};var ul=Ku,tf=class extends U{constructor(i={}){if(i instanceof Oe)return vi(i,"environment"),super(i),this;let e=0;try{let{names:t,values:r}=Yi(i),n=ss(k._R_NewEnv(ke.globalEnv.ptr,0,0));++e,r.forEach((s,o)=>{let a=t?t[o]:null;if(!a)throw new Error("Can't create object in new environment with empty symbol name");let l=new wt(a),c=ss(new U(s));try{_u(n,l,c)}finally{be(1)}}),super(new Oe(n))}finally{be(e)}}ls(i=!1,e=!0){return bi.wrap(k._R_lsInternal3(this.ptr,Number(i),Number(e))).toArray()}bind(i,e){let t=new wt(i),r=ss(new U(e));try{_u(this,t,r)}finally{be(1)}}names(){return this.ls(!0,!0)}frame(){return U.wrap(k._FRAME(this.ptr))}subset(i){if(typeof i=="number")throw new Error("Object of type environment is not subsettable");return this.getDollar(i)}toObject({depth:i=-1}={}){let e=this.names();return Object.fromEntries([...Array(e.length).keys()].map(t=>{let r=this.getDollar(e[t]);return[e[t],i<0?r:r.toJs({depth:i})]}))}toJs(i={depth:0},e=1){let t=this.names(),r=[...Array(t.length).keys()].map(n=>i.depth&&e>=i.depth?this.getDollar(t[n]):this.getDollar(t[n]).toJs(i,e+1));return{type:"environment",names:t,values:r}}},Gi=class extends U{constructor(i,e,t){if(i instanceof Oe)return vi(i,e),super(i),this;let r={n:0};try{let{names:n,values:s}=Yi(i),o=k._Rf_allocVector(bt[e],s.length);le(o,r),s.forEach(t(o)),U.wrap(o).setNames(n),super(new Oe(o))}finally{be(r.n)}}get length(){return k._LENGTH(this.ptr)}get(i){return super.get(i)}subset(i){return super.subset(i)}getDollar(){throw new Error("$ operator is invalid for atomic vectors")}detectMissing(){let i={n:0};try{let e=k._Rf_lang2(new wt("is.na").ptr,this.ptr);le(e,i);let t=zr.wrap(xs(e,ke.baseEnv));le(t,i);let r=t.toTypedArray();return Array.from(r).map(n=>!!n)}finally{be(i.n)}}toArray(){let i=this.toTypedArray();return this.detectMissing().map((e,t)=>e?null:i[t])}toObject({allowDuplicateKey:i=!0,allowEmptyKey:e=!1}={}){let t=this.entries(),r=t.map(([n])=>n);if(!i&&new Set(r).size!==r.length)throw new Error("Duplicate key when converting atomic vector without allowDuplicateKey enabled");if(!e&&r.some(n=>!n))throw new Error("Empty or null key when converting atomic vector without allowEmptyKey enabled");return Object.fromEntries(t.filter((n,s)=>t.findIndex(o=>o[0]===n[0])===s))}entries(){let i=this.toArray(),e=this.names();return i.map((t,r)=>[e?e[r]:null,t])}toJs(){return{type:this.type(),names:this.names(),values:this.toArray()}}},Ba,rf=class nf extends Gi{constructor(e){super(e,"logical",S(nf,Ba))}getBoolean(e){return this.get(e).toArray()[0]}toBoolean(){if(this.length!==1)throw new Error("Can't convert atomic vector of length > 1 to a scalar JS value");let e=this.getBoolean(1);if(e===null)throw new Error("Can't convert missing value `NA` to a JS boolean");return e}toTypedArray(){return new Int32Array(k.HEAP32.subarray(k._LOGICAL(this.ptr)/4,k._LOGICAL(this.ptr)/4+this.length))}toArray(){let e=this.toTypedArray();return this.detectMissing().map((t,r)=>t?null:!!e[r])}};Ba=new WeakMap,V(rf,Ba,i=>{let e=k._LOGICAL(i),t=k.getValue(k._R_NaInt,"i32");return(r,n)=>{k.setValue(e+4*n,r===null?t:!!r,"i32")}});var zr=rf,Xa,sf=class of extends Gi{constructor(e){super(e,"integer",S(of,Xa))}getNumber(e){return this.get(e).toArray()[0]}toNumber(){if(this.length!==1)throw new Error("Can't convert atomic vector of length > 1 to a scalar JS value");let e=this.getNumber(1);if(e===null)throw new Error("Can't convert missing value `NA` to a JS number");return e}toTypedArray(){return new Int32Array(k.HEAP32.subarray(k._INTEGER(this.ptr)/4,k._INTEGER(this.ptr)/4+this.length))}};Xa=new WeakMap,V(sf,Xa,i=>{let e=k._INTEGER(i),t=k.getValue(k._R_NaInt,"i32");return(r,n)=>{k.setValue(e+4*n,r===null?t:Math.round(Number(r)),"i32")}});var ly=sf,Na,af=class lf extends Gi{constructor(e){super(e,"double",S(lf,Na))}getNumber(e){return this.get(e).toArray()[0]}toNumber(){if(this.length!==1)throw new Error("Can't convert atomic vector of length > 1 to a scalar JS value");let e=this.getNumber(1);if(e===null)throw new Error("Can't convert missing value `NA` to a JS number");return e}toTypedArray(){return new Float64Array(k.HEAPF64.subarray(k._REAL(this.ptr)/8,k._REAL(this.ptr)/8+this.length))}};Na=new WeakMap,V(af,Na,i=>{let e=k._REAL(i),t=k.getValue(k._R_NaReal,"double");return(r,n)=>{k.setValue(e+8*n,r===null?t:r,"double")}});var fl=af,ja,cf=class hf extends Gi{constructor(e){super(e,"complex",S(hf,ja))}getComplex(e){return this.get(e).toArray()[0]}toComplex(){if(this.length!==1)throw new Error("Can't convert atomic vector of length > 1 to a scalar JS value");let e=this.getComplex(1);if(e===null)throw new Error("Can't convert missing value `NA` to a JS object");return e}toTypedArray(){return new Float64Array(k.HEAPF64.subarray(k._COMPLEX(this.ptr)/8,k._COMPLEX(this.ptr)/8+2*this.length))}toArray(){let e=this.toTypedArray();return this.detectMissing().map((t,r)=>t?null:{re:e[2*r],im:e[2*r+1]})}};ja=new WeakMap,V(cf,ja,i=>{let e=k._COMPLEX(i),t=k.getValue(k._R_NaReal,"double");return(r,n)=>{k.setValue(e+8*(2*n),r===null?t:r.re,"double"),k.setValue(e+8*(2*n+1),r===null?t:r.im,"double")}});var uf=cf,Ia,ff=class df extends Gi{constructor(e){super(e,"character",S(df,Ia))}getString(e){return this.get(e).toArray()[0]}toString(){if(this.length!==1)throw new Error("Can't convert atomic vector of length > 1 to a scalar JS value");let e=this.getString(1);if(e===null)throw new Error("Can't convert missing value `NA` to a JS string");return e}toTypedArray(){return new Uint32Array(k.HEAPU32.subarray(k._STRING_PTR(this.ptr)/4,k._STRING_PTR(this.ptr)/4+this.length))}toArray(){let e=k._vmaxget();try{return this.detectMissing().map((t,r)=>t?null:k.UTF8ToString(k._Rf_translateCharUTF8(k._STRING_ELT(this.ptr,r))))}finally{k._vmaxset(e)}}};Ia=new WeakMap,V(ff,Ia,i=>(e,t)=>{e===null?k._SET_STRING_ELT(i,t,ke.naString.ptr):k._SET_STRING_ELT(i,t,new ul(e).ptr)});var bi=ff,Wa,pf=class mf extends Gi{constructor(e){e instanceof ArrayBuffer&&(e=new Uint8Array(e)),super(e,"raw",S(mf,Wa))}getNumber(e){return this.get(e).toArray()[0]}toNumber(){if(this.length!==1)throw new Error("Can't convert atomic vector of length > 1 to a scalar JS value");let e=this.getNumber(1);if(e===null)throw new Error("Can't convert missing value `NA` to a JS number");return e}toTypedArray(){return new Uint8Array(k.HEAPU8.subarray(k._RAW(this.ptr),k._RAW(this.ptr)+this.length))}};Wa=new WeakMap,V(pf,Wa,i=>{let e=k._RAW(i);return(t,r)=>{k.setValue(e+r,Number(t),"i8")}});var gf=pf;function Yi(i){return ll(i)?i:Array.isArray(i)||ArrayBuffer.isView(i)?{names:null,values:i}:i&&typeof i=="object"&&!Ur(i)?{names:Object.keys(i),values:Object.values(i)}:{names:null,values:[i]}}function Of(i){let e={object:U,null:qa,symbol:wt,pairlist:cl,closure:rs,environment:tf,call:Hi,special:rs,builtin:rs,string:ul,logical:zr,integer:ly,double:fl,complex:uf,character:bi,list:Va,raw:gf,function:rs,dataframe:hl};return i in e?e[i]:U}function ms(i){return i instanceof U}function yf(i){let e=["logical","integer","double","complex","character"];return ms(i)&&e.includes(i.type())||ms(i)&&i.isNa()}function bf(i){return i===null||typeof i=="number"||typeof i=="boolean"||typeof i=="string"||Ur(i)}var ke;function Ss(){let i={resolve:()=>{},reject:()=>{},promise:Promise.resolve()},e=new Promise((t,r)=>{i.resolve=t,i.reject=r});return i.promise=e,i}function cy(i){return new Promise(e=>setTimeout(e,i))}function Gt(i,e,t,...r){return i==null||hy(i)?i:i instanceof ArrayBuffer?new Uint8Array(i):e(i)?t(i,...r):Array.isArray(i)||ArrayBuffer.isView(i)?i.map(n=>Gt(n,e,t,...r)):i instanceof Oe?i:typeof i=="object"?Object.fromEntries(Object.entries(i).map(([n,s])=>[n,Gt(s,e,t,...r)])):i}function dl(i,e,t){let r=new XMLHttpRequest;r.open("get",i,!0),r.onload=()=>{if(r.status>=200&&r.status<300)try{let n=new Worker(URL.createObjectURL(new Blob([r.responseText])));e(n)}catch(n){if(t)t(n instanceof Error?n:new Error(String(n)));else throw n}else t?t(new Error(`Worker loading error: HTTP ${r.status}`)):console.error(`HTTP Error: ${r.status}`)},r.onerror=()=>{t?t(new Error(`Network error loading ${i}`)):console.error(`Network error loading ${i}`)},r.send()}function pl(i){if(ze)return!1;let e=new URL(location.href),t=new URL(i,location.origin);return!(e.host===t.host&&e.port===t.port&&e.protocol===t.protocol)}function hy(i){return typeof ImageBitmap<"u"&&i instanceof ImageBitmap}function uy(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)&&!ArrayBuffer.isView(i)&&!Ur(i)&&!ll(i)&&!(i instanceof Date)&&!(i instanceof RegExp)&&!(i instanceof Error)&&!(i instanceof Oe)&&Object.getPrototypeOf(i)===Object.prototype}var fy=ns(J0()),dy=new TextEncoder;async function py(i,e,t){try{let{taskId:r,sizeBuffer:n,dataBuffer:s,signalBuffer:o}=e,a=(0,fy.encode)(t),l=a.length<=s.length;if(Atomics.store(n,0,a.length),Atomics.store(n,1,+l),!l){let[c,h]=my(i);s.set(dy.encode(c)),await Lu(o,r),s=(await h).dataBuffer}s.set(a),Atomics.store(n,1,1),await Lu(o,r)}catch(r){console.warn(r)}}function my(i){let e=Hu();return[e,new Promise(t=>{ze?i.once("message",r=>{!r.id||r.id!==e||t(r)}):i.addEventListener("message",function r(n){!n.data||!n.data.id||n.data.id!==e||(i.removeEventListener("message",r),t(n.data))}),i.start&&i.start()})]}async function Lu(i,e){let t=(e>>1)%32,r=1;for(;Atomics.compareExchange(i,t+1,0,e)!==0;)await cy(r),r<32&&(r*=2);Atomics.or(i,0,1<<t),Atomics.notify(i,0)}var Dt,Lt,ls,za,_a=class{constructor(){V(this,ls),V(this,Dt),V(this,Lt),ue(this,Lt,[]),ue(this,Dt,[])}reset(){ue(this,Lt,[]),ue(this,Dt,[])}put(i){S(this,Lt).length||tt(this,ls,za).call(this),S(this,Lt).shift()(i)}async get(){return S(this,Dt).length||tt(this,ls,za).call(this),S(this,Dt).shift()}isEmpty(){return!S(this,Dt).length}isBlocked(){return!!S(this,Lt).length}get length(){return S(this,Dt).length-S(this,Lt).length}};Dt=new WeakMap,Lt=new WeakMap,ls=new WeakSet,za=function(){S(this,Dt).push(new Promise(i=>{S(this,Lt).push(i)}))};function gy(i,e){return wf({type:"request",data:{uuid:Hu(),msg:i}},e)}function Ua(i,e,t){return wf({type:"response",data:{uuid:i,resp:e}},t)}function wf(i,e){return e&&ny(i,e),i}function Oy(i){let e=new ht(i.obj.message);return i.obj.name=="ErrnoError"?e.message=`ErrnoError: ${String(i.obj.errno)}`:i.obj.name!=="Error"&&(e.name=i.obj.name),e.stack=i.obj.stack,e}function yy(i){return!!i&&typeof i=="object"&&"payloadType"in i&&"obj"in i}function vf(i){return yy(i)&&i.payloadType==="ptr"}var $r,cs,ml=class{constructor(){this.inputQueue=new _a,this.outputQueue=new _a,this.systemQueue=new _a,V(this,$r,new Map),V(this,cs,!1)}async read(){return await this.outputQueue.get()}async flush(){let i=[];for(;!this.outputQueue.isEmpty();)i.push(await this.read());return i}async readSystem(){return await this.systemQueue.get()}write(i){if(S(this,cs))throw new ct("The webR communication channel has been closed.");this.inputQueue.put(i)}async request(i,e){let t=gy(i,e),{resolve:r,reject:n,promise:s}=Ss();return S(this,$r).set(t.data.uuid,{resolve:r,reject:n}),this.write(t),s}putClosedMessage(){ue(this,cs,!0),this.outputQueue.put({type:"closed"})}resolveResponse(i){let e=i.data.uuid,t=S(this,$r).get(e);if(t){let r=i.data.resp;S(this,$r).delete(e),r.payloadType==="err"?t.reject(Oy(r)):t.resolve(r)}else console.warn("Can't find request.")}};$r=new WeakMap,cs=new WeakMap;var zT=new TextDecoder("utf-8"),UT=new Int32Array(new ArrayBuffer(4));ze&&(globalThis.Worker=Ui("worker_threads").Worker);var Br,Fa,xf,hs,qu=class extends ml{constructor(i){super(),V(this,Fa),V(this,Br),this.close=()=>{},V(this,hs,async(t,r)=>{if(!(!r||!r.type))switch(r.type){case"resolve":ue(this,Br,new Int32Array(r.data)),this.resolve();return;case"response":this.resolveResponse(r);return;case"system":this.systemQueue.put(r.data);return;default:this.outputQueue.put(r);return;case"sync-request":{let n=r,s=n.data.msg,o=n.data.reqData;switch(s.type){case"read":{let a=await this.inputQueue.get();await py(t,o,a);break}default:throw new ct(`Unsupported request type '${s.type}'.`)}return}case"request":throw new ct("Can't send messages of type 'request' from a worker. Please Use 'sync-request' instead.")}}),{resolve:this.resolve,reject:this.reject,promise:this.initialised}=Ss();let e=t=>{tt(this,Fa,xf).call(this,t),this.close=()=>{t.terminate(),this.putClosedMessage()};let r={type:"init",data:{config:i,channelType:qt.SharedArrayBuffer}};t.postMessage(r)};if(pl(i.baseUrl))dl(`${i.baseUrl}webr-worker.js`,t=>e(t),t=>{this.reject(new ht(`Worker loading error: ${t.message}`))});else{let t=new Worker(`${i.baseUrl}webr-worker.js`);e(t)}}interrupt(){if(!S(this,Br))throw new ct("Failed attempt to interrupt before initialising interruptBuffer");this.inputQueue.reset(),S(this,Br)[0]=1}};Br=new WeakMap,Fa=new WeakSet,xf=function(i){ze?(i.on("message",e=>{S(this,hs).call(this,i,e)}),i.on("error",e=>{console.error(e),this.reject(new ht("An error occurred initialising the webR SharedBufferChannel worker."))})):(i.onmessage=e=>S(this,hs).call(this,i,e.data),i.onerror=e=>{console.error(e),this.reject(new ht("An error occurred initialising the webR SharedBufferChannel worker."))})},hs=new WeakMap;ze&&(globalThis.Worker=Ui("worker_threads").Worker);var Nr,Fi,jr,Ir,Sf,Vu,kf,us,by=class extends ml{constructor(i){super(),V(this,Ir),this.close=()=>{},V(this,Nr,new Map),V(this,Fi),V(this,jr,!1),V(this,us,(t,r)=>{if(!(!r||!r.type))switch(r.type){case"resolve":this.resolve();return;case"response":this.resolveResponse(r);return;case"system":this.systemQueue.put(r.data);return;default:this.outputQueue.put(r);return;case"sync-request":{let n=r.data;S(this,Nr).set(n.data.uuid,n.data.msg);return}case"request":throw new ct("Can't send messages of type 'request' from a worker.Use service worker fetch request instead.")}}),{resolve:this.resolve,reject:this.reject,promise:this.initialised}=Ss(),console.warn("The ServiceWorker communication channel is deprecated and will be removed in a future version of webR. Consider using the PostMessage channel instead. If blocking input is required (for example, `browser()`) the SharedArrayBuffer channel should be used. See https://docs.r-wasm.org/webr/latest/serving.html for further information.");let e=t=>{tt(this,Ir,kf).call(this,t),this.close=()=>{t.terminate(),this.putClosedMessage()},tt(this,Ir,Sf).call(this,`${i.serviceWorkerUrl}webr-serviceworker.js`).then(r=>{let n={type:"init",data:{config:i,channelType:qt.ServiceWorker,clientId:r,location:window.location.href}};t.postMessage(n)})};if(pl(i.serviceWorkerUrl))dl(`${i.baseUrl}webr-worker.js`,t=>e(t),t=>{this.reject(new ht(`Worker loading error: ${t.message}`))});else{let t=new Worker(`${i.serviceWorkerUrl}webr-worker.js`);e(t)}}activeRegistration(){var i;if(!((i=S(this,Fi))!=null&&i.active))throw new ct("Attempted to obtain a non-existent active registration.");return S(this,Fi).active}interrupt(){ue(this,jr,!0)}};Nr=new WeakMap,Fi=new WeakMap,jr=new WeakMap,Ir=new WeakSet,Sf=async function(i){ue(this,Fi,await navigator.serviceWorker.register(i)),await navigator.serviceWorker.ready,window.addEventListener("beforeunload",()=>{var t;(t=S(this,Fi))==null||t.unregister()});let e=await new Promise(t=>{navigator.serviceWorker.addEventListener("message",function r(n){n.data.type==="registration-successful"&&(navigator.serviceWorker.removeEventListener("message",r),t(n.data.clientId))}),this.activeRegistration().postMessage({type:"register-client-main"})});return navigator.serviceWorker.addEventListener("message",t=>{tt(this,Ir,Vu).call(this,t)}),e},Vu=async function(i){if(i.data.type==="request"){let e=i.data.data,t=S(this,Nr).get(e);if(!t)throw new ct("Request not found during service worker XHR request");switch(S(this,Nr).delete(e),t.type){case"read":{let r=await this.inputQueue.get();this.activeRegistration().postMessage({type:"wasm-webr-fetch-response",uuid:e,response:Ua(e,r)});break}case"interrupt":{let r=S(this,jr);this.activeRegistration().postMessage({type:"wasm-webr-fetch-response",uuid:e,response:Ua(e,r)}),this.inputQueue.reset(),ue(this,jr,!1);break}default:throw new ct(`Unsupported request type '${t.type}'.`)}return}},kf=function(i){ze?(i.on("message",e=>{S(this,us).call(this,i,e)}),i.on("error",e=>{console.error(e),this.reject(new ht("An error occurred initialising the webR ServiceWorkerChannel worker."))})):(i.onmessage=e=>S(this,us).call(this,i,e.data),i.onerror=e=>{console.error(e),this.reject(new ht("An error occurred initialising the webR ServiceWorkerChannel worker."))})},us=new WeakMap;ze&&(globalThis.Worker=Ui("worker_threads").Worker);var Xr,Ha,Tf,fs,$u=class extends ml{constructor(i){super(),V(this,Ha),this.close=()=>{},V(this,Xr),V(this,fs,async(t,r)=>{if(!(!r||!r.type))switch(r.type){case"resolve":this.resolve();return;case"response":this.resolveResponse(r);return;case"system":this.systemQueue.put(r.data);return;default:this.outputQueue.put(r);return;case"request":{let n=r,s=n.data.msg;switch(s.type){case"read":{let o=await this.inputQueue.get();if(S(this,Xr)){let a=Ua(n.data.uuid,o);S(this,Xr).postMessage(a)}break}default:throw new ct(`Unsupported request type '${s.type}'.`)}return}case"sync-request":throw new ct("Can't send messages of type 'sync-request' in PostMessage mode. Use 'request' instead.")}}),{resolve:this.resolve,reject:this.reject,promise:this.initialised}=Ss();let e=t=>{ue(this,Xr,t),tt(this,Ha,Tf).call(this,t),this.close=()=>{t.terminate(),this.putClosedMessage()};let r={type:"init",data:{config:i,channelType:qt.PostMessage}};t.postMessage(r)};if(pl(i.baseUrl))dl(`${i.baseUrl}webr-worker.js`,t=>e(t),t=>{this.reject(new ht(`Worker loading error: ${t.message}`))});else{let t=new Worker(`${i.baseUrl}webr-worker.js`);e(t)}}interrupt(){console.error("Interrupting R execution is not available when using the PostMessage channel")}};Xr=new WeakMap,Ha=new WeakSet,Tf=function(i){ze?(i.on("message",e=>{S(this,fs).call(this,i,e)}),i.on("error",e=>{console.error(e),this.reject(new ht("An error occurred initialising the webR PostMessageChannel worker."))})):(i.onmessage=e=>S(this,fs).call(this,i,e.data),i.onerror=e=>{console.error(e),this.reject(new ht("An error occurred initialising the webR PostMessageChannel worker."))})},fs=new WeakMap;var qt={Automatic:0,SharedArrayBuffer:1,ServiceWorker:2,PostMessage:3};function wy(i){switch(i.channelType){case qt.SharedArrayBuffer:return new qu(i);case qt.ServiceWorker:return new by(i);case qt.PostMessage:return new $u(i);case qt.Automatic:default:return typeof SharedArrayBuffer<"u"?new qu(i):new $u(i)}}var vy=ze?__dirname+"/":"https://webr.r-wasm.org/v0.5.2/",xy="https://repo.r-wasm.org",Pf="0.5.2";function ie(i){return!!i&&(typeof i=="object"||typeof i=="function")&&"payloadType"in i&&vf(i._payload)}function Ae(i){return ie(i)&&i._payload.obj.type==="null"}function Sy(i){return ie(i)&&i._payload.obj.type==="symbol"}function ky(i){return ie(i)&&i._payload.obj.type==="pairlist"}function Ty(i){return ie(i)&&i._payload.obj.type==="environment"}function Py(i){return ie(i)&&i._payload.obj.type==="logical"}function Cy(i){return ie(i)&&i._payload.obj.type==="integer"}function Ey(i){return ie(i)&&i._payload.obj.type==="double"}function Ry(i){return ie(i)&&i._payload.obj.type==="complex"}function Zi(i){return ie(i)&&i._payload.obj.type==="character"}function ut(i){return ie(i)&&i._payload.obj.type==="list"}function gl(i){return ie(i)&&i._payload.obj.type==="raw"}function ks(i){return ie(i)&&i._payload.obj.type==="call"}function Ts(i){var e;return!!(ie(i)&&(e=i._payload.obj.methods)!=null&&e.includes("exec"))}function Ay(){}function Qy(i,e){return async function*(){let t={type:"callRObjectMethod",data:{payload:e._payload,prop:"getPropertyValue",args:[{payloadType:"raw",obj:"length"}],shelter:void 0}},r=await i.request(t);if(typeof r.obj!="number")throw new wi("Cannot iterate over object, unexpected type for length property.");for(let n=1;n<=r.obj;n++)yield e.get(n)}}function Cf(i,e,t){return async(...r)=>{let n=r.map(a=>ie(a)?a._payload:{obj:Gt(a,ie,l=>l._payload),payloadType:"raw"}),s={type:"callRObjectMethod",data:{payload:t,prop:e,args:n}},o=await i.request(s);switch(o.payloadType){case"ptr":return yi(i,o);case"raw":return Gt(o,vf,(a,l)=>yi(l,a),i).obj}}}async function My(i,e,t,...r){let n={type:"newRObject",data:{objType:e,args:Gt(r,ie,o=>o._payload),shelter:t}},s=await i.request(n);switch(s.payloadType){case"raw":throw new Wr("Unexpected raw payload type returned from newRObject");case"ptr":return yi(i,s)}}function yi(i,e){var t;let r=new Proxy((t=e.obj.methods)!=null&&t.includes("exec")?Object.assign(Ay,{...e}):e,{get:(n,s)=>{var o;if(s==="_payload")return e;if(s===Symbol.asyncIterator)return Qy(i,r);if((o=e.obj.methods)!=null&&o.includes(s.toString()))return Cf(i,s.toString(),e)},apply:async(n,s,o)=>{let a=await yi(i,e).exec(...o);return Ts(a)?a:a.toJs()}});return r}function $e(i,e,t){return new Proxy(U,{construct:(r,n)=>My(i,t,e,...n),get:(r,n)=>Cf(i,n.toString())})}var gs,Os,ys,bs,ws,Ga,Ya,Za,Ja,Ka,el,Ef,_y=class{constructor(i={},e={REnv:{R_HOME:"/usr/lib/R",FONTCONFIG_PATH:"/etc/fonts",R_ENABLE_JIT:"0"}}){V(this,el),V(this,gs),V(this,Os),V(this,ys),V(this,bs),V(this,ws),V(this,Ga,t=>{console.log(t)}),V(this,Ya,t=>{console.error(t)}),V(this,Za,t=>{let r=prompt(t);r&&this.stdin(`${r}
`)}),V(this,Ja,t=>{if(ze)throw new Error("Plotting with HTML canvas is not yet supported under Node");this.canvas.getContext("2d").drawImage(t,0,0)}),V(this,Ka,()=>{if(ze)throw new Error("Plotting with HTML canvas is not yet supported under Node");this.canvas.getContext("2d").clearRect(0,0,this.canvas.width,this.canvas.height)}),this.webR=new Af(e),ze||(this.canvas=document.createElement("canvas"),this.canvas.setAttribute("width","1008"),this.canvas.setAttribute("height","1008")),ue(this,gs,i.stdout||S(this,Ga)),ue(this,Os,i.stderr||S(this,Ya)),ue(this,ys,i.prompt||S(this,Za)),ue(this,bs,i.canvasImage||S(this,Ja)),ue(this,ws,i.canvasNewPage||S(this,Ka)),this.webR.evalRVoid("options(device=webr::canvas)")}stdin(i){this.webR.writeConsole(i)}interrupt(){this.webR.interrupt()}run(){tt(this,el,Ef).call(this)}};gs=new WeakMap,Os=new WeakMap,ys=new WeakMap,bs=new WeakMap,ws=new WeakMap,Ga=new WeakMap,Ya=new WeakMap,Za=new WeakMap,Ja=new WeakMap,Ka=new WeakMap,el=new WeakSet,Ef=async function(){for(;;){let i=await this.webR.read();switch(i.type){case"stdout":S(this,gs).call(this,i.data);break;case"stderr":S(this,Os).call(this,i.data);break;case"prompt":S(this,ys).call(this,i.data);break;case"canvas":i.data.event==="canvasImage"?S(this,bs).call(this,i.data.image):i.data.event==="canvasNewPage"&&S(this,ws).call(this);break;case"closed":return;default:console.warn(`Unhandled output type for webR Console: ${i.type}.`)}}};var Dy={FONTCONFIG_PATH:"/etc/fonts",R_HOME:"/usr/lib/R",R_ENABLE_JIT:"0",WEBR:"1",WEBR_VERSION:Pf},Bu={RArgs:[],REnv:Dy,baseUrl:vy,serviceWorkerUrl:"",repoUrl:xy,homedir:"/home/web_user",interactive:!0,channelType:qt.Automatic,createLazyFilesystem:!0},Z,ds,tl,Rf,Af=class{constructor(i={}){V(this,tl),V(this,Z),V(this,ds),this.version=Pf,this.FS={analyzePath:async(t,r)=>{let n={type:"analyzePath",data:{path:t,dontResolveLastLink:r}};return(await S(this,Z).request(n)).obj},lookupPath:async t=>{let r={type:"lookupPath",data:{path:t}};return(await S(this,Z).request(r)).obj},mkdir:async t=>{let r={type:"mkdir",data:{path:t}};return(await S(this,Z).request(r)).obj},mount:async(t,r,n)=>{let s=[];"blobs"in r&&r.blobs&&(s=[...s,...r.blobs.map(a=>a.data instanceof Blob?a.data.arrayBuffer().then(l=>{a.data=new Uint8Array(l)}):Promise.resolve())]),"packages"in r&&r.packages&&(s=[...s,...r.packages.map(a=>a.blob instanceof Blob?a.blob.arrayBuffer().then(l=>{a.blob=new Uint8Array(l)}):Promise.resolve())]),await Promise.all(s);let o={type:"mount",data:{type:t,options:r,mountpoint:n}};await S(this,Z).request(o)},syncfs:async t=>{let r={type:"syncfs",data:{populate:t}};await S(this,Z).request(r)},readFile:async(t,r)=>{let n={type:"readFile",data:{path:t,flags:r}};return(await S(this,Z).request(n)).obj},rename:async(t,r)=>{let n={type:"rename",data:{oldpath:t,newpath:r}};await S(this,Z).request(n)},rmdir:async t=>{let r={type:"rmdir",data:{path:t}};await S(this,Z).request(r)},writeFile:async(t,r,n)=>{let s={type:"writeFile",data:{path:t,data:r,flags:n}};await S(this,Z).request(s)},unlink:async t=>{let r={type:"unlink",data:{path:t}};await S(this,Z).request(r)},unmount:async t=>{let r={type:"unmount",data:{path:t}};await S(this,Z).request(r)}};let e={...Bu,...i,REnv:{...Bu.REnv,...i.REnv}};ue(this,Z,wy(e)),this.objs={},this.Shelter=Ly(S(this,Z)),ue(this,ds,S(this,Z).initialised.then(async()=>{this.globalShelter=await new this.Shelter,this.RObject=this.globalShelter.RObject,this.RLogical=this.globalShelter.RLogical,this.RInteger=this.globalShelter.RInteger,this.RDouble=this.globalShelter.RDouble,this.RComplex=this.globalShelter.RComplex,this.RCharacter=this.globalShelter.RCharacter,this.RRaw=this.globalShelter.RRaw,this.RList=this.globalShelter.RList,this.RDataFrame=this.globalShelter.RDataFrame,this.RPairlist=this.globalShelter.RPairlist,this.REnvironment=this.globalShelter.REnvironment,this.RSymbol=this.globalShelter.RSymbol,this.RString=this.globalShelter.RString,this.RCall=this.globalShelter.RCall,this.objs={baseEnv:await this.RObject.getPersistentObject("baseEnv"),globalEnv:await this.RObject.getPersistentObject("globalEnv"),null:await this.RObject.getPersistentObject("null"),true:await this.RObject.getPersistentObject("true"),false:await this.RObject.getPersistentObject("false"),na:await this.RObject.getPersistentObject("na")},tt(this,tl,Rf).call(this)}))}async init(){return S(this,ds)}close(){S(this,Z).close()}async read(){return await S(this,Z).read()}async*stream(){for(;;){let i=await S(this,Z).read();if(i.type==="closed")return;yield i}}async flush(){return await S(this,Z).flush()}write(i){S(this,Z).write(i)}writeConsole(i){this.write({type:"stdin",data:i+`
`})}interrupt(){S(this,Z).interrupt()}async installPackages(i,e){let t=Object.assign({quiet:!1,mount:!0},e),r={type:"installPackages",data:{name:i,options:t}};await S(this,Z).request(r)}async destroy(i){await this.globalShelter.destroy(i)}async evalR(i,e){return this.globalShelter.evalR(i,e)}async evalRVoid(i,e){return this.evalRRaw(i,"void",e)}async evalRBoolean(i,e){return this.evalRRaw(i,"boolean",e)}async evalRNumber(i,e){return this.evalRRaw(i,"number",e)}async evalRString(i,e){return this.evalRRaw(i,"string",e)}async evalRRaw(i,e,t={}){let r=Gt(t,ie,o=>o._payload),n={type:"evalRRaw",data:{code:i,options:r,outputType:e}},s=await S(this,Z).request(n);switch(s.payloadType){case"raw":return s.obj;case"ptr":throw new Wr("Unexpected ptr payload type returned from evalRVoid")}}async invokeWasmFunction(i,...e){let t={type:"invokeWasmFunction",data:{ptr:i,args:e}};return(await S(this,Z).request(t)).obj}};Z=new WeakMap,ds=new WeakMap,tl=new WeakSet,Rf=async function(){for(;;){let i=await S(this,Z).readSystem();switch(i.type){case"setTimeoutWasm":setTimeout((e,t)=>{this.invokeWasmFunction(e,...t)},i.data.delay,i.data.ptr,i.data.args);break;case"console.log":console.log(i.data);break;case"console.warn":console.warn(i.data);break;case"console.error":console.error(i.data);break;case"close":S(this,Z).close();break;default:throw new wi("Unknown system message type `"+i.type+"`")}}};var oe,K,ps,il=class{constructor(i){V(this,oe,""),V(this,K),V(this,ps,!1),ue(this,K,i)}async init(){if(S(this,ps))return;let i={type:"newShelter"},e=await S(this,K).request(i);ue(this,oe,e.obj),this.RObject=$e(S(this,K),S(this,oe),"object"),this.RLogical=$e(S(this,K),S(this,oe),"logical"),this.RInteger=$e(S(this,K),S(this,oe),"integer"),this.RDouble=$e(S(this,K),S(this,oe),"double"),this.RComplex=$e(S(this,K),S(this,oe),"complex"),this.RCharacter=$e(S(this,K),S(this,oe),"character"),this.RRaw=$e(S(this,K),S(this,oe),"raw"),this.RList=$e(S(this,K),S(this,oe),"list"),this.RDataFrame=$e(S(this,K),S(this,oe),"dataframe"),this.RPairlist=$e(S(this,K),S(this,oe),"pairlist"),this.REnvironment=$e(S(this,K),S(this,oe),"environment"),this.RSymbol=$e(S(this,K),S(this,oe),"symbol"),this.RString=$e(S(this,K),S(this,oe),"string"),this.RCall=$e(S(this,K),S(this,oe),"call"),ue(this,ps,!0)}async purge(){let i={type:"shelterPurge",data:S(this,oe)};await S(this,K).request(i)}async destroy(i){let e={type:"shelterDestroy",data:{id:S(this,oe),obj:i._payload}};await S(this,K).request(e)}async size(){let i={type:"shelterSize",data:S(this,oe)};return(await S(this,K).request(i)).obj}async evalR(i,e={}){let t=Gt(e,ie,s=>s._payload),r={type:"evalR",data:{code:i,options:t,shelter:S(this,oe)}},n=await S(this,K).request(r);switch(n.payloadType){case"raw":throw new Wr("Unexpected payload type returned from evalR");default:return yi(S(this,K),n)}}async captureR(i,e={}){let t=Gt(e,ie,s=>s._payload),r={type:"captureR",data:{code:i,options:t,shelter:S(this,oe)}},n=await S(this,K).request(r);switch(n.payloadType){case"ptr":throw new Wr("Unexpected payload type returned from evalR");case"raw":{let s=n.obj,o=yi(S(this,K),s.result),a=s.output,l=s.images;for(let c=0;c<a.length;++c)a[c].type!=="stdout"&&a[c].type!=="stderr"&&(a[c].data=yi(S(this,K),a[c].data));return{result:o,output:a,images:l}}}}};oe=new WeakMap,K=new WeakMap,ps=new WeakMap;function Ly(i){return new Proxy(il,{construct:async()=>{let e=new il(i);return await e.init(),e}})}var Mf=Symbol("Comlink.proxy"),wl=Symbol("Comlink.endpoint"),qy=Symbol("Comlink.releaseProxy"),yl=Symbol("Comlink.finalizer"),Cs=Symbol("Comlink.thrown"),_f=i=>typeof i=="object"&&i!==null||typeof i=="function",Vy={canHandle:i=>_f(i)&&i[Mf],serialize(i){let{port1:e,port2:t}=new MessageChannel;return Qs(i,e),[t,[t]]},deserialize(i){return i.start(),Fr(i)}},$y={canHandle:i=>_f(i)&&Cs in i,serialize({value:i}){let e;return i instanceof Error?e={isError:!0,value:{message:i.message,name:i.name,stack:i.stack}}:e={isError:!1,value:i},[e,[]]},deserialize(i){throw i.isError?Object.assign(new Error(i.value.message),i.value):i.value}},Yt=new Map([["proxy",Vy],["throw",$y]]);function By(i,e){for(let t of i)if(e===t||t==="*"||t instanceof RegExp&&t.test(e))return!0;return!1}function Qs(i,e=globalThis,t=["*"]){e.addEventListener("message",function r(n){if(!n||!n.data)return;if(!By(t,n.origin)){console.warn(`Invalid origin '${n.origin}' for comlink proxy`);return}let{id:s,type:o,path:a}=Object.assign({path:[]},n.data),l=(n.data.argumentList||[]).map(xi),c;try{let h=a.slice(0,-1).reduce((f,d)=>f[d],i),u=a.reduce((f,d)=>f[d],i);switch(o){case"GET":c=u;break;case"SET":h[a.slice(-1)[0]]=xi(n.data.value),c=!0;break;case"APPLY":c=u.apply(h,l);break;case"CONSTRUCT":{let f=new u(...l);c=zy(f)}break;case"ENDPOINT":{let{port1:f,port2:d}=new MessageChannel;Qs(i,d),c=Wy(f,[f])}break;case"RELEASE":c=void 0;break;default:return}}catch(h){c={value:h,[Cs]:0}}Promise.resolve(c).catch(h=>({value:h,[Cs]:0})).then(h=>{let[u,f]=As(h);e.postMessage(Object.assign(Object.assign({},u),{id:s}),f),o==="RELEASE"&&(e.removeEventListener("message",r),Df(e),yl in i&&typeof i[yl]=="function"&&i[yl]())}).catch(h=>{let[u,f]=As({value:new TypeError("Unserializable return value"),[Cs]:0});e.postMessage(Object.assign(Object.assign({},u),{id:s}),f)})}),e.start&&e.start()}function Xy(i){return i.constructor.name==="MessagePort"}function Df(i){Xy(i)&&i.close()}function Fr(i,e){return bl(i,[],e)}function Ps(i){if(i)throw new Error("Proxy has been released and is not useable")}function Lf(i){return Ji(i,{type:"RELEASE"}).then(()=>{Df(i)})}var Es=new WeakMap,Rs="FinalizationRegistry"in globalThis&&new FinalizationRegistry(i=>{let e=(Es.get(i)||0)-1;Es.set(i,e),e===0&&Lf(i)});function Ny(i,e){let t=(Es.get(e)||0)+1;Es.set(e,t),Rs&&Rs.register(i,e,i)}function jy(i){Rs&&Rs.unregister(i)}function bl(i,e=[],t=function(){}){let r=!1,n=new Proxy(t,{get(s,o){if(Ps(r),o===qy)return()=>{jy(n),Lf(i),r=!0};if(o==="then"){if(e.length===0)return{then:()=>n};let a=Ji(i,{type:"GET",path:e.map(l=>l.toString())}).then(xi);return a.then.bind(a)}return bl(i,[...e,o])},set(s,o,a){Ps(r);let[l,c]=As(a);return Ji(i,{type:"SET",path:[...e,o].map(h=>h.toString()),value:l},c).then(xi)},apply(s,o,a){Ps(r);let l=e[e.length-1];if(l===wl)return Ji(i,{type:"ENDPOINT"}).then(xi);if(l==="bind")return bl(i,e.slice(0,-1));let[c,h]=Qf(a);return Ji(i,{type:"APPLY",path:e.map(u=>u.toString()),argumentList:c},h).then(xi)},construct(s,o){Ps(r);let[a,l]=Qf(o);return Ji(i,{type:"CONSTRUCT",path:e.map(c=>c.toString()),argumentList:a},l).then(xi)}});return Ny(n,i),n}function Iy(i){return Array.prototype.concat.apply([],i)}function Qf(i){let e=i.map(As);return[e.map(t=>t[0]),Iy(e.map(t=>t[1]))]}var qf=new WeakMap;function Wy(i,e){return qf.set(i,e),i}function zy(i){return Object.assign(i,{[Mf]:!0})}function As(i){for(let[e,t]of Yt)if(t.canHandle(i)){let[r,n]=t.serialize(i);return[{type:"HANDLER",name:e,value:r},n]}return[{type:"RAW",value:i},qf.get(i)||[]]}function xi(i){switch(i.type){case"HANDLER":return Yt.get(i.name).deserialize(i.value);case"RAW":return i.value}}function Ji(i,e,t){return new Promise(r=>{let n=Uy();i.addEventListener("message",function s(o){!o.data||!o.data.id||o.data.id!==n||(i.removeEventListener("message",s),r(o.data))}),i.start&&i.start(),i.postMessage(Object.assign({id:n},e),t)})}function Uy(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}var Ki=[],it=class{constructor(e){this.isRunning=!1;this.isDestroyed=!1;Ki.push(this),e?this.callbacks=e:this.callbacks={busyCallback:()=>{},idleCallback:()=>{},runningCallback:()=>{},finishedCallback:()=>{}}}running(){this.isRunning=!0,Ki.forEach(e=>e.callbacks.busyCallback()),this.callbacks.runningCallback()}finished(){this.isRunning=!1,this.callbacks.finishedCallback(),this.status().busy||Ki.forEach(e=>e.callbacks.idleCallback())}status(){let e=this.isRunning,t=this.isDestroyed,r=Ki.some(n=>n.isRunning);return{running:e,busy:r,destroyed:t}}destroy(){this.isDestroyed=!0;let e=Ki.indexOf(this);Ki.splice(e,1)}};var j=class i{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,r){[e,t]=sr(this,e,t);let n=[];return this.decompose(0,e,n,2),r.length&&r.decompose(0,r.length,n,3),this.decompose(t,this.length,n,1),tr.from(n,this.length-(t-e)+r.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=sr(this,e,t);let r=[];return this.decompose(e,t,r,0),tr.from(r,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),r=this.length-this.scanIdentical(e,-1),n=new Ti(this),s=new Ti(e);for(let o=t,a=t;;){if(n.next(o),s.next(o),o=0,n.lineBreak!=s.lineBreak||n.done!=s.done||n.value!=s.value)return!1;if(a+=n.value.length,n.done||a>=r)return!0}}iter(e=1){return new Ti(this,e)}iterRange(e,t=this.length){return new Ls(this,e,t)}iterLines(e,t){let r;if(e==null)r=this.iter();else{t==null&&(t=this.lines+1);let n=this.line(e).from;r=this.iterRange(n,Math.max(n,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new qs(r)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?i.empty:e.length<=32?new Ue(e):tr.from(Ue.split(e,[]))}},Ue=class i extends j{constructor(e,t=Fy(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,r,n){for(let s=0;;s++){let o=this.text[s],a=n+o.length;if((t?r:a)>=e)return new xl(n,a,r,o);n=a+1,r++}}decompose(e,t,r,n){let s=e<=0&&t>=this.length?this:new i($f(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(n&1){let o=r.pop(),a=Ds(s.text,o.text.slice(),0,s.length);if(a.length<=32)r.push(new i(a,o.length+s.length));else{let l=a.length>>1;r.push(new i(a.slice(0,l)),new i(a.slice(l)))}}else r.push(s)}replace(e,t,r){if(!(r instanceof i))return super.replace(e,t,r);[e,t]=sr(this,e,t);let n=Ds(this.text,Ds(r.text,$f(this.text,0,e)),t),s=this.length+r.length-(t-e);return n.length<=32?new i(n,s):tr.from(i.split(n,[]),s)}sliceString(e,t=this.length,r=`
`){[e,t]=sr(this,e,t);let n="";for(let s=0,o=0;s<=t&&o<this.text.length;o++){let a=this.text[o],l=s+a.length;s>e&&o&&(n+=r),e<l&&t>s&&(n+=a.slice(Math.max(0,e-s),t-s)),s=l+1}return n}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let r=[],n=-1;for(let s of e)r.push(s),n+=s.length+1,r.length==32&&(t.push(new i(r,n)),r=[],n=-1);return n>-1&&t.push(new i(r,n)),t}},tr=class i extends j{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let r of e)this.lines+=r.lines}lineInner(e,t,r,n){for(let s=0;;s++){let o=this.children[s],a=n+o.length,l=r+o.lines-1;if((t?l:a)>=e)return o.lineInner(e,t,r,n);n=a+1,r=l+1}}decompose(e,t,r,n){for(let s=0,o=0;o<=t&&s<this.children.length;s++){let a=this.children[s],l=o+a.length;if(e<=l&&t>=o){let c=n&((o<=e?1:0)|(l>=t?2:0));o>=e&&l<=t&&!c?r.push(a):a.decompose(e-o,t-o,r,c)}o=l+1}}replace(e,t,r){if([e,t]=sr(this,e,t),r.lines<this.lines)for(let n=0,s=0;n<this.children.length;n++){let o=this.children[n],a=s+o.length;if(e>=s&&t<=a){let l=o.replace(e-s,t-s,r),c=this.lines-o.lines+l.lines;if(l.lines<c>>4&&l.lines>c>>6){let h=this.children.slice();return h[n]=l,new i(h,this.length-(t-e)+r.length)}return super.replace(s,a,l)}s=a+1}return super.replace(e,t,r)}sliceString(e,t=this.length,r=`
`){[e,t]=sr(this,e,t);let n="";for(let s=0,o=0;s<this.children.length&&o<=t;s++){let a=this.children[s],l=o+a.length;o>e&&s&&(n+=r),e<l&&t>o&&(n+=a.sliceString(e-o,t-o,r)),o=l+1}return n}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof i))return 0;let r=0,[n,s,o,a]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;n+=t,s+=t){if(n==o||s==a)return r;let l=this.children[n],c=e.children[s];if(l!=c)return r+l.scanIdentical(c,t);r+=l.length+1}}static from(e,t=e.reduce((r,n)=>r+n.length+1,-1)){let r=0;for(let d of e)r+=d.lines;if(r<32){let d=[];for(let m of e)m.flatten(d);return new Ue(d,t)}let n=Math.max(32,r>>5),s=n<<1,o=n>>1,a=[],l=0,c=-1,h=[];function u(d){let m;if(d.lines>s&&d instanceof i)for(let p of d.children)u(p);else d.lines>o&&(l>o||!l)?(f(),a.push(d)):d instanceof Ue&&l&&(m=h[h.length-1])instanceof Ue&&d.lines+m.lines<=32?(l+=d.lines,c+=d.length+1,h[h.length-1]=new Ue(m.text.concat(d.text),m.length+1+d.length)):(l+d.lines>n&&f(),l+=d.lines,c+=d.length+1,h.push(d))}function f(){l!=0&&(a.push(h.length==1?h[0]:i.from(h,c)),c=-1,l=h.length=0)}for(let d of e)u(d);return f(),a.length==1?a[0]:new i(a,t)}};j.empty=new Ue([""],0);function Fy(i){let e=-1;for(let t of i)e+=t.length+1;return e}function Ds(i,e,t=0,r=1e9){for(let n=0,s=0,o=!0;s<i.length&&n<=r;s++){let a=i[s],l=n+a.length;l>=t&&(l>r&&(a=a.slice(0,r-n)),n<t&&(a=a.slice(t-n)),o?(e[e.length-1]+=a,o=!1):e.push(a)),n=l+1}return e}function $f(i,e,t){return Ds(i,[""],e,t)}var Ti=class{constructor(e,t=1){this.dir=t,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[t>0?1:(e instanceof Ue?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let r=this.nodes.length-1,n=this.nodes[r],s=this.offsets[r],o=s>>1,a=n instanceof Ue?n.text.length:n.children.length;if(o==(t>0?a:0)){if(r==0)return this.done=!0,this.value="",this;t>0&&this.offsets[r-1]++,this.nodes.pop(),this.offsets.pop()}else if((s&1)==(t>0?0:1)){if(this.offsets[r]+=t,e==0)return this.lineBreak=!0,this.value=`
`,this;e--}else if(n instanceof Ue){let l=n.text[o+(t<0?-1:0)];if(this.offsets[r]+=t,l.length>Math.max(0,e))return this.value=e==0?l:t>0?l.slice(e):l.slice(0,l.length-e),this;e-=l.length}else{let l=n.children[o+(t<0?-1:0)];e>l.length?(e-=l.length,this.offsets[r]+=t):(t<0&&this.offsets[r]--,this.nodes.push(l),this.offsets.push(t>0?1:(l instanceof Ue?l.text.length:l.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}},Ls=class{constructor(e,t,r){this.value="",this.done=!1,this.cursor=new Ti(e,t>r?-1:1),this.pos=t>r?e.length:0,this.from=Math.min(t,r),this.to=Math.max(t,r)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let r=t<0?this.pos-this.from:this.to-this.pos;e>r&&(e=r),r-=e;let{value:n}=this.cursor.next(e);return this.pos+=(n.length+e)*t,this.value=n.length<=r?n:t<0?n.slice(n.length-r):n.slice(0,r),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}},qs=class{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:r,value:n}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):r?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=n,this.afterBreak=!1),this}get lineBreak(){return!1}};typeof Symbol<"u"&&(j.prototype[Symbol.iterator]=function(){return this.iter()},Ti.prototype[Symbol.iterator]=Ls.prototype[Symbol.iterator]=qs.prototype[Symbol.iterator]=function(){return this});var xl=class{constructor(e,t,r,n){this.from=e,this.to=t,this.number=r,this.text=n}get length(){return this.to-this.from}};function sr(i,e,t){return e=Math.max(0,Math.min(i.length,e)),[e,Math.max(e,Math.min(i.length,t))]}var ir="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(i=>i?parseInt(i,36):1);for(let i=1;i<ir.length;i++)ir[i]+=ir[i-1];function Hy(i){for(let e=1;e<ir.length;e+=2)if(ir[e]>i)return ir[e-1]<=i;return!1}function Bf(i){return i>=127462&&i<=127487}var Xf=8205;function pe(i,e,t=!0,r=!0){return(t?Uf:Gy)(i,e,r)}function Uf(i,e,t){if(e==i.length)return e;e&&Ff(i.charCodeAt(e))&&Hf(i.charCodeAt(e-1))&&e--;let r=fe(i,e);for(e+=Qe(r);e<i.length;){let n=fe(i,e);if(r==Xf||n==Xf||t&&Hy(n))e+=Qe(n),r=n;else if(Bf(n)){let s=0,o=e-2;for(;o>=0&&Bf(fe(i,o));)s++,o-=2;if(s%2==0)break;e+=2}else break}return e}function Gy(i,e,t){for(;e>0;){let r=Uf(i,e-2,t);if(r<e)return r;e--}return 0}function Ff(i){return i>=56320&&i<57344}function Hf(i){return i>=55296&&i<56320}function fe(i,e){let t=i.charCodeAt(e);if(!Hf(t)||e+1==i.length)return t;let r=i.charCodeAt(e+1);return Ff(r)?(t-55296<<10)+(r-56320)+65536:t}function Kr(i){return i<=65535?String.fromCharCode(i):(i-=65536,String.fromCharCode((i>>10)+55296,(i&1023)+56320))}function Qe(i){return i<65536?1:2}var Sl=/\r\n?|\n/,ye=function(i){return i[i.Simple=0]="Simple",i[i.TrackDel=1]="TrackDel",i[i.TrackBefore=2]="TrackBefore",i[i.TrackAfter=3]="TrackAfter",i}(ye||(ye={})),$t=class i{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;t<this.sections.length;t+=2)e+=this.sections[t];return e}get newLength(){let e=0;for(let t=0;t<this.sections.length;t+=2){let r=this.sections[t+1];e+=r<0?this.sections[t]:r}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let t=0,r=0,n=0;t<this.sections.length;){let s=this.sections[t++],o=this.sections[t++];o<0?(e(r,n,s),n+=s):n+=o,r+=s}}iterChangedRanges(e,t=!1){kl(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let r=this.sections[t++],n=this.sections[t++];n<0?e.push(r,n):e.push(n,r)}return new i(e)}composeDesc(e){return this.empty?e:e.empty?this:Gf(this,e)}mapDesc(e,t=!1){return e.empty?this:Tl(this,e,t)}mapPos(e,t=-1,r=ye.Simple){let n=0,s=0;for(let o=0;o<this.sections.length;){let a=this.sections[o++],l=this.sections[o++],c=n+a;if(l<0){if(c>e)return s+(e-n);s+=a}else{if(r!=ye.Simple&&c>=e&&(r==ye.TrackDel&&n<e&&c>e||r==ye.TrackBefore&&n<e||r==ye.TrackAfter&&c>e))return null;if(c>e||c==e&&t<0&&!a)return e==n||t<0?s:s+l;s+=l}n=c}if(e>n)throw new RangeError(`Position ${e} is out of range for changeset of length ${n}`);return s}touchesRange(e,t=e){for(let r=0,n=0;r<this.sections.length&&n<=t;){let s=this.sections[r++],o=this.sections[r++],a=n+s;if(o>=0&&n<=t&&a>=e)return n<e&&a>t?"cover":!0;n=a}return!1}toString(){let e="";for(let t=0;t<this.sections.length;){let r=this.sections[t++],n=this.sections[t++];e+=(e?" ":"")+r+(n>=0?":"+n:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(t=>typeof t!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new i(e)}static create(e){return new i(e)}},Me=class i extends $t{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return kl(this,(t,r,n,s,o)=>e=e.replace(n,n+(r-t),o),!1),e}mapDesc(e,t=!1){return Tl(this,e,t,!0)}invert(e){let t=this.sections.slice(),r=[];for(let n=0,s=0;n<t.length;n+=2){let o=t[n],a=t[n+1];if(a>=0){t[n]=a,t[n+1]=o;let l=n>>1;for(;r.length<l;)r.push(j.empty);r.push(o?e.slice(s,s+o):j.empty)}s+=o}return new i(t,r)}compose(e){return this.empty?e:e.empty?this:Gf(this,e,!0)}map(e,t=!1){return e.empty?this:Tl(this,e,t,!0)}iterChanges(e,t=!1){kl(this,e,t)}get desc(){return $t.create(this.sections)}filter(e){let t=[],r=[],n=[],s=new Pi(this);e:for(let o=0,a=0;;){let l=o==e.length?1e9:e[o++];for(;a<l||a==l&&s.len==0;){if(s.done)break e;let h=Math.min(s.len,l-a);Pe(n,h,-1);let u=s.ins==-1?-1:s.off==0?s.ins:0;Pe(t,h,u),u>0&&Zt(r,t,s.text),s.forward(h),a+=h}let c=e[o++];for(;a<c;){if(s.done)break e;let h=Math.min(s.len,c-a);Pe(t,h,-1),Pe(n,h,s.ins==-1?-1:s.off==0?s.ins:0),s.forward(h),a+=h}}return{changes:new i(t,r),filtered:$t.create(n)}}toJSON(){let e=[];for(let t=0;t<this.sections.length;t+=2){let r=this.sections[t],n=this.sections[t+1];n<0?e.push(r):n==0?e.push([r]):e.push([r].concat(this.inserted[t>>1].toJSON()))}return e}static of(e,t,r){let n=[],s=[],o=0,a=null;function l(h=!1){if(!h&&!n.length)return;o<t&&Pe(n,t-o,-1);let u=new i(n,s);a=a?a.compose(u.map(a)):u,n=[],s=[],o=0}function c(h){if(Array.isArray(h))for(let u of h)c(u);else if(h instanceof i){if(h.length!=t)throw new RangeError(`Mismatched change set length (got ${h.length}, expected ${t})`);l(),a=a?a.compose(h.map(a)):h}else{let{from:u,to:f=u,insert:d}=h;if(u>f||u<0||f>t)throw new RangeError(`Invalid change range ${u} to ${f} (in doc of length ${t})`);let m=d?typeof d=="string"?j.of(d.split(r||Sl)):d:j.empty,p=m.length;if(u==f&&p==0)return;u<o&&l(),u>o&&Pe(n,u-o,-1),Pe(n,f-u,p),Zt(s,n,m),o=f}}return c(e),l(!a),a}static empty(e){return new i(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],r=[];for(let n=0;n<e.length;n++){let s=e[n];if(typeof s=="number")t.push(s,-1);else{if(!Array.isArray(s)||typeof s[0]!="number"||s.some((o,a)=>a&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(s.length==1)t.push(s[0],0);else{for(;r.length<n;)r.push(j.empty);r[n]=j.of(s.slice(1)),t.push(s[0],r[n].length)}}}return new i(t,r)}static createSet(e,t){return new i(e,t)}};function Pe(i,e,t,r=!1){if(e==0&&t<=0)return;let n=i.length-2;n>=0&&t<=0&&t==i[n+1]?i[n]+=e:e==0&&i[n]==0?i[n+1]+=t:r?(i[n]+=e,i[n+1]+=t):i.push(e,t)}function Zt(i,e,t){if(t.length==0)return;let r=e.length-2>>1;if(r<i.length)i[i.length-1]=i[i.length-1].append(t);else{for(;i.length<r;)i.push(j.empty);i.push(t)}}function kl(i,e,t){let r=i.inserted;for(let n=0,s=0,o=0;o<i.sections.length;){let a=i.sections[o++],l=i.sections[o++];if(l<0)n+=a,s+=a;else{let c=n,h=s,u=j.empty;for(;c+=a,h+=l,l&&r&&(u=u.append(r[o-2>>1])),!(t||o==i.sections.length||i.sections[o+1]<0);)a=i.sections[o++],l=i.sections[o++];e(n,c,s,h,u),n=c,s=h}}}function Tl(i,e,t,r=!1){let n=[],s=r?[]:null,o=new Pi(i),a=new Pi(e);for(let l=-1;;)if(o.ins==-1&&a.ins==-1){let c=Math.min(o.len,a.len);Pe(n,c,-1),o.forward(c),a.forward(c)}else if(a.ins>=0&&(o.ins<0||l==o.i||o.off==0&&(a.len<o.len||a.len==o.len&&!t))){let c=a.len;for(Pe(n,a.ins,-1);c;){let h=Math.min(o.len,c);o.ins>=0&&l<o.i&&o.len<=h&&(Pe(n,0,o.ins),s&&Zt(s,n,o.text),l=o.i),o.forward(h),c-=h}a.next()}else if(o.ins>=0){let c=0,h=o.len;for(;h;)if(a.ins==-1){let u=Math.min(h,a.len);c+=u,h-=u,a.forward(u)}else if(a.ins==0&&a.len<h)h-=a.len,a.next();else break;Pe(n,c,l<o.i?o.ins:0),s&&l<o.i&&Zt(s,n,o.text),l=o.i,o.forward(o.len-h)}else{if(o.done&&a.done)return s?Me.createSet(n,s):$t.create(n);throw new Error("Mismatched change set lengths")}}function Gf(i,e,t=!1){let r=[],n=t?[]:null,s=new Pi(i),o=new Pi(e);for(let a=!1;;){if(s.done&&o.done)return n?Me.createSet(r,n):$t.create(r);if(s.ins==0)Pe(r,s.len,0,a),s.next();else if(o.len==0&&!o.done)Pe(r,0,o.ins,a),n&&Zt(n,r,o.text),o.next();else{if(s.done||o.done)throw new Error("Mismatched change set lengths");{let l=Math.min(s.len2,o.len),c=r.length;if(s.ins==-1){let h=o.ins==-1?-1:o.off?0:o.ins;Pe(r,l,h,a),n&&h&&Zt(n,r,o.text)}else o.ins==-1?(Pe(r,s.off?0:s.len,l,a),n&&Zt(n,r,s.textBit(l))):(Pe(r,s.off?0:s.len,o.off?0:o.ins,a),n&&!o.off&&Zt(n,r,o.text));a=(s.ins>l||o.ins>=0&&o.len>l)&&(a||r.length>c),s.forward2(l),o.forward(l)}}}}var Pi=class{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,t=this.i-2>>1;return t>=e.length?j.empty:e[t]}textBit(e){let{inserted:t}=this.set,r=this.i-2>>1;return r>=t.length&&!e?j.empty:t[r].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}},er=class i{constructor(e,t,r){this.from=e,this.to=t,this.flags=r}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}map(e,t=-1){let r,n;return this.empty?r=n=e.mapPos(this.from,t):(r=e.mapPos(this.from,1),n=e.mapPos(this.to,-1)),r==this.from&&n==this.to?this:new i(r,n,this.flags)}extend(e,t=e){if(e<=this.anchor&&t>=this.anchor)return T.range(e,t);let r=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return T.range(this.anchor,r)}eq(e,t=!1){return this.anchor==e.anchor&&this.head==e.head&&(!t||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return T.range(e.anchor,e.head)}static create(e,t,r){return new i(e,t,r)}},T=class i{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:i.create(this.ranges.map(r=>r.map(e,t)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let r=0;r<this.ranges.length;r++)if(!this.ranges[r].eq(e.ranges[r],t))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new i([this.main],0)}addRange(e,t=!0){return i.create([e].concat(this.ranges),t?0:this.mainIndex+1)}replaceRange(e,t=this.mainIndex){let r=this.ranges.slice();return r[t]=e,i.create(r,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(e=>e.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new i(e.ranges.map(t=>er.fromJSON(t)),e.main)}static single(e,t=e){return new i([i.range(e,t)],0)}static create(e,t=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let r=0,n=0;n<e.length;n++){let s=e[n];if(s.empty?s.from<=r:s.from<r)return i.normalized(e.slice(),t);r=s.to}return new i(e,t)}static cursor(e,t=0,r,n){return er.create(e,e,(t==0?0:t<0?8:16)|(r==null?7:Math.min(6,r))|(n??16777215)<<6)}static range(e,t,r,n){let s=(r??16777215)<<6|(n==null?7:Math.min(6,n));return t<e?er.create(t,e,48|s):er.create(e,t,(t>e?8:0)|s)}static normalized(e,t=0){let r=e[t];e.sort((n,s)=>n.from-s.from),t=e.indexOf(r);for(let n=1;n<e.length;n++){let s=e[n],o=e[n-1];if(s.empty?s.from<=o.to:s.from<o.to){let a=o.from,l=Math.max(s.to,o.to);n<=t&&t--,e.splice(--n,2,s.anchor>s.head?i.range(l,a):i.range(a,l))}}return new i(e,t)}};function Yf(i,e){for(let t of i.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}var Ll=0,A=class i{constructor(e,t,r,n,s){this.combine=e,this.compareInput=t,this.compare=r,this.isStatic=n,this.id=Ll++,this.default=e([]),this.extensions=typeof s=="function"?s(this):s}get reader(){return this}static define(e={}){return new i(e.combine||(t=>t),e.compareInput||((t,r)=>t===r),e.compare||(e.combine?(t,r)=>t===r:ql),!!e.static,e.enables)}of(e){return new rr([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new rr(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new rr(e,this,2,t)}from(e,t){return t||(t=r=>r),this.compute([e],r=>t(r.field(e)))}};function ql(i,e){return i==e||i.length==e.length&&i.every((t,r)=>t===e[r])}var rr=class{constructor(e,t,r,n){this.dependencies=e,this.facet=t,this.type=r,this.value=n,this.id=Ll++}dynamicSlot(e){var t;let r=this.value,n=this.facet.compareInput,s=this.id,o=e[s]>>1,a=this.type==2,l=!1,c=!1,h=[];for(let u of this.dependencies)u=="doc"?l=!0:u=="selection"?c=!0:(((t=e[u.id])!==null&&t!==void 0?t:1)&1)==0&&h.push(e[u.id]);return{create(u){return u.values[o]=r(u),1},update(u,f){if(l&&f.docChanged||c&&(f.docChanged||f.selection)||Pl(u,h)){let d=r(u);if(a?!Nf(d,u.values[o],n):!n(d,u.values[o]))return u.values[o]=d,1}return 0},reconfigure:(u,f)=>{let d,m=f.config.address[s];if(m!=null){let p=Bs(f,m);if(this.dependencies.every(g=>g instanceof A?f.facet(g)===u.facet(g):g instanceof re?f.field(g,!1)==u.field(g,!1):!0)||(a?Nf(d=r(u),p,n):n(d=r(u),p)))return u.values[o]=p,0}else d=r(u);return u.values[o]=d,1}}}};function Nf(i,e,t){if(i.length!=e.length)return!1;for(let r=0;r<i.length;r++)if(!t(i[r],e[r]))return!1;return!0}function Pl(i,e){let t=!1;for(let r of e)Gr(i,r)&1&&(t=!0);return t}function Yy(i,e,t){let r=t.map(l=>i[l.id]),n=t.map(l=>l.type),s=r.filter(l=>!(l&1)),o=i[e.id]>>1;function a(l){let c=[];for(let h=0;h<r.length;h++){let u=Bs(l,r[h]);if(n[h]==2)for(let f of u)c.push(f);else c.push(u)}return e.combine(c)}return{create(l){for(let c of r)Gr(l,c);return l.values[o]=a(l),1},update(l,c){if(!Pl(l,s))return 0;let h=a(l);return e.compare(h,l.values[o])?0:(l.values[o]=h,1)},reconfigure(l,c){let h=Pl(l,r),u=c.config.facets[e.id],f=c.facet(e);if(u&&!h&&ql(t,u))return l.values[o]=f,0;let d=a(l);return e.compare(d,f)?(l.values[o]=f,0):(l.values[o]=d,1)}}}var jf=A.define({static:!0}),re=class i{constructor(e,t,r,n,s){this.id=e,this.createF=t,this.updateF=r,this.compareF=n,this.spec=s,this.provides=void 0}static define(e){let t=new i(Ll++,e.create,e.update,e.compare||((r,n)=>r===n),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(jf).find(r=>r.field==this);return(t?.create||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:r=>(r.values[t]=this.create(r),1),update:(r,n)=>{let s=r.values[t],o=this.updateF(s,n);return this.compareF(s,o)?0:(r.values[t]=o,1)},reconfigure:(r,n)=>n.config.address[this.id]!=null?(r.values[t]=n.field(this),0):(r.values[t]=this.create(r),1)}}init(e){return[this,jf.of({field:this,create:e})]}get extension(){return this}},Si={lowest:4,low:3,default:2,high:1,highest:0};function Hr(i){return e=>new Vs(e,i)}var _e={highest:Hr(Si.highest),high:Hr(Si.high),default:Hr(Si.default),low:Hr(Si.low),lowest:Hr(Si.lowest)},Vs=class{constructor(e,t){this.inner=e,this.prec=t}},Bt=class i{of(e){return new Yr(this,e)}reconfigure(e){return i.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}},Yr=class{constructor(e,t){this.compartment=e,this.inner=t}},$s=class i{constructor(e,t,r,n,s,o){for(this.base=e,this.compartments=t,this.dynamicSlots=r,this.address=n,this.staticValues=s,this.facets=o,this.statusTemplate=[];this.statusTemplate.length<r.length;)this.statusTemplate.push(0)}staticFacet(e){let t=this.address[e.id];return t==null?e.default:this.staticValues[t>>1]}static resolve(e,t,r){let n=[],s=Object.create(null),o=new Map;for(let f of Zy(e,t,o))f instanceof re?n.push(f):(s[f.facet.id]||(s[f.facet.id]=[])).push(f);let a=Object.create(null),l=[],c=[];for(let f of n)a[f.id]=c.length<<1,c.push(d=>f.slot(d));let h=r?.config.facets;for(let f in s){let d=s[f],m=d[0].facet,p=h&&h[f]||[];if(d.every(g=>g.type==0))if(a[m.id]=l.length<<1|1,ql(p,d))l.push(r.facet(m));else{let g=m.combine(d.map(O=>O.value));l.push(r&&m.compare(g,r.facet(m))?r.facet(m):g)}else{for(let g of d)g.type==0?(a[g.id]=l.length<<1|1,l.push(g.value)):(a[g.id]=c.length<<1,c.push(O=>g.dynamicSlot(O)));a[m.id]=c.length<<1,c.push(g=>Yy(g,m,d))}}let u=c.map(f=>f(a));return new i(e,o,u,a,l,s)}};function Zy(i,e,t){let r=[[],[],[],[],[]],n=new Map;function s(o,a){let l=n.get(o);if(l!=null){if(l<=a)return;let c=r[l].indexOf(o);c>-1&&r[l].splice(c,1),o instanceof Yr&&t.delete(o.compartment)}if(n.set(o,a),Array.isArray(o))for(let c of o)s(c,a);else if(o instanceof Yr){if(t.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let c=e.get(o.compartment)||o.inner;t.set(o.compartment,c),s(c,a)}else if(o instanceof Vs)s(o.inner,o.prec);else if(o instanceof re)r[a].push(o),o.provides&&s(o.provides,a);else if(o instanceof rr)r[a].push(o),o.facet.extensions&&s(o.facet.extensions,Si.default);else{let c=o.extension;if(!c)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);s(c,a)}}return s(i,Si.default),r.reduce((o,a)=>o.concat(a))}function Gr(i,e){if(e&1)return 2;let t=e>>1,r=i.status[t];if(r==4)throw new Error("Cyclic dependency between fields and/or facets");if(r&2)return r;i.status[t]=4;let n=i.computeSlot(i,i.config.dynamicSlots[t]);return i.status[t]=2|n}function Bs(i,e){return e&1?i.config.staticValues[e>>1]:i.values[e>>1]}var Zf=A.define(),Cl=A.define({combine:i=>i.some(e=>e),static:!0}),Jf=A.define({combine:i=>i.length?i[0]:void 0,static:!0}),Kf=A.define(),ed=A.define(),td=A.define(),id=A.define({combine:i=>i.length?i[0]:!1}),Be=class{constructor(e,t){this.type=e,this.value=t}static define(){return new El}},El=class{of(e){return new Be(this,e)}},Rl=class{constructor(e){this.map=e}of(e){return new D(this,e)}},D=class i{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return t===void 0?void 0:t==this.value?this:new i(this.type,t)}is(e){return this.type==e}static define(e={}){return new Rl(e.map||(t=>t))}static mapEffects(e,t){if(!e.length)return e;let r=[];for(let n of e){let s=n.map(t);s&&r.push(s)}return r}};D.reconfigure=D.define();D.appendConfig=D.define();var de=class i{constructor(e,t,r,n,s,o){this.startState=e,this.changes=t,this.selection=r,this.effects=n,this.annotations=s,this.scrollIntoView=o,this._doc=null,this._state=null,r&&Yf(r,t.newLength),s.some(a=>a.type==i.time)||(this.annotations=s.concat(i.time.of(Date.now())))}static create(e,t,r,n,s,o){return new i(e,t,r,n,s,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(i.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}};de.time=Be.define();de.userEvent=Be.define();de.addToHistory=Be.define();de.remote=Be.define();function Jy(i,e){let t=[];for(let r=0,n=0;;){let s,o;if(r<i.length&&(n==e.length||e[n]>=i[r]))s=i[r++],o=i[r++];else if(n<e.length)s=e[n++],o=e[n++];else return t;!t.length||t[t.length-1]<s?t.push(s,o):t[t.length-1]<o&&(t[t.length-1]=o)}}function rd(i,e,t){var r;let n,s,o;return t?(n=e.changes,s=Me.empty(e.changes.length),o=i.changes.compose(e.changes)):(n=e.changes.map(i.changes),s=i.changes.mapDesc(e.changes,!0),o=i.changes.compose(n)),{changes:o,selection:e.selection?e.selection.map(s):(r=i.selection)===null||r===void 0?void 0:r.map(n),effects:D.mapEffects(i.effects,n).concat(D.mapEffects(e.effects,s)),annotations:i.annotations.length?i.annotations.concat(e.annotations):e.annotations,scrollIntoView:i.scrollIntoView||e.scrollIntoView}}function Al(i,e,t){let r=e.selection,n=nr(e.annotations);return e.userEvent&&(n=n.concat(de.userEvent.of(e.userEvent))),{changes:e.changes instanceof Me?e.changes:Me.of(e.changes||[],t,i.facet(Jf)),selection:r&&(r instanceof T?r:T.single(r.anchor,r.head)),effects:nr(e.effects),annotations:n,scrollIntoView:!!e.scrollIntoView}}function nd(i,e,t){let r=Al(i,e.length?e[0]:{},i.doc.length);e.length&&e[0].filter===!1&&(t=!1);for(let s=1;s<e.length;s++){e[s].filter===!1&&(t=!1);let o=!!e[s].sequential;r=rd(r,Al(i,e[s],o?r.changes.newLength:i.doc.length),o)}let n=de.create(i,r.changes,r.selection,r.effects,r.annotations,r.scrollIntoView);return eb(t?Ky(n):n)}function Ky(i){let e=i.startState,t=!0;for(let n of e.facet(Kf)){let s=n(i);if(s===!1){t=!1;break}Array.isArray(s)&&(t=t===!0?s:Jy(t,s))}if(t!==!0){let n,s;if(t===!1)s=i.changes.invertedDesc,n=Me.empty(e.doc.length);else{let o=i.changes.filter(t);n=o.changes,s=o.filtered.mapDesc(o.changes).invertedDesc}i=de.create(e,n,i.selection&&i.selection.map(s),D.mapEffects(i.effects,s),i.annotations,i.scrollIntoView)}let r=e.facet(ed);for(let n=r.length-1;n>=0;n--){let s=r[n](i);s instanceof de?i=s:Array.isArray(s)&&s.length==1&&s[0]instanceof de?i=s[0]:i=nd(e,nr(s),!1)}return i}function eb(i){let e=i.startState,t=e.facet(td),r=i;for(let n=t.length-1;n>=0;n--){let s=t[n](i);s&&Object.keys(s).length&&(r=rd(r,Al(e,s,i.changes.newLength),!0))}return r==i?i:de.create(e,i.changes,i.selection,r.effects,r.annotations,r.scrollIntoView)}var tb=[];function nr(i){return i==null?tb:Array.isArray(i)?i:[i]}var H=function(i){return i[i.Word=0]="Word",i[i.Space=1]="Space",i[i.Other=2]="Other",i}(H||(H={})),ib=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,Ql;try{Ql=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function rb(i){if(Ql)return Ql.test(i);for(let e=0;e<i.length;e++){let t=i[e];if(/\w/.test(t)||t>"\x80"&&(t.toUpperCase()!=t.toLowerCase()||ib.test(t)))return!0}return!1}function nb(i){return e=>{if(!/\S/.test(e))return H.Space;if(rb(e))return H.Word;for(let t=0;t<i.length;t++)if(e.indexOf(i[t])>-1)return H.Word;return H.Other}}var W=class i{constructor(e,t,r,n,s,o){this.config=e,this.doc=t,this.selection=r,this.values=n,this.status=e.statusTemplate.slice(),this.computeSlot=s,o&&(o._state=this);for(let a=0;a<this.config.dynamicSlots.length;a++)Gr(this,a<<1);this.computeSlot=null}field(e,t=!0){let r=this.config.address[e.id];if(r==null){if(t)throw new RangeError("Field is not present in this state");return}return Gr(this,r),Bs(this,r)}update(...e){return nd(this,e,!0)}applyTransaction(e){let t=this.config,{base:r,compartments:n}=t;for(let a of e.effects)a.is(Bt.reconfigure)?(t&&(n=new Map,t.compartments.forEach((l,c)=>n.set(c,l)),t=null),n.set(a.value.compartment,a.value.extension)):a.is(D.reconfigure)?(t=null,r=a.value):a.is(D.appendConfig)&&(t=null,r=nr(r).concat(a.value));let s;t?s=e.startState.values.slice():(t=$s.resolve(r,n,this),s=new i(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(l,c)=>c.reconfigure(l,this),null).values);let o=e.startState.facet(Cl)?e.newSelection:e.newSelection.asSingle();new i(t,e.newDoc,o,s,(a,l)=>l.update(a,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:T.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,r=e(t.ranges[0]),n=this.changes(r.changes),s=[r.range],o=nr(r.effects);for(let a=1;a<t.ranges.length;a++){let l=e(t.ranges[a]),c=this.changes(l.changes),h=c.map(n);for(let f=0;f<a;f++)s[f]=s[f].map(h);let u=n.mapDesc(c,!0);s.push(l.range.map(u)),n=n.compose(h),o=D.mapEffects(o,h).concat(D.mapEffects(nr(l.effects),u))}return{changes:n,selection:T.create(s,t.mainIndex),effects:o}}changes(e=[]){return e instanceof Me?e:Me.of(e,this.doc.length,this.facet(i.lineSeparator))}toText(e){return j.of(e.split(this.facet(i.lineSeparator)||Sl))}sliceDoc(e=0,t=this.doc.length){return this.doc.sliceString(e,t,this.lineBreak)}facet(e){let t=this.config.address[e.id];return t==null?e.default:(Gr(this,t),Bs(this,t))}toJSON(e){let t={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let r in e){let n=e[r];n instanceof re&&this.config.address[n.id]!=null&&(t[r]=n.spec.toJSON(this.field(e[r]),this))}return t}static fromJSON(e,t={},r){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let n=[];if(r){for(let s in r)if(Object.prototype.hasOwnProperty.call(e,s)){let o=r[s],a=e[s];n.push(o.init(l=>o.spec.fromJSON(a,l)))}}return i.create({doc:e.doc,selection:T.fromJSON(e.selection),extensions:t.extensions?n.concat([t.extensions]):n})}static create(e={}){let t=$s.resolve(e.extensions||[],new Map),r=e.doc instanceof j?e.doc:j.of((e.doc||"").split(t.staticFacet(i.lineSeparator)||Sl)),n=e.selection?e.selection instanceof T?e.selection:T.single(e.selection.anchor,e.selection.head):T.single(0);return Yf(n,r.length),t.staticFacet(Cl)||(n=n.asSingle()),new i(t,r,n,t.dynamicSlots.map(()=>null),(s,o)=>o.create(s),null)}get tabSize(){return this.facet(i.tabSize)}get lineBreak(){return this.facet(i.lineSeparator)||`
`}get readOnly(){return this.facet(id)}phrase(e,...t){for(let r of this.facet(i.phrases))if(Object.prototype.hasOwnProperty.call(r,e)){e=r[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,(r,n)=>{if(n=="$")return"$";let s=+(n||1);return!s||s>t.length?r:t[s-1]})),e}languageDataAt(e,t,r=-1){let n=[];for(let s of this.facet(Zf))for(let o of s(this,t,r))Object.prototype.hasOwnProperty.call(o,e)&&n.push(o[e]);return n}charCategorizer(e){return nb(this.languageDataAt("wordChars",e).join(""))}wordAt(e){let{text:t,from:r,length:n}=this.doc.lineAt(e),s=this.charCategorizer(e),o=e-r,a=e-r;for(;o>0;){let l=pe(t,o,!1);if(s(t.slice(l,o))!=H.Word)break;o=l}for(;a<n;){let l=pe(t,a);if(s(t.slice(a,l))!=H.Word)break;a=l}return o==a?null:T.range(o+r,a+r)}};W.allowMultipleSelections=Cl;W.tabSize=A.define({combine:i=>i.length?i[0]:4});W.lineSeparator=Jf;W.readOnly=id;W.phrases=A.define({compare(i,e){let t=Object.keys(i),r=Object.keys(e);return t.length==r.length&&t.every(n=>i[n]==e[n])}});W.languageData=Zf;W.changeFilter=Kf;W.transactionFilter=ed;W.transactionExtender=td;Bt.reconfigure=D.define();function Ce(i,e,t={}){let r={};for(let n of i)for(let s of Object.keys(n)){let o=n[s],a=r[s];if(a===void 0)r[s]=o;else if(!(a===o||o===void 0))if(Object.hasOwnProperty.call(t,s))r[s]=t[s](a,o);else throw new Error("Config merge conflict for field "+s)}for(let n in e)r[n]===void 0&&(r[n]=e[n]);return r}var ft=class{eq(e){return this==e}range(e,t=e){return Zr.create(e,t,this)}};ft.prototype.startSide=ft.prototype.endSide=0;ft.prototype.point=!1;ft.prototype.mapMode=ye.TrackDel;var Zr=class i{constructor(e,t,r){this.from=e,this.to=t,this.value=r}static create(e,t,r){return new i(e,t,r)}};function Ml(i,e){return i.from-e.from||i.value.startSide-e.value.startSide}var _l=class i{constructor(e,t,r,n){this.from=e,this.to=t,this.value=r,this.maxPoint=n}get length(){return this.to[this.to.length-1]}findIndex(e,t,r,n=0){let s=r?this.to:this.from;for(let o=n,a=s.length;;){if(o==a)return o;let l=o+a>>1,c=s[l]-e||(r?this.value[l].endSide:this.value[l].startSide)-t;if(l==o)return c>=0?o:a;c>=0?a=l:o=l+1}}between(e,t,r,n){for(let s=this.findIndex(t,-1e9,!0),o=this.findIndex(r,1e9,!1,s);s<o;s++)if(n(this.from[s]+e,this.to[s]+e,this.value[s])===!1)return!1}map(e,t){let r=[],n=[],s=[],o=-1,a=-1;for(let l=0;l<this.value.length;l++){let c=this.value[l],h=this.from[l]+e,u=this.to[l]+e,f,d;if(h==u){let m=t.mapPos(h,c.startSide,c.mapMode);if(m==null||(f=d=m,c.startSide!=c.endSide&&(d=t.mapPos(h,c.endSide),d<f)))continue}else if(f=t.mapPos(h,c.startSide),d=t.mapPos(u,c.endSide),f>d||f==d&&c.startSide>0&&c.endSide<=0)continue;(d-f||c.endSide-c.startSide)<0||(o<0&&(o=f),c.point&&(a=Math.max(a,d-f)),r.push(c),n.push(f-o),s.push(d-o))}return{mapped:r.length?new i(n,s,r,a):null,pos:o}}},z=class i{constructor(e,t,r,n){this.chunkPos=e,this.chunk=t,this.nextLayer=r,this.maxPoint=n}static create(e,t,r,n){return new i(e,t,r,n)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let t of this.chunk)e+=t.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:t=[],sort:r=!1,filterFrom:n=0,filterTo:s=this.length}=e,o=e.filter;if(t.length==0&&!o)return this;if(r&&(t=t.slice().sort(Ml)),this.isEmpty)return t.length?i.of(t):this;let a=new Xs(this,null,-1).goto(0),l=0,c=[],h=new dt;for(;a.value||l<t.length;)if(l<t.length&&(a.from-t[l].from||a.startSide-t[l].value.startSide)>=0){let u=t[l++];h.addInner(u.from,u.to,u.value)||c.push(u)}else a.rangeIndex==1&&a.chunkIndex<this.chunk.length&&(l==t.length||this.chunkEnd(a.chunkIndex)<t[l].from)&&(!o||n>this.chunkEnd(a.chunkIndex)||s<this.chunkPos[a.chunkIndex])&&h.addChunk(this.chunkPos[a.chunkIndex],this.chunk[a.chunkIndex])?a.nextChunk():((!o||n>a.to||s<a.from||o(a.from,a.to,a.value))&&(h.addInner(a.from,a.to,a.value)||c.push(Zr.create(a.from,a.to,a.value))),a.next());return h.finishInner(this.nextLayer.isEmpty&&!c.length?i.empty:this.nextLayer.update({add:c,filter:o,filterFrom:n,filterTo:s}))}map(e){if(e.empty||this.isEmpty)return this;let t=[],r=[],n=-1;for(let o=0;o<this.chunk.length;o++){let a=this.chunkPos[o],l=this.chunk[o],c=e.touchesRange(a,a+l.length);if(c===!1)n=Math.max(n,l.maxPoint),t.push(l),r.push(e.mapPos(a));else if(c===!0){let{mapped:h,pos:u}=l.map(a,e);h&&(n=Math.max(n,h.maxPoint),t.push(h),r.push(u))}}let s=this.nextLayer.map(e);return t.length==0?s:new i(r,t,s||i.empty,n)}between(e,t,r){if(!this.isEmpty){for(let n=0;n<this.chunk.length;n++){let s=this.chunkPos[n],o=this.chunk[n];if(t>=s&&e<=s+o.length&&o.between(s,e-s,t-s,r)===!1)return}this.nextLayer.between(e,t,r)}}iter(e=0){return Jr.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return Jr.from(e).goto(t)}static compare(e,t,r,n,s=-1){let o=e.filter(u=>u.maxPoint>0||!u.isEmpty&&u.maxPoint>=s),a=t.filter(u=>u.maxPoint>0||!u.isEmpty&&u.maxPoint>=s),l=If(o,a,r),c=new ki(o,l,s),h=new ki(a,l,s);r.iterGaps((u,f,d)=>Wf(c,u,h,f,d,n)),r.empty&&r.length==0&&Wf(c,0,h,0,0,n)}static eq(e,t,r=0,n){n==null&&(n=999999999);let s=e.filter(h=>!h.isEmpty&&t.indexOf(h)<0),o=t.filter(h=>!h.isEmpty&&e.indexOf(h)<0);if(s.length!=o.length)return!1;if(!s.length)return!0;let a=If(s,o),l=new ki(s,a,0).goto(r),c=new ki(o,a,0).goto(r);for(;;){if(l.to!=c.to||!Dl(l.active,c.active)||l.point&&(!c.point||!l.point.eq(c.point)))return!1;if(l.to>n)return!0;l.next(),c.next()}}static spans(e,t,r,n,s=-1){let o=new ki(e,null,s).goto(t),a=t,l=o.openStart;for(;;){let c=Math.min(o.to,r);if(o.point){let h=o.activeForPoint(o.to),u=o.pointFrom<t?h.length+1:o.point.startSide<0?h.length:Math.min(h.length,l);n.point(a,c,o.point,h,u,o.pointRank),l=Math.min(o.openEnd(c),h.length)}else c>a&&(n.span(a,c,o.active,l),l=o.openEnd(c));if(o.to>r)return l+(o.point&&o.to>r?1:0);a=o.to,o.next()}}static of(e,t=!1){let r=new dt;for(let n of e instanceof Zr?[e]:t?sb(e):e)r.add(n.from,n.to,n.value);return r.finish()}static join(e){if(!e.length)return i.empty;let t=e[e.length-1];for(let r=e.length-2;r>=0;r--)for(let n=e[r];n!=i.empty;n=n.nextLayer)t=new i(n.chunkPos,n.chunk,t,Math.max(n.maxPoint,t.maxPoint));return t}};z.empty=new z([],[],null,-1);function sb(i){if(i.length>1)for(let e=i[0],t=1;t<i.length;t++){let r=i[t];if(Ml(e,r)>0)return i.slice().sort(Ml);e=r}return i}z.empty.nextLayer=z.empty;var dt=class i{finishChunk(e){this.chunks.push(new _l(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(e,t,r){this.addInner(e,t,r)||(this.nextLayer||(this.nextLayer=new i)).add(e,t,r)}addInner(e,t,r){let n=e-this.lastTo||r.startSide-this.last.endSide;if(n<=0&&(e-this.lastFrom||r.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return n<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(t-this.chunkStart),this.last=r,this.lastFrom=e,this.lastTo=t,this.value.push(r),r.point&&(this.maxPoint=Math.max(this.maxPoint,t-e)),!0)}addChunk(e,t){if((e-this.lastTo||t.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,t.maxPoint),this.chunks.push(t),this.chunkPos.push(e);let r=t.value.length-1;return this.last=t.value[r],this.lastFrom=t.from[r]+e,this.lastTo=t.to[r]+e,!0}finish(){return this.finishInner(z.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let t=z.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}};function If(i,e,t){let r=new Map;for(let s of i)for(let o=0;o<s.chunk.length;o++)s.chunk[o].maxPoint<=0&&r.set(s.chunk[o],s.chunkPos[o]);let n=new Set;for(let s of e)for(let o=0;o<s.chunk.length;o++){let a=r.get(s.chunk[o]);a!=null&&(t?t.mapPos(a):a)==s.chunkPos[o]&&!t?.touchesRange(a,a+s.chunk[o].length)&&n.add(s.chunk[o])}return n}var Xs=class{constructor(e,t,r,n=0){this.layer=e,this.skip=t,this.minPoint=r,this.rank=n}get startSide(){return this.value?this.value.startSide:0}get endSide(){return this.value?this.value.endSide:0}goto(e,t=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(e,t,!1),this}gotoInner(e,t,r){for(;this.chunkIndex<this.layer.chunk.length;){let n=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(n)||this.layer.chunkEnd(this.chunkIndex)<e||n.maxPoint<this.minPoint))break;this.chunkIndex++,r=!1}if(this.chunkIndex<this.layer.chunk.length){let n=this.layer.chunk[this.chunkIndex].findIndex(e-this.layer.chunkPos[this.chunkIndex],t,!0);(!r||this.rangeIndex<n)&&this.setRangeIndex(n)}this.next()}forward(e,t){(this.to-e||this.endSide-t)<0&&this.gotoInner(e,t,!0)}next(){for(;;)if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}else{let e=this.layer.chunkPos[this.chunkIndex],t=this.layer.chunk[this.chunkIndex],r=e+t.from[this.rangeIndex];if(this.from=r,this.to=e+t.to[this.rangeIndex],this.value=t.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex<this.layer.chunk.length&&this.skip.has(this.layer.chunk[this.chunkIndex]);)this.chunkIndex++;this.rangeIndex=0}else this.rangeIndex=e}nextChunk(){this.chunkIndex++,this.rangeIndex=0,this.next()}compare(e){return this.from-e.from||this.startSide-e.startSide||this.rank-e.rank||this.to-e.to||this.endSide-e.endSide}},Jr=class i{constructor(e){this.heap=e}static from(e,t=null,r=-1){let n=[];for(let s=0;s<e.length;s++)for(let o=e[s];!o.isEmpty;o=o.nextLayer)o.maxPoint>=r&&n.push(new Xs(o,t,r,s));return n.length==1?n[0]:new i(n)}get startSide(){return this.value?this.value.startSide:0}goto(e,t=-1e9){for(let r of this.heap)r.goto(e,t);for(let r=this.heap.length>>1;r>=0;r--)vl(this.heap,r);return this.next(),this}forward(e,t){for(let r of this.heap)r.forward(e,t);for(let r=this.heap.length>>1;r>=0;r--)vl(this.heap,r);(this.to-e||this.value.endSide-t)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),vl(this.heap,0)}}};function vl(i,e){for(let t=i[e];;){let r=(e<<1)+1;if(r>=i.length)break;let n=i[r];if(r+1<i.length&&n.compare(i[r+1])>=0&&(n=i[r+1],r++),t.compare(n)<0)break;i[r]=t,i[e]=n,e=r}}var ki=class{constructor(e,t,r){this.minPoint=r,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=Jr.from(e,t,r)}goto(e,t=-1e9){return this.cursor.goto(e,t),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=t,this.openStart=-1,this.next(),this}forward(e,t){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-t)<0;)this.removeActive(this.minActive);this.cursor.forward(e,t)}removeActive(e){Ms(this.active,e),Ms(this.activeTo,e),Ms(this.activeRank,e),this.minActive=zf(this.active,this.activeTo)}addActive(e){let t=0,{value:r,to:n,rank:s}=this.cursor;for(;t<this.activeRank.length&&(s-this.activeRank[t]||n-this.activeTo[t])>0;)t++;_s(this.active,t,r),_s(this.activeTo,t,n),_s(this.activeRank,t,s),e&&_s(e,t,this.cursor.from),this.minActive=zf(this.active,this.activeTo)}next(){let e=this.to,t=this.point;this.point=null;let r=this.openStart<0?[]:null;for(;;){let n=this.minActive;if(n>-1&&(this.activeTo[n]-this.cursor.from||this.active[n].endSide-this.cursor.startSide)<0){if(this.activeTo[n]>e){this.to=this.activeTo[n],this.endSide=this.active[n].endSide;break}this.removeActive(n),r&&Ms(r,n)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let s=this.cursor.value;if(!s.point)this.addActive(r),this.cursor.next();else if(t&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)this.cursor.next();else{this.point=s,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=s.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}}else{this.to=this.endSide=1e9;break}}if(r){this.openStart=0;for(let n=r.length-1;n>=0&&r[n]<e;n--)this.openStart++}}activeForPoint(e){if(!this.active.length)return this.active;let t=[];for(let r=this.active.length-1;r>=0&&!(this.activeRank[r]<this.pointRank);r--)(this.activeTo[r]>e||this.activeTo[r]==e&&this.active[r].endSide>=this.point.endSide)&&t.push(this.active[r]);return t.reverse()}openEnd(e){let t=0;for(let r=this.activeTo.length-1;r>=0&&this.activeTo[r]>e;r--)t++;return t}};function Wf(i,e,t,r,n,s){i.goto(e),t.goto(r);let o=r+n,a=r,l=r-e;for(;;){let c=i.to+l-t.to||i.endSide-t.endSide,h=c<0?i.to+l:t.to,u=Math.min(h,o);if(i.point||t.point?i.point&&t.point&&(i.point==t.point||i.point.eq(t.point))&&Dl(i.activeForPoint(i.to),t.activeForPoint(t.to))||s.comparePoint(a,u,i.point,t.point):u>a&&!Dl(i.active,t.active)&&s.compareRange(a,u,i.active,t.active),h>o)break;a=h,c<=0&&i.next(),c>=0&&t.next()}}function Dl(i,e){if(i.length!=e.length)return!1;for(let t=0;t<i.length;t++)if(i[t]!=e[t]&&!i[t].eq(e[t]))return!1;return!0}function Ms(i,e){for(let t=e,r=i.length-1;t<r;t++)i[t]=i[t+1];i.pop()}function _s(i,e,t){for(let r=i.length-1;r>=e;r--)i[r+1]=i[r];i[e]=t}function zf(i,e){let t=-1,r=1e9;for(let n=0;n<e.length;n++)(e[n]-r||i[n].endSide-i[t].endSide)<0&&(t=n,r=e[n]);return t}function Xt(i,e,t=i.length){let r=0;for(let n=0;n<t;)i.charCodeAt(n)==9?(r+=e-r%e,n++):(r++,n=pe(i,n));return r}function Ns(i,e,t,r){for(let n=0,s=0;;){if(s>=e)return n;if(n==i.length)break;s+=i.charCodeAt(n)==9?t-s%t:1,n=pe(i,n)}return r===!0?-1:i.length}var Vl="\u037C",sd=typeof Symbol>"u"?"__"+Vl:Symbol.for(Vl),$l=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),od=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{},rt=class{constructor(e,t){this.rules=[];let{finish:r}=t||{};function n(o){return/^@/.test(o)?[o]:o.split(/,\s*/)}function s(o,a,l,c){let h=[],u=/^@(\w+)\b/.exec(o[0]),f=u&&u[1]=="keyframes";if(u&&a==null)return l.push(o[0]+";");for(let d in a){let m=a[d];if(/&/.test(d))s(d.split(/,\s*/).map(p=>o.map(g=>p.replace(/&/,g))).reduce((p,g)=>p.concat(g)),m,l);else if(m&&typeof m=="object"){if(!u)throw new RangeError("The value of a property ("+d+") should be a primitive value.");s(n(d),m,h,f)}else m!=null&&h.push(d.replace(/_.*/,"").replace(/[A-Z]/g,p=>"-"+p.toLowerCase())+": "+m+";")}(h.length||f)&&l.push((r&&!u&&!c?o.map(r):o).join(", ")+" {"+h.join(" ")+"}")}for(let o in e)s(n(o),e[o],this.rules)}getRules(){return this.rules.join(`
`)}static newName(){let e=od[sd]||1;return od[sd]=e+1,Vl+e.toString(36)}static mount(e,t,r){let n=e[$l],s=r&&r.nonce;n?s&&n.setNonce(s):n=new Bl(e,s),n.mount(Array.isArray(t)?t:[t],e)}},ad=new Map,Bl=class{constructor(e,t){let r=e.ownerDocument||e,n=r.defaultView;if(!e.head&&e.adoptedStyleSheets&&n.CSSStyleSheet){let s=ad.get(r);if(s)return e[$l]=s;this.sheet=new n.CSSStyleSheet,ad.set(r,this)}else this.styleTag=r.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);this.modules=[],e[$l]=this}mount(e,t){let r=this.sheet,n=0,s=0;for(let o=0;o<e.length;o++){let a=e[o],l=this.modules.indexOf(a);if(l<s&&l>-1&&(this.modules.splice(l,1),s--,l=-1),l==-1){if(this.modules.splice(s++,0,a),r)for(let c=0;c<a.rules.length;c++)r.insertRule(a.rules[c],n++)}else{for(;s<l;)n+=this.modules[s++].rules.length;n+=a.rules.length,s++}}if(r)t.adoptedStyleSheets.indexOf(this.sheet)<0&&(t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets]);else{let o="";for(let l=0;l<this.modules.length;l++)o+=this.modules[l].getRules()+`
`;this.styleTag.textContent=o;let a=t.head||t;this.styleTag.parentNode!=a&&a.insertBefore(this.styleTag,a.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}};var Nt={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:"'"},or={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},ob=typeof navigator<"u"&&/Mac/.test(navigator.platform),ab=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(me=0;me<10;me++)Nt[48+me]=Nt[96+me]=String(me);var me;for(me=1;me<=24;me++)Nt[me+111]="F"+me;var me;for(me=65;me<=90;me++)Nt[me]=String.fromCharCode(me+32),or[me]=String.fromCharCode(me);var me;for(js in Nt)or.hasOwnProperty(js)||(or[js]=Nt[js]);var js;function ld(i){var e=ob&&i.metaKey&&i.shiftKey&&!i.ctrlKey&&!i.altKey||ab&&i.shiftKey&&i.key&&i.key.length==1||i.key=="Unidentified",t=!e&&i.key||(i.shiftKey?or:Nt)[i.keyCode]||i.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}function pn(i){let e;return i.nodeType==11?e=i.getSelection?i:i.ownerDocument:e=i,e.getSelection()}function Fl(i,e){return e?i==e||i.contains(e.nodeType!=1?e.parentNode:e):!1}function lb(i){let e=i.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function Js(i,e){if(!e.anchorNode)return!1;try{return Fl(i,e.anchorNode)}catch{return!1}}function mn(i){return i.nodeType==3?Ri(i,0,i.nodeValue.length).getClientRects():i.nodeType==1?i.getClientRects():[]}function an(i,e,t,r){return t?cd(i,e,t,r,-1)||cd(i,e,t,r,1):!1}function Ei(i){for(var e=0;;e++)if(i=i.previousSibling,!i)return e}function no(i){return i.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(i.nodeName)}function cd(i,e,t,r,n){for(;;){if(i==t&&e==r)return!0;if(e==(n<0?0:jt(i))){if(i.nodeName=="DIV")return!1;let s=i.parentNode;if(!s||s.nodeType!=1)return!1;e=Ei(i)+(n<0?0:1),i=s}else if(i.nodeType==1){if(i=i.childNodes[e+(n<0?-1:0)],i.nodeType==1&&i.contentEditable=="false")return!1;e=n<0?jt(i):0}else return!1}}function jt(i){return i.nodeType==3?i.nodeValue.length:i.childNodes.length}function qc(i,e){let t=e?i.left:i.right;return{left:t,right:t,top:i.top,bottom:i.bottom}}function cb(i){let e=i.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:i.innerWidth,top:0,bottom:i.innerHeight}}function Gd(i,e){let t=e.width/i.offsetWidth,r=e.height/i.offsetHeight;return(t>.995&&t<1.005||!isFinite(t)||Math.abs(e.width-i.offsetWidth)<1)&&(t=1),(r>.995&&r<1.005||!isFinite(r)||Math.abs(e.height-i.offsetHeight)<1)&&(r=1),{scaleX:t,scaleY:r}}function hb(i,e,t,r,n,s,o,a){let l=i.ownerDocument,c=l.defaultView||window;for(let h=i,u=!1;h&&!u;)if(h.nodeType==1){let f,d=h==l.body,m=1,p=1;if(d)f=cb(c);else{if(/^(fixed|sticky)$/.test(getComputedStyle(h).position)&&(u=!0),h.scrollHeight<=h.clientHeight&&h.scrollWidth<=h.clientWidth){h=h.assignedSlot||h.parentNode;continue}let y=h.getBoundingClientRect();({scaleX:m,scaleY:p}=Gd(h,y)),f={left:y.left,right:y.left+h.clientWidth*m,top:y.top,bottom:y.top+h.clientHeight*p}}let g=0,O=0;if(n=="nearest")e.top<f.top?(O=-(f.top-e.top+o),t>0&&e.bottom>f.bottom+O&&(O=e.bottom-f.bottom+O+o)):e.bottom>f.bottom&&(O=e.bottom-f.bottom+o,t<0&&e.top-O<f.top&&(O=-(f.top+O-e.top+o)));else{let y=e.bottom-e.top,x=f.bottom-f.top;O=(n=="center"&&y<=x?e.top+y/2-x/2:n=="start"||n=="center"&&t<0?e.top-o:e.bottom-x+o)-f.top}if(r=="nearest"?e.left<f.left?(g=-(f.left-e.left+s),t>0&&e.right>f.right+g&&(g=e.right-f.right+g+s)):e.right>f.right&&(g=e.right-f.right+s,t<0&&e.left<f.left+g&&(g=-(f.left+g-e.left+s))):g=(r=="center"?e.left+(e.right-e.left)/2-(f.right-f.left)/2:r=="start"==a?e.left-s:e.right-(f.right-f.left)+s)-f.left,g||O)if(d)c.scrollBy(g,O);else{let y=0,x=0;if(O){let v=h.scrollTop;h.scrollTop+=O/p,x=(h.scrollTop-v)*p}if(g){let v=h.scrollLeft;h.scrollLeft+=g/m,y=(h.scrollLeft-v)*m}e={left:e.left-y,top:e.top-x,right:e.right-y,bottom:e.bottom-x},y&&Math.abs(y-g)<1&&(r="nearest"),x&&Math.abs(x-O)<1&&(n="nearest")}if(d)break;h=h.assignedSlot||h.parentNode}else if(h.nodeType==11)h=h.host;else break}function ub(i){let e=i.ownerDocument;for(let t=i.parentNode;t&&t!=e.body;)if(t.nodeType==1){if(t.scrollHeight>t.clientHeight||t.scrollWidth>t.clientWidth)return t;t=t.assignedSlot||t.parentNode}else if(t.nodeType==11)t=t.host;else break;return null}var Hl=class{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:t,focusNode:r}=e;this.set(t,Math.min(e.anchorOffset,t?jt(t):0),r,Math.min(e.focusOffset,r?jt(r):0))}set(e,t,r,n){this.anchorNode=e,this.anchorOffset=t,this.focusNode=r,this.focusOffset=n}},ar=null;function Yd(i){if(i.setActive)return i.setActive();if(ar)return i.focus(ar);let e=[];for(let t=i;t&&(e.push(t,t.scrollTop,t.scrollLeft),t!=t.ownerDocument);t=t.parentNode);if(i.focus(ar==null?{get preventScroll(){return ar={preventScroll:!0},!0}}:void 0),!ar){ar=!1;for(let t=0;t<e.length;){let r=e[t++],n=e[t++],s=e[t++];r.scrollTop!=n&&(r.scrollTop=n),r.scrollLeft!=s&&(r.scrollLeft=s)}}}var hd;function Ri(i,e,t=e){let r=hd||(hd=document.createRange());return r.setEnd(i,t),r.setStart(i,e),r}function ur(i,e,t,r){let n={key:e,code:e,keyCode:t,which:t,cancelable:!0};r&&({altKey:n.altKey,ctrlKey:n.ctrlKey,shiftKey:n.shiftKey,metaKey:n.metaKey}=r);let s=new KeyboardEvent("keydown",n);s.synthetic=!0,i.dispatchEvent(s);let o=new KeyboardEvent("keyup",n);return o.synthetic=!0,i.dispatchEvent(o),s.defaultPrevented||o.defaultPrevented}function fb(i){for(;i;){if(i&&(i.nodeType==9||i.nodeType==11&&i.host))return i;i=i.assignedSlot||i.parentNode}return null}function Zd(i){for(;i.attributes.length;)i.removeAttributeNode(i.attributes[0])}function db(i,e){let t=e.focusNode,r=e.focusOffset;if(!t||e.anchorNode!=t||e.anchorOffset!=r)return!1;for(r=Math.min(r,jt(t));;)if(r){if(t.nodeType!=1)return!1;let n=t.childNodes[r-1];n.contentEditable=="false"?r--:(t=n,r=jt(t))}else{if(t==i)return!0;r=Ei(t),t=t.parentNode}}function Jd(i){return i.scrollTop>Math.max(1,i.scrollHeight-i.clientHeight-4)}function Kd(i,e){for(let t=i,r=e;;){if(t.nodeType==3&&r>0)return{node:t,offset:r};if(t.nodeType==1&&r>0){if(t.contentEditable=="false")return null;t=t.childNodes[r-1],r=jt(t)}else if(t.parentNode&&!no(t))r=Ei(t),t=t.parentNode;else return null}}function ep(i,e){for(let t=i,r=e;;){if(t.nodeType==3&&r<t.nodeValue.length)return{node:t,offset:r};if(t.nodeType==1&&r<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[r],r=0}else if(t.parentNode&&!no(t))r=Ei(t)+1,t=t.parentNode;else return null}}var De=class i{constructor(e,t,r=!0){this.node=e,this.offset=t,this.precise=r}static before(e,t){return new i(e.parentNode,Ei(e),t)}static after(e,t){return new i(e.parentNode,Ei(e)+1,t)}},Vc=[],ee=class i{constructor(){this.parent=null,this.dom=null,this.flags=2}get overrideDOMText(){return null}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e){let t=this.posAtStart;for(let r of this.children){if(r==e)return t;t+=r.length+r.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}sync(e,t){if(this.flags&2){let r=this.dom,n=null,s;for(let o of this.children){if(o.flags&7){if(!o.dom&&(s=n?n.nextSibling:r.firstChild)){let a=i.get(s);(!a||!a.parent&&a.canReuseDOM(o))&&o.reuseDOM(s)}o.sync(e,t),o.flags&=-8}if(s=n?n.nextSibling:r.firstChild,t&&!t.written&&t.node==r&&s!=o.dom&&(t.written=!0),o.dom.parentNode==r)for(;s&&s!=o.dom;)s=ud(s);else r.insertBefore(o.dom,s);n=o.dom}for(s=n?n.nextSibling:r.firstChild,s&&t&&t.node==r&&(t.written=!0);s;)s=ud(s)}else if(this.flags&1)for(let r of this.children)r.flags&7&&(r.sync(e,t),r.flags&=-8)}reuseDOM(e){}localPosFromDOM(e,t){let r;if(e==this.dom)r=this.dom.childNodes[t];else{let n=jt(e)==0?0:t==0?-1:1;for(;;){let s=e.parentNode;if(s==this.dom)break;n==0&&s.firstChild!=s.lastChild&&(e==s.firstChild?n=-1:n=1),e=s}n<0?r=e:r=e.nextSibling}if(r==this.dom.firstChild)return 0;for(;r&&!i.get(r);)r=r.nextSibling;if(!r)return this.length;for(let n=0,s=0;;n++){let o=this.children[n];if(o.dom==r)return s;s+=o.length+o.breakAfter}}domBoundsAround(e,t,r=0){let n=-1,s=-1,o=-1,a=-1;for(let l=0,c=r,h=r;l<this.children.length;l++){let u=this.children[l],f=c+u.length;if(c<e&&f>t)return u.domBoundsAround(e,t,c);if(f>=e&&n==-1&&(n=l,s=c),c>t&&u.dom.parentNode==this.dom){o=l,a=h;break}h=f,c=f+u.breakAfter}return{from:s,to:a<0?r+this.length:a,startDOM:(n?this.children[n-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:o<this.children.length&&o>=0?this.children[o].dom:null}}markDirty(e=!1){this.flags|=2,this.markParentsDirty(e)}markParentsDirty(e){for(let t=this.parent;t;t=t.parent){if(e&&(t.flags|=2),t.flags&1)return;t.flags|=1,e=!1}}setParent(e){this.parent!=e&&(this.parent=e,this.flags&7&&this.markParentsDirty(!0))}setDOM(e){this.dom!=e&&(this.dom&&(this.dom.cmView=null),this.dom=e,e.cmView=this)}get rootView(){for(let e=this;;){let t=e.parent;if(!t)return e;e=t}}replaceChildren(e,t,r=Vc){this.markDirty();for(let n=e;n<t;n++){let s=this.children[n];s.parent==this&&r.indexOf(s)<0&&s.destroy()}this.children.splice(e,t-e,...r);for(let n=0;n<r.length;n++)r[n].setParent(this)}ignoreMutation(e){return!1}ignoreEvent(e){return!1}childCursor(e=this.length){return new so(this.children,e,this.children.length)}childPos(e,t=1){return this.childCursor().findPos(e,t)}toString(){let e=this.constructor.name.replace("View","");return e+(this.children.length?"("+this.children.join()+")":this.length?"["+(e=="Text"?this.text:this.length)+"]":"")+(this.breakAfter?"#":"")}static get(e){return e.cmView}get isEditable(){return!0}get isWidget(){return!1}get isHidden(){return!1}merge(e,t,r,n,s,o){return!1}become(e){return!1}canReuseDOM(e){return e.constructor==this.constructor&&!((this.flags|e.flags)&8)}getSide(){return 0}destroy(){for(let e of this.children)e.parent==this&&e.destroy();this.parent=null}};ee.prototype.breakAfter=0;function ud(i){let e=i.nextSibling;return i.parentNode.removeChild(i),e}var so=class{constructor(e,t,r){this.children=e,this.pos=t,this.i=r,this.off=0}findPos(e,t=1){for(;;){if(e>this.pos||e==this.pos&&(t>0||this.i==0||this.children[this.i-1].breakAfter))return this.off=e-this.pos,this;let r=this.children[--this.i];this.pos-=r.length+r.breakAfter}}};function tp(i,e,t,r,n,s,o,a,l){let{children:c}=i,h=c.length?c[e]:null,u=s.length?s[s.length-1]:null,f=u?u.breakAfter:o;if(!(e==r&&h&&!o&&!f&&s.length<2&&h.merge(t,n,s.length?u:null,t==0,a,l))){if(r<c.length){let d=c[r];d&&(n<d.length||d.breakAfter&&u?.breakAfter)?(e==r&&(d=d.split(n),n=0),!f&&u&&d.merge(0,n,u,!0,0,l)?s[s.length-1]=d:((n||d.children.length&&!d.children[0].length)&&d.merge(0,n,null,!1,0,l),s.push(d))):d?.breakAfter&&(u?u.breakAfter=1:o=1),r++}for(h&&(h.breakAfter=o,t>0&&(!o&&s.length&&h.merge(t,h.length,s[0],!1,a,0)?h.breakAfter=s.shift().breakAfter:(t<h.length||h.children.length&&h.children[h.children.length-1].length==0)&&h.merge(t,h.length,null,!1,a,0),e++));e<r&&s.length;)if(c[r-1].become(s[s.length-1]))r--,s.pop(),l=s.length?0:a;else if(c[e].become(s[0]))e++,s.shift(),a=s.length?0:l;else break;!s.length&&e&&r<c.length&&!c[e-1].breakAfter&&c[r].merge(0,0,c[e-1],!1,a,l)&&e--,(e<r||s.length)&&i.replaceChildren(e,r,s)}}function ip(i,e,t,r,n,s){let o=i.childCursor(),{i:a,off:l}=o.findPos(t,1),{i:c,off:h}=o.findPos(e,-1),u=e-t;for(let f of r)u+=f.length;i.length+=u,tp(i,c,h,a,l,r,0,n,s)}var Xe=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},Gl=typeof document<"u"?document:{documentElement:{style:{}}},Yl=/Edge\/(\d+)/.exec(Xe.userAgent),rp=/MSIE \d/.test(Xe.userAgent),Zl=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Xe.userAgent),wo=!!(rp||Zl||Yl),fd=!wo&&/gecko\/(\d+)/i.test(Xe.userAgent),Xl=!wo&&/Chrome\/(\d+)/.exec(Xe.userAgent),dd="webkitFontSmoothing"in Gl.documentElement.style,np=!wo&&/Apple Computer/.test(Xe.vendor),pd=np&&(/Mobile\/\w+/.test(Xe.userAgent)||Xe.maxTouchPoints>2),Q={mac:pd||/Mac/.test(Xe.platform),windows:/Win/.test(Xe.platform),linux:/Linux|X11/.test(Xe.platform),ie:wo,ie_version:rp?Gl.documentMode||6:Zl?+Zl[1]:Yl?+Yl[1]:0,gecko:fd,gecko_version:fd?+(/Firefox\/(\d+)/.exec(Xe.userAgent)||[0,0])[1]:0,chrome:!!Xl,chrome_version:Xl?+Xl[1]:0,ios:pd,android:/Android\b/.test(Xe.userAgent),webkit:dd,safari:np,webkit_version:dd?+(/\bAppleWebKit\/(\d+)/.exec(Xe.userAgent)||[0,0])[1]:0,tabSize:Gl.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"},pb=256,Tt=class i extends ee{constructor(e){super(),this.text=e}get length(){return this.text.length}createDOM(e){this.setDOM(e||document.createTextNode(this.text))}sync(e,t){this.dom||this.createDOM(),this.dom.nodeValue!=this.text&&(t&&t.node==this.dom&&(t.written=!0),this.dom.nodeValue=this.text)}reuseDOM(e){e.nodeType==3&&this.createDOM(e)}merge(e,t,r){return this.flags&8||r&&(!(r instanceof i)||this.length-(t-e)+r.length>pb||r.flags&8)?!1:(this.text=this.text.slice(0,e)+(r?r.text:"")+this.text.slice(t),this.markDirty(),!0)}split(e){let t=new i(this.text.slice(e));return this.text=this.text.slice(0,e),this.markDirty(),t.flags|=this.flags&8,t}localPosFromDOM(e,t){return e==this.dom?t:t?this.text.length:0}domAtPos(e){return new De(this.dom,e)}domBoundsAround(e,t,r){return{from:r,to:r+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}coordsAt(e,t){return mb(this.dom,e,t)}},ti=class i extends ee{constructor(e,t=[],r=0){super(),this.mark=e,this.children=t,this.length=r;for(let n of t)n.setParent(this)}setAttrs(e){if(Zd(e),this.mark.class&&(e.className=this.mark.class),this.mark.attrs)for(let t in this.mark.attrs)e.setAttribute(t,this.mark.attrs[t]);return e}canReuseDOM(e){return super.canReuseDOM(e)&&!((this.flags|e.flags)&8)}reuseDOM(e){e.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(e),this.flags|=6)}sync(e,t){this.dom?this.flags&4&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),super.sync(e,t)}merge(e,t,r,n,s,o){return r&&(!(r instanceof i&&r.mark.eq(this.mark))||e&&s<=0||t<this.length&&o<=0)?!1:(ip(this,e,t,r?r.children.slice():[],s-1,o-1),this.markDirty(),!0)}split(e){let t=[],r=0,n=-1,s=0;for(let a of this.children){let l=r+a.length;l>e&&t.push(r<e?a.split(e-r):a),n<0&&r>=e&&(n=s),r=l,s++}let o=this.length-e;return this.length=e,n>-1&&(this.children.length=n,this.markDirty()),new i(this.mark,t,o)}domAtPos(e){return sp(this,e)}coordsAt(e,t){return ap(this,e,t)}};function mb(i,e,t){let r=i.nodeValue.length;e>r&&(e=r);let n=e,s=e,o=0;e==0&&t<0||e==r&&t>=0?Q.chrome||Q.gecko||(e?(n--,o=1):s<r&&(s++,o=-1)):t<0?n--:s<r&&s++;let a=Ri(i,n,s).getClientRects();if(!a.length)return null;let l=a[(o?o<0:t>=0)?0:a.length-1];return Q.safari&&!o&&l.width==0&&(l=Array.prototype.find.call(a,c=>c.width)||l),o?qc(l,o<0):l||null}var gn=class i extends ee{static create(e,t,r){return new i(e,t,r)}constructor(e,t,r){super(),this.widget=e,this.length=t,this.side=r,this.prevWidget=null}split(e){let t=i.create(this.widget,this.length-e,this.side);return this.length-=e,t}sync(e){(!this.dom||!this.widget.updateDOM(this.dom,e))&&(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(e)),this.widget.editable||(this.dom.contentEditable="false"))}getSide(){return this.side}merge(e,t,r,n,s,o){return r&&(!(r instanceof i)||!this.widget.compare(r.widget)||e>0&&s<=0||t<this.length&&o<=0)?!1:(this.length=e+(r?r.length:0)+(this.length-t),!0)}become(e){return e instanceof i&&e.side==this.side&&this.widget.constructor==e.widget.constructor?(this.widget.compare(e.widget)||this.markDirty(!0),this.dom&&!this.prevWidget&&(this.prevWidget=this.widget),this.widget=e.widget,this.length=e.length,!0):!1}ignoreMutation(){return!0}ignoreEvent(e){return this.widget.ignoreEvent(e)}get overrideDOMText(){if(this.length==0)return j.empty;let e=this;for(;e.parent;)e=e.parent;let{view:t}=e,r=t&&t.state.doc,n=this.posAtStart;return r?r.slice(n,n+this.length):j.empty}domAtPos(e){return(this.length?e==0:this.side>0)?De.before(this.dom):De.after(this.dom,e==this.length)}domBoundsAround(){return null}coordsAt(e,t){let r=this.widget.coordsAt(this.dom,e,t);if(r)return r;let n=this.dom.getClientRects(),s=null;if(!n.length)return null;let o=this.side?this.side<0:e>0;for(let a=o?n.length-1:0;s=n[a],!(e>0?a==0:a==n.length-1||s.top<s.bottom);a+=o?-1:1);return qc(s,!o)}get isEditable(){return!1}get isWidget(){return!0}get isHidden(){return this.widget.isHidden}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}},On=class i extends ee{constructor(e){super(),this.side=e}get length(){return 0}merge(){return!1}become(e){return e instanceof i&&e.side==this.side}split(){return new i(this.side)}sync(){if(!this.dom){let e=document.createElement("img");e.className="cm-widgetBuffer",e.setAttribute("aria-hidden","true"),this.setDOM(e)}}getSide(){return this.side}domAtPos(e){return this.side>0?De.before(this.dom):De.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(e){return this.dom.getBoundingClientRect()}get overrideDOMText(){return j.empty}get isHidden(){return!0}};Tt.prototype.children=gn.prototype.children=On.prototype.children=Vc;function sp(i,e){let t=i.dom,{children:r}=i,n=0;for(let s=0;n<r.length;n++){let o=r[n],a=s+o.length;if(!(a==s&&o.getSide()<=0)){if(e>s&&e<a&&o.dom.parentNode==t)return o.domAtPos(e-s);if(e<=s)break;s=a}}for(let s=n;s>0;s--){let o=r[s-1];if(o.dom.parentNode==t)return o.domAtPos(o.length)}for(let s=n;s<r.length;s++){let o=r[s];if(o.dom.parentNode==t)return o.domAtPos(0)}return new De(t,0)}function op(i,e,t){let r,{children:n}=i;t>0&&e instanceof ti&&n.length&&(r=n[n.length-1])instanceof ti&&r.mark.eq(e.mark)?op(r,e.children[0],t-1):(n.push(e),e.setParent(i)),i.length+=e.length}function ap(i,e,t){let r=null,n=-1,s=null,o=-1;function a(c,h){for(let u=0,f=0;u<c.children.length&&f<=h;u++){let d=c.children[u],m=f+d.length;m>=h&&(d.children.length?a(d,h-f):(!s||s.isHidden&&t>0)&&(m>h||f==m&&d.getSide()>0)?(s=d,o=h-f):(f<h||f==m&&d.getSide()<0&&!d.isHidden)&&(r=d,n=h-f)),f=m}}a(i,e);let l=(t<0?r:s)||r||s;return l?l.coordsAt(Math.max(0,l==r?n:o),t):gb(i)}function gb(i){let e=i.dom.lastChild;if(!e)return i.dom.getBoundingClientRect();let t=mn(e);return t[t.length-1]||null}function Jl(i,e){for(let t in i)t=="class"&&e.class?e.class+=" "+i.class:t=="style"&&e.style?e.style+=";"+i.style:e[t]=i[t];return e}var md=Object.create(null);function oo(i,e,t){if(i==e)return!0;i||(i=md),e||(e=md);let r=Object.keys(i),n=Object.keys(e);if(r.length-(t&&r.indexOf(t)>-1?1:0)!=n.length-(t&&n.indexOf(t)>-1?1:0))return!1;for(let s of r)if(s!=t&&(n.indexOf(s)==-1||i[s]!==e[s]))return!1;return!0}function Kl(i,e,t){let r=!1;if(e)for(let n in e)t&&n in t||(r=!0,n=="style"?i.style.cssText="":i.removeAttribute(n));if(t)for(let n in t)e&&e[n]==t[n]||(r=!0,n=="style"?i.style.cssText=t[n]:i.setAttribute(n,t[n]));return r}function Ob(i){let e=Object.create(null);for(let t=0;t<i.attributes.length;t++){let r=i.attributes[t];e[r.name]=r.value}return e}var ve=class i extends ee{constructor(){super(...arguments),this.children=[],this.length=0,this.prevAttrs=void 0,this.attrs=null,this.breakAfter=0}merge(e,t,r,n,s,o){if(r){if(!(r instanceof i))return!1;this.dom||r.transferDOM(this)}return n&&this.setDeco(r?r.attrs:null),ip(this,e,t,r?r.children.slice():[],s,o),!0}split(e){let t=new i;if(t.breakAfter=this.breakAfter,this.length==0)return t;let{i:r,off:n}=this.childPos(e);n&&(t.append(this.children[r].split(n),0),this.children[r].merge(n,this.children[r].length,null,!1,0,0),r++);for(let s=r;s<this.children.length;s++)t.append(this.children[s],0);for(;r>0&&this.children[r-1].length==0;)this.children[--r].destroy();return this.children.length=r,this.markDirty(),this.length=e,t}transferDOM(e){this.dom&&(this.markDirty(),e.setDOM(this.dom),e.prevAttrs=this.prevAttrs===void 0?this.attrs:this.prevAttrs,this.prevAttrs=void 0,this.dom=null)}setDeco(e){oo(this.attrs,e)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=e)}append(e,t){op(this,e,t)}addLineDeco(e){let t=e.spec.attributes,r=e.spec.class;t&&(this.attrs=Jl(t,this.attrs||{})),r&&(this.attrs=Jl({class:r},this.attrs||{}))}domAtPos(e){return sp(this,e)}reuseDOM(e){e.nodeName=="DIV"&&(this.setDOM(e),this.flags|=6)}sync(e,t){var r;this.dom?this.flags&4&&(Zd(this.dom),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0):(this.setDOM(document.createElement("div")),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0),this.prevAttrs!==void 0&&(Kl(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),super.sync(e,t);let n=this.dom.lastChild;for(;n&&ee.get(n)instanceof ti;)n=n.lastChild;if(!n||!this.length||n.nodeName!="BR"&&((r=ee.get(n))===null||r===void 0?void 0:r.isEditable)==!1&&(!Q.ios||!this.children.some(s=>s instanceof Tt))){let s=document.createElement("BR");s.cmIgnore=!0,this.dom.appendChild(s)}}measureTextSize(){if(this.children.length==0||this.length>20)return null;let e=0,t;for(let r of this.children){if(!(r instanceof Tt)||/[^ -~]/.test(r.text))return null;let n=mn(r.dom);if(n.length!=1)return null;e+=n[0].width,t=n[0].height}return e?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:e/this.length,textHeight:t}:null}coordsAt(e,t){let r=ap(this,e,t);if(!this.children.length&&r&&this.parent){let{heightOracle:n}=this.parent.view.viewState,s=r.bottom-r.top;if(Math.abs(s-n.lineHeight)<2&&n.textHeight<s){let o=(s-n.textHeight)/2;return{top:r.top+o,bottom:r.bottom-o,left:r.left,right:r.left}}}return r}become(e){return e instanceof i&&this.children.length==0&&e.children.length==0&&oo(this.attrs,e.attrs)&&this.breakAfter==e.breakAfter}covers(){return!0}static find(e,t){for(let r=0,n=0;r<e.children.length;r++){let s=e.children[r],o=n+s.length;if(o>=t){if(s instanceof i)return s;if(o>t)break}n=o+s.breakAfter}return null}},Ci=class i extends ee{constructor(e,t,r){super(),this.widget=e,this.length=t,this.deco=r,this.breakAfter=0,this.prevWidget=null}merge(e,t,r,n,s,o){return r&&(!(r instanceof i)||!this.widget.compare(r.widget)||e>0&&s<=0||t<this.length&&o<=0)?!1:(this.length=e+(r?r.length:0)+(this.length-t),!0)}domAtPos(e){return e==0?De.before(this.dom):De.after(this.dom,e==this.length)}split(e){let t=this.length-e;this.length=e;let r=new i(this.widget,t,this.deco);return r.breakAfter=this.breakAfter,r}get children(){return Vc}sync(e){(!this.dom||!this.widget.updateDOM(this.dom,e))&&(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(e)),this.widget.editable||(this.dom.contentEditable="false"))}get overrideDOMText(){return this.parent?this.parent.view.state.doc.slice(this.posAtStart,this.posAtEnd):j.empty}domBoundsAround(){return null}become(e){return e instanceof i&&e.widget.constructor==this.widget.constructor?(e.widget.compare(this.widget)||this.markDirty(!0),this.dom&&!this.prevWidget&&(this.prevWidget=this.widget),this.widget=e.widget,this.length=e.length,this.deco=e.deco,this.breakAfter=e.breakAfter,!0):!1}ignoreMutation(){return!0}ignoreEvent(e){return this.widget.ignoreEvent(e)}get isEditable(){return!1}get isWidget(){return!0}coordsAt(e,t){return this.widget.coordsAt(this.dom,e,t)}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}covers(e){let{startSide:t,endSide:r}=this.deco;return t==r?!1:e<0?t<0:r>0}},Ne=class{eq(e){return!1}updateDOM(e,t){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(e){return!0}coordsAt(e,t,r){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}},Le=function(i){return i[i.Text=0]="Text",i[i.WidgetBefore=1]="WidgetBefore",i[i.WidgetAfter=2]="WidgetAfter",i[i.WidgetRange=3]="WidgetRange",i}(Le||(Le={})),M=class extends ft{constructor(e,t,r,n){super(),this.startSide=e,this.endSide=t,this.widget=r,this.spec=n}get heightRelevant(){return!1}static mark(e){return new yn(e)}static widget(e){let t=Math.max(-1e4,Math.min(1e4,e.side||0)),r=!!e.block;return t+=r&&!e.inlineOrder?t>0?3e8:-4e8:t>0?1e8:-1e8,new ii(e,t,t,r,e.widget||null,!1)}static replace(e){let t=!!e.block,r,n;if(e.isBlockGap)r=-5e8,n=4e8;else{let{start:s,end:o}=lp(e,t);r=(s?t?-3e8:-1:5e8)-1,n=(o?t?2e8:1:-6e8)+1}return new ii(e,r,n,t,e.widget||null,!0)}static line(e){return new bn(e)}static set(e,t=!1){return z.of(e,t)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}};M.none=z.empty;var yn=class i extends M{constructor(e){let{start:t,end:r}=lp(e);super(t?-1:5e8,r?1:-6e8,null,e),this.tagName=e.tagName||"span",this.class=e.class||"",this.attrs=e.attributes||null}eq(e){var t,r;return this==e||e instanceof i&&this.tagName==e.tagName&&(this.class||((t=this.attrs)===null||t===void 0?void 0:t.class))==(e.class||((r=e.attrs)===null||r===void 0?void 0:r.class))&&oo(this.attrs,e.attrs,"class")}range(e,t=e){if(e>=t)throw new RangeError("Mark decorations may not be empty");return super.range(e,t)}};yn.prototype.point=!1;var bn=class i extends M{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof i&&this.spec.class==e.spec.class&&oo(this.spec.attributes,e.spec.attributes)}range(e,t=e){if(t!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,t)}};bn.prototype.mapMode=ye.TrackBefore;bn.prototype.point=!0;var ii=class i extends M{constructor(e,t,r,n,s,o){super(t,r,s,e),this.block=n,this.isReplace=o,this.mapMode=n?t<=0?ye.TrackBefore:ye.TrackAfter:ye.TrackDel}get type(){return this.startSide!=this.endSide?Le.WidgetRange:this.startSide<=0?Le.WidgetBefore:Le.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof i&&yb(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,t=e){if(this.isReplace&&(e>t||e==t&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&t!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,t)}};ii.prototype.point=!0;function lp(i,e=!1){let{inclusiveStart:t,inclusiveEnd:r}=i;return t==null&&(t=i.inclusive),r==null&&(r=i.inclusive),{start:t??e,end:r??e}}function yb(i,e){return i==e||!!(i&&e&&i.compare(e))}function ec(i,e,t,r=0){let n=t.length-1;n>=0&&t[n]+r>=i?t[n]=Math.max(t[n],e):t.push(i,e)}var ln=class i{constructor(e,t,r,n){this.doc=e,this.pos=t,this.end=r,this.disallowBlockEffectsFor=n,this.content=[],this.curLine=null,this.breakAtStart=0,this.pendingBuffer=0,this.bufferMarks=[],this.atCursorPos=!0,this.openStart=-1,this.openEnd=-1,this.text="",this.textOff=0,this.cursor=e.iter(),this.skip=t}posCovered(){if(this.content.length==0)return!this.breakAtStart&&this.doc.lineAt(this.pos).from!=this.pos;let e=this.content[this.content.length-1];return!(e.breakAfter||e instanceof Ci&&e.deco.endSide<0)}getLine(){return this.curLine||(this.content.push(this.curLine=new ve),this.atCursorPos=!0),this.curLine}flushBuffer(e=this.bufferMarks){this.pendingBuffer&&(this.curLine.append(Is(new On(-1),e),e.length),this.pendingBuffer=0)}addBlockWidget(e){this.flushBuffer(),this.curLine=null,this.content.push(e)}finish(e){this.pendingBuffer&&e<=this.bufferMarks.length?this.flushBuffer():this.pendingBuffer=0,!this.posCovered()&&!(e&&this.content.length&&this.content[this.content.length-1]instanceof Ci)&&this.getLine()}buildText(e,t,r){for(;e>0;){if(this.textOff==this.text.length){let{value:s,lineBreak:o,done:a}=this.cursor.next(this.skip);if(this.skip=0,a)throw new Error("Ran out of text content when drawing inline views");if(o){this.posCovered()||this.getLine(),this.content.length?this.content[this.content.length-1].breakAfter=1:this.breakAtStart=1,this.flushBuffer(),this.curLine=null,this.atCursorPos=!0,e--;continue}else this.text=s,this.textOff=0}let n=Math.min(this.text.length-this.textOff,e,512);this.flushBuffer(t.slice(t.length-r)),this.getLine().append(Is(new Tt(this.text.slice(this.textOff,this.textOff+n)),t),r),this.atCursorPos=!0,this.textOff+=n,e-=n,r=0}}span(e,t,r,n){this.buildText(t-e,r,n),this.pos=t,this.openStart<0&&(this.openStart=n)}point(e,t,r,n,s,o){if(this.disallowBlockEffectsFor[o]&&r instanceof ii){if(r.block)throw new RangeError("Block decorations may not be specified via plugins");if(t>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}let a=t-e;if(r instanceof ii)if(r.block)r.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new Ci(r.widget||ri.block,a,r));else{let l=gn.create(r.widget||ri.inline,a,a?0:r.startSide),c=this.atCursorPos&&!l.isEditable&&s<=n.length&&(e<t||r.startSide>0),h=!l.isEditable&&(e<t||s>n.length||r.startSide<=0),u=this.getLine();this.pendingBuffer==2&&!c&&!l.isEditable&&(this.pendingBuffer=0),this.flushBuffer(n),c&&(u.append(Is(new On(1),n),s),s=n.length+Math.max(0,s-n.length)),u.append(Is(l,n),s),this.atCursorPos=h,this.pendingBuffer=h?e<t||s>n.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=n.slice())}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(r);a&&(this.textOff+a<=this.text.length?this.textOff+=a:(this.skip+=a-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=t),this.openStart<0&&(this.openStart=s)}static build(e,t,r,n,s){let o=new i(e,t,r,s);return o.openEnd=z.spans(n,t,r,o),o.openStart<0&&(o.openStart=o.openEnd),o.finish(o.openEnd),o}};function Is(i,e){for(let t of e)i=new ti(t,[i],i.length);return i}var ri=class extends Ne{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}};ri.inline=new ri("span");ri.block=new ri("div");var G=function(i){return i[i.LTR=0]="LTR",i[i.RTL=1]="RTL",i}(G||(G={})),Ai=G.LTR,$c=G.RTL;function cp(i){let e=[];for(let t=0;t<i.length;t++)e.push(1<<+i[t]);return e}var bb=cp("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),wb=cp("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),tc=Object.create(null),vt=[];for(let i of["()","[]","{}"]){let e=i.charCodeAt(0),t=i.charCodeAt(1);tc[e]=t,tc[t]=-e}function hp(i){return i<=247?bb[i]:1424<=i&&i<=1524?2:1536<=i&&i<=1785?wb[i-1536]:1774<=i&&i<=2220?4:8192<=i&&i<=8204?256:64336<=i&&i<=65023?4:1}var vb=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/,St=class{get dir(){return this.level%2?$c:Ai}constructor(e,t,r){this.from=e,this.to=t,this.level=r}side(e,t){return this.dir==t==e?this.to:this.from}forward(e,t){return e==(this.dir==t)}static find(e,t,r,n){let s=-1;for(let o=0;o<e.length;o++){let a=e[o];if(a.from<=t&&a.to>=t){if(a.level==r)return o;(s<0||(n!=0?n<0?a.from<t:a.to>t:e[s].level>a.level))&&(s=o)}}if(s<0)throw new RangeError("Index out of range");return s}};function up(i,e){if(i.length!=e.length)return!1;for(let t=0;t<i.length;t++){let r=i[t],n=e[t];if(r.from!=n.from||r.to!=n.to||r.direction!=n.direction||!up(r.inner,n.inner))return!1}return!0}var J=[];function xb(i,e,t,r,n){for(let s=0;s<=r.length;s++){let o=s?r[s-1].to:e,a=s<r.length?r[s].from:t,l=s?256:n;for(let c=o,h=l,u=l;c<a;c++){let f=hp(i.charCodeAt(c));f==512?f=h:f==8&&u==4&&(f=16),J[c]=f==4?2:f,f&7&&(u=f),h=f}for(let c=o,h=l,u=l;c<a;c++){let f=J[c];if(f==128)c<a-1&&h==J[c+1]&&h&24?f=J[c]=h:J[c]=256;else if(f==64){let d=c+1;for(;d<a&&J[d]==64;)d++;let m=c&&h==8||d<t&&J[d]==8?u==1?1:8:256;for(let p=c;p<d;p++)J[p]=m;c=d-1}else f==8&&u==1&&(J[c]=1);h=f,f&7&&(u=f)}}}function Sb(i,e,t,r,n){let s=n==1?2:1;for(let o=0,a=0,l=0;o<=r.length;o++){let c=o?r[o-1].to:e,h=o<r.length?r[o].from:t;for(let u=c,f,d,m;u<h;u++)if(d=tc[f=i.charCodeAt(u)])if(d<0){for(let p=a-3;p>=0;p-=3)if(vt[p+1]==-d){let g=vt[p+2],O=g&2?n:g&4?g&1?s:n:0;O&&(J[u]=J[vt[p]]=O),a=p;break}}else{if(vt.length==189)break;vt[a++]=u,vt[a++]=f,vt[a++]=l}else if((m=J[u])==2||m==1){let p=m==n;l=p?0:1;for(let g=a-3;g>=0;g-=3){let O=vt[g+2];if(O&2)break;if(p)vt[g+2]|=2;else{if(O&4)break;vt[g+2]|=4}}}}}function kb(i,e,t,r){for(let n=0,s=r;n<=t.length;n++){let o=n?t[n-1].to:i,a=n<t.length?t[n].from:e;for(let l=o;l<a;){let c=J[l];if(c==256){let h=l+1;for(;;)if(h==a){if(n==t.length)break;h=t[n++].to,a=n<t.length?t[n].from:e}else if(J[h]==256)h++;else break;let u=s==1,f=(h<e?J[h]:r)==1,d=u==f?u?1:2:r;for(let m=h,p=n,g=p?t[p-1].to:i;m>l;)m==g&&(m=t[--p].from,g=p?t[p-1].to:i),J[--m]=d;l=h}else s=c,l++}}}function ic(i,e,t,r,n,s,o){let a=r%2?2:1;if(r%2==n%2)for(let l=e,c=0;l<t;){let h=!0,u=!1;if(c==s.length||l<s[c].from){let p=J[l];p!=a&&(h=!1,u=p==16)}let f=!h&&a==1?[]:null,d=h?r:r+1,m=l;e:for(;;)if(c<s.length&&m==s[c].from){if(u)break e;let p=s[c];if(!h)for(let g=p.to,O=c+1;;){if(g==t)break e;if(O<s.length&&s[O].from==g)g=s[O++].to;else{if(J[g]==a)break e;break}}if(c++,f)f.push(p);else{p.from>l&&o.push(new St(l,p.from,d));let g=p.direction==Ai!=!(d%2);rc(i,g?r+1:r,n,p.inner,p.from,p.to,o),l=p.to}m=p.to}else{if(m==t||(h?J[m]!=a:J[m]==a))break;m++}f?ic(i,l,m,r+1,n,f,o):l<m&&o.push(new St(l,m,d)),l=m}else for(let l=t,c=s.length;l>e;){let h=!0,u=!1;if(!c||l>s[c-1].to){let p=J[l-1];p!=a&&(h=!1,u=p==16)}let f=!h&&a==1?[]:null,d=h?r:r+1,m=l;e:for(;;)if(c&&m==s[c-1].to){if(u)break e;let p=s[--c];if(!h)for(let g=p.from,O=c;;){if(g==e)break e;if(O&&s[O-1].to==g)g=s[--O].from;else{if(J[g-1]==a)break e;break}}if(f)f.push(p);else{p.to<l&&o.push(new St(p.to,l,d));let g=p.direction==Ai!=!(d%2);rc(i,g?r+1:r,n,p.inner,p.from,p.to,o),l=p.from}m=p.from}else{if(m==e||(h?J[m-1]!=a:J[m-1]==a))break;m--}f?ic(i,m,l,r+1,n,f,o):m<l&&o.push(new St(m,l,d)),l=m}}function rc(i,e,t,r,n,s,o){let a=e%2?2:1;xb(i,n,s,r,a),Sb(i,n,s,r,a),kb(n,s,r,a),ic(i,n,s,e,t,r,o)}function Tb(i,e,t){if(!i)return[new St(0,0,e==$c?1:0)];if(e==Ai&&!t.length&&!vb.test(i))return fp(i.length);if(t.length)for(;i.length>J.length;)J[J.length]=256;let r=[],n=e==Ai?0:1;return rc(i,n,n,t,0,i.length,r),r}function fp(i){return[new St(0,i,0)]}var dp="";function Pb(i,e,t,r,n){var s;let o=r.head-i.from,a=St.find(e,o,(s=r.bidiLevel)!==null&&s!==void 0?s:-1,r.assoc),l=e[a],c=l.side(n,t);if(o==c){let f=a+=n?1:-1;if(f<0||f>=e.length)return null;l=e[a=f],o=l.side(!n,t),c=l.side(n,t)}let h=pe(i.text,o,l.forward(n,t));(h<l.from||h>l.to)&&(h=c),dp=i.text.slice(Math.min(o,h),Math.max(o,h));let u=a==(n?e.length-1:0)?null:e[a+(n?1:-1)];return u&&h==c&&u.level+(n?0:1)<l.level?T.cursor(u.side(!n,t)+i.from,u.forward(n,t)?1:-1,u.level):T.cursor(h+i.from,l.forward(n,t)?-1:1,l.level)}function Cb(i,e,t){for(let r=e;r<t;r++){let n=hp(i.charCodeAt(r));if(n==1)return Ai;if(n==2||n==4)return $c}return Ai}var pp=A.define(),mp=A.define(),gp=A.define(),Op=A.define(),nc=A.define(),yp=A.define(),bp=A.define(),wp=A.define({combine:i=>i.some(e=>e)}),vp=A.define({combine:i=>i.some(e=>e)}),xp=A.define(),cn=class i{constructor(e,t="nearest",r="nearest",n=5,s=5,o=!1){this.range=e,this.y=t,this.x=r,this.yMargin=n,this.xMargin=s,this.isSnapshot=o}map(e){return e.empty?this:new i(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(e){return this.range.to<=e.doc.length?this:new i(T.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}},Ws=D.define({map:(i,e)=>i.map(e)}),Sp=D.define();function xe(i,e,t){let r=i.facet(Op);r.length?r[0](e):window.onerror?window.onerror(String(e),t,void 0,void 0,e):t?console.error(t+":",e):console.error(e)}var Jt=A.define({combine:i=>i.length?i[0]:!0}),Eb=0,tn=A.define(),se=class i{constructor(e,t,r,n,s){this.id=e,this.create=t,this.domEventHandlers=r,this.domEventObservers=n,this.extension=s(this)}static define(e,t){let{eventHandlers:r,eventObservers:n,provide:s,decorations:o}=t||{};return new i(Eb++,e,r,n,a=>{let l=[tn.of(a)];return o&&l.push(wn.of(c=>{let h=c.plugin(a);return h?o(h):M.none})),s&&l.push(s(a)),l})}static fromClass(e,t){return i.define(r=>new e(r),t)}},hn=class{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}update(e){if(this.value){if(this.mustUpdate){let t=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(t)}catch(r){if(xe(t.state,r,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.create(e)}catch(t){xe(e.state,t,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var t;if(!((t=this.value)===null||t===void 0)&&t.destroy)try{this.value.destroy()}catch(r){xe(e.state,r,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}},kp=A.define(),Bc=A.define(),wn=A.define(),Tp=A.define(),Xc=A.define(),Pp=A.define();function gd(i,e){let t=i.state.facet(Pp);if(!t.length)return t;let r=t.map(s=>s instanceof Function?s(i):s),n=[];return z.spans(r,e.from,e.to,{point(){},span(s,o,a,l){let c=s-e.from,h=o-e.from,u=n;for(let f=a.length-1;f>=0;f--,l--){let d=a[f].spec.bidiIsolate,m;if(d==null&&(d=Cb(e.text,c,h)),l>0&&u.length&&(m=u[u.length-1]).to==c&&m.direction==d)m.to=h,u=m.inner;else{let p={from:c,to:h,direction:d,inner:[]};u.push(p),u=p.inner}}}}),n}var Cp=A.define();function Ep(i){let e=0,t=0,r=0,n=0;for(let s of i.state.facet(Cp)){let o=s(i);o&&(o.left!=null&&(e=Math.max(e,o.left)),o.right!=null&&(t=Math.max(t,o.right)),o.top!=null&&(r=Math.max(r,o.top)),o.bottom!=null&&(n=Math.max(n,o.bottom)))}return{left:e,right:t,top:r,bottom:n}}var rn=A.define(),kt=class i{constructor(e,t,r,n){this.fromA=e,this.toA=t,this.fromB=r,this.toB=n}join(e){return new i(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let t=e.length,r=this;for(;t>0;t--){let n=e[t-1];if(!(n.fromA>r.toA)){if(n.toA<r.fromA)break;r=r.join(n),e.splice(t-1,1)}}return e.splice(t,0,r),e}static extendWithRanges(e,t){if(t.length==0)return e;let r=[];for(let n=0,s=0,o=0,a=0;;n++){let l=n==e.length?null:e[n],c=o-a,h=l?l.fromB:1e9;for(;s<t.length&&t[s]<h;){let u=t[s],f=t[s+1],d=Math.max(a,u),m=Math.min(h,f);if(d<=m&&new i(d+c,m+c,d,m).addToSet(r),f>h)break;s+=2}if(!l)return r;new i(l.fromA,l.toA,l.fromB,l.toB).addToSet(r),o=l.toA,a=l.toB}}},ao=class i{constructor(e,t,r){this.view=e,this.state=t,this.transactions=r,this.flags=0,this.startState=e.state,this.changes=Me.empty(this.startState.doc.length);for(let s of r)this.changes=this.changes.compose(s.changes);let n=[];this.changes.iterChangedRanges((s,o,a,l)=>n.push(new kt(s,o,a,l))),this.changedRanges=n}static create(e,t,r){return new i(e,t,r)}get viewportChanged(){return(this.flags&4)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&10)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return this.flags==0&&this.transactions.length==0}},lo=class extends ee{get length(){return this.view.state.doc.length}constructor(e){super(),this.view=e,this.decorations=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.markedForComposition=new Set,this.editContextFormatting=M.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.setDOM(e.contentDOM),this.children=[new ve],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new kt(0,0,0,e.state.doc.length)],0,null)}update(e){var t;let r=e.changedRanges;this.minWidth>0&&r.length&&(r.every(({fromA:c,toA:h})=>h<this.minWidthFrom||c>this.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(e);let n=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((t=this.domChanged)===null||t===void 0)&&t.newSel?n=this.domChanged.newSel.head:!Lb(e.changes,this.hasComposition)&&!e.selectionSet&&(n=e.state.selection.main.head));let s=n>-1?Ab(this.view,e.changes,n):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();let{from:c,to:h}=this.hasComposition;r=new kt(c,h,e.changes.mapPos(c,-1),e.changes.mapPos(h,1)).addToSet(r.slice())}this.hasComposition=s?{from:s.range.fromB,to:s.range.toB}:null,(Q.ie||Q.chrome)&&!s&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let o=this.decorations,a=this.updateDeco(),l=_b(o,a,e.changes);return r=kt.extendWithRanges(r,l),!(this.flags&7)&&r.length==0?!1:(this.updateInner(r,e.startState.doc.length,s),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,t,r){this.view.viewState.mustMeasureContent=!0,this.updateChildren(e,t,r);let{observer:n}=this.view;n.ignore(()=>{this.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let o=Q.chrome||Q.ios?{node:n.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,o),this.flags&=-8,o&&(o.written||n.selectionRange.focusNode!=o.node)&&(this.forceSelection=!0),this.dom.style.height=""}),this.markedForComposition.forEach(o=>o.flags&=-9);let s=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let o of this.children)o instanceof Ci&&o.widget instanceof co&&s.push(o.dom);n.updateGaps(s)}updateChildren(e,t,r){let n=r?r.range.addToSet(e.slice()):e,s=this.childCursor(t);for(let o=n.length-1;;o--){let a=o>=0?n[o]:null;if(!a)break;let{fromA:l,toA:c,fromB:h,toB:u}=a,f,d,m,p;if(r&&r.range.fromB<u&&r.range.toB>h){let v=ln.build(this.view.state.doc,h,r.range.fromB,this.decorations,this.dynamicDecorationMap),w=ln.build(this.view.state.doc,r.range.toB,u,this.decorations,this.dynamicDecorationMap);d=v.breakAtStart,m=v.openStart,p=w.openEnd;let P=this.compositionView(r);w.breakAtStart?P.breakAfter=1:w.content.length&&P.merge(P.length,P.length,w.content[0],!1,w.openStart,0)&&(P.breakAfter=w.content[0].breakAfter,w.content.shift()),v.content.length&&P.merge(0,0,v.content[v.content.length-1],!0,0,v.openEnd)&&v.content.pop(),f=v.content.concat(P).concat(w.content)}else({content:f,breakAtStart:d,openStart:m,openEnd:p}=ln.build(this.view.state.doc,h,u,this.decorations,this.dynamicDecorationMap));let{i:g,off:O}=s.findPos(c,1),{i:y,off:x}=s.findPos(l,-1);tp(this,y,x,g,O,f,d,m,p)}r&&this.fixCompositionDOM(r)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let t of e.transactions)for(let r of t.effects)r.is(Sp)&&(this.editContextFormatting=r.value)}compositionView(e){let t=new Tt(e.text.nodeValue);t.flags|=8;for(let{deco:n}of e.marks)t=new ti(n,[t],t.length);let r=new ve;return r.append(t,0),r}fixCompositionDOM(e){let t=(s,o)=>{o.flags|=8|(o.children.some(l=>l.flags&7)?1:0),this.markedForComposition.add(o);let a=ee.get(s);a&&a!=o&&(a.dom=null),o.setDOM(s)},r=this.childPos(e.range.fromB,1),n=this.children[r.i];t(e.line,n);for(let s=e.marks.length-1;s>=-1;s--)r=n.childPos(r.off,1),n=n.children[r.i],t(s>=0?e.marks[s].node:e.text,n)}updateSelection(e=!1,t=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let r=this.view.root.activeElement,n=r==this.dom,s=!n&&Js(this.dom,this.view.observer.selectionRange)&&!(r&&this.dom.contains(r));if(!(n||t||s))return;let o=this.forceSelection;this.forceSelection=!1;let a=this.view.state.selection.main,l=this.moveToLine(this.domAtPos(a.anchor)),c=a.empty?l:this.moveToLine(this.domAtPos(a.head));if(Q.gecko&&a.empty&&!this.hasComposition&&Rb(l)){let u=document.createTextNode("");this.view.observer.ignore(()=>l.node.insertBefore(u,l.node.childNodes[l.offset]||null)),l=c=new De(u,0),o=!0}let h=this.view.observer.selectionRange;(o||!h.focusNode||(!an(l.node,l.offset,h.anchorNode,h.anchorOffset)||!an(c.node,c.offset,h.focusNode,h.focusOffset))&&!this.suppressWidgetCursorChange(h,a))&&(this.view.observer.ignore(()=>{Q.android&&Q.chrome&&this.dom.contains(h.focusNode)&&Db(h.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let u=pn(this.view.root);if(u)if(a.empty){if(Q.gecko){let f=Qb(l.node,l.offset);if(f&&f!=3){let d=(f==1?Kd:ep)(l.node,l.offset);d&&(l=new De(d.node,d.offset))}}u.collapse(l.node,l.offset),a.bidiLevel!=null&&u.caretBidiLevel!==void 0&&(u.caretBidiLevel=a.bidiLevel)}else if(u.extend){u.collapse(l.node,l.offset);try{u.extend(c.node,c.offset)}catch{}}else{let f=document.createRange();a.anchor>a.head&&([l,c]=[c,l]),f.setEnd(c.node,c.offset),f.setStart(l.node,l.offset),u.removeAllRanges(),u.addRange(f)}s&&this.view.root.activeElement==this.dom&&(this.dom.blur(),r&&r.focus())}),this.view.observer.setSelectionRange(l,c)),this.impreciseAnchor=l.precise?null:new De(h.anchorNode,h.anchorOffset),this.impreciseHead=c.precise?null:new De(h.focusNode,h.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&an(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==t.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,t=e.state.selection.main,r=pn(e.root),{anchorNode:n,anchorOffset:s}=e.observer.selectionRange;if(!r||!t.empty||!t.assoc||!r.modify)return;let o=ve.find(this,t.head);if(!o)return;let a=o.posAtStart;if(t.head==a||t.head==a+o.length)return;let l=this.coordsAt(t.head,-1),c=this.coordsAt(t.head,1);if(!l||!c||l.bottom>c.top)return;let h=this.domAtPos(t.head+t.assoc);r.collapse(h.node,h.offset),r.modify("move",t.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let u=e.observer.selectionRange;e.docView.posFromDOM(u.anchorNode,u.anchorOffset)!=t.from&&r.collapse(n,s)}moveToLine(e){let t=this.dom,r;if(e.node!=t)return e;for(let n=e.offset;!r&&n<t.childNodes.length;n++){let s=ee.get(t.childNodes[n]);s instanceof ve&&(r=s.domAtPos(0))}for(let n=e.offset-1;!r&&n>=0;n--){let s=ee.get(t.childNodes[n]);s instanceof ve&&(r=s.domAtPos(s.length))}return r?new De(r.node,r.offset,!0):e}nearest(e){for(let t=e;t;){let r=ee.get(t);if(r&&r.rootView==this)return r;t=t.parentNode}return null}posFromDOM(e,t){let r=this.nearest(e);if(!r)throw new RangeError("Trying to find position for a DOM position outside of the document");return r.localPosFromDOM(e,t)+r.posAtStart}domAtPos(e){let{i:t,off:r}=this.childCursor().findPos(e,-1);for(;t<this.children.length-1;){let n=this.children[t];if(r<n.length||n instanceof ve)break;t++,r=0}return this.children[t].domAtPos(r)}coordsAt(e,t){let r=null,n=0;for(let s=this.length,o=this.children.length-1;o>=0;o--){let a=this.children[o],l=s-a.breakAfter,c=l-a.length;if(l<e)break;if(c<=e&&(c<e||a.covers(-1))&&(l>e||a.covers(1))&&(!r||a instanceof ve&&!(r instanceof ve&&t>=0)))r=a,n=c;else if(r&&c==e&&l==e&&a instanceof Ci&&Math.abs(t)<2){if(a.deco.startSide<0)break;o&&(r=null)}s=c}return r?r.coordsAt(e-n,t):null}coordsForChar(e){let{i:t,off:r}=this.childPos(e,1),n=this.children[t];if(!(n instanceof ve))return null;for(;n.children.length;){let{i:a,off:l}=n.childPos(r,1);for(;;a++){if(a==n.children.length)return null;if((n=n.children[a]).length)break}r=l}if(!(n instanceof Tt))return null;let s=pe(n.text,r);if(s==r)return null;let o=Ri(n.dom,r,s).getClientRects();for(let a=0;a<o.length;a++){let l=o[a];if(a==o.length-1||l.top<l.bottom&&l.left<l.right)return l}return null}measureVisibleLineHeights(e){let t=[],{from:r,to:n}=e,s=this.view.contentDOM.clientWidth,o=s>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,a=-1,l=this.view.textDirection==G.LTR;for(let c=0,h=0;h<this.children.length;h++){let u=this.children[h],f=c+u.length;if(f>n)break;if(c>=r){let d=u.dom.getBoundingClientRect();if(t.push(d.height),o){let m=u.dom.lastChild,p=m?mn(m):[];if(p.length){let g=p[p.length-1],O=l?g.right-d.left:d.right-g.left;O>a&&(a=O,this.minWidth=s,this.minWidthFrom=c,this.minWidthTo=f)}}}c=f+u.breakAfter}return t}textDirectionAt(e){let{i:t}=this.childPos(e,1);return getComputedStyle(this.children[t].dom).direction=="rtl"?G.RTL:G.LTR}measureTextSize(){for(let s of this.children)if(s instanceof ve){let o=s.measureTextSize();if(o)return o}let e=document.createElement("div"),t,r,n;return e.className="cm-line",e.style.width="99999px",e.style.position="absolute",e.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.dom.appendChild(e);let s=mn(e.firstChild)[0];t=e.getBoundingClientRect().height,r=s?s.width/27:7,n=s?s.height:t,e.remove()}),{lineHeight:t,charWidth:r,textHeight:n}}childCursor(e=this.length){let t=this.children.length;return t&&(e-=this.children[--t].length),new so(this.children,e,t)}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let r=0,n=0;;n++){let s=n==t.viewports.length?null:t.viewports[n],o=s?s.from-1:this.length;if(o>r){let a=(t.lineBlockAt(o).bottom-t.lineBlockAt(r).top)/this.view.scaleY;e.push(M.replace({widget:new co(a),block:!0,inclusive:!0,isBlockGap:!0}).range(r,o))}if(!s)break;r=s.to+1}return M.set(e)}updateDeco(){let e=1,t=this.view.state.facet(wn).map(s=>(this.dynamicDecorationMap[e++]=typeof s=="function")?s(this.view):s),r=!1,n=this.view.state.facet(Tp).map((s,o)=>{let a=typeof s=="function";return a&&(r=!0),a?s(this.view):s});for(n.length&&(this.dynamicDecorationMap[e++]=r,t.push(z.join(n))),this.decorations=[this.editContextFormatting,...t,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];e<this.decorations.length;)this.dynamicDecorationMap[e++]=!1;return this.decorations}scrollIntoView(e){if(e.isSnapshot){let c=this.view.viewState.lineBlockAt(e.range.head);this.view.scrollDOM.scrollTop=c.top-e.yMargin,this.view.scrollDOM.scrollLeft=e.xMargin;return}for(let c of this.view.state.facet(xp))try{if(c(this.view,e.range,e))return!0}catch(h){xe(this.view.state,h,"scroll handler")}let{range:t}=e,r=this.coordsAt(t.head,t.empty?t.assoc:t.head>t.anchor?-1:1),n;if(!r)return;!t.empty&&(n=this.coordsAt(t.anchor,t.anchor>t.head?-1:1))&&(r={left:Math.min(r.left,n.left),top:Math.min(r.top,n.top),right:Math.max(r.right,n.right),bottom:Math.max(r.bottom,n.bottom)});let s=Ep(this.view),o={left:r.left-s.left,top:r.top-s.top,right:r.right+s.right,bottom:r.bottom+s.bottom},{offsetWidth:a,offsetHeight:l}=this.view.scrollDOM;hb(this.view.scrollDOM,o,t.head<t.anchor?-1:1,e.x,e.y,Math.max(Math.min(e.xMargin,a),-a),Math.max(Math.min(e.yMargin,l),-l),this.view.textDirection==G.LTR)}};function Rb(i){return i.node.nodeType==1&&i.node.firstChild&&(i.offset==0||i.node.childNodes[i.offset-1].contentEditable=="false")&&(i.offset==i.node.childNodes.length||i.node.childNodes[i.offset].contentEditable=="false")}var co=class extends Ne{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement("div");return e.className="cm-gap",this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}};function Rp(i,e){let t=i.observer.selectionRange;if(!t.focusNode)return null;let r=Kd(t.focusNode,t.focusOffset),n=ep(t.focusNode,t.focusOffset),s=r||n;if(n&&r&&n.node!=r.node){let a=ee.get(n.node);if(!a||a instanceof Tt&&a.text!=n.node.nodeValue)s=n;else if(i.docView.lastCompositionAfterCursor){let l=ee.get(r.node);!l||l instanceof Tt&&l.text!=r.node.nodeValue||(s=n)}}if(i.docView.lastCompositionAfterCursor=s!=r,!s)return null;let o=e-s.offset;return{from:o,to:o+s.node.nodeValue.length,node:s.node}}function Ab(i,e,t){let r=Rp(i,t);if(!r)return null;let{node:n,from:s,to:o}=r,a=n.nodeValue;if(/[\n\r]/.test(a)||i.state.doc.sliceString(r.from,r.to)!=a)return null;let l=e.invertedDesc,c=new kt(l.mapPos(s),l.mapPos(o),s,o),h=[];for(let u=n.parentNode;;u=u.parentNode){let f=ee.get(u);if(f instanceof ti)h.push({node:u,deco:f.mark});else{if(f instanceof ve||u.nodeName=="DIV"&&u.parentNode==i.contentDOM)return{range:c,text:n,marks:h,line:u};if(u!=i.contentDOM)h.push({node:u,deco:new yn({inclusive:!0,attributes:Ob(u),tagName:u.tagName.toLowerCase()})});else return null}}}function Qb(i,e){return i.nodeType!=1?0:(e&&i.childNodes[e-1].contentEditable=="false"?1:0)|(e<i.childNodes.length&&i.childNodes[e].contentEditable=="false"?2:0)}var Mb=class{constructor(){this.changes=[]}compareRange(e,t){ec(e,t,this.changes)}comparePoint(e,t){ec(e,t,this.changes)}};function _b(i,e,t){let r=new Mb;return z.compare(i,e,t,r),r.changes}function Db(i,e){for(let t=i;t&&t!=e;t=t.assignedSlot||t.parentNode)if(t.nodeType==1&&t.contentEditable=="false")return!0;return!1}function Lb(i,e){let t=!1;return e&&i.iterChangedRanges((r,n)=>{r<e.to&&n>e.from&&(t=!0)}),t}function qb(i,e,t=1){let r=i.charCategorizer(e),n=i.doc.lineAt(e),s=e-n.from;if(n.length==0)return T.cursor(e);s==0?t=1:s==n.length&&(t=-1);let o=s,a=s;t<0?o=pe(n.text,s,!1):a=pe(n.text,s);let l=r(n.text.slice(o,a));for(;o>0;){let c=pe(n.text,o,!1);if(r(n.text.slice(c,o))!=l)break;o=c}for(;a<n.length;){let c=pe(n.text,a);if(r(n.text.slice(a,c))!=l)break;a=c}return T.range(o+n.from,a+n.from)}function Vb(i,e){return e.left>i?e.left-i:Math.max(0,i-e.right)}function $b(i,e){return e.top>i?e.top-i:Math.max(0,i-e.bottom)}function Nl(i,e){return i.top<e.bottom-1&&i.bottom>e.top+1}function Od(i,e){return e<i.top?{top:e,left:i.left,right:i.right,bottom:i.bottom}:i}function yd(i,e){return e>i.bottom?{top:i.top,left:i.left,right:i.right,bottom:e}:i}function sc(i,e,t){let r,n,s,o,a=!1,l,c,h,u;for(let m=i.firstChild;m;m=m.nextSibling){let p=mn(m);for(let g=0;g<p.length;g++){let O=p[g];n&&Nl(n,O)&&(O=Od(yd(O,n.bottom),n.top));let y=Vb(e,O),x=$b(t,O);if(y==0&&x==0)return m.nodeType==3?bd(m,e,t):sc(m,e,t);if(!r||o>x||o==x&&s>y){r=m,n=O,s=y,o=x;let v=x?t<O.top?-1:1:y?e<O.left?-1:1:0;a=!v||(v>0?g<p.length-1:g>0)}y==0?t>O.bottom&&(!h||h.bottom<O.bottom)?(l=m,h=O):t<O.top&&(!u||u.top>O.top)&&(c=m,u=O):h&&Nl(h,O)?h=yd(h,O.bottom):u&&Nl(u,O)&&(u=Od(u,O.top))}}if(h&&h.bottom>=t?(r=l,n=h):u&&u.top<=t&&(r=c,n=u),!r)return{node:i,offset:0};let f=Math.max(n.left,Math.min(n.right,e));if(r.nodeType==3)return bd(r,f,t);if(a&&r.contentEditable!="false")return sc(r,f,t);let d=Array.prototype.indexOf.call(i.childNodes,r)+(e>=(n.left+n.right)/2?1:0);return{node:i,offset:d}}function bd(i,e,t){let r=i.nodeValue.length,n=-1,s=1e9,o=0;for(let a=0;a<r;a++){let l=Ri(i,a,a+1).getClientRects();for(let c=0;c<l.length;c++){let h=l[c];if(h.top==h.bottom)continue;o||(o=e-h.left);let u=(h.top>t?h.top-t:t-h.bottom)-1;if(h.left-1<=e&&h.right+1>=e&&u<s){let f=e>=(h.left+h.right)/2,d=f;if((Q.chrome||Q.gecko)&&Ri(i,a).getBoundingClientRect().left==h.right&&(d=!f),u<=0)return{node:i,offset:a+(d?1:0)};n=a+(d?1:0),s=u}}}return{node:i,offset:n>-1?n:o>0?i.nodeValue.length:0}}function Ap(i,e,t,r=-1){var n,s;let o=i.contentDOM.getBoundingClientRect(),a=o.top+i.viewState.paddingTop,l,{docHeight:c}=i.viewState,{x:h,y:u}=e,f=u-a;if(f<0)return 0;if(f>c)return i.state.doc.length;for(let v=i.viewState.heightOracle.textHeight/2,w=!1;l=i.elementAtHeight(f),l.type!=Le.Text;)for(;f=r>0?l.bottom+v:l.top-v,!(f>=0&&f<=c);){if(w)return t?null:0;w=!0,r=-r}u=a+f;let d=l.from;if(d<i.viewport.from)return i.viewport.from==0?0:t?null:wd(i,o,l,h,u);if(d>i.viewport.to)return i.viewport.to==i.state.doc.length?i.state.doc.length:t?null:wd(i,o,l,h,u);let m=i.dom.ownerDocument,p=i.root.elementFromPoint?i.root:m,g=p.elementFromPoint(h,u);g&&!i.contentDOM.contains(g)&&(g=null),g||(h=Math.max(o.left+1,Math.min(o.right-1,h)),g=p.elementFromPoint(h,u),g&&!i.contentDOM.contains(g)&&(g=null));let O,y=-1;if(g&&((n=i.docView.nearest(g))===null||n===void 0?void 0:n.isEditable)!=!1){if(m.caretPositionFromPoint){let v=m.caretPositionFromPoint(h,u);v&&({offsetNode:O,offset:y}=v)}else if(m.caretRangeFromPoint){let v=m.caretRangeFromPoint(h,u);v&&({startContainer:O,startOffset:y}=v,(!i.contentDOM.contains(O)||Q.safari&&Bb(O,y,h)||Q.chrome&&Xb(O,y,h))&&(O=void 0))}}if(!O||!i.docView.dom.contains(O)){let v=ve.find(i.docView,d);if(!v)return f>l.top+l.height/2?l.to:l.from;({node:O,offset:y}=sc(v.dom,h,u))}let x=i.docView.nearest(O);if(!x)return null;if(x.isWidget&&((s=x.dom)===null||s===void 0?void 0:s.nodeType)==1){let v=x.dom.getBoundingClientRect();return e.y<v.top||e.y<=v.bottom&&e.x<=(v.left+v.right)/2?x.posAtStart:x.posAtEnd}else return x.localPosFromDOM(O,y)+x.posAtStart}function wd(i,e,t,r,n){let s=Math.round((r-e.left)*i.defaultCharacterWidth);if(i.lineWrapping&&t.height>i.defaultLineHeight*1.5){let a=i.viewState.heightOracle.textHeight,l=Math.floor((n-t.top-(i.defaultLineHeight-a)*.5)/a);s+=l*i.viewState.heightOracle.lineLength}let o=i.state.sliceDoc(t.from,t.to);return t.from+Ns(o,s,i.state.tabSize)}function Bb(i,e,t){let r;if(i.nodeType!=3||e!=(r=i.nodeValue.length))return!1;for(let n=i.nextSibling;n;n=n.nextSibling)if(n.nodeType!=1||n.nodeName!="BR")return!1;return Ri(i,r-1,r).getBoundingClientRect().left>t}function Xb(i,e,t){if(e!=0)return!1;for(let n=i;;){let s=n.parentNode;if(!s||s.nodeType!=1||s.firstChild!=n)return!1;if(s.classList.contains("cm-line"))break;n=s}let r=i.nodeType==1?i.getBoundingClientRect():Ri(i,0,Math.max(i.nodeValue.length,1)).getBoundingClientRect();return t-r.left>5}function oc(i,e){let t=i.lineBlockAt(e);if(Array.isArray(t.type)){for(let r of t.type)if(r.to>e||r.to==e&&(r.to==t.to||r.type==Le.Text))return r}return t}function Nb(i,e,t,r){let n=oc(i,e.head),s=!r||n.type!=Le.Text||!(i.lineWrapping||n.widgetLineBreaks)?null:i.coordsAtPos(e.assoc<0&&e.head>n.from?e.head-1:e.head);if(s){let o=i.dom.getBoundingClientRect(),a=i.textDirectionAt(n.from),l=i.posAtCoords({x:t==(a==G.LTR)?o.right-1:o.left+1,y:(s.top+s.bottom)/2});if(l!=null)return T.cursor(l,t?-1:1)}return T.cursor(t?n.to:n.from,t?-1:1)}function vd(i,e,t,r){let n=i.state.doc.lineAt(e.head),s=i.bidiSpans(n),o=i.textDirectionAt(n.from);for(let a=e,l=null;;){let c=Pb(n,s,o,a,t),h=dp;if(!c){if(n.number==(t?i.state.doc.lines:1))return a;h=`
`,n=i.state.doc.line(n.number+(t?1:-1)),s=i.bidiSpans(n),c=i.visualLineSide(n,!t)}if(l){if(!l(h))return a}else{if(!r)return c;l=r(h)}a=c}}function jb(i,e,t){let r=i.state.charCategorizer(e),n=r(t);return s=>{let o=r(s);return n==H.Space&&(n=o),n==o}}function Ib(i,e,t,r){let n=e.head,s=t?1:-1;if(n==(t?i.state.doc.length:0))return T.cursor(n,e.assoc);let o=e.goalColumn,a,l=i.contentDOM.getBoundingClientRect(),c=i.coordsAtPos(n,e.assoc||-1),h=i.documentTop;if(c)o==null&&(o=c.left-l.left),a=s<0?c.top:c.bottom;else{let d=i.viewState.lineBlockAt(n);o==null&&(o=Math.min(l.right-l.left,i.defaultCharacterWidth*(n-d.from))),a=(s<0?d.top:d.bottom)+h}let u=l.left+o,f=r??i.viewState.heightOracle.textHeight>>1;for(let d=0;;d+=10){let m=a+(f+d)*s,p=Ap(i,{x:u,y:m},!1,s);if(m<l.top||m>l.bottom||(s<0?p<n:p>n)){let g=i.docView.coordsForChar(p),O=!g||m<g.top?-1:1;return T.cursor(p,O,void 0,o)}}}function Ks(i,e,t){for(;;){let r=0;for(let n of i)n.between(e-1,e+1,(s,o,a)=>{if(e>s&&e<o){let l=r||t||(e-s<o-e?-1:1);e=l<0?s:o,r=l}});if(!r)return e}}function jl(i,e,t){let r=Ks(i.state.facet(Xc).map(n=>n(i)),t.from,e.head>t.from?-1:1);return r==t.from?t:T.cursor(r,r<t.from?1:-1)}var ac=class{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,Q.safari&&e.contentDOM.addEventListener("input",()=>null),Q.gecko&&nw(e.contentDOM.ownerDocument)}handleEvent(e){!Yb(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||this.runHandlers(e.type,e)}runHandlers(e,t){let r=this.handlers[e];if(r){for(let n of r.observers)n(this.view,t);for(let n of r.handlers){if(t.defaultPrevented)break;if(n(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=Wb(e),r=this.handlers,n=this.view.contentDOM;for(let s in t)if(s!="scroll"){let o=!t[s].handlers.length,a=r[s];a&&o!=!a.handlers.length&&(n.removeEventListener(s,this.handleEvent),a=null),a||n.addEventListener(s,this.handleEvent,{passive:o})}for(let s in r)s!="scroll"&&!t[s]&&n.removeEventListener(s,this.handleEvent);this.handlers=t}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&e.keyCode!=27&&Mp.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),Q.android&&Q.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let t;return Q.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&((t=Qp.find(r=>r.keyCode==e.keyCode))&&!e.ctrlKey||zb.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey)?(this.pendingIOSKey=t||e,setTimeout(()=>this.flushIOSKey(),250),!0):(e.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(e){let t=this.pendingIOSKey;return!t||t.key=="Enter"&&e&&e.from<e.to&&/^\S+$/.test(e.insert.toString())?!1:(this.pendingIOSKey=void 0,ur(this.view.contentDOM,t.key,t.keyCode,t instanceof KeyboardEvent?t:void 0))}ignoreDuringComposition(e){return/^key/.test(e.type)?this.composing>0?!0:Q.safari&&!Q.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1:!1}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.view.observer.update(e),this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}};function xd(i,e){return(t,r)=>{try{return e.call(i,r,t)}catch(n){xe(t.state,n)}}}function Wb(i){let e=Object.create(null);function t(r){return e[r]||(e[r]={observers:[],handlers:[]})}for(let r of i){let n=r.spec;if(n&&n.domEventHandlers)for(let s in n.domEventHandlers){let o=n.domEventHandlers[s];o&&t(s).handlers.push(xd(r.value,o))}if(n&&n.domEventObservers)for(let s in n.domEventObservers){let o=n.domEventObservers[s];o&&t(s).observers.push(xd(r.value,o))}}for(let r in pt)t(r).handlers.push(pt[r]);for(let r in st)t(r).observers.push(st[r]);return e}var Qp=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],zb="dthko",Mp=[16,17,18,20,91,92,224,225],zs=6;function Us(i){return Math.max(0,i)*.7+8}function Ub(i,e){return Math.max(Math.abs(i.clientX-e.clientX),Math.abs(i.clientY-e.clientY))}var lc=class{constructor(e,t,r,n){this.view=e,this.startEvent=t,this.style=r,this.mustSelect=n,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParent=ub(e.contentDOM),this.atoms=e.state.facet(Xc).map(o=>o(e));let s=e.contentDOM.ownerDocument;s.addEventListener("mousemove",this.move=this.move.bind(this)),s.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(W.allowMultipleSelections)&&Fb(e,t),this.dragging=Gb(e,t)&&qp(t)==1?null:!1}start(e){this.dragging===!1&&this.select(e)}move(e){var t;if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&Ub(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let r=0,n=0,s=((t=this.scrollParent)===null||t===void 0?void 0:t.getBoundingClientRect())||{left:0,top:0,right:this.view.win.innerWidth,bottom:this.view.win.innerHeight},o=Ep(this.view);e.clientX-o.left<=s.left+zs?r=-Us(s.left-e.clientX):e.clientX+o.right>=s.right-zs&&(r=Us(e.clientX-s.right)),e.clientY-o.top<=s.top+zs?n=-Us(s.top-e.clientY):e.clientY+o.bottom>=s.bottom-zs&&(n=Us(e.clientY-s.bottom)),this.setScrollSpeed(r,n)}up(e){this.dragging==null&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,t){this.scrollSpeed={x:e,y:t},e||t?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){this.scrollParent?(this.scrollParent.scrollLeft+=this.scrollSpeed.x,this.scrollParent.scrollTop+=this.scrollSpeed.y):this.view.win.scrollBy(this.scrollSpeed.x,this.scrollSpeed.y),this.dragging===!1&&this.select(this.lastEvent)}skipAtoms(e){let t=null;for(let r=0;r<e.ranges.length;r++){let n=e.ranges[r],s=null;if(n.empty){let o=Ks(this.atoms,n.from,0);o!=n.from&&(s=T.cursor(o,-1))}else{let o=Ks(this.atoms,n.from,-1),a=Ks(this.atoms,n.to,1);(o!=n.from||a!=n.to)&&(s=T.range(n.from==n.anchor?o:a,n.from==n.head?o:a))}s&&(t||(t=e.ranges.slice()),t[r]=s)}return t?T.create(t,e.mainIndex):e}select(e){let{view:t}=this,r=this.skipAtoms(this.style.get(e,this.extend,this.multiple));(this.mustSelect||!r.eq(t.state.selection,this.dragging===!1))&&this.view.dispatch({selection:r,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(t=>t.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}};function Fb(i,e){let t=i.state.facet(pp);return t.length?t[0](e):Q.mac?e.metaKey:e.ctrlKey}function Hb(i,e){let t=i.state.facet(mp);return t.length?t[0](e):Q.mac?!e.altKey:!e.ctrlKey}function Gb(i,e){let{main:t}=i.state.selection;if(t.empty)return!1;let r=pn(i.root);if(!r||r.rangeCount==0)return!0;let n=r.getRangeAt(0).getClientRects();for(let s=0;s<n.length;s++){let o=n[s];if(o.left<=e.clientX&&o.right>=e.clientX&&o.top<=e.clientY&&o.bottom>=e.clientY)return!0}return!1}function Yb(i,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target,r;t!=i.contentDOM;t=t.parentNode)if(!t||t.nodeType==11||(r=ee.get(t))&&r.ignoreEvent(e))return!1;return!0}var pt=Object.create(null),st=Object.create(null),_p=Q.ie&&Q.ie_version<15||Q.ios&&Q.webkit_version<604;function Zb(i){let e=i.dom.parentNode;if(!e)return;let t=e.appendChild(document.createElement("textarea"));t.style.cssText="position: fixed; left: -10000px; top: 10px",t.focus(),setTimeout(()=>{i.focus(),t.remove(),Dp(i,t.value)},50)}function Dp(i,e){let{state:t}=i,r,n=1,s=t.toText(e),o=s.lines==t.selection.ranges.length;if(cc!=null&&t.selection.ranges.every(l=>l.empty)&&cc==s.toString()){let l=-1;r=t.changeByRange(c=>{let h=t.doc.lineAt(c.from);if(h.from==l)return{range:c};l=h.from;let u=t.toText((o?s.line(n++).text:e)+t.lineBreak);return{changes:{from:h.from,insert:u},range:T.cursor(c.from+u.length)}})}else o?r=t.changeByRange(l=>{let c=s.line(n++);return{changes:{from:l.from,to:l.to,insert:c.text},range:T.cursor(l.from+c.length)}}):r=t.replaceSelection(s);i.dispatch(r,{userEvent:"input.paste",scrollIntoView:!0})}st.scroll=i=>{i.inputState.lastScrollTop=i.scrollDOM.scrollTop,i.inputState.lastScrollLeft=i.scrollDOM.scrollLeft};pt.keydown=(i,e)=>(i.inputState.setSelectionOrigin("select"),e.keyCode==27&&i.inputState.tabFocusMode!=0&&(i.inputState.tabFocusMode=Date.now()+2e3),!1);st.touchstart=(i,e)=>{i.inputState.lastTouchTime=Date.now(),i.inputState.setSelectionOrigin("select.pointer")};st.touchmove=i=>{i.inputState.setSelectionOrigin("select.pointer")};pt.mousedown=(i,e)=>{if(i.observer.flush(),i.inputState.lastTouchTime>Date.now()-2e3)return!1;let t=null;for(let r of i.state.facet(gp))if(t=r(i,e),t)break;if(!t&&e.button==0&&(t=ew(i,e)),t){let r=!i.hasFocus;i.inputState.startMouseSelection(new lc(i,e,t,r)),r&&i.observer.ignore(()=>{Yd(i.contentDOM);let s=i.root.activeElement;s&&!s.contains(i.contentDOM)&&s.blur()});let n=i.inputState.mouseSelection;if(n)return n.start(e),n.dragging===!1}return!1};function Sd(i,e,t,r){if(r==1)return T.cursor(e,t);if(r==2)return qb(i.state,e,t);{let n=ve.find(i.docView,e),s=i.state.doc.lineAt(n?n.posAtEnd:e),o=n?n.posAtStart:s.from,a=n?n.posAtEnd:s.to;return a<i.state.doc.length&&a==s.to&&a++,T.range(o,a)}}var Lp=(i,e)=>i>=e.top&&i<=e.bottom,kd=(i,e,t)=>Lp(e,t)&&i>=t.left&&i<=t.right;function Jb(i,e,t,r){let n=ve.find(i.docView,e);if(!n)return 1;let s=e-n.posAtStart;if(s==0)return 1;if(s==n.length)return-1;let o=n.coordsAt(s,-1);if(o&&kd(t,r,o))return-1;let a=n.coordsAt(s,1);return a&&kd(t,r,a)?1:o&&Lp(r,o)?-1:1}function Td(i,e){let t=i.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:t,bias:Jb(i,t,e.clientX,e.clientY)}}var Kb=Q.ie&&Q.ie_version<=11,Pd=null,Cd=0,Ed=0;function qp(i){if(!Kb)return i.detail;let e=Pd,t=Ed;return Pd=i,Ed=Date.now(),Cd=!e||t>Date.now()-400&&Math.abs(e.clientX-i.clientX)<2&&Math.abs(e.clientY-i.clientY)<2?(Cd+1)%3:1}function ew(i,e){let t=Td(i,e),r=qp(e),n=i.state.selection;return{update(s){s.docChanged&&(t.pos=s.changes.mapPos(t.pos),n=n.map(s.changes))},get(s,o,a){let l=Td(i,s),c,h=Sd(i,l.pos,l.bias,r);if(t.pos!=l.pos&&!o){let u=Sd(i,t.pos,t.bias,r),f=Math.min(u.from,h.from),d=Math.max(u.to,h.to);h=f<h.from?T.range(f,d):T.range(d,f)}return o?n.replaceRange(n.main.extend(h.from,h.to)):a&&r==1&&n.ranges.length>1&&(c=tw(n,l.pos))?c:a?n.addRange(h):T.create([h])}}}function tw(i,e){for(let t=0;t<i.ranges.length;t++){let{from:r,to:n}=i.ranges[t];if(r<=e&&n>=e)return T.create(i.ranges.slice(0,t).concat(i.ranges.slice(t+1)),i.mainIndex==t?0:i.mainIndex-(i.mainIndex>t?1:0))}return null}pt.dragstart=(i,e)=>{let{selection:{main:t}}=i.state;if(e.target.draggable){let n=i.docView.nearest(e.target);if(n&&n.isWidget){let s=n.posAtStart,o=s+n.length;(s>=t.to||o<=t.from)&&(t=T.range(s,o))}}let{inputState:r}=i;return r.mouseSelection&&(r.mouseSelection.dragging=!0),r.draggedContent=t,e.dataTransfer&&(e.dataTransfer.setData("Text",i.state.sliceDoc(t.from,t.to)),e.dataTransfer.effectAllowed="copyMove"),!1};pt.dragend=i=>(i.inputState.draggedContent=null,!1);function Rd(i,e,t,r){if(!t)return;let n=i.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:s}=i.inputState,o=r&&s&&Hb(i,e)?{from:s.from,to:s.to}:null,a={from:n,insert:t},l=i.state.changes(o?[o,a]:a);i.focus(),i.dispatch({changes:l,selection:{anchor:l.mapPos(n,-1),head:l.mapPos(n,1)},userEvent:o?"move.drop":"input.drop"}),i.inputState.draggedContent=null}pt.drop=(i,e)=>{if(!e.dataTransfer)return!1;if(i.state.readOnly)return!0;let t=e.dataTransfer.files;if(t&&t.length){let r=Array(t.length),n=0,s=()=>{++n==t.length&&Rd(i,e,r.filter(o=>o!=null).join(i.state.lineBreak),!1)};for(let o=0;o<t.length;o++){let a=new FileReader;a.onerror=s,a.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(a.result)||(r[o]=a.result),s()},a.readAsText(t[o])}return!0}else{let r=e.dataTransfer.getData("Text");if(r)return Rd(i,e,r,!0),!0}return!1};pt.paste=(i,e)=>{if(i.state.readOnly)return!0;i.observer.flush();let t=_p?null:e.clipboardData;return t?(Dp(i,t.getData("text/plain")||t.getData("text/uri-list")),!0):(Zb(i),!1)};function iw(i,e){let t=i.dom.parentNode;if(!t)return;let r=t.appendChild(document.createElement("textarea"));r.style.cssText="position: fixed; left: -10000px; top: 10px",r.value=e,r.focus(),r.selectionEnd=e.length,r.selectionStart=0,setTimeout(()=>{r.remove(),i.focus()},50)}function rw(i){let e=[],t=[],r=!1;for(let n of i.selection.ranges)n.empty||(e.push(i.sliceDoc(n.from,n.to)),t.push(n));if(!e.length){let n=-1;for(let{from:s}of i.selection.ranges){let o=i.doc.lineAt(s);o.number>n&&(e.push(o.text),t.push({from:o.from,to:Math.min(i.doc.length,o.to+1)})),n=o.number}r=!0}return{text:e.join(i.lineBreak),ranges:t,linewise:r}}var cc=null;pt.copy=pt.cut=(i,e)=>{let{text:t,ranges:r,linewise:n}=rw(i.state);if(!t&&!n)return!1;cc=n?t:null,e.type=="cut"&&!i.state.readOnly&&i.dispatch({changes:r,scrollIntoView:!0,userEvent:"delete.cut"});let s=_p?null:e.clipboardData;return s?(s.clearData(),s.setData("text/plain",t),!0):(iw(i,t),!1)};var Vp=Be.define();function $p(i,e){let t=[];for(let r of i.facet(bp)){let n=r(i,e);n&&t.push(n)}return t?i.update({effects:t,annotations:Vp.of(!0)}):null}function Bp(i){setTimeout(()=>{let e=i.hasFocus;if(e!=i.inputState.notifiedFocused){let t=$p(i.state,e);t?i.dispatch(t):i.update([])}},10)}st.focus=i=>{i.inputState.lastFocusTime=Date.now(),!i.scrollDOM.scrollTop&&(i.inputState.lastScrollTop||i.inputState.lastScrollLeft)&&(i.scrollDOM.scrollTop=i.inputState.lastScrollTop,i.scrollDOM.scrollLeft=i.inputState.lastScrollLeft),Bp(i)};st.blur=i=>{i.observer.clearSelectionRange(),Bp(i)};st.compositionstart=st.compositionupdate=i=>{i.observer.editContext||(i.inputState.compositionFirstChange==null&&(i.inputState.compositionFirstChange=!0),i.inputState.composing<0&&(i.inputState.composing=0))};st.compositionend=i=>{i.observer.editContext||(i.inputState.composing=-1,i.inputState.compositionEndedAt=Date.now(),i.inputState.compositionPendingKey=!0,i.inputState.compositionPendingChange=i.observer.pendingRecords().length>0,i.inputState.compositionFirstChange=null,Q.chrome&&Q.android?i.observer.flushSoon():i.inputState.compositionPendingChange?Promise.resolve().then(()=>i.observer.flush()):setTimeout(()=>{i.inputState.composing<0&&i.docView.hasComposition&&i.update([])},50))};st.contextmenu=i=>{i.inputState.lastContextMenu=Date.now()};pt.beforeinput=(i,e)=>{var t;let r;if(Q.chrome&&Q.android&&(r=Qp.find(n=>n.inputType==e.inputType))&&(i.observer.delayAndroidKey(r.key,r.keyCode),r.key=="Backspace"||r.key=="Delete")){let n=((t=window.visualViewport)===null||t===void 0?void 0:t.height)||0;setTimeout(()=>{var s;(((s=window.visualViewport)===null||s===void 0?void 0:s.height)||0)>n+10&&i.hasFocus&&(i.contentDOM.blur(),i.focus())},100)}return Q.ios&&e.inputType=="deleteContentForward"&&i.observer.flushSoon(),Q.safari&&e.inputType=="insertText"&&i.inputState.composing>=0&&setTimeout(()=>st.compositionend(i,e),20),!1};var Ad=new Set;function nw(i){Ad.has(i)||(Ad.add(i),i.addEventListener("copy",()=>{}),i.addEventListener("cut",()=>{}))}var Qd=["pre-wrap","normal","pre-line","break-spaces"],hc=class{constructor(e){this.lineWrapping=e,this.doc=j.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30,this.heightChanged=!1}heightForGap(e,t){let r=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(r+=Math.max(0,Math.ceil((t-e-r*this.lineLength*.5)/this.lineLength))),this.lineHeight*r}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/(this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return Qd.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let r=0;r<e.length;r++){let n=e[r];n<0?r++:this.heightSamples[Math.floor(n*10)]||(t=!0,this.heightSamples[Math.floor(n*10)]=!0)}return t}refresh(e,t,r,n,s,o){let a=Qd.indexOf(e)>-1,l=Math.round(t)!=Math.round(this.lineHeight)||this.lineWrapping!=a;if(this.lineWrapping=a,this.lineHeight=t,this.charWidth=r,this.textHeight=n,this.lineLength=s,l){this.heightSamples={};for(let c=0;c<o.length;c++){let h=o[c];h<0?c++:this.heightSamples[Math.floor(h*10)]=!0}}return l}},uc=class{constructor(e,t){this.from=e,this.heights=t,this.index=0}get more(){return this.index<this.heights.length}},xt=class i{constructor(e,t,r,n,s){this.from=e,this.length=t,this.top=r,this.height=n,this._content=s}get type(){return typeof this._content=="number"?Le.Text:Array.isArray(this._content)?this._content:this._content.type}get to(){return this.from+this.length}get bottom(){return this.top+this.height}get widget(){return this._content instanceof ii?this._content.widget:null}get widgetLineBreaks(){return typeof this._content=="number"?this._content:0}join(e){let t=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(e._content)?e._content:[e]);return new i(this.from,this.length+e.length,this.top,this.height+e.height,t)}},te=function(i){return i[i.ByPos=0]="ByPos",i[i.ByHeight=1]="ByHeight",i[i.ByPosNoHeight=2]="ByPosNoHeight",i}(te||(te={})),eo=.001,Fe=class i{constructor(e,t,r=2){this.length=e,this.height=t,this.flags=r}get outdated(){return(this.flags&2)>0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e,t){this.height!=t&&(Math.abs(this.height-t)>eo&&(e.heightChanged=!0),this.height=t)}replace(e,t,r){return i.of(r)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,r,n){let s=this,o=r.doc;for(let a=n.length-1;a>=0;a--){let{fromA:l,toA:c,fromB:h,toB:u}=n[a],f=s.lineAt(l,te.ByPosNoHeight,r.setDoc(t),0,0),d=f.to>=c?f:s.lineAt(c,te.ByPosNoHeight,r,0,0);for(u+=d.to-c,c=d.to;a>0&&f.from<=n[a-1].toA;)l=n[a-1].fromA,h=n[a-1].fromB,a--,l<f.from&&(f=s.lineAt(l,te.ByPosNoHeight,r,0,0));h+=f.from-l,l=f.from;let m=dc.build(r.setDoc(o),e,h,u);s=s.replace(l,c,m)}return s.updateHeight(r,0)}static empty(){return new nt(0,0)}static of(e){if(e.length==1)return e[0];let t=0,r=e.length,n=0,s=0;for(;;)if(t==r)if(n>s*2){let a=e[t-1];a.break?e.splice(--t,1,a.left,null,a.right):e.splice(--t,1,a.left,a.right),r+=1+a.break,n-=a.size}else if(s>n*2){let a=e[r];a.break?e.splice(r,1,a.left,null,a.right):e.splice(r,1,a.left,a.right),r+=2+a.break,s-=a.size}else break;else if(n<s){let a=e[t++];a&&(n+=a.size)}else{let a=e[--r];a&&(s+=a.size)}let o=0;return e[t-1]==null?(o=1,t--):e[t]==null&&(o=1,r++),new fc(i.of(e.slice(0,t)),o,i.of(e.slice(r)))}};Fe.prototype.size=1;var ho=class extends Fe{constructor(e,t,r){super(e,t),this.deco=r}blockAt(e,t,r,n){return new xt(n,this.length,r,this.height,this.deco||0)}lineAt(e,t,r,n,s){return this.blockAt(0,r,n,s)}forEachLine(e,t,r,n,s,o){e<=s+this.length&&t>=s&&o(this.blockAt(0,r,n,s))}updateHeight(e,t=0,r=!1,n){return n&&n.from<=t&&n.more&&this.setHeight(e,n.heights[n.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}},nt=class i extends ho{constructor(e,t){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(e,t,r,n){return new xt(n,this.length,r,this.height,this.breaks)}replace(e,t,r){let n=r[0];return r.length==1&&(n instanceof i||n instanceof ei&&n.flags&4)&&Math.abs(this.length-n.length)<10?(n instanceof ei?n=new i(n.length,this.height):n.height=this.height,this.outdated||(n.outdated=!1),n):Fe.of(r)}updateHeight(e,t=0,r=!1,n){return n&&n.from<=t&&n.more?this.setHeight(e,n.heights[n.index++]):(r||this.outdated)&&this.setHeight(e,Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}},ei=class i extends Fe{constructor(e){super(e,0)}heightMetrics(e,t){let r=e.doc.lineAt(t).number,n=e.doc.lineAt(t+this.length).number,s=n-r+1,o,a=0;if(e.lineWrapping){let l=Math.min(this.height,e.lineHeight*s);o=l/s,this.length>s+1&&(a=(this.height-l)/(this.length-s-1))}else o=this.height/s;return{firstLine:r,lastLine:n,perLine:o,perChar:a}}blockAt(e,t,r,n){let{firstLine:s,lastLine:o,perLine:a,perChar:l}=this.heightMetrics(t,n);if(t.lineWrapping){let c=n+(e<t.lineHeight?0:Math.round(Math.max(0,Math.min(1,(e-r)/this.height))*this.length)),h=t.doc.lineAt(c),u=a+h.length*l,f=Math.max(r,e-u/2);return new xt(h.from,h.length,f,u,0)}else{let c=Math.max(0,Math.min(o-s,Math.floor((e-r)/a))),{from:h,length:u}=t.doc.line(s+c);return new xt(h,u,r+a*c,a,0)}}lineAt(e,t,r,n,s){if(t==te.ByHeight)return this.blockAt(e,r,n,s);if(t==te.ByPosNoHeight){let{from:d,to:m}=r.doc.lineAt(e);return new xt(d,m-d,0,0,0)}let{firstLine:o,perLine:a,perChar:l}=this.heightMetrics(r,s),c=r.doc.lineAt(e),h=a+c.length*l,u=c.number-o,f=n+a*u+l*(c.from-s-u);return new xt(c.from,c.length,Math.max(n,Math.min(f,n+this.height-h)),h,0)}forEachLine(e,t,r,n,s,o){e=Math.max(e,s),t=Math.min(t,s+this.length);let{firstLine:a,perLine:l,perChar:c}=this.heightMetrics(r,s);for(let h=e,u=n;h<=t;){let f=r.doc.lineAt(h);if(h==e){let m=f.number-a;u+=l*m+c*(e-s-m)}let d=l+c*f.length;o(new xt(f.from,f.length,u,d,0)),u+=d,h=f.to+1}}replace(e,t,r){let n=this.length-t;if(n>0){let s=r[r.length-1];s instanceof i?r[r.length-1]=new i(s.length+n):r.push(null,new i(n-1))}if(e>0){let s=r[0];s instanceof i?r[0]=new i(e+s.length):r.unshift(new i(e-1),null)}return Fe.of(r)}decomposeLeft(e,t){t.push(new i(e-1),null)}decomposeRight(e,t){t.push(null,new i(this.length-e-1))}updateHeight(e,t=0,r=!1,n){let s=t+this.length;if(n&&n.from<=t+this.length&&n.more){let o=[],a=Math.max(t,n.from),l=-1;for(n.from>t&&o.push(new i(n.from-t-1).updateHeight(e,t));a<=s&&n.more;){let h=e.doc.lineAt(a).length;o.length&&o.push(null);let u=n.heights[n.index++];l==-1?l=u:Math.abs(u-l)>=eo&&(l=-2);let f=new nt(h,u);f.outdated=!1,o.push(f),a+=h+1}a<=s&&o.push(null,new i(s-a).updateHeight(e,a));let c=Fe.of(o);return(l<0||Math.abs(c.height-this.height)>=eo||Math.abs(l-this.heightMetrics(e,t).perLine)>=eo)&&(e.heightChanged=!0),c}else(r||this.outdated)&&(this.setHeight(e,e.heightForGap(t,t+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}},fc=class extends Fe{constructor(e,t,r){super(e.length+t+r.length,e.height+r.height,t|(e.outdated||r.outdated?2:0)),this.left=e,this.right=r,this.size=e.size+r.size}get break(){return this.flags&1}blockAt(e,t,r,n){let s=r+this.left.height;return e<s?this.left.blockAt(e,t,r,n):this.right.blockAt(e,t,s,n+this.left.length+this.break)}lineAt(e,t,r,n,s){let o=n+this.left.height,a=s+this.left.length+this.break,l=t==te.ByHeight?e<o:e<a,c=l?this.left.lineAt(e,t,r,n,s):this.right.lineAt(e,t,r,o,a);if(this.break||(l?c.to<a:c.from>a))return c;let h=t==te.ByPosNoHeight?te.ByPosNoHeight:te.ByPos;return l?c.join(this.right.lineAt(a,h,r,o,a)):this.left.lineAt(a,h,r,n,s).join(c)}forEachLine(e,t,r,n,s,o){let a=n+this.left.height,l=s+this.left.length+this.break;if(this.break)e<l&&this.left.forEachLine(e,t,r,n,s,o),t>=l&&this.right.forEachLine(e,t,r,a,l,o);else{let c=this.lineAt(l,te.ByPos,r,n,s);e<c.from&&this.left.forEachLine(e,c.from-1,r,n,s,o),c.to>=e&&c.from<=t&&o(c),t>c.to&&this.right.forEachLine(c.to+1,t,r,a,l,o)}}replace(e,t,r){let n=this.left.length+this.break;if(t<n)return this.balanced(this.left.replace(e,t,r),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-n,t-n,r));let s=[];e>0&&this.decomposeLeft(e,s);let o=s.length;for(let a of r)s.push(a);if(e>0&&Md(s,o-1),t<this.length){let a=s.length;this.decomposeRight(t,s),Md(s,a)}return Fe.of(s)}decomposeLeft(e,t){let r=this.left.length;if(e<=r)return this.left.decomposeLeft(e,t);t.push(this.left),this.break&&(r++,e>=r&&t.push(null)),e>r&&this.right.decomposeLeft(e-r,t)}decomposeRight(e,t){let r=this.left.length,n=r+this.break;if(e>=n)return this.right.decomposeRight(e-n,t);e<r&&this.left.decomposeRight(e,t),this.break&&e<n&&t.push(null),t.push(this.right)}balanced(e,t){return e.size>2*t.size||t.size>2*e.size?Fe.of(this.break?[e,null,t]:[e,t]):(this.left=e,this.right=t,this.height=e.height+t.height,this.outdated=e.outdated||t.outdated,this.size=e.size+t.size,this.length=e.length+this.break+t.length,this)}updateHeight(e,t=0,r=!1,n){let{left:s,right:o}=this,a=t+s.length+this.break,l=null;return n&&n.from<=t+s.length&&n.more?l=s=s.updateHeight(e,t,r,n):s.updateHeight(e,t,r),n&&n.from<=a+o.length&&n.more?l=o=o.updateHeight(e,a,r,n):o.updateHeight(e,a,r),l?this.balanced(s,o):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}};function Md(i,e){let t,r;i[e]==null&&(t=i[e-1])instanceof ei&&(r=i[e+1])instanceof ei&&i.splice(e-1,3,new ei(t.length+1+r.length))}var sw=5,dc=class i{constructor(e,t){this.pos=e,this.oracle=t,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,t){if(this.lineStart>-1){let r=Math.min(t,this.lineEnd),n=this.nodes[this.nodes.length-1];n instanceof nt?n.length+=r-this.pos:(r>this.pos||!this.isCovered)&&this.nodes.push(new nt(r-this.pos,-1)),this.writtenTo=r,t>r&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=t}point(e,t,r){if(e<t||r.heightRelevant){let n=r.widget?r.widget.estimatedHeight:0,s=r.widget?r.widget.lineBreaks:0;n<0&&(n=this.oracle.lineHeight);let o=t-e;r.block?this.addBlock(new ho(o,n,r)):(o||s||n>=sw)&&this.addLineDeco(n,s,o)}else t>e&&this.span(e,t);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}enterLine(){if(this.lineStart>-1)return;let{from:e,to:t}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=t,this.writtenTo<e&&((this.writtenTo<e-1||this.nodes[this.nodes.length-1]==null)&&this.nodes.push(this.blankContent(this.writtenTo,e-1)),this.nodes.push(null)),this.pos>e&&this.nodes.push(new nt(this.pos-e,-1)),this.writtenTo=this.pos}blankContent(e,t){let r=new ei(t-e);return this.oracle.doc.lineAt(e).to==t&&(r.flags|=4),r}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof nt)return e;let t=new nt(0,-1);return this.nodes.push(t),t}addBlock(e){this.enterLine();let t=e.deco;t&&t.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,t&&t.endSide>0&&(this.covering=e)}addLineDeco(e,t,r){let n=this.ensureLine();n.length+=r,n.collapsed+=r,n.widgetHeight=Math.max(n.widgetHeight,e),n.breaks+=t,this.writtenTo=this.pos=this.pos+r}finish(e){let t=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(t instanceof nt)&&!this.isCovered?this.nodes.push(new nt(0,-1)):(this.writtenTo<this.pos||t==null)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos));let r=e;for(let n of this.nodes)n instanceof nt&&n.updateHeight(this.oracle,r),r+=n?n.length:1;return this.nodes}static build(e,t,r,n){let s=new i(r,e);return z.spans(t,r,n,s,0),s.finish(r)}};function ow(i,e,t){let r=new pc;return z.compare(i,e,t,r,0),r.changes}var pc=class{constructor(){this.changes=[]}compareRange(){}comparePoint(e,t,r,n){(e<t||r&&r.heightRelevant||n&&n.heightRelevant)&&ec(e,t,this.changes,5)}};function aw(i,e){let t=i.getBoundingClientRect(),r=i.ownerDocument,n=r.defaultView||window,s=Math.max(0,t.left),o=Math.min(n.innerWidth,t.right),a=Math.max(0,t.top),l=Math.min(n.innerHeight,t.bottom);for(let c=i.parentNode;c&&c!=r.body;)if(c.nodeType==1){let h=c,u=window.getComputedStyle(h);if((h.scrollHeight>h.clientHeight||h.scrollWidth>h.clientWidth)&&u.overflow!="visible"){let f=h.getBoundingClientRect();s=Math.max(s,f.left),o=Math.min(o,f.right),a=Math.max(a,f.top),l=c==i.parentNode?f.bottom:Math.min(l,f.bottom)}c=u.position=="absolute"||u.position=="fixed"?h.offsetParent:h.parentNode}else if(c.nodeType==11)c=c.host;else break;return{left:s-t.left,right:Math.max(s,o)-t.left,top:a-(t.top+e),bottom:Math.max(a,l)-(t.top+e)}}function lw(i,e){let t=i.getBoundingClientRect();return{left:0,right:t.right-t.left,top:e,bottom:t.bottom-(t.top+e)}}var un=class{constructor(e,t,r){this.from=e,this.to=t,this.size=r}static same(e,t){if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++){let n=e[r],s=t[r];if(n.from!=s.from||n.to!=s.to||n.size!=s.size)return!1}return!0}draw(e,t){return M.replace({widget:new mc(this.size*(t?e.scaleY:e.scaleX),t)}).range(this.from,this.to)}},mc=class extends Ne{constructor(e,t){super(),this.size=e,this.vertical=t}eq(e){return e.size==this.size&&e.vertical==this.vertical}toDOM(){let e=document.createElement("div");return this.vertical?e.style.height=this.size+"px":(e.style.width=this.size+"px",e.style.height="2px",e.style.display="inline-block"),e}get estimatedHeight(){return this.vertical?this.size:-1}},uo=class{constructor(e){this.state=e,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scrollTop=0,this.scrolledToBottom=!1,this.scaleX=1,this.scaleY=1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=_d,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=G.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let t=e.facet(Bc).some(r=>typeof r!="function"&&r.class=="cm-lineWrapping");this.heightOracle=new hc(t),this.stateDeco=e.facet(wn).filter(r=>typeof r!="function"),this.heightMap=Fe.empty().applyChanges(this.stateDeco,j.empty,this.heightOracle.setDoc(e.doc),[new kt(0,0,0,e.doc.length)]);for(let r=0;r<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());r++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=M.set(this.lineGaps.map(r=>r.draw(this,!1))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let r=0;r<=1;r++){let n=r?t.head:t.anchor;if(!e.some(({from:s,to:o})=>n>=s&&n<=o)){let{from:s,to:o}=this.lineBlockAt(n);e.push(new lr(s,o))}}return this.viewports=e.sort((r,n)=>r.from-n.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?_d:new gc(this.heightOracle,this.heightMap,this.viewports),e.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push(nn(e,this.scaler))})}update(e,t=null){this.state=e.state;let r=this.stateDeco;this.stateDeco=this.state.facet(wn).filter(h=>typeof h!="function");let n=e.changedRanges,s=kt.extendWithRanges(n,ow(r,this.stateDeco,e?e.changes:Me.empty(this.state.doc.length))),o=this.heightMap.height,a=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),s),this.heightMap.height!=o&&(e.flags|=2),a?(this.scrollAnchorPos=e.changes.mapPos(a.from,-1),this.scrollAnchorHeight=a.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=this.heightMap.height);let l=s.length?this.mapViewport(this.viewport,e.changes):this.viewport;(t&&(t.range.head<l.from||t.range.head>l.to)||!this.viewportIsAppropriate(l))&&(l=this.getViewport(0,t));let c=l.from!=this.viewport.from||l.to!=this.viewport.to;this.viewport=l,e.flags|=this.updateForViewport(),(c||!e.changes.empty||e.flags&2)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(),t&&(this.scrollTarget=t),!this.mustEnforceCursorAssoc&&e.selectionSet&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(vp)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let t=e.contentDOM,r=window.getComputedStyle(t),n=this.heightOracle,s=r.whiteSpace;this.defaultTextDirection=r.direction=="rtl"?G.RTL:G.LTR;let o=this.heightOracle.mustRefreshForWrapping(s),a=t.getBoundingClientRect(),l=o||this.mustMeasureContent||this.contentDOMHeight!=a.height;this.contentDOMHeight=a.height,this.mustMeasureContent=!1;let c=0,h=0;if(a.width&&a.height){let{scaleX:v,scaleY:w}=Gd(t,a);(v>.005&&Math.abs(this.scaleX-v)>.005||w>.005&&Math.abs(this.scaleY-w)>.005)&&(this.scaleX=v,this.scaleY=w,c|=8,o=l=!0)}let u=(parseInt(r.paddingTop)||0)*this.scaleY,f=(parseInt(r.paddingBottom)||0)*this.scaleY;(this.paddingTop!=u||this.paddingBottom!=f)&&(this.paddingTop=u,this.paddingBottom=f,c|=10),this.editorWidth!=e.scrollDOM.clientWidth&&(n.lineWrapping&&(l=!0),this.editorWidth=e.scrollDOM.clientWidth,c|=8);let d=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=d&&(this.scrollAnchorHeight=-1,this.scrollTop=d),this.scrolledToBottom=Jd(e.scrollDOM);let m=(this.printing?lw:aw)(t,this.paddingTop),p=m.top-this.pixelViewport.top,g=m.bottom-this.pixelViewport.bottom;this.pixelViewport=m;let O=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(O!=this.inView&&(this.inView=O,O&&(l=!0)),!this.inView&&!this.scrollTarget)return 0;let y=a.width;if((this.contentDOMWidth!=y||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=a.width,this.editorHeight=e.scrollDOM.clientHeight,c|=8),l){let v=e.docView.measureVisibleLineHeights(this.viewport);if(n.mustRefreshForHeights(v)&&(o=!0),o||n.lineWrapping&&Math.abs(y-this.contentDOMWidth)>n.charWidth){let{lineHeight:w,charWidth:P,textHeight:C}=e.docView.measureTextSize();o=w>0&&n.refresh(s,w,P,C,y/P,v),o&&(e.docView.minWidth=0,c|=8)}p>0&&g>0?h=Math.max(p,g):p<0&&g<0&&(h=Math.min(p,g)),n.heightChanged=!1;for(let w of this.viewports){let P=w.from==this.viewport.from?v:e.docView.measureVisibleLineHeights(w);this.heightMap=(o?Fe.empty().applyChanges(this.stateDeco,j.empty,this.heightOracle,[new kt(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(n,0,o,new uc(w.from,P))}n.heightChanged&&(c|=2)}let x=!this.viewportIsAppropriate(this.viewport,h)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return x&&(c&2&&(c|=this.updateScaler()),this.viewport=this.getViewport(h,this.scrollTarget),c|=this.updateForViewport()),(c&2||x)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,e)),c|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),c}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,t){let r=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),n=this.heightMap,s=this.heightOracle,{visibleTop:o,visibleBottom:a}=this,l=new lr(n.lineAt(o-r*1e3,te.ByHeight,s,0,0).from,n.lineAt(a+(1-r)*1e3,te.ByHeight,s,0,0).to);if(t){let{head:c}=t.range;if(c<l.from||c>l.to){let h=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),u=n.lineAt(c,te.ByPos,s,0,0),f;t.y=="center"?f=(u.top+u.bottom)/2-h/2:t.y=="start"||t.y=="nearest"&&c<l.from?f=u.top:f=u.bottom-h,l=new lr(n.lineAt(f-1e3/2,te.ByHeight,s,0,0).from,n.lineAt(f+h+1e3/2,te.ByHeight,s,0,0).to)}}return l}mapViewport(e,t){let r=t.mapPos(e.from,-1),n=t.mapPos(e.to,1);return new lr(this.heightMap.lineAt(r,te.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(n,te.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:t},r=0){if(!this.inView)return!0;let{top:n}=this.heightMap.lineAt(e,te.ByPos,this.heightOracle,0,0),{bottom:s}=this.heightMap.lineAt(t,te.ByPos,this.heightOracle,0,0),{visibleTop:o,visibleBottom:a}=this;return(e==0||n<=o-Math.max(10,Math.min(-r,250)))&&(t==this.state.doc.length||s>=a+Math.max(10,Math.min(r,250)))&&n>o-2*1e3&&s<a+2*1e3}mapLineGaps(e,t){if(!e.length||t.empty)return e;let r=[];for(let n of e)t.touchesRange(n.from,n.to)||r.push(new un(t.mapPos(n.from),t.mapPos(n.to),n.size));return r}ensureLineGaps(e,t){let r=this.heightOracle.lineWrapping,n=r?1e4:2e3,s=n>>1,o=n<<1;if(this.defaultTextDirection!=G.LTR&&!r)return[];let a=[],l=(h,u,f,d)=>{if(u-h<s)return;let m=this.state.selection.main,p=[m.from];m.empty||p.push(m.to);for(let O of p)if(O>h&&O<u){l(h,O-10,f,d),l(O+10,u,f,d);return}let g=hw(e,O=>O.from>=f.from&&O.to<=f.to&&Math.abs(O.from-h)<s&&Math.abs(O.to-u)<s&&!p.some(y=>O.from<y&&O.to>y));if(!g){if(u<f.to&&t&&r&&t.visibleRanges.some(O=>O.from<=u&&O.to>=u)){let O=t.moveToLineBoundary(T.cursor(u),!1,!0).head;O>h&&(u=O)}g=new un(h,u,this.gapSize(f,h,u,d))}a.push(g)},c=h=>{if(h.length<o||h.type!=Le.Text)return;let u=cw(h.from,h.to,this.stateDeco);if(u.total<o)return;let f=this.scrollTarget?this.scrollTarget.range.head:null,d,m;if(r){let p=n/this.heightOracle.lineLength*this.heightOracle.lineHeight,g,O;if(f!=null){let y=Hs(u,f),x=((this.visibleBottom-this.visibleTop)/2+p)/h.height;g=y-x,O=y+x}else g=(this.visibleTop-h.top-p)/h.height,O=(this.visibleBottom-h.top+p)/h.height;d=Fs(u,g),m=Fs(u,O)}else{let p=u.total*this.heightOracle.charWidth,g=n*this.heightOracle.charWidth,O,y;if(f!=null){let x=Hs(u,f),v=((this.pixelViewport.right-this.pixelViewport.left)/2+g)/p;O=x-v,y=x+v}else O=(this.pixelViewport.left-g)/p,y=(this.pixelViewport.right+g)/p;d=Fs(u,O),m=Fs(u,y)}d>h.from&&l(h.from,d,h,u),m<h.to&&l(m,h.to,h,u)};for(let h of this.viewportLines)Array.isArray(h.type)?h.type.forEach(c):c(h);return a}gapSize(e,t,r,n){let s=Hs(n,r)-Hs(n,t);return this.heightOracle.lineWrapping?e.height*s:n.total*this.heightOracle.charWidth*s}updateLineGaps(e){un.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=M.set(e.map(t=>t.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(){let e=this.stateDeco;this.lineGaps.length&&(e=e.concat(this.lineGapDeco));let t=[];z.spans(e,this.viewport.from,this.viewport.to,{span(n,s){t.push({from:n,to:s})},point(){}},20);let r=t.length!=this.visibleRanges.length||this.visibleRanges.some((n,s)=>n.from!=t[s].from||n.to!=t[s].to);return this.visibleRanges=t,r?4:0}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(t=>t.from<=e&&t.to>=e)||nn(this.heightMap.lineAt(e,te.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(t=>t.top<=e&&t.bottom>=e)||nn(this.heightMap.lineAt(this.scaler.fromDOM(e),te.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(e){let t=this.lineBlockAtHeight(e+8);return t.from>=this.viewport.from||this.viewportLines[0].top-e>200?t:this.viewportLines[0]}elementAtHeight(e){return nn(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}},lr=class{constructor(e,t){this.from=e,this.to=t}};function cw(i,e,t){let r=[],n=i,s=0;return z.spans(t,i,e,{span(){},point(o,a){o>n&&(r.push({from:n,to:o}),s+=o-n),n=a}},20),n<e&&(r.push({from:n,to:e}),s+=e-n),{total:s,ranges:r}}function Fs({total:i,ranges:e},t){if(t<=0)return e[0].from;if(t>=1)return e[e.length-1].to;let r=Math.floor(i*t);for(let n=0;;n++){let{from:s,to:o}=e[n],a=o-s;if(r<=a)return s+r;r-=a}}function Hs(i,e){let t=0;for(let{from:r,to:n}of i.ranges){if(e<=n){t+=e-r;break}t+=n-r}return t/i.total}function hw(i,e){for(let t of i)if(e(t))return t}var _d={toDOM(i){return i},fromDOM(i){return i},scale:1,eq(i){return i==this}},gc=class i{constructor(e,t,r){let n=0,s=0,o=0;this.viewports=r.map(({from:a,to:l})=>{let c=t.lineAt(a,te.ByPos,e,0,0).top,h=t.lineAt(l,te.ByPos,e,0,0).bottom;return n+=h-c,{from:a,to:l,top:c,bottom:h,domTop:0,domBottom:0}}),this.scale=(7e6-n)/(t.height-n);for(let a of this.viewports)a.domTop=o+(a.top-s)*this.scale,o=a.domBottom=a.domTop+(a.bottom-a.top),s=a.bottom}toDOM(e){for(let t=0,r=0,n=0;;t++){let s=t<this.viewports.length?this.viewports[t]:null;if(!s||e<s.top)return n+(e-r)*this.scale;if(e<=s.bottom)return s.domTop+(e-s.top);r=s.bottom,n=s.domBottom}}fromDOM(e){for(let t=0,r=0,n=0;;t++){let s=t<this.viewports.length?this.viewports[t]:null;if(!s||e<s.domTop)return r+(e-n)/this.scale;if(e<=s.domBottom)return s.top+(e-s.domTop);r=s.bottom,n=s.domBottom}}eq(e){return e instanceof i?this.scale==e.scale&&this.viewports.length==e.viewports.length&&this.viewports.every((t,r)=>t.from==e.viewports[r].from&&t.to==e.viewports[r].to):!1}};function nn(i,e){if(e.scale==1)return i;let t=e.toDOM(i.top),r=e.toDOM(i.bottom);return new xt(i.from,i.length,t,r-t,Array.isArray(i._content)?i._content.map(n=>nn(n,e)):i._content)}var Gs=A.define({combine:i=>i.join(" ")}),Oc=A.define({combine:i=>i.indexOf(!0)>-1}),yc=rt.newName(),Xp=rt.newName(),Np=rt.newName(),jp={"&light":"."+Xp,"&dark":"."+Np};function bc(i,e,t){return new rt(e,{finish(r){return/&/.test(r)?r.replace(/&\w*/,n=>{if(n=="&")return i;if(!t||!t[n])throw new RangeError(`Unsupported selector: ${n}`);return t[n]}):i+" "+r}})}var uw=bc("."+yc,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#444"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",insetInlineStart:0,zIndex:200},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",borderRight:"1px solid #ddd"},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top"},".cm-highlightSpace:before":{content:"attr(data-display)",position:"absolute",pointerEvents:"none",color:"#888"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},jp),sn="\uFFFF",wc=class{constructor(e,t){this.points=e,this.text="",this.lineSeparator=t.facet(W.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=sn}readRange(e,t){if(!e)return this;let r=e.parentNode;for(let n=e;;){this.findPointBefore(r,n);let s=this.text.length;this.readNode(n);let o=n.nextSibling;if(o==t)break;let a=ee.get(n),l=ee.get(o);(a&&l?a.breakAfter:(a?a.breakAfter:no(n))||no(o)&&(n.nodeName!="BR"||n.cmIgnore)&&this.text.length>s)&&this.lineBreak(),n=o}return this.findPointBefore(r,t),this}readTextNode(e){let t=e.nodeValue;for(let r of this.points)r.node==e&&(r.pos=this.text.length+Math.min(r.offset,t.length));for(let r=0,n=this.lineSeparator?null:/\r\n?|\n/g;;){let s=-1,o=1,a;if(this.lineSeparator?(s=t.indexOf(this.lineSeparator,r),o=this.lineSeparator.length):(a=n.exec(t))&&(s=a.index,o=a[0].length),this.append(t.slice(r,s<0?t.length:s)),s<0)break;if(this.lineBreak(),o>1)for(let l of this.points)l.node==e&&l.pos>this.text.length&&(l.pos-=o-1);r=s+o}}readNode(e){if(e.cmIgnore)return;let t=ee.get(e),r=t&&t.overrideDOMText;if(r!=null){this.findPointInside(e,r.length);for(let n=r.iter();!n.next().done;)n.lineBreak?this.lineBreak():this.append(n.value)}else e.nodeType==3?this.readTextNode(e):e.nodeName=="BR"?e.nextSibling&&this.lineBreak():e.nodeType==1&&this.readRange(e.firstChild,null)}findPointBefore(e,t){for(let r of this.points)r.node==e&&e.childNodes[r.offset]==t&&(r.pos=this.text.length)}findPointInside(e,t){for(let r of this.points)(e.nodeType==3?r.node==e:e.contains(r.node))&&(r.pos=this.text.length+(fw(e,r.node,r.offset)?t:0))}};function fw(i,e,t){for(;;){if(!e||t<jt(e))return!1;if(e==i)return!0;t=Ei(e)+1,e=e.parentNode}}var fo=class{constructor(e,t){this.node=e,this.offset=t,this.pos=-1}},vc=class{constructor(e,t,r,n){this.typeOver=n,this.bounds=null,this.text="",this.domChanged=t>-1;let{impreciseHead:s,impreciseAnchor:o}=e.docView;if(e.state.readOnly&&t>-1)this.newSel=null;else if(t>-1&&(this.bounds=e.docView.domBoundsAround(t,r,0))){let a=s||o?[]:mw(e),l=new wc(a,e.state);l.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=l.text,this.newSel=gw(a,this.bounds.from)}else{let a=e.observer.selectionRange,l=s&&s.node==a.focusNode&&s.offset==a.focusOffset||!Fl(e.contentDOM,a.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(a.focusNode,a.focusOffset),c=o&&o.node==a.anchorNode&&o.offset==a.anchorOffset||!Fl(e.contentDOM,a.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(a.anchorNode,a.anchorOffset),h=e.viewport;if((Q.ios||Q.chrome)&&e.state.selection.main.empty&&l!=c&&(h.from>0||h.to<e.state.doc.length)){let u=Math.min(l,c),f=Math.max(l,c),d=h.from-u,m=h.to-f;(d==0||d==1||u==0)&&(m==0||m==-1||f==e.state.doc.length)&&(l=0,c=e.state.doc.length)}this.newSel=T.single(c,l)}}};function Ip(i,e){let t,{newSel:r}=e,n=i.state.selection.main,s=i.inputState.lastKeyTime>Date.now()-100?i.inputState.lastKeyCode:-1;if(e.bounds){let{from:o,to:a}=e.bounds,l=n.from,c=null;(s===8||Q.android&&e.text.length<a-o)&&(l=n.to,c="end");let h=pw(i.state.doc.sliceString(o,a,sn),e.text,l-o,c);h&&(Q.chrome&&s==13&&h.toB==h.from+2&&e.text.slice(h.from,h.toB)==sn+sn&&h.toB--,t={from:o+h.from,to:o+h.toA,insert:j.of(e.text.slice(h.from,h.toB).split(sn))})}else r&&(!i.hasFocus&&i.state.facet(Jt)||r.main.eq(n))&&(r=null);if(!t&&!r)return!1;if(!t&&e.typeOver&&!n.empty&&r&&r.main.empty?t={from:n.from,to:n.to,insert:i.state.doc.slice(n.from,n.to)}:t&&t.from>=n.from&&t.to<=n.to&&(t.from!=n.from||t.to!=n.to)&&n.to-n.from-(t.to-t.from)<=4?t={from:n.from,to:n.to,insert:i.state.doc.slice(n.from,t.from).append(t.insert).append(i.state.doc.slice(t.to,n.to))}:(Q.mac||Q.android)&&t&&t.from==t.to&&t.from==n.head-1&&/^\. ?$/.test(t.insert.toString())&&i.contentDOM.getAttribute("autocorrect")=="off"?(r&&t.insert.length==2&&(r=T.single(r.main.anchor-1,r.main.head-1)),t={from:n.from,to:n.to,insert:j.of([" "])}):Q.chrome&&t&&t.from==t.to&&t.from==n.head&&t.insert.toString()==`
 `&&i.lineWrapping&&(r&&(r=T.single(r.main.anchor-1,r.main.head-1)),t={from:n.from,to:n.to,insert:j.of([" "])}),t)return Wp(i,t,r,s);if(r&&!r.main.eq(n)){let o=!1,a="select";return i.inputState.lastSelectionTime>Date.now()-50&&(i.inputState.lastSelectionOrigin=="select"&&(o=!0),a=i.inputState.lastSelectionOrigin),i.dispatch({selection:r,scrollIntoView:o,userEvent:a}),!0}else return!1}function Wp(i,e,t,r=-1){if(Q.ios&&i.inputState.flushIOSKey(e))return!0;let n=i.state.selection.main;if(Q.android&&(e.to==n.to&&(e.from==n.from||e.from==n.from-1&&i.state.sliceDoc(e.from,n.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&ur(i.contentDOM,"Enter",13)||(e.from==n.from-1&&e.to==n.to&&e.insert.length==0||r==8&&e.insert.length<e.to-e.from&&e.to>n.head)&&ur(i.contentDOM,"Backspace",8)||e.from==n.from&&e.to==n.to+1&&e.insert.length==0&&ur(i.contentDOM,"Delete",46)))return!0;let s=e.insert.toString();i.inputState.composing>=0&&i.inputState.composing++;let o,a=()=>o||(o=dw(i,e,t));return i.state.facet(yp).some(l=>l(i,e.from,e.to,s,a))||i.dispatch(a()),!0}function dw(i,e,t){let r,n=i.state,s=n.selection.main;if(e.from>=s.from&&e.to<=s.to&&e.to-e.from>=(s.to-s.from)/3&&(!t||t.main.empty&&t.main.from==e.from+e.insert.length)&&i.inputState.composing<0){let a=s.from<e.from?n.sliceDoc(s.from,e.from):"",l=s.to>e.to?n.sliceDoc(e.to,s.to):"";r=n.replaceSelection(i.state.toText(a+e.insert.sliceString(0,void 0,i.state.lineBreak)+l))}else{let a=n.changes(e),l=t&&t.main.to<=a.newLength?t.main:void 0;if(n.selection.ranges.length>1&&i.inputState.composing>=0&&e.to<=s.to&&e.to>=s.to-10){let c=i.state.sliceDoc(e.from,e.to),h,u=t&&Rp(i,t.main.head);if(u){let m=e.insert.length-(e.to-e.from);h={from:u.from,to:u.to-m}}else h=i.state.doc.lineAt(s.head);let f=s.to-e.to,d=s.to-s.from;r=n.changeByRange(m=>{if(m.from==s.from&&m.to==s.to)return{changes:a,range:l||m.map(a)};let p=m.to-f,g=p-c.length;if(m.to-m.from!=d||i.state.sliceDoc(g,p)!=c||m.to>=h.from&&m.from<=h.to)return{range:m};let O=n.changes({from:g,to:p,insert:e.insert}),y=m.to-s.to;return{changes:O,range:l?T.range(Math.max(0,l.anchor+y),Math.max(0,l.head+y)):m.map(O)}})}else r={changes:a,selection:l&&n.selection.replaceRange(l)}}let o="input.type";return(i.composing||i.inputState.compositionPendingChange&&i.inputState.compositionEndedAt>Date.now()-50)&&(i.inputState.compositionPendingChange=!1,o+=".compose",i.inputState.compositionFirstChange&&(o+=".start",i.inputState.compositionFirstChange=!1)),n.update(r,{userEvent:o,scrollIntoView:!0})}function pw(i,e,t,r){let n=Math.min(i.length,e.length),s=0;for(;s<n&&i.charCodeAt(s)==e.charCodeAt(s);)s++;if(s==n&&i.length==e.length)return null;let o=i.length,a=e.length;for(;o>0&&a>0&&i.charCodeAt(o-1)==e.charCodeAt(a-1);)o--,a--;if(r=="end"){let l=Math.max(0,s-Math.min(o,a));t-=o+l-s}if(o<s&&i.length<e.length){let l=t<=s&&t>=o?s-t:0;s-=l,a=s+(a-o),o=s}else if(a<s){let l=t<=s&&t>=a?s-t:0;s-=l,o=s+(o-a),a=s}return{from:s,toA:o,toB:a}}function mw(i){let e=[];if(i.root.activeElement!=i.contentDOM)return e;let{anchorNode:t,anchorOffset:r,focusNode:n,focusOffset:s}=i.observer.selectionRange;return t&&(e.push(new fo(t,r)),(n!=t||s!=r)&&e.push(new fo(n,s))),e}function gw(i,e){if(i.length==0)return null;let t=i[0].pos,r=i.length==2?i[1].pos:t;return t>-1&&r>-1?T.single(t+e,r+e):null}var Ow={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Il=Q.ie&&Q.ie_version<=11,xc=class{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new Hl,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(t=>{for(let r of t)this.queue.push(r);(Q.ie&&Q.ie_version<=11||Q.ios&&e.composing)&&t.some(r=>r.type=="childList"&&r.removedNodes.length||r.type=="characterData"&&r.oldValue.length>r.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&e.constructor.EDIT_CONTEXT!==!1&&!(Q.chrome&&Q.chrome_version<126)&&(this.editContext=new Sc(e),e.state.facet(Jt)&&(e.contentDOM.editContext=this.editContext.editContext)),Il&&(this.onCharData=t=>{this.queue.push({target:t.target,type:"characterData",oldValue:t.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var t;((t=this.view.docView)===null||t===void 0?void 0:t.lastUpdate)<Date.now()-75&&this.onResize()}),this.resizeScroll.observe(e.scrollDOM)),this.addWindowListeners(this.win=e.win),this.start(),typeof IntersectionObserver=="function"&&(this.intersection=new IntersectionObserver(t=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),t.length>0&&t[t.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(t=>{t.length>0&&t[t.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(e){e.type=="change"&&!e.matches||(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((t,r)=>t!=e[r]))){this.gapIntersection.disconnect();for(let t of e)this.gapIntersection.observe(t);this.gaps=e}}onSelectionChange(e){let t=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:r}=this,n=this.selectionRange;if(r.state.facet(Jt)?r.root.activeElement!=this.dom:!Js(r.dom,n))return;let s=n.anchorNode&&r.docView.nearest(n.anchorNode);if(s&&s.ignoreEvent(e)){t||(this.selectionChanged=!1);return}(Q.ie&&Q.ie_version<=11||Q.android&&Q.chrome)&&!r.state.selection.main.empty&&n.focusNode&&an(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=pn(e.root);if(!t)return!1;let r=Q.safari&&e.root.nodeType==11&&lb(this.dom.ownerDocument)==this.dom&&yw(this.view,t)||t;if(!r||this.selectionRange.eq(r))return!1;let n=Js(this.dom,r);return n&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&db(this.dom,r)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(r),n&&(this.selectionChanged=!0),!0)}setSelectionRange(e,t){this.selectionRange.set(e.node,e.offset,t.node,t.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let e=0,t=null;for(let r=this.dom;r;)if(r.nodeType==1)!t&&e<this.scrollTargets.length&&this.scrollTargets[e]==r?e++:t||(t=this.scrollTargets.slice(0,e)),t&&t.push(r),r=r.assignedSlot||r.parentNode;else if(r.nodeType==11)r=r.host;else break;if(e<this.scrollTargets.length&&!t&&(t=this.scrollTargets.slice(0,e)),t){for(let r of this.scrollTargets)r.removeEventListener("scroll",this.onScroll);for(let r of this.scrollTargets=t)r.addEventListener("scroll",this.onScroll)}}ignore(e){if(!this.active)return e();try{return this.stop(),e()}finally{this.start(),this.clear()}}start(){this.active||(this.observer.observe(this.dom,Ow),Il&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),Il&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,t){var r;if(!this.delayedAndroidKey){let n=()=>{let s=this.delayedAndroidKey;s&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=s.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&s.force&&ur(this.dom,s.key,s.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(n)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:t,force:this.lastChange<Date.now()-50||!!(!((r=this.delayedAndroidKey)===null||r===void 0)&&r.force)})}clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}flushSoon(){this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame(()=>{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let t=-1,r=-1,n=!1;for(let s of e){let o=this.readMutation(s);o&&(o.typeOver&&(n=!0),t==-1?{from:t,to:r}=o:(t=Math.min(o.from,t),r=Math.max(o.to,r)))}return{from:t,to:r,typeOver:n}}readChange(){let{from:e,to:t,typeOver:r}=this.processRecords(),n=this.selectionChanged&&Js(this.dom,this.selectionRange);if(e<0&&!n)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let s=new vc(this.view,e,t,r);return this.view.docView.domChanged={newSel:s.newSel?s.newSel.main:null},s}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let t=this.readChange();if(!t)return this.view.requestMeasure(),!1;let r=this.view.state,n=Ip(this.view,t);return this.view.state==r&&(t.domChanged||t.newSel&&!t.newSel.main.eq(this.view.state.selection.main))&&this.view.update([]),n}readMutation(e){let t=this.view.docView.nearest(e.target);if(!t||t.ignoreMutation(e))return null;if(t.markDirty(e.type=="attributes"),e.type=="attributes"&&(t.flags|=4),e.type=="childList"){let r=Dd(t,e.previousSibling||e.target.previousSibling,-1),n=Dd(t,e.nextSibling||e.target.nextSibling,1);return{from:r?t.posAfter(r):t.posAtStart,to:n?t.posBefore(n):t.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:t.posAtStart,to:t.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener("change",this.onPrint):e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener("change",this.onPrint):e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet(Jt)!=e.state.facet(Jt)&&(e.view.contentDOM.editContext=e.state.facet(Jt)?this.editContext.editContext:null))}destroy(){var e,t,r;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(t=this.gapIntersection)===null||t===void 0||t.disconnect(),(r=this.resizeScroll)===null||r===void 0||r.disconnect();for(let n of this.scrollTargets)n.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey)}};function Dd(i,e,t){for(;e;){let r=ee.get(e);if(r&&r.parent==i)return r;let n=e.parentNode;e=n!=i.dom?n:t>0?e.nextSibling:e.previousSibling}return null}function Ld(i,e){let t=e.startContainer,r=e.startOffset,n=e.endContainer,s=e.endOffset,o=i.docView.domAtPos(i.state.selection.main.anchor);return an(o.node,o.offset,n,s)&&([t,r,n,s]=[n,s,t,r]),{anchorNode:t,anchorOffset:r,focusNode:n,focusOffset:s}}function yw(i,e){if(e.getComposedRanges){let n=e.getComposedRanges(i.root)[0];if(n)return Ld(i,n)}let t=null;function r(n){n.preventDefault(),n.stopImmediatePropagation(),t=n.getTargetRanges()[0]}return i.contentDOM.addEventListener("beforeinput",r,!0),i.dom.ownerDocument.execCommand("indent"),i.contentDOM.removeEventListener("beforeinput",r,!0),t?Ld(i,t):null}var Sc=class{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.resetRange(e.state);let t=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});t.addEventListener("textupdate",r=>{let{anchor:n}=e.state.selection.main,s={from:this.toEditorPos(r.updateRangeStart),to:this.toEditorPos(r.updateRangeEnd),insert:j.of(r.text.split(`
`))};s.from==this.from&&n<this.from?s.from=n:s.to==this.to&&n>this.to&&(s.to=n),!(s.from==s.to&&!s.insert.length)&&(this.pendingContextChange=s,Wp(e,s,T.single(this.toEditorPos(r.selectionStart),this.toEditorPos(r.selectionEnd))),this.pendingContextChange&&this.revertPending(e.state))}),t.addEventListener("characterboundsupdate",r=>{let n=[],s=null;for(let o=this.toEditorPos(r.rangeStart),a=this.toEditorPos(r.rangeEnd);o<a;o++){let l=e.coordsForChar(o);s=l&&new DOMRect(l.left,l.right,l.right-l.left,l.bottom-l.top)||s||new DOMRect,n.push(s)}t.updateCharacterBounds(r.rangeStart,n)}),t.addEventListener("textformatupdate",r=>{let n=[];for(let s of r.getTextFormats()){let o=s.underlineStyle,a=s.underlineThickness;if(o!="None"&&a!="None"){let l=`text-decoration: underline ${o=="Dashed"?"dashed ":o=="Squiggle"?"wavy ":""}${a=="Thin"?1:2}px`;n.push(M.mark({attributes:{style:l}}).range(this.toEditorPos(s.rangeStart),this.toEditorPos(s.rangeEnd)))}}e.dispatch({effects:Sp.of(M.set(n))})}),t.addEventListener("compositionstart",()=>{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)}),t.addEventListener("compositionend",()=>{e.inputState.composing=-1,e.inputState.compositionFirstChange=null}),this.measureReq={read:r=>{this.editContext.updateControlBounds(r.contentDOM.getBoundingClientRect());let n=pn(r.root);n&&n.rangeCount&&this.editContext.updateSelectionBounds(n.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,r=!1,n=this.pendingContextChange;return e.changes.iterChanges((s,o,a,l,c)=>{if(r)return;let h=c.length-(o-s);if(n&&o>=n.to)if(n.from==s&&n.to==o&&n.insert.eq(c)){n=this.pendingContextChange=null,t+=h;return}else n=null,this.revertPending(e.state);if(s+=t,o+=t,o<=this.from)this.from+=h,this.to+=h;else if(s<this.to){if(s<this.from||o>this.to||this.to-this.from+c.length>3e4){r=!0;return}this.editContext.updateText(this.toContextPos(s),this.toContextPos(o),c.toString()),this.to+=h}t+=h}),n&&!r&&this.revertPending(e.state),!r}update(e){!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.resetRange(e.state),this.editContext.updateText(0,this.editContext.text.length,e.state.doc.sliceString(this.from,this.to)),this.setSelection(e.state)):(e.docChanged||e.selectionSet)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:t}=e.selection.main;this.from=Math.max(0,t-1e4),this.to=Math.min(e.doc.length,t+1e4)}revertPending(e){let t=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(t.from),this.toContextPos(t.to+t.insert.length),e.doc.sliceString(t.from,t.to))}setSelection(e){let{main:t}=e.selection,r=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),n=this.toContextPos(t.head);(this.editContext.selectionStart!=r||this.editContext.selectionEnd!=n)&&this.editContext.updateSelection(r,n)}rangeIsValid(e){let{head:t}=e.selection.main;return!(this.from>0&&t-this.from<500||this.to<e.doc.length&&this.to-t<500||this.to-this.from>1e4*3)}toEditorPos(e){return e+this.from}toContextPos(e){return e-this.from}},R=class i{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return this.inputState.composing>0}get compositionStarted(){return this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:t}=e;this.dispatchTransactions=e.dispatchTransactions||t&&(r=>r.forEach(n=>t(n,this)))||(r=>this.update(r)),this.dispatch=this.dispatch.bind(this),this._root=e.root||fb(e.parent)||document,this.viewState=new uo(e.state||W.create(e)),e.scrollTo&&e.scrollTo.is(Ws)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(tn).map(r=>new hn(r));for(let r of this.plugins)r.update(this);this.observer=new xc(this),this.inputState=new ac(this),this.inputState.ensureHandlers(this.plugins),this.docView=new lo(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure()}dispatch(...e){let t=e.length==1&&e[0]instanceof de?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(t,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let t=!1,r=!1,n,s=this.state;for(let f of e){if(f.startState!=s)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");s=f.state}if(this.destroyed){this.viewState.state=s;return}let o=this.hasFocus,a=0,l=null;e.some(f=>f.annotation(Vp))?(this.inputState.notifiedFocused=o,a=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,l=$p(s,o),l||(a=1));let c=this.observer.delayedAndroidKey,h=null;if(c?(this.observer.clearDelayedAndroidKey(),h=this.observer.readChange(),(h&&!this.state.doc.eq(s.doc)||!this.state.selection.eq(s.selection))&&(h=null)):this.observer.clear(),s.facet(W.phrases)!=this.state.facet(W.phrases))return this.setState(s);n=ao.create(this,s,e),n.flags|=a;let u=this.viewState.scrollTarget;try{this.updateState=2;for(let f of e){if(u&&(u=u.map(f.changes)),f.scrollIntoView){let{main:d}=f.state.selection;u=new cn(d.empty?d:T.cursor(d.head,d.head>d.anchor?-1:1))}for(let d of f.effects)d.is(Ws)&&(u=d.value.clip(this.state))}this.viewState.update(n,u),this.bidiCache=po.update(this.bidiCache,n.changes),n.empty||(this.updatePlugins(n),this.inputState.update(n)),t=this.docView.update(n),this.state.facet(rn)!=this.styleModules&&this.mountStyles(),r=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(t,e.some(f=>f.isUserEvent("select.pointer")))}finally{this.updateState=0}if(n.startState.facet(Gs)!=n.state.facet(Gs)&&(this.viewState.mustMeasureContent=!0),(t||r||u||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),t&&this.docViewUpdate(),!n.empty)for(let f of this.state.facet(nc))try{f(n)}catch(d){xe(this.state,d,"update listener")}(l||h)&&Promise.resolve().then(()=>{l&&this.state==l.startState&&this.dispatch(l),h&&!Ip(this,h)&&c.force&&ur(this.contentDOM,c.key,c.keyCode)})}setState(e){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=e;return}this.updateState=2;let t=this.hasFocus;try{for(let r of this.plugins)r.destroy(this);this.viewState=new uo(e),this.plugins=e.facet(tn).map(r=>new hn(r)),this.pluginMap.clear();for(let r of this.plugins)r.update(this);this.docView.destroy(),this.docView=new lo(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}t&&this.focus(),this.requestMeasure()}updatePlugins(e){let t=e.startState.facet(tn),r=e.state.facet(tn);if(t!=r){let n=[];for(let s of r){let o=t.indexOf(s);if(o<0)n.push(new hn(s));else{let a=this.plugins[o];a.mustUpdate=e,n.push(a)}}for(let s of this.plugins)s.mustUpdate!=e&&s.destroy(this);this.plugins=n,this.pluginMap.clear()}else for(let n of this.plugins)n.mustUpdate=e;for(let n=0;n<this.plugins.length;n++)this.plugins[n].update(this);t!=r&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let e of this.plugins){let t=e.value;if(t&&t.docViewUpdate)try{t.docViewUpdate(this)}catch(r){xe(this.state,r,"doc view update listener")}}}measure(e=!0){if(this.destroyed)return;if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let t=null,r=this.scrollDOM,n=r.scrollTop*this.scaleY,{scrollAnchorPos:s,scrollAnchorHeight:o}=this.viewState;Math.abs(n-this.viewState.scrollTop)>1&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let a=0;;a++){if(o<0)if(Jd(r))s=-1,o=this.viewState.heightMap.height;else{let d=this.viewState.scrollAnchorAt(n);s=d.from,o=d.top}this.updateState=1;let l=this.viewState.measure(this);if(!l&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(a>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let c=[];l&4||([this.measureRequests,c]=[c,this.measureRequests]);let h=c.map(d=>{try{return d.read(this)}catch(m){return xe(this.state,m),qd}}),u=ao.create(this,this.state,[]),f=!1;u.flags|=l,t?t.flags|=l:t=u,this.updateState=2,u.empty||(this.updatePlugins(u),this.inputState.update(u),this.updateAttrs(),f=this.docView.update(u),f&&this.docViewUpdate());for(let d=0;d<c.length;d++)if(h[d]!=qd)try{let m=c[d];m.write&&m.write(h[d],this)}catch(m){xe(this.state,m)}if(f&&this.docView.updateSelection(!0),!u.viewportChanged&&this.measureRequests.length==0){if(this.viewState.editorHeight)if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,o=-1;continue}else{let m=(s<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(s).top)-o;if(m>1||m<-1){n=n+m,r.scrollTop=n/this.scaleY,o=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let a of this.state.facet(nc))a(t)}get themeClasses(){return yc+" "+(this.state.facet(Oc)?Np:Xp)+" "+this.state.facet(Gs)}updateAttrs(){let e=Vd(this,kp,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",translate:"no",contenteditable:this.state.facet(Jt)?"true":"false",class:"cm-content",style:`${Q.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(t["aria-readonly"]="true"),Vd(this,Bc,t);let r=this.observer.ignore(()=>{let n=Kl(this.contentDOM,this.contentAttrs,t),s=Kl(this.dom,this.editorAttrs,e);return n||s});return this.editorAttrs=e,this.contentAttrs=t,r}showAnnouncements(e){let t=!0;for(let r of e)for(let n of r.effects)if(n.is(i.announce)){t&&(this.announceDOM.textContent=""),t=!1;let s=this.announceDOM.appendChild(document.createElement("div"));s.textContent=n.value}}mountStyles(){this.styleModules=this.state.facet(rn);let e=this.state.facet(i.cspNonce);rt.mount(this.root,this.styleModules.concat(uw).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(this.measureRequests.indexOf(e)>-1)return;if(e.key!=null){for(let t=0;t<this.measureRequests.length;t++)if(this.measureRequests[t].key===e.key){this.measureRequests[t]=e;return}}this.measureRequests.push(e)}}plugin(e){let t=this.pluginMap.get(e);return(t===void 0||t&&t.spec!=e)&&this.pluginMap.set(e,t=this.plugins.find(r=>r.spec==e)||null),t&&t.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,t,r){return jl(this,e,vd(this,e,t,r))}moveByGroup(e,t){return jl(this,e,vd(this,e,t,r=>jb(this,e.head,r)))}visualLineSide(e,t){let r=this.bidiSpans(e),n=this.textDirectionAt(e.from),s=r[t?r.length-1:0];return T.cursor(s.side(t,n)+e.from,s.forward(!t,n)?1:-1)}moveToLineBoundary(e,t,r=!0){return Nb(this,e,t,r)}moveVertically(e,t,r){return jl(this,e,Ib(this,e,t,r))}domAtPos(e){return this.docView.domAtPos(e)}posAtDOM(e,t=0){return this.docView.posFromDOM(e,t)}posAtCoords(e,t=!0){return this.readMeasured(),Ap(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let r=this.docView.coordsAt(e,t);if(!r||r.left==r.right)return r;let n=this.state.doc.lineAt(e),s=this.bidiSpans(n),o=s[St.find(s,e-n.from,-1,t)];return qc(r,o.dir==G.LTR==t>0)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(wp)||e<this.viewport.from||e>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>bw)return fp(e.length);let t=this.textDirectionAt(e.from),r;for(let s of this.bidiCache)if(s.from==e.from&&s.dir==t&&(s.fresh||up(s.isolates,r=gd(this,e))))return s.order;r||(r=gd(this,e));let n=Tb(e.text,t,r);return this.bidiCache.push(new po(e.from,e.to,t,r,!0,n)),n}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||Q.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{Yd(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((e.nodeType==9?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,t={}){return Ws.of(new cn(typeof e=="number"?T.cursor(e):e,t.y,t.x,t.yMargin,t.xMargin))}scrollSnapshot(){let{scrollTop:e,scrollLeft:t}=this.scrollDOM,r=this.viewState.scrollAnchorAt(e);return Ws.of(new cn(T.cursor(r.from),"start","start",r.top-e,t,!0))}setTabFocusMode(e){e==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof e=="boolean"?this.inputState.tabFocusMode=e?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return se.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return se.define(()=>({}),{eventObservers:e})}static theme(e,t){let r=rt.newName(),n=[Gs.of(r),rn.of(bc(`.${r}`,e))];return t&&t.dark&&n.push(Oc.of(!0)),n}static baseTheme(e){return _e.lowest(rn.of(bc("."+yc,e,jp)))}static findFromDOM(e){var t;let r=e.querySelector(".cm-content"),n=r&&ee.get(r)||ee.get(e);return((t=n?.rootView)===null||t===void 0?void 0:t.view)||null}};R.styleModule=rn;R.inputHandler=yp;R.scrollHandler=xp;R.focusChangeEffect=bp;R.perLineTextDirection=wp;R.exceptionSink=Op;R.updateListener=nc;R.editable=Jt;R.mouseSelectionStyle=gp;R.dragMovesSelection=mp;R.clickAddsSelectionRange=pp;R.decorations=wn;R.outerDecorations=Tp;R.atomicRanges=Xc;R.bidiIsolatedRanges=Pp;R.scrollMargins=Cp;R.darkTheme=Oc;R.cspNonce=A.define({combine:i=>i.length?i[0]:""});R.contentAttributes=Bc;R.editorAttributes=kp;R.lineWrapping=R.contentAttributes.of({class:"cm-lineWrapping"});R.announce=D.define();var bw=4096,qd={},po=class i{constructor(e,t,r,n,s,o){this.from=e,this.to=t,this.dir=r,this.isolates=n,this.fresh=s,this.order=o}static update(e,t){if(t.empty&&!e.some(s=>s.fresh))return e;let r=[],n=e.length?e[e.length-1].dir:G.LTR;for(let s=Math.max(0,e.length-10);s<e.length;s++){let o=e[s];o.dir==n&&!t.touchesRange(o.from,o.to)&&r.push(new i(t.mapPos(o.from,1),t.mapPos(o.to,-1),o.dir,o.isolates,!1,o.order))}return r}};function Vd(i,e,t){for(let r=i.state.facet(e),n=r.length-1;n>=0;n--){let s=r[n],o=typeof s=="function"?s(i):s;o&&Jl(o,t)}return t}var ww=Q.mac?"mac":Q.windows?"win":Q.linux?"linux":"key";function vw(i,e){let t=i.split(/-(?!$)/),r=t[t.length-1];r=="Space"&&(r=" ");let n,s,o,a;for(let l=0;l<t.length-1;++l){let c=t[l];if(/^(cmd|meta|m)$/i.test(c))a=!0;else if(/^a(lt)?$/i.test(c))n=!0;else if(/^(c|ctrl|control)$/i.test(c))s=!0;else if(/^s(hift)?$/i.test(c))o=!0;else if(/^mod$/i.test(c))e=="mac"?a=!0:s=!0;else throw new Error("Unrecognized modifier name: "+c)}return n&&(r="Alt-"+r),s&&(r="Ctrl-"+r),a&&(r="Meta-"+r),o&&(r="Shift-"+r),r}function Ys(i,e,t){return e.altKey&&(i="Alt-"+i),e.ctrlKey&&(i="Ctrl-"+i),e.metaKey&&(i="Meta-"+i),t!==!1&&e.shiftKey&&(i="Shift-"+i),i}var xw=_e.default(R.domEventHandlers({keydown(i,e){return Fp(zp(e.state),i,e,"editor")}})),It=A.define({enables:xw}),$d=new WeakMap;function zp(i){let e=i.facet(It),t=$d.get(e);return t||$d.set(e,t=kw(e.reduce((r,n)=>r.concat(n),[]))),t}function Up(i,e,t){return Fp(zp(i.state),e,i,t)}var Kt=null,Sw=4e3;function kw(i,e=ww){let t=Object.create(null),r=Object.create(null),n=(o,a)=>{let l=r[o];if(l==null)r[o]=a;else if(l!=a)throw new Error("Key binding "+o+" is used both as a regular binding and as a multi-stroke prefix")},s=(o,a,l,c,h)=>{var u,f;let d=t[o]||(t[o]=Object.create(null)),m=a.split(/ (?!$)/).map(O=>vw(O,e));for(let O=1;O<m.length;O++){let y=m.slice(0,O).join(" ");n(y,!0),d[y]||(d[y]={preventDefault:!0,stopPropagation:!1,run:[x=>{let v=Kt={view:x,prefix:y,scope:o};return setTimeout(()=>{Kt==v&&(Kt=null)},Sw),!0}]})}let p=m.join(" ");n(p,!1);let g=d[p]||(d[p]={preventDefault:!1,stopPropagation:!1,run:((f=(u=d._any)===null||u===void 0?void 0:u.run)===null||f===void 0?void 0:f.slice())||[]});l&&g.run.push(l),c&&(g.preventDefault=!0),h&&(g.stopPropagation=!0)};for(let o of i){let a=o.scope?o.scope.split(" "):["editor"];if(o.any)for(let c of a){let h=t[c]||(t[c]=Object.create(null));h._any||(h._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:u}=o;for(let f in h)h[f].run.push(d=>u(d,kc))}let l=o[e]||o.key;if(l)for(let c of a)s(c,l,o.run,o.preventDefault,o.stopPropagation),o.shift&&s(c,"Shift-"+l,o.shift,o.preventDefault,o.stopPropagation)}return t}var kc=null;function Fp(i,e,t,r){kc=e;let n=ld(e),s=fe(n,0),o=Qe(s)==n.length&&n!=" ",a="",l=!1,c=!1,h=!1;Kt&&Kt.view==t&&Kt.scope==r&&(a=Kt.prefix+" ",Mp.indexOf(e.keyCode)<0&&(c=!0,Kt=null));let u=new Set,f=g=>{if(g){for(let O of g.run)if(!u.has(O)&&(u.add(O),O(t)))return g.stopPropagation&&(h=!0),!0;g.preventDefault&&(g.stopPropagation&&(h=!0),c=!0)}return!1},d=i[r],m,p;return d&&(f(d[a+Ys(n,e,!o)])?l=!0:o&&(e.altKey||e.metaKey||e.ctrlKey)&&!(Q.windows&&e.ctrlKey&&e.altKey)&&(m=Nt[e.keyCode])&&m!=n?(f(d[a+Ys(m,e,!0)])||e.shiftKey&&(p=or[e.keyCode])!=n&&p!=m&&f(d[a+Ys(p,e,!1)]))&&(l=!0):o&&e.shiftKey&&f(d[a+Ys(n,e,!0)])&&(l=!0),!l&&f(d._any)&&(l=!0)),c&&(l=!0),l&&h&&e.stopPropagation(),kc=null,l}var vn=class i{constructor(e,t,r,n,s){this.className=e,this.left=t,this.top=r,this.width=n,this.height=s}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}update(e,t){return t.className!=this.className?!1:(this.adjust(e),!0)}adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",this.width!=null&&(e.style.width=this.width+"px"),e.style.height=this.height+"px"}eq(e){return this.left==e.left&&this.top==e.top&&this.width==e.width&&this.height==e.height&&this.className==e.className}static forRange(e,t,r){if(r.empty){let n=e.coordsAtPos(r.head,r.assoc||1);if(!n)return[];let s=Hp(e);return[new i(t,n.left-s.left,n.top-s.top,null,n.bottom-n.top)]}else return Tw(e,t,r)}};function Hp(i){let e=i.scrollDOM.getBoundingClientRect();return{left:(i.textDirection==G.LTR?e.left:e.right-i.scrollDOM.clientWidth*i.scaleX)-i.scrollDOM.scrollLeft*i.scaleX,top:e.top-i.scrollDOM.scrollTop*i.scaleY}}function Bd(i,e,t,r){let n=i.coordsAtPos(e,t*2);if(!n)return r;let s=i.dom.getBoundingClientRect(),o=(n.top+n.bottom)/2,a=i.posAtCoords({x:s.left+1,y:o}),l=i.posAtCoords({x:s.right-1,y:o});return a==null||l==null?r:{from:Math.max(r.from,Math.min(a,l)),to:Math.min(r.to,Math.max(a,l))}}function Tw(i,e,t){if(t.to<=i.viewport.from||t.from>=i.viewport.to)return[];let r=Math.max(t.from,i.viewport.from),n=Math.min(t.to,i.viewport.to),s=i.textDirection==G.LTR,o=i.contentDOM,a=o.getBoundingClientRect(),l=Hp(i),c=o.querySelector(".cm-line"),h=c&&window.getComputedStyle(c),u=a.left+(h?parseInt(h.paddingLeft)+Math.min(0,parseInt(h.textIndent)):0),f=a.right-(h?parseInt(h.paddingRight):0),d=oc(i,r),m=oc(i,n),p=d.type==Le.Text?d:null,g=m.type==Le.Text?m:null;if(p&&(i.lineWrapping||d.widgetLineBreaks)&&(p=Bd(i,r,1,p)),g&&(i.lineWrapping||m.widgetLineBreaks)&&(g=Bd(i,n,-1,g)),p&&g&&p.from==g.from&&p.to==g.to)return y(x(t.from,t.to,p));{let w=p?x(t.from,null,p):v(d,!1),P=g?x(null,t.to,g):v(m,!0),C=[];return(p||d).to<(g||m).from-(p&&g?1:0)||d.widgetLineBreaks>1&&w.bottom+i.defaultLineHeight/2<P.top?C.push(O(u,w.bottom,f,P.top)):w.bottom<P.top&&i.elementAtHeight((w.bottom+P.top)/2).type==Le.Text&&(w.bottom=P.top=(w.bottom+P.top)/2),y(w).concat(C).concat(y(P))}function O(w,P,C,_){return new vn(e,w-l.left,P-l.top-.01,C-w,_-P+.01)}function y({top:w,bottom:P,horizontal:C}){let _=[];for(let $=0;$<C.length;$+=2)_.push(O(C[$],w,C[$+1],P));return _}function x(w,P,C){let _=1e9,$=-1e9,q=[];function N(I,ne,qe,Ve,We){let Ke=i.coordsAtPos(I,I==C.to?-2:2),ge=i.coordsAtPos(qe,qe==C.from?2:-2);!Ke||!ge||(_=Math.min(Ke.top,ge.top,_),$=Math.max(Ke.bottom,ge.bottom,$),We==G.LTR?q.push(s&&ne?u:Ke.left,s&&Ve?f:ge.right):q.push(!s&&Ve?u:ge.left,!s&&ne?f:Ke.right))}let B=w??C.from,Y=P??C.to;for(let I of i.visibleRanges)if(I.to>B&&I.from<Y)for(let ne=Math.max(I.from,B),qe=Math.min(I.to,Y);;){let Ve=i.state.doc.lineAt(ne);for(let We of i.bidiSpans(Ve)){let Ke=We.from+Ve.from,ge=We.to+Ve.from;if(Ke>=qe)break;ge>ne&&N(Math.max(Ke,ne),w==null&&Ke<=B,Math.min(ge,qe),P==null&&ge>=Y,We.dir)}if(ne=Ve.to+1,ne>=qe)break}return q.length==0&&N(B,w==null,Y,P==null,i.textDirection),{top:_,bottom:$,horizontal:q}}function v(w,P){let C=a.top+(P?w.top:w.bottom);return{top:C,bottom:C,horizontal:[]}}}function Pw(i,e){return i.constructor==e.constructor&&i.eq(e)}var Tc=class{constructor(e,t){this.view=e,this.layer=t,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=e.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),t.above&&this.dom.classList.add("cm-layer-above"),t.class&&this.dom.classList.add(t.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(e.state),e.requestMeasure(this.measureReq),t.mount&&t.mount(this.dom,e)}update(e){e.startState.facet(to)!=e.state.facet(to)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&(this.scale(),e.view.requestMeasure(this.measureReq))}docViewUpdate(e){this.layer.updateOnDocViewUpdate!==!1&&e.requestMeasure(this.measureReq)}setOrder(e){let t=0,r=e.facet(to);for(;t<r.length&&r[t]!=this.layer;)t++;this.dom.style.zIndex=String((this.layer.above?150:-1)-t)}measure(){return this.layer.markers(this.view)}scale(){let{scaleX:e,scaleY:t}=this.view;(e!=this.scaleX||t!=this.scaleY)&&(this.scaleX=e,this.scaleY=t,this.dom.style.transform=`scale(${1/e}, ${1/t})`)}draw(e){if(e.length!=this.drawn.length||e.some((t,r)=>!Pw(t,this.drawn[r]))){let t=this.dom.firstChild,r=0;for(let n of e)n.update&&t&&n.constructor&&this.drawn[r].constructor&&n.update(t,this.drawn[r])?(t=t.nextSibling,r++):this.dom.insertBefore(n.draw(),t);for(;t;){let n=t.nextSibling;t.remove(),t=n}this.drawn=e}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}},to=A.define();function Gp(i){return[se.define(e=>new Tc(e,i)),to.of(i)]}var Yp=!Q.ios,xn=A.define({combine(i){return Ce(i,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,t)=>Math.min(e,t),drawRangeCursor:(e,t)=>e||t})}});function Zp(i={}){return[xn.of(i),Cw,Ew,Rw,vp.of(!0)]}function Jp(i){return i.startState.facet(xn)!=i.state.facet(xn)}var Cw=Gp({above:!0,markers(i){let{state:e}=i,t=e.facet(xn),r=[];for(let n of e.selection.ranges){let s=n==e.selection.main;if(n.empty?!s||Yp:t.drawRangeCursor){let o=s?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",a=n.empty?n:T.cursor(n.head,n.head>n.anchor?-1:1);for(let l of vn.forRange(i,o,a))r.push(l)}}return r},update(i,e){i.transactions.some(r=>r.selection)&&(e.style.animationName=e.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let t=Jp(i);return t&&Xd(i.state,e),i.docChanged||i.selectionSet||t},mount(i,e){Xd(e.state,i)},class:"cm-cursorLayer"});function Xd(i,e){e.style.animationDuration=i.facet(xn).cursorBlinkRate+"ms"}var Ew=Gp({above:!1,markers(i){return i.state.selection.ranges.map(e=>e.empty?[]:vn.forRange(i,"cm-selectionBackground",e)).reduce((e,t)=>e.concat(t))},update(i,e){return i.docChanged||i.selectionSet||i.viewportChanged||Jp(i)},class:"cm-selectionLayer"}),Pc={".cm-line":{"& ::selection, &::selection":{backgroundColor:"transparent !important"}},".cm-content":{"& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}};Yp&&(Pc[".cm-line"].caretColor=Pc[".cm-content"].caretColor="transparent !important");var Rw=_e.highest(R.theme(Pc)),Kp=D.define({map(i,e){return i==null?null:e.mapPos(i)}}),on=re.define({create(){return null},update(i,e){return i!=null&&(i=e.changes.mapPos(i)),e.effects.reduce((t,r)=>r.is(Kp)?r.value:t,i)}}),Aw=se.fromClass(class{constructor(i){this.view=i,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(i){var e;let t=i.state.field(on);t==null?this.cursor!=null&&((e=this.cursor)===null||e===void 0||e.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(i.startState.field(on)!=t||i.docChanged||i.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:i}=this,e=i.state.field(on),t=e!=null&&i.coordsAtPos(e);if(!t)return null;let r=i.scrollDOM.getBoundingClientRect();return{left:t.left-r.left+i.scrollDOM.scrollLeft*i.scaleX,top:t.top-r.top+i.scrollDOM.scrollTop*i.scaleY,height:t.bottom-t.top}}drawCursor(i){if(this.cursor){let{scaleX:e,scaleY:t}=this.view;i?(this.cursor.style.left=i.left/e+"px",this.cursor.style.top=i.top/t+"px",this.cursor.style.height=i.height/t+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(i){this.view.state.field(on)!=i&&this.view.dispatch({effects:Kp.of(i)})}},{eventObservers:{dragover(i){this.setDropPos(this.view.posAtCoords({x:i.clientX,y:i.clientY}))},dragleave(i){(i.target==this.view.contentDOM||!this.view.contentDOM.contains(i.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function em(){return[on,Aw]}function Nd(i,e,t,r,n){e.lastIndex=0;for(let s=i.iterRange(t,r),o=t,a;!s.next().done;o+=s.value.length)if(!s.lineBreak)for(;a=e.exec(s.value);)n(o+a.index,a)}function Qw(i,e){let t=i.visibleRanges;if(t.length==1&&t[0].from==i.viewport.from&&t[0].to==i.viewport.to)return t;let r=[];for(let{from:n,to:s}of t)n=Math.max(i.state.doc.lineAt(n).from,n-e),s=Math.min(i.state.doc.lineAt(s).to,s+e),r.length&&r[r.length-1].to>=n?r[r.length-1].to=s:r.push({from:n,to:s});return r}var Cc=class{constructor(e){let{regexp:t,decoration:r,decorate:n,boundary:s,maxLength:o=1e3}=e;if(!t.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=t,n)this.addMatch=(a,l,c,h)=>n(h,c,c+a[0].length,a,l);else if(typeof r=="function")this.addMatch=(a,l,c,h)=>{let u=r(a,l,c);u&&h(c,c+a[0].length,u)};else if(r)this.addMatch=(a,l,c,h)=>h(c,c+a[0].length,r);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=s,this.maxLength=o}createDeco(e){let t=new dt,r=t.add.bind(t);for(let{from:n,to:s}of Qw(e,this.maxLength))Nd(e.state.doc,this.regexp,n,s,(o,a)=>this.addMatch(a,e,o,r));return t.finish()}updateDeco(e,t){let r=1e9,n=-1;return e.docChanged&&e.changes.iterChanges((s,o,a,l)=>{l>e.view.viewport.from&&a<e.view.viewport.to&&(r=Math.min(a,r),n=Math.max(l,n))}),e.viewportChanged||n-r>1e3?this.createDeco(e.view):n>-1?this.updateRange(e.view,t.map(e.changes),r,n):t}updateRange(e,t,r,n){for(let s of e.visibleRanges){let o=Math.max(s.from,r),a=Math.min(s.to,n);if(a>o){let l=e.state.doc.lineAt(o),c=l.to<a?e.state.doc.lineAt(a):l,h=Math.max(s.from,l.from),u=Math.min(s.to,c.to);if(this.boundary){for(;o>l.from;o--)if(this.boundary.test(l.text[o-1-l.from])){h=o;break}for(;a<c.to;a++)if(this.boundary.test(c.text[a-c.from])){u=a;break}}let f=[],d,m=(p,g,O)=>f.push(O.range(p,g));if(l==c)for(this.regexp.lastIndex=h-l.from;(d=this.regexp.exec(l.text))&&d.index<u-l.from;)this.addMatch(d,e,d.index+l.from,m);else Nd(e.state.doc,this.regexp,h,u,(p,g)=>this.addMatch(g,e,p,m));t=t.update({filterFrom:h,filterTo:u,filter:(p,g)=>p<h||g>u,add:f})}}return t}},Ec=/x/.unicode!=null?"gu":"g",Mw=new RegExp(`[\0-\b
-\x7F-\x9F\xAD\u061C\u200B\u200E\u200F\u2028\u2029\u202D\u202E\u2066\u2067\u2069\uFEFF\uFFF9-\uFFFC]`,Ec),_w={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"},Wl=null;function Dw(){var i;if(Wl==null&&typeof document<"u"&&document.body){let e=document.body.style;Wl=((i=e.tabSize)!==null&&i!==void 0?i:e.MozTabSize)!=null}return Wl||!1}var io=A.define({combine(i){let e=Ce(i,{render:null,specialChars:Mw,addSpecialChars:null});return(e.replaceTabs=!Dw())&&(e.specialChars=new RegExp("	|"+e.specialChars.source,Ec)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,Ec)),e}});function tm(i={}){return[io.of(i),Lw()]}var jd=null;function Lw(){return jd||(jd=se.fromClass(class{constructor(i){this.view=i,this.decorations=M.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(i.state.facet(io)),this.decorations=this.decorator.createDeco(i)}makeDecorator(i){return new Cc({regexp:i.specialChars,decoration:(e,t,r)=>{let{doc:n}=t.state,s=fe(e[0],0);if(s==9){let o=n.lineAt(r),a=t.state.tabSize,l=Xt(o.text,a,r-o.from);return M.replace({widget:new Ac((a-l%a)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[s]||(this.decorationCache[s]=M.replace({widget:new Rc(i,s)}))},boundary:i.replaceTabs?void 0:/[^]/})}update(i){let e=i.state.facet(io);i.startState.facet(io)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(i.view)):this.decorations=this.decorator.updateDeco(i,this.decorations)}},{decorations:i=>i.decorations}))}var qw="\u2022";function Vw(i){return i>=32?qw:i==10?"\u2424":String.fromCharCode(9216+i)}var Rc=class extends Ne{constructor(e,t){super(),this.options=e,this.code=t}eq(e){return e.code==this.code}toDOM(e){let t=Vw(this.code),r=e.state.phrase("Control character")+" "+(_w[this.code]||"0x"+this.code.toString(16)),n=this.options.render&&this.options.render(this.code,r,t);if(n)return n;let s=document.createElement("span");return s.textContent=t,s.title=r,s.setAttribute("aria-label",r),s.className="cm-specialChar",s}ignoreEvent(){return!1}},Ac=class extends Ne{constructor(e){super(),this.width=e}eq(e){return e.width==this.width}toDOM(){let e=document.createElement("span");return e.textContent="	",e.className="cm-tab",e.style.width=this.width+"px",e}ignoreEvent(){return!1}};function im(){return Bw}var $w=M.line({class:"cm-activeLine"}),Bw=se.fromClass(class{constructor(i){this.decorations=this.getDeco(i)}update(i){(i.docChanged||i.selectionSet)&&(this.decorations=this.getDeco(i.view))}getDeco(i){let e=-1,t=[];for(let r of i.state.selection.ranges){let n=i.lineBlockAt(r.head);n.from>e&&(t.push($w.range(n.from)),e=n.from)}return M.set(t)}},{decorations:i=>i.decorations});var Qc=2e3;function Xw(i,e,t){let r=Math.min(e.line,t.line),n=Math.max(e.line,t.line),s=[];if(e.off>Qc||t.off>Qc||e.col<0||t.col<0){let o=Math.min(e.off,t.off),a=Math.max(e.off,t.off);for(let l=r;l<=n;l++){let c=i.doc.line(l);c.length<=a&&s.push(T.range(c.from+o,c.to+a))}}else{let o=Math.min(e.col,t.col),a=Math.max(e.col,t.col);for(let l=r;l<=n;l++){let c=i.doc.line(l),h=Ns(c.text,o,i.tabSize,!0);if(h<0)s.push(T.cursor(c.to));else{let u=Ns(c.text,a,i.tabSize);s.push(T.range(c.from+h,c.from+u))}}}return s}function Nw(i,e){let t=i.coordsAtPos(i.viewport.from);return t?Math.round(Math.abs((t.left-e)/i.defaultCharacterWidth)):-1}function Id(i,e){let t=i.posAtCoords({x:e.clientX,y:e.clientY},!1),r=i.state.doc.lineAt(t),n=t-r.from,s=n>Qc?-1:n==r.length?Nw(i,e.clientX):Xt(r.text,i.state.tabSize,t-r.from);return{line:r.number,col:s,off:n}}function jw(i,e){let t=Id(i,e),r=i.state.selection;return t?{update(n){if(n.docChanged){let s=n.changes.mapPos(n.startState.doc.line(t.line).from),o=n.state.doc.lineAt(s);t={line:o.number,col:t.col,off:Math.min(t.off,o.length)},r=r.map(n.changes)}},get(n,s,o){let a=Id(i,n);if(!a)return r;let l=Xw(i.state,t,a);return l.length?o?T.create(l.concat(r.ranges)):T.create(l):r}}:null}function rm(i){let e=i?.eventFilter||(t=>t.altKey&&t.button==0);return R.mouseSelectionStyle.of((t,r)=>e(r)?jw(t,r):null)}var Iw={Alt:[18,i=>!!i.altKey],Control:[17,i=>!!i.ctrlKey],Shift:[16,i=>!!i.shiftKey],Meta:[91,i=>!!i.metaKey]},Ww={style:"cursor: crosshair"};function nm(i={}){let[e,t]=Iw[i.key||"Alt"],r=se.fromClass(class{constructor(n){this.view=n,this.isDown=!1}set(n){this.isDown!=n&&(this.isDown=n,this.view.update([]))}},{eventObservers:{keydown(n){this.set(n.keyCode==e||t(n))},keyup(n){(n.keyCode==e||!t(n))&&this.set(!1)},mousemove(n){this.set(t(n))}}});return[r,R.contentAttributes.of(n=>{var s;return!((s=n.plugin(r))===null||s===void 0)&&s.isDown?Ww:null})]}var en="-10000px",mo=class{constructor(e,t,r,n){this.facet=t,this.createTooltipView=r,this.removeTooltipView=n,this.input=e.state.facet(t),this.tooltips=this.input.filter(o=>o);let s=null;this.tooltipViews=this.tooltips.map(o=>s=r(o,s))}update(e,t){var r;let n=e.state.facet(this.facet),s=n.filter(l=>l);if(n===this.input){for(let l of this.tooltipViews)l.update&&l.update(e);return!1}let o=[],a=t?[]:null;for(let l=0;l<s.length;l++){let c=s[l],h=-1;if(c){for(let u=0;u<this.tooltips.length;u++){let f=this.tooltips[u];f&&f.create==c.create&&(h=u)}if(h<0)o[l]=this.createTooltipView(c,l?o[l-1]:null),a&&(a[l]=!!c.above);else{let u=o[l]=this.tooltipViews[h];a&&(a[l]=t[h]),u.update&&u.update(e)}}}for(let l of this.tooltipViews)o.indexOf(l)<0&&(this.removeTooltipView(l),(r=l.destroy)===null||r===void 0||r.call(l));return t&&(a.forEach((l,c)=>t[c]=l),t.length=a.length),this.input=n,this.tooltips=s,this.tooltipViews=o,!0}};function zw(i){let{win:e}=i;return{top:0,left:0,bottom:e.innerHeight,right:e.innerWidth}}var zl=A.define({combine:i=>{var e,t,r;return{position:Q.ios?"absolute":((e=i.find(n=>n.position))===null||e===void 0?void 0:e.position)||"fixed",parent:((t=i.find(n=>n.parent))===null||t===void 0?void 0:t.parent)||null,tooltipSpace:((r=i.find(n=>n.tooltipSpace))===null||r===void 0?void 0:r.tooltipSpace)||zw}}}),Wd=new WeakMap,Nc=se.fromClass(class{constructor(i){this.view=i,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let e=i.state.facet(zl);this.position=e.position,this.parent=e.parent,this.classes=i.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver=typeof ResizeObserver=="function"?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new mo(i,Sn,(t,r)=>this.createTooltip(t,r),t=>{this.resizeObserver&&this.resizeObserver.unobserve(t.dom),t.dom.remove()}),this.above=this.manager.tooltips.map(t=>!!t.above),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(t=>{Date.now()>this.lastTransaction-50&&t.length>0&&t[t.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),i.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let i of this.manager.tooltipViews)this.intersectionObserver.observe(i.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(i){i.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(i,this.above);e&&this.observeIntersection();let t=e||i.geometryChanged,r=i.state.facet(zl);if(r.position!=this.position&&!this.madeAbsolute){this.position=r.position;for(let n of this.manager.tooltipViews)n.dom.style.position=this.position;t=!0}if(r.parent!=this.parent){this.parent&&this.container.remove(),this.parent=r.parent,this.createContainer();for(let n of this.manager.tooltipViews)this.container.appendChild(n.dom);t=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);t&&this.maybeMeasure()}createTooltip(i,e){let t=i.create(this.view),r=e?e.dom:null;if(t.dom.classList.add("cm-tooltip"),i.arrow&&!t.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let n=document.createElement("div");n.className="cm-tooltip-arrow",t.dom.appendChild(n)}return t.dom.style.position=this.position,t.dom.style.top=en,t.dom.style.left="0px",this.container.insertBefore(t.dom,r),t.mount&&t.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(t.dom),t}destroy(){var i,e,t;this.view.win.removeEventListener("resize",this.measureSoon);for(let r of this.manager.tooltipViews)r.dom.remove(),(i=r.destroy)===null||i===void 0||i.call(r);this.parent&&this.container.remove(),(e=this.resizeObserver)===null||e===void 0||e.disconnect(),(t=this.intersectionObserver)===null||t===void 0||t.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let i=this.view.dom.getBoundingClientRect(),e=1,t=1,r=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:n}=this.manager.tooltipViews[0];if(Q.gecko)r=n.offsetParent!=this.container.ownerDocument.body;else if(n.style.top==en&&n.style.left=="0px"){let s=n.getBoundingClientRect();r=Math.abs(s.top+1e4)>1||Math.abs(s.left)>1}}if(r||this.position=="absolute")if(this.parent){let n=this.parent.getBoundingClientRect();n.width&&n.height&&(e=n.width/this.parent.offsetWidth,t=n.height/this.parent.offsetHeight)}else({scaleX:e,scaleY:t}=this.view.viewState);return{editor:i,parent:this.parent?this.container.getBoundingClientRect():i,pos:this.manager.tooltips.map((n,s)=>{let o=this.manager.tooltipViews[s];return o.getCoords?o.getCoords(n.pos):this.view.coordsAtPos(n.pos)}),size:this.manager.tooltipViews.map(({dom:n})=>n.getBoundingClientRect()),space:this.view.state.facet(zl).tooltipSpace(this.view),scaleX:e,scaleY:t,makeAbsolute:r}}writeMeasure(i){var e;if(i.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let a of this.manager.tooltipViews)a.dom.style.position="absolute"}let{editor:t,space:r,scaleX:n,scaleY:s}=i,o=[];for(let a=0;a<this.manager.tooltips.length;a++){let l=this.manager.tooltips[a],c=this.manager.tooltipViews[a],{dom:h}=c,u=i.pos[a],f=i.size[a];if(!u||u.bottom<=Math.max(t.top,r.top)||u.top>=Math.min(t.bottom,r.bottom)||u.right<Math.max(t.left,r.left)-.1||u.left>Math.min(t.right,r.right)+.1){h.style.top=en;continue}let d=l.arrow?c.dom.querySelector(".cm-tooltip-arrow"):null,m=d?7:0,p=f.right-f.left,g=(e=Wd.get(c))!==null&&e!==void 0?e:f.bottom-f.top,O=c.offset||Fw,y=this.view.textDirection==G.LTR,x=f.width>r.right-r.left?y?r.left:r.right-f.width:y?Math.min(u.left-(d?14:0)+O.x,r.right-p):Math.max(r.left,u.left-p+(d?14:0)-O.x),v=this.above[a];!l.strictSide&&(v?u.top-(f.bottom-f.top)-O.y<r.top:u.bottom+(f.bottom-f.top)+O.y>r.bottom)&&v==r.bottom-u.bottom>u.top-r.top&&(v=this.above[a]=!v);let w=(v?u.top-r.top:r.bottom-u.bottom)-m;if(w<g&&c.resize!==!1){if(w<this.view.defaultLineHeight){h.style.top=en;continue}Wd.set(c,g),h.style.height=(g=w)/s+"px"}else h.style.height&&(h.style.height="");let P=v?u.top-g-m-O.y:u.bottom+m+O.y,C=x+p;if(c.overlap!==!0)for(let _ of o)_.left<C&&_.right>x&&_.top<P+g&&_.bottom>P&&(P=v?_.top-g-2-m:_.bottom+m+2);if(this.position=="absolute"?(h.style.top=(P-i.parent.top)/s+"px",h.style.left=(x-i.parent.left)/n+"px"):(h.style.top=P/s+"px",h.style.left=x/n+"px"),d){let _=u.left+(y?O.x:-O.x)-(x+14-7);d.style.left=_/n+"px"}c.overlap!==!0&&o.push({left:x,top:P,right:C,bottom:P+g}),h.classList.toggle("cm-tooltip-above",v),h.classList.toggle("cm-tooltip-below",!v),c.positioned&&c.positioned(i.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let i of this.manager.tooltipViews)i.dom.style.top=en}},{eventObservers:{scroll(){this.maybeMeasure()}}}),Uw=R.baseTheme({".cm-tooltip":{zIndex:100,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:`${7*2}px`,position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),Fw={x:0,y:0},Sn=A.define({enables:[Nc,Uw]}),go=A.define({combine:i=>i.reduce((e,t)=>e.concat(t),[])}),Oo=class i{static create(e){return new i(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new mo(e,go,(t,r)=>this.createHostedView(t,r),t=>t.dom.remove())}createHostedView(e,t){let r=e.create(this.view);return r.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(r.dom,t?t.dom.nextSibling:this.dom.firstChild),this.mounted&&r.mount&&r.mount(this.view),r}mount(e){for(let t of this.manager.tooltipViews)t.mount&&t.mount(e);this.mounted=!0}positioned(e){for(let t of this.manager.tooltipViews)t.positioned&&t.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let t of this.manager.tooltipViews)(e=t.destroy)===null||e===void 0||e.call(t)}passProp(e){let t;for(let r of this.manager.tooltipViews){let n=r[e];if(n!==void 0){if(t===void 0)t=n;else if(t!==n)return}}return t}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}},Hw=Sn.compute([go],i=>{let e=i.facet(go);return e.length===0?null:{pos:Math.min(...e.map(t=>t.pos)),end:Math.max(...e.map(t=>{var r;return(r=t.end)!==null&&r!==void 0?r:t.pos})),create:Oo.create,above:e[0].above,arrow:e.some(t=>t.arrow)}}),Mc=class{constructor(e,t,r,n,s){this.view=e,this.source=t,this.field=r,this.setHover=n,this.hoverTime=s,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:e.dom,time:0},this.checkHover=this.checkHover.bind(this),e.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),e.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let e=Date.now()-this.lastMove.time;e<this.hoverTime?this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime-e):this.startHover()}startHover(){clearTimeout(this.restartTimeout);let{view:e,lastMove:t}=this,r=e.docView.nearest(t.target);if(!r)return;let n,s=1;if(r instanceof gn)n=r.posAtStart;else{if(n=e.posAtCoords(t),n==null)return;let a=e.coordsAtPos(n);if(!a||t.y<a.top||t.y>a.bottom||t.x<a.left-e.defaultCharacterWidth||t.x>a.right+e.defaultCharacterWidth)return;let l=e.bidiSpans(e.state.doc.lineAt(n)).find(h=>h.from<=n&&h.to>=n),c=l&&l.dir==G.RTL?-1:1;s=t.x<a.left?-c:c}let o=this.source(e,n,s);if(o?.then){let a=this.pending={pos:n};o.then(l=>{this.pending==a&&(this.pending=null,l&&!(Array.isArray(l)&&!l.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(l)?l:[l])}))},l=>xe(e.state,l,"hover tooltip"))}else o&&!(Array.isArray(o)&&!o.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(o)?o:[o])})}get tooltip(){let e=this.view.plugin(Nc),t=e?e.manager.tooltips.findIndex(r=>r.create==Oo.create):-1;return t>-1?e.manager.tooltipViews[t]:null}mousemove(e){var t,r;this.lastMove={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:n,tooltip:s}=this;if(n.length&&s&&!Gw(s.dom,e)||this.pending){let{pos:o}=n[0]||this.pending,a=(r=(t=n[0])===null||t===void 0?void 0:t.end)!==null&&r!==void 0?r:o;(o==a?this.view.posAtCoords(this.lastMove)!=o:!Yw(this.view,o,a,e.clientX,e.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:t}=this;if(t.length){let{tooltip:r}=this;r&&r.dom.contains(e.relatedTarget)?this.watchTooltipLeave(r.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(e){let t=r=>{e.removeEventListener("mouseleave",t),this.active.length&&!this.view.dom.contains(r.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};e.addEventListener("mouseleave",t)}destroy(){clearTimeout(this.hoverTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}},Zs=4;function Gw(i,e){let t=i.getBoundingClientRect();return e.clientX>=t.left-Zs&&e.clientX<=t.right+Zs&&e.clientY>=t.top-Zs&&e.clientY<=t.bottom+Zs}function Yw(i,e,t,r,n,s){let o=i.scrollDOM.getBoundingClientRect(),a=i.documentTop+i.documentPadding.top+i.contentHeight;if(o.left>r||o.right<r||o.top>n||Math.min(o.bottom,a)<n)return!1;let l=i.posAtCoords({x:r,y:n},!1);return l>=e&&l<=t}function sm(i,e={}){let t=D.define(),r=re.define({create(){return[]},update(n,s){if(n.length&&(e.hideOnChange&&(s.docChanged||s.selection)?n=[]:e.hideOn&&(n=n.filter(o=>!e.hideOn(s,o))),s.docChanged)){let o=[];for(let a of n){let l=s.changes.mapPos(a.pos,-1,ye.TrackDel);if(l!=null){let c=Object.assign(Object.create(null),a);c.pos=l,c.end!=null&&(c.end=s.changes.mapPos(c.end)),o.push(c)}}n=o}for(let o of s.effects)o.is(t)&&(n=o.value),o.is(Zw)&&(n=[]);return n},provide:n=>go.from(n)});return[r,se.define(n=>new Mc(n,i,r,t,e.hoverTime||300)),Hw]}function jc(i,e){let t=i.plugin(Nc);if(!t)return null;let r=t.manager.tooltips.indexOf(e);return r<0?null:t.manager.tooltipViews[r]}var Zw=D.define();var zd=A.define({combine(i){let e,t;for(let r of i)e=e||r.topContainer,t=t||r.bottomContainer;return{topContainer:e,bottomContainer:t}}});function Mi(i,e){let t=i.plugin(om),r=t?t.specs.indexOf(e):-1;return r>-1?t.panels[r]:null}var om=se.fromClass(class{constructor(i){this.input=i.state.facet(Qi),this.specs=this.input.filter(t=>t),this.panels=this.specs.map(t=>t(i));let e=i.state.facet(zd);this.top=new cr(i,!0,e.topContainer),this.bottom=new cr(i,!1,e.bottomContainer),this.top.sync(this.panels.filter(t=>t.top)),this.bottom.sync(this.panels.filter(t=>!t.top));for(let t of this.panels)t.dom.classList.add("cm-panel"),t.mount&&t.mount()}update(i){let e=i.state.facet(zd);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new cr(i.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new cr(i.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let t=i.state.facet(Qi);if(t!=this.input){let r=t.filter(l=>l),n=[],s=[],o=[],a=[];for(let l of r){let c=this.specs.indexOf(l),h;c<0?(h=l(i.view),a.push(h)):(h=this.panels[c],h.update&&h.update(i)),n.push(h),(h.top?s:o).push(h)}this.specs=r,this.panels=n,this.top.sync(s),this.bottom.sync(o);for(let l of a)l.dom.classList.add("cm-panel"),l.mount&&l.mount()}else for(let r of this.panels)r.update&&r.update(i)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:i=>R.scrollMargins.of(e=>{let t=e.plugin(i);return t&&{top:t.top.scrollMargin(),bottom:t.bottom.scrollMargin()}})}),cr=class{constructor(e,t,r){this.view=e,this.top=t,this.container=r,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let t of this.panels)t.destroy&&e.indexOf(t)<0&&t.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(this.panels.length==0){this.dom&&(this.dom.remove(),this.dom=void 0);return}if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let t=this.container||this.view.dom;t.insertBefore(this.dom,this.top?t.firstChild:null)}let e=this.dom.firstChild;for(let t of this.panels)if(t.dom.parentNode==this.dom){for(;e!=t.dom;)e=Ud(e);e=e.nextSibling}else this.dom.insertBefore(t.dom,e);for(;e;)e=Ud(e)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(!(!this.container||this.classes==this.view.themeClasses)){for(let e of this.classes.split(" "))e&&this.container.classList.remove(e);for(let e of(this.classes=this.view.themeClasses).split(" "))e&&this.container.classList.add(e)}}};function Ud(i){let e=i.nextSibling;return i.remove(),e}var Qi=A.define({enables:om}),He=class extends ft{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}};He.prototype.elementClass="";He.prototype.toDOM=void 0;He.prototype.mapMode=ye.TrackBefore;He.prototype.startSide=He.prototype.endSide=-1;He.prototype.point=!0;var ro=A.define(),Jw={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>z.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{}},fn=A.define();function Ic(i){return[am(),fn.of(Object.assign(Object.assign({},Jw),i))]}var _c=A.define({combine:i=>i.some(e=>e)});function am(i){let e=[Kw];return i&&i.fixed===!1&&e.push(_c.of(!0)),e}var Kw=se.fromClass(class{constructor(i){this.view=i,this.prevViewport=i.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=i.state.facet(fn).map(e=>new yo(i,e));for(let e of this.gutters)this.dom.appendChild(e.dom);this.fixed=!i.state.facet(_c),this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),i.scrollDOM.insertBefore(this.dom,i.contentDOM)}update(i){if(this.updateGutters(i)){let e=this.prevViewport,t=i.view.viewport,r=Math.min(e.to,t.to)-Math.max(e.from,t.from);this.syncGutters(r<(t.to-t.from)*.8)}i.geometryChanged&&(this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px"),this.view.state.facet(_c)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":""),this.prevViewport=i.view.viewport}syncGutters(i){let e=this.dom.nextSibling;i&&this.dom.remove();let t=z.iter(this.view.state.facet(ro),this.view.viewport.from),r=[],n=this.gutters.map(s=>new Lc(s,this.view.viewport,-this.view.documentPadding.top));for(let s of this.view.viewportLineBlocks)if(r.length&&(r=[]),Array.isArray(s.type)){let o=!0;for(let a of s.type)if(a.type==Le.Text&&o){Dc(t,r,a.from);for(let l of n)l.line(this.view,a,r);o=!1}else if(a.widget)for(let l of n)l.widget(this.view,a)}else if(s.type==Le.Text){Dc(t,r,s.from);for(let o of n)o.line(this.view,s,r)}else if(s.widget)for(let o of n)o.widget(this.view,s);for(let s of n)s.finish();i&&this.view.scrollDOM.insertBefore(this.dom,e)}updateGutters(i){let e=i.startState.facet(fn),t=i.state.facet(fn),r=i.docChanged||i.heightChanged||i.viewportChanged||!z.eq(i.startState.facet(ro),i.state.facet(ro),i.view.viewport.from,i.view.viewport.to);if(e==t)for(let n of this.gutters)n.update(i)&&(r=!0);else{r=!0;let n=[];for(let s of t){let o=e.indexOf(s);o<0?n.push(new yo(this.view,s)):(this.gutters[o].update(i),n.push(this.gutters[o]))}for(let s of this.gutters)s.dom.remove(),n.indexOf(s)<0&&s.destroy();for(let s of n)this.dom.appendChild(s.dom);this.gutters=n}return r}destroy(){for(let i of this.gutters)i.destroy();this.dom.remove()}},{provide:i=>R.scrollMargins.of(e=>{let t=e.plugin(i);return!t||t.gutters.length==0||!t.fixed?null:e.textDirection==G.LTR?{left:t.dom.offsetWidth*e.scaleX}:{right:t.dom.offsetWidth*e.scaleX}})});function Fd(i){return Array.isArray(i)?i:[i]}function Dc(i,e,t){for(;i.value&&i.from<=t;)i.from==t&&e.push(i.value),i.next()}var Lc=class{constructor(e,t,r){this.gutter=e,this.height=r,this.i=0,this.cursor=z.iter(e.markers,t.from)}addElement(e,t,r){let{gutter:n}=this,s=(t.top-this.height)/e.scaleY,o=t.height/e.scaleY;if(this.i==n.elements.length){let a=new bo(e,o,s,r);n.elements.push(a),n.dom.appendChild(a.dom)}else n.elements[this.i].update(e,o,s,r);this.height=t.bottom,this.i++}line(e,t,r){let n=[];Dc(this.cursor,n,t.from),r.length&&(n=n.concat(r));let s=this.gutter.config.lineMarker(e,t,n);s&&n.unshift(s);let o=this.gutter;n.length==0&&!o.config.renderEmptyElements||this.addElement(e,t,n)}widget(e,t){let r=this.gutter.config.widgetMarker(e,t.widget,t);r&&this.addElement(e,t,[r])}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let t=e.elements.pop();e.dom.removeChild(t.dom),t.destroy()}}},yo=class{constructor(e,t){this.view=e,this.config=t,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let r in t.domEventHandlers)this.dom.addEventListener(r,n=>{let s=n.target,o;if(s!=this.dom&&this.dom.contains(s)){for(;s.parentNode!=this.dom;)s=s.parentNode;let l=s.getBoundingClientRect();o=(l.top+l.bottom)/2}else o=n.clientY;let a=e.lineBlockAtHeight(o-e.documentTop);t.domEventHandlers[r](e,a,n)&&n.preventDefault()});this.markers=Fd(t.markers(e)),t.initialSpacer&&(this.spacer=new bo(e,0,0,[t.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let t=this.markers;if(this.markers=Fd(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let n=this.config.updateSpacer(this.spacer.markers[0],e);n!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[n])}let r=e.view.viewport;return!z.eq(this.markers,t,r.from,r.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}},bo=class{constructor(e,t,r,n){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,t,r,n)}update(e,t,r,n){this.height!=t&&(this.height=t,this.dom.style.height=t+"px"),this.above!=r&&(this.dom.style.marginTop=(this.above=r)?r+"px":""),ev(this.markers,n)||this.setMarkers(e,n)}setMarkers(e,t){let r="cm-gutterElement",n=this.dom.firstChild;for(let s=0,o=0;;){let a=o,l=s<t.length?t[s++]:null,c=!1;if(l){let h=l.elementClass;h&&(r+=" "+h);for(let u=o;u<this.markers.length;u++)if(this.markers[u].compare(l)){a=u,c=!0;break}}else a=this.markers.length;for(;o<a;){let h=this.markers[o++];if(h.toDOM){h.destroy(n);let u=n.nextSibling;n.remove(),n=u}}if(!l)break;l.toDOM&&(c?n=n.nextSibling:this.dom.insertBefore(l.toDOM(e),n)),c&&o++}this.dom.className=r,this.markers=t}destroy(){this.setMarkers(null,[])}};function ev(i,e){if(i.length!=e.length)return!1;for(let t=0;t<i.length;t++)if(!i[t].compare(e[t]))return!1;return!0}var tv=A.define(),hr=A.define({combine(i){return Ce(i,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(e,t){let r=Object.assign({},e);for(let n in t){let s=r[n],o=t[n];r[n]=s?(a,l,c)=>s(a,l,c)||o(a,l,c):o}return r}})}}),dn=class extends He{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}};function Ul(i,e){return i.state.facet(hr).formatNumber(e,i.state)}var iv=fn.compute([hr],i=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(tv)},lineMarker(e,t,r){return r.some(n=>n.toDOM)?null:new dn(Ul(e,e.state.doc.lineAt(t.from).number))},widgetMarker:()=>null,lineMarkerChange:e=>e.startState.facet(hr)!=e.state.facet(hr),initialSpacer(e){return new dn(Ul(e,Hd(e.state.doc.lines)))},updateSpacer(e,t){let r=Ul(t.view,Hd(t.view.state.doc.lines));return r==e.number?e:new dn(r)},domEventHandlers:i.facet(hr).domEventHandlers}));function lm(i={}){return[hr.of(i),am(),iv]}function Hd(i){let e=9;for(;e<i;)e=e*10+9;return e}var rv=new class extends He{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},nv=ro.compute(["selection"],i=>{let e=[],t=-1;for(let r of i.selection.ranges){let n=i.doc.lineAt(r.head).from;n>t&&(t=n,e.push(rv.range(n)))}return z.of(e)});function cm(){return nv}var sv=0,kn=class{constructor(e,t){this.from=e,this.to=t}},L=class{constructor(e={}){this.id=sv++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")})}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=Ee.match(e)),t=>{let r=e(t);return r===void 0?null:[this,r]}}};L.closedBy=new L({deserialize:i=>i.split(" ")});L.openedBy=new L({deserialize:i=>i.split(" ")});L.group=new L({deserialize:i=>i.split(" ")});L.isolate=new L({deserialize:i=>{if(i&&i!="rtl"&&i!="ltr"&&i!="auto")throw new RangeError("Invalid value for isolate: "+i);return i||"auto"}});L.contextHash=new L({perNode:!0});L.lookAhead=new L({perNode:!0});L.mounted=new L({perNode:!0});var fr=class{constructor(e,t,r){this.tree=e,this.overlay=t,this.parser=r}static get(e){return e&&e.props&&e.props[L.mounted.id]}},ov=Object.create(null),Ee=class i{constructor(e,t,r,n=0){this.name=e,this.props=t,this.id=r,this.flags=n}static define(e){let t=e.props&&e.props.length?Object.create(null):ov,r=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),n=new i(e.name||"",t,e.id,r);if(e.props){for(let s of e.props)if(Array.isArray(s)||(s=s(n)),s){if(s[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[s[0].id]=s[1]}}return n}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let t=this.prop(L.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let r in e)for(let n of r.split(" "))t[n]=e[r];return r=>{for(let n=r.prop(L.group),s=-1;s<(n?n.length:0);s++){let o=t[s<0?r.name:n[s]];if(o)return o}}}};Ee.none=new Ee("",Object.create(null),0,8);var Tn=class i{constructor(e){this.types=e;for(let t=0;t<e.length;t++)if(e[t].id!=t)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let t=[];for(let r of this.types){let n=null;for(let s of e){let o=s(r);o&&(n||(n=Object.assign({},r.props)),n[o[0].id]=o[1])}t.push(n?new Ee(r.name,n,r.id,r.flags):r)}return new i(t)}},vo=new WeakMap,hm=new WeakMap,ae;(function(i){i[i.ExcludeBuffers=1]="ExcludeBuffers",i[i.IncludeAnonymous=2]="IncludeAnonymous",i[i.IgnoreMounts=4]="IgnoreMounts",i[i.IgnoreOverlays=8]="IgnoreOverlays"})(ae||(ae={}));var ce=class i{constructor(e,t,r,n,s){if(this.type=e,this.children=t,this.positions=r,this.length=n,this.props=null,s&&s.length){this.props=Object.create(null);for(let[o,a]of s)this.props[typeof o=="number"?o:o.id]=a}}toString(){let e=fr.get(this);if(e&&!e.overlay)return e.tree.toString();let t="";for(let r of this.children){let n=r.toString();n&&(t&&(t+=","),t+=n)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(t.length?"("+t+")":""):t}cursor(e=0){return new Cn(this.topNode,e)}cursorAt(e,t=0,r=0){let n=vo.get(this)||this.topNode,s=new Cn(n);return s.moveTo(e,t),vo.set(this,s._tree),s}get topNode(){return new ot(this,0,0,null)}resolve(e,t=0){let r=Pn(vo.get(this)||this.topNode,e,t,!1);return vo.set(this,r),r}resolveInner(e,t=0){let r=Pn(hm.get(this)||this.topNode,e,t,!0);return hm.set(this,r),r}resolveStack(e,t=0){return av(this,e,t)}iterate(e){let{enter:t,leave:r,from:n=0,to:s=this.length}=e,o=e.mode||0,a=(o&ae.IncludeAnonymous)>0;for(let l=this.cursor(o|ae.IncludeAnonymous);;){let c=!1;if(l.from<=s&&l.to>=n&&(!a&&l.type.isAnonymous||t(l)!==!1)){if(l.firstChild())continue;c=!0}for(;c&&r&&(a||!l.type.isAnonymous)&&r(l),!l.nextSibling();){if(!l.parent())return;c=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:Yc(Ee.none,this.children,this.positions,0,this.children.length,0,this.length,(t,r,n)=>new i(this.type,t,r,n,this.propValues),e.makeTree||((t,r,n)=>new i(Ee.none,t,r,n)))}static build(e){return lv(e)}};ce.empty=new ce(Ee.none,[],[],0);var Wc=class i{constructor(e,t){this.buffer=e,this.index=t}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new i(this.buffer,this.index)}},ni=class i{constructor(e,t,r){this.buffer=e,this.length=t,this.set=r}get type(){return Ee.none}toString(){let e=[];for(let t=0;t<this.buffer.length;)e.push(this.childString(t)),t=this.buffer[t+3];return e.join(",")}childString(e){let t=this.buffer[e],r=this.buffer[e+3],n=this.set.types[t],s=n.name;if(/\W/.test(s)&&!n.isError&&(s=JSON.stringify(s)),e+=4,r==e)return s;let o=[];for(;e<r;)o.push(this.childString(e)),e=this.buffer[e+3];return s+"("+o.join(",")+")"}findChild(e,t,r,n,s){let{buffer:o}=this,a=-1;for(let l=e;l!=t&&!(dm(s,n,o[l+1],o[l+2])&&(a=l,r>0));l=o[l+3]);return a}slice(e,t,r){let n=this.buffer,s=new Uint16Array(t-e),o=0;for(let a=e,l=0;a<t;){s[l++]=n[a++],s[l++]=n[a++]-r;let c=s[l++]=n[a++]-r;s[l++]=n[a++]-e,o=Math.max(o,c)}return new i(s,o,this.set)}};function dm(i,e,t,r){switch(i){case-2:return t<e;case-1:return r>=e&&t<e;case 0:return t<e&&r>e;case 1:return t<=e&&r>e;case 2:return r>e;case 4:return!0}}function Pn(i,e,t,r){for(var n;i.from==i.to||(t<1?i.from>=e:i.from>e)||(t>-1?i.to<=e:i.to<e);){let o=!r&&i instanceof ot&&i.index<0?null:i.parent;if(!o)return i;i=o}let s=r?0:ae.IgnoreOverlays;if(r)for(let o=i,a=o.parent;a;o=a,a=o.parent)o instanceof ot&&o.index<0&&((n=a.enter(e,t,s))===null||n===void 0?void 0:n.from)!=o.from&&(i=a);for(;;){let o=i.enter(e,t,s);if(!o)return i;i=o}}var So=class{cursor(e=0){return new Cn(this,e)}getChild(e,t=null,r=null){let n=um(this,e,t,r);return n.length?n[0]:null}getChildren(e,t=null,r=null){return um(this,e,t,r)}resolve(e,t=0){return Pn(this,e,t,!1)}resolveInner(e,t=0){return Pn(this,e,t,!0)}matchContext(e){return zc(this,e)}enterUnfinishedNodesBefore(e){let t=this.childBefore(e),r=this;for(;t;){let n=t.lastChild;if(!n||n.to!=t.to)break;n.type.isError&&n.from==n.to?(r=t,t=n.prevSibling):t=n}return r}get node(){return this}get next(){return this.parent}},ot=class i extends So{constructor(e,t,r,n){super(),this._tree=e,this.from=t,this.index=r,this._parent=n}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,t,r,n,s=0){for(let o=this;;){for(let{children:a,positions:l}=o._tree,c=t>0?a.length:-1;e!=c;e+=t){let h=a[e],u=l[e]+o.from;if(dm(n,r,u,u+h.length)){if(h instanceof ni){if(s&ae.ExcludeBuffers)continue;let f=h.findChild(0,h.buffer.length,t,r-u,n);if(f>-1)return new _i(new Uc(o,h,e,u),null,f)}else if(s&ae.IncludeAnonymous||!h.type.isAnonymous||Gc(h)){let f;if(!(s&ae.IgnoreMounts)&&(f=fr.get(h))&&!f.overlay)return new i(f.tree,u,e,o);let d=new i(h,u,e,o);return s&ae.IncludeAnonymous||!d.type.isAnonymous?d:d.nextChild(t<0?h.children.length-1:0,t,r,n)}}}if(s&ae.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?e=o.index+t:e=t<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}enter(e,t,r=0){let n;if(!(r&ae.IgnoreOverlays)&&(n=fr.get(this._tree))&&n.overlay){let s=e-this.from;for(let{from:o,to:a}of n.overlay)if((t>0?o<=s:o<s)&&(t<0?a>=s:a>s))return new i(n.tree,n.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,r)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}};function um(i,e,t,r){let n=i.cursor(),s=[];if(!n.firstChild())return s;if(t!=null){for(let o=!1;!o;)if(o=n.type.is(t),!n.nextSibling())return s}for(;;){if(r!=null&&n.type.is(r))return s;if(n.type.is(e)&&s.push(n.node),!n.nextSibling())return r==null?s:[]}}function zc(i,e,t=e.length-1){for(let r=i.parent;t>=0;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(e[t]&&e[t]!=r.name)return!1;t--}}return!0}var Uc=class{constructor(e,t,r,n){this.parent=e,this.buffer=t,this.index=r,this.start=n}},_i=class i extends So{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,r){super(),this.context=e,this._parent=t,this.index=r,this.type=e.buffer.set.types[e.buffer.buffer[r]]}child(e,t,r){let{buffer:n}=this.context,s=n.findChild(this.index+4,n.buffer[this.index+3],e,t-this.context.start,r);return s<0?null:new i(this.context,this,s)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}enter(e,t,r=0){if(r&ae.ExcludeBuffers)return null;let{buffer:n}=this.context,s=n.findChild(this.index+4,n.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return s<0?null:new i(this.context,this,s)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new i(this.context,this._parent,t):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new i(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:r}=this.context,n=this.index+4,s=r.buffer[this.index+3];if(s>n){let o=r.buffer[this.index+1];e.push(r.slice(n,s,o)),t.push(0)}return new ce(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}};function pm(i){if(!i.length)return null;let e=0,t=i[0];for(let s=1;s<i.length;s++){let o=i[s];(o.from>t.from||o.to<t.to)&&(t=o,e=s)}let r=t instanceof ot&&t.index<0?null:t.parent,n=i.slice();return r?n[e]=r:n.splice(e,1),new Fc(n,t)}var Fc=class{constructor(e,t){this.heads=e,this.node=t}get next(){return pm(this.heads)}};function av(i,e,t){let r=i.resolveInner(e,t),n=null;for(let s=r instanceof ot?r:r.context.parent;s;s=s.parent)if(s.index<0){let o=s.parent;(n||(n=[r])).push(o.resolve(e,t)),s=o}else{let o=fr.get(s.tree);if(o&&o.overlay&&o.overlay[0].from<=e&&o.overlay[o.overlay.length-1].to>=e){let a=new ot(o.tree,o.overlay[0].from+s.from,-1,s);(n||(n=[r])).push(Pn(a,e,t,!1))}}return n?pm(n):r}var Cn=class{get name(){return this.type.name}constructor(e,t=0){if(this.mode=t,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,e instanceof ot)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let r=e._parent;r;r=r._parent)this.stack.unshift(r.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,t){this.index=e;let{start:r,buffer:n}=this.buffer;return this.type=t||n.set.types[n.buffer[e]],this.from=r+n.buffer[e+1],this.to=r+n.buffer[e+2],!0}yield(e){return e?e instanceof ot?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,r){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,r,this.mode));let{buffer:n}=this.buffer,s=n.findChild(this.index+4,n.buffer[this.index+3],e,t-this.buffer.start,r);return s<0?!1:(this.stack.push(this.index),this.yieldBuf(s))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,r=this.mode){return this.buffer?r&ae.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&ae.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&ae.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:t}=this.buffer,r=this.stack.length-1;if(e<0){let n=r<0?0:this.stack[r]+4;if(this.index!=n)return this.yieldBuf(t.findChild(n,this.index,-1,0,4))}else{let n=t.buffer[this.index+3];if(n<(r<0?t.buffer.length:t.buffer[this.stack[r]+3]))return this.yieldBuf(n)}return r<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,r,{buffer:n}=this;if(n){if(e>0){if(this.index<n.buffer.buffer.length)return!1}else for(let s=0;s<this.index;s++)if(n.buffer.buffer[s+3]<this.index)return!1;({index:t,parent:r}=n)}else({index:t,_parent:r}=this._tree);for(;r;{index:t,_parent:r}=r)if(t>-1)for(let s=t+e,o=e<0?-1:r._tree.children.length;s!=o;s+=e){let a=r._tree.children[s];if(this.mode&ae.IncludeAnonymous||a instanceof ni||!a.type.isAnonymous||Gc(a))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,t););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,t=null,r=0;if(e&&e.context==this.buffer)e:for(let n=this.index,s=this.stack.length;s>=0;){for(let o=e;o;o=o._parent)if(o.index==n){if(n==this.index)return o;t=o,r=s+1;break e}n=this.stack[--s]}for(let n=r;n<this.stack.length;n++)t=new _i(this.buffer,t,this.stack[n]);return this.bufferNode=new _i(this.buffer,t,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,t){for(let r=0;;){let n=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){r++;continue}this.type.isAnonymous||(n=!0)}for(;n&&t&&t(this),n=this.type.isAnonymous,!this.nextSibling();){if(!r)return;this.parent(),r--,n=!0}}}matchContext(e){if(!this.buffer)return zc(this.node,e);let{buffer:t}=this.buffer,{types:r}=t.set;for(let n=e.length-1,s=this.stack.length-1;n>=0;s--){if(s<0)return zc(this.node,e,n);let o=r[t.buffer[this.stack[s]]];if(!o.isAnonymous){if(e[n]&&e[n]!=o.name)return!1;n--}}return!0}};function Gc(i){return i.children.some(e=>e instanceof ni||!e.type.isAnonymous||Gc(e))}function lv(i){var e;let{buffer:t,nodeSet:r,maxBufferLength:n=1024,reused:s=[],minRepeatType:o=r.types.length}=i,a=Array.isArray(t)?new Wc(t,t.length):t,l=r.types,c=0,h=0;function u(w,P,C,_,$,q){let{id:N,start:B,end:Y,size:I}=a,ne=h;for(;I<0;)if(a.next(),I==-1){let ge=s[N];C.push(ge),_.push(B-w);return}else if(I==-3){c=N;return}else if(I==-4){h=N;return}else throw new RangeError(`Unrecognized record size: ${I}`);let qe=l[N],Ve,We,Ke=B-w;if(Y-B<=n&&(We=g(a.pos-P,$))){let ge=new Uint16Array(We.size-We.skip),et=a.pos-We.size,yt=ge.length;for(;a.pos>et;)yt=O(We.start,ge,yt);Ve=new ni(ge,Y-We.start,r),Ke=We.start-w}else{let ge=a.pos-I;a.next();let et=[],yt=[],gi=N>=o?N:-1,zi=0,is=Y;for(;a.pos>ge;)gi>=0&&a.id==gi&&a.size>=0?(a.end<=is-n&&(m(et,yt,B,zi,a.end,is,gi,ne),zi=et.length,is=a.end),a.next()):q>2500?f(B,ge,et,yt):u(B,ge,et,yt,gi,q+1);if(gi>=0&&zi>0&&zi<et.length&&m(et,yt,B,zi,B,is,gi,ne),et.reverse(),yt.reverse(),gi>-1&&zi>0){let Qu=d(qe);Ve=Yc(qe,et,yt,0,et.length,0,Y-B,Qu,Qu)}else Ve=p(qe,et,yt,Y-B,ne-Y)}C.push(Ve),_.push(Ke)}function f(w,P,C,_){let $=[],q=0,N=-1;for(;a.pos>P;){let{id:B,start:Y,end:I,size:ne}=a;if(ne>4)a.next();else{if(N>-1&&Y<N)break;N<0&&(N=I-n),$.push(B,Y,I),q++,a.next()}}if(q){let B=new Uint16Array(q*4),Y=$[$.length-2];for(let I=$.length-3,ne=0;I>=0;I-=3)B[ne++]=$[I],B[ne++]=$[I+1]-Y,B[ne++]=$[I+2]-Y,B[ne++]=ne;C.push(new ni(B,$[2]-Y,r)),_.push(Y-w)}}function d(w){return(P,C,_)=>{let $=0,q=P.length-1,N,B;if(q>=0&&(N=P[q])instanceof ce){if(!q&&N.type==w&&N.length==_)return N;(B=N.prop(L.lookAhead))&&($=C[q]+N.length+B)}return p(w,P,C,_,$)}}function m(w,P,C,_,$,q,N,B){let Y=[],I=[];for(;w.length>_;)Y.push(w.pop()),I.push(P.pop()+C-$);w.push(p(r.types[N],Y,I,q-$,B-q)),P.push($-C)}function p(w,P,C,_,$=0,q){if(c){let N=[L.contextHash,c];q=q?[N].concat(q):[N]}if($>25){let N=[L.lookAhead,$];q=q?[N].concat(q):[N]}return new ce(w,P,C,_,q)}function g(w,P){let C=a.fork(),_=0,$=0,q=0,N=C.end-n,B={size:0,start:0,skip:0};e:for(let Y=C.pos-w;C.pos>Y;){let I=C.size;if(C.id==P&&I>=0){B.size=_,B.start=$,B.skip=q,q+=4,_+=4,C.next();continue}let ne=C.pos-I;if(I<0||ne<Y||C.start<N)break;let qe=C.id>=o?4:0,Ve=C.start;for(C.next();C.pos>ne;){if(C.size<0)if(C.size==-3)qe+=4;else break e;else C.id>=o&&(qe+=4);C.next()}$=Ve,_+=I,q+=qe}return(P<0||_==w)&&(B.size=_,B.start=$,B.skip=q),B.size>4?B:void 0}function O(w,P,C){let{id:_,start:$,end:q,size:N}=a;if(a.next(),N>=0&&_<o){let B=C;if(N>4){let Y=a.pos-(N-4);for(;a.pos>Y;)C=O(w,P,C)}P[--C]=B,P[--C]=q-w,P[--C]=$-w,P[--C]=_}else N==-3?c=_:N==-4&&(h=_);return C}let y=[],x=[];for(;a.pos>0;)u(i.start||0,i.bufferStart||0,y,x,-1,0);let v=(e=i.length)!==null&&e!==void 0?e:y.length?x[0]+y[0].length:0;return new ce(l[i.topID],y.reverse(),x.reverse(),v)}var fm=new WeakMap;function xo(i,e){if(!i.isAnonymous||e instanceof ni||e.type!=i)return 1;let t=fm.get(e);if(t==null){t=1;for(let r of e.children){if(r.type!=i||!(r instanceof ce)){t=1;break}t+=xo(i,r)}fm.set(e,t)}return t}function Yc(i,e,t,r,n,s,o,a,l){let c=0;for(let m=r;m<n;m++)c+=xo(i,e[m]);let h=Math.ceil(c*1.5/8),u=[],f=[];function d(m,p,g,O,y){for(let x=g;x<O;){let v=x,w=p[x],P=xo(i,m[x]);for(x++;x<O;x++){let C=xo(i,m[x]);if(P+C>=h)break;P+=C}if(x==v+1){if(P>h){let C=m[v];d(C.children,C.positions,0,C.children.length,p[v]+y);continue}u.push(m[v])}else{let C=p[x-1]+m[x-1].length-w;u.push(Yc(i,m,p,v,x,w,C,null,l))}f.push(w+y-s)}}return d(e,t,r,n,0),(a||l)(u,f,o)}var ko=class{constructor(){this.map=new WeakMap}setBuffer(e,t,r){let n=this.map.get(e);n||this.map.set(e,n=new Map),n.set(t,r)}getBuffer(e,t){let r=this.map.get(e);return r&&r.get(t)}set(e,t){e instanceof _i?this.setBuffer(e.context.buffer,e.index,t):e instanceof ot&&this.map.set(e.tree,t)}get(e){return e instanceof _i?this.getBuffer(e.context.buffer,e.index):e instanceof ot?this.map.get(e.tree):void 0}cursorSet(e,t){e.buffer?this.setBuffer(e.buffer.buffer,e.index,t):this.map.set(e.tree,t)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}},Di=class i{constructor(e,t,r,n,s=!1,o=!1){this.from=e,this.to=t,this.tree=r,this.offset=n,this.open=(s?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,t=[],r=!1){let n=[new i(0,e.length,e,0,!1,r)];for(let s of t)s.to>e.length&&n.push(s);return n}static applyChanges(e,t,r=128){if(!t.length)return e;let n=[],s=1,o=e.length?e[0]:null;for(let a=0,l=0,c=0;;a++){let h=a<t.length?t[a]:null,u=h?h.fromA:1e9;if(u-l>=r)for(;o&&o.from<u;){let f=o;if(l>=f.from||u<=f.to||c){let d=Math.max(f.from,l)-c,m=Math.min(f.to,u)-c;f=d>=m?null:new i(d,m,f.tree,f.offset+c,a>0,!!h)}if(f&&n.push(f),o.to>u)break;o=s<e.length?e[s++]:null}if(!h)break;l=h.toA,c=h.toA-h.toB}return n}},dr=class{startParse(e,t,r){return typeof e=="string"&&(e=new Hc(e)),r=r?r.length?r.map(n=>new kn(n.from,n.to)):[new kn(0,0)]:[new kn(0,e.length)],this.createParse(e,t||[],r)}parse(e,t,r){let n=this.startParse(e,t,r);for(;;){let s=n.advance();if(s)return s}}},Hc=class{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}};var DP=new L({perNode:!0});var cv=0,Rt=class i{constructor(e,t,r){this.set=e,this.base=t,this.modified=r,this.id=cv++}static define(e){if(e?.base)throw new Error("Can not derive from a modified tag");let t=new i([],null,[]);if(t.set.push(t),e)for(let r of e.set)t.set.push(r);return t}static defineModifier(){let e=new Eo;return t=>t.modified.indexOf(e)>-1?t:Eo.get(t.base||t,t.modified.concat(e).sort((r,n)=>r.id-n.id))}},hv=0,Eo=class i{constructor(){this.instances=[],this.id=hv++}static get(e,t){if(!t.length)return e;let r=t[0].instances.find(a=>a.base==e&&uv(t,a.modified));if(r)return r;let n=[],s=new Rt(n,e,t);for(let a of t)a.instances.push(s);let o=fv(t);for(let a of e.set)if(!a.modified.length)for(let l of o)n.push(i.get(a,l));return s}};function uv(i,e){return i.length==e.length&&i.every((t,r)=>t==e[r])}function fv(i){let e=[[]];for(let t=0;t<i.length;t++)for(let r=0,n=e.length;r<n;r++)e.push(e[r].concat(i[t]));return e.sort((t,r)=>r.length-t.length)}function mr(i){let e=Object.create(null);for(let t in i){let r=i[t];Array.isArray(r)||(r=[r]);for(let n of t.split(" "))if(n){let s=[],o=2,a=n;for(let u=0;;){if(a=="..."&&u>0&&u+3==n.length){o=1;break}let f=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(a);if(!f)throw new RangeError("Invalid path: "+n);if(s.push(f[0]=="*"?"":f[0][0]=='"'?JSON.parse(f[0]):f[0]),u+=f[0].length,u==n.length)break;let d=n[u++];if(u==n.length&&d=="!"){o=0;break}if(d!="/")throw new RangeError("Invalid path: "+n);a=n.slice(u)}let l=s.length-1,c=s[l];if(!c)throw new RangeError("Invalid path: "+n);let h=new pr(r,o,l>0?s.slice(0,l):null);e[c]=h.sort(e[c])}}return Om.add(e)}var Om=new L,pr=class{constructor(e,t,r,n){this.tags=e,this.mode=t,this.context=r,this.next=n}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth<this.depth?(this.next=e,this):(e.next=this.sort(e.next),e)}get depth(){return this.context?this.context.length:0}};pr.empty=new pr([],2,null);function Rn(i,e){let t=Object.create(null);for(let s of i)if(!Array.isArray(s.tag))t[s.tag.id]=s.class;else for(let o of s.tag)t[o.id]=s.class;let{scope:r,all:n=null}=e||{};return{style:s=>{let o=n;for(let a of s)for(let l of a.set){let c=t[l.id];if(c){o=o?o+" "+c:c;break}}return o},scope:r}}function dv(i,e){let t=null;for(let r of i){let n=r.style(e);n&&(t=t?t+" "+n:n)}return t}function eh(i,e,t,r=0,n=i.length){let s=new Jc(r,Array.isArray(e)?e:[e],t);s.highlightRange(i.cursor(),r,n,"",s.highlighters),s.flush(n)}function th(i,e,t,r,n,s=0,o=i.length){let a=s;function l(c,h){if(!(c<=a)){for(let u=i.slice(a,c),f=0;;){let d=u.indexOf(`
`,f),m=d<0?u.length:d;if(m>f&&r(u.slice(f,m),h),d<0)break;n(),f=d+1}a=c}}eh(e,t,(c,h,u)=>{l(c,""),l(h,u)},s,o),l(o,"")}var Jc=class{constructor(e,t,r){this.at=e,this.highlighters=t,this.span=r,this.class=""}startSpan(e,t){t!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=t)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,t,r,n,s){let{type:o,from:a,to:l}=e;if(a>=r||l<=t)return;o.isTop&&(s=this.highlighters.filter(d=>!d.scope||d.scope(o)));let c=n,h=pv(e)||pr.empty,u=dv(s,h.tags);if(u&&(c&&(c+=" "),c+=u,h.mode==1&&(n+=(n?" ":"")+u)),this.startSpan(Math.max(t,a),c),h.opaque)return;let f=e.tree&&e.tree.prop(L.mounted);if(f&&f.overlay){let d=e.node.enter(f.overlay[0].from+a,1),m=this.highlighters.filter(g=>!g.scope||g.scope(f.tree.type)),p=e.firstChild();for(let g=0,O=a;;g++){let y=g<f.overlay.length?f.overlay[g]:null,x=y?y.from+a:l,v=Math.max(t,O),w=Math.min(r,x);if(v<w&&p)for(;e.from<w&&(this.highlightRange(e,v,w,n,s),this.startSpan(Math.min(w,e.to),c),!(e.to>=x||!e.nextSibling())););if(!y||x>r)break;O=y.to+a,O>t&&(this.highlightRange(d.cursor(),Math.max(t,y.from+a),Math.min(r,O),"",m),this.startSpan(Math.min(r,O),c))}p&&e.parent()}else if(e.firstChild()){f&&(n="");do if(!(e.to<=t)){if(e.from>=r)break;this.highlightRange(e,t,r,n,s),this.startSpan(Math.min(r,e.to),c)}while(e.nextSibling());e.parent()}}};function pv(i){let e=i.type.prop(Om);for(;e&&e.context&&!i.matchContext(e.context);)e=e.next;return e||null}var E=Rt.define,To=E(),si=E(),mm=E(si),gm=E(si),oi=E(),Po=E(oi),Zc=E(oi),Et=E(),Li=E(Et),Pt=E(),Ct=E(),Kc=E(),En=E(Kc),Co=E(),b={comment:To,lineComment:E(To),blockComment:E(To),docComment:E(To),name:si,variableName:E(si),typeName:mm,tagName:E(mm),propertyName:gm,attributeName:E(gm),className:E(si),labelName:E(si),namespace:E(si),macroName:E(si),literal:oi,string:Po,docString:E(Po),character:E(Po),attributeValue:E(Po),number:Zc,integer:E(Zc),float:E(Zc),bool:E(oi),regexp:E(oi),escape:E(oi),color:E(oi),url:E(oi),keyword:Pt,self:E(Pt),null:E(Pt),atom:E(Pt),unit:E(Pt),modifier:E(Pt),operatorKeyword:E(Pt),controlKeyword:E(Pt),definitionKeyword:E(Pt),moduleKeyword:E(Pt),operator:Ct,derefOperator:E(Ct),arithmeticOperator:E(Ct),logicOperator:E(Ct),bitwiseOperator:E(Ct),compareOperator:E(Ct),updateOperator:E(Ct),definitionOperator:E(Ct),typeOperator:E(Ct),controlOperator:E(Ct),punctuation:Kc,separator:E(Kc),bracket:En,angleBracket:E(En),squareBracket:E(En),paren:E(En),brace:E(En),content:Et,heading:Li,heading1:E(Li),heading2:E(Li),heading3:E(Li),heading4:E(Li),heading5:E(Li),heading6:E(Li),contentSeparator:E(Et),list:E(Et),quote:E(Et),emphasis:E(Et),strong:E(Et),link:E(Et),monospace:E(Et),strikethrough:E(Et),inserted:E(),deleted:E(),changed:E(),invalid:E(),meta:Co,documentMeta:E(Co),annotation:E(Co),processingInstruction:E(Co),definition:Rt.defineModifier(),constant:Rt.defineModifier(),function:Rt.defineModifier(),standard:Rt.defineModifier(),local:Rt.defineModifier(),special:Rt.defineModifier()},VP=Rn([{tag:b.link,class:"tok-link"},{tag:b.heading,class:"tok-heading"},{tag:b.emphasis,class:"tok-emphasis"},{tag:b.strong,class:"tok-strong"},{tag:b.keyword,class:"tok-keyword"},{tag:b.atom,class:"tok-atom"},{tag:b.bool,class:"tok-bool"},{tag:b.url,class:"tok-url"},{tag:b.labelName,class:"tok-labelName"},{tag:b.inserted,class:"tok-inserted"},{tag:b.deleted,class:"tok-deleted"},{tag:b.literal,class:"tok-literal"},{tag:b.string,class:"tok-string"},{tag:b.number,class:"tok-number"},{tag:[b.regexp,b.escape,b.special(b.string)],class:"tok-string2"},{tag:b.variableName,class:"tok-variableName"},{tag:b.local(b.variableName),class:"tok-variableName tok-local"},{tag:b.definition(b.variableName),class:"tok-variableName tok-definition"},{tag:b.special(b.variableName),class:"tok-variableName2"},{tag:b.definition(b.propertyName),class:"tok-propertyName tok-definition"},{tag:b.typeName,class:"tok-typeName"},{tag:b.namespace,class:"tok-namespace"},{tag:b.className,class:"tok-className"},{tag:b.macroName,class:"tok-macroName"},{tag:b.propertyName,class:"tok-propertyName"},{tag:b.operator,class:"tok-operator"},{tag:b.comment,class:"tok-comment"},{tag:b.meta,class:"tok-meta"},{tag:b.invalid,class:"tok-invalid"},{tag:b.punctuation,class:"tok-punctuation"}]);var ih,gr=new L;function mv(i){return A.define({combine:i?e=>e.concat(i):void 0})}var gv=new L,Ge=class{constructor(e,t,r=[],n=""){this.data=e,this.name=n,W.prototype.hasOwnProperty("tree")||Object.defineProperty(W.prototype,"tree",{get(){return he(this)}}),this.parser=t,this.extension=[ai.of(this),W.languageData.of((s,o,a)=>{let l=ym(s,o,a),c=l.type.prop(gr);if(!c)return[];let h=s.facet(c),u=l.type.prop(gv);if(u){let f=l.resolve(o-l.from,a);for(let d of u)if(d.test(f,s)){let m=s.facet(d.facet);return d.type=="replace"?m:m.concat(h)}}return h})].concat(r)}isActiveAt(e,t,r=-1){return ym(e,t,r).type.prop(gr)==this.data}findRegions(e){let t=e.facet(ai);if(t?.data==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let r=[],n=(s,o)=>{if(s.prop(gr)==this.data){r.push({from:o,to:o+s.length});return}let a=s.prop(L.mounted);if(a){if(a.tree.prop(gr)==this.data){if(a.overlay)for(let l of a.overlay)r.push({from:l.from+o,to:l.to+o});else r.push({from:o,to:o+s.length});return}else if(a.overlay){let l=r.length;if(n(a.tree,a.overlay[0].from+o),r.length>l)return}}for(let l=0;l<s.children.length;l++){let c=s.children[l];c instanceof ce&&n(c,s.positions[l]+o)}};return n(he(e),0),r}get allowsNesting(){return!0}};Ge.setState=D.define();function ym(i,e,t){let r=i.facet(ai),n=he(i).topNode;if(!r||r.allowsNesting)for(let s=n;s;s=s.enter(e,t,ae.ExcludeBuffers))s.type.isTop&&(n=s);return n}var Or=class i extends Ge{constructor(e,t,r){super(e,t,[],r),this.parser=t}static define(e){let t=mv(e.languageData);return new i(t,e.parser.configure({props:[gr.add(r=>r.isTop?t:void 0)]}),e.name)}configure(e,t){return new i(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}};function he(i){let e=i.field(Ge.state,!1);return e?e.tree:ce.empty}var oh=class{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,t){let r=this.cursorPos-this.string.length;return e<r||t>=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-r,t-r)}},An=null,ah=class i{constructor(e,t,r=[],n,s,o,a,l){this.parser=e,this.state=t,this.fragments=r,this.tree=n,this.treeLen=s,this.viewport=o,this.skipped=a,this.scheduleOn=l,this.parse=null,this.tempSkipped=[]}static create(e,t,r){return new i(e,t,[],ce.empty,0,r,[],null)}startParse(){return this.parser.startParse(new oh(this.state.doc),this.fragments)}work(e,t){return t!=null&&t>=this.state.doc.length&&(t=void 0),this.tree!=ce.empty&&this.isDone(t??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var r;if(typeof e=="number"){let n=Date.now()+e;e=()=>Date.now()>n}for(this.parse||(this.parse=this.startParse()),t!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&t<this.state.doc.length&&this.parse.stopAt(t);;){let n=this.parse.advance();if(n)if(this.fragments=this.withoutTempSkipped(Di.addTree(n,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=(r=this.parse.stoppedAt)!==null&&r!==void 0?r:this.state.doc.length,this.tree=n,this.parse=null,this.treeLen<(t??this.state.doc.length))this.parse=this.startParse();else return!0;if(e())return!1}})}takeTree(){let e,t;this.parse&&(e=this.parse.parsedPos)>=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(t=this.parse.advance()););}),this.treeLen=e,this.tree=t,this.fragments=this.withoutTempSkipped(Di.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=An;An=this;try{return e()}finally{An=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=bm(e,t.from,t.to);return e}changes(e,t){let{fragments:r,tree:n,treeLen:s,viewport:o,skipped:a}=this;if(this.takeTree(),!e.empty){let l=[];if(e.iterChangedRanges((c,h,u,f)=>l.push({fromA:c,toA:h,fromB:u,toB:f})),r=Di.applyChanges(r,l),n=ce.empty,s=0,o={from:e.mapPos(o.from,-1),to:e.mapPos(o.to,1)},this.skipped.length){a=[];for(let c of this.skipped){let h=e.mapPos(c.from,1),u=e.mapPos(c.to,-1);h<u&&a.push({from:h,to:u})}}}return new i(this.parser,t,r,n,s,o,a,this.scheduleOn)}updateViewport(e){if(this.viewport.from==e.from&&this.viewport.to==e.to)return!1;this.viewport=e;let t=this.skipped.length;for(let r=0;r<this.skipped.length;r++){let{from:n,to:s}=this.skipped[r];n<e.to&&s>e.from&&(this.fragments=bm(this.fragments,n,s),this.skipped.splice(r--,1))}return this.skipped.length>=t?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,t){this.skipped.push({from:e,to:t})}static getSkippingParser(e){return new class extends dr{createParse(t,r,n){let s=n[0].from,o=n[n.length-1].to;return{parsedPos:s,advance(){let l=An;if(l){for(let c of n)l.tempSkipped.push(c);e&&(l.scheduleOn=l.scheduleOn?Promise.all([l.scheduleOn,e]):e)}return this.parsedPos=o,new ce(Ee.none,[],[],o-s)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let t=this.fragments;return this.treeLen>=e&&t.length&&t[0].from==0&&t[0].to>=e}static get(){return An}};function bm(i,e,t){return Di.applyChanges(i,[{fromA:e,toA:t,fromB:e,toB:t}])}var Mn=class i{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let t=this.context.changes(e.changes,e.state),r=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),t.viewport.to);return t.work(20,r)||t.takeTree(),new i(t)}static init(e){let t=Math.min(3e3,e.doc.length),r=ah.create(e.facet(ai).parser,e,{from:0,to:t});return r.work(20,t)||r.takeTree(),new i(r)}};Ge.state=re.define({create:Mn.init,update(i,e){for(let t of e.effects)if(t.is(Ge.setState))return t.value;return e.startState.facet(ai)!=e.state.facet(ai)?Mn.init(e.state):i.apply(e)}});var km=i=>{let e=setTimeout(()=>i(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(km=i=>{let e=-1,t=setTimeout(()=>{e=requestIdleCallback(i,{timeout:400})},100);return()=>e<0?clearTimeout(t):cancelIdleCallback(e)});var rh=typeof navigator<"u"&&(!((ih=navigator.scheduling)===null||ih===void 0)&&ih.isInputPending)?()=>navigator.scheduling.isInputPending():null,Ov=se.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let t=this.view.state.field(Ge.state).context;(t.updateViewport(e.view.viewport)||this.view.viewport.to>t.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(t)}scheduleWork(){if(this.working)return;let{state:e}=this.view,t=e.field(Ge.state);(t.tree!=t.context.tree||!t.context.isDone(e.doc.length))&&(this.working=km(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEnd<t&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=t+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:r,viewport:{to:n}}=this.view,s=r.field(Ge.state);if(s.tree==s.context.tree&&s.context.isDone(n+1e5))return;let o=Date.now()+Math.min(this.chunkBudget,100,e&&!rh?Math.max(25,e.timeRemaining()-5):1e9),a=s.context.treeLen<n&&r.doc.length>n+1e3,l=s.context.work(()=>rh&&rh()||Date.now()>o,n+(a?0:1e5));this.chunkBudget-=Date.now()-t,(l||this.chunkBudget<=0)&&(s.context.takeTree(),this.view.dispatch({effects:Ge.setState.of(new Mn(s.context))})),this.chunkBudget>0&&!(l&&!a)&&this.scheduleWork(),this.checkAsyncSchedule(s.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(t=>xe(this.view.state,t)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),ai=A.define({combine(i){return i.length?i[0]:null},enables:i=>[Ge.state,Ov,R.contentAttributes.compute([i],e=>{let t=e.facet(i);return t&&t.name?{"data-language":t.name}:{}})]}),yr=class{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}};var yv=A.define(),br=A.define({combine:i=>{if(!i.length)return"  ";let e=i[0];if(!e||/\S/.test(e)||Array.from(e).some(t=>t!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(i[0]));return e}});function _n(i){let e=i.facet(br);return e.charCodeAt(0)==9?i.tabSize*e.length:e.length}function wr(i,e){let t="",r=i.tabSize,n=i.facet(br)[0];if(n=="	"){for(;e>=r;)t+="	",e-=r;n=" "}for(let s=0;s<e;s++)t+=n;return t}function Mo(i,e){i instanceof W&&(i=new qi(i));for(let r of i.state.facet(yv)){let n=r(i,e);if(n!==void 0)return n}let t=he(i.state);return t.length>=e?bv(i,t,e):null}var qi=class{constructor(e,t={}){this.state=e,this.options=t,this.unit=_n(e)}lineAt(e,t=1){let r=this.state.doc.lineAt(e),{simulateBreak:n,simulateDoubleBreak:s}=this.options;return n!=null&&n>=r.from&&n<=r.to?s&&n==e?{text:"",from:e}:(t<0?n<e:n<=e)?{text:r.text.slice(n-r.from),from:n}:{text:r.text.slice(0,n-r.from),from:r.from}:r}textAfterPos(e,t=1){if(this.options.simulateDoubleBreak&&e==this.options.simulateBreak)return"";let{text:r,from:n}=this.lineAt(e,t);return r.slice(e-n,Math.min(r.length,e+100-n))}column(e,t=1){let{text:r,from:n}=this.lineAt(e,t),s=this.countColumn(r,e-n),o=this.options.overrideIndentation?this.options.overrideIndentation(n):-1;return o>-1&&(s+=o-this.countColumn(r,r.search(/\S|$/))),s}countColumn(e,t=e.length){return Xt(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:r,from:n}=this.lineAt(e,t),s=this.options.overrideIndentation;if(s){let o=s(n);if(o>-1)return o}return this.countColumn(r,r.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}},Dn=new L;function bv(i,e,t){let r=e.resolveStack(t),n=r.node.enterUnfinishedNodesBefore(t);if(n!=r.node){let s=[];for(let o=n;o!=r.node;o=o.parent)s.push(o);for(let o=s.length-1;o>=0;o--)r={node:s[o],next:r}}return Tm(r,i,t)}function Tm(i,e,t){for(let r=i;r;r=r.next){let n=vv(r.node);if(n)return n(lh.create(e,t,r))}return 0}function wv(i){return i.pos==i.options.simulateBreak&&i.options.simulateDoubleBreak}function vv(i){let e=i.type.prop(Dn);if(e)return e;let t=i.firstChild,r;if(t&&(r=t.type.prop(L.closedBy))){let n=i.lastChild,s=n&&r.indexOf(n.name)>-1;return o=>Pm(o,!0,1,void 0,s&&!wv(o)?n.from:void 0)}return i.parent==null?xv:null}function xv(){return 0}var lh=class i extends qi{constructor(e,t,r){super(e.state,e.options),this.base=e,this.pos=t,this.context=r}get node(){return this.context.node}static create(e,t,r){return new i(e,t,r)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let t=this.state.doc.lineAt(e.from);for(;;){let r=e.resolve(t.from);for(;r.parent&&r.parent.from==r.from;)r=r.parent;if(Sv(r,e))break;t=this.state.doc.lineAt(r.from)}return this.lineIndent(t.from)}continue(){return Tm(this.context.next,this.base,this.pos)}};function Sv(i,e){for(let t=e;t;t=t.parent)if(i==t)return!0;return!1}function kv(i){let e=i.node,t=e.childAfter(e.from),r=e.lastChild;if(!t)return null;let n=i.options.simulateBreak,s=i.state.doc.lineAt(t.from),o=n==null||n<=s.from?s.to:Math.min(s.to,n);for(let a=t.to;;){let l=e.childAfter(a);if(!l||l==r)return null;if(!l.type.isSkipped)return l.from<o?t:null;a=l.to}}function $i({closing:i,align:e=!0,units:t=1}){return r=>Pm(r,e,t,i)}function Pm(i,e,t,r,n){let s=i.textAfter,o=s.match(/^\s*/)[0].length,a=r&&s.slice(o,o+r.length)==r||n==i.pos+o,l=e?kv(i):null;return l?a?i.column(l.from):i.column(l.to):i.baseIndent+(a?0:i.unit*t)}var Tv=200;function Cm(){return W.transactionFilter.of(i=>{if(!i.docChanged||!i.isUserEvent("input.type")&&!i.isUserEvent("input.complete"))return i;let e=i.startState.languageDataAt("indentOnInput",i.startState.selection.main.head);if(!e.length)return i;let t=i.newDoc,{head:r}=i.newSelection.main,n=t.lineAt(r);if(r>n.from+Tv)return i;let s=t.sliceString(n.from,r);if(!e.some(c=>c.test(s)))return i;let{state:o}=i,a=-1,l=[];for(let{head:c}of o.selection.ranges){let h=o.doc.lineAt(c);if(h.from==a)continue;a=h.from;let u=Mo(o,h.from);if(u==null)continue;let f=/^\s*/.exec(h.text)[0],d=wr(o,u);f!=d&&l.push({from:h.from,to:h.from+f.length,insert:d})}return l.length?[i,{changes:l,sequential:!0}]:i})}var Pv=A.define(),Ln=new L;function _o(i){let e=i.firstChild,t=i.lastChild;return e&&e.to<t.from?{from:e.to,to:t.type.isError?i.to:t.from}:null}function Cv(i,e,t){let r=he(i);if(r.length<t)return null;let n=r.resolveStack(t,1),s=null;for(let o=n;o;o=o.next){let a=o.node;if(a.to<=t||a.from>t)continue;if(s&&a.from<e)break;let l=a.type.prop(Ln);if(l&&(a.to<r.length-50||r.length==i.doc.length||!Ev(a))){let c=l(a,i);c&&c.from<=t&&c.from>=e&&c.to>t&&(s=c)}}return s}function Ev(i){let e=i.lastChild;return e&&e.to==i.to&&e.type.isError}function Ro(i,e,t){for(let r of i.facet(Pv)){let n=r(i,e,t);if(n)return n}return Cv(i,e,t)}function Em(i,e){let t=e.mapPos(i.from,1),r=e.mapPos(i.to,-1);return t>=r?void 0:{from:t,to:r}}var Do=D.define({map:Em}),qn=D.define({map:Em});function Rm(i){let e=[];for(let{head:t}of i.state.selection.ranges)e.some(r=>r.from<=t&&r.to>=t)||e.push(i.lineBlockAt(t));return e}var Vi=re.define({create(){return M.none},update(i,e){i=i.map(e.changes);for(let t of e.effects)if(t.is(Do)&&!Rv(i,t.value.from,t.value.to)){let{preparePlaceholder:r}=e.state.facet(ph),n=r?M.replace({widget:new ch(r(e.state,t.value))}):wm;i=i.update({add:[n.range(t.value.from,t.value.to)]})}else t.is(qn)&&(i=i.update({filter:(r,n)=>t.value.from!=r||t.value.to!=n,filterFrom:t.value.from,filterTo:t.value.to}));if(e.selection){let t=!1,{head:r}=e.selection.main;i.between(r,r,(n,s)=>{n<r&&s>r&&(t=!0)}),t&&(i=i.update({filterFrom:r,filterTo:r,filter:(n,s)=>s<=r||n>=r}))}return i},provide:i=>R.decorations.from(i),toJSON(i,e){let t=[];return i.between(0,e.doc.length,(r,n)=>{t.push(r,n)}),t},fromJSON(i){if(!Array.isArray(i)||i.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let t=0;t<i.length;){let r=i[t++],n=i[t++];if(typeof r!="number"||typeof n!="number")throw new RangeError("Invalid JSON for fold state");e.push(wm.range(r,n))}return M.set(e,!0)}});function Ao(i,e,t){var r;let n=null;return(r=i.field(Vi,!1))===null||r===void 0||r.between(e,t,(s,o)=>{(!n||n.from>s)&&(n={from:s,to:o})}),n}function Rv(i,e,t){let r=!1;return i.between(e,e,(n,s)=>{n==e&&s==t&&(r=!0)}),r}function Am(i,e){return i.field(Vi,!1)?e:e.concat(D.appendConfig.of(_m()))}var Av=i=>{for(let e of Rm(i)){let t=Ro(i.state,e.from,e.to);if(t)return i.dispatch({effects:Am(i.state,[Do.of(t),Qm(i,t)])}),!0}return!1},Qv=i=>{if(!i.state.field(Vi,!1))return!1;let e=[];for(let t of Rm(i)){let r=Ao(i.state,t.from,t.to);r&&e.push(qn.of(r),Qm(i,r,!1))}return e.length&&i.dispatch({effects:e}),e.length>0};function Qm(i,e,t=!0){let r=i.state.doc.lineAt(e.from).number,n=i.state.doc.lineAt(e.to).number;return R.announce.of(`${i.state.phrase(t?"Folded lines":"Unfolded lines")} ${r} ${i.state.phrase("to")} ${n}.`)}var Mv=i=>{let{state:e}=i,t=[];for(let r=0;r<e.doc.length;){let n=i.lineBlockAt(r),s=Ro(e,n.from,n.to);s&&t.push(Do.of(s)),r=(s?i.lineBlockAt(s.to):n).to+1}return t.length&&i.dispatch({effects:Am(i.state,t)}),!!t.length},_v=i=>{let e=i.state.field(Vi,!1);if(!e||!e.size)return!1;let t=[];return e.between(0,i.state.doc.length,(r,n)=>{t.push(qn.of({from:r,to:n}))}),i.dispatch({effects:t}),!0};var Mm=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:Av},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:Qv},{key:"Ctrl-Alt-[",run:Mv},{key:"Ctrl-Alt-]",run:_v}],Dv={placeholderDOM:null,preparePlaceholder:null,placeholderText:"\u2026"},ph=A.define({combine(i){return Ce(i,Dv)}});function _m(i){let e=[Vi,qv];return i&&e.push(ph.of(i)),e}function Dm(i,e){let{state:t}=i,r=t.facet(ph),n=o=>{let a=i.lineBlockAt(i.posAtDOM(o.target)),l=Ao(i.state,a.from,a.to);l&&i.dispatch({effects:qn.of(l)}),o.preventDefault()};if(r.placeholderDOM)return r.placeholderDOM(i,n,e);let s=document.createElement("span");return s.textContent=r.placeholderText,s.setAttribute("aria-label",t.phrase("folded code")),s.title=t.phrase("unfold"),s.className="cm-foldPlaceholder",s.onclick=n,s}var wm=M.replace({widget:new class extends Ne{toDOM(i){return Dm(i,null)}}}),ch=class extends Ne{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return Dm(e,this.value)}},Lv={openText:"\u2304",closedText:"\u203A",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1},Qn=class extends He{constructor(e,t){super(),this.config=e,this.open=t}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let t=document.createElement("span");return t.textContent=this.open?this.config.openText:this.config.closedText,t.title=e.state.phrase(this.open?"Fold line":"Unfold line"),t}};function Lm(i={}){let e=Object.assign(Object.assign({},Lv),i),t=new Qn(e,!0),r=new Qn(e,!1),n=se.fromClass(class{constructor(o){this.from=o.viewport.from,this.markers=this.buildMarkers(o)}update(o){(o.docChanged||o.viewportChanged||o.startState.facet(ai)!=o.state.facet(ai)||o.startState.field(Vi,!1)!=o.state.field(Vi,!1)||he(o.startState)!=he(o.state)||e.foldingChanged(o))&&(this.markers=this.buildMarkers(o.view))}buildMarkers(o){let a=new dt;for(let l of o.viewportLineBlocks){let c=Ao(o.state,l.from,l.to)?r:Ro(o.state,l.from,l.to)?t:null;c&&a.add(l.from,l.from,c)}return a.finish()}}),{domEventHandlers:s}=e;return[n,Ic({class:"cm-foldGutter",markers(o){var a;return((a=o.plugin(n))===null||a===void 0?void 0:a.markers)||z.empty},initialSpacer(){return new Qn(e,!1)},domEventHandlers:Object.assign(Object.assign({},s),{click:(o,a,l)=>{if(s.click&&s.click(o,a,l))return!0;let c=Ao(o.state,a.from,a.to);if(c)return o.dispatch({effects:qn.of(c)}),!0;let h=Ro(o.state,a.from,a.to);return h?(o.dispatch({effects:Do.of(h)}),!0):!1}})}),_m()]}var qv=R.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}}),Qo=class i{constructor(e,t){this.specs=e;let r;function n(a){let l=rt.newName();return(r||(r=Object.create(null)))["."+l]=a,l}let s=typeof t.all=="string"?t.all:t.all?n(t.all):void 0,o=t.scope;this.scope=o instanceof Ge?a=>a.prop(gr)==o.data:o?a=>a==o:void 0,this.style=Rn(e.map(a=>({tag:a.tag,class:a.class||n(Object.assign({},a,{tag:null}))})),{all:s}).style,this.module=r?new rt(r):null,this.themeType=t.themeType}static define(e,t){return new i(e,t||{})}},hh=A.define(),qm=A.define({combine(i){return i.length?[i[0]]:null}});function nh(i){let e=i.facet(hh);return e.length?e:i.facet(qm)}function Vn(i,e){let t=[Vv],r;return i instanceof Qo&&(i.module&&t.push(R.styleModule.of(i.module)),r=i.themeType),e?.fallback?t.push(qm.of(i)):r?t.push(hh.computeN([R.darkTheme],n=>n.facet(R.darkTheme)==(r=="dark")?[i]:[])):t.push(hh.of(i)),t}var uh=class{constructor(e){this.markCache=Object.create(null),this.tree=he(e.state),this.decorations=this.buildDeco(e,nh(e.state)),this.decoratedTo=e.viewport.to}update(e){let t=he(e.state),r=nh(e.state),n=r!=nh(e.startState),{viewport:s}=e.view,o=e.changes.mapPos(this.decoratedTo,1);t.length<s.to&&!n&&t.type==this.tree.type&&o>=s.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=o):(t!=this.tree||e.viewportChanged||n)&&(this.tree=t,this.decorations=this.buildDeco(e.view,r),this.decoratedTo=s.to)}buildDeco(e,t){if(!t||!this.tree.length)return M.none;let r=new dt;for(let{from:n,to:s}of e.visibleRanges)eh(this.tree,t,(o,a,l)=>{r.add(o,a,this.markCache[l]||(this.markCache[l]=M.mark({class:l})))},n,s);return r.finish()}},Vv=_e.high(se.fromClass(uh,{decorations:i=>i.decorations})),Vm=Qo.define([{tag:b.meta,color:"#404740"},{tag:b.link,textDecoration:"underline"},{tag:b.heading,textDecoration:"underline",fontWeight:"bold"},{tag:b.emphasis,fontStyle:"italic"},{tag:b.strong,fontWeight:"bold"},{tag:b.strikethrough,textDecoration:"line-through"},{tag:b.keyword,color:"#708"},{tag:[b.atom,b.bool,b.url,b.contentSeparator,b.labelName],color:"#219"},{tag:[b.literal,b.inserted],color:"#164"},{tag:[b.string,b.deleted],color:"#a11"},{tag:[b.regexp,b.escape,b.special(b.string)],color:"#e40"},{tag:b.definition(b.variableName),color:"#00f"},{tag:b.local(b.variableName),color:"#30a"},{tag:[b.typeName,b.namespace],color:"#085"},{tag:b.className,color:"#167"},{tag:[b.special(b.variableName),b.macroName],color:"#256"},{tag:b.definition(b.propertyName),color:"#00c"},{tag:b.comment,color:"#940"},{tag:b.invalid,color:"#f00"}]),$v=R.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),$m=1e4,Bm="()[]{}",Xm=A.define({combine(i){return Ce(i,{afterCursor:!0,brackets:Bm,maxScanDistance:$m,renderMatch:Nv})}}),Bv=M.mark({class:"cm-matchingBracket"}),Xv=M.mark({class:"cm-nonmatchingBracket"});function Nv(i){let e=[],t=i.matched?Bv:Xv;return e.push(t.range(i.start.from,i.start.to)),i.end&&e.push(t.range(i.end.from,i.end.to)),e}var jv=re.define({create(){return M.none},update(i,e){if(!e.docChanged&&!e.selection)return i;let t=[],r=e.state.facet(Xm);for(let n of e.state.selection.ranges){if(!n.empty)continue;let s=mt(e.state,n.head,-1,r)||n.head>0&&mt(e.state,n.head-1,1,r)||r.afterCursor&&(mt(e.state,n.head,1,r)||n.head<e.state.doc.length&&mt(e.state,n.head+1,-1,r));s&&(t=t.concat(r.renderMatch(s,e.state)))}return M.set(t,!0)},provide:i=>R.decorations.from(i)}),Iv=[jv,$v];function Nm(i={}){return[Xm.of(i),Iv]}var Wv=new L;function fh(i,e,t){let r=i.prop(e<0?L.openedBy:L.closedBy);if(r)return r;if(i.name.length==1){let n=t.indexOf(i.name);if(n>-1&&n%2==(e<0?1:0))return[t[n+e]]}return null}function dh(i){let e=i.type.prop(Wv);return e?e(i.node):i}function mt(i,e,t,r={}){let n=r.maxScanDistance||$m,s=r.brackets||Bm,o=he(i),a=o.resolveInner(e,t);for(let l=a;l;l=l.parent){let c=fh(l.type,t,s);if(c&&l.from<l.to){let h=dh(l);if(h&&(t>0?e>=h.from&&e<h.to:e>h.from&&e<=h.to))return zv(i,e,t,l,h,c,s)}}return Uv(i,e,t,o,a.type,n,s)}function zv(i,e,t,r,n,s,o){let a=r.parent,l={from:n.from,to:n.to},c=0,h=a?.cursor();if(h&&(t<0?h.childBefore(r.from):h.childAfter(r.to)))do if(t<0?h.to<=r.from:h.from>=r.to){if(c==0&&s.indexOf(h.type.name)>-1&&h.from<h.to){let u=dh(h);return{start:l,end:u?{from:u.from,to:u.to}:void 0,matched:!0}}else if(fh(h.type,t,o))c++;else if(fh(h.type,-t,o)){if(c==0){let u=dh(h);return{start:l,end:u&&u.from<u.to?{from:u.from,to:u.to}:void 0,matched:!1}}c--}}while(t<0?h.prevSibling():h.nextSibling());return{start:l,matched:!1}}function Uv(i,e,t,r,n,s,o){let a=t<0?i.sliceDoc(e-1,e):i.sliceDoc(e,e+1),l=o.indexOf(a);if(l<0||l%2==0!=t>0)return null;let c={from:t<0?e-1:e,to:t>0?e+1:e},h=i.doc.iterRange(e,t>0?i.doc.length:0),u=0;for(let f=0;!h.next().done&&f<=s;){let d=h.value;t<0&&(f+=d.length);let m=e+f*t;for(let p=t>0?0:d.length-1,g=t>0?d.length:-1;p!=g;p+=t){let O=o.indexOf(d[p]);if(!(O<0||r.resolveInner(m+p,1).type!=n))if(O%2==0==t>0)u++;else{if(u==1)return{start:c,end:{from:m+p,to:m+p+1},matched:O>>1==l>>1};u--}}t>0&&(f+=d.length)}return h.done?{start:c,matched:!1}:null}var Fv=Object.create(null),vm=[Ee.none];var xm=[],Sm=Object.create(null),Hv=Object.create(null);for(let[i,e]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])Hv[i]=Gv(Fv,e);function sh(i,e){xm.indexOf(i)>-1||(xm.push(i),console.warn(e))}function Gv(i,e){let t=[];for(let a of e.split(" ")){let l=[];for(let c of a.split(".")){let h=i[c]||b[c];h?typeof h=="function"?l.length?l=l.map(h):sh(c,`Modifier ${c} used at start of tag`):l.length?sh(c,`Tag ${c} used as modifier`):l=Array.isArray(h)?h:[h]:sh(c,`Unknown highlighting tag ${c}`)}for(let c of l)t.push(c)}if(!t.length)return 0;let r=e.replace(/ /g,"_"),n=r+" "+t.map(a=>a.id),s=Sm[n];if(s)return s.id;let o=Sm[n]=Ee.define({id:vm.length,name:r,props:[mr({[r]:t})]});return vm.push(o),o.id}var zP={rtl:M.mark({class:"cm-iso",inclusive:!0,attributes:{dir:"rtl"},bidiIsolate:G.RTL}),ltr:M.mark({class:"cm-iso",inclusive:!0,attributes:{dir:"ltr"},bidiIsolate:G.LTR}),auto:M.mark({class:"cm-iso",inclusive:!0,attributes:{dir:"auto"},bidiIsolate:null})};var Yv=i=>{let{state:e}=i,t=e.doc.lineAt(e.selection.main.from),r=vh(i.state,t.from);return r.line?Zv(i):r.block?Kv(i):!1};function wh(i,e){return({state:t,dispatch:r})=>{if(t.readOnly)return!1;let n=i(e,t);return n?(r(t.update(n)),!0):!1}}var Zv=wh(ix,0);var Jv=wh(Gm,0);var Kv=wh((i,e)=>Gm(i,e,tx(e)),0);function vh(i,e){let t=i.languageDataAt("commentTokens",e);return t.length?t[0]:{}}var $n=50;function ex(i,{open:e,close:t},r,n){let s=i.sliceDoc(r-$n,r),o=i.sliceDoc(n,n+$n),a=/\s*$/.exec(s)[0].length,l=/^\s*/.exec(o)[0].length,c=s.length-a;if(s.slice(c-e.length,c)==e&&o.slice(l,l+t.length)==t)return{open:{pos:r-a,margin:a&&1},close:{pos:n+l,margin:l&&1}};let h,u;n-r<=2*$n?h=u=i.sliceDoc(r,n):(h=i.sliceDoc(r,r+$n),u=i.sliceDoc(n-$n,n));let f=/^\s*/.exec(h)[0].length,d=/\s*$/.exec(u)[0].length,m=u.length-d-t.length;return h.slice(f,f+e.length)==e&&u.slice(m,m+t.length)==t?{open:{pos:r+f+e.length,margin:/\s/.test(h.charAt(f+e.length))?1:0},close:{pos:n-d-t.length,margin:/\s/.test(u.charAt(m-1))?1:0}}:null}function tx(i){let e=[];for(let t of i.selection.ranges){let r=i.doc.lineAt(t.from),n=t.to<=r.to?r:i.doc.lineAt(t.to),s=e.length-1;s>=0&&e[s].to>r.from?e[s].to=n.to:e.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:n.to})}return e}function Gm(i,e,t=e.selection.ranges){let r=t.map(s=>vh(e,s.from).block);if(!r.every(s=>s))return null;let n=t.map((s,o)=>ex(e,r[o],s.from,s.to));if(i!=2&&!n.every(s=>s))return{changes:e.changes(t.map((s,o)=>n[o]?[]:[{from:s.from,insert:r[o].open+" "},{from:s.to,insert:" "+r[o].close}]))};if(i!=1&&n.some(s=>s)){let s=[];for(let o=0,a;o<n.length;o++)if(a=n[o]){let l=r[o],{open:c,close:h}=a;s.push({from:c.pos-l.open.length,to:c.pos+c.margin},{from:h.pos-h.margin,to:h.pos+l.close.length})}return{changes:s}}return null}function ix(i,e,t=e.selection.ranges){let r=[],n=-1;for(let{from:s,to:o}of t){let a=r.length,l=1e9,c=vh(e,s).line;if(c){for(let h=s;h<=o;){let u=e.doc.lineAt(h);if(u.from>n&&(s==o||o>u.from)){n=u.from;let f=/^\s*/.exec(u.text)[0].length,d=f==u.length,m=u.text.slice(f,f+c.length)==c?f:-1;f<u.text.length&&f<l&&(l=f),r.push({line:u,comment:m,token:c,indent:f,empty:d,single:!1})}h=u.to+1}if(l<1e9)for(let h=a;h<r.length;h++)r[h].indent<r[h].line.text.length&&(r[h].indent=l);r.length==a+1&&(r[a].single=!0)}}if(i!=2&&r.some(s=>s.comment<0&&(!s.empty||s.single))){let s=[];for(let{line:a,token:l,indent:c,empty:h,single:u}of r)(u||!h)&&s.push({from:a.from+c,insert:l+" "});let o=e.changes(s);return{changes:o,selection:e.selection.map(o,1)}}else if(i!=1&&r.some(s=>s.comment>=0)){let s=[];for(let{line:o,comment:a,token:l}of r)if(a>=0){let c=o.from+a,h=c+l.length;o.text[h-o.from]==" "&&h++,s.push({from:c,to:h})}return{changes:s}}return null}var gh=Be.define(),rx=Be.define(),nx=A.define(),Ym=A.define({combine(i){return Ce(i,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(r,n)=>e(r,n)||t(r,n)})}}),Zm=re.define({create(){return Bi.empty},update(i,e){let t=e.state.facet(Ym),r=e.annotation(gh);if(r){let l=gt.fromTransaction(e,r.selection),c=r.side,h=c==0?i.undone:i.done;return l?h=qo(h,h.length,t.minDepth,l):h=tg(h,e.startState.selection),new Bi(c==0?r.rest:h,c==0?h:r.rest)}let n=e.annotation(rx);if((n=="full"||n=="before")&&(i=i.isolate()),e.annotation(de.addToHistory)===!1)return e.changes.empty?i:i.addMapping(e.changes.desc);let s=gt.fromTransaction(e),o=e.annotation(de.time),a=e.annotation(de.userEvent);return s?i=i.addChanges(s,o,a,t,e):e.selection&&(i=i.addSelection(e.startState.selection,o,a,t.newGroupDelay)),(n=="full"||n=="after")&&(i=i.isolate()),i},toJSON(i){return{done:i.done.map(e=>e.toJSON()),undone:i.undone.map(e=>e.toJSON())}},fromJSON(i){return new Bi(i.done.map(gt.fromJSON),i.undone.map(gt.fromJSON))}});function Jm(i={}){return[Zm,Ym.of(i),R.domEventHandlers({beforeinput(e,t){let r=e.inputType=="historyUndo"?Km:e.inputType=="historyRedo"?Oh:null;return r?(e.preventDefault(),r(t)):!1}})]}function Vo(i,e){return function({state:t,dispatch:r}){if(!e&&t.readOnly)return!1;let n=t.field(Zm,!1);if(!n)return!1;let s=n.pop(i,t,e);return s?(r(s),!0):!1}}var Km=Vo(0,!1),Oh=Vo(1,!1),sx=Vo(0,!0),ox=Vo(1,!0);var gt=class i{constructor(e,t,r,n,s){this.changes=e,this.effects=t,this.mapped=r,this.startSelection=n,this.selectionsAfter=s}setSelAfter(e){return new i(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,r;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(t=this.mapped)===null||t===void 0?void 0:t.toJSON(),startSelection:(r=this.startSelection)===null||r===void 0?void 0:r.toJSON(),selectionsAfter:this.selectionsAfter.map(n=>n.toJSON())}}static fromJSON(e){return new i(e.changes&&Me.fromJSON(e.changes),[],e.mapped&&$t.fromJSON(e.mapped),e.startSelection&&T.fromJSON(e.startSelection),e.selectionsAfter.map(T.fromJSON))}static fromTransaction(e,t){let r=at;for(let n of e.startState.facet(nx)){let s=n(e);s.length&&(r=r.concat(s))}return!r.length&&e.changes.empty?null:new i(e.changes.invert(e.startState.doc),r,void 0,t||e.startState.selection,at)}static selection(e){return new i(void 0,at,void 0,void 0,e)}};function qo(i,e,t,r){let n=e+1>t+20?e-t-1:0,s=i.slice(n,e);return s.push(r),s}function ax(i,e){let t=[],r=!1;return i.iterChangedRanges((n,s)=>t.push(n,s)),e.iterChangedRanges((n,s,o,a)=>{for(let l=0;l<t.length;){let c=t[l++],h=t[l++];a>=c&&o<=h&&(r=!0)}}),r}function lx(i,e){return i.ranges.length==e.ranges.length&&i.ranges.filter((t,r)=>t.empty!=e.ranges[r].empty).length===0}function eg(i,e){return i.length?e.length?i.concat(e):i:e}var at=[],cx=200;function tg(i,e){if(i.length){let t=i[i.length-1],r=t.selectionsAfter.slice(Math.max(0,t.selectionsAfter.length-cx));return r.length&&r[r.length-1].eq(e)?i:(r.push(e),qo(i,i.length-1,1e9,t.setSelAfter(r)))}else return[gt.selection([e])]}function hx(i){let e=i[i.length-1],t=i.slice();return t[i.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),t}function mh(i,e){if(!i.length)return i;let t=i.length,r=at;for(;t;){let n=ux(i[t-1],e,r);if(n.changes&&!n.changes.empty||n.effects.length){let s=i.slice(0,t);return s[t-1]=n,s}else e=n.mapped,t--,r=n.selectionsAfter}return r.length?[gt.selection(r)]:at}function ux(i,e,t){let r=eg(i.selectionsAfter.length?i.selectionsAfter.map(a=>a.map(e)):at,t);if(!i.changes)return gt.selection(r);let n=i.changes.map(e),s=e.mapDesc(i.changes,!0),o=i.mapped?i.mapped.composeDesc(s):s;return new gt(n,D.mapEffects(i.effects,e),o,i.startSelection.map(s),r)}var fx=/^(input\.type|delete)($|\.)/,Bi=class i{constructor(e,t,r=0,n=void 0){this.done=e,this.undone=t,this.prevTime=r,this.prevUserEvent=n}isolate(){return this.prevTime?new i(this.done,this.undone):this}addChanges(e,t,r,n,s){let o=this.done,a=o[o.length-1];return a&&a.changes&&!a.changes.empty&&e.changes&&(!r||fx.test(r))&&(!a.selectionsAfter.length&&t-this.prevTime<n.newGroupDelay&&n.joinToEvent(s,ax(a.changes,e.changes))||r=="input.type.compose")?o=qo(o,o.length-1,n.minDepth,new gt(e.changes.compose(a.changes),eg(e.effects,a.effects),a.mapped,a.startSelection,at)):o=qo(o,o.length,n.minDepth,e),new i(o,at,t,r)}addSelection(e,t,r,n){let s=this.done.length?this.done[this.done.length-1].selectionsAfter:at;return s.length>0&&t-this.prevTime<n&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&lx(s[s.length-1],e)?this:new i(tg(this.done,e),this.undone,t,r)}addMapping(e){return new i(mh(this.done,e),mh(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,t,r){let n=e==0?this.done:this.undone;if(n.length==0)return null;let s=n[n.length-1],o=s.selectionsAfter[0]||t.selection;if(r&&s.selectionsAfter.length)return t.update({selection:s.selectionsAfter[s.selectionsAfter.length-1],annotations:gh.of({side:e,rest:hx(n),selection:o}),userEvent:e==0?"select.undo":"select.redo",scrollIntoView:!0});if(s.changes){let a=n.length==1?at:n.slice(0,n.length-1);return s.mapped&&(a=mh(a,s.mapped)),t.update({changes:s.changes,selection:s.startSelection,effects:s.effects,annotations:gh.of({side:e,rest:a,selection:o}),filter:!1,userEvent:e==0?"undo":"redo",scrollIntoView:!0})}else return null}};Bi.empty=new Bi(at,at);var ig=[{key:"Mod-z",run:Km,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:Oh,preventDefault:!0},{linux:"Ctrl-Shift-z",run:Oh,preventDefault:!0},{key:"Mod-u",run:sx,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:ox,preventDefault:!0}];function vr(i,e){return T.create(i.ranges.map(e),i.mainIndex)}function At(i,e){return i.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function Ot({state:i,dispatch:e},t){let r=vr(i.selection,t);return r.eq(i.selection,!0)?!1:(e(At(i,r)),!0)}function $o(i,e){return T.cursor(e?i.to:i.from)}function rg(i,e){return Ot(i,t=>t.empty?i.moveByChar(t,e):$o(t,e))}function Re(i){return i.textDirectionAt(i.state.selection.main.head)==G.LTR}var ng=i=>rg(i,!Re(i)),sg=i=>rg(i,Re(i));function og(i,e){return Ot(i,t=>t.empty?i.moveByGroup(t,e):$o(t,e))}var dx=i=>og(i,!Re(i)),px=i=>og(i,Re(i));var eC=typeof Intl<"u"&&Intl.Segmenter?new Intl.Segmenter(void 0,{granularity:"word"}):null;function mx(i,e,t){if(e.type.prop(t))return!0;let r=e.to-e.from;return r&&(r>2||/[^\s,.;:]/.test(i.sliceDoc(e.from,e.to)))||e.firstChild}function Bo(i,e,t){let r=he(i).resolveInner(e.head),n=t?L.closedBy:L.openedBy;for(let l=e.head;;){let c=t?r.childAfter(l):r.childBefore(l);if(!c)break;mx(i,c,n)?r=c:l=t?c.to:c.from}let s=r.type.prop(n),o,a;return s&&(o=t?mt(i,r.from,1):mt(i,r.to,-1))&&o.matched?a=t?o.end.to:o.end.from:a=t?r.to:r.from,T.cursor(a,t?-1:1)}var gx=i=>Ot(i,e=>Bo(i.state,e,!Re(i))),Ox=i=>Ot(i,e=>Bo(i.state,e,Re(i)));function ag(i,e){return Ot(i,t=>{if(!t.empty)return $o(t,e);let r=i.moveVertically(t,e);return r.head!=t.head?r:i.moveToLineBoundary(t,e)})}var lg=i=>ag(i,!1),cg=i=>ag(i,!0);function hg(i){let e=i.scrollDOM.clientHeight<i.scrollDOM.scrollHeight-2,t=0,r=0,n;if(e){for(let s of i.state.facet(R.scrollMargins)){let o=s(i);o?.top&&(t=Math.max(o?.top,t)),o?.bottom&&(r=Math.max(o?.bottom,r))}n=i.scrollDOM.clientHeight-t-r}else n=(i.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:t,marginBottom:r,selfScroll:e,height:Math.max(i.defaultLineHeight,n-5)}}function ug(i,e){let t=hg(i),{state:r}=i,n=vr(r.selection,o=>o.empty?i.moveVertically(o,e,t.height):$o(o,e));if(n.eq(r.selection))return!1;let s;if(t.selfScroll){let o=i.coordsAtPos(r.selection.main.head),a=i.scrollDOM.getBoundingClientRect(),l=a.top+t.marginTop,c=a.bottom-t.marginBottom;o&&o.top>l&&o.bottom<c&&(s=R.scrollIntoView(n.main.head,{y:"start",yMargin:o.top-l}))}return i.dispatch(At(r,n),{effects:s}),!0}var jm=i=>ug(i,!1),yh=i=>ug(i,!0);function li(i,e,t){let r=i.lineBlockAt(e.head),n=i.moveToLineBoundary(e,t);if(n.head==e.head&&n.head!=(t?r.to:r.from)&&(n=i.moveToLineBoundary(e,t,!1)),!t&&n.head==r.from&&r.length){let s=/^\s*/.exec(i.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;s&&e.head!=r.from+s&&(n=T.cursor(r.from+s))}return n}var yx=i=>Ot(i,e=>li(i,e,!0)),bx=i=>Ot(i,e=>li(i,e,!1)),wx=i=>Ot(i,e=>li(i,e,!Re(i))),vx=i=>Ot(i,e=>li(i,e,Re(i))),xx=i=>Ot(i,e=>T.cursor(i.lineBlockAt(e.head).from,1)),Sx=i=>Ot(i,e=>T.cursor(i.lineBlockAt(e.head).to,-1));function kx(i,e,t){let r=!1,n=vr(i.selection,s=>{let o=mt(i,s.head,-1)||mt(i,s.head,1)||s.head>0&&mt(i,s.head-1,1)||s.head<i.doc.length&&mt(i,s.head+1,-1);if(!o||!o.end)return s;r=!0;let a=o.start.from==s.head?o.end.to:o.end.from;return t?T.range(s.anchor,a):T.cursor(a)});return r?(e(At(i,n)),!0):!1}var Tx=({state:i,dispatch:e})=>kx(i,e,!1);function lt(i,e){let t=vr(i.state.selection,r=>{let n=e(r);return T.range(r.anchor,n.head,n.goalColumn,n.bidiLevel||void 0)});return t.eq(i.state.selection)?!1:(i.dispatch(At(i.state,t)),!0)}function fg(i,e){return lt(i,t=>i.moveByChar(t,e))}var dg=i=>fg(i,!Re(i)),pg=i=>fg(i,Re(i));function mg(i,e){return lt(i,t=>i.moveByGroup(t,e))}var Px=i=>mg(i,!Re(i)),Cx=i=>mg(i,Re(i));var Ex=i=>lt(i,e=>Bo(i.state,e,!Re(i))),Rx=i=>lt(i,e=>Bo(i.state,e,Re(i)));function gg(i,e){return lt(i,t=>i.moveVertically(t,e))}var Og=i=>gg(i,!1),yg=i=>gg(i,!0);function bg(i,e){return lt(i,t=>i.moveVertically(t,e,hg(i).height))}var Im=i=>bg(i,!1),Wm=i=>bg(i,!0),Ax=i=>lt(i,e=>li(i,e,!0)),Qx=i=>lt(i,e=>li(i,e,!1)),Mx=i=>lt(i,e=>li(i,e,!Re(i))),_x=i=>lt(i,e=>li(i,e,Re(i))),Dx=i=>lt(i,e=>T.cursor(i.lineBlockAt(e.head).from)),Lx=i=>lt(i,e=>T.cursor(i.lineBlockAt(e.head).to)),zm=({state:i,dispatch:e})=>(e(At(i,{anchor:0})),!0),Um=({state:i,dispatch:e})=>(e(At(i,{anchor:i.doc.length})),!0),Fm=({state:i,dispatch:e})=>(e(At(i,{anchor:i.selection.main.anchor,head:0})),!0),Hm=({state:i,dispatch:e})=>(e(At(i,{anchor:i.selection.main.anchor,head:i.doc.length})),!0),qx=({state:i,dispatch:e})=>(e(i.update({selection:{anchor:0,head:i.doc.length},userEvent:"select"})),!0),Vx=({state:i,dispatch:e})=>{let t=Xo(i).map(({from:r,to:n})=>T.range(r,Math.min(n+1,i.doc.length)));return e(i.update({selection:T.create(t),userEvent:"select"})),!0},$x=({state:i,dispatch:e})=>{let t=vr(i.selection,r=>{var n;let s=he(i).resolveStack(r.from,1);for(let o=s;o;o=o.next){let{node:a}=o;if((a.from<r.from&&a.to>=r.to||a.to>r.to&&a.from<=r.from)&&(!((n=a.parent)===null||n===void 0)&&n.parent))return T.range(a.to,a.from)}return r});return e(At(i,t)),!0},Bx=({state:i,dispatch:e})=>{let t=i.selection,r=null;return t.ranges.length>1?r=T.create([t.main]):t.main.empty||(r=T.create([T.cursor(t.main.head)])),r?(e(At(i,r)),!0):!1};function Bn(i,e){if(i.state.readOnly)return!1;let t="delete.selection",{state:r}=i,n=r.changeByRange(s=>{let{from:o,to:a}=s;if(o==a){let l=e(s);l<o?(t="delete.backward",l=Lo(i,l,!1)):l>o&&(t="delete.forward",l=Lo(i,l,!0)),o=Math.min(o,l),a=Math.max(a,l)}else o=Lo(i,o,!1),a=Lo(i,a,!0);return o==a?{range:s}:{changes:{from:o,to:a},range:T.cursor(o,o<s.head?-1:1)}});return n.changes.empty?!1:(i.dispatch(r.update(n,{scrollIntoView:!0,userEvent:t,effects:t=="delete.selection"?R.announce.of(r.phrase("Selection deleted")):void 0})),!0)}function Lo(i,e,t){if(i instanceof R)for(let r of i.state.facet(R.atomicRanges).map(n=>n(i)))r.between(e,e,(n,s)=>{n<e&&s>e&&(e=t?s:n)});return e}var wg=(i,e,t)=>Bn(i,r=>{let n=r.from,{state:s}=i,o=s.doc.lineAt(n),a,l;if(t&&!e&&n>o.from&&n<o.from+200&&!/[^ \t]/.test(a=o.text.slice(0,n-o.from))){if(a[a.length-1]=="	")return n-1;let c=Xt(a,s.tabSize),h=c%_n(s)||_n(s);for(let u=0;u<h&&a[a.length-1-u]==" ";u++)n--;l=n}else l=pe(o.text,n-o.from,e,e)+o.from,l==n&&o.number!=(e?s.doc.lines:1)?l+=e?1:-1:!e&&/[\ufe00-\ufe0f]/.test(o.text.slice(l-o.from,n-o.from))&&(l=pe(o.text,l-o.from,!1,!1)+o.from);return l}),bh=i=>wg(i,!1,!0);var vg=i=>wg(i,!0,!1),xg=(i,e)=>Bn(i,t=>{let r=t.head,{state:n}=i,s=n.doc.lineAt(r),o=n.charCategorizer(r);for(let a=null;;){if(r==(e?s.to:s.from)){r==t.head&&s.number!=(e?n.doc.lines:1)&&(r+=e?1:-1);break}let l=pe(s.text,r-s.from,e)+s.from,c=s.text.slice(Math.min(r,l)-s.from,Math.max(r,l)-s.from),h=o(c);if(a!=null&&h!=a)break;(c!=" "||r!=t.head)&&(a=h),r=l}return r}),Sg=i=>xg(i,!1),Xx=i=>xg(i,!0),Nx=i=>Bn(i,e=>{let t=i.lineBlockAt(e.head).to;return e.head<t?t:Math.min(i.state.doc.length,e.head+1)});var jx=i=>Bn(i,e=>{let t=i.moveToLineBoundary(e,!1).head;return e.head>t?t:Math.max(0,e.head-1)}),Ix=i=>Bn(i,e=>{let t=i.moveToLineBoundary(e,!0).head;return e.head<t?t:Math.min(i.state.doc.length,e.head+1)});var Wx=({state:i,dispatch:e})=>{if(i.readOnly)return!1;let t=i.changeByRange(r=>({changes:{from:r.from,to:r.to,insert:j.of(["",""])},range:T.cursor(r.from)}));return e(i.update(t,{scrollIntoView:!0,userEvent:"input"})),!0},zx=({state:i,dispatch:e})=>{if(i.readOnly)return!1;let t=i.changeByRange(r=>{if(!r.empty||r.from==0||r.from==i.doc.length)return{range:r};let n=r.from,s=i.doc.lineAt(n),o=n==s.from?n-1:pe(s.text,n-s.from,!1)+s.from,a=n==s.to?n+1:pe(s.text,n-s.from,!0)+s.from;return{changes:{from:o,to:a,insert:i.doc.slice(n,a).append(i.doc.slice(o,n))},range:T.cursor(a)}});return t.changes.empty?!1:(e(i.update(t,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function Xo(i){let e=[],t=-1;for(let r of i.selection.ranges){let n=i.doc.lineAt(r.from),s=i.doc.lineAt(r.to);if(!r.empty&&r.to==s.from&&(s=i.doc.lineAt(r.to-1)),t>=n.number){let o=e[e.length-1];o.to=s.to,o.ranges.push(r)}else e.push({from:n.from,to:s.to,ranges:[r]});t=s.number+1}return e}function kg(i,e,t){if(i.readOnly)return!1;let r=[],n=[];for(let s of Xo(i)){if(t?s.to==i.doc.length:s.from==0)continue;let o=i.doc.lineAt(t?s.to+1:s.from-1),a=o.length+1;if(t){r.push({from:s.to,to:o.to},{from:s.from,insert:o.text+i.lineBreak});for(let l of s.ranges)n.push(T.range(Math.min(i.doc.length,l.anchor+a),Math.min(i.doc.length,l.head+a)))}else{r.push({from:o.from,to:s.from},{from:s.to,insert:i.lineBreak+o.text});for(let l of s.ranges)n.push(T.range(l.anchor-a,l.head-a))}}return r.length?(e(i.update({changes:r,scrollIntoView:!0,selection:T.create(n,i.selection.mainIndex),userEvent:"move.line"})),!0):!1}var Ux=({state:i,dispatch:e})=>kg(i,e,!1),Fx=({state:i,dispatch:e})=>kg(i,e,!0);function Tg(i,e,t){if(i.readOnly)return!1;let r=[];for(let n of Xo(i))t?r.push({from:n.from,insert:i.doc.slice(n.from,n.to)+i.lineBreak}):r.push({from:n.to,insert:i.lineBreak+i.doc.slice(n.from,n.to)});return e(i.update({changes:r,scrollIntoView:!0,userEvent:"input.copyline"})),!0}var Hx=({state:i,dispatch:e})=>Tg(i,e,!1),Gx=({state:i,dispatch:e})=>Tg(i,e,!0),Yx=i=>{if(i.state.readOnly)return!1;let{state:e}=i,t=e.changes(Xo(e).map(({from:n,to:s})=>(n>0?n--:s<e.doc.length&&s++,{from:n,to:s}))),r=vr(e.selection,n=>{let s;if(i.lineWrapping){let o=i.lineBlockAt(n.head),a=i.coordsAtPos(n.head,n.assoc||1);a&&(s=o.bottom+i.documentTop-a.bottom+i.defaultLineHeight/2)}return i.moveVertically(n,!0,s)}).map(t);return i.dispatch({changes:t,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0};function Zx(i,e){if(/\(\)|\[\]|\{\}/.test(i.sliceDoc(e-1,e+1)))return{from:e,to:e};let t=he(i).resolveInner(e),r=t.childBefore(e),n=t.childAfter(e),s;return r&&n&&r.to<=e&&n.from>=e&&(s=r.type.prop(L.closedBy))&&s.indexOf(n.name)>-1&&i.doc.lineAt(r.to).from==i.doc.lineAt(n.from).from&&!/\S/.test(i.sliceDoc(r.to,n.from))?{from:r.to,to:n.from}:null}var Jx=Pg(!1),Kx=Pg(!0);function Pg(i){return({state:e,dispatch:t})=>{if(e.readOnly)return!1;let r=e.changeByRange(n=>{let{from:s,to:o}=n,a=e.doc.lineAt(s),l=!i&&s==o&&Zx(e,s);i&&(s=o=(o<=a.to?a:e.doc.lineAt(o)).to);let c=new qi(e,{simulateBreak:s,simulateDoubleBreak:!!l}),h=Mo(c,s);for(h==null&&(h=Xt(/^\s*/.exec(e.doc.lineAt(s).text)[0],e.tabSize));o<a.to&&/\s/.test(a.text[o-a.from]);)o++;l?{from:s,to:o}=l:s>a.from&&s<a.from+100&&!/\S/.test(a.text.slice(0,s))&&(s=a.from);let u=["",wr(e,h)];return l&&u.push(wr(e,c.lineIndent(a.from,-1))),{changes:{from:s,to:o,insert:j.of(u)},range:T.cursor(s+1+u[1].length)}});return t(e.update(r,{scrollIntoView:!0,userEvent:"input"})),!0}}function xh(i,e){let t=-1;return i.changeByRange(r=>{let n=[];for(let o=r.from;o<=r.to;){let a=i.doc.lineAt(o);a.number>t&&(r.empty||r.to>a.from)&&(e(a,n,r),t=a.number),o=a.to+1}let s=i.changes(n);return{changes:n,range:T.range(s.mapPos(r.anchor,1),s.mapPos(r.head,1))}})}var e1=({state:i,dispatch:e})=>{if(i.readOnly)return!1;let t=Object.create(null),r=new qi(i,{overrideIndentation:s=>{let o=t[s];return o??-1}}),n=xh(i,(s,o,a)=>{let l=Mo(r,s.from);if(l==null)return;/\S/.test(s.text)||(l=0);let c=/^\s*/.exec(s.text)[0],h=wr(i,l);(c!=h||a.from<s.from+c.length)&&(t[s.from]=l,o.push({from:s.from,to:s.from+c.length,insert:h}))});return n.changes.empty||e(i.update(n,{userEvent:"indent"})),!0},t1=({state:i,dispatch:e})=>i.readOnly?!1:(e(i.update(xh(i,(t,r)=>{r.push({from:t.from,insert:i.facet(br)})}),{userEvent:"input.indent"})),!0),i1=({state:i,dispatch:e})=>i.readOnly?!1:(e(i.update(xh(i,(t,r)=>{let n=/^\s*/.exec(t.text)[0];if(!n)return;let s=Xt(n,i.tabSize),o=0,a=wr(i,Math.max(0,s-_n(i)));for(;o<n.length&&o<a.length&&n.charCodeAt(o)==a.charCodeAt(o);)o++;r.push({from:t.from+o,to:t.from+n.length,insert:a.slice(o)})}),{userEvent:"delete.dedent"})),!0),r1=i=>(i.setTabFocusMode(),!0);var n1=[{key:"Ctrl-b",run:ng,shift:dg,preventDefault:!0},{key:"Ctrl-f",run:sg,shift:pg},{key:"Ctrl-p",run:lg,shift:Og},{key:"Ctrl-n",run:cg,shift:yg},{key:"Ctrl-a",run:xx,shift:Dx},{key:"Ctrl-e",run:Sx,shift:Lx},{key:"Ctrl-d",run:vg},{key:"Ctrl-h",run:bh},{key:"Ctrl-k",run:Nx},{key:"Ctrl-Alt-h",run:Sg},{key:"Ctrl-o",run:Wx},{key:"Ctrl-t",run:zx},{key:"Ctrl-v",run:yh}],s1=[{key:"ArrowLeft",run:ng,shift:dg,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:dx,shift:Px,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:wx,shift:Mx,preventDefault:!0},{key:"ArrowRight",run:sg,shift:pg,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:px,shift:Cx,preventDefault:!0},{mac:"Cmd-ArrowRight",run:vx,shift:_x,preventDefault:!0},{key:"ArrowUp",run:lg,shift:Og,preventDefault:!0},{mac:"Cmd-ArrowUp",run:zm,shift:Fm},{mac:"Ctrl-ArrowUp",run:jm,shift:Im},{key:"ArrowDown",run:cg,shift:yg,preventDefault:!0},{mac:"Cmd-ArrowDown",run:Um,shift:Hm},{mac:"Ctrl-ArrowDown",run:yh,shift:Wm},{key:"PageUp",run:jm,shift:Im},{key:"PageDown",run:yh,shift:Wm},{key:"Home",run:bx,shift:Qx,preventDefault:!0},{key:"Mod-Home",run:zm,shift:Fm},{key:"End",run:yx,shift:Ax,preventDefault:!0},{key:"Mod-End",run:Um,shift:Hm},{key:"Enter",run:Jx},{key:"Mod-a",run:qx},{key:"Backspace",run:bh,shift:bh},{key:"Delete",run:vg},{key:"Mod-Backspace",mac:"Alt-Backspace",run:Sg},{key:"Mod-Delete",mac:"Alt-Delete",run:Xx},{mac:"Mod-Backspace",run:jx},{mac:"Mod-Delete",run:Ix}].concat(n1.map(i=>({mac:i.key,run:i.run,shift:i.shift}))),Cg=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:gx,shift:Ex},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:Ox,shift:Rx},{key:"Alt-ArrowUp",run:Ux},{key:"Shift-Alt-ArrowUp",run:Hx},{key:"Alt-ArrowDown",run:Fx},{key:"Shift-Alt-ArrowDown",run:Gx},{key:"Escape",run:Bx},{key:"Mod-Enter",run:Kx},{key:"Alt-l",mac:"Ctrl-l",run:Vx},{key:"Mod-i",run:$x,preventDefault:!0},{key:"Mod-[",run:i1},{key:"Mod-]",run:t1},{key:"Mod-Alt-\\",run:e1},{key:"Shift-Mod-k",run:Yx},{key:"Shift-Mod-\\",run:Tx},{key:"Mod-/",run:Yv},{key:"Alt-A",run:Jv},{key:"Ctrl-m",mac:"Shift-Alt-m",run:r1}].concat(s1);function F(){var i=arguments[0];typeof i=="string"&&(i=document.createElement(i));var e=1,t=arguments[1];if(t&&typeof t=="object"&&t.nodeType==null&&!Array.isArray(t)){for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){var n=t[r];typeof n=="string"?i.setAttribute(r,n):n!=null&&(i[r]=n)}e++}for(;e<arguments.length;e++)Eg(i,arguments[e]);return i}function Eg(i,e){if(typeof e=="string")i.appendChild(document.createTextNode(e));else if(e!=null)if(e.nodeType!=null)i.appendChild(e);else if(Array.isArray(e))for(var t=0;t<e.length;t++)Eg(i,e[t]);else throw new RangeError("Unsupported child node: "+e)}var Rg=typeof String.prototype.normalize=="function"?i=>i.normalize("NFKD"):i=>i,hi=class{constructor(e,t,r=0,n=e.length,s,o){this.test=o,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(r,n),this.bufferStart=r,this.normalize=s?a=>s(Rg(a)):Rg,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return fe(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=Kr(e),r=this.bufferStart+this.bufferPos;this.bufferPos+=Qe(e);let n=this.normalize(t);for(let s=0,o=r;;s++){let a=n.charCodeAt(s),l=this.match(a,o,this.bufferPos+this.bufferStart);if(s==n.length-1){if(l)return this.value=l,this;break}o==r&&s<t.length&&t.charCodeAt(s)==a&&o++}}}match(e,t,r){let n=null;for(let s=0;s<this.matches.length;s+=2){let o=this.matches[s],a=!1;this.query.charCodeAt(o)==e&&(o==this.query.length-1?n={from:this.matches[s+1],to:r}:(this.matches[s]++,a=!0)),a||(this.matches.splice(s,2),s-=2)}return this.query.charCodeAt(0)==e&&(this.query.length==1?n={from:t,to:r}:this.matches.push(1,t)),n&&this.test&&!this.test(n.from,n.to,this.buffer,this.bufferStart)&&(n=null),n}};typeof Symbol<"u"&&(hi.prototype[Symbol.iterator]=function(){return this});var _g={from:-1,to:-1,match:/.*/.exec("")},Rh="gm"+(/x/.unicode==null?"":"u"),Io=class{constructor(e,t,r,n=0,s=e.length){if(this.text=e,this.to=s,this.curLine="",this.done=!1,this.value=_g,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new zo(e,t,r,n,s);this.re=new RegExp(t,Rh+(r?.ignoreCase?"i":"")),this.test=r?.test,this.iter=e.iter();let o=e.lineAt(n);this.curLineStart=o.from,this.matchPos=Uo(e,n),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine="":(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let r=this.curLineStart+t.index,n=r+t[0].length;if(this.matchPos=Uo(this.text,n+(r==n?1:0)),r==this.curLineStart+this.curLine.length&&this.nextLine(),(r<n||r>this.value.to)&&(!this.test||this.test(r,n,t)))return this.value={from:r,to:n,match:t},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),e=0;else return this.done=!0,this}}},Sh=new WeakMap,Wo=class i{constructor(e,t){this.from=e,this.text=t}get to(){return this.from+this.text.length}static get(e,t,r){let n=Sh.get(e);if(!n||n.from>=r||n.to<=t){let a=new i(t,e.sliceString(t,r));return Sh.set(e,a),a}if(n.from==t&&n.to==r)return n;let{text:s,from:o}=n;return o>t&&(s=e.sliceString(t,o)+s,o=t),n.to<r&&(s+=e.sliceString(n.to,r)),Sh.set(e,new i(o,s)),new i(t,s.slice(t-o,r-o))}},zo=class{constructor(e,t,r,n,s){this.text=e,this.to=s,this.done=!1,this.value=_g,this.matchPos=Uo(e,n),this.re=new RegExp(t,Rh+(r?.ignoreCase?"i":"")),this.test=r?.test,this.flat=Wo.get(e,n,this.chunkEnd(n+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let r=this.flat.from+t.index,n=r+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(r,n,t)))return this.value={from:r,to:n,match:t},this.matchPos=Uo(this.text,n+(r==n?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Wo.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}};typeof Symbol<"u"&&(Io.prototype[Symbol.iterator]=zo.prototype[Symbol.iterator]=function(){return this});function o1(i){try{return new RegExp(i,Rh),!0}catch{return!1}}function Uo(i,e){if(e>=i.length)return e;let t=i.lineAt(e),r;for(;e<t.to&&(r=t.text.charCodeAt(e-t.from))>=56320&&r<57344;)e++;return e}function kh(i){let e=String(i.state.doc.lineAt(i.state.selection.main.head).number),t=F("input",{class:"cm-textfield",name:"line",value:e}),r=F("form",{class:"cm-gotoLine",onkeydown:s=>{s.keyCode==27?(s.preventDefault(),i.dispatch({effects:Fo.of(!1)}),i.focus()):s.keyCode==13&&(s.preventDefault(),n())},onsubmit:s=>{s.preventDefault(),n()}},F("label",i.state.phrase("Go to line"),": ",t)," ",F("button",{class:"cm-button",type:"submit"},i.state.phrase("go")));function n(){let s=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(t.value);if(!s)return;let{state:o}=i,a=o.doc.lineAt(o.selection.main.head),[,l,c,h,u]=s,f=h?+h.slice(1):0,d=c?+c:a.number;if(c&&u){let g=d/100;l&&(g=g*(l=="-"?-1:1)+a.number/o.doc.lines),d=Math.round(o.doc.lines*g)}else c&&l&&(d=d*(l=="-"?-1:1)+a.number);let m=o.doc.line(Math.max(1,Math.min(o.doc.lines,d))),p=T.cursor(m.from+Math.max(0,Math.min(f,m.length)));i.dispatch({effects:[Fo.of(!1),R.scrollIntoView(p.from,{y:"center"})],selection:p}),i.focus()}return{dom:r}}var Fo=D.define(),Ag=re.define({create(){return!0},update(i,e){for(let t of e.effects)t.is(Fo)&&(i=t.value);return i},provide:i=>Qi.from(i,e=>e?kh:null)}),a1=i=>{let e=Mi(i,kh);if(!e){let t=[Fo.of(!0)];i.state.field(Ag,!1)==null&&t.push(D.appendConfig.of([Ag,l1])),i.dispatch({effects:t}),e=Mi(i,kh)}return e&&e.dom.querySelector("input").select(),!0},l1=R.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px","& label":{fontSize:"80%"}}}),c1={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},Dg=A.define({combine(i){return Ce(i,c1,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function Lg(i){let e=[p1,d1];return i&&e.push(Dg.of(i)),e}var h1=M.mark({class:"cm-selectionMatch"}),u1=M.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function Qg(i,e,t,r){return(t==0||i(e.sliceDoc(t-1,t))!=H.Word)&&(r==e.doc.length||i(e.sliceDoc(r,r+1))!=H.Word)}function f1(i,e,t,r){return i(e.sliceDoc(t,t+1))==H.Word&&i(e.sliceDoc(r-1,r))==H.Word}var d1=se.fromClass(class{constructor(i){this.decorations=this.getDeco(i)}update(i){(i.selectionSet||i.docChanged||i.viewportChanged)&&(this.decorations=this.getDeco(i.view))}getDeco(i){let e=i.state.facet(Dg),{state:t}=i,r=t.selection;if(r.ranges.length>1)return M.none;let n=r.main,s,o=null;if(n.empty){if(!e.highlightWordAroundCursor)return M.none;let l=t.wordAt(n.head);if(!l)return M.none;o=t.charCategorizer(n.head),s=t.sliceDoc(l.from,l.to)}else{let l=n.to-n.from;if(l<e.minSelectionLength||l>200)return M.none;if(e.wholeWords){if(s=t.sliceDoc(n.from,n.to),o=t.charCategorizer(n.head),!(Qg(o,t,n.from,n.to)&&f1(o,t,n.from,n.to)))return M.none}else if(s=t.sliceDoc(n.from,n.to),!s)return M.none}let a=[];for(let l of i.visibleRanges){let c=new hi(t.doc,s,l.from,l.to);for(;!c.next().done;){let{from:h,to:u}=c.value;if((!o||Qg(o,t,h,u))&&(n.empty&&h<=n.from&&u>=n.to?a.push(u1.range(h,u)):(h>=n.to||u<=n.from)&&a.push(h1.range(h,u)),a.length>e.maxMatches))return M.none}}return M.set(a)}},{decorations:i=>i.decorations}),p1=R.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),m1=({state:i,dispatch:e})=>{let{selection:t}=i,r=T.create(t.ranges.map(n=>i.wordAt(n.head)||T.cursor(n.head)),t.mainIndex);return r.eq(t)?!1:(e(i.update({selection:r})),!0)};function g1(i,e){let{main:t,ranges:r}=i.selection,n=i.wordAt(t.head),s=n&&n.from==t.from&&n.to==t.to;for(let o=!1,a=new hi(i.doc,e,r[r.length-1].to);;)if(a.next(),a.done){if(o)return null;a=new hi(i.doc,e,0,Math.max(0,r[r.length-1].from-1)),o=!0}else{if(o&&r.some(l=>l.from==a.value.from))continue;if(s){let l=i.wordAt(a.value.from);if(!l||l.from!=a.value.from||l.to!=a.value.to)continue}return a.value}}var O1=({state:i,dispatch:e})=>{let{ranges:t}=i.selection;if(t.some(s=>s.from===s.to))return m1({state:i,dispatch:e});let r=i.sliceDoc(t[0].from,t[0].to);if(i.selection.ranges.some(s=>i.sliceDoc(s.from,s.to)!=r))return!1;let n=g1(i,r);return n?(e(i.update({selection:i.selection.addRange(T.range(n.from,n.to),!1),effects:R.scrollIntoView(n.to)})),!0):!1},kr=A.define({combine(i){return Ce(i,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new Eh(e),scrollToMatch:e=>R.scrollIntoView(e)})}});var Ho=class{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||o1(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(t,r)=>r=="n"?`
`:r=="r"?"\r":r=="t"?"	":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord}create(){return this.regexp?new Ph(this):new Th(this)}getCursor(e,t=0,r){let n=e.doc?e:W.create({doc:e});return r==null&&(r=n.doc.length),this.regexp?Sr(this,n,t,r):xr(this,n,t,r)}},Go=class{constructor(e){this.spec=e}};function xr(i,e,t,r){return new hi(e.doc,i.unquoted,t,r,i.caseSensitive?void 0:n=>n.toLowerCase(),i.wholeWord?y1(e.doc,e.charCategorizer(e.selection.main.head)):void 0)}function y1(i,e){return(t,r,n,s)=>((s>t||s+n.length<r)&&(s=Math.max(0,t-2),n=i.sliceString(s,Math.min(i.length,r+2))),(e(Yo(n,t-s))!=H.Word||e(Zo(n,t-s))!=H.Word)&&(e(Zo(n,r-s))!=H.Word||e(Yo(n,r-s))!=H.Word))}var Th=class extends Go{constructor(e){super(e)}nextMatch(e,t,r){let n=xr(this.spec,e,r,e.doc.length).nextOverlapping();return n.done&&(n=xr(this.spec,e,0,t).nextOverlapping()),n.done?null:n.value}prevMatchInRange(e,t,r){for(let n=r;;){let s=Math.max(t,n-1e4-this.spec.unquoted.length),o=xr(this.spec,e,s,n),a=null;for(;!o.nextOverlapping().done;)a=o.value;if(a)return a;if(s==t)return null;n-=1e4}}prevMatch(e,t,r){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,r,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let r=xr(this.spec,e,0,e.doc.length),n=[];for(;!r.next().done;){if(n.length>=t)return null;n.push(r.value)}return n}highlight(e,t,r,n){let s=xr(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(r+this.spec.unquoted.length,e.doc.length));for(;!s.next().done;)n(s.value.from,s.value.to)}};function Sr(i,e,t,r){return new Io(e.doc,i.search,{ignoreCase:!i.caseSensitive,test:i.wholeWord?b1(e.charCategorizer(e.selection.main.head)):void 0},t,r)}function Yo(i,e){return i.slice(pe(i,e,!1),e)}function Zo(i,e){return i.slice(e,pe(i,e))}function b1(i){return(e,t,r)=>!r[0].length||(i(Yo(r.input,r.index))!=H.Word||i(Zo(r.input,r.index))!=H.Word)&&(i(Zo(r.input,r.index+r[0].length))!=H.Word||i(Yo(r.input,r.index+r[0].length))!=H.Word)}var Ph=class extends Go{nextMatch(e,t,r){let n=Sr(this.spec,e,r,e.doc.length).next();return n.done&&(n=Sr(this.spec,e,0,t).next()),n.done?null:n.value}prevMatchInRange(e,t,r){for(let n=1;;n++){let s=Math.max(t,r-n*1e4),o=Sr(this.spec,e,s,r),a=null;for(;!o.next().done;)a=o.value;if(a&&(s==t||a.from>s+10))return a;if(s==t)return null}}prevMatch(e,t,r){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,r,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&\d+])/g,(t,r)=>r=="$"?"$":r=="&"?e.match[0]:r!="0"&&+r<e.match.length?e.match[r]:t)}matchAll(e,t){let r=Sr(this.spec,e,0,e.doc.length),n=[];for(;!r.next().done;){if(n.length>=t)return null;n.push(r.value)}return n}highlight(e,t,r,n){let s=Sr(this.spec,e,Math.max(0,t-250),Math.min(r+250,e.doc.length));for(;!s.next().done;)n(s.value.from,s.value.to)}},Nn=D.define(),Ah=D.define(),ci=re.define({create(i){return new Xn(Ch(i).create(),null)},update(i,e){for(let t of e.effects)t.is(Nn)?i=new Xn(t.value.create(),i.panel):t.is(Ah)&&(i=new Xn(i.query,t.value?Qh:null));return i},provide:i=>Qi.from(i,e=>e.panel)});var Xn=class{constructor(e,t){this.query=e,this.panel=t}},w1=M.mark({class:"cm-searchMatch"}),v1=M.mark({class:"cm-searchMatch cm-searchMatch-selected"}),x1=se.fromClass(class{constructor(i){this.view=i,this.decorations=this.highlight(i.state.field(ci))}update(i){let e=i.state.field(ci);(e!=i.startState.field(ci)||i.docChanged||i.selectionSet||i.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:i,panel:e}){if(!e||!i.spec.valid)return M.none;let{view:t}=this,r=new dt;for(let n=0,s=t.visibleRanges,o=s.length;n<o;n++){let{from:a,to:l}=s[n];for(;n<o-1&&l>s[n+1].from-2*250;)l=s[++n].to;i.highlight(t.state,a,l,(c,h)=>{let u=t.state.selection.ranges.some(f=>f.from==c&&f.to==h);r.add(c,h,u?v1:w1)})}return r.finish()}},{decorations:i=>i.decorations});function jn(i){return e=>{let t=e.state.field(ci,!1);return t&&t.query.spec.valid?i(e,t):$g(e)}}var Jo=jn((i,{query:e})=>{let{to:t}=i.state.selection.main,r=e.nextMatch(i.state,t,t);if(!r)return!1;let n=T.single(r.from,r.to),s=i.state.facet(kr);return i.dispatch({selection:n,effects:[Mh(i,r),s.scrollToMatch(n.main,i)],userEvent:"select.search"}),Vg(i),!0}),Ko=jn((i,{query:e})=>{let{state:t}=i,{from:r}=t.selection.main,n=e.prevMatch(t,r,r);if(!n)return!1;let s=T.single(n.from,n.to),o=i.state.facet(kr);return i.dispatch({selection:s,effects:[Mh(i,n),o.scrollToMatch(s.main,i)],userEvent:"select.search"}),Vg(i),!0}),S1=jn((i,{query:e})=>{let t=e.matchAll(i.state,1e3);return!t||!t.length?!1:(i.dispatch({selection:T.create(t.map(r=>T.range(r.from,r.to))),userEvent:"select.search.matches"}),!0)}),k1=({state:i,dispatch:e})=>{let t=i.selection;if(t.ranges.length>1||t.main.empty)return!1;let{from:r,to:n}=t.main,s=[],o=0;for(let a=new hi(i.doc,i.sliceDoc(r,n));!a.next().done;){if(s.length>1e3)return!1;a.value.from==r&&(o=s.length),s.push(T.range(a.value.from,a.value.to))}return e(i.update({selection:T.create(s,o),userEvent:"select.search.matches"})),!0},Mg=jn((i,{query:e})=>{let{state:t}=i,{from:r,to:n}=t.selection.main;if(t.readOnly)return!1;let s=e.nextMatch(t,r,r);if(!s)return!1;let o=[],a,l,c=[];if(s.from==r&&s.to==n&&(l=t.toText(e.getReplacement(s)),o.push({from:s.from,to:s.to,insert:l}),s=e.nextMatch(t,s.from,s.to),c.push(R.announce.of(t.phrase("replaced match on line $",t.doc.lineAt(r).number)+"."))),s){let h=o.length==0||o[0].from>=s.to?0:s.to-s.from-l.length;a=T.single(s.from-h,s.to-h),c.push(Mh(i,s)),c.push(t.facet(kr).scrollToMatch(a.main,i))}return i.dispatch({changes:o,selection:a,effects:c,userEvent:"input.replace"}),!0}),T1=jn((i,{query:e})=>{if(i.state.readOnly)return!1;let t=e.matchAll(i.state,1e9).map(n=>{let{from:s,to:o}=n;return{from:s,to:o,insert:e.getReplacement(n)}});if(!t.length)return!1;let r=i.state.phrase("replaced $ matches",t.length)+".";return i.dispatch({changes:t,effects:R.announce.of(r),userEvent:"input.replace.all"}),!0});function Qh(i){return i.state.facet(kr).createPanel(i)}function Ch(i,e){var t,r,n,s,o;let a=i.selection.main,l=a.empty||a.to>a.from+100?"":i.sliceDoc(a.from,a.to);if(e&&!l)return e;let c=i.facet(kr);return new Ho({search:((t=e?.literal)!==null&&t!==void 0?t:c.literal)?l:l.replace(/\n/g,"\\n"),caseSensitive:(r=e?.caseSensitive)!==null&&r!==void 0?r:c.caseSensitive,literal:(n=e?.literal)!==null&&n!==void 0?n:c.literal,regexp:(s=e?.regexp)!==null&&s!==void 0?s:c.regexp,wholeWord:(o=e?.wholeWord)!==null&&o!==void 0?o:c.wholeWord})}function qg(i){let e=Mi(i,Qh);return e&&e.dom.querySelector("[main-field]")}function Vg(i){let e=qg(i);e&&e==i.root.activeElement&&e.select()}var $g=i=>{let e=i.state.field(ci,!1);if(e&&e.panel){let t=qg(i);if(t&&t!=i.root.activeElement){let r=Ch(i.state,e.query.spec);r.valid&&i.dispatch({effects:Nn.of(r)}),t.focus(),t.select()}}else i.dispatch({effects:[Ah.of(!0),e?Nn.of(Ch(i.state,e.query.spec)):D.appendConfig.of(C1)]});return!0},Bg=i=>{let e=i.state.field(ci,!1);if(!e||!e.panel)return!1;let t=Mi(i,Qh);return t&&t.dom.contains(i.root.activeElement)&&i.focus(),i.dispatch({effects:Ah.of(!1)}),!0},Xg=[{key:"Mod-f",run:$g,scope:"editor search-panel"},{key:"F3",run:Jo,shift:Ko,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:Jo,shift:Ko,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:Bg,scope:"editor search-panel"},{key:"Mod-Shift-l",run:k1},{key:"Mod-Alt-g",run:a1},{key:"Mod-d",run:O1,preventDefault:!0}],Eh=class{constructor(e){this.view=e;let t=this.query=e.state.field(ci).query.spec;this.commit=this.commit.bind(this),this.searchField=F("input",{value:t.search,placeholder:Ye(e,"Find"),"aria-label":Ye(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=F("input",{value:t.replace,placeholder:Ye(e,"Replace"),"aria-label":Ye(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=F("input",{type:"checkbox",name:"case",form:"",checked:t.caseSensitive,onchange:this.commit}),this.reField=F("input",{type:"checkbox",name:"re",form:"",checked:t.regexp,onchange:this.commit}),this.wordField=F("input",{type:"checkbox",name:"word",form:"",checked:t.wholeWord,onchange:this.commit});function r(n,s,o){return F("button",{class:"cm-button",name:n,onclick:s,type:"button"},o)}this.dom=F("div",{onkeydown:n=>this.keydown(n),class:"cm-search"},[this.searchField,r("next",()=>Jo(e),[Ye(e,"next")]),r("prev",()=>Ko(e),[Ye(e,"previous")]),r("select",()=>S1(e),[Ye(e,"all")]),F("label",null,[this.caseField,Ye(e,"match case")]),F("label",null,[this.reField,Ye(e,"regexp")]),F("label",null,[this.wordField,Ye(e,"by word")]),...e.state.readOnly?[]:[F("br"),this.replaceField,r("replace",()=>Mg(e),[Ye(e,"replace")]),r("replaceAll",()=>T1(e),[Ye(e,"replace all")])],F("button",{name:"close",onclick:()=>Bg(e),"aria-label":Ye(e,"close"),type:"button"},["\xD7"])])}commit(){let e=new Ho({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:Nn.of(e)}))}keydown(e){Up(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?Ko:Jo)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),Mg(this.view))}update(e){for(let t of e.transactions)for(let r of t.effects)r.is(Nn)&&!r.value.eq(this.query)&&this.setQuery(r.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(kr).top}};function Ye(i,e){return i.state.phrase(e)}var No=30,jo=/[\s\.,:;?!]/;function Mh(i,{from:e,to:t}){let r=i.state.doc.lineAt(e),n=i.state.doc.lineAt(t).to,s=Math.max(r.from,e-No),o=Math.min(n,t+No),a=i.state.sliceDoc(s,o);if(s!=r.from){for(let l=0;l<No;l++)if(!jo.test(a[l+1])&&jo.test(a[l])){a=a.slice(l);break}}if(o!=n){for(let l=a.length-1;l>a.length-No;l--)if(!jo.test(a[l-1])&&jo.test(a[l])){a=a.slice(0,l);break}}return R.announce.of(`${i.state.phrase("current match")}. ${a} ${i.state.phrase("on line")} ${r.number}.`)}var P1=R.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),C1=[ci,_e.low(x1),P1];var ta=class{constructor(e,t,r){this.state=e,this.pos=t,this.explicit=r,this.abortListeners=[]}tokenBefore(e){let t=he(this.state).resolveInner(this.pos,-1);for(;t&&e.indexOf(t.name)<0;)t=t.parent;return t?{from:t.from,to:this.pos,text:this.state.sliceDoc(t.from,this.pos),type:t.type}:null}matchBefore(e){let t=this.state.doc.lineAt(this.pos),r=Math.max(t.from,this.pos-250),n=t.text.slice(r-t.from,this.pos-t.from),s=n.search(Yg(e,!1));return s<0?null:{from:r+s,to:this.pos,text:n.slice(s)}}get aborted(){return this.abortListeners==null}addEventListener(e,t){e=="abort"&&this.abortListeners&&this.abortListeners.push(t)}};function Ng(i){let e=Object.keys(i).join(""),t=/\w/.test(e);return t&&(e=e.replace(/\w/g,"")),`[${t?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function E1(i){let e=Object.create(null),t=Object.create(null);for(let{label:n}of i){e[n[0]]=!0;for(let s=1;s<n.length;s++)t[n[s]]=!0}let r=Ng(e)+Ng(t)+"*$";return[new RegExp("^"+r),new RegExp(r)]}function zh(i){let e=i.map(n=>typeof n=="string"?{label:n}:n),[t,r]=e.every(n=>/^\w+$/.test(n.label))?[/\w*$/,/\w+$/]:E1(e);return n=>{let s=n.matchBefore(r);return s||n.explicit?{from:s?s.from:n.pos,options:e,validFor:t}:null}}function Gg(i,e){return t=>{for(let r=he(t.state).resolveInner(t.pos,-1);r;r=r.parent){if(i.indexOf(r.name)>-1)return null;if(r.type.isTop)break}return e(t)}}var ia=class{constructor(e,t,r,n){this.completion=e,this.source=t,this.match=r,this.score=n}};function ui(i){return i.selection.main.from}function Yg(i,e){var t;let{source:r}=i,n=e&&r[0]!="^",s=r[r.length-1]!="$";return!n&&!s?i:new RegExp(`${n?"^":""}(?:${r})${s?"$":""}`,(t=i.flags)!==null&&t!==void 0?t:i.ignoreCase?"i":"")}var Uh=Be.define();function R1(i,e,t,r){let{main:n}=i.selection,s=t-n.from,o=r-n.from;return Object.assign(Object.assign({},i.changeByRange(a=>a!=n&&t!=r&&i.sliceDoc(a.from+s,a.from+o)!=i.sliceDoc(t,r)?{range:a}:{changes:{from:a.from+s,to:r==n.from?a.to:a.from+o,insert:e},range:T.cursor(a.from+s+e.length)})),{scrollIntoView:!0,userEvent:"input.complete"})}var jg=new WeakMap;function A1(i){if(!Array.isArray(i))return i;let e=jg.get(i);return e||jg.set(i,e=zh(i)),e}var ra=D.define(),In=D.define(),Lh=class{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let t=0;t<e.length;){let r=fe(e,t),n=Qe(r);this.chars.push(r);let s=e.slice(t,t+n),o=s.toUpperCase();this.folded.push(fe(o==s?s.toLowerCase():o,0)),t+=n}this.astral=e.length!=this.chars.length}ret(e,t){return this.score=e,this.matched=t,this}match(e){if(this.pattern.length==0)return this.ret(-100,[]);if(e.length<this.pattern.length)return null;let{chars:t,folded:r,any:n,precise:s,byWord:o}=this;if(t.length==1){let y=fe(e,0),x=Qe(y),v=x==e.length?0:-100;if(y!=t[0])if(y==r[0])v+=-200;else return null;return this.ret(v,[0,x])}let a=e.indexOf(this.pattern);if(a==0)return this.ret(e.length==this.pattern.length?0:-100,[0,this.pattern.length]);let l=t.length,c=0;if(a<0){for(let y=0,x=Math.min(e.length,200);y<x&&c<l;){let v=fe(e,y);(v==t[c]||v==r[c])&&(n[c++]=y),y+=Qe(v)}if(c<l)return null}let h=0,u=0,f=!1,d=0,m=-1,p=-1,g=/[a-z]/.test(e),O=!0;for(let y=0,x=Math.min(e.length,200),v=0;y<x&&u<l;){let w=fe(e,y);a<0&&(h<l&&w==t[h]&&(s[h++]=y),d<l&&(w==t[d]||w==r[d]?(d==0&&(m=y),p=y+1,d++):d=0));let P,C=w<255?w>=48&&w<=57||w>=97&&w<=122?2:w>=65&&w<=90?1:0:(P=Kr(w))!=P.toLowerCase()?1:P!=P.toUpperCase()?2:0;(!y||C==1&&g||v==0&&C!=0)&&(t[u]==w||r[u]==w&&(f=!0)?o[u++]=y:o.length&&(O=!1)),v=C,y+=Qe(w)}return u==l&&o[0]==0&&O?this.result(-100+(f?-200:0),o,e):d==l&&m==0?this.ret(-200-e.length+(p==e.length?0:-100),[0,p]):a>-1?this.ret(-700-e.length,[a,a+this.pattern.length]):d==l?this.ret(-900-e.length,[m,p]):u==l?this.result(-100+(f?-200:0)+-700+(O?0:-1100),o,e):t.length==2?null:this.result((n[0]?-700:0)+-200+-1100,n,e)}result(e,t,r){let n=[],s=0;for(let o of t){let a=o+(this.astral?Qe(fe(r,o)):1);s&&n[s-1]==o?n[s-1]=a:(n[s++]=o,n[s++]=a)}return this.ret(e-r.length,n)}},qh=class{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length<this.pattern.length)return null;let t=e.slice(0,this.pattern.length),r=t==this.pattern?0:t.toLowerCase()==this.folded?-200:null;return r==null?null:(this.matched=[0,t.length],this.score=r+(e.length==this.pattern.length?0:-100),this)}},Se=A.define({combine(i){return Ce(i,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:Q1,filterStrict:!1,compareCompletions:(e,t)=>e.label.localeCompare(t.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,t)=>e&&t,closeOnBlur:(e,t)=>e&&t,icons:(e,t)=>e&&t,tooltipClass:(e,t)=>r=>Ig(e(r),t(r)),optionClass:(e,t)=>r=>Ig(e(r),t(r)),addToOptions:(e,t)=>e.concat(t),filterStrict:(e,t)=>e||t})}});function Ig(i,e){return i?e?i+" "+e:i:e}function Q1(i,e,t,r,n,s){let o=i.textDirection==G.RTL,a=o,l=!1,c="top",h,u,f=e.left-n.left,d=n.right-e.right,m=r.right-r.left,p=r.bottom-r.top;if(a&&f<Math.min(m,d)?a=!1:!a&&d<Math.min(m,f)&&(a=!0),m<=(a?f:d))h=Math.max(n.top,Math.min(t.top,n.bottom-p))-e.top,u=Math.min(400,a?f:d);else{l=!0,u=Math.min(400,(o?e.right:n.right-e.left)-30);let y=n.bottom-e.bottom;y>=p||y>e.top?h=t.bottom-e.top:(c="bottom",h=e.bottom-t.top)}let g=(e.bottom-e.top)/s.offsetHeight,O=(e.right-e.left)/s.offsetWidth;return{style:`${c}: ${h/g}px; max-width: ${u/O}px`,class:"cm-completionInfo-"+(l?o?"left-narrow":"right-narrow":a?"left":"right")}}function M1(i){let e=i.addToOptions.slice();return i.icons&&e.push({render(t){let r=document.createElement("div");return r.classList.add("cm-completionIcon"),t.type&&r.classList.add(...t.type.split(/\s+/g).map(n=>"cm-completionIcon-"+n)),r.setAttribute("aria-hidden","true"),r},position:20}),e.push({render(t,r,n,s){let o=document.createElement("span");o.className="cm-completionLabel";let a=t.displayLabel||t.label,l=0;for(let c=0;c<s.length;){let h=s[c++],u=s[c++];h>l&&o.appendChild(document.createTextNode(a.slice(l,h)));let f=o.appendChild(document.createElement("span"));f.appendChild(document.createTextNode(a.slice(h,u))),f.className="cm-completionMatchedText",l=u}return l<a.length&&o.appendChild(document.createTextNode(a.slice(l))),o},position:50},{render(t){if(!t.detail)return null;let r=document.createElement("span");return r.className="cm-completionDetail",r.textContent=t.detail,r},position:80}),e.sort((t,r)=>t.position-r.position).map(t=>t.render)}function _h(i,e,t){if(i<=t)return{from:0,to:i};if(e<0&&(e=0),e<=i>>1){let n=Math.floor(e/t);return{from:n*t,to:(n+1)*t}}let r=Math.floor((i-e)/t);return{from:i-(r+1)*t,to:i-r*t}}var Vh=class{constructor(e,t,r){this.view=e,this.stateField=t,this.applyCompletion=r,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:l=>this.placeInfo(l),key:this},this.space=null,this.currentClass="";let n=e.state.field(t),{options:s,selected:o}=n.open,a=e.state.facet(Se);this.optionContent=M1(a),this.optionClass=a.optionClass,this.tooltipClass=a.tooltipClass,this.range=_h(s.length,o,a.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",l=>{let{options:c}=e.state.field(t).open;for(let h=l.target,u;h&&h!=this.dom;h=h.parentNode)if(h.nodeName=="LI"&&(u=/-(\d+)$/.exec(h.id))&&+u[1]<c.length){this.applyCompletion(e,c[+u[1]]),l.preventDefault();return}}),this.dom.addEventListener("focusout",l=>{let c=e.state.field(this.stateField,!1);c&&c.tooltip&&e.state.facet(Se).closeOnBlur&&l.relatedTarget!=e.contentDOM&&e.dispatch({effects:In.of(null)})}),this.showOptions(s,n.id)}mount(){this.updateSel()}showOptions(e,t){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,t,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var t;let r=e.state.field(this.stateField),n=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),r!=n){let{options:s,selected:o,disabled:a}=r.open;(!n.open||n.open.options!=s)&&(this.range=_h(s.length,o,e.state.facet(Se).maxRenderedOptions),this.showOptions(s,r.id)),this.updateSel(),a!=((t=n.open)===null||t===void 0?void 0:t.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!a)}}updateTooltipClass(e){let t=this.tooltipClass(e);if(t!=this.currentClass){for(let r of this.currentClass.split(" "))r&&this.dom.classList.remove(r);for(let r of t.split(" "))r&&this.dom.classList.add(r);this.currentClass=t}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),t=e.open;if((t.selected>-1&&t.selected<this.range.from||t.selected>=this.range.to)&&(this.range=_h(t.options.length,t.selected,this.view.state.facet(Se).maxRenderedOptions),this.showOptions(t.options,e.id)),this.updateSelectedOption(t.selected)){this.destroyInfo();let{completion:r}=t.options[t.selected],{info:n}=r;if(!n)return;let s=typeof n=="string"?document.createTextNode(n):n(r);if(!s)return;"then"in s?s.then(o=>{o&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(o,r)}).catch(o=>xe(this.view.state,o,"completion info")):this.addInfoPane(s,r)}}addInfoPane(e,t){this.destroyInfo();let r=this.info=document.createElement("div");if(r.className="cm-tooltip cm-completionInfo",e.nodeType!=null)r.appendChild(e),this.infoDestroy=null;else{let{dom:n,destroy:s}=e;r.appendChild(n),this.infoDestroy=s||null}this.dom.appendChild(r),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let t=null;for(let r=this.list.firstChild,n=this.range.from;r;r=r.nextSibling,n++)r.nodeName!="LI"||!r.id?n--:n==e?r.hasAttribute("aria-selected")||(r.setAttribute("aria-selected","true"),t=r):r.hasAttribute("aria-selected")&&r.removeAttribute("aria-selected");return t&&D1(this.list,t),t}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let t=this.dom.getBoundingClientRect(),r=this.info.getBoundingClientRect(),n=e.getBoundingClientRect(),s=this.space;if(!s){let o=this.dom.ownerDocument.defaultView||window;s={left:0,top:0,right:o.innerWidth,bottom:o.innerHeight}}return n.top>Math.min(s.bottom,t.bottom)-10||n.bottom<Math.max(s.top,t.top)+10?null:this.view.state.facet(Se).positionInfo(this.view,t,n,r,s,this.dom)}placeInfo(e){this.info&&(e?(e.style&&(this.info.style.cssText=e.style),this.info.className="cm-tooltip cm-completionInfo "+(e.class||"")):this.info.style.cssText="top: -1e6px")}createListBox(e,t,r){let n=document.createElement("ul");n.id=t,n.setAttribute("role","listbox"),n.setAttribute("aria-expanded","true"),n.setAttribute("aria-label",this.view.state.phrase("Completions"));let s=null;for(let o=r.from;o<r.to;o++){let{completion:a,match:l}=e[o],{section:c}=a;if(c){let f=typeof c=="string"?c:c.name;if(f!=s&&(o>r.from||r.from==0))if(s=f,typeof c!="string"&&c.header)n.appendChild(c.header(c));else{let d=n.appendChild(document.createElement("completion-section"));d.textContent=f}}let h=n.appendChild(document.createElement("li"));h.id=t+"-"+o,h.setAttribute("role","option");let u=this.optionClass(a);u&&(h.className=u);for(let f of this.optionContent){let d=f(a,this.view.state,this.view,l);d&&h.appendChild(d)}}return r.from&&n.classList.add("cm-completionListIncompleteTop"),r.to<e.length&&n.classList.add("cm-completionListIncompleteBottom"),n}destroyInfo(){this.info&&(this.infoDestroy&&this.infoDestroy(),this.info.remove(),this.info=null)}destroy(){this.destroyInfo()}};function _1(i,e){return t=>new Vh(t,i,e)}function D1(i,e){let t=i.getBoundingClientRect(),r=e.getBoundingClientRect(),n=t.height/i.offsetHeight;r.top<t.top?i.scrollTop-=(t.top-r.top)/n:r.bottom>t.bottom&&(i.scrollTop+=(r.bottom-t.bottom)/n)}function Wg(i){return(i.boost||0)*100+(i.apply?10:0)+(i.info?5:0)+(i.type?1:0)}function L1(i,e){let t=[],r=null,n=c=>{t.push(c);let{section:h}=c.completion;if(h){r||(r=[]);let u=typeof h=="string"?h:h.name;r.some(f=>f.name==u)||r.push(typeof h=="string"?{name:u}:h)}},s=e.facet(Se);for(let c of i)if(c.hasResult()){let h=c.result.getMatch;if(c.result.filter===!1)for(let u of c.result.options)n(new ia(u,c.source,h?h(u):[],1e9-t.length));else{let u=e.sliceDoc(c.from,c.to),f,d=s.filterStrict?new qh(u):new Lh(u);for(let m of c.result.options)if(f=d.match(m.label)){let p=m.displayLabel?h?h(m,f.matched):[]:f.matched;n(new ia(m,c.source,p,f.score+(m.boost||0)))}}}if(r){let c=Object.create(null),h=0,u=(f,d)=>{var m,p;return((m=f.rank)!==null&&m!==void 0?m:1e9)-((p=d.rank)!==null&&p!==void 0?p:1e9)||(f.name<d.name?-1:1)};for(let f of r.sort(u))h-=1e5,c[f.name]=h;for(let f of t){let{section:d}=f.completion;d&&(f.score+=c[typeof d=="string"?d:d.name])}}let o=[],a=null,l=s.compareCompletions;for(let c of t.sort((h,u)=>u.score-h.score||l(h.completion,u.completion))){let h=c.completion;!a||a.label!=h.label||a.detail!=h.detail||a.type!=null&&h.type!=null&&a.type!=h.type||a.apply!=h.apply||a.boost!=h.boost?o.push(c):Wg(c.completion)>Wg(a)&&(o[o.length-1]=c),a=c.completion}return o}var $h=class i{constructor(e,t,r,n,s,o){this.options=e,this.attrs=t,this.tooltip=r,this.timestamp=n,this.selected=s,this.disabled=o}setSelected(e,t){return e==this.selected||e>=this.options.length?this:new i(this.options,zg(t,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,t,r,n,s){let o=L1(e,t);if(!o.length)return n&&e.some(l=>l.state==1)?new i(n.options,n.attrs,n.tooltip,n.timestamp,n.selected,!0):null;let a=t.facet(Se).selectOnOpen?0:-1;if(n&&n.selected!=a&&n.selected!=-1){let l=n.options[n.selected].completion;for(let c=0;c<o.length;c++)if(o[c].completion==l){a=c;break}}return new i(o,zg(r,a),{pos:e.reduce((l,c)=>c.hasResult()?Math.min(l,c.from):l,1e8),create:N1,above:s.aboveCursor},n?n.timestamp:Date.now(),a,!1)}map(e){return new i(this.options,this.attrs,Object.assign(Object.assign({},this.tooltip),{pos:e.mapPos(this.tooltip.pos)}),this.timestamp,this.selected,this.disabled)}},Bh=class i{constructor(e,t,r){this.active=e,this.id=t,this.open=r}static start(){return new i(B1,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:t}=e,r=t.facet(Se),s=(r.override||t.languageDataAt("autocomplete",ui(t)).map(A1)).map(a=>(this.active.find(c=>c.source==a)||new Qt(a,this.active.some(c=>c.state!=0)?1:0)).update(e,r));s.length==this.active.length&&s.every((a,l)=>a==this.active[l])&&(s=this.active);let o=this.open;o&&e.docChanged&&(o=o.map(e.changes)),e.selection||s.some(a=>a.hasResult()&&e.changes.touchesRange(a.from,a.to))||!q1(s,this.active)?o=$h.build(s,t,this.id,o,r):o&&o.disabled&&!s.some(a=>a.state==1)&&(o=null),!o&&s.every(a=>a.state!=1)&&s.some(a=>a.hasResult())&&(s=s.map(a=>a.hasResult()?new Qt(a.source,0):a));for(let a of e.effects)a.is(Jg)&&(o=o&&o.setSelected(a.value,this.id));return s==this.active&&o==this.open?this:new i(s,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?V1:$1}};function q1(i,e){if(i==e)return!0;for(let t=0,r=0;;){for(;t<i.length&&!i[t].hasResult;)t++;for(;r<e.length&&!e[r].hasResult;)r++;let n=t==i.length,s=r==e.length;if(n||s)return n==s;if(i[t++].result!=e[r++].result)return!1}}var V1={"aria-autocomplete":"list"},$1={};function zg(i,e){let t={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":i};return e>-1&&(t["aria-activedescendant"]=i+"-"+e),t}var B1=[];function Xh(i,e){if(i.isUserEvent("input.complete")){let t=i.annotation(Uh);if(t&&e.activateOnCompletion(t))return"input"}return i.isUserEvent("input.type")?"input":i.isUserEvent("delete.backward")?"delete":null}var Qt=class i{constructor(e,t,r=-1){this.source=e,this.state=t,this.explicitPos=r}hasResult(){return!1}update(e,t){let r=Xh(e,t),n=this;r?n=n.handleUserEvent(e,r,t):e.docChanged?n=n.handleChange(e):e.selection&&n.state!=0&&(n=new i(n.source,0));for(let s of e.effects)if(s.is(ra))n=new i(n.source,1,s.value?ui(e.state):-1);else if(s.is(In))n=new i(n.source,0);else if(s.is(Zg))for(let o of s.value)o.source==n.source&&(n=o);return n}handleUserEvent(e,t,r){return t=="delete"||!r.activateOnTyping?this.map(e.changes):new i(this.source,1)}handleChange(e){return e.changes.touchesRange(ui(e.startState))?new i(this.source,0):this.map(e.changes)}map(e){return e.empty||this.explicitPos<0?this:new i(this.source,this.state,e.mapPos(this.explicitPos))}},na=class i extends Qt{constructor(e,t,r,n,s){super(e,2,t),this.result=r,this.from=n,this.to=s}hasResult(){return!0}handleUserEvent(e,t,r){var n;let s=this.result;s.map&&!e.changes.empty&&(s=s.map(s,e.changes));let o=e.changes.mapPos(this.from),a=e.changes.mapPos(this.to,1),l=ui(e.state);if((this.explicitPos<0?l<=o:l<this.from)||l>a||!s||t=="delete"&&ui(e.startState)==this.from)return new Qt(this.source,t=="input"&&r.activateOnTyping?1:0);let c=this.explicitPos<0?-1:e.changes.mapPos(this.explicitPos);return X1(s.validFor,e.state,o,a)?new i(this.source,c,s,o,a):s.update&&(s=s.update(s,o,a,new ta(e.state,l,c>=0)))?new i(this.source,c,s,s.from,(n=s.to)!==null&&n!==void 0?n:ui(e.state)):new Qt(this.source,1,c)}handleChange(e){return e.changes.touchesRange(this.from,this.to)?new Qt(this.source,0):this.map(e.changes)}map(e){return e.empty?this:(this.result.map?this.result.map(this.result,e):this.result)?new i(this.source,this.explicitPos<0?-1:e.mapPos(this.explicitPos),this.result,e.mapPos(this.from),e.mapPos(this.to,1)):new Qt(this.source,0)}};function X1(i,e,t,r){if(!i)return!1;let n=e.sliceDoc(t,r);return typeof i=="function"?i(n,t,r,e):Yg(i,!0).test(n)}var Zg=D.define({map(i,e){return i.map(t=>t.map(e))}}),Jg=D.define(),je=re.define({create(){return Bh.start()},update(i,e){return i.update(e)},provide:i=>[Sn.from(i,e=>e.tooltip),R.contentAttributes.from(i,e=>e.attrs)]});function Fh(i,e){let t=e.completion.apply||e.completion.label,r=i.state.field(je).active.find(n=>n.source==e.source);return r instanceof na?(typeof t=="string"?i.dispatch(Object.assign(Object.assign({},R1(i.state,t,r.from,r.to)),{annotations:Uh.of(e.completion)})):t(i,e.completion,r.from,r.to),!0):!1}var N1=_1(je,Fh);function ea(i,e="option"){return t=>{let r=t.state.field(je,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp<t.state.facet(Se).interactionDelay)return!1;let n=1,s;e=="page"&&(s=jc(t,r.open.tooltip))&&(n=Math.max(2,Math.floor(s.dom.offsetHeight/s.dom.querySelector("li").offsetHeight)-1));let{length:o}=r.open.options,a=r.open.selected>-1?r.open.selected+n*(i?1:-1):i?0:o-1;return a<0?a=e=="page"?0:o-1:a>=o&&(a=e=="page"?o-1:0),t.dispatch({effects:Jg.of(a)}),!0}}var j1=i=>{let e=i.state.field(je,!1);return i.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestamp<i.state.facet(Se).interactionDelay?!1:Fh(i,e.open.options[e.open.selected])},I1=i=>i.state.field(je,!1)?(i.dispatch({effects:ra.of(!0)}),!0):!1,W1=i=>{let e=i.state.field(je,!1);return!e||!e.active.some(t=>t.state!=0)?!1:(i.dispatch({effects:In.of(null)}),!0)},Nh=class{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}},z1=50,U1=1e3,F1=se.fromClass(class{constructor(i){this.view=i,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let e of i.state.field(je).active)e.state==1&&this.startQuery(e)}update(i){let e=i.state.field(je),t=i.state.facet(Se);if(!i.selectionSet&&!i.docChanged&&i.startState.field(je)==e)return;let r=i.transactions.some(s=>(s.selection||s.docChanged)&&!Xh(s,t));for(let s=0;s<this.running.length;s++){let o=this.running[s];if(r||o.updates.length+i.transactions.length>z1&&Date.now()-o.time>U1){for(let a of o.context.abortListeners)try{a()}catch(l){xe(this.view.state,l)}o.context.abortListeners=null,this.running.splice(s--,1)}else o.updates.push(...i.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),i.transactions.some(s=>s.effects.some(o=>o.is(ra)))&&(this.pendingStart=!0);let n=this.pendingStart?50:t.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(s=>s.state==1&&!this.running.some(o=>o.active.source==s.source))?setTimeout(()=>this.startUpdate(),n):-1,this.composing!=0)for(let s of i.transactions)Xh(s,t)=="input"?this.composing=2:this.composing==2&&s.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:i}=this.view,e=i.field(je);for(let t of e.active)t.state==1&&!this.running.some(r=>r.active.source==t.source)&&this.startQuery(t)}startQuery(i){let{state:e}=this.view,t=ui(e),r=new ta(e,t,i.explicitPos==t),n=new Nh(i,r);this.running.push(n),Promise.resolve(i.source(r)).then(s=>{n.context.aborted||(n.done=s||null,this.scheduleAccept())},s=>{this.view.dispatch({effects:In.of(null)}),xe(this.view.state,s)})}scheduleAccept(){this.running.every(i=>i.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Se).updateSyncTime))}accept(){var i;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],t=this.view.state.facet(Se);for(let r=0;r<this.running.length;r++){let n=this.running[r];if(n.done===void 0)continue;if(this.running.splice(r--,1),n.done){let o=new na(n.active.source,n.active.explicitPos,n.done,n.done.from,(i=n.done.to)!==null&&i!==void 0?i:ui(n.updates.length?n.updates[0].startState:this.view.state));for(let a of n.updates)o=o.update(a,t);if(o.hasResult()){e.push(o);continue}}let s=this.view.state.field(je).active.find(o=>o.source==n.active.source);if(s&&s.state==1)if(n.done==null){let o=new Qt(n.active.source,0);for(let a of n.updates)o=o.update(a,t);o.state!=1&&e.push(o)}else this.startQuery(s)}e.length&&this.view.dispatch({effects:Zg.of(e)})}},{eventHandlers:{blur(i){let e=this.view.state.field(je,!1);if(e&&e.tooltip&&this.view.state.facet(Se).closeOnBlur){let t=e.open&&jc(this.view,e.open.tooltip);(!t||!t.dom.contains(i.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:In.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:ra.of(!1)}),20),this.composing=0}}}),H1=typeof navigator=="object"&&/Win/.test(navigator.platform),G1=_e.highest(R.domEventHandlers({keydown(i,e){let t=e.state.field(je,!1);if(!t||!t.open||t.open.disabled||t.open.selected<0||i.key.length>1||i.ctrlKey&&!(H1&&i.altKey)||i.metaKey)return!1;let r=t.open.options[t.open.selected],n=t.active.find(o=>o.source==r.source),s=r.completion.commitCharacters||n.result.commitCharacters;return s&&s.indexOf(i.key)>-1&&Fh(e,r),!1}})),Kg=R.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"\xB7\xB7\xB7"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'\u0192'"}},".cm-completionIcon-class":{"&:after":{content:"'\u25CB'"}},".cm-completionIcon-interface":{"&:after":{content:"'\u25CC'"}},".cm-completionIcon-variable":{"&:after":{content:"'\u{1D465}'"}},".cm-completionIcon-constant":{"&:after":{content:"'\u{1D436}'"}},".cm-completionIcon-type":{"&:after":{content:"'\u{1D461}'"}},".cm-completionIcon-enum":{"&:after":{content:"'\u222A'"}},".cm-completionIcon-property":{"&:after":{content:"'\u25A1'"}},".cm-completionIcon-keyword":{"&:after":{content:"'\u{1F511}\uFE0E'"}},".cm-completionIcon-namespace":{"&:after":{content:"'\u25A2'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}}),jh=class{constructor(e,t,r,n){this.field=e,this.line=t,this.from=r,this.to=n}},Ih=class i{constructor(e,t,r){this.field=e,this.from=t,this.to=r}map(e){let t=e.mapPos(this.from,-1,ye.TrackDel),r=e.mapPos(this.to,1,ye.TrackDel);return t==null||r==null?null:new i(this.field,t,r)}},Wh=class i{constructor(e,t){this.lines=e,this.fieldPositions=t}instantiate(e,t){let r=[],n=[t],s=e.doc.lineAt(t),o=/^\s*/.exec(s.text)[0];for(let l of this.lines){if(r.length){let c=o,h=/^\t*/.exec(l)[0].length;for(let u=0;u<h;u++)c+=e.facet(br);n.push(t+c.length-h),l=c+l.slice(h)}r.push(l),t+=l.length+1}let a=this.fieldPositions.map(l=>new Ih(l.field,n[l.line]+l.from,n[l.line]+l.to));return{text:r,ranges:a}}static parse(e){let t=[],r=[],n=[],s;for(let o of e.split(/\r\n?|\n/)){for(;s=/[#$]\{(?:(\d+)(?::([^}]*))?|((?:\\[{}]|[^}])*))\}/.exec(o);){let a=s[1]?+s[1]:null,l=s[2]||s[3]||"",c=-1,h=l.replace(/\\[{}]/g,u=>u[1]);for(let u=0;u<t.length;u++)(a!=null?t[u].seq==a:h&&t[u].name==h)&&(c=u);if(c<0){let u=0;for(;u<t.length&&(a==null||t[u].seq!=null&&t[u].seq<a);)u++;t.splice(u,0,{seq:a,name:h}),c=u;for(let f of n)f.field>=c&&f.field++}n.push(new jh(c,r.length,s.index,s.index+h.length)),o=o.slice(0,s.index)+l+o.slice(s.index+s[0].length)}o=o.replace(/\\([{}])/g,(a,l,c)=>{for(let h of n)h.line==r.length&&h.from>c&&(h.from--,h.to--);return l}),r.push(o)}return new i(r,n)}},Y1=M.widget({widget:new class extends Ne{toDOM(){let i=document.createElement("span");return i.className="cm-snippetFieldPosition",i}ignoreEvent(){return!1}}}),Z1=M.mark({class:"cm-snippetField"}),Tr=class i{constructor(e,t){this.ranges=e,this.active=t,this.deco=M.set(e.map(r=>(r.from==r.to?Y1:Z1).range(r.from,r.to)))}map(e){let t=[];for(let r of this.ranges){let n=r.map(e);if(!n)return null;t.push(n)}return new i(t,this.active)}selectionInsideField(e){return e.ranges.every(t=>this.ranges.some(r=>r.field==this.active&&r.from<=t.from&&r.to>=t.to))}},Un=D.define({map(i,e){return i&&i.map(e)}}),J1=D.define(),Wn=re.define({create(){return null},update(i,e){for(let t of e.effects){if(t.is(Un))return t.value;if(t.is(J1)&&i)return new Tr(i.ranges,t.value)}return i&&e.docChanged&&(i=i.map(e.changes)),i&&e.selection&&!i.selectionInsideField(e.selection)&&(i=null),i},provide:i=>R.decorations.from(i,e=>e?e.deco:M.none)});function Hh(i,e){return T.create(i.filter(t=>t.field==e).map(t=>T.range(t.from,t.to)))}function K1(i){let e=Wh.parse(i);return(t,r,n,s)=>{let{text:o,ranges:a}=e.instantiate(t.state,n),l={changes:{from:n,to:s,insert:j.of(o)},scrollIntoView:!0,annotations:r?[Uh.of(r),de.userEvent.of("input.complete")]:void 0};if(a.length&&(l.selection=Hh(a,0)),a.some(c=>c.field>0)){let c=new Tr(a,0),h=l.effects=[Un.of(c)];t.state.field(Wn,!1)===void 0&&h.push(D.appendConfig.of([Wn,nS,sS,Kg]))}t.dispatch(t.state.update(l))}}function eO(i){return({state:e,dispatch:t})=>{let r=e.field(Wn,!1);if(!r||i<0&&r.active==0)return!1;let n=r.active+i,s=i>0&&!r.ranges.some(o=>o.field==n+i);return t(e.update({selection:Hh(r.ranges,n),effects:Un.of(s?null:new Tr(r.ranges,n)),scrollIntoView:!0})),!0}}var eS=({state:i,dispatch:e})=>i.field(Wn,!1)?(e(i.update({effects:Un.of(null)})),!0):!1,tS=eO(1),iS=eO(-1);var rS=[{key:"Tab",run:tS,shift:iS},{key:"Escape",run:eS}],Ug=A.define({combine(i){return i.length?i[0]:rS}}),nS=_e.highest(It.compute([Ug],i=>i.facet(Ug)));function Mt(i,e){return Object.assign(Object.assign({},e),{apply:K1(i)})}var sS=R.domEventHandlers({mousedown(i,e){let t=e.state.field(Wn,!1),r;if(!t||(r=e.posAtCoords({x:i.clientX,y:i.clientY}))==null)return!1;let n=t.ranges.find(s=>s.from<=r&&s.to>=r);return!n||n.field==t.active?!1:(e.dispatch({selection:Hh(t.ranges,n.field),effects:Un.of(t.ranges.some(s=>s.field>n.field)?new Tr(t.ranges,n.field):null),scrollIntoView:!0}),!0)}});var zn={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},Xi=D.define({map(i,e){let t=e.mapPos(i,-1,ye.TrackAfter);return t??void 0}}),Gh=new class extends ft{};Gh.startSide=1;Gh.endSide=-1;var tO=re.define({create(){return z.empty},update(i,e){if(i=i.map(e.changes),e.selection){let t=e.state.doc.lineAt(e.selection.main.head);i=i.update({filter:r=>r>=t.from&&r<=t.to})}for(let t of e.effects)t.is(Xi)&&(i=i.update({add:[Gh.range(t.value,t.value+1)]}));return i}});function iO(){return[aS,tO]}var Dh="()[]{}<>";function rO(i){for(let e=0;e<Dh.length;e+=2)if(Dh.charCodeAt(e)==i)return Dh.charAt(e+1);return Kr(i<128?i:i+1)}function nO(i,e){return i.languageDataAt("closeBrackets",e)[0]||zn}var oS=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),aS=R.inputHandler.of((i,e,t,r)=>{if((oS?i.composing:i.compositionStarted)||i.state.readOnly)return!1;let n=i.state.selection.main;if(r.length>2||r.length==2&&Qe(fe(r,0))==1||e!=n.from||t!=n.to)return!1;let s=cS(i.state,r);return s?(i.dispatch(s),!0):!1}),lS=({state:i,dispatch:e})=>{if(i.readOnly)return!1;let r=nO(i,i.selection.main.head).brackets||zn.brackets,n=null,s=i.changeByRange(o=>{if(o.empty){let a=hS(i.doc,o.head);for(let l of r)if(l==a&&sa(i.doc,o.head)==rO(fe(l,0)))return{changes:{from:o.head-l.length,to:o.head+l.length},range:T.cursor(o.head-l.length)}}return{range:n=o}});return n||e(i.update(s,{scrollIntoView:!0,userEvent:"delete.backward"})),!n},sO=[{key:"Backspace",run:lS}];function cS(i,e){let t=nO(i,i.selection.main.head),r=t.brackets||zn.brackets;for(let n of r){let s=rO(fe(n,0));if(e==n)return s==n?dS(i,n,r.indexOf(n+n+n)>-1,t):uS(i,n,s,t.before||zn.before);if(e==s&&oO(i,i.selection.main.from))return fS(i,n,s)}return null}function oO(i,e){let t=!1;return i.field(tO).between(0,i.doc.length,r=>{r==e&&(t=!0)}),t}function sa(i,e){let t=i.sliceString(e,e+2);return t.slice(0,Qe(fe(t,0)))}function hS(i,e){let t=i.sliceString(e-2,e);return Qe(fe(t,0))==t.length?t:t.slice(1)}function uS(i,e,t,r){let n=null,s=i.changeByRange(o=>{if(!o.empty)return{changes:[{insert:e,from:o.from},{insert:t,from:o.to}],effects:Xi.of(o.to+e.length),range:T.range(o.anchor+e.length,o.head+e.length)};let a=sa(i.doc,o.head);return!a||/\s/.test(a)||r.indexOf(a)>-1?{changes:{insert:e+t,from:o.head},effects:Xi.of(o.head+e.length),range:T.cursor(o.head+e.length)}:{range:n=o}});return n?null:i.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function fS(i,e,t){let r=null,n=i.changeByRange(s=>s.empty&&sa(i.doc,s.head)==t?{changes:{from:s.head,to:s.head+t.length,insert:t},range:T.cursor(s.head+t.length)}:r={range:s});return r?null:i.update(n,{scrollIntoView:!0,userEvent:"input.type"})}function dS(i,e,t,r){let n=r.stringPrefixes||zn.stringPrefixes,s=null,o=i.changeByRange(a=>{if(!a.empty)return{changes:[{insert:e,from:a.from},{insert:e,from:a.to}],effects:Xi.of(a.to+e.length),range:T.range(a.anchor+e.length,a.head+e.length)};let l=a.head,c=sa(i.doc,l),h;if(c==e){if(Fg(i,l))return{changes:{insert:e+e,from:l},effects:Xi.of(l+e.length),range:T.cursor(l+e.length)};if(oO(i,l)){let f=t&&i.sliceDoc(l,l+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:l,to:l+f.length,insert:f},range:T.cursor(l+f.length)}}}else{if(t&&i.sliceDoc(l-2*e.length,l)==e+e&&(h=Hg(i,l-2*e.length,n))>-1&&Fg(i,h))return{changes:{insert:e+e+e+e,from:l},effects:Xi.of(l+e.length),range:T.cursor(l+e.length)};if(i.charCategorizer(l)(c)!=H.Word&&Hg(i,l,n)>-1&&!pS(i,l,e,n))return{changes:{insert:e+e,from:l},effects:Xi.of(l+e.length),range:T.cursor(l+e.length)}}return{range:s=a}});return s?null:i.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function Fg(i,e){let t=he(i).resolveInner(e+1);return t.parent&&t.from==e}function pS(i,e,t,r){let n=he(i).resolveInner(e,-1),s=r.reduce((o,a)=>Math.max(o,a.length),0);for(let o=0;o<5;o++){let a=i.sliceDoc(n.from,Math.min(n.to,n.from+t.length+s)),l=a.indexOf(t);if(!l||l>-1&&r.indexOf(a.slice(0,l))>-1){let h=n.firstChild;for(;h&&h.from==n.from&&h.to-h.from>t.length+l;){if(i.sliceDoc(h.to-t.length,h.to)==t)return!1;h=h.firstChild}return!0}let c=n.to==e&&n.parent;if(!c)break;n=c}return!1}function Hg(i,e,t){let r=i.charCategorizer(e);if(r(i.sliceDoc(e-1,e))!=H.Word)return e;for(let n of t){let s=e-n.length;if(i.sliceDoc(s,e)==n&&r(i.sliceDoc(s-1,s))!=H.Word)return s}return-1}function Fn(i={}){return[G1,je,Se.of(i),F1,mS,Kg]}var Yh=[{key:"Ctrl-Space",run:I1},{key:"Escape",run:W1},{key:"ArrowDown",run:ea(!0)},{key:"ArrowUp",run:ea(!1)},{key:"PageDown",run:ea(!0,"page")},{key:"PageUp",run:ea(!1,"page")},{key:"Enter",run:j1}],mS=_e.highest(It.computeN([Se],i=>i.facet(Se).defaultKeymap?[Yh]:[]));var Zh=class{constructor(e,t,r){this.from=e,this.to=t,this.diagnostic=r}},Ni=class i{constructor(e,t,r){this.diagnostics=e,this.panel=t,this.selected=r}static init(e,t,r){let n=e,s=r.facet(Hn).markerFilter;s&&(n=s(n,r));let o=M.set(n.map(a=>a.from==a.to||a.from==a.to-1&&r.doc.lineAt(a.from).to==a.from?M.widget({widget:new Jh(a),diagnostic:a}).range(a.from):M.mark({attributes:{class:"cm-lintRange cm-lintRange-"+a.severity+(a.markClass?" "+a.markClass:"")},diagnostic:a}).range(a.from,a.to)),!0);return new i(o,t,Pr(o))}};function Pr(i,e=null,t=0){let r=null;return i.between(t,1e9,(n,s,{spec:o})=>{if(!(e&&o.diagnostic!=e))return r=new Zh(n,s,o.diagnostic),!1}),r}function gS(i,e){let t=e.pos,r=e.end||t,n=i.state.facet(Hn).hideOn(i,t,r);if(n!=null)return n;let s=i.startState.doc.lineAt(e.pos);return!!(i.effects.some(o=>o.is(lO))||i.changes.touchesRange(s.from,Math.max(s.to,r)))}function OS(i,e){return i.field(Ze,!1)?e:e.concat(D.appendConfig.of(TS))}var lO=D.define(),Kh=D.define(),cO=D.define(),Ze=re.define({create(){return new Ni(M.none,null,null)},update(i,e){if(e.docChanged&&i.diagnostics.size){let t=i.diagnostics.map(e.changes),r=null,n=i.panel;if(i.selected){let s=e.changes.mapPos(i.selected.from,1);r=Pr(t,i.selected.diagnostic,s)||Pr(t,null,s)}!t.size&&n&&e.state.facet(Hn).autoPanel&&(n=null),i=new Ni(t,n,r)}for(let t of e.effects)if(t.is(lO)){let r=e.state.facet(Hn).autoPanel?t.value.length?Gn.open:null:i.panel;i=Ni.init(t.value,r,e.state)}else t.is(Kh)?i=new Ni(i.diagnostics,t.value?Gn.open:null,i.selected):t.is(cO)&&(i=new Ni(i.diagnostics,i.panel,t.value));return i},provide:i=>[Qi.from(i,e=>e.panel),R.decorations.from(i,e=>e.diagnostics)]});var yS=M.mark({class:"cm-lintRange cm-lintRange-active"});function bS(i,e,t){let{diagnostics:r}=i.state.field(Ze),n=[],s=2e8,o=0;r.between(e-(t<0?1:0),e+(t>0?1:0),(l,c,{spec:h})=>{e>=l&&e<=c&&(l==c||(e>l||t>0)&&(e<c||t<0))&&(n.push(h.diagnostic),s=Math.min(l,s),o=Math.max(c,o))});let a=i.state.facet(Hn).tooltipFilter;return a&&(n=a(n,i.state)),n.length?{pos:s,end:o,above:i.state.doc.lineAt(s).to<o,create(){return{dom:wS(i,n)}}}:null}function wS(i,e){return F("ul",{class:"cm-tooltip-lint"},e.map(t=>fO(i,t,!1)))}var vS=i=>{let e=i.state.field(Ze,!1);(!e||!e.panel)&&i.dispatch({effects:OS(i.state,[Kh.of(!0)])});let t=Mi(i,Gn.open);return t&&t.dom.querySelector(".cm-panel-lint ul").focus(),!0},aO=i=>{let e=i.state.field(Ze,!1);return!e||!e.panel?!1:(i.dispatch({effects:Kh.of(!1)}),!0)},xS=i=>{let e=i.state.field(Ze,!1);if(!e)return!1;let t=i.state.selection.main,r=e.diagnostics.iter(t.to+1);return!r.value&&(r=e.diagnostics.iter(0),!r.value||r.from==t.from&&r.to==t.to)?!1:(i.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0}),!0)};var hO=[{key:"Mod-Shift-m",run:vS,preventDefault:!0},{key:"F8",run:xS}];var Hn=A.define({combine(i){return Object.assign({sources:i.map(e=>e.source).filter(e=>e!=null)},Ce(i.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{needsRefresh:(e,t)=>e?t?r=>e(r)||t(r):e:t}))}});function uO(i){let e=[];if(i)e:for(let{name:t}of i){for(let r=0;r<t.length;r++){let n=t[r];if(/[a-zA-Z]/.test(n)&&!e.some(s=>s.toLowerCase()==n.toLowerCase())){e.push(n);continue e}}e.push("")}return e}function fO(i,e,t){var r;let n=t?uO(e.actions):[];return F("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},F("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage(i):e.message),(r=e.actions)===null||r===void 0?void 0:r.map((s,o)=>{let a=!1,l=f=>{if(f.preventDefault(),a)return;a=!0;let d=Pr(i.state.field(Ze).diagnostics,e);d&&s.apply(i,d.from,d.to)},{name:c}=s,h=n[o]?c.indexOf(n[o]):-1,u=h<0?c:[c.slice(0,h),F("u",c.slice(h,h+1)),c.slice(h+1)];return F("button",{type:"button",class:"cm-diagnosticAction",onclick:l,onmousedown:l,"aria-label":` Action: ${c}${h<0?"":` (access key "${n[o]})"`}.`},u)}),e.source&&F("div",{class:"cm-diagnosticSource"},e.source))}var Jh=class extends Ne{constructor(e){super(),this.diagnostic=e}eq(e){return e.diagnostic==this.diagnostic}toDOM(){return F("span",{class:"cm-lintPoint cm-lintPoint-"+this.diagnostic.severity})}},aa=class{constructor(e,t){this.diagnostic=t,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=fO(e,t,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}},Gn=class i{constructor(e){this.view=e,this.items=[];let t=n=>{if(n.keyCode==27)aO(this.view),this.view.focus();else if(n.keyCode==38||n.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(n.keyCode==40||n.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(n.keyCode==36)this.moveSelection(0);else if(n.keyCode==35)this.moveSelection(this.items.length-1);else if(n.keyCode==13)this.view.focus();else if(n.keyCode>=65&&n.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:s}=this.items[this.selectedIndex],o=uO(s.actions);for(let a=0;a<o.length;a++)if(o[a].toUpperCase().charCodeAt(0)==n.keyCode){let l=Pr(this.view.state.field(Ze).diagnostics,s);l&&s.actions[a].apply(e,l.from,l.to)}}else return;n.preventDefault()},r=n=>{for(let s=0;s<this.items.length;s++)this.items[s].dom.contains(n.target)&&this.moveSelection(s)};this.list=F("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:t,onclick:r}),this.dom=F("div",{class:"cm-panel-lint"},this.list,F("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>aO(this.view)},"\xD7")),this.update()}get selectedIndex(){let e=this.view.state.field(Ze).selected;if(!e)return-1;for(let t=0;t<this.items.length;t++)if(this.items[t].diagnostic==e.diagnostic)return t;return-1}update(){let{diagnostics:e,selected:t}=this.view.state.field(Ze),r=0,n=!1,s=null;for(e.between(0,this.view.state.doc.length,(o,a,{spec:l})=>{let c=-1,h;for(let u=r;u<this.items.length;u++)if(this.items[u].diagnostic==l.diagnostic){c=u;break}c<0?(h=new aa(this.view,l.diagnostic),this.items.splice(r,0,h),n=!0):(h=this.items[c],c>r&&(this.items.splice(r,c-r),n=!0)),t&&h.diagnostic==t.diagnostic?h.dom.hasAttribute("aria-selected")||(h.dom.setAttribute("aria-selected","true"),s=h):h.dom.hasAttribute("aria-selected")&&h.dom.removeAttribute("aria-selected"),r++});r<this.items.length&&!(this.items.length==1&&this.items[0].diagnostic.from<0);)n=!0,this.items.pop();this.items.length==0&&(this.items.push(new aa(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),n=!0),s?(this.list.setAttribute("aria-activedescendant",s.id),this.view.requestMeasure({key:this,read:()=>({sel:s.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:o,panel:a})=>{let l=a.height/this.list.offsetHeight;o.top<a.top?this.list.scrollTop-=(a.top-o.top)/l:o.bottom>a.bottom&&(this.list.scrollTop+=(o.bottom-a.bottom)/l)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),n&&this.sync()}sync(){let e=this.list.firstChild;function t(){let r=e;e=r.nextSibling,r.remove()}for(let r of this.items)if(r.dom.parentNode==this.list){for(;e!=r.dom;)t();e=r.dom.nextSibling}else this.list.insertBefore(r.dom,e);for(;e;)t()}moveSelection(e){if(this.selectedIndex<0)return;let t=this.view.state.field(Ze),r=Pr(t.diagnostics,this.items[e].diagnostic);r&&this.view.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0,effects:cO.of(r)})}static open(e){return new i(e)}};function SS(i,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${e}>${encodeURIComponent(i)}</svg>')`}function oa(i){return SS(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${i}" fill="none" stroke-width=".7"/>`,'width="6" height="3"')}var kS=R.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:oa("#d11")},".cm-lintRange-warning":{backgroundImage:oa("orange")},".cm-lintRange-info":{backgroundImage:oa("#999")},".cm-lintRange-hint":{backgroundImage:oa("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}}});var TS=[Ze,R.decorations.compute([Ze],i=>{let{selected:e,panel:t}=i.field(Ze);return!e||!t||e.from==e.to?M.none:M.set([yS.range(e.from,e.to)])}),sm(bS,{hideOn:gS}),kS];var dO=[lm(),cm(),tm(),Jm(),Lm(),Zp(),em(),W.allowMultipleSelections.of(!0),Cm(),Vn(Vm,{fallback:!0}),Nm(),iO(),Fn(),rm(),nm(),im(),Lg(),It.of([...sO,...Cg,...Xg,...ig,...Mm,...Yh,...hO])];var iu=class i{constructor(e,t,r,n,s,o,a,l,c,h=0,u){this.p=e,this.stack=t,this.state=r,this.reducePos=n,this.pos=s,this.score=o,this.buffer=a,this.bufferBase=l,this.curContext=c,this.lookAhead=h,this.parent=u}toString(){return`[${this.stack.filter((e,t)=>t%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,t,r=0){let n=e.parser.context;return new i(e,[],t,r,r,0,[],0,n?new la(n,n.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var t;let r=e>>19,n=e&65535,{parser:s}=this.p;this.reducePos<this.pos-25&&this.setLookAhead(this.pos);let o=s.dynamicPrecedence(n);if(o&&(this.score+=o),r==0){this.pushState(s.getGoto(this.state,n,!0),this.reducePos),n<s.minRepeatTerm&&this.storeNode(n,this.reducePos,this.reducePos,4,!0),this.reduceContext(n,this.reducePos);return}let a=this.stack.length-(r-1)*3-(e&262144?6:0),l=a?this.stack[a-2]:this.p.ranges[0].from,c=this.reducePos-l;c>=2e3&&!(!((t=this.p.parser.nodeSet.types[n])===null||t===void 0)&&t.isAnonymous)&&(l==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=c):this.p.lastBigReductionSize<c&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=l,this.p.lastBigReductionSize=c));let h=a?this.stack[a-1]:0,u=this.bufferBase+this.buffer.length-h;if(n<s.minRepeatTerm||e&131072){let f=s.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(n,l,f,u+4,!0)}if(e&262144)this.state=this.stack[a];else{let f=this.stack[a-3];this.state=s.getGoto(f,n,!0)}for(;this.stack.length>a;)this.stack.pop();this.reduceContext(n,l)}storeNode(e,t,r,n=4,s=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let o=this,a=this.buffer.length;if(a==0&&o.parent&&(a=o.bufferBase-o.parent.bufferBase,o=o.parent),a>0&&o.buffer[a-4]==0&&o.buffer[a-1]>-1){if(t==r)return;if(o.buffer[a-2]>=t){o.buffer[a-2]=r;return}}}if(!s||this.pos==r)this.buffer.push(e,t,r,n);else{let o=this.buffer.length;if(o>0&&this.buffer[o-4]!=0)for(;o>0&&this.buffer[o-2]>r;)this.buffer[o]=this.buffer[o-4],this.buffer[o+1]=this.buffer[o-3],this.buffer[o+2]=this.buffer[o-2],this.buffer[o+3]=this.buffer[o-1],o-=4,n>4&&(n-=4);this.buffer[o]=e,this.buffer[o+1]=t,this.buffer[o+2]=r,this.buffer[o+3]=n}}shift(e,t,r,n){if(e&131072)this.pushState(e&65535,this.pos);else if((e&262144)==0){let s=e,{parser:o}=this.p;(n>this.pos||t<=o.maxNode)&&(this.pos=n,o.stateFlag(s,1)||(this.reducePos=n)),this.pushState(s,r),this.shiftContext(t,r),t<=o.maxNode&&this.buffer.push(t,r,n,4)}else this.pos=n,this.shiftContext(t,r),t<=this.p.parser.maxNode&&this.buffer.push(t,r,n,4)}apply(e,t,r,n){e&65536?this.reduce(e):this.shift(e,t,r,n)}useNode(e,t){let r=this.p.reused.length-1;(r<0||this.p.reused[r]!=e)&&(this.p.reused.push(e),r++);let n=this.pos;this.reducePos=this.pos=n+e.length,this.pushState(t,n),this.buffer.push(r,n,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,t=e.buffer.length;for(;t>0&&e.buffer[t-2]>e.reducePos;)t-=4;let r=e.buffer.slice(t),n=e.bufferBase+t;for(;e&&n==e.bufferBase;)e=e.parent;return new i(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,r,n,this.curContext,this.lookAhead,e)}recoverByDelete(e,t){let r=e<=this.p.parser.maxNode;r&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,r?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new ru(this);;){let r=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(r==0)return!1;if((r&65536)==0)return!0;t.reduce(r)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>8||this.stack.length>=120){let n=[];for(let s=0,o;s<t.length;s+=2)(o=t[s+1])!=this.state&&this.p.parser.hasAction(o,e)&&n.push(t[s],o);if(this.stack.length<120)for(let s=0;n.length<8&&s<t.length;s+=2){let o=t[s+1];n.some((a,l)=>l&1&&a==o)||n.push(t[s],o)}t=n}let r=[];for(let n=0;n<t.length&&r.length<4;n+=2){let s=t[n+1];if(s==this.state)continue;let o=this.split();o.pushState(s,this.pos),o.storeNode(0,o.pos,o.pos,4,!0),o.shiftContext(t[n],this.pos),o.reducePos=this.pos,o.score-=200,r.push(o)}return r}forceReduce(){let{parser:e}=this.p,t=e.stateSlot(this.state,5);if((t&65536)==0)return!1;if(!e.validAction(this.state,t)){let r=t>>19,n=t&65535,s=this.stack.length-r*3;if(s<0||e.getGoto(this.stack[s],n,!1)<0){let o=this.findForcedReduction();if(o==null)return!1;t=o}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}findForcedReduction(){let{parser:e}=this.p,t=[],r=(n,s)=>{if(!t.includes(n))return t.push(n),e.allActions(n,o=>{if(!(o&393216))if(o&65536){let a=(o>>19)-s;if(a>1){let l=o&65535,c=this.stack.length-a*3;if(c>=0&&e.getGoto(this.stack[c],l,!1)>=0)return a<<19|65536|l}}else{let a=r(o,s+1);if(a!=null)return a}})};return r(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let t=0;t<this.stack.length;t+=3)if(this.stack[t]!=e.stack[t])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(t)))}reduceContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(t)))}emitContext(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-3)&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-4)&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(e){if(e!=this.curContext.context){let t=new la(this.curContext.tracker,e);t.hash!=this.curContext.hash&&this.emitContext(),this.curContext=t}}setLookAhead(e){e>this.lookAhead&&(this.emitLookAhead(),this.lookAhead=e)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}},la=class{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}},ru=class{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=e&65535,r=e>>19;r==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(r-1)*3;let n=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=n}},nu=class i{constructor(e,t,r){this.stack=e,this.pos=t,this.index=r,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,t=e.bufferBase+e.buffer.length){return new i(e,t,t-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new i(this.stack,this.pos,this.index)}};function Yn(i,e=Uint16Array){if(typeof i!="string")return i;let t=null;for(let r=0,n=0;r<i.length;){let s=0;for(;;){let o=i.charCodeAt(r++),a=!1;if(o==126){s=65535;break}o>=92&&o--,o>=34&&o--;let l=o-32;if(l>=46&&(l-=46,a=!0),s+=l,a)break;s*=46}t?t[n++]=s:t=new e(s)}return t}var Cr=class{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}},pO=new Cr,su=class{constructor(e,t){this.input=e,this.ranges=t,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=pO,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){let r=this.range,n=this.rangeIndex,s=this.pos+e;for(;s<r.from;){if(!n)return null;let o=this.ranges[--n];s-=r.from-o.to,r=o}for(;t<0?s>r.to:s>=r.to;){if(n==this.ranges.length-1)return null;let o=this.ranges[++n];s+=o.from-r.to,r=o}return s}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let t of this.ranges)if(t.to>e)return Math.max(e,t.from);return this.end}peek(e){let t=this.chunkOff+e,r,n;if(t>=0&&t<this.chunk.length)r=this.pos+e,n=this.chunk.charCodeAt(t);else{let s=this.resolveOffset(e,1);if(s==null)return-1;if(r=s,r>=this.chunk2Pos&&r<this.chunk2Pos+this.chunk2.length)n=this.chunk2.charCodeAt(r-this.chunk2Pos);else{let o=this.rangeIndex,a=this.range;for(;a.to<=r;)a=this.ranges[++o];this.chunk2=this.input.chunk(this.chunk2Pos=r),r+this.chunk2.length>a.to&&(this.chunk2=this.chunk2.slice(0,a.to-r)),n=this.chunk2.charCodeAt(0)}}return r>=this.token.lookAhead&&(this.token.lookAhead=r+1),n}acceptToken(e,t=0){let r=t?this.resolveOffset(t,-1):this.pos;if(r==null||r<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=e,this.token.end=r}acceptTokenTo(e,t){this.token.value=e,this.token.end=t}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:t}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=t,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),t=this.pos+e.length;this.chunk=t>this.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=pO,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;e>=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e<this.chunkPos+this.chunk.length?this.chunkOff=e-this.chunkPos:(this.chunk="",this.chunkOff=0),this.readNext()}return this}read(e,t){if(e>=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let r="";for(let n of this.ranges){if(n.from>=t)break;n.to>e&&(r+=this.input.read(Math.max(n.from,e),Math.min(n.to,t)))}return r}},fi=class{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:r}=t.p;bO(this.data,e,t,this.id,r.data,r.tokenPrecTable)}};fi.prototype.contextual=fi.prototype.fallback=fi.prototype.extend=!1;var ou=class{constructor(e,t,r){this.precTable=t,this.elseToken=r,this.data=typeof e=="string"?Yn(e):e}token(e,t){let r=e.pos,n=0;for(;;){let s=e.next<0,o=e.resolveOffset(1,1);if(bO(this.data,e,t,0,this.data,this.precTable),e.token.value>-1)break;if(this.elseToken==null)return;if(s||n++,o==null)break;e.reset(o,e.token)}n&&(e.reset(r,e.token),e.acceptToken(this.elseToken,n))}};ou.prototype.contextual=fi.prototype.fallback=fi.prototype.extend=!1;var ji=class{constructor(e,t={}){this.token=e,this.contextual=!!t.contextual,this.fallback=!!t.fallback,this.extend=!!t.extend}};function bO(i,e,t,r,n,s){let o=0,a=1<<r,{dialect:l}=t.p.parser;e:for(;(a&i[o])!=0;){let c=i[o+1];for(let d=o+3;d<c;d+=2)if((i[d+1]&a)>0){let m=i[d];if(l.allows(m)&&(e.token.value==-1||e.token.value==m||CS(m,e.token.value,n,s))){e.acceptToken(m);break}}let h=e.next,u=0,f=i[o+2];if(e.next<0&&f>u&&i[c+f*3-3]==65535){o=i[c+f*3-1];continue e}for(;u<f;){let d=u+f>>1,m=c+d+(d<<1),p=i[m],g=i[m+1]||65536;if(h<p)f=d;else if(h>=g)u=d+1;else{o=i[m+2],e.advance();continue e}}break}}function mO(i,e,t){for(let r=e,n;(n=i[r])!=65535;r++)if(n==t)return r-e;return-1}function CS(i,e,t,r){let n=mO(t,r,e);return n<0||mO(t,r,i)<n}var Je=typeof process<"u"&&process.env&&/\bparse\b/.test(process.env.LOG),eu=null;function gO(i,e,t){let r=i.cursor(ae.IncludeAnonymous);for(r.moveTo(e);;)if(!(t<0?r.childBefore(e):r.childAfter(e)))for(;;){if((t<0?r.to<e:r.from>e)&&!r.type.isError)return t<0?Math.max(0,Math.min(r.to-1,e-25)):Math.min(i.length,Math.max(r.from+1,e+25));if(t<0?r.prevSibling():r.nextSibling())break;if(!r.parent())return t<0?0:i.length}}var au=class{constructor(e,t){this.fragments=e,this.nodeSet=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?gO(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?gO(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(e<this.nextStart)return null;for(;this.fragment&&this.safeTo<=e;)this.nextFragment();if(!this.fragment)return null;for(;;){let t=this.trees.length-1;if(t<0)return this.nextFragment(),null;let r=this.trees[t],n=this.index[t];if(n==r.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let s=r.children[n],o=this.start[t]+r.positions[n];if(o>e)return this.nextStart=o,null;if(s instanceof ce){if(o==e){if(o<this.safeFrom)return null;let a=o+s.length;if(a<=this.safeTo){let l=s.prop(L.lookAhead);if(!l||a+l<this.fragment.to)return s}}this.index[t]++,o+s.length>=Math.max(this.safeFrom,e)&&(this.trees.push(s),this.start.push(o),this.index.push(0))}else this.index[t]++,this.nextStart=o+s.length}}},lu=class{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(r=>new Cr)}getActions(e){let t=0,r=null,{parser:n}=e.p,{tokenizers:s}=n,o=n.stateSlot(e.state,3),a=e.curContext?e.curContext.hash:0,l=0;for(let c=0;c<s.length;c++){if((1<<c&o)==0)continue;let h=s[c],u=this.tokens[c];if(!(r&&!h.fallback)&&((h.contextual||u.start!=e.pos||u.mask!=o||u.context!=a)&&(this.updateCachedToken(u,h,e),u.mask=o,u.context=a),u.lookAhead>u.end+25&&(l=Math.max(u.lookAhead,l)),u.value!=0)){let f=t;if(u.extended>-1&&(t=this.addActions(e,u.extended,u.end,t)),t=this.addActions(e,u.value,u.end,t),!h.extend&&(r=u,t>f))break}}for(;this.actions.length>t;)this.actions.pop();return l&&e.setLookAhead(l),!r&&e.pos==this.stream.end&&(r=new Cr,r.value=e.p.parser.eofTerm,r.start=r.end=e.pos,t=this.addActions(e,r.value,r.end,t)),this.mainToken=r,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new Cr,{pos:r,p:n}=e;return t.start=r,t.end=Math.min(r+1,n.stream.end),t.value=r==n.stream.end?n.parser.eofTerm:0,t}updateCachedToken(e,t,r){let n=this.stream.clipPos(r.pos);if(t.token(this.stream.reset(n,e),r),e.value>-1){let{parser:s}=r.p;for(let o=0;o<s.specialized.length;o++)if(s.specialized[o]==e.value){let a=s.specializers[o](this.stream.read(e.start,e.end),r);if(a>=0&&r.p.parser.dialect.allows(a>>1)){(a&1)==0?e.value=a>>1:e.extended=a>>1;break}}}else e.value=0,e.end=this.stream.clipPos(n+1)}putAction(e,t,r,n){for(let s=0;s<n;s+=3)if(this.actions[s]==e)return n;return this.actions[n++]=e,this.actions[n++]=t,this.actions[n++]=r,n}addActions(e,t,r,n){let{state:s}=e,{parser:o}=e.p,{data:a}=o;for(let l=0;l<2;l++)for(let c=o.stateSlot(s,l?2:1);;c+=3){if(a[c]==65535)if(a[c+1]==1)c=Wt(a,c+2);else{n==0&&a[c+1]==2&&(n=this.putAction(Wt(a,c+2),t,r,n));break}a[c]==t&&(n=this.putAction(Wt(a,c+1),t,r,n))}return n}},cu=class{constructor(e,t,r,n){this.parser=e,this.input=t,this.ranges=n,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new su(t,n),this.tokens=new lu(e,this.stream),this.topTerm=e.top[1];let{from:s}=n[0];this.stacks=[iu.start(this,e.top[0],s)],this.fragments=r.length&&this.stream.end-s>e.bufferLength*4?new au(r,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,t=this.minStackPos,r=this.stacks=[],n,s;if(this.bigReductionCount>300&&e.length==1){let[o]=e;for(;o.forceReduce()&&o.stack.length&&o.stack[o.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let o=0;o<e.length;o++){let a=e[o];for(;;){if(this.tokens.mainToken=null,a.pos>t)r.push(a);else{if(this.advanceStack(a,r,e))continue;{n||(n=[],s=[]),n.push(a);let l=this.tokens.getMainToken(a);s.push(l.value,l.end)}}break}}if(!r.length){let o=n&&ES(n);if(o)return Je&&console.log("Finish with "+this.stackID(o)),this.stackToTree(o);if(this.parser.strict)throw Je&&n&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+t);this.recovering||(this.recovering=5)}if(this.recovering&&n){let o=this.stoppedAt!=null&&n[0].pos>this.stoppedAt?n[0]:this.runRecovery(n,s,r);if(o)return Je&&console.log("Force-finish "+this.stackID(o)),this.stackToTree(o.forceAll())}if(this.recovering){let o=this.recovering==1?1:this.recovering*3;if(r.length>o)for(r.sort((a,l)=>l.score-a.score);r.length>o;)r.pop();r.some(a=>a.reducePos>t)&&this.recovering--}else if(r.length>1){e:for(let o=0;o<r.length-1;o++){let a=r[o];for(let l=o+1;l<r.length;l++){let c=r[l];if(a.sameState(c)||a.buffer.length>500&&c.buffer.length>500)if((a.score-c.score||a.buffer.length-c.buffer.length)>0)r.splice(l--,1);else{r.splice(o--,1);continue e}}}r.length>12&&r.splice(12,r.length-12)}this.minStackPos=r[0].pos;for(let o=1;o<r.length;o++)r[o].pos<this.minStackPos&&(this.minStackPos=r[o].pos);return null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=e}advanceStack(e,t,r){let n=e.pos,{parser:s}=this,o=Je?this.stackID(e)+" -> ":"";if(this.stoppedAt!=null&&n>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let c=e.curContext&&e.curContext.tracker.strict,h=c?e.curContext.hash:0;for(let u=this.fragments.nodeAt(n);u;){let f=this.parser.nodeSet.types[u.type.id]==u.type?s.getGoto(e.state,u.type.id):-1;if(f>-1&&u.length&&(!c||(u.prop(L.contextHash)||0)==h))return e.useNode(u,f),Je&&console.log(o+this.stackID(e)+` (via reuse of ${s.getName(u.type.id)})`),!0;if(!(u instanceof ce)||u.children.length==0||u.positions[0]>0)break;let d=u.children[0];if(d instanceof ce&&u.positions[0]==0)u=d;else break}}let a=s.stateSlot(e.state,4);if(a>0)return e.reduce(a),Je&&console.log(o+this.stackID(e)+` (via always-reduce ${s.getName(a&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let l=this.tokens.getActions(e);for(let c=0;c<l.length;){let h=l[c++],u=l[c++],f=l[c++],d=c==l.length||!r,m=d?e:e.split(),p=this.tokens.mainToken;if(m.apply(h,u,p?p.start:m.pos,f),Je&&console.log(o+this.stackID(m)+` (via ${(h&65536)==0?"shift":`reduce of ${s.getName(h&65535)}`} for ${s.getName(u)} @ ${n}${m==e?"":", split"})`),d)return!0;m.pos>n?t.push(m):r.push(m)}return!1}advanceFully(e,t){let r=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>r)return OO(e,t),!0}}runRecovery(e,t,r){let n=null,s=!1;for(let o=0;o<e.length;o++){let a=e[o],l=t[o<<1],c=t[(o<<1)+1],h=Je?this.stackID(a)+" -> ":"";if(a.deadEnd&&(s||(s=!0,a.restart(),Je&&console.log(h+this.stackID(a)+" (restarted)"),this.advanceFully(a,r))))continue;let u=a.split(),f=h;for(let d=0;u.forceReduce()&&d<10&&(Je&&console.log(f+this.stackID(u)+" (via force-reduce)"),!this.advanceFully(u,r));d++)Je&&(f=this.stackID(u)+" -> ");for(let d of a.recoverByInsert(l))Je&&console.log(h+this.stackID(d)+" (via recover-insert)"),this.advanceFully(d,r);this.stream.end>a.pos?(c==a.pos&&(c++,l=0),a.recoverByDelete(l,c),Je&&console.log(h+this.stackID(a)+` (via recover-delete ${this.parser.getName(l)})`),OO(a,r)):(!n||n.score<a.score)&&(n=a)}return n}stackToTree(e){return e.close(),ce.build({buffer:nu.create(e),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:e.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(e){let t=(eu||(eu=new WeakMap)).get(e);return t||eu.set(e,t=String.fromCodePoint(this.nextStackID++)),t+e}};function OO(i,e){for(let t=0;t<e.length;t++){let r=e[t];if(r.pos==i.pos&&r.sameState(i)){e[t].score<i.score&&(e[t]=i);return}}e.push(i)}var hu=class{constructor(e,t,r){this.source=e,this.flags=t,this.disabled=r}allows(e){return!this.disabled||this.disabled[e]==0}},tu=i=>i,ca=class{constructor(e){this.start=e.start,this.shift=e.shift||tu,this.reduce=e.reduce||tu,this.reuse=e.reuse||tu,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}},Er=class i extends dr{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let t=e.nodeNames.split(" ");this.minRepeatTerm=t.length;for(let a=0;a<e.repeatNodeCount;a++)t.push("");let r=Object.keys(e.topRules).map(a=>e.topRules[a][1]),n=[];for(let a=0;a<t.length;a++)n.push([]);function s(a,l,c){n[a].push([l,l.deserialize(String(c))])}if(e.nodeProps)for(let a of e.nodeProps){let l=a[0];typeof l=="string"&&(l=L[l]);for(let c=1;c<a.length;){let h=a[c++];if(h>=0)s(h,l,a[c++]);else{let u=a[c+-h];for(let f=-h;f>0;f--)s(a[c++],l,u);c++}}}this.nodeSet=new Tn(t.map((a,l)=>Ee.define({name:l>=this.minRepeatTerm?void 0:a,id:l,props:n[l],top:r.indexOf(l)>-1,error:l==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(l)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=1024;let o=Yn(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let a=0;a<this.specializerSpecs.length;a++)this.specialized[a]=this.specializerSpecs[a].term;this.specializers=this.specializerSpecs.map(yO),this.states=Yn(e.states,Uint32Array),this.data=Yn(e.stateData),this.goto=Yn(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(a=>typeof a=="number"?new fi(o,a):a),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,t,r){let n=new cu(this,e,t,r);for(let s of this.wrappers)n=s(n,e,t,r);return n}getGoto(e,t,r=!1){let n=this.goto;if(t>=n[0])return-1;for(let s=n[t+1];;){let o=n[s++],a=o&1,l=n[s++];if(a&&r)return l;for(let c=s+(o>>1);s<c;s++)if(n[s]==e)return l;if(a)return-1}}hasAction(e,t){let r=this.data;for(let n=0;n<2;n++)for(let s=this.stateSlot(e,n?2:1),o;;s+=3){if((o=r[s])==65535)if(r[s+1]==1)o=r[s=Wt(r,s+2)];else{if(r[s+1]==2)return Wt(r,s+2);break}if(o==t||o==0)return Wt(r,s+1)}return 0}stateSlot(e,t){return this.states[e*6+t]}stateFlag(e,t){return(this.stateSlot(e,0)&t)>0}validAction(e,t){return!!this.allActions(e,r=>r==t?!0:null)}allActions(e,t){let r=this.stateSlot(e,4),n=r?t(r):void 0;for(let s=this.stateSlot(e,1);n==null;s+=3){if(this.data[s]==65535)if(this.data[s+1]==1)s=Wt(this.data,s+2);else break;n=t(Wt(this.data,s+1))}return n}nextStates(e){let t=[];for(let r=this.stateSlot(e,1);;r+=3){if(this.data[r]==65535)if(this.data[r+1]==1)r=Wt(this.data,r+2);else break;if((this.data[r+2]&1)==0){let n=this.data[r+1];t.some((s,o)=>o&1&&s==n)||t.push(this.data[r],n)}}return t}configure(e){let t=Object.assign(Object.create(i.prototype),this);if(e.props&&(t.nodeSet=this.nodeSet.extend(...e.props)),e.top){let r=this.topRules[e.top];if(!r)throw new RangeError(`Invalid top rule name ${e.top}`);t.top=r}return e.tokenizers&&(t.tokenizers=this.tokenizers.map(r=>{let n=e.tokenizers.find(s=>s.from==r);return n?n.to:r})),e.specializers&&(t.specializers=this.specializers.slice(),t.specializerSpecs=this.specializerSpecs.map((r,n)=>{let s=e.specializers.find(a=>a.from==r.external);if(!s)return r;let o=Object.assign(Object.assign({},r),{external:s.to});return t.specializers[n]=yO(o),o})),e.contextTracker&&(t.context=e.contextTracker),e.dialect&&(t.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(t.strict=e.strict),e.wrap&&(t.wrappers=t.wrappers.concat(e.wrap)),e.bufferLength!=null&&(t.bufferLength=e.bufferLength),t}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let t=this.dynamicPrecedences;return t==null?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),r=t.map(()=>!1);if(e)for(let s of e.split(" ")){let o=t.indexOf(s);o>=0&&(r[o]=!0)}let n=null;for(let s=0;s<t.length;s++)if(!r[s])for(let o=this.dialects[t[s]],a;(a=this.data[o++])!=65535;)(n||(n=new Uint8Array(this.maxTerm+1)))[a]=1;return new hu(e,r,n)}static deserialize(e){return new i(e)}};function Wt(i,e){return i[e]|i[e+1]<<16}function ES(i){let e=null;for(let t of i){let r=t.p.stoppedAt;(t.pos==t.p.stream.end||r!=null&&t.pos>r)&&t.p.parser.stateFlag(t.state,2)&&(!e||e.score<t.score)&&(e=t)}return e}function yO(i){if(i.external){let e=i.extend?1:0;return(t,r)=>i.external(t,r)<<1|e}return i.get}var RS=mr({"repeat while for if else return break next in":b.controlKeyword,"Logical!":b.bool,function:b.definitionKeyword,"FunctionCall/Identifier FunctionCall/String":b.function(b.variableName),"NamedArg!":b.function(b.attributeName),Comment:b.lineComment,"Numeric Integer Complex Inf":b.number,"SpecialConstant!":b.literal,String:b.string,"ArithOp MatrixOp":b.arithmeticOperator,BitOp:b.bitwiseOperator,CompareOp:b.compareOperator,"ExtractionOp NamespaceOp":b.operator,AssignmentOperator:b.definitionOperator,"...":b.punctuation,"( )":b.paren,"[ ]":b.squareBracket,"{ }":b.brace,$:b.derefOperator,", ;":b.separator}),AS={__proto__:null,TRUE:12,T:14,FALSE:18,F:20,NULL:30,NA:34,Inf:38,NaN:42,function:46,"...":50,return:60,break:64,next:68,if:80,else:82,repeat:86,while:90,for:94,in:96},ha=Er.deserialize({version:14,states:"7dOYQPOOOOQO'#Dx'#DxOOQO'#Dw'#DwO$aQPO'#DwOOQO'#Dy'#DyO(]QPO'#DvOOQO'#Dv'#DvOOQO'#Cx'#CxO*UQPO'#CwO,YQPO'#DmO/rQPO'#DaO1kQPO'#D`OOQO'#Dz'#DzOOQO'#Du'#DuQYQPOOOOQO'#Ca'#CaOOQO'#Cd'#CdOOQO'#Cj'#CjOOQO'#Cl'#ClOOQO'#Cn'#CnOOQO'#Cp'#CpO1|QPO'#CrO2RQPO'#DTO!bQPO'#DWO2WQPO'#DYO2]QPO'#D[O3oQPO'#DROOQO,59l,59lO3yQPO'#DoOOQO'#Do'#DoO*UQPO,59cOOQO'#DP'#DPOOQO,59c,59cO5fQPO'#CyO5kQPO'#C{O7XQPO'#C}O8uQPO,59yO:ZQQO,59yOOQO'#Dd'#DdOOQO'#De'#DeOOQO'#Df'#DfOOQO'#Dg'#DgOOQO'#Dh'#DhOOQO'#Di'#DiOOQO'#Dj'#DjOOQO'#Dk'#DkOOQO'#Dl'#DlOYQPO,59}OYQPO,59}OYQPO,59}OYQPO,59}OYQPO,59}OYQPO,59}OYQPO,59}OYQPO,59}OYQPO,59}OOQO'#Db'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f$g$h$i$j$k$l$p!sQOW^jntu!P!Q!R!S!T!U!V!W!X!Z!_!a!b!f!k#Q#Y#b#m#o$S$b$c$d$e$f$g$h$i$j$k$l$pR#R!]R!gjQ!otR!su",nodeNames:"\u26A0 Comment Script Identifier Integer True TRUE T False FALSE F Numeric String Complex Null NULL NA NA Inf Inf NaN NaN FunctionDeclaration function ParamList ... NamedArg Block BlockOpenBrace ReturnStatement return BreakStatement break NextStatement next BlockCloseBrace FunctionCall ArgList NamedArg IfStatement if else RepeatStatement repeat WhileStatement while ForStatement for in IndexStatement VariableAssignment Assignable AssignmentOperator BinaryStatement NamespaceOp ExtractionOp ArithOp ArithOp ArithOp CompareOp MatrixOp LogicOp LogicOp",maxTerm:116,nodeProps:[["group",-11,3,22,27,36,39,42,44,46,49,50,53,"Expression",-4,4,11,12,13,"Constant Expression",-2,5,8,"Constant Expression Logical",-4,14,16,18,20,"Expression SpecialConstant"]],propSources:[RS],skippedNodes:[0,1],repeatNodeCount:5,tokenData:"6[~RzX^#upq#uqr$jrs$ust%itu%tuv%yvw'twx(Rxy(pyz(uz{(z{|)P|})U}!O)Z!O!P)p!P!Q.b!Q!R.g!R![0^![!]2x!^!_3]!_!`4O!`!a4]!b!c4h!c!}*|!}#O4m#P#Q4z#Q#R5X#R#S*|#S#T5^#T#o*|#o#p5s#p#q5x#q#r6V#y#z#u$f$g#u#BY#BZ#u$IS$I_#u$I|$JO#u$JT$JU#u$KV$KW#u&FU&FV#u~#zY!h~X^#upq#u#y#z#u$f$g#u#BY#BZ#u$IS$I_#u$I|$JO#u$JT$JU#u$KV$KW#u&FU&FV#u~$mP!_!`$p~$uO#]~~$zU[~OY$uZr$urs%^s#O$u#O#P%c#P~$u~%cO[~~%fPO~$u~%nQP~OY%iZ~%i~%yO#S~~%|Uuv&`z{&e!P!Q&p#]#^&{#c#d'^#l#m'i~&eO#X~~&hPuv&k~&pO#b~~&sPuv&v~&{O#a~~'OP#b#c'R~'UPuv'X~'^O#`~~'aPuv'd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4`P!_!`4c~4hO#^~~4mO#T~~4rP!w~!}#O4u~4zO!z~R5PP!yP#P#Q5SQ5XO!{Q~5^O#U~~5aQO#S5g#T~5g~5jRO#S5g#S#T%^#T~5g~5xO!u~~5}P#e~#p#q6Q~6VO#f~~6[O!t~",tokenizers:[0,1],topRules:{Script:[0,2]},specialized:[{term:3,get:i=>AS[i]||-1}],tokenPrec:0});var QS=1,kO=194,TO=195,MS=196,wO=197,_S=198,DS=199,LS=200,qS=2,PO=3,vO=201,VS=24,$S=25,BS=49,XS=50,NS=55,jS=56,IS=57,WS=59,zS=60,US=61,FS=62,HS=63,GS=65,YS=238,ZS=71,JS=241,KS=242,ek=243,tk=244,ik=245,rk=246,nk=247,sk=248,CO=72,ok=249,ak=250,lk=251,ck=252,hk=253,uk=254,fk=255,dk=256,pk=73,mk=77,gk=263,Ok=112,yk=130,bk=151,wk=152,vk=155,Ii=10,Zn=13,pu=32,da=9,mu=35,xk=40,Sk=46,du=123,xO=125,EO=39,RO=34,kk=92,Tk=111,Pk=120,Ck=78,Ek=117,Rk=85,Ak=new Set([$S,BS,XS,gk,GS,yk,jS,IS,YS,FS,HS,CO,pk,mk,zS,US,bk,wk,vk,Ok]);function uu(i){return i==Ii||i==Zn}function fu(i){return i>=48&&i<=57||i>=65&&i<=70||i>=97&&i<=102}var Qk=new ji((i,e)=>{let t;if(i.next<0)i.acceptToken(DS);else if(e.context.flags&ua)uu(i.next)&&i.acceptToken(_S,1);else if(((t=i.peek(-1))<0||uu(t))&&e.canShift(wO)){let r=0;for(;i.next==pu||i.next==da;)i.advance(),r++;(i.next==Ii||i.next==Zn||i.next==mu)&&i.acceptToken(wO,-r)}else uu(i.next)&&i.acceptToken(MS,1)},{contextual:!0}),Mk=new ji((i,e)=>{let t=e.context;if(t.flags)return;let r=i.peek(-1);if(r==Ii||r==Zn){let n=0,s=0;for(;;){if(i.next==pu)n++;else if(i.next==da)n+=8-n%8;else break;i.advance(),s++}n!=t.indent&&i.next!=Ii&&i.next!=Zn&&i.next!=mu&&(n<t.indent?i.acceptToken(TO,-s):i.acceptToken(kO))}}),ua=1,AO=2,zt=4,Ut=8,Ft=16,Ht=32;function fa(i,e,t){this.parent=i,this.indent=e,this.flags=t,this.hash=(i?i.hash+i.hash<<8:0)+e+(e<<4)+t+(t<<6)}var _k=new fa(null,0,0);function Dk(i){let e=0;for(let t=0;t<i.length;t++)e+=i.charCodeAt(t)==da?8-e%8:1;return e}var SO=new Map([[JS,0],[KS,zt],[ek,Ut],[tk,Ut|zt],[ik,Ft],[rk,Ft|zt],[nk,Ft|Ut],[sk,Ft|Ut|zt],[ok,Ht],[ak,Ht|zt],[lk,Ht|Ut],[ck,Ht|Ut|zt],[hk,Ht|Ft],[uk,Ht|Ft|zt],[fk,Ht|Ft|Ut],[dk,Ht|Ft|Ut|zt]].map(([i,e])=>[i,e|AO])),Lk=new ca({start:_k,reduce(i,e,t,r){return i.flags&ua&&Ak.has(e)||(e==ZS||e==CO)&&i.flags&AO?i.parent:i},shift(i,e,t,r){return e==kO?new fa(i,Dk(r.read(r.pos,t.pos)),0):e==TO?i.parent:e==VS||e==NS||e==WS||e==PO?new fa(i,0,ua):SO.has(e)?new fa(i,0,SO.get(e)|i.flags&ua):i},hash(i){return i.hash}}),qk=new ji(i=>{for(let e=0;e<5;e++){if(i.next!="print".charCodeAt(e))return;i.advance()}if(!/\w/.test(String.fromCharCode(i.next)))for(let e=0;;e++){let t=i.peek(e);if(!(t==pu||t==da)){t!=xk&&t!=Sk&&t!=Ii&&t!=Zn&&t!=mu&&i.acceptToken(QS);return}}}),Vk=new ji((i,e)=>{let{flags:t}=e.context,r=t&zt?RO:EO,n=(t&Ut)>0,s=!(t&Ft),o=(t&Ht)>0,a=i.pos;for(;!(i.next<0);)if(o&&i.next==du)if(i.peek(1)==du)i.advance(2);else{if(i.pos==a){i.acceptToken(PO,1);return}break}else if(s&&i.next==kk){if(i.pos==a){i.advance();let l=i.next;l>=0&&(i.advance(),$k(i,l)),i.acceptToken(qS);return}break}else if(i.next==r&&(!n||i.peek(1)==r&&i.peek(2)==r)){if(i.pos==a){i.acceptToken(vO,n?3:1);return}break}else if(i.next==Ii){if(n)i.advance();else if(i.pos==a){i.acceptToken(vO);return}break}else i.advance();i.pos>a&&i.acceptToken(LS)});function $k(i,e){if(e==Tk)for(let t=0;t<2&&i.next>=48&&i.next<=55;t++)i.advance();else if(e==Pk)for(let t=0;t<2&&fu(i.next);t++)i.advance();else if(e==Ek)for(let t=0;t<4&&fu(i.next);t++)i.advance();else if(e==Rk)for(let t=0;t<8&&fu(i.next);t++)i.advance();else if(e==Ck&&i.next==du){for(i.advance();i.next>=0&&i.next!=xO&&i.next!=EO&&i.next!=RO&&i.next!=Ii;)i.advance();i.next==xO&&i.advance()}}var Bk=mr({'async "*" "**" FormatConversion FormatSpec':b.modifier,"for while if elif else try except finally return raise break continue with pass assert await yield match case":b.controlKeyword,"in not and or is del":b.operatorKeyword,"from def class global nonlocal lambda":b.definitionKeyword,import:b.moduleKeyword,"with as print":b.keyword,Boolean:b.bool,None:b.null,VariableName:b.variableName,"CallExpression/VariableName":b.function(b.variableName),"FunctionDefinition/VariableName":b.function(b.definition(b.variableName)),"ClassDefinition/VariableName":b.definition(b.className),PropertyName:b.propertyName,"CallExpression/MemberExpression/PropertyName":b.function(b.propertyName),Comment:b.lineComment,Number:b.number,String:b.string,FormatString:b.special(b.string),Escape:b.escape,UpdateOp:b.updateOperator,"ArithOp!":b.arithmeticOperator,BitOp:b.bitwiseOperator,CompareOp:b.compareOperator,AssignOp:b.definitionOperator,Ellipsis:b.punctuation,At:b.meta,"( )":b.paren,"[ ]":b.squareBracket,"{ }":b.brace,".":b.derefOperator,", ;":b.separator}),Xk={__proto__:null,await:44,or:54,and:56,in:60,not:62,is:64,if:70,else:72,lambda:76,yield:94,from:96,async:102,for:104,None:162,True:164,False:164,del:178,pass:182,break:186,continue:190,return:194,raise:202,import:206,as:208,global:212,nonlocal:214,assert:218,type:223,elif:236,while:240,try:246,except:248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0]0UQ0a0ZR0b0^R/T.`R/d.t",nodeNames:"\u26A0 print Escape { Comment Script AssignStatement * BinaryExpression BitOp BitOp BitOp BitOp ArithOp ArithOp @ ArithOp ** UnaryExpression ArithOp BitOp AwaitExpression await ) ( ParenthesizedExpression BinaryExpression or and CompareOp in not is UnaryExpression ConditionalExpression if else LambdaExpression lambda ParamList VariableName AssignOp , : NamedExpression AssignOp YieldExpression yield from TupleExpression ComprehensionExpression async for LambdaExpression ] [ ArrayExpression ArrayComprehensionExpression } { DictionaryExpression DictionaryComprehensionExpression SetExpression SetComprehensionExpression CallExpression ArgList AssignOp MemberExpression . PropertyName Number String FormatString FormatReplacement FormatSelfDoc FormatConversion FormatSpec FormatReplacement FormatSelfDoc ContinuedString Ellipsis None Boolean TypeDef AssignOp UpdateStatement UpdateOp ExpressionStatement DeleteStatement del PassStatement pass BreakStatement break ContinueStatement continue ReturnStatement return YieldStatement PrintStatement RaiseStatement raise ImportStatement import as ScopeStatement global nonlocal AssertStatement assert TypeDefinition type TypeParamList TypeParam StatementGroup ; IfStatement Body elif WhileStatement while ForStatement TryStatement try except finally WithStatement with FunctionDefinition def ParamList AssignOp TypeDef ClassDefinition class DecoratedStatement Decorator At MatchStatement match MatchBody MatchClause case CapturePattern LiteralPattern ArithOp ArithOp AsPattern OrPattern LogicOp AttributePattern SequencePattern MappingPattern StarPattern ClassPattern PatternArgList KeywordPattern KeywordPattern Guard",maxTerm:277,context:Lk,nodeProps:[["isolate",-5,4,71,72,73,77,""],["group",-15,6,85,87,88,90,92,94,96,98,99,100,102,105,108,110,"Statement Statement",-22,8,18,21,25,40,49,50,56,57,60,61,62,63,64,67,70,71,72,79,80,81,82,"Expression",-10,114,116,119,121,122,126,128,133,135,138,"Statement",-9,143,144,147,148,150,151,152,153,154,"Pattern"],["openedBy",23,"(",54,"[",58,"{"],["closedBy",24,")",55,"]",59,"}"]],propSources:[Bk],skippedNodes:[0,4],repeatNodeCount:34,tokenData:"!2|~R!`OX%TXY%oY[%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iZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To!-Vi&n`&YS%uZOr%TrsNWsw%Twx! vx!Q%T!Q![JU![!c%T!c!dJU!d!eLx!e!hJU!h!i!(`!i!}JU!}#R%T#R#SJU#S#T%T#T#UJU#U#VLx#V#YJU#Y#Z!(`#Z#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUo!.}a&n`&YS%uZOr%Trs)Ysw%Twx.Ux!Q%T!Q![JU![!c%T!c!}JU!}#R%T#R#SJU#S#T%T#T#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUk!0ZT!XZ&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc!0qT!WR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tj!1XV%kQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%T~!1sO!]~k!1zV%jR&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%T~!2fO![~i!2mT%tX&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%T",tokenizers:[qk,Mk,Qk,Vk,0,1,2,3,4],topRules:{Script:[0,5]},specialized:[{term:221,get:i=>Xk[i]||-1}],tokenPrec:7652});var Jn=Rn([{tag:b.keyword,class:"tok-keyword"},{tag:b.operator,class:"tok-operator"},{tag:b.definitionOperator,class:"tok-definitionOperator"},{tag:b.compareOperator,class:"tok-compareOperator"},{tag:b.attributeName,class:"tok-attributeName"},{tag:b.controlKeyword,class:"tok-controlKeyword"},{tag:b.comment,class:"tok-comment"},{tag:b.string,class:"tok-string"},{tag:b.regexp,class:"tok-string2"},{tag:b.variableName,class:"tok-variableName"},{tag:b.bool,class:"tok-bool"},{tag:b.separator,class:"tok-separator"},{tag:b.literal,class:"tok-literal"},{tag:[b.number,b.integer],class:"tok-number"},{tag:b.function(b.variableName),class:"tok-function-variableName"},{tag:b.function(b.attributeName),class:"tok-function-attributeName"}]);function Rr(i){let e=document.createElement("code");e.className="sourceCode r";function t(n,s){let o=document.createTextNode(n);if(s){let a=document.createElement("span");a.appendChild(o),a.className=s,o=a}e.appendChild(o)}function r(){e.appendChild(document.createTextNode(`
`))}return th(i,ha.parse(i),Jn,t,r),e}function Ar(i){let e=document.createElement("code");e.className="sourceCode python";function t(n,s){let o=document.createTextNode(n);if(s){let a=document.createElement("span");a.appendChild(o),a.className=s,o=a}e.appendChild(o)}function r(){e.appendChild(document.createTextNode(`
`))}return th(i,pa.parse(i),Jn,t,r),e}function gu(i,e,t,r){if(typeof t=="number"&&(t=t.toLocaleString()),i.textContent.includes(e)){let n=!1;for(let s of i.children)n||=gu(s,e,t,r);if(!n)switch(i.textContent=i.textContent.replaceAll(e,()=>t),r){case"none":break;case"r":i.innerHTML=Rr(i.textContent).innerHTML;break;case"python":i.innerHTML=Ar(i.textContent).innerHTML;break;default:throw new Error(`Can't highlight interpolation, unknown language \`${r}\`.`)}return!0}return!1}var QO=new ko,LO=new Set(["Script","Body","FunctionDefinition","ClassDefinition","LambdaExpression","ForStatement","MatchClause"]);function ma(i){return(e,t,r)=>{if(r)return!1;let n=e.node.getChild("VariableName");return n&&t(n,i),!0}}var Nk={FunctionDefinition:ma("function"),ClassDefinition:ma("class"),ForStatement(i,e,t){if(t){for(let r=i.node.firstChild;r;r=r.nextSibling)if(r.name=="VariableName")e(r,"variable");else if(r.name=="in")break}},ImportStatement(i,e){var t,r;let{node:n}=i,s=((t=n.firstChild)===null||t===void 0?void 0:t.name)=="from";for(let o=n.getChild("import");o;o=o.nextSibling)o.name=="VariableName"&&((r=o.nextSibling)===null||r===void 0?void 0:r.name)!="as"&&e(o,s?"variable":"namespace")},AssignStatement(i,e){for(let t=i.node.firstChild;t;t=t.nextSibling)if(t.name=="VariableName")e(t,"variable");else if(t.name==":"||t.name=="AssignOp")break},ParamList(i,e){for(let t=null,r=i.node.firstChild;r;r=r.nextSibling)r.name=="VariableName"&&(!t||!/\*|AssignOp/.test(t.name))&&e(r,"variable"),t=r},CapturePattern:ma("variable"),AsPattern:ma("variable"),__proto__:null};function qO(i,e){let t=QO.get(e);if(t)return t;let r=[],n=!0;function s(o,a){let l=i.sliceString(o.from,o.to);r.push({label:l,type:a})}return e.cursor(ae.IncludeAnonymous).iterate(o=>{if(o.name){let a=Nk[o.name];if(a&&a(o,s,n)||!n&&LO.has(o.name))return!1;n=!1}else if(o.to-o.from>8192){for(let a of qO(i,o.node))r.push(a);return!1}}),QO.set(e,r),r}var MO=/^[\w\xa1-\uffff][\w\d\xa1-\uffff]*$/,VO=["String","FormatString","Comment","PropertyName"];function jk(i){let e=he(i.state).resolveInner(i.pos,-1);if(VO.indexOf(e.name)>-1)return null;let t=e.name=="VariableName"||e.to-e.from<20&&MO.test(i.state.sliceDoc(e.from,e.to));if(!t&&!i.explicit)return null;let r=[];for(let n=e;n;n=n.parent)LO.has(n.name)&&(r=r.concat(qO(i.state.doc,n)));return{options:r,from:t?e.from:i.pos,validFor:MO}}var Ik=["__annotations__","__builtins__","__debug__","__doc__","__import__","__name__","__loader__","__package__","__spec__","False","None","True"].map(i=>({label:i,type:"constant"})).concat(["ArithmeticError","AssertionError","AttributeError","BaseException","BlockingIOError","BrokenPipeError","BufferError","BytesWarning","ChildProcessError","ConnectionAbortedError","ConnectionError","ConnectionRefusedError","ConnectionResetError","DeprecationWarning","EOFError","Ellipsis","EncodingWarning","EnvironmentError","Exception","FileExistsError","FileNotFoundError","FloatingPointError","FutureWarning","GeneratorExit","IOError","ImportError","ImportWarning","IndentationError","IndexError","InterruptedError","IsADirectoryError","KeyError","KeyboardInterrupt","LookupError","MemoryError","ModuleNotFoundError","NameError","NotADirectoryError","NotImplemented","NotImplementedError","OSError","OverflowError","PendingDeprecationWarning","PermissionError","ProcessLookupError","RecursionError","ReferenceError","ResourceWarning","RuntimeError","RuntimeWarning","StopAsyncIteration","StopIteration","SyntaxError","SyntaxWarning","SystemError","SystemExit","TabError","TimeoutError","TypeError","UnboundLocalError","UnicodeDecodeError","UnicodeEncodeError","UnicodeError","UnicodeTranslateError","UnicodeWarning","UserWarning","ValueError","Warning","ZeroDivisionError"].map(i=>({label:i,type:"type"}))).concat(["bool","bytearray","bytes","classmethod","complex","float","frozenset","int","list","map","memoryview","object","range","set","staticmethod","str","super","tuple","type"].map(i=>({label:i,type:"class"}))).concat(["abs","aiter","all","anext","any","ascii","bin","breakpoint","callable","chr","compile","delattr","dict","dir","divmod","enumerate","eval","exec","exit","filter","format","getattr","globals","hasattr","hash","help","hex","id","input","isinstance","issubclass","iter","len","license","locals","max","min","next","oct","open","ord","pow","print","property","quit","repr","reversed","round","setattr","slice","sorted","sum","vars","zip"].map(i=>({label:i,type:"function"}))),Wk=[Mt("def ${name}(${params}):\n	${}",{label:"def",detail:"function",type:"keyword"}),Mt("for ${name} in ${collection}:\n	${}",{label:"for",detail:"loop",type:"keyword"}),Mt("while ${}:\n	${}",{label:"while",detail:"loop",type:"keyword"}),Mt("try:\n	${}\nexcept ${error}:\n	${}",{label:"try",detail:"/ except block",type:"keyword"}),Mt(`if \${}:
	
`,{label:"if",detail:"block",type:"keyword"}),Mt("if ${}:\n	${}\nelse:\n	${}",{label:"if",detail:"/ else block",type:"keyword"}),Mt("class ${name}:\n	def __init__(self, ${params}):\n			${}",{label:"class",detail:"definition",type:"keyword"}),Mt("import ${module}",{label:"import",detail:"statement",type:"keyword"}),Mt("from ${module} import ${names}",{label:"from",detail:"import",type:"keyword"})],zk=Gg(VO,zh(Ik.concat(Wk)));function _O(i){let{node:e,pos:t}=i,r=i.lineIndent(t,-1),n=null;for(;;){let s=e.childBefore(t);if(s)if(s.name=="Comment")t=s.from;else if(s.name=="Body")i.baseIndentFor(s)+i.unit<=r&&(n=s),e=s;else if(s.type.is("Statement"))e=s;else break;else break}return n}function DO(i,e){let t=i.baseIndentFor(e),r=i.lineAt(i.pos,-1),n=r.from+r.text.length;return/^\s*($|#)/.test(r.text)&&i.node.to<n+100&&!/\S/.test(i.state.sliceDoc(n,i.node.to))&&i.lineIndent(i.pos,-1)<=t||/^\s*(else:|elif |except |finally:)/.test(i.textAfter)&&i.lineIndent(i.pos,-1)>t?null:t+i.unit}var Ou=Or.define({name:"python",parser:pa.configure({props:[Dn.add({Body:i=>{var e;let t=_O(i);return(e=DO(i,t||i.node))!==null&&e!==void 0?e:i.continue()},IfStatement:i=>/^\s*(else:|elif )/.test(i.textAfter)?i.baseIndent:i.continue(),"ForStatement WhileStatement":i=>/^\s*else:/.test(i.textAfter)?i.baseIndent:i.continue(),TryStatement:i=>/^\s*(except |finally:|else:)/.test(i.textAfter)?i.baseIndent:i.continue(),"TupleExpression ComprehensionExpression ParamList ArgList ParenthesizedExpression":$i({closing:")"}),"DictionaryExpression DictionaryComprehensionExpression SetExpression SetComprehensionExpression":$i({closing:"}"}),"ArrayExpression ArrayComprehensionExpression":$i({closing:"]"}),"String FormatString":()=>null,Script:i=>{var e;let t=_O(i);return(e=t&&DO(i,t))!==null&&e!==void 0?e:i.continue()}}),Ln.add({"ArrayExpression DictionaryExpression SetExpression TupleExpression":_o,Body:(i,e)=>({from:i.from+1,to:i.to-(i.to==e.doc.length?0:1)})})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"'''",'"""'],stringPrefixes:["f","fr","rf","r","u","b","br","rb","F","FR","RF","R","U","B","BR","RB"]},commentTokens:{line:"#"},indentOnInput:/^\s*([\}\]\)]|else:|elif |except |finally:)$/}});function $O(){return new yr(Ou,[Ou.data.of({autocomplete:jk}),Ou.data.of({autocomplete:zk})])}var Uk=Or.define({parser:ha.configure({props:[Dn.add({Block:$i({closing:"}"}),"ParamList ArgList":$i({closing:")"})}),Ln.add({Block:_o})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"']},commentTokens:{line:"#"}}});function BO(){return new yr(Uk)}var Zk={"arrow-repeat":XO(),"exclamation-circle":NO(),lightbulb:jO(),play:IO()};function Jk(){let i=document.querySelectorAll(".tab-content > .tab-pane");Array.from(i).forEach(t=>{t.innerHTML.trim()==""&&(t.classList.add("d-none"),document.querySelector(`.nav-item > a[data-bs-target="#${t.id}"]`)?.parentElement?.classList.add("d-none"))});let e=document.querySelectorAll(".tab-content");Array.from(e).forEach(t=>{if(Array.from(t.children).reduce((n,s)=>s.classList.contains("d-none")?n:n+1,0)==1){let n=t.querySelector(".tab-pane:not(.d-none)"),s=t.parentElement;s.appendChild(n),s.querySelector(".nav.nav-tabs").remove(),t.remove()}})}var ga=class{constructor(e,t){if(typeof e!="string")throw new Error("Can't create editor, `code` must be a string.");this.container=document.createElement("div"),this.initialCode=e,this.options=Object.assign({autorun:!1,canvas:!0,completion:!0,runbutton:!0,startover:!0,persist:!1},t),this.storageKey=`editor-${window.location.href}#${this.options.id}`;let r=[dO,this.languageExtensions(),R.updateListener.of(a=>this.onViewUpdate(a))];if(this.options.persist){let a=window.localStorage.getItem(this.storageKey);a&&(e=a)}this.state=W.create({doc:e,extensions:r}),this.view=new R({state:this.state});let n=this.render(),s=String(t["min-lines"]||0),o=String(t["max-lines"])||"infinity";n.style.setProperty("--exercise-min-lines",s),n.style.setProperty("--exercise-max-lines",o),this.container.oninput=a=>this.onInput(a),this.container.appendChild(n),this.container.value={code:this.options.autorun?e:null,options:this.options},this.container.value.indicator=this.indicator=new it({runningCallback:()=>{Array.from(this.container.getElementsByClassName("exercise-editor-eval-indicator")).forEach(a=>a.classList.remove("d-none"))},finishedCallback:()=>{Array.from(this.container.getElementsByClassName("exercise-editor-eval-indicator")).forEach(a=>a.classList.add("d-none"))},busyCallback:()=>{Array.from(this.container.getElementsByClassName("exercise-editor-btn-run-code")).forEach(a=>a.classList.add("disabled"))},idleCallback:()=>{Array.from(this.container.getElementsByClassName("exercise-editor-btn-run-code")).forEach(a=>a.classList.remove("disabled"))}})}onInput(e){if(this.options.runbutton&&!e.detail.commit){e.preventDefault(),e.stopImmediatePropagation();return}this.container.value.code=this.view.state.doc.toString(),"code"in e.detail&&(this.container.value.code=e.detail.code),this.options.persist&&window.localStorage.setItem(this.storageKey,this.container.value.code)}onViewUpdate(e){e.docChanged&&this.container.dispatchEvent(new CustomEvent("input",{detail:{commit:!1}}))}renderButton(e){let t=document.createElement("a"),r=document.createElement("span");return t.className=`d-flex align-items-center gap-1 btn btn-exercise-editor ${e.className} text-nowrap`,t.setAttribute("role","button"),t.setAttribute("aria-label",e.text),r.className="btn-label-exercise-editor",r.innerText=e.text,t.innerHTML=Zk[e.icon],t.appendChild(r),t.onclick=e.onclick||null,t.onkeydown=e.onclick||null,t}renderButtonGroup(e){let t=document.createElement("div");return t.className="btn-group btn-group-exercise-editor btn-group-sm",e.forEach(r=>t.appendChild(r)),t}renderSpinner(){let e=document.createElement("div");return e.className="exercise-editor-eval-indicator spinner-grow spinner-grow-sm",e.setAttribute("role","status"),e}renderHintButton(e,t){return Array.from(e).reduceRight((r,n,s,o)=>this.renderButton({text:s===0?"Show Hint":"Next Hint",icon:"lightbulb",className:"btn-outline-dark btn-sm",onclick:function(){s>0&&o[s-1].classList.add("d-none"),n.classList.remove("d-none"),r?this.replaceWith(r):this.remove()}}),t)}renderSolutionButton(e,t){return this.renderButton({text:"Show Solution",icon:"exclamation-circle",className:"btn-exercise-solution btn-outline-dark btn-sm",onclick:function(){t&&t.forEach(r=>r.classList.add("d-none")),Array.from(e).forEach(r=>{r.classList.remove("d-none")}),this.remove()}})}renderHintsTabset(e,t){let r=new Set;e.forEach(s=>{let o=s.parentElement;o.id.includes("tabset-")&&r.add(o)});let n=new Set;return t.forEach(s=>{let o=s.parentElement;o.id.includes("tabset-")&&n.add(o)}),r.forEach(s=>{let o=document.createElement("div");o.className="d-flex justify-content-between exercise-tab-pane-header";let a=s.querySelectorAll(`.exercise-hint[data-exercise="${this.options.exercise}"]`);o.appendChild(this.renderHintButton(a,null)),s.prepend(o)}),n.forEach(s=>{let o=document.createElement("div");o.className="d-flex justify-content-between exercise-tab-pane-header";let a=s.querySelectorAll(`.exercise-solution[data-exercise="${this.options.exercise}"]`);o.appendChild(this.renderSolutionButton(a,null)),s.prepend(o)}),null}renderHints(){let e=document.querySelectorAll(`.d-none.exercise-hint[data-exercise="${this.options.exercise}"]`),t=document.querySelectorAll(`.d-none.exercise-solution[data-exercise="${this.options.exercise}"]`),r=Array.from(e).some(s=>s.parentElement.id.includes("tabset-"))||Array.from(t).some(s=>s.parentElement.id.includes("tabset-")),n=null;if(r)this.renderHintsTabset(e,t);else{let s;t.length>0&&(s=this.renderSolutionButton(t,e)),n=this.renderHintButton(e,s)}return Jk(),n}render(){let e=document.createElement("div"),t=document.createElement("div"),r=document.createElement("div");e.className="card exercise-editor my-3",t.className="card-header exercise-editor-header d-flex justify-content-between",r.className="card-body exercise-editor-body p-0";let n=document.createElement("div");n.className="d-flex align-items-center gap-3";let s=document.createElement("div");s.innerHTML="caption"in this.options?this.options.caption:this.defaultCaption,n.appendChild(s);let o=[];this.options.startover&&o.push(this.renderButton({text:"Start Over",icon:"arrow-repeat",className:"btn-outline-dark",onclick:()=>{if(this.view.dispatch({changes:{from:0,to:this.view.state.doc.length,insert:this.initialCode}}),this.options.runbutton){let h=this.options.autorun?this.initialCode:null;this.container.dispatchEvent(new CustomEvent("input",{detail:{code:h,commit:!0}}))}}}));let a=this.renderHints();a&&o.push(a),o.length>0&&n.appendChild(this.renderButtonGroup(o)),t.appendChild(n);let l=document.createElement("div");l.className="d-flex align-items-center gap-3";let c=[];return this.options.runbutton&&c.push(this.renderButton({text:"Run Code",icon:"play",className:"btn-primary disabled exercise-editor-btn-run-code",onclick:()=>{this.container.dispatchEvent(new CustomEvent("input",{detail:{commit:!0}}))}})),l.appendChild(this.renderSpinner()),c.length>0&&l.appendChild(this.renderButtonGroup(c)),t.appendChild(l),e.appendChild(t),r.appendChild(this.view.dom),e.appendChild(r),e}},Oa=class extends ga{constructor(e,t,r){super(t,r),this.webRPromise=e,this.completionMethods=this.setupCompletion()}languageExtensions(){let e=new Bt,t=new Bt;return[Vn(Jn),Fn({override:[(...r)=>this.doCompletion(...r)]}),e.of(BO()),t.of(W.tabSize.of(2)),_e.high(It.of([{key:"Mod-Enter",run:()=>(this.container.dispatchEvent(new CustomEvent("input",{detail:{commit:!0}})),!0)},{key:"Mod-Shift-m",run:()=>(this.view.dispatch({changes:{from:0,to:this.view.state.doc.length,insert:this.view.state.doc.toString().trimEnd()+" |> "}}),!0)}]))]}render(){return this.defaultCaption="R Code",super.render()}async setupCompletion(){let e=await this.webRPromise;return await e.evalRVoid("rc.settings(func=TRUE, fuzzy=TRUE)"),{assignLineBuffer:await e.evalR("utils:::.assignLinebuffer"),assignToken:await e.evalR("utils:::.assignToken"),assignStart:await e.evalR("utils:::.assignStart"),assignEnd:await e.evalR("utils:::.assignEnd"),completeToken:await e.evalR("utils:::.completeToken"),retrieveCompletions:await e.evalR("utils:::.retrieveCompletions")}}async doCompletion(e){if(!this.options.completion)return null;let t=await this.completionMethods,r=e.state.doc.lineAt(e.state.selection.main.head).text,{from:n,to:s,text:o}=e.matchBefore(/[a-zA-Z0-9_.:]*/)??{from:0,to:0,text:""};if(n===s&&!e.explicit)return null;await t.assignLineBuffer(r.replace(/\)+$/,"")),await t.assignToken(o),await t.assignStart(n+1),await t.assignEnd(s+1),await t.completeToken();let l=(await t.retrieveCompletions()).values.map(c=>{if(!c)throw new Error("Missing values in completion result.");return{label:c,boost:c.endsWith("=")?10:0}});return{from:n,options:l}}},ya=class extends ga{constructor(e,t,r){super(t,r),this.pyodidePromise=e}render(){return this.defaultCaption="Python Code",super.render()}languageExtensions(){let e=new Bt,t=new Bt,r=[Vn(Jn),e.of($O()),t.of(W.tabSize.of(2)),_e.high(It.of([{key:"Mod-Enter",run:()=>(this.container.dispatchEvent(new CustomEvent("input",{detail:{commit:!0}})),!0)}]))];return this.options.completion||r.push(Fn({override:[(...n)=>null]})),r}};function Qr(i){for(var e="",t=new Uint8Array(i),r=t.byteLength,n=0;n<r;n++)e+=String.fromCharCode(t[n]);return window.btoa(e)}function WO(i){return btoa(encodeURIComponent(i).replace(/%([0-9A-F]{2})/g,(e,t)=>String.fromCharCode(parseInt(t,16))))}function di(i){return decodeURIComponent(atob(i).split("").map(e=>"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)).join(""))}function yu(i){return typeof ImageBitmap<"u"&&i instanceof ImageBitmap}function Kn(i,e,t,...r){return i==null||yu(i)||i instanceof ArrayBuffer||ArrayBuffer.isView(i)?i:e(i)?t(i,...r):Array.isArray(i)?i.map(n=>Kn(n,e,t,...r)):typeof i=="object"?Object.fromEntries(Object.entries(i).map(([n,s])=>[n,Kn(s,e,t,...r)])):i}function ba(i){for(let e of i.getElementsByTagName("script"))if(!e.type||e.type=="text/javascript"||e.type=="module"){let t=document.createElement("script");e.async&&(t.async=e.async),e.crossOrigin&&(t.crossOrigin=e.crossOrigin),e.defer&&(t.defer=e.async),e.integrity&&(t.integrity=e.integrity),e.src&&(t.src=e.src),e.text&&(t.text=e.text),e.type&&(t.type=e.type),e.parentNode.replaceChild(t,e)}}function bu(i){return new Promise(function(e,t){var r=document.createElement("script");r.onload=()=>e(i),r.onerror=()=>t(`Can't load script: "${i}".`),r.async=!0,r.src=i,document.getElementsByTagName("head")[0].appendChild(r)})}function zO(i){let e=i.replace(/\/+/g,"/").split("/"),t=[];for(let r of e)r==="."||r===""||(r===".."?t.pop():t.push(r));return t.join("/")}var UO=[];async function es(i){let e=await i.toJs({depth:-1}),t=await Promise.all(e.names.map(async(r,n)=>[r,await e.values[n].toString()]));return Object.fromEntries(t)}async function wu(i,e){let t=await i.toJs({depth:-1});return await Promise.all(t.values.map(async r=>({[e]:await r.toString()})))}async function vu(i){let e=await i.toJs({depth:-1});return await Promise.all(e.values.map(t=>es(t)))}async function Kk(i){if(!(await(await i.class()).toArray()).includes("html_dependency"))throw new Error("Can't interpret R object of class `${classes}` as HTML dependency.");let t=await i.get("attachment"),r=await i.get("head"),n=await i.get("meta"),s=await(await i.get("name")).toString(),o=await i.get("package"),a=await i.get("restyle"),l=await i.get("script"),c=await i.get("src"),h=await i.get("stylesheet"),u=await(await i.get("version")).toString(),f={attachment:[],head:Ae(r)?void 0:await r.toString(),meta:[],name:s,pkg:Ae(o)?void 0:await o.toString(),restyle:Ae(a)?void 0:await a.toBoolean(),script:[],src:{},stylesheet:[],version:u};if(Zi(c)?f.src={file:await c.toString()}:ut(c)&&(f.src=await es(c)),!Ae(n)){let d=await n.toObject();f.meta=await Promise.all(Object.entries(d).map(async([m,p])=>({name:m,content:await p.toString()})))}if(Zi(h))f.stylesheet=(await h.toArray()).map(d=>({href:d}));else if(ut(h)){let d=await h.toJs({depth:-1});d.names?d.names.includes("href")?f.stylesheet=[await es(h)]:f.stylesheet=await vu(h):f.stylesheet=await wu(h,"href")}if(Zi(l))f.script=(await l.toArray()).map(d=>({src:d}));else if(ut(l)){let d=await l.toJs({depth:-1});d.names?d.names.includes("src")?f.script=[await es(l)]:f.script=await vu(l):f.script=await wu(l,"src")}if(Zi(t))f.attachment=(await t.toArray()).map((d,m)=>({key:(m+1).toString(),href:d}));else if(ut(t)){let d=await t.toJs({depth:-1});d.names?d.names.includes("href")?(f.attachment=[await es(t)],f.attachment[0].key="1"):(f.attachment=await vu(t),f.attachment.forEach((m,p)=>{m.key=(p+1).toString()})):(f.attachment=await wu(t,"href"),f.attachment.forEach((m,p)=>{m.key=(p+1).toString()}))}return f}async function xu(i,e){let t=await Kk(e),r=t.pkg?await i.evalRString(`find.package("${t.pkg}")`):"";if(t.name in UO)return!1;if(UO[t.name]=t.version,t.head){let n=document.createElement("div");n.innerHTML=t.head,n.childNodes.forEach(s=>document.head.appendChild(s))}if(t.meta&&t.meta.forEach(async n=>{let s=document.createElement("meta");Object.entries(n).map(([o,a])=>{s.setAttribute(o,a||"")}),document.head.appendChild(s)}),t.stylesheet&&t.stylesheet.forEach(async n=>{let s=document.createElement("link");if(t.src.file){let o=await i.FS.readFile(`${r}/${t.src.file}/${n.href}`);n.href=`data:text/css;base64,${Qr(o)}`}else n.href=`${t.src.href}/${n.href}`;n.rel||(s.rel="stylesheet"),n.type||(s.type="text/css"),Object.entries(n).map(([o,a])=>{s.setAttribute(o,a||"")}),document.head.appendChild(s)}),t.script){let n=t.script.map(async s=>{let o=document.createElement("script");if(t.src.file){let l=await i.FS.readFile(`${r}/${t.src.file}/${s.src}`);s.src=`data:text/javascript;base64,${Qr(l)}`}else s.src=`${t.src.href}/${s.src}`;o.async=!1,Object.entries(s).map(([l,c])=>{l==="async"&&(o.async=c==="true"),o.setAttribute(l,c||"")});let a=new Promise((l,c)=>{o.onload=()=>l(null),o.onerror=h=>c(h)});return document.head.appendChild(o),a});await Promise.allSettled(n)}return!0}var Mr=class{constructor(e,t){this.manager=e;let r=t.options;!r.exercise||r.envir==="global"?(this.labels={prep:r.envir,result:r.envir,grading:r.envir,solution:r.envir,global:"global"},this.discard=!1):(this.labels={prep:`${r.envir}-prep`,result:`${r.envir}-result`,grading:`${r.envir}-grading`,solution:`${r.envir}-solution`,global:"global"},this.discard=r.envir===`exercise-env-${r.exercise}`)}get(e="global"){return this.manager.get(this.labels[e])}bind(e,t,r="global"){return this.manager.bind(e,t,this.labels[r])}create(e,t){return this.manager.create(this.labels[e],this.labels[t],this.discard)}destroy(e){return this.manager.destroy(this.labels[e])}},_r=class i{constructor(e){this.env={};this.shelter=new e.Shelter,this.env.global=Promise.resolve().then(()=>e.objs.globalEnv)}static#e;static instance(e){return i.#e||(i.#e=new i(e)),i.#e}async toR(e){if(!e||ie(e))return e;let t=await this.shelter;if(e.constructor===Object)try{return await new t.RObject(e)}catch(r){let n=r;if(!n.message.includes("Can't construct `data.frame`"))throw n;return await new t.RList(Object.fromEntries(await Promise.all(Object.entries(e).map(async([s,o])=>[s,await this.toR(o)]))))}if(e.constructor===Array)try{return await new t.RObject(e)}catch(r){let n=r;if(!n.message.includes("Can't construct `data.frame`"))throw n;return await new t.RList(await Promise.all(e.map(s=>this.toR(s))))}return e}async get(e="global"){let t=await this.shelter;return e in this.env||(this.env[e]=t.evalR("new.env(parent = globalenv())")),await this.env[e]}async bind(e,t,r="global"){let n=await this.get(r);t=await this.toR(t),await n.bind(e,t)}async create(e,t,r=!0){if(e===t||e==="global")return this.get(e);if(e in this.env){if(!r)return this.get(e);await this.destroy(e)}let n=await this.shelter,s=await this.get(t);return this.env[e]=n.evalR("new.env(parent = parent)",{env:{parent:s}}),await this.env[e]}async destroy(e){if(e=="global"||!(e in this.env))return;let t=await this.shelter,r=await this.env[e];try{await t.destroy(r)}catch(n){let s=n;if(!s.message.includes("Can't find object in shelter."))throw s}delete this.env[e]}},Dr=class i{constructor(e){this.env={};this.pyodide=e,this.env.global=Promise.resolve().then(()=>e.toPy({}))}static#e;static instance(e){return i.#e||(i.#e=new i(e)),i.#e}async get(e="global"){return e in this.env||(this.env[e]=this.pyodide.toPy({})),await this.env[e]}async bind(e,t,r="global"){let n=await this.get(r),s=await this.pyodide.toPy({environment:n,key:e,value:t});await this.pyodide.runPythonAsync("environment[key] = value",{locals:s}),s.destroy()}async create(e,t,r=!0){if(e===t||e==="global")return this.get(e);r&&e in this.env&&await this.destroy(e);let n=await this.get(e),s=await this.get(t),o=await this.pyodide.toPy({target:n,parent:s});return await this.pyodide.runPythonAsync("target.update(parent)",{locals:o}),o.destroy(),await this.env[e]}async destroy(e){if(e=="global"||!(e in this.env))return;await(await this.env[e]).destroy(),delete this.env[e]}};var v0=Mu(Ru(),1),Ca=class{constructor(e,t){this.container=this.newContainer(),this.nullResult={result:null,evaluate_result:null,evaluator:this},this.container.value=this.nullResult,this.webR=e,this.context=t,this.shelter=new e.Shelter,this.envManager=new Mr(_r.instance(e),t),this.context.code&&(this.context.code=this.context.code.replace(/\n\n+$/,`
`)),this.options=Object.assign({envir:"global",eval:!0,echo:!1,warning:!0,error:!0,include:!0,output:!0,timelimit:30},t.options)}newContainer(){let e=document.createElement("div");return e.classList.add("cell-output-container"),e.classList.add("cell-output-container-webr"),e}async purge(){(await this.shelter).purge()}getSetupCode(){let e=this.options.exercise,t=document.querySelectorAll(`script[type="exercise-setup-${e}-contents"]`);if(t.length>0)return t.length>1&&console.warn(`Multiple \`setup\` blocks found for exercise "${e}", using the first.`),JSON.parse(di(t[0].textContent)).code}async process(e){if(!this.options.eval){this.container=this.asSourceHTML(this.context.code),this.container.value=this.nullResult;return}if(this.options.exercise&&this.context.code&&this.context.code.match(/_{6}_*/g)){this.container.value.result=null;return}let t=this.context.indicator;this.context.indicator||(t=new it),t.running();try{await Promise.all(Object.entries(e).map(async([l,c])=>{await this.envManager.bind(l,c,"prep")}));let r=this.getSetupCode();await this.evaluate(r,"prep"),await this.envManager.create("result","prep");let n=await this.evaluate(this.context.code,"result");if(!n)this.container.value.result=null;else if(this.options.output==="asis"){let l=await n.toArray(),c=await l[l.length-1].get("value");this.container.innerHTML=await c.toString()}else if(this.container=await this.asHtml(n),!this.options.output){let l=this.container.value;this.container=this.newContainer(),this.container.value=l}let s=await this.envManager.get("result"),a=await(await this.webR.objs.globalEnv.get(".webr_ojs")).toObject({depth:-1});typeof this.options.define=="string"?a[this.options.define]=await s.get(this.options.define):this.options.define&&Object.assign(a,Object.fromEntries(await Promise.all(this.options.define.map(async l=>{let c=await s.get(l);return[l,c]})))),Object.keys(a).forEach(async l=>{let c=await this.asOjs(a[l]);window._ojs.ojsConnector.mainModule._scope.has(l)?window._ojs.ojsConnector.mainModule.redefine(l,()=>c):window._ojs.ojsConnector.define(l)(c)}),await this.webR.evalRVoid("rm(list = ls(.webr_ojs), envir = .webr_ojs)")}finally{this.purge(),t.finished(),this.context.indicator||t.destroy()}}async evaluate(e,t,r=this.options){return e==null?null:(await(await this.shelter).captureR(`
        setTimeLimit(elapsed = timelimit)
        on.exit(setTimeLimit(elapsed = Inf))
        eval_result <- evaluate::evaluate(
          code,
          envir = envir,
          keep_message = warning,
          keep_warning = warning,
          stop_on_error = error,
          filename = "User code",
          output_handler = getOption("webr.evaluate.handler")
        )
        knitr:::merge_low_plot(eval_result)
      `,{env:{code:e,timelimit:Number(r.timelimit),envir:await this.envManager.get(t),warning:r.warning,error:r.error?0:1}})).result}asSourceHTML(e){let t=document.createElement("div"),r=document.createElement("pre");t.className="sourceCode",r.className="sourceCode r";let n=Rr(e);return r.appendChild(n),t.appendChild(r),t}async asHtml(e,t=this.options){let r=[],n=this.newContainer();n.value=this.nullResult;let s=()=>{if(t.echo&&r.length){let p=document.createElement("div"),g=document.createElement("pre");p.className="sourceCode",g.className="sourceCode r";let O=Rr(r.join(""));g.appendChild(O),p.appendChild(g),n.appendChild(p)}r.length=0},o=new v0.default({escapeXML:!0}),a=p=>{let g=document.createElement("div");g.className="exercise-cell-output cell-output cell-output-webr cell-output-stdout",g.innerHTML="<pre><code></code></pre>";let O=g.querySelector("code");O.textContent=p,O.innerHTML=o.toHtml(O.textContent),t.output&&(s(),n.appendChild(g))},l=p=>{let g=document.createElement("div");g.className="exercise-cell-output cell-output cell-output-webr cell-output-stderr",g.innerHTML="<pre><code></code></pre>";let O=g.querySelector("code");O.textContent=p,O.innerHTML=o.toHtml(O.textContent),t.output&&(s(),n.appendChild(g))},c=p=>{let g=document.createElement("canvas");g.width=p.width,g.height=p.height,g.className="img-fluid figure-img",g.style.width=`${2*p.width/3}px`,g.getContext("bitmaprenderer").transferFromImageBitmap(p);let O=document.createElement("div");O.className="cell-output-display cell-output-webr",O.appendChild(g),t.output&&(s(),n.appendChild(O))},h=async(p,g,O)=>{if(t.output){s();let y=await d.evalR("format(cnd, backtrace = FALSE)",{env:{cnd:p}}),x=await y.names(),v="",w="";if(x&&x.includes("message")){let C=await p.get("message"),_=await p.get("call");w=await ks(_)?` in \`${await _.deparse()}\``:": ",v=`${O}: ${await C.toString()}`}else v=await y.toString();let P=document.createElement("div");P.innerHTML=`
        <div class="callout-${g} callout callout-style-default callout-captioned">
          <div class="callout-header d-flex align-content-center">
            <div class="callout-icon-container"><i class="callout-icon"></i></div>
            <div class="callout-caption-container flex-fill">R ${O}${w}</div>
          </div>
          <div class="callout-body-container callout-body">
            <pre></pre>
          </div>
        </div>
        `,P.querySelector(".callout-body pre").appendChild(document.createTextNode(v)),n.appendChild(P)}},u=async p=>{if(t.output){let g=await p.toString(),O=await(await p.attrs()).get("knit_meta"),y=document.createElement("div");if(y.className="cell-output cell-output-webr",y.innerHTML=g,ba(y),s(),n.appendChild(y),ut(O)){let x=await O.toArray();for(let v=0;v<x.length;v++)await xu(this.webR,x[v])}}},f=async(p,g)=>{if(t.output){let O=document.createElement("div"),y=document.createElement("img");O.className="cell-output-display cell-output-pyodide",y.src=`data:${p};base64, ${g}`,y.style.maxWidth="100%",O.appendChild(y),n.appendChild(O)}},d=await this.shelter,m=await e.toArray();for(let p=0;p<m.length;p++){let g=await m[p].type(),O=await(await m[p].class()).toArray();switch(g){case"character":{a(await m[p].toString());break}case"list":{if(O.includes("warning"))await h(m[p],"warning","Warning");else if(O.includes("error"))await h(m[p],"important","Error");else if(O.includes("condition")){let y=await m[p].get("message");l(await y.toString())}if(O.includes("source")){let y=await m[p].get("src");r.push(await y.toString())}if(O.includes("result")){let y=await(await m[p].get("visible")).toBoolean(),x=await m[p].get("value"),v=await(await m[p].get("class")).toArray();y&&v.includes("knit_asis")&&await u(x)}if(O.includes("recordedplot")){let y=await this.webR.evalRNumber('getOption("webr.fig.width")');"fig-width"in this.options&&(y=Number(this.options["fig-width"]));let x=await this.webR.evalRNumber('getOption("webr.fig.height")');if("fig-height"in this.options&&(x=Number(this.options["fig-height"])),typeof OffscreenCanvas<"u"&&this.options.canvas){let v=await d.captureR("replayPlot(plot)",{captureGraphics:{width:72*y,height:72*x},env:{plot:m[p]}});c(v.images[0])}else{let w=await(await d.evalR(`
                tmp_dir <- tempdir()
                filename <- paste0(tmp_dir, ".webr-plot.png")
                if (requireNamespace("ragg", quietly = TRUE)) {
                  ragg::agg_png(file = filename, width = width, height = height, units = "in", res = 300)
                } else {
                  png(file = filename, width = width, height = height, units = "in", res = 300)
                }
                replayPlot(plot)
                dev.off()
                filesize <- file.info(filename)[["size"]]
                readBin(filename, "raw", n = filesize)
              `,{env:{plot:m[p],width:y,height:x}})).toTypedArray();f("image/png",Qr(w))}}break}default:throw new Error(`Unexpected list item type "${g}" in evaluation result`)}}return s(),n.value.result=await m[m.length-1].get("value"),n.value.evaluate_result=e,n}async asOjs(e){if(e instanceof ImageBitmap){let s=document.createElement("canvas");s.width=e.width,s.height=e.height;let o=s.getContext("2d");return o.drawImage(e,0,0,e.width,e.height),e.close(),s.style.width=`${2*o.canvas.width/3}px`,s}if(!ie(e))return e;let n=(await(await this.shelter).captureR(`
      knitr::knit_print(value, options = list(screenshot.force = FALSE))
    `,{env:{value:e}})).result;if(Ts(n)||ks(n))return async(...s)=>{try{let o=await this.webR.evalRNumber('72 * getOption("webr.fig.width")'),a=await this.webR.evalRNumber('72 * getOption("webr.fig.height")'),l=[],c=this.options.canvas&&typeof OffscreenCanvas<"u";c||this.webR.evalRVoid(`
              while (dev.cur() > 1) dev.off()
              options(device = function() {
                png(file = "/tmp/.webr-plot.png", width = width, height = height)
              })
            `,{env:{width:o,height:a}});let h=await n.capture({withAutoprint:!0,captureGraphics:c?{width:o,height:a}:!1},...s);if(c)l=h.images;else{let u=await this.webR.evalR(`
              while (dev.cur() > 1) dev.off()
              filename <- "/tmp/.webr-plot.png"
              if (file.exists(filename)) {
                filesize <- file.info(filename)[["size"]]
                readBin(filename, "raw", n = filesize)
              } else NULL
            `);if(gl(u)){let f=await u.toTypedArray(),d=document.createElement("img");d.src=`data:image/png;base64, ${Qr(f)}`,l=[d]}}if(l.length){let u=await this.asOjs(l[l.length-1]);return u.value=await this.asOjs(h.result),u}return await this.asOjs(h.result)}finally{this.webR.globalShelter.purge()}};switch(n._payload.obj.type){case"null":return null;case"character":if((await(await n.class()).toArray()).includes("knit_asis")){let o=await n.toString(),a=await(await n.attrs()).get("knit_meta"),l=document.createElement("div");if(l.className="cell-output",l.innerHTML=o,ut(a)){let c=await a.toArray();for(let h=0;h<c.length;h++)await xu(this.webR,c[h])}return window.HTMLWidgets&&setTimeout(()=>{window.HTMLWidgets.staticRender()},250),l}case"logical":case"double":case"raw":case"integer":return await n.toArray();case"list":{let o=await(await n.attrs()).get("class");if(!Ae(o)&&(await o.toArray()).includes("data.frame"))return await n.toD3()}case"environment":case"pairlist":{let s={},o=await n.toJs({depth:-1});for(let a=0;a<o.values.length;a++){let l=o.names?o.names[a]:a;s[l]=await this.asOjs(o.values[a])}return s}default:throw new Error(`Unsupported type: ${e._payload.obj.type}`)}}};var k0=Mu(Ru(),1),Lr,S0=!1,Ea=class{constructor(e,t){this.container=this.newContainer(),this.nullResult={result:null,evaluate_result:null,evaluator:this},this.container.value=this.nullResult,this.container.className="cell-output-container",this.pyodide=e,this.context=t,this.envManager=new Mr(Dr.instance(e),t),this.options=Object.assign({envir:"global",eval:!0,echo:!1,warning:!0,error:!0,include:!0,output:!0,timelimit:30},t.options)}newContainer(){let e=document.createElement("div");return e.classList.add("cell-output-container"),e.classList.add("cell-output-container-pyodide"),e}getSetupCode(){let e=this.options.exercise,t=document.querySelectorAll(`script[type="exercise-setup-${e}-contents"]`);if(t.length>0)return t.length>1&&console.warn(`Multiple \`setup\` blocks found for exercise "${e}", using the first.`),JSON.parse(di(t[0].textContent)).code}async process(e){if(!this.options.eval){this.container=this.asSourceHTML(this.context.code),this.container.value=this.nullResult;return}if(this.options.exercise&&this.context.code&&this.context.code.match(/_{6}_*/g)){this.container.value.result=null;return}let t=this.context.indicator;this.context.indicator||(t=new it),t.running();try{await Promise.all(Object.entries(e).map(async([a,l])=>{await this.envManager.bind(a,l,"prep")}));let r=this.getSetupCode();await this.evaluate(r,"prep"),await this.envManager.create("result","prep");let n=await this.evaluate(this.context.code,"result");if(!n)this.container.value.result=null;else if(this.options.output==="asis")this.container.innerHTML=await n.stdout;else if(this.container=await this.asHtml(n),!this.options.output){let a=this.container.value;this.container=this.newContainer(),this.container.value=a}let s=await this.envManager.get("result"),o={};typeof this.options.define=="string"?o[this.options.define]=await s.get(this.options.define):this.options.define&&Object.assign(o,Object.fromEntries(await Promise.all(this.options.define.map(async a=>{let l=await s.get(a);return[a,l]})))),Object.keys(o).forEach(async a=>{let l=await this.asOjs(o[a]);window._ojs.ojsConnector.mainModule._scope.has(a)?window._ojs.ojsConnector.mainModule.redefine(a,()=>l):window._ojs.ojsConnector.define(a)(l)})}finally{t.finished(),this.context.indicator||t.destroy()}}async evaluate(e,t,r=this.options){if(e==null)return null;await this.pyodide.loadPackagesFromImports(e);let[n,s,o]=[7,5,100];"fig-width"in this.options&&(n=Number(this.options["fig-width"])),"fig-height"in this.options&&(s=Number(this.options["fig-height"])),"fig-dpi"in this.options&&(o=Number(this.options["fig-dpi"]));let a=await this.pyodide.toPy({code:e,dpi:o,width:n,height:s,environment:await this.envManager.get(t)}),l=await this.pyodide.runPythonAsync(atob(x0()),{locals:a});a.destroy();let c=await l.get("value"),h=await l.get("stdout"),u=await l.get("stderr"),f=await l.get("outputs");return{value:c,stdout:h,stderr:u,outputs:f}}asSourceHTML(e){let t=document.createElement("div"),r=document.createElement("pre");t.className="sourceCode",r.className="sourceCode python";let n=Ar(e);return r.appendChild(n),t.appendChild(r),t}async asOjs(e){return Object.getOwnPropertyNames(e).includes("toJs")?e.toJs():e}async asHtml(e,t=this.options){let r=this.newContainer();if(r.value=this.nullResult,!e)return r;let n=u=>{if(u.width<=1&&u.height<=1)return;let f=document.createElement("canvas");f.width=u.width,f.height=u.height,f.className="img-fluid figure-img",f.style.width=`${2*u.width/3}px`,f.getContext("bitmaprenderer").transferFromImageBitmap(u);let d=document.createElement("div");d.className="cell-output-display cell-output-pyodide",d.appendChild(f),t.output&&r.appendChild(d)},s=u=>{if(t.output){let f=document.createElement("div");f.appendChild(document.createTextNode(u)),f.className="cell-output cell-output-pyodide",f.innerHTML=`<pre><code>${f.innerHTML}</code></pre>`,r.appendChild(f)}},o=async u=>{let f=await this.pyodide.runPythonAsync(`
        import ipywidgets as widgets
        import json
        json.dumps(widgets.Widget.get_manager_state())
      `);Lr||(Lr=document.createElement("script"),Lr.type="application/vnd.jupyter.widget-state+json",Lr=document.body.appendChild(Lr),await bu("https://cdn.jsdelivr.net/npm/@jupyter-widgets/html-manager@1.0.11/dist/embed.js")),Lr.innerHTML=f;let d=await this.pyodide.toPy({widget:u}),m=await this.pyodide.runPythonAsync(`
        import json
        json.dumps(widget)
      `,{locals:d});d.destroy();let p=document.createElement("script");p.type="application/vnd.jupyter.widget-view+json",p.innerHTML=m,r.appendChild(p),dispatchEvent(new Event("load"))},a=async u=>{let f=await this.pyodide.toPy({figure:u}),d=await this.pyodide.runPythonAsync(`
        import json
        json.dumps(figure)
      `,{locals:f});S0||(await bu("https://cdn.plot.ly/plotly-2.35.2.min.js"),S0=!0);var m=JSON.parse(d);let p=document.createElement("div");window.Plotly.newPlot(p,m.data,m.layout),r.appendChild(p)},l=async u=>{if(t.output){let f=document.createElement("div");f.className="cell-output cell-output-pyodide",f.innerHTML=u,ba(f),r.appendChild(f)}},c=async(u,f)=>{if(t.output){let d=document.createElement("div"),m=document.createElement("img");d.className="cell-output-display cell-output-pyodide",m.src=`data:${u};base64, ${f}`,d.appendChild(m),r.appendChild(d)}};if(t.echo){let u=document.createElement("div"),f=document.createElement("pre");u.className="sourceCode",f.className="sourceCode python";let d=Ar(this.context.code);f.appendChild(d),u.appendChild(f),r.appendChild(u)}let h=new k0.default({escapeXML:!0});if(e.stdout){let u=document.createElement("div");u.className="exercise-cell-output cell-output cell-output-pyodide cell-output-stdout",u.innerHTML="<pre><code></code></pre>";let f=u.querySelector("code");f.textContent=e.stdout,f.innerHTML=h.toHtml(f.textContent),r.appendChild(u)}if(e.stderr){let u=document.createElement("div");u.className="exercise-cell-output cell-output cell-output-pyodide cell-output-stderr",u.innerHTML="<pre><code></code></pre>";let f=u.querySelector("code");f.textContent=e.stderr,f.innerHTML=h.toHtml(f.textContent),r.appendChild(u)}for(let u=0;u<await e.outputs.length;u++){let f=await e.outputs.get(u),d=await f._repr_mime_("application/html-imagebitmap"),m=await f._repr_mime_("text/html"),p=await f._repr_mime_("application/vnd.jupyter.widget-view+json"),g=await f._repr_mime_("application/vnd.plotly.v1+json"),O=await f._repr_mime_("text/plain"),y=await f._repr_mime_("image/png"),x=await f._repr_mime_("image/jpeg"),v=await f._repr_mime_("image/gif"),w=await f._repr_mime_("image/svg+xml");d?n(d):m?l(m):p?o(p):g?a(g):y?c("image/png",y):x?c("image/jpeg",x):v?c("image/gif",v):w?l(w):O&&s(O),f.destroy()}return r.value.result=e,r}};var qr=class{constructor(e){this.evaluator=e,this.envManager=this.evaluator.envManager,this.context=this.evaluator.context,this.options={envir:this.evaluator.options.envir,eval:!0,echo:!1,warning:!0,error:!1,include:!0,output:!0,timelimit:600}}getCheckingAlgorithm(){let e=this.evaluator.options.exercise,t=document.querySelectorAll(`script[type="exercise-check-${e}-contents"]`);if(t.length>0)return t.length>1&&console.warn(`Multiple \`check\` blocks found for exercise "${e}", using the first.`),JSON.parse(di(t[0].textContent)).code}};var Ra=class extends qr{constructor(e){super(e),this.webR=this.evaluator.webR}async gradeExercise(){let e=this.context.code;if(!e)return null;let t=await this.blankCheck(e);if(!Ae(t))return await this.feedbackAsHtmlAlert(t);if(t=await this.parseCheck(e),!Ae(t))return await this.feedbackAsHtmlAlert(t);let r=this.context.indicator;this.context.indicator||(r=new it),r.running();try{if(t=await this.evaluateExercise(),Ae(t))return null;let n=await this.evaluator.asHtml(t,this.options),s=await n.value.result,o=await(await s.class()).toArray();if(o.includes("gradethis_graded")||o.includes("gradethis_feedback"))return await this.feedbackAsHtmlAlert(s);if(ut(s)){let a=await s.get("message"),l=await s.get("correct");if(!Ae(a)&&!Ae(l))return await this.feedbackAsHtmlAlert(s)}return n}finally{r.finished(),this.context.indicator||r.destroy()}}async parseCheck(e,t){let r=await this.evaluator.shelter;try{return await r.evalR("parse(text = user_code)",{env:{user_code:e}}),this.evaluator.webR.objs.null}catch{return await new r.RList({message:await r.evalR(`htmltools::HTML("
          It looks like this might not be valid R code.
          R cannot determine how to turn your text into a complete command.
          You may have forgotten to fill in a blank,
          to remove an underscore, to include a comma between arguments,
          or to close an opening <code>&quot;</code>, <code>'</code>, <code>(</code>
          or <code>{</code> with a matching <code>&quot;</code>, <code>'</code>,
          <code>)</code> or <code>}</code>.
        ")`),correct:!1,location:"append",type:"error"})}finally{r.purge()}}async blankCheck(e){let t=await this.evaluator.shelter;return e.match(/_{6}_*/g)?await new t.RList({message:"Please replace ______ with valid code.",correct:!1,location:"append",type:"info"}):this.evaluator.webR.objs.null}async evaluateSolution(){let e=this.evaluator.options.exercise,t=document.querySelectorAll(`.exercise-solution[data-exercise="${e}"] > code.solution-code`);if(t.length>0){t.length>1&&console.warn(`Multiple solutions found for exercise "${e}", using first solution.`);let r=await this.evaluator.shelter;await this.envManager.create("solution","prep");let n=await this.envManager.get("solution"),s=t[0].textContent,o=await r.evalR(s,{env:n});return{envir:n,code:s,result:o}}return null}async evaluateExercise(){await this.envManager.create("grading","result");let e=await this.evaluator.shelter;try{let t=await this.envManager.get("result"),r=this.evaluator.container.value.evaluate_result,n=await this.envManager.get("prep"),s=this.evaluator.container.value.result,o={user_code:this.context.code,stage:"check",engine:"r",label:this.context.options.exercise||this.webR.objs.null,check_code:this.getCheckingAlgorithm()||this.webR.objs.null,envir_result:t,evaluate_result:r,envir_prep:n,last_value:s,solution_code:this.webR.objs.null,solution_code_all:this.webR.objs.null,envir_solution:this.webR.objs.null,solution:this.webR.objs.null},a=await this.evaluateSolution();a&&(o.solution_code=a.code,o.solution_code_all=[a.code],o.envir_solution=a.envir,o.solution=a.result);let l=await new e.RList(o);await this.envManager.bind(".checker_args",l,"grading");let c={...this.options};return c.error=!1,c.output=!0,await this.evaluator.evaluate(`.checker <- getOption('webr.exercise.checker')
        environment(.checker) <- environment()
        do.call(.checker, .checker_args)`,"grading",c)}finally{e.purge()}}async feedbackAsHtmlAlert(e){let t=await this.evaluator.shelter,r=document.createElement("div"),n=await e.get("type"),s=await e.get("correct");switch(r.classList.add("alert"),r.classList.add("exercise-grade"),await n.toString()){case"success":r.classList.add("alert-success");break;case"info":r.classList.add("alert-info");break;case"warning":r.classList.add("alert-warning");break;case"error":case"danger":r.classList.add("alert-danger");break;default:{let f=await s.toArray();f.length>0&&f[0]?r.classList.add("alert-success"):r.classList.add("alert-danger")}}let o=document.createElement("span");o.className="exercise-feedback";let a=await e.get("message");a=(await t.captureR("knitr::knit_print(grade$message)",{env:{grade:e}})).result;let c=await a.toString(),h=document.createElement("div");h.innerHTML=c,r.append(...h.childNodes);let u=await e.get("error");if(!Ae(u)){a=await u.get("message"),c=await a.toString();let f=await u.get("call"),d=await u.get("gradethis_call"),m=document.createElement("p"),p=document.createElement("pre");p.appendChild(document.createTextNode(`Error: ${c}`)),m.appendChild(p),r.appendChild(m);let g=document.createElement("details");p=document.createElement("pre"),p.appendChild(document.createTextNode(await f.toString())),g.appendChild(p),p=document.createElement("pre"),p.appendChild(document.createTextNode(await d.toString())),g.appendChild(p),r.appendChild(g)}return r}};var Aa=class extends qr{constructor(e){super(e),this.pyodide=this.evaluator.pyodide}async gradeExercise(){let e=this.context.code;if(!e)return null;let t=await this.blankCheck(e);if(t)return await this.feedbackAsHtmlAlert(t);if(t=await this.parseCheck(e),t)return await this.feedbackAsHtmlAlert(t);let r=this.context.indicator;this.context.indicator||(r=new it),r.running();try{let n=await this.evaluateExercise();if(!n.value)return null;let s=await this.evaluator.asHtml(n,this.options),o=await s.value.result.value,a,l;return await o.type==="dict"&&(a=await o.get("message"),l=await o.get("correct")),a&&l!==void 0?await this.feedbackAsHtmlAlert(o):s}finally{r.finished(),this.context.indicator||r.destroy()}}async parseCheck(e,t){try{return await this.pyodide.runPythonAsync(`
        from ast import parse
        parse(user_code)
      `,{locals:await this.pyodide.toPy({user_code:e})}),null}catch{return await this.pyodide.toPy({message:`
          It looks like this might not be valid Python code.
          Python cannot determine how to turn your text into a complete command.
          Your code may be indented incorrectly, or you may have forgotten to
          fill in a blank, to remove an underscore, to include a comma between
          arguments, or to close an opening <code>&quot;</code>, <code>'</code>,
          <code>(</code> or <code>{</code> with a matching <code>&quot;</code>,
          <code>'</code>, <code>)</code> or <code>}</code>.
        `,correct:!1,location:"append",type:"error"})}}async blankCheck(e){return e.match(/_{6}_*/g)?await this.pyodide.toPy({message:"Please replace ______ with valid code.",correct:!1,location:"append",type:"info"}):null}async evaluateSolution(){let e=this.evaluator.options.exercise,t=document.querySelectorAll(`.exercise-solution[data-exercise="${e}"] > code.solution-code`);if(t.length>0){t.length>1&&console.warn(`Multiple solutions found for exercise "${e}", using first solution.`),await this.envManager.create("solution","prep");let r=await this.envManager.get("solution"),n=t[0].textContent,s=await this.pyodide.runPythonAsync(n,{globals:r});return{envir:r,code:n,result:s}}return null}async evaluateExercise(){await this.envManager.create("grading","result");let e=await this.envManager.get("result"),t=this.evaluator.container.value.evaluate_result,r=await this.envManager.get("prep"),n=this.evaluator.container.value.result.value,s={user_code:this.context.code,stage:"check",engine:"python",label:this.context.options.exercise,check_code:this.getCheckingAlgorithm(),envir_result:e,evaluate_result:t,envir_prep:r,last_value:n,result:n,solution_code:null,solution_code_all:null,envir_solution:null,solution:null},o=await this.evaluateSolution();o&&(s.solution_code=o.code,s.solution_code_all=[o.code],s.envir_solution=o.envir,s.solution=o.result);let a=await this.pyodide.toPy(s);await this.envManager.bind("_checker_env",a,"grading"),a.destroy();let l={...this.options};return l.error=!1,l.output=!0,await this.evaluator.evaluate(`
        import pyodide
        feedback = None
        if (_checker_env["check_code"]):
          try:
            feedback = pyodide.code.eval_code(
              _checker_env["check_code"],
              globals = globals(),
              locals = _checker_env
            )
          except Exception as error:
            feedback = {
              'correct': False,
              'message': 'Error while checking \`{}\`: "{}"'.format(_checker_env["label"], error),
              'type': 'error'
            }
        feedback
      `,"grading",l)}async feedbackAsHtmlAlert(e){let t=document.createElement("div"),r=await e.get("type"),n=await e.get("correct"),s=await e.get("message");switch(t.classList.add("alert"),t.classList.add("exercise-grade"),r){case"success":t.classList.add("alert-success");break;case"info":t.classList.add("alert-info");break;case"warning":t.classList.add("alert-warning");break;case"error":case"danger":t.classList.add("alert-danger");break;default:t.classList.add(n?"alert-success":"alert-danger")}let o=document.createElement("span");return o.className="exercise-feedback",o.innerHTML=s,t.appendChild(o),t}};function LT(i){return i&&i[Symbol.toStringTag]=="PyProxy"}function T0(i){return i&&!!i[wl]}function qT(i){return i&&typeof i=="object"&&"_comlinkProxy"in i&&"ptr"in i}function VT(i){return i&&i[Symbol.toStringTag]=="Map"}function Au(i){if(T0(i))return!0;if(i==null||i instanceof ArrayBuffer||ArrayBuffer.isView(i))return!1;if(i instanceof Array)return i.some(e=>Au(e));if(typeof i=="object")return Object.entries(i).some(([e,t])=>Au(t))}var P0={},C0={canHandle:LT,serialize(i){let e=self.pyodide._module.PyProxy_getPtr(i);P0[e]=i;let{port1:t,port2:r}=new MessageChannel;return Qs(i,t),[[r,e],[r]]},deserialize([i,e]){i.start();let t=Fr(i);return new Proxy(t,{get:(n,s)=>s==="_ptr"?e:n[s]})}},E0={canHandle:Au,serialize(i){return[Kn(i,T0,e=>({_comlinkProxy:!0,ptr:e._ptr})),[]]},deserialize(i){return Kn(i,qT,e=>P0[e.ptr])}},R0={canHandle:yu,serialize(i){if(i.width==0&&i.height==0){let e=new OffscreenCanvas(1,1);e.getContext("2d"),i=e.transferToImageBitmap()}return[i,[i]]},deserialize(i){return i}},A0={canHandle:VT,serialize(i){return[Object.fromEntries(i.entries()),[]]},deserialize(i){return i}};async function NT(i,e){return await i.evalRVoid('options("webr.render.df" = x)',{env:{x:e.render_df||"default"}}),await i.evalRVoid(atob(Q0()))}async function jT(i){await i.runPythonAsync(atob(M0()));let e=atob(_0());await i.FS.mkdirTree("/pyodide"),await i.FS.writeFile("/pyodide/matplotlib_display.py",e)}async function IT(i){let e=new URL("./pyodide-worker.js",import.meta.url),t=new Worker(e,{type:"module"}),n=await Fr(t).init(i);return Yt.set("PyProxy",C0),Yt.set("Comlink",E0),Yt.set("ImageBitmap",R0),Yt.set("Map",A0),Yt.delete("throw"),n}window._exercise_ojs_runtime={PyodideExerciseEditor:ya,PyodideEvaluator:Ea,PyodideEnvironment:Dr,PyodideGrader:Aa,WebR:Ol,WebRExerciseEditor:Oa,WebREvaluator:Ca,WebRGrader:Ra,WebREnvironment:_r,highlightR:Rr,highlightPython:Ar,interpolate:gu,setupR:NT,setupPython:jT,startPyodideWorker:IT,b64Encode:WO,b64Decode:di,collapsePath:zO};export{Dr as PyodideEnvironment,Ea as PyodideEvaluator,ya as PyodideExerciseEditor,Aa as PyodideGrader,Ol as WebR,_r as WebREnvironment,Ca as WebREvaluator,Oa as WebRExerciseEditor,Ra as WebRGrader,di as b64Decode,WO as b64Encode,zO as collapsePath,Ar as highlightPython,Rr as highlightR,gu as interpolate,jT as setupPython,NT as setupR,IT as startPyodideWorker};
/*! Bundled license information:

comlink/dist/esm/comlink.mjs:
  (**
   * @license
   * Copyright 2019 Google LLC
   * SPDX-License-Identifier: Apache-2.0
   *)
*/
