1import{q as le,S as A,G as xe,E as I,a1 as g,J as be,a2 as Z,a3 as Ce,a4 as He,Y as Se,a5 as L,a6 as R,a7 as ve,D as w,i as ht,R as ft,a8 as b,a9 as C,aa as je,ab as ut,ac as Ve,ad as dt,A as pt,$ as mt,ae as me,m as gt,af as yt,ag as xt,ah as Me,ai as bt}from"./index-CwLudJcF.js";try{let i=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new i.Error().stack;e&&(i._sentryDebugIds=i._sentryDebugIds||{},i._sentryDebugIds[e]="2c83573f-f02c-4fe9-970b-180f35da5b08",i._sentryDebugIdIdentifier="sentry-dbid-2c83573f-f02c-4fe9-970b-180f35da5b08")}catch{}const Re=typeof String.prototype.normalize=="function"?i=>i.normalize("NFKD"):i=>i;class U{constructor(e,t,n=0,s=e.length,o,r){this.test=r,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(n,s),this.bufferStart=n,this.normalize=o?l=>o(Re(l)):Re,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return L(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=ve(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=R(e);let s=this.normalize(t);if(s.length)for(let o=0,r=n;;o++){let l=s.charCodeAt(o),a=this.match(l,r,this.bufferPos+this.bufferStart);if(o==s.length-1){if(a)return this.value=a,this;break}r==n&&o<t.length&&t.charCodeAt(o)==l&&r++}}}match(e,t,n){let s=null;for(let o=0;o<this.matches.length;o+=2){let r=this.matches[o],l=!1;this.query.charCodeAt(r)==e&&(r==this.query.length-1?s={from:this.matches[o+1],to:n}:(this.matches[o]++,l=!0)),l||(this.matches.splice(o,2),o-=2)}return this.query.charCodeAt(0)==e&&(this.query.length==1?s={from:t,to:n}:this.matches.push(1,t)),s&&this.test&&!this.test(s.from,s.to,this.buffer,this.bufferStart)&&(s=null),s}}typeof Symbol<"u"&&(U.prototype[Symbol.iterator]=function(){return this});const Qe={from:-1,to:-1,match:/.*/.exec("")},we="gm"+(/x/.unicode==null?"":"u");class Ke{constructor(e,t,n,s=0,o=e.length){if(this.text=e,this.to=o,this.curLine="",this.done=!1,this.value=Qe,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new _e(e,t,n,s,o);this.re=new RegExp(t,we+(n?.ignoreCase?"i":"")),this.test=n?.test,this.iter=e.iter();let r=e.lineAt(s);this.curLineStart=r.from,this.matchPos=ee(e,s),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine="":(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let n=this.curLineStart+t.index,s=n+t[0].length;if(this.matchPos=ee(this.text,s+(n==s?1:0)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(n<s||n>this.value.to)&&(!this.test||this.test(n,s,t)))return this.value={from:n,to:s,match:t},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),e=0;else return this.done=!0,this}}}const he=new WeakMap;class N{constructor(e,t){this.from=e,this.text=t}get to(){return this.from+this.text.length}static get(e,t,n){let s=he.get(e);if(!s||s.from>=n||s.to<=t){let l=new N(t,e.sliceString(t,n));return he.set(e,l),l}if(s.from==t&&s.to==n)return s;let{text:o,from:r}=s;return r>t&&(o=e.sliceString(t,r)+o,r=t),s.to<n&&(o+=e.sliceString(s.to,n)),he.set(e,new N(r,o)),new N(t,o.slice(t-r,n-r))}}class _e{constructor(e,t,n,s,o){this.text=e,this.to=o,this.done=!1,this.value=Qe,this.matchPos=ee(e,s),this.re=new RegExp(t,we+(n?.ignoreCase?"i":"")),this.test=n?.test,this.flat=N.get(e,s,this.chunkEnd(s+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let n=this.flat.from+t.index,s=n+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(n,s,t)))return this.value={from:n,to:s,match:t}
1,this.matchPos=ee(this.text,s+(n==s?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=N.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(Ke.prototype[Symbol.iterator]=_e.prototype[Symbol.iterator]=function(){return this});function Ct(i){try{return new RegExp(i,we),!0}catch{return!1}}function ee(i,e){if(e>=i.length)return e;let t=i.lineAt(e),n;for(;e<t.to&&(n=t.text.charCodeAt(e-t.from))>=56320&&n<57344;)e++;return e}function ge(i){let e=String(i.state.doc.lineAt(i.state.selection.main.head).number),t=b("input",{class:"cm-textfield",name:"line",value:e}),n=b("form",{class:"cm-gotoLine",onkeydown:o=>{o.keyCode==27?(o.preventDefault(),i.dispatch({effects:j.of(!1)}),i.focus()):o.keyCode==13&&(o.preventDefault(),s())},onsubmit:o=>{o.preventDefault(),s()}},b("label",i.state.phrase("Go to line"),": ",t)," ",b("button",{class:"cm-button",type:"submit"},i.state.phrase("go")),b("button",{name:"close",onclick:()=>{i.dispatch({effects:j.of(!1)}),i.focus()},"aria-label":i.state.phrase("close"),type:"button"},["Ã"]));function s(){let o=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(t.value);if(!o)return;let{state:r}=i,l=r.doc.lineAt(r.selection.main.head),[,a,h,c,f]=o,d=c?+c.slice(1):0,u=h?+h:l.number;if(h&&f){let k=u/100;a&&(k=k*(a=="-"?-1:1)+l.number/r.doc.lines),u=Math.round(r.doc.lines*k)}else h&&a&&(u=u*(a=="-"?-1:1)+l.number);let p=r.doc.line(Math.max(1,Math.min(r.doc.lines,u))),y=g.cursor(p.from+Math.max(0,Math.min(d,p.length)));i.dispatch({effects:[j.of(!1),I.scrollIntoView(y.from,{y:"center"})],selection:y}),i.focus()}return{dom:n}}const j=A.define(),Te=le.define({create(){return!0},update(i,e){for(let t of e.effects)t.is(j)&&(i=t.value);return i},provide:i=>He.from(i,e=>e?ge:null)}),St=i=>{let e=Z(i,ge);if(!e){let t=[j.of(!0)];i.state.field(Te,!1)==null&&t.push(A.appendConfig.of([Te,vt])),i.dispatch({effects:t}),e=Z(i,ge)}return e&&e.dom.querySelector("input").select(),!0},vt=I.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px",position:"relative","& label":{fontSize:"80%"},"& [name=close]":{position:"absolute",top:"0",bottom:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:"0"}}}),Mt={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},wt=be.define({combine(i){return Se(i,Mt,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function Ri(i){return[kt,At]}const It=w.mark({class:"cm-selectionMatch"}),Lt=w.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function Oe(i,e,t,n){return(t==0||i(e.sliceDoc(t-1,t))!=C.Word)&&(n==e.doc.length||i(e.sliceDoc(n,n+1))!=C.Word)}function Dt(i,e,t,n){return i(e.sliceDoc(t,t+1))==C.Word&&i(e.sliceDoc(n-1,n))==C.Word}const At=Ce.fromClass(class{constructor(i){this.decorations=this.getDeco(i)}update(i){(i.selectionSet||i.docChanged||i.viewportChanged)&&(this.decorations=this.getDeco(i.view))}getDeco(i){let e=i.state.facet(wt),{state:t}=i,n=t.selection;if(n.ranges.length>1)return w.none;let s=n.main,o,r=null;if(s.empty){if(!e.highlightWordAroundCursor)return w.none;let a=t.wordAt(s.head);if(!a)return w.none;r=t.charCategorizer(s.head),o=t.sliceDoc(a.from,a.to)}else{let a=s.to-s.from;if(a<e.minSelectionLength||a>200)return w.none;if(e.wholeWords){if(o=t.sliceDoc(s.from,s.to),r=t.charCategorizer(s.head),!(Oe(r,t,s.from,s.to)&&Dt(r,t,s.from,s.to)))return w.none}else if(o=t.sliceDoc(s.from,s.to),!o)return w.none}let l=[];for(let a of i.visibleRanges){let h=new U(t.doc,o,a.from,a.to);for(;!h.next().done;){let{from:c,to:f}=h.value;if((!r||Oe(r,t,c,f))&&(s.empty&&c<=s.from&&f>=s.to?l.push(Lt.range(c,f)):(c>=s.to||f<=s.from)&&l.push(It.range(c,f)),l.length>e.maxMatches))return w.none}}return w.set(l)}},{decorations:i=>i.decorations}),kt=I.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),Et=({state:i,dispatch:e})=>{let{selection:t}=i,n=g.create(t.ranges.map(s=>i.wordAt(s.head)||g.cursor(s.head)),t.mainIndex);return n.eq(t)?!1:(e(i.update({selection:n})),!0)};function Rt(i,e){let{main:t,ranges:n}=i.selection,s=i.wordAt(t.head),o=s&&s.from==t.from&&s.to==t.to;for(let r=!1,l=new U(i.doc,e,n[n.length-1].to);;)if(l.next(),l.done){if(r)return null;l=new U(i.doc,e,0,Math.max(0,n[n.length-1].from-1)),r=!0}else{if(r&&n.some(a=>a.from==l.value.from))continue;if(o){let a=i.wordAt(l.value.from);if(!a||a.from!=l.value.from||a.to!=l.value.to)continue}return l.value}}const Tt=({state:i,dispatch:e})=>{let{ranges:t}=i.selection;if(t.some(o=>o.from===o.to))return Et({state:i,dispatch:e});let n=i.sliceDoc(t[0].from,t[0].to);if(i.selection.ranges.some(o=>i.sliceDoc(o.from,o.to)!=n))return!1;let s=Rt(i,n);return s?(e(i.update({selection:i.selection.addRange(g.range(s.from,s.to),!1),effects:I.scrollIntoView(s.to)})),!0):!1},H=be.define({combine(i){return Se(i,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new Ht(e),scrollToMatch:e=>I.scrollIntoView(e)})}});class Ye{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||Ct(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(t,n)=>n=="n"?` 2`:n=="r"?"\r":n=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord}create(){return this.regexp?new Ft(this):new Pt(this)}getCursor(e,t=0,n){let s=e.doc?e:ht.create({doc:e});return n==null&&(n=s.doc.length),this.regexp?q(this,s,t,n):B(this,s,t,n)}}class Ge{constructor(e){this.spec=e}}function B(i,e,t,n){return new U(e.doc,i.unquoted,t,n,i.caseSensitive?void 0:s=>s.toLowerCase(),i.wholeWord?Ot(e.doc,e.charCategorizer(e.selection.main.head)):void 0)}function Ot(i,e){return(t,n,s,o)=>((o>t||o+s.length<n)&&(o=Math.max(0,t-2),s=i.sliceString(o,Math.min(i.length,n+2))),(e(te(s,t-o))!=C.Word||e(ie(s,t-o))!=C.Word)&&(e(ie(s,n-o))!=C.Word||e(te(s,n-o))!=C.Word))}class Pt extends Ge{constructor(e){super(e)}
vendor: 8,947 bytes, line 2
2nextMatch(e,t,n){let s=B(this.spec,e,n,e.doc.length).nextOverlapping();if(s.done){let o=Math.min(e.doc.length,t+this.spec.unquoted.length);s=B(this.spec,e,0,o).nextOverlapping()}return s.done||s.value.from==t&&s.value.to==n?null:s.value}prevMatchInRange(e,t,n){for(let s=n;;){let o=Math.max(t,s-1e4-this.spec.unquoted.length),r=B(this.spec,e,o,s),l=null;for(;!r.nextOverlapping().done;)l=r.value;if(l)return l;if(o==t)return null;s-=1e4}}prevMatch(e,t,n){let s=this.prevMatchInRange(e,0,t);return s||(s=this.prevMatchInRange(e,Math.max(0,n-this.spec.unquoted.length),e.doc.length)),s&&(s.from!=t||s.to!=n)?s:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let n=B(this.spec,e,0,e.doc.length),s=[];for(;!n.next().done;){if(s.length>=t)return null;s.push(n.value)}return s}highlight(e,t,n,s){let o=B(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));for(;!o.next().done;)s(o.value.from,o.value.to)}}function q(i,e,t,n){return new Ke(e.doc,i.search,{ignoreCase:!i.caseSensitive,test:i.wholeWord?Wt(e.charCategorizer(e.selection.main.head)):void 0},t,n)}function te(i,e){return i.slice(je(i,e,!1),e)}function ie(i,e){return i.slice(e,je(i,e))}function Wt(i){return(e,t,n)=>!n[0].length||(i(te(n.input,n.index))!=C.Word||i(ie(n.input,n.index))!=C.Word)&&(i(ie(n.input,n.index+n[0].length))!=C.Word||i(te(n.input,n.index+n[0].length))!=C.Word)}class Ft extends Ge{nextMatch(e,t,n){let s=q(this.spec,e,n,e.doc.length).next();return s.done&&(s=q(this.spec,e,0,t).next()),s.done?null:s.value}prevMatchInRange(e,t,n){for(let s=1;;s++){let o=Math.max(t,n-s*1e4),r=q(this.spec,e,o,n),l=null;for(;!r.next().done;)l=r.value;if(l&&(o==t||l.from>o+10))return l;if(o==t)return null}}prevMatch(e,t,n){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,n)=>{if(n=="&")return e.match[0];if(n=="$")return"$";for(let s=n.length;s>0;s--){let o=+n.slice(0,s);if(o>0&&o<e.match.length)return e.match[o]+n.slice(s)}return t})}matchAll(e,t){let n=q(this.spec,e,0,e.doc.length),s=[];for(;!n.next().done;){if(s.length>=t)return null;s.push(n.value)}return s}highlight(e,t,n,s){let o=q(this.spec,e,Math.max(0,t-250),Math.min(n+250,e.doc.length));for(;!o.next().done;)s(o.value.from,o.value.to)}}const V=A.define(),Ie=A.define(),O=le.define({create(i){return new fe(ye(i).create(),null)},update(i,e){for(let t of e.effects)t.is(V)?i=new fe(t.value.create(),i.panel):t.is(Ie)&&(i=new fe(i.query,t.value?Le:null));return i},provide:i=>He.from(i,e=>e.panel)});class fe{constructor(e,t){this.query=e,this.panel=t}}const Bt=w.mark({class:"cm-searchMatch"}),qt=w.mark({class:"cm-searchMatch cm-searchMatch-selected"}),$t=Ce.fromClass(class{constructor(i){this.view=i,this.decorations=this.highlight(i.state.field(O))}update(i){let e=i.state.field(O);(e!=i.startState.field(O)||i.docChanged||i.selectionSet||i.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:i,panel:e}){if(!e||!i.spec.valid)return w.none;let{view:t}=this,n=new ft;for(let s=0,o=t.visibleRanges,r=o.length;s<r;s++){let{from:l,to:a}=o[s];for(;s<r-1&&a>o[s+1].from-500;)a=o[++s].to;i.highlight(t.state,l,a,(h,c)=>{let f=t.state.selection.ranges.some(d=>d.from==h&&d.to==c);n.add(h,c,f?qt:Bt)})}return n.finish()}},{decorations:i=>i.decorations});function _(i){return e=>{let t=e.state.field(O,!1);return t&&t.query.spec.valid?i(e,t):Ze(e)}}const ne=_((i,{query:e})=>{let{to:t}=i.state.selection.main,n=e.nextMatch(i.state,t,t);if(!n)return!1;let s=g.single(n.from,n.to),o=i.state.facet(H);return i.dispatch({selection:s,effects:[De(i,n),o.scrollToMatch(s.main,i)],userEvent:"select.search"}),Je(i),!0}),se=_((i,{query:e})=>{let{state:t}=i,{from:n}=t.selection.main,s=e.prevMatch(t,n,n);if(!s)return!1;let o=g.single(s.from,s.to),r=i.state.facet(H);return i.dispatch({selection:o,effects:[De(i,s),r.scrollToMatch(o.main,i)],userEvent:"select.search"}),Je(i),!0}),Nt=_((i,{query:e})=>{let t=e.matchAll(i.state,1e3);return!t||!t.length?!1:(i.dispatch({selection:g.create(t.map(n=>g.range(n.from,n.to))),userEvent:"select.search.matches"}),!0)}),zt=({state:i,dispatch:e})=>{let t=i.selection;if(t.ranges.length>1||t.main.empty)return!1;let{from:n,to:s}=t.main,o=[],r=0;for(let l=new U(i.doc,i.sliceDoc(n,s));!l.next().done;){if(o.length>1e3)return!1;l.value.from==n&&(r=o.length),o.push(g.range(l.value.from,l.value.to))}return e(i.update({selection:g.create(o,r),userEvent:"select.search.matches"})),!0},Pe=_((i,{query:e})=>{let{state:t}=i,{from:n,to:s}=t.selection.main;if(t.readOnly)return!1;let o=e.nextMatch(t,n,n);if(!o)return!1;let r=o,l=[],a,h,c=[];r.from==n&&r.to==s&&(h=t.toText(e.getReplacement(r)),l.push({from:r.from,to:r.to,insert:h}),r=e.nextMatch(t,r.from,r.to),c.push(I.announce.of(t.phrase("replaced match on line $",t.doc.lineAt(n).number)+".")));let f=i.state.changes(l);return r&&(a=g.single(r.from,r.to).map(f),c.push(De(i,r)),c.push(t.facet(H).scrollToMatch(a.main,i))),i.dispatch({changes:f,selection:a,effects:c,userEvent:"input.replace"}),!0}),Ut=_((i,{query:e})=>{if(i.state.readOnly)return!1;let t=e.matchAll(i.state,1e9).map(s=>{let{from:o,to:r}=s;return{from:o,to:r,insert:e.getReplacement(s)}});if(!t.length)return!1;let n=i.state.phrase("replaced $ matches",t.length)+".";return i.dispatch({changes:t,effects:I.announce.of(n),userEvent:"input.replace.all"}),!0});function Le(i){return i.state.facet(H).createPanel(i)}function ye(i,e){var t,n,s,o,r;let l=i.selection.main,a=l.empty||l.to>l.from+100?"":i.sliceDoc(l.from,l.to);if(e&&!a)return e;let h=i.facet(H);return new Ye({search:((t=e?.literal)!==null&&t!==void 0?t:h.literal)?a:a.replace(/\n/g,"\\n"),caseSensitive:(n=e?.caseSensitive)!==null&&n!==void 0?n:h.caseSensitive,literal:(s=e?.literal)!==null&&s!==void 0?s:h.literal,regexp:(o=e?.regexp)!==null&&o!==void 0?o:h.regexp,wholeWord:(r=e?.wholeWord)!==null&&r!==void 0?r:h.wholeWord})}function Xe(i){let e=Z(i,Le);return e&&e.dom.querySelector("[main-field]")}function Je(i){let e=Xe(i);e&&e==i.root.activeElement&&e.select()}const Ze=i=>{let e=i.state.field(O,!1);if(e&&e.panel){let t=Xe(i);if(t&&t!=i.root.activeElement){let n=ye(i.state,e.query.spec);n.valid&&i.dispatch({effects:V.of(n)}),t.focus(),t.select()}}else i.dispatch({effects:[Ie.of(!0),e?V.of(ye(i.state,e.query.spec)):A.appendConfig.of(Vt)]});return!0},et=i=>{let e=i.state.field(O,!1);if(!e||!e.panel)return!1;let t=Z(i,Le);return t&&t.dom.contains(i.root.activeElement)&&i.focus(),i.dispatch({effects:Ie.of(!1)}),!0},Ti=[{key:"Mod-f",run:Ze,scope:"editor search-panel"},{key:"F3",run:ne,shift:se,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:ne,shift:se,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:et,scope:"editor search-panel"},{key:"Mod-Shift-l",run:zt},{key:"Mod-Alt-g",run:St},{key:"Mod-d",run:Tt,preventDefault:!0}];class Ht{constructor(e){this.view=e;let t=this.query=e.state.field(O).query.spec;this.commit=this.commit.bind(this),this.searchField=b("input",{value:t.search,placeholder:M(e,"Find"),"aria-label":M(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=b("input",{value:t.replace,placeholder:M(e,"Replace"),"aria-label":M(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=b("input",{type:"checkbox",name:"case",form:"",checked:t.caseSensitive,onchange:this.commit}),this.reField=b("input",{type:"checkbox",name:"re",form:"",checked:t.regexp,onchange:this.commit}),this.wordField=b("input",{type:"checkbox",name:"word",form:"",checked:t.wholeWord,onchange:this.commit});function n(s,o,r){return b("button",{class:"cm-button",name:s,onclick:o,type:"button"},r)}this.dom=b("div",{onkeydown:s=>this.keydown(s),class:"cm-search"},[this.searchField,n("next",()=>ne(e),[M(e,"next")]),n("prev",()=>se(e),[M(e,"previous")]),n("select",()=>Nt(e),[M(e,"all")]),b("label",null,[this.caseField,M(e,"match case")]),b("label",null,[this.reField,M(e,"regexp")]),b("label",null,[this.wordField,M(e,"by word")]),...e.state.readOnly?[]:[b("br"),this.replaceField,n("replace",()=>Pe(e),[M(e,"replace")]),n("replaceAll",()=>Ut(e),[M(e,"replace all")])],b("button",{name:"close",onclick:()=>et(e),"aria-label":M(e,"close"),type:"button"},["Ã"])])}commit(){let e=new Ye({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:V.of(e)}))}keydown(e){ut(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?se:ne)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),Pe(this.view))}update(e){for(let t of e.transactions)for(let n of t.effects)n.is(V)&&
2!n.value.eq(this.query)&&this.setQuery(n.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(H).top}}function M(i,e){return i.state.phrase(e)}const G=30,X=/[\s\.,:;?!]/;function De(i,{from:e,to:t}){let n=i.state.doc.lineAt(e),s=i.state.doc.lineAt(t).to,o=Math.max(n.from,e-G),r=Math.min(s,t+G),l=i.state.sliceDoc(o,r);if(o!=n.from){for(let a=0;a<G;a++)if(!X.test(l[a+1])&&X.test(l[a])){l=l.slice(a);break}}if(r!=s){for(let a=l.length-1;a>l.length-G;a--)if(!X.test(l[a-1])&&X.test(l[a])){l=l.slice(0,a);break}}return I.announce.of(`${i.state.phrase("current match")}. ${l} ${i.state.phrase("on line")} ${n.number}.`)}const jt=I.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"}}),Vt=[O,xe.low($t),jt];class tt{constructor(e,t,n,s){this.state=e,this.pos=t,this.explicit=n,this.view=s,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let t=Me(this.state).resolveInner(this.pos,-1);for(;t&&e.indexOf(t.name)<0;)t=t.parent;return t?{from:t.from,to:this.pos,text:this.state.sliceDoc(t.from,this.pos),type:t.type}:null}matchBefore(e){let t=this.state.doc.lineAt(this.pos),n=Math.max(t.from,this.pos-250),s=t.text.slice(n-t.from,this.pos-t.from),o=s.search(it(e,!1));return o<0?null:{from:n+o,to:this.pos,text:s.slice(o)}}get aborted(){return this.abortListeners==null}addEventListener(e,t,n){e=="abort"&&this.abortListeners&&(this.abortListeners.push(t),n&&n.onDocChange&&(this.abortOnDocChange=!0))}}function We(i){let e=Object.keys(i).join(""),t=/\w/.test(e);return t&&(e=e.replace(/\w/g,"")),`[${t?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function Qt(i){let e=Object.create(null),t=Object.create(null);for(let{label:s}of i){e[s[0]]=!0;for(let o=1;o<s.length;o++)t[s[o]]=!0}let n=We(e)+We(t)+"*$";return[new RegExp("^"+n),new RegExp(n)]}function Kt(i){let e=i.map(s=>typeof s=="string"?{label:s}:s),[t,n]=e.every(s=>/^\w+$/.test(s.label))?[/\w*$/,/\w+$/]:Qt(e);return s=>{let o=s.matchBefore(n);return o||s.explicit?{from:o?o.from:s.pos,options:e,validFor:t}:null}}class Fe{constructor(e,t,n,s){this.completion=e,this.source=t,this.match=n,this.score=s}}function W(i){return i.selection.main.from}function it(i,e){var t;let{source:n}=i,s=e&&n[0]!="^",o=n[n.length-1]!="$";return!s&&!o?i:new RegExp(`${s?"^":""}(?:${n})${o?"$":""}`,(t=i.flags)!==null&&t!==void 0?t:i.ignoreCase?"i":"")}const nt=pt.define();function _t(i,e,t,n){let{main:s}=i.selection,o=t-s.from,r=n-s.from;return{...i.changeByRange(l=>{if(l!=s&&t!=n&&i.sliceDoc(l.from+o,l.from+r)!=i.sliceDoc(t,n))return{range:l};let a=i.toText(e);return{changes:{from:l.from+o,to:n==s.from?l.to:l.from+r,insert:a},range:g.cursor(l.from+o+a.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const Be=new WeakMap;function Yt(i){if(!Array.isArray(i))return i;let e=Be.get(i);return e||Be.set(i,e=Kt(i)),e}const oe=A.define(),Q=A.define();class Gt{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let t=0;t<e.length;){let n=L(e,t),s=R(n);this.chars.push(n);let o=e.slice(t,t+s),r=o.toUpperCase();this.folded.push(L(r==o?o.toLowerCase():r,0)),t+=s}this.astral=e.length!=this.chars.length}ret(e,t){return this.score=e,this.matched=t,this}match(e){if(this.pattern.length==0)return this.ret(-100,[]);if(e.length<this.pattern.length)return null;let{chars:t,folded:n,any:s,precise:o,byWord:r}=this;if(t.length==1){let m=L(e,0),F=R(m),E=F==e.length?0:-100;if(m!=t[0])if(m==n[0])E+=-200;else return null;return this.ret(E,[0,F])}let l=e.indexOf(this.pattern);if(l==0)return this.ret(e.length==this.pattern.length?0:-100,[0,this.pattern.length]);let a=t.length,h=0;if(l<0){for(let m=0,F=Math.min(e.length,200);m<F&&h<a;){let E=L(e,m);(E==t[h]||E==n[h])&&(s[h++]=m),m+=R(E)}if(h<a)return null}let c=0,f=0,d=!1,u=0,p=-1,y=-1,k=/[a-z]/.test(e),T=!0;for(let m=0,F=Math.min(e.length,200),E=0;m<F&&f<a;){let S=L(e,m);l<0&&(c<a&&S==t[c]&&(o[c++]=m),u<a&&(S==t[u]||S==n[u]?(u==0&&(p=m),y=m+1,u++):u=0));let Y,ce=S<255?S>=48&&S<=57||S>=97&&S<=122?2:S>=65&&S<=90?1:0:(Y=ve(S))!=Y.toLowerCase()?1:Y!=Y.toUpperCase()?2:0;(!m||ce==1&&k||E==0&&ce!=0)&&(t[f]==S||n[f]==S&&(d=!0)?r[f++]=m:r.length&&(T=!1)),E=ce,m+=R(S)}return f==a&&r[0]==0&&T?this.result(-100+(d?-200:0),r,e):u==a&&p==0?this.ret(-200-e.length+(y==e.length?0:-100),[0,y]):l>-1?this.ret(-700-e.length,[l,l+this.pattern.length]):u==a?this.ret(-900-e.length,[p,y]):f==a?this.result(-100+(d?-200:0)+-700+(T?0:-1100),r,e):t.length==2?null:this.result((s[0]?-700:0)+-200+-1100,s,e)}result(e,t,n){let s=[],o=0;for(let r of t){let l=r+(this.astral?R(L(n,r)):1);o&&s[o-1]==r?s[o-1]=l:(s[o++]=r,s[o++]=l)}return this.ret(e-n.length,s)}}class Xt{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length<this.pattern.length)return null;let t=e.slice(0,this.pattern.length),n=t==this.pattern?0:t.toLowerCase()==this.folded?-200:null;return n==null?null:(this.matched=[0,t.length],this.score=n+(e.length==this.pattern.length?0:-100),this)}}const x=be.define({combine(i){return Se(i,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:Jt,filterStrict:!1,compareCompletions:(e,t)=>e.label.localeCompare(t.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,t)=>e&&t,closeOnBlur:(e,t)=>e&&t,icons:(e,t)=>e&&t,tooltipClass:(e,t)=>n=>
vendor: 4,256 bytes, line 2
2qe(e(n),t(n)),optionClass:(e,t)=>n=>qe(e(n),t(n)),addToOptions:(e,t)=>e.concat(t),filterStrict:(e,t)=>e||t})}});function qe(i,e){return i?e?i+" "+e:i:e}function Jt(i,e,t,n,s,o){let r=i.textDirection==bt.RTL,l=r,a=!1,h="top",c,f,d=e.left-s.left,u=s.right-e.right,p=n.right-n.left,y=n.bottom-n.top;if(l&&d<Math.min(p,u)?l=!1:!l&&u<Math.min(p,d)&&(l=!0),p<=(l?d:u))c=Math.max(s.top,Math.min(t.top,s.bottom-y))-e.top,f=Math.min(400,l?d:u);else{a=!0,f=Math.min(400,(r?e.right:s.right-e.left)-30);let m=s.bottom-e.bottom;m>=y||m>e.top?c=t.bottom-e.top:(h="bottom",c=e.bottom-t.top)}let k=(e.bottom-e.top)/o.offsetHeight,T=(e.right-e.left)/o.offsetWidth;return{style:`${h}: ${c/k}px; max-width: ${f/T}px`,class:"cm-completionInfo-"+(a?r?"left-narrow":"right-narrow":l?"left":"right")}}function Zt(i){let e=i.addToOptions.slice();return i.icons&&e.push({render(t){let n=document.createElement("div");return n.classList.add("cm-completionIcon"),t.type&&n.classList.add(...t.type.split(/\s+/g).map(s=>"cm-completionIcon-"+s)),n.setAttribute("aria-hidden","true"),n},position:20}),e.push({render(t,n,s,o){let r=document.createElement("span");r.className="cm-completionLabel";let l=t.displayLabel||t.label,a=0;for(let h=0;h<o.length;){let c=o[h++],f=o[h++];c>a&&r.appendChild(document.createTextNode(l.slice(a,c)));let d=r.appendChild(document.createElement("span"));d.appendChild(document.createTextNode(l.slice(c,f))),d.className="cm-completionMatchedText",a=f}return a<l.length&&r.appendChild(document.createTextNode(l.slice(a))),r},position:50},{render(t){if(!t.detail)return null;let n=document.createElement("span");return n.className="cm-completionDetail",n.textContent=t.detail,n},position:80}),e.sort((t,n)=>t.position-n.position).map(t=>t.render)}function ue(i,e,t){if(i<=t)return{from:0,to:i};if(e<0&&(e=0),e<=i>>1){let s=Math.floor(e/t);return{from:s*t,to:(s+1)*t}}let n=Math.floor((i-e)/t);return{from:i-(n+1)*t,to:i-n*t}}class ei{constructor(e,t,n){this.view=e,this.stateField=t,this.applyCompletion=n,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:a=>this.placeInfo(a),key:this},this.space=null,this.currentClass="";let s=e.state.field(t),{options:o,selected:r}=s.open,l=e.state.facet(x);this.optionContent=Zt(l),this.optionClass=l.optionClass,this.tooltipClass=l.tooltipClass,this.range=ue(o.length,r,l.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",a=>{let{options:h}=e.state.field(t).open;for(let c=a.target,f;c&&c!=this.dom;c=c.parentNode)if(c.nodeName=="LI"&&(f=/-(\d+)$/.exec(c.id))&&+f[1]<h.length){this.applyCompletion(e,h[+f[1]]),a.preventDefault();return}}),this.dom.addEventListener("focusout",a=>{let h=e.state.field(this.stateField,!1);h&&h.tooltip&&e.state.facet(x).closeOnBlur&&a.relatedTarget!=e.contentDOM&&e.dispatch({effects:Q.of(null)})}),this.showOptions(o,s.id)}mount(){this.updateSel()}showOptions(e,t){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,t,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var t;let n=e.state.field(this.stateField),s=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),n!=s){let{options:o,selected:r,disabled:l}=n.open;(!s.open||s.open.options!=o)&&(this.range=ue(o.length,r,e.state.facet(x).maxRenderedOptions),this.showOptions(o,n.id)),this.updateSel(),l!=((t=s.open)===null||t===void 0?void 0:t.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!l)}}updateTooltipClass(e){let t=this.tooltipClass(e);if(t!=this.currentClass){for(let n of this.currentClass.split(" "))n&&this.dom.classList.remove(n);for(let n of t.split(" "))n&&this.dom.classList.add(n);this.currentClass=t}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),t=e.open;if((t.selected>-1&&t.selected<this.range.from||t.selected>=this.range.to)&&(this.range=ue(t.options.length,t.selected,this.view.state.facet(x).maxRenderedOptions),this.showOptions(t.options,e.id)),this.updateSelectedOption(t.selected)){this.destroyInfo();
vendor: 4,330 bytes, line 2
2let{completion:n}=t.options[t.selected],{info:s}=n;if(!s)return;let o=typeof s=="string"?document.createTextNode(s):s(n);if(!o)return;"then"in o?o.then(r=>{r&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(r,n)}).catch(r=>me(this.view.state,r,"completion info")):this.addInfoPane(o,n)}}addInfoPane(e,t){this.destroyInfo();let n=this.info=document.createElement("div");if(n.className="cm-tooltip cm-completionInfo",e.nodeType!=null)n.appendChild(e),this.infoDestroy=null;else{let{dom:s,destroy:o}=e;n.appendChild(s),this.infoDestroy=o||null}this.dom.appendChild(n),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let t=null;for(let n=this.list.firstChild,s=this.range.from;n;n=n.nextSibling,s++)n.nodeName!="LI"||!n.id?s--:s==e?n.hasAttribute("aria-selected")||(n.setAttribute("aria-selected","true"),t=n):n.hasAttribute("aria-selected")&&n.removeAttribute("aria-selected");return t&&ii(this.list,t),t}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let t=this.dom.getBoundingClientRect(),n=this.info.getBoundingClientRect(),s=e.getBoundingClientRect(),o=this.space;if(!o){let r=this.dom.ownerDocument.documentElement;o={left:0,top:0,right:r.clientWidth,bottom:r.clientHeight}}return s.top>Math.min(o.bottom,t.bottom)-10||s.bottom<Math.max(o.top,t.top)+10?null:this.view.state.facet(x).positionInfo(this.view,t,s,n,o,this.dom)}placeInfo(e){this.info&&(e?(e.style&&(this.info.style.cssText=e.style),this.info.className="cm-tooltip cm-completionInfo "+(e.class||"")):this.info.style.cssText="top: -1e6px")}createListBox(e,t,n){const s=document.createElement("ul");s.id=t,s.setAttribute("role","listbox"),s.setAttribute("aria-expanded","true"),s.setAttribute("aria-label",this.view.state.phrase("Completions")),s.addEventListener("mousedown",r=>{r.target==s&&r.preventDefault()});let o=null;for(let r=n.from;r<n.to;r++){let{completion:l,match:a}=e[r],{section:h}=l;if(h){let d=typeof h=="string"?h:h.name;if(d!=o&&(r>n.from||n.from==0))if(o=d,typeof h!="string"&&h.header)s.appendChild(h.header(h));else{let u=s.appendChild(document.createElement("completion-section"));u.textContent=d}}const c=s.appendChild(document.createElement("li"));c.id=t+"-"+r,c.setAttribute("role","option");let f=this.optionClass(l);f&&(c.className=f);for(let d of this.optionContent){let u=d(l,this.view.state,this.view,a);u&&c.appendChild(u)}}return n.from&&s.classList.add("cm-completionListIncompleteTop"),n.to<e.length&&s.classList.add("cm-completionListIncompleteBottom"),s}destroyInfo(){this.info&&(this.infoDestroy&&this.infoDestroy(),this.info.remove(),this.info=null)}destroy(){this.destroyInfo()}}function ti(i,e){return t=>new ei(t,i,e)}function ii(i,e){let t=i.getBoundingClientRect(),n=e.getBoundingClientRect(),s=t.height/i.offsetHeight;n.top<t.top?i.scrollTop-=(t.top-n.top)/s:n.bottom>t.bottom&&(i.scrollTop+=(n.bottom-t.bottom)/s)}function $e(i){return(i.boost||0)*100+(i.apply?10:0)+(i.info?5:0)+(i.type?1:0)}function ni(i,e){let t=[],n=null,s=null,o=c=>{t.push(c);let{section:f}=c.completion;if(f){n||(n=[]);let d=typeof f=="string"?f:f.name;n.some(u=>u.name==d)||n.push(typeof f=="string"?{name:d}:f)}},r=e.facet(x);for(let c of i)if(c.hasResult()){let f=c.result.getMatch;if(c.result.filter===!1)for(let d of c.result.options)o(new Fe(d,c.source,f?f(d):[],1e9-t.length));else{let d=e.sliceDoc(c.from,c.to),u,p=r.filterStrict?new Xt(d):new Gt(d);for(let y of c.result.options)if(u=p.match(y.label)){let k=y.displayLabel?f?f(y,u.matched):[]:u.matched,T=u.score+(y.boost||0);if(o(new Fe(y,c.source,k,T)),typeof y.section=="object"&&y.section.rank==="dynamic"){let{name:m}=y.section;s||(s=Object.create(null)),s[m]=Math.max(T,s[m]||-1e9)}}}}if(n){let c=Object.create(null),f=0,d=(u,p)=>(u.rank==="dynamic"&&p.rank==="dynamic"?s[p.name]-s[u.name]:0)||(typeof u.rank=="number"?u.rank:1e9)-(typeof p.rank=="number"?p.rank:1e9)||(u.name<p.name?-1:1);for(let u of n.sort(d))f-=1e5,c[u.name]=f;for(let u of t){let{section:p}=u.completion;p&&(u.score+=c[typeof p=="string"?p:p.name])}}let l=[],a=null,h=r.compareCompletions;for(let c of t.sort((f,d)=>d.score-f.score||h(f.completion,d.completion))){let f=c.completion;!a||a.label!=f.label||a.detail!=f.detail||a.type!=null&&f.type!=null&&a.type!=f.type||a.apply!=f.apply||a.boost!=f.boost?l.push(c):$e(c.completion)>
vendor: 17,130 bytes, lines 2-3
2$e(a)&&(l[l.length-1]=c),a=c.completion}return l}class ${constructor(e,t,n,s,o,r){this.options=e,this.attrs=t,this.tooltip=n,this.timestamp=s,this.selected=o,this.disabled=r}setSelected(e,t){return e==this.selected||e>=this.options.length?this:new $(this.options,Ne(t,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,t,n,s,o,r){if(s&&!r&&e.some(h=>h.isPending))return s.setDisabled();let l=ni(e,t);if(!l.length)return s&&e.some(h=>h.isPending)?s.setDisabled():null;let a=t.facet(x).selectOnOpen?0:-1;if(s&&s.selected!=a&&s.selected!=-1){let h=s.options[s.selected].completion;for(let c=0;c<l.length;c++)if(l[c].completion==h){a=c;break}}return new $(l,Ne(n,a),{pos:e.reduce((h,c)=>c.hasResult()?Math.min(h,c.from):h,1e8),create:ci,above:o.aboveCursor},s?s.timestamp:Date.now(),a,!1)}map(e){return new $(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new $(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class re{constructor(e,t,n){this.active=e,this.id=t,this.open=n}static start(){return new re(li,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:t}=e,n=t.facet(x),o=(n.override||t.languageDataAt("autocomplete",W(t)).map(Yt)).map(a=>(this.active.find(c=>c.source==a)||new D(a,this.active.some(c=>c.state!=0)?1:0)).update(e,n));o.length==this.active.length&&o.every((a,h)=>a==this.active[h])&&(o=this.active);let r=this.open,l=e.effects.some(a=>a.is(Ae));r&&e.docChanged&&(r=r.map(e.changes)),e.selection||o.some(a=>a.hasResult()&&e.changes.touchesRange(a.from,a.to))||!si(o,this.active)||l?r=$.build(o,t,this.id,r,n,l):r&&r.disabled&&!o.some(a=>a.isPending)&&(r=null),!r&&o.every(a=>!a.isPending)&&o.some(a=>a.hasResult())&&(o=o.map(a=>a.hasResult()?new D(a.source,0):a));for(let a of e.effects)a.is(ot)&&(r=r&&r.setSelected(a.value,this.id));return o==this.active&&r==this.open?this:new re(o,this.id,r)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?oi:ri}}function si(i,e){if(i==e)return!0;for(let t=0,n=0;;){for(;t<i.length&&!i[t].hasResult();)t++;for(;n<e.length&&!e[n].hasResult();)n++;let s=t==i.length,o=n==e.length;if(s||o)return s==o;if(i[t++].result!=e[n++].result)return!1}}const oi={"aria-autocomplete":"list"},ri={};function Ne(i,e){let t={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":i};return e>-1&&(t["aria-activedescendant"]=i+"-"+e),t}const li=[];function st(i,e){if(i.isUserEvent("input.complete")){let n=i.annotation(nt);if(n&&e.activateOnCompletion(n))return 12}let t=i.isUserEvent("input.type");return t&&e.activateOnTyping?5:t?1:i.isUserEvent("delete.backward")?2:i.selection?8:i.docChanged?16:0}class D{constructor(e,t,n=!1){this.source=e,this.state=t,this.explicit=n}hasResult(){return!1}get isPending(){return this.state==1}update(e,t){let n=st(e,t),s=this;(n&8||n&16&&this.touches(e))&&(s=new D(s.source,0)),n&4&&s.state==0&&(s=new D(this.source,1)),s=s.updateFor(e,n);for(let o of e.effects)if(o.is(oe))s=new D(s.source,1,o.value);else if(o.is(Q))s=new D(s.source,0);else if(o.is(Ae))for(let r of o.value)r.source==s.source&&(s=r);return s}updateFor(e,t){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(W(e.state))}}class z extends D{constructor(e,t,n,s,o,r){super(e,3,t),this.limit=n,this.result=s,this.from=o,this.to=r}hasResult(){return!0}updateFor(e,t){var n;if(!(t&3))return this.map(e.changes);let s=this.result;s.map&&!e.changes.empty&&(s=s.map(s,e.changes));let o=e.changes.mapPos(this.from),r=e.changes.mapPos(this.to,1),l=W(e.state);if(l>r||!s||t&2&&(W(e.startState)==this.from||l<this.limit))return new D(this.source,t&4?1:0);let a=e.changes.mapPos(this.limit);return ai(s.validFor,e.state,o,r)?new z(this.source,this.explicit,a,s,o,r):s.update&&(s=s.update(s,o,r,new tt(e.state,l,!1)))?new z(this.source,this.explicit,a,s,s.from,(n=s.to)!==null&&n!==void 0?n:W(e.state)):new D(this.source,1,this.explicit)}map(e){return e.empty?this:(this.result.map?this.result.map(this.result,e):this.result)?new z(this.source,this.explicit,e.mapPos(this.limit),this.result,e.mapPos(this.from),e.mapPos(this.to,1)):new D(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}}function ai(i,e,t,n){if(!i)return!1;let s=e.sliceDoc(t,n);return typeof i=="function"?i(s,t,n,e):it(i,!0).test(s)}const Ae=A.define({map(i,e){return i.map(t=>t.map(e))}}),ot=A.define(),v=le.define({create(){return re.start()},update(i,e){return i.update(e)},provide:i=>[dt.from(i,e=>e.tooltip),I.contentAttributes.from(i,e=>e.attrs)]});function ke(i,e){const t=e.completion.apply||e.completion.label;let n=i.state.field(v).active.find(s=>s.source==e.source);return n instanceof z?(typeof t=="string"?i.dispatch({..._t(i.state,t,n.from,n.to),annotations:nt.of(e.completion)}):t(i,e.completion,n.from,n.to),!0):!1}const ci=ti(v,ke);function J(i,e="option"){return t=>{let n=t.state.field(v,!1);if(!n||!n.open||n.open.disabled||Date.now()-n.open.timestamp<t.state.facet(x).interactionDelay)return!1;let s=1,o;e=="page"&&(o=Ve(t,n.open.tooltip))&&(s=Math.max(2,Math.floor(o.dom.offsetHeight/o.dom.querySelector("li").offsetHeight)-1));let{length:r}=n.open.options,l=n.open.selected>-1?n.open.selected+s*(i?1:-1):i?0:r-1;return l<0?l=e=="page"?0:r-1:l>=r&&(l=e=="page"?r-1:0),t.dispatch({effects:ot.of(l)}),!0}}const hi=i=>{let e=i.state.field(v,!1);return i.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestamp<i.state.facet(x).interactionDelay?!1:ke(i,e.open.options[e.open.selected])},de=i=>i.state.field(v,!1)?(i.dispatch({effects:oe.of(!0)}),!0):!1,fi=i=>{let e=i.state.field(v,!1);return!e||!e.active.some(t=>t.state!=0)?!1:(i.dispatch({effects:Q.of(null)}),!0)};class ui{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}}const di=50,pi=1e3,mi=Ce.fromClass(class{constructor(i){this.view=i,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let e of i.state.field(v).active)e.isPending&&this.startQuery(e)}update(i){let e=i.state.field(v),t=i.state.facet(x);if(!i.selectionSet&&!i.docChanged&&i.startState.field(v)==e)return;let n=i.transactions.some(o=>{let r=st(o,t);return r&8||(o.selection||o.docChanged)&&!(r&3)});for(let o=0;o<this.running.length;o++){let r=this.running[o];if(n||r.context.abortOnDocChange&&i.docChanged||r.updates.length+i.transactions.length>di&&Date.now()-r.time>pi){for(let l of r.context.abortListeners)try{l()}catch(a){me(this.view.state,a)}r.context.abortListeners=null,this.running.splice(o--,1)}else r.updates.push(...i.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),i.transactions.some(o=>o.effects.some(r=>r.is(oe)))&&(this.pendingStart=!0);let s=this.pendingStart?50:t.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(o=>o.isPending&&!this.running.some(r=>r.active.source==o.source))?setTimeout(()=>this.startUpdate(),s):-1,this.composing!=0)for(let o of i.transactions)o.isUserEvent("input.type")?this.composing=2:this.composing==2&&o.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:i}=this.view,e=i.field(v);for(let t of e.active)t.isPending&&!this.running.some(n=>n.active.source==t.source)&&this.startQuery(t);this.running.length&&e.open&&e.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(x).updateSyncTime))}startQuery(i){let{state:e}=this.view,t=W(e),n=new tt(e,t,i.explicit,this.view),s=new ui(i,n);this.running.push(s),Promise.resolve(i.source(n)).then(o=>{s.context.aborted||(s.done=o||null,this.scheduleAccept())},o=>{this.view.dispatch({effects:Q.of(null)}),me(this.view.state,o)})}scheduleAccept(){this.running.every(i=>i.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(x).updateSyncTime))}accept(){var i;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],t=this.view.state.facet(x),n=this.view.state.field(v);for(let s=0;s<this.running.length;s++){let o=this.running[s];if(o.done===void 0)continue;if(this.running.splice(s--,1),o.done){let l=W(o.updates.length?o.updates[0].startState:this.view.state),a=Math.min(l,o.done.from+(o.active.explicit?0:1)),h=new z(o.active.source,o.active.explicit,a,o.done,o.done.from,(i=o.done.to)!==null&&i!==void 0?i:l);for(let c of o.updates)h=h.update(c,t);if(h.hasResult()){e.push(h);continue}}let r=n.active.find(l=>l.source==o.active.source);if(r&&r.isPending)if(o.done==null){let l=new D(o.active.source,0);for(let a of o.updates)l=l.update(a,t);l.isPending||e.push(l)}else this.startQuery(r)}(e.length||n.open&&n.open.disabled)&&this.view.dispatch({effects:Ae.of(e)})}},{eventHandlers:{blur(i){let e=this.view.state.field(v,!1);if(e&&e.tooltip&&this.view.state.facet(x).closeOnBlur){let t=e.open&&Ve(this.view,e.open.tooltip);(!t||!t.dom.contains(i.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:Q.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:oe.of(!1)}),20),this.composing=0}}}),gi=typeof navigator=="object"&&/Win/.test(navigator.platform),yi=xe.highest(I.domEventHandlers({keydown(i,e){let t=e.state.field(v,!1);if(!t||!t.open||t.open.disabled||t.open.selected<0||i.key.length>1||i.ctrlKey&&!(gi&&i.altKey)||i.metaKey)return!1;let n=t.open.options[t.open.selected],s=t.active.find(r=>r.source==n.source),o=n.completion.commitCharacters||s.result.commitCharacters;return o&&o.indexOf(i.key)>-1&&ke(e,n),!1}})),xi=I.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'Æ'"}},".cm-completionIcon-class":{"&:after":{content:"'â'"}},".cm-completionIcon-interface":{"&:after":{content:"'â'"}},".cm-completionIcon-variable":{"&:after":{content:"'ð¥'"}},".cm-completionIcon-constant":{"&:after":{content:"'ð¶'"}},".cm-completionIcon-type":{"&:after":{content:"'ð¡'"}},".cm-completionIcon-enum":{"&:after":{content:"'âª'"}},".cm-completionIcon-property":{"&:after":{content:"'â¡'"}},".cm-completionIcon-keyword":{"&:after":{content:"'ðï¸'"}},".cm-completionIcon-namespace":{"&:after":{content:"'â¢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}}),K={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},P=A.define({map(i,e){let t=e.mapPos(i,-1,yt.TrackAfter);return t??void 0}}),Ee=new class extends xt{};Ee.startSide=1;Ee.endSide=-1;const rt=le.define({create(){return mt.empty},update(i,e){if(i=i.map(e.changes),e.selection){let t=e.state.doc.lineAt(e.selection.main.head);i=i.update({filter:n=>n>=t.from&&n<=t.to})}for(let t of e.effects)t.is(P)&&(i=i.update({add:[Ee.range(t.value,t.value+1)]}));return i}});function Oi(){return[Ci,rt]}const pe="()[]{}<>«»»«[]ï½ï½";function lt(i){for(let e=0;e<pe.length;e+=2)if(pe.charCodeAt(e)==i)return pe.charAt(e+1);return ve(i<128?i:i+1)}function at(i,e){return i.languageDataAt("closeBrackets",e)[0]||K}const bi=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),Ci=I.inputHandler.of((i,e,t,n)=>{if((bi?i.composing:i.compositionStarted)||i.state.readOnly)return!1;let s=i.state.selection.main;if(n.length>2||n.length==2&&R(L(n,0))==1||e!=s.from||t!=s.to)return!1;let o=vi(i.state,n);return o?(i.dispatch(o),!0):!1}),Si=({state:i,dispatch:e})=>{if(i.readOnly)return!1;let n=at(i,i.selection.main.head).brackets||K.brackets,s=null,o=i.changeByRange(r=>{if(r.empty){let l=Mi(i.doc,r.head);for(let a of n)if(a==l&&ae(i.doc,r.head)==lt(L(a,0)))return{changes:{from:r.head-a.length,to:r.head+a.length},range:g.cursor(r.head-a.length)}}return{range:s=r}});return s||e(i.update(o,{scrollIntoView:!0,userEvent:"delete.backward"})),!s},Pi=[{key:"Backspace",run:Si}];function vi(i,e){let t=at(i,i.selection.main.head),n=t.brackets||K.brackets;for(let s of n){let o=lt(L(s,0));if(e==s)return o==s?Li(i,s,n.indexOf(s+s+s)>-1,t):wi(i,s,o,t.before||K.before);if(e==o&&ct(i,i.selection.main.from))return Ii(i,s,o)}return null}function ct(i,e){let t=!1;return i.field(rt).between(0,i.doc.length,n=>{n==e&&(t=!0)}),t}function ae(i,e){let t=i.sliceString(e,e+2);return t.slice(0,R(L(t,0)))}function Mi(i,e){let t=i.sliceString(e-2,e);return R(L(t,0))==t.length?t:t.slice(1)}function wi(i,e,t,n){let s=null,o=i.changeByRange(r=>{if(!r.empty)return{changes:[{insert:e,from:r.from},{insert:t,from:r.to}],effects:P.of(r.to+e.length),range:g.range(r.anchor+e.length,r.head+e.length)};let l=ae(i.doc,r.head);return!l||/\s/.test(l)||n.indexOf(l)>-1?{changes:{insert:e+t,from:r.head},effects:P.of(r.head+e.length),range:g.cursor(r.head+e.length)}:{range:s=r}});return s?null:i.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function Ii(i,e,t){let n=null,s=i.changeByRange(o=>o.empty&&ae(i.doc,o.head)==t?{changes:{from:o.head,to:o.head+t.length,insert:t},range:g.cursor(o.head+t.length)}:n={range:o});return n?null:i.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function Li(i,e,t,n){let s=n.stringPrefixes||K.stringPrefixes,o=null,r=i.changeByRange(l=>{if(!l.empty)return{changes:[{insert:e,from:l.from},{insert:e,from:l.to}],effects:P.of(l.to+e.length),range:g.range(l.anchor+e.length,l.head+e.length)};let a=l.head,h=ae(i.doc,a),c;if(h==e){if(ze(i,a))return{changes:{insert:e+e,from:a},effects:P.of(a+e.length),range:g.cursor(a+e.length)};if(ct(i,a)){let d=t&&i.sliceDoc(a,a+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:a,to:a+d.length,insert:d},range:g.cursor(a+d.length)}}}else{if(t&&i.sliceDoc(a-2*e.length,a)==e+e&&(c=Ue(i,a-2*e.length,s))>-1&&ze(i,c))return{changes:{insert:e+e+e+e,from:a},effects:P.of(a+e.length),range:g.cursor(a+e.length)};if(i.charCategorizer(a)(h)!=C.Word&&Ue(i,a,s)>-1&&!Di(i,a,e,s))return{changes:{insert:e+e,from:a},effects:P.of(a+e.length),range:g.cursor(a+e.length)}}return{range:o=l}});return o?null:i.update(r,{scrollIntoView:!0,userEvent:"input.type"})}function ze(i,e){let t=Me(i).resolveInner(e+1);return t.parent&&t.from==e}function Di(i,e,t,n){let s=Me(i).resolveInner(e,-1),o=n.reduce((r,l)=>Math.max(r,l.length),0);for(let r=0;r<5;r++){let l=i.sliceDoc(s.from,Math.min(s.to,s.from+t.length+o)),a=l.indexOf(t);if(!a||a>-1&&n.indexOf(l.slice(0,a))>-1){let c=s.firstChild;for(;c&&c.from==s.from&&c.to-c.from>t.length+a;){if(i.sliceDoc(c.to-t.length,c.to)==t)return!1;c=c.firstChild}return!0}let h=s.to==e&&s.parent;if(!h)break;s=h}return!1}function Ue(i,e,t){let n=i.charCategorizer(e);if(n(i.sliceDoc(e-1,e))!=C.Word)return e;for(let s of t){let o=e-s.length;if(i.sliceDoc(o,e)==s&&n(i.sliceDoc(o-1,o))!=C.Word)return o}return-1}function Wi(i={}){return[yi,v,x.of(i),mi,ki,xi]}const Ai=[{key:"Ctrl-Space",run:de},{mac:"Alt-`",run:de},{mac:"Alt-i",run:de},{key:"Escape",run:fi},{key:"ArrowDown",run:J(!0)},{key:"ArrowUp",run:J(!1)},{key:"PageDown",run:J(!0,"page")},{key:"PageUp",run:J(!1,"page")},{key:"Enter",run:hi}],ki=xe.highest(gt.computeN([x],i=>i.facet(x).defaultKeymap?[Ai]:[]));export{Ai as a,Oi as b,Pi as c,Wi as d,Ri as h,Ti as s}; 3//# sourceMappingURL=index-BMH1sPWN.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.