PageSourceSearch

https://pika.page/assets/@codemirror--autocomplete-4941b2d5b53436f…9854ae32c93daede29f55722f01d857aa0444590.js

js pika.page collected 2026-09-25 18:57:33 UTC 39,581 bytes, 4 lines download raw bytes

1// @codemirror/[email protected] downloaded from https://ga.jspm.io/npm:@codemirror/[email protected]/dist/index.js
2
3import{Annotation as e,EditorSelection as t,StateEffect as n,codePointAt as i,codePointSize as o,fromCodePoint as s,Facet as l,combineConfig as r,StateField as a,Prec as c,MapMode as f,Transaction as u,Text as h,RangeValue as p,RangeSet as d,CharCategory as m}from"@codemirror/state";import{Direction as g,logException as v,showTooltip as b,EditorView as w,getTooltip as y,ViewPlugin as x,Decoration as C,WidgetType as A,keymap as S}from"@codemirror/view";import{syntaxTree as I,indentUnit as k}from"@codemirror/language";class CompletionContext{constructor(e,t,n,i){this.state=e;this.pos=t;this.explicit=n;this.view=i;this.abortListeners=[];this.abortOnDocChange=false}tokenBefore(e){let t=I(this.state).resolveInner(this.pos,-1);while(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);let n=Math.max(t.from,this.pos-250);let i=t.text.slice(n-t.from,this.pos-t.from);let o=i.search(L(e,false));return o<0?null:{from:n+o,to:this.pos,text:i.slice(o)}}get aborted(){return this.abortListeners==null}addEventListener(e,t,n){if(e=="abort"&&this.abortListeners){this.abortListeners.push(t);n&&n.onDocChange&&(this.abortOnDocChange=true)}}}function D(e){let t=Object.keys(e).join("");let n=/\w/.test(t);n&&(t=t.replace(/\w/g,""));return`[${n?"\\w":""}${t.replace(/[^\w\s]/g,"\\$&")}]`}function O(e){let t=Object.create(null),n=Object.create(null);for(let{label:i}of e){t[i[0]]=true;for(let e=1;e<i.length;e++)n[i[e]]=true}let i=D(t)+D(n)+"*$";return[new RegExp("^"+i),new RegExp(i)]}function R(e){let t=e.map((e=>typeof e=="string"?{label:e}:e));let[n,i]=t.every((e=>/^\w+$/.test(e.label)))?[/\w*$/,/\w+$/]:O(t);return e=>{let o=e.matchBefore(i);return o||e.explicit?{from:o?o.from:e.pos,options:t,validFor:n}:null}}function T(e,t){return n=>{for(let i=I(n.state).resolveInner(n.pos,-1);i;i=i.parent){if(e.indexOf(i.name)>-1)return t(n);if(i.type.isTop)break}return null}}function M(e,t){return n=>{for(let t=I(n.state).resolveInner(n.pos,-1);t;t=t.parent){if(e.indexOf(t.name)>-1)return null;if(t.type.isTop)break}return t(n)}}class Option{constructor(e,t,n,i){this.completion=e;this.source=t;this.match=n;this.score=i}}function E(e){return e.selection.main.from}function L(e,t){var n;let{source:i}=e;let o=t&&i[0]!="^",s=i[i.length-1]!="$";return o||s?new RegExp(`${o?"^":""}(?:${i})${s?"$":""}`,(n=e.flags)!==null&&n!==void 0?n:e.ignoreCase?"i":""):e}const P=e.define();function F(e,n,i,o){let{main:s}=e.selection,l=i-s.from,r=o-s.from;return{...e.changeByRange((a=>{if(a!=s&&i!=o&&e.sliceDoc(a.from+l,a.from+r)!=e.sliceDoc(i,o))return{range:a};let c=e.toText(n);return{changes:{from:a.from+l,to:o==s.from?a.to:a.from+r,insert:c},range:t.cursor(a.from+l+c.length)}})),scrollIntoView:true,userEvent:"input.complete"}}const B=new WeakMap;function $(e){if(!Array.isArray(e))return e;let t=B.get(e);t||B.set(e,t=R(e));return t}const N=n.define();const U=n.define();class FuzzyMatcher{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=i(e,t),s=o(n);this.chars.push(n);let l=e.slice(t,t+s),r=l.toUpperCase();this.folded.push(i(r==l?l.toLowerCase():r,0));t+=s}this.astral=e.length!=this.chars.length}ret(e,t){this.score=e;this.matched=t;return 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:l,precise:r,byWord:a}=this;if(t.length==1){let s=i(e,0),l=o(s);let r=l==e.length?0:-100;if(s==t[0]);else{if(s!=n[0])return null;r+=-200}return this.ret(r,[0,l])}let c=e.indexOf(this.pattern);if(c==0)return this.ret(e.length==this.pattern.length?0:-100,[0,this.pattern.length]);let f=t.length,u=0;if(c<0){for(let s=0,r=Math.min(e.length,200);s<r&&u<f;){let r=i(e,s);r!=t[u]&&r!=n[u]||(l[u++]=s);s+=o(r)}if(u<f)return null}let h=0;let p=0,d=false;let m=0,g=-1,v=-1;let b=/[a-z]/.test(e),w=true;for(let l=0,u=Math.min(e.length,200),y=0;l<u&&p<f;){let u=i(e,l);if(c<0){h<f&&u==t[h]&&(r[h++]=l);if(m<f)if(u==t[m]||u==n[m]){m==0&&(g=l);v=l+1;m++}else m=0}let x,C=u<255?u>=48&&u<=57||u>=97&&u<=122?2:u>=65&&u<=90?1:0:(x=s(u))!=x.toLowerCase()?1:x!=x.toUpperCase()?2:0;(!l||C==1&&b||y==0&&C!=0)&&(t[p]==u||n[p]==u&&(d=true)?a[p++]=l:a.length&&(w=false));y=C;l+=o(u)}return p==f&&a[0]==0&&w?this.result((d?-200:0)-100,a,e):m==f&&g==0?this.ret(-200-e.length+(v==e.length?0:-100),[0,v]):c>-1?this.ret(-700-e.length,[c,c+this.pattern.length]):m==f?this.ret(-900-e.length,[g,v]):p==f?this.result((d?-200:0)-100-700+(w?0:-1100),a,e):t.length==2?null:this.result((l[0]?-700:0)-200-1100,l,e)}result(e,t,n){let s=[],l=0;for(let e of t){let t=e+(this.astral?o(i(n,e)):1);if(l&&s[l-1]==e)s[l-1]=t;else{s[l++]=e;s[l++]=t}}return this.ret(e-n.length,s)}}class StrictMatcher{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);let n=t==this.pattern?0:t.toLowerCase()==this.folded?-200:null;if(n==null)return null;this.matched=[0,t.length];this.score=n+(e.length==this.pattern.length?0:-100);return this}}const W=l.define({combine(e){return r(e,{activateOnTyping:true,activateOnCompletion:()=>false,activateOnTypingDelay:100,selectOnOpen:true,override:null,closeOnBlur:true,maxRenderedOptions:100,defaultKeymap:true,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:false,icons:true,addToOptions:[],positionInfo:j,filterStrict:false,compareCompletions:(e,t)=>
3(e.sortText||e.label).localeCompare(t.sortText||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=>q(e(n),t(n)),optionClass:(e,t)=>n=>q(e(n),t(n)),addToOptions:(e,t)=>e.concat(t),filterStrict:(e,t)=>e||t})}});function q(e,t){return e?t?e+" "+t:e:t}function j(e,t,n,i,o,s){let l=e.textDirection==g.RTL,r=l,a=false;let c,f,u="top";let h=t.left-o.left,p=o.right-t.right;let d=i.right-i.left,m=i.bottom-i.top;r&&h<Math.min(d,p)?r=false:!r&&p<Math.min(d,h)&&(r=true);if(d<=(r?h:p)){c=Math.max(o.top,Math.min(n.top,o.bottom-m))-t.top;f=Math.min(400,r?h:p)}else{a=true;f=Math.min(400,(l?t.right:o.right-t.left)-30);let e=o.bottom-t.bottom;if(e>=m||e>t.top)c=n.bottom-t.top;else{u="bottom";c=t.bottom-n.top}}let v=(t.bottom-t.top)/s.offsetHeight;let b=(t.right-t.left)/s.offsetWidth;return{style:`${u}: ${c/v}px; max-width: ${f/b}px`,class:"cm-completionInfo-"+(a?l?"left-narrow":"right-narrow":r?"left":"right")}}function z(e){let t=e.addToOptions.slice();e.icons&&t.push({render(e){let t=document.createElement("div");t.classList.add("cm-completionIcon");e.type&&t.classList.add(...e.type.split(/\s+/g).map((e=>"cm-completionIcon-"+e)));t.setAttribute("aria-hidden","true");return t},position:20});t.push({render(e,t,n,i){let o=document.createElement("span");o.className="cm-completionLabel";let s=e.displayLabel||e.label,l=0;for(let e=0;e<i.length;){let t=i[e++],n=i[e++];t>l&&o.appendChild(document.createTextNode(s.slice(l,t)));let r=o.appendChild(document.createElement("span"));r.appendChild(document.createTextNode(s.slice(t,n)));r.className="cm-completionMatchedText";l=n}l<s.length&&o.appendChild(document.createTextNode(s.slice(l)));return o},position:50},{render(e){if(!e.detail)return null;let t=document.createElement("span");t.className="cm-completionDetail";t.textContent=e.detail;return t},position:80});return t.sort(((e,t)=>e.position-t.position)).map((e=>e.render))}function H(e,t,n){if(e<=n)return{from:0,to:e};t<0&&(t=0);if(t<=e>>1){let e=Math.floor(t/n);return{from:e*n,to:(e+1)*n}}let i=Math.floor((e-t)/n);return{from:e-(i+1)*n,to:e-i*n}}class CompletionTooltip{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:e=>this.placeInfo(e),key:this};this.space=null;this.currentClass="";let i=e.state.field(t);let{options:o,selected:s}=i.open;let l=e.state.facet(W);this.optionContent=z(l);this.optionClass=l.optionClass;this.tooltipClass=l.tooltipClass;this.range=H(o.length,s,l.maxRenderedOptions);this.dom=document.createElement("div");this.dom.className="cm-tooltip-autocomplete";this.updateTooltipClass(e.state);this.dom.addEventListener("mousedown",(n=>{let{options:i}=e.state.field(t).open;for(let t,o=n.target;o&&o!=this.dom;o=o.parentNode)if(o.nodeName=="LI"&&(t=/-(\d+)$/.exec(o.id))&&+t[1]<i.length){this.applyCompletion(e,i[+t[1]]);n.preventDefault();return}}));this.dom.addEventListener("focusout",(t=>{let n=e.state.field(this.stateField,false);n&&n.tooltip&&e.state.facet(W).closeOnBlur&&t.relatedTarget!=e.contentDOM&&e.dispatch({effects:U.of(null)})}));this.showOptions(o,i.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);let i=e.startState.field(this.stateField);this.updateTooltipClass(e.state);if(n!=i){let{options:o,selected:s,disabled:l}=n.open;if(!i.open||i.open.options!=o){this.range=H(o.length,s,e.state.facet(W).maxRenderedOptions);this.showOptions(o,n.id)}this.updateSel();l!=((t=i.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 e of this.currentClass.split(" "))e&&this.dom.classList.remove(e);for(let e of t.split(" "))e&&this.dom.classList.add(e);this.currentClass=t}}positioned(e){this.space=e;this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),t=e.open;if(t.selected>-1&&t.selected<this.range.from||t.selected>=this.range.to){this.range=H(t.options.length,t.selected,this.view.state.facet(W).maxRenderedOptions);this.showOptions(t.options,e.id)}let n=this.updateSelectedOption(t.selected);if(n){this.destroyInfo();
3let{completion:i}=t.options[t.selected];let{info:o}=i;if(!o)return;let s=typeof o==="string"?document.createTextNode(o):o(i);if(!s)return;if("then"in s)s.then((t=>{t&&this.view.state.field(this.stateField,false)==e&&this.addInfoPane(t,i)})).catch((e=>v(this.view.state,e,"completion info")));else{this.addInfoPane(s,i);n.setAttribute("aria-describedby",this.info.id)}}}addInfoPane(e,t){this.destroyInfo();let n=this.info=document.createElement("div");n.className="cm-tooltip cm-completionInfo";n.id="cm-completionInfo-"+Math.floor(Math.random()*65535).toString(16);if(e.nodeType!=null){n.appendChild(e);this.infoDestroy=null}else{let{dom:t,destroy:i}=e;n.appendChild(t);this.infoDestroy=i||null}this.dom.appendChild(n);this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let t=null;for(let n=this.list.firstChild,i=this.range.from;n;n=n.nextSibling,i++)if(n.nodeName=="LI"&&n.id){if(i==e){if(!n.hasAttribute("aria-selected")){n.setAttribute("aria-selected","true");t=n}}else if(n.hasAttribute("aria-selected")){n.removeAttribute("aria-selected");n.removeAttribute("aria-describedby")}}else i--;t&&K(this.list,t);return t}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let t=this.dom.getBoundingClientRect();let n=this.info.getBoundingClientRect();let i=e.getBoundingClientRect();let o=this.space;if(!o){let e=this.dom.ownerDocument.documentElement;o={left:0,top:0,right:e.clientWidth,bottom:e.clientHeight}}return i.top>Math.min(o.bottom,t.bottom)-10||i.bottom<Math.max(o.top,t.top)+10?null:this.view.state.facet(W).positionInfo(this.view,t,i,n,o,this.dom)}placeInfo(e){if(this.info)if(e){e.style&&(this.info.style.cssText=e.style);this.info.className="cm-tooltip cm-completionInfo "+(e.class||"")}else this.info.style.cssText="top: -1e6px"}createListBox(e,t,n){const i=document.createElement("ul");i.id=t;i.setAttribute("role","listbox");i.setAttribute("aria-expanded","true");i.setAttribute("aria-label",this.view.state.phrase("Completions"));i.addEventListener("mousedown",(e=>{e.target==i&&e.preventDefault()}));let o=null;for(let s=n.from;s<n.to;s++){let{completion:l,match:r}=e[s],{section:a}=l;if(a){let e=typeof a=="string"?a:a.name;if(e!=o&&(s>n.from||n.from==0)){o=e;if(typeof a!="string"&&a.header)i.appendChild(a.header(a));else{let t=i.appendChild(document.createElement("completion-section"));t.textContent=e}}}const c=i.appendChild(document.createElement("li"));c.id=t+"-"+s;c.setAttribute("role","option");let f=this.optionClass(l);f&&(c.className=f);for(let e of this.optionContent){let t=e(l,this.view.state,this.view,r);t&&c.appendChild(t)}}n.from&&i.classList.add("cm-completionListIncompleteTop");n.to<e.length&&i.classList.add("cm-completionListIncompleteBottom");return i}destroyInfo(){if(this.info){this.infoDestroy&&this.infoDestroy();this.info.remove();this.info=null}}destroy(){this.destroyInfo()}}function V(e,t){return n=>new CompletionTooltip(n,e,t)}function K(e,t){let n=e.getBoundingClientRect();let i=t.getBoundingClientRect();let o=n.height/e.offsetHeight;i.top<n.top?e.scrollTop-=(n.top-i.top)/o:i.bottom>n.bottom&&(e.scrollTop+=(i.bottom-n.bottom)/o)}function Q(e){return(e.boost||0)*100+(e.apply?10:0)+(e.info?5:0)+(e.type?1:0)}function X(e,t){let n=[];let i=null,o=null;let s=e=>{n.push(e);let{section:t}=e.completion;if(t){i||(i=[]);let e=typeof t=="string"?t:t.name;i.some((t=>t.name==e))||i.push(typeof t=="string"?{name:e}:t)}};let l=t.facet(W);for(let i of e)if(i.hasResult()){let e=i.result.getMatch;if(i.result.filter===false)for(let t of i.result.options)s(new Option(t,i.source,e?e(t):[],1e9-n.length));else{let n,r=t.sliceDoc(i.from,i.to);let a=l.filterStrict?new StrictMatcher(r):new FuzzyMatcher(r);for(let t of i.result.options)if(n=a.match(t.label)){let l=t.displayLabel?e?e(t,n.matched):[]:n.matched;let r=n.score+(t.boost||0);s(new Option(t,i.source,l,r));if(typeof t.section=="object"&&t.section.rank==="dynamic"){let{name:e}=t.section;o||(o=Object.create(null));o[e]=Math.max(r,o[e]||-1e9)}}}}if(i){let e=Object.create(null),t=0;let s=(e,t)=>(e.rank==="dynamic"&&t.rank==="dynamic"?o[t.name]-o[e.name]:0)||(typeof e.rank=="number"?e.rank:1e9)-(typeof t.rank=="number"?t.rank:1e9)||(e.name<t.name?-1:1);for(let n of i.sort(s)){t-=1e5;e[n.name]=t}for(let t of n){let{section:n}=t.completion;n&&(t.score+=e[typeof n=="string"?n:n.name])}}let r=[],a=null;
3let c=l.compareCompletions;for(let e of n.sort(((e,t)=>t.score-e.score||c(e.completion,t.completion)))){let t=e.completion;!a||a.label!=t.label||a.detail!=t.detail||a.type!=null&&t.type!=null&&a.type!=t.type||a.apply!=t.apply||a.boost!=t.boost?r.push(e):Q(e.completion)>Q(a)&&(r[r.length-1]=e);a=e.completion}return r}class CompletionDialog{constructor(e,t,n,i,o,s){this.options=e;this.attrs=t;this.tooltip=n;this.timestamp=i;this.selected=o;this.disabled=s}setSelected(e,t){return e==this.selected||e>=this.options.length?this:new CompletionDialog(this.options,J(t,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,t,n,i,o,s){if(i&&!s&&e.some((e=>e.isPending)))return i.setDisabled();let l=X(e,t);if(!l.length)return i&&e.some((e=>e.isPending))?i.setDisabled():null;let r=t.facet(W).selectOnOpen?0:-1;if(i&&i.selected!=r&&i.selected!=-1){let e=i.options[i.selected].completion;for(let t=0;t<l.length;t++)if(l[t].completion==e){r=t;break}}return new CompletionDialog(l,J(n,r),{pos:e.reduce(((e,t)=>t.hasResult()?Math.min(e,t.from):e),1e8),create:le,above:o.aboveCursor},i?i.timestamp:Date.now(),r,false)}map(e){return new CompletionDialog(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new CompletionDialog(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,true)}}class CompletionState{constructor(e,t,n){this.active=e;this.id=t;this.open=n}static start(){return new CompletionState(Z,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:t}=e,n=t.facet(W);let i=n.override||t.languageDataAt("autocomplete",E(t)).map($);let o=i.map((t=>{let i=this.active.find((e=>e.source==t))||new ActiveSource(t,this.active.some((e=>e.state!=0))?1:0);return i.update(e,n)}));o.length==this.active.length&&o.every(((e,t)=>e==this.active[t]))&&(o=this.active);let s=this.open,l=e.effects.some((e=>e.is(ne)));s&&e.docChanged&&(s=s.map(e.changes));e.selection||o.some((t=>t.hasResult()&&e.changes.touchesRange(t.from,t.to)))||!_(o,this.active)||l?s=CompletionDialog.build(o,t,this.id,s,n,l):s&&s.disabled&&!o.some((e=>e.isPending))&&(s=null);!s&&o.every((e=>!e.isPending))&&o.some((e=>e.hasResult()))&&(o=o.map((e=>e.hasResult()?new ActiveSource(e.source,0):e)));for(let t of e.effects)t.is(ie)&&(s=s&&s.setSelected(t.value,this.id));return o==this.active&&s==this.open?this:new CompletionState(o,this.id,s)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?Y:G}}function _(e,t){if(e==t)return true;for(let n=0,i=0;;){while(n<e.length&&!e[n].hasResult())n++;while(i<t.length&&!t[i].hasResult())i++;let o=n==e.length,s=i==t.length;if(o||s)return o==s;if(e[n++].result!=t[i++].result)return false}}const Y={"aria-autocomplete":"list"};const G={};function J(e,t){let n={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":e};t>-1&&(n["aria-activedescendant"]=e+"-"+t);return n}const Z=[];function ee(e,t){if(e.isUserEvent("input.complete")){let n=e.annotation(P);if(n&&t.activateOnCompletion(n))return 12}let n=e.isUserEvent("input.type");return n&&t.activateOnTyping?5:n?1:e.isUserEvent("delete.backward")?2:e.selection?8:e.docChanged?16:0}class ActiveSource{constructor(e,t,n=false){this.source=e;this.state=t;this.explicit=n}hasResult(){return false}get isPending(){return this.state==1}update(e,t){let n=ee(e,t),i=this;(n&8||n&16&&this.touches(e))&&(i=new ActiveSource(i.source,0));n&4&&i.state==0&&(i=new ActiveSource(this.source,1));i=i.updateFor(e,n);for(let t of e.effects)if(t.is(N))i=new ActiveSource(i.source,1,t.value);else if(t.is(U))i=new ActiveSource(i.source,0);else if(t.is(ne))for(let e of t.value)e.source==i.source&&(i=e);return i}updateFor(e,t){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(E(e.state))}}class ActiveResult extends ActiveSource{constructor(e,t,n,i,o,s){super(e,3,t);this.limit=n;this.result=i;this.from=o;this.to=s}hasResult(){return true}updateFor(e,t){var n;if(!(t&3))return this.map(e.changes);let i=this.result;i.map&&!e.changes.empty&&(i=i.map(i,e.changes));let o=e.changes.mapPos(this.from),s=e.changes.mapPos(this.to,1);let l=E(e.state);if(l>s||!i||t&2&&(E(e.startState)==this.from||l<this.limit))return new ActiveSource(this.source,t&4?1:0);let r=e.changes.mapPos(this.limit);return te(i.validFor,e.state,o,s)?new ActiveResult(this.source,this.explicit,r,i,o,s):i.update&&(i=i.update(i,o,s,new CompletionContext(e.state,l,false)))?new ActiveResult(this.source,this.explicit,r,i,i.from,(n=i.to)!==null&&n!==void 0?n:E(e.state)):new ActiveSource(this.source,1,this.explicit)}map(e){if(e.empty)return this;let t=this.result.map?this.result.map(this.result,e):this.result;return t?new ActiveResult(this.source,this.explicit,e.mapPos(this.limit),this.result,e.mapPos(this.from),e.mapPos(this.to,1)):new ActiveSource(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}}function te(e,t,n,i){if(!e)return false;let o=t.sliceDoc(n,i);return typeof e=="function"?e(o,n,i,t):L(e,true).test(o)}const ne=n.define({map(e,t){return e.map((e=>e.map(t)))}});const ie=n.define();const oe=a.define({create(){return CompletionState.start()},update(e,t){return e.update(t)},provide:e=>[b.from(e,(e=>e.tooltip)),w.contentAttributes.from(e,(e=>e.attrs))]});function se(e,t){const n=t.completion.apply||t.completion.label;let i=e.state.field(oe).active.find((e=>e.source==t.source));if(!(i instanceof ActiveResult))return false;typeof n=="string"?e.dispatch({...F(e.state,n,i.from,i.to),annotations:P.of(t.completion)}):n(e,t.completion,i.from,i.to);return true}const le=V(oe,se);function re(e,t="option"){return n=>{let i=n.state.field(oe,false);
3if(!i||!i.open||i.open.disabled||Date.now()-i.open.timestamp<n.state.facet(W).interactionDelay)return false;let o,s=1;t=="page"&&(o=y(n,i.open.tooltip))&&(s=Math.max(2,Math.floor(o.dom.offsetHeight/o.dom.querySelector("li").offsetHeight)-1));let{length:l}=i.open.options;let r=i.open.selected>-1?i.open.selected+s*(e?1:-1):e?0:l-1;r<0?r=t=="page"?0:l-1:r>=l&&(r=t=="page"?l-1:0);n.dispatch({effects:ie.of(r)});return true}}const ae=e=>{let t=e.state.field(oe,false);return!(e.state.readOnly||!t||!t.open||t.open.selected<0||t.open.disabled||Date.now()-t.open.timestamp<e.state.facet(W).interactionDelay)&&se(e,t.open.options[t.open.selected])};const ce=e=>{let t=e.state.field(oe,false);if(!t)return false;e.dispatch({effects:N.of(true)});return true};const fe=e=>{let t=e.state.field(oe,false);if(!t||!t.active.some((e=>e.state!=0)))return false;e.dispatch({effects:U.of(null)});return true};class RunningQuery{constructor(e,t){this.active=e;this.context=t;this.time=Date.now();this.updates=[];this.done=void 0}}const ue=50,he=1e3;const pe=x.fromClass(class{constructor(e){this.view=e;this.debounceUpdate=-1;this.running=[];this.debounceAccept=-1;this.pendingStart=false;this.composing=0;for(let t of e.state.field(oe).active)t.isPending&&this.startQuery(t)}update(e){let t=e.state.field(oe);let n=e.state.facet(W);if(!e.selectionSet&&!e.docChanged&&e.startState.field(oe)==t)return;let i=e.transactions.some((e=>{let t=ee(e,n);return t&8||(e.selection||e.docChanged)&&!(t&3)}));for(let t=0;t<this.running.length;t++){let n=this.running[t];if(i||n.context.abortOnDocChange&&e.docChanged||n.updates.length+e.transactions.length>ue&&Date.now()-n.time>he){for(let e of n.context.abortListeners)try{e()}catch(e){v(this.view.state,e)}n.context.abortListeners=null;this.running.splice(t--,1)}else n.updates.push(...e.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate);e.transactions.some((e=>e.effects.some((e=>e.is(N)))))&&(this.pendingStart=true);let o=this.pendingStart?50:n.activateOnTypingDelay;this.debounceUpdate=t.active.some((e=>e.isPending&&!this.running.some((t=>t.active.source==e.source))))?setTimeout((()=>this.startUpdate()),o):-1;if(this.composing!=0)for(let t of e.transactions)t.isUserEvent("input.type")?this.composing=2:this.composing==2&&t.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1;this.pendingStart=false;let{state:e}=this.view,t=e.field(oe);for(let e of t.active)e.isPending&&!this.running.some((t=>t.active.source==e.source))&&this.startQuery(e);this.running.length&&t.open&&t.open.disabled&&(this.debounceAccept=setTimeout((()=>this.accept()),this.view.state.facet(W).updateSyncTime))}startQuery(e){let{state:t}=this.view,n=E(t);let i=new CompletionContext(t,n,e.explicit,this.view);let o=new RunningQuery(e,i);this.running.push(o);Promise.resolve(e.source(i)).then((e=>{if(!o.context.aborted){o.done=e||null;this.scheduleAccept()}}),(e=>{this.view.dispatch({effects:U.of(null)});v(this.view.state,e)}))}scheduleAccept(){this.running.every((e=>e.done!==void 0))?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout((()=>this.accept()),this.view.state.facet(W).updateSyncTime))}accept(){var e;this.debounceAccept>-1&&clearTimeout(this.debounceAccept);this.debounceAccept=-1;let t=[];let n=this.view.state.facet(W),i=this.view.state.field(oe);for(let o=0;o<this.running.length;o++){let s=this.running[o];if(s.done===void 0)continue;this.running.splice(o--,1);if(s.done){let i=E(s.updates.length?s.updates[0].startState:this.view.state);let o=Math.min(i,s.done.from+(s.active.explicit?0:1));let l=new ActiveResult(s.active.source,s.active.explicit,o,s.done,s.done.from,(e=s.done.to)!==null&&e!==void 0?e:i);for(let e of s.updates)l=l.update(e,n);if(l.hasResult()){t.push(l);continue}}let l=i.active.find((e=>e.source==s.active.source));if(l&&l.isPending)if(s.done==null){let e=new ActiveSource(s.active.source,0);for(let t of s.updates)e=e.update(t,n);e.isPending||t.push(e)}else this.startQuery(l)}(t.length||i.open&&i.open.disabled)&&this.view.dispatch({effects:ne.of(t)})}},{eventHandlers:{blur(e){let t=this.view.state.field(oe,false);
3if(t&&t.tooltip&&this.view.state.facet(W).closeOnBlur){let n=t.open&&y(this.view,t.open.tooltip);n&&n.dom.contains(e.relatedTarget)||setTimeout((()=>this.view.dispatch({effects:U.of(null)})),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout((()=>this.view.dispatch({effects:N.of(false)})),20);this.composing=0}}});const de=typeof navigator=="object"&&/Win/.test(navigator.platform);const me=c.highest(w.domEventHandlers({keydown(e,t){let n=t.state.field(oe,false);if(!n||!n.open||n.open.disabled||n.open.selected<0||e.key.length>1||e.ctrlKey&&!(de&&e.altKey)||e.metaKey)return false;let i=n.open.options[n.open.selected];let o=n.active.find((e=>e.source==i.source));let s=i.completion.commitCharacters||o.result.commitCharacters;s&&s.indexOf(e.key)>-1&&se(t,i);return false}}));const ge=w.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"}}});class FieldPos{constructor(e,t,n,i){this.field=e;this.line=t;this.from=n;this.to=i}}class FieldRange{constructor(e,t,n){this.field=e;this.from=t;this.to=n}map(e){let t=e.mapPos(this.from,-1,f.TrackDel);let n=e.mapPos(this.to,1,f.TrackDel);return t==null||n==null?null:new FieldRange(this.field,t,n)}}class Snippet{constructor(e,t){this.lines=e;this.fieldPositions=t}instantiate(e,t){let n=[],i=[t];let o=e.doc.lineAt(t),s=/^\s*/.exec(o.text)[0];for(let o of this.lines){if(n.length){let n=s,l=/^\t*/.exec(o)[0].length;for(let t=0;t<l;t++)n+=e.facet(k);i.push(t+n.length-l);o=n+o.slice(l)}n.push(o);t+=o.length+1}let l=this.fieldPositions.map((e=>new FieldRange(e.field,i[e.line]+e.from,i[e.line]+e.to)));return{text:n,ranges:l}}static parse(e){let t=[];let n,i=[],o=[];for(let s of e.split(/\r\n?|\n/)){while(n=/[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(s)){let e=n[1]?+n[1]:null,l=n[2]||n[3]||"",r=-1;let a=l.replace(/\\[{}]/g,(e=>e[1]));for(let n=0;n<t.length;
3n++)(e!=null?t[n].seq!=e:!a||t[n].name!=a)||(r=n);if(r<0){let n=0;while(n<t.length&&(e==null||t[n].seq!=null&&t[n].seq<e))n++;t.splice(n,0,{seq:e,name:a});r=n;for(let e of o)e.field>=r&&e.field++}for(let e of o)if(e.line==i.length&&e.from>n.index){let t=n[2]?3+(n[1]||"").length:2;e.from-=t;e.to-=t}o.push(new FieldPos(r,i.length,n.index,n.index+a.length));s=s.slice(0,n.index)+l+s.slice(n.index+n[0].length)}s=s.replace(/\\([{}])/g,((e,t,n)=>{for(let e of o)if(e.line==i.length&&e.from>n){e.from--;e.to--}return t}));i.push(s)}return new Snippet(i,o)}}let ve=C.widget({widget:new class extends A{toDOM(){let e=document.createElement("span");e.className="cm-snippetFieldPosition";return e}ignoreEvent(){return false}}});let be=C.mark({class:"cm-snippetField"});class ActiveSnippet{constructor(e,t){this.ranges=e;this.active=t;this.deco=C.set(e.map((e=>(e.from==e.to?ve:be).range(e.from,e.to))),true)}map(e){let t=[];for(let n of this.ranges){let i=n.map(e);if(!i)return null;t.push(i)}return new ActiveSnippet(t,this.active)}selectionInsideField(e){return e.ranges.every((e=>this.ranges.some((t=>t.field==this.active&&t.from<=e.from&&t.to>=e.to))))}}const we=n.define({map(e,t){return e&&e.map(t)}});const ye=n.define();const xe=a.define({create(){return null},update(e,t){for(let n of t.effects){if(n.is(we))return n.value;if(n.is(ye)&&e)return new ActiveSnippet(e.ranges,n.value)}e&&t.docChanged&&(e=e.map(t.changes));e&&t.selection&&!e.selectionInsideField(t.selection)&&(e=null);return e},provide:e=>w.decorations.from(e,(e=>e?e.deco:C.none))});function Ce(e,n){return t.create(e.filter((e=>e.field==n)).map((e=>t.range(e.from,e.to))))}function Ae(e){let t=Snippet.parse(e);return(e,i,o,s)=>{let{text:l,ranges:r}=t.instantiate(e.state,o);let{main:a}=e.state.selection;let c={changes:{from:o,to:s==a.from?a.to:s,insert:h.of(l)},scrollIntoView:true,annotations:i?[P.of(i),u.userEvent.of("input.complete")]:void 0};r.length&&(c.selection=Ce(r,0));if(r.some((e=>e.field>0))){let t=new ActiveSnippet(r,0);let i=c.effects=[we.of(t)];e.state.field(xe,false)===void 0&&i.push(n.appendConfig.of([xe,Ee,Pe,ge]))}e.dispatch(e.state.update(c))}}function Se(e){return({state:t,dispatch:n})=>{let i=t.field(xe,false);if(!i||e<0&&i.active==0)return false;let o=i.active+e,s=e>0&&!i.ranges.some((t=>t.field==o+e));n(t.update({selection:Ce(i.ranges,o),effects:we.of(s?null:new ActiveSnippet(i.ranges,o)),scrollIntoView:true}));return true}}const Ie=({state:e,dispatch:t})=>{let n=e.field(xe,false);if(!n)return false;t(e.update({effects:we.of(null)}));return true};const ke=Se(1);const De=Se(-1);function Oe(e){let t=e.field(xe,false);return!!(t&&t.ranges.some((e=>e.field==t.active+1)))}function Re(e){let t=e.field(xe,false);return!!(t&&t.active>0)}const Te=[{key:"Tab",run:ke,shift:De},{key:"Escape",run:Ie}];const Me=l.define({combine(e){return e.length?e[0]:Te}});const Ee=c.highest(S.compute([Me],(e=>e.facet(Me))));function Le(e,t){return{...t,apply:Ae(e)}}const Pe=w.domEventHandlers({mousedown(e,t){let n,i=t.state.field(xe,false);if(!i||(n=t.posAtCoords({x:e.clientX,y:e.clientY}))==null)return false;let o=i.ranges.find((e=>e.from<=n&&e.to>=n));if(!o||o.field==i.active)return false;t.dispatch({selection:Ce(i.ranges,o.field),effects:we.of(i.ranges.some((e=>e.field>o.field))?new ActiveSnippet(i.ranges,o.field):null),scrollIntoView:true});return true}});function Fe(e){let t=e.replace(/[\]\-\\]/g,"\\$&");try{return new RegExp(`[\\p{Alphabetic}\\p{Number}_${t}]+`,"ug")}catch(e){return new RegExp(`[w${t}]`,"g")}}function Be(e,t){return new RegExp(t(e.source),e.unicode?"u":"")}const $e=Object.create(null);function Ne(e){return $e[e]||($e[e]=new WeakMap)}function Ue(e,t,n,i,o){for(let s=e.iterLines(),l=0;!s.next().done;){let e,{value:r}=s;t.lastIndex=0;while(e=t.exec(r))if(!i[e[0]]&&l+e.index!=o){n.push({type:"text",label:e[0]});i[e[0]]=true;if(n.length>=2e3)return}l+=r.length+1}}function We(e,t,n,i,o){let s=e.length>=1e3;let l=s&&t.get(e);if(l)return l;let r=[],a=Object.create(null);if(e.children){let s=0;for(let l of e.children){if(l.length>=1e3){for(let e of We(l,t,n,i-s,o-s))if(!a[e.label]){a[e.label]=true;r.push(e)}}else Ue(l,n,r,a,o-s);s+=l.length+1}}else Ue(e,n,r,a,o);s&&r.length<2e3&&t.set(e,r);return r}const qe=e=>{let t=e.state.languageDataAt("wordChars",e.pos).join("");let n=Fe(t);let i=e.matchBefore(Be(n,(e=>e+"$")));if(!i&&!e.explicit)return null;let o=i?i.from:e.pos;let s=We(e.state.doc,Ne(t),n,5e4,o);return{from:o,options:s,validFor:Be(n,(e=>"^"+e))}};const je={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]};const ze=n.define({map(e,t){let n=t.mapPos(e,-1,f.TrackAfter);return n==null?void 0:n}});const He=new class extends p{};He.startSide=1;He.endSide=-1;const Ve=a.define({create(){return d.empty},update(e,t){e=e.map(t.changes);if(t.selection){let n=t.state.doc.lineAt(t.selection.main.head);e=e.update({filter:e=>e>=n.from&&e<=n.to})}for(let n of t.effects)n.is(ze)&&(e=e.update({add:[He.range(n.value,
3n.value+1)]}));return e}});function Ke(){return[Ge,Ve]}const Qe="()[]{}<>«»»«[]{}";function Xe(e){for(let t=0;t<Qe.length;t+=2)if(Qe.charCodeAt(t)==e)return Qe.charAt(t+1);return s(e<128?e:e+1)}function _e(e,t){return e.languageDataAt("closeBrackets",t)[0]||je}const Ye=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent);const Ge=w.inputHandler.of(((e,t,n,s)=>{if((Ye?e.composing:e.compositionStarted)||e.state.readOnly)return false;let l=e.state.selection.main;if(s.length>2||s.length==2&&o(i(s,0))==1||t!=l.from||n!=l.to)return false;let r=et(e.state,s);if(!r)return false;e.dispatch(r);return true}));const Je=({state:e,dispatch:n})=>{if(e.readOnly)return false;let o=_e(e,e.selection.main.head);let s=o.brackets||je.brackets;let l=null,r=e.changeByRange((n=>{if(n.empty){let o=it(e.doc,n.head);for(let l of s)if(l==o&&nt(e.doc,n.head)==Xe(i(l,0)))return{changes:{from:n.head-l.length,to:n.head+l.length},range:t.cursor(n.head-l.length)}}return{range:l=n}}));l||n(e.update(r,{scrollIntoView:true,userEvent:"delete.backward"}));return!l};const Ze=[{key:"Backspace",run:Je}];function et(e,t){let n=_e(e,e.selection.main.head);let o=n.brackets||je.brackets;for(let s of o){let l=Xe(i(s,0));if(t==s)return l==s?lt(e,s,o.indexOf(s+s+s)>-1,n):ot(e,s,l,n.before||je.before);if(t==l&&tt(e,e.selection.main.from))return st(e,s,l)}return null}function tt(e,t){let n=false;e.field(Ve).between(0,e.doc.length,(e=>{e==t&&(n=true)}));return n}function nt(e,t){let n=e.sliceString(t,t+2);return n.slice(0,o(i(n,0)))}function it(e,t){let n=e.sliceString(t-2,t);return o(i(n,0))==n.length?n:n.slice(1)}function ot(e,n,i,o){let s=null,l=e.changeByRange((l=>{if(!l.empty)return{changes:[{insert:n,from:l.from},{insert:i,from:l.to}],effects:ze.of(l.to+n.length),range:t.range(l.anchor+n.length,l.head+n.length)};let r=nt(e.doc,l.head);return!r||/\s/.test(r)||o.indexOf(r)>-1?{changes:{insert:n+i,from:l.head},effects:ze.of(l.head+n.length),range:t.cursor(l.head+n.length)}:{range:s=l}}));return s?null:e.update(l,{scrollIntoView:true,userEvent:"input.type"})}function st(e,n,i){let o=null,s=e.changeByRange((n=>n.empty&&nt(e.doc,n.head)==i?{changes:{from:n.head,to:n.head+i.length,insert:i},range:t.cursor(n.head+i.length)}:o={range:n}));return o?null:e.update(s,{scrollIntoView:true,userEvent:"input.type"})}function lt(e,n,i,o){let s=o.stringPrefixes||je.stringPrefixes;let l=null,r=e.changeByRange((o=>{if(!o.empty)return{changes:[{insert:n,from:o.from},{insert:n,from:o.to}],effects:ze.of(o.to+n.length),range:t.range(o.anchor+n.length,o.head+n.length)};let r,a=o.head,c=nt(e.doc,a);if(c==n){if(rt(e,a))return{changes:{insert:n+n,from:a},effects:ze.of(a+n.length),range:t.cursor(a+n.length)};if(tt(e,a)){let o=i&&e.sliceDoc(a,a+n.length*3)==n+n+n;let s=o?n+n+n:n;return{changes:{from:a,to:a+s.length,insert:s},range:t.cursor(a+s.length)}}}else{if(i&&e.sliceDoc(a-2*n.length,a)==n+n&&(r=ct(e,a-2*n.length,s))>-1&&rt(e,r))return{changes:{insert:n+n+n+n,from:a},effects:ze.of(a+n.length),range:t.cursor(a+n.length)};if(e.charCategorizer(a)(c)!=m.Word&&ct(e,a,s)>-1&&!at(e,a,n,s))return{changes:{insert:n+n,from:a},effects:ze.of(a+n.length),range:t.cursor(a+n.length)}}return{range:l=o}}));return l?null:e.update(r,{scrollIntoView:true,userEvent:"input.type"})}function rt(e,t){let n=I(e).resolveInner(t+1);return n.parent&&n.from==t}function at(e,t,n,i){let o=I(e).resolveInner(t,-1);let s=i.reduce(((e,t)=>Math.max(e,t.length)),0);for(let l=0;l<5;l++){let l=e.sliceDoc(o.from,Math.min(o.to,o.from+n.length+s));let r=l.indexOf(n);if(!r||r>-1&&i.indexOf(l.slice(0,r))>-1){let t=o.firstChild;while(t&&t.from==o.from&&t.to-t.from>n.length+r){if(e.sliceDoc(t.to-n.length,t.to)==n)return false;t=t.firstChild}return true}let a=o.to==t&&o.parent;if(!a)break;o=a}return false}function ct(e,t,n){let i=e.charCategorizer(t);if(i(e.sliceDoc(t-1,t))!=m.Word)return t;for(let o of n){let n=t-o.length;if(e.sliceDoc(n,t)==o&&i(e.sliceDoc(n-1,n))!=m.Word)return n}return-1}function ft(e={}){return[me,oe,W.of(e),pe,ht,ge]}const ut=[{key:"Ctrl-Space",run:ce},{mac:"Alt-`",run:ce},{mac:"Alt-i",run:ce},{key:"Escape",run:fe},{key:"ArrowDown",run:re(true)},{key:"ArrowUp",run:re(false)},{key:"PageDown",run:re(true,"page")},{key:"PageUp",run:re(false,"page")},{key:"Enter",run:ae}];const ht=c.highest(S.computeN([W],(e=>e.facet(W).defaultKeymap?[ut]:[])));function pt(e){let t=e.field(oe,false);return t&&t.active.some((e=>e.isPending))?"pending":t&&t.active.some((e=>e.state!=0))?"active":null}const dt=new WeakMap;function mt(e){var t;let n=(t=e.field(oe,false))===null||t===void 0?void 0:t.open;if(!n||n.disabled)return[];let i=dt.get(n.options);i||dt.set(n.options,i=n.options.map((e=>e.completion)));return i}function gt(e){var t;let n=(t=e.field(oe,false))===null||t===void 0?void 0:t.open;return n&&!n.disabled&&n.selected>=0?n.options[n.selected].completion:null}function vt(e){var t;let n=(t=e.field(oe,false))===null||t===void 0?void 0:t.open;return n&&!n.disabled&&n.selected>=0?n.selected:null}function bt(e){return ie.of(e)}export{CompletionContext,ae as acceptCompletion,ft as autocompletion,Ie as clearSnippet,Ke as closeBrackets,Ze as closeBracketsKeymap,fe as closeCompletion,qe as completeAnyWord,R as completeFromList,ut as completionKeymap,pt as completionStatus,mt as currentCompletions,Je as deleteBracketPair,Oe as hasNextSnippetField,Re as hasPrevSnippetField,T as ifIn,M as ifNotIn,et as insertBracket,F as insertCompletionText,re as moveCompletionSelection,ke as nextSnippetField,P as pickedCompletion,De as prevSnippetField,gt as selectedCompletion,vt as selectedCompletionIndex,bt as setSelectedCompletion,Ae as snippet,Le as snippetCompletion,Me as snippetKeymap,ce as startCompletion};
4

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.