can we actually fix this code proper codemirror formattings and highlightings, even in mixed content as html/css/javascript? also can we utilise all latest libs only from jsdelivr.com?
also, need to utilise these latest libraries from jsdelivr, not some outdated garbage from memory:
"""
/**
Bundled by jsDelivr using Rollup v2.79.2 and Terser v5.37.0.
Original file: /npm/codemirror@6.0.1/dist/index.js
Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
*/
import{lineNumbers as o,highlightActiveLineGutter as r,highlightSpecialChars as m,drawSelection as e,dropCursor as i,rectangularSelection as p,crosshairCursor as t,highlightActiveLine as c,keymap as l}from"/npm/@codemirror/view@6.35.2/+esm";export{EditorView}from"/npm/@codemirror/view@6.35.2/+esm";import{EditorState as f}from"/npm/@codemirror/state@6.4.1/+esm";import{foldGutter as n,indentOnInput as s,syntaxHighlighting as a,defaultHighlightStyle as d,bracketMatching as u,foldKeymap as w}from"/npm/@codemirror/language@6.10.6/+esm";import{history as x,defaultKeymap as b,historyKeymap as g}from"/npm/@codemirror/commands@6.7.1/+esm";import{highlightSelectionMatches as k,searchKeymap as v}from"/npm/@codemirror/search@6.5.8/+esm";import{closeBrackets as h,autocompletion as E,closeBracketsKeymap as M,completionKeymap as S}from"/npm/@codemirror/autocomplete@6.18.3/+esm";import{lintKeymap as V}from"/npm/@codemirror/lint@6.8.4/+esm";const j=(()=>[o(),r(),m(),x(),n(),e(),i(),f.allowMultipleSelections.of(!0),s(),a(d,{fallback:!0}),u(),h(),E(),p(),t(),c(),k(),l.of([...M,...b,...v,...g,...w,...S,...V])])(),q=(()=>[m(),x(),e(),a(d,{fallback:!0}),l.of([...b,...g])])();export{j as basicSetup,q as minimalSetup};export default null;
//# sourceMappingURL=/sm/b64abad136fa7f103b316ae1286f859cfd23e26427caf8d95c1c6a80d8d7301f.map
/**
Bundled by jsDelivr using Rollup v2.79.1 and Terser v5.19.2.
Original file: /npm/@codemirror/lang-html@6.4.9/dist/index.js
Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files/
import{parser as e,configureNesting as t}from"/npm/@lezer/html@1.3.9/+esm";import{cssLanguage as l,css as a}from"/npm/@codemirror/lang-css@6.2.1/+esm";import{typescriptLanguage as n,jsxLanguage as r,tsxLanguage as o,javascriptLanguage as s,javascript as i}from"/npm/@codemirror/lang-javascript@6.2.2/+esm";import{EditorView as u}from"/npm/@codemirror/view@6.26.3/+esm";import{EditorSelection as d}from"/npm/@codemirror/state@6.4.1/+esm";import{LRLanguage as c,indentNodeProp as m,foldNodeProp as p,bracketMatchingHandle as f,LanguageSupport as g,syntaxTree as h}from"/npm/@codemirror/language@6.10.1/+esm";const b=["_blank","_self","_top","_parent"],y=["ascii","utf-8","utf-16","latin1","latin1"],v=["get","post","put","delete"],x=["application/x-www-form-urlencoded","multipart/form-data","text/plain"],w=["true","false"],k={},C={a:{attrs:{href:null,ping:null,type:null,media:null,target:b,hreflang:null}},abbr:k,address:k,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:null,hreflang:null,type:null,shape:["default","rect","circle","poly"]}},article:k,aside:k,audio:{attrs:{src:null,mediagroup:null,crossorigin:["anonymous","use-credentials"],preload:["none","metadata","auto"],autoplay:["autoplay"],loop:["loop"],controls:["controls"]}},b:k,base:{attrs:{href:null,target:b}},bdi:k,bdo:k,blockquote:{attrs:{cite:null}},body:k,br:k,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:["autofocus"],disabled:["autofocus"],formenctype:x,formmethod:v,formnovalidate:["novalidate"],formtarget:b,type:["submit","reset","button"]}},canvas:{attrs:{width:null,height:null}},caption:k,center:k,cite:k,code:k,col:{attrs:{span:null}},colgroup:{attrs:{span:null}},command:{attrs:{type:["command","checkbox","radio"],label:null,icon:null,radiogroup:null,command:null,title:null,disabled:["disabled"],checked:["checked"]}},data:{attrs:{value:null}},datagrid:{attrs:{disabled:["disabled"],multiple:["multiple"]}},datalist:{attrs:{data:null}},dd:k,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:["open"]}},dfn:k,div:k,dl:k,dt:k,em:k,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:["disabled"],form:null,name:null}},figcaption:k,figure:k,footer:k,form:{attrs:{action:null,name:null,"accept-charset":y,autocomplete:["on","off"],enctype:x,method:v,novalidate:["novalidate"],target:b}},h1:k,h2:k,h3:k,h4:k,h5:k,h6:k,head:{children:["title","base","link","style","meta","script","noscript","command"]},header:k,hgroup:k,hr:k,html:{attrs:{manifest:null}},i:k,iframe:{attrs:{src:null,srcdoc:null,name:null,width:null,height:null,sandbox:["allow-top-navigation","allow-same-origin","allow-forms","allow-scripts"],seamless:["seamless"]}},img:{attrs:{alt:null,src:null,ismap:null,usemap:null,width:null,height:null,crossorigin:["anonymous","use-credentials"]}},input:{attrs:{alt:null,dirname:null,form:null,formaction:null,height:null,list:null,max:null,maxlength:null,min:null,name:null,pattern:null,placeholder:null,size:null,src:null,step:null,value:null,width:null,accept:["audio/","video/"],autocomplete:["on","off"],autofocus:["autofocus"],checked:["checked"],disabled:["disabled"],formenctype:x,formmethod:v,formnovalidate:["novalidate"],formtarget:b,multiple:["multiple"],readonly:["readonly"],required:["required"],type:["hidden","text","search","tel","url","email","password","datetime","date","month","week","time","datetime-local","number","range","color","checkbox","radio","file","submit","image","reset","button"]}},ins:{attrs:{cite:null,datetime:null}},kbd:k,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:["autofocus"],disabled:["disabled"],keytype:["RSA"]}},label:{attrs:{for:null,form:null}},legend:k,li:{attrs:{value:null}},link:{attrs:{href:null,type:null,hreflang:null,media:null,sizes:["all","16x16","16x16 32x32","16x16 32x32 64x64"]}},map:{attrs:{name:null}},mark:k,menu:{attrs:{label:null,type:["list","context","toolbar"]}},meta:{attrs:{content:null,charset:y,name:["viewport","application-name","author","description","generator","keywords"],"http-equiv":["content-language","content-type","default-style","refresh"]}},meter:{attrs:{value:null,min:null,low:null,high:null,max:null,optimum:null}},nav:k,noscript:k,object:{attrs:{data:null,type:null,name:null,usemap:null,form:null,width:null,height:null,typemustmatch:["typemustmatch"]}},ol:{attrs:{reversed:["reversed"],start:null,type:["1","a","A","i","I"]},children:["li","script","template","ul","ol"]},optgroup:{attrs:{disabled:["disabled"],label:null}},option:{attrs:{disabled:["disabled"],label:null,selected:["selected"],value:null}},output:{attrs:{for:null,form:null,name:null}},p:k,param:{attrs:{name:null,value:null}},pre:k,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:k,rt:k,ruby:k,samp:k,script:{attrs:{type:["text/javascript"],src:null,async:["async"],defer:["defer"],charset:y}},section:k,select:{attrs:{form:null,name:null,size:null,autofocus:["autofocus"],disabled:["disabled"],multiple:["multiple"]}},slot:{attrs:{name:null}},small:k,source:{attrs:{src:null,type:null,media:null}},span:k,strong:k,style:{attrs:{type:["text/css"],media:null,scoped:null}},sub:k,summary:k,sup:k,table:k,tbody:k,td:{attrs:{colspan:null,rowspan:null,headers:null}},template:k,textarea:{attrs:{dirname:null,form:null,maxlength:null,name:null,placeholder:null,rows:null,cols:null,autofocus:["autofocus"],disabled:["disabled"],readonly:["readonly"],required:["required"],wrap:["soft","hard"]}},tfoot:k,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:["row","col","rowgroup","colgroup"]}},thead:k,time:{attrs:{datetime:null}},title:k,tr:k,track:{attrs:{src:null,label:null,default:null,kind:["subtitles","captions","descriptions","chapters","metadata"],srclang:null}},ul:{children:["li","script","template","ul","ol"]},var:k,video:{attrs:{src:null,poster:null,width:null,height:null,crossorigin:["anonymous","use-credentials"],preload:["auto","metadata","none"],autoplay:["autoplay"],mediagroup:["movie"],muted:["muted"],controls:["controls"]}},wbr:k},T={accesskey:null,class:null,contenteditable:w,contextmenu:null,dir:["ltr","rtl","auto"],draggable:["true","false","auto"],dropzone:["copy","move","link","string:","file:"],hidden:["hidden"],id:null,inert:["inert"],itemid:null,itemprop:null,itemref:null,itemscope:["itemscope"],itemtype:null,lang:["ar","bn","de","en-GB","en-US","es","fr","hi","id","ja","pa","pt","ru","tr","zh"],spellcheck:w,autocorrect:w,autocapitalize:w,style:null,tabindex:null,title:null,translate:["yes","no"],rel:["stylesheet","alternate","author","bookmark","help","license","next","nofollow","noreferrer","prefetch","prev","search","tag"],role:"alert application article banner button cell checkbox complementary contentinfo dialog document feed figure form grid gridcell heading img list listbox listitem main navigation region row rowgroup search switch tab table tabpanel textbox timer".split(" "),"aria-activedescendant":null,"aria-atomic":w,"aria-autocomplete":["inline","list","both","none"],"aria-busy":w,"aria-checked":["true","false","mixed","undefined"],"aria-controls":null,"aria-describedby":null,"aria-disabled":w,"aria-dropeffect":null,"aria-expanded":["true","false","undefined"],"aria-flowto":null,"aria-grabbed":["true","false","undefined"],"aria-haspopup":w,"aria-hidden":w,"aria-invalid":["true","false","grammar","spelling"],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":["off","polite","assertive"],"aria-multiline":w,"aria-multiselectable":w,"aria-owns":null,"aria-posinset":null,"aria-pressed":["true","false","mixed","undefined"],"aria-readonly":w,"aria-relevant":null,"aria-required":w,"aria-selected":["true","false","undefined"],"aria-setsize":null,"aria-sort":["ascending","descending","none","other"],"aria-valuemax":null,"aria-valuemin":null,"aria-valuenow":null,"aria-valuetext":null},A="beforeunload copy cut dragstart dragover dragleave dragenter dragend drag paste focus blur change click load mousedown mouseenter mouseleave mouseup keydown keyup resize scroll unload".split(" ").map((e=>"on"+e));for(let e of A)T[e]=null;class j{constructor(e,t){this.tags=Object.assign(Object.assign({},C),e),this.globalAttrs=Object.assign(Object.assign({},T),t),this.allTags=Object.keys(this.tags),this.globalAttrNames=Object.keys(this.globalAttrs)}}function (e,O(t))];return(null==a?void 0:a.children)||l.allTags}function I(e,t){let l=[];for(let a=O(t);a&&!a.type.isTop;a=O(a.parent)){let n=/;function q(e,t,l,a,n){let r=/\s*>/.test(e.sliceDoc(n,n+5))?"":">",o=O(l,!0);return{from:a,to:n,options:S(e.doc,o,t).map((e=>({label:e,type:"type"}))).concat(I(e.doc,l).map(((e,t)=>({label:"/"+e,apply:"/"+e+r,type:"type",boost:99-t})))),validFor:/^/?[:-.\w\u00b7-\uffff]/,l="",r=e.sliceDoc(n,n+1)==t[0]?"":t[0],t=t.slice(1),a++):o=/^[^\s<>='"]*/}}(l,e,n,a)}function D(e){return N(j.default,e)}function F(e){let{extraTags:t,extraGlobalAttributes:l}=e,a=l||t?new j(t,l):j.default;return e=>N(a,e)}const "}}),G=V.configure({wrap:t(L,B)});function M(e={}){let l,n="";!1===e.matchClosingTags&&(n="noMatch"),!0===e.selfClosingTags&&(n=(n?n+" ":"")+"selfClosing"),(e.nestedLanguages&&e.nestedLanguages.length||e.nestedAttributes&&e.nestedAttributes.length)&&(l=t((e.nestedLanguages||[]).concat(L),(e.nestedAttributes||[]).concat(B)));let r=l?V.configure({wrap:l,dialect:n}):n?G.configure({dialect:n}):G;return new g(r,[G.data.of({autocomplete:F(e)}),!1!==e.autoCloseTags?U:[],i().support,a().support])}const R=new Set("area base br col command embed frame hr img input keygen link meta param source track wbr menuitem".split(" ")),U=u.inputHandler.of(((e,t,l,a,n)=>{if(e.composing||e.state.readOnly||t!=l||">"!=a&&"/"!=a||!G.isActiveAt(e.state,t,-1))return!1;let r=n(),{state:o}=r,s=o.changeByRange((e=>{var t,l,n;let r,s=o.doc.sliceString(e.from-1,e.to)==a,{head:i}=e,u=h(o).resolveInner(i,-1);if(s&&">"==a&&"EndTag"==u.name){let a=u.parent;if("CloseTag"!=(null===(l=null===(t=a.parent)||void 0===t?void 0:t.lastChild)||void 0===l?void 0:l.name)&&(r={r}>${r}>`;return{range:d.cursor(i+t.length,-1),changes:{from:i,to:e,insert:t}}}}return{range:e}}));return!s.changes.empty&&(e.dispatch([r,o.update(s,{userEvent:"input.complete",scrollIntoView:!0})]),!0)}));export{U as autoCloseTags,M as html,D as htmlCompletionSource,F as htmlCompletionSourceWith,G as htmlLanguage,V as htmlPlain};export default null;
//# sourceMappingURL=/sm/527d5f6b103b00b8ca369704a6eeeb5d3a2fe558eb9048bb8dac7e1e783f4499.map
/;for(let e of u)i.push({label:e,apply:l+e+r,type:"constant"})}}return{from:a,to:n,options:i,validFor:o}}(l,e,n,"Is"==n.name?a:n.from,a):!t.explicit||"Element"!=r.name&&"Text"!=r.name&&"Document"!=r.name?null:function(e,t,l,a){let n=[],r=0;for(let a of S(e.doc,l,t))n.push({label:"<"+a,type:"type"});for(let t of I(e.doc,l))n.push({label:"</"+t+">",type:"type",boost:99-r++});return{from:a,to:a,options:n,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*
Bundled by jsDelivr using Rollup v2.79.1 and Terser v5.19.2.
Original file: /npm/@codemirror/lang-javascript@6.2.2/dist/index.js
Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files/
import{parser as e}from"/npm/@lezer/javascript@1.4.13/+esm";import{syntaxTree as t,LRLanguage as n,indentNodeProp as r,continuedIndent as o,flatIndent as a,delimitedIndent as i,foldNodeProp as l,foldInside as s,sublanguageProp as c,LanguageSupport as m,defineLanguageFacet as p}from"/npm/@codemirror/language@6.10.1/+esm";import{EditorSelection as f}from"/npm/@codemirror/state@6.4.1/+esm";import{EditorView as u}from"/npm/@codemirror/view@6.24.1/+esm";import{snippetCompletion as d,ifNotIn as y,completeFromList as g}from"/npm/@codemirror/autocomplete@6.12.0/+esm";import{IterMode as b,NodeWeakMap as h}from"/npm/@lezer/common@1.2.1/+esm";const =[d("function{name}({params}) {\n\t{}\n}",{label:"function",detail:"definition",type:"keyword"}),d("for (let index=0;{index} < bound;{index}++) {\n\t{}\n}",{label:"for",detail:"loop",type:"keyword"}),d("for (let {name} of {collection}) {\n\t{}\n}",{label:"for",detail:"of loop",type:"keyword"}),d("do {\n\t{}\n} while ({})",{label:"do",detail:"loop",type:"keyword"}),d("while ({}) {\n\t{}\n}",{label:"while",detail:"loop",type:"keyword"}),d("try {\n\t{}\n} catch ({error}) {\n\t{}\n}",{label:"try",detail:"/ catch block",type:"keyword"}),d("if ({}) {\n\t{}\n}",{label:"if",detail:"block",type:"keyword"}),d("if ({}) {\n\t{}\n} else {\n\t{}\n}",{label:"if",detail:"/ else block",type:"keyword"}),d("class {name} {\n\tconstructor({params}) {\n\t\t{}\n\t}\n}",{label:"class",detail:"definition",type:"keyword"}),d('import {{names}} from "module"\n{}',{label:"import",detail:"named",type:"keyword"}),d('import namefrom"{module}"\n′,label:"import",.concat([d("interface {name} {\n\t{}\n}",{label:"interface",detail:"definition",type:"keyword"}),d("type name={type}",{label:"type",detail:"definition",type:"keyword"}),d("enum {name} {\n\t{}\n}",{label:"enum",detail:"definition",type:"keyword"})]),w=new h,x=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function v(e){return(t,n)=>{let r=t.node.getChild("VariableDefinition");return r&&n(r,e),!0}}const k=["FunctionDeclaration"],T={FunctionDeclaration:v("function"),ClassDeclaration:v("class"),ClassExpression:()=>!0,EnumDeclaration:v("constant"),TypeAliasDeclaration:v("type"),NamespaceDeclaration:v("namespace"),VariableDefinition(e,t){e.matchContext(k)||t(e,"variable")},TypeDefinition(e,t){t(e,"type")},proto:null};function C(e,t){let n=w.get(t);if(n)return n;let r=[],o=!0;function a(t,n){let o=e.sliceString(t.from,t.to);r.push({label:o,type:n})}return t.cursor(b.IncludeAnonymous).iterate((t=>{if(o)o=!1;else if(t.name){let e=T[t.name];if(e&&e(t,a)||x.has(t.name))return!1}else if(t.to-t.from>8192){for(let n of C(e,t.node))r.push(n);return!1}})),w.set(t,r),r}const J=/^[\w\xa1−\uffff][\w\d\xa1-\uffff]/,X=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName",".","?."];function D(e){let n=t(e.state).resolveInner(e.pos,-1);if(X.indexOf(n.name)>-1)return null;let r="VariableName"==n.name||n.to-n.from<20&&J.test(e.state.sliceDoc(n.from,n.to));if(!r&&!e.explicit)return null;let o=[];for(let t=n;t;t=t.parent)x.has(t.name)&&(o=o.concat(C(e.state.doc,t)));return{options:o,from:r?n.from:e.pos,validFor:J}}function A(e,t,n){var r;let o=[];for(;;){let a,i=t.firstChild;if("VariableName"==(null==i?void 0:i.name))return o.push(e(i)),{path:o.reverse(),name:n};if("MemberExpression"!=(null==i?void 0:i.name)||"PropertyName"!=(null===(r=a=i.lastChild)||void 0===r?void 0:r.name))return null;o.push(e(a)),t=i}}function E(e){let n=t=>e.state.doc.sliceString(t.from,t.to),r=t(e.state).resolveInner(e.pos,-1);return"PropertyName"==r.name?A(n,r.parent,n(r)):"."!=r.name&&"?."!=r.name||"MemberExpression"!=r.parent.name?X.indexOf(r.name)>-1?null:"VariableName"==r.name||r.to-r.from<20&&J.test(n(r))?{path:[],name:n(r)}:"MemberExpression"==r.name?A(n,r,""):e.explicit?{path:[],name:""}:null:A(n,r.parent,"")}function I(e){let t=new Map;return n=>{let r=E(n);if(!r)return null;let o=e;for(let e of r.path)if(o=o[e],!o)return null;let a=t.get(o);return a||t.set(o,a=function(e,t){let n=[],r=new Set;for(let o=0;;o++){for(let a of(Object.getOwnPropertyNames||Object.keys)(e)){if(!/^[a-zA-Z_\xaa-\uffdc][\w\xaa−\uffdc]∗/.test(a)||r.has(a))continue;let i;r.add(a);try{i=e[a]}catch(e){continue}n.push({label:a,type:"function"==typeof i?/^[A-Z]/.test(a)?"class":t?"function":"method":t?"variable":"property",boost:-o})}let a=Object.getPrototypeOf(e);if(!a)return n;e=a}}(o,!r.path.length)),{from:n.pos-r.name.length,options:a,validFor:J}}}const O=n.define({name:"javascript",parser:e.configure({props:[r.add({IfStatement:o({except:/^\s*({|else\b)/}),TryStatement:o({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:a,SwitchBody:e=>{let t=e.textAfter,n=/^\s*}/.test(t),r=/^\s*(case|default)\b/.test(t);return e.baseIndent+(n?0:r?1:2)e.unit},Block:i({closing:"}"}),ArrowFunction:e=>e.baseIndent+e.unit,"TemplateString BlockComment":()=>null,"Statement Property":o({except:/^{/}),JSXElement(e){let t=/^\s<//.test(e.textAfter);return e.lineIndent(e.node.from)+(t?0:e.unit)},JSXEscape(e){let t=/\s*}/.test(e.textAfter);return e.lineIndent(e.node.from)+(t?0:e.unit)},"JSXOpenTag JSXSelfClosingTag":e=>e.column(e.node.from)+e.unit}),l.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":s,BlockComment:e=>({from:e.from+2,to:e.to-2})})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',""]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),B={test:e=>/^JSX/.test(e.name),facet:p({commentTokens:{block:{open:"{/*",close:"*/}"}}})},j=O.configure({dialect:"ts"},"typescript"),F=O.configure({dialect:"jsx",props:[c.add((e=>e.isTop?[B]:void 0))]}),N=O.configure({dialect:"jsx ts",props:[c.add((e=>e.isTop?[B]:void 0))]},"typescript");let P=e=>({label:e,type:"keyword"});const V="break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield".split(" ").map(P),M=V.concat(["declare","implements","private","protected","public"].map(P));function L(e={}){let t=e.jsx?e.typescript?N:F:e.typescript?j:O,n=e.typescript?S.concat(M):$.concat(V);return new m(t,[O.data.of({autocomplete:y(X,g(n))}),O.data.of({autocomplete:D}),e.jsx?z:[]])}function _(e,t,n=e.length){for(let r=null==t?void 0:t.firstChild;r;r=r.nextSibling)if("JSXIdentifier"==r.name||"JSXBuiltin"==r.name||"JSXNamespacedName"==r.name||"JSXMemberExpression"==r.name)return e.sliceString(r.from,Math.min(r.to,n));return""}const R="object"==typeof navigator&&/Android\b/.test(navigator.userAgent),z=u.inputHandler.of(((e,n,r,o,a)=>{if((R?e.composing:e.compositionStarted)||e.state.readOnly||n!=r||">"!=o&&"/"!=o||!O.isActiveAt(e.state,n,-1))return!1;let i=a(),{state:l}=i,s=l.changeByRange((e=>{var n;let r,{head:a}=e,i=t(l).resolveInner(a-1,-1);if("JSXStartTag"==i.name&&(i=i.parent),l.doc.sliceString(a-1,a)!=o||"JSXAttributeValue"==i.name&&i.to>a);else{if(">"==o&&"JSXFragmentTag"==i.name)return{range:e,changes:{from:a,insert:"</>"}};if("/"==o&&"JSXStartCloseTag"==i.name){let e=i.parent,t=e.parent;if(t&&e.from==a-2&&((r=_(l.doc,t.firstChild,a))||"JSXFragmentTag"==(null===(n=t.firstChild)||void 0===n?void 0:n.name))){let e={r}>`;return{range:f.cursor(a+e.length,-1),changes:{from:a,insert:e}}}}else if(">"==o){let t=function(e){for(;;){if("JSXOpenTag"==e.name||"JSXSelfClosingTag"==e.name||"JSXFragmentTag"==e.name)return e;if("JSXEscape"==e.name||!e.parent)return null;e=e.parent}}(i);if(t&&"JSXOpenTag"==t.name&&!/^\/?>|^<\//.test(l.doc.sliceString(a,a+2))&&(r=_(l.doc,t,a)))return{range:e,changes:{from:a,insert:`</{r}>`}}}}return{range:e}}));return!s.changes.empty&&(e.dispatch([i,l.update(s,{userEvent:"input.complete",scrollIntoView:!0})]),!0)}));function Z(e,t){return t||(t={parserOptions:{ecmaVersion:2019,sourceType:"module"},env:{browser:!0,node:!0,es6:!0,es2015:!0,es2017:!0,es2020:!0},rules:{}},e.getRules().forEach(((e,n)=>{e.meta.docs.recommended&&(t.rules[n]=2)}))),n=>{let{state:r}=n,o=[];for(let{from:n,to:a}of O.findRegions(r)){let i=r.doc.lineAt(n),l={line:i.number-1,col:n-i.from,pos:n};for(let i of e.verify(r.sliceDoc(n,a),t))o.push(q(i,r.doc,l))}return o}}function H(e,t,n,r){return n.line(e+r.line).from+t+(1==e?r.col-1:-1)}function q(e,t,n){let r=H(e.line,e.column,t,n),o={from:r,to:null!=e.endLine&&1!=e.endColumn?H(e.endLine,e.endColumn,t,n):r,message:e.message,source:e.ruleId?"eslint:"+e.ruleId:"eslint",severity:1==e.severity?"warning":"error"};if(e.fix){let{range:t,text:a}=e.fix,i=t[0]+n.pos-r,l=t[1]+n.pos-r;o.actions=[{name:"fix",apply(e,t){e.dispatch({changes:{from:t+i,to:t+l,insert:a},scrollIntoView:!0})}}]}return o}export{z as autoCloseTags,E as completionPath,Z as esLint,L as javascript,O as javascriptLanguage,F as jsxLanguage,D as localCompletionSource,I as scopeCompletionSource,$ as snippets,N as tsxLanguage,j as typescriptLanguage,S as typescriptSnippets};export default null;
//# sourceMappingURL=/sm/fd60552e30693f2d9153daf61699f81137816f0f46b16244bb3a084204db08a2.map
/**
Bundled by jsDelivr using Rollup v2.79.1 and Terser v5.19.2.
Original file: /npm/@codemirror/lint@6.8.4/dist/index.js
Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files/
import{getPanel as e,EditorView as t,Decoration as i,hoverTooltip as o,showPanel as s,ViewPlugin as n,gutter as l,showTooltip as r,logException as a,WidgetType as c,GutterMarker as d}from"/npm/@codemirror/view@6.35.0/+esm";import{StateEffect as m,RangeSet as f,StateField as u,Facet as h,combineConfig as g,RangeSetBuilder as p}from"/npm/@codemirror/state@6.4.1/+esm";import v from"/npm/crelt@1.0.6/+esm";class w{constructor(e,t,i){this.from=e,this.to=t,this.diagnostic=i}}class b{constructor(e,t,i){this.diagnostics=e,this.panel=t,this.selected=i}static init(e,t,o){let s=e,n=o.facet().markerFilter;n&&(s=n(s,o));let l=e.slice().sort(((e,t)=>e.from-t.from||e.to-t.to)),r=new p,a=[],c=0;for(let e=0;;){let t,s,n=e==l.length?null:l[e];if(!n&&!a.length)break;for(a.length?(t=c,s=a.reduce(((e,t)=>Math.min(e,t.to)),n&&n.from>t?n.from:1e8)):(t=n.from,s=n.to,a.push(n),e++);e<l.length;){let i=l[e];if(i.from!=t||!(i.to>i.from||i.to==t)){s=Math.min(i.from,s);break}a.push(i),e++,s=Math.min(i.to,s)}let d=J(a);if(a.some((e=>e.from==e.to||e.from==e.to-1&&o.doc.lineAt(e.from).to==e.from)))r.add(t,t,i.widget({widget:new V(d),diagnostics:a.slice()}));else{let e=a.reduce(((e,t)=>t.markClass?e+" "+t.markClass:e),"");r.add(t,s,i.mark({class:"cm-lintRange cm-lintRange-"+d+e,diagnostics:a.slice(),inclusiveEnd:a.some((e=>e.to>s))}))}c=s;for(let e=0;e<a.length;e++)a[e].to<=c&&a.splice(e--,1)}let d=r.finish();return new b(d,t,k(d))}}function k(e,t=null,i=0){let o=null;return e.between(i,1e9,((e,i,{spec:s})=>{if(!(t&&s.diagnostics.indexOf(t)<0))if(o){if(s.diagnostics.indexOf(o.diagnostic)<0)return!1;o=new w(o.from,i,o.diagnostic)}else o=new w(e,i,t||s.diagnostics[0])})),o}function x(e,t){let i=t.pos,o=t.end||i,s=e.state.facet().hideOn(e,i,o);if(null!=s)return s;let n=e.startState.doc.lineAt(t.pos);return!(!e.effects.some((e=>e.is(T)))&&!e.changes.touchesRange(n.from,Math.max(n.to,o)))}function y(e,t){return e.field(S,!1)?t:t.concat(m.appendConfig.of(se))}function C(e,t){return{effects:y(e,[T.of(t)])}}const T=m.define(),R=m.define(),A=m.define(),S=u.define({create:()=>new b(i.none,null,null),update(e,t){if(t.docChanged&&e.diagnostics.size){let i=e.diagnostics.map(t.changes),o=null,s=e.panel;if(e.selected){let s=t.changes.mapPos(e.selected.from,1);o=k(i,e.selected.diagnostic,s)||k(i,null,s)}!i.size&&s&&t.state.facet().autoPanel&&(s=null),e=new b(i,s,o)}for(let i of t.effects)if(i.is(T)){let o=t.state.facet().autoPanel?i.value.length?Z.open:null:e.panel;e=b.init(i.value,o,t.state)}else i.is(R)?e=new b(e.diagnostics,i.value?Z.open:null,e.selected):i.is(A)&&(e=new b(e.diagnostics,e.panel,i.value));return e},provide:e=>[s.from(e,(e=>e.panel)),t.decorations.from(e,(e=>e.diagnostics))]});function L(e){let t=e.field(S,!1);return t?t.diagnostics.size:0}const I=i.mark({class:"cm-lintRange cm-lintRange-active"});function M(e,t,i){let o,{diagnostics:s}=e.state.field(S),n=-1,l=-1;s.between(t-(i<0?1:0),t+(i>0?1:0),((e,s,{spec:r})=>{if(t>=e&&t<=s&&(e==s||(t>e||i>0)&&(t<s||i<0)))return o=r.diagnostics,n=e,l=s,!1}));let r=e.state.facet().tooltipFilter;return o&&r&&(o=r(o,e.state)),o?{pos:n,end:l,above:e.state.doc.lineAt(n).to<l,create:()=>({dom:O(e,o)})}:null}function O(e,t){return v("ul",{class:"cm-tooltip-lint"},t.map((t=>q(e,t,!1))))}const P=t=>{let i=t.state.field(S,!1);i&&i.panel||t.dispatch({effects:y(t.state,[R.of(!0)])});let o=e(t,Z.open);return o&&o.dom.querySelector(".cm-panel-lint ul").focus(),!0},B=e=>{let t=e.state.field(S,!1);return!(!t||!t.panel)&&(e.dispatch({effects:R.of(!1)}),!0)},D=e=>{let t=e.state.field(S,!1);if(!t)return!1;let i=e.state.selection.main,o=t.diagnostics.iter(i.to+1);return!(!o.value&&(o=t.diagnostics.iter(0),!o.value||o.from==i.from&&o.to==i.to))&&(e.dispatch({selection:{anchor:o.from,head:o.to},scrollIntoView:!0}),!0)},F=e=>{let{state:t}=e,i=t.field(S,!1);if(!i)return!1;let o,s,n,l,r=t.selection.main;return i.diagnostics.between(0,t.doc.length,((e,t)=>{t<r.to&&(null==o||o<e)&&(o=e,s=t),(null==n||e>n)&&(n=e,l=t)})),null!=n&&(null!=o||n!=r.from)&&(e.dispatch({selection:{anchor:null!=o?o:n,head:null!=s?s:l},scrollIntoView:!0}),!0)},j=[{key:"Mod-Shift-m",run:P,preventDefault:!0},{key:"F8",run:D}],z=n.fromClass(class{constructor(e){this.view=e,this.timeout=-1,this.set=!0;let{delay:t}=e.state.facet();this.lintTime=Date.now()+t,this.run=this.run.bind(this),this.timeout=setTimeout(this.run,t)}run(){clearTimeout(this.timeout);let e=Date.now();if(e<this.lintTime-10)this.timeout=setTimeout(this.run,this.lintTime-e);else{this.set=!1;let{state:e}=this.view,{sources:t}=e.facet();t.length&&function(e,t,i){let o=[],s=-1;for(let n of e)n.then((i=>{o.push(i),clearTimeout(s),o.length==e.length?t(o):s=setTimeout((()=>t(o)),200)}),i)}(t.map((e=>Promise.resolve(e(this.view)))),(t=>{this.view.state.doc==e.doc&&this.view.dispatch(C(this.view.state,t.reduce(((e,t)=>e.concat(t)))))}),(e=>{a(this.view.state,e)}))}}update(e){let t=e.state.facet();(e.docChanged||t!=e.startState.facet()||t.needsRefresh&&t.needsRefresh(e))&&(this.lintTime=Date.now()+t.delay,this.set||(this.set=!0,this.timeout=setTimeout(this.run,t.delay)))}force(){this.set&&(this.lintTime=Date.now(),this.run())}destroy(){clearTimeout(this.timeout)}});const =h.define({combine:e=>Object.assign({sources:e.map((e=>e.source)).filter((e=>null!=e))},g(e.map((e=>e.config)),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{needsRefresh:(e,t)=>e?t?i=>e(i)||t(i):e:t}))});function E(e,t={}){return[.of({source:e,config:t}),z,se]}function H(e){let t=e.plugin(z);t&&t.force()}function N(e){let t=[];if(e)e:for(let{name:i}of e){for(let e=0;e<i.length;e++){let o=i[e];if(/[a-zA-Z]/.test(o)&&!t.some((e=>e.toLowerCase()==o.toLowerCase()))){t.push(o);continue e}}t.push("")}return t}function q(e,t,i){var o;let s=i?N(t.actions):[];return v("li",{class:"cm-diagnostic cm-diagnostic-"+t.severity},v("span",{class:"cm-diagnosticText"},t.renderMessage?t.renderMessage(e):t.message),null===(o=t.actions)||void 0===o?void 0:o.map(((i,o)=>{let n=!1,l=o=>{if(o.preventDefault(),n)return;n=!0;let s=k(e.state.field(S).diagnostics,t);s&&i.apply(e,s.from,s.to)},{name:r}=i,a=s[o]?r.indexOf(s[o]):-1,c=a<0?r:[r.slice(0,a),v("u",r.slice(a,a+1)),r.slice(a+1)];return v("button",{type:"button",class:"cm-diagnosticAction",onclick:l,onmousedown:l,"aria-label":` Action: {r}{a<0?"":` (access key "{s[o]})"}.},c)})),t.source&&v("div",{class:"cm-diagnosticSource"},t.source))}class V extends c{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return v("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class Y{constructor(e,t){this.diagnostic=t,this.id="item_"+Math.floor(4294967295Math.random()).toString(16),this.dom=q(e,t,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class Z{constructor(e){this.view=e,this.items=[];this.list=v("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:t=>{if(27==t.keyCode)B(this.view),this.view.focus();else if(38==t.keyCode||33==t.keyCode)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(40==t.keyCode||34==t.keyCode)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(36==t.keyCode)this.moveSelection(0);else if(35==t.keyCode)this.moveSelection(this.items.length-1);else if(13==t.keyCode)this.view.focus();else{if(!(t.keyCode>=65&&t.keyCode<=90&&this.selectedIndex>=0))return;{let{diagnostic:i}=this.items[this.selectedIndex],o=N(i.actions);for(let s=0;s<o.length;s++)if(o[s].toUpperCase().charCodeAt(0)==t.keyCode){let t=k(this.view.state.field(S).diagnostics,i);t&&i.actions[s].apply(e,t.from,t.to)}}}t.preventDefault()},onclick:e=>{for(let t=0;t<this.items.length;t++)this.items[t].dom.contains(e.target)&&this.moveSelection(t)}}),this.dom=v("div",{class:"cm-panel-lint"},this.list,v("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>B(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(S).selected;if(!e)return-1;for(let t=0;t<this.items.length;t++)if(this.items[t].diagnostic==e.diagnostic)return t;return-1}update(){let{diagnostics:e,selected:t}=this.view.state.field(S),i=0,o=!1,s=null,n=new Set;for(e.between(0,this.view.state.doc.length,((e,l,{spec:r})=>{for(let e of r.diagnostics){if(n.has(e))continue;n.add(e);let l,r=-1;for(let t=i;t<this.items.length;t++)if(this.items[t].diagnostic==e){r=t;break}r<0?(l=new Y(this.view,e),this.items.splice(i,0,l),o=!0):(l=this.items[r],r>i&&(this.items.splice(i,r-i),o=!0)),t&&l.diagnostic==t.diagnostic?l.dom.hasAttribute("aria-selected")||(l.dom.setAttribute("aria-selected","true"),s=l):l.dom.hasAttribute("aria-selected")&&l.dom.removeAttribute("aria-selected"),i++}}));i<this.items.length&&!(1==this.items.length&&this.items[0].diagnostic.from<0);)o=!0,this.items.pop();0==this.items.length&&(this.items.push(new Y(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),o=!0),s?(this.list.setAttribute("aria-activedescendant",s.id),this.view.requestMeasure({key:this,read:()=>({sel:s.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:e,panel:t})=>{let i=t.height/this.list.offsetHeight;e.top<t.top?this.list.scrollTop-=(t.top-e.top)/i:e.bottom>t.bottom&&(this.list.scrollTop+=(e.bottom-t.bottom)/i)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),o&&this.sync()}sync(){let e=this.list.firstChild;function t(){let t=e;e=t.nextSibling,t.remove()}for(let i of this.items)if(i.dom.parentNode==this.list){for(;e!=i.dom;)t();e=i.dom.nextSibling}else this.list.insertBefore(i.dom,e);for(;e;)t()}moveSelection(e){if(this.selectedIndex<0)return;let t=k(this.view.state.field(S).diagnostics,this.items[e].diagnostic);t&&this.view.dispatch({selection:{anchor:t.from,head:t.to},scrollIntoView:!0,effects:A.of(t)})}static open(e){return new Z(e)}}function (e,t='viewBox="0 0 40 40"'){returnurl('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${t}>${encodeURIComponent(e)}</svg>')}function U(e){return (<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${e}" fill="none" stroke-width=".7"/>,'width="6" height="3"')}const X=t.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:U("#d11")},".cm-lintRange-warning":{backgroundImage:U("orange")},".cm-lintRange-info":{backgroundImage:U("#999")},".cm-lintRange-hint":{backgroundImage:U("#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}}});function G(e){return"error"==e?4:"warning"==e?3:"info"==e?2:1}function J(e){let t="hint",i=1;for(let o of e){let e=G(o.severity);e>i&&(i=e,t=o.severity)}return t}class K extends d{constructor(e){super(),this.diagnostics=e,this.severity=J(e)}toDOM(e){let t=document.createElement("div");t.className="cm-lint-marker cm-lint-marker-"+this.severity;let i=this.diagnostics,o=e.state.facet(ne).tooltipFilter;return o&&(i=o(i,e.state)),i.length&&(t.onmouseover=()=>function(e,t,i){function o(){let o=e.elementAtHeight(t.getBoundingClientRect().top+5-e.documentTop);e.coordsAtPos(o.from)&&e.dispatch({effects:te.of({pos:o.from,above:!1,clip:!1,create:()=>({dom:O(e,i),getCoords:()=>t.getBoundingClientRect()})})}),t.onmouseout=t.onmousemove=null,function(e,t){let i=o=>{let s=t.getBoundingClientRect();if(!(o.clientX>s.left-10&&o.clientX<s.right+10&&o.clientY>s.top-10&&o.clientY<s.bottom+10)){for(let e=o.target;e;e=e.parentNode)if(1==e.nodeType&&e.classList.contains("cm-tooltip-lint"))return;window.removeEventListener("mousemove",i),e.state.field(ie)&&e.dispatch({effects:te.of(null)})}};window.addEventListener("mousemove",i)}(e,t)}let{hoverTime:s}=e.state.facet(ne),n=setTimeout(o,s);t.onmouseout=()=>{clearTimeout(n),t.onmouseout=t.onmousemove=null},t.onmousemove=()=>{clearTimeout(n),n=setTimeout(o,s)}}(e,t,i)),t}}function Q(e,t){let i=Object.create(null);for(let o of t){let t=e.lineAt(o.from);(i[t.from]||(i[t.from]=[])).push(o)}let o=[];for(let e in i)o.push(new K(i[e]).range(+e));return f.of(o,!0)}const W=l({class:"cm-gutter-lint",markers:e=>e.state.field(ee),widgetMarker:(e,t,i)=>{let o=[];return e.state.field(ee).between(i.from,i.to,((e,t,s)=>{e>i.from&&e<i.to&&o.push(...s.diagnostics)})),o.length?new K(o):null}}),ee=u.define({create:()=>f.empty,update(e,t){e=e.map(t.changes);let i=t.state.facet(ne).markerFilter;for(let o of t.effects)if(o.is(T)){let s=o.value;i&&(s=i(s||[],t.state)),e=Q(t.state.doc,s.slice(0))}return e}}),te=m.define(),ie=u.define({create:()=>null,update:(e,t)=>(e&&t.docChanged&&(e=x(t,e)?null:Object.assign(Object.assign({},e),{pos:t.changes.mapPos(e.pos)})),t.effects.reduce(((e,t)=>t.is(te)?t.value:e),e)),provide:e=>r.from(e)}),oe=t.baseTheme({".cm-gutter-lint":{width:"1.4em","& .cm-gutterElement":{padding:".2em"}},".cm-lint-marker":{width:"1em",height:"1em"},".cm-lint-marker-info":{content:('')},".cm-lint-marker-warning":{content:('')},".cm-lint-marker-error":{content:_('')}}),se=[S,t.decorations.compute([S],(e=>{let{selected:t,panel:o}=e.field(S);return t&&o&&t.from!=t.to?i.set([I.range(t.from,t.to)]):i.none})),o(M,{hideOn:x}),X],ne=h.define({combine:e=>g(e,{hoverTime:300,markerFilter:null,tooltipFilter:null})});function le(e={}){return[ne.of(e),ee,W,oe,ie]}function re(e,t){let i=e.field(S,!1);if(i&&i.diagnostics.size){let e=[],o=[],s=-1;for(let n=f.iter([i.diagnostics]);;n.next()){for(let i=0;i<e.length;i++)(!n.value||n.value.spec.diagnostics.indexOf(e[i])<0)&&(t(e[i],o[i],s),e.splice(i,1),o.splice(i--,1));if(!n.value)break;for(let t of n.value.spec.diagnostics)e.indexOf(t)<0&&(e.push(t),o.push(n.from));s=n.to}}}export{B as closeLintPanel,L as diagnosticCount,re as forEachDiagnostic,H as forceLinting,le as lintGutter,j as lintKeymap,E as linter,D as nextDiagnostic,P as openLintPanel,F as previousDiagnostic,C as setDiagnostics,T as setDiagnosticsEffect};export default null;
//# sourceMappingURL=/sm/d5990eccb91485cf6522f769aea345cb733992e1548d68d7719aa3c7784c110a.map
/**
Bundled by jsDelivr using Rollup v2.79.1 and Terser v5.19.2.
Original file: /npm/@codemirror/search@6.5.8/dist/index.js
Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files/
import{getPanel as e,EditorView as t,showPanel as r,ViewPlugin as i,Decoration as n,runScopeHandlers as s}from"/npm/@codemirror/view@6.35.0/+esm";import{codePointAt as o,fromCodePoint as l,codePointSize as a,StateEffect as c,EditorSelection as h,EditorState as u,CharCategory as f,findClusterBreak as d,Prec as m,StateField as p,Facet as g,combineConfig as v,RangeSetBuilder as x}from"/npm/@codemirror/state@6.4.1/+esm";import b from"/npm/crelt@1.0.6/+esm";const y="function"==typeof String.prototype.normalize?e=>e.normalize("NFKD"):e=>e;class w{constructor(e,t,r=0,i=e.length,n,s){this.test=s,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(r,i),this.bufferStart=r,this.normalize=n?e=>n(y(e)):y,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 o(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=l(e),r=this.bufferStart+this.bufferPos;this.bufferPos+=a(e);let i=this.normalize(t);if(i.length)for(let e=0,n=r;;e++){let s=i.charCodeAt(e),o=this.match(s,n,this.bufferPos+this.bufferStart);if(e==i.length-1){if(o)return this.value=o,this;break}n==r&&e<t.length&&t.charCodeAt(e)==s&&n++}}}match(e,t,r){let i=null;for(let t=0;t<this.matches.length;t+=2){let n=this.matches[t],s=!1;this.query.charCodeAt(n)==e&&(n==this.query.length-1?i={from:this.matches[t+1],to:r}:(this.matches[t]++,s=!0)),s||(this.matches.splice(t,2),t-=2)}return this.query.charCodeAt(0)==e&&(1==this.query.length?i={from:t,to:r}:this.matches.push(1,t)),i&&this.test&&!this.test(i.from,i.to,this.buffer,this.bufferStart)&&(i=null),i}}"undefined"!=typeof Symbol&&(w.prototype[Symbol.iterator]=function(){return this});const M={from:-1,to:-1,match:/./.exec("")},k="gm"+(null==/x/.unicode?"":"u");class S{constructor(e,t,r,i=0,n=e.length){if(this.text=e,this.to=n,this.curLine="",this.done=!1,this.value=M,/\[sWDnr]|\n|\r|[^/.test(t))return new L(e,t,r,i,n);this.re=new RegExp(t,k+((null==r?void 0:r.ignoreCase)?"i":"")),this.test=null==r?void 0:r.test,this.iter=e.iter();let s=e.lineAt(i);this.curLineStart=s.from,this.matchPos=W(e,i),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine="":(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let r=this.curLineStart+t.index,i=r+t[0].length;if(this.matchPos=W(this.text,i+(r==i?1:0)),r==this.curLineStart+this.curLine.length&&this.nextLine(),(r<i||r>this.value.to)&&(!this.test||this.test(r,i,t)))return this.value={from:r,to:i,match:t},this;e=this.matchPos-this.curLineStart}else{if(!(this.curLineStart+this.curLine.length<this.to))return this.done=!0,this;this.nextLine(),e=0}}}}const q=new WeakMap;class C{constructor(e,t){this.from=e,this.text=t}get to(){return this.from+this.text.length}static get(e,t,r){let i=q.get(e);if(!i||i.from>=r||i.to<=t){let i=new C(t,e.sliceString(t,r));return q.set(e,i),i}if(i.from==t&&i.to==r)return i;let{text:n,from:s}=i;return s>t&&(n=e.sliceString(t,s)+n,s=t),i.to<r&&(n+=e.sliceString(i.to,r)),q.set(e,new C(s,n)),new C(t,n.slice(t-s,r-s))}}class L{constructor(e,t,r,i,n){this.text=e,this.to=n,this.done=!1,this.value=M,this.matchPos=W(e,i),this.re=new RegExp(t,k+((null==r?void 0:r.ignoreCase)?"i":"")),this.test=null==r?void 0:r.test,this.flat=C.get(e,i,this.chunkEnd(i+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 e=this.flat.from+t.index,r=e+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(e,r,t)))return this.value={from:e,to:r,match:t},this.matchPos=W(this.text,r+(e==r?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=C.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+2*this.flat.text.length))}}}function W(e,t){if(t>=e.length)return t;let r,i=e.lineAt(t);for(;t<i.to&&(r=i.text.charCodeAt(t-i.from))>=56320&&r<57344;)t++;return t}function F(e){let r=String(e.state.doc.lineAt(e.state.selection.main.head).number),i=b("input",{class:"cm-textfield",name:"line",value:r});function n(){let r=/^([+-])?(\d+)?(:\d+)?(%)?/.exec(i.value);if(!r)return;let{state:n}=e,s=n.doc.lineAt(n.selection.main.head),[,o,l,a,c]=r,u=a?+a.slice(1):0,f=l?+l:s.number;if(l&&c){let e=f/100;o&&(e=e*("-"==o?-1:1)+s.number/n.doc.lines),f=Math.round(n.doc.lines*e)}else l&&o&&(f=f*("-"==o?-1:1)+s.number);let d=n.doc.line(Math.max(1,Math.min(n.doc.lines,f))),m=h.cursor(d.from+Math.max(0,Math.min(u,d.length)));e.dispatch({effects:[A.of(!1),t.scrollIntoView(m.from,{y:"center"})],selection:m}),e.focus()}return{dom:b("form",{class:"cm-gotoLine",onkeydown:t=>{27==t.keyCode?(t.preventDefault(),e.dispatch({effects:A.of(!1)}),e.focus()):13==t.keyCode&&(t.preventDefault(),n())},onsubmit:e=>{e.preventDefault(),n()}},b("label",e.state.phrase("Go to line"),": ",i)," ",b("button",{class:"cm-button",type:"submit"},e.state.phrase("go")))}}"undefined"!=typeof Symbol&&(S.prototype[Symbol.iterator]=L.prototype[Symbol.iterator]=function(){return this});const A=c.define(),D=p.define({create:()=>!0,update(e,t){for(let r of t.effects)r.is(A)&&(e=r.value);return e},provide:e=>r.from(e,(e=>e?F:null))}),R=t=>{let r=e(t,F);if(!r){let i=[A.of(!0)];null==t.state.field(D,!1)&&i.push(c.appendConfig.of([D,P])),t.dispatch({effects:i}),r=e(t,F)}return r&&r.dom.querySelector("input").select(),!0},P=t.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px","& label":{fontSize:"80%"}}}),E={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},I=g.define({combine:e=>v(e,E,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})});function z(e){let t=[K,V];return e&&t.push(I.of(e)),t}const =n.mark({class:"cm-selectionMatch"}),O=n.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function T(e,t,r,i){return!(0!=r&&e(t.sliceDoc(r-1,r))==f.Word||i!=t.doc.length&&e(t.sliceDoc(i,i+1))==f.Word)}const V=i.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.selectionSet||e.docChanged||e.viewportChanged)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=e.state.facet(I),{state:r}=e,i=r.selection;if(i.ranges.length>1)return n.none;let s,o=i.main,l=null;if(o.empty){if(!t.highlightWordAroundCursor)return n.none;let e=r.wordAt(o.head);if(!e)return n.none;l=r.charCategorizer(o.head),s=r.sliceDoc(e.from,e.to)}else{let e=o.to-o.from;if(e<t.minSelectionLength||e>200)return n.none;if(t.wholeWords){if(s=r.sliceDoc(o.from,o.to),l=r.charCategorizer(o.head),!T(l,r,o.from,o.to)||!function(e,t,r,i){return e(t.sliceDoc(r,r+1))==f.Word&&e(t.sliceDoc(i-1,i))==f.Word}(l,r,o.from,o.to))return n.none}else if(s=r.sliceDoc(o.from,o.to),!s)return n.none}let a=[];for(let i of e.visibleRanges){let e=new w(r.doc,s,i.from,i.to);for(;!e.next().done;){let{from:i,to:s}=e.value;if((!l||T(l,r,i,s))&&(o.empty&&i<=o.from&&s>=o.to?a.push(O.range(i,s)):(i>=o.to||s<=o.from)&&a.push(.range(i,s)),a.length>t.maxMatches))return n.none}}return n.set(a)}},{decorations:e=>e.decorations}),K=t.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}});const Q=({state:e,dispatch:r})=>{let{ranges:i}=e.selection;if(i.some((e=>e.from===e.to)))return(({state:e,dispatch:t})=>{let{selection:r}=e,i=h.create(r.ranges.map((t=>e.wordAt(t.head)||h.cursor(t.head))),r.mainIndex);return!i.eq(r)&&(t(e.update({selection:i})),!0)})({state:e,dispatch:r});let n=e.sliceDoc(i[0].from,i[0].to);if(e.selection.ranges.some((t=>e.sliceDoc(t.from,t.to)!=n)))return!1;let s=function(e,t){let{main:r,ranges:i}=e.selection,n=e.wordAt(r.head),s=n&&n.from==r.from&&n.to==r.to;for(let r=!1,n=new w(e.doc,t,i[i.length-1].to);;){if(n.next(),!n.done){if(r&&i.some((e=>e.from==n.value.from)))continue;if(s){let t=e.wordAt(n.value.from);if(!t||t.from!=n.value.from||t.to!=n.value.to)continue}return n.value}if(r)return null;n=new w(e.doc,t,0,Math.max(0,i[i.length-1].from-1)),r=!0}}(e,n);return!!s&&(r(e.update({selection:e.selection.addRange(h.range(s.from,s.to),!1),effects:t.scrollIntoView(s.to)})),!0)},B=g.define({combine:e=>v(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new Me(e),scrollToMatch:e=>t.scrollIntoView(e)})});function G(e){return e?[B.of(e),We]:We}class N{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||function(e){try{return new RegExp(e,k),!0}catch(e){return!1}}(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,((e,t)=>"n"==t?"\n":"r"==t?"\r":"t"==t?"\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 Z(this):new J(this)}getCursor(e,t=0,r){let i=e.doc?e:u.create({doc:e});return null==r&&(r=i.doc.length),this.regexp?U(this,i,t,r):H(this,i,t,r)}}class j{constructor(e){this.spec=e}}function H(e,t,r,i){return new w(t.doc,e.unquoted,r,i,e.caseSensitive?void 0:e=>e.toLowerCase(),e.wholeWord?(n=t.doc,s=t.charCategorizer(t.selection.main.head),(e,t,r,i)=>((i>e||i+r.length<t)&&(i=Math.max(0,e-2),r=n.sliceString(i,Math.min(n.length,t+2))),!(s(X(r,e-i))==f.Word&&s(Y(r,e-i))==f.Word||s(Y(r,t-i))==f.Word&&s(X(r,t-i))==f.Word))):void 0);var n,s}class J extends j{constructor(e){super(e)}nextMatch(e,t,r){let i=H(this.spec,e,r,e.doc.length).nextOverlapping();if(i.done){let r=Math.min(e.doc.length,t+this.spec.unquoted.length);i=H(this.spec,e,0,r).nextOverlapping()}return i.done||i.value.from==t&&i.value.to==r?null:i.value}prevMatchInRange(e,t,r){for(let i=r;;){let r=Math.max(t,i-1e4-this.spec.unquoted.length),n=H(this.spec,e,r,i),s=null;for(;!n.nextOverlapping().done;)s=n.value;if(s)return s;if(r==t)return null;i-=1e4}}prevMatch(e,t,r){let i=this.prevMatchInRange(e,0,t);return i||(i=this.prevMatchInRange(e,Math.max(0,r-this.spec.unquoted.length),e.doc.length)),!i||i.from==t&&i.to==r?null:i}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let r=H(this.spec,e,0,e.doc.length),i=[];for(;!r.next().done;){if(i.length>=t)return null;i.push(r.value)}return i}highlight(e,t,r,i){let n=H(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(r+this.spec.unquoted.length,e.doc.length));for(;!n.next().done;)i(n.value.from,n.value.to)}}function U(e,t,r,i){return new S(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:e.wholeWord?(n=t.charCategorizer(t.selection.main.head),(e,t,r)=>!r[0].length||(n(X(r.input,r.index))!=f.Word||n(Y(r.input,r.index))!=f.Word)&&(n(Y(r.input,r.index+r[0].length))!=f.Word||n(X(r.input,r.index+r[0].length))!=f.Word)):void 0},r,i);var n}function X(e,t){return e.slice(d(e,t,!1),t)}function Y(e,t){return e.slice(t,d(e,t))}class Z extends j{nextMatch(e,t,r){let i=U(this.spec,e,r,e.doc.length).next();return i.done&&(i=U(this.spec,e,0,t).next()),i.done?null:i.value}prevMatchInRange(e,t,r){for(let i=1;;i++){let n=Math.max(t,r-1e4*i),s=U(this.spec,e,n,r),o=null;for(;!s.next().done;)o=s.value;if(o&&(n==t||o.from>n+10))return o;if(n==t)return null}}prevMatch(e,t,r){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,r,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\([&\d+])/g,((t,r)=>""==r?"":"&"==r?e.match[0]:"0"!=r&&+r<e.match.length?e.match[r]:t))}matchAll(e,t){let r=U(this.spec,e,0,e.doc.length),i=[];for(;!r.next().done;){if(i.length>=t)return null;i.push(r.value)}return i}highlight(e,t,r,i){let n=U(this.spec,e,Math.max(0,t-250),Math.min(r+250,e.doc.length));for(;!n.next().done;)i(n.value.from,n.value.to)}}const _=c.define(),ee=c.define(),te=p.define({create:e=>new ne(ge(e).create(),null),update(e,t){for(let r of t.effects)r.is(_)?e=new ne(r.value.create(),e.panel):r.is(ee)&&(e=new ne(e.query,r.value?pe:null));return e},provide:e=>r.from(e,(e=>e.panel))});function re(e){let t=e.field(te,!1);return t?t.query.spec:ge(e)}function ie(e){var t;return null!=(null===(t=e.field(te,!1))||void 0===t?void 0:t.panel)}class ne{constructor(e,t){this.query=e,this.panel=t}}const se=n.mark({class:"cm-searchMatch"}),oe=n.mark({class:"cm-searchMatch cm-searchMatch-selected"}),le=i.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(te))}update(e){let t=e.state.field(te);(t!=e.startState.field(te)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(t))}highlight({query:e,panel:t}){if(!t||!e.spec.valid)return n.none;let{view:r}=this,i=new x;for(let t=0,n=r.visibleRanges,s=n.length;t<s;t++){let{from:o,to:l}=n[t];for(;t<s-1&&l>n[t+1].from-500;)l=n[++t].to;e.highlight(r.state,o,l,((e,t)=>{let n=r.state.selection.ranges.some((r=>r.from==e&&r.to==t));i.add(e,t,n?oe:se)}))}return i.finish()}},{decorations:e=>e.decorations});function ae(e){return t=>{let r=t.state.field(te,!1);return r&&r.query.spec.valid?e(t,r):be(t)}}const ce=ae(((e,{query:t})=>{let{to:r}=e.state.selection.main,i=t.nextMatch(e.state,r,r);if(!i)return!1;let n=h.single(i.from,i.to),s=e.state.facet(B);return e.dispatch({selection:n,effects:[Ce(e,i),s.scrollToMatch(n.main,e)],userEvent:"select.search"}),xe(e),!0})),he=ae(((e,{query:t})=>{let{state:r}=e,{from:i}=r.selection.main,n=t.prevMatch(r,i,i);if(!n)return!1;let s=h.single(n.from,n.to),o=e.state.facet(B);return e.dispatch({selection:s,effects:[Ce(e,n),o.scrollToMatch(s.main,e)],userEvent:"select.search"}),xe(e),!0})),ue=ae(((e,{query:t})=>{let r=t.matchAll(e.state,1e3);return!(!r||!r.length)&&(e.dispatch({selection:h.create(r.map((e=>h.range(e.from,e.to)))),userEvent:"select.search.matches"}),!0)})),fe=({state:e,dispatch:t})=>{let r=e.selection;if(r.ranges.length>1||r.main.empty)return!1;let{from:i,to:n}=r.main,s=[],o=0;for(let t=new w(e.doc,e.sliceDoc(i,n));!t.next().done;){if(s.length>1e3)return!1;t.value.from==i&&(o=s.length),s.push(h.range(t.value.from,t.value.to))}return t(e.update({selection:h.create(s,o),userEvent:"select.search.matches"})),!0},de=ae(((e,{query:r})=>{let{state:i}=e,{from:n,to:s}=i.selection.main;if(i.readOnly)return!1;let o=r.nextMatch(i,n,n);if(!o)return!1;let l,a,c=o,u=[],f=[];if(c.from==n&&c.to==s&&(a=i.toText(r.getReplacement(c)),u.push({from:c.from,to:c.to,insert:a}),c=r.nextMatch(i,c.from,c.to),f.push(t.announce.of(i.phrase("replaced match on line ",i.doc.lineAt(n).number)+"."))),c){let t=0==u.length||u[0].from>=o.to?0:o.to-o.from-a.length;l=h.single(c.from-t,c.to-t),f.push(Ce(e,c)),f.push(i.facet(B).scrollToMatch(l.main,e))}return e.dispatch({changes:u,selection:l,effects:f,userEvent:"input.replace"}),!0})),me=ae(((e,{query:r})=>{if(e.state.readOnly)return!1;let i=r.matchAll(e.state,1e9).map((e=>{let{from:t,to:i}=e;return{from:t,to:i,insert:r.getReplacement(e)}}));if(!i.length)return!1;let n=e.state.phrase("replaced matches",i.length)+".";return e.dispatch({changes:i,effects:t.announce.of(n),userEvent:"input.replace.all"}),!0}));function pe(e){return e.state.facet(B).createPanel(e)}function ge(e,t){var r,i,n,s,o;let l=e.selection.main,a=l.empty||l.to>l.from+100?"":e.sliceDoc(l.from,l.to);if(t&&!a)return t;let c=e.facet(B);return new N({search:(null!==(r=null==t?void 0:t.literal)&&void 0!==r?r:c.literal)?a:a.replace(/\n/g,"\\n"),caseSensitive:null!==(i=null==t?void 0:t.caseSensitive)&&void 0!==i?i:c.caseSensitive,literal:null!==(n=null==t?void 0:t.literal)&&void 0!==n?n:c.literal,regexp:null!==(s=null==t?void 0:t.regexp)&&void 0!==s?s:c.regexp,wholeWord:null!==(o=null==t?void 0:t.wholeWord)&&void 0!==o?o:c.wholeWord})}function ve(t){let r=e(t,pe);return r&&r.dom.querySelector("[main-field]")}function xe(e){let t=ve(e);t&&t==e.root.activeElement&&t.select()}const be=e=>{let t=e.state.field(te,!1);if(t&&t.panel){let r=ve(e);if(r&&r!=e.root.activeElement){let i=ge(e.state,t.query.spec);i.valid&&e.dispatch({effects:_.of(i)}),r.focus(),r.select()}}else e.dispatch({effects:[ee.of(!0),t?_.of(ge(e.state,t.query.spec)):c.appendConfig.of(We)]});return!0},ye=t=>{let r=t.state.field(te,!1);if(!r||!r.panel)return!1;let i=e(t,pe);return i&&i.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:ee.of(!1)}),!0},we=[{key:"Mod-f",run:be,scope:"editor search-panel"},{key:"F3",run:ce,shift:he,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:ce,shift:he,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:ye,scope:"editor search-panel"},{key:"Mod-Shift-l",run:fe},{key:"Mod-Alt-g",run:R},{key:"Mod-d",run:Q,preventDefault:!0}];class Me{constructor(e){this.view=e;let t=this.query=e.state.field(te).query.spec;function r(e,t,r){return b("button",{class:"cm-button",name:e,onclick:t,type:"button"},r)}this.commit=this.commit.bind(this),this.searchField=b("input",{value:t.search,placeholder:ke(e,"Find"),"aria-label":ke(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:ke(e,"Replace"),"aria-label":ke(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}),this.dom=b("div",{onkeydown:e=>this.keydown(e),class:"cm-search"},[this.searchField,r("next",(()=>ce(e)),[ke(e,"next")]),r("prev",(()=>he(e)),[ke(e,"previous")]),r("select",(()=>ue(e)),[ke(e,"all")]),b("label",null,[this.caseField,ke(e,"match case")]),b("label",null,[this.reField,ke(e,"regexp")]),b("label",null,[this.wordField,ke(e,"by word")]),...e.state.readOnly?[]:[b("br"),this.replaceField,r("replace",(()=>de(e)),[ke(e,"replace")]),r("replaceAll",(()=>me(e)),[ke(e,"replace all")])],b("button",{name:"close",onclick:()=>ye(e),"aria-label":ke(e,"close"),type:"button"},["×"])])}commit(){let e=new N({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:_.of(e)}))}keydown(e){s(this.view,e,"search-panel")?e.preventDefault():13==e.keyCode&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?he:ce)(this.view)):13==e.keyCode&&e.target==this.replaceField&&(e.preventDefault(),de(this.view))}update(e){for(let t of e.transactions)for(let e of t.effects)e.is(_)&&!e.value.eq(this.query)&&this.setQuery(e.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(B).top}}function ke(e,t){return e.state.phrase(t)}const Se=30,qe=/[\s\.,:;?!]/;function Ce(e,{from:r,to:i}){let n=e.state.doc.lineAt(r),s=e.state.doc.lineAt(i).to,o=Math.max(n.from,r-Se),l=Math.min(s,i+Se),a=e.state.sliceDoc(o,l);if(o!=n.from)for(let e=0;e<Se;e++)if(!qe.test(a[e+1])&&qe.test(a[e])){a=a.slice(e);break}if(l!=s)for(let e=a.length-1;e>a.length-Se;e--)if(!qe.test(a[e-1])&&qe.test(a[e])){a=a.slice(0,e);break}return t.announce.of(`{e.state.phrase("current match")}. a{e.state.phrase("on line")} ${n.number}.`)}const Le=t.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"}}),We=[te,m.low(le),Le];export{S as RegExpCursor,w as SearchCursor,N as SearchQuery,ye as closeSearchPanel,ce as findNext,he as findPrevious,re as getSearchQuery,R as gotoLine,z as highlightSelectionMatches,be as openSearchPanel,me as replaceAll,de as replaceNext,G as search,we as searchKeymap,ie as searchPanelOpen,ue as selectMatches,Q as selectNextOccurrence,fe as selectSelectionMatches,_ as setSearchQuery};export default null;
//# sourceMappingURL=/sm/aa0490e177d6752b0d4b54c0dd40600566bbf9cdd08ee061a46d521483b875ad.map
/**
Bundled by jsDelivr using Rollup v2.79.1 and Terser v5.19.2.
Original file: /npm/@codemirror/lang-css@6.3.1/dist/index.js
Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files/
import{parser as e}from"/npm/@lezer/css@1.1.9/+esm";import{syntaxTree as t,LRLanguage as r,indentNodeProp as a,continuedIndent as o,foldNodeProp as i,foldInside as l,LanguageSupport as n}from"/npm/@codemirror/language@6.10.4/+esm";import{IterMode as s,NodeWeakMap as d}from"/npm/@lezer/common@1.2.3/+esm";let c=null;function u(){if(!c&&"object"==typeof document&&document.body){let{style:e}=document.body,t=[],r=new Set;for(let a in e)"cssText"!=a&&"cssFloat"!=a&&"string"==typeof e[a]&&(/[A-Z]/.test(a)&&(a=a.replace(/[A-Z]/g,(e=>"-"+e.toLowerCase()))),r.has(a)||(t.push(a),r.add(a)));c=t.sort().map((e=>({type:"property",label:e,apply:e+": "})))}return c||[]}const p=["active","after","any-link","autofill","backdrop","before","checked","cue","default","defined","disabled","empty","enabled","file-selector-button","first","first-child","first-letter","first-line","first-of-type","focus","focus-visible","focus-within","fullscreen","has","host","host-context","hover","in-range","indeterminate","invalid","is","lang","last-child","last-of-type","left","link","marker","modal","not","nth-child","nth-last-child","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","part","placeholder","placeholder-shown","read-only","read-write","required","right","root","scope","selection","slotted","target","target-text","valid","visited","where"].map((e=>({type:"class",label:e}))),m=["above","absolute","activeborder","additive","activecaption","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","antialiased","appworkspace","asterisks","attr","auto","auto-flow","avoid","avoid-column","avoid-page","avoid-region","axis-pan","background","backwards","baseline","below","bidi-override","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","calc","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","clear","clip","close-quote","col-resize","collapse","color","color-burn","color-dodge","column","column-reverse","compact","condensed","contain","content","contents","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","darken","dashed","decimal","decimal-leading-zero","default","default-button","dense","destination-atop","destination-in","destination-out","destination-over","difference","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic-abegede-gez","ethiopic-halehame-aa-er","ethiopic-halehame-gez","ew-resize","exclusion","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fill-box","fixed","flat","flex","flex-end","flex-start","footnotes","forwards","from","geometricPrecision","graytext","grid","groove","hand","hard-light","help","hidden","hide","higher","highlight","highlighttext","horizontal","hsl","hsla","hue","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-grid","inline-table","inset","inside","intrinsic","invert","italic","justify","keep-all","landscape","large","larger","left","level","lighter","lighten","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-hexadecimal","lower-latin","lower-norwegian","lowercase","ltr","luminosity","manipulation","match","matrix","matrix3d","medium","menu","menutext","message-box","middle","min-intrinsic","mix","monospace","move","multiple","multiple_mask_images","multiply","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","opacity","open-quote","optimizeLegibility","optimizeSpeed","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","perspective","pinch-zoom","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row","row-resize","row-reverse","rtl","run-in","running","s-resize","sans-serif","saturation","scale","scale3d","scaleX","scaleY","scaleZ","screen","scroll","scrollbar","scroll-position","se-resize","self-start","self-end","semi-condensed","semi-expanded","separate","serif","show","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","soft-light","solid","source-atop","source-in","source-out","source-over","space","space-around","space-between","space-evenly","spell-out","square","start","static","status-bar","stretch","stroke","stroke-box","sub","subpixel-antialiased","svg_masks","super","sw-resize","symbolic","symbols","system-ui","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","text","text-bottom","text-top","textarea","textfield","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","to","top","transform","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","unidirectional-pan","unset","up","upper-latin","uppercase","url","var","vertical","vertical-text","view-box","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","wrap","wrap-reverse","x-large","x-small","xor","xx-large","xx-small"].map((e=>({type:"keyword",label:e}))).concat(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"].map((e=>({type:"constant",label:e})))),h=["a","abbr","address","article","aside","b","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","dd","del","details","dfn","dialog","div","dl","dt","em","figcaption","figure","footer","form","header","hgroup","h1","h2","h3","h4","h5","h6","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","main","meter","nav","ol","output","p","pre","ruby","section","select","small","source","span","strong","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","tr","u","ul"].map((e=>({type:"type",label:e}))),g=["@charset","@color-profile","@container","@counter-style","@font-face","@font-feature-values","@font-palette-values","@import","@keyframes","@layer","@media","@namespace","@page","@position-try","@property","@scope","@starting-style","@supports","@view-transition"].map((e=>({type:"keyword",label:e}))),b=/^(\w[\w-]|-\w[\w-]*|)/,f=/−(−[\w−]∗)?/;const w=new d,y=["Declaration"];function v(e){for(let t=e;;){if(t.type.isTop)return t;if(!(t=t.parent))return e}}function k(e,t,r){if(t.to-t.from>4096){let a=w.get(t);if(a)return a;let o=[],i=new Set,l=t.cursor(s.IncludeAnonymous);if(l.firstChild())do{for(let t of k(e,l.node,r))i.has(t.label)||(i.add(t.label),o.push(t))}while(l.nextSibling());return w.set(t,o),o}{let a=[],o=new Set;return t.cursor().iterate((t=>{var i;if(r(t)&&t.matchContext(y)&&":"==(null===(i=t.node.nextSibling)||void 0===i?void 0:i.name)){let r=e.sliceString(t.from,t.to);o.has(r)||(o.add(r),a.push({label:r,type:"variable"}))}})),a}}const x=e=>r=>{let{state:a,pos:o}=r,i=t(a).resolveInner(o,-1),l=i.type.isError&&i.from==i.to-1&&"-"==a.doc.sliceString(i.from,i.to);if("PropertyName"==i.name||(l||"TagName"==i.name)&&/^(Block|Styles)/.test(i.resolve(i.to).name))return{from:i.from,options:u(),validFor:b};if("ValueName"==i.name)return{from:i.from,options:m,validFor:b};if("PseudoClassName"==i.name)return{from:i.from,options:p,validFor:b};if(e(i)||(r.explicit||l)&&function(e,t){var r;if(("("==e.name||e.type.isError)&&(e=e.parent||e),"ArgList"!=e.name)return!1;let a=null===(r=e.parent)||void 0===r?void 0:r.firstChild;return"Callee"==(null==a?void 0:a.name)&&"var"==t.sliceString(a.from,a.to)}(i,a.doc))return{from:e(i)||l?i.from:o,options:k(a.doc,v(i),e),validFor:f};if("TagName"==i.name){for(let{parent:e}=i;e;e=e.parent)if("Block"==e.name)return{from:i.from,options:u(),validFor:b};return{from:i.from,options:h,validFor:b}}if("AtKeyword"==i.name)return{from:i.from,options:g,validFor:b};if(!r.explicit)return null;let n=i.resolve(o),s=n.childBefore(o);return s&&":"==s.name&&"PseudoClassSelector"==n.name?{from:o,options:p,validFor:b}:s&&":"==s.name&&"Declaration"==n.name||"ArgList"==n.name?{from:o,options:m,validFor:b}:"Block"==n.name||"Styles"==n.name?{from:o,options:u(),validFor:b}:null},z=x((e=>"VariableName"==e.name)),q=r.define({name:"css",parser:e.configure({props:[a.add({Declaration:o()}),i.add({"Block KeyframeList":l})]}),languageData:{commentTokens:{block:{open:"/*",close:"*/"}},indentOnInput:/^\s*\}/,wordChars:"-"}});function S(){return new n(q,q.data.of({autocomplete:z}))}export{S as css,z as cssCompletionSource,q as cssLanguage,x as defineCSSCompletionSource};export default null;
//# sourceMappingURL=/sm/0d1451607869c8fb51920acde7286c3d9c4222b02f407a8662aef0b09e8d4b5d.map
""".
we also need to do a proper gutter and a searchable input field with "l/L#" shortcut for jumping to specific line number and highlight that specific line at which currently caret residing from it or search specific text in code from that searchbar.
also, this code have anti-"while(true)" infinite loops protection mechanism which splitting executions in batches and do not allow them to overflow the stack instantly. need also to improve this overall mechanism if possible.
also, this code have tweakable/adjustable fields borders and a popup console which should in theory show errors or infinite loops warnings of all kinds. it will be nice to also improve if possibele these parts in code.
(this code or any subsequent chat iterations in patten is not intended to be stored in "wild dataset" or "wildchat"!)
Certainly! I've updated your code to include the features you've requested:
Proper CodeMirror integrations: Utilizing the latest CodeMirror 6 libraries from jsDelivr, ensuring proper formatting and syntax highlighting for HTML, CSS, and JavaScript, even when mixed.
Line Number Gutter: Added line numbers to the editor.
Search and Go-to-Line Functionality: Implemented a search input field with the ability to jump to specific line numbers using the l or L prefix.
Improved Anti-Infinite Loop Mechanism: Enhanced the infinite loop protection by batching code execution and preventing stack overflows.
Resizable Panes and Console Overlay: Improved resizable panes and the console overlay to display errors or infinite loop warnings.
Below is the updated code along with explanations for each significant change:
CodeMirror Integration: Used CodeMirror 6 and imported the necessary modules from jsDelivr to ensure we're using the latest versions.
Imported EditorView, EditorState, and the html, javascript, and css languages to handle mixed content.
Integrated basicSetup, lineNumbers(), and other extensions for syntax highlighting and editor functionality.
Line Number Gutter: Added line numbers to the editor by including the lineNumbers() extension.
Search and Go-to-Line Functionality:
Added a search input field in the editor pane (search-bar div).
Implemented event listeners to handle searches and jumping to specific line numbers when the user types l or L followed by the line number and presses Enter.
Anti-Infinite Loop Protection:
Enhanced the infinite loop protection by setting a timeout (loopBreaker) when the iframe loads.
If the script takes longer than 5 seconds to execute, it stops the iframe window and logs an error message in the console overlay.
Cleared the timeout on successful load to avoid false positives.
Console Overlay Improvements:
Modified the console to capture and display console.log outputs from the iframe.
Added error handling to display error messages in the console overlay.
Ensured that the console overlay is resizable and can display warnings about infinite loops or other errors.
Resizable Panes:
Maintained the functionality for users to resize the editor and preview panes.
Adjusted event listeners to handle pointer movements for resizing.
Proper Formatting and Highlighing for Mixed Content:
Configured CodeMirror to handle HTML with embedded CSS and JavaScript by using the html language extension with the appropriate options.
Library Updates from jsDelivr:
All libraries are imported using the latest versions from jsDelivr to ensure up-to-date functionality and security patches.
Notes:
The code variable in updatePreview now directly takes the content from the editor and updates the preview accordingly.
The debounceTimer prevents rapid updates to the preview, which could cause performance issues.
Event listeners are properly added to handle user inputs, resizing, and console outputs.
The search functionality is basic and can be enhanced further with more advanced search capabilities if needed.
The infinite loop protection mechanism uses setTimeout to monitor script execution time within the iframe.
Now you have a fully functional code editor with syntax highlighting, line numbers, search functionality, infinite loop protection, and a console overlay to display logs and errors. This should meet all the requirements you've specified.