@govbr-ds/playground 5.2.0 → 5.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Playground.d.ts.map +1 -1
- package/dist/browser/chunks/babel-PXSNAHUX.js +16 -0
- package/dist/browser/chunks/chunk-6DHFEWGX.js +1 -0
- package/dist/browser/chunks/{chunk-JM73XHPL.js → chunk-7G6EEGZ4.js} +1 -1
- package/dist/{react/chunks/dist-AKMJXMTZ.js → browser/chunks/dist-H5E3DUQZ.js} +1 -1
- package/dist/browser/chunks/{dist-VIVGCYF5.js → dist-HT72W6BH.js} +1 -1
- package/dist/browser/chunks/{dist-KS4J6S7U.js → dist-MALZEIQI.js} +1 -1
- package/dist/browser/chunks/{esm-BWS4JPZG.js → esm-3ZNLC56K.js} +1 -1
- package/dist/browser/chunks/{esm-R75BP3LA.js → esm-6SLZNXJD.js} +1 -1
- package/dist/browser/chunks/estree-EALESNBX.js +44 -0
- package/dist/browser/chunks/html-C5MOHUJO.js +25 -0
- package/dist/browser/chunks/postcss-RXMLIASD.js +62 -0
- package/dist/browser/chunks/standalone-G7AM3SII.js +29 -0
- package/dist/browser/index.d.ts.map +1 -1
- package/dist/browser/index.js +21 -21
- package/dist/library/profile.d.ts +1 -1
- package/dist/react/chunks/babel-PXSNAHUX.js +16 -0
- package/dist/react/chunks/chunk-6DHFEWGX.js +1 -0
- package/dist/{browser/chunks/dist-AKMJXMTZ.js → react/chunks/dist-H5E3DUQZ.js} +1 -1
- package/dist/react/chunks/{dist-VIVGCYF5.js → dist-HT72W6BH.js} +1 -1
- package/dist/react/chunks/{dist-KS4J6S7U.js → dist-MALZEIQI.js} +1 -1
- package/dist/react/chunks/{esm-R75BP3LA.js → esm-6SLZNXJD.js} +1 -1
- package/dist/react/chunks/{esm-WLDNKOOE.js → esm-YAO6K4CU.js} +1 -1
- package/dist/react/chunks/estree-EALESNBX.js +44 -0
- package/dist/react/chunks/html-C5MOHUJO.js +25 -0
- package/dist/react/chunks/postcss-RXMLIASD.js +62 -0
- package/dist/react/chunks/standalone-G7AM3SII.js +29 -0
- package/dist/react/index.js +18 -18
- package/dist/styles.css +77 -37
- package/dist/utils/previewLocale.d.ts +6 -6
- package/dist/utils/previewLocale.d.ts.map +1 -1
- package/package.json +7 -7
- package/dist/browser/chunks/babel-TRTEHJWP.js +0 -16
- package/dist/browser/chunks/chunk-Y6SLVHK3.js +0 -1
- package/dist/browser/chunks/estree-UYKKTIFA.js +0 -44
- package/dist/browser/chunks/html-TM3VAO62.js +0 -25
- package/dist/browser/chunks/postcss-JAVHFEUM.js +0 -62
- package/dist/browser/chunks/standalone-IDMVEPER.js +0 -29
- package/dist/react/chunks/babel-TRTEHJWP.js +0 -16
- package/dist/react/chunks/chunk-Y6SLVHK3.js +0 -1
- package/dist/react/chunks/estree-UYKKTIFA.js +0 -44
- package/dist/react/chunks/html-TM3VAO62.js +0 -25
- package/dist/react/chunks/postcss-JAVHFEUM.js +0 -62
- package/dist/react/chunks/standalone-IDMVEPER.js +0 -29
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var g=Object.create;var f=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var i=Object.getOwnPropertyNames;var j=Object.getPrototypeOf,k=Object.prototype.hasOwnProperty;var m=(b,a)=>()=>{try{return a||b((a={exports:{}}).exports,a),a.exports}catch(c){throw a=0,c}};var l=(b,a,c,e)=>{if(a&&typeof a=="object"||typeof a=="function")for(let d of i(a))!k.call(b,d)&&d!==c&&f(b,d,{get:()=>a[d],enumerable:!(e=h(a,d))||e.enumerable});return b};var n=(b,a,c)=>(c=b!=null?g(j(b)):{},l(a||!b||!b.__esModule?f(c,"default",{value:b,enumerable:!0}):c,b));export{m as a,n as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c,d}from"./chunk-ZIL2IWZ3.js";import"./chunk-UVFYWQD2.js";import"./chunk-5A3ZKBRD.js";import"./chunk-
|
|
1
|
+
import{a,b,c,d}from"./chunk-ZIL2IWZ3.js";import"./chunk-UVFYWQD2.js";import"./chunk-5A3ZKBRD.js";import"./chunk-6DHFEWGX.js";export{d as css,b as cssCompletionSource,c as cssLanguage,a as defineCSSCompletionSource};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c,d,e,f,g,h,i,j,k,l}from"./chunk-EP7B2XPY.js";import"./chunk-UVFYWQD2.js";import"./chunk-TFWQIFOZ.js";import"./chunk-5A3ZKBRD.js";import"./chunk-
|
|
1
|
+
import{a,b,c,d,e,f,g,h,i,j,k,l}from"./chunk-EP7B2XPY.js";import"./chunk-UVFYWQD2.js";import"./chunk-TFWQIFOZ.js";import"./chunk-5A3ZKBRD.js";import"./chunk-6DHFEWGX.js";export{k as autoCloseTags,d as completionPath,l as esLint,j as javascript,f as javascriptLanguage,h as jsxLanguage,c as localCompletionSource,e as scopeCompletionSource,a as snippets,i as tsxLanguage,g as typescriptLanguage,b as typescriptSnippets};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c,d,e}from"./chunk-WUR2JRNJ.js";import"./chunk-ZIL2IWZ3.js";import"./chunk-EP7B2XPY.js";import"./chunk-UVFYWQD2.js";import"./chunk-TFWQIFOZ.js";import"./chunk-5A3ZKBRD.js";import"./chunk-
|
|
1
|
+
import{a,b,c,d,e}from"./chunk-WUR2JRNJ.js";import"./chunk-ZIL2IWZ3.js";import"./chunk-EP7B2XPY.js";import"./chunk-UVFYWQD2.js";import"./chunk-TFWQIFOZ.js";import"./chunk-5A3ZKBRD.js";import"./chunk-6DHFEWGX.js";export{e as autoCloseTags,d as html,a as htmlCompletionSource,b as htmlCompletionSourceWith,c as htmlLanguage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as s}from"./chunk-3JEV5GFZ.js";import{Y as m,cb as f,db as u,j as e}from"./chunk-5A3ZKBRD.js";import"./chunk-
|
|
1
|
+
import{a as s}from"./chunk-3JEV5GFZ.js";import{Y as m,cb as f,db as u,j as e}from"./chunk-5A3ZKBRD.js";import"./chunk-6DHFEWGX.js";var d=c=>{var o=c.theme,i=c.settings,t=i===void 0?{}:i,g=c.styles,n=g===void 0?[]:g,r={".cm-gutters":{}},a={};t.background&&(a.backgroundColor=t.background),t.backgroundImage&&(a.backgroundImage=t.backgroundImage),t.foreground&&(a.color=t.foreground),t.fontSize&&(a.fontSize=t.fontSize),(t.background||t.foreground)&&(r["&"]=a),t.fontFamily&&(r["&.cm-editor .cm-scroller"]={fontFamily:t.fontFamily}),t.gutterBackground&&(r[".cm-gutters"].backgroundColor=t.gutterBackground),t.gutterForeground&&(r[".cm-gutters"].color=t.gutterForeground),t.gutterBorder&&(r[".cm-gutters"].borderRightColor=t.gutterBorder),t.caret&&(r[".cm-content"]={caretColor:t.caret},r[".cm-cursor, .cm-dropCursor"]={borderLeftColor:t.caret});var l={};t.gutterActiveForeground&&(l.color=t.gutterActiveForeground),t.lineHighlight&&(r[".cm-activeLine"]={backgroundColor:t.lineHighlight},l.backgroundColor=t.lineHighlight),r[".cm-activeLineGutter"]=l,t.selection&&(r["&.cm-focused .cm-selectionBackground, & .cm-line::selection, & .cm-selectionLayer .cm-selectionBackground, .cm-content ::selection"]={background:t.selection+" !important"}),t.selectionMatch&&(r["& .cm-selectionMatch"]={backgroundColor:t.selectionMatch});var h=m.theme(r,{dark:o==="dark"}),b=f.define(n),p=[h,u(b)];return p};var k={background:"#fff",foreground:"#24292e",selection:"#BBDFFF",selectionMatch:"#BBDFFF",gutterBackground:"#fff",gutterForeground:"#6e7781"},v=[{tag:[e.standard(e.tagName),e.tagName],color:"#116329"},{tag:[e.comment,e.bracket],color:"#6a737d"},{tag:[e.className,e.propertyName],color:"#6f42c1"},{tag:[e.variableName,e.attributeName,e.number,e.operator],color:"#005cc5"},{tag:[e.keyword,e.typeName,e.typeOperator,e.typeName],color:"#d73a49"},{tag:[e.string,e.meta,e.regexp],color:"#032f62"},{tag:[e.name,e.quote],color:"#22863a"},{tag:[e.heading,e.strong],color:"#24292e",fontWeight:"bold"},{tag:[e.emphasis],color:"#24292e",fontStyle:"italic"},{tag:[e.deleted],color:"#b31d28",backgroundColor:"ffeef0"},{tag:[e.atom,e.bool,e.special(e.variableName)],color:"#e36209"},{tag:[e.url,e.escape,e.regexp,e.link],color:"#032f62"},{tag:e.link,textDecoration:"underline"},{tag:e.strikethrough,textDecoration:"line-through"},{tag:e.invalid,color:"#cb2431"}],y=c=>{var o=c||{},i=o.theme,t=i===void 0?"light":i,g=o.settings,n=g===void 0?{}:g,r=o.styles,a=r===void 0?[]:r;return d({theme:t,settings:s({},k,n),styles:[...v,...a]})},$=y(),x={background:"#0d1117",foreground:"#c9d1d9",caret:"#c9d1d9",selection:"#003d73",selectionMatch:"#003d73",lineHighlight:"#36334280"},N=[{tag:[e.standard(e.tagName),e.tagName],color:"#7ee787"},{tag:[e.comment,e.bracket],color:"#8b949e"},{tag:[e.className,e.propertyName],color:"#d2a8ff"},{tag:[e.variableName,e.attributeName,e.number,e.operator],color:"#79c0ff"},{tag:[e.keyword,e.typeName,e.typeOperator,e.typeName],color:"#ff7b72"},{tag:[e.string,e.meta,e.regexp],color:"#a5d6ff"},{tag:[e.name,e.quote],color:"#7ee787"},{tag:[e.heading,e.strong],color:"#d2a8ff",fontWeight:"bold"},{tag:[e.emphasis],color:"#d2a8ff",fontStyle:"italic"},{tag:[e.deleted],color:"#ffdcd7",backgroundColor:"ffeef0"},{tag:[e.atom,e.bool,e.special(e.variableName)],color:"#ffab70"},{tag:e.link,textDecoration:"underline"},{tag:e.strikethrough,textDecoration:"line-through"},{tag:e.invalid,color:"#f97583"}],F=c=>{var o=c||{},i=o.theme,t=i===void 0?"dark":i,g=o.settings,n=g===void 0?{}:g,r=o.styles,a=r===void 0?[]:r;return d({theme:t,settings:s({},x,n),styles:[...N,...a]})},H=F();export{x as defaultSettingsGithubDark,k as defaultSettingsGithubLight,H as githubDark,F as githubDarkInit,N as githubDarkStyle,$ as githubLight,y as githubLightInit,v as githubLightStyle};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{d as Rn,e as Fn,f as In,g as Wn}from"./chunk-TFWQIFOZ.js";import{a as Pn}from"./chunk-3JEV5GFZ.js";import{$ as Fl,A as Ml,Aa as Kl,B as Al,Ba as zl,C as L,Ca as xo,D as _e,Da as Jl,E as B,Ea as jl,F as _,Fa as Yl,G as Z,Ga as Ln,H as Ll,Ha as Bn,I as Bl,Ia as Zl,J as mo,Ja as Xl,K as $e,Ka as Ql,L as Ve,M as Dl,N as b,O as mn,Oa as qe,P as wl,Q as v,Qa as Ue,R as Tl,Ra as Ke,S as gn,Sa as me,T as El,Ta as Mt,U as go,Ua as At,V as He,W as Ol,X as Rl,Y as y,Z as he,Za as Dn,_ as pn,a as Ne,aa as Il,ab as wn,ba as vt,bb as Tn,ca as Wl,cb as En,da as yn,db as ge,ea as Pl,eb as Lt,fa as Ct,fb as On,ga as Nl,ha as xn,hb as X,ia as kn,j as h,ja as Sn,k as bt,ka as bn,l as Sl,la as _l,m as N,ma as po,n as an,na as vn,o as cn,oa as Cn,p as un,pa as $l,q as bl,qa as Vl,r as fn,ra as Hl,s as hn,sa as Gl,t as vl,ta as ql,u as m,ua as Ul,v as $,va as de,w as ne,wa as Ge,x as dn,xa as Mn,y as Cl,ya as An,z as fe,za as yo}from"./chunk-5A3ZKBRD.js";import"./chunk-Y6SLVHK3.js";function Nn(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}import{useRef as gl,forwardRef as pl,useImperativeHandle as yl,useCallback as xl}from"react";import{useEffect as Me,useLayoutEffect as fl,useState as Ae}from"react";var ko=t=>{let{state:e}=t,n=e.doc.lineAt(e.selection.main.from),r=Rt(t.state,n.from);return r.line?So(t):r.block?vo(t):!1};function Ot(t,e){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let o=t(e,n);return o?(r(n.update(o)),!0):!1}}var So=Ot(Ao,0);var bo=Ot(zn,0);var vo=Ot((t,e)=>zn(t,e,Mo(e)),0);function Rt(t,e){let n=t.languageDataAt("commentTokens",e,1);return n.length?n[0]:{}}var pe=50;function Co(t,{open:e,close:n},r,o){let i=t.sliceDoc(r-pe,r),l=t.sliceDoc(o,o+pe),s=/\s*$/.exec(i)[0].length,a=/^\s*/.exec(l)[0].length,c=i.length-s;if(i.slice(c-e.length,c)==e&&l.slice(a,a+n.length)==n)return{open:{pos:r-s,margin:s&&1},close:{pos:o+a,margin:a&&1}};let u,f;o-r<=2*pe?u=f=t.sliceDoc(r,o):(u=t.sliceDoc(r,r+pe),f=t.sliceDoc(o-pe,o));let d=/^\s*/.exec(u)[0].length,x=/\s*$/.exec(f)[0].length,g=f.length-x-n.length;return u.slice(d,d+e.length)==e&&f.slice(g,g+n.length)==n?{open:{pos:r+d+e.length,margin:/\s/.test(u.charAt(d+e.length))?1:0},close:{pos:o-x-n.length,margin:/\s/.test(f.charAt(g-1))?1:0}}:null}function Mo(t){let e=[];for(let n of t.selection.ranges){let r=t.doc.lineAt(n.from),o=n.to<=r.to?r:t.doc.lineAt(n.to);o.from>r.from&&o.from==n.to&&(o=n.to==r.to+1?r:t.doc.lineAt(n.to-1));let i=e.length-1;i>=0&&e[i].to>r.from?e[i].to=o.to:e.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:o.to})}return e}function zn(t,e,n=e.selection.ranges){let r=n.map(i=>Rt(e,i.from).block);if(!r.every(i=>i))return null;let o=n.map((i,l)=>Co(e,r[l],i.from,i.to));if(t!=2&&!o.every(i=>i))return{changes:e.changes(n.map((i,l)=>o[l]?[]:[{from:i.from,insert:r[l].open+" "},{from:i.to,insert:" "+r[l].close}]))};if(t!=1&&o.some(i=>i)){let i=[];for(let l=0,s;l<o.length;l++)if(s=o[l]){let a=r[l],{open:c,close:u}=s;i.push({from:c.pos-a.open.length,to:c.pos+c.margin},{from:u.pos-u.margin,to:u.pos+a.close.length})}return{changes:i}}return null}function Ao(t,e,n=e.selection.ranges){let r=[],o=-1;e:for(let{from:i,to:l}of n){let s=r.length,a=1e9,c;for(let u=i;u<=l;){let f=e.doc.lineAt(u);if(c==null&&(c=Rt(e,f.from).line,!c))continue e;if(f.from>o&&(i==l||l>f.from)){o=f.from;let d=/^\s*/.exec(f.text)[0].length,x=d==f.length,g=f.text.slice(d,d+c.length)==c?d:-1;d<f.text.length&&d<a&&(a=d),r.push({line:f,comment:g,token:c,indent:d,empty:x,single:!1})}u=f.to+1}if(a<1e9)for(let u=s;u<r.length;u++)r[u].indent<r[u].line.text.length&&(r[u].indent=a);r.length==s+1&&(r[s].single=!0)}if(t!=2&&r.some(i=>i.comment<0&&(!i.empty||i.single))){let i=[];for(let{line:s,token:a,indent:c,empty:u,single:f}of r)(f||!u)&&i.push({from:s.from+c,insert:a+" "});let l=e.changes(i);return{changes:l,selection:e.selection.map(l,1)}}else if(t!=1&&r.some(i=>i.comment>=0)){let i=[];for(let{line:l,comment:s,token:a}of r)if(s>=0){let c=l.from+s,u=c+a.length;l.text[u-l.from]==" "&&u++,i.push({from:c,to:u})}return{changes:i}}return null}var Dt=fe.define(),Lo=fe.define(),Bo=$.define(),Jn=$.define({combine(t){return Z(t,{minDepth:100,newGroupDelay:500,joinToEvent:(e,n)=>n},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,n)=>(r,o)=>e(r,o)||n(r,o)})}}),jn=ne.define({create(){return Q.empty},update(t,e){let n=e.state.facet(Jn),r=e.annotation(Dt);if(r){let a=R.fromTransaction(e,r.selection),c=r.side,u=c==0?t.undone:t.done;return a?u=Je(u,u.length,n.minDepth,a):u=Xn(u,e.startState.selection),new Q(c==0?r.rest:u,c==0?u:r.rest)}let o=e.annotation(Lo);if((o=="full"||o=="before")&&(t=t.isolate()),e.annotation(_e.addToHistory)===!1)return e.changes.empty?t:t.addMapping(e.changes.desc);let i=R.fromTransaction(e),l=e.annotation(_e.time),s=e.annotation(_e.userEvent);return i?t=t.addChanges(i,l,s,n,e):e.selection&&(t=t.addSelection(e.startState.selection,l,s,n.newGroupDelay)),(o=="full"||o=="after")&&(t=t.isolate()),t},toJSON(t){return{done:t.done.map(e=>e.toJSON()),undone:t.undone.map(e=>e.toJSON())}},fromJSON(t){return new Q(t.done.map(R.fromJSON),t.undone.map(R.fromJSON))}});function Ft(t={}){return[jn,Jn.of(t),y.domEventHandlers({beforeinput(e,n){let r=e.inputType=="historyUndo"?Yn:e.inputType=="historyRedo"?wt:null;return r?(e.preventDefault(),r(n)):!1}})]}function je(t,e){return function({state:n,dispatch:r}){if(!e&&n.readOnly)return!1;let o=n.field(jn,!1);if(!o)return!1;let i=o.pop(t,n,e);return i?(r(i),!0):!1}}var Yn=je(0,!1),wt=je(1,!1),Do=je(0,!0),wo=je(1,!0);var R=class t{constructor(e,n,r,o,i){this.changes=e,this.effects=n,this.mapped=r,this.startSelection=o,this.selectionsAfter=i}setSelAfter(e){return new t(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,n,r;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(n=this.mapped)===null||n===void 0?void 0:n.toJSON(),startSelection:(r=this.startSelection)===null||r===void 0?void 0:r.toJSON(),selectionsAfter:this.selectionsAfter.map(o=>o.toJSON())}}static fromJSON(e){return new t(e.changes&&hn.fromJSON(e.changes),[],e.mapped&&fn.fromJSON(e.mapped),e.startSelection&&m.fromJSON(e.startSelection),e.selectionsAfter.map(m.fromJSON))}static fromTransaction(e,n){let r=E;for(let o of e.startState.facet(Bo)){let i=o(e);i.length&&(r=r.concat(i))}return!r.length&&e.changes.empty?null:new t(e.changes.invert(e.startState.doc),r,void 0,n||e.startState.selection,E)}static selection(e){return new t(void 0,E,void 0,void 0,e)}};function Je(t,e,n,r){let o=e+1>n+20?e-n-1:0,i=t.slice(o,e);return i.push(r),i}function To(t,e){let n=[],r=!1;return t.iterChangedRanges((o,i)=>n.push(o,i)),e.iterChangedRanges((o,i,l,s)=>{for(let a=0;a<n.length;){let c=n[a++],u=n[a++];s>=c&&l<=u&&(r=!0)}}),r}function Eo(t,e){return t.ranges.length==e.ranges.length&&t.ranges.filter((n,r)=>n.empty!=e.ranges[r].empty).length===0}function Zn(t,e){return t.length?e.length?t.concat(e):t:e}var E=[],Oo=200;function Xn(t,e){if(t.length){let n=t[t.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-Oo));return r.length&&r[r.length-1].eq(e)?t:(r.push(e),Je(t,t.length-1,1e9,n.setSelAfter(r)))}else return[R.selection([e])]}function Ro(t){let e=t[t.length-1],n=t.slice();return n[t.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),n}function Bt(t,e){if(!t.length)return t;let n=t.length,r=E;for(;n;){let o=Fo(t[n-1],e,r);if(o.changes&&!o.changes.empty||o.effects.length){let i=t.slice(0,n);return i[n-1]=o,i}else e=o.mapped,n--,r=o.selectionsAfter}return r.length?[R.selection(r)]:E}function Fo(t,e,n){let r=Zn(t.selectionsAfter.length?t.selectionsAfter.map(s=>s.map(e)):E,n);if(!t.changes)return R.selection(r);let o=t.changes.map(e),i=e.mapDesc(t.changes,!0),l=t.mapped?t.mapped.composeDesc(i):i;return new R(o,L.mapEffects(t.effects,e),l,t.startSelection.map(i),r)}var Io=/^(input\.type|delete)($|\.)/,Q=class t{constructor(e,n,r=0,o=void 0){this.done=e,this.undone=n,this.prevTime=r,this.prevUserEvent=o}isolate(){return this.prevTime?new t(this.done,this.undone):this}addChanges(e,n,r,o,i){let l=this.done,s=l[l.length-1];return s&&s.changes&&!s.changes.empty&&e.changes&&(!r||Io.test(r))&&(!s.selectionsAfter.length&&n-this.prevTime<o.newGroupDelay&&o.joinToEvent(i,To(s.changes,e.changes))||r=="input.type.compose")?l=Je(l,l.length-1,o.minDepth,new R(e.changes.compose(s.changes),Zn(L.mapEffects(e.effects,s.changes),s.effects),s.mapped,s.startSelection,E)):l=Je(l,l.length,o.minDepth,e),new t(l,E,n,r)}addSelection(e,n,r,o){let i=this.done.length?this.done[this.done.length-1].selectionsAfter:E;return i.length>0&&n-this.prevTime<o&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&Eo(i[i.length-1],e)?this:new t(Xn(this.done,e),this.undone,n,r)}addMapping(e){return new t(Bt(this.done,e),Bt(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,n,r){let o=e==0?this.done:this.undone;if(o.length==0)return null;let i=o[o.length-1],l=i.selectionsAfter[0]||(i.startSelection?i.startSelection.map(i.changes.invertedDesc,1):n.selection);if(r&&i.selectionsAfter.length)return n.update({selection:i.selectionsAfter[i.selectionsAfter.length-1],annotations:Dt.of({side:e,rest:Ro(o),selection:l}),userEvent:e==0?"select.undo":"select.redo",scrollIntoView:!0});if(i.changes){let s=o.length==1?E:o.slice(0,o.length-1);return i.mapped&&(s=Bt(s,i.mapped)),n.update({changes:i.changes,selection:i.startSelection,effects:i.effects,annotations:Dt.of({side:e,rest:s,selection:l}),filter:!1,userEvent:e==0?"undo":"redo",scrollIntoView:!0})}else return null}};Q.empty=new Q(E,E);var It=[{key:"Mod-z",run:Yn,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:wt,preventDefault:!0},{linux:"Ctrl-Shift-z",run:wt,preventDefault:!0},{key:"Mod-u",run:Do,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:wo,preventDefault:!0}];function re(t,e){return m.create(t.ranges.map(e),t.mainIndex)}function F(t,e){return t.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function I({state:t,dispatch:e},n){let r=re(t.selection,n);return r.eq(t.selection,!0)?!1:(e(F(t,r)),!0)}function Ye(t,e){return m.cursor(e?t.to:t.from)}function Qn(t,e){return I(t,n=>n.empty?t.moveByChar(n,e):Ye(n,e))}function M(t){return t.textDirectionAt(t.state.selection.main.head)==gn.LTR}var er=t=>Qn(t,!M(t)),tr=t=>Qn(t,M(t));function nr(t,e){return I(t,n=>n.empty?t.moveByGroup(n,e):Ye(n,e))}var Wo=t=>nr(t,!M(t)),Po=t=>nr(t,M(t));var is=typeof Intl<"u"&&Intl.Segmenter?new Intl.Segmenter(void 0,{granularity:"word"}):null;function No(t,e,n){if(e.type.prop(n))return!0;let r=e.to-e.from;return r&&(r>2||/[^\s,.;:]/.test(t.sliceDoc(e.from,e.to)))||e.firstChild}function Ze(t,e,n){let r=qe(t).resolveInner(e.head),o=n?Ne.closedBy:Ne.openedBy;for(let a=e.head;;){let c=n?r.childAfter(a):r.childBefore(a);if(!c)break;No(t,c,o)?r=c:a=n?c.to:c.from}let i=r.type.prop(o),l,s;return i&&(l=n?X(t,r.from,1):X(t,r.to,-1))&&l.matched?s=n?l.end.to:l.end.from:s=n?r.to:r.from,m.cursor(s,n?-1:1)}var _o=t=>I(t,e=>Ze(t.state,e,!M(t))),$o=t=>I(t,e=>Ze(t.state,e,M(t)));function rr(t,e){return I(t,n=>{if(!n.empty)return Ye(n,e);let r=t.moveVertically(n,e);return r.head!=n.head?r:t.moveToLineBoundary(n,e)})}var or=t=>rr(t,!1),ir=t=>rr(t,!0);function lr(t){let e=t.scrollDOM.clientHeight<t.scrollDOM.scrollHeight-2,n=0,r=0,o;if(e){for(let i of t.state.facet(y.scrollMargins)){let l=i(t);l?.top&&(n=Math.max(l?.top,n)),l?.bottom&&(r=Math.max(l?.bottom,r))}o=t.scrollDOM.clientHeight-n-r}else o=(t.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:n,marginBottom:r,selfScroll:e,height:Math.max(t.defaultLineHeight,o-5)}}function sr(t,e){let n=lr(t),{state:r}=t,o=re(r.selection,l=>l.empty?t.moveVertically(l,e,n.height):Ye(l,e));if(o.eq(r.selection))return!1;let i;if(n.selfScroll){let l=t.coordsAtPos(r.selection.main.head),s=t.scrollDOM.getBoundingClientRect(),a=s.top+n.marginTop,c=s.bottom-n.marginBottom;l&&l.top>a&&l.bottom<c&&(i=y.scrollIntoView(o.main.head,{y:"start",yMargin:l.top-a}))}return t.dispatch(F(r,o),{effects:i}),!0}var _n=t=>sr(t,!1),Tt=t=>sr(t,!0);function V(t,e,n){let r=t.lineBlockAt(e.head),o=t.moveToLineBoundary(e,n);if(o.head==e.head&&o.head!=(n?r.to:r.from)&&(o=t.moveToLineBoundary(e,n,!1)),!n&&o.head==r.from&&r.length){let i=/^\s*/.exec(t.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;i&&e.head!=r.from+i&&(o=m.cursor(r.from+i))}return o}var Vo=t=>I(t,e=>V(t,e,!0)),Ho=t=>I(t,e=>V(t,e,!1)),Go=t=>I(t,e=>V(t,e,!M(t))),qo=t=>I(t,e=>V(t,e,M(t))),Uo=t=>I(t,e=>t.moveToLineBoundary(e,!1,!1)),Ko=t=>I(t,e=>t.moveToLineBoundary(e,!0,!1));function zo(t,e,n){let r=!1,o=re(t.selection,i=>{let l=X(t,i.head,-1)||X(t,i.head,1)||i.head>0&&X(t,i.head-1,1)||i.head<t.doc.length&&X(t,i.head+1,-1);if(!l||!l.end)return i;r=!0;let s=l.start.from==i.head?l.end.to:l.end.from;return n?m.range(i.anchor,s):m.cursor(s)});return r?(e(F(t,o)),!0):!1}var Jo=({state:t,dispatch:e})=>zo(t,e,!1);function O(t,e,n){let r=re(t.state.selection,o=>{o.undirectional&&o.head>=o.anchor!=e&&(o=m.range(o.head,o.anchor));let i=n(o);return m.range(o.anchor,i.head,i.goalColumn,i.bidiLevel||void 0,i.assoc)});return r.eq(t.state.selection)?!1:(t.dispatch(F(t.state,r)),!0)}function ar(t,e){return O(t,e,n=>t.moveByChar(n,e))}var cr=t=>ar(t,!M(t)),ur=t=>ar(t,M(t));function fr(t,e){return O(t,e,n=>t.moveByGroup(n,e))}var jo=t=>fr(t,!M(t)),Yo=t=>fr(t,M(t));var Zo=t=>{let e=!M(t);return O(t,e,n=>Ze(t.state,n,e))},Xo=t=>{let e=M(t);return O(t,e,n=>Ze(t.state,n,e))};function hr(t,e){return O(t,e,n=>t.moveVertically(n,e))}var dr=t=>hr(t,!1),mr=t=>hr(t,!0);function gr(t,e){return O(t,e,n=>t.moveVertically(n,e,lr(t).height))}var $n=t=>gr(t,!1),Vn=t=>gr(t,!0),Qo=t=>O(t,!0,e=>V(t,e,!0)),ei=t=>O(t,!1,e=>V(t,e,!1)),ti=t=>{let e=!M(t);return O(t,e,n=>V(t,n,e))},ni=t=>{let e=M(t);return O(t,e,n=>V(t,n,e))},ri=t=>O(t,!1,e=>m.cursor(t.lineBlockAt(e.head).from)),oi=t=>O(t,!0,e=>m.cursor(t.lineBlockAt(e.head).to)),Hn=({state:t,dispatch:e})=>(e(F(t,{anchor:0})),!0),Gn=({state:t,dispatch:e})=>(e(F(t,{anchor:t.doc.length})),!0),qn=({state:t,dispatch:e})=>(e(F(t,{anchor:t.selection.main.anchor,head:0})),!0),Un=({state:t,dispatch:e})=>(e(F(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0),ii=({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0),li=({state:t,dispatch:e})=>{let n=Xe(t).map(({from:r,to:o})=>m.undirectionalRange(r,Math.min(o+1,t.doc.length)));return e(t.update({selection:m.create(n),userEvent:"select"})),!0},si=({state:t,dispatch:e})=>{let n=re(t.selection,r=>{let o=qe(t),i=o.resolveStack(r.from,1);if(r.empty){let l=o.resolveStack(r.from,-1);l.node.from>=i.node.from&&l.node.to<=i.node.to&&(i=l)}for(let l=i;l;l=l.next){let{node:s}=l;if((s.from<r.from&&s.to>=r.to||s.to>r.to&&s.from<=r.from)&&l.next)return m.undirectionalRange(s.from,s.to)}return r});return n.eq(t.selection)?!1:(e(F(t,n)),!0)};function pr(t,e){let{state:n}=t,r=n.selection,o=n.selection.ranges.slice();for(let i of n.selection.ranges){let l=n.doc.lineAt(i.head);if(e?l.to<t.state.doc.length:l.from>0)for(let s=i;;){let a=t.moveVertically(s,e);if(a.head<l.from||a.head>l.to){o.some(c=>c.head==a.head)||o.push(a);break}else{if(a.head==s.head)break;s=a}}}return o.length==r.ranges.length?!1:(t.dispatch(F(n,m.create(o,o.length-1))),!0)}var ai=t=>pr(t,!1),ci=t=>pr(t,!0),ui=({state:t,dispatch:e})=>{let n=t.selection,r=null;return n.ranges.length>1?r=m.create([n.main]):n.main.empty||(r=m.create([m.cursor(n.main.head)])),r?(e(F(t,r)),!0):!1};function ye(t,e){if(t.state.readOnly)return!1;let n="delete.selection",{state:r}=t,o=r.changeByRange(i=>{let{from:l,to:s}=i;if(l==s){let a=e(i);a<l?(n="delete.backward",a=ze(t,a,!1)):a>l&&(n="delete.forward",a=ze(t,a,!0)),l=Math.min(l,a),s=Math.max(s,a)}else l=ze(t,l,!1),s=ze(t,s,!0);return l==s?{range:i}:{changes:{from:l,to:s},range:m.cursor(l,l<i.head?-1:1)}});return o.changes.empty?!1:(t.dispatch(r.update(o,{scrollIntoView:!0,userEvent:n,effects:n=="delete.selection"?y.announce.of(r.phrase("Selection deleted")):void 0})),!0)}function ze(t,e,n){if(t instanceof y)for(let r of t.state.facet(y.atomicRanges).map(o=>o(t)))r.between(e,e,(o,i)=>{o<e&&i>e&&(e=n?i:o)});return e}var yr=(t,e,n)=>ye(t,r=>{let o=r.from,{state:i}=t,l=i.doc.lineAt(o),s,a;if(n&&!e&&o>l.from&&o<l.from+200&&!/[^ \t]/.test(s=l.text.slice(0,o-l.from))){if(s[s.length-1]==" ")return o-1;let c=Ve(s,i.tabSize),u=c%Ke(i)||Ke(i);for(let f=0;f<u&&s[s.length-1-f]==" ";f++)o--;a=o}else a=N(l.text,o-l.from,e,e)+l.from,a==o&&l.number!=(e?i.doc.lines:1)?a+=e?1:-1:!e&&/[\ufe00-\ufe0f]/.test(l.text.slice(a-l.from,o-l.from))&&(a=N(l.text,a-l.from,!1,!1)+l.from);return a}),Et=t=>yr(t,!1,!0);var xr=t=>yr(t,!0,!1),kr=(t,e)=>ye(t,n=>{let r=n.head,{state:o}=t,i=o.doc.lineAt(r),l=o.charCategorizer(r);for(let s=null;;){if(r==(e?i.to:i.from)){r==n.head&&i.number!=(e?o.doc.lines:1)&&(r+=e?1:-1);break}let a=N(i.text,r-i.from,e)+i.from,c=i.text.slice(Math.min(r,a)-i.from,Math.max(r,a)-i.from),u=l(c);if(s!=null&&u!=s)break;(c!=" "||r!=n.head)&&(s=u),r=a}return r}),Sr=t=>kr(t,!1),fi=t=>kr(t,!0);var hi=t=>ye(t,e=>{let n=t.lineBlockAt(e.head).to;return e.head<n?n:Math.min(t.state.doc.length,e.head+1)});var di=t=>ye(t,e=>{let n=t.moveToLineBoundary(e,!1).head;return e.head>n?n:Math.max(0,e.head-1)}),mi=t=>ye(t,e=>{let n=t.moveToLineBoundary(e,!0).head;return e.head<n?n:Math.min(t.state.doc.length,e.head+1)});var gi=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=t.changeByRange(r=>({changes:{from:r.from,to:r.to,insert:bt.of(["",""])},range:m.cursor(r.from)}));return e(t.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},pi=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=t.changeByRange(r=>{if(!r.empty||r.from==0||r.from==t.doc.length)return{range:r};let o=r.from,i=t.doc.lineAt(o),l=o==i.from?o-1:N(i.text,o-i.from,!1)+i.from,s=o==i.to?o+1:N(i.text,o-i.from,!0)+i.from;return{changes:{from:l,to:s,insert:t.doc.slice(o,s).append(t.doc.slice(l,o))},range:m.cursor(s)}});return n.changes.empty?!1:(e(t.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function Xe(t){let e=[],n=-1;for(let r of t.selection.ranges){let o=t.doc.lineAt(r.from),i=t.doc.lineAt(r.to);if(!r.empty&&r.to==i.from&&(i=t.doc.lineAt(r.to-1)),n>=o.number){let l=e[e.length-1];l.to=i.to,l.ranges.push(r)}else e.push({from:o.from,to:i.to,ranges:[r]});n=i.number+1}return e}function br(t,e,n){if(t.readOnly)return!1;let r=[],o=[];for(let i of Xe(t)){if(n?i.to==t.doc.length:i.from==0)continue;let l=t.doc.lineAt(n?i.to+1:i.from-1),s=l.length+1;if(n){r.push({from:i.to,to:l.to},{from:i.from,insert:l.text+t.lineBreak});for(let a of i.ranges)o.push(m.range(Math.min(t.doc.length,a.anchor+s),Math.min(t.doc.length,a.head+s)))}else{r.push({from:l.from,to:i.from},{from:i.to,insert:t.lineBreak+l.text});for(let a of i.ranges)o.push(m.range(a.anchor-s,a.head-s))}}return r.length?(e(t.update({changes:r,scrollIntoView:!0,selection:m.create(o,t.selection.mainIndex),userEvent:"move.line"})),!0):!1}var yi=({state:t,dispatch:e})=>br(t,e,!1),xi=({state:t,dispatch:e})=>br(t,e,!0);function vr(t,e,n){if(t.readOnly)return!1;let r=[];for(let i of Xe(t))n?r.push({from:i.from,insert:t.doc.slice(i.from,i.to)+t.lineBreak}):r.push({from:i.to,insert:t.lineBreak+t.doc.slice(i.from,i.to)});let o=t.changes(r);return e(t.update({changes:o,selection:t.selection.map(o,n?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}var ki=({state:t,dispatch:e})=>vr(t,e,!1),Si=({state:t,dispatch:e})=>vr(t,e,!0),bi=t=>{if(t.state.readOnly)return!1;let{state:e}=t,n=e.changes(Xe(e).map(({from:o,to:i})=>(o>0?o--:i<e.doc.length&&i++,{from:o,to:i}))),r=re(e.selection,o=>{let i;if(t.lineWrapping){let l=t.lineBlockAt(o.head),s=t.coordsAtPos(o.head,o.assoc||1);s&&(i=l.bottom+t.documentTop-s.bottom+t.defaultLineHeight/2)}return t.moveVertically(o,!0,i)}).map(n);return t.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0};function vi(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let n=qe(t).resolveInner(e),r=n.childBefore(e),o=n.childAfter(e),i;return r&&o&&r.to<=e&&o.from>=e&&(i=r.type.prop(Ne.closedBy))&&i.indexOf(o.name)>-1&&t.doc.lineAt(r.to).from==t.doc.lineAt(o.from).from&&!/\S/.test(t.sliceDoc(r.to,o.from))?{from:r.to,to:o.from}:null}var Kn=Cr(!1),Ci=Cr(!0);function Cr(t){return({state:e,dispatch:n})=>{if(e.readOnly)return!1;let r=e.changeByRange(o=>{let{from:i,to:l}=o,s=e.doc.lineAt(i),a=!t&&i==l&&vi(e,i);t&&(i=l=(l<=s.to?s:e.doc.lineAt(l)).to);let c=new At(e,{simulateBreak:i,simulateDoubleBreak:!!a}),u=Mt(c,i);for(u==null&&(u=Ve(/^\s*/.exec(e.doc.lineAt(i).text)[0],e.tabSize));l<s.to&&/\s/.test(s.text[l-s.from]);)l++;a?{from:i,to:l}=a:i>s.from&&i<s.from+100&&!/\S/.test(s.text.slice(0,i))&&(i=s.from);let f=["",me(e,u)];return a&&f.push(me(e,c.lineIndent(s.from,-1))),{changes:{from:i,to:l,insert:bt.of(f)},range:m.cursor(i+1+f[1].length)}});return n(e.update(r,{scrollIntoView:!0,userEvent:"input"})),!0}}function Wt(t,e){let n=-1;return t.changeByRange(r=>{let o=[];for(let l=r.from;l<=r.to;){let s=t.doc.lineAt(l);s.number>n&&(r.empty||r.to>s.from)&&(e(s,o,r),n=s.number),l=s.to+1}let i=t.changes(o);return{changes:o,range:m.range(i.mapPos(r.anchor,1),i.mapPos(r.head,1))}})}var Mi=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=Object.create(null),r=new At(t,{overrideIndentation:i=>{let l=n[i];return l??-1}}),o=Wt(t,(i,l,s)=>{let a=Mt(r,i.from);if(a==null)return;/\S/.test(i.text)||(a=0);let c=/^\s*/.exec(i.text)[0],u=me(t,a);(c!=u||s.from<i.from+c.length)&&(n[i.from]=a,l.push({from:i.from,to:i.from+c.length,insert:u}))});return o.changes.empty||e(t.update(o,{userEvent:"indent"})),!0},Mr=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(Wt(t,(n,r)=>{r.push({from:n.from,insert:t.facet(Ue)})}),{userEvent:"input.indent"})),!0),Ar=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(Wt(t,(n,r)=>{let o=/^\s*/.exec(n.text)[0];if(!o)return;let i=Ve(o,t.tabSize),l=0,s=me(t,Math.max(0,i-Ke(t)));for(;l<o.length&&l<s.length&&o.charCodeAt(l)==s.charCodeAt(l);)l++;r.push({from:n.from+l,to:n.from+o.length,insert:s.slice(l)})}),{userEvent:"delete.dedent"})),!0),Ai=t=>(t.setTabFocusMode(),!0);var Li=[{key:"Ctrl-b",run:er,shift:cr,preventDefault:!0},{key:"Ctrl-f",run:tr,shift:ur},{key:"Ctrl-p",run:or,shift:dr},{key:"Ctrl-n",run:ir,shift:mr},{key:"Ctrl-a",run:Uo,shift:ri},{key:"Ctrl-e",run:Ko,shift:oi},{key:"Ctrl-d",run:xr},{key:"Ctrl-h",run:Et},{key:"Ctrl-k",run:hi},{key:"Ctrl-Alt-h",run:Sr},{key:"Ctrl-o",run:gi},{key:"Ctrl-t",run:pi},{key:"Ctrl-v",run:Tt}],Bi=[{key:"ArrowLeft",run:er,shift:cr,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:Wo,shift:jo,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:Go,shift:ti,preventDefault:!0},{key:"ArrowRight",run:tr,shift:ur,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:Po,shift:Yo,preventDefault:!0},{mac:"Cmd-ArrowRight",run:qo,shift:ni,preventDefault:!0},{key:"ArrowUp",run:or,shift:dr,preventDefault:!0},{mac:"Cmd-ArrowUp",run:Hn,shift:qn},{mac:"Ctrl-ArrowUp",run:_n,shift:$n},{key:"ArrowDown",run:ir,shift:mr,preventDefault:!0},{mac:"Cmd-ArrowDown",run:Gn,shift:Un},{mac:"Ctrl-ArrowDown",run:Tt,shift:Vn},{key:"PageUp",run:_n,shift:$n},{key:"PageDown",run:Tt,shift:Vn},{key:"Home",run:Ho,shift:ei,preventDefault:!0},{key:"Mod-Home",run:Hn,shift:qn},{key:"End",run:Vo,shift:Qo,preventDefault:!0},{key:"Mod-End",run:Gn,shift:Un},{key:"Enter",run:Kn,shift:Kn},{key:"Mod-a",run:ii},{key:"Backspace",run:Et,shift:Et,preventDefault:!0},{key:"Delete",run:xr,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:Sr,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:fi,preventDefault:!0},{mac:"Mod-Backspace",run:di,preventDefault:!0},{mac:"Mod-Delete",run:mi,preventDefault:!0}].concat(Li.map(t=>({mac:t.key,run:t.run,shift:t.shift}))),Pt=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:_o,shift:Zo},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:$o,shift:Xo},{key:"Alt-ArrowUp",run:yi},{key:"Shift-Alt-ArrowUp",run:ki},{key:"Alt-ArrowDown",run:xi},{key:"Shift-Alt-ArrowDown",run:Si},{key:"Mod-Alt-ArrowUp",run:ai},{key:"Mod-Alt-ArrowDown",run:ci},{key:"Escape",run:ui},{key:"Mod-Enter",run:Ci},{key:"Alt-l",mac:"Ctrl-l",run:li},{key:"Mod-i",run:si,preventDefault:!0},{key:"Mod-[",run:Ar},{key:"Mod-]",run:Mr},{key:"Mod-Alt-\\",run:Mi},{key:"Shift-Mod-k",run:bi},{key:"Shift-Mod-\\",run:Jo},{key:"Mod-/",run:ko},{key:"Alt-A",mac:"Ctrl-A",run:bo},{key:"Ctrl-m",mac:"Shift-Alt-m",run:Ai}].concat(Bi),Lr={key:"Tab",run:Mr,shift:Ar};var Br=typeof String.prototype.normalize=="function"?t=>t.normalize("NFKD"):t=>t,G=class{constructor(e,n,r=0,o=e.length,i,l){this.test=l,this.value={from:0,to:0,precise:!1},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(r,o),this.bufferStart=r,this.normalize=i?s=>i(Br(s)):Br,this.query=this.normalize(n)}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 an(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 n=cn(e),r=this.bufferStart+this.bufferPos;this.bufferPos+=un(e);let o=this.normalize(n);if(o.length)for(let i=0,l=r,s=!0;;i++){let a=o.charCodeAt(i),c=this.match(a,l,s,this.bufferPos+this.bufferStart,i==o.length-1);if(c)return this.value=c,this;if(i==o.length-1)break;s&&i<n.length&&n.charCodeAt(i)==a?l++:s=!1}}}match(e,n,r,o,i){let l=null;for(let s=0;s<this.matches.length;){let a=this.matches[s],c=!1;this.query.charCodeAt(a.index)==e&&(a.index==this.query.length-1?l={from:a.from,to:o,precise:i&&a.precise}:(a.index++,c=!0)),c?s++:this.matches.splice(s,1)}return this.query.charCodeAt(0)==e&&(this.query.length==1?l={from:n,to:o,precise:r&&i}:this.matches.push({from:n,index:1,precise:r})),l&&this.test&&!this.test(l.from,l.to,this.buffer,this.bufferStart)&&(l=null),l}};typeof Symbol<"u"&&(G.prototype[Symbol.iterator]=function(){return this});var Tr={from:-1,to:-1,match:/.*/.exec(""),precise:!0},Gt="gm"+(/x/.unicode==null?"":"u"),tt=class{constructor(e,n,r,o=0,i=e.length){if(this.text=e,this.to=i,this.curLine="",this.done=!1,this.value=Tr,/\\[sWDnr]|\n|\r|\[\^/.test(n))return new rt(e,n,r,o,i);this.re=new RegExp(n,Gt+(r?.ignoreCase?"i":"")),this.test=r?.test,this.iter=e.iter();let l=e.lineAt(o);this.curLineStart=l.from,this.matchPos=ot(e,o),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 n=this.matchPos<=this.to&&this.re.exec(this.curLine);if(n){let r=this.curLineStart+n.index,o=r+n[0].length;if(this.matchPos=ot(this.text,o+(r==o?1:0)),r==this.curLineStart+this.curLine.length&&this.nextLine(),(r<o||r>this.value.to)&&(!this.test||this.test(r,o,n)))return this.value={from:r,to:o,precise:!0,match:n},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}}},Nt=new WeakMap,nt=class t{constructor(e,n){this.from=e,this.text=n}get to(){return this.from+this.text.length}static get(e,n,r){let o=Nt.get(e);if(!o||o.from>=r||o.to<=n){let s=new t(n,e.sliceString(n,r));return Nt.set(e,s),s}if(o.from==n&&o.to==r)return o;let{text:i,from:l}=o;return l>n&&(i=e.sliceString(n,l)+i,l=n),o.to<r&&(i+=e.sliceString(o.to,r)),Nt.set(e,new t(l,i)),new t(n,i.slice(n-l,r-l))}},rt=class{constructor(e,n,r,o,i){this.text=e,this.to=i,this.done=!1,this.value=Tr,this.matchPos=ot(e,o),this.re=new RegExp(n,Gt+(r?.ignoreCase?"i":"")),this.test=r?.test,this.flat=nt.get(e,o,this.chunkEnd(o+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,n=this.re.exec(this.flat.text);if(n&&!n[0]&&n.index==e&&(this.re.lastIndex=e+1,n=this.re.exec(this.flat.text)),n){let r=this.flat.from+n.index,o=r+n[0].length;if((this.flat.to>=this.to||n.index+n[0].length<=this.flat.text.length-10)&&(!this.test||this.test(r,o,n)))return this.value={from:r,to:o,precise:!0,match:n},this.matchPos=ot(this.text,o+(r==o?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=nt.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}};typeof Symbol<"u"&&(tt.prototype[Symbol.iterator]=rt.prototype[Symbol.iterator]=function(){return this});function Di(t){try{return new RegExp(t,Gt),!0}catch{return!1}}function ot(t,e){if(e>=t.length)return e;let n=t.lineAt(e),r;for(;e<n.to&&(r=n.text.charCodeAt(e-n.from))>=56320&&r<57344;)e++;return e}var wi=t=>{let e=An(t,"cm-goto-line");if(e){let l=e.dom.querySelector("input[type=text]");return l&&l.select(),!0}let{state:n}=t,r=String(n.doc.lineAt(t.state.selection.main.head).number),{close:o,result:i}=Mn(t,{class:"cm-goto-line",label:n.phrase("Go to line"),input:{type:"text",name:"line",value:r},focus:!0,submitLabel:n.phrase("go")});return i.then(l=>{let s=l&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(l.elements.line.value);if(!s){t.dispatch({effects:o});return}let a=n.doc.lineAt(n.selection.main.head),[,c,u,f,d]=s,x=f?+f.slice(1):0,g=u?+u:a.number;if(u&&d){let D=g/100;c&&(D=D*(c=="-"?-1:1)+a.number/n.doc.lines),g=Math.round(n.doc.lines*D)}else u&&c&&(g=g*(c=="-"?-1:1)+a.number);let p=n.doc.line(Math.max(1,Math.min(n.doc.lines,g))),S=m.cursor(p.from+Math.max(0,Math.min(x,p.length)));t.dispatch({effects:[o,y.scrollIntoView(S.from,{y:"center"})],selection:S})}),!0},Ti={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},Er=$.define({combine(t){return Z(t,Ti,{highlightWordAroundCursor:(e,n)=>e||n,minSelectionLength:Math.min,maxMatches:Math.min})}});function Or(t){let e=[Ii,Fi];return t&&e.push(Er.of(t)),e}var Ei=v.mark({class:"cm-selectionMatch"}),Oi=v.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function Dr(t,e,n,r){return(n==0||t(e.sliceDoc(n-1,n))!=B.Word)&&(r==e.doc.length||t(e.sliceDoc(r,r+1))!=B.Word)}function Ri(t,e,n,r){return t(e.sliceDoc(n,n+1))==B.Word&&t(e.sliceDoc(r-1,r))==B.Word}var Fi=He.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.selectionSet||t.docChanged||t.viewportChanged)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=t.state.facet(Er),{state:n}=t,r=n.selection;if(r.ranges.length>1)return v.none;let o=r.main,i,l=null;if(o.empty){if(!e.highlightWordAroundCursor)return v.none;let a=n.wordAt(o.head);if(!a)return v.none;l=n.charCategorizer(o.head),i=n.sliceDoc(a.from,a.to)}else{let a=o.to-o.from;if(a<e.minSelectionLength||a>200)return v.none;if(e.wholeWords){if(i=n.sliceDoc(o.from,o.to),l=n.charCategorizer(o.head),!(Dr(l,n,o.from,o.to)&&Ri(l,n,o.from,o.to)))return v.none}else if(i=n.sliceDoc(o.from,o.to),!i)return v.none}let s=[];for(let a of t.visibleRanges){let c=new G(n.doc,i,a.from,a.to);for(;!c.next().done;){let{from:u,to:f}=c.value;if((!l||Dr(l,n,u,f))&&(o.empty&&u<=o.from&&f>=o.to?s.push(Oi.range(u,f)):(u>=o.to||f<=o.from)&&s.push(Ei.range(u,f)),s.length>e.maxMatches))return v.none}}return v.set(s)}},{decorations:t=>t.decorations}),Ii=y.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),Wi=({state:t,dispatch:e})=>{let{selection:n}=t,r=m.create(n.ranges.map(o=>t.wordAt(o.head)||m.cursor(o.head)),n.mainIndex);return r.eq(n)?!1:(e(t.update({selection:r})),!0)};function Pi(t,e){let{main:n,ranges:r}=t.selection,o=t.wordAt(n.head),i=o&&o.from==n.from&&o.to==n.to;for(let l=!1,s=new G(t.doc,e,r[r.length-1].to);;)if(s.next(),s.done){if(l)return null;s=new G(t.doc,e,0,Math.max(0,r[r.length-1].from-1)),l=!0}else{if(l&&r.some(a=>a.from==s.value.from))continue;if(i){let a=t.wordAt(s.value.from);if(!a||a.from!=s.value.from||a.to!=s.value.to)continue}return s.value}}var Ni=({state:t,dispatch:e})=>{let{ranges:n}=t.selection;if(n.some(i=>i.from===i.to))return Wi({state:t,dispatch:e});let r=t.sliceDoc(n[0].from,n[0].to);if(t.selection.ranges.some(i=>t.sliceDoc(i.from,i.to)!=r))return!1;let o=Pi(t,r);return o?(e(t.update({selection:t.selection.addRange(m.range(o.from,o.to),!1),effects:y.scrollIntoView(o.to)})),!0):!1},le=$.define({combine(t){return Z(t,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new Ht(e),scrollToMatch:e=>y.scrollIntoView(e)})}});var it=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||Di(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord,this.test=e.test}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(n,r)=>r=="n"?`
|
|
1
|
+
import{d as Rn,e as Fn,f as In,g as Wn}from"./chunk-TFWQIFOZ.js";import{a as Pn}from"./chunk-3JEV5GFZ.js";import{$ as Fl,A as Ml,Aa as Kl,B as Al,Ba as zl,C as L,Ca as xo,D as _e,Da as Jl,E as B,Ea as jl,F as _,Fa as Yl,G as Z,Ga as Ln,H as Ll,Ha as Bn,I as Bl,Ia as Zl,J as mo,Ja as Xl,K as $e,Ka as Ql,L as Ve,M as Dl,N as b,O as mn,Oa as qe,P as wl,Q as v,Qa as Ue,R as Tl,Ra as Ke,S as gn,Sa as me,T as El,Ta as Mt,U as go,Ua as At,V as He,W as Ol,X as Rl,Y as y,Z as he,Za as Dn,_ as pn,a as Ne,aa as Il,ab as wn,ba as vt,bb as Tn,ca as Wl,cb as En,da as yn,db as ge,ea as Pl,eb as Lt,fa as Ct,fb as On,ga as Nl,ha as xn,hb as X,ia as kn,j as h,ja as Sn,k as bt,ka as bn,l as Sl,la as _l,m as N,ma as po,n as an,na as vn,o as cn,oa as Cn,p as un,pa as $l,q as bl,qa as Vl,r as fn,ra as Hl,s as hn,sa as Gl,t as vl,ta as ql,u as m,ua as Ul,v as $,va as de,w as ne,wa as Ge,x as dn,xa as Mn,y as Cl,ya as An,z as fe,za as yo}from"./chunk-5A3ZKBRD.js";import"./chunk-6DHFEWGX.js";function Nn(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}import{useRef as gl,forwardRef as pl,useImperativeHandle as yl,useCallback as xl}from"react";import{useEffect as Me,useLayoutEffect as fl,useState as Ae}from"react";var ko=t=>{let{state:e}=t,n=e.doc.lineAt(e.selection.main.from),r=Rt(t.state,n.from);return r.line?So(t):r.block?vo(t):!1};function Ot(t,e){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let o=t(e,n);return o?(r(n.update(o)),!0):!1}}var So=Ot(Ao,0);var bo=Ot(zn,0);var vo=Ot((t,e)=>zn(t,e,Mo(e)),0);function Rt(t,e){let n=t.languageDataAt("commentTokens",e,1);return n.length?n[0]:{}}var pe=50;function Co(t,{open:e,close:n},r,o){let i=t.sliceDoc(r-pe,r),l=t.sliceDoc(o,o+pe),s=/\s*$/.exec(i)[0].length,a=/^\s*/.exec(l)[0].length,c=i.length-s;if(i.slice(c-e.length,c)==e&&l.slice(a,a+n.length)==n)return{open:{pos:r-s,margin:s&&1},close:{pos:o+a,margin:a&&1}};let u,f;o-r<=2*pe?u=f=t.sliceDoc(r,o):(u=t.sliceDoc(r,r+pe),f=t.sliceDoc(o-pe,o));let d=/^\s*/.exec(u)[0].length,x=/\s*$/.exec(f)[0].length,g=f.length-x-n.length;return u.slice(d,d+e.length)==e&&f.slice(g,g+n.length)==n?{open:{pos:r+d+e.length,margin:/\s/.test(u.charAt(d+e.length))?1:0},close:{pos:o-x-n.length,margin:/\s/.test(f.charAt(g-1))?1:0}}:null}function Mo(t){let e=[];for(let n of t.selection.ranges){let r=t.doc.lineAt(n.from),o=n.to<=r.to?r:t.doc.lineAt(n.to);o.from>r.from&&o.from==n.to&&(o=n.to==r.to+1?r:t.doc.lineAt(n.to-1));let i=e.length-1;i>=0&&e[i].to>r.from?e[i].to=o.to:e.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:o.to})}return e}function zn(t,e,n=e.selection.ranges){let r=n.map(i=>Rt(e,i.from).block);if(!r.every(i=>i))return null;let o=n.map((i,l)=>Co(e,r[l],i.from,i.to));if(t!=2&&!o.every(i=>i))return{changes:e.changes(n.map((i,l)=>o[l]?[]:[{from:i.from,insert:r[l].open+" "},{from:i.to,insert:" "+r[l].close}]))};if(t!=1&&o.some(i=>i)){let i=[];for(let l=0,s;l<o.length;l++)if(s=o[l]){let a=r[l],{open:c,close:u}=s;i.push({from:c.pos-a.open.length,to:c.pos+c.margin},{from:u.pos-u.margin,to:u.pos+a.close.length})}return{changes:i}}return null}function Ao(t,e,n=e.selection.ranges){let r=[],o=-1;e:for(let{from:i,to:l}of n){let s=r.length,a=1e9,c;for(let u=i;u<=l;){let f=e.doc.lineAt(u);if(c==null&&(c=Rt(e,f.from).line,!c))continue e;if(f.from>o&&(i==l||l>f.from)){o=f.from;let d=/^\s*/.exec(f.text)[0].length,x=d==f.length,g=f.text.slice(d,d+c.length)==c?d:-1;d<f.text.length&&d<a&&(a=d),r.push({line:f,comment:g,token:c,indent:d,empty:x,single:!1})}u=f.to+1}if(a<1e9)for(let u=s;u<r.length;u++)r[u].indent<r[u].line.text.length&&(r[u].indent=a);r.length==s+1&&(r[s].single=!0)}if(t!=2&&r.some(i=>i.comment<0&&(!i.empty||i.single))){let i=[];for(let{line:s,token:a,indent:c,empty:u,single:f}of r)(f||!u)&&i.push({from:s.from+c,insert:a+" "});let l=e.changes(i);return{changes:l,selection:e.selection.map(l,1)}}else if(t!=1&&r.some(i=>i.comment>=0)){let i=[];for(let{line:l,comment:s,token:a}of r)if(s>=0){let c=l.from+s,u=c+a.length;l.text[u-l.from]==" "&&u++,i.push({from:c,to:u})}return{changes:i}}return null}var Dt=fe.define(),Lo=fe.define(),Bo=$.define(),Jn=$.define({combine(t){return Z(t,{minDepth:100,newGroupDelay:500,joinToEvent:(e,n)=>n},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,n)=>(r,o)=>e(r,o)||n(r,o)})}}),jn=ne.define({create(){return Q.empty},update(t,e){let n=e.state.facet(Jn),r=e.annotation(Dt);if(r){let a=R.fromTransaction(e,r.selection),c=r.side,u=c==0?t.undone:t.done;return a?u=Je(u,u.length,n.minDepth,a):u=Xn(u,e.startState.selection),new Q(c==0?r.rest:u,c==0?u:r.rest)}let o=e.annotation(Lo);if((o=="full"||o=="before")&&(t=t.isolate()),e.annotation(_e.addToHistory)===!1)return e.changes.empty?t:t.addMapping(e.changes.desc);let i=R.fromTransaction(e),l=e.annotation(_e.time),s=e.annotation(_e.userEvent);return i?t=t.addChanges(i,l,s,n,e):e.selection&&(t=t.addSelection(e.startState.selection,l,s,n.newGroupDelay)),(o=="full"||o=="after")&&(t=t.isolate()),t},toJSON(t){return{done:t.done.map(e=>e.toJSON()),undone:t.undone.map(e=>e.toJSON())}},fromJSON(t){return new Q(t.done.map(R.fromJSON),t.undone.map(R.fromJSON))}});function Ft(t={}){return[jn,Jn.of(t),y.domEventHandlers({beforeinput(e,n){let r=e.inputType=="historyUndo"?Yn:e.inputType=="historyRedo"?wt:null;return r?(e.preventDefault(),r(n)):!1}})]}function je(t,e){return function({state:n,dispatch:r}){if(!e&&n.readOnly)return!1;let o=n.field(jn,!1);if(!o)return!1;let i=o.pop(t,n,e);return i?(r(i),!0):!1}}var Yn=je(0,!1),wt=je(1,!1),Do=je(0,!0),wo=je(1,!0);var R=class t{constructor(e,n,r,o,i){this.changes=e,this.effects=n,this.mapped=r,this.startSelection=o,this.selectionsAfter=i}setSelAfter(e){return new t(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,n,r;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(n=this.mapped)===null||n===void 0?void 0:n.toJSON(),startSelection:(r=this.startSelection)===null||r===void 0?void 0:r.toJSON(),selectionsAfter:this.selectionsAfter.map(o=>o.toJSON())}}static fromJSON(e){return new t(e.changes&&hn.fromJSON(e.changes),[],e.mapped&&fn.fromJSON(e.mapped),e.startSelection&&m.fromJSON(e.startSelection),e.selectionsAfter.map(m.fromJSON))}static fromTransaction(e,n){let r=E;for(let o of e.startState.facet(Bo)){let i=o(e);i.length&&(r=r.concat(i))}return!r.length&&e.changes.empty?null:new t(e.changes.invert(e.startState.doc),r,void 0,n||e.startState.selection,E)}static selection(e){return new t(void 0,E,void 0,void 0,e)}};function Je(t,e,n,r){let o=e+1>n+20?e-n-1:0,i=t.slice(o,e);return i.push(r),i}function To(t,e){let n=[],r=!1;return t.iterChangedRanges((o,i)=>n.push(o,i)),e.iterChangedRanges((o,i,l,s)=>{for(let a=0;a<n.length;){let c=n[a++],u=n[a++];s>=c&&l<=u&&(r=!0)}}),r}function Eo(t,e){return t.ranges.length==e.ranges.length&&t.ranges.filter((n,r)=>n.empty!=e.ranges[r].empty).length===0}function Zn(t,e){return t.length?e.length?t.concat(e):t:e}var E=[],Oo=200;function Xn(t,e){if(t.length){let n=t[t.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-Oo));return r.length&&r[r.length-1].eq(e)?t:(r.push(e),Je(t,t.length-1,1e9,n.setSelAfter(r)))}else return[R.selection([e])]}function Ro(t){let e=t[t.length-1],n=t.slice();return n[t.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),n}function Bt(t,e){if(!t.length)return t;let n=t.length,r=E;for(;n;){let o=Fo(t[n-1],e,r);if(o.changes&&!o.changes.empty||o.effects.length){let i=t.slice(0,n);return i[n-1]=o,i}else e=o.mapped,n--,r=o.selectionsAfter}return r.length?[R.selection(r)]:E}function Fo(t,e,n){let r=Zn(t.selectionsAfter.length?t.selectionsAfter.map(s=>s.map(e)):E,n);if(!t.changes)return R.selection(r);let o=t.changes.map(e),i=e.mapDesc(t.changes,!0),l=t.mapped?t.mapped.composeDesc(i):i;return new R(o,L.mapEffects(t.effects,e),l,t.startSelection.map(i),r)}var Io=/^(input\.type|delete)($|\.)/,Q=class t{constructor(e,n,r=0,o=void 0){this.done=e,this.undone=n,this.prevTime=r,this.prevUserEvent=o}isolate(){return this.prevTime?new t(this.done,this.undone):this}addChanges(e,n,r,o,i){let l=this.done,s=l[l.length-1];return s&&s.changes&&!s.changes.empty&&e.changes&&(!r||Io.test(r))&&(!s.selectionsAfter.length&&n-this.prevTime<o.newGroupDelay&&o.joinToEvent(i,To(s.changes,e.changes))||r=="input.type.compose")?l=Je(l,l.length-1,o.minDepth,new R(e.changes.compose(s.changes),Zn(L.mapEffects(e.effects,s.changes),s.effects),s.mapped,s.startSelection,E)):l=Je(l,l.length,o.minDepth,e),new t(l,E,n,r)}addSelection(e,n,r,o){let i=this.done.length?this.done[this.done.length-1].selectionsAfter:E;return i.length>0&&n-this.prevTime<o&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&Eo(i[i.length-1],e)?this:new t(Xn(this.done,e),this.undone,n,r)}addMapping(e){return new t(Bt(this.done,e),Bt(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,n,r){let o=e==0?this.done:this.undone;if(o.length==0)return null;let i=o[o.length-1],l=i.selectionsAfter[0]||(i.startSelection?i.startSelection.map(i.changes.invertedDesc,1):n.selection);if(r&&i.selectionsAfter.length)return n.update({selection:i.selectionsAfter[i.selectionsAfter.length-1],annotations:Dt.of({side:e,rest:Ro(o),selection:l}),userEvent:e==0?"select.undo":"select.redo",scrollIntoView:!0});if(i.changes){let s=o.length==1?E:o.slice(0,o.length-1);return i.mapped&&(s=Bt(s,i.mapped)),n.update({changes:i.changes,selection:i.startSelection,effects:i.effects,annotations:Dt.of({side:e,rest:s,selection:l}),filter:!1,userEvent:e==0?"undo":"redo",scrollIntoView:!0})}else return null}};Q.empty=new Q(E,E);var It=[{key:"Mod-z",run:Yn,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:wt,preventDefault:!0},{linux:"Ctrl-Shift-z",run:wt,preventDefault:!0},{key:"Mod-u",run:Do,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:wo,preventDefault:!0}];function re(t,e){return m.create(t.ranges.map(e),t.mainIndex)}function F(t,e){return t.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function I({state:t,dispatch:e},n){let r=re(t.selection,n);return r.eq(t.selection,!0)?!1:(e(F(t,r)),!0)}function Ye(t,e){return m.cursor(e?t.to:t.from)}function Qn(t,e){return I(t,n=>n.empty?t.moveByChar(n,e):Ye(n,e))}function M(t){return t.textDirectionAt(t.state.selection.main.head)==gn.LTR}var er=t=>Qn(t,!M(t)),tr=t=>Qn(t,M(t));function nr(t,e){return I(t,n=>n.empty?t.moveByGroup(n,e):Ye(n,e))}var Wo=t=>nr(t,!M(t)),Po=t=>nr(t,M(t));var is=typeof Intl<"u"&&Intl.Segmenter?new Intl.Segmenter(void 0,{granularity:"word"}):null;function No(t,e,n){if(e.type.prop(n))return!0;let r=e.to-e.from;return r&&(r>2||/[^\s,.;:]/.test(t.sliceDoc(e.from,e.to)))||e.firstChild}function Ze(t,e,n){let r=qe(t).resolveInner(e.head),o=n?Ne.closedBy:Ne.openedBy;for(let a=e.head;;){let c=n?r.childAfter(a):r.childBefore(a);if(!c)break;No(t,c,o)?r=c:a=n?c.to:c.from}let i=r.type.prop(o),l,s;return i&&(l=n?X(t,r.from,1):X(t,r.to,-1))&&l.matched?s=n?l.end.to:l.end.from:s=n?r.to:r.from,m.cursor(s,n?-1:1)}var _o=t=>I(t,e=>Ze(t.state,e,!M(t))),$o=t=>I(t,e=>Ze(t.state,e,M(t)));function rr(t,e){return I(t,n=>{if(!n.empty)return Ye(n,e);let r=t.moveVertically(n,e);return r.head!=n.head?r:t.moveToLineBoundary(n,e)})}var or=t=>rr(t,!1),ir=t=>rr(t,!0);function lr(t){let e=t.scrollDOM.clientHeight<t.scrollDOM.scrollHeight-2,n=0,r=0,o;if(e){for(let i of t.state.facet(y.scrollMargins)){let l=i(t);l?.top&&(n=Math.max(l?.top,n)),l?.bottom&&(r=Math.max(l?.bottom,r))}o=t.scrollDOM.clientHeight-n-r}else o=(t.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:n,marginBottom:r,selfScroll:e,height:Math.max(t.defaultLineHeight,o-5)}}function sr(t,e){let n=lr(t),{state:r}=t,o=re(r.selection,l=>l.empty?t.moveVertically(l,e,n.height):Ye(l,e));if(o.eq(r.selection))return!1;let i;if(n.selfScroll){let l=t.coordsAtPos(r.selection.main.head),s=t.scrollDOM.getBoundingClientRect(),a=s.top+n.marginTop,c=s.bottom-n.marginBottom;l&&l.top>a&&l.bottom<c&&(i=y.scrollIntoView(o.main.head,{y:"start",yMargin:l.top-a}))}return t.dispatch(F(r,o),{effects:i}),!0}var _n=t=>sr(t,!1),Tt=t=>sr(t,!0);function V(t,e,n){let r=t.lineBlockAt(e.head),o=t.moveToLineBoundary(e,n);if(o.head==e.head&&o.head!=(n?r.to:r.from)&&(o=t.moveToLineBoundary(e,n,!1)),!n&&o.head==r.from&&r.length){let i=/^\s*/.exec(t.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;i&&e.head!=r.from+i&&(o=m.cursor(r.from+i))}return o}var Vo=t=>I(t,e=>V(t,e,!0)),Ho=t=>I(t,e=>V(t,e,!1)),Go=t=>I(t,e=>V(t,e,!M(t))),qo=t=>I(t,e=>V(t,e,M(t))),Uo=t=>I(t,e=>t.moveToLineBoundary(e,!1,!1)),Ko=t=>I(t,e=>t.moveToLineBoundary(e,!0,!1));function zo(t,e,n){let r=!1,o=re(t.selection,i=>{let l=X(t,i.head,-1)||X(t,i.head,1)||i.head>0&&X(t,i.head-1,1)||i.head<t.doc.length&&X(t,i.head+1,-1);if(!l||!l.end)return i;r=!0;let s=l.start.from==i.head?l.end.to:l.end.from;return n?m.range(i.anchor,s):m.cursor(s)});return r?(e(F(t,o)),!0):!1}var Jo=({state:t,dispatch:e})=>zo(t,e,!1);function O(t,e,n){let r=re(t.state.selection,o=>{o.undirectional&&o.head>=o.anchor!=e&&(o=m.range(o.head,o.anchor));let i=n(o);return m.range(o.anchor,i.head,i.goalColumn,i.bidiLevel||void 0,i.assoc)});return r.eq(t.state.selection)?!1:(t.dispatch(F(t.state,r)),!0)}function ar(t,e){return O(t,e,n=>t.moveByChar(n,e))}var cr=t=>ar(t,!M(t)),ur=t=>ar(t,M(t));function fr(t,e){return O(t,e,n=>t.moveByGroup(n,e))}var jo=t=>fr(t,!M(t)),Yo=t=>fr(t,M(t));var Zo=t=>{let e=!M(t);return O(t,e,n=>Ze(t.state,n,e))},Xo=t=>{let e=M(t);return O(t,e,n=>Ze(t.state,n,e))};function hr(t,e){return O(t,e,n=>t.moveVertically(n,e))}var dr=t=>hr(t,!1),mr=t=>hr(t,!0);function gr(t,e){return O(t,e,n=>t.moveVertically(n,e,lr(t).height))}var $n=t=>gr(t,!1),Vn=t=>gr(t,!0),Qo=t=>O(t,!0,e=>V(t,e,!0)),ei=t=>O(t,!1,e=>V(t,e,!1)),ti=t=>{let e=!M(t);return O(t,e,n=>V(t,n,e))},ni=t=>{let e=M(t);return O(t,e,n=>V(t,n,e))},ri=t=>O(t,!1,e=>m.cursor(t.lineBlockAt(e.head).from)),oi=t=>O(t,!0,e=>m.cursor(t.lineBlockAt(e.head).to)),Hn=({state:t,dispatch:e})=>(e(F(t,{anchor:0})),!0),Gn=({state:t,dispatch:e})=>(e(F(t,{anchor:t.doc.length})),!0),qn=({state:t,dispatch:e})=>(e(F(t,{anchor:t.selection.main.anchor,head:0})),!0),Un=({state:t,dispatch:e})=>(e(F(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0),ii=({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0),li=({state:t,dispatch:e})=>{let n=Xe(t).map(({from:r,to:o})=>m.undirectionalRange(r,Math.min(o+1,t.doc.length)));return e(t.update({selection:m.create(n),userEvent:"select"})),!0},si=({state:t,dispatch:e})=>{let n=re(t.selection,r=>{let o=qe(t),i=o.resolveStack(r.from,1);if(r.empty){let l=o.resolveStack(r.from,-1);l.node.from>=i.node.from&&l.node.to<=i.node.to&&(i=l)}for(let l=i;l;l=l.next){let{node:s}=l;if((s.from<r.from&&s.to>=r.to||s.to>r.to&&s.from<=r.from)&&l.next)return m.undirectionalRange(s.from,s.to)}return r});return n.eq(t.selection)?!1:(e(F(t,n)),!0)};function pr(t,e){let{state:n}=t,r=n.selection,o=n.selection.ranges.slice();for(let i of n.selection.ranges){let l=n.doc.lineAt(i.head);if(e?l.to<t.state.doc.length:l.from>0)for(let s=i;;){let a=t.moveVertically(s,e);if(a.head<l.from||a.head>l.to){o.some(c=>c.head==a.head)||o.push(a);break}else{if(a.head==s.head)break;s=a}}}return o.length==r.ranges.length?!1:(t.dispatch(F(n,m.create(o,o.length-1))),!0)}var ai=t=>pr(t,!1),ci=t=>pr(t,!0),ui=({state:t,dispatch:e})=>{let n=t.selection,r=null;return n.ranges.length>1?r=m.create([n.main]):n.main.empty||(r=m.create([m.cursor(n.main.head)])),r?(e(F(t,r)),!0):!1};function ye(t,e){if(t.state.readOnly)return!1;let n="delete.selection",{state:r}=t,o=r.changeByRange(i=>{let{from:l,to:s}=i;if(l==s){let a=e(i);a<l?(n="delete.backward",a=ze(t,a,!1)):a>l&&(n="delete.forward",a=ze(t,a,!0)),l=Math.min(l,a),s=Math.max(s,a)}else l=ze(t,l,!1),s=ze(t,s,!0);return l==s?{range:i}:{changes:{from:l,to:s},range:m.cursor(l,l<i.head?-1:1)}});return o.changes.empty?!1:(t.dispatch(r.update(o,{scrollIntoView:!0,userEvent:n,effects:n=="delete.selection"?y.announce.of(r.phrase("Selection deleted")):void 0})),!0)}function ze(t,e,n){if(t instanceof y)for(let r of t.state.facet(y.atomicRanges).map(o=>o(t)))r.between(e,e,(o,i)=>{o<e&&i>e&&(e=n?i:o)});return e}var yr=(t,e,n)=>ye(t,r=>{let o=r.from,{state:i}=t,l=i.doc.lineAt(o),s,a;if(n&&!e&&o>l.from&&o<l.from+200&&!/[^ \t]/.test(s=l.text.slice(0,o-l.from))){if(s[s.length-1]==" ")return o-1;let c=Ve(s,i.tabSize),u=c%Ke(i)||Ke(i);for(let f=0;f<u&&s[s.length-1-f]==" ";f++)o--;a=o}else a=N(l.text,o-l.from,e,e)+l.from,a==o&&l.number!=(e?i.doc.lines:1)?a+=e?1:-1:!e&&/[\ufe00-\ufe0f]/.test(l.text.slice(a-l.from,o-l.from))&&(a=N(l.text,a-l.from,!1,!1)+l.from);return a}),Et=t=>yr(t,!1,!0);var xr=t=>yr(t,!0,!1),kr=(t,e)=>ye(t,n=>{let r=n.head,{state:o}=t,i=o.doc.lineAt(r),l=o.charCategorizer(r);for(let s=null;;){if(r==(e?i.to:i.from)){r==n.head&&i.number!=(e?o.doc.lines:1)&&(r+=e?1:-1);break}let a=N(i.text,r-i.from,e)+i.from,c=i.text.slice(Math.min(r,a)-i.from,Math.max(r,a)-i.from),u=l(c);if(s!=null&&u!=s)break;(c!=" "||r!=n.head)&&(s=u),r=a}return r}),Sr=t=>kr(t,!1),fi=t=>kr(t,!0);var hi=t=>ye(t,e=>{let n=t.lineBlockAt(e.head).to;return e.head<n?n:Math.min(t.state.doc.length,e.head+1)});var di=t=>ye(t,e=>{let n=t.moveToLineBoundary(e,!1).head;return e.head>n?n:Math.max(0,e.head-1)}),mi=t=>ye(t,e=>{let n=t.moveToLineBoundary(e,!0).head;return e.head<n?n:Math.min(t.state.doc.length,e.head+1)});var gi=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=t.changeByRange(r=>({changes:{from:r.from,to:r.to,insert:bt.of(["",""])},range:m.cursor(r.from)}));return e(t.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},pi=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=t.changeByRange(r=>{if(!r.empty||r.from==0||r.from==t.doc.length)return{range:r};let o=r.from,i=t.doc.lineAt(o),l=o==i.from?o-1:N(i.text,o-i.from,!1)+i.from,s=o==i.to?o+1:N(i.text,o-i.from,!0)+i.from;return{changes:{from:l,to:s,insert:t.doc.slice(o,s).append(t.doc.slice(l,o))},range:m.cursor(s)}});return n.changes.empty?!1:(e(t.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function Xe(t){let e=[],n=-1;for(let r of t.selection.ranges){let o=t.doc.lineAt(r.from),i=t.doc.lineAt(r.to);if(!r.empty&&r.to==i.from&&(i=t.doc.lineAt(r.to-1)),n>=o.number){let l=e[e.length-1];l.to=i.to,l.ranges.push(r)}else e.push({from:o.from,to:i.to,ranges:[r]});n=i.number+1}return e}function br(t,e,n){if(t.readOnly)return!1;let r=[],o=[];for(let i of Xe(t)){if(n?i.to==t.doc.length:i.from==0)continue;let l=t.doc.lineAt(n?i.to+1:i.from-1),s=l.length+1;if(n){r.push({from:i.to,to:l.to},{from:i.from,insert:l.text+t.lineBreak});for(let a of i.ranges)o.push(m.range(Math.min(t.doc.length,a.anchor+s),Math.min(t.doc.length,a.head+s)))}else{r.push({from:l.from,to:i.from},{from:i.to,insert:t.lineBreak+l.text});for(let a of i.ranges)o.push(m.range(a.anchor-s,a.head-s))}}return r.length?(e(t.update({changes:r,scrollIntoView:!0,selection:m.create(o,t.selection.mainIndex),userEvent:"move.line"})),!0):!1}var yi=({state:t,dispatch:e})=>br(t,e,!1),xi=({state:t,dispatch:e})=>br(t,e,!0);function vr(t,e,n){if(t.readOnly)return!1;let r=[];for(let i of Xe(t))n?r.push({from:i.from,insert:t.doc.slice(i.from,i.to)+t.lineBreak}):r.push({from:i.to,insert:t.lineBreak+t.doc.slice(i.from,i.to)});let o=t.changes(r);return e(t.update({changes:o,selection:t.selection.map(o,n?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}var ki=({state:t,dispatch:e})=>vr(t,e,!1),Si=({state:t,dispatch:e})=>vr(t,e,!0),bi=t=>{if(t.state.readOnly)return!1;let{state:e}=t,n=e.changes(Xe(e).map(({from:o,to:i})=>(o>0?o--:i<e.doc.length&&i++,{from:o,to:i}))),r=re(e.selection,o=>{let i;if(t.lineWrapping){let l=t.lineBlockAt(o.head),s=t.coordsAtPos(o.head,o.assoc||1);s&&(i=l.bottom+t.documentTop-s.bottom+t.defaultLineHeight/2)}return t.moveVertically(o,!0,i)}).map(n);return t.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0};function vi(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let n=qe(t).resolveInner(e),r=n.childBefore(e),o=n.childAfter(e),i;return r&&o&&r.to<=e&&o.from>=e&&(i=r.type.prop(Ne.closedBy))&&i.indexOf(o.name)>-1&&t.doc.lineAt(r.to).from==t.doc.lineAt(o.from).from&&!/\S/.test(t.sliceDoc(r.to,o.from))?{from:r.to,to:o.from}:null}var Kn=Cr(!1),Ci=Cr(!0);function Cr(t){return({state:e,dispatch:n})=>{if(e.readOnly)return!1;let r=e.changeByRange(o=>{let{from:i,to:l}=o,s=e.doc.lineAt(i),a=!t&&i==l&&vi(e,i);t&&(i=l=(l<=s.to?s:e.doc.lineAt(l)).to);let c=new At(e,{simulateBreak:i,simulateDoubleBreak:!!a}),u=Mt(c,i);for(u==null&&(u=Ve(/^\s*/.exec(e.doc.lineAt(i).text)[0],e.tabSize));l<s.to&&/\s/.test(s.text[l-s.from]);)l++;a?{from:i,to:l}=a:i>s.from&&i<s.from+100&&!/\S/.test(s.text.slice(0,i))&&(i=s.from);let f=["",me(e,u)];return a&&f.push(me(e,c.lineIndent(s.from,-1))),{changes:{from:i,to:l,insert:bt.of(f)},range:m.cursor(i+1+f[1].length)}});return n(e.update(r,{scrollIntoView:!0,userEvent:"input"})),!0}}function Wt(t,e){let n=-1;return t.changeByRange(r=>{let o=[];for(let l=r.from;l<=r.to;){let s=t.doc.lineAt(l);s.number>n&&(r.empty||r.to>s.from)&&(e(s,o,r),n=s.number),l=s.to+1}let i=t.changes(o);return{changes:o,range:m.range(i.mapPos(r.anchor,1),i.mapPos(r.head,1))}})}var Mi=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=Object.create(null),r=new At(t,{overrideIndentation:i=>{let l=n[i];return l??-1}}),o=Wt(t,(i,l,s)=>{let a=Mt(r,i.from);if(a==null)return;/\S/.test(i.text)||(a=0);let c=/^\s*/.exec(i.text)[0],u=me(t,a);(c!=u||s.from<i.from+c.length)&&(n[i.from]=a,l.push({from:i.from,to:i.from+c.length,insert:u}))});return o.changes.empty||e(t.update(o,{userEvent:"indent"})),!0},Mr=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(Wt(t,(n,r)=>{r.push({from:n.from,insert:t.facet(Ue)})}),{userEvent:"input.indent"})),!0),Ar=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(Wt(t,(n,r)=>{let o=/^\s*/.exec(n.text)[0];if(!o)return;let i=Ve(o,t.tabSize),l=0,s=me(t,Math.max(0,i-Ke(t)));for(;l<o.length&&l<s.length&&o.charCodeAt(l)==s.charCodeAt(l);)l++;r.push({from:n.from+l,to:n.from+o.length,insert:s.slice(l)})}),{userEvent:"delete.dedent"})),!0),Ai=t=>(t.setTabFocusMode(),!0);var Li=[{key:"Ctrl-b",run:er,shift:cr,preventDefault:!0},{key:"Ctrl-f",run:tr,shift:ur},{key:"Ctrl-p",run:or,shift:dr},{key:"Ctrl-n",run:ir,shift:mr},{key:"Ctrl-a",run:Uo,shift:ri},{key:"Ctrl-e",run:Ko,shift:oi},{key:"Ctrl-d",run:xr},{key:"Ctrl-h",run:Et},{key:"Ctrl-k",run:hi},{key:"Ctrl-Alt-h",run:Sr},{key:"Ctrl-o",run:gi},{key:"Ctrl-t",run:pi},{key:"Ctrl-v",run:Tt}],Bi=[{key:"ArrowLeft",run:er,shift:cr,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:Wo,shift:jo,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:Go,shift:ti,preventDefault:!0},{key:"ArrowRight",run:tr,shift:ur,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:Po,shift:Yo,preventDefault:!0},{mac:"Cmd-ArrowRight",run:qo,shift:ni,preventDefault:!0},{key:"ArrowUp",run:or,shift:dr,preventDefault:!0},{mac:"Cmd-ArrowUp",run:Hn,shift:qn},{mac:"Ctrl-ArrowUp",run:_n,shift:$n},{key:"ArrowDown",run:ir,shift:mr,preventDefault:!0},{mac:"Cmd-ArrowDown",run:Gn,shift:Un},{mac:"Ctrl-ArrowDown",run:Tt,shift:Vn},{key:"PageUp",run:_n,shift:$n},{key:"PageDown",run:Tt,shift:Vn},{key:"Home",run:Ho,shift:ei,preventDefault:!0},{key:"Mod-Home",run:Hn,shift:qn},{key:"End",run:Vo,shift:Qo,preventDefault:!0},{key:"Mod-End",run:Gn,shift:Un},{key:"Enter",run:Kn,shift:Kn},{key:"Mod-a",run:ii},{key:"Backspace",run:Et,shift:Et,preventDefault:!0},{key:"Delete",run:xr,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:Sr,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:fi,preventDefault:!0},{mac:"Mod-Backspace",run:di,preventDefault:!0},{mac:"Mod-Delete",run:mi,preventDefault:!0}].concat(Li.map(t=>({mac:t.key,run:t.run,shift:t.shift}))),Pt=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:_o,shift:Zo},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:$o,shift:Xo},{key:"Alt-ArrowUp",run:yi},{key:"Shift-Alt-ArrowUp",run:ki},{key:"Alt-ArrowDown",run:xi},{key:"Shift-Alt-ArrowDown",run:Si},{key:"Mod-Alt-ArrowUp",run:ai},{key:"Mod-Alt-ArrowDown",run:ci},{key:"Escape",run:ui},{key:"Mod-Enter",run:Ci},{key:"Alt-l",mac:"Ctrl-l",run:li},{key:"Mod-i",run:si,preventDefault:!0},{key:"Mod-[",run:Ar},{key:"Mod-]",run:Mr},{key:"Mod-Alt-\\",run:Mi},{key:"Shift-Mod-k",run:bi},{key:"Shift-Mod-\\",run:Jo},{key:"Mod-/",run:ko},{key:"Alt-A",mac:"Ctrl-A",run:bo},{key:"Ctrl-m",mac:"Shift-Alt-m",run:Ai}].concat(Bi),Lr={key:"Tab",run:Mr,shift:Ar};var Br=typeof String.prototype.normalize=="function"?t=>t.normalize("NFKD"):t=>t,G=class{constructor(e,n,r=0,o=e.length,i,l){this.test=l,this.value={from:0,to:0,precise:!1},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(r,o),this.bufferStart=r,this.normalize=i?s=>i(Br(s)):Br,this.query=this.normalize(n)}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 an(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 n=cn(e),r=this.bufferStart+this.bufferPos;this.bufferPos+=un(e);let o=this.normalize(n);if(o.length)for(let i=0,l=r,s=!0;;i++){let a=o.charCodeAt(i),c=this.match(a,l,s,this.bufferPos+this.bufferStart,i==o.length-1);if(c)return this.value=c,this;if(i==o.length-1)break;s&&i<n.length&&n.charCodeAt(i)==a?l++:s=!1}}}match(e,n,r,o,i){let l=null;for(let s=0;s<this.matches.length;){let a=this.matches[s],c=!1;this.query.charCodeAt(a.index)==e&&(a.index==this.query.length-1?l={from:a.from,to:o,precise:i&&a.precise}:(a.index++,c=!0)),c?s++:this.matches.splice(s,1)}return this.query.charCodeAt(0)==e&&(this.query.length==1?l={from:n,to:o,precise:r&&i}:this.matches.push({from:n,index:1,precise:r})),l&&this.test&&!this.test(l.from,l.to,this.buffer,this.bufferStart)&&(l=null),l}};typeof Symbol<"u"&&(G.prototype[Symbol.iterator]=function(){return this});var Tr={from:-1,to:-1,match:/.*/.exec(""),precise:!0},Gt="gm"+(/x/.unicode==null?"":"u"),tt=class{constructor(e,n,r,o=0,i=e.length){if(this.text=e,this.to=i,this.curLine="",this.done=!1,this.value=Tr,/\\[sWDnr]|\n|\r|\[\^/.test(n))return new rt(e,n,r,o,i);this.re=new RegExp(n,Gt+(r?.ignoreCase?"i":"")),this.test=r?.test,this.iter=e.iter();let l=e.lineAt(o);this.curLineStart=l.from,this.matchPos=ot(e,o),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 n=this.matchPos<=this.to&&this.re.exec(this.curLine);if(n){let r=this.curLineStart+n.index,o=r+n[0].length;if(this.matchPos=ot(this.text,o+(r==o?1:0)),r==this.curLineStart+this.curLine.length&&this.nextLine(),(r<o||r>this.value.to)&&(!this.test||this.test(r,o,n)))return this.value={from:r,to:o,precise:!0,match:n},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}}},Nt=new WeakMap,nt=class t{constructor(e,n){this.from=e,this.text=n}get to(){return this.from+this.text.length}static get(e,n,r){let o=Nt.get(e);if(!o||o.from>=r||o.to<=n){let s=new t(n,e.sliceString(n,r));return Nt.set(e,s),s}if(o.from==n&&o.to==r)return o;let{text:i,from:l}=o;return l>n&&(i=e.sliceString(n,l)+i,l=n),o.to<r&&(i+=e.sliceString(o.to,r)),Nt.set(e,new t(l,i)),new t(n,i.slice(n-l,r-l))}},rt=class{constructor(e,n,r,o,i){this.text=e,this.to=i,this.done=!1,this.value=Tr,this.matchPos=ot(e,o),this.re=new RegExp(n,Gt+(r?.ignoreCase?"i":"")),this.test=r?.test,this.flat=nt.get(e,o,this.chunkEnd(o+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,n=this.re.exec(this.flat.text);if(n&&!n[0]&&n.index==e&&(this.re.lastIndex=e+1,n=this.re.exec(this.flat.text)),n){let r=this.flat.from+n.index,o=r+n[0].length;if((this.flat.to>=this.to||n.index+n[0].length<=this.flat.text.length-10)&&(!this.test||this.test(r,o,n)))return this.value={from:r,to:o,precise:!0,match:n},this.matchPos=ot(this.text,o+(r==o?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=nt.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}};typeof Symbol<"u"&&(tt.prototype[Symbol.iterator]=rt.prototype[Symbol.iterator]=function(){return this});function Di(t){try{return new RegExp(t,Gt),!0}catch{return!1}}function ot(t,e){if(e>=t.length)return e;let n=t.lineAt(e),r;for(;e<n.to&&(r=n.text.charCodeAt(e-n.from))>=56320&&r<57344;)e++;return e}var wi=t=>{let e=An(t,"cm-goto-line");if(e){let l=e.dom.querySelector("input[type=text]");return l&&l.select(),!0}let{state:n}=t,r=String(n.doc.lineAt(t.state.selection.main.head).number),{close:o,result:i}=Mn(t,{class:"cm-goto-line",label:n.phrase("Go to line"),input:{type:"text",name:"line",value:r},focus:!0,submitLabel:n.phrase("go")});return i.then(l=>{let s=l&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(l.elements.line.value);if(!s){t.dispatch({effects:o});return}let a=n.doc.lineAt(n.selection.main.head),[,c,u,f,d]=s,x=f?+f.slice(1):0,g=u?+u:a.number;if(u&&d){let D=g/100;c&&(D=D*(c=="-"?-1:1)+a.number/n.doc.lines),g=Math.round(n.doc.lines*D)}else u&&c&&(g=g*(c=="-"?-1:1)+a.number);let p=n.doc.line(Math.max(1,Math.min(n.doc.lines,g))),S=m.cursor(p.from+Math.max(0,Math.min(x,p.length)));t.dispatch({effects:[o,y.scrollIntoView(S.from,{y:"center"})],selection:S})}),!0},Ti={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},Er=$.define({combine(t){return Z(t,Ti,{highlightWordAroundCursor:(e,n)=>e||n,minSelectionLength:Math.min,maxMatches:Math.min})}});function Or(t){let e=[Ii,Fi];return t&&e.push(Er.of(t)),e}var Ei=v.mark({class:"cm-selectionMatch"}),Oi=v.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function Dr(t,e,n,r){return(n==0||t(e.sliceDoc(n-1,n))!=B.Word)&&(r==e.doc.length||t(e.sliceDoc(r,r+1))!=B.Word)}function Ri(t,e,n,r){return t(e.sliceDoc(n,n+1))==B.Word&&t(e.sliceDoc(r-1,r))==B.Word}var Fi=He.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.selectionSet||t.docChanged||t.viewportChanged)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=t.state.facet(Er),{state:n}=t,r=n.selection;if(r.ranges.length>1)return v.none;let o=r.main,i,l=null;if(o.empty){if(!e.highlightWordAroundCursor)return v.none;let a=n.wordAt(o.head);if(!a)return v.none;l=n.charCategorizer(o.head),i=n.sliceDoc(a.from,a.to)}else{let a=o.to-o.from;if(a<e.minSelectionLength||a>200)return v.none;if(e.wholeWords){if(i=n.sliceDoc(o.from,o.to),l=n.charCategorizer(o.head),!(Dr(l,n,o.from,o.to)&&Ri(l,n,o.from,o.to)))return v.none}else if(i=n.sliceDoc(o.from,o.to),!i)return v.none}let s=[];for(let a of t.visibleRanges){let c=new G(n.doc,i,a.from,a.to);for(;!c.next().done;){let{from:u,to:f}=c.value;if((!l||Dr(l,n,u,f))&&(o.empty&&u<=o.from&&f>=o.to?s.push(Oi.range(u,f)):(u>=o.to||f<=o.from)&&s.push(Ei.range(u,f)),s.length>e.maxMatches))return v.none}}return v.set(s)}},{decorations:t=>t.decorations}),Ii=y.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),Wi=({state:t,dispatch:e})=>{let{selection:n}=t,r=m.create(n.ranges.map(o=>t.wordAt(o.head)||m.cursor(o.head)),n.mainIndex);return r.eq(n)?!1:(e(t.update({selection:r})),!0)};function Pi(t,e){let{main:n,ranges:r}=t.selection,o=t.wordAt(n.head),i=o&&o.from==n.from&&o.to==n.to;for(let l=!1,s=new G(t.doc,e,r[r.length-1].to);;)if(s.next(),s.done){if(l)return null;s=new G(t.doc,e,0,Math.max(0,r[r.length-1].from-1)),l=!0}else{if(l&&r.some(a=>a.from==s.value.from))continue;if(i){let a=t.wordAt(s.value.from);if(!a||a.from!=s.value.from||a.to!=s.value.to)continue}return s.value}}var Ni=({state:t,dispatch:e})=>{let{ranges:n}=t.selection;if(n.some(i=>i.from===i.to))return Wi({state:t,dispatch:e});let r=t.sliceDoc(n[0].from,n[0].to);if(t.selection.ranges.some(i=>t.sliceDoc(i.from,i.to)!=r))return!1;let o=Pi(t,r);return o?(e(t.update({selection:t.selection.addRange(m.range(o.from,o.to),!1),effects:y.scrollIntoView(o.to)})),!0):!1},le=$.define({combine(t){return Z(t,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new Ht(e),scrollToMatch:e=>y.scrollIntoView(e)})}});var it=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||Di(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord,this.test=e.test}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(n,r)=>r=="n"?`
|
|
2
2
|
`: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&&this.test==e.test}create(){return this.regexp?new $t(this):new _t(this)}getCursor(e,n=0,r){let o=e.doc?e:_.create({doc:e});return r==null&&(r=o.doc.length),this.regexp?ie(this,o,n,r):oe(this,o,n,r)}},lt=class{constructor(e){this.spec=e}};function _i(t,e,n){return(r,o,i,l)=>{if(n&&!n(r,o,i,l))return!1;let s=r>=l&&o<=l+i.length?i.slice(r-l,o-l):e.doc.sliceString(r,o);return t(s,e,r,o)}}function oe(t,e,n,r){let o;return t.wholeWord&&(o=$i(e.doc,e.charCategorizer(e.selection.main.head))),t.test&&(o=_i(t.test,e,o)),new G(e.doc,t.unquoted,n,r,t.caseSensitive?void 0:i=>i.toLowerCase(),o)}function $i(t,e){return(n,r,o,i)=>((i>n||i+o.length<r)&&(i=Math.max(0,n-2),o=t.sliceString(i,Math.min(t.length,r+2))),(e(st(o,n-i))!=B.Word||e(at(o,n-i))!=B.Word)&&(e(at(o,r-i))!=B.Word||e(st(o,r-i))!=B.Word))}var _t=class extends lt{constructor(e){super(e)}nextMatch(e,n,r){let o=oe(this.spec,e,r,e.doc.length).nextOverlapping();if(o.done){let i=Math.min(e.doc.length,n+this.spec.unquoted.length);o=oe(this.spec,e,0,i).nextOverlapping()}return o.done||o.value.from==n&&o.value.to==r?null:o.value}prevMatchInRange(e,n,r){for(let o=r;;){let i=Math.max(n,o-1e4-this.spec.unquoted.length),l=oe(this.spec,e,i,o),s=null;for(;!l.nextOverlapping().done;)s=l.value;if(s)return s;if(i==n)return null;o-=1e4}}prevMatch(e,n,r){let o=this.prevMatchInRange(e,0,n);return o||(o=this.prevMatchInRange(e,Math.max(0,r-this.spec.unquoted.length),e.doc.length)),o&&(o.from!=n||o.to!=r)?o:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,n){let r=oe(this.spec,e,0,e.doc.length),o=[];for(;!r.next().done;){if(o.length>=n)return null;o.push(r.value)}return o}highlight(e,n,r,o){let i=oe(this.spec,e,Math.max(0,n-this.spec.unquoted.length),Math.min(r+this.spec.unquoted.length,e.doc.length));for(;!i.next().done;)o(i.value.from,i.value.to)}};function Vi(t,e,n){return(r,o,i)=>(!n||n(r,o,i))&&t(i[0],e,r,o)}function ie(t,e,n,r){let o;return t.wholeWord&&(o=Hi(e.charCategorizer(e.selection.main.head))),t.test&&(o=Vi(t.test,e,o)),new tt(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:o},n,r)}function st(t,e){return t.slice(N(t,e,!1),e)}function at(t,e){return t.slice(e,N(t,e))}function Hi(t){return(e,n,r)=>!r[0].length||(t(st(r.input,r.index))!=B.Word||t(at(r.input,r.index))!=B.Word)&&(t(at(r.input,r.index+r[0].length))!=B.Word||t(st(r.input,r.index+r[0].length))!=B.Word)}var $t=class extends lt{nextMatch(e,n,r){let o=ie(this.spec,e,r,e.doc.length).next();return o.done&&(o=ie(this.spec,e,0,n).next()),o.done?null:o.value}prevMatchInRange(e,n,r){for(let o=1;;o++){let i=Math.max(n,r-o*1e4),l=ie(this.spec,e,i,r),s=null;for(;!l.next().done;)s=l.value;if(s&&(i==n||s.from>i+10))return s;if(i==n)return null}}prevMatch(e,n,r){return this.prevMatchInRange(e,0,n)||this.prevMatchInRange(e,r,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(n,r)=>{if(r=="&")return e.match[0];if(r=="$")return"$";for(let o=r.length;o>0;o--){let i=+r.slice(0,o);if(i>0&&i<e.match.length)return e.match[i]+r.slice(o)}return n})}matchAll(e,n){let r=ie(this.spec,e,0,e.doc.length),o=[];for(;!r.next().done;){if(o.length>=n)return null;o.push(r.value)}return o}highlight(e,n,r,o){let i=ie(this.spec,e,Math.max(0,n-250),Math.min(r+250,e.doc.length));for(;!i.next().done;)o(i.value.from,i.value.to)}},ke=L.define(),qt=L.define(),H=ne.define({create(t){return new xe(Vt(t).create(),null)},update(t,e){for(let n of e.effects)n.is(ke)?t=new xe(n.value.create(),t.panel):n.is(qt)&&(t=new xe(t.query,n.value?Ut:null));return t},provide:t=>Ge.from(t,e=>e.panel)});var xe=class{constructor(e,n){this.query=e,this.panel=n}},Gi=v.mark({class:"cm-searchMatch"}),qi=v.mark({class:"cm-searchMatch cm-searchMatch-selected"}),Ui=He.fromClass(class{constructor(t){this.view=t,this.decorations=this.highlight(t.state.field(H))}update(t){let e=t.state.field(H);(e!=t.startState.field(H)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:t,panel:e}){if(!e||!t.spec.valid)return v.none;let{view:n}=this,r=new $e;for(let o=0,i=n.visibleRanges,l=i.length;o<l;o++){let{from:s,to:a}=i[o];for(;o<l-1&&a>i[o+1].from-500;)a=i[++o].to;t.highlight(n.state,s,a,(c,u)=>{let f=n.state.selection.ranges.some(d=>d.from==c&&d.to==u);r.add(c,u,f?qi:Gi)})}return r.finish()}},{decorations:t=>t.decorations});function Se(t){return e=>{let n=e.state.field(H,!1);return n&&n.query.spec.valid?t(e,n):Ir(e)}}var ct=Se((t,{query:e})=>{let{to:n}=t.state.selection.main,r=e.nextMatch(t.state,n,n);if(!r)return!1;let o=m.single(r.from,r.to),i=t.state.facet(le);return t.dispatch({selection:o,effects:[Kt(t,r),i.scrollToMatch(o.main,t)],userEvent:"select.search"}),Fr(t),!0}),ut=Se((t,{query:e})=>{let{state:n}=t,{from:r}=n.selection.main,o=e.prevMatch(n,r,r);if(!o)return!1;let i=m.single(o.from,o.to),l=t.state.facet(le);return t.dispatch({selection:i,effects:[Kt(t,o),l.scrollToMatch(i.main,t)],userEvent:"select.search"}),Fr(t),!0}),Ki=Se((t,{query:e})=>{let n=e.matchAll(t.state,1e3);return!n||!n.length?!1:(t.dispatch({selection:m.create(n.map(r=>m.range(r.from,r.to))),userEvent:"select.search.matches"}),!0)}),zi=({state:t,dispatch:e})=>{let n=t.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:r,to:o}=n.main,i=[],l=0;for(let s=new G(t.doc,t.sliceDoc(r,o));!s.next().done;){if(i.length>1e3)return!1;s.value.from==r&&(l=i.length),i.push(m.range(s.value.from,s.value.to))}return e(t.update({selection:m.create(i,l),userEvent:"select.search.matches"})),!0},wr=Se((t,{query:e})=>{let{state:n}=t,{from:r,to:o}=n.selection.main;if(n.readOnly)return!1;let i=e.nextMatch(n,r,r);if(!i)return!1;let l=i,s=[],a,c,u=[];l.precise?l.from==r&&l.to==o&&(c=n.toText(e.getReplacement(l)),s.push({from:l.from,to:l.to,insert:c}),l=e.nextMatch(n,l.from,l.to),u.push(y.announce.of(n.phrase("replaced match on line $",n.doc.lineAt(r).number)+"."))):l=e.nextMatch(n,l.from,l.to);let f=t.state.changes(s);return l&&(a=m.single(l.from,l.to).map(f),u.push(Kt(t,l)),u.push(n.facet(le).scrollToMatch(a.main,t))),t.dispatch({changes:f,selection:a,effects:u,userEvent:"input.replace"}),!0}),Ji=Se((t,{query:e})=>{if(t.state.readOnly)return!1;let n=[];for(let o of e.matchAll(t.state,1e9)){let{from:i,to:l,precise:s}=o;s&&n.push({from:i,to:l,insert:e.getReplacement(o)})}if(!n.length)return!1;let r=t.state.phrase("replaced $ matches",n.length)+".";return t.dispatch({changes:n,effects:y.announce.of(r),userEvent:"input.replace.all"}),!0});function Ut(t){return t.state.facet(le).createPanel(t)}function Vt(t,e){var n,r,o,i,l;let s=t.selection.main,a=s.empty||s.to>s.from+100?"":t.sliceDoc(s.from,s.to);if(e&&!a)return e;let c=t.facet(le);return new it({search:((n=e?.literal)!==null&&n!==void 0?n:c.literal)?a:a.replace(/\n/g,"\\n"),caseSensitive:(r=e?.caseSensitive)!==null&&r!==void 0?r:c.caseSensitive,literal:(o=e?.literal)!==null&&o!==void 0?o:c.literal,regexp:(i=e?.regexp)!==null&&i!==void 0?i:c.regexp,wholeWord:(l=e?.wholeWord)!==null&&l!==void 0?l:c.wholeWord})}function Rr(t){let e=de(t,Ut);return e&&e.dom.querySelector("[main-field]")}function Fr(t){let e=Rr(t);e&&e==t.root.activeElement&&e.select()}var Ir=t=>{let e=t.state.field(H,!1);if(e&&e.panel){let n=Rr(t);if(n&&n!=t.root.activeElement){let r=Vt(t.state,e.query.spec);r.valid&&t.dispatch({effects:ke.of(r)}),n.focus(),n.select()}}else t.dispatch({effects:[qt.of(!0),e?ke.of(Vt(t.state,e.query.spec)):L.appendConfig.of(Yi)]});return!0},Wr=t=>{let e=t.state.field(H,!1);if(!e||!e.panel)return!1;let n=de(t,Ut);return n&&n.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:qt.of(!1)}),!0},Pr=[{key:"Mod-f",run:Ir,scope:"editor search-panel"},{key:"F3",run:ct,shift:ut,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:ct,shift:ut,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:Wr,scope:"editor search-panel"},{key:"Mod-Shift-l",run:zi},{key:"Mod-Alt-g",run:wi},{key:"Mod-d",run:Ni,preventDefault:!0}],Ht=class{constructor(e){this.view=e;let n=this.query=e.state.field(H).query.spec;this.commit=this.commit.bind(this),this.searchField=b("input",{value:n.search,placeholder:w(e,"Find"),"aria-label":w(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=b("input",{value:n.replace,placeholder:w(e,"Replace"),"aria-label":w(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=b("input",{type:"checkbox",name:"case",form:"",checked:n.caseSensitive,onchange:this.commit}),this.reField=b("input",{type:"checkbox",name:"re",form:"",checked:n.regexp,onchange:this.commit}),this.wordField=b("input",{type:"checkbox",name:"word",form:"",checked:n.wholeWord,onchange:this.commit});function r(o,i,l){return b("button",{class:"cm-button",name:o,onclick:i,type:"button"},l)}this.dom=b("div",{onkeydown:o=>this.keydown(o),class:"cm-search"},[this.searchField,r("next",()=>ct(e),[w(e,"next")]),r("prev",()=>ut(e),[w(e,"previous")]),r("select",()=>Ki(e),[w(e,"all")]),b("label",null,[this.caseField,w(e,"match case")]),b("label",null,[this.reField,w(e,"regexp")]),b("label",null,[this.wordField,w(e,"by word")]),...e.state.readOnly?[]:[b("br"),this.replaceField,r("replace",()=>wr(e),[w(e,"replace")]),r("replaceAll",()=>Ji(e),[w(e,"replace all")])],b("button",{name:"close",onclick:()=>Wr(e),"aria-label":w(e,"close"),type:"button"},["\xD7"])])}commit(){let e=new it({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:ke.of(e)}))}keydown(e){pn(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?ut:ct)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),wr(this.view))}update(e){for(let n of e.transactions)for(let r of n.effects)r.is(ke)&&!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(le).top}};function w(t,e){return t.state.phrase(e)}var Qe=30,et=/[\s\.,:;?!]/;function Kt(t,{from:e,to:n}){let r=t.state.doc.lineAt(e),o=t.state.doc.lineAt(n).to,i=Math.max(r.from,e-Qe),l=Math.min(o,n+Qe),s=t.state.sliceDoc(i,l);if(i!=r.from){for(let a=0;a<Qe;a++)if(!et.test(s[a+1])&&et.test(s[a])){s=s.slice(a);break}}if(l!=o){for(let a=s.length-1;a>s.length-Qe;a--)if(!et.test(s[a-1])&&et.test(s[a])){s=s.slice(0,a);break}}return y.announce.of(`${t.state.phrase("current match")}. ${s} ${t.state.phrase("on line")} ${r.number}.`)}var ji=y.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"}}),Yi=[H,dn.low(Ui),ji];var ht=class{constructor(e,n,r){this.from=e,this.to=n,this.diagnostic=r}},ee=class t{constructor(e,n,r){this.diagnostics=e,this.panel=n,this.selected=r}static init(e,n,r){let o=r.facet(be).markerFilter;o&&(e=o(e,r));let i=e.slice().sort((x,g)=>x.from-g.from||x.to-g.to),l=new $e,s=[],a=0,c=r.doc.iter(),u=0,f=r.doc.length;for(let x=0;;){let g=x==i.length?null:i[x];if(!g&&!s.length)break;let p,S;if(s.length)p=a,S=s.reduce((k,A)=>Math.min(k,A.to),g&&g.from>p?g.from:1e8);else{if(p=g.from,p>f)break;S=g.to,s.push(g),x++}for(;x<i.length;){let k=i[x];if(k.from==p&&(k.to>k.from||k.to==p))s.push(k),x++,S=Math.min(k.to,S);else{S=Math.min(k.from,S);break}}S=Math.min(S,f);let D=!1;if(s.some(k=>k.from==p&&(k.to==S||S==f))&&(D=p==S,!D&&S-p<10)){let k=p-(u+c.value.length);k>0&&(c.next(k),u=p);for(let A=p;;){if(A>=S){D=!0;break}if(!c.lineBreak&&u+c.value.length>A)break;A=u+c.value.length,u+=c.value.length,c.next()}}let U=sl(s);if(D)l.add(p,p,v.widget({widget:new zt(U),diagnostics:s.slice()}));else{let k=s.reduce((A,K)=>K.markClass?A+" "+K.markClass:A,"");l.add(p,S,v.mark({class:"cm-lintRange cm-lintRange-"+U+k,diagnostics:s.slice(),inclusiveEnd:s.some(A=>A.to>S)}))}if(a=S,a==f)break;for(let k=0;k<s.length;k++)s[k].to<=a&&s.splice(k--,1)}let d=l.finish();return new t(d,n,q(d))}};function q(t,e=null,n=0){let r=null;return t.between(n,1e9,(o,i,{spec:l})=>{if(!(e&&l.diagnostics.indexOf(e)<0))if(!r)r=new ht(o,i,e||l.diagnostics[0]);else{if(l.diagnostics.indexOf(r.diagnostic)<0)return!1;r=new ht(r.from,i,r.diagnostic)}}),r}function Zi(t,e){let n=e.pos,r=e.end||n,o=t.state.facet(be).hideOn(t,n,r);if(o!=null)return o;let i=t.startState.doc.lineAt(e.pos);return!!(t.effects.some(l=>l.is($r))||t.changes.touchesRange(i.from,Math.max(i.to,r)))}function Xi(t,e){return t.field(T,!1)?e:e.concat(L.appendConfig.of(al))}var $r=L.define(),Jt=L.define(),Vr=L.define(),T=ne.define({create(){return new ee(v.none,null,null)},update(t,e){if(e.docChanged&&t.diagnostics.size){let n=t.diagnostics.map(e.changes),r=null,o=t.panel;if(t.selected){let i=e.changes.mapPos(t.selected.from,1);r=q(n,t.selected.diagnostic,i)||q(n,null,i)}!n.size&&o&&e.state.facet(be).autoPanel&&(o=null),t=new ee(n,o,r)}for(let n of e.effects)if(n.is($r)){let r=e.state.facet(be).autoPanel?n.value.length?ve.open:null:t.panel;t=ee.init(n.value,r,e.state)}else n.is(Jt)?t=new ee(t.diagnostics,n.value?ve.open:null,t.selected):n.is(Vr)&&(t=new ee(t.diagnostics,t.panel,n.value));return t},provide:t=>[Ge.from(t,e=>e.panel),y.decorations.from(t,e=>e.diagnostics)]});var Qi=v.mark({class:"cm-lintRange cm-lintRange-active"});function el(t,e,n){let{diagnostics:r}=t.state.field(T),o,i=-1,l=-1;r.between(e-(n<0?1:0),e+(n>0?1:0),(a,c,{spec:u})=>{if(e>=a&&e<=c&&(a==c||(e>a||n>0)&&(e<c||n<0)))return o=u.diagnostics,i=a,l=c,!1});let s=t.state.facet(be).tooltipFilter;return o&&s&&(o=s(o,t.state)),o?{pos:i,end:l,above:!0,create(){return{dom:tl(t,o)}}}:null}function tl(t,e){return b("ul",{class:"cm-tooltip-lint"},e.map(n=>qr(t,n,!1)))}var nl=t=>{let e=t.state.field(T,!1);(!e||!e.panel)&&t.dispatch({effects:Xi(t.state,[Jt.of(!0)])});let n=de(t,ve.open);return n&&n.dom.querySelector(".cm-panel-lint ul").focus(),!0},Nr=t=>{let e=t.state.field(T,!1);return!e||!e.panel?!1:(t.dispatch({effects:Jt.of(!1)}),!0)},rl=t=>{let e=t.state.field(T,!1);if(!e)return!1;let n=t.state.selection.main,r=q(e.diagnostics,null,n.to+1);return!r&&(r=q(e.diagnostics,null,0),!r||r.from==n.from&&r.to==n.to)?!1:(t.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0}),Cn(t,r.from,1,{tooltip:Ur,until:o=>o.docChanged||o.newSelection.main.head<r.from||o.newSelection.main.head>r.to}),!0)};var Hr=[{key:"Mod-Shift-m",run:nl,preventDefault:!0},{key:"F8",run:rl}];var be=$.define({combine(t){return{sources:t.map(e=>e.source).filter(e=>e!=null),...Z(t.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:_r,tooltipFilter:_r,needsRefresh:(e,n)=>e?n?r=>e(r)||n(r):e:n,hideOn:(e,n)=>e?n?(r,o,i)=>e(r,o,i)||n(r,o,i):e:n,autoPanel:(e,n)=>e||n})}}});function _r(t,e){return t?e?(n,r)=>e(t(n,r),r):t:e}function Gr(t){let e=[];if(t)e:for(let{name:n}of t){for(let r=0;r<n.length;r++){let o=n[r];if(/[a-zA-Z]/.test(o)&&!e.some(i=>i.toLowerCase()==o.toLowerCase())){e.push(o);continue e}}e.push("")}return e}function qr(t,e,n){var r;let o=n?Gr(e.actions):[];return b("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},b("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage(t):e.message),(r=e.actions)===null||r===void 0?void 0:r.map((i,l)=>{let s=!1,a=x=>{if(x.preventDefault(),s)return;s=!0;let g=q(t.state.field(T).diagnostics,e);g&&i.apply(t,g.from,g.to)},{name:c}=i,u=o[l]?c.indexOf(o[l]):-1,f=u<0?c:[c.slice(0,u),b("u",c.slice(u,u+1)),c.slice(u+1)],d=i.markClass?" "+i.markClass:"";return b("button",{type:"button",class:"cm-diagnosticAction"+d,onclick:a,onmousedown:a,"aria-label":` Action: ${c}${u<0?"":` (access key "${o[l]})"`}.`},f)}),e.source&&b("div",{class:"cm-diagnosticSource"},e.source))}var zt=class extends mn{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return b("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}},dt=class{constructor(e,n){this.diagnostic=n,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=qr(e,n,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}},ve=class t{constructor(e){this.view=e,this.items=[];let n=o=>{if(!(o.ctrlKey||o.altKey||o.metaKey)){if(o.keyCode==27)Nr(this.view),this.view.focus();else if(o.keyCode==38||o.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(o.keyCode==40||o.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(o.keyCode==36)this.moveSelection(0);else if(o.keyCode==35)this.moveSelection(this.items.length-1);else if(o.keyCode==13)this.view.focus();else if(o.keyCode>=65&&o.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:i}=this.items[this.selectedIndex],l=Gr(i.actions);for(let s=0;s<l.length;s++)if(l[s].toUpperCase().charCodeAt(0)==o.keyCode){let a=q(this.view.state.field(T).diagnostics,i);a&&i.actions[s].apply(e,a.from,a.to)}}else return;o.preventDefault()}},r=o=>{for(let i=0;i<this.items.length;i++)this.items[i].dom.contains(o.target)&&this.moveSelection(i)};this.list=b("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:n,onclick:r}),this.dom=b("div",{class:"cm-panel-lint"},this.list,b("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>Nr(this.view)},"\xD7")),this.update()}get selectedIndex(){let e=this.view.state.field(T).selected;if(!e)return-1;for(let n=0;n<this.items.length;n++)if(this.items[n].diagnostic==e.diagnostic)return n;return-1}update(){let{diagnostics:e,selected:n}=this.view.state.field(T),r=0,o=!1,i=null,l=new Set;for(e.between(0,this.view.state.doc.length,(s,a,{spec:c})=>{for(let u of c.diagnostics){if(l.has(u))continue;l.add(u);let f=-1,d;for(let x=r;x<this.items.length;x++)if(this.items[x].diagnostic==u){f=x;break}f<0?(d=new dt(this.view,u),this.items.splice(r,0,d),o=!0):(d=this.items[f],f>r&&(this.items.splice(r,f-r),o=!0)),n&&d.diagnostic==n.diagnostic?d.dom.hasAttribute("aria-selected")||(d.dom.setAttribute("aria-selected","true"),i=d):d.dom.hasAttribute("aria-selected")&&d.dom.removeAttribute("aria-selected"),r++}});r<this.items.length&&!(this.items.length==1&&this.items[0].diagnostic.from<0);)o=!0,this.items.pop();this.items.length==0&&(this.items.push(new dt(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),o=!0),i?(this.list.setAttribute("aria-activedescendant",i.id),this.view.requestMeasure({key:this,read:()=>({sel:i.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:s,panel:a})=>{let c=a.height/this.list.offsetHeight;s.top<a.top?this.list.scrollTop-=(a.top-s.top)/c:s.bottom>a.bottom&&(this.list.scrollTop+=(s.bottom-a.bottom)/c)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),o&&this.sync()}sync(){let e=this.list.firstChild;function n(){let r=e;e=r.nextSibling,r.remove()}for(let r of this.items)if(r.dom.parentNode==this.list){for(;e!=r.dom;)n();e=r.dom.nextSibling}else this.list.insertBefore(r.dom,e);for(;e;)n()}moveSelection(e){if(this.selectedIndex<0)return;let n=this.view.state.field(T),r=q(n.diagnostics,this.items[e].diagnostic);r&&this.view.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0,effects:Vr.of(r)})}static open(e){return new t(e)}};function ol(t,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${e}>${encodeURIComponent(t)}</svg>')`}function ft(t){return ol(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${t}" fill="none" stroke-width=".7"/>`,'width="6" height="3"')}var il=y.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:ft("#f11")},".cm-lintRange-warning":{backgroundImage:ft("orange")},".cm-lintRange-info":{backgroundImage:ft("#999")},".cm-lintRange-hint":{backgroundImage:ft("#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}},"&dark .cm-lintRange-active":{backgroundColor:"#86714a80"},"&dark .cm-panel.cm-panel-lint ul":{"& [aria-selected]":{backgroundColor:"#2e343e"}}});function ll(t){return t=="error"?4:t=="warning"?3:t=="info"?2:1}function sl(t){let e="hint",n=1;for(let r of t){let o=ll(r.severity);o>n&&(n=o,e=r.severity)}return e}var Ur=vn(el,{hideOn:Zi}),al=[T,y.decorations.compute([T],t=>{let{selected:e,panel:n}=t.field(T);return!e||!n||e.from==e.to?v.none:v.set([Qi.range(e.from,e.to)])}),Ur,il];var jt=function(e){e===void 0&&(e={});var n=e,r=n.crosshairCursor,o=r===void 0?!1:r,i=[];e.closeBracketsKeymap!==!1&&(i=i.concat(Fn)),e.defaultKeymap!==!1&&(i=i.concat(Pt)),e.searchKeymap!==!1&&(i=i.concat(Pr)),e.historyKeymap!==!1&&(i=i.concat(It)),e.foldKeymap!==!1&&(i=i.concat(wn)),e.completionKeymap!==!1&&(i=i.concat(Wn)),e.lintKeymap!==!1&&(i=i.concat(Hr));var l=[];return e.lineNumbers!==!1&&l.push(Ln()),e.highlightActiveLineGutter!==!1&&l.push(Bn()),e.highlightSpecialChars!==!1&&l.push(Ct()),e.history!==!1&&l.push(Ft()),e.foldGutter!==!1&&l.push(Tn()),e.drawSelection!==!1&&l.push(vt()),e.dropCursor!==!1&&l.push(yn()),e.allowMultipleSelections!==!1&&l.push(_.allowMultipleSelections.of(!0)),e.indentOnInput!==!1&&l.push(Dn()),e.syntaxHighlighting!==!1&&l.push(ge(Lt,{fallback:!0})),e.bracketMatching!==!1&&l.push(On()),e.closeBrackets!==!1&&l.push(Rn()),e.autocompletion!==!1&&l.push(In()),e.rectangularSelection!==!1&&l.push(Sn()),o!==!1&&l.push(bn()),e.highlightActiveLine!==!1&&l.push(xn()),e.highlightSelectionMatches!==!1&&l.push(Or()),e.tabSize&&typeof e.tabSize=="number"&&l.push(Ue.of(" ".repeat(e.tabSize))),l.concat([he.of(i.flat())]).filter(Boolean)},Ms=function(e){e===void 0&&(e={});var n=[];e.defaultKeymap!==!1&&(n=n.concat(Pt)),e.historyKeymap!==!1&&(n=n.concat(It));var r=[];return e.highlightSpecialChars!==!1&&r.push(Ct()),e.history!==!1&&r.push(Ft()),e.drawSelection!==!1&&r.push(vt()),e.syntaxHighlighting!==!1&&r.push(ge(Lt,{fallback:!0})),r.concat([he.of(n.flat())]).filter(Boolean)};var Kr="#e5c07b",Yt="#e06c75",zr="#56b6c2",Jr="#ffffff",Ce="#abb2bf",gt="#7d8799",jr="#61afef",Yr="#98c379",Zt="#d19a66",Zr="#c678dd",Xr="#21252b",Xt="#2c313a",Qt="#282c34",mt="#353a42",Qr="#3E4451",en="#528bff",ws={chalky:Kr,coral:Yt,cyan:zr,invalid:Jr,ivory:Ce,stone:gt,malibu:jr,sage:Yr,whiskey:Zt,violet:Zr,darkBackground:Xr,highlightBackground:Xt,background:Qt,tooltipBackground:mt,selection:Qr,cursor:en},cl=y.theme({"&":{color:Ce,backgroundColor:Qt},".cm-content":{caretColor:en},".cm-cursor, .cm-dropCursor":{borderLeftColor:en},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:Qr},".cm-panels":{backgroundColor:Xr,color:Ce},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:"1px solid #457dff"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff2f"},".cm-activeLine":{backgroundColor:"#6699ff0b"},".cm-selectionMatch":{backgroundColor:"#aafe661a"},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bad0f847"},".cm-gutters":{backgroundColor:Qt,color:gt,border:"none"},".cm-activeLineGutter":{backgroundColor:Xt},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:mt},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:mt,borderBottomColor:mt},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:Xt,color:Ce}}},{dark:!0}),ul=En.define([{tag:h.keyword,color:Zr},{tag:[h.name,h.deleted,h.character,h.propertyName,h.macroName],color:Yt},{tag:[h.function(h.variableName),h.labelName],color:jr},{tag:[h.color,h.constant(h.name),h.standard(h.name)],color:Zt},{tag:[h.definition(h.name),h.separator],color:Ce},{tag:[h.typeName,h.className,h.number,h.changed,h.annotation,h.modifier,h.self,h.namespace],color:Kr},{tag:[h.operator,h.operatorKeyword,h.url,h.escape,h.regexp,h.link,h.special(h.string)],color:zr},{tag:[h.meta,h.comment],color:gt},{tag:h.strong,fontWeight:"bold"},{tag:h.emphasis,fontStyle:"italic"},{tag:h.strikethrough,textDecoration:"line-through"},{tag:h.link,color:gt,textDecoration:"underline"},{tag:h.heading,fontWeight:"bold",color:Yt},{tag:[h.atom,h.bool,h.special(h.variableName)],color:Zt},{tag:[h.processingInstruction,h.string,h.inserted],color:Yr},{tag:h.invalid,color:Jr}]),eo=[cl,ge(ul)];var to=y.theme({"&":{backgroundColor:"#fff"}},{dark:!1});var no=function(e){e===void 0&&(e={});var n=e,r=n.indentWithTab,o=r===void 0?!0:r,i=n.editable,l=i===void 0?!0:i,s=n.readOnly,a=s===void 0?!1:s,c=n.theme,u=c===void 0?"light":c,f=n.placeholder,d=f===void 0?"":f,x=n.basicSetup,g=x===void 0?!0:x,p=[];switch(o&&p.unshift(he.of([Lr])),g&&(typeof g=="boolean"?p.unshift(jt()):p.unshift(jt(g))),d&&p.unshift(kn(d)),u){case"light":p.push(to);break;case"dark":p.push(eo);break;case"none":break;default:p.push(u);break}return l===!1&&p.push(y.editable.of(!1)),a&&p.push(_.readOnly.of(!0)),[...p]};var ro=t=>({line:t.state.doc.lineAt(t.state.selection.main.from),lineCount:t.state.doc.lines,lineBreak:t.state.lineBreak,length:t.state.doc.length,readOnly:t.state.readOnly,tabSize:t.state.tabSize,selection:t.state.selection,selectionAsSingle:t.state.selection.asSingle().main,ranges:t.state.selection.ranges,selectionCode:t.state.sliceDoc(t.state.selection.main.from,t.state.selection.main.to),selections:t.state.selection.ranges.map(e=>t.state.sliceDoc(e.from,e.to)),selectedText:t.state.selection.ranges.some(e=>!e.empty)});var pt=class{constructor(e,n){this.timeLeftMS=void 0,this.timeoutMS=void 0,this.isCancelled=!1,this.isTimeExhausted=!1,this.callbacks=[],this.timeLeftMS=n,this.timeoutMS=n,this.callbacks.push(e)}tick(){if(!this.isCancelled&&!this.isTimeExhausted&&(this.timeLeftMS--,this.timeLeftMS<=0)){this.isTimeExhausted=!0;var e=this.callbacks.slice();this.callbacks.length=0,e.forEach(n=>{try{n()}catch(r){console.error("TimeoutLatch callback error:",r)}})}}cancel(){this.isCancelled=!0,this.callbacks.length=0}reset(){this.timeLeftMS=this.timeoutMS,this.isCancelled=!1,this.isTimeExhausted=!1}get isDone(){return this.isCancelled||this.isTimeExhausted}},yt=class{constructor(){this.interval=null,this.latches=new Set}add(e){this.latches.add(e),this.start()}remove(e){this.latches.delete(e),this.latches.size===0&&this.stop()}start(){this.interval===null&&(this.interval=setInterval(()=>{this.latches.forEach(e=>{e.tick(),e.isDone&&this.remove(e)})},1))}stop(){this.interval!==null&&(clearInterval(this.interval),this.interval=null)}},tn=null,oo=()=>typeof window>"u"?new yt:(tn||(tn=new yt),tn);var lo=y.theme({"& .cm-scroller":{height:"100% !important"}}),io=null,nn=null;function so(t,e,n,r,o,i){if(!t&&!e&&!n&&!r&&!o&&!i)return null;var l=JSON.stringify({height:t,minHeight:e,maxHeight:n,width:r,minWidth:o,maxWidth:i});return l===io||(io=l,nn=y.theme({"&":{height:t,minHeight:e,maxHeight:n,width:r,minWidth:o,maxWidth:i}})),nn}var ao=fe.define(),hl=200,dl=[];function co(t){var e=t.value,n=t.selection,r=t.onChange,o=t.onStatistics,i=t.onCreateEditor,l=t.onUpdate,s=t.extensions,a=s===void 0?dl:s,c=t.autoFocus,u=t.theme,f=u===void 0?"light":u,d=t.height,x=d===void 0?null:d,g=t.minHeight,p=g===void 0?null:g,S=t.maxHeight,D=S===void 0?null:S,U=t.width,k=U===void 0?null:U,A=t.minWidth,K=A===void 0?null:A,Le=t.maxWidth,Be=Le===void 0?null:Le,De=t.placeholder,we=De===void 0?"":De,Te=t.editable,Ee=Te===void 0?!0:Te,Oe=t.readOnly,te=Oe===void 0?!1:Oe,z=t.indentWithTab,se=z===void 0?!0:z,ae=t.basicSetup,Re=ae===void 0?!0:ae,Fe=t.root,ce=t.initialState,Ie=Ae(),J=Ie[0],rn=Ie[1],on=Ae(),C=on[0],We=on[1],ln=Ae(),xt=ln[0],kt=ln[1],W=Ae(()=>({current:null}))[0],Pe=Ae(()=>({current:null}))[0],sn=so(x,p,D,k,K,Be),fo=y.updateListener.of(P=>{if(P.docChanged&&typeof r=="function"&&!P.transactions.some(St=>St.annotation(ao))){W.current?W.current.reset():(W.current=new pt(()=>{if(Pe.current){var St=Pe.current;Pe.current=null,St()}W.current=null},hl),oo().add(W.current));var j=P.state.doc,Y=j.toString();r(Y,P)}o&&o(ro(P))}),ho=no({theme:f,editable:Ee,readOnly:te,placeholder:we,indentWithTab:se,basicSetup:Re}),ue=[fo,...sn?[sn]:[],lo,...ho];return l&&typeof l=="function"&&ue.push(y.updateListener.of(l)),ue=ue.concat(a),fl(()=>{if(J&&!xt){var P={doc:e,selection:n,extensions:ue},j=ce?_.fromJSON(ce.json,P,ce.fields):_.create(P);if(kt(j),!C){var Y=new y({state:j,parent:J,root:Fe});We(Y),i&&i(Y,j)}}return()=>{C&&(kt(void 0),We(void 0))}},[J,xt]),Me(()=>{t.container&&rn(t.container)},[t.container]),Me(()=>()=>{C&&(C.destroy(),We(void 0)),W.current&&(W.current.cancel(),W.current=null)},[C]),Me(()=>{c&&C&&C.focus()},[c,C]),Me(()=>{C&&C.dispatch({effects:L.reconfigure.of(ue)})},[f,a,x,p,D,k,K,Be,we,Ee,te,se,Re,r,l]),Me(()=>{if(e!==void 0){var P=C?C.state.doc.toString():"";if(C&&e!==P){var j=W.current&&!W.current.isDone,Y=()=>{C&&e!==C.state.doc.toString()&&C.dispatch({changes:{from:0,to:C.state.doc.toString().length,insert:e||""},annotations:[ao.of(!0)]})};j?Pe.current=Y:Y()}}},[e,C]),{state:xt,setState:kt,view:C,setView:We,container:J,setContainer:rn}}import{jsx as kl}from"react/jsx-runtime";var ml=["className","value","selection","extensions","onChange","onStatistics","onCreateEditor","onUpdate","autoFocus","theme","height","minHeight","maxHeight","width","minWidth","maxWidth","basicSetup","placeholder","indentWithTab","editable","readOnly","root","initialState"],uo=pl((t,e)=>{var n=t.className,r=t.value,o=r===void 0?"":r,i=t.selection,l=t.extensions,s=l===void 0?[]:l,a=t.onChange,c=t.onStatistics,u=t.onCreateEditor,f=t.onUpdate,d=t.autoFocus,x=t.theme,g=x===void 0?"light":x,p=t.height,S=t.minHeight,D=t.maxHeight,U=t.width,k=t.minWidth,A=t.maxWidth,K=t.basicSetup,Le=t.placeholder,Be=t.indentWithTab,De=t.editable,we=t.readOnly,Te=t.root,Ee=t.initialState,Oe=Nn(t,ml),te=gl(null),z=co({root:Te,value:o,autoFocus:d,theme:g,height:p,minHeight:S,maxHeight:D,width:U,minWidth:k,maxWidth:A,basicSetup:K,placeholder:Le,indentWithTab:Be,editable:De,readOnly:we,selection:i,onChange:a,onStatistics:c,onCreateEditor:u,onUpdate:f,extensions:s,initialState:Ee}),se=z.state,ae=z.view,Re=z.container,Fe=z.setContainer;yl(e,()=>({editor:te.current,state:se,view:ae}),[te,Re,se,ae]);var ce=xl(J=>{te.current=J,Fe(J)},[Fe]);if(typeof o!="string")throw new Error("value must be typeof string but got "+typeof o);var Ie=typeof g=="string"?"cm-theme-"+g:"cm-theme";return kl("div",Pn({ref:ce,className:""+Ie+(n?" "+n:"")},Oe))});uo.displayName="CodeMirror";var la=uo;export{fe as Annotation,Ml as AnnotationType,El as BidiSpan,Rl as BlockInfo,wl as BlockType,Tl as BlockWrapper,fn as ChangeDesc,hn as ChangeSet,B as CharCategory,Cl as Compartment,v as Decoration,gn as Direction,m as EditorSelection,_ as EditorState,y as EditorView,ao as ExternalChange,$ as Facet,yo as GutterMarker,Sl as Line,bl as MapMode,Pl as MatchDecorator,dn as Prec,Bl as Range,mo as RangeSet,$e as RangeSetBuilder,Ll as RangeValue,Fl as RectangleMarker,vl as SelectionRange,L as StateEffect,Al as StateEffectType,ne as StateField,bt as Text,_e as Transaction,He as ViewPlugin,Ol as ViewUpdate,mn as WidgetType,Ql as __test,Cn as activateHover,jt as basicSetup,Gl as closeHoverTooltip,Hl as closeHoverTooltips,an as codePointAt,un as codePointSize,ws as color,Z as combineConfig,Ve as countColumn,bn as crosshairCursor,la as default,to as defaultLightThemeOption,vt as drawSelection,yn as dropCursor,N as findClusterBreak,Dl as findColumn,cn as fromCodePoint,no as getDefaultExtensions,An as getDialog,Wl as getDrawSelectionConfig,de as getPanel,ro as getStatistics,$l as getTooltip,xo as gutter,Kl as gutterLineClass,zl as gutterWidgetClass,Jl as gutters,Vl as hasHoverTooltips,xn as highlightActiveLine,Bn as highlightActiveLineGutter,Ct as highlightSpecialChars,Xl as highlightTrailingWhitespace,Zl as highlightWhitespace,vn as hoverTooltip,he as keymap,Il as layer,jl as lineNumberMarkers,Yl as lineNumberWidgetMarker,Ln as lineNumbers,go as logException,Ms as minimalSetup,eo as oneDark,ul as oneDarkHighlightStyle,cl as oneDarkTheme,Ul as panels,kn as placeholder,Sn as rectangularSelection,ql as repositionTooltips,pn as runScopeHandlers,Nl as scrollPastEnd,Mn as showDialog,Ge as showPanel,po as showTooltip,_l as tooltips,co as useCodeMirror};
|