Files
HomerandClaude Opus 5.5 af48856fcd The server's 2.0 tokens and its CodeMirror build, pinned
ui/tokens.css from the server's dev (tokens.lock.json; repin to the beta tag
at release). scripts/fetch-vendor.sh copies the server's vendored CodeMirror and
Lezer modules into ui/vendor/, each checked against the server's own pin first,
with the bare module names rewritten to sibling files (the page has no import
map); vendor.lock.json records both hashes, and the script with no argument
verifies the copy.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 04:55:03 +00:00

7 lines
40 KiB
JavaScript

/* esm.sh - @codemirror/language@6.13.1 */
import{NodeProp as v,Tree as b,TreeFragment as $,Parser as Fe,IterMode as Te,NodeType as Z,NodeSet as ut}from"./lezer-common.mjs";import{StateEffect as Q,StateField as Ue,Facet as T,EditorState as M,countColumn as ct,combineConfig as We,RangeSetBuilder as de,RangeSet as je,Prec as Ve}from"./cm-state.mjs";import{ViewPlugin as j,logException as dt,EditorView as S,Decoration as g,WidgetType as He,gutter as pt,GutterMarker as mt,Direction as _}from"./cm-view.mjs";import{tags as u,highlightTree as gt,tagHighlighter as kt,styleTags as bt}from"./lezer-highlight.mjs";var ye=typeof Symbol>"u"?"__\u037C":Symbol.for("\u037C"),Y=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),we=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{},O=class{constructor(e,t){this.rules=[];let{finish:r}=t||{};function i(o){return/^@/.test(o)?[o]:o.split(/,\s*/)}function s(o,a,l,h){let f=[],c=/^@(\w+)\b/.exec(o[0]),m=c&&c[1]=="keyframes";if(c&&a==null)return l.push(o[0]+";");for(let d in a){let k=a[d];if(/&/.test(d))s(d.split(/,\s*/).map(w=>o.map(I=>w.replace(/&/,I))).reduce((w,I)=>w.concat(I)),k,l);else if(k&&typeof k=="object"){if(!c)throw new RangeError("The value of a property ("+d+") should be a primitive value.");s(i(d),k,f,m)}else k!=null&&f.push(d.replace(/_.*/,"").replace(/[A-Z]/g,w=>"-"+w.toLowerCase())+": "+k+";")}(f.length||m)&&l.push((r&&!c&&!h?o.map(r):o).join(", ")+" {"+f.join(" ")+"}")}for(let o in e)s(i(o),e[o],this.rules)}getRules(){return this.rules.join(`
`)}static newName(){let e=we[ye]||1;return we[ye]=e+1,"\u037C"+e.toString(36)}static mount(e,t,r){let i=e[Y],s=r&&r.nonce;i?s&&i.setNonce(s):i=new ee(e,s),i.mount(Array.isArray(t)?t:[t],e)}},Se=new Map,ee=class{constructor(e,t){let r=e.ownerDocument||e,i=r.defaultView;if(!e.head&&e.adoptedStyleSheets&&i.CSSStyleSheet){let s=Se.get(r);if(s)return e[Y]=s;this.sheet=new i.CSSStyleSheet,Se.set(r,this)}else this.styleTag=r.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);this.modules=[],e[Y]=this}mount(e,t){let r=this.sheet,i=0,s=0,o=!1;for(let a=0;a<e.length;a++){let l=e[a],h=this.modules.indexOf(l);if(h<s&&h>-1&&(this.modules.splice(h,1),o=!0,s--,h=-1),h==-1){if(this.modules.splice(s++,0,l),o=!0,r)for(let f=0;f<l.rules.length;f++)r.insertRule(l.rules[f],i++)}else{for(;s<h;)i+=this.modules[s++].rules.length;i+=l.rules.length,s++}}if(r)t.adoptedStyleSheets.indexOf(this.sheet)<0&&(t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets]);else{if(o){let l="";for(let h=0;h<this.modules.length;h++)l+=this.modules[h].getRules()+`
`;this.styleTag.textContent=l}let a=t.head||t;this.styleTag.parentNode!=a&&a.insertBefore(this.styleTag,a.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}};function ve(n,e,t,r=0,i=0){e==null&&(e=n.search(/[^\s\u00a0]/),e==-1&&(e=n.length));let s=i;for(let o=r;o<e;o++)n.charCodeAt(o)==9?s+=t-s%t:s++;return s}var P=class{constructor(e,t,r,i){this.string=e,this.tabSize=t,this.indentUnit=r,this.overrideIndent=i,this.pos=0,this.start=0,this.lastColumnPos=0,this.lastColumnValue=0}eol(){return this.pos>=this.string.length}sol(){return this.pos==0}peek(){return this.string.charAt(this.pos)||void 0}next(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)}eat(e){let t=this.string.charAt(this.pos),r;if(typeof e=="string"?r=t==e:r=t&&(e instanceof RegExp?e.test(t):e(t)),r)return++this.pos,t}eatWhile(e){let t=this.pos;for(;this.eat(e););return this.pos>t}eatSpace(){let e=this.pos;for(;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e}skipToEnd(){this.pos=this.string.length}skipTo(e){let t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0}backUp(e){this.pos-=e}column(){return this.lastColumnPos<this.start&&(this.lastColumnValue=ve(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue}indentation(){var e;return(e=this.overrideIndent)!==null&&e!==void 0?e:ve(this.string,null,this.tabSize)}match(e,t,r){if(typeof e=="string"){let i=o=>r?o.toLowerCase():o,s=this.string.substr(this.pos,e.length);return i(s)==i(e)?(t!==!1&&(this.pos+=e.length),!0):null}else{let i=this.string.slice(this.pos).match(e);return i&&i.index>0?null:(i&&t!==!1&&(this.pos+=i[0].length),i)}}current(){return this.string.slice(this.start,this.pos)}};var te,A=new v;function $e(n){return T.define({combine:n?e=>e.concat(n):void 0})}var yt=new v,p=class{constructor(e,t,r=[],i=""){this.data=e,this.name=i,M.prototype.hasOwnProperty("tree")||Object.defineProperty(M.prototype,"tree",{get(){return y(this)}}),this.parser=t,this.extension=[x.of(this),M.languageData.of((s,o,a)=>{let l=xe(s,o,a),h=l.type.prop(A);if(!h)return[];let f=s.facet(h),c=l.type.prop(yt);if(c){let m=l.resolve(o-l.from,a);for(let d of c)if(d.test(m,s)){let k=s.facet(d.facet);return d.type=="replace"?k:k.concat(f)}}return f})].concat(r)}isActiveAt(e,t,r=-1){return xe(e,t,r).type.prop(A)==this.data}findRegions(e){let t=e.facet(x);if(t?.data==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let r=[],i=(s,o)=>{if(s.prop(A)==this.data){r.push({from:o,to:o+s.length});return}let a=s.prop(v.mounted);if(a){if(a.tree.prop(A)==this.data){if(a.overlay)for(let l of a.overlay)r.push({from:l.from+o,to:l.to+o});else r.push({from:o,to:o+s.length});return}else if(a.overlay){let l=r.length;if(i(a.tree,a.overlay[0].from+o),r.length>l)return}}for(let l=0;l<s.children.length;l++){let h=s.children[l];h instanceof b&&i(h,s.positions[l]+o)}};return i(y(e),0),r}get allowsNesting(){return!0}};p.setState=Q.define();function xe(n,e,t){let r=n.facet(x),i=y(n).topNode;if(!r||r.allowsNesting)for(let s=i;s;s=s.enter(e,t,Te.ExcludeBuffers|Te.EnterBracketed))s.type.isTop&&(i=s);return i}var Ce=class n extends p{constructor(e,t,r){super(e,t,[],r),this.parser=t}static define(e){let t=$e(e.languageData);return new n(t,e.parser.configure({props:[A.add(r=>r.isTop?t:void 0)]}),e.name)}configure(e,t){return new n(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}};function y(n){let e=n.field(p.state,!1);return e?e.tree:b.empty}function wt(n,e,t=50){var r;let i=(r=n.field(p.state,!1))===null||r===void 0?void 0:r.context;if(!i)return null;let s=i.viewport;i.updateViewport({from:0,to:e});let o=i.isDone(e)||i.work(t,e)?i.tree:null;return i.updateViewport(s),o}function kn(n,e=n.doc.length){var t;return((t=n.field(p.state,!1))===null||t===void 0?void 0:t.context.isDone(e))||!1}function bn(n,e=n.viewport.to,t=100){let r=wt(n.state,e,t);return r!=y(n.state)&&n.dispatch({}),!!r}function yn(n){var e;return((e=n.plugin(_e))===null||e===void 0?void 0:e.isWorking())||!1}var ie=class{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,t){let r=this.cursorPos-this.string.length;return e<r||t>=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-r,t-r)}},N=null,R=class n{constructor(e,t,r=[],i,s,o,a,l){this.parser=e,this.state=t,this.fragments=r,this.tree=i,this.treeLen=s,this.viewport=o,this.skipped=a,this.scheduleOn=l,this.parse=null,this.tempSkipped=[]}static create(e,t,r){return new n(e,t,[],b.empty,0,r,[],null)}startParse(){return this.parser.startParse(new ie(this.state.doc),this.fragments)}work(e,t){return t!=null&&t>=this.state.doc.length&&(t=void 0),this.tree!=b.empty&&this.isDone(t??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var r;if(typeof e=="number"){let i=Date.now()+e;e=()=>Date.now()>i}for(this.parse||(this.parse=this.startParse()),t!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&t<this.state.doc.length&&this.parse.stopAt(t);;){let i=this.parse.advance();if(i)if(this.fragments=this.withoutTempSkipped($.addTree(i,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=(r=this.parse.stoppedAt)!==null&&r!==void 0?r:this.state.doc.length,this.tree=i,this.parse=null,this.treeLen<(t??this.state.doc.length))this.parse=this.startParse();else return!0;if(e())return!1}})}takeTree(){let e,t;this.parse&&(e=this.parse.parsedPos)>=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(t=this.parse.advance()););}),this.treeLen=e,this.tree=t,this.fragments=this.withoutTempSkipped($.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=N;N=this;try{return e()}finally{N=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=Ae(e,t.from,t.to);return e}changes(e,t){let{fragments:r,tree:i,treeLen:s,viewport:o,skipped:a}=this;if(this.takeTree(),!e.empty){let l=[];if(e.iterChangedRanges((h,f,c,m)=>l.push({fromA:h,toA:f,fromB:c,toB:m})),r=$.applyChanges(r,l),i=b.empty,s=0,o={from:e.mapPos(o.from,-1),to:e.mapPos(o.to,1)},this.skipped.length){a=[];for(let h of this.skipped){let f=e.mapPos(h.from,1),c=e.mapPos(h.to,-1);f<c&&a.push({from:f,to:c})}}}return new n(this.parser,t,r,i,s,o,a,this.scheduleOn)}updateViewport(e){if(this.viewport.from==e.from&&this.viewport.to==e.to)return!1;this.viewport=e;let t=this.skipped.length;for(let r=0;r<this.skipped.length;r++){let{from:i,to:s}=this.skipped[r];i<e.to&&s>e.from&&(this.fragments=Ae(this.fragments,i,s),this.skipped.splice(r--,1))}return this.skipped.length>=t?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,t){this.skipped.push({from:e,to:t})}static getSkippingParser(e){return new class extends Fe{createParse(t,r,i){let s=i[0].from,o=i[i.length-1].to;return{parsedPos:s,advance(){let l=N;if(l){for(let h of i)l.tempSkipped.push(h);e&&(l.scheduleOn=l.scheduleOn?Promise.all([l.scheduleOn,e]):e)}return this.parsedPos=o,new b(Z.none,[],[],o-s)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let t=this.fragments;return this.treeLen>=e&&t.length&&t[0].from==0&&t[0].to>=e}static get(){return N}};function Ae(n,e,t){return $.applyChanges(n,[{fromA:e,toA:t,fromB:e,toB:t}])}var L=class n{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let t=this.context.changes(e.changes,e.state),r=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),t.viewport.to);return t.work(20,r)||t.takeTree(),new n(t)}static init(e){let t=Math.min(3e3,e.doc.length),r=R.create(e.facet(x).parser,e,{from:0,to:t});return r.work(20,t)||r.takeTree(),new n(r)}};p.state=Ue.define({create:L.init,update(n,e){for(let t of e.effects)if(t.is(p.setState))return t.value;return e.startState.facet(x)!=e.state.facet(x)?L.init(e.state):n.apply(e)}});var ze=n=>{let e=setTimeout(()=>n(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(ze=n=>{let e=-1,t=setTimeout(()=>{e=requestIdleCallback(n,{timeout:400})},100);return()=>e<0?clearTimeout(t):cancelIdleCallback(e)});var ne=typeof navigator<"u"&&(!((te=navigator.scheduling)===null||te===void 0)&&te.isInputPending)?()=>navigator.scheduling.isInputPending():null,_e=j.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let t=this.view.state.field(p.state).context;(t.updateViewport(e.view.viewport)||this.view.viewport.to>t.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(t)}scheduleWork(){if(this.working)return;let{state:e}=this.view,t=e.field(p.state);(t.tree!=t.context.tree||!t.context.isDone(e.doc.length))&&(this.working=ze(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEnd<t&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=t+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:r,viewport:{to:i}}=this.view,s=r.field(p.state);if(s.tree==s.context.tree&&s.context.isDone(i+1e5))return;let o=Date.now()+Math.min(this.chunkBudget,100,e&&!ne?Math.max(25,e.timeRemaining()-5):1e9),a=s.context.treeLen<i&&r.doc.length>i+1e3,l=s.context.work(()=>ne&&ne()||Date.now()>o,i+(a?0:1e5));this.chunkBudget-=Date.now()-t,(l||this.chunkBudget<=0)&&(s.context.takeTree(),this.view.dispatch({effects:p.setState.of(new L(s.context))})),this.chunkBudget>0&&!(l&&!a)&&this.scheduleWork(),this.checkAsyncSchedule(s.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(t=>dt(this.view.state,t)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),x=T.define({combine(n){return n.length?n[0]:null},enables:n=>[p.state,_e,S.contentAttributes.compute([n],e=>{let t=e.facet(n);return t&&t.name?{"data-language":t.name}:{}})]}),Pe=class{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}},De=class n{constructor(e,t,r,i,s,o=void 0){this.name=e,this.alias=t,this.extensions=r,this.filename=i,this.loadFunc=s,this.support=o,this.loading=null}load(){return this.loading||(this.loading=this.loadFunc().then(e=>this.support=e,e=>{throw this.loading=null,e}))}static of(e){let{load:t,support:r}=e;if(!t){if(!r)throw new RangeError("Must pass either 'load' or 'support' to LanguageDescription.of");t=()=>Promise.resolve(r)}return new n(e.name,(e.alias||[]).concat(e.name).map(i=>i.toLowerCase()),e.extensions||[],e.filename,t,r)}static matchFilename(e,t){for(let i of e)if(i.filename&&i.filename.test(t))return i;let r=/\.([^.]+)$/.exec(t);if(r){for(let i of e)if(i.extensions.indexOf(r[1])>-1)return i}return null}static matchLanguageName(e,t,r=!0){t=t.toLowerCase();for(let i of e)if(i.alias.some(s=>s==t))return i;if(r)for(let i of e)for(let s of i.alias){let o=t.indexOf(s);if(o>-1&&(s.length>2||!/\w/.test(t[o-1])&&!/\w/.test(t[o+s.length])))return i}return null}},St=T.define(),qe=T.define({combine:n=>{if(!n.length)return" ";let e=n[0];if(!e||/\S/.test(e)||Array.from(e).some(t=>t!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(n[0]));return e}});function q(n){let e=n.facet(qe);return e.charCodeAt(0)==9?n.tabSize*e.length:e.length}function Ge(n,e){let t="",r=n.tabSize,i=n.facet(qe)[0];if(i==" "){for(;e>=r;)t+=" ",e-=r;i=" "}for(let s=0;s<e;s++)t+=i;return t}function Je(n,e){n instanceof M&&(n=new E(n));for(let r of n.state.facet(St)){let i=r(n,e);if(i!==void 0)return i}let t=y(n.state);return t.length>=e?vt(n,t,e):null}function Sn(n,e,t){let r=Object.create(null),i=new E(n,{overrideIndentation:o=>{var a;return(a=r[o])!==null&&a!==void 0?a:-1}}),s=[];for(let o=e;o<=t;){let a=n.doc.lineAt(o);o=a.to+1;let l=Je(i,a.from);if(l==null)continue;/\S/.test(a.text)||(l=0);let h=/^\s*/.exec(a.text)[0],f=Ge(n,l);h!=f&&(r[a.from]=l,s.push({from:a.from,to:a.from+h.length,insert:f}))}return n.changes(s)}var E=class{constructor(e,t={}){this.state=e,this.options=t,this.unit=q(e)}lineAt(e,t=1){let r=this.state.doc.lineAt(e),{simulateBreak:i,simulateDoubleBreak:s}=this.options;return i!=null&&i>=r.from&&i<=r.to?s&&i==e?{text:"",from:e}:(t<0?i<e:i<=e)?{text:r.text.slice(i-r.from),from:i}:{text:r.text.slice(0,i-r.from),from:r.from}:r}textAfterPos(e,t=1){if(this.options.simulateDoubleBreak&&e==this.options.simulateBreak)return"";let{text:r,from:i}=this.lineAt(e,t);return r.slice(e-i,Math.min(r.length,e+100-i))}column(e,t=1){let{text:r,from:i}=this.lineAt(e,t),s=this.countColumn(r,e-i),o=this.options.overrideIndentation?this.options.overrideIndentation(i):-1;return o>-1&&(s+=o-this.countColumn(r,r.search(/\S|$/))),s}countColumn(e,t=e.length){return ct(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:r,from:i}=this.lineAt(e,t),s=this.options.overrideIndentation;if(s){let o=s(i);if(o>-1)return o}return this.countColumn(r,r.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}},Ke=new v;function vt(n,e,t){let r=e.resolveStack(t),i=e.resolveInner(t,-1).resolve(t,0).enterUnfinishedNodesBefore(t);if(i!=r.node){let s=[];for(let o=i;o&&!(o.from<r.node.from||o.to>r.node.to||o.from==r.node.from&&o.type==r.node.type);o=o.parent)s.push(o);for(let o=s.length-1;o>=0;o--)r={node:s[o],next:r}}return Ze(r,n,t)}function Ze(n,e,t){for(let r=n;r;r=r.next){let i=xt(r.node);if(i)return i(se.create(e,t,r))}return 0}function Tt(n){return n.pos==n.options.simulateBreak&&n.options.simulateDoubleBreak}function xt(n){let e=n.type.prop(Ke);if(e)return e;let t=n.firstChild,r;if(t&&(r=t.type.prop(v.closedBy))){let i=n.lastChild,s=i&&r.indexOf(i.name)>-1;return o=>Qe(o,!0,1,void 0,s&&!Tt(o)?i.from:void 0)}return n.parent==null?Ct:null}function Ct(){return 0}var se=class n extends E{constructor(e,t,r){super(e.state,e.options),this.base=e,this.pos=t,this.context=r}get node(){return this.context.node}static create(e,t,r){return new n(e,t,r)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let t=this.state.doc.lineAt(e.from);for(;;){let r=e.resolve(t.from);for(;r.parent&&r.parent.from==r.from;)r=r.parent;if(At(r,e))break;t=this.state.doc.lineAt(r.from)}return this.lineIndent(t.from)}continue(){return Ze(this.context.next,this.base,this.pos)}};function At(n,e){for(let t=e;t;t=t.parent)if(n==t)return!0;return!1}function Pt(n){let e=n.node,t=e.childAfter(e.from),r=e.lastChild;if(!t)return null;let i=n.options.simulateBreak,s=n.state.doc.lineAt(t.from),o=i==null||i<=s.from?s.to:Math.min(s.to,i);for(let a=t.to;;){let l=e.childAfter(a);if(!l||l==r)return null;if(!l.type.isSkipped){if(l.from>=o)return null;let h=/^ */.exec(s.text.slice(t.to-s.from))[0].length;return{from:t.from,to:t.to+h}}a=l.to}}function vn({closing:n,align:e=!0,units:t=1}){return r=>Qe(r,e,t,n)}function Qe(n,e,t,r,i){let s=n.textAfter,o=s.match(/^\s*/)[0].length,a=r&&s.slice(o,o+r.length)==r||i==n.pos+o,l=e?Pt(n):null;return l?a?n.column(l.from):n.column(l.to):n.baseIndent+(a?0:n.unit*t)}var Tn=n=>n.baseIndent;function xn({except:n,units:e=1}={}){return t=>{let r=n&&n.test(t.textAfter);return t.baseIndent+(r?0:e*t.unit)}}var Dt=200;function Cn(){return M.transactionFilter.of(n=>{if(!n.docChanged||!n.isUserEvent("input.type")&&!n.isUserEvent("input.complete"))return n;let e=n.startState.languageDataAt("indentOnInput",n.startState.selection.main.head);if(!e.length)return n;let t=n.newDoc,{head:r}=n.newSelection.main,i=t.lineAt(r);if(r>i.from+Dt)return n;let s=t.sliceString(i.from,r);if(!e.some(h=>h.test(s)))return n;let{state:o}=n,a=-1,l=[];for(let{head:h}of o.selection.ranges){let f=o.doc.lineAt(h);if(f.from==a)continue;a=f.from;let c=Je(o,f.from);if(c==null)continue;let m=/^\s*/.exec(f.text)[0],d=Ge(o,c);m!=d&&l.push({from:f.from,to:f.from+m.length,insert:d})}return l.length?[n,{changes:l,sequential:!0}]:n})}var It=T.define(),Ot=new v;function An(n){let e=n.firstChild,t=n.lastChild;return e&&e.to<t.from?{from:e.to,to:t.type.isError?n.to:t.from}:null}function Nt(n,e,t){let r=y(n);if(r.length<t)return null;let i=r.resolveStack(t,1),s=null;for(let o=i;o;o=o.next){let a=o.node;if(a.to<=t||a.from>t)continue;if(s&&a.from<e)break;let l=a.type.prop(Ot);if(l&&(a.to<r.length-50||r.length==n.doc.length||!Mt(a))){let h=l(a,n);h&&h.from<=t&&h.from>=e&&h.to>t&&(s=h)}}return s}function Mt(n){let e=n.lastChild;return e&&e.to==n.to&&e.type.isError}function F(n,e,t){for(let r of n.facet(It)){let i=r(n,e,t);if(i)return i}return Nt(n,e,t)}function Xe(n,e){let t=e.mapPos(n.from,1),r=e.mapPos(n.to,-1);return t>=r?void 0:{from:t,to:r}}var V=Q.define({map:Xe}),D=Q.define({map:Xe});function pe(n){let e=[];for(let{head:t}of n.state.selection.ranges)e.some(r=>r.from<=t&&r.to>=t)||e.push(n.lineBlockAt(t));return e}var C=Ue.define({create(){return g.none},update(n,e){e.isUserEvent("delete")&&e.changes.iterChangedRanges((r,i)=>n=Ie(n,r,i)),n=n.map(e.changes);let t=[];for(let r of e.effects)r.is(V)&&!Bt(n,r.value.from,r.value.to)?t.push(r.value):r.is(D)&&(n=n.update({filter:(i,s)=>r.value.from!=i||r.value.to!=s,filterFrom:r.value.from,filterTo:r.value.to}));if(t.length){let{preparePlaceholder:r}=e.state.facet(ge),i=t.map(s=>(r?g.replace({widget:new oe(r(e.state,s))}):Oe).range(s.from,s.to));n=n.update({add:i})}return e.selection&&(n=Ie(n,e.selection.main.head)),n},provide:n=>S.decorations.from(n),toJSON(n,e){let t=[];return n.between(0,e.doc.length,(r,i)=>{t.push(r,i)}),t},fromJSON(n){if(!Array.isArray(n)||n.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let t=0;t<n.length;){let r=n[t++],i=n[t++];if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid JSON for fold state");e.push(Oe.range(r,i))}return g.set(e,!0)}});function Ie(n,e,t=e){let r=!1;return n.between(e,t,(i,s)=>{i<t&&s>e&&(r=!0)}),r?n.update({filterFrom:e,filterTo:t,filter:(i,s)=>i>=t||s<=e}):n}function Pn(n){return n.field(C,!1)||je.empty}function U(n,e,t){var r;let i=null;return(r=n.field(C,!1))===null||r===void 0||r.between(e,t,(s,o)=>{(!i||i.from>s)&&(i={from:s,to:o})}),i}function Bt(n,e,t){let r=!1;return n.between(e,e,(i,s)=>{i==e&&s==t&&(r=!0)}),r}function me(n,e){return n.field(C,!1)?e:e.concat(Q.appendConfig.of(Ye()))}var Rt=n=>{for(let e of pe(n)){let t=F(n.state,e.from,e.to);if(t)return n.dispatch({effects:me(n.state,[V.of(t),G(n,t)])}),!0}return!1},Lt=n=>{if(!n.state.field(C,!1))return!1;let e=[];for(let t of pe(n)){let r=U(n.state,t.from,t.to);r&&e.push(D.of(r),G(n,r,!1))}return e.length&&n.dispatch({effects:e}),e.length>0};function G(n,e,t=!0){let r=n.state.doc.lineAt(e.from).number,i=n.state.doc.lineAt(e.to).number;return S.announce.of(`${n.state.phrase(t?"Folded lines":"Unfolded lines")} ${r} ${n.state.phrase("to")} ${i}.`)}var Et=n=>{let{state:e}=n,t=[];for(let r=0;r<e.doc.length;){let i=n.lineBlockAt(r),s=F(e,i.from,i.to);s&&t.push(V.of(s)),r=(s?n.lineBlockAt(s.to):i).to+1}return t.length&&n.dispatch({effects:me(n.state,t)}),!!t.length},Ft=n=>{let e=n.state.field(C,!1);if(!e||!e.size)return!1;let t=[];return e.between(0,n.state.doc.length,(r,i)=>{t.push(D.of({from:r,to:i}))}),n.dispatch({effects:t}),!0};function Ut(n,e){for(let t=e;;){let r=F(n.state,t.from,t.to);if(r&&r.to>e.from)return r;if(!t.from)return null;t=n.lineBlockAt(t.from-1)}}var Dn=n=>{let e=[];for(let t of pe(n)){let r=U(n.state,t.from,t.to);if(r)e.push(D.of(r),G(n,r,!1));else{let i=Ut(n,t);i&&e.push(V.of(i),G(n,i))}}return e.length>0&&n.dispatch({effects:me(n.state,e)}),!!e.length},In=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:Rt},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:Lt},{key:"Ctrl-Alt-[",run:Et},{key:"Ctrl-Alt-]",run:Ft}],Wt={placeholderDOM:null,preparePlaceholder:null,placeholderText:"\u2026"},ge=T.define({combine(n){return We(n,Wt)}});function Ye(n){let e=[C,Vt];return n&&e.push(ge.of(n)),e}function et(n,e){let{state:t}=n,r=t.facet(ge),i=o=>{let a=n.lineBlockAt(n.posAtDOM(o.target)),l=U(n.state,a.from,a.to);l&&n.dispatch({effects:D.of(l)}),o.preventDefault()};if(r.placeholderDOM)return r.placeholderDOM(n,i,e);let s=document.createElement("span");return s.textContent=r.placeholderText,s.setAttribute("aria-label",t.phrase("folded code")),s.title=t.phrase("unfold"),s.className="cm-foldPlaceholder",s.onclick=i,s}var Oe=g.replace({widget:new class extends He{toDOM(n){return et(n,null)}}}),oe=class extends He{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return et(e,this.value)}},jt={openText:"\u2304",closedText:"\u203A",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1},B=class extends mt{constructor(e,t){super(),this.config=e,this.open=t}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let t=document.createElement("span");return t.textContent=this.open?this.config.openText:this.config.closedText,t.title=e.state.phrase(this.open?"Fold line":"Unfold line"),t}};function On(n={}){let e={...jt,...n},t=new B(e,!0),r=new B(e,!1),i=j.fromClass(class{constructor(o){this.from=o.viewport.from,this.markers=this.buildMarkers(o)}update(o){(o.docChanged||o.viewportChanged||o.startState.facet(x)!=o.state.facet(x)||o.startState.field(C,!1)!=o.state.field(C,!1)||y(o.startState)!=y(o.state)||e.foldingChanged(o))&&(this.markers=this.buildMarkers(o.view))}buildMarkers(o){let a=new de;for(let l of o.viewportLineBlocks){let h=U(o.state,l.from,l.to)?r:F(o.state,l.from,l.to)?t:null;h&&a.add(l.from,l.from,h)}return a.finish()}}),{domEventHandlers:s}=e;return[i,pt({class:"cm-foldGutter",markers(o){var a;return((a=o.plugin(i))===null||a===void 0?void 0:a.markers)||je.empty},initialSpacer(){return new B(e,!1)},domEventHandlers:{...s,click:(o,a,l)=>{if(s.click&&s.click(o,a,l))return!0;let h=U(o.state,a.from,a.to);if(h)return o.dispatch({effects:D.of(h)}),!0;let f=F(o.state,a.from,a.to);return f?(o.dispatch({effects:V.of(f)}),!0):!1}}}),Ye()]}var Vt=S.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}}),J=class n{constructor(e,t){this.specs=e;let r;function i(a){let l=O.newName();return(r||(r=Object.create(null)))["."+l]=a,l}let s=typeof t.all=="string"?t.all:t.all?i(t.all):void 0,o=t.scope;this.scope=o instanceof p?a=>a.prop(A)==o.data:o?a=>a==o:void 0,this.style=kt(e.map(a=>({tag:a.tag,class:a.class||i(Object.assign({},a,{tag:null}))})),{all:s}).style,this.module=r?new O(r):null,this.themeType=t.themeType}static define(e,t){return new n(e,t||{})}},le=T.define(),tt=T.define({combine(n){return n.length?[n[0]]:null}});function z(n){let e=n.facet(le);return e.length?e:n.facet(tt)}function Nn(n,e){let t=[Ht],r;return n instanceof J&&(n.module&&t.push(S.styleModule.of(n.module)),r=n.themeType),e?.fallback?t.push(tt.of(n)):r?t.push(le.computeN([S.darkTheme],i=>i.facet(S.darkTheme)==(r=="dark")?[n]:[])):t.push(le.of(n)),t}function Mn(n,e,t){let r=z(n),i=null;if(r){for(let s of r)if(!s.scope||t&&s.scope(t)){let o=s.style(e);o&&(i=i?i+" "+o:o)}}return i}var ae=class{constructor(e){this.markCache=Object.create(null),this.tree=y(e.state),this.decorations=this.buildDeco(e,z(e.state)),this.decoratedTo=e.viewport.to}update(e){let t=y(e.state),r=z(e.state),i=r!=z(e.startState),{viewport:s}=e.view,o=e.changes.mapPos(this.decoratedTo,1);t.length<s.to&&!i&&t.type==this.tree.type&&o>=s.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=o):(t!=this.tree||e.viewportChanged||i)&&(this.tree=t,this.decorations=this.buildDeco(e.view,r),this.decoratedTo=s.to)}buildDeco(e,t){if(!t||!this.tree.length)return g.none;let r=new de;for(let{from:i,to:s}of e.visibleRanges)gt(this.tree,t,(o,a,l)=>{r.add(o,a,this.markCache[l]||(this.markCache[l]=g.mark({class:l})))},i,s);return r.finish()}},Ht=Ve.high(j.fromClass(ae,{decorations:n=>n.decorations})),Bn=J.define([{tag:u.meta,color:"#404740"},{tag:u.link,textDecoration:"underline"},{tag:u.heading,textDecoration:"underline",fontWeight:"bold"},{tag:u.emphasis,fontStyle:"italic"},{tag:u.strong,fontWeight:"bold"},{tag:u.strikethrough,textDecoration:"line-through"},{tag:u.keyword,color:"#708"},{tag:[u.atom,u.bool,u.url,u.contentSeparator,u.labelName],color:"#219"},{tag:[u.literal,u.inserted],color:"#164"},{tag:[u.string,u.deleted],color:"#a11"},{tag:[u.regexp,u.escape,u.special(u.string)],color:"#e40"},{tag:u.definition(u.variableName),color:"#00f"},{tag:u.local(u.variableName),color:"#30a"},{tag:[u.typeName,u.namespace],color:"#085"},{tag:u.className,color:"#167"},{tag:[u.special(u.variableName),u.macroName],color:"#256"},{tag:u.definition(u.propertyName),color:"#00c"},{tag:u.comment,color:"#940"},{tag:u.invalid,color:"#f00"}]),$t=S.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),nt=1e4,rt="()[]{}",it=T.define({combine(n){return We(n,{afterCursor:!0,brackets:rt,maxScanDistance:nt,renderMatch:qt})}}),zt=g.mark({class:"cm-matchingBracket"}),_t=g.mark({class:"cm-nonmatchingBracket"});function qt(n){let e=[],t=n.matched?zt:_t;return e.push(t.range(n.start.from,n.start.to)),n.end&&e.push(t.range(n.end.from,n.end.to)),e}function Ne(n){let e=[],t=n.facet(it);for(let r of n.selection.ranges){if(!r.empty)continue;let i=H(n,r.head,-1,t)||r.head>0&&H(n,r.head-1,1,t)||t.afterCursor&&(H(n,r.head,1,t)||r.head<n.doc.length&&H(n,r.head+1,-1,t));i&&(e=e.concat(t.renderMatch(i,n)))}return g.set(e,!0)}var Gt=j.fromClass(class{constructor(n){this.paused=!1,this.decorations=Ne(n.state)}update(n){(n.docChanged||n.selectionSet||this.paused)&&(n.view.composing?(this.decorations=this.decorations.map(n.changes),this.paused=!0):(this.decorations=Ne(n.state),this.paused=!1))}},{decorations:n=>n.decorations}),Jt=[Gt,$t];function Rn(n={}){return[it.of(n),Jt]}var Kt=new v;function he(n,e,t){let r=n.prop(e<0?v.openedBy:v.closedBy);if(r)return r;if(n.name.length==1){let i=t.indexOf(n.name);if(i>-1&&i%2==(e<0?1:0))return[t[i+e]]}return null}function fe(n){let e=n.type.prop(Kt);return e?e(n.node):n}function H(n,e,t,r={}){let i=r.maxScanDistance||nt,s=r.brackets||rt,o=y(n),a=o.resolveInner(e,t);for(let l=a;l;l=l.parent){let h=he(l.type,t,s);if(h&&l.from<l.to){let f=fe(l);if(f&&(t>0?e>=f.from&&e<f.to:e>f.from&&e<=f.to))return Zt(n,e,t,l,f,h,s)}}return Qt(n,e,t,o,a.type,i,s)}function Zt(n,e,t,r,i,s,o){let a=r.parent,l={from:i.from,to:i.to},h=0,f=a?.cursor();if(f&&(t<0?f.childBefore(r.from):f.childAfter(r.to)))do if(t<0?f.to<=r.from:f.from>=r.to){if(h==0&&s.indexOf(f.type.name)>-1&&f.from<f.to){let c=fe(f);return{start:l,end:c?{from:c.from,to:c.to}:void 0,matched:!0}}else if(he(f.type,t,o))h++;else if(he(f.type,-t,o)){if(h==0){let c=fe(f);return{start:l,end:c&&c.from<c.to?{from:c.from,to:c.to}:void 0,matched:!1}}h--}}while(t<0?f.prevSibling():f.nextSibling());return{start:l,matched:!1}}function Qt(n,e,t,r,i,s,o){if(t<0?!e:e==n.doc.length)return null;let a=t<0?n.sliceDoc(e-1,e):n.sliceDoc(e,e+1),l=o.indexOf(a);if(l<0||l%2==0!=t>0)return null;let h={from:t<0?e-1:e,to:t>0?e+1:e},f=n.doc.iterRange(e,t>0?n.doc.length:0),c=0;for(let m=0;!f.next().done&&m<=s;){let d=f.value;t<0&&(m+=d.length);let k=e+m*t;for(let w=t>0?0:d.length-1,I=t>0?d.length:-1;w!=I;w+=t){let X=o.indexOf(d[w]);if(!(X<0||r.resolveInner(k+w,1).type!=i))if(X%2==0==t>0)c++;else{if(c==1)return{start:h,end:{from:k+w,to:k+w+1},matched:X>>1==l>>1};c--}}t>0&&(m+=d.length)}return f.done?{start:h,matched:!1}:null}function Xt(n){return{name:n.name||"",token:n.token,blankLine:n.blankLine||(()=>{}),startState:n.startState||(()=>!0),copyState:n.copyState||Yt,indent:n.indent||(()=>null),languageData:n.languageData||{},tokenTable:n.tokenTable||be,mergeTokens:n.mergeTokens!==!1}}function Yt(n){if(typeof n!="object")return n;let e={};for(let t in n){let r=n[t];e[t]=r instanceof Array?r.slice():r}return e}var Me=new WeakMap,Be=class n extends p{constructor(e){let t=$e(e.languageData),r=Xt(e),i,s=new class extends Fe{createParse(o,a,l){return new ue(i,o,a,l)}};super(t,s,[],e.name),this.topNode=rn(t,this),i=this,this.streamParser=r,this.stateAfter=new v({perNode:!0}),this.tokenTable=e.tokenTable?new K(r.tokenTable):nn}static define(e){return new n(e)}getIndent(e){let t,{overrideIndentation:r}=e.options;r&&(t=Me.get(e.state),t!=null&&t<e.pos-1e4&&(t=void 0));let i=ke(this,e.node.tree,e.node.from,e.node.from,t??e.pos),s,o;if(i?(o=i.state,s=i.pos+1):(o=this.streamParser.startState(e.unit),s=e.node.from),e.pos-s>1e4)return null;for(;s<e.pos;){let l=e.state.doc.lineAt(s),h=Math.min(e.pos,l.to);if(l.length){let f=r?r(l.from):-1,c=new P(l.text,e.state.tabSize,e.unit,f<0?void 0:f);for(;c.pos<h-l.from;)ot(this.streamParser.token,c,o)}else this.streamParser.blankLine(o,e.unit);if(h==e.pos)break;s=l.to+1}let a=e.lineAt(e.pos);return r&&t==null&&Me.set(e.state,a.from),this.streamParser.indent(o,/^\s*(.*)/.exec(a.text)[1],e)}get allowsNesting(){return!1}};function ke(n,e,t,r,i){let s=t>=r&&t+e.length<=i&&e.prop(n.stateAfter);if(s)return{state:n.streamParser.copyState(s),pos:t+e.length};for(let o=e.children.length-1;o>=0;o--){let a=e.children[o],l=t+e.positions[o],h=a instanceof b&&l<i&&ke(n,a,l,r,i);if(h)return h}return null}function st(n,e,t,r,i){if(i&&t<=0&&r>=e.length)return e;!i&&t==0&&e.type==n.topNode&&(i=!0);for(let s=e.children.length-1;s>=0;s--){let o=e.positions[s],a=e.children[s],l;if(o<r&&a instanceof b){if(!(l=st(n,a,t-o,r-o,i)))break;return i?new b(e.type,e.children.slice(0,s).concat(l),e.positions.slice(0,s+1),o+l.length):l}}return null}function en(n,e,t,r,i){for(let s of e){let o=s.from+(s.openStart?25:0),a=s.to-(s.openEnd?25:0),l=o<=t&&a>t&&ke(n,s.tree,0-s.offset,t,a),h;if(l&&l.pos<=r&&(h=st(n,s.tree,t+s.offset,l.pos+s.offset,!1)))return{state:l.state,tree:h}}return{state:n.streamParser.startState(i?q(i):4),tree:b.empty}}var ue=class{constructor(e,t,r,i){this.lang=e,this.input=t,this.fragments=r,this.ranges=i,this.stoppedAt=null,this.chunks=[],this.chunkPos=[],this.chunk=[],this.chunkReused=void 0,this.rangeIndex=0,this.to=i[i.length-1].to;let s=R.get(),o=i[0].from,{state:a,tree:l}=en(e,r,o,this.to,s?.state);this.state=a,this.parsedPos=this.chunkStart=o+l.length;for(let h=0;h<l.children.length;h++)this.chunks.push(l.children[h]),this.chunkPos.push(l.positions[h]);s&&this.parsedPos<s.viewport.from-1e5&&i.some(h=>h.from<=s.viewport.from&&h.to>=s.viewport.from)&&(this.state=this.lang.streamParser.startState(q(s.state)),s.skipUntilInView(this.parsedPos,s.viewport.from),this.parsedPos=s.viewport.from),this.moveRangeIndex()}advance(){let e=R.get(),t=this.stoppedAt==null?this.to:Math.min(this.to,this.stoppedAt),r=Math.min(t,this.chunkStart+512);for(e&&(r=Math.min(r,e.viewport.to));this.parsedPos<r;)this.parseLine(e);return this.chunkStart<this.parsedPos&&this.finishChunk(),this.parsedPos>=t?this.finish():e&&this.parsedPos>=e.viewport.to?(e.skipUntilInView(this.parsedPos,t),this.finish()):null}stopAt(e){this.stoppedAt=e}lineAfter(e){let t=this.input.chunk(e);if(this.input.lineChunks)t==`
`&&(t="");else{let r=t.indexOf(`
`);r>-1&&(t=t.slice(0,r))}return e+t.length<=this.to?t:t.slice(0,this.to-e)}nextLine(){let e=this.parsedPos,t=this.lineAfter(e),r=e+t.length;for(let i=this.rangeIndex;;){let s=this.ranges[i].to;if(s>=r||(t=t.slice(0,s-(r-t.length)),i++,i==this.ranges.length))break;let o=this.ranges[i].from,a=this.lineAfter(o);t+=a,r=o+a.length}return{line:t,end:r}}skipGapsTo(e,t,r){for(;;){let i=this.ranges[this.rangeIndex].to,s=e+t;if(r>0?i>s:i>=s)break;let o=this.ranges[++this.rangeIndex].from;t+=o-i}return t}moveRangeIndex(){for(;this.ranges[this.rangeIndex].to<this.parsedPos;)this.rangeIndex++}emitToken(e,t,r,i){let s=4;if(this.ranges.length>1){i=this.skipGapsTo(t,i,1),t+=i;let a=this.chunk.length;i=this.skipGapsTo(r,i,-1),r+=i,s+=this.chunk.length-a}let o=this.chunk.length-4;return this.lang.streamParser.mergeTokens&&s==4&&o>=0&&this.chunk[o]==e&&this.chunk[o+2]==t?this.chunk[o+2]=r:this.chunk.push(e,t,r,s),i}parseLine(e){let{line:t,end:r}=this.nextLine(),i=0,{streamParser:s}=this.lang,o=new P(t,e?e.state.tabSize:4,e?q(e.state):2);if(o.eol())s.blankLine(this.state,o.indentUnit);else for(;!o.eol();){let a=ot(s.token,o,this.state);if(a&&(i=this.emitToken(this.lang.tokenTable.resolve(a),this.parsedPos+o.start,this.parsedPos+o.pos,i)),o.start>1e4)break}this.parsedPos=r,this.moveRangeIndex(),this.parsedPos<this.to&&this.parsedPos++}finishChunk(){let e=b.build({buffer:this.chunk,start:this.chunkStart,length:this.parsedPos-this.chunkStart,nodeSet:tn,topID:0,maxBufferLength:512,reused:this.chunkReused});e=new b(e.type,e.children,e.positions,e.length,[[this.lang.stateAfter,this.lang.streamParser.copyState(this.state)]]),this.chunks.push(e),this.chunkPos.push(this.chunkStart-this.ranges[0].from),this.chunk=[],this.chunkReused=void 0,this.chunkStart=this.parsedPos}finish(){return new b(this.lang.topNode,this.chunks,this.chunkPos,this.parsedPos-this.ranges[0].from).balance()}};function ot(n,e,t){e.start=e.pos;for(let r=0;r<10;r++){let i=n(e,t);if(e.pos>e.start)return i}throw new Error("Stream parser failed to advance stream.")}var be=Object.create(null),W=[Z.none],tn=new ut(W),Re=[],Le=Object.create(null),lt=Object.create(null);for(let[n,e]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])lt[n]=at(be,e);var K=class{constructor(e){this.extra=e,this.table=Object.assign(Object.create(null),lt)}resolve(e){return e?this.table[e]||(this.table[e]=at(this.extra,e)):0}},nn=new K(be);function re(n,e){Re.indexOf(n)>-1||(Re.push(n),console.warn(e))}function at(n,e){let t=[];for(let a of e.split(" ")){let l=[];for(let h of a.split(".")){let f=n[h]||u[h];f?typeof f=="function"?l.length?l=l.map(f):re(h,`Modifier ${h} used at start of tag`):l.length?re(h,`Tag ${h} used as modifier`):l=Array.isArray(f)?f:[f]:re(h,`Unknown highlighting tag ${h}`)}for(let h of l)t.push(h)}if(!t.length)return 0;let r=e.replace(/ /g,"_"),i=r+" "+t.map(a=>a.id),s=Le[i];if(s)return s.id;let o=Le[i]=Z.define({id:W.length,name:r,props:[bt({[r]:t})]});return W.push(o),o.id}function rn(n,e){let t=Z.define({id:W.length,name:"Document",props:[A.add(()=>n),Ke.add(()=>r=>e.getIndent(r))],top:!0});return W.push(t),t}function ht(n){return n.length<=4096&&/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/.test(n)}function ft(n){for(let e=n.iter();!e.next().done;)if(ht(e.value))return!0;return!1}function sn(n){let e=!1;return n.iterChanges((t,r,i,s,o)=>{!e&&ft(o)&&(e=!0)}),e}var ce=T.define({combine:n=>n.some(e=>e)});function Ln(n={}){let e=[on];return n.alwaysIsolate&&e.push(ce.of(!0)),e}var on=j.fromClass(class{constructor(n){this.always=n.state.facet(ce)||n.textDirection!=_.LTR||n.state.facet(S.perLineTextDirection),this.hasRTL=!this.always&&ft(n.state.doc),this.tree=y(n.state),this.decorations=this.always||this.hasRTL?Ee(n,this.tree,this.always):g.none}update(n){let e=n.state.facet(ce)||n.view.textDirection!=_.LTR||n.state.facet(S.perLineTextDirection);if(!e&&!this.hasRTL&&sn(n.changes)&&(this.hasRTL=!0),!e&&!this.hasRTL)return;let t=y(n.state);(e!=this.always||t!=this.tree||n.docChanged||n.viewportChanged)&&(this.tree=t,this.always=e,this.decorations=Ee(n.view,t,e))}},{provide:n=>{function e(t){var r,i;return(i=(r=t.plugin(n))===null||r===void 0?void 0:r.decorations)!==null&&i!==void 0?i:g.none}return[S.outerDecorations.of(e),Ve.lowest(S.bidiIsolatedRanges.of(e))]}});function Ee(n,e,t){let r=new de,i=n.visibleRanges;t||(i=ln(i,n.state.doc));for(let{from:s,to:o}of i)e.iterate({enter:a=>{let l=a.type.prop(v.isolate);l&&r.add(a.from,a.to,an[l])},from:s,to:o});return r.finish()}function ln(n,e){let t=e.iter(),r=0,i=[],s=null;for(let{from:o,to:a}of n)if(!(s&&s.to>o&&(o=s.to,o>=a)))for(r+t.value.length<o&&(t.next(o-(r+t.value.length)),r=o);;){let l=r,h=r+t.value.length;if(!t.lineBreak&&ht(t.value)&&(s&&s.to>l-10?s.to=Math.min(a,h):i.push(s={from:l,to:Math.min(a,h)})),h>=a)break;r=h,t.next()}return i}var an={rtl:g.mark({class:"cm-iso",inclusive:!0,attributes:{dir:"rtl"},bidiIsolate:_.RTL}),ltr:g.mark({class:"cm-iso",inclusive:!0,attributes:{dir:"ltr"},bidiIsolate:_.LTR}),auto:g.mark({class:"cm-iso",inclusive:!0,attributes:{dir:"auto"},bidiIsolate:null})};export{ie as DocInput,J as HighlightStyle,E as IndentContext,Ce as LRLanguage,p as Language,De as LanguageDescription,Pe as LanguageSupport,R as ParseContext,Be as StreamLanguage,P as StringStream,se as TreeIndentContext,Ln as bidiIsolates,Rn as bracketMatching,Kt as bracketMatchingHandle,Ye as codeFolding,xn as continuedIndent,Bn as defaultHighlightStyle,$e as defineLanguageFacet,vn as delimitedIndent,wt as ensureSyntaxTree,Tn as flatIndent,Et as foldAll,Rt as foldCode,V as foldEffect,On as foldGutter,An as foldInside,In as foldKeymap,Ot as foldNodeProp,It as foldService,C as foldState,F as foldable,Pn as foldedRanges,bn as forceParsing,q as getIndentUnit,Je as getIndentation,Mn as highlightingFor,Ke as indentNodeProp,Cn as indentOnInput,Sn as indentRange,St as indentService,Ge as indentString,qe as indentUnit,x as language,A as languageDataProp,H as matchBrackets,yt as sublanguageProp,Nn as syntaxHighlighting,yn as syntaxParserRunning,y as syntaxTree,kn as syntaxTreeAvailable,Dn as toggleFold,Ft as unfoldAll,Lt as unfoldCode,D as unfoldEffect};
//# sourceMappingURL=language.bundle.mjs.map