{let{w:t}=e;return t})),a=t.some((e=>{let{h:t}=e;return t}));if(o+a+t.some((e=>{let{d:t}=e;return t}))>1)throw new Error("Mixed descriptor in srcset is not supported");let u=o?"w":a?"h":"d",l=o?"w":a?"h":"x",c=e=>Math.max(...e),p=t.map((e=>e.url)),h=c(p.map((e=>e.length))),d=t.map((e=>e[u])).map((e=>e?e.toString():"")),f=d.map((e=>{let t=e.indexOf(".");return-1===t?e.length:t})),m=c(f);return i([",",s],p.map(((e,t)=>{let r=[e],i=d[t];if(i){let s=h-e.length+1,o=m-f[t],a=" ".repeat(s+o);r.push(n(a," "),i+l)}return r})))},printClassNames:function(e){return e.trim().split(/\s+/).join(" ")}}}}),Ii=y({"src/language-html/syntax-vue.js"(e,t){S();var{builders:{group:r}}=V();t.exports={isVueEventBindingExpression:function(e){let t=e.trim();return/^(?:[\w$]+|\([^)]*\))\s*=>|^function\s*\(/.test(t)||/^[$A-Z_a-z][\w$]*(?:\.[$A-Z_a-z][\w$]*|\['[^']*']|\["[^"]*"]|\[\d+]|\[[$A-Z_a-z][\w$]*])*$/.test(t)},printVueFor:function(e,t){let{left:n,operator:i,right:s}=function(e){let t=/(.*?)\s+(in|of)\s+(.*)/s,r=/,([^,\]}]*)(?:,([^,\]}]*))?$/,n=/^\(|\)$/g,i=e.match(t);if(!i)return;let s={};if(s.for=i[3].trim(),!s.for)return;let o=i[1].trim().replace(n,""),a=o.match(r);a?(s.alias=o.replace(r,""),s.iterator1=a[1].trim(),a[2]&&(s.iterator2=a[2].trim())):s.alias=o;let u=[s.alias,s.iterator1,s.iterator2];return u.some(((e,t)=>!e&&(0===t||u.slice(t+1).some(Boolean))))?void 0:{left:u.filter(Boolean).join(","),operator:i[2],right:s.for}}(e);return[r(t(`function _(${n}) {}`,{parser:"babel",__isVueForBindingLeft:!0}))," ",i," ",t(s,{parser:"__js_expression"},{stripTrailingHardline:!0})]},printVueBindings:function(e,t){return t(`function _(${e}) {}`,{parser:"babel",__isVueBindings:!0})}}}}),ji=y({"src/language-html/get-node-content.js"(e,t){S();var{needsToBorrowParentClosingTagStartMarker:r,printClosingTagStartMarker:n,needsToBorrowLastChildClosingTagEndMarker:i,printClosingTagEndMarker:s,needsToBorrowParentOpeningTagEndMarker:o,printOpeningTagEndMarker:a}=Ni();t.exports=function(e,t){let u=e.startSourceSpan.end.offset;e.firstChild&&o(e.firstChild)&&(u-=a(e).length);let l=e.endSourceSpan.start.offset;return e.lastChild&&r(e.lastChild)?l+=n(e,t).length:i(e)&&(l-=s(e.lastChild,t).length),t.originalText.slice(u,l)}}}),Li=y({"src/language-html/embed.js"(e,t){S();var{builders:{breakParent:r,group:n,hardline:i,indent:s,line:o,fill:a,softline:u},utils:{mapDoc:l,replaceTextEndOfLine:c}}=V(),p=Pn(),{printClosingTag:h,printClosingTagSuffix:d,needsToBorrowPrevClosingTagEndMarker:f,printOpeningTagPrefix:m,printOpeningTag:g}=Ni(),{printImgSrcset:O,printClassNames:D}=Mi(),{printVueFor:y,printVueBindings:v,isVueEventBindingExpression:b}=Ii(),{isScriptLikeTag:C,isVueNonHtmlBlock:E,inferScriptParser:x,htmlTrimPreserveIndentation:w,dedentString:A,unescapeQuoteEntities:F,isVueSlotAttribute:T,isVueSfcBindingsAttribute:k,getTextValueParts:P}=Ai(),$=ji();function Q(e,t,r){let i=t=>new RegExp(t.join("|")).test(e.fullName),l=()=>F(e.value),p=!1,h=(e,t)=>{let r="NGRoot"===e.type?"NGMicrosyntax"===e.node.type&&1===e.node.body.length&&"NGMicrosyntaxExpression"===e.node.body[0].type?e.node.body[0].expression:e.node:"JsExpressionRoot"===e.type?e.node:e;r&&("ObjectExpression"===r.type||"ArrayExpression"===r.type||"__vue_expression"===t.parser&&("TemplateLiteral"===r.type||"StringLiteral"===r.type))&&(p=!0)},d=function(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return n([s([u,e]),t?u:""])},f=e=>p?(e=>n(e))(e):d(e),m=(e,r)=>t(e,Object.assign({__onHtmlBindingRoot:h,__embeddedInHtml:!0},r));if("srcset"===e.fullName&&("img"===e.parent.fullName||"source"===e.parent.fullName))return d(O(l()));if("class"===e.fullName&&!r.parentParser){let e=l();if(!e.includes("{{"))return D(e)}if("style"===e.fullName&&!r.parentParser){let e=l();if(!e.includes("{{"))return d(m(e,{parser:"css",__isHTMLStyleAttribute:!0}))}if("vue"===r.parser){if("v-for"===e.fullName)return y(l(),m);if(T(e)||k(e,r))return v(l(),m);let t=["^:","^v-bind:"],n=["^v-"];if(i(["^@","^v-on:"])){let e=l(),t=b(e)?"__js_expression":r.__should_parse_vue_template_with_ts?"__vue_ts_event_binding":"__vue_event_binding";return f(m(e,{parser:t}))}if(i(t))return f(m(l(),{parser:"__vue_expression"}));if(i(n))return f(m(l(),{parser:"__js_expression"}))}if("angular"===r.parser){let t=(e,t)=>m(e,Object.assign(Object.assign({},t),{},{trailingComma:"none"})),r=["^\\*"],u=["^\\[.+\\]$","^bind(on)?-","^ng-(if|show|hide|class|style)$"],p=["^i18n(-.+)?$"];if(i(["^\\(.+\\)$","^on-"]))return f(t(l(),{parser:"__ng_action"}));if(i(u))return f(t(l(),{parser:"__ng_binding"}));if(i(p)){let t=l().trim();return d(a(P(e,t)),!t.includes("@@"))}if(i(r))return f(t(l(),{parser:"__ng_directive"}));let h=/{{(.+?)}}/s,g=l();if(h.test(g)){let e=[];for(let[r,i]of g.split(h).entries())if(r%2==0)e.push(c(i));else try{e.push(n(["{{",s([o,t(i,{parser:"__ng_interpolation",__isInHtmlInterpolation:!0})]),o,"}}"]))}catch{e.push("{{",c(i),"}}")}return n(e)}}return null}t.exports=function(e,t,a,u){let c=e.getValue();switch(c.type){case"element":if(C(c)||"interpolation"===c.type)return;if(!c.isSelfClosing&&E(c,u)){let r=x(c,u);if(!r)return;let s=$(c,u),o=/^\s*$/.test(s),l="";return o||(l=a(w(s),{parser:r,__embeddedInHtml:!0},{stripTrailingHardline:!0}),o=""===l),[m(c,u),n(g(e,u,t)),o?"":i,l,o?"":i,h(c,u),d(c,u)]}break;case"text":if(C(c.parent)){let e=x(c.parent,u);if(e){let t="markdown"===e?A(c.value.replace(/^[^\S\n]*\n/,"")):c.value,n={parser:e,__embeddedInHtml:!0};if("html"===u.parser&&"babel"===e){let e="script",{attrMap:t}=c.parent;t&&("module"===t.type||"text/babel"===t.type&&"module"===t["data-type"])&&(e="module"),n.__babelSourceType=e}return[r,m(c,u),a(t,n,{stripTrailingHardline:!0}),d(c,u)]}}else if("interpolation"===c.parent.type){let e={__isInHtmlInterpolation:!0,__embeddedInHtml:!0};return"angular"===u.parser?(e.parser="__ng_interpolation",e.trailingComma="none"):"vue"===u.parser?e.parser=u.__should_parse_vue_template_with_ts?"__vue_ts_expression":"__vue_expression":e.parser="__js_expression",[s([o,a(c.value,e,{stripTrailingHardline:!0})]),c.parent.next&&f(c.parent.next)?" ":o]}break;case"attribute":{if(!c.value)break;if(/^PRETTIER_HTML_PLACEHOLDER_\d+_\d+_IN_JS$/.test(u.originalText.slice(c.valueSpan.start.offset,c.valueSpan.end.offset)))return[c.rawName,"=",c.value];if("lwc"===u.parser&&/^{.*}$/s.test(u.originalText.slice(c.valueSpan.start.offset,c.valueSpan.end.offset)))return[c.rawName,"=",c.value];let e=Q(c,((e,t)=>a(e,Object.assign({__isInHtmlAttribute:!0,__embeddedInHtml:!0},t),{stripTrailingHardline:!0})),u);if(e)return[c.rawName,'="',n(l(e,(e=>"string"==typeof e?e.replace(/"/g,"""):e))),'"'];break}case"front-matter":return p(c,a)}}}}),Zi=y({"src/language-html/print/children.js"(e,t){S();var{builders:{breakParent:r,group:n,ifBreak:i,line:s,softline:o,hardline:a},utils:{replaceTextEndOfLine:u}}=V(),{locStart:l,locEnd:c}=_i(),{forceBreakChildren:p,forceNextEmptyLine:h,isTextLikeNode:d,hasPrettierIgnore:f,preferHardlineAsLeadingSpaces:m}=Ai(),{printOpeningTagPrefix:g,needsToBorrowNextOpeningTagStartMarker:O,printOpeningTagStartMarker:D,needsToBorrowPrevClosingTagEndMarker:y,printClosingTagEndMarker:v,printClosingTagSuffix:b,needsToBorrowParentClosingTagStartMarker:C}=Ni();function E(e,t,r){let n=e.getValue();return f(n)?[g(n,t),...u(t.originalText.slice(l(n)+(n.prev&&O(n.prev)?D(n).length:0),c(n)-(n.next&&y(n.next)?v(n,t).length:0))),b(n,t)]:r()}function x(e,t){return d(e)&&d(t)?e.isTrailingSpaceSensitive?e.hasTrailingSpaces?m(t)?a:s:"":m(t)?a:o:O(e)&&(f(t)||t.firstChild||t.isSelfClosing||"element"===t.type&&t.attrs.length>0)||"element"===e.type&&e.isSelfClosing&&y(t)?"":!t.isLeadingSpaceSensitive||m(t)||y(t)&&e.lastChild&&C(e.lastChild)&&e.lastChild.lastChild&&C(e.lastChild.lastChild)?a:t.hasLeadingSpaces?s:o}t.exports={printChildren:function(e,t,s){let u=e.getValue();if(p(u))return[r,...e.map((e=>{let r=e.getValue(),n=r.prev?x(r.prev,r):"";return[n?[n,h(r.prev)?a:""]:"",E(e,t,s)]}),"children")];let l=u.children.map((()=>Symbol("")));return e.map(((e,r)=>{let u=e.getValue();if(d(u)){if(u.prev&&d(u.prev)){let r=x(u.prev,u);if(r)return h(u.prev)?[a,a,E(e,t,s)]:[r,E(e,t,s)]}return E(e,t,s)}let c=[],p=[],f=[],m=[],g=u.prev?x(u.prev,u):"",O=u.next?x(u,u.next):"";return g&&(h(u.prev)?c.push(a,a):g===a?c.push(a):d(u.prev)?p.push(g):p.push(i("",o,{groupId:l[r-1]}))),O&&(h(u)?d(u.next)&&m.push(a,a):O===a?d(u.next)&&m.push(a):f.push(O)),[...c,n([...p,n([E(e,t,s),...f],{id:l[r]})]),...m]}),"children")}}}}),Xi=y({"src/language-html/print/element.js"(e,t){S();var{builders:{breakParent:r,dedentToRoot:n,group:i,ifBreak:s,indentIfBreak:o,indent:a,line:u,softline:l},utils:{replaceTextEndOfLine:c}}=V(),p=ji(),{shouldPreserveContent:h,isScriptLikeTag:d,isVueCustomBlock:f,countParents:m,forceBreakContent:g}=Ai(),{printOpeningTagPrefix:O,printOpeningTag:D,printClosingTagSuffix:y,printClosingTag:v,needsToBorrowPrevClosingTagEndMarker:b,needsToBorrowLastChildClosingTagEndMarker:C}=Ni(),{printChildren:E}=Zi();t.exports={printElement:function(e,t,S){let x=e.getValue();if(h(x,t))return[O(x,t),i(D(e,t,S)),...c(p(x,t)),...v(x,t),y(x,t)];let w=1===x.children.length&&"interpolation"===x.firstChild.type&&x.firstChild.isLeadingSpaceSensitive&&!x.firstChild.hasLeadingSpaces&&x.lastChild.isTrailingSpaceSensitive&&!x.lastChild.hasTrailingSpaces,A=Symbol("element-attr-group-id"),F=r=>i([i(D(e,t,S),{id:A}),r,v(x,t)]);return 0===x.children.length?F(x.hasDanglingSpaces&&x.isDanglingSpaceSensitive?u:""):F([g(x)?r:"",(T=[w?s(l,"",{groupId:A}):x.firstChild.hasLeadingSpaces&&x.firstChild.isLeadingSpaceSensitive?u:"text"===x.firstChild.type&&x.isWhitespaceSensitive&&x.isIndentationSensitive?n(l):l,E(e,t,S)],w?o(T,{groupId:A}):!d(x)&&!f(x,t)||"root"!==x.parent.type||"vue"!==t.parser||t.vueIndentScriptAndStyle?a(T):T),(x.next?b(x.next):C(x.parent))?x.lastChild.hasTrailingSpaces&&x.lastChild.isTrailingSpaceSensitive?" ":"":w?s(l,"",{groupId:A}):x.lastChild.hasTrailingSpaces&&x.lastChild.isTrailingSpaceSensitive?u:("comment"===x.lastChild.type||"text"===x.lastChild.type&&x.isWhitespaceSensitive&&x.isIndentationSensitive)&&new RegExp(`\\n[\\t ]{${t.tabWidth*m(e,(e=>e.parent&&"root"!==e.parent.type))}}$`).test(x.lastChild.value)?"":l]);var T}}}}),Vi=y({"src/language-html/printer-html.js"(e,t){S();var{builders:{fill:r,group:n,hardline:i,literalline:s},utils:{cleanDoc:o,getDocParts:a,isConcat:u,replaceTextEndOfLine:l}}=V(),c=Ei(),{countChars:p,unescapeQuoteEntities:h,getTextValueParts:d}=Ai(),f=Qi(),{insertPragma:m}=Bi(),{locStart:g,locEnd:O}=_i(),D=Li(),{printClosingTagSuffix:y,printClosingTagEnd:v,printOpeningTagPrefix:b,printOpeningTagStart:C}=Ni(),{printElement:E}=Xi(),{printChildren:x}=Zi();t.exports={preprocess:f,print:function(e,t,c){let f=e.getValue();switch(f.type){case"front-matter":return l(f.raw);case"root":return t.__onHtmlRoot&&t.__onHtmlRoot(f),[n(x(e,t,c)),i];case"element":case"ieConditionalComment":return E(e,t,c);case"ieConditionalStartComment":case"ieConditionalEndComment":return[C(f),v(f)];case"interpolation":return[C(f,t),...e.map(c,"children"),v(f,t)];case"text":{if("interpolation"===f.parent.type){let e=/\n[^\S\n]*$/,t=e.test(f.value),r=t?f.value.replace(e,""):f.value;return[...l(r),t?i:""]}let e=o([b(f,t),...d(f),y(f,t)]);return u(e)||"fill"===e.type?r(a(e)):e}case"docType":return[n([C(f,t)," ",f.value.replace(/^html\b/i,"html").replace(/\s+/g," ")]),v(f,t)];case"comment":return[b(f,t),...l(t.originalText.slice(g(f),O(f)),s),y(f,t)];case"attribute":{if(null===f.value)return f.rawName;let e=h(f.value),t=p(e,"'")({name:"Angular",since:"1.15.0",parsers:["angular"],vscodeLanguageIds:["html"],extensions:[".component.html"],filenames:[]}))),r(Ui(),(e=>({since:"1.15.0",parsers:["html"],vscodeLanguageIds:["html"],extensions:[...e.extensions,".mjml"]}))),r(Ui(),(()=>({name:"Lightning Web Components",since:"1.17.0",parsers:["lwc"],vscodeLanguageIds:["html"],extensions:[],filenames:[]}))),r(zi(),(()=>({since:"1.10.0",parsers:["vue"],vscodeLanguageIds:["vue"]})))],a={html:n};t.exports={languages:o,printers:a,options:i,parsers:s}}}),Gi=y({"src/language-yaml/pragma.js"(e,t){S(),t.exports={isPragma:function(e){return/^\s*@(?:prettier|format)\s*$/.test(e)},hasPragma:function(e){return/^\s*#[^\S\n]*@(?:prettier|format)\s*?(?:\n|$)/.test(e)},insertPragma:function(e){return`# @format\n\n${e}`}}}}),Hi=y({"src/language-yaml/loc.js"(e,t){S(),t.exports={locStart:function(e){return e.position.start.offset},locEnd:function(e){return e.position.end.offset}}}}),Ji=y({"src/language-yaml/embed.js"(e,t){S(),t.exports=function(e,t,r,n){if("root"===e.getValue().type&&n.filepath&&/(?:[/\\]|^)\.(?:prettier|stylelint|lintstaged)rc$/.test(n.filepath))return r(n.originalText,Object.assign(Object.assign({},n),{},{parser:"json"}))}}}),Ki=y({"src/language-yaml/utils.js"(e,t){S();var{getLast:r,isNonEmptyArray:n}=de();function i(e,t){return e&&"string"==typeof e.type&&(!t||t.includes(e.type))}function s(e){return"prettier-ignore"===e.value.trim()}function o(e){return n(null==e?void 0:e.leadingComments)}function a(e){return n(null==e?void 0:e.middleComments)}function u(e){return null==e?void 0:e.indicatorComment}function l(e){return null==e?void 0:e.trailingComment}function c(e){return n(null==e?void 0:e.endComments)}function p(e){let t,r=[];for(let n of e.split(/( +)/))" "!==n?" "===t?r.push(n):r.push((r.pop()||"")+n):void 0===t&&r.unshift(""),t=n;return" "===t&&r.push((r.pop()||"")+" "),""===r[0]&&(r.shift(),r.unshift(" "+(r.shift()||""))),r}t.exports={getLast:r,getAncestorCount:function(e,t){let r=0,n=e.stack.length-1;for(let s=0;se(n,r,t)))}):t,n)},defineShortcut:function(e,t,r){Object.defineProperty(e,t,{get:r,enumerable:!1})},isNextLineEmpty:function(e,t){let r=0,n=t.length;for(let i=e.position.end.offset-1;i *)[^\n\r ]/m);n=e?e.groups.leadingSpace.length:Number.POSITIVE_INFINITY}else n=e.indent-1+i;let u=a.split("\n").map((e=>e.slice(n)));return"preserve"===o.proseWrap||"blockLiteral"===e.type?l(u.map((e=>0===e.length?[]:[e]))):l(u.map((e=>0===e.length?[]:p(e))).reduce(((e,t,n)=>0!==n&&u[n-1].length>0&&t.length>0&&!/^\s/.test(t[0])&&!/^\s|\s$/.test(r(e))?[...e.slice(0,-1),[...r(e),...t]]:[...e,t]),[]).map((e=>e.reduce(((e,t)=>e.length>0&&/\s$/.test(r(e))?[...e.slice(0,-1),r(e)+" "+t]:[...e,t]),[]))).map((e=>"never"===o.proseWrap?[e.join(" ")]:e)));function l(t){if("keep"===e.chomping)return 0===r(t).length?t.slice(0,-1):t;let n=0;for(let e=t.length-1;e>=0&&0===t[e].length;e--)n++;return 0===n?t:n>=2&&!s?t.slice(0,-(n-1)):t.slice(0,-n)}},getFlowScalarLineContents:function(e,t,n){let i=t.split("\n").map(((e,t,r)=>0===t&&t===r.length-1?e:0!==t&&t!==r.length-1?e.trim():0===t?e.trimEnd():e.trimStart()));return"preserve"===n.proseWrap?i.map((e=>0===e.length?[]:[e])):i.map((e=>0===e.length?[]:p(e))).reduce(((t,n,s)=>0!==s&&i[s-1].length>0&&n.length>0&&("quoteDouble"!==e||!r(r(t)).endsWith("\\"))?[...t.slice(0,-1),[...r(t),...n]]:[...t,n]),[]).map((e=>"never"===n.proseWrap?[e.join(" ")]:e))},getLastDescendantNode:function e(t){return n(t.children)?e(r(t.children)):t},hasPrettierIgnore:function(e){let t=e.getValue();if("documentBody"===t.type){let t=e.getParentNode();return c(t.head)&&s(r(t.head.endComments))}return o(t)&&s(r(t.leadingComments))},hasLeadingComments:o,hasMiddleComments:a,hasIndicatorComment:u,hasTrailingComment:l,hasEndComments:c}}}),es=y({"src/language-yaml/print-preprocess.js"(e,t){S();var{defineShortcut:r,mapNode:n}=Ki();function i(e){switch(e.type){case"document":r(e,"head",(()=>e.children[0])),r(e,"body",(()=>e.children[1]));break;case"documentBody":case"sequenceItem":case"flowSequenceItem":case"mappingKey":case"mappingValue":r(e,"content",(()=>e.children[0]));break;case"mappingItem":case"flowMappingItem":r(e,"key",(()=>e.children[0])),r(e,"value",(()=>e.children[1]))}return e}t.exports=function(e){return n(e,i)}}}),ts=y({"src/language-yaml/print/misc.js"(e,t){S();var{builders:{softline:r,align:n}}=V(),{hasEndComments:i,isNextLineEmpty:s,isNode:o}=Ki(),a=new WeakMap;function u(e){return i(e)&&!o(e,["documentHead","documentBody","flowMapping","flowSequence"])}t.exports={alignWithSpaces:function(e,t){return n(" ".repeat(e),t)},shouldPrintEndComments:u,printNextEmptyLine:function(e,t){let n,i=e.getValue(),o=e.stack[0];return a.has(o)?n=a.get(o):(n=new Set,a.set(o,n)),n.has(i.position.end.line)||(n.add(i.position.end.line),!s(i,t)||u(e.getParentNode()))?"":r}}}}),rs=y({"src/language-yaml/print/flow-mapping-sequence.js"(e,t){S();var{builders:{ifBreak:r,line:n,softline:i,hardline:s,join:o}}=V(),{isEmptyNode:a,getLast:u,hasEndComments:l}=Ki(),{printNextEmptyLine:c,alignWithSpaces:p}=ts();function h(e,t,c){let h=e.getValue(),f="flowMapping"===h.type,m=f?"{":"[",g=f?"}":"]",O=i;f&&h.children.length>0&&c.bracketSpacing&&(O=n);let D=u(h.children),y=D&&"flowMappingItem"===D.type&&a(D.key)&&a(D.value);return[m,p(c.tabWidth,[O,d(e,t,c),"none"===c.trailingComma?"":r(","),l(h)?[s,o(s,e.map(t,"endComments"))]:""]),y?"":O,g]}function d(e,t,r){let i=e.getValue();return e.map(((e,s)=>[t(),s===i.children.length-1?"":[",",n,i.children[s].position.start.line!==i.children[s+1].position.start.line?c(e,r.originalText):""]]),"children")}t.exports={printFlowMapping:h,printFlowSequence:h}}}),ns=y({"src/language-yaml/print/mapping-item.js"(e,t){S();var{builders:{conditionalGroup:r,group:n,hardline:i,ifBreak:s,join:o,line:a}}=V(),{hasLeadingComments:u,hasMiddleComments:l,hasTrailingComment:c,hasEndComments:p,isNode:h,isEmptyNode:d,isInlineNode:f}=Ki(),{alignWithSpaces:m}=ts();function g(e,t){if(!e)return!0;switch(e.type){case"plain":case"quoteSingle":case"quoteDouble":break;case"alias":return!0;default:return!1}if("preserve"===t.proseWrap)return e.position.start.line===e.position.end.line;if(/\\$/m.test(t.originalText.slice(e.position.start.offset,e.position.end.offset)))return!1;switch(t.proseWrap){case"never":return!e.value.includes("\n");case"always":return!/[\n ]/.test(e.value);default:return!1}}t.exports=function(e,t,O,D,y){let{key:v,value:b}=e,C=d(v),S=d(b);if(C&&S)return": ";let E=D("key"),x=function(e){return e.key.content&&"alias"===e.key.content.type}(e)?" ":"";if(S)return"flowMappingItem"===e.type&&"flowMapping"===t.type?E:"mappingItem"!==e.type||!g(v.content,y)||c(v.content)||t.tag&&"tag:yaml.org,2002:set"===t.tag.value?["? ",m(2,E)]:[E,x,":"];let w=D("value");if(C)return[": ",m(2,w)];if(u(b)||!f(v.content))return["? ",m(2,E),i,o("",O.map(D,"value","leadingComments").map((e=>[e,i]))),": ",m(2,w)];if(function(e){if(!e)return!0;switch(e.type){case"plain":case"quoteDouble":case"quoteSingle":return e.position.start.line===e.position.end.line;case"alias":return!0;default:return!1}}(v.content)&&!u(v.content)&&!l(v.content)&&!c(v.content)&&!p(v)&&!u(b.content)&&!l(b.content)&&!p(b)&&g(b.content,y))return[E,x,": ",w];let A=Symbol("mappingKey"),F=n([s("? "),n(m(2,E),{id:A})]),T=[i,": ",m(2,w)],k=[x,":"];u(b.content)||p(b)&&b.content&&!h(b.content,["mapping","sequence"])||"mapping"===t.type&&c(v.content)&&f(b.content)||h(b.content,["mapping","sequence"])&&null===b.content.tag&&null===b.content.anchor?k.push(i):b.content&&k.push(a),k.push(w);let P=m(y.tabWidth,k);return!g(v.content,y)||u(v.content)||l(v.content)||p(v)?r([[F,s(T,P,{groupId:A})]]):r([[E,P]])}}}),is=y({"src/language-yaml/print/block.js"(e,t){S();var{builders:{dedent:r,dedentToRoot:n,fill:i,hardline:s,join:o,line:a,literalline:u,markAsRoot:l},utils:{getDocParts:c}}=V(),{getAncestorCount:p,getBlockValueLineContents:h,hasIndicatorComment:d,isLastDescendantNode:f,isNode:m}=Ki(),{alignWithSpaces:g}=ts();t.exports=function(e,t,O){let D=e.getValue(),y=p(e,(e=>m(e,["sequence","mapping"]))),v=f(e),b=["blockFolded"===D.type?">":"|"];null!==D.indent&&b.push(D.indent.toString()),"clip"!==D.chomping&&b.push("keep"===D.chomping?"+":"-"),d(D)&&b.push(" ",t("indicatorComment"));let C=h(D,{parentIndent:y,isLastDescendant:v,options:O}),S=[];for(let[e,t]of C.entries())0===e&&S.push(s),S.push(i(c(o(a,t)))),e!==C.length-1?S.push(0===t.length?s:l(u)):"keep"===D.chomping&&v&&S.push(n(0===t.length?s:u));return null===D.indent?b.push(r(g(O.tabWidth,S))):b.push(n(g(D.indent-1+y,S))),b}}}),ss=y({"src/language-yaml/printer-yaml.js"(e,t){S();var{builders:{breakParent:r,fill:n,group:i,hardline:s,join:o,line:a,lineSuffix:u,literalline:l},utils:{getDocParts:c,replaceTextEndOfLine:p}}=V(),{isPreviousLineEmpty:h}=de(),{insertPragma:d,isPragma:f}=Gi(),{locStart:m}=Hi(),g=Ji(),{getFlowScalarLineContents:O,getLastDescendantNode:D,hasLeadingComments:y,hasMiddleComments:v,hasTrailingComment:b,hasEndComments:C,hasPrettierIgnore:E,isLastDescendantNode:x,isNode:w,isInlineNode:A}=Ki(),F=es(),{alignWithSpaces:T,printNextEmptyLine:k,shouldPrintEndComments:P}=ts(),{printFlowMapping:$,printFlowSequence:Q}=rs(),B=ns(),_=is();function N(e,t){return b(e)||t&&(t.head.children.length>0||C(t.head))}function R(e,t,r){let i=O(e,t,r);return o(s,i.map((e=>n(c(o(a,e))))))}t.exports={preprocess:F,embed:g,print:function(e,t,n){let a=e.getValue(),c=[];"mappingValue"!==a.type&&y(a)&&c.push([o(s,e.map(n,"leadingComments")),s]);let{tag:d,anchor:f}=a;d&&c.push(n("tag")),d&&f&&c.push(" "),f&&c.push(n("anchor"));let g="";w(a,["mapping","sequence","comment","directive","mappingItem","sequenceItem"])&&!x(e)&&(g=k(e,t.originalText)),(d||f)&&(w(a,["sequence","mapping"])&&!v(a)?c.push(s):c.push(" ")),v(a)&&c.push([1===a.middleComments.length?"":s,o(s,e.map(n,"middleComments")),s]);let O=e.getParentNode();return E(e)?c.push(p(t.originalText.slice(a.position.start.offset,a.position.end.offset).trimEnd(),l)):c.push(i(function(e,t,r,n,i){switch(e.type){case"root":{let{children:t}=e,n=[];r.each(((e,r)=>{let o=t[r],a=t[r+1];0!==r&&n.push(s),n.push(i()),N(o,a)?(n.push(s,"..."),b(o)&&n.push(" ",i("trailingComment"))):a&&!b(a.head)&&n.push(s,"---")}),"children");let o=D(e);return(!w(o,["blockLiteral","blockFolded"])||"keep"!==o.chomping)&&n.push(s),n}case"document":{let a=[];return"head"===function(e,t,r,n){return r.children[0]===e&&/---(?:\s|$)/.test(n.originalText.slice(m(e),m(e)+4))||e.head.children.length>0||C(e.head)||b(e.head)?"head":!N(e,t)&&!!t&&"root"}(e,t.children[r.getName()+1],t,n)&&((e.head.children.length>0||e.head.endComments.length>0)&&a.push(i("head")),b(e.head)?a.push(["---"," ",i(["head","trailingComment"])]):a.push("---")),function(e){return e.body.children.length>0||C(e.body)}(e)&&a.push(i("body")),o(s,a)}case"documentHead":return o(s,[...r.map(i,"children"),...r.map(i,"endComments")]);case"documentBody":{let{children:t,endComments:n}=e,a="";if(t.length>0&&n.length>0){let t=D(e);w(t,["blockFolded","blockLiteral"])?"keep"!==t.chomping&&(a=[s,s]):a=s}return[o(s,r.map(i,"children")),a,o(s,r.map(i,"endComments"))]}case"directive":return["%",o(" ",[e.name,...e.parameters])];case"comment":return["#",e.value];case"alias":return["*",e.value];case"tag":return n.originalText.slice(e.position.start.offset,e.position.end.offset);case"anchor":return["&",e.value];case"plain":return R(e.type,n.originalText.slice(e.position.start.offset,e.position.end.offset),n);case"quoteDouble":case"quoteSingle":{let t="'",r='"',i=n.originalText.slice(e.position.start.offset+1,e.position.end.offset-1);if("quoteSingle"===e.type&&i.includes("\\")||"quoteDouble"===e.type&&/\\[^"]/.test(i)){let s="quoteDouble"===e.type?r:t;return[s,R(e.type,i,n),s]}if(i.includes(r))return[t,R(e.type,"quoteDouble"===e.type?i.replace(/\\"/g,r).replace(/'/g,t.repeat(2)):i,n),t];if(i.includes(t))return[r,R(e.type,"quoteSingle"===e.type?i.replace(/''/g,t):i,n),r];let s=n.singleQuote?t:r;return[s,R(e.type,i,n),s]}case"blockFolded":case"blockLiteral":return _(r,i,n);case"mapping":case"sequence":return o(s,r.map(i,"children"));case"sequenceItem":return["- ",T(2,e.content?i("content"):"")];case"mappingKey":case"mappingValue":return e.content?i("content"):"";case"mappingItem":case"flowMappingItem":return B(e,t,r,i,n);case"flowMapping":return $(r,i,n);case"flowSequence":return Q(r,i,n);case"flowSequenceItem":return i("content");default:throw new Error(`Unexpected node type ${e.type}`)}}(a,O,e,t,n))),b(a)&&!w(a,["document","documentHead"])&&c.push(u(["mappingValue"!==a.type||a.content?" ":"","mappingKey"===O.type&&"mapping"===e.getParentNode(2).type&&A(a)?"":r,n("trailingComment")])),P(a)&&c.push(T("sequenceItem"===a.type?2:0,[s,o(s,e.map((e=>[h(t.originalText,e.getValue(),m)?s:"",n()]),"endComments"))])),c.push(g),c},massageAstNode:function(e,t){if(w(t))switch(delete t.position,t.type){case"comment":if(f(t.value))return null;break;case"quoteDouble":case"quoteSingle":t.type="quote"}},insertPragma:d}}}),os=y({"src/language-yaml/options.js"(e,t){S();var r=vn();t.exports={bracketSpacing:r.bracketSpacing,singleQuote:r.singleQuote,proseWrap:r.proseWrap}}}),as=y({"src/language-yaml/parsers.js"(){S()}}),us=y({"node_modules/linguist-languages/data/YAML.json"(e,t){t.exports={name:"YAML",type:"data",color:"#cb171e",tmScope:"source.yaml",aliases:["yml"],extensions:[".yml",".mir",".reek",".rviz",".sublime-syntax",".syntax",".yaml",".yaml-tmlanguage",".yaml.sed",".yml.mysql"],filenames:[".clang-format",".clang-tidy",".gemrc","CITATION.cff","glide.lock","yarn.lock"],aceMode:"yaml",codemirrorMode:"yaml",codemirrorMimeType:"text/x-yaml",languageId:407}}}),ls=y({"src/language-yaml/index.js"(e,t){S();var r=Jt(),n=ss(),i=os(),s=as(),o=[r(us(),(e=>({since:"1.14.0",parsers:["yaml"],vscodeLanguageIds:["yaml","ansible","home-assistant"],filenames:[...e.filenames.filter((e=>"yarn.lock"!==e)),".prettierrc",".stylelintrc",".lintstagedrc"]})))];t.exports={languages:o,printers:{yaml:n},options:i,parsers:s}}}),cs=y({"src/languages.js"(e,t){S(),t.exports=[Tn(),Yn(),ni(),ci(),Si(),Yi(),ls()]}});S();var{version:ps}=E(),hs=Gt(),{getSupportInfo:ds}=oe(),fs=Ht(),ms=cs(),gs=V();function Os(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return function(){for(var r=arguments.length,n=new Array(r),i=0;iDs(e,t).formatted,check(e,t){let{formatted:r}=Ds(e,t);return r===e},doc:gs,getSupportInfo:Os(ds,0),version:ps,util:fs,__debug:{parse:Os(hs.parse),formatAST:Os(hs.formatAST),formatDoc:Os(hs.formatDoc),printToDoc:Os(hs.printToDoc),printDocToString:Os(hs.printDocToString)}}}));return Ve()}()},HI7g:(e,t,r)=>{"use strict";var n=r("bgcN"),i=r("DCQ6"),s=r("cEeD");class o{constructor(e,t,r,n){this.state=e,this.pos=t,this.explicit=r,this.view=n,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let t=s.syntaxTree(this.state).resolveInner(this.pos,-1);for(;t&&e.indexOf(t.name)<0;)t=t.parent;return t?{from:t.from,to:this.pos,text:this.state.sliceDoc(t.from,this.pos),type:t.type}:null}matchBefore(e){let t=this.state.doc.lineAt(this.pos),r=Math.max(t.from,this.pos-250),n=t.text.slice(r-t.from,this.pos-t.from),i=n.search(p(e,!1));return i<0?null:{from:r+i,to:this.pos,text:n.slice(i)}}get aborted(){return null==this.abortListeners}addEventListener(e,t,r){"abort"==e&&this.abortListeners&&(this.abortListeners.push(t),r&&r.onDocChange&&(this.abortOnDocChange=!0))}}function a(e){let t=Object.keys(e).join(""),r=/\w/.test(t);return r&&(t=t.replace(/\w/g,"")),`[${r?"\\w":""}${t.replace(/[^\w\s]/g,"\\$&")}]`}function u(e){let t=e.map((e=>"string"==typeof e?{label:e}:e)),[r,n]=t.every((e=>/^\w+$/.test(e.label)))?[/\w*$/,/\w+$/]:function(e){let t=Object.create(null),r=Object.create(null);for(let{label:n}of e){t[n[0]]=!0;for(let e=1;e{let i=e.matchBefore(n);return i||e.explicit?{from:i?i.from:e.pos,options:t,validFor:r}:null}}class l{constructor(e,t,r,n){this.completion=e,this.source=t,this.match=r,this.score=n}}function c(e){return e.selection.main.from}function p(e,t){var r;let{source:n}=e,i=t&&"^"!=n[0],s="$"!=n[n.length-1];return i||s?new RegExp(`${i?"^":""}(?:${n})${s?"$":""}`,null!==(r=e.flags)&&void 0!==r?r:e.ignoreCase?"i":""):e}const h=n.Annotation.define();function d(e,t,r,i){let{main:s}=e.selection,o=r-s.from,a=i-s.from;return Object.assign(Object.assign({},e.changeByRange((u=>u!=s&&r!=i&&e.sliceDoc(u.from+o,u.from+a)!=e.sliceDoc(r,i)?{range:u}:{changes:{from:u.from+o,to:i==s.from?u.to:u.from+a,insert:t},range:n.EditorSelection.cursor(u.from+o+t.length)}))),{scrollIntoView:!0,userEvent:"input.complete"})}const f=new WeakMap;function m(e){if(!Array.isArray(e))return e;let t=f.get(e);return t||f.set(e,t=u(e)),t}const g=n.StateEffect.define(),O=n.StateEffect.define();class D{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let t=0;t=48&&l<=57||l>=97&&l<=122?2:l>=65&&l<=90?1:0:(y=n.fromCodePoint(l))!=y.toLowerCase()?1:y!=y.toUpperCase()?2:0;(!i||1==v&&g||0==D&&0!=v)&&(t[p]==l||r[p]==l&&(h=!0)?o[p++]=i:o.length&&(O=!1)),D=v,i+=n.codePointSize(l)}return p==u&&0==o[0]&&O?this.result((h?-200:0)-100,o,e):d==u&&0==f?this.ret(-200-e.length+(m==e.length?0:-100),[0,m]):a>-1?this.ret(-700-e.length,[a,a+this.pattern.length]):d==u?this.ret(-900-e.length,[f,m]):p==u?this.result((h?-200:0)-100-700+(O?0:-1100),o,e):2==t.length?null:this.result((i[0]?-700:0)-200-1100,i,e)}result(e,t,r){let i=[],s=0;for(let e of t){let t=e+(this.astral?n.codePointSize(n.codePointAt(r,e)):1);s&&i[s-1]==e?i[s-1]=t:(i[s++]=e,i[s++]=t)}return this.ret(e-r.length,i)}}class y{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.lengthn.combineConfig(e,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:C,filterStrict:!1,compareCompletions:(e,t)=>e.label.localeCompare(t.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,t)=>e&&t,closeOnBlur:(e,t)=>e&&t,icons:(e,t)=>e&&t,tooltipClass:(e,t)=>r=>b(e(r),t(r)),optionClass:(e,t)=>r=>b(e(r),t(r)),addToOptions:(e,t)=>e.concat(t),filterStrict:(e,t)=>e||t})});function b(e,t){return e?t?e+" "+t:e:t}function C(e,t,r,n,s,o){let a,u,l=e.textDirection==i.Direction.RTL,c=l,p=!1,h="top",d=t.left-s.left,f=s.right-t.right,m=n.right-n.left,g=n.bottom-n.top;if(c&&d=g||e>t.top?a=r.bottom-t.top:(h="bottom",a=t.bottom-r.top)}return{style:`${h}: ${a/((t.bottom-t.top)/o.offsetHeight)}px; max-width: ${u/((t.right-t.left)/o.offsetWidth)}px`,class:"cm-completionInfo-"+(p?l?"left-narrow":"right-narrow":c?"left":"right")}}function S(e,t,r){if(e<=r)return{from:0,to:e};if(t<0&&(t=0),t<=e>>1){let e=Math.floor(t/r);return{from:e*r,to:(e+1)*r}}let n=Math.floor((e-t)/r);return{from:e-(n+1)*r,to:e-n*r}}class E{constructor(e,t,r){this.view=e,this.stateField=t,this.applyCompletion=r,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:e=>this.placeInfo(e),key:this},this.space=null,this.currentClass="";let n=e.state.field(t),{options:i,selected:s}=n.open,o=e.state.facet(v);this.optionContent=function(e){let t=e.addToOptions.slice();return e.icons&&t.push({render(e){let t=document.createElement("div");return t.classList.add("cm-completionIcon"),e.type&&t.classList.add(...e.type.split(/\s+/g).map((e=>"cm-completionIcon-"+e))),t.setAttribute("aria-hidden","true"),t},position:20}),t.push({render(e,t,r,n){let i=document.createElement("span");i.className="cm-completionLabel";let s=e.displayLabel||e.label,o=0;for(let e=0;eo&&i.appendChild(document.createTextNode(s.slice(o,t)));let a=i.appendChild(document.createElement("span"));a.appendChild(document.createTextNode(s.slice(t,r))),a.className="cm-completionMatchedText",o=r}return oe.position-t.position)).map((e=>e.render))}(o),this.optionClass=o.optionClass,this.tooltipClass=o.tooltipClass,this.range=S(i.length,s,o.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",(r=>{let{options:n}=e.state.field(t).open;for(let t,i=r.target;i&&i!=this.dom;i=i.parentNode)if("LI"==i.nodeName&&(t=/-(\d+)$/.exec(i.id))&&+t[1]{let r=e.state.field(this.stateField,!1);r&&r.tooltip&&e.state.facet(v).closeOnBlur&&t.relatedTarget!=e.contentDOM&&e.dispatch({effects:O.of(null)})})),this.showOptions(i,n.id)}mount(){this.updateSel()}showOptions(e,t){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,t,this.range)),this.list.addEventListener("scroll",(()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)}))}update(e){var t;let r=e.state.field(this.stateField),n=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),r!=n){let{options:i,selected:s,disabled:o}=r.open;n.open&&n.open.options==i||(this.range=S(i.length,s,e.state.facet(v).maxRenderedOptions),this.showOptions(i,r.id)),this.updateSel(),o!=(null===(t=n.open)||void 0===t?void 0:t.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!o)}}updateTooltipClass(e){let t=this.tooltipClass(e);if(t!=this.currentClass){for(let e of this.currentClass.split(" "))e&&this.dom.classList.remove(e);for(let e of t.split(" "))e&&this.dom.classList.add(e);this.currentClass=t}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),t=e.open;if((t.selected>-1&&t.selected=this.range.to)&&(this.range=S(t.options.length,t.selected,this.view.state.facet(v).maxRenderedOptions),this.showOptions(t.options,e.id)),this.updateSelectedOption(t.selected)){this.destroyInfo();let{completion:r}=t.options[t.selected],{info:n}=r;if(!n)return;let s="string"==typeof n?document.createTextNode(n):n(r);if(!s)return;"then"in s?s.then((t=>{t&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(t,r)})).catch((e=>i.logException(this.view.state,e,"completion info"))):this.addInfoPane(s,r)}}addInfoPane(e,t){this.destroyInfo();let r=this.info=document.createElement("div");if(r.className="cm-tooltip cm-completionInfo",null!=e.nodeType)r.appendChild(e),this.infoDestroy=null;else{let{dom:t,destroy:n}=e;r.appendChild(t),this.infoDestroy=n||null}this.dom.appendChild(r),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let t=null;for(let r=this.list.firstChild,n=this.range.from;r;r=r.nextSibling,n++)"LI"==r.nodeName&&r.id?n==e?r.hasAttribute("aria-selected")||(r.setAttribute("aria-selected","true"),t=r):r.hasAttribute("aria-selected")&&r.removeAttribute("aria-selected"):n--;return t&&function(e,t){let r=e.getBoundingClientRect(),n=t.getBoundingClientRect(),i=r.height/e.offsetHeight;n.topr.bottom&&(e.scrollTop+=(n.bottom-r.bottom)/i)}(this.list,t),t}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let t=this.dom.getBoundingClientRect(),r=this.info.getBoundingClientRect(),n=e.getBoundingClientRect(),i=this.space;if(!i){let e=this.dom.ownerDocument.defaultView||window;i={left:0,top:0,right:e.innerWidth,bottom:e.innerHeight}}return n.top>Math.min(i.bottom,t.bottom)-10||n.bottomr.from||0==r.from)&&(i=e,"string"!=typeof u&&u.header?n.appendChild(u.header(u)):n.appendChild(document.createElement("completion-section")).textContent=e)}const l=n.appendChild(document.createElement("li"));l.id=t+"-"+s,l.setAttribute("role","option");let c=this.optionClass(o);c&&(l.className=c);for(let e of this.optionContent){let t=e(o,this.view.state,this.view,a);t&&l.appendChild(t)}}return r.from&&n.classList.add("cm-completionListIncompleteTop"),r.to=this.options.length?this:new w(this.options,k(t,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,t,r,n,i){let s=function(e,t){let r=[],n=null,i=e=>{r.push(e);let{section:t}=e.completion;if(t){n||(n=[]);let e="string"==typeof t?t:t.name;n.some((t=>t.name==e))||n.push("string"==typeof t?{name:e}:t)}},s=t.facet(v);for(let n of e)if(n.hasResult()){let e=n.result.getMatch;if(!1===n.result.filter)for(let t of n.result.options)i(new l(t,n.source,e?e(t):[],1e9-r.length));else{let r,o=t.sliceDoc(n.from,n.to),a=s.filterStrict?new y(o):new D(o);for(let t of n.result.options)if(r=a.match(t.label)){let s=t.displayLabel?e?e(t,r.matched):[]:r.matched;i(new l(t,n.source,s,r.score+(t.boost||0)))}}}if(n){let e=Object.create(null),t=0,i=(e,t)=>{var r,n;return(null!==(r=e.rank)&&void 0!==r?r:1e9)-(null!==(n=t.rank)&&void 0!==n?n:1e9)||(e.namet.score-e.score||u(e.completion,t.completion)))){let t=e.completion;!a||a.label!=t.label||a.detail!=t.detail||null!=a.type&&null!=t.type&&a.type!=t.type||a.apply!=t.apply||a.boost!=t.boost?o.push(e):x(e.completion)>x(a)&&(o[o.length-1]=e),a=e.completion}return o}(e,t);if(!s.length)return n&&e.some((e=>1==e.state))?new w(n.options,n.attrs,n.tooltip,n.timestamp,n.selected,!0):null;let o=t.facet(v).selectOnOpen?0:-1;if(n&&n.selected!=o&&-1!=n.selected){let e=n.options[n.selected].completion;for(let t=0;tt.hasResult()?Math.min(e,t.from):e),1e8),create:I,above:i.aboveCursor},n?n.timestamp:Date.now(),o,!1)}map(e){return new w(this.options,this.attrs,Object.assign(Object.assign({},this.tooltip),{pos:e.mapPos(this.tooltip.pos)}),this.timestamp,this.selected,this.disabled)}}class A{constructor(e,t,r){this.active=e,this.id=t,this.open=r}static start(){return new A(P,"cm-ac-"+Math.floor(2e6*Math.random()).toString(36),null)}update(e){let{state:t}=e,r=t.facet(v),n=(r.override||t.languageDataAt("autocomplete",c(t)).map(m)).map((t=>(this.active.find((e=>e.source==t))||new Q(t,this.active.some((e=>0!=e.state))?1:0)).update(e,r)));n.length==this.active.length&&n.every(((e,t)=>e==this.active[t]))&&(n=this.active);let i=this.open;i&&e.docChanged&&(i=i.map(e.changes)),e.selection||n.some((t=>t.hasResult()&&e.changes.touchesRange(t.from,t.to)))||!function(e,t){if(e==t)return!0;for(let r=0,n=0;;){for(;r1==e.state))&&(i=null),!i&&n.every((e=>1!=e.state))&&n.some((e=>e.hasResult()))&&(n=n.map((e=>e.hasResult()?new Q(e.source,0):e)));for(let t of e.effects)t.is(N)&&(i=i&&i.setSelected(t.value,this.id));return n==this.active&&i==this.open?this:new A(n,this.id,i)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?F:T}}const F={"aria-autocomplete":"list"},T={};function k(e,t){let r={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":e};return t>-1&&(r["aria-activedescendant"]=e+"-"+t),r}const P=[];function $(e,t){if(e.isUserEvent("input.complete")){let r=e.annotation(h);if(r&&t.activateOnCompletion(r))return 12}let r=e.isUserEvent("input.type");return r&&t.activateOnTyping?5:r?1:e.isUserEvent("delete.backward")?2:e.selection?8:e.docChanged?16:0}class Q{constructor(e,t,r=-1){this.source=e,this.state=t,this.explicitPos=r}hasResult(){return!1}update(e,t){let r=$(e,t),n=this;(8&r||16&r&&this.touches(e))&&(n=new Q(n.source,0)),4&r&&0==n.state&&(n=new Q(this.source,1)),n=n.updateFor(e,r);for(let t of e.effects)if(t.is(g))n=new Q(n.source,1,t.value?c(e.state):-1);else if(t.is(O))n=new Q(n.source,0);else if(t.is(_))for(let e of t.value)e.source==n.source&&(n=e);return n}updateFor(e,t){return this.map(e.changes)}map(e){return e.empty||this.explicitPos<0?this:new Q(this.source,this.state,e.mapPos(this.explicitPos))}touches(e){return e.changes.touchesRange(c(e.state))}}class B extends Q{constructor(e,t,r,n,i){super(e,2,t),this.result=r,this.from=n,this.to=i}hasResult(){return!0}updateFor(e,t){var r;if(!(3&t))return this.map(e.changes);let n=this.result;n.map&&!e.changes.empty&&(n=n.map(n,e.changes));let i=e.changes.mapPos(this.from),s=e.changes.mapPos(this.to,1),a=c(e.state);if((this.explicitPos<0?a<=i:as||!n||2&t&&c(e.startState)==this.from)return new Q(this.source,4&t?1:0);let u=this.explicitPos<0?-1:e.changes.mapPos(this.explicitPos);return function(e,t,r,n){if(!e)return!1;let i=t.sliceDoc(r,n);return"function"==typeof e?e(i,r,n,t):p(e,!0).test(i)}(n.validFor,e.state,i,s)?new B(this.source,u,n,i,s):n.update&&(n=n.update(n,i,s,new o(e.state,a,u>=0)))?new B(this.source,u,n,n.from,null!==(r=n.to)&&void 0!==r?r:c(e.state)):new Q(this.source,1,u)}map(e){return e.empty?this:(this.result.map?this.result.map(this.result,e):this.result)?new B(this.source,this.explicitPos<0?-1:e.mapPos(this.explicitPos),this.result,e.mapPos(this.from),e.mapPos(this.to,1)):new Q(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}}const _=n.StateEffect.define({map:(e,t)=>e.map((e=>e.map(t)))}),N=n.StateEffect.define(),R=n.StateField.define({create:()=>A.start(),update:(e,t)=>e.update(t),provide:e=>[i.showTooltip.from(e,(e=>e.tooltip)),i.EditorView.contentAttributes.from(e,(e=>e.attrs))]});function M(e,t){const r=t.completion.apply||t.completion.label;let n=e.state.field(R).active.find((e=>e.source==t.source));return n instanceof B&&("string"==typeof r?e.dispatch(Object.assign(Object.assign({},d(e.state,r,n.from,n.to)),{annotations:h.of(t.completion)})):r(e,t.completion,n.from,n.to),!0)}const I=function(e,t){return r=>new E(r,e,t)}(R,M);function j(e,t="option"){return r=>{let n=r.state.field(R,!1);if(!n||!n.open||n.open.disabled||Date.now()-n.open.timestamp-1?n.open.selected+o*(e?1:-1):e?0:a-1;return u<0?u="page"==t?0:a-1:u>=a&&(u="page"==t?a-1:0),r.dispatch({effects:N.of(u)}),!0}}const L=e=>{let t=e.state.field(R,!1);return!(e.state.readOnly||!t||!t.open||t.open.selected<0||t.open.disabled||Date.now()-t.open.timestamp!!e.state.field(R,!1)&&(e.dispatch({effects:g.of(!0)}),!0),X=e=>{let t=e.state.field(R,!1);return!(!t||!t.active.some((e=>0!=e.state))||(e.dispatch({effects:O.of(null)}),0))};class V{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}}const q=i.ViewPlugin.fromClass(class{constructor(e){this.view=e,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let t of e.state.field(R).active)1==t.state&&this.startQuery(t)}update(e){let t=e.state.field(R),r=e.state.facet(v);if(!e.selectionSet&&!e.docChanged&&e.startState.field(R)==t)return;let n=e.transactions.some((e=>{let t=$(e,r);return 8&t||(e.selection||e.docChanged)&&!(3&t)}));for(let t=0;t50&&Date.now()-r.time>1e3){for(let e of r.context.abortListeners)try{e()}catch(e){i.logException(this.view.state,e)}r.context.abortListeners=null,this.running.splice(t--,1)}else r.updates.push(...e.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),e.transactions.some((e=>e.effects.some((e=>e.is(g)))))&&(this.pendingStart=!0);let s=this.pendingStart?50:r.activateOnTypingDelay;if(this.debounceUpdate=t.active.some((e=>1==e.state&&!this.running.some((t=>t.active.source==e.source))))?setTimeout((()=>this.startUpdate()),s):-1,0!=this.composing)for(let t of e.transactions)t.isUserEvent("input.type")?this.composing=2:2==this.composing&&t.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:e}=this.view,t=e.field(R);for(let e of t.active)1!=e.state||this.running.some((t=>t.active.source==e.source))||this.startQuery(e)}startQuery(e){let{state:t}=this.view,r=c(t),n=new o(t,r,e.explicitPos==r,this.view),s=new V(e,n);this.running.push(s),Promise.resolve(e.source(n)).then((e=>{s.context.aborted||(s.done=e||null,this.scheduleAccept())}),(e=>{this.view.dispatch({effects:O.of(null)}),i.logException(this.view.state,e)}))}scheduleAccept(){this.running.every((e=>void 0!==e.done))?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout((()=>this.accept()),this.view.state.facet(v).updateSyncTime))}accept(){var e;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let t=[],r=this.view.state.facet(v);for(let n=0;ne.source==i.active.source));if(s&&1==s.state)if(null==i.done){let e=new Q(i.active.source,0);for(let t of i.updates)e=e.update(t,r);1!=e.state&&t.push(e)}else this.startQuery(s)}t.length&&this.view.dispatch({effects:_.of(t)})}},{eventHandlers:{blur(e){let t=this.view.state.field(R,!1);if(t&&t.tooltip&&this.view.state.facet(v).closeOnBlur){let r=t.open&&i.getTooltip(this.view,t.open.tooltip);r&&r.dom.contains(e.relatedTarget)||setTimeout((()=>this.view.dispatch({effects:O.of(null)})),10)}},compositionstart(){this.composing=1},compositionend(){3==this.composing&&setTimeout((()=>this.view.dispatch({effects:g.of(!1)})),20),this.composing=0}}}),W="object"==typeof navigator&&/Win/.test(navigator.platform),U=n.Prec.highest(i.EditorView.domEventHandlers({keydown(e,t){let r=t.state.field(R,!1);if(!r||!r.open||r.open.disabled||r.open.selected<0||e.key.length>1||e.ctrlKey&&(!W||!e.altKey)||e.metaKey)return!1;let n=r.open.options[r.open.selected],i=r.active.find((e=>e.source==n.source)),s=n.completion.commitCharacters||i.result.commitCharacters;return s&&s.indexOf(e.key)>-1&&M(t,n),!1}})),z=i.EditorView.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});class Y{constructor(e,t,r,n){this.field=e,this.line=t,this.from=r,this.to=n}}class G{constructor(e,t,r){this.field=e,this.from=t,this.to=r}map(e){let t=e.mapPos(this.from,-1,n.MapMode.TrackDel),r=e.mapPos(this.to,1,n.MapMode.TrackDel);return null==t||null==r?null:new G(this.field,t,r)}}class H{constructor(e,t){this.lines=e,this.fieldPositions=t}instantiate(e,t){let r=[],n=[t],i=e.doc.lineAt(t),o=/^\s*/.exec(i.text)[0];for(let i of this.lines){if(r.length){let r=o,a=/^\t*/.exec(i)[0].length;for(let t=0;tnew G(e.field,n[e.line]+e.from,n[e.line]+e.to)));return{text:r,ranges:a}}static parse(e){let t,r=[],n=[],i=[];for(let s of e.split(/\r\n?|\n/)){for(;t=/[#$]\{(?:(\d+)(?::([^}]*))?|((?:\\[{}]|[^}])*))\}/.exec(s);){let e=t[1]?+t[1]:null,o=t[2]||t[3]||"",a=-1,u=o.replace(/\\[{}]/g,(e=>e[1]));for(let t=0;t=a&&e.field++}i.push(new Y(a,n.length,t.index,t.index+u.length)),s=s.slice(0,t.index)+o+s.slice(t.index+t[0].length)}s=s.replace(/\\([{}])/g,((e,t,r)=>{for(let e of i)e.line==n.length&&e.from>r&&(e.from--,e.to--);return t})),n.push(s)}return new H(n,i)}}let J=i.Decoration.widget({widget:new class extends i.WidgetType{toDOM(){let e=document.createElement("span");return e.className="cm-snippetFieldPosition",e}ignoreEvent(){return!1}}}),K=i.Decoration.mark({class:"cm-snippetField"});class ee{constructor(e,t){this.ranges=e,this.active=t,this.deco=i.Decoration.set(e.map((e=>(e.from==e.to?J:K).range(e.from,e.to))))}map(e){let t=[];for(let r of this.ranges){let n=r.map(e);if(!n)return null;t.push(n)}return new ee(t,this.active)}selectionInsideField(e){return e.ranges.every((e=>this.ranges.some((t=>t.field==this.active&&t.from<=e.from&&t.to>=e.to))))}}const te=n.StateEffect.define({map:(e,t)=>e&&e.map(t)}),re=n.StateEffect.define(),ne=n.StateField.define({create:()=>null,update(e,t){for(let r of t.effects){if(r.is(te))return r.value;if(r.is(re)&&e)return new ee(e.ranges,r.value)}return e&&t.docChanged&&(e=e.map(t.changes)),e&&t.selection&&!e.selectionInsideField(t.selection)&&(e=null),e},provide:e=>i.EditorView.decorations.from(e,(e=>e?e.deco:i.Decoration.none))});function ie(e,t){return n.EditorSelection.create(e.filter((e=>e.field==t)).map((e=>n.EditorSelection.range(e.from,e.to))))}function se(e){let t=H.parse(e);return(e,r,i,s)=>{let{text:o,ranges:a}=t.instantiate(e.state,i),u={changes:{from:i,to:s,insert:n.Text.of(o)},scrollIntoView:!0,annotations:r?[h.of(r),n.Transaction.userEvent.of("input.complete")]:void 0};if(a.length&&(u.selection=ie(a,0)),a.some((e=>e.field>0))){let t=new ee(a,0),r=u.effects=[te.of(t)];void 0===e.state.field(ne,!1)&&r.push(n.StateEffect.appendConfig.of([ne,he,de,z]))}e.dispatch(e.state.update(u))}}function oe(e){return({state:t,dispatch:r})=>{let n=t.field(ne,!1);if(!n||e<0&&0==n.active)return!1;let i=n.active+e,s=e>0&&!n.ranges.some((t=>t.field==i+e));return r(t.update({selection:ie(n.ranges,i),effects:te.of(s?null:new ee(n.ranges,i)),scrollIntoView:!0})),!0}}const ae=({state:e,dispatch:t})=>!!e.field(ne,!1)&&(t(e.update({effects:te.of(null)})),!0),ue=oe(1),le=oe(-1),ce=[{key:"Tab",run:ue,shift:le},{key:"Escape",run:ae}],pe=n.Facet.define({combine:e=>e.length?e[0]:ce}),he=n.Prec.highest(i.keymap.compute([pe],(e=>e.facet(pe)))),de=i.EditorView.domEventHandlers({mousedown(e,t){let r,n=t.state.field(ne,!1);if(!n||null==(r=t.posAtCoords({x:e.clientX,y:e.clientY})))return!1;let i=n.ranges.find((e=>e.from<=r&&e.to>=r));return!(!i||i.field==n.active||(t.dispatch({selection:ie(n.ranges,i.field),effects:te.of(n.ranges.some((e=>e.field>i.field))?new ee(n.ranges,i.field):null),scrollIntoView:!0}),0))}});function fe(e,t){return new RegExp(t(e.source),e.unicode?"u":"")}const me=Object.create(null);function ge(e,t,r,n,i){for(let s=e.iterLines(),o=0;!s.next().done;){let e,{value:a}=s;for(t.lastIndex=0;e=t.exec(a);)if(!n[e[0]]&&o+e.index!=i&&(r.push({type:"text",label:e[0]}),n[e[0]]=!0,r.length>=2e3))return;o+=a.length+1}}function Oe(e,t,r,n,i){let s=e.length>=1e3,o=s&&t.get(e);if(o)return o;let a=[],u=Object.create(null);if(e.children){let s=0;for(let o of e.children){if(o.length>=1e3)for(let e of Oe(o,t,r,n-s,i-s))u[e.label]||(u[e.label]=!0,a.push(e));else ge(o,r,a,u,i-s);s+=o.length+1}}else ge(e,r,a,u,i);return s&&a.length<2e3&&t.set(e,a),a}const De={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},ye=n.StateEffect.define({map(e,t){let r=t.mapPos(e,-1,n.MapMode.TrackAfter);return null==r?void 0:r}}),ve=new class extends n.RangeValue{};ve.startSide=1,ve.endSide=-1;const be=n.StateField.define({create:()=>n.RangeSet.empty,update(e,t){if(e=e.map(t.changes),t.selection){let r=t.state.doc.lineAt(t.selection.main.head);e=e.update({filter:e=>e>=r.from&&e<=r.to})}for(let r of t.effects)r.is(ye)&&(e=e.update({add:[ve.range(r.value,r.value+1)]}));return e}}),Ce="()[]{}<>";function Se(e){for(let t=0;t{if((xe?e.composing:e.compositionStarted)||e.state.readOnly)return!1;let s=e.state.selection.main;if(i.length>2||2==i.length&&1==n.codePointSize(n.codePointAt(i,0))||t!=s.from||r!=s.to)return!1;let o=Te(e.state,i);return!!o&&(e.dispatch(o),!0)})),Ae=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let r=Ee(e,e.selection.main.head).brackets||De.brackets,i=null,s=e.changeByRange((t=>{if(t.empty){let i=function(e,t){let r=e.sliceString(t-2,t);return n.codePointSize(n.codePointAt(r,0))==r.length?r:r.slice(1)}(e.doc,t.head);for(let s of r)if(s==i&&Pe(e.doc,t.head)==Se(n.codePointAt(s,0)))return{changes:{from:t.head-s.length,to:t.head+s.length},range:n.EditorSelection.cursor(t.head-s.length)}}return{range:i=t}}));return i||t(e.update(s,{scrollIntoView:!0,userEvent:"delete.backward"})),!i},Fe=[{key:"Backspace",run:Ae}];function Te(e,t){let r=Ee(e,e.selection.main.head),i=r.brackets||De.brackets;for(let s of i){let o=Se(n.codePointAt(s,0));if(t==s)return o==s?Be(e,s,i.indexOf(s+s+s)>-1,r):$e(e,s,o,r.before||De.before);if(t==o&&ke(e,e.selection.main.from))return Qe(e,0,o)}return null}function ke(e,t){let r=!1;return e.field(be).between(0,e.doc.length,(e=>{e==t&&(r=!0)})),r}function Pe(e,t){let r=e.sliceString(t,t+2);return r.slice(0,n.codePointSize(n.codePointAt(r,0)))}function $e(e,t,r,i){let s=null,o=e.changeByRange((o=>{if(!o.empty)return{changes:[{insert:t,from:o.from},{insert:r,from:o.to}],effects:ye.of(o.to+t.length),range:n.EditorSelection.range(o.anchor+t.length,o.head+t.length)};let a=Pe(e.doc,o.head);return!a||/\s/.test(a)||i.indexOf(a)>-1?{changes:{insert:t+r,from:o.head},effects:ye.of(o.head+t.length),range:n.EditorSelection.cursor(o.head+t.length)}:{range:s=o}}));return s?null:e.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function Qe(e,t,r){let i=null,s=e.changeByRange((t=>t.empty&&Pe(e.doc,t.head)==r?{changes:{from:t.head,to:t.head+r.length,insert:r},range:n.EditorSelection.cursor(t.head+r.length)}:i={range:t}));return i?null:e.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function Be(e,t,r,i){let o=i.stringPrefixes||De.stringPrefixes,a=null,u=e.changeByRange((i=>{if(!i.empty)return{changes:[{insert:t,from:i.from},{insert:t,from:i.to}],effects:ye.of(i.to+t.length),range:n.EditorSelection.range(i.anchor+t.length,i.head+t.length)};let u,l=i.head,c=Pe(e.doc,l);if(c==t){if(_e(e,l))return{changes:{insert:t+t,from:l},effects:ye.of(l+t.length),range:n.EditorSelection.cursor(l+t.length)};if(ke(e,l)){let i=r&&e.sliceDoc(l,l+3*t.length)==t+t+t?t+t+t:t;return{changes:{from:l,to:l+i.length,insert:i},range:n.EditorSelection.cursor(l+i.length)}}}else{if(r&&e.sliceDoc(l-2*t.length,l)==t+t&&(u=Ne(e,l-2*t.length,o))>-1&&_e(e,u))return{changes:{insert:t+t+t+t,from:l},effects:ye.of(l+t.length),range:n.EditorSelection.cursor(l+t.length)};if(e.charCategorizer(l)(c)!=n.CharCategory.Word&&Ne(e,l,o)>-1&&!function(e,t,r,n){let i=s.syntaxTree(e).resolveInner(t,-1),o=n.reduce(((e,t)=>Math.max(e,t.length)),0);for(let s=0;s<5;s++){let s=e.sliceDoc(i.from,Math.min(i.to,i.from+r.length+o)),a=s.indexOf(r);if(!a||a>-1&&n.indexOf(s.slice(0,a))>-1){let t=i.firstChild;for(;t&&t.from==i.from&&t.to-t.from>r.length+a;){if(e.sliceDoc(t.to-r.length,t.to)==r)return!1;t=t.firstChild}return!0}let u=i.to==t&&i.parent;if(!u)break;i=u}return!1}(e,l,t,o))return{changes:{insert:t+t,from:l},effects:ye.of(l+t.length),range:n.EditorSelection.cursor(l+t.length)}}return{range:a=i}}));return a?null:e.update(u,{scrollIntoView:!0,userEvent:"input.type"})}function _e(e,t){let r=s.syntaxTree(e).resolveInner(t+1);return r.parent&&r.from==t}function Ne(e,t,r){let i=e.charCategorizer(t);if(i(e.sliceDoc(t-1,t))!=n.CharCategory.Word)return t;for(let s of r){let r=t-s.length;if(e.sliceDoc(r,t)==s&&i(e.sliceDoc(r-1,r))!=n.CharCategory.Word)return r}return-1}const Re=[{key:"Ctrl-Space",run:Z},{key:"Escape",run:X},{key:"ArrowDown",run:j(!0)},{key:"ArrowUp",run:j(!1)},{key:"PageDown",run:j(!0,"page")},{key:"PageUp",run:j(!1,"page")},{key:"Enter",run:L}],Me=n.Prec.highest(i.keymap.computeN([v],(e=>e.facet(v).defaultKeymap?[Re]:[]))),Ie=new WeakMap;t.CompletionContext=o,t.acceptCompletion=L,t.autocompletion=function(e={}){return[U,R,v.of(e),q,Me,z]},t.clearSnippet=ae,t.closeBrackets=function(){return[we,be]},t.closeBracketsKeymap=Fe,t.closeCompletion=X,t.completeAnyWord=e=>{let t=e.state.languageDataAt("wordChars",e.pos).join(""),r=function(e){let t=e.replace(/[\]\-\\]/g,"\\$&");try{return new RegExp(`[\\p{Alphabetic}\\p{Number}_${t}]+`,"ug")}catch(e){return new RegExp(`[w${t}]`,"g")}}(t),n=e.matchBefore(fe(r,(e=>e+"$")));if(!n&&!e.explicit)return null;let i=n?n.from:e.pos,s=Oe(e.state.doc,function(e){return me[e]||(me[e]=new WeakMap)}(t),r,5e4,i);return{from:i,options:s,validFor:fe(r,(e=>"^"+e))}},t.completeFromList=u,t.completionKeymap=Re,t.completionStatus=function(e){let t=e.field(R,!1);return t&&t.active.some((e=>1==e.state))?"pending":t&&t.active.some((e=>0!=e.state))?"active":null},t.currentCompletions=function(e){var t;let r=null===(t=e.field(R,!1))||void 0===t?void 0:t.open;if(!r||r.disabled)return[];let n=Ie.get(r.options);return n||Ie.set(r.options,n=r.options.map((e=>e.completion))),n},t.deleteBracketPair=Ae,t.hasNextSnippetField=function(e){let t=e.field(ne,!1);return!(!t||!t.ranges.some((e=>e.field==t.active+1)))},t.hasPrevSnippetField=function(e){let t=e.field(ne,!1);return!!(t&&t.active>0)},t.ifIn=function(e,t){return r=>{for(let n=s.syntaxTree(r.state).resolveInner(r.pos,-1);n;n=n.parent){if(e.indexOf(n.name)>-1)return t(r);if(n.type.isTop)break}return null}},t.ifNotIn=function(e,t){return r=>{for(let t=s.syntaxTree(r.state).resolveInner(r.pos,-1);t;t=t.parent){if(e.indexOf(t.name)>-1)return null;if(t.type.isTop)break}return t(r)}},t.insertBracket=Te,t.insertCompletionText=d,t.moveCompletionSelection=j,t.nextSnippetField=ue,t.pickedCompletion=h,t.prevSnippetField=le,t.selectedCompletion=function(e){var t;let r=null===(t=e.field(R,!1))||void 0===t?void 0:t.open;return r&&!r.disabled&&r.selected>=0?r.options[r.selected].completion:null},t.selectedCompletionIndex=function(e){var t;let r=null===(t=e.field(R,!1))||void 0===t?void 0:t.open;return r&&!r.disabled&&r.selected>=0?r.selected:null},t.setSelectedCompletion=function(e){return N.of(e)},t.snippet=se,t.snippetCompletion=function(e,t){return Object.assign(Object.assign({},t),{apply:se(e)})},t.snippetKeymap=pe,t.startCompletion=Z},oIhD:(e,t,r)=>{"use strict";var n=r("bgcN"),i=r("DCQ6"),s=r("cEeD"),o=r("G5nY");const a=e=>{let{state:t}=e,r=t.doc.lineAt(t.selection.main.from),n=g(e.state,r.from);return n.line?l(e):!!n.block&&m(e)};function u(e,t){return({state:r,dispatch:n})=>{if(r.readOnly)return!1;let i=e(t,r);return!!i&&(n(r.update(i)),!0)}}const l=u(y,0),c=u(y,1),p=u(y,2),h=u(D,0),d=u(D,1),f=u(D,2),m=u(((e,t)=>D(e,t,function(e){let t=[];for(let r of e.selection.ranges){let n=e.doc.lineAt(r.from),i=r.to<=n.to?n:e.doc.lineAt(r.to),s=t.length-1;s>=0&&t[s].to>n.from?t[s].to=i.to:t.push({from:n.from+/^\s*/.exec(n.text)[0].length,to:i.to})}return t}(t))),0);function g(e,t){let r=e.languageDataAt("commentTokens",t);return r.length?r[0]:{}}const O=50;function D(e,t,r=t.selection.ranges){let n=r.map((e=>g(t,e.from).block));if(!n.every((e=>e)))return null;let i=r.map(((e,r)=>function(e,{open:t,close:r},n,i){let s,o,a=e.sliceDoc(n-O,n),u=e.sliceDoc(i,i+O),l=/\s*$/.exec(a)[0].length,c=/^\s*/.exec(u)[0].length,p=a.length-l;if(a.slice(p-t.length,p)==t&&u.slice(c,c+r.length)==r)return{open:{pos:n-l,margin:l&&1},close:{pos:i+c,margin:c&&1}};i-n<=2*O?s=o=e.sliceDoc(n,i):(s=e.sliceDoc(n,n+O),o=e.sliceDoc(i-O,i));let h=/^\s*/.exec(s)[0].length,d=/\s*$/.exec(o)[0].length,f=o.length-d-r.length;return s.slice(h,h+t.length)==t&&o.slice(f,f+r.length)==r?{open:{pos:n+h+t.length,margin:/\s/.test(s.charAt(h+t.length))?1:0},close:{pos:i-d-r.length,margin:/\s/.test(o.charAt(f-1))?1:0}}:null}(t,n[r],e.from,e.to)));if(2!=e&&!i.every((e=>e)))return{changes:t.changes(r.map(((e,t)=>i[t]?[]:[{from:e.from,insert:n[t].open+" "},{from:e.to,insert:" "+n[t].close}])))};if(1!=e&&i.some((e=>e))){let e=[];for(let t,r=0;ri&&(e==s||s>u.from)){i=u.from;let e=/^\s*/.exec(u.text)[0].length,t=e==u.length,r=u.text.slice(e,e+a.length)==a?e:-1;ee.comment<0&&(!e.empty||e.single)))){let e=[];for(let{line:t,token:r,indent:i,empty:s,single:o}of n)!o&&s||e.push({from:t.from+i,insert:r+" "});let r=t.changes(e);return{changes:r,selection:t.selection.map(r,1)}}if(1!=e&&n.some((e=>e.comment>=0))){let e=[];for(let{line:t,comment:r,token:i}of n)if(r>=0){let n=t.from+r,s=n+i.length;" "==t.text[s-t.from]&&s++,e.push({from:n,to:s})}return{changes:e}}return null}const v=n.Annotation.define(),b=n.Annotation.define(),C=n.Facet.define(),S=n.Facet.define({combine:e=>n.combineConfig(e,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(r,n)=>e(r,n)||t(r,n)})}),E=n.StateField.define({create:()=>V.empty,update(e,t){let r=t.state.facet(S),i=t.annotation(v);if(i){let n=B.fromTransaction(t,i.selection),s=i.side,o=0==s?e.undone:e.done;return o=n?_(o,o.length,r.minDepth,n):I(o,t.startState.selection),new V(0==s?i.rest:o,0==s?o:i.rest)}let s=t.annotation(b);if("full"!=s&&"before"!=s||(e=e.isolate()),!1===t.annotation(n.Transaction.addToHistory))return t.changes.empty?e:e.addMapping(t.changes.desc);let o=B.fromTransaction(t),a=t.annotation(n.Transaction.time),u=t.annotation(n.Transaction.userEvent);return o?e=e.addChanges(o,a,u,r,t):t.selection&&(e=e.addSelection(t.startState.selection,a,u,r.newGroupDelay)),"full"!=s&&"after"!=s||(e=e.isolate()),e},toJSON:e=>({done:e.done.map((e=>e.toJSON())),undone:e.undone.map((e=>e.toJSON()))}),fromJSON:e=>new V(e.done.map(B.fromJSON),e.undone.map(B.fromJSON))}),x=E;function w(e,t){return function({state:r,dispatch:n}){if(!t&&r.readOnly)return!1;let i=r.field(E,!1);if(!i)return!1;let s=i.pop(e,r,t);return!!s&&(n(s),!0)}}const A=w(0,!1),F=w(1,!1),T=w(0,!0),k=w(1,!0);function P(e){return function(t){let r=t.field(E,!1);if(!r)return 0;let n=0==e?r.done:r.undone;return n.length-(n.length&&!n[0].changes?1:0)}}const $=P(0),Q=P(1);class B{constructor(e,t,r,n,i){this.changes=e,this.effects=t,this.mapped=r,this.startSelection=n,this.selectionsAfter=i}setSelAfter(e){return new B(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,r;return{changes:null===(e=this.changes)||void 0===e?void 0:e.toJSON(),mapped:null===(t=this.mapped)||void 0===t?void 0:t.toJSON(),startSelection:null===(r=this.startSelection)||void 0===r?void 0:r.toJSON(),selectionsAfter:this.selectionsAfter.map((e=>e.toJSON()))}}static fromJSON(e){return new B(e.changes&&n.ChangeSet.fromJSON(e.changes),[],e.mapped&&n.ChangeDesc.fromJSON(e.mapped),e.startSelection&&n.EditorSelection.fromJSON(e.startSelection),e.selectionsAfter.map(n.EditorSelection.fromJSON))}static fromTransaction(e,t){let r=R;for(let t of e.startState.facet(C)){let n=t(e);n.length&&(r=r.concat(n))}return!r.length&&e.changes.empty?null:new B(e.changes.invert(e.startState.doc),r,void 0,t||e.startState.selection,R)}static selection(e){return new B(void 0,R,void 0,void 0,e)}}function _(e,t,r,n){let i=t+1>r+20?t-r-1:0,s=e.slice(i,t);return s.push(n),s}function N(e,t){return e.length?t.length?e.concat(t):e:t}const R=[],M=200;function I(e,t){if(e.length){let r=e[e.length-1],n=r.selectionsAfter.slice(Math.max(0,r.selectionsAfter.length-M));return n.length&&n[n.length-1].eq(t)?e:(n.push(t),_(e,e.length-1,1e9,r.setSelAfter(n)))}return[B.selection([t])]}function j(e){let t=e[e.length-1],r=e.slice();return r[e.length-1]=t.setSelAfter(t.selectionsAfter.slice(0,t.selectionsAfter.length-1)),r}function L(e,t){if(!e.length)return e;let r=e.length,n=R;for(;r;){let i=Z(e[r-1],t,n);if(i.changes&&!i.changes.empty||i.effects.length){let t=e.slice(0,r);return t[r-1]=i,t}t=i.mapped,r--,n=i.selectionsAfter}return n.length?[B.selection(n)]:R}function Z(e,t,r){let i=N(e.selectionsAfter.length?e.selectionsAfter.map((e=>e.map(t))):R,r);if(!e.changes)return B.selection(i);let s=e.changes.map(t),o=t.mapDesc(e.changes,!0),a=e.mapped?e.mapped.composeDesc(o):o;return new B(s,n.StateEffect.mapEffects(e.effects,t),a,e.startSelection.map(o),i)}const X=/^(input\.type|delete)($|\.)/;class V{constructor(e,t,r=0,n=void 0){this.done=e,this.undone=t,this.prevTime=r,this.prevUserEvent=n}isolate(){return this.prevTime?new V(this.done,this.undone):this}addChanges(e,t,r,i,s){let o=this.done,a=o[o.length-1];return o=a&&a.changes&&!a.changes.empty&&e.changes&&(!r||X.test(r))&&(!a.selectionsAfter.length&&t-this.prevTimer.push(e,t))),t.iterChangedRanges(((e,t,i,s)=>{for(let e=0;e=t&&i<=o&&(n=!0)}})),n}(a.changes,e.changes))||"input.type.compose"==r)?_(o,o.length-1,i.minDepth,new B(e.changes.compose(a.changes),N(n.StateEffect.mapEffects(e.effects,a.changes),a.effects),a.mapped,a.startSelection,R)):_(o,o.length,i.minDepth,e),new V(o,R,t,r)}addSelection(e,t,r,n){let i=this.done.length?this.done[this.done.length-1].selectionsAfter:R;return i.length>0&&t-this.prevTimee.empty!=o.ranges[t].empty)).length)?this:new V(I(this.done,e),this.undone,t,r);var s,o}addMapping(e){return new V(L(this.done,e),L(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,t,r){let n=0==e?this.done:this.undone;if(0==n.length)return null;let i=n[n.length-1],s=i.selectionsAfter[0]||t.selection;if(r&&i.selectionsAfter.length)return t.update({selection:i.selectionsAfter[i.selectionsAfter.length-1],annotations:v.of({side:e,rest:j(n),selection:s}),userEvent:0==e?"select.undo":"select.redo",scrollIntoView:!0});if(i.changes){let r=1==n.length?R:n.slice(0,n.length-1);return i.mapped&&(r=L(r,i.mapped)),t.update({changes:i.changes,selection:i.startSelection,effects:i.effects,annotations:v.of({side:e,rest:r,selection:s}),filter:!1,userEvent:0==e?"undo":"redo",scrollIntoView:!0})}return null}}V.empty=new V(R,R);const q=[{key:"Mod-z",run:A,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:F,preventDefault:!0},{linux:"Ctrl-Shift-z",run:F,preventDefault:!0},{key:"Mod-u",run:T,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:k,preventDefault:!0}];function W(e,t){return n.EditorSelection.create(e.ranges.map(t),e.mainIndex)}function U(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:"select"})}function z({state:e,dispatch:t},r){let n=W(e.selection,r);return!n.eq(e.selection,!0)&&(t(U(e,n)),!0)}function Y(e,t){return n.EditorSelection.cursor(t?e.to:e.from)}function G(e,t){return z(e,(r=>r.empty?e.moveByChar(r,t):Y(r,t)))}function H(e){return e.textDirectionAt(e.state.selection.main.head)==i.Direction.LTR}const J=e=>G(e,!H(e)),K=e=>G(e,H(e));function ee(e,t){return z(e,(r=>r.empty?e.moveByGroup(r,t):Y(r,t)))}const te=e=>ee(e,!H(e)),re=e=>ee(e,H(e)),ne="undefined"!=typeof Intl&&Intl.Segmenter?new Intl.Segmenter(void 0,{granularity:"word"}):null;function ie(e,t,r){let i=e.state.charCategorizer(t.from),s=n.CharCategory.Space,o=t.from,a=0,u=!1,l=!1,c=!1,p=t=>{if(u)return!1;o+=r?t.length:-t.length;let p,h=i(t);if(h==n.CharCategory.Word&&t.charCodeAt(0)<128&&/[\W_]/.test(t)&&(h=-1),s==n.CharCategory.Space&&(s=h),s!=h)return!1;if(s==n.CharCategory.Word)if(t.toLowerCase()==t){if(!r&&l)return!1;c=!0}else if(c){if(r)return!1;u=!0}else{if(l&&r&&i(p=e.state.sliceDoc(o,o+1))==n.CharCategory.Word&&p.toLowerCase()==p)return!1;l=!0}return a++,!0},h=e.moveByChar(t,r,(e=>(p(e),p)));if(ne&&s==n.CharCategory.Word&&h.from==t.from+a*(r?1:-1)){let i=Math.min(t.head,h.head),s=Math.max(t.head,h.head),o=e.state.sliceDoc(i,s);if(o.length>1&&/[\u4E00-\uffff]/.test(o)){let e=Array.from(ne.segment(o));if(e.length>1)return r?n.EditorSelection.cursor(t.head+e[1].index,-1):n.EditorSelection.cursor(h.head+e[e.length-1].index,1)}}return h}function se(e,t){return z(e,(r=>r.empty?ie(e,r,t):Y(r,t)))}function oe(e,t,r){if(t.type.prop(r))return!0;let n=t.to-t.from;return n&&(n>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}function ae(e,t,r){let i,a,u=s.syntaxTree(e).resolveInner(t.head),l=r?o.NodeProp.closedBy:o.NodeProp.openedBy;for(let n=t.head;;){let t=r?u.childAfter(n):u.childBefore(n);if(!t)break;oe(e,t,l)?u=t:n=r?t.to:t.from}return a=u.type.prop(l)&&(i=r?s.matchBrackets(e,u.from,1):s.matchBrackets(e,u.to,-1))&&i.matched?r?i.end.to:i.end.from:r?u.to:u.from,n.EditorSelection.cursor(a,r?-1:1)}const ue=e=>z(e,(t=>ae(e.state,t,!H(e)))),le=e=>z(e,(t=>ae(e.state,t,H(e))));function ce(e,t){return z(e,(r=>{if(!r.empty)return Y(r,t);let n=e.moveVertically(r,t);return n.head!=r.head?n:e.moveToLineBoundary(r,t)}))}const pe=e=>ce(e,!1),he=e=>ce(e,!0);function de(e){let t,r=e.scrollDOM.clientHeightr.empty?e.moveVertically(r,t,n.height):Y(r,t)));if(o.eq(s.selection))return!1;if(n.selfScroll){let t=e.coordsAtPos(s.selection.main.head),a=e.scrollDOM.getBoundingClientRect(),u=a.top+n.marginTop,l=a.bottom-n.marginBottom;t&&t.top>u&&t.bottomfe(e,!1),ge=e=>fe(e,!0);function Oe(e,t,r){let i=e.lineBlockAt(t.head),s=e.moveToLineBoundary(t,r);if(s.head==t.head&&s.head!=(r?i.to:i.from)&&(s=e.moveToLineBoundary(t,r,!1)),!r&&s.head==i.from&&i.length){let r=/^\s*/.exec(e.state.sliceDoc(i.from,Math.min(i.from+100,i.to)))[0].length;r&&t.head!=i.from+r&&(s=n.EditorSelection.cursor(i.from+r))}return s}const De=e=>z(e,(t=>Oe(e,t,!0))),ye=e=>z(e,(t=>Oe(e,t,!1))),ve=e=>z(e,(t=>Oe(e,t,!H(e)))),be=e=>z(e,(t=>Oe(e,t,H(e)))),Ce=e=>z(e,(t=>n.EditorSelection.cursor(e.lineBlockAt(t.head).from,1))),Se=e=>z(e,(t=>n.EditorSelection.cursor(e.lineBlockAt(t.head).to,-1)));function Ee(e,t,r){let i=!1,o=W(e.selection,(t=>{let o=s.matchBrackets(e,t.head,-1)||s.matchBrackets(e,t.head,1)||t.head>0&&s.matchBrackets(e,t.head-1,1)||t.headEe(e,t,!1);function we(e,t){let r=W(e.state.selection,(e=>{let r=t(e);return n.EditorSelection.range(e.anchor,r.head,r.goalColumn,r.bidiLevel||void 0)}));return!r.eq(e.state.selection)&&(e.dispatch(U(e.state,r)),!0)}function Ae(e,t){return we(e,(r=>e.moveByChar(r,t)))}const Fe=e=>Ae(e,!H(e)),Te=e=>Ae(e,H(e));function ke(e,t){return we(e,(r=>e.moveByGroup(r,t)))}const Pe=e=>ke(e,!H(e)),$e=e=>ke(e,H(e));function Qe(e,t){return we(e,(r=>ie(e,r,t)))}const Be=e=>we(e,(t=>ae(e.state,t,!H(e)))),_e=e=>we(e,(t=>ae(e.state,t,H(e))));function Ne(e,t){return we(e,(r=>e.moveVertically(r,t)))}const Re=e=>Ne(e,!1),Me=e=>Ne(e,!0);function Ie(e,t){return we(e,(r=>e.moveVertically(r,t,de(e).height)))}const je=e=>Ie(e,!1),Le=e=>Ie(e,!0),Ze=e=>we(e,(t=>Oe(e,t,!0))),Xe=e=>we(e,(t=>Oe(e,t,!1))),Ve=e=>we(e,(t=>Oe(e,t,!H(e)))),qe=e=>we(e,(t=>Oe(e,t,H(e)))),We=e=>we(e,(t=>n.EditorSelection.cursor(e.lineBlockAt(t.head).from))),Ue=e=>we(e,(t=>n.EditorSelection.cursor(e.lineBlockAt(t.head).to))),ze=({state:e,dispatch:t})=>(t(U(e,{anchor:0})),!0),Ye=({state:e,dispatch:t})=>(t(U(e,{anchor:e.doc.length})),!0),Ge=({state:e,dispatch:t})=>(t(U(e,{anchor:e.selection.main.anchor,head:0})),!0),He=({state:e,dispatch:t})=>(t(U(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),Je=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"})),!0),Ke=({state:e,dispatch:t})=>{let r=mt(e).map((({from:t,to:r})=>n.EditorSelection.range(t,Math.min(r+1,e.doc.length))));return t(e.update({selection:n.EditorSelection.create(r),userEvent:"select"})),!0},et=({state:e,dispatch:t})=>{let r=W(e.selection,(t=>{var r;for(let i=s.syntaxTree(e).resolveStack(t.from,1);i;i=i.next){let{node:e}=i;if((e.from=t.to||e.to>t.to&&e.from<=t.from)&&(null===(r=e.parent)||void 0===r?void 0:r.parent))return n.EditorSelection.range(e.to,e.from)}return t}));return t(U(e,r)),!0},tt=({state:e,dispatch:t})=>{let r=e.selection,i=null;return r.ranges.length>1?i=n.EditorSelection.create([r.main]):r.main.empty||(i=n.EditorSelection.create([n.EditorSelection.cursor(r.main.head)])),!!i&&(t(U(e,i)),!0)};function rt(e,t){if(e.state.readOnly)return!1;let r="delete.selection",{state:s}=e,o=s.changeByRange((i=>{let{from:s,to:o}=i;if(s==o){let n=t(i);ns&&(r="delete.forward",n=nt(e,n,!0)),s=Math.min(s,n),o=Math.max(o,n)}else s=nt(e,s,!1),o=nt(e,o,!0);return s==o?{range:i}:{changes:{from:s,to:o},range:n.EditorSelection.cursor(s,st(e))))n.between(t,t,((e,n)=>{et&&(t=r?n:e)}));return t}const it=(e,t,r)=>rt(e,(i=>{let o,a,u=i.from,{state:l}=e,c=l.doc.lineAt(u);if(r&&!t&&u>c.from&&uit(e,!1,!0),ot=e=>it(e,!0,!1),at=(e,t)=>rt(e,(r=>{let i=r.head,{state:s}=e,o=s.doc.lineAt(i),a=s.charCategorizer(i);for(let e=null;;){if(i==(t?o.to:o.from)){i==r.head&&o.number!=(t?s.doc.lines:1)&&(i+=t?1:-1);break}let u=n.findClusterBreak(o.text,i-o.from,t)+o.from,l=o.text.slice(Math.min(i,u)-o.from,Math.max(i,u)-o.from),c=a(l);if(null!=e&&c!=e)break;" "==l&&i==r.head||(e=c),i=u}return i})),ut=e=>at(e,!1),lt=e=>at(e,!0),ct=e=>rt(e,(t=>{let r=e.lineBlockAt(t.head).to;return t.headrt(e,(t=>{let r=e.moveToLineBoundary(t,!1).head;return t.head>r?r:Math.max(0,t.head-1)})),ht=e=>rt(e,(t=>{let r=e.moveToLineBoundary(t,!0).head;return t.head{if(e.readOnly)return!1;let r=e.changeByRange((e=>({changes:{from:e.from,to:e.to,insert:n.Text.of(["",""])},range:n.EditorSelection.cursor(e.from)})));return t(e.update(r,{scrollIntoView:!0,userEvent:"input"})),!0},ft=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let r=e.changeByRange((t=>{if(!t.empty||0==t.from||t.from==e.doc.length)return{range:t};let r=t.from,i=e.doc.lineAt(r),s=r==i.from?r-1:n.findClusterBreak(i.text,r-i.from,!1)+i.from,o=r==i.to?r+1:n.findClusterBreak(i.text,r-i.from,!0)+i.from;return{changes:{from:s,to:o,insert:e.doc.slice(r,o).append(e.doc.slice(s,r))},range:n.EditorSelection.cursor(o)}}));return!r.changes.empty&&(t(e.update(r,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function mt(e){let t=[],r=-1;for(let n of e.selection.ranges){let i=e.doc.lineAt(n.from),s=e.doc.lineAt(n.to);if(n.empty||n.to!=s.from||(s=e.doc.lineAt(n.to-1)),r>=i.number){let e=t[t.length-1];e.to=s.to,e.ranges.push(n)}else t.push({from:i.from,to:s.to,ranges:[n]});r=s.number+1}return t}function gt(e,t,r){if(e.readOnly)return!1;let i=[],s=[];for(let t of mt(e)){if(r?t.to==e.doc.length:0==t.from)continue;let o=e.doc.lineAt(r?t.to+1:t.from-1),a=o.length+1;if(r){i.push({from:t.to,to:o.to},{from:t.from,insert:o.text+e.lineBreak});for(let r of t.ranges)s.push(n.EditorSelection.range(Math.min(e.doc.length,r.anchor+a),Math.min(e.doc.length,r.head+a)))}else{i.push({from:o.from,to:t.from},{from:t.to,insert:e.lineBreak+o.text});for(let e of t.ranges)s.push(n.EditorSelection.range(e.anchor-a,e.head-a))}}return!!i.length&&(t(e.update({changes:i,scrollIntoView:!0,selection:n.EditorSelection.create(s,e.selection.mainIndex),userEvent:"move.line"})),!0)}const Ot=({state:e,dispatch:t})=>gt(e,t,!1),Dt=({state:e,dispatch:t})=>gt(e,t,!0);function yt(e,t,r){if(e.readOnly)return!1;let n=[];for(let t of mt(e))r?n.push({from:t.from,insert:e.doc.slice(t.from,t.to)+e.lineBreak}):n.push({from:t.to,insert:e.lineBreak+e.doc.slice(t.from,t.to)});return t(e.update({changes:n,scrollIntoView:!0,userEvent:"input.copyline"})),!0}const vt=({state:e,dispatch:t})=>yt(e,t,!1),bt=({state:e,dispatch:t})=>yt(e,t,!0),Ct=e=>{if(e.state.readOnly)return!1;let{state:t}=e,r=t.changes(mt(t).map((({from:e,to:r})=>(e>0?e--:r{let r;if(e.lineWrapping){let n=e.lineBlockAt(t.head),i=e.coordsAtPos(t.head,t.assoc||1);i&&(r=n.bottom+e.documentTop-i.bottom+e.defaultLineHeight/2)}return e.moveVertically(t,!0,r)})).map(r);return e.dispatch({changes:r,selection:n,scrollIntoView:!0,userEvent:"delete.line"}),!0},St=xt(!1),Et=xt(!0);function xt(e){return({state:t,dispatch:r})=>{if(t.readOnly)return!1;let i=t.changeByRange((r=>{let{from:i,to:a}=r,u=t.doc.lineAt(i),l=!e&&i==a&&function(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let r,n=s.syntaxTree(e).resolveInner(t),i=n.childBefore(t),a=n.childAfter(t);return i&&a&&i.to<=t&&a.from>=t&&(r=i.type.prop(o.NodeProp.closedBy))&&r.indexOf(a.name)>-1&&e.doc.lineAt(i.to).from==e.doc.lineAt(a.from).from&&!/\S/.test(e.sliceDoc(i.to,a.from))?{from:i.to,to:a.from}:null}(t,i);e&&(i=a=(a<=u.to?u:t.doc.lineAt(a)).to);let c=new s.IndentContext(t,{simulateBreak:i,simulateDoubleBreak:!!l}),p=s.getIndentation(c,i);for(null==p&&(p=n.countColumn(/^\s*/.exec(t.doc.lineAt(i).text)[0],t.tabSize));au.from&&i{let s=[];for(let n=i.from;n<=i.to;){let o=e.doc.lineAt(n);o.number>r&&(i.empty||i.to>o.from)&&(t(o,s,i),r=o.number),n=o.to+1}let o=e.changes(s);return{changes:s,range:n.EditorSelection.range(o.mapPos(i.anchor,1),o.mapPos(i.head,1))}}))}const At=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let r=Object.create(null),n=new s.IndentContext(e,{overrideIndentation:e=>{let t=r[e];return null==t?-1:t}}),i=wt(e,((t,i,o)=>{let a=s.getIndentation(n,t.from);if(null==a)return;/\S/.test(t.text)||(a=0);let u=/^\s*/.exec(t.text)[0],l=s.indentString(e,a);(u!=l||o.from!e.readOnly&&(t(e.update(wt(e,((t,r)=>{r.push({from:t.from,insert:e.facet(s.indentUnit)})})),{userEvent:"input.indent"})),!0),Tt=({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(wt(e,((t,r)=>{let i=/^\s*/.exec(t.text)[0];if(!i)return;let o=n.countColumn(i,e.tabSize),a=0,u=s.indentString(e,Math.max(0,o-s.getIndentUnit(e)));for(;a(e.setTabFocusMode(),!0),Pt=[{key:"Ctrl-b",run:J,shift:Fe,preventDefault:!0},{key:"Ctrl-f",run:K,shift:Te},{key:"Ctrl-p",run:pe,shift:Re},{key:"Ctrl-n",run:he,shift:Me},{key:"Ctrl-a",run:Ce,shift:We},{key:"Ctrl-e",run:Se,shift:Ue},{key:"Ctrl-d",run:ot},{key:"Ctrl-h",run:st},{key:"Ctrl-k",run:ct},{key:"Ctrl-Alt-h",run:ut},{key:"Ctrl-o",run:dt},{key:"Ctrl-t",run:ft},{key:"Ctrl-v",run:ge}],$t=[{key:"ArrowLeft",run:J,shift:Fe,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:te,shift:Pe,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:ve,shift:Ve,preventDefault:!0},{key:"ArrowRight",run:K,shift:Te,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:re,shift:$e,preventDefault:!0},{mac:"Cmd-ArrowRight",run:be,shift:qe,preventDefault:!0},{key:"ArrowUp",run:pe,shift:Re,preventDefault:!0},{mac:"Cmd-ArrowUp",run:ze,shift:Ge},{mac:"Ctrl-ArrowUp",run:me,shift:je},{key:"ArrowDown",run:he,shift:Me,preventDefault:!0},{mac:"Cmd-ArrowDown",run:Ye,shift:He},{mac:"Ctrl-ArrowDown",run:ge,shift:Le},{key:"PageUp",run:me,shift:je},{key:"PageDown",run:ge,shift:Le},{key:"Home",run:ye,shift:Xe,preventDefault:!0},{key:"Mod-Home",run:ze,shift:Ge},{key:"End",run:De,shift:Ze,preventDefault:!0},{key:"Mod-End",run:Ye,shift:He},{key:"Enter",run:St},{key:"Mod-a",run:Je},{key:"Backspace",run:st,shift:st},{key:"Delete",run:ot},{key:"Mod-Backspace",mac:"Alt-Backspace",run:ut},{key:"Mod-Delete",mac:"Alt-Delete",run:lt},{mac:"Mod-Backspace",run:pt},{mac:"Mod-Delete",run:ht}].concat(Pt.map((e=>({mac:e.key,run:e.run,shift:e.shift})))),Qt=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:ue,shift:Be},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:le,shift:_e},{key:"Alt-ArrowUp",run:Ot},{key:"Shift-Alt-ArrowUp",run:vt},{key:"Alt-ArrowDown",run:Dt},{key:"Shift-Alt-ArrowDown",run:bt},{key:"Escape",run:tt},{key:"Mod-Enter",run:Et},{key:"Alt-l",mac:"Ctrl-l",run:Ke},{key:"Mod-i",run:et,preventDefault:!0},{key:"Mod-[",run:Tt},{key:"Mod-]",run:Ft},{key:"Mod-Alt-\\",run:At},{key:"Shift-Mod-k",run:Ct},{key:"Shift-Mod-\\",run:xe},{key:"Mod-/",run:a},{key:"Alt-A",run:h},{key:"Ctrl-m",mac:"Shift-Alt-m",run:kt}].concat($t),Bt={key:"Tab",run:Ft,shift:Tt};t.blockComment=d,t.blockUncomment=f,t.copyLineDown=bt,t.copyLineUp=vt,t.cursorCharBackward=e=>G(e,!1),t.cursorCharForward=e=>G(e,!0),t.cursorCharLeft=J,t.cursorCharRight=K,t.cursorDocEnd=Ye,t.cursorDocStart=ze,t.cursorGroupBackward=e=>ee(e,!1),t.cursorGroupForward=e=>ee(e,!0),t.cursorGroupLeft=te,t.cursorGroupRight=re,t.cursorLineBoundaryBackward=ye,t.cursorLineBoundaryForward=De,t.cursorLineBoundaryLeft=ve,t.cursorLineBoundaryRight=be,t.cursorLineDown=he,t.cursorLineEnd=Se,t.cursorLineStart=Ce,t.cursorLineUp=pe,t.cursorMatchingBracket=xe,t.cursorPageDown=ge,t.cursorPageUp=me,t.cursorSubwordBackward=e=>se(e,!1),t.cursorSubwordForward=e=>se(e,!0),t.cursorSyntaxLeft=ue,t.cursorSyntaxRight=le,t.defaultKeymap=Qt,t.deleteCharBackward=st,t.deleteCharBackwardStrict=e=>it(e,!1,!1),t.deleteCharForward=ot,t.deleteGroupBackward=ut,t.deleteGroupForward=lt,t.deleteLine=Ct,t.deleteLineBoundaryBackward=pt,t.deleteLineBoundaryForward=ht,t.deleteToLineEnd=ct,t.deleteToLineStart=e=>rt(e,(t=>{let r=e.lineBlockAt(t.head).from;return t.head>r?r:Math.max(0,t.head-1)})),t.deleteTrailingWhitespace=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let r=[];for(let t=0,n="",i=e.doc.iter();;){if(i.next(),i.lineBreak||i.done){let e=n.search(/\s+$/);if(e>-1&&r.push({from:t-(n.length-e),to:t}),i.done)break;n=""}else n=i.value;t+=i.value.length}return!!r.length&&(t(e.update({changes:r,userEvent:"delete"})),!0)},t.emacsStyleKeymap=Pt,t.history=function(e={}){return[E,S.of(e),i.EditorView.domEventHandlers({beforeinput(e,t){let r="historyUndo"==e.inputType?A:"historyRedo"==e.inputType?F:null;return!!r&&(e.preventDefault(),r(t))}})]},t.historyField=x,t.historyKeymap=q,t.indentLess=Tt,t.indentMore=Ft,t.indentSelection=At,t.indentWithTab=Bt,t.insertBlankLine=Et,t.insertNewline=({state:e,dispatch:t})=>(t(e.update(e.replaceSelection(e.lineBreak),{scrollIntoView:!0,userEvent:"input"})),!0),t.insertNewlineAndIndent=St,t.insertNewlineKeepIndent=({state:e,dispatch:t})=>(t(e.update(e.changeByRange((t=>{let r=/^\s*/.exec(e.doc.lineAt(t.from).text)[0];return{changes:{from:t.from,to:t.to,insert:e.lineBreak+r},range:n.EditorSelection.cursor(t.from+r.length+1)}})),{scrollIntoView:!0,userEvent:"input"})),!0),t.insertTab=({state:e,dispatch:t})=>e.selection.ranges.some((e=>!e.empty))?Ft({state:e,dispatch:t}):(t(e.update(e.replaceSelection("\t"),{scrollIntoView:!0,userEvent:"input"})),!0),t.invertedEffects=C,t.isolateHistory=b,t.lineComment=c,t.lineUncomment=p,t.moveLineDown=Dt,t.moveLineUp=Ot,t.redo=F,t.redoDepth=Q,t.redoSelection=k,t.selectAll=Je,t.selectCharBackward=e=>Ae(e,!1),t.selectCharForward=e=>Ae(e,!0),t.selectCharLeft=Fe,t.selectCharRight=Te,t.selectDocEnd=He,t.selectDocStart=Ge,t.selectGroupBackward=e=>ke(e,!1),t.selectGroupForward=e=>ke(e,!0),t.selectGroupLeft=Pe,t.selectGroupRight=$e,t.selectLine=Ke,t.selectLineBoundaryBackward=Xe,t.selectLineBoundaryForward=Ze,t.selectLineBoundaryLeft=Ve,t.selectLineBoundaryRight=qe,t.selectLineDown=Me,t.selectLineEnd=Ue,t.selectLineStart=We,t.selectLineUp=Re,t.selectMatchingBracket=({state:e,dispatch:t})=>Ee(e,t,!0),t.selectPageDown=Le,t.selectPageUp=je,t.selectParentSyntax=et,t.selectSubwordBackward=e=>Qe(e,!1),t.selectSubwordForward=e=>Qe(e,!0),t.selectSyntaxLeft=Be,t.selectSyntaxRight=_e,t.simplifySelection=tt,t.splitLine=dt,t.standardKeymap=$t,t.temporarilySetTabFocusMode=e=>(e.setTabFocusMode(2e3),!0),t.toggleBlockComment=h,t.toggleBlockCommentByLine=m,t.toggleComment=a,t.toggleLineComment=l,t.toggleTabFocusMode=kt,t.transposeChars=ft,t.undo=A,t.undoDepth=$,t.undoSelection=T},MxJC:(e,t,r)=>{"use strict";var n=r("YnMz"),i=r("cEeD"),s=r("G5nY");let o=null;function a(){if(!o&&"object"==typeof document&&document.body){let{style:e}=document.body,t=[],r=new Set;for(let n in e)"cssText"!=n&&"cssFloat"!=n&&"string"==typeof e[n]&&(/[A-Z]/.test(n)&&(n=n.replace(/[A-Z]/g,(e=>"-"+e.toLowerCase()))),r.has(n)||(t.push(n),r.add(n)));o=t.sort().map((e=>({type:"property",label:e})))}return o||[]}const u=["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}))),l=["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})))),c=["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}))),p=["@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}))),h=/^(\w[\w-]*|-\w[\w-]*|)$/,d=/^-(-[\w-]*)?$/,f=new s.NodeWeakMap,m=["Declaration"];function g(e){for(let t=e;;){if(t.type.isTop)return t;if(!(t=t.parent))return e}}function O(e,t,r){if(t.to-t.from>4096){let n=f.get(t);if(n)return n;let i=[],o=new Set,a=t.cursor(s.IterMode.IncludeAnonymous);if(a.firstChild())do{for(let t of O(e,a.node,r))o.has(t.label)||(o.add(t.label),i.push(t))}while(a.nextSibling());return f.set(t,i),i}{let n=[],i=new Set;return t.cursor().iterate((t=>{var s;if(r(t)&&t.matchContext(m)&&":"==(null===(s=t.node.nextSibling)||void 0===s?void 0:s.name)){let r=e.sliceString(t.from,t.to);i.has(r)||(i.add(r),n.push({label:r,type:"variable"}))}})),n}}const D=e=>t=>{let{state:r,pos:n}=t,s=i.syntaxTree(r).resolveInner(n,-1),o=s.type.isError&&s.from==s.to-1&&"-"==r.doc.sliceString(s.from,s.to);if("PropertyName"==s.name||(o||"TagName"==s.name)&&/^(Block|Styles)$/.test(s.resolve(s.to).name))return{from:s.from,options:a(),validFor:h};if("ValueName"==s.name)return{from:s.from,options:l,validFor:h};if("PseudoClassName"==s.name)return{from:s.from,options:u,validFor:h};if(e(s)||(t.explicit||o)&&function(e,t){var r;if(("("==e.name||e.type.isError)&&(e=e.parent||e),"ArgList"!=e.name)return!1;let n=null===(r=e.parent)||void 0===r?void 0:r.firstChild;return"Callee"==(null==n?void 0:n.name)&&"var"==t.sliceString(n.from,n.to)}(s,r.doc))return{from:e(s)||o?s.from:n,options:O(r.doc,g(s),e),validFor:d};if("TagName"==s.name){for(let{parent:e}=s;e;e=e.parent)if("Block"==e.name)return{from:s.from,options:a(),validFor:h};return{from:s.from,options:c,validFor:h}}if("AtKeyword"==s.name)return{from:s.from,options:p,validFor:h};if(!t.explicit)return null;let f=s.resolve(n),m=f.childBefore(n);return m&&":"==m.name&&"PseudoClassSelector"==f.name?{from:n,options:u,validFor:h}:m&&":"==m.name&&"Declaration"==f.name||"ArgList"==f.name?{from:n,options:l,validFor:h}:"Block"==f.name||"Styles"==f.name?{from:n,options:a(),validFor:h}:null},y=D((e=>"VariableName"==e.name)),v=i.LRLanguage.define({name:"css",parser:n.parser.configure({props:[i.indentNodeProp.add({Declaration:i.continuedIndent()}),i.foldNodeProp.add({"Block KeyframeList":i.foldInside})]}),languageData:{commentTokens:{block:{open:"/*",close:"*/"}},indentOnInput:/^\s*\}$/,wordChars:"-"}});t.css=function(){return new i.LanguageSupport(v,v.data.of({autocomplete:y}))},t.cssCompletionSource=y,t.cssLanguage=v,t.defineCSSCompletionSource=D},"7ymw":(e,t,r)=>{"use strict";var n=r("f/Rv"),i=r("MxJC"),s=r("TXND"),o=r("DCQ6"),a=r("bgcN"),u=r("cEeD");const l=["_blank","_self","_top","_parent"],c=["ascii","utf-8","utf-16","latin1","latin1"],p=["get","post","put","delete"],h=["application/x-www-form-urlencoded","multipart/form-data","text/plain"],d=["true","false"],f={},m={a:{attrs:{href:null,ping:null,type:null,media:null,target:l,hreflang:null}},abbr:f,address:f,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:null,hreflang:null,type:null,shape:["default","rect","circle","poly"]}},article:f,aside:f,audio:{attrs:{src:null,mediagroup:null,crossorigin:["anonymous","use-credentials"],preload:["none","metadata","auto"],autoplay:["autoplay"],loop:["loop"],controls:["controls"]}},b:f,base:{attrs:{href:null,target:l}},bdi:f,bdo:f,blockquote:{attrs:{cite:null}},body:f,br:f,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:["autofocus"],disabled:["autofocus"],formenctype:h,formmethod:p,formnovalidate:["novalidate"],formtarget:l,type:["submit","reset","button"]}},canvas:{attrs:{width:null,height:null}},caption:f,center:f,cite:f,code:f,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:f,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:["open"]}},dfn:f,div:f,dl:f,dt:f,em:f,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:["disabled"],form:null,name:null}},figcaption:f,figure:f,footer:f,form:{attrs:{action:null,name:null,"accept-charset":c,autocomplete:["on","off"],enctype:h,method:p,novalidate:["novalidate"],target:l}},h1:f,h2:f,h3:f,h4:f,h5:f,h6:f,head:{children:["title","base","link","style","meta","script","noscript","command"]},header:f,hgroup:f,hr:f,html:{attrs:{manifest:null}},i:f,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/*","image/*"],autocomplete:["on","off"],autofocus:["autofocus"],checked:["checked"],disabled:["disabled"],formenctype:h,formmethod:p,formnovalidate:["novalidate"],formtarget:l,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:f,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:["autofocus"],disabled:["disabled"],keytype:["RSA"]}},label:{attrs:{for:null,form:null}},legend:f,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:f,menu:{attrs:{label:null,type:["list","context","toolbar"]}},meta:{attrs:{content:null,charset:c,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:f,noscript:f,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:f,param:{attrs:{name:null,value:null}},pre:f,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:f,rt:f,ruby:f,samp:f,script:{attrs:{type:["text/javascript"],src:null,async:["async"],defer:["defer"],charset:c}},section:f,select:{attrs:{form:null,name:null,size:null,autofocus:["autofocus"],disabled:["disabled"],multiple:["multiple"]}},slot:{attrs:{name:null}},small:f,source:{attrs:{src:null,type:null,media:null}},span:f,strong:f,style:{attrs:{type:["text/css"],media:null,scoped:null}},sub:f,summary:f,sup:f,table:f,tbody:f,td:{attrs:{colspan:null,rowspan:null,headers:null}},template:f,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:f,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:["row","col","rowgroup","colgroup"]}},thead:f,time:{attrs:{datetime:null}},title:f,tr:f,track:{attrs:{src:null,label:null,default:null,kind:["subtitles","captions","descriptions","chapters","metadata"],srclang:null}},ul:{children:["li","script","template","ul","ol"]},var:f,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:f},g={accesskey:null,class:null,contenteditable:d,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:d,autocorrect:d,autocapitalize:d,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":d,"aria-autocomplete":["inline","list","both","none"],"aria-busy":d,"aria-checked":["true","false","mixed","undefined"],"aria-controls":null,"aria-describedby":null,"aria-disabled":d,"aria-dropeffect":null,"aria-expanded":["true","false","undefined"],"aria-flowto":null,"aria-grabbed":["true","false","undefined"],"aria-haspopup":d,"aria-hidden":d,"aria-invalid":["true","false","grammar","spelling"],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":["off","polite","assertive"],"aria-multiline":d,"aria-multiselectable":d,"aria-owns":null,"aria-posinset":null,"aria-pressed":["true","false","mixed","undefined"],"aria-readonly":d,"aria-relevant":null,"aria-required":d,"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},O="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 O)g[e]=null;class D{constructor(e,t){this.tags=Object.assign(Object.assign({},m),e),this.globalAttrs=Object.assign(Object.assign({},g),t),this.allTags=Object.keys(this.tags),this.globalAttrNames=Object.keys(this.globalAttrs)}}function y(e,t,r=e.length){if(!t)return"";let n=t.firstChild,i=n&&n.getChild("TagName");return i?e.sliceString(i.from,Math.min(i.to,r)):""}function v(e,t=!1){for(;e;e=e.parent)if("Element"==e.name){if(!t)return e;t=!1}return null}function b(e,t,r){let n=r.tags[y(e,v(t))];return(null==n?void 0:n.children)||r.allTags}function C(e,t){let r=[];for(let n=v(t);n&&!n.type.isTop;n=v(n.parent)){let i=y(e,n);if(i&&"CloseTag"==n.lastChild.name)break;i&&r.indexOf(i)<0&&("EndTag"==t.name||t.from>=n.firstChild.to)&&r.push(i)}return r}D.default=new D;const S=/^[:\-\.\w\u00b7-\uffff]*$/;function E(e,t,r,n,i){let s=/\s*>/.test(e.sliceDoc(i,i+5))?"":">",o=v(r,!0);return{from:n,to:i,options:b(e.doc,o,t).map((e=>({label:e,type:"type"}))).concat(C(e.doc,r).map(((e,t)=>({label:"/"+e,apply:"/"+e+s,type:"type",boost:99-t})))),validFor:/^\/?[:\-\.\w\u00b7-\uffff]*$/}}function x(e,t,r,n){let i=/\s*>/.test(e.sliceDoc(n,n+5))?"":">";return{from:r,to:n,options:C(e.doc,t).map(((e,t)=>({label:e,apply:e+i,type:"type",boost:99-t}))),validFor:S}}function w(e,t){let{state:r,pos:n}=t,i=u.syntaxTree(r).resolveInner(n,-1),s=i.resolve(n);for(let e,t=n;s==i&&(e=i.childBefore(t));){let r=e.lastChild;if(!r||!r.type.isError||r.from({label:e,type:"property"}))),validFor:S}}(r,e,i,"AttributeName"==i.name?i.from:n,n):"Is"==i.name||"AttributeValue"==i.name||"UnquotedAttributeValue"==i.name?function(e,t,r,n,i){var s;let o,a=null===(s=r.parent)||void 0===s?void 0:s.getChild("AttributeName"),u=[];if(a){let s=e.sliceDoc(a.from,a.to),l=t.globalAttrs[s];if(!l){let n=v(r),i=n?t.tags[y(e.doc,n)]:null;l=(null==i?void 0:i.attrs)&&i.attrs[s]}if(l){let t=e.sliceDoc(n,i).toLowerCase(),r='"',s='"';/^['"]/.test(t)?(o='"'==t[0]?/^[^"]*$/:/^[^']*$/,r="",s=e.sliceDoc(i,i+1)==t[0]?"":t[0],t=t.slice(1),n++):o=/^[^\s<>='"]*$/;for(let e of l)u.push({label:e,apply:r+e+s,type:"constant"})}}return{from:n,to:i,options:u,validFor:o}}(r,e,i,"Is"==i.name?n:i.from,n):!t.explicit||"Element"!=s.name&&"Text"!=s.name&&"Document"!=s.name?null:function(e,t,r,n){let i=[],s=0;for(let n of b(e.doc,r,t))i.push({label:"<"+n,type:"type"});for(let t of C(e.doc,r))i.push({label:""+t+">",type:"type",boost:99-s++});return{from:n,to:n,options:i,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}(r,e,i,n)}function A(e){let{extraTags:t,extraGlobalAttributes:r}=e,n=r||t?new D(t,r):D.default;return e=>w(n,e)}const F=s.javascriptLanguage.parser.configure({top:"SingleExpression"}),T=[{tag:"script",attrs:e=>"text/typescript"==e.type||"ts"==e.lang,parser:s.typescriptLanguage.parser},{tag:"script",attrs:e=>"text/babel"==e.type||"text/jsx"==e.type,parser:s.jsxLanguage.parser},{tag:"script",attrs:e=>"text/typescript-jsx"==e.type,parser:s.tsxLanguage.parser},{tag:"script",attrs:e=>/^(importmap|speculationrules|application\/(.+\+)?json)$/i.test(e.type),parser:F},{tag:"script",attrs:e=>!e.type||/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(e.type),parser:s.javascriptLanguage.parser},{tag:"style",attrs:e=>(!e.lang||"css"==e.lang)&&(!e.type||/^(text\/)?(x-)?(stylesheet|css)$/i.test(e.type)),parser:i.cssLanguage.parser}],k=[{name:"style",parser:i.cssLanguage.parser.configure({top:"Styles"})}].concat(O.map((e=>({name:e,parser:s.javascriptLanguage.parser})))),P=u.LRLanguage.define({name:"html",parser:n.parser.configure({props:[u.indentNodeProp.add({Element(e){let t=/^(\s*)(<\/)?/.exec(e.textAfter);return e.node.to<=e.pos+t[0].length?e.continue():e.lineIndent(e.node.from)+(t[2]?0:e.unit)},"OpenTag CloseTag SelfClosingTag":e=>e.column(e.node.from)+e.unit,Document(e){if(e.pos+/\s*/.exec(e.textAfter)[0].lengthe.getChild("TagName")})]}),languageData:{commentTokens:{block:{open:"\x3c!--",close:"--\x3e"}},indentOnInput:/^\s*<\/\w+\W$/,wordChars:"-._"}}),$=P.configure({wrap:n.configureNesting(T,k)}),Q=new Set("area base br col command embed frame hr img input keygen link meta param source track wbr menuitem".split(" ")),B=o.EditorView.inputHandler.of(((e,t,r,n,i)=>{if(e.composing||e.state.readOnly||t!=r||">"!=n&&"/"!=n||!$.isActiveAt(e.state,t,-1))return!1;let s=i(),{state:o}=s,l=o.changeByRange((e=>{var t,r,i;let s,l=o.doc.sliceString(e.from-1,e.to)==n,{head:c}=e,p=u.syntaxTree(o).resolveInner(c,-1);if(l&&">"==n&&"EndTag"==p.name){let n=p.parent;if("CloseTag"!=(null===(r=null===(t=n.parent)||void 0===t?void 0:t.lastChild)||void 0===r?void 0:r.name)&&(s=y(o.doc,n.parent,c))&&!Q.has(s))return{range:e,changes:{from:c,to:c+(">"===o.doc.sliceString(c,c+1)?1:0),insert:`${s}>`}}}else if(l&&"/"==n&&"IncompleteCloseTag"==p.name){let e=p.parent;if(p.from==c-2&&"CloseTag"!=(null===(i=e.lastChild)||void 0===i?void 0:i.name)&&(s=y(o.doc,e,c))&&!Q.has(s)){let e=c+(">"===o.doc.sliceString(c,c+1)?1:0),t=`${s}>`;return{range:a.EditorSelection.cursor(c+t.length,-1),changes:{from:c,to:e,insert:t}}}}return{range:e}}));return!l.changes.empty&&(e.dispatch([s,o.update(l,{userEvent:"input.complete",scrollIntoView:!0})]),!0)}));t.autoCloseTags=B,t.html=function(e={}){let t,r="";!1===e.matchClosingTags&&(r="noMatch"),!0===e.selfClosingTags&&(r=(r?r+" ":"")+"selfClosing"),(e.nestedLanguages&&e.nestedLanguages.length||e.nestedAttributes&&e.nestedAttributes.length)&&(t=n.configureNesting((e.nestedLanguages||[]).concat(T),(e.nestedAttributes||[]).concat(k)));let o=t?P.configure({wrap:t,dialect:r}):r?$.configure({dialect:r}):$;return new u.LanguageSupport(o,[$.data.of({autocomplete:A(e)}),!1!==e.autoCloseTags?B:[],s.javascript().support,i.css().support])},t.htmlCompletionSource=function(e){return w(D.default,e)},t.htmlCompletionSourceWith=A,t.htmlLanguage=$,t.htmlPlain=P},TXND:(e,t,r)=>{"use strict";var n=r("qgMs"),i=r("cEeD"),s=r("bgcN"),o=r("DCQ6"),a=r("HI7g"),u=r("G5nY");const l=[a.snippetCompletion("function ${name}(${params}) {\n\t${}\n}",{label:"function",detail:"definition",type:"keyword"}),a.snippetCompletion("for (let ${index} = 0; ${index} < ${bound}; ${index}++) {\n\t${}\n}",{label:"for",detail:"loop",type:"keyword"}),a.snippetCompletion("for (let ${name} of ${collection}) {\n\t${}\n}",{label:"for",detail:"of loop",type:"keyword"}),a.snippetCompletion("do {\n\t${}\n} while (${})",{label:"do",detail:"loop",type:"keyword"}),a.snippetCompletion("while (${}) {\n\t${}\n}",{label:"while",detail:"loop",type:"keyword"}),a.snippetCompletion("try {\n\t${}\n} catch (${error}) {\n\t${}\n}",{label:"try",detail:"/ catch block",type:"keyword"}),a.snippetCompletion("if (${}) {\n\t${}\n}",{label:"if",detail:"block",type:"keyword"}),a.snippetCompletion("if (${}) {\n\t${}\n} else {\n\t${}\n}",{label:"if",detail:"/ else block",type:"keyword"}),a.snippetCompletion("class ${name} {\n\tconstructor(${params}) {\n\t\t${}\n\t}\n}",{label:"class",detail:"definition",type:"keyword"}),a.snippetCompletion('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),a.snippetCompletion('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],c=l.concat([a.snippetCompletion("interface ${name} {\n\t${}\n}",{label:"interface",detail:"definition",type:"keyword"}),a.snippetCompletion("type ${name} = ${type}",{label:"type",detail:"definition",type:"keyword"}),a.snippetCompletion("enum ${name} {\n\t${}\n}",{label:"enum",detail:"definition",type:"keyword"})]),p=new u.NodeWeakMap,h=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function d(e){return(t,r)=>{let n=t.node.getChild("VariableDefinition");return n&&r(n,e),!0}}const f=["FunctionDeclaration"],m={FunctionDeclaration:d("function"),ClassDeclaration:d("class"),ClassExpression:()=>!0,EnumDeclaration:d("constant"),TypeAliasDeclaration:d("type"),NamespaceDeclaration:d("namespace"),VariableDefinition(e,t){e.matchContext(f)||t(e,"variable")},TypeDefinition(e,t){t(e,"type")},__proto__:null};function g(e,t){let r=p.get(t);if(r)return r;let n=[],i=!0;function s(t,r){let i=e.sliceString(t.from,t.to);n.push({label:i,type:r})}return t.cursor(u.IterMode.IncludeAnonymous).iterate((t=>{if(i)i=!1;else if(t.name){let e=m[t.name];if(e&&e(t,s)||h.has(t.name))return!1}else if(t.to-t.from>8192){for(let r of g(e,t.node))n.push(r);return!1}})),p.set(t,n),n}const O=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,D=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName",".","?."];function y(e){let t=i.syntaxTree(e.state).resolveInner(e.pos,-1);if(D.indexOf(t.name)>-1)return null;let r="VariableName"==t.name||t.to-t.from<20&&O.test(e.state.sliceDoc(t.from,t.to));if(!r&&!e.explicit)return null;let n=[];for(let r=t;r;r=r.parent)h.has(r.name)&&(n=n.concat(g(e.state.doc,r)));return{options:n,from:r?t.from:e.pos,validFor:O}}function v(e,t,r){var n;let i=[];for(;;){let s,o=t.firstChild;if("VariableName"==(null==o?void 0:o.name))return i.push(e(o)),{path:i.reverse(),name:r};if("MemberExpression"!=(null==o?void 0:o.name)||"PropertyName"!=(null===(n=s=o.lastChild)||void 0===n?void 0:n.name))return null;i.push(e(s)),t=o}}function b(e){let t=t=>e.state.doc.sliceString(t.from,t.to),r=i.syntaxTree(e.state).resolveInner(e.pos,-1);return"PropertyName"==r.name?v(t,r.parent,t(r)):"."!=r.name&&"?."!=r.name||"MemberExpression"!=r.parent.name?D.indexOf(r.name)>-1?null:"VariableName"==r.name||r.to-r.from<20&&O.test(t(r))?{path:[],name:t(r)}:"MemberExpression"==r.name?v(t,r,""):e.explicit?{path:[],name:""}:null:v(t,r.parent,"")}const C=i.LRLanguage.define({name:"javascript",parser:n.parser.configure({props:[i.indentNodeProp.add({IfStatement:i.continuedIndent({except:/^\s*({|else\b)/}),TryStatement:i.continuedIndent({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:i.flatIndent,SwitchBody:e=>{let t=e.textAfter,r=/^\s*\}/.test(t),n=/^\s*(case|default)\b/.test(t);return e.baseIndent+(r?0:n?1:2)*e.unit},Block:i.delimitedIndent({closing:"}"}),ArrowFunction:e=>e.baseIndent+e.unit,"TemplateString BlockComment":()=>null,"Statement Property":i.continuedIndent({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}),i.foldNodeProp.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":i.foldInside,BlockComment:e=>({from:e.from+2,to:e.to-2})})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),S={test:e=>/^JSX/.test(e.name),facet:i.defineLanguageFacet({commentTokens:{block:{open:"{/*",close:"*/}"}}})},E=C.configure({dialect:"ts"},"typescript"),x=C.configure({dialect:"jsx",props:[i.sublanguageProp.add((e=>e.isTop?[S]:void 0))]}),w=C.configure({dialect:"jsx ts",props:[i.sublanguageProp.add((e=>e.isTop?[S]:void 0))]},"typescript");let A=e=>({label:e,type:"keyword"});const F="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(A),T=F.concat(["declare","implements","private","protected","public"].map(A));function k(e,t,r=e.length){for(let n=null==t?void 0:t.firstChild;n;n=n.nextSibling)if("JSXIdentifier"==n.name||"JSXBuiltin"==n.name||"JSXNamespacedName"==n.name||"JSXMemberExpression"==n.name)return e.sliceString(n.from,Math.min(n.to,r));return""}const P="object"==typeof navigator&&/Android\b/.test(navigator.userAgent),$=o.EditorView.inputHandler.of(((e,t,r,n,o)=>{if((P?e.composing:e.compositionStarted)||e.state.readOnly||t!=r||">"!=n&&"/"!=n||!C.isActiveAt(e.state,t,-1))return!1;let a=o(),{state:u}=a,l=u.changeByRange((e=>{var t;let r,{head:o}=e,a=i.syntaxTree(u).resolveInner(o-1,-1);if("JSXStartTag"==a.name&&(a=a.parent),u.doc.sliceString(o-1,o)!=n||"JSXAttributeValue"==a.name&&a.to>o);else{if(">"==n&&"JSXFragmentTag"==a.name)return{range:e,changes:{from:o,insert:">"}};if("/"==n&&"JSXStartCloseTag"==a.name){let e=a.parent,n=e.parent;if(n&&e.from==o-2&&((r=k(u.doc,n.firstChild,o))||"JSXFragmentTag"==(null===(t=n.firstChild)||void 0===t?void 0:t.name))){let e=`${r}>`;return{range:s.EditorSelection.cursor(o+e.length,-1),changes:{from:o,insert:e}}}}else if(">"==n){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}}(a);if(t&&"JSXOpenTag"==t.name&&!/^\/?>|^<\//.test(u.doc.sliceString(o,o+2))&&(r=k(u.doc,t,o)))return{range:e,changes:{from:o,insert:`${r}>`}}}}return{range:e}}));return!l.changes.empty&&(e.dispatch([a,u.update(l,{userEvent:"input.complete",scrollIntoView:!0})]),!0)}));function Q(e,t,r,n){return r.line(e+n.line).from+t+(1==e?n.col-1:-1)}function B(e,t,r){let n=Q(e.line,e.column,t,r),i={from:n,to:null!=e.endLine&&1!=e.endColumn?Q(e.endLine,e.endColumn,t,r):n,message:e.message,source:e.ruleId?"eslint:"+e.ruleId:"eslint",severity:1==e.severity?"warning":"error"};if(e.fix){let{range:t,text:s}=e.fix,o=t[0]+r.pos-n,a=t[1]+r.pos-n;i.actions=[{name:"fix",apply(e,t){e.dispatch({changes:{from:t+o,to:t+a,insert:s},scrollIntoView:!0})}}]}return i}t.autoCloseTags=$,t.completionPath=b,t.esLint=function(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,r)=>{e.meta.docs.recommended&&(t.rules[r]=2)}))),r=>{let{state:n}=r,i=[];for(let{from:r,to:s}of C.findRegions(n)){let o=n.doc.lineAt(r),a={line:o.number-1,col:r-o.from,pos:r};for(let o of e.verify(n.sliceDoc(r,s),t))i.push(B(o,n.doc,a))}return i}},t.javascript=function(e={}){let t=e.jsx?e.typescript?w:x:e.typescript?E:C,r=e.typescript?c.concat(T):l.concat(F);return new i.LanguageSupport(t,[C.data.of({autocomplete:a.ifNotIn(D,a.completeFromList(r))}),C.data.of({autocomplete:y}),e.jsx?$:[]])},t.javascriptLanguage=C,t.jsxLanguage=x,t.localCompletionSource=y,t.scopeCompletionSource=function(e){let t=new Map;return r=>{let n=b(r);if(!n)return null;let i=e;for(let e of n.path)if(i=i[e],!i)return null;let s=t.get(i);return s||t.set(i,s=function(e,t){let r=[],n=new Set;for(let i=0;;i++){for(let s of(Object.getOwnPropertyNames||Object.keys)(e)){if(!/^[a-zA-Z_$\xaa-\uffdc][\w$\xaa-\uffdc]*$/.test(s)||n.has(s))continue;let o;n.add(s);try{o=e[s]}catch(e){continue}r.push({label:s,type:"function"==typeof o?/^[A-Z]/.test(s)?"class":t?"function":"method":t?"variable":"property",boost:-i})}let s=Object.getPrototypeOf(e);if(!s)return r;e=s}}(i,!n.path.length)),{from:r.pos-n.name.length,options:s,validFor:O}}},t.snippets=l,t.tsxLanguage=w,t.typescriptLanguage=E,t.typescriptSnippets=c},cEeD:(e,t,r)=>{"use strict";var n,i=r("G5nY"),s=r("bgcN"),o=r("DCQ6"),a=r("Otu7"),u=r("AjgN");const l=new i.NodeProp;function c(e){return s.Facet.define({combine:e?t=>t.concat(e):void 0})}const p=new i.NodeProp;class h{constructor(e,t,r=[],n=""){this.data=e,this.name=n,s.EditorState.prototype.hasOwnProperty("tree")||Object.defineProperty(s.EditorState.prototype,"tree",{get(){return m(this)}}),this.parser=t,this.extension=[x.of(this),s.EditorState.languageData.of(((e,t,r)=>{let n=d(e,t,r),i=n.type.prop(l);if(!i)return[];let s=e.facet(i),o=n.type.prop(p);if(o){let i=n.resolve(t-n.from,r);for(let t of o)if(t.test(i,e)){let r=e.facet(t.facet);return"replace"==t.type?r:r.concat(s)}}return s}))].concat(r)}isActiveAt(e,t,r=-1){return d(e,t,r).type.prop(l)==this.data}findRegions(e){let t=e.facet(x);if((null==t?void 0:t.data)==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let r=[],n=(e,t)=>{if(e.prop(l)==this.data)return void r.push({from:t,to:t+e.length});let s=e.prop(i.NodeProp.mounted);if(s){if(s.tree.prop(l)==this.data){if(s.overlay)for(let e of s.overlay)r.push({from:e.from+t,to:e.to+t});else r.push({from:t,to:t+e.length});return}if(s.overlay){let e=r.length;if(n(s.tree,s.overlay[0].from+t),r.length>e)return}}for(let r=0;re.isTop?t:void 0))]}),e.name)}configure(e,t){return new f(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function m(e){let t=e.field(h.state,!1);return t?t.tree:i.Tree.empty}function g(e,t,r=50){var n;let i=null===(n=e.field(h.state,!1))||void 0===n?void 0:n.context;if(!i)return null;let s=i.viewport;i.updateViewport({from:0,to:t});let o=i.isDone(t)||i.work(r,t)?i.tree:null;return i.updateViewport(s),o}class O{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=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-r,t-r)}}let D=null;class y{constructor(e,t,r=[],n,i,s,o,a){this.parser=e,this.state=t,this.fragments=r,this.tree=n,this.treeLen=i,this.viewport=s,this.skipped=o,this.scheduleOn=a,this.parse=null,this.tempSkipped=[]}static create(e,t,r){return new y(e,t,[],i.Tree.empty,0,r,[],null)}startParse(){return this.parser.startParse(new O(this.state.doc),this.fragments)}work(e,t){return null!=t&&t>=this.state.doc.length&&(t=void 0),this.tree!=i.Tree.empty&&this.isDone(null!=t?t:this.state.doc.length)?(this.takeTree(),!0):this.withContext((()=>{var r;if("number"==typeof e){let t=Date.now()+e;e=()=>Date.now()>t}for(this.parse||(this.parse=this.startParse()),null!=t&&(null==this.parse.stoppedAt||this.parse.stoppedAt>t)&&t=this.treeLen&&((null==this.parse.stoppedAt||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(i.TreeFragment.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=D;D=this;try{return e()}finally{D=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=v(e,t.from,t.to);return e}changes(e,t){let{fragments:r,tree:n,treeLen:s,viewport:o,skipped:a}=this;if(this.takeTree(),!e.empty){let t=[];if(e.iterChangedRanges(((e,r,n,i)=>t.push({fromA:e,toA:r,fromB:n,toB:i}))),r=i.TreeFragment.applyChanges(r,t),n=i.Tree.empty,s=0,o={from:e.mapPos(o.from,-1),to:e.mapPos(o.to,1)},this.skipped.length){a=[];for(let t of this.skipped){let r=e.mapPos(t.from,1),n=e.mapPos(t.to,-1);re.from&&(this.fragments=v(this.fragments,r,n),this.skipped.splice(t--,1))}return!(this.skipped.length>=t||(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 i.Parser{createParse(t,r,n){let s=n[0].from,o=n[n.length-1].to;return{parsedPos:s,advance(){let t=D;if(t){for(let e of n)t.tempSkipped.push(e);e&&(t.scheduleOn=t.scheduleOn?Promise.all([t.scheduleOn,e]):e)}return this.parsedPos=o,new i.Tree(i.NodeType.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&&0==t[0].from&&t[0].to>=e}static get(){return D}}function v(e,t,r){return i.TreeFragment.applyChanges(e,[{fromA:t,toA:r,fromB:t,toB:r}])}class b{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 b(t)}static init(e){let t=Math.min(3e3,e.doc.length),r=y.create(e.facet(x).parser,e,{from:0,to:t});return r.work(20,t)||r.takeTree(),new b(r)}}h.state=s.StateField.define({create:b.init,update(e,t){for(let e of t.effects)if(e.is(h.setState))return e.value;return t.startState.facet(x)!=t.state.facet(x)?b.init(t.state):e.apply(t)}});let C=e=>{let t=setTimeout((()=>e()),500);return()=>clearTimeout(t)};"undefined"!=typeof requestIdleCallback&&(C=e=>{let t=-1,r=setTimeout((()=>{t=requestIdleCallback(e,{timeout:400})}),100);return()=>t<0?clearTimeout(r):cancelIdleCallback(t)});const S="undefined"!=typeof navigator&&(null===(n=navigator.scheduling)||void 0===n?void 0:n.isInputPending)?()=>navigator.scheduling.isInputPending():null,E=o.ViewPlugin.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(h.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(h.state);t.tree==t.context.tree&&t.context.isDone(e.doc.length)||(this.working=C(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEndn+1e3,a=i.context.work((()=>S&&S()||Date.now()>s),n+(o?0:1e5));this.chunkBudget-=Date.now()-t,(a||this.chunkBudget<=0)&&(i.context.takeTree(),this.view.dispatch({effects:h.setState.of(new b(i.context))})),this.chunkBudget>0&&(!a||o)&&this.scheduleWork(),this.checkAsyncSchedule(i.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then((()=>this.scheduleWork())).catch((e=>o.logException(this.view.state,e))).then((()=>this.workScheduled--)),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),x=s.Facet.define({combine:e=>e.length?e[0]:null,enables:e=>[h.state,E,o.EditorView.contentAttributes.compute([e],(t=>{let r=t.facet(e);return r&&r.name?{"data-language":r.name}:{}}))]});class w{constructor(e,t,r,n,i,s=void 0){this.name=e,this.alias=t,this.extensions=r,this.filename=n,this.loadFunc=i,this.support=s,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 w(e.name,(e.alias||[]).concat(e.name).map((e=>e.toLowerCase())),e.extensions||[],e.filename,t,r)}static matchFilename(e,t){for(let r of e)if(r.filename&&r.filename.test(t))return r;let r=/\.([^.]+)$/.exec(t);if(r)for(let t of e)if(t.extensions.indexOf(r[1])>-1)return t;return null}static matchLanguageName(e,t,r=!0){t=t.toLowerCase();for(let r of e)if(r.alias.some((e=>e==t)))return r;if(r)for(let r of e)for(let e of r.alias){let n=t.indexOf(e);if(n>-1&&(e.length>2||!/\w/.test(t[n-1])&&!/\w/.test(t[n+e.length])))return r}return null}}const A=s.Facet.define(),F=s.Facet.define({combine:e=>{if(!e.length)return" ";let t=e[0];if(!t||/\S/.test(t)||Array.from(t).some((e=>e!=t[0])))throw new Error("Invalid indent unit: "+JSON.stringify(e[0]));return t}});function T(e){let t=e.facet(F);return 9==t.charCodeAt(0)?e.tabSize*t.length:t.length}function k(e,t){let r="",n=e.tabSize,i=e.facet(F)[0];if("\t"==i){for(;t>=n;)r+="\t",t-=n;i=" "}for(let e=0;e=t?function(e,t,r){let n=t.resolveStack(r),i=n.node.enterUnfinishedNodesBefore(r);if(i!=n.node){let e=[];for(let t=i;t!=n.node;t=t.parent)e.push(t);for(let t=e.length-1;t>=0;t--)n={node:e[t],next:n}}return B(n,e,r)}(e,r,t):null}class ${constructor(e,t={}){this.state=e,this.options=t,this.unit=T(e)}lineAt(e,t=1){let r=this.state.doc.lineAt(e),{simulateBreak:n,simulateDoubleBreak:i}=this.options;return null!=n&&n>=r.from&&n<=r.to?i&&n==e?{text:"",from:e}:(t<0?n-1&&(i+=s-this.countColumn(r,r.search(/\S|$/))),i}countColumn(e,t=e.length){return s.countColumn(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:r,from:n}=this.lineAt(e,t),i=this.options.overrideIndentation;if(i){let e=i(n);if(e>-1)return e}return this.countColumn(r,r.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const Q=new i.NodeProp;function B(e,t,r){for(let n=e;n;n=n.next){let e=_(n.node);if(e)return e(R.create(t,r,n))}return 0}function _(e){let t=e.type.prop(Q);if(t)return t;let r,n=e.firstChild;if(n&&(r=n.type.prop(i.NodeProp.closedBy))){let t=e.lastChild,n=t&&r.indexOf(t.name)>-1;return e=>I(e,!0,1,void 0,n&&!function(e){return e.pos==e.options.simulateBreak&&e.options.simulateDoubleBreak}(e)?t.from:void 0)}return null==e.parent?N:null}function N(){return 0}class R extends ${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 R(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(M(r,e))break;t=this.state.doc.lineAt(r.from)}return this.lineIndent(t.from)}continue(){return B(this.context.next,this.base,this.pos)}}function M(e,t){for(let r=t;r;r=r.parent)if(e==r)return!0;return!1}function I(e,t,r,n,i){let s=e.textAfter,o=s.match(/^\s*/)[0].length,a=n&&s.slice(o,o+n.length)==n||i==e.pos+o,u=t?function(e){let t=e.node,r=t.childAfter(t.from),n=t.lastChild;if(!r)return null;let i=e.options.simulateBreak,s=e.state.doc.lineAt(r.from),o=null==i||i<=s.from?s.to:Math.min(s.to,i);for(let e=r.to;;){let i=t.childAfter(e);if(!i||i==n)return null;if(!i.type.isSkipped)return i.fromr)continue;if(i&&o.from=t&&n.to>r&&(i=n)}}return i}(e,t,r)}function V(e,t){let r=t.mapPos(e.from,1),n=t.mapPos(e.to,-1);return r>=n?void 0:{from:r,to:n}}const q=s.StateEffect.define({map:V}),W=s.StateEffect.define({map:V});function U(e){let t=[];for(let{head:r}of e.state.selection.ranges)t.some((e=>e.from<=r&&e.to>=r))||t.push(e.lineBlockAt(r));return t}const z=s.StateField.define({create:()=>o.Decoration.none,update(e,t){e=e.map(t.changes);for(let r of t.effects)if(r.is(q)&&!G(e,r.value.from,r.value.to)){let{preparePlaceholder:n}=t.state.facet(oe),i=n?o.Decoration.replace({widget:new ce(n(t.state,r.value))}):le;e=e.update({add:[i.range(r.value.from,r.value.to)]})}else r.is(W)&&(e=e.update({filter:(e,t)=>r.value.from!=e||r.value.to!=t,filterFrom:r.value.from,filterTo:r.value.to}));if(t.selection){let r=!1,{head:n}=t.selection.main;e.between(n,n,((e,t)=>{en&&(r=!0)})),r&&(e=e.update({filterFrom:n,filterTo:n,filter:(e,t)=>t<=n||e>=n}))}return e},provide:e=>o.EditorView.decorations.from(e),toJSON(e,t){let r=[];return e.between(0,t.doc.length,((e,t)=>{r.push(e,t)})),r},fromJSON(e){if(!Array.isArray(e)||e.length%2)throw new RangeError("Invalid JSON for fold state");let t=[];for(let r=0;r{(!i||i.from>e)&&(i={from:e,to:t})})),i}function G(e,t,r){let n=!1;return e.between(t,t,((e,i)=>{e==t&&i==r&&(n=!0)})),n}function H(e,t){return e.field(z,!1)?t:t.concat(s.StateEffect.appendConfig.of(ae()))}const J=e=>{for(let t of U(e)){let r=X(e.state,t.from,t.to);if(r)return e.dispatch({effects:H(e.state,[q.of(r),ee(e,r)])}),!0}return!1},K=e=>{if(!e.state.field(z,!1))return!1;let t=[];for(let r of U(e)){let n=Y(e.state,r.from,r.to);n&&t.push(W.of(n),ee(e,n,!1))}return t.length&&e.dispatch({effects:t}),t.length>0};function ee(e,t,r=!0){let n=e.state.doc.lineAt(t.from).number,i=e.state.doc.lineAt(t.to).number;return o.EditorView.announce.of(`${e.state.phrase(r?"Folded lines":"Unfolded lines")} ${n} ${e.state.phrase("to")} ${i}.`)}const te=e=>{let{state:t}=e,r=[];for(let n=0;n{let t=e.state.field(z,!1);if(!t||!t.size)return!1;let r=[];return t.between(0,e.state.doc.length,((e,t)=>{r.push(W.of({from:e,to:t}))})),e.dispatch({effects:r}),!0};function ne(e,t){for(let r=t;;){let n=X(e.state,r.from,r.to);if(n&&n.to>t.from)return n;if(!r.from)return null;r=e.lineBlockAt(r.from-1)}}const ie=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:J},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:K},{key:"Ctrl-Alt-[",run:te},{key:"Ctrl-Alt-]",run:re}],se={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},oe=s.Facet.define({combine:e=>s.combineConfig(e,se)});function ae(e){let t=[z,de];return e&&t.push(oe.of(e)),t}function ue(e,t){let{state:r}=e,n=r.facet(oe),i=t=>{let r=e.lineBlockAt(e.posAtDOM(t.target)),n=Y(e.state,r.from,r.to);n&&e.dispatch({effects:W.of(n)}),t.preventDefault()};if(n.placeholderDOM)return n.placeholderDOM(e,i,t);let s=document.createElement("span");return s.textContent=n.placeholderText,s.setAttribute("aria-label",r.phrase("folded code")),s.title=r.phrase("unfold"),s.className="cm-foldPlaceholder",s.onclick=i,s}const le=o.Decoration.replace({widget:new class extends o.WidgetType{toDOM(e){return ue(e,null)}}});class ce extends o.WidgetType{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return ue(e,this.value)}}const pe={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class he extends o.GutterMarker{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}}const de=o.EditorView.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"}});class fe{constructor(e,t){let r;function n(e){let t=u.StyleModule.newName();return(r||(r=Object.create(null)))["."+t]=e,t}this.specs=e;const i="string"==typeof t.all?t.all:t.all?n(t.all):void 0,s=t.scope;this.scope=s instanceof h?e=>e.prop(l)==s.data:s?e=>e==s:void 0,this.style=a.tagHighlighter(e.map((e=>({tag:e.tag,class:e.class||n(Object.assign({},e,{tag:null}))}))),{all:i}).style,this.module=r?new u.StyleModule(r):null,this.themeType=t.themeType}static define(e,t){return new fe(e,t||{})}}const me=s.Facet.define(),ge=s.Facet.define({combine:e=>e.length?[e[0]]:null});function Oe(e){let t=e.facet(me);return t.length?t:e.facet(ge)}const De=s.Prec.high(o.ViewPlugin.fromClass(class{constructor(e){this.markCache=Object.create(null),this.tree=m(e.state),this.decorations=this.buildDeco(e,Oe(e.state)),this.decoratedTo=e.viewport.to}update(e){let t=m(e.state),r=Oe(e.state),n=r!=Oe(e.startState),{viewport:i}=e.view,s=e.changes.mapPos(this.decoratedTo,1);t.length=i.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=s):(t!=this.tree||e.viewportChanged||n)&&(this.tree=t,this.decorations=this.buildDeco(e.view,r),this.decoratedTo=i.to)}buildDeco(e,t){if(!t||!this.tree.length)return o.Decoration.none;let r=new s.RangeSetBuilder;for(let{from:n,to:i}of e.visibleRanges)a.highlightTree(this.tree,t,((e,t,n)=>{r.add(e,t,this.markCache[n]||(this.markCache[n]=o.Decoration.mark({class:n})))}),n,i);return r.finish()}},{decorations:e=>e.decorations})),ye=fe.define([{tag:a.tags.meta,color:"#404740"},{tag:a.tags.link,textDecoration:"underline"},{tag:a.tags.heading,textDecoration:"underline",fontWeight:"bold"},{tag:a.tags.emphasis,fontStyle:"italic"},{tag:a.tags.strong,fontWeight:"bold"},{tag:a.tags.strikethrough,textDecoration:"line-through"},{tag:a.tags.keyword,color:"#708"},{tag:[a.tags.atom,a.tags.bool,a.tags.url,a.tags.contentSeparator,a.tags.labelName],color:"#219"},{tag:[a.tags.literal,a.tags.inserted],color:"#164"},{tag:[a.tags.string,a.tags.deleted],color:"#a11"},{tag:[a.tags.regexp,a.tags.escape,a.tags.special(a.tags.string)],color:"#e40"},{tag:a.tags.definition(a.tags.variableName),color:"#00f"},{tag:a.tags.local(a.tags.variableName),color:"#30a"},{tag:[a.tags.typeName,a.tags.namespace],color:"#085"},{tag:a.tags.className,color:"#167"},{tag:[a.tags.special(a.tags.variableName),a.tags.macroName],color:"#256"},{tag:a.tags.definition(a.tags.propertyName),color:"#00c"},{tag:a.tags.comment,color:"#940"},{tag:a.tags.invalid,color:"#f00"}]),ve=o.EditorView.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),be="()[]{}",Ce=s.Facet.define({combine:e=>s.combineConfig(e,{afterCursor:!0,brackets:be,maxScanDistance:1e4,renderMatch:xe})}),Se=o.Decoration.mark({class:"cm-matchingBracket"}),Ee=o.Decoration.mark({class:"cm-nonmatchingBracket"});function xe(e){let t=[],r=e.matched?Se:Ee;return t.push(r.range(e.start.from,e.start.to)),e.end&&t.push(r.range(e.end.from,e.end.to)),t}const we=[s.StateField.define({create:()=>o.Decoration.none,update(e,t){if(!t.docChanged&&!t.selection)return e;let r=[],n=t.state.facet(Ce);for(let e of t.state.selection.ranges){if(!e.empty)continue;let i=ke(t.state,e.head,-1,n)||e.head>0&&ke(t.state,e.head-1,1,n)||n.afterCursor&&(ke(t.state,e.head,1,n)||e.heado.EditorView.decorations.from(e)}),ve],Ae=new i.NodeProp;function Fe(e,t,r){let n=e.prop(t<0?i.NodeProp.openedBy:i.NodeProp.closedBy);if(n)return n;if(1==e.name.length){let n=r.indexOf(e.name);if(n>-1&&n%2==(t<0?1:0))return[r[n+t]]}return null}function Te(e){let t=e.type.prop(Ae);return t?t(e.node):e}function ke(e,t,r,n={}){let i=n.maxScanDistance||1e4,s=n.brackets||be,o=m(e),a=o.resolveInner(t,r);for(let e=a;e;e=e.parent){let n=Fe(e.type,r,s);if(n&&e.from0?t>=i.from&&ti.from&&t<=i.to))return Pe(0,0,r,e,i,n,s)}}return function(e,t,r,n,i,s,o){let a=r<0?e.sliceDoc(t-1,t):e.sliceDoc(t,t+1),u=o.indexOf(a);if(u<0||u%2==0!=r>0)return null;let l={from:r<0?t-1:t,to:r>0?t+1:t},c=e.doc.iterRange(t,r>0?e.doc.length:0),p=0;for(let e=0;!c.next().done&&e<=s;){let s=c.value;r<0&&(e+=s.length);let a=t+e*r;for(let e=r>0?0:s.length-1,t=r>0?s.length:-1;e!=t;e+=r){let t=o.indexOf(s[e]);if(!(t<0||n.resolveInner(a+e,1).type!=i))if(t%2==0==r>0)p++;else{if(1==p)return{start:l,end:{from:a+e,to:a+e+1},matched:t>>1==u>>1};p--}}r>0&&(e+=s.length)}return c.done?{start:l,matched:!1}:null}(e,t,r,o,a.type,i,s)}function Pe(e,t,r,n,i,s,o){let a=n.parent,u={from:i.from,to:i.to},l=0,c=null==a?void 0:a.cursor();if(c&&(r<0?c.childBefore(n.from):c.childAfter(n.to)))do{if(r<0?c.to<=n.from:c.from>=n.to){if(0==l&&s.indexOf(c.type.name)>-1&&c.from=this.string.length}sol(){return 0==this.pos}peek(){return this.string.charAt(this.pos)||void 0}next(){if(this.post}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.lastColumnPosr?e.toLowerCase():e;return n(this.string.substr(this.pos,e.length))==n(e)?(!1!==t&&(this.pos+=e.length),!0):null}{let r=this.string.slice(this.pos).match(e);return r&&r.index>0?null:(r&&!1!==t&&(this.pos+=r[0].length),r)}}current(){return this.string.slice(this.start,this.pos)}}function Be(e){if("object"!=typeof e)return e;let t={};for(let r in e){let n=e[r];t[r]=n instanceof Array?n.slice():n}return t}const _e=new WeakMap;class Ne extends h{constructor(e){let t,r=c(e.languageData),n={name:(s=e).name||"",token:s.token,blankLine:s.blankLine||(()=>{}),startState:s.startState||(()=>!0),copyState:s.copyState||Be,indent:s.indent||(()=>null),languageData:s.languageData||{},tokenTable:s.tokenTable||Le};var s;super(r,new class extends i.Parser{createParse(e,r,n){return new Ie(t,e,r,n)}},[A.of(((e,t)=>this.getIndent(e,t)))],e.name),this.topNode=function(e){let t=i.NodeType.define({id:Ze.length,name:"Document",props:[l.add((()=>e))],top:!0});return Ze.push(t),t}(r),t=this,this.streamParser=n,this.stateAfter=new i.NodeProp({perNode:!0}),this.tokenTable=e.tokenTable?new Ue(n.tokenTable):ze}static define(e){return new Ne(e)}getIndent(e,t){let r,n=m(e.state),i=n.resolve(t);for(;i&&i.type!=this.topNode;)i=i.parent;if(!i)return null;let{overrideIndentation:s}=e.options;s&&(r=_e.get(e.state),null!=r&&r1e4)return null;for(;o=n&&r+t.length<=s&&t.prop(e.stateAfter);if(o)return{state:e.streamParser.copyState(o),pos:r+t.length};for(let o=t.children.length-1;o>=0;o--){let a=t.children[o],u=r+t.positions[o],l=a instanceof i.Tree&&u=t.length)return t;s||t.type!=e.topNode||(s=!0);for(let o=t.children.length-1;o>=0;o--){let a,u=t.positions[o],l=t.children[o];if(ur&&Re(e,n.tree,0-n.offset,r,s);if(o&&(t=Me(e,n.tree,r+n.offset,o.pos+n.offset,!1)))return{state:o.state,tree:t}}return{state:e.streamParser.startState(n?T(n):4),tree:i.Tree.empty}}(e,r,o,null==s?void 0:s.state);this.state=a,this.parsedPos=this.chunkStart=o+u.length;for(let e=0;e=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)"\n"==t&&(t="");else{let e=t.indexOf("\n");e>-1&&(t=t.slice(0,e))}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 e=this.rangeIndex;;){let n=this.ranges[e].to;if(n>=r)break;if(t=t.slice(0,n-(r-t.length)),e++,e==this.ranges.length)break;let i=this.ranges[e].from,s=this.lineAfter(i);t+=s,r=i+s.length}return{line:t,end:r}}skipGapsTo(e,t,r){for(;;){let n=this.ranges[this.rangeIndex].to,i=e+t;if(r>0?n>i:n>=i)break;t+=this.ranges[++this.rangeIndex].from-n}return t}moveRangeIndex(){for(;this.ranges[this.rangeIndex].to1){t+=i=this.skipGapsTo(t,i,1);let e=this.chunk.length;r+=i=this.skipGapsTo(r,i,-1),n+=this.chunk.length-e}return this.chunk.push(e,t,r,n),i}parseLine(e){let{line:t,end:r}=this.nextLine(),n=0,{streamParser:i}=this.lang,s=new Qe(t,e?e.state.tabSize:4,e?T(e.state):2);if(s.eol())i.blankLine(this.state,s.indentUnit);else for(;!s.eol();){let e=je(i.token,s,this.state);if(e&&(n=this.emitToken(this.lang.tokenTable.resolve(e),this.parsedPos+s.start,this.parsedPos+s.pos,4,n)),s.start>1e4)break}this.parsedPos=r,this.moveRangeIndex(),this.parsedPost.start)return n}throw new Error("Stream parser failed to advance stream.")}const Le=Object.create(null),Ze=[i.NodeType.none],Xe=new i.NodeSet(Ze),Ve=[],qe=Object.create(null),We=Object.create(null);for(let[e,t]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"]])We[e]=Ge(Le,t);class Ue{constructor(e){this.extra=e,this.table=Object.assign(Object.create(null),We)}resolve(e){return e?this.table[e]||(this.table[e]=Ge(this.extra,e)):0}}const ze=new Ue(Le);function Ye(e,t){Ve.indexOf(e)>-1||(Ve.push(e),console.warn(t))}function Ge(e,t){let r=[];for(let n of t.split(" ")){let t=[];for(let r of n.split(".")){let n=e[r]||a.tags[r];n?"function"==typeof n?t.length?t=t.map(n):Ye(r,`Modifier ${r} used at start of tag`):t.length?Ye(r,`Tag ${r} used as modifier`):t=Array.isArray(n)?n:[n]:Ye(r,`Unknown highlighting tag ${r}`)}for(let e of t)r.push(e)}if(!r.length)return 0;let n=t.replace(/ /g,"_"),s=n+" "+r.map((e=>e.id)),o=qe[s];if(o)return o.id;let u=qe[s]=i.NodeType.define({id:Ze.length,name:n,props:[a.styleTags({[n]:r})]});return Ze.push(u),u.id}function He(e){return e.length<=4096&&/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/.test(e)}function Je(e){for(let t=e.iter();!t.next().done;)if(He(t.value))return!0;return!1}const Ke=s.Facet.define({combine:e=>e.some((e=>e))}),et=o.ViewPlugin.fromClass(class{constructor(e){this.always=e.state.facet(Ke)||e.textDirection!=o.Direction.LTR||e.state.facet(o.EditorView.perLineTextDirection),this.hasRTL=!this.always&&Je(e.state.doc),this.tree=m(e.state),this.decorations=this.always||this.hasRTL?tt(e,this.tree,this.always):o.Decoration.none}update(e){let t=e.state.facet(Ke)||e.view.textDirection!=o.Direction.LTR||e.state.facet(o.EditorView.perLineTextDirection);if(t||this.hasRTL||!function(e){let t=!1;return e.iterChanges(((e,r,n,i,s)=>{!t&&Je(s)&&(t=!0)})),t}(e.changes)||(this.hasRTL=!0),!t&&!this.hasRTL)return;let r=m(e.state);(t!=this.always||r!=this.tree||e.docChanged||e.viewportChanged)&&(this.tree=r,this.always=t,this.decorations=tt(e.view,r,t))}},{provide:e=>{function t(t){var r,n;return null!==(n=null===(r=t.plugin(e))||void 0===r?void 0:r.decorations)&&void 0!==n?n:o.Decoration.none}return[o.EditorView.outerDecorations.of(t),s.Prec.lowest(o.EditorView.bidiIsolatedRanges.of(t))]}});function tt(e,t,r){let n=new s.RangeSetBuilder,o=e.visibleRanges;r||(o=function(e,t){let r=t.iter(),n=0,i=[],s=null;for(let{from:t,to:o}of e)if(!(s&&s.to>t&&(t=s.to,t>=o)))for(n+r.value.lengthe-10?s.to=Math.min(o,t):i.push(s={from:e,to:Math.min(o,t)})),t>=o)break;n=t,r.next()}return i}(o,e.state.doc));for(let{from:e,to:r}of o)t.iterate({enter:e=>{let t=e.type.prop(i.NodeProp.isolate);t&&n.add(e.from,e.to,rt[t])},from:e,to:r});return n.finish()}const rt={rtl:o.Decoration.mark({class:"cm-iso",inclusive:!0,attributes:{dir:"rtl"},bidiIsolate:o.Direction.RTL}),ltr:o.Decoration.mark({class:"cm-iso",inclusive:!0,attributes:{dir:"ltr"},bidiIsolate:o.Direction.LTR}),auto:o.Decoration.mark({class:"cm-iso",inclusive:!0,attributes:{dir:"auto"},bidiIsolate:null})};t.DocInput=O,t.HighlightStyle=fe,t.IndentContext=$,t.LRLanguage=f,t.Language=h,t.LanguageDescription=w,t.LanguageSupport=class{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}},t.ParseContext=y,t.StreamLanguage=Ne,t.StringStream=Qe,t.TreeIndentContext=R,t.bidiIsolates=function(e={}){let t=[et];return e.alwaysIsolate&&t.push(Ke.of(!0)),t},t.bracketMatching=function(e={}){return[Ce.of(e),we]},t.bracketMatchingHandle=Ae,t.codeFolding=ae,t.continuedIndent=function({except:e,units:t=1}={}){return r=>{let n=e&&e.test(r.textAfter);return r.baseIndent+(n?0:t*r.unit)}},t.defaultHighlightStyle=ye,t.defineLanguageFacet=c,t.delimitedIndent=function({closing:e,align:t=!0,units:r=1}){return n=>I(n,t,r,e)},t.ensureSyntaxTree=g,t.flatIndent=e=>e.baseIndent,t.foldAll=te,t.foldCode=J,t.foldEffect=q,t.foldGutter=function(e={}){let t=Object.assign(Object.assign({},pe),e),r=new he(t,!0),n=new he(t,!1),i=o.ViewPlugin.fromClass(class{constructor(e){this.from=e.viewport.from,this.markers=this.buildMarkers(e)}update(e){(e.docChanged||e.viewportChanged||e.startState.facet(x)!=e.state.facet(x)||e.startState.field(z,!1)!=e.state.field(z,!1)||m(e.startState)!=m(e.state)||t.foldingChanged(e))&&(this.markers=this.buildMarkers(e.view))}buildMarkers(e){let t=new s.RangeSetBuilder;for(let i of e.viewportLineBlocks){let s=Y(e.state,i.from,i.to)?n:X(e.state,i.from,i.to)?r:null;s&&t.add(i.from,i.from,s)}return t.finish()}}),{domEventHandlers:a}=t;return[i,o.gutter({class:"cm-foldGutter",markers(e){var t;return(null===(t=e.plugin(i))||void 0===t?void 0:t.markers)||s.RangeSet.empty},initialSpacer:()=>new he(t,!1),domEventHandlers:Object.assign(Object.assign({},a),{click:(e,t,r)=>{if(a.click&&a.click(e,t,r))return!0;let n=Y(e.state,t.from,t.to);if(n)return e.dispatch({effects:W.of(n)}),!0;let i=X(e.state,t.from,t.to);return!!i&&(e.dispatch({effects:q.of(i)}),!0)}})}),ae()]},t.foldInside=function(e){let t=e.firstChild,r=e.lastChild;return t&&t.to{if(!e.docChanged||!e.isUserEvent("input.type")&&!e.isUserEvent("input.complete"))return e;let t=e.startState.languageDataAt("indentOnInput",e.startState.selection.main.head);if(!t.length)return e;let r=e.newDoc,{head:n}=e.newSelection.main,i=r.lineAt(n);if(n>i.from+200)return e;let s=r.sliceString(i.from,n);if(!t.some((e=>e.test(s))))return e;let{state:o}=e,a=-1,u=[];for(let{head:e}of o.selection.ranges){let t=o.doc.lineAt(e);if(t.from==a)continue;a=t.from;let r=P(o,t.from);if(null==r)continue;let n=/^\s*/.exec(t.text)[0],i=k(o,r);n!=i&&u.push({from:t.from,to:t.from+n.length,insert:i})}return u.length?[e,{changes:u,sequential:!0}]:e}))},t.indentRange=function(e,t,r){let n=Object.create(null),i=new $(e,{overrideIndentation:e=>{var t;return null!==(t=n[e])&&void 0!==t?t:-1}}),s=[];for(let o=t;o<=r;){let t=e.doc.lineAt(o);o=t.to+1;let r=P(i,t.from);if(null==r)continue;/\S/.test(t.text)||(r=0);let a=/^\s*/.exec(t.text)[0],u=k(e,r);a!=u&&(n[t.from]=r,s.push({from:t.from,to:t.from+a.length,insert:u}))}return e.changes(s)},t.indentService=A,t.indentString=k,t.indentUnit=F,t.language=x,t.languageDataProp=l,t.matchBrackets=ke,t.sublanguageProp=p,t.syntaxHighlighting=function(e,t){let r,n=[De];return e instanceof fe&&(e.module&&n.push(o.EditorView.styleModule.of(e.module)),r=e.themeType),(null==t?void 0:t.fallback)?n.push(ge.of(e)):r?n.push(me.computeN([o.EditorView.darkTheme],(t=>t.facet(o.EditorView.darkTheme)==("dark"==r)?[e]:[]))):n.push(me.of(e)),n},t.syntaxParserRunning=function(e){var t;return(null===(t=e.plugin(E))||void 0===t?void 0:t.isWorking())||!1},t.syntaxTree=m,t.syntaxTreeAvailable=function(e,t=e.doc.length){var r;return(null===(r=e.field(h.state,!1))||void 0===r?void 0:r.context.isDone(t))||!1},t.toggleFold=e=>{let t=[];for(let r of U(e)){let n=Y(e.state,r.from,r.to);if(n)t.push(W.of(n),ee(e,n,!1));else{let n=ne(e,r);n&&t.push(q.of(n),ee(e,n))}}return t.length>0&&e.dispatch({effects:H(e.state,t)}),!!t.length},t.unfoldAll=re,t.unfoldCode=K,t.unfoldEffect=W},N62o:(e,t,r)=>{"use strict";var n=r("DCQ6"),i=r("bgcN"),s=r("UV+R");class o{constructor(e,t,r){this.from=e,this.to=t,this.diagnostic=r}}class a{constructor(e,t,r){this.diagnostics=e,this.panel=t,this.selected=r}static init(e,t,r){let i=e,s=r.facet(S).markerFilter;s&&(i=s(i,r));let o=n.Decoration.set(i.map((e=>e.from==e.to||e.from==e.to-1&&r.doc.lineAt(e.from).to==e.from?n.Decoration.widget({widget:new w(e),diagnostic:e}).range(e.from):n.Decoration.mark({attributes:{class:"cm-lintRange cm-lintRange-"+e.severity+(e.markClass?" "+e.markClass:"")},diagnostic:e}).range(e.from,e.to))),!0);return new a(o,t,u(o))}}function u(e,t=null,r=0){let n=null;return e.between(r,1e9,((e,r,{spec:i})=>{if(!t||i.diagnostic==t)return n=new o(e,r,i.diagnostic),!1})),n}function l(e,t){let r=t.pos,n=t.end||r,i=e.state.facet(S).hideOn(e,r,n);if(null!=i)return i;let s=e.startState.doc.lineAt(t.pos);return!(!e.effects.some((e=>e.is(h)))&&!e.changes.touchesRange(s.from,Math.max(s.to,n)))}function c(e,t){return e.field(m,!1)?t:t.concat(i.StateEffect.appendConfig.of(j))}function p(e,t){return{effects:c(e,[h.of(t)])}}const h=i.StateEffect.define(),d=i.StateEffect.define(),f=i.StateEffect.define(),m=i.StateField.define({create:()=>new a(n.Decoration.none,null,null),update(e,t){if(t.docChanged&&e.diagnostics.size){let r=e.diagnostics.map(t.changes),n=null,i=e.panel;if(e.selected){let i=t.changes.mapPos(e.selected.from,1);n=u(r,e.selected.diagnostic,i)||u(r,null,i)}!r.size&&i&&t.state.facet(S).autoPanel&&(i=null),e=new a(r,i,n)}for(let r of t.effects)if(r.is(h)){let n=t.state.facet(S).autoPanel?r.value.length?F.open:null:e.panel;e=a.init(r.value,n,t.state)}else r.is(d)?e=new a(e.diagnostics,r.value?F.open:null,e.selected):r.is(f)&&(e=new a(e.diagnostics,e.panel,r.value));return e},provide:e=>[n.showPanel.from(e,(e=>e.panel)),n.EditorView.decorations.from(e,(e=>e.diagnostics))]}),g=n.Decoration.mark({class:"cm-lintRange cm-lintRange-active"});function O(e,t){return s("ul",{class:"cm-tooltip-lint"},t.map((t=>x(e,t,!1))))}const D=e=>{let t=e.state.field(m,!1);t&&t.panel||e.dispatch({effects:c(e.state,[d.of(!0)])});let r=n.getPanel(e,F.open);return r&&r.dom.querySelector(".cm-panel-lint ul").focus(),!0},y=e=>{let t=e.state.field(m,!1);return!(!t||!t.panel||(e.dispatch({effects:d.of(!1)}),0))},v=e=>{let t=e.state.field(m,!1);if(!t)return!1;let r=e.state.selection.main,n=t.diagnostics.iter(r.to+1);return!(!n.value&&(n=t.diagnostics.iter(0),!n.value||n.from==r.from&&n.to==r.to)||(e.dispatch({selection:{anchor:n.from,head:n.to},scrollIntoView:!0}),0))},b=[{key:"Mod-Shift-m",run:D,preventDefault:!0},{key:"F8",run:v}],C=n.ViewPlugin.fromClass(class{constructor(e){this.view=e,this.timeout=-1,this.set=!0;let{delay:t}=e.state.facet(S);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(ePromise.resolve(e(this.view))))).then((t=>{let r=t.reduce(((e,t)=>e.concat(t)));this.view.state.doc==e.doc&&this.view.dispatch(p(this.view.state,r))}),(e=>{n.logException(this.view.state,e)}))}}update(e){let t=e.state.facet(S);(e.docChanged||t!=e.startState.facet(S)||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)}}),S=i.Facet.define({combine:e=>Object.assign({sources:e.map((e=>e.source)).filter((e=>null!=e))},i.combineConfig(e.map((e=>e.config)),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{needsRefresh:(e,t)=>e?t?r=>e(r)||t(r):e:t}))});function E(e){let t=[];if(e)e:for(let{name:r}of e){for(let e=0;ee.toLowerCase()==n.toLowerCase()))){t.push(n);continue e}}t.push("")}return t}function x(e,t,r){var n;let i=r?E(t.actions):[];return s("li",{class:"cm-diagnostic cm-diagnostic-"+t.severity},s("span",{class:"cm-diagnosticText"},t.renderMessage?t.renderMessage(e):t.message),null===(n=t.actions)||void 0===n?void 0:n.map(((r,n)=>{let o=!1,a=n=>{if(n.preventDefault(),o)return;o=!0;let i=u(e.state.field(m).diagnostics,t);i&&r.apply(e,i.from,i.to)},{name:l}=r,c=i[n]?l.indexOf(i[n]):-1,p=c<0?l:[l.slice(0,c),s("u",l.slice(c,c+1)),l.slice(c+1)];return s("button",{type:"button",class:"cm-diagnosticAction",onclick:a,onmousedown:a,"aria-label":` Action: ${l}${c<0?"":` (access key "${i[n]})"`}.`},p)})),t.source&&s("div",{class:"cm-diagnosticSource"},t.source))}class w extends n.WidgetType{constructor(e){super(),this.diagnostic=e}eq(e){return e.diagnostic==this.diagnostic}toDOM(){return s("span",{class:"cm-lintPoint cm-lintPoint-"+this.diagnostic.severity})}}class A{constructor(e,t){this.diagnostic=t,this.id="item_"+Math.floor(4294967295*Math.random()).toString(16),this.dom=x(e,t,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class F{constructor(e){this.view=e,this.items=[],this.list=s("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:t=>{if(27==t.keyCode)y(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:r}=this.items[this.selectedIndex],n=E(r.actions);for(let i=0;i{for(let t=0;ty(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(m).selected;if(!e)return-1;for(let t=0;t{let a,u=-1;for(let e=r;er&&(this.items.splice(r,u-r),n=!0)),t&&a.diagnostic==t.diagnostic?a.dom.hasAttribute("aria-selected")||(a.dom.setAttribute("aria-selected","true"),i=a):a.dom.hasAttribute("aria-selected")&&a.dom.removeAttribute("aria-selected"),r++}));r({sel:i.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:e,panel:t})=>{let r=t.height/this.list.offsetHeight;e.topt.bottom&&(this.list.scrollTop+=(e.bottom-t.bottom)/r)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),n&&this.sync()}sync(){let e=this.list.firstChild;function t(){let t=e;e=t.nextSibling,t.remove()}for(let r of this.items)if(r.dom.parentNode==this.list){for(;e!=r.dom;)t();e=r.dom.nextSibling}else this.list.insertBefore(r.dom,e);for(;e;)t()}moveSelection(e){if(this.selectedIndex<0)return;let t=u(this.view.state.field(m).diagnostics,this.items[e].diagnostic);t&&this.view.dispatch({selection:{anchor:t.from,head:t.to},scrollIntoView:!0,effects:f.of(t)})}static open(e){return new F(e)}}function T(e,t='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,')`}function k(e){return T(``,'width="6" height="3"')}const P=n.EditorView.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:k("#d11")},".cm-lintRange-warning":{backgroundImage:k("orange")},".cm-lintRange-info":{backgroundImage:k("#999")},".cm-lintRange-hint":{backgroundImage:k("#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 $(e){return"error"==e?4:"warning"==e?3:"info"==e?2:1}class Q extends n.GutterMarker{constructor(e){super(),this.diagnostics=e,this.severity=e.reduce(((e,t)=>$(e)<$(t.severity)?t.severity:e),"hint")}toDOM(e){let t=document.createElement("div");t.className="cm-lint-marker cm-lint-marker-"+this.severity;let r=this.diagnostics,n=e.state.facet(L).tooltipFilter;return n&&(r=n(r,e.state)),r.length&&(t.onmouseover=()=>function(e,t,r){function n(){let n=e.elementAtHeight(t.getBoundingClientRect().top+5-e.documentTop);e.coordsAtPos(n.from)&&e.dispatch({effects:R.of({pos:n.from,above:!1,create:()=>({dom:O(e,r),getCoords:()=>t.getBoundingClientRect()})})}),t.onmouseout=t.onmousemove=null,function(e,t){let r=n=>{let i=t.getBoundingClientRect();if(!(n.clientX>i.left-10&&n.clientXi.top-10&&n.clientY{clearTimeout(s),t.onmouseout=t.onmousemove=null},t.onmousemove=()=>{clearTimeout(s),s=setTimeout(n,i)}}(e,t,r)),t}}function B(e,t){let r=Object.create(null);for(let n of t){let t=e.lineAt(n.from);(r[t.from]||(r[t.from]=[])).push(n)}let n=[];for(let e in r)n.push(new Q(r[e]).range(+e));return i.RangeSet.of(n,!0)}const _=n.gutter({class:"cm-gutter-lint",markers:e=>e.state.field(N)}),N=i.StateField.define({create:()=>i.RangeSet.empty,update(e,t){e=e.map(t.changes);let r=t.state.facet(L).markerFilter;for(let n of t.effects)if(n.is(h)){let i=n.value;r&&(i=r(i||[],t.state)),e=B(t.state.doc,i.slice(0))}return e}}),R=i.StateEffect.define(),M=i.StateField.define({create:()=>null,update:(e,t)=>(e&&t.docChanged&&(e=l(t,e)?null:Object.assign(Object.assign({},e),{pos:t.changes.mapPos(e.pos)})),t.effects.reduce(((e,t)=>t.is(R)?t.value:e),e)),provide:e=>n.showTooltip.from(e)}),I=n.EditorView.baseTheme({".cm-gutter-lint":{width:"1.4em","& .cm-gutterElement":{padding:".2em"}},".cm-lint-marker":{width:"1em",height:"1em"},".cm-lint-marker-info":{content:T('')},".cm-lint-marker-warning":{content:T('')},".cm-lint-marker-error":{content:T('')}}),j=[m,n.EditorView.decorations.compute([m],(e=>{let{selected:t,panel:r}=e.field(m);return t&&r&&t.from!=t.to?n.Decoration.set([g.range(t.from,t.to)]):n.Decoration.none})),n.hoverTooltip((function(e,t,r){let{diagnostics:n}=e.state.field(m),i=[],s=2e8,o=0;n.between(t-(r<0?1:0),t+(r>0?1:0),((e,n,{spec:a})=>{t>=e&&t<=n&&(e==n||(t>e||r>0)&&(t({dom:O(e,i)})}:null}),{hideOn:l}),P],L=i.Facet.define({combine:e=>i.combineConfig(e,{hoverTime:300,markerFilter:null,tooltipFilter:null})});t.closeLintPanel=y,t.diagnosticCount=function(e){let t=e.field(m,!1);return t?t.diagnostics.size:0},t.forEachDiagnostic=function(e,t){let r=e.field(m,!1);if(r&&r.diagnostics.size)for(let e=i.RangeSet.iter([r.diagnostics]);e.value;e.next())t(e.value.spec.diagnostic,e.from,e.to)},t.forceLinting=function(e){let t=e.plugin(C);t&&t.force()},t.lintGutter=function(e={}){return[L.of(e),N,_,I,M]},t.lintKeymap=b,t.linter=function(e,t={}){return[S.of({source:e,config:t}),C,j]},t.nextDiagnostic=v,t.openLintPanel=D,t.previousDiagnostic=e=>{let{state:t}=e,r=t.field(m,!1);if(!r)return!1;let n,i,s,o,a=t.selection.main;return r.diagnostics.between(0,t.doc.length,((e,t)=>{ts)&&(s=e,o=t)})),null!=s&&(null!=n||s!=a.from)&&(e.dispatch({selection:{anchor:null!=n?n:s,head:null!=i?i:o},scrollIntoView:!0}),!0)},t.setDiagnostics=p,t.setDiagnosticsEffect=h},v4nf:(e,t,r)=>{"use strict";var n=r("DCQ6"),i=r("bgcN"),s=r("UV+R");const o="function"==typeof String.prototype.normalize?e=>e.normalize("NFKD"):e=>e;class a{constructor(e,t,r=0,n=e.length,i,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,n),this.bufferStart=r,this.normalize=i?e=>i(o(e)):o,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 i.codePointAt(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=i.fromCodePoint(e),r=this.bufferStart+this.bufferPos;this.bufferPos+=i.codePointSize(e);let n=this.normalize(t);for(let e=0,i=r;;e++){let s=n.charCodeAt(e),o=this.match(s,i,this.bufferPos+this.bufferStart);if(e==n.length-1){if(o)return this.value=o,this;break}i==r&ðis.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,n=r+t[0].length;if(this.matchPos=f(this.text,n+(r==n?1:0)),r==this.curLineStart+this.curLine.length&&this.nextLine(),(rthis.value.to)&&(!this.test||this.test(r,n,t)))return this.value={from:r,to:n,match:t},this;e=this.matchPos-this.curLineStart}else{if(!(this.curLineStart+this.curLine.length=r||n.to<=t){let n=new h(t,e.sliceString(t,r));return p.set(e,n),n}if(n.from==t&&n.to==r)return n;let{text:i,from:s}=n;return s>t&&(i=e.sliceString(t,s)+i,s=t),n.to=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=f(this.text,r+(e==r?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=h.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+2*this.flat.text.length))}}}function f(e,t){if(t>=e.length)return t;let r,n=e.lineAt(t);for(;t=56320&&r<57344;)t++;return t}function m(e){let t=String(e.state.doc.lineAt(e.state.selection.main.head).number),r=s("input",{class:"cm-textfield",name:"line",value:t});function o(){let t=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(r.value);if(!t)return;let{state:s}=e,o=s.doc.lineAt(s.selection.main.head),[,a,u,l,c]=t,p=l?+l.slice(1):0,h=u?+u:o.number;if(u&&c){let e=h/100;a&&(e=e*("-"==a?-1:1)+o.number/s.doc.lines),h=Math.round(s.doc.lines*e)}else u&&a&&(h=h*("-"==a?-1:1)+o.number);let d=s.doc.line(Math.max(1,Math.min(s.doc.lines,h))),f=i.EditorSelection.cursor(d.from+Math.max(0,Math.min(p,d.length)));e.dispatch({effects:[g.of(!1),n.EditorView.scrollIntoView(f.from,{y:"center"})],selection:f}),e.focus()}return{dom:s("form",{class:"cm-gotoLine",onkeydown:t=>{27==t.keyCode?(t.preventDefault(),e.dispatch({effects:g.of(!1)}),e.focus()):13==t.keyCode&&(t.preventDefault(),o())},onsubmit:e=>{e.preventDefault(),o()}},s("label",e.state.phrase("Go to line"),": ",r)," ",s("button",{class:"cm-button",type:"submit"},e.state.phrase("go")))}}"undefined"!=typeof Symbol&&(c.prototype[Symbol.iterator]=d.prototype[Symbol.iterator]=function(){return this});const g=i.StateEffect.define(),O=i.StateField.define({create:()=>!0,update(e,t){for(let r of t.effects)r.is(g)&&(e=r.value);return e},provide:e=>n.showPanel.from(e,(e=>e?m:null))}),D=e=>{let t=n.getPanel(e,m);if(!t){let r=[g.of(!0)];null==e.state.field(O,!1)&&r.push(i.StateEffect.appendConfig.of([O,y])),e.dispatch({effects:r}),t=n.getPanel(e,m)}return t&&t.dom.querySelector("input").select(),!0},y=n.EditorView.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px","& label":{fontSize:"80%"}}}),v={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},b=i.Facet.define({combine:e=>i.combineConfig(e,v,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}),C=n.Decoration.mark({class:"cm-selectionMatch"}),S=n.Decoration.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function E(e,t,r,n){return!(0!=r&&e(t.sliceDoc(r-1,r))==i.CharCategory.Word||n!=t.doc.length&&e(t.sliceDoc(n,n+1))==i.CharCategory.Word)}function x(e,t,r,n){return e(t.sliceDoc(r,r+1))==i.CharCategory.Word&&e(t.sliceDoc(n-1,n))==i.CharCategory.Word}const w=n.ViewPlugin.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(b),{state:r}=e,i=r.selection;if(i.ranges.length>1)return n.Decoration.none;let s,o=i.main,u=null;if(o.empty){if(!t.highlightWordAroundCursor)return n.Decoration.none;let e=r.wordAt(o.head);if(!e)return n.Decoration.none;u=r.charCategorizer(o.head),s=r.sliceDoc(e.from,e.to)}else{let e=o.to-o.from;if(e200)return n.Decoration.none;if(t.wholeWords){if(s=r.sliceDoc(o.from,o.to),u=r.charCategorizer(o.head),!E(u,r,o.from,o.to)||!x(u,r,o.from,o.to))return n.Decoration.none}else if(s=r.sliceDoc(o.from,o.to),!s)return n.Decoration.none}let l=[];for(let i of e.visibleRanges){let e=new a(r.doc,s,i.from,i.to);for(;!e.next().done;){let{from:i,to:s}=e.value;if((!u||E(u,r,i,s))&&(o.empty&&i<=o.from&&s>=o.to?l.push(S.range(i,s)):(i>=o.to||s<=o.from)&&l.push(C.range(i,s)),l.length>t.maxMatches))return n.Decoration.none}}return n.Decoration.set(l)}},{decorations:e=>e.decorations}),A=n.EditorView.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),F=({state:e,dispatch:t})=>{let{ranges:r}=e.selection;if(r.some((e=>e.from===e.to)))return(({state:e,dispatch:t})=>{let{selection:r}=e,n=i.EditorSelection.create(r.ranges.map((t=>e.wordAt(t.head)||i.EditorSelection.cursor(t.head))),r.mainIndex);return!n.eq(r)&&(t(e.update({selection:n})),!0)})({state:e,dispatch:t});let s=e.sliceDoc(r[0].from,r[0].to);if(e.selection.ranges.some((t=>e.sliceDoc(t.from,t.to)!=s)))return!1;let o=function(e,t){let{main:r,ranges:n}=e.selection,i=e.wordAt(r.head),s=i&&i.from==r.from&&i.to==r.to;for(let r=!1,i=new a(e.doc,t,n[n.length-1].to);;){if(i.next(),!i.done){if(r&&n.some((e=>e.from==i.value.from)))continue;if(s){let t=e.wordAt(i.value.from);if(!t||t.from!=i.value.from||t.to!=i.value.to)continue}return i.value}if(r)return null;i=new a(e.doc,t,0,Math.max(0,n[n.length-1].from-1)),r=!0}}(e,s);return!!o&&(t(e.update({selection:e.selection.addRange(i.EditorSelection.range(o.from,o.to),!1),effects:n.EditorView.scrollIntoView(o.to)})),!0)},T=i.Facet.define({combine:e=>i.combineConfig(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new ae(e),scrollToMatch:e=>n.EditorView.scrollIntoView(e)})});class k{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,l),!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 I(this):new B(this)}getCursor(e,t=0,r){let n=e.doc?e:i.EditorState.create({doc:e});return null==r&&(r=n.doc.length),this.regexp?_(this,n,t,r):$(this,n,t,r)}}class P{constructor(e){this.spec=e}}function $(e,t,r,n){return new a(t.doc,e.unquoted,r,n,e.caseSensitive?void 0:e=>e.toLowerCase(),e.wholeWord?Q(t.doc,t.charCategorizer(t.selection.main.head)):void 0)}function Q(e,t){return(r,n,s,o)=>((o>r||o+s.length=t)return null;n.push(r.value)}return n}highlight(e,t,r,n){let i=$(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(r+this.spec.unquoted.length,e.doc.length));for(;!i.next().done;)n(i.value.from,i.value.to)}}function _(e,t,r,n){return new c(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:e.wholeWord?M(t.charCategorizer(t.selection.main.head)):void 0},r,n)}function N(e,t){return e.slice(i.findClusterBreak(e,t,!1),t)}function R(e,t){return e.slice(t,i.findClusterBreak(e,t))}function M(e){return(t,r,n)=>!n[0].length||(e(N(n.input,n.index))!=i.CharCategory.Word||e(R(n.input,n.index))!=i.CharCategory.Word)&&(e(R(n.input,n.index+n[0].length))!=i.CharCategory.Word||e(N(n.input,n.index+n[0].length))!=i.CharCategory.Word)}class I extends P{nextMatch(e,t,r){let n=_(this.spec,e,r,e.doc.length).next();return n.done&&(n=_(this.spec,e,0,t).next()),n.done?null:n.value}prevMatchInRange(e,t,r){for(let n=1;;n++){let i=Math.max(t,r-1e4*n),s=_(this.spec,e,i,r),o=null;for(;!s.next().done;)o=s.value;if(o&&(i==t||o.from>i+10))return o;if(i==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=t)return null;n.push(r.value)}return n}highlight(e,t,r,n){let i=_(this.spec,e,Math.max(0,t-250),Math.min(r+250,e.doc.length));for(;!i.next().done;)n(i.value.from,i.value.to)}}const j=i.StateEffect.define(),L=i.StateEffect.define(),Z=i.StateField.define({create:e=>new X(te(e).create(),null),update(e,t){for(let r of t.effects)r.is(j)?e=new X(r.value.create(),e.panel):r.is(L)&&(e=new X(e.query,r.value?ee:null));return e},provide:e=>n.showPanel.from(e,(e=>e.panel))});class X{constructor(e,t){this.query=e,this.panel=t}}const V=n.Decoration.mark({class:"cm-searchMatch"}),q=n.Decoration.mark({class:"cm-searchMatch cm-searchMatch-selected"}),W=n.ViewPlugin.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(Z))}update(e){let t=e.state.field(Z);(t!=e.startState.field(Z)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(t))}highlight({query:e,panel:t}){if(!t||!e.spec.valid)return n.Decoration.none;let{view:r}=this,s=new i.RangeSetBuilder;for(let t=0,n=r.visibleRanges,i=n.length;tn[t+1].from-500;)a=n[++t].to;e.highlight(r.state,o,a,((e,t)=>{let n=r.state.selection.ranges.some((r=>r.from==e&&r.to==t));s.add(e,t,n?q:V)}))}return s.finish()}},{decorations:e=>e.decorations});function U(e){return t=>{let r=t.state.field(Z,!1);return r&&r.query.spec.valid?e(t,r):ie(t)}}const z=U(((e,{query:t})=>{let{to:r}=e.state.selection.main,n=t.nextMatch(e.state,r,r);if(!n)return!1;let s=i.EditorSelection.single(n.from,n.to),o=e.state.facet(T);return e.dispatch({selection:s,effects:[pe(e,n),o.scrollToMatch(s.main,e)],userEvent:"select.search"}),ne(e),!0})),Y=U(((e,{query:t})=>{let{state:r}=e,{from:n}=r.selection.main,s=t.prevMatch(r,n,n);if(!s)return!1;let o=i.EditorSelection.single(s.from,s.to),a=e.state.facet(T);return e.dispatch({selection:o,effects:[pe(e,s),a.scrollToMatch(o.main,e)],userEvent:"select.search"}),ne(e),!0})),G=U(((e,{query:t})=>{let r=t.matchAll(e.state,1e3);return!(!r||!r.length||(e.dispatch({selection:i.EditorSelection.create(r.map((e=>i.EditorSelection.range(e.from,e.to)))),userEvent:"select.search.matches"}),0))})),H=({state:e,dispatch:t})=>{let r=e.selection;if(r.ranges.length>1||r.main.empty)return!1;let{from:n,to:s}=r.main,o=[],u=0;for(let t=new a(e.doc,e.sliceDoc(n,s));!t.next().done;){if(o.length>1e3)return!1;t.value.from==n&&(u=o.length),o.push(i.EditorSelection.range(t.value.from,t.value.to))}return t(e.update({selection:i.EditorSelection.create(o,u),userEvent:"select.search.matches"})),!0},J=U(((e,{query:t})=>{let{state:r}=e,{from:s,to:o}=r.selection.main;if(r.readOnly)return!1;let a=t.nextMatch(r,s,s);if(!a)return!1;let u,l,c=[],p=[];if(a.from==s&&a.to==o&&(l=r.toText(t.getReplacement(a)),c.push({from:a.from,to:a.to,insert:l}),a=t.nextMatch(r,a.from,a.to),p.push(n.EditorView.announce.of(r.phrase("replaced match on line $",r.doc.lineAt(s).number)+"."))),a){let t=0==c.length||c[0].from>=a.to?0:a.to-a.from-l.length;u=i.EditorSelection.single(a.from-t,a.to-t),p.push(pe(e,a)),p.push(r.facet(T).scrollToMatch(u.main,e))}return e.dispatch({changes:c,selection:u,effects:p,userEvent:"input.replace"}),!0})),K=U(((e,{query:t})=>{if(e.state.readOnly)return!1;let r=t.matchAll(e.state,1e9).map((e=>{let{from:r,to:n}=e;return{from:r,to:n,insert:t.getReplacement(e)}}));if(!r.length)return!1;let i=e.state.phrase("replaced $ matches",r.length)+".";return e.dispatch({changes:r,effects:n.EditorView.announce.of(i),userEvent:"input.replace.all"}),!0}));function ee(e){return e.state.facet(T).createPanel(e)}function te(e,t){var r,n,i,s,o;let a=e.selection.main,u=a.empty||a.to>a.from+100?"":e.sliceDoc(a.from,a.to);if(t&&!u)return t;let l=e.facet(T);return new k({search:(null!==(r=null==t?void 0:t.literal)&&void 0!==r?r:l.literal)?u:u.replace(/\n/g,"\\n"),caseSensitive:null!==(n=null==t?void 0:t.caseSensitive)&&void 0!==n?n:l.caseSensitive,literal:null!==(i=null==t?void 0:t.literal)&&void 0!==i?i:l.literal,regexp:null!==(s=null==t?void 0:t.regexp)&&void 0!==s?s:l.regexp,wholeWord:null!==(o=null==t?void 0:t.wholeWord)&&void 0!==o?o:l.wholeWord})}function re(e){let t=n.getPanel(e,ee);return t&&t.dom.querySelector("[main-field]")}function ne(e){let t=re(e);t&&t==e.root.activeElement&&t.select()}const ie=e=>{let t=e.state.field(Z,!1);if(t&&t.panel){let r=re(e);if(r&&r!=e.root.activeElement){let n=te(e.state,t.query.spec);n.valid&&e.dispatch({effects:j.of(n)}),r.focus(),r.select()}}else e.dispatch({effects:[L.of(!0),t?j.of(te(e.state,t.query.spec)):i.StateEffect.appendConfig.of(de)]});return!0},se=e=>{let t=e.state.field(Z,!1);if(!t||!t.panel)return!1;let r=n.getPanel(e,ee);return r&&r.dom.contains(e.root.activeElement)&&e.focus(),e.dispatch({effects:L.of(!1)}),!0},oe=[{key:"Mod-f",run:ie,scope:"editor search-panel"},{key:"F3",run:z,shift:Y,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:z,shift:Y,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:se,scope:"editor search-panel"},{key:"Mod-Shift-l",run:H},{key:"Mod-Alt-g",run:D},{key:"Mod-d",run:F,preventDefault:!0}];class ae{constructor(e){this.view=e;let t=this.query=e.state.field(Z).query.spec;function r(e,t,r){return s("button",{class:"cm-button",name:e,onclick:t,type:"button"},r)}this.commit=this.commit.bind(this),this.searchField=s("input",{value:t.search,placeholder:ue(e,"Find"),"aria-label":ue(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=s("input",{value:t.replace,placeholder:ue(e,"Replace"),"aria-label":ue(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=s("input",{type:"checkbox",name:"case",form:"",checked:t.caseSensitive,onchange:this.commit}),this.reField=s("input",{type:"checkbox",name:"re",form:"",checked:t.regexp,onchange:this.commit}),this.wordField=s("input",{type:"checkbox",name:"word",form:"",checked:t.wholeWord,onchange:this.commit}),this.dom=s("div",{onkeydown:e=>this.keydown(e),class:"cm-search"},[this.searchField,r("next",(()=>z(e)),[ue(e,"next")]),r("prev",(()=>Y(e)),[ue(e,"previous")]),r("select",(()=>G(e)),[ue(e,"all")]),s("label",null,[this.caseField,ue(e,"match case")]),s("label",null,[this.reField,ue(e,"regexp")]),s("label",null,[this.wordField,ue(e,"by word")]),...e.state.readOnly?[]:[s("br"),this.replaceField,r("replace",(()=>J(e)),[ue(e,"replace")]),r("replaceAll",(()=>K(e)),[ue(e,"replace all")])],s("button",{name:"close",onclick:()=>se(e),"aria-label":ue(e,"close"),type:"button"},["×"])])}commit(){let e=new k({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:j.of(e)}))}keydown(e){n.runScopeHandlers(this.view,e,"search-panel")?e.preventDefault():13==e.keyCode&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?Y:z)(this.view)):13==e.keyCode&&e.target==this.replaceField&&(e.preventDefault(),J(this.view))}update(e){for(let t of e.transactions)for(let e of t.effects)e.is(j)&&!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(T).top}}function ue(e,t){return e.state.phrase(t)}const le=30,ce=/[\s\.,:;?!]/;function pe(e,{from:t,to:r}){let i=e.state.doc.lineAt(t),s=e.state.doc.lineAt(r).to,o=Math.max(i.from,t-le),a=Math.min(s,r+le),u=e.state.sliceDoc(o,a);if(o!=i.from)for(let e=0;eu.length-le;e--)if(!ce.test(u[e-1])&&ce.test(u[e])){u=u.slice(0,e);break}return n.EditorView.announce.of(`${e.state.phrase("current match")}. ${u} ${e.state.phrase("on line")} ${i.number}.`)}const he=n.EditorView.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"}}),de=[Z,i.Prec.low(W),he];t.RegExpCursor=c,t.SearchCursor=a,t.SearchQuery=k,t.closeSearchPanel=se,t.findNext=z,t.findPrevious=Y,t.getSearchQuery=function(e){let t=e.field(Z,!1);return t?t.query.spec:te(e)},t.gotoLine=D,t.highlightSelectionMatches=function(e){let t=[A,w];return e&&t.push(b.of(e)),t},t.openSearchPanel=ie,t.replaceAll=K,t.replaceNext=J,t.search=function(e){return e?[T.of(e),de]:de},t.searchKeymap=oe,t.searchPanelOpen=function(e){var t;return null!=(null===(t=e.field(Z,!1))||void 0===t?void 0:t.panel)},t.selectMatches=G,t.selectNextOccurrence=F,t.selectSelectionMatches=H,t.setSearchQuery=j},bgcN:(e,t)=>{"use strict";class r{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,r){[e,t]=p(this,e,t);let n=[];return this.decompose(0,e,n,2),r.length&&r.decompose(0,r.length,n,3),this.decompose(t,this.length,n,1),i.from(n,this.length-(t-e)+r.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=p(this,e,t);let r=[];return this.decompose(e,t,r,0),i.from(r,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),r=this.length-this.scanIdentical(e,-1),n=new a(this),i=new a(e);for(let e=t,s=t;;){if(n.next(e),i.next(e),e=0,n.lineBreak!=i.lineBreak||n.done!=i.done||n.value!=i.value)return!1;if(s+=n.value.length,n.done||s>=r)return!0}}iter(e=1){return new a(this,e)}iterRange(e,t=this.length){return new u(this,e,t)}iterLines(e,t){let r;if(null==e)r=this.iter();else{null==t&&(t=this.lines+1);let n=this.line(e).from;r=this.iterRange(n,Math.max(n,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new l(r)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(0==e.length)throw new RangeError("A document must have at least one line");return 1!=e.length||e[0]?e.length<=32?new n(e):i.from(n.split(e,[])):r.empty}}class n extends r{constructor(e,t=function(e){let t=-1;for(let r of e)t+=r.length+1;return t}(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,r,n){for(let i=0;;i++){let s=this.text[i],o=n+s.length;if((t?r:o)>=e)return new c(n,o,r,s);n=o+1,r++}}decompose(e,t,r,i){let a=e<=0&&t>=this.length?this:new n(o(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(1&i){let e=r.pop(),t=s(a.text,e.text.slice(),0,a.length);if(t.length<=32)r.push(new n(t,e.length+a.length));else{let e=t.length>>1;r.push(new n(t.slice(0,e)),new n(t.slice(e)))}}else r.push(a)}replace(e,t,r){if(!(r instanceof n))return super.replace(e,t,r);[e,t]=p(this,e,t);let a=s(this.text,s(r.text,o(this.text,0,e)),t),u=this.length+r.length-(t-e);return a.length<=32?new n(a,u):i.from(n.split(a,[]),u)}sliceString(e,t=this.length,r="\n"){[e,t]=p(this,e,t);let n="";for(let i=0,s=0;i<=t&&se&&s&&(n+=r),ei&&(n+=o.slice(Math.max(0,e-i),t-i)),i=a+1}return n}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let r=[],i=-1;for(let s of e)r.push(s),i+=s.length+1,32==r.length&&(t.push(new n(r,i)),r=[],i=-1);return i>-1&&t.push(new n(r,i)),t}}class i extends r{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let t of e)this.lines+=t.lines}lineInner(e,t,r,n){for(let i=0;;i++){let s=this.children[i],o=n+s.length,a=r+s.lines-1;if((t?a:o)>=e)return s.lineInner(e,t,r,n);n=o+1,r=a+1}}decompose(e,t,r,n){for(let i=0,s=0;s<=t&&i=s){let i=n&((s<=e?1:0)|(a>=t?2:0));s>=e&&a<=t&&!i?r.push(o):o.decompose(e-s,t-s,r,i)}s=a+1}}replace(e,t,r){if([e,t]=p(this,e,t),r.lines=s&&t<=a){let u=o.replace(e-s,t-s,r),l=this.lines-o.lines+u.lines;if(u.lines>4&&u.lines>l>>6){let s=this.children.slice();return s[n]=u,new i(s,this.length-(t-e)+r.length)}return super.replace(s,a,u)}s=a+1}return super.replace(e,t,r)}sliceString(e,t=this.length,r="\n"){[e,t]=p(this,e,t);let n="";for(let i=0,s=0;ie&&i&&(n+=r),es&&(n+=o.sliceString(e-s,t-s,r)),s=a+1}return n}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof i))return 0;let r=0,[n,s,o,a]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;n+=t,s+=t){if(n==o||s==a)return r;let i=this.children[n],u=e.children[s];if(i!=u)return r+i.scanIdentical(u,t);r+=i.length+1}}static from(e,t=e.reduce(((e,t)=>e+t.length+1),-1)){let r=0;for(let t of e)r+=t.lines;if(r<32){let r=[];for(let t of e)t.flatten(r);return new n(r,t)}let s=Math.max(32,r>>5),o=s<<1,a=s>>1,u=[],l=0,c=-1,p=[];function h(e){let t;if(e.lines>o&&e instanceof i)for(let t of e.children)h(t);else e.lines>a&&(l>a||!l)?(d(),u.push(e)):e instanceof n&&l&&(t=p[p.length-1])instanceof n&&e.lines+t.lines<=32?(l+=e.lines,c+=e.length+1,p[p.length-1]=new n(t.text.concat(e.text),t.length+1+e.length)):(l+e.lines>s&&d(),l+=e.lines,c+=e.length+1,p.push(e))}function d(){0!=l&&(u.push(1==p.length?p[0]:i.from(p,c)),c=-1,l=p.length=0)}for(let t of e)h(t);return d(),1==u.length?u[0]:new i(u,t)}}function s(e,t,r=0,n=1e9){for(let i=0,s=0,o=!0;s=r&&(u>n&&(a=a.slice(0,n-i)),i0?1:(e instanceof n?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let r=this.nodes.length-1,i=this.nodes[r],s=this.offsets[r],o=s>>1,a=i instanceof n?i.text.length:i.children.length;if(o==(t>0?a:0)){if(0==r)return this.done=!0,this.value="",this;t>0&&this.offsets[r-1]++,this.nodes.pop(),this.offsets.pop()}else if((1&s)==(t>0?0:1)){if(this.offsets[r]+=t,0==e)return this.lineBreak=!0,this.value="\n",this;e--}else if(i instanceof n){let n=i.text[o+(t<0?-1:0)];if(this.offsets[r]+=t,n.length>Math.max(0,e))return this.value=0==e?n:t>0?n.slice(e):n.slice(0,n.length-e),this;e-=n.length}else{let s=i.children[o+(t<0?-1:0)];e>s.length?(e-=s.length,this.offsets[r]+=t):(t<0&&this.offsets[r]--,this.nodes.push(s),this.offsets.push(t>0?1:(s instanceof n?s.text.length:s.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class u{constructor(e,t,r){this.value="",this.done=!1,this.cursor=new a(e,t>r?-1:1),this.pos=t>r?e.length:0,this.from=Math.min(t,r),this.to=Math.max(t,r)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let r=t<0?this.pos-this.from:this.to-this.pos;e>r&&(e=r),r-=e;let{value:n}=this.cursor.next(e);return this.pos+=(n.length+e)*t,this.value=n.length<=r?n:t<0?n.slice(n.length-r):n.slice(0,r),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&""!=this.value}}class l{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:r,value:n}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):r?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=n,this.afterBreak=!1),this}get lineBreak(){return!1}}"undefined"!=typeof Symbol&&(r.prototype[Symbol.iterator]=function(){return this.iter()},a.prototype[Symbol.iterator]=u.prototype[Symbol.iterator]=l.prototype[Symbol.iterator]=function(){return this});class c{constructor(e,t,r,n){this.from=e,this.to=t,this.number=r,this.text=n}get length(){return this.to-this.from}}function p(e,t,r){return[t=Math.max(0,Math.min(e.length,t)),Math.max(t,Math.min(e.length,r))]}let h="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map((e=>e?parseInt(e,36):1));for(let e=1;ee)return h[t-1]<=e;return!1}function f(e){return e>=127462&&e<=127487}const m=8205;function g(e,t,r=!0,n=!0){return(r?O:D)(e,t,n)}function O(e,t,r){if(t==e.length)return t;t&&y(e.charCodeAt(t))&&v(e.charCodeAt(t-1))&&t--;let n=b(e,t);for(t+=C(n);t=0&&f(b(e,n));)r++,n-=2;if(r%2==0)break;t+=2}}}return t}function D(e,t,r){for(;t>0;){let n=O(e,t-2,r);if(n=56320&&e<57344}function v(e){return e>=55296&&e<56320}function b(e,t){let r=e.charCodeAt(t);if(!v(r)||t+1==e.length)return r;let n=e.charCodeAt(t+1);return y(n)?n-56320+(r-55296<<10)+65536:r}function C(e){return e<65536?1:2}const S=/\r\n?|\n/;var E;t.MapMode=void 0,(E=t.MapMode||(t.MapMode={}))[E.Simple=0]="Simple",E[E.TrackDel=1]="TrackDel",E[E.TrackBefore=2]="TrackBefore",E[E.TrackAfter=3]="TrackAfter";class x{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;te)return s+(e-i);s+=a}else{if(n!=t.MapMode.Simple&&l>=e&&(n==t.MapMode.TrackDel&&ie||n==t.MapMode.TrackBefore&&ie))return null;if(l>e||l==e&&r<0&&!a)return e==i||r<0?s:s+u;s+=u}i=l}if(e>i)throw new RangeError(`Position ${e} is out of range for changeset of length ${i}`);return s}touchesRange(e,t=e){for(let r=0,n=0;r=0&&n<=t&&i>=e)return!(nt)||"cover";n=i}return!1}toString(){let e="";for(let t=0;t=0?":"+n:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some((e=>"number"!=typeof e)))throw new RangeError("Invalid JSON representation of ChangeDesc");return new x(e)}static create(e){return new x(e)}}class w extends x{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return T(this,((t,r,n,i,s)=>e=e.replace(n,n+(r-t),s)),!1),e}mapDesc(e,t=!1){return k(this,e,t,!0)}invert(e){let t=this.sections.slice(),n=[];for(let i=0,s=0;i=0){t[i]=a,t[i+1]=o;let u=i>>1;for(;n.length0&&F(r,t,i.text),i.forward(e),o+=e}let u=e[s++];for(;o>1].toJSON()))}return e}static of(e,t,n){let i=[],s=[],o=0,a=null;function u(e=!1){if(!e&&!i.length)return;oa||e<0||a>t)throw new RangeError(`Invalid change range ${e} to ${a} (in doc of length ${t})`);let p=c?"string"==typeof c?r.of(c.split(n||S)):c:r.empty,h=p.length;if(e==a&&0==h)return;eo&&A(i,e-o,-1),A(i,a-e,h),F(s,i,p),o=a}}(e),u(!a),a}static empty(e){return new w(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],n=[];for(let i=0;it&&"string"!=typeof e)))throw new RangeError("Invalid JSON representation of ChangeSet");if(1==s.length)t.push(s[0],0);else{for(;n.length=0&&r<=0&&r==e[i+1]?e[i]+=t:0==t&&0==e[i]?e[i+1]+=r:n?(e[i]+=t,e[i+1]+=r):e.push(t,r)}function F(e,t,n){if(0==n.length)return;let i=t.length-2>>1;if(i>1])),!(n||a==e.sections.length||e.sections[a+1]<0);)u=e.sections[a++],l=e.sections[a++];t(s,c,o,p,h),s=c,o=p}}}function k(e,t,r,n=!1){let i=[],s=n?[]:null,o=new $(e),a=new $(t);for(let e=-1;;)if(-1==o.ins&&-1==a.ins){let e=Math.min(o.len,a.len);A(i,e,-1),o.forward(e),a.forward(e)}else if(a.ins>=0&&(o.ins<0||e==o.i||0==o.off&&(a.len=0&&e=0)){if(o.done&&a.done)return s?w.createSet(i,s):x.create(i);throw new Error("Mismatched change set lengths")}{let t=0,r=o.len;for(;r;)if(-1==a.ins){let e=Math.min(r,a.len);t+=e,r-=e,a.forward(e)}else{if(!(0==a.ins&&a.lent||o.ins>=0&&o.len>t)&&(e||n.length>r),s.forward2(t),o.forward(t)}}else A(n,0,o.ins,e),i&&F(i,n,o.text),o.next()}}class ${constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i>1;return t>=e.length?r.empty:e[t]}textBit(e){let{inserted:t}=this.set,n=this.i-2>>1;return n>=t.length&&!e?r.empty:t[n].slice(this.off,null==e?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){-1==this.ins?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class Q{constructor(e,t,r){this.from=e,this.to=t,this.flags=r}get anchor(){return 32&this.flags?this.to:this.from}get head(){return 32&this.flags?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return 8&this.flags?-1:16&this.flags?1:0}get bidiLevel(){let e=7&this.flags;return 7==e?null:e}get goalColumn(){let e=this.flags>>6;return 16777215==e?void 0:e}map(e,t=-1){let r,n;return this.empty?r=n=e.mapPos(this.from,t):(r=e.mapPos(this.from,1),n=e.mapPos(this.to,-1)),r==this.from&&n==this.to?this:new Q(r,n,this.flags)}extend(e,t=e){if(e<=this.anchor&&t>=this.anchor)return B.range(e,t);let r=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return B.range(this.anchor,r)}eq(e,t=!1){return!(this.anchor!=e.anchor||this.head!=e.head||t&&this.empty&&this.assoc!=e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||"number"!=typeof e.anchor||"number"!=typeof e.head)throw new RangeError("Invalid JSON representation for SelectionRange");return B.range(e.anchor,e.head)}static create(e,t,r){return new Q(e,t,r)}}class B{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:B.create(this.ranges.map((r=>r.map(e,t))),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let r=0;re.toJSON())),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||"number"!=typeof e.main||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new B(e.ranges.map((e=>Q.fromJSON(e))),e.main)}static single(e,t=e){return new B([B.range(e,t)],0)}static create(e,t=0){if(0==e.length)throw new RangeError("A selection needs at least one range");for(let r=0,n=0;ne?8:0)|i)}static normalized(e,t=0){let r=e[t];e.sort(((e,t)=>e.from-t.from)),t=e.indexOf(r);for(let r=1;rn.head?B.range(o,s):B.range(s,o))}}return new B(e,t)}}function _(e,t){for(let r of e.ranges)if(r.to>t)throw new RangeError("Selection points outside of document")}let N=0;class R{constructor(e,t,r,n,i){this.combine=e,this.compareInput=t,this.compare=r,this.isStatic=n,this.id=N++,this.default=e([]),this.extensions="function"==typeof i?i(this):i}get reader(){return this}static define(e={}){return new R(e.combine||(e=>e),e.compareInput||((e,t)=>e===t),e.compare||(e.combine?(e,t)=>e===t:M),!!e.static,e.enables)}of(e){return new I([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new I(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new I(e,this,2,t)}from(e,t){return t||(t=e=>e),this.compute([e],(r=>t(r.field(e))))}}function M(e,t){return e==t||e.length==t.length&&e.every(((e,r)=>e===t[r]))}class I{constructor(e,t,r,n){this.dependencies=e,this.facet=t,this.type=r,this.value=n,this.id=N++}dynamicSlot(e){var t;let r=this.value,n=this.facet.compareInput,i=this.id,s=e[i]>>1,o=2==this.type,a=!1,u=!1,l=[];for(let r of this.dependencies)"doc"==r?a=!0:"selection"==r?u=!0:1&(null!==(t=e[r.id])&&void 0!==t?t:1)||l.push(e[r.id]);return{create:e=>(e.values[s]=r(e),1),update(e,t){if(a&&t.docChanged||u&&(t.docChanged||t.selection)||L(e,l)){let t=r(e);if(o?!j(t,e.values[s],n):!n(t,e.values[s]))return e.values[s]=t,1}return 0},reconfigure:(e,t)=>{let a,u=t.config.address[i];if(null!=u){let i=J(t,u);if(this.dependencies.every((r=>r instanceof R?t.facet(r)===e.facet(r):!(r instanceof V)||t.field(r,!1)==e.field(r,!1)))||(o?j(a=r(e),i,n):n(a=r(e),i)))return e.values[s]=i,0}else a=r(e);return e.values[s]=a,1}}}}function j(e,t,r){if(e.length!=t.length)return!1;for(let n=0;ne[t.id])),i=r.map((e=>e.type)),s=n.filter((e=>!(1&e))),o=e[t.id]>>1;function a(e){let r=[];for(let t=0;te===t),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(X).find((e=>e.field==this));return((null==t?void 0:t.create)||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:e=>(e.values[t]=this.create(e),1),update:(e,r)=>{let n=e.values[t],i=this.updateF(n,r);return this.compareF(n,i)?0:(e.values[t]=i,1)},reconfigure:(e,r)=>null!=r.config.address[this.id]?(e.values[t]=r.field(this),0):(e.values[t]=this.create(e),1)}}init(e){return[this,X.of({field:this,create:e})]}get extension(){return this}}function q(e){return t=>new U(t,e)}const W={highest:q(0),high:q(1),default:q(2),low:q(3),lowest:q(4)};class U{constructor(e,t){this.inner=e,this.prec=t}}class z{of(e){return new Y(this,e)}reconfigure(e){return z.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class Y{constructor(e,t){this.compartment=e,this.inner=t}}class G{constructor(e,t,r,n,i,s){for(this.base=e,this.compartments=t,this.dynamicSlots=r,this.address=n,this.staticValues=i,this.facets=s,this.statusTemplate=[];this.statusTemplate.length>1]}static resolve(e,t,r){let n=[],i=Object.create(null),s=new Map;for(let r of function(e,t,r){let n=[[],[],[],[],[]],i=new Map;return function e(s,o){let a=i.get(s);if(null!=a){if(a<=o)return;let e=n[a].indexOf(s);e>-1&&n[a].splice(e,1),s instanceof Y&&r.delete(s.compartment)}if(i.set(s,o),Array.isArray(s))for(let t of s)e(t,o);else if(s instanceof Y){if(r.has(s.compartment))throw new RangeError("Duplicate use of compartment in extensions");let n=t.get(s.compartment)||s.inner;r.set(s.compartment,n),e(n,o)}else if(s instanceof U)e(s.inner,s.prec);else if(s instanceof V)n[o].push(s),s.provides&&e(s.provides,o);else if(s instanceof I)n[o].push(s),s.facet.extensions&&e(s.facet.extensions,2);else{let t=s.extension;if(!t)throw new Error(`Unrecognized extension value in extension set (${s}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);e(t,o)}}(e,2),n.reduce(((e,t)=>e.concat(t)))}(e,t,s))r instanceof V?n.push(r):(i[r.facet.id]||(i[r.facet.id]=[])).push(r);let o=Object.create(null),a=[],u=[];for(let e of n)o[e.id]=u.length<<1,u.push((t=>e.slot(t)));let l=null==r?void 0:r.config.facets;for(let e in i){let t=i[e],n=t[0].facet,s=l&&l[e]||[];if(t.every((e=>0==e.type)))if(o[n.id]=a.length<<1|1,M(s,t))a.push(r.facet(n));else{let e=n.combine(t.map((e=>e.value)));a.push(r&&n.compare(e,r.facet(n))?r.facet(n):e)}else{for(let e of t)0==e.type?(o[e.id]=a.length<<1|1,a.push(e.value)):(o[e.id]=u.length<<1,u.push((t=>e.dynamicSlot(t))));o[n.id]=u.length<<1,u.push((e=>Z(e,n,t)))}}let c=u.map((e=>e(o)));return new G(e,s,c,o,a,i)}}function H(e,t){if(1&t)return 2;let r=t>>1,n=e.status[r];if(4==n)throw new Error("Cyclic dependency between fields and/or facets");if(2&n)return n;e.status[r]=4;let i=e.computeSlot(e,e.config.dynamicSlots[r]);return e.status[r]=2|i}function J(e,t){return 1&t?e.config.staticValues[t>>1]:e.values[t>>1]}const K=R.define(),ee=R.define({combine:e=>e.some((e=>e)),static:!0}),te=R.define({combine:e=>e.length?e[0]:void 0,static:!0}),re=R.define(),ne=R.define(),ie=R.define(),se=R.define({combine:e=>!!e.length&&e[0]});class oe{constructor(e,t){this.type=e,this.value=t}static define(){return new ae}}class ae{of(e){return new oe(this,e)}}class ue{constructor(e){this.map=e}of(e){return new le(this,e)}}class le{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return void 0===t?void 0:t==this.value?this:new le(this.type,t)}is(e){return this.type==e}static define(e={}){return new ue(e.map||(e=>e))}static mapEffects(e,t){if(!e.length)return e;let r=[];for(let n of e){let e=n.map(t);e&&r.push(e)}return r}}le.reconfigure=le.define(),le.appendConfig=le.define();class ce{constructor(e,t,r,n,i,s){this.startState=e,this.changes=t,this.selection=r,this.effects=n,this.annotations=i,this.scrollIntoView=s,this._doc=null,this._state=null,r&&_(r,t.newLength),i.some((e=>e.type==ce.time))||(this.annotations=i.concat(ce.time.of(Date.now())))}static create(e,t,r,n,i,s){return new ce(e,t,r,n,i,s)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(ce.userEvent);return!(!t||!(t==e||t.length>e.length&&t.slice(0,e.length)==e&&"."==t[e.length]))}}function pe(e,t){let r=[];for(let n=0,i=0;;){let s,o;if(n=e[n]))s=e[n++],o=e[n++];else{if(!(i