From cfe066049cda4e598b779a6e19c26ccf4228fc80 Mon Sep 17 00:00:00 2001 From: jonatanklosko Date: Fri, 17 May 2024 09:15:24 +0000 Subject: [PATCH] Update assets --- static/assets/app.js | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/static/assets/app.js b/static/assets/app.js index bf6d0e54b..95105395a 100644 --- a/static/assets/app.js +++ b/static/assets/app.js @@ -14,7 +14,7 @@ removing illegal node: "${(r.outerHTML||r.nodeValue).trim()}" let liveSocket = new LiveSocket("/live", Socket, {...}) `);this.socket=new e(t,i),this.bindingPrefix=i.bindingPrefix||DL,this.opts=i,this.params=Jl(i.params||{}),this.viewLogger=i.viewLogger,this.metadataCallbacks=i.metadata||{},this.defaults=Object.assign(ch(ML),i.defaults||{}),this.activeElement=null,this.prevActive=null,this.silenced=!1,this.main=null,this.outgoingMainEl=null,this.clickStartedAtTarget=null,this.linkRef=1,this.roots={},this.href=window.location.href,this.pendingLink=null,this.currentLocation=ch(window.location),this.hooks=i.hooks||{},this.uploaders=i.uploaders||{},this.loaderTimeout=i.loaderTimeout||IL,this.reloadWithJitterTimer=null,this.maxReloads=i.maxReloads||wL,this.reloadJitterMin=i.reloadJitterMin||kL,this.reloadJitterMax=i.reloadJitterMax||SL,this.failsafeJitter=i.failsafeJitter||TL,this.localStorage=i.localStorage||window.localStorage,this.sessionStorage=i.sessionStorage||window.sessionStorage,this.boundTopLevelEvents=!1,this.domCallbacks=Object.assign({onPatchStart:Jl(),onPatchEnd:Jl(),onNodeAdded:Jl(),onBeforeElUpdated:Jl()},i.dom||{}),this.transitions=new m7,window.addEventListener("pagehide",r=>{this.unloaded=!0}),this.socket.onOpen(()=>{this.isUnloaded()&&window.location.reload()})}version(){return"1.0.0-rc.0"}isProfileEnabled(){return this.sessionStorage.getItem(sg)==="true"}isDebugEnabled(){return this.sessionStorage.getItem(ih)==="true"}isDebugDisabled(){return this.sessionStorage.getItem(ih)==="false"}enableDebug(){this.sessionStorage.setItem(ih,"true")}enableProfiling(){this.sessionStorage.setItem(sg,"true")}disableDebug(){this.sessionStorage.setItem(ih,"false")}disableProfiling(){this.sessionStorage.removeItem(sg)}enableLatencySim(t){this.enableDebug(),console.log("latency simulator enabled for the duration of this browser session. Call disableLatencySim() to disable"),this.sessionStorage.setItem(ag,t)}disableLatencySim(){this.sessionStorage.removeItem(ag)}getLatencySim(){let t=this.sessionStorage.getItem(ag);return t?parseInt(t):null}getSocket(){return this.socket}connect(){window.location.hostname==="localhost"&&!this.isDebugDisabled()&&this.enableDebug();let t=()=>{this.joinRootViews()?(this.bindTopLevelEvents(),this.socket.connect()):this.main?this.socket.connect():this.bindTopLevelEvents({dead:!0}),this.joinDeadView()};["complete","loaded","interactive"].indexOf(document.readyState)>=0?t():document.addEventListener("DOMContentLoaded",()=>t())}disconnect(t){clearTimeout(this.reloadWithJitterTimer),this.socket.disconnect(t)}replaceTransport(t){clearTimeout(this.reloadWithJitterTimer),this.socket.replaceTransport(t),this.connect()}execJS(t,e,i=null){this.owner(t,r=>Ti.exec(i,e,r,t))}execJSHookPush(t,e,i,r){this.withinOwners(t,n=>{Ti.exec("hook",e,n,t,["push",{data:i,callback:r}])})}unload(){this.unloaded||(this.main&&this.isConnected()&&this.log(this.main,"socket",()=>["disconnect for page nav"]),this.unloaded=!0,this.destroyAllViews(),this.disconnect())}triggerDOM(t,e){this.domCallbacks[t](...e)}time(t,e){if(!this.isProfileEnabled()||!console.time)return e();console.time(t);let i=e();return console.timeEnd(t),i}log(t,e,i){if(this.viewLogger){let[r,n]=i();this.viewLogger(t,e,r,n)}else if(this.isDebugEnabled()){let[r,n]=i();qL(t,e,r,n)}}requestDOMUpdate(t){this.transitions.after(t)}transition(t,e,i=function(){}){this.transitions.addTransition(t,e,i)}onChannel(t,e,i){t.on(e,r=>{let n=this.getLatencySim();n?setTimeout(()=>i(r),n):i(r)})}wrapPush(t,e,i){let r=this.getLatencySim(),n=t.joinCount;if(!r)return this.isConnected()&&e.timeout?i().receive("timeout",()=>{t.joinCount===n&&!t.isDestroyed()&&this.reloadWithJitter(t,()=>{this.log(t,"timeout",()=>["received timeout while communicating with server. Falling back to hard refresh for recovery"])})}):i();let o={receives:[],receive(s,a){this.receives.push([s,a])}};return setTimeout(()=>{t.isDestroyed()||o.receives.reduce((s,[a,l])=>s.receive(a,l),i())},r),o}reloadWithJitter(t,e){clearTimeout(this.reloadWithJitterTimer),this.disconnect();let i=this.reloadJitterMin,r=this.reloadJitterMax,n=Math.floor(Math.random()*(r-i+1))+i,o=Kr.updateLocal(this.localStorage,window.location.pathname,qk,0,s=>s+1);o>this.maxReloads&&(n=this.failsafeJitter),this.reloadWithJitterTimer=setTimeout(()=>{t.isDestroyed()||t.isConnected()||(t.destroy(),e?e():this.log(t,"join",()=>[`encountered ${o} consecutive reloads`]),o>this.maxReloads&&this.log(t,"join",()=>[`exceeded ${this.maxReloads} consecutive reloads. Entering failsafe mode`]),this.hasPendingLink()?window.location=this.pendingLink:window.location.reload())},n)}getHookCallbacks(t){return t&&t.startsWith("Phoenix.")?GL[t.split(".")[1]]:this.hooks[t]}isUnloaded(){return this.unloaded}isConnected(){return this.socket.isConnected()}getBindingPrefix(){return this.bindingPrefix}binding(t){return`${this.getBindingPrefix()}${t}`}channel(t,e){return this.socket.channel(t,e)}joinDeadView(){let t=document.body;if(t&&!this.isPhxView(t)&&!this.isPhxView(document.firstElementChild)){let e=this.newRootView(t);e.setHref(this.getHref()),e.joinDead(),this.main||(this.main=e),window.requestAnimationFrame(()=>e.execNewMounted())}}joinRootViews(){let t=!1;return te.all(document,`${wa}:not([${ba}])`,e=>{if(!this.getRootById(e.id)){let i=this.newRootView(e);i.setHref(this.getHref()),i.join(),e.hasAttribute(Og)&&(this.main=i)}t=!0}),t}redirect(t,e){this.unload(),Kr.redirect(t,e)}replaceMain(t,e,i=null,r=this.setPendingLink(t)){let n=this.currentLocation.href;this.outgoingMainEl=this.outgoingMainEl||this.main.el;let o=te.cloneNode(this.outgoingMainEl,"");this.main.showLoader(this.loaderTimeout),this.main.destroy(),this.main=this.newRootView(o,e,n),this.main.setRedirect(t),this.transitionRemoves(null,!0),this.main.join((s,a)=>{s===1&&this.commitPendingLink(r)&&this.requestDOMUpdate(()=>{te.findPhxSticky(document).forEach(l=>o.appendChild(l)),this.outgoingMainEl.replaceWith(o),this.outgoingMainEl=null,i&&i(r),a()})})}transitionRemoves(t,e){let i=this.binding("remove");if(t=t||te.all(document,`[${i}]`),e){let r=te.findPhxSticky(document)||[];t=t.filter(n=>!te.isChildOfAny(n,r))}t.forEach(r=>{this.execJS(r,r.getAttribute(i),"remove")})}isPhxView(t){return t.getAttribute&&t.getAttribute(po)!==null}newRootView(t,e,i){let r=new Kk(t,this,null,e,i);return this.roots[r.id]=r,r}owner(t,e){let i=ho(t.closest(wa),r=>this.getViewByEl(r))||this.main;i&&e(i)}withinOwners(t,e){this.owner(t,i=>e(i,t))}getViewByEl(t){let e=t.getAttribute(va);return ho(this.getRootById(e),i=>i.getDescendentByEl(t))}getRootById(t){return this.roots[t]}destroyAllViews(){for(let t in this.roots)this.roots[t].destroy(),delete this.roots[t];this.main=null}destroyViewByEl(t){let e=this.getRootById(t.getAttribute(va));e&&e.id===t.id?(e.destroy(),delete this.roots[e.id]):e&&e.destroyDescendent(t.id)}setActiveElement(t){if(this.activeElement===t)return;this.activeElement=t;let e=()=>{t===this.activeElement&&(this.activeElement=null),t.removeEventListener("mouseup",this),t.removeEventListener("touchend",this)};t.addEventListener("mouseup",e),t.addEventListener("touchend",e)}getActiveElement(){return document.activeElement===document.body?this.activeElement||document.activeElement:document.activeElement||document.body}dropActiveElement(t){this.prevActive&&t.ownsElement(this.prevActive)&&(this.prevActive=null)}restorePreviouslyActiveFocus(){this.prevActive&&this.prevActive!==document.body&&this.prevActive.focus()}blurActiveElement(){this.prevActive=this.getActiveElement(),this.prevActive!==document.body&&this.prevActive.blur()}bindTopLevelEvents({dead:t}={}){this.boundTopLevelEvents||(this.boundTopLevelEvents=!0,this.socket.onClose(e=>{if(e&&e.code===1e3&&this.main)return this.reloadWithJitter(this.main)}),document.body.addEventListener("click",function(){}),window.addEventListener("pageshow",e=>{e.persisted&&(this.getSocket().disconnect(),this.withPageLoading({to:window.location.href,kind:"redirect"}),window.location.reload())},!0),t||this.bindNav(),this.bindClicks(),t||this.bindForms(),this.bind({keyup:"keyup",keydown:"keydown"},(e,i,r,n,o,s)=>{let a=n.getAttribute(this.binding(XL)),l=e.key&&e.key.toLowerCase();if(a&&a.toLowerCase()!==l)return;let c=H({key:e.key},this.eventMeta(i,e,n));Ti.exec(i,o,r,n,["push",{data:c}])}),this.bind({blur:"focusout",focus:"focusin"},(e,i,r,n,o,s)=>{if(!s){let a=H({key:e.key},this.eventMeta(i,e,n));Ti.exec(i,o,r,n,["push",{data:a}])}}),this.bind({blur:"blur",focus:"focus"},(e,i,r,n,o,s)=>{if(s==="window"){let a=this.eventMeta(i,e,n);Ti.exec(i,o,r,n,["push",{data:a}])}}),window.addEventListener("dragover",e=>e.preventDefault()),window.addEventListener("drop",e=>{e.preventDefault();let i=ho(oc(e.target,this.binding(gk)),o=>o.getAttribute(this.binding(gk))),r=i&&document.getElementById(i),n=Array.from(e.dataTransfer.files||[]);!r||r.disabled||n.length===0||!(r.files instanceof FileList)||(Lt.trackFiles(r,n,e.dataTransfer),r.dispatchEvent(new Event("input",{bubbles:!0})))}),this.on(Bk,e=>{let i=e.target;if(!te.isUploadInput(i))return;let r=Array.from(e.detail.files||[]).filter(n=>n instanceof File||n instanceof Blob);Lt.trackFiles(i,r),i.dispatchEvent(new Event("input",{bubbles:!0}))}))}eventMeta(t,e,i){let r=this.metadataCallbacks[t];return r?r(e,i):{}}setPendingLink(t){return this.linkRef++,this.pendingLink=t,this.linkRef}commitPendingLink(t){return this.linkRef!==t?!1:(this.href=this.pendingLink,this.pendingLink=null,!0)}getHref(){return this.href}hasPendingLink(){return!!this.pendingLink}bind(t,e){for(let i in t){let r=t[i];this.on(r,n=>{let o=this.binding(i),s=this.binding(`window-${i}`),a=n.target.getAttribute&&n.target.getAttribute(o);a?this.debounce(n.target,n,r,()=>{this.withinOwners(n.target,l=>{e(n,i,l,n.target,a,null)})}):te.all(document,`[${s}]`,l=>{let c=l.getAttribute(s);this.debounce(l,n,r,()=>{this.withinOwners(l,u=>{e(n,i,u,l,c,"window")})})})})}}bindClicks(){window.addEventListener("mousedown",t=>this.clickStartedAtTarget=t.target),this.bindClick("click","click",!1),this.bindClick("mousedown","capture-click",!0)}bindClick(t,e,i){let r=this.binding(e);window.addEventListener(t,n=>{let o=null;if(i)o=n.target.matches(`[${r}]`)?n.target:n.target.querySelector(`[${r}]`);else{n.detail===0&&(this.clickStartedAtTarget=n.target);let a=this.clickStartedAtTarget||n.target;o=oc(a,r),this.dispatchClickAway(n,a),this.clickStartedAtTarget=null}let s=o&&o.getAttribute(r);if(!s){!i&&te.isNewPageClick(n,window.location)&&this.unload();return}o.getAttribute("href")==="#"&&n.preventDefault(),!o.hasAttribute(Yi)&&this.debounce(o,n,"click",()=>{this.withinOwners(o,a=>{Ti.exec("click",s,a,o,["push",{data:this.eventMeta("click",n,o)}])})})},i)}dispatchClickAway(t,e){let i=this.binding("click-away");te.all(document,`[${i}]`,r=>{r.isSameNode(e)||r.contains(e)||this.withinOwners(r,n=>{let o=r.getAttribute(i);Ti.isVisible(r)&&Ti.isInViewport(r)&&Ti.exec("click",o,n,r,["push",{data:this.eventMeta("click",t,t.target)}])})})}bindNav(){if(!Kr.canPushState())return;history.scrollRestoration&&(history.scrollRestoration="manual");let t=null;window.addEventListener("scroll",e=>{clearTimeout(t),t=setTimeout(()=>{Kr.updateCurrentState(i=>Object.assign(i,{scroll:window.scrollY}))},100)}),window.addEventListener("popstate",e=>{if(!this.registerNewLocation(window.location))return;let{type:i,id:r,root:n,scroll:o}=e.state||{},s=window.location.href;te.dispatchEvent(window,"phx:navigate",{detail:{href:s,patch:i==="patch",pop:!0}}),this.requestDOMUpdate(()=>{this.main.isConnected()&&i==="patch"&&r===this.main.id?this.main.pushLinkPatch(s,null,()=>{this.maybeScroll(o)}):this.replaceMain(s,null,()=>{n&&this.replaceRootHistory(),this.maybeScroll(o)})})},!1),window.addEventListener("click",e=>{let i=oc(e.target,eg),r=i&&i.getAttribute(eg);if(!r||!this.isConnected()||!this.main||te.wantsNewTab(e))return;let n=i.href instanceof SVGAnimatedString?i.href.baseVal:i.href,o=i.getAttribute(CL);e.preventDefault(),e.stopImmediatePropagation(),this.pendingLink!==n&&this.requestDOMUpdate(()=>{if(r==="patch")this.pushHistoryPatch(n,o,i);else if(r==="redirect")this.historyRedirect(n,o);else throw new Error(`expected ${eg} to be "patch" or "redirect", got: ${r}`);let s=i.getAttribute(this.binding("click"));s&&this.requestDOMUpdate(()=>this.execJS(i,s,"click"))})},!1)}maybeScroll(t){typeof t=="number"&&requestAnimationFrame(()=>{window.scrollTo(0,t)})}dispatchEvent(t,e={}){te.dispatchEvent(window,`phx:${t}`,{detail:e})}dispatchEvents(t){t.forEach(([e,i])=>this.dispatchEvent(e,i))}withPageLoading(t,e){te.dispatchEvent(window,"phx:page-loading-start",{detail:t});let i=()=>te.dispatchEvent(window,"phx:page-loading-stop",{detail:t});return e?e(i):i}pushHistoryPatch(t,e,i){if(!this.isConnected()||!this.main.isMain())return Kr.redirect(t);this.withPageLoading({to:t,kind:"patch"},r=>{this.main.pushLinkPatch(t,i,n=>{this.historyPatch(t,e,n),r()})})}historyPatch(t,e,i=this.setPendingLink(t)){this.commitPendingLink(i)&&(Kr.pushState(e,{type:"patch",id:this.main.id},t),te.dispatchEvent(window,"phx:navigate",{detail:{patch:!0,href:t,pop:!1}}),this.registerNewLocation(window.location))}historyRedirect(t,e,i){if(!this.isConnected()||!this.main.isMain())return Kr.redirect(t,i);if(/^\/$|^\/[^\/]+.*$/.test(t)){let{protocol:n,host:o}=window.location;t=`${n}//${o}${t}`}let r=window.scrollY;this.withPageLoading({to:t,kind:"redirect"},n=>{this.replaceMain(t,i,o=>{o===this.linkRef&&(Kr.pushState(e,{type:"redirect",id:this.main.id,scroll:r},t),te.dispatchEvent(window,"phx:navigate",{detail:{href:t,patch:!1,pop:!1}}),this.registerNewLocation(window.location)),n()})})}replaceRootHistory(){Kr.pushState("replace",{root:!0,type:"patch",id:this.main.id})}registerNewLocation(t){let{pathname:e,search:i}=this.currentLocation;return e+i===t.pathname+t.search?!1:(this.currentLocation=ch(t),!0)}bindForms(){let t=0,e=!1;this.on("submit",i=>{let r=i.target.getAttribute(this.binding("submit")),n=i.target.getAttribute(this.binding("change"));!e&&n&&!r&&(e=!0,i.preventDefault(),this.withinOwners(i.target,o=>{o.disableForm(i.target),window.requestAnimationFrame(()=>{te.isUnloadableFormSubmit(i)&&this.unload(),i.target.submit()})}))},!0),this.on("submit",i=>{let r=i.target.getAttribute(this.binding("submit"));if(!r){te.isUnloadableFormSubmit(i)&&this.unload();return}i.preventDefault(),i.target.disabled=!0,this.withinOwners(i.target,n=>{Ti.exec("submit",r,n,i.target,["push",{submitter:i.submitter}])})},!1);for(let i of["change","input"])this.on(i,r=>{let n=this.binding("change"),o=r.target,s=o.getAttribute(n),a=o.form&&o.form.getAttribute(n),l=s||a;if(!l||o.type==="number"&&o.validity&&o.validity.badInput)return;let c=s?o:o.form,u=t;t++;let{at:f,type:d}=te.private(o,"prev-iteration")||{};f===u-1&&i==="change"&&d==="input"||(te.putPrivate(o,"prev-iteration",{at:u,type:i}),this.debounce(o,r,i,()=>{this.withinOwners(c,p=>{te.putPrivate(o,rc,!0),te.isTextualInput(o)||this.setActiveElement(o),Ti.exec("change",l,p,o,["push",{_target:r.target.name,dispatcher:c}])})}))},!1);this.on("reset",i=>{let r=i.target;te.resetForm(r);let n=Array.from(r.elements).find(o=>o.type==="reset");n&&window.requestAnimationFrame(()=>{n.dispatchEvent(new Event("input",{bubbles:!0,cancelable:!1}))})})}debounce(t,e,i,r){if(i==="blur"||i==="focusout")return r();let n=this.binding(AL),o=this.binding($L),s=this.defaults.debounce.toString(),a=this.defaults.throttle.toString();this.withinOwners(t,l=>{let c=()=>!l.isDestroyed()&&document.body.contains(t);te.debounce(t,e,n,s,o,a,c,()=>{r()})})}silenceEvents(t){this.silenced=!0,t(),this.silenced=!1}on(t,e){window.addEventListener(t,i=>{this.silenced||e(i)})}},m7=class{constructor(){this.transitions=new Set,this.pendingOps=[]}reset(){this.transitions.forEach(t=>{clearTimeout(t),this.transitions.delete(t)}),this.flushPendingOps()}after(t){this.size()===0?t():this.pushPendingOp(t)}addTransition(t,e,i){e();let r=setTimeout(()=>{this.transitions.delete(r),i(),this.flushPendingOps()},t);this.transitions.add(r)}pushPendingOp(t){this.pendingOps.push(t)}size(){return this.transitions.size}flushPendingOps(){if(this.size()>0)return;let t=this.pendingOps.shift();t&&(t(),this.flushPendingOps())}};var eS="livebook:";function cs(t){try{let e=localStorage.getItem(eS+t);if(e)return JSON.parse(e)}catch(e){console.error(`Failed to load from local storage, reason: ${e.message}`)}}function ka(t,e){try{let i=JSON.stringify(e);localStorage.setItem(eS+t,i)}catch(i){console.error(`Failed to write to local storage, reason: ${i.message}`)}}var tS="app_auth_token:";function iS(t,e){ka(tS+t,e)}function rS(){let t=window.location.pathname;if(t.startsWith("/apps/")){let e=t.split("/")[2],i=cs(tS+e);if(i)return i}return null}var g7={mounted(){this.handleEvent("persist_app_auth",({slug:t,token:e})=>{iS(t,e),this.pushEvent("app_auth_persisted")})}},nS=g7;function ht(t,e){let i={};for(let r of e){let n=`data-p-${r}`;if(!t.hasAttribute(n))throw new Error(`Missing attribute "${n}" on element <${t.tagName}:${t.id}>`);let o=t.getAttribute(n);i[b7(r)]=JSON.parse(o)}return i}function b7(t){let[e,...i]=t.split("-");return[e,...i.map(r=>r.charAt(0).toUpperCase()+r.slice(1))].join("")}function oS(t,e,i){let n=new ArrayBuffer(44+t.byteLength),o=new DataView(n),s=t.byteLength/4,a=4,l=e*a,c=i*l,u=s*l,f=0;function d(S){o.setUint32(f,S,!1),f+=4}function p(S){o.setUint32(f,S,!0),f+=4}function g(S){o.setUint16(f,S,!0),f+=2}function x(S){o.setFloat32(f,S,!0),f+=4}d(1380533830),p(36+u),d(1463899717),d(1718449184),p(16),g(3),g(e),p(i),p(c),g(l),g(a*8),d(1684108385),p(u);let w=new Float32Array(t);for(let S=0;S{this.inputEl.click()}),this.inputEl.addEventListener("change",t=>{let[e]=t.target.files;e&&this.loadFile(e)}),this.el.addEventListener("dragover",t=>{t.stopPropagation(),t.preventDefault(),t.dataTransfer.dropEffect="copy"}),this.el.addEventListener("drop",t=>{t.stopPropagation(),t.preventDefault();let[e]=t.dataTransfer.files;e&&!this.isRecording()&&this.loadFile(e)}),this.el.addEventListener("dragenter",t=>{this.el.classList.add(...bg)}),this.el.addEventListener("dragleave",t=>{this.el.contains(t.relatedTarget)||this.el.classList.remove(...bg)}),this.el.addEventListener("drop",t=>{this.el.classList.remove(...bg)}),this.recordButton.addEventListener("click",t=>{this.startRecording()}),this.stopButton.addEventListener("click",t=>{this.stopRecording()}),this.cancelButton.addEventListener("click",t=>{this.stopRecording(!1)})},updated(){this.props=this.getProps(),this.audioEl.src=this.props.audioUrl},getProps(){return ht(this.el,["id","phx-target","sampling-rate","endianness","format","audio-url"])},startRecording(){this.audioEl.classList.add("hidden"),this.uploadButton.classList.add("hidden"),this.recordButton.classList.add("hidden"),this.stopButton.classList.remove("hidden"),this.cancelButton.classList.remove("hidden"),this.audioChunks=[],navigator.mediaDevices.getUserMedia({audio:!0}).then(t=>{this.mediaRecorder=new MediaRecorder(t),this.mediaRecorder.addEventListener("dataavailable",e=>{this.audioChunks.push(e.data)}),this.mediaRecorder.start()})},stopRecording(t=!0){this.audioEl.classList.remove("hidden"),this.uploadButton.classList.remove("hidden"),this.recordButton.classList.remove("hidden"),this.stopButton.classList.add("hidden"),this.cancelButton.classList.add("hidden"),t&&this.mediaRecorder.addEventListener("stop",e=>{new Blob(this.audioChunks).arrayBuffer().then(r=>{this.loadEncodedAudio(r)})}),this.mediaRecorder.stop()},isRecording(){return this.mediaRecorder&&this.mediaRecorder.state==="recording"},loadFile(t){let e=new FileReader;e.onload=i=>{this.loadEncodedAudio(i.target.result)},e.readAsArrayBuffer(t)},loadEncodedAudio(t){this.pushEventTo(this.props.phxTarget,"decoding",{}),new AudioContext({sampleRate:this.props.samplingRate}).decodeAudioData(t,i=>{let r=x7(i);this.pushAudio(r)})},pushAudio(t){let e={num_channels:t.numChannels,sampling_rate:t.samplingRate},i=this.encodeAudio(t),r=new Blob([i]);r.meta=()=>e,this.uploadTo(this.props.phxTarget,"file",[r])},encodeAudio(t){if(this.props.format==="pcm_f32")return v7(t.data,this.props.endianness);if(this.props.format==="wav")return oS(t.data,t.numChannels,t.samplingRate)}};function x7(t){let e=t.numberOfChannels,i=t.sampleRate,r=t.length,n=4*e*r,o=new ArrayBuffer(n),s=new Float32Array(o);for(let a=0;a=0;l--)r=i[l],n=r.name,o=r.namespaceURI,s=r.value,o?(n=r.localName||n,a=t.getAttributeNS(o,n),a!==s&&(r.prefix==="xmlns"&&(n=r.name),t.setAttributeNS(o,n,s))):(a=t.getAttribute(n),a!==s&&t.setAttribute(n,s));for(var c=t.attributes,u=c.length-1;u>=0;u--)r=c[u],n=r.name,o=r.namespaceURI,o?(n=r.localName||n,e.hasAttributeNS(o,n)||t.removeAttributeNS(o,n)):e.hasAttribute(n)||t.removeAttribute(n)}}var fh,S7="http://www.w3.org/1999/xhtml",Li=typeof document=="undefined"?void 0:document,T7=!!Li&&"content"in Li.createElement("template"),E7=!!Li&&Li.createRange&&"createContextualFragment"in Li.createRange();function C7(t){var e=Li.createElement("template");return e.innerHTML=t,e.content.childNodes[0]}function _7(t){fh||(fh=Li.createRange(),fh.selectNode(Li.body));var e=fh.createContextualFragment(t);return e.childNodes[0]}function P7(t){var e=Li.createElement("body");return e.innerHTML=t,e.childNodes[0]}function Q7(t){return t=t.trim(),T7?C7(t):E7?_7(t):P7(t)}function hh(t,e){var i=t.nodeName,r=e.nodeName,n,o;return i===r?!0:(n=i.charCodeAt(0),o=r.charCodeAt(0),n<=90&&o>=97?i===r.toUpperCase():o<=90&&n>=97?r===i.toUpperCase():!1)}function A7(t,e){return!e||e===S7?Li.createElement(t):Li.createElementNS(e,t)}function $7(t,e){for(var i=t.firstChild;i;){var r=i.nextSibling;e.appendChild(i),i=r}return e}function yg(t,e,i){t[i]!==e[i]&&(t[i]=e[i],t[i]?t.setAttribute(i,""):t.removeAttribute(i))}var uS={OPTION:function(t,e){var i=t.parentNode;if(i){var r=i.nodeName.toUpperCase();r==="OPTGROUP"&&(i=i.parentNode,r=i&&i.nodeName.toUpperCase()),r==="SELECT"&&!i.hasAttribute("multiple")&&(t.hasAttribute("selected")&&!e.selected&&(t.setAttribute("selected","selected"),t.removeAttribute("selected")),i.selectedIndex=-1)}yg(t,e,"selected")},INPUT:function(t,e){yg(t,e,"checked"),yg(t,e,"disabled"),t.value!==e.value&&(t.value=e.value),e.hasAttribute("value")||t.removeAttribute("value")},TEXTAREA:function(t,e){var i=e.value;t.value!==i&&(t.value=i);var r=t.firstChild;if(r){var n=r.nodeValue;if(n==i||!i&&n==t.placeholder)return;r.nodeValue=i}},SELECT:function(t,e){if(!e.hasAttribute("multiple")){for(var i=-1,r=0,n=t.firstChild,o,s;n;)if(s=n.nodeName&&n.nodeName.toUpperCase(),s==="OPTGROUP")o=n,n=o.firstChild;else{if(s==="OPTION"){if(n.hasAttribute("selected")){i=r;break}r++}n=n.nextSibling,!n&&o&&(n=o.nextSibling,o=null)}t.selectedIndex=i}}},ac=1,fS=11,hS=3,dS=8;function Oo(){}function X7(t){if(t)return t.getAttribute&&t.getAttribute("id")||t.id}function R7(t){return function(i,r,n){if(n||(n={}),typeof r=="string")if(i.nodeName==="#document"||i.nodeName==="HTML"||i.nodeName==="BODY"){var o=r;r=Li.createElement("html"),r.innerHTML=o}else r=Q7(r);else r.nodeType===fS&&(r=r.firstElementChild);var s=n.getNodeKey||X7,a=n.onBeforeNodeAdded||Oo,l=n.onNodeAdded||Oo,c=n.onBeforeElUpdated||Oo,u=n.onElUpdated||Oo,f=n.onBeforeNodeDiscarded||Oo,d=n.onNodeDiscarded||Oo,p=n.onBeforeElChildrenUpdated||Oo,g=n.skipFromChildren||Oo,x=n.addChild||function(q,le){return q.appendChild(le)},w=n.childrenOnly===!0,S=Object.create(null),T=[];function A(q){T.push(q)}function I(q,le){if(q.nodeType===ac)for(var V=q.firstChild;V;){var E=void 0;le&&(E=s(V))?A(E):(d(V),V.firstChild&&I(V,le)),V=V.nextSibling}}function D(q,le,V){f(q)!==!1&&(le&&le.removeChild(q),d(q),I(q,V))}function C(q){if(q.nodeType===ac||q.nodeType===fS)for(var le=q.firstChild;le;){var V=s(le);V&&(S[V]=le),C(le),le=le.nextSibling}}C(i);function j(q){l(q);for(var le=q.firstChild;le;){var V=le.nextSibling,E=s(le);if(E){var B=S[E];B&&hh(le,B)?(le.parentNode.replaceChild(B,le),F(B,le)):j(le)}else j(le);le=V}}function se(q,le,V){for(;le;){var E=le.nextSibling;(V=s(le))?A(V):D(le,q,!0),le=E}}function F(q,le,V){var E=s(le);E&&delete S[E],!(!V&&(c(q,le)===!1||(t(q,le),u(q),p(q,le)===!1)))&&(q.nodeName!=="TEXTAREA"?U(q,le):uS.TEXTAREA(q,le))}function U(q,le){var V=g(q,le),E=le.firstChild,B=q.firstChild,re,L,Ue,Be,Ze;e:for(;E;){for(Be=E.nextSibling,re=s(E);!V&&B;){if(Ue=B.nextSibling,E.isSameNode&&E.isSameNode(B)){E=Be,B=Ue;continue e}L=s(B);var $t=B.nodeType,Xe=void 0;if($t===E.nodeType&&($t===ac?(re?re!==L&&((Ze=S[re])?Ue===Ze?Xe=!1:(q.insertBefore(Ze,B),L?A(L):D(B,q,!0),B=Ze,L=s(B)):Xe=!1):L&&(Xe=!1),Xe=Xe!==!1&&hh(B,E),Xe&&F(B,E)):($t===hS||$t==dS)&&(Xe=!0,B.nodeValue!==E.nodeValue&&(B.nodeValue=E.nodeValue))),Xe){E=Be,B=Ue;continue e}L?A(L):D(B,q,!0),B=Ue}if(re&&(Ze=S[re])&&hh(Ze,E))V||x(q,Ze),F(Ze,E);else{var Ct=a(E);Ct!==!1&&(Ct&&(E=Ct),E.actualize&&(E=E.actualize(q.ownerDocument||Li)),x(q,E),j(E))}E=Be,B=Ue}se(q,B,L);var _t=uS[q.nodeName];_t&&_t(q,le)}var ae=i,ue=ae.nodeType,ie=r.nodeType;if(!w){if(ue===ac)ie===ac?hh(i,r)||(d(i),ae=$7(i,A7(r.nodeName,r.namespaceURI))):ae=r;else if(ue===hS||ue===dS){if(ie===ue)return ae.nodeValue!==r.nodeValue&&(ae.nodeValue=r.nodeValue),ae;ae=r}}if(ae===r)d(i);else{if(r.isSameNode&&r.isSameNode(ae))return;if(F(ae,r,w),T)for(var he=0,me=T.length;hes.length,l;a&&s.push(n);try{l=t.apply(this,s)}catch(c){let u=c;if(a&&i)throw u;return n(u)}a||(l instanceof Promise?l.then(o,n):l instanceof Error?n(l):o(l))}function n(s,...a){i||(i=!0,e(s,...a))}function o(s){n(null,s)}}function wg(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?TS(t.position):"start"in t||"end"in t?TS(t):"line"in t||"column"in t?vg(t):""}function vg(t){return ES(t&&t.line)+":"+ES(t&&t.column)}function TS(t){return vg(t&&t.start)+"-"+vg(t&&t.end)}function ES(t){return t&&typeof t=="number"?t:1}var Dt=class extends Error{constructor(e,i,r){super(),typeof i=="string"&&(r=i,i=void 0);let n="",o={},s=!1;if(i&&("line"in i&&"column"in i?o={place:i}:"start"in i&&"end"in i?o={place:i}:"type"in i?o={ancestors:[i],place:i.position}:o=H({},i)),typeof e=="string"?n=e:!o.cause&&e&&(s=!0,n=e.message,o.cause=e),!o.ruleId&&!o.source&&typeof r=="string"){let l=r.indexOf(":");l===-1?o.ruleId=r:(o.source=r.slice(0,l),o.ruleId=r.slice(l+1))}if(!o.place&&o.ancestors&&o.ancestors){let l=o.ancestors[o.ancestors.length-1];l&&(o.place=l.position)}let a=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file,this.message=n,this.line=a?a.line:void 0,this.name=wg(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=s&&o.cause&&typeof o.cause.stack=="string"?o.cause.stack:"",this.actual,this.expected,this.note,this.url}};Dt.prototype.file="";Dt.prototype.name="";Dt.prototype.reason="";Dt.prototype.message="";Dt.prototype.stack="";Dt.prototype.column=void 0;Dt.prototype.line=void 0;Dt.prototype.ancestors=void 0;Dt.prototype.cause=void 0;Dt.prototype.fatal=void 0;Dt.prototype.place=void 0;Dt.prototype.ruleId=void 0;Dt.prototype.source=void 0;var Qr={basename:D7,dirname:N7,extname:M7,join:U7,sep:"/"};function D7(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');cc(t);let i=0,r=-1,n=t.length,o;if(e===void 0||e.length===0||e.length>t.length){for(;n--;)if(t.codePointAt(n)===47){if(o){i=n+1;break}}else r<0&&(o=!0,r=n+1);return r<0?"":t.slice(i,r)}if(e===t)return"";let s=-1,a=e.length-1;for(;n--;)if(t.codePointAt(n)===47){if(o){i=n+1;break}}else s<0&&(o=!0,s=n+1),a>-1&&(t.codePointAt(n)===e.codePointAt(a--)?a<0&&(r=n):(a=-1,r=s));return i===r?r=s:r<0&&(r=t.length),t.slice(i,r)}function N7(t){if(cc(t),t.length===0)return".";let e=-1,i=t.length,r;for(;--i;)if(t.codePointAt(i)===47){if(r){e=i;break}}else r||(r=!0);return e<0?t.codePointAt(0)===47?"/":".":e===1&&t.codePointAt(0)===47?"//":t.slice(0,e)}function M7(t){cc(t);let e=t.length,i=-1,r=0,n=-1,o=0,s;for(;e--;){let a=t.codePointAt(e);if(a===47){if(s){r=e+1;break}continue}i<0&&(s=!0,i=e+1),a===46?n<0?n=e:o!==1&&(o=1):n>-1&&(o=-1)}return n<0||i<0||o===0||o===1&&n===i-1&&n===r+1?"":t.slice(n,i)}function U7(...t){let e=-1,i;for(;++e0&&t.codePointAt(t.length-1)===47&&(i+="/"),e?"/"+i:i}function j7(t,e){let i="",r=0,n=-1,o=0,s=-1,a,l;for(;++s<=t.length;){if(s2){if(l=i.lastIndexOf("/"),l!==i.length-1){l<0?(i="",r=0):(i=i.slice(0,l),r=i.length-1-i.lastIndexOf("/")),n=s,o=0;continue}}else if(i.length>0){i="",r=0,n=s,o=0;continue}}e&&(i=i.length>0?i+"/..":"..",r=2)}else i.length>0?i+="/"+t.slice(n+1,s):i=t.slice(n+1,s),r=s-n-1;n=s,o=0}else a===46&&o>-1?o++:o=-1}return i}function cc(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}var CS={cwd:q7};function q7(){return"/"}function Sa(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function _S(t){if(typeof t=="string")t=new URL(t);else if(!Sa(t)){let e=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+t+"`");throw e.code="ERR_INVALID_ARG_TYPE",e}if(t.protocol!=="file:"){let e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return W7(t)}function W7(t){if(t.hostname!==""){let r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}let e=t.pathname,i=-1;for(;++i0){let[p,...g]=u,x=r[d][1];lc(x)&&lc(p)&&(p=(0,Oh.default)(!0,x,p)),r[d]=[c,p,...g]}}}},mh=new Pg().freeze();function Eg(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function Cg(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function _g(t,e){if(e)throw new Error("Cannot call `"+t+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function AS(t){if(!lc(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function $S(t,e,i){if(!i)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function ph(t){return V7(t)?t:new mo(t)}function V7(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function Y7(t){return typeof t=="string"||F7(t)}function F7(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}var H7={};function Qg(t,e){let i=e||H7,r=typeof i.includeImageAlt=="boolean"?i.includeImageAlt:!0,n=typeof i.includeHtml=="boolean"?i.includeHtml:!0;return RS(t,r,n)}function RS(t,e,i){if(G7(t)){if("value"in t)return t.type==="html"&&!i?"":t.value;if(e&&"alt"in t&&t.alt)return t.alt;if("children"in t)return XS(t.children,e,i)}return Array.isArray(t)?XS(t,e,i):""}function XS(t,e,i){let r=[],n=-1;for(;++nn?0:n+e:e=e>n?n:e,i=i>0?i:0,r.length<1e4)s=Array.from(r),s.unshift(e,i),t.splice(...s);else for(i&&t.splice(e,i);o0?(ii(t,t.length,0,e),t):e}var IS={}.hasOwnProperty;function LS(t){let e={},i=-1;for(;++i13&&i<32||i>126&&i<160||i>55295&&i<57344||i>64975&&i<65008||(i&65535)===65535||(i&65535)===65534||i>1114111?"\uFFFD":String.fromCharCode(i)}function En(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}var e8=go(new RegExp("\\p{P}","u")),Hi=go(/[A-Za-z]/),Ci=go(/[\dA-Za-z]/),DS=go(/[#-'*+\--9=?A-Z^-~]/);function uc(t){return t!==null&&(t<32||t===127)}var fc=go(/\d/),NS=go(/[\dA-Fa-f]/),Ag=go(/[!-/:-@[-`{-~]/);function ke(t){return t!==null&&t<-2}function Rt(t){return t!==null&&(t<0||t===32)}function Ie(t){return t===-2||t===-1||t===32}function MS(t){return Ag(t)||e8(t)}var US=go(/\s/);function go(t){return e;function e(i){return i!==null&&i>-1&&t.test(String.fromCharCode(i))}}function Le(t,e,i,r){let n=r?r-1:Number.POSITIVE_INFINITY,o=0;return s;function s(l){return Ie(l)?(t.enter(i),a(l)):e(l)}function a(l){return Ie(l)&&o++s))return;let j=e.events.length,se=j,F,U;for(;se--;)if(e.events[se][0]==="exit"&&e.events[se][1].type==="chunkFlow"){if(F){U=e.events[se][1].end;break}F=!0}for(S(r),C=j;CA;){let D=i[I];e.containerState=D[1],D[0].exit.call(e,t)}i.length=A}function T(){n.write([null]),o=void 0,n=void 0,e.containerState._closeFlow=void 0}}function r8(t,e,i){return Le(t,t.attempt(this.parser.constructs.document,e,i),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function $g(t){if(t===null||Rt(t)||US(t))return 1;if(MS(t))return 2}function Ta(t,e,i){let r=[],n=-1;for(;++n1&&t[i][1].end.offset-t[i][1].start.offset>1?2:1;let f=Object.assign({},t[r][1].end),d=Object.assign({},t[i][1].start);WS(f,-l),WS(d,l),s={type:l>1?"strongSequence":"emphasisSequence",start:f,end:Object.assign({},t[r][1].end)},a={type:l>1?"strongSequence":"emphasisSequence",start:Object.assign({},t[i][1].start),end:d},o={type:l>1?"strongText":"emphasisText",start:Object.assign({},t[r][1].end),end:Object.assign({},t[i][1].start)},n={type:l>1?"strong":"emphasis",start:Object.assign({},s.start),end:Object.assign({},a.end)},t[r][1].end=Object.assign({},s.start),t[i][1].start=Object.assign({},a.end),c=[],t[r][1].end.offset-t[r][1].start.offset&&(c=Ei(c,[["enter",t[r][1],e],["exit",t[r][1],e]])),c=Ei(c,[["enter",n,e],["enter",s,e],["exit",s,e],["enter",o,e]]),c=Ei(c,Ta(e.parser.constructs.insideSpan.null,t.slice(r+1,i),e)),c=Ei(c,[["exit",o,e],["enter",a,e],["exit",a,e],["exit",n,e]]),t[i][1].end.offset-t[i][1].start.offset?(u=2,c=Ei(c,[["enter",t[i][1],e],["exit",t[i][1],e]])):u=0,ii(t,r-1,i-r+3,c),i=r+c.length-u-2;break}}for(i=-1;++i0&&Ie(C)?Le(t,T,"linePrefix",o+1)(C):T(C)}function T(C){return C===null||ke(C)?t.check(BS,x,I)(C):(t.enter("codeFlowValue"),A(C))}function A(C){return C===null||ke(C)?(t.exit("codeFlowValue"),T(C)):(t.consume(C),A)}function I(C){return t.exit("codeFenced"),e(C)}function D(C,j,se){let F=0;return U;function U(me){return C.enter("lineEnding"),C.consume(me),C.exit("lineEnding"),ae}function ae(me){return C.enter("codeFencedFence"),Ie(me)?Le(C,ue,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(me):ue(me)}function ue(me){return me===a?(C.enter("codeFencedFenceSequence"),ie(me)):se(me)}function ie(me){return me===a?(F++,C.consume(me),ie):F>=s?(C.exit("codeFencedFenceSequence"),Ie(me)?Le(C,he,"whitespace")(me):he(me)):se(me)}function he(me){return me===null||ke(me)?(C.exit("codeFencedFence"),j(me)):se(me)}}}function p8(t,e,i){let r=this;return n;function n(s){return s===null?i(s):(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),o)}function o(s){return r.parser.lazy[r.now().line]?i(s):e(s)}}var dc={name:"codeIndented",tokenize:m8},O8={tokenize:g8,partial:!0};function m8(t,e,i){let r=this;return n;function n(c){return t.enter("codeIndented"),Le(t,o,"linePrefix",5)(c)}function o(c){let u=r.events[r.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?s(c):i(c)}function s(c){return c===null?l(c):ke(c)?t.attempt(O8,s,l)(c):(t.enter("codeFlowValue"),a(c))}function a(c){return c===null||ke(c)?(t.exit("codeFlowValue"),s(c)):(t.consume(c),a)}function l(c){return t.exit("codeIndented"),e(c)}}function g8(t,e,i){let r=this;return n;function n(s){return r.parser.lazy[r.now().line]?i(s):ke(s)?(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),n):Le(t,o,"linePrefix",5)(s)}function o(s){let a=r.events[r.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?e(s):ke(s)?n(s):i(s)}}var Rg={name:"codeText",tokenize:x8,resolve:b8,previous:y8};function b8(t){let e=t.length-4,i=3,r,n;if((t[i][1].type==="lineEnding"||t[i][1].type==="space")&&(t[e][1].type==="lineEnding"||t[e][1].type==="space")){for(r=i;++r=4?e(s):t.interrupt(r.parser.constructs.flow,i,e)(s)}}function kh(t,e,i,r,n,o,s,a,l){let c=l||Number.POSITIVE_INFINITY,u=0;return f;function f(S){return S===60?(t.enter(r),t.enter(n),t.enter(o),t.consume(S),t.exit(o),d):S===null||S===32||S===41||uc(S)?i(S):(t.enter(r),t.enter(s),t.enter(a),t.enter("chunkString",{contentType:"string"}),x(S))}function d(S){return S===62?(t.enter(o),t.consume(S),t.exit(o),t.exit(n),t.exit(r),e):(t.enter(a),t.enter("chunkString",{contentType:"string"}),p(S))}function p(S){return S===62?(t.exit("chunkString"),t.exit(a),d(S)):S===null||S===60||ke(S)?i(S):(t.consume(S),S===92?g:p)}function g(S){return S===60||S===62||S===92?(t.consume(S),p):p(S)}function x(S){return!u&&(S===null||S===41||Rt(S))?(t.exit("chunkString"),t.exit(a),t.exit(s),t.exit(r),e(S)):u999||p===null||p===91||p===93&&!l||p===94&&!a&&"_hiddenFootnoteSupport"in s.parser.constructs?i(p):p===93?(t.exit(o),t.enter(n),t.consume(p),t.exit(n),t.exit(r),e):ke(p)?(t.enter("lineEnding"),t.consume(p),t.exit("lineEnding"),u):(t.enter("chunkString",{contentType:"string"}),f(p))}function f(p){return p===null||p===91||p===93||ke(p)||a++>999?(t.exit("chunkString"),u(p)):(t.consume(p),l||(l=!Ie(p)),p===92?d:f)}function d(p){return p===91||p===92||p===93?(t.consume(p),a++,f):f(p)}}function Th(t,e,i,r,n,o){let s;return a;function a(d){return d===34||d===39||d===40?(t.enter(r),t.enter(n),t.consume(d),t.exit(n),s=d===40?41:d,l):i(d)}function l(d){return d===s?(t.enter(n),t.consume(d),t.exit(n),t.exit(r),e):(t.enter(o),c(d))}function c(d){return d===s?(t.exit(o),l(s)):d===null?i(d):ke(d)?(t.enter("lineEnding"),t.consume(d),t.exit("lineEnding"),Le(t,c,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),u(d))}function u(d){return d===s||d===null||ke(d)?(t.exit("chunkString"),c(d)):(t.consume(d),d===92?f:u)}function f(d){return d===s||d===92?(t.consume(d),u):u(d)}}function us(t,e){let i;return r;function r(n){return ke(n)?(t.enter("lineEnding"),t.consume(n),t.exit("lineEnding"),i=!0,r):Ie(n)?Le(t,r,i?"linePrefix":"lineSuffix")(n):e(n)}}var Lg={name:"definition",tokenize:C8},E8={tokenize:_8,partial:!0};function C8(t,e,i){let r=this,n;return o;function o(p){return t.enter("definition"),s(p)}function s(p){return Sh.call(r,t,a,i,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function a(p){return n=En(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),p===58?(t.enter("definitionMarker"),t.consume(p),t.exit("definitionMarker"),l):i(p)}function l(p){return Rt(p)?us(t,c)(p):c(p)}function c(p){return kh(t,u,i,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function u(p){return t.attempt(E8,f,f)(p)}function f(p){return Ie(p)?Le(t,d,"whitespace")(p):d(p)}function d(p){return p===null||ke(p)?(t.exit("definition"),r.parser.defined.push(n),e(p)):i(p)}}function _8(t,e,i){return r;function r(a){return Rt(a)?us(t,n)(a):i(a)}function n(a){return Th(t,o,i,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function o(a){return Ie(a)?Le(t,s,"whitespace")(a):s(a)}function s(a){return a===null||ke(a)?e(a):i(a)}}var Dg={name:"hardBreakEscape",tokenize:P8};function P8(t,e,i){return r;function r(o){return t.enter("hardBreakEscape"),t.consume(o),n}function n(o){return ke(o)?(t.exit("hardBreakEscape"),e(o)):i(o)}}var Ng={name:"headingAtx",tokenize:A8,resolve:Q8};function Q8(t,e){let i=t.length-2,r=3,n,o;return t[r][1].type==="whitespace"&&(r+=2),i-2>r&&t[i][1].type==="whitespace"&&(i-=2),t[i][1].type==="atxHeadingSequence"&&(r===i-1||i-4>r&&t[i-2][1].type==="whitespace")&&(i-=r+1===i?2:4),i>r&&(n={type:"atxHeadingText",start:t[r][1].start,end:t[i][1].end},o={type:"chunkText",start:t[r][1].start,end:t[i][1].end,contentType:"text"},ii(t,r,i-r+1,[["enter",n,e],["enter",o,e],["exit",o,e],["exit",n,e]])),t}function A8(t,e,i){let r=0;return n;function n(u){return t.enter("atxHeading"),o(u)}function o(u){return t.enter("atxHeadingSequence"),s(u)}function s(u){return u===35&&r++<6?(t.consume(u),s):u===null||Rt(u)?(t.exit("atxHeadingSequence"),a(u)):i(u)}function a(u){return u===35?(t.enter("atxHeadingSequence"),l(u)):u===null||ke(u)?(t.exit("atxHeading"),e(u)):Ie(u)?Le(t,a,"whitespace")(u):(t.enter("atxHeadingText"),c(u))}function l(u){return u===35?(t.consume(u),l):(t.exit("atxHeadingSequence"),a(u))}function c(u){return u===null||u===35||Rt(u)?(t.exit("atxHeadingText"),a(u)):(t.consume(u),c)}}var ZS=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],Mg=["pre","script","style","textarea"];var Ug={name:"htmlFlow",tokenize:I8,resolveTo:R8,concrete:!0},$8={tokenize:D8,partial:!0},X8={tokenize:L8,partial:!0};function R8(t){let e=t.length;for(;e--&&!(t[e][0]==="enter"&&t[e][1].type==="htmlFlow"););return e>1&&t[e-2][1].type==="linePrefix"&&(t[e][1].start=t[e-2][1].start,t[e+1][1].start=t[e-2][1].start,t.splice(e-2,2)),t}function I8(t,e,i){let r=this,n,o,s,a,l;return c;function c(L){return u(L)}function u(L){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(L),f}function f(L){return L===33?(t.consume(L),d):L===47?(t.consume(L),o=!0,x):L===63?(t.consume(L),n=3,r.interrupt?e:E):Hi(L)?(t.consume(L),s=String.fromCharCode(L),w):i(L)}function d(L){return L===45?(t.consume(L),n=2,p):L===91?(t.consume(L),n=5,a=0,g):Hi(L)?(t.consume(L),n=4,r.interrupt?e:E):i(L)}function p(L){return L===45?(t.consume(L),r.interrupt?e:E):i(L)}function g(L){let Ue="CDATA[";return L===Ue.charCodeAt(a++)?(t.consume(L),a===Ue.length?r.interrupt?e:ue:g):i(L)}function x(L){return Hi(L)?(t.consume(L),s=String.fromCharCode(L),w):i(L)}function w(L){if(L===null||L===47||L===62||Rt(L)){let Ue=L===47,Be=s.toLowerCase();return!Ue&&!o&&Mg.includes(Be)?(n=1,r.interrupt?e(L):ue(L)):ZS.includes(s.toLowerCase())?(n=6,Ue?(t.consume(L),S):r.interrupt?e(L):ue(L)):(n=7,r.interrupt&&!r.parser.lazy[r.now().line]?i(L):o?T(L):A(L))}return L===45||Ci(L)?(t.consume(L),s+=String.fromCharCode(L),w):i(L)}function S(L){return L===62?(t.consume(L),r.interrupt?e:ue):i(L)}function T(L){return Ie(L)?(t.consume(L),T):U(L)}function A(L){return L===47?(t.consume(L),U):L===58||L===95||Hi(L)?(t.consume(L),I):Ie(L)?(t.consume(L),A):U(L)}function I(L){return L===45||L===46||L===58||L===95||Ci(L)?(t.consume(L),I):D(L)}function D(L){return L===61?(t.consume(L),C):Ie(L)?(t.consume(L),D):A(L)}function C(L){return L===null||L===60||L===61||L===62||L===96?i(L):L===34||L===39?(t.consume(L),l=L,j):Ie(L)?(t.consume(L),C):se(L)}function j(L){return L===l?(t.consume(L),l=null,F):L===null||ke(L)?i(L):(t.consume(L),j)}function se(L){return L===null||L===34||L===39||L===47||L===60||L===61||L===62||L===96||Rt(L)?D(L):(t.consume(L),se)}function F(L){return L===47||L===62||Ie(L)?A(L):i(L)}function U(L){return L===62?(t.consume(L),ae):i(L)}function ae(L){return L===null||ke(L)?ue(L):Ie(L)?(t.consume(L),ae):i(L)}function ue(L){return L===45&&n===2?(t.consume(L),ve):L===60&&n===1?(t.consume(L),q):L===62&&n===4?(t.consume(L),B):L===63&&n===3?(t.consume(L),E):L===93&&n===5?(t.consume(L),V):ke(L)&&(n===6||n===7)?(t.exit("htmlFlowData"),t.check($8,re,ie)(L)):L===null||ke(L)?(t.exit("htmlFlowData"),ie(L)):(t.consume(L),ue)}function ie(L){return t.check(X8,he,re)(L)}function he(L){return t.enter("lineEnding"),t.consume(L),t.exit("lineEnding"),me}function me(L){return L===null||ke(L)?ie(L):(t.enter("htmlFlowData"),ue(L))}function ve(L){return L===45?(t.consume(L),E):ue(L)}function q(L){return L===47?(t.consume(L),s="",le):ue(L)}function le(L){if(L===62){let Ue=s.toLowerCase();return Mg.includes(Ue)?(t.consume(L),B):ue(L)}return Hi(L)&&s.length<8?(t.consume(L),s+=String.fromCharCode(L),le):ue(L)}function V(L){return L===93?(t.consume(L),E):ue(L)}function E(L){return L===62?(t.consume(L),B):L===45&&n===2?(t.consume(L),E):ue(L)}function B(L){return L===null||ke(L)?(t.exit("htmlFlowData"),re(L)):(t.consume(L),B)}function re(L){return t.exit("htmlFlow"),e(L)}}function L8(t,e,i){let r=this;return n;function n(s){return ke(s)?(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),o):i(s)}function o(s){return r.parser.lazy[r.now().line]?i(s):e(s)}}function D8(t,e,i){return r;function r(n){return t.enter("lineEnding"),t.consume(n),t.exit("lineEnding"),t.attempt(bo,e,i)}}var zg={name:"htmlText",tokenize:N8};function N8(t,e,i){let r=this,n,o,s;return a;function a(E){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(E),l}function l(E){return E===33?(t.consume(E),c):E===47?(t.consume(E),D):E===63?(t.consume(E),A):Hi(E)?(t.consume(E),se):i(E)}function c(E){return E===45?(t.consume(E),u):E===91?(t.consume(E),o=0,g):Hi(E)?(t.consume(E),T):i(E)}function u(E){return E===45?(t.consume(E),p):i(E)}function f(E){return E===null?i(E):E===45?(t.consume(E),d):ke(E)?(s=f,q(E)):(t.consume(E),f)}function d(E){return E===45?(t.consume(E),p):f(E)}function p(E){return E===62?ve(E):E===45?d(E):f(E)}function g(E){let B="CDATA[";return E===B.charCodeAt(o++)?(t.consume(E),o===B.length?x:g):i(E)}function x(E){return E===null?i(E):E===93?(t.consume(E),w):ke(E)?(s=x,q(E)):(t.consume(E),x)}function w(E){return E===93?(t.consume(E),S):x(E)}function S(E){return E===62?ve(E):E===93?(t.consume(E),S):x(E)}function T(E){return E===null||E===62?ve(E):ke(E)?(s=T,q(E)):(t.consume(E),T)}function A(E){return E===null?i(E):E===63?(t.consume(E),I):ke(E)?(s=A,q(E)):(t.consume(E),A)}function I(E){return E===62?ve(E):A(E)}function D(E){return Hi(E)?(t.consume(E),C):i(E)}function C(E){return E===45||Ci(E)?(t.consume(E),C):j(E)}function j(E){return ke(E)?(s=j,q(E)):Ie(E)?(t.consume(E),j):ve(E)}function se(E){return E===45||Ci(E)?(t.consume(E),se):E===47||E===62||Rt(E)?F(E):i(E)}function F(E){return E===47?(t.consume(E),ve):E===58||E===95||Hi(E)?(t.consume(E),U):ke(E)?(s=F,q(E)):Ie(E)?(t.consume(E),F):ve(E)}function U(E){return E===45||E===46||E===58||E===95||Ci(E)?(t.consume(E),U):ae(E)}function ae(E){return E===61?(t.consume(E),ue):ke(E)?(s=ae,q(E)):Ie(E)?(t.consume(E),ae):F(E)}function ue(E){return E===null||E===60||E===61||E===62||E===96?i(E):E===34||E===39?(t.consume(E),n=E,ie):ke(E)?(s=ue,q(E)):Ie(E)?(t.consume(E),ue):(t.consume(E),he)}function ie(E){return E===n?(t.consume(E),n=void 0,me):E===null?i(E):ke(E)?(s=ie,q(E)):(t.consume(E),ie)}function he(E){return E===null||E===34||E===39||E===60||E===61||E===96?i(E):E===47||E===62||Rt(E)?F(E):(t.consume(E),he)}function me(E){return E===47||E===62||Rt(E)?F(E):i(E)}function ve(E){return E===62?(t.consume(E),t.exit("htmlTextData"),t.exit("htmlText"),e):i(E)}function q(E){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(E),t.exit("lineEnding"),le}function le(E){return Ie(E)?Le(t,V,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(E):V(E)}function V(E){return t.enter("htmlTextData"),s(E)}}var fs={name:"labelEnd",tokenize:W8,resolveTo:q8,resolveAll:j8},M8={tokenize:B8},U8={tokenize:Z8},z8={tokenize:V8};function j8(t){let e=-1;for(;++e=3&&(c===null||ke(c))?(t.exit("thematicBreak"),e(c)):i(c)}function l(c){return c===n?(t.consume(c),r++,l):(t.exit("thematicBreakSequence"),Ie(c)?Le(t,a,"whitespace")(c):a(c))}}var di={name:"list",tokenize:eD,continuation:{tokenize:tD},exit:rD},K8={tokenize:nD,partial:!0},J8={tokenize:iD,partial:!0};function eD(t,e,i){let r=this,n=r.events[r.events.length-1],o=n&&n[1].type==="linePrefix"?n[2].sliceSerialize(n[1],!0).length:0,s=0;return a;function a(p){let g=r.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(g==="listUnordered"?!r.containerState.marker||p===r.containerState.marker:fc(p)){if(r.containerState.type||(r.containerState.type=g,t.enter(g,{_container:!0})),g==="listUnordered")return t.enter("listItemPrefix"),p===42||p===45?t.check(hs,i,c)(p):c(p);if(!r.interrupt||p===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),l(p)}return i(p)}function l(p){return fc(p)&&++s<10?(t.consume(p),l):(!r.interrupt||s<2)&&(r.containerState.marker?p===r.containerState.marker:p===41||p===46)?(t.exit("listItemValue"),c(p)):i(p)}function c(p){return t.enter("listItemMarker"),t.consume(p),t.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||p,t.check(bo,r.interrupt?i:u,t.attempt(K8,d,f))}function u(p){return r.containerState.initialBlankLine=!0,o++,d(p)}function f(p){return Ie(p)?(t.enter("listItemPrefixWhitespace"),t.consume(p),t.exit("listItemPrefixWhitespace"),d):i(p)}function d(p){return r.containerState.size=o+r.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(p)}}function tD(t,e,i){let r=this;return r.containerState._closeFlow=void 0,t.check(bo,n,o);function n(a){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Le(t,e,"listItemIndent",r.containerState.size+1)(a)}function o(a){return r.containerState.furtherBlankLines||!Ie(a)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,s(a)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,t.attempt(J8,e,s)(a))}function s(a){return r.containerState._closeFlow=!0,r.interrupt=void 0,Le(t,t.attempt(di,e,i),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function iD(t,e,i){let r=this;return Le(t,n,"listItemIndent",r.containerState.size+1);function n(o){let s=r.events[r.events.length-1];return s&&s[1].type==="listItemIndent"&&s[2].sliceSerialize(s[1],!0).length===r.containerState.size?e(o):i(o)}}function rD(t){t.exit(this.containerState.type)}function nD(t,e,i){let r=this;return Le(t,n,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function n(o){let s=r.events[r.events.length-1];return!Ie(o)&&s&&s[1].type==="listItemPrefixWhitespace"?e(o):i(o)}}var Eh={name:"setextUnderline",tokenize:sD,resolveTo:oD};function oD(t,e){let i=t.length,r,n,o;for(;i--;)if(t[i][0]==="enter"){if(t[i][1].type==="content"){r=i;break}t[i][1].type==="paragraph"&&(n=i)}else t[i][1].type==="content"&&t.splice(i,1),!o&&t[i][1].type==="definition"&&(o=i);let s={type:"setextHeading",start:Object.assign({},t[n][1].start),end:Object.assign({},t[t.length-1][1].end)};return t[n][1].type="setextHeadingText",o?(t.splice(n,0,["enter",s,e]),t.splice(o+1,0,["exit",t[r][1],e]),t[r][1].end=Object.assign({},t[o][1].end)):t[r][1]=s,t.push(["exit",s,e]),t}function sD(t,e,i){let r=this,n;return o;function o(c){let u=r.events.length,f;for(;u--;)if(r.events[u][1].type!=="lineEnding"&&r.events[u][1].type!=="linePrefix"&&r.events[u][1].type!=="content"){f=r.events[u][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||f)?(t.enter("setextHeadingLine"),n=c,s(c)):i(c)}function s(c){return t.enter("setextHeadingLineSequence"),a(c)}function a(c){return c===n?(t.consume(c),a):(t.exit("setextHeadingLineSequence"),Ie(c)?Le(t,l,"lineSuffix")(c):l(c))}function l(c){return c===null||ke(c)?(t.exit("setextHeadingLine"),e(c)):i(c)}}var VS={tokenize:aD};function aD(t){let e=this,i=t.attempt(bo,r,t.attempt(this.parser.constructs.flowInitial,n,Le(t,t.attempt(this.parser.constructs.flow,n,t.attempt(Ig,n)),"linePrefix")));return i;function r(o){if(o===null){t.consume(o);return}return t.enter("lineEndingBlank"),t.consume(o),t.exit("lineEndingBlank"),e.currentConstruct=void 0,i}function n(o){if(o===null){t.consume(o);return}return t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),e.currentConstruct=void 0,i}}var YS={resolveAll:KS()},FS=GS("string"),HS=GS("text");function GS(t){return{tokenize:e,resolveAll:KS(t==="text"?lD:void 0)};function e(i){let r=this,n=this.parser.constructs[t],o=i.attempt(n,s,a);return s;function s(u){return c(u)?o(u):a(u)}function a(u){if(u===null){i.consume(u);return}return i.enter("data"),i.consume(u),l}function l(u){return c(u)?(i.exit("data"),o(u)):(i.consume(u),l)}function c(u){if(u===null)return!0;let f=n[u],d=-1;if(f)for(;++d-1){let a=s[0];typeof a=="string"?s[0]=a.slice(r):s.shift()}o>0&&s.push(t[n].slice(0,o))}return s}function uD(t,e){let i=-1,r=[],n;for(;++ibD,contentInitial:()=>hD,disable:()=>yD,document:()=>fD,flow:()=>pD,flowInitial:()=>dD,insideSpan:()=>gD,string:()=>OD,text:()=>mD});var fD={42:di,43:di,45:di,48:di,49:di,50:di,51:di,52:di,53:di,54:di,55:di,56:di,57:di,62:bh},hD={91:Lg},dD={[-2]:dc,[-1]:dc,32:dc},pD={35:Ng,42:hs,45:[Eh,hs],60:Ug,61:Eh,95:hs,96:vh,126:vh},OD={38:xh,92:yh},mD={[-5]:pc,[-4]:pc,[-3]:pc,33:jg,38:xh,42:hc,60:[Xg,zg],91:qg,92:[Dg,yh],93:fs,95:hc,96:Rg},gD={null:[hc,YS]},bD={null:[42,95]},yD={null:[]};function Bg(t){let i=LS([Wg,...(t||{}).extensions||[]]),r={defined:[],lazy:{},constructs:i,content:n(zS),document:n(qS),flow:n(VS),string:n(FS),text:n(HS)};return r;function n(o){return s;function s(a){return JS(r,o,a)}}}function Zg(t){for(;!wh(t););return t}var e3=/[\0\t\n\r]/g;function Vg(){let t=1,e="",i=!0,r;return n;function n(o,s,a){let l=[],c,u,f,d,p;for(o=e+(typeof o=="string"?o.toString():new TextDecoder(s||void 0).decode(o)),f=0,e="",i&&(o.charCodeAt(0)===65279&&f++,i=void 0);f0){let Zi=Ee.tokenStack[Ee.tokenStack.length-1];(Zi[1]||n3).call(Ee,void 0,Zi[0])}for(ye.position={start:yo(ce.length>0?ce[0][1].start:{line:1,column:1,offset:0}),end:yo(ce.length>0?ce[ce.length-2][1].end:{line:1,column:1,offset:0})},$e=-1;++$e-1&&t.test(String.fromCharCode(i))}}function Hg(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}var Jr=function(t){if(t==null)return PD;if(typeof t=="function")return _h(t);if(typeof t=="object")return Array.isArray(t)?ED(t):CD(t);if(typeof t=="string")return _D(t);throw new Error("Expected function, string, or object as test")};function ED(t){let e=[],i=-1;for(;++i":""))+")"})}return d;function d(){let p=c3,g,x,w;if((!e||o(l,c,u[u.length-1]||void 0))&&(p=AD(i(l,u)),p[0]===ds))return p;if("children"in l&&l.children){let S=l;if(S.children&&p[0]!==_a)for(x=(r?S.children.length:-1)+s,w=u.concat(S);x>-1&&x0?{type:"text",value:C}:void 0),C===!1?d.lastIndex=I+1:(g!==I&&T.push({type:"text",value:c.value.slice(g,I)}),Array.isArray(C)?T.push(...C):C&&T.push(C),g=I+A[0].length,S=!0),!d.global)break;A=d.exec(c.value)}return S?(g?\]}]+$/.exec(t);if(!e)return[t,void 0];t=t.slice(0,e.index);let i=e[0],r=i.indexOf(")"),n=Ca(t,"("),o=Ca(t,")");for(;r!==-1&&n>o;)t+=i.slice(0,r+1),i=i.slice(r+1),r=i.indexOf(")"),o++;return[t,i]}function u3(t,e){let i=t.input.charCodeAt(t.index-1);return(t.index===0||l3(i)||a3(i))&&(!e||i!==47)}function r0(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}f3.peek=JD;function n0(){return{enter:{gfmFootnoteDefinition:BD,gfmFootnoteDefinitionLabelString:ZD,gfmFootnoteCall:FD,gfmFootnoteCallString:HD},exit:{gfmFootnoteDefinition:YD,gfmFootnoteDefinitionLabelString:VD,gfmFootnoteCall:KD,gfmFootnoteCallString:GD}}}function o0(){return{unsafe:[{character:"[",inConstruct:["phrasing","label","reference"]}],handlers:{footnoteDefinition:eN,footnoteReference:f3}}}function BD(t){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},t)}function ZD(){this.buffer()}function VD(t){let e=this.resume(),i=this.stack[this.stack.length-1];i.type,i.label=e,i.identifier=r0(this.sliceSerialize(t)).toLowerCase()}function YD(t){this.exit(t)}function FD(t){this.enter({type:"footnoteReference",identifier:"",label:""},t)}function HD(){this.buffer()}function GD(t){let e=this.resume(),i=this.stack[this.stack.length-1];i.type,i.label=e,i.identifier=r0(this.sliceSerialize(t)).toLowerCase()}function KD(t){this.exit(t)}function f3(t,e,i,r){let n=i.createTracker(r),o=n.move("[^"),s=i.enter("footnoteReference"),a=i.enter("reference");return o+=n.move(i.safe(i.associationId(t),Ce(H({},n.current()),{before:o,after:"]"}))),a(),s(),o+=n.move("]"),o}function JD(){return"["}function eN(t,e,i,r){let n=i.createTracker(r),o=n.move("[^"),s=i.enter("footnoteDefinition"),a=i.enter("label");return o+=n.move(i.safe(i.associationId(t),Ce(H({},n.current()),{before:o,after:"]"}))),a(),o+=n.move("]:"+(t.children&&t.children.length>0?" ":"")),n.shift(4),o+=n.move(i.indentLines(i.containerFlow(t,n.current()),tN)),s(),o}function tN(t,e,i){return e===0?t:(i?"":" ")+t}var iN=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];h3.peek=oN;function s0(){return{canContainEols:["delete"],enter:{strikethrough:rN},exit:{strikethrough:nN}}}function a0(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:iN}],handlers:{delete:h3}}}function rN(t){this.enter({type:"delete",children:[]},t)}function nN(t){this.exit(t)}function h3(t,e,i,r){let n=i.createTracker(r),o=i.enter("strikethrough"),s=n.move("~~");return s+=i.containerPhrasing(t,Ce(H({},n.current()),{before:s,after:"~"})),s+=n.move("~~"),o(),s}function oN(){return"~"}function p3(t,e={}){let i=(e.align||[]).concat(),r=e.stringLength||aN,n=[],o=[],s=[],a=[],l=0,c=-1;for(;++cl&&(l=t[c].length);++wa[w])&&(a[w]=T)}g.push(S)}o[c]=g,s[c]=x}let u=-1;if(typeof i=="object"&&"length"in i)for(;++ua[u]&&(a[u]=S),d[u]=S),f[u]=T}o.splice(1,0,f),s.splice(1,0,d),c=-1;let p=[];for(;++cbD,contentInitial:()=>hD,disable:()=>yD,document:()=>fD,flow:()=>pD,flowInitial:()=>dD,insideSpan:()=>gD,string:()=>OD,text:()=>mD});var fD={42:di,43:di,45:di,48:di,49:di,50:di,51:di,52:di,53:di,54:di,55:di,56:di,57:di,62:bh},hD={91:Lg},dD={[-2]:dc,[-1]:dc,32:dc},pD={35:Ng,42:hs,45:[Eh,hs],60:Ug,61:Eh,95:hs,96:vh,126:vh},OD={38:xh,92:yh},mD={[-5]:pc,[-4]:pc,[-3]:pc,33:jg,38:xh,42:hc,60:[Xg,zg],91:qg,92:[Dg,yh],93:fs,95:hc,96:Rg},gD={null:[hc,YS]},bD={null:[42,95]},yD={null:[]};function Bg(t){let i=LS([Wg,...(t||{}).extensions||[]]),r={defined:[],lazy:{},constructs:i,content:n(zS),document:n(qS),flow:n(VS),string:n(FS),text:n(HS)};return r;function n(o){return s;function s(a){return JS(r,o,a)}}}function Zg(t){for(;!wh(t););return t}var e3=/[\0\t\n\r]/g;function Vg(){let t=1,e="",i=!0,r;return n;function n(o,s,a){let l=[],c,u,f,d,p;for(o=e+(typeof o=="string"?o.toString():new TextDecoder(s||void 0).decode(o)),f=0,e="",i&&(o.charCodeAt(0)===65279&&f++,i=void 0);f0){let Zi=Ee.tokenStack[Ee.tokenStack.length-1];(Zi[1]||n3).call(Ee,void 0,Zi[0])}for(ye.position={start:yo(ce.length>0?ce[0][1].start:{line:1,column:1,offset:0}),end:yo(ce.length>0?ce[ce.length-2][1].end:{line:1,column:1,offset:0})},$e=-1;++$e-1&&t.test(String.fromCharCode(i))}}function Hg(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}var Jr=function(t){if(t==null)return PD;if(typeof t=="function")return _h(t);if(typeof t=="object")return Array.isArray(t)?ED(t):CD(t);if(typeof t=="string")return _D(t);throw new Error("Expected function, string, or object as test")};function ED(t){let e=[],i=-1;for(;++i":""))+")"})}return d;function d(){let p=c3,g,x,w;if((!e||o(l,c,u[u.length-1]||void 0))&&(p=AD(i(l,u)),p[0]===ds))return p;if("children"in l&&l.children){let S=l;if(S.children&&p[0]!==_a)for(x=(r?S.children.length:-1)+s,w=u.concat(S);x>-1&&x0?{type:"text",value:C}:void 0),C===!1?d.lastIndex=I+1:(g!==I&&T.push({type:"text",value:c.value.slice(g,I)}),Array.isArray(C)?T.push(...C):C&&T.push(C),g=I+A[0].length,S=!0),!d.global)break;A=d.exec(c.value)}return S?(g?\]}]+$/.exec(t);if(!e)return[t,void 0];t=t.slice(0,e.index);let i=e[0],r=i.indexOf(")"),n=Ca(t,"("),o=Ca(t,")");for(;r!==-1&&n>o;)t+=i.slice(0,r+1),i=i.slice(r+1),r=i.indexOf(")"),o++;return[t,i]}function u3(t,e){let i=t.input.charCodeAt(t.index-1);return(t.index===0||l3(i)||a3(i))&&(!e||i!==47)}function r0(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}f3.peek=JD;function n0(){return{enter:{gfmFootnoteDefinition:BD,gfmFootnoteDefinitionLabelString:ZD,gfmFootnoteCall:FD,gfmFootnoteCallString:HD},exit:{gfmFootnoteDefinition:YD,gfmFootnoteDefinitionLabelString:VD,gfmFootnoteCall:KD,gfmFootnoteCallString:GD}}}function o0(){return{unsafe:[{character:"[",inConstruct:["phrasing","label","reference"]}],handlers:{footnoteDefinition:eN,footnoteReference:f3}}}function BD(t){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},t)}function ZD(){this.buffer()}function VD(t){let e=this.resume(),i=this.stack[this.stack.length-1];i.type,i.label=e,i.identifier=r0(this.sliceSerialize(t)).toLowerCase()}function YD(t){this.exit(t)}function FD(t){this.enter({type:"footnoteReference",identifier:"",label:""},t)}function HD(){this.buffer()}function GD(t){let e=this.resume(),i=this.stack[this.stack.length-1];i.type,i.label=e,i.identifier=r0(this.sliceSerialize(t)).toLowerCase()}function KD(t){this.exit(t)}function f3(t,e,i,r){let n=i.createTracker(r),o=n.move("[^"),s=i.enter("footnoteReference"),a=i.enter("reference");return o+=n.move(i.safe(i.associationId(t),Ce(H({},n.current()),{before:o,after:"]"}))),a(),s(),o+=n.move("]"),o}function JD(){return"["}function eN(t,e,i,r){let n=i.createTracker(r),o=n.move("[^"),s=i.enter("footnoteDefinition"),a=i.enter("label");return o+=n.move(i.safe(i.associationId(t),Ce(H({},n.current()),{before:o,after:"]"}))),a(),o+=n.move("]:"+(t.children&&t.children.length>0?" ":"")),n.shift(4),o+=n.move(i.indentLines(i.containerFlow(t,n.current()),tN)),s(),o}function tN(t,e,i){return e===0?t:(i?"":" ")+t}var iN=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];h3.peek=oN;function s0(){return{canContainEols:["delete"],enter:{strikethrough:rN},exit:{strikethrough:nN}}}function a0(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:iN}],handlers:{delete:h3}}}function rN(t){this.enter({type:"delete",children:[]},t)}function nN(t){this.exit(t)}function h3(t,e,i,r){let n=i.createTracker(r),o=i.enter("strikethrough"),s=n.move("~~");return s+=i.containerPhrasing(t,Ce(H({},n.current()),{before:s,after:"~"})),s+=n.move("~~"),o(),s}function oN(){return"~"}function p3(t,e={}){let i=(e.align||[]).concat(),r=e.stringLength||aN,n=[],o=[],s=[],a=[],l=0,c=-1;for(;++cl&&(l=t[c].length);++wa[w])&&(a[w]=T)}g.push(S)}o[c]=g,s[c]=x}let u=-1;if(typeof i=="object"&&"length"in i)for(;++ua[u]&&(a[u]=S),d[u]=S),f[u]=T}o.splice(1,0,f),s.splice(1,0,d),c=-1;let p=[];for(;++c "),o.shift(2);let s=i.indentLines(i.containerFlow(t,o.current()),lN);return n(),s}function lN(t,e,i){return">"+(i?"":" ")+t}function b3(t,e){return g3(t,e.inConstruct,!0)&&!g3(t,e.notInConstruct,!1)}function g3(t,e,i){if(typeof e=="string"&&(e=[e]),!e||e.length===0)return i;let r=-1;for(;++rs&&(s=o):o=1,n=r+e.length,r=i.indexOf(e,n);return s}function y3(t,e){return!!(e.options.fences===!1&&t.value&&!t.lang&&/[^ \r\n]/.test(t.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(t.value))}function x3(t){let e=t.options.fence||"`";if(e!=="`"&&e!=="~")throw new Error("Cannot serialize code with `"+e+"` for `options.fence`, expected `` ` `` or `~`");return e}function v3(t,e,i,r){let n=x3(i),o=t.value||"",s=n==="`"?"GraveAccent":"Tilde";if(y3(t,i)){let f=i.enter("codeIndented"),d=i.indentLines(o,cN);return f(),d}let a=i.createTracker(r),l=n.repeat(Math.max(Qh(o,n)+1,3)),c=i.enter("codeFenced"),u=a.move(l);if(t.lang){let f=i.enter(`codeFencedLang${s}`);u+=a.move(i.safe(t.lang,H({before:u,after:" ",encode:["`"]},a.current()))),f()}if(t.lang&&t.meta){let f=i.enter(`codeFencedMeta${s}`);u+=a.move(" "),u+=a.move(i.safe(t.meta,H({before:u,after:` @@ -52,24 +52,24 @@ removing illegal node: "${(r.outerHTML||r.nodeValue).trim()}" \f\r &>`.split(""),`\0 \f\r "&'<=>\``.split("")],[`\0 \f\r "&'<=>\``.split(""),`\0 -\f\r "&'<=>\``.split("")]],single:[["&'".split(""),"\"&'`".split("")],["\0&'".split(""),"\0\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\0"&'.split(""),"\0\"&'`".split("")]]};function EE(t,e,i,r){let n=r.schema,o=n.space==="svg"?!1:r.settings.omitOptionalTags,s=n.space==="svg"?r.settings.closeEmptyElements:r.settings.voids.includes(t.tagName.toLowerCase()),a=[],l;n.space==="html"&&t.tagName==="svg"&&(r.schema=Or);let c=Ej(r,t.properties),u=r.all(n.space==="html"&&t.tagName==="template"?t.content:t);return r.schema=n,u&&(s=!1),(c||!o||!TE(t,e,i))&&(a.push("<",t.tagName,c?" "+c:""),s&&(n.space==="svg"||r.settings.closeSelfClosing)&&(l=c.charAt(c.length-1),(!r.settings.tightSelfClosing||l==="/"||l&&l!=='"'&&l!=="'")&&a.push(" "),a.push("/")),a.push(">")),a.push(u),!s&&(!o||!Hc(t,e,i))&&a.push(""),a.join("")}function Ej(t,e){let i=[],r=-1,n;if(e){for(n in e)if(e[n]!==null&&e[n]!==void 0){let o=Cj(t,n,e[n]);o&&i.push(o)}}for(;++rCa(i,t.alternative)&&(s=t.alternative),a=s+Nn(i,Object.assign({},t.settings.characterReferences,{subset:(s==="'"?Cd.single:Cd.double)[n][o],attribute:!0}))+s),l+(a&&"="+a))}function _d(t,e,i,r){return i&&i.type==="element"&&(i.tagName==="script"||i.tagName==="style")?t.value:Nn(t.value,Object.assign({},r.settings.characterReferences,{subset:["<","&"]}))}function CE(t,e,i,r){return r.settings.allowDangerousHtml?t.value:_d(t,e,i,r)}function _E(t,e,i,r){return r.all(t)}var PE=Pa("type",{invalid:_j,unknown:Pj,handlers:{comment:yE,doctype:xE,element:EE,raw:CE,root:_E,text:_d}});function _j(t){throw new Error("Expected node, not `"+t+"`")}function Pj(t){let e=t;throw new Error("Cannot compile unknown node `"+e.type+"`")}var Qj={},Aj={},$j=[];function Nb(t,e){let i=e||Qj,r=i.quote||'"',n=r==='"'?"'":'"';if(r!=='"'&&r!=="'")throw new Error("Invalid quote `"+r+"`, expected `'` or `\"`");return{one:Xj,all:Rj,settings:{omitOptionalTags:i.omitOptionalTags||!1,allowParseErrors:i.allowParseErrors||!1,allowDangerousCharacters:i.allowDangerousCharacters||!1,quoteSmart:i.quoteSmart||!1,preferUnquoted:i.preferUnquoted||!1,tightAttributes:i.tightAttributes||!1,upperDoctype:i.upperDoctype||!1,tightDoctype:i.tightDoctype||!1,bogusComments:i.bogusComments||!1,tightCommaSeparatedLists:i.tightCommaSeparatedLists||!1,tightSelfClosing:i.tightSelfClosing||!1,collapseEmptyAttributes:i.collapseEmptyAttributes||!1,allowDangerousHtml:i.allowDangerousHtml||!1,voids:i.voids||Jh,characterReferences:i.characterReferences||Aj,closeSelfClosing:i.closeSelfClosing||!1,closeEmptyElements:i.closeEmptyElements||!1},schema:i.space==="svg"?Or:Xn,quote:r,alternative:n}.one(Array.isArray(t)?{type:"root",children:t}:t,void 0,void 0)}function Xj(t,e,i){return PE(t,e,i,this)}function Rj(t){let e=[],i=t&&t.children||$j,r=-1;for(;++rl instanceof Text?l.textContent:l.outerHTML).join("");i.setData("text/html",a),i.setData("text/plain",Lj(s).textContent),t.preventDefault()}}});function Mb(t,e){let r=(e||{}).force||!1;pi(t,n);function n(o){r?delete o.position:o.position=void 0}}var Dj=0,Mi=class{constructor(e,i){this.from=e,this.to=i}},Qe=class{constructor(e={}){this.id=Dj++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")})}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=St.match(e)),i=>{let r=e(i);return r===void 0?null:[this,r]}}};Qe.closedBy=new Qe({deserialize:t=>t.split(" ")});Qe.openedBy=new Qe({deserialize:t=>t.split(" ")});Qe.group=new Qe({deserialize:t=>t.split(" ")});Qe.isolate=new Qe({deserialize:t=>{if(t&&t!="rtl"&&t!="ltr"&&t!="auto")throw new RangeError("Invalid value for isolate: "+t);return t||"auto"}});Qe.contextHash=new Qe({perNode:!0});Qe.lookAhead=new Qe({perNode:!0});Qe.mounted=new Qe({perNode:!0});var Ss=class{constructor(e,i,r){this.tree=e,this.overlay=i,this.parser=r}static get(e){return e&&e.props&&e.props[Qe.mounted.id]}},Nj=Object.create(null),St=class t{constructor(e,i,r,n=0){this.name=e,this.props=i,this.id=r,this.flags=n}static define(e){let i=e.props&&e.props.length?Object.create(null):Nj,r=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),n=new t(e.name||"",i,e.id,r);if(e.props){for(let o of e.props)if(Array.isArray(o)||(o=o(n)),o){if(o[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");i[o[0].id]=o[1]}}return n}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let i=this.prop(Qe.group);return i?i.indexOf(e)>-1:!1}return this.id==e}static match(e){let i=Object.create(null);for(let r in e)for(let n of r.split(" "))i[n]=e[r];return r=>{for(let n=r.prop(Qe.group),o=-1;o<(n?n.length:0);o++){let s=i[o<0?r.name:n[o]];if(s)return s}}}};St.none=new St("",Object.create(null),0,8);var Mn=class t{constructor(e){this.types=e;for(let i=0;i0;for(let l=this.cursor(s|st.IncludeAnonymous);;){let c=!1;if(l.from<=o&&l.to>=n&&(!a&&l.type.isAnonymous||i(l)!==!1)){if(l.firstChild())continue;c=!0}for(;c&&r&&(a||!l.type.isAnonymous)&&r(l),!l.nextSibling();){if(!l.parent())return;c=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let i in this.props)e.push([+i,this.props[i]]);return e}balance(e={}){return this.children.length<=8?this:Hb(St.none,this.children,this.positions,0,this.children.length,0,this.length,(i,r,n)=>new t(this.type,i,r,n,this.propValues),e.makeTree||((i,r,n)=>new t(St.none,i,r,n)))}static build(e){return Uj(e)}};qe.empty=new qe(St.none,[],[],0);var Ub=class t{constructor(e,i){this.buffer=e,this.index=i}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new t(this.buffer,this.index)}},$o=class t{constructor(e,i,r){this.buffer=e,this.length=i,this.set=r}get type(){return St.none}toString(){let e=[];for(let i=0;i0));l=s[l+3]);return a}slice(e,i,r){let n=this.buffer,o=new Uint16Array(i-e),s=0;for(let a=e,l=0;a=e&&ie;case 1:return i<=e&&r>e;case 2:return r>e;case 4:return!0}}function Gc(t,e,i,r){for(var n;t.from==t.to||(i<1?t.from>=e:t.from>e)||(i>-1?t.to<=e:t.to0?a.length:-1;e!=c;e+=i){let u=a[e],f=l[e]+s.from;if(NE(n,r,f,f+u.length)){if(u instanceof $o){if(o&st.ExcludeBuffers)continue;let d=u.findChild(0,u.buffer.length,i,r-f,n);if(d>-1)return new Ts(new jb(s,u,e,f),null,d)}else if(o&st.IncludeAnonymous||!u.type.isAnonymous||Fb(u)){let d;if(!(o&st.IgnoreMounts)&&(d=Ss.get(u))&&!d.overlay)return new t(d.tree,f,e,s);let p=new t(u,f,e,s);return o&st.IncludeAnonymous||!p.type.isAnonymous?p:p.nextChild(i<0?u.children.length-1:0,i,r,n)}}}if(o&st.IncludeAnonymous||!s.type.isAnonymous||(s.index>=0?e=s.index+i:e=i<0?-1:s._parent._tree.children.length,s=s._parent,!s))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}enter(e,i,r=0){let n;if(!(r&st.IgnoreOverlays)&&(n=Ss.get(this._tree))&&n.overlay){let o=e-this.from;for(let{from:s,to:a}of n.overlay)if((i>0?s<=o:s=o:a>o))return new t(n.tree,n.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,i,r)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}};function $E(t,e,i,r){let n=t.cursor(),o=[];if(!n.firstChild())return o;if(i!=null){for(let s=!1;!s;)if(s=n.type.is(i),!n.nextSibling())return o}for(;;){if(r!=null&&n.type.is(r))return o;if(n.type.is(e)&&o.push(n.node),!n.nextSibling())return r==null?o:[]}}function zb(t,e,i=e.length-1){for(let r=t.parent;i>=0;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(e[i]&&e[i]!=r.name)return!1;i--}}return!0}var jb=class{constructor(e,i,r,n){this.parent=e,this.buffer=i,this.index=r,this.start=n}},Ts=class t extends $d{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,i,r){super(),this.context=e,this._parent=i,this.index=r,this.type=e.buffer.set.types[e.buffer.buffer[r]]}child(e,i,r){let{buffer:n}=this.context,o=n.findChild(this.index+4,n.buffer[this.index+3],e,i-this.context.start,r);return o<0?null:new t(this.context,this,o)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}enter(e,i,r=0){if(r&st.ExcludeBuffers)return null;let{buffer:n}=this.context,o=n.findChild(this.index+4,n.buffer[this.index+3],i>0?1:-1,e-this.context.start,i);return o<0?null:new t(this.context,this,o)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,i=e.buffer[this.index+3];return i<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new t(this.context,this._parent,i):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,i=this._parent?this._parent.index+4:0;return this.index==i?this.externalSibling(-1):new t(this.context,this._parent,e.findChild(i,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],i=[],{buffer:r}=this.context,n=this.index+4,o=r.buffer[this.index+3];if(o>n){let s=r.buffer[this.index+1];e.push(r.slice(n,o,s)),i.push(0)}return new qe(this.type,e,i,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}};function ME(t){if(!t.length)return null;let e=0,i=t[0];for(let o=1;oi.from||s.to=e){let a=new Ui(s.tree,s.overlay[0].from+o.from,-1,o);(n||(n=[r])).push(Gc(a,e,i,!1))}}return n?ME(n):r}var ja=class{get name(){return this.type.name}constructor(e,i=0){if(this.mode=i,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,e instanceof Ui)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let r=e._parent;r;r=r._parent)this.stack.unshift(r.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,i){this.index=e;let{start:r,buffer:n}=this.buffer;return this.type=i||n.set.types[n.buffer[e]],this.from=r+n.buffer[e+1],this.to=r+n.buffer[e+2],!0}yield(e){return e?e instanceof Ui?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,i,r){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,i,r,this.mode));let{buffer:n}=this.buffer,o=n.findChild(this.index+4,n.buffer[this.index+3],e,i-this.buffer.start,r);return o<0?!1:(this.stack.push(this.index),this.yieldBuf(o))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,i,r=this.mode){return this.buffer?r&st.ExcludeBuffers?!1:this.enterChild(1,e,i):this.yield(this._tree.enter(e,i,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&st.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&st.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:i}=this.buffer,r=this.stack.length-1;if(e<0){let n=r<0?0:this.stack[r]+4;if(this.index!=n)return this.yieldBuf(i.findChild(n,this.index,-1,0,4))}else{let n=i.buffer[this.index+3];if(n<(r<0?i.buffer.length:i.buffer[this.stack[r]+3]))return this.yieldBuf(n)}return r<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let i,r,{buffer:n}=this;if(n){if(e>0){if(this.index-1)for(let o=i+e,s=e<0?-1:r._tree.children.length;o!=s;o+=e){let a=r._tree.children[o];if(this.mode&st.IncludeAnonymous||a instanceof $o||!a.type.isAnonymous||Fb(a))return!1}return!0}move(e,i){if(i&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,i=0){for(;(this.from==this.to||(i<1?this.from>=e:this.from>e)||(i>-1?this.to<=e:this.to=0;){for(let s=e;s;s=s._parent)if(s.index==n){if(n==this.index)return s;i=s,r=o+1;break e}n=this.stack[--o]}for(let n=r;n=0;o--){if(o<0)return zb(this.node,e,n);let s=r[i.buffer[this.stack[o]]];if(!s.isAnonymous){if(e[n]&&e[n]!=s.name)return!1;n--}}return!0}};function Fb(t){return t.children.some(e=>e instanceof $o||!e.type.isAnonymous||Fb(e))}function Uj(t){var e;let{buffer:i,nodeSet:r,maxBufferLength:n=1024,reused:o=[],minRepeatType:s=r.types.length}=t,a=Array.isArray(i)?new Ub(i,i.length):i,l=r.types,c=0,u=0;function f(D,C,j,se,F,U){let{id:ae,start:ue,end:ie,size:he}=a,me=u;for(;he<0;)if(a.next(),he==-1){let E=o[ae];j.push(E),se.push(ue-D);return}else if(he==-3){c=ae;return}else if(he==-4){u=ae;return}else throw new RangeError(`Unrecognized record size: ${he}`);let ve=l[ae],q,le,V=ue-D;if(ie-ue<=n&&(le=w(a.pos-C,F))){let E=new Uint16Array(le.size-le.skip),B=a.pos-le.size,re=E.length;for(;a.pos>B;)re=S(le.start,E,re);q=new $o(E,ie-le.start,r),V=le.start-D}else{let E=a.pos-he;a.next();let B=[],re=[],L=ae>=s?ae:-1,Ue=0,Be=ie;for(;a.pos>E;)L>=0&&a.id==L&&a.size>=0?(a.end<=Be-n&&(g(B,re,ue,Ue,a.end,Be,L,me),Ue=B.length,Be=a.end),a.next()):U>2500?d(ue,E,B,re):f(ue,E,B,re,L,U+1);if(L>=0&&Ue>0&&Ue-1&&Ue>0){let Ze=p(ve);q=Hb(ve,B,re,0,B.length,0,ie-ue,Ze,Ze)}else q=x(ve,B,re,ie-ue,me-ie)}j.push(q),se.push(V)}function d(D,C,j,se){let F=[],U=0,ae=-1;for(;a.pos>C;){let{id:ue,start:ie,end:he,size:me}=a;if(me>4)a.next();else{if(ae>-1&&ie=0;he-=3)ue[me++]=F[he],ue[me++]=F[he+1]-ie,ue[me++]=F[he+2]-ie,ue[me++]=me;j.push(new $o(ue,F[2]-ie,r)),se.push(ie-D)}}function p(D){return(C,j,se)=>{let F=0,U=C.length-1,ae,ue;if(U>=0&&(ae=C[U])instanceof qe){if(!U&&ae.type==D&&ae.length==se)return ae;(ue=ae.prop(Qe.lookAhead))&&(F=j[U]+ae.length+ue)}return x(D,C,j,se,F)}}function g(D,C,j,se,F,U,ae,ue){let ie=[],he=[];for(;D.length>se;)ie.push(D.pop()),he.push(C.pop()+j-F);D.push(x(r.types[ae],ie,he,U-F,ue-U)),C.push(F-j)}function x(D,C,j,se,F=0,U){if(c){let ae=[Qe.contextHash,c];U=U?[ae].concat(U):[ae]}if(F>25){let ae=[Qe.lookAhead,F];U=U?[ae].concat(U):[ae]}return new qe(D,C,j,se,U)}function w(D,C){let j=a.fork(),se=0,F=0,U=0,ae=j.end-n,ue={size:0,start:0,skip:0};e:for(let ie=j.pos-D;j.pos>ie;){let he=j.size;if(j.id==C&&he>=0){ue.size=se,ue.start=F,ue.skip=U,U+=4,se+=4,j.next();continue}let me=j.pos-he;if(he<0||me=s?4:0,q=j.start;for(j.next();j.pos>me;){if(j.size<0)if(j.size==-3)ve+=4;else break e;else j.id>=s&&(ve+=4);j.next()}F=q,se+=he,U+=ve}return(C<0||se==D)&&(ue.size=se,ue.start=F,ue.skip=U),ue.size>4?ue:void 0}function S(D,C,j){let{id:se,start:F,end:U,size:ae}=a;if(a.next(),ae>=0&&se4){let ie=a.pos-(ae-4);for(;a.pos>ie;)j=S(D,C,j)}C[--j]=ue,C[--j]=U-D,C[--j]=F-D,C[--j]=se}else ae==-3?c=se:ae==-4&&(u=se);return j}let T=[],A=[];for(;a.pos>0;)f(t.start||0,t.bufferStart||0,T,A,-1,0);let I=(e=t.length)!==null&&e!==void 0?e:T.length?A[0]+T[0].length:0;return new qe(l[t.topID],T.reverse(),A.reverse(),I)}var XE=new WeakMap;function Ad(t,e){if(!t.isAnonymous||e instanceof $o||e.type!=t)return 1;let i=XE.get(e);if(i==null){i=1;for(let r of e.children){if(r.type!=t||!(r instanceof qe)){i=1;break}i+=Ad(t,r)}XE.set(e,i)}return i}function Hb(t,e,i,r,n,o,s,a,l){let c=0;for(let g=r;g=u)break;C+=j}if(A==I+1){if(C>u){let j=g[I];p(j.children,j.positions,0,j.children.length,x[I]+T);continue}f.push(g[I])}else{let j=x[A-1]+g[A-1].length-D;f.push(Hb(t,g,x,I,A,D,j,null,l))}d.push(D+T-o)}}return p(e,i,r,n,0),(a||l)(f,d,s)}var qa=class{constructor(){this.map=new WeakMap}setBuffer(e,i,r){let n=this.map.get(e);n||this.map.set(e,n=new Map),n.set(i,r)}getBuffer(e,i){let r=this.map.get(e);return r&&r.get(i)}set(e,i){e instanceof Ts?this.setBuffer(e.context.buffer,e.index,i):e instanceof Ui&&this.map.set(e.tree,i)}get(e){return e instanceof Ts?this.getBuffer(e.context.buffer,e.index):e instanceof Ui?this.map.get(e.tree):void 0}cursorSet(e,i){e.buffer?this.setBuffer(e.buffer.buffer,e.index,i):this.map.set(e.tree,i)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}},Un=class t{constructor(e,i,r,n,o=!1,s=!1){this.from=e,this.to=i,this.tree=r,this.offset=n,this.open=(o?1:0)|(s?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,i=[],r=!1){let n=[new t(0,e.length,e,0,!1,r)];for(let o of i)o.to>e.length&&n.push(o);return n}static applyChanges(e,i,r=128){if(!i.length)return e;let n=[],o=1,s=e.length?e[0]:null;for(let a=0,l=0,c=0;;a++){let u=a=r)for(;s&&s.from=d.from||f<=d.to||c){let p=Math.max(d.from,l)-c,g=Math.min(d.to,f)-c;d=p>=g?null:new t(p,g,d.tree,d.offset+c,a>0,!!u)}if(d&&n.push(d),s.to>f)break;s=onew Mi(n.from,n.to)):[new Mi(0,0)]:[new Mi(0,e.length)],this.createParse(e,i||[],r)}parse(e,i,r){let n=this.startParse(e,i,r);for(;;){let o=n.advance();if(o)return o}}},Wb=class{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,i){return this.string.slice(e,i)}};function Id(t){return(e,i,r,n)=>new Vb(e,t,i,r,n)}var Xd=class{constructor(e,i,r,n,o){this.parser=e,this.parse=i,this.overlay=r,this.target=n,this.from=o}};function RE(t){if(!t.length||t.some(e=>e.from>=e.to))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(t))}var Bb=class{constructor(e,i,r,n,o,s,a){this.parser=e,this.predicate=i,this.mounts=r,this.index=n,this.start=o,this.target=s,this.prev=a,this.depth=0,this.ranges=[]}},Zb=new Qe({perNode:!0}),Vb=class{constructor(e,i,r,n,o){this.nest=i,this.input=r,this.fragments=n,this.ranges=o,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=e}advance(){if(this.baseParse){let r=this.baseParse.advance();if(!r)return null;if(this.baseParse=null,this.baseTree=r,this.startInner(),this.stoppedAt!=null)for(let n of this.inner)n.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let r=this.baseTree;return this.stoppedAt!=null&&(r=new qe(r.type,r.children,r.positions,r.length,r.propValues.concat([[Zb,this.stoppedAt]]))),r}let e=this.inner[this.innerDone],i=e.parse.advance();if(i){this.innerDone++;let r=Object.assign(Object.create(null),e.target.props);r[Qe.mounted.id]=new Ss(i,e.overlay,e.parser),e.target.props=r}return null}get parsedPos(){if(this.baseParse)return 0;let e=this.input.length;for(let i=this.innerDone;i=this.stoppedAt)a=!1;else if(e.hasNode(n)){if(i){let c=i.mounts.find(u=>u.frag.from<=n.from&&u.frag.to>=n.to&&u.mount.overlay);if(c)for(let u of c.mount.overlay){let f=u.from+c.pos,d=u.to+c.pos;f>=n.from&&d<=n.to&&!i.ranges.some(p=>p.fromf)&&i.ranges.push({from:f,to:d})}}a=!1}else if(r&&(s=zj(r.ranges,n.from,n.to)))a=s!=2;else if(!n.type.isAnonymous&&(o=this.nest(n,this.input))&&(n.fromnew Mi(f.from-n.from,f.to-n.from)):null,n.tree,u.length?u[0].from:n.from)),o.overlay?u.length&&(r={ranges:u,depth:0,prev:r}):a=!1}}else i&&(l=i.predicate(n))&&(l===!0&&(l=new Mi(n.from,n.to)),l.fromnew Mi(u.from-i.start,u.to-i.start)),i.target,c[0].from))),i=i.prev}r&&!--r.depth&&(r=r.prev)}}}};function zj(t,e,i){for(let r of t){if(r.from>=i)break;if(r.to>e)return r.from<=e&&r.to>=i?2:1}return 0}function IE(t,e,i,r,n,o){if(e=e&&i.enter(r,1,st.IgnoreOverlays|st.ExcludeBuffers)||i.next(!1)||(this.done=!0)}hasNode(e){if(this.moveTo(e.from),!this.done&&this.cursor.from+this.offset==e.from&&this.cursor.tree)for(let i=this.cursor.tree;;){if(i==e.tree)return!0;if(i.children.length&&i.positions[0]==0&&i.children[0]instanceof qe)i=i.children[0];else break}return!1}},Yb=class{constructor(e){var i;if(this.fragments=e,this.curTo=0,this.fragI=0,e.length){let r=this.curFrag=e[0];this.curTo=(i=r.tree.prop(Zb))!==null&&i!==void 0?i:r.to,this.inner=new Rd(r.tree,-r.offset)}else this.curFrag=this.inner=null}hasNode(e){for(;this.curFrag&&e.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=e.from&&this.curTo>=e.to&&this.inner.hasNode(e)}nextFrag(){var e;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let i=this.curFrag=this.fragments[this.fragI];this.curTo=(e=i.tree.prop(Zb))!==null&&e!==void 0?e:i.to,this.inner=new Rd(i.tree,-i.offset)}}findMounts(e,i){var r;let n=[];if(this.inner){this.inner.cursor.moveTo(e,1);for(let o=this.inner.cursor.node;o;o=o.parent){let s=(r=o.tree)===null||r===void 0?void 0:r.prop(Qe.mounted);if(s&&s.parser==i)for(let a=this.fragI;a=o.to)break;l.tree==this.curFrag.tree&&n.push({frag:l,pos:o.from-l.offset,mount:s})}}}return n}};function LE(t,e){let i=null,r=e;for(let n=1,o=0;n=a)break;l.to<=s||(i||(r=i=e.slice()),l.froma&&i.splice(o+1,0,new Mi(a,l.to))):l.to>a?i[o--]=new Mi(a,l.to):i.splice(o--,1))}}return r}function qj(t,e,i,r){let n=0,o=0,s=!1,a=!1,l=-1e9,c=[];for(;;){let u=n==t.length?1e9:s?t[n].to:t[n].from,f=o==e.length?1e9:a?e[o].to:e[o].from;if(s!=a){let d=Math.max(l,i),p=Math.min(u,f,r);dnew Mi(d.from+r,d.to+r)),f=qj(e,u,l,c);for(let d=0,p=l;;d++){let g=d==f.length,x=g?c:f[d].from;if(x>p&&i.push(new Un(p,x,n.tree,-s,o.from>=p||o.openStart,o.to<=x||o.openEnd)),g)break;p=f[d].to}}else i.push(new Un(l,c,n.tree,-s,o.from>=s||o.openStart,o.to<=a||o.openEnd))}return i}var He=class t{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,i,r){[e,i]=Fa(this,e,i);let n=[];return this.decompose(0,e,n,2),r.length&&r.decompose(0,r.length,n,3),this.decompose(i,this.length,n,1),Ba.from(n,this.length-(i-e)+r.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,i=this.length){[e,i]=Fa(this,e,i);let r=[];return this.decompose(e,i,r,0),Ba.from(r,i-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let i=this.scanIdentical(e,1),r=this.length-this.scanIdentical(e,-1),n=new _s(this),o=new _s(e);for(let s=i,a=i;;){if(n.next(s),o.next(s),s=0,n.lineBreak!=o.lineBreak||n.done!=o.done||n.value!=o.value)return!1;if(a+=n.value.length,n.done||a>=r)return!0}}iter(e=1){return new _s(this,e)}iterRange(e,i=this.length){return new Md(this,e,i)}iterLines(e,i){let r;if(e==null)r=this.iter();else{i==null&&(i=this.lines+1);let n=this.line(e).from;r=this.iterRange(n,Math.max(n,i==this.lines+1?this.length:i<=1?0:this.line(i-1).to))}return new Ud(r)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?t.empty:e.length<=32?new Gi(e):Ba.from(Gi.split(e,[]))}},Gi=class t extends He{constructor(e,i=Wj(e)){super(),this.text=e,this.length=i}get lines(){return this.text.length}get children(){return null}lineInner(e,i,r,n){for(let o=0;;o++){let s=this.text[o],a=n+s.length;if((i?r:a)>=e)return new Kb(n,a,r,s);n=a+1,r++}}decompose(e,i,r,n){let o=e<=0&&i>=this.length?this:new t(UE(this.text,e,i),Math.min(i,this.length)-Math.max(0,e));if(n&1){let s=r.pop(),a=Nd(o.text,s.text.slice(),0,o.length);if(a.length<=32)r.push(new t(a,s.length+o.length));else{let l=a.length>>1;r.push(new t(a.slice(0,l)),new t(a.slice(l)))}}else r.push(o)}replace(e,i,r){if(!(r instanceof t))return super.replace(e,i,r);[e,i]=Fa(this,e,i);let n=Nd(this.text,Nd(r.text,UE(this.text,0,e)),i),o=this.length+r.length-(i-e);return n.length<=32?new t(n,o):Ba.from(t.split(n,[]),o)}sliceString(e,i=this.length,r=` +\f\r "&'<=>\``.split("")]],single:[["&'".split(""),"\"&'`".split("")],["\0&'".split(""),"\0\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\0"&'.split(""),"\0\"&'`".split("")]]};function EE(t,e,i,r){let n=r.schema,o=n.space==="svg"?!1:r.settings.omitOptionalTags,s=n.space==="svg"?r.settings.closeEmptyElements:r.settings.voids.includes(t.tagName.toLowerCase()),a=[],l;n.space==="html"&&t.tagName==="svg"&&(r.schema=Or);let c=Ej(r,t.properties),u=r.all(n.space==="html"&&t.tagName==="template"?t.content:t);return r.schema=n,u&&(s=!1),(c||!o||!TE(t,e,i))&&(a.push("<",t.tagName,c?" "+c:""),s&&(n.space==="svg"||r.settings.closeSelfClosing)&&(l=c.charAt(c.length-1),(!r.settings.tightSelfClosing||l==="/"||l&&l!=='"'&&l!=="'")&&a.push(" "),a.push("/")),a.push(">")),a.push(u),!s&&(!o||!Hc(t,e,i))&&a.push(""),a.join("")}function Ej(t,e){let i=[],r=-1,n;if(e){for(n in e)if(e[n]!==null&&e[n]!==void 0){let o=Cj(t,n,e[n]);o&&i.push(o)}}for(;++rCa(i,t.alternative)&&(s=t.alternative),a=s+Nn(i,Object.assign({},t.settings.characterReferences,{subset:(s==="'"?Cd.single:Cd.double)[n][o],attribute:!0}))+s),l+(a&&"="+a))}function _d(t,e,i,r){return i&&i.type==="element"&&(i.tagName==="script"||i.tagName==="style")?t.value:Nn(t.value,Object.assign({},r.settings.characterReferences,{subset:["<","&"]}))}function CE(t,e,i,r){return r.settings.allowDangerousHtml?t.value:_d(t,e,i,r)}function _E(t,e,i,r){return r.all(t)}var PE=Pa("type",{invalid:_j,unknown:Pj,handlers:{comment:yE,doctype:xE,element:EE,raw:CE,root:_E,text:_d}});function _j(t){throw new Error("Expected node, not `"+t+"`")}function Pj(t){let e=t;throw new Error("Cannot compile unknown node `"+e.type+"`")}var Qj={},Aj={},$j=[];function Nb(t,e){let i=e||Qj,r=i.quote||'"',n=r==='"'?"'":'"';if(r!=='"'&&r!=="'")throw new Error("Invalid quote `"+r+"`, expected `'` or `\"`");return{one:Xj,all:Rj,settings:{omitOptionalTags:i.omitOptionalTags||!1,allowParseErrors:i.allowParseErrors||!1,allowDangerousCharacters:i.allowDangerousCharacters||!1,quoteSmart:i.quoteSmart||!1,preferUnquoted:i.preferUnquoted||!1,tightAttributes:i.tightAttributes||!1,upperDoctype:i.upperDoctype||!1,tightDoctype:i.tightDoctype||!1,bogusComments:i.bogusComments||!1,tightCommaSeparatedLists:i.tightCommaSeparatedLists||!1,tightSelfClosing:i.tightSelfClosing||!1,collapseEmptyAttributes:i.collapseEmptyAttributes||!1,allowDangerousHtml:i.allowDangerousHtml||!1,voids:i.voids||Jh,characterReferences:i.characterReferences||Aj,closeSelfClosing:i.closeSelfClosing||!1,closeEmptyElements:i.closeEmptyElements||!1},schema:i.space==="svg"?Or:Xn,quote:r,alternative:n}.one(Array.isArray(t)?{type:"root",children:t}:t,void 0,void 0)}function Xj(t,e,i){return PE(t,e,i,this)}function Rj(t){let e=[],i=t&&t.children||$j,r=-1;for(;++rl instanceof Text?l.textContent:l.outerHTML).join("");i.setData("text/html",a),i.setData("text/plain",Lj(s).textContent),t.preventDefault()}}});function Mb(t,e){let r=(e||{}).force||!1;pi(t,n);function n(o){r?delete o.position:o.position=void 0}}var Dj=0,Mi=class{constructor(e,i){this.from=e,this.to=i}},Qe=class{constructor(e={}){this.id=Dj++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")})}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=Tt.match(e)),i=>{let r=e(i);return r===void 0?null:[this,r]}}};Qe.closedBy=new Qe({deserialize:t=>t.split(" ")});Qe.openedBy=new Qe({deserialize:t=>t.split(" ")});Qe.group=new Qe({deserialize:t=>t.split(" ")});Qe.isolate=new Qe({deserialize:t=>{if(t&&t!="rtl"&&t!="ltr"&&t!="auto")throw new RangeError("Invalid value for isolate: "+t);return t||"auto"}});Qe.contextHash=new Qe({perNode:!0});Qe.lookAhead=new Qe({perNode:!0});Qe.mounted=new Qe({perNode:!0});var Ss=class{constructor(e,i,r){this.tree=e,this.overlay=i,this.parser=r}static get(e){return e&&e.props&&e.props[Qe.mounted.id]}},Nj=Object.create(null),Tt=class t{constructor(e,i,r,n=0){this.name=e,this.props=i,this.id=r,this.flags=n}static define(e){let i=e.props&&e.props.length?Object.create(null):Nj,r=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),n=new t(e.name||"",i,e.id,r);if(e.props){for(let o of e.props)if(Array.isArray(o)||(o=o(n)),o){if(o[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");i[o[0].id]=o[1]}}return n}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let i=this.prop(Qe.group);return i?i.indexOf(e)>-1:!1}return this.id==e}static match(e){let i=Object.create(null);for(let r in e)for(let n of r.split(" "))i[n]=e[r];return r=>{for(let n=r.prop(Qe.group),o=-1;o<(n?n.length:0);o++){let s=i[o<0?r.name:n[o]];if(s)return s}}}};Tt.none=new Tt("",Object.create(null),0,8);var Mn=class t{constructor(e){this.types=e;for(let i=0;i0;for(let l=this.cursor(s|st.IncludeAnonymous);;){let c=!1;if(l.from<=o&&l.to>=n&&(!a&&l.type.isAnonymous||i(l)!==!1)){if(l.firstChild())continue;c=!0}for(;c&&r&&(a||!l.type.isAnonymous)&&r(l),!l.nextSibling();){if(!l.parent())return;c=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let i in this.props)e.push([+i,this.props[i]]);return e}balance(e={}){return this.children.length<=8?this:Hb(Tt.none,this.children,this.positions,0,this.children.length,0,this.length,(i,r,n)=>new t(this.type,i,r,n,this.propValues),e.makeTree||((i,r,n)=>new t(Tt.none,i,r,n)))}static build(e){return Uj(e)}};qe.empty=new qe(Tt.none,[],[],0);var Ub=class t{constructor(e,i){this.buffer=e,this.index=i}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new t(this.buffer,this.index)}},$o=class t{constructor(e,i,r){this.buffer=e,this.length=i,this.set=r}get type(){return Tt.none}toString(){let e=[];for(let i=0;i0));l=s[l+3]);return a}slice(e,i,r){let n=this.buffer,o=new Uint16Array(i-e),s=0;for(let a=e,l=0;a=e&&ie;case 1:return i<=e&&r>e;case 2:return r>e;case 4:return!0}}function Gc(t,e,i,r){for(var n;t.from==t.to||(i<1?t.from>=e:t.from>e)||(i>-1?t.to<=e:t.to0?a.length:-1;e!=c;e+=i){let u=a[e],f=l[e]+s.from;if(NE(n,r,f,f+u.length)){if(u instanceof $o){if(o&st.ExcludeBuffers)continue;let d=u.findChild(0,u.buffer.length,i,r-f,n);if(d>-1)return new Ts(new jb(s,u,e,f),null,d)}else if(o&st.IncludeAnonymous||!u.type.isAnonymous||Fb(u)){let d;if(!(o&st.IgnoreMounts)&&(d=Ss.get(u))&&!d.overlay)return new t(d.tree,f,e,s);let p=new t(u,f,e,s);return o&st.IncludeAnonymous||!p.type.isAnonymous?p:p.nextChild(i<0?u.children.length-1:0,i,r,n)}}}if(o&st.IncludeAnonymous||!s.type.isAnonymous||(s.index>=0?e=s.index+i:e=i<0?-1:s._parent._tree.children.length,s=s._parent,!s))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}enter(e,i,r=0){let n;if(!(r&st.IgnoreOverlays)&&(n=Ss.get(this._tree))&&n.overlay){let o=e-this.from;for(let{from:s,to:a}of n.overlay)if((i>0?s<=o:s=o:a>o))return new t(n.tree,n.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,i,r)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}};function $E(t,e,i,r){let n=t.cursor(),o=[];if(!n.firstChild())return o;if(i!=null){for(let s=!1;!s;)if(s=n.type.is(i),!n.nextSibling())return o}for(;;){if(r!=null&&n.type.is(r))return o;if(n.type.is(e)&&o.push(n.node),!n.nextSibling())return r==null?o:[]}}function zb(t,e,i=e.length-1){for(let r=t.parent;i>=0;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(e[i]&&e[i]!=r.name)return!1;i--}}return!0}var jb=class{constructor(e,i,r,n){this.parent=e,this.buffer=i,this.index=r,this.start=n}},Ts=class t extends $d{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,i,r){super(),this.context=e,this._parent=i,this.index=r,this.type=e.buffer.set.types[e.buffer.buffer[r]]}child(e,i,r){let{buffer:n}=this.context,o=n.findChild(this.index+4,n.buffer[this.index+3],e,i-this.context.start,r);return o<0?null:new t(this.context,this,o)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}enter(e,i,r=0){if(r&st.ExcludeBuffers)return null;let{buffer:n}=this.context,o=n.findChild(this.index+4,n.buffer[this.index+3],i>0?1:-1,e-this.context.start,i);return o<0?null:new t(this.context,this,o)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,i=e.buffer[this.index+3];return i<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new t(this.context,this._parent,i):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,i=this._parent?this._parent.index+4:0;return this.index==i?this.externalSibling(-1):new t(this.context,this._parent,e.findChild(i,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],i=[],{buffer:r}=this.context,n=this.index+4,o=r.buffer[this.index+3];if(o>n){let s=r.buffer[this.index+1];e.push(r.slice(n,o,s)),i.push(0)}return new qe(this.type,e,i,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}};function ME(t){if(!t.length)return null;let e=0,i=t[0];for(let o=1;oi.from||s.to=e){let a=new Ui(s.tree,s.overlay[0].from+o.from,-1,o);(n||(n=[r])).push(Gc(a,e,i,!1))}}return n?ME(n):r}var ja=class{get name(){return this.type.name}constructor(e,i=0){if(this.mode=i,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,e instanceof Ui)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let r=e._parent;r;r=r._parent)this.stack.unshift(r.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,i){this.index=e;let{start:r,buffer:n}=this.buffer;return this.type=i||n.set.types[n.buffer[e]],this.from=r+n.buffer[e+1],this.to=r+n.buffer[e+2],!0}yield(e){return e?e instanceof Ui?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,i,r){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,i,r,this.mode));let{buffer:n}=this.buffer,o=n.findChild(this.index+4,n.buffer[this.index+3],e,i-this.buffer.start,r);return o<0?!1:(this.stack.push(this.index),this.yieldBuf(o))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,i,r=this.mode){return this.buffer?r&st.ExcludeBuffers?!1:this.enterChild(1,e,i):this.yield(this._tree.enter(e,i,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&st.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&st.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:i}=this.buffer,r=this.stack.length-1;if(e<0){let n=r<0?0:this.stack[r]+4;if(this.index!=n)return this.yieldBuf(i.findChild(n,this.index,-1,0,4))}else{let n=i.buffer[this.index+3];if(n<(r<0?i.buffer.length:i.buffer[this.stack[r]+3]))return this.yieldBuf(n)}return r<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let i,r,{buffer:n}=this;if(n){if(e>0){if(this.index-1)for(let o=i+e,s=e<0?-1:r._tree.children.length;o!=s;o+=e){let a=r._tree.children[o];if(this.mode&st.IncludeAnonymous||a instanceof $o||!a.type.isAnonymous||Fb(a))return!1}return!0}move(e,i){if(i&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,i=0){for(;(this.from==this.to||(i<1?this.from>=e:this.from>e)||(i>-1?this.to<=e:this.to=0;){for(let s=e;s;s=s._parent)if(s.index==n){if(n==this.index)return s;i=s,r=o+1;break e}n=this.stack[--o]}for(let n=r;n=0;o--){if(o<0)return zb(this.node,e,n);let s=r[i.buffer[this.stack[o]]];if(!s.isAnonymous){if(e[n]&&e[n]!=s.name)return!1;n--}}return!0}};function Fb(t){return t.children.some(e=>e instanceof $o||!e.type.isAnonymous||Fb(e))}function Uj(t){var e;let{buffer:i,nodeSet:r,maxBufferLength:n=1024,reused:o=[],minRepeatType:s=r.types.length}=t,a=Array.isArray(i)?new Ub(i,i.length):i,l=r.types,c=0,u=0;function f(D,C,j,se,F,U){let{id:ae,start:ue,end:ie,size:he}=a,me=u;for(;he<0;)if(a.next(),he==-1){let E=o[ae];j.push(E),se.push(ue-D);return}else if(he==-3){c=ae;return}else if(he==-4){u=ae;return}else throw new RangeError(`Unrecognized record size: ${he}`);let ve=l[ae],q,le,V=ue-D;if(ie-ue<=n&&(le=w(a.pos-C,F))){let E=new Uint16Array(le.size-le.skip),B=a.pos-le.size,re=E.length;for(;a.pos>B;)re=S(le.start,E,re);q=new $o(E,ie-le.start,r),V=le.start-D}else{let E=a.pos-he;a.next();let B=[],re=[],L=ae>=s?ae:-1,Ue=0,Be=ie;for(;a.pos>E;)L>=0&&a.id==L&&a.size>=0?(a.end<=Be-n&&(g(B,re,ue,Ue,a.end,Be,L,me),Ue=B.length,Be=a.end),a.next()):U>2500?d(ue,E,B,re):f(ue,E,B,re,L,U+1);if(L>=0&&Ue>0&&Ue-1&&Ue>0){let Ze=p(ve);q=Hb(ve,B,re,0,B.length,0,ie-ue,Ze,Ze)}else q=x(ve,B,re,ie-ue,me-ie)}j.push(q),se.push(V)}function d(D,C,j,se){let F=[],U=0,ae=-1;for(;a.pos>C;){let{id:ue,start:ie,end:he,size:me}=a;if(me>4)a.next();else{if(ae>-1&&ie=0;he-=3)ue[me++]=F[he],ue[me++]=F[he+1]-ie,ue[me++]=F[he+2]-ie,ue[me++]=me;j.push(new $o(ue,F[2]-ie,r)),se.push(ie-D)}}function p(D){return(C,j,se)=>{let F=0,U=C.length-1,ae,ue;if(U>=0&&(ae=C[U])instanceof qe){if(!U&&ae.type==D&&ae.length==se)return ae;(ue=ae.prop(Qe.lookAhead))&&(F=j[U]+ae.length+ue)}return x(D,C,j,se,F)}}function g(D,C,j,se,F,U,ae,ue){let ie=[],he=[];for(;D.length>se;)ie.push(D.pop()),he.push(C.pop()+j-F);D.push(x(r.types[ae],ie,he,U-F,ue-U)),C.push(F-j)}function x(D,C,j,se,F=0,U){if(c){let ae=[Qe.contextHash,c];U=U?[ae].concat(U):[ae]}if(F>25){let ae=[Qe.lookAhead,F];U=U?[ae].concat(U):[ae]}return new qe(D,C,j,se,U)}function w(D,C){let j=a.fork(),se=0,F=0,U=0,ae=j.end-n,ue={size:0,start:0,skip:0};e:for(let ie=j.pos-D;j.pos>ie;){let he=j.size;if(j.id==C&&he>=0){ue.size=se,ue.start=F,ue.skip=U,U+=4,se+=4,j.next();continue}let me=j.pos-he;if(he<0||me=s?4:0,q=j.start;for(j.next();j.pos>me;){if(j.size<0)if(j.size==-3)ve+=4;else break e;else j.id>=s&&(ve+=4);j.next()}F=q,se+=he,U+=ve}return(C<0||se==D)&&(ue.size=se,ue.start=F,ue.skip=U),ue.size>4?ue:void 0}function S(D,C,j){let{id:se,start:F,end:U,size:ae}=a;if(a.next(),ae>=0&&se4){let ie=a.pos-(ae-4);for(;a.pos>ie;)j=S(D,C,j)}C[--j]=ue,C[--j]=U-D,C[--j]=F-D,C[--j]=se}else ae==-3?c=se:ae==-4&&(u=se);return j}let T=[],A=[];for(;a.pos>0;)f(t.start||0,t.bufferStart||0,T,A,-1,0);let I=(e=t.length)!==null&&e!==void 0?e:T.length?A[0]+T[0].length:0;return new qe(l[t.topID],T.reverse(),A.reverse(),I)}var XE=new WeakMap;function Ad(t,e){if(!t.isAnonymous||e instanceof $o||e.type!=t)return 1;let i=XE.get(e);if(i==null){i=1;for(let r of e.children){if(r.type!=t||!(r instanceof qe)){i=1;break}i+=Ad(t,r)}XE.set(e,i)}return i}function Hb(t,e,i,r,n,o,s,a,l){let c=0;for(let g=r;g=u)break;C+=j}if(A==I+1){if(C>u){let j=g[I];p(j.children,j.positions,0,j.children.length,x[I]+T);continue}f.push(g[I])}else{let j=x[A-1]+g[A-1].length-D;f.push(Hb(t,g,x,I,A,D,j,null,l))}d.push(D+T-o)}}return p(e,i,r,n,0),(a||l)(f,d,s)}var qa=class{constructor(){this.map=new WeakMap}setBuffer(e,i,r){let n=this.map.get(e);n||this.map.set(e,n=new Map),n.set(i,r)}getBuffer(e,i){let r=this.map.get(e);return r&&r.get(i)}set(e,i){e instanceof Ts?this.setBuffer(e.context.buffer,e.index,i):e instanceof Ui&&this.map.set(e.tree,i)}get(e){return e instanceof Ts?this.getBuffer(e.context.buffer,e.index):e instanceof Ui?this.map.get(e.tree):void 0}cursorSet(e,i){e.buffer?this.setBuffer(e.buffer.buffer,e.index,i):this.map.set(e.tree,i)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}},Un=class t{constructor(e,i,r,n,o=!1,s=!1){this.from=e,this.to=i,this.tree=r,this.offset=n,this.open=(o?1:0)|(s?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,i=[],r=!1){let n=[new t(0,e.length,e,0,!1,r)];for(let o of i)o.to>e.length&&n.push(o);return n}static applyChanges(e,i,r=128){if(!i.length)return e;let n=[],o=1,s=e.length?e[0]:null;for(let a=0,l=0,c=0;;a++){let u=a=r)for(;s&&s.from=d.from||f<=d.to||c){let p=Math.max(d.from,l)-c,g=Math.min(d.to,f)-c;d=p>=g?null:new t(p,g,d.tree,d.offset+c,a>0,!!u)}if(d&&n.push(d),s.to>f)break;s=onew Mi(n.from,n.to)):[new Mi(0,0)]:[new Mi(0,e.length)],this.createParse(e,i||[],r)}parse(e,i,r){let n=this.startParse(e,i,r);for(;;){let o=n.advance();if(o)return o}}},Wb=class{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,i){return this.string.slice(e,i)}};function Id(t){return(e,i,r,n)=>new Vb(e,t,i,r,n)}var Xd=class{constructor(e,i,r,n,o){this.parser=e,this.parse=i,this.overlay=r,this.target=n,this.from=o}};function RE(t){if(!t.length||t.some(e=>e.from>=e.to))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(t))}var Bb=class{constructor(e,i,r,n,o,s,a){this.parser=e,this.predicate=i,this.mounts=r,this.index=n,this.start=o,this.target=s,this.prev=a,this.depth=0,this.ranges=[]}},Zb=new Qe({perNode:!0}),Vb=class{constructor(e,i,r,n,o){this.nest=i,this.input=r,this.fragments=n,this.ranges=o,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=e}advance(){if(this.baseParse){let r=this.baseParse.advance();if(!r)return null;if(this.baseParse=null,this.baseTree=r,this.startInner(),this.stoppedAt!=null)for(let n of this.inner)n.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let r=this.baseTree;return this.stoppedAt!=null&&(r=new qe(r.type,r.children,r.positions,r.length,r.propValues.concat([[Zb,this.stoppedAt]]))),r}let e=this.inner[this.innerDone],i=e.parse.advance();if(i){this.innerDone++;let r=Object.assign(Object.create(null),e.target.props);r[Qe.mounted.id]=new Ss(i,e.overlay,e.parser),e.target.props=r}return null}get parsedPos(){if(this.baseParse)return 0;let e=this.input.length;for(let i=this.innerDone;i=this.stoppedAt)a=!1;else if(e.hasNode(n)){if(i){let c=i.mounts.find(u=>u.frag.from<=n.from&&u.frag.to>=n.to&&u.mount.overlay);if(c)for(let u of c.mount.overlay){let f=u.from+c.pos,d=u.to+c.pos;f>=n.from&&d<=n.to&&!i.ranges.some(p=>p.fromf)&&i.ranges.push({from:f,to:d})}}a=!1}else if(r&&(s=zj(r.ranges,n.from,n.to)))a=s!=2;else if(!n.type.isAnonymous&&(o=this.nest(n,this.input))&&(n.fromnew Mi(f.from-n.from,f.to-n.from)):null,n.tree,u.length?u[0].from:n.from)),o.overlay?u.length&&(r={ranges:u,depth:0,prev:r}):a=!1}}else i&&(l=i.predicate(n))&&(l===!0&&(l=new Mi(n.from,n.to)),l.fromnew Mi(u.from-i.start,u.to-i.start)),i.target,c[0].from))),i=i.prev}r&&!--r.depth&&(r=r.prev)}}}};function zj(t,e,i){for(let r of t){if(r.from>=i)break;if(r.to>e)return r.from<=e&&r.to>=i?2:1}return 0}function IE(t,e,i,r,n,o){if(e=e&&i.enter(r,1,st.IgnoreOverlays|st.ExcludeBuffers)||i.next(!1)||(this.done=!0)}hasNode(e){if(this.moveTo(e.from),!this.done&&this.cursor.from+this.offset==e.from&&this.cursor.tree)for(let i=this.cursor.tree;;){if(i==e.tree)return!0;if(i.children.length&&i.positions[0]==0&&i.children[0]instanceof qe)i=i.children[0];else break}return!1}},Yb=class{constructor(e){var i;if(this.fragments=e,this.curTo=0,this.fragI=0,e.length){let r=this.curFrag=e[0];this.curTo=(i=r.tree.prop(Zb))!==null&&i!==void 0?i:r.to,this.inner=new Rd(r.tree,-r.offset)}else this.curFrag=this.inner=null}hasNode(e){for(;this.curFrag&&e.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=e.from&&this.curTo>=e.to&&this.inner.hasNode(e)}nextFrag(){var e;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let i=this.curFrag=this.fragments[this.fragI];this.curTo=(e=i.tree.prop(Zb))!==null&&e!==void 0?e:i.to,this.inner=new Rd(i.tree,-i.offset)}}findMounts(e,i){var r;let n=[];if(this.inner){this.inner.cursor.moveTo(e,1);for(let o=this.inner.cursor.node;o;o=o.parent){let s=(r=o.tree)===null||r===void 0?void 0:r.prop(Qe.mounted);if(s&&s.parser==i)for(let a=this.fragI;a=o.to)break;l.tree==this.curFrag.tree&&n.push({frag:l,pos:o.from-l.offset,mount:s})}}}return n}};function LE(t,e){let i=null,r=e;for(let n=1,o=0;n=a)break;l.to<=s||(i||(r=i=e.slice()),l.froma&&i.splice(o+1,0,new Mi(a,l.to))):l.to>a?i[o--]=new Mi(a,l.to):i.splice(o--,1))}}return r}function qj(t,e,i,r){let n=0,o=0,s=!1,a=!1,l=-1e9,c=[];for(;;){let u=n==t.length?1e9:s?t[n].to:t[n].from,f=o==e.length?1e9:a?e[o].to:e[o].from;if(s!=a){let d=Math.max(l,i),p=Math.min(u,f,r);dnew Mi(d.from+r,d.to+r)),f=qj(e,u,l,c);for(let d=0,p=l;;d++){let g=d==f.length,x=g?c:f[d].from;if(x>p&&i.push(new Un(p,x,n.tree,-s,o.from>=p||o.openStart,o.to<=x||o.openEnd)),g)break;p=f[d].to}}else i.push(new Un(l,c,n.tree,-s,o.from>=s||o.openStart,o.to<=a||o.openEnd))}return i}var He=class t{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,i,r){[e,i]=Fa(this,e,i);let n=[];return this.decompose(0,e,n,2),r.length&&r.decompose(0,r.length,n,3),this.decompose(i,this.length,n,1),Ba.from(n,this.length-(i-e)+r.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,i=this.length){[e,i]=Fa(this,e,i);let r=[];return this.decompose(e,i,r,0),Ba.from(r,i-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let i=this.scanIdentical(e,1),r=this.length-this.scanIdentical(e,-1),n=new _s(this),o=new _s(e);for(let s=i,a=i;;){if(n.next(s),o.next(s),s=0,n.lineBreak!=o.lineBreak||n.done!=o.done||n.value!=o.value)return!1;if(a+=n.value.length,n.done||a>=r)return!0}}iter(e=1){return new _s(this,e)}iterRange(e,i=this.length){return new Md(this,e,i)}iterLines(e,i){let r;if(e==null)r=this.iter();else{i==null&&(i=this.lines+1);let n=this.line(e).from;r=this.iterRange(n,Math.max(n,i==this.lines+1?this.length:i<=1?0:this.line(i-1).to))}return new Ud(r)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?t.empty:e.length<=32?new Gi(e):Ba.from(Gi.split(e,[]))}},Gi=class t extends He{constructor(e,i=Wj(e)){super(),this.text=e,this.length=i}get lines(){return this.text.length}get children(){return null}lineInner(e,i,r,n){for(let o=0;;o++){let s=this.text[o],a=n+s.length;if((i?r:a)>=e)return new Kb(n,a,r,s);n=a+1,r++}}decompose(e,i,r,n){let o=e<=0&&i>=this.length?this:new t(UE(this.text,e,i),Math.min(i,this.length)-Math.max(0,e));if(n&1){let s=r.pop(),a=Nd(o.text,s.text.slice(),0,o.length);if(a.length<=32)r.push(new t(a,s.length+o.length));else{let l=a.length>>1;r.push(new t(a.slice(0,l)),new t(a.slice(l)))}}else r.push(o)}replace(e,i,r){if(!(r instanceof t))return super.replace(e,i,r);[e,i]=Fa(this,e,i);let n=Nd(this.text,Nd(r.text,UE(this.text,0,e)),i),o=this.length+r.length-(i-e);return n.length<=32?new t(n,o):Ba.from(t.split(n,[]),o)}sliceString(e,i=this.length,r=` `){[e,i]=Fa(this,e,i);let n="";for(let o=0,s=0;o<=i&&se&&s&&(n+=r),eo&&(n+=a.slice(Math.max(0,e-o),i-o)),o=l+1}return n}flatten(e){for(let i of this.text)e.push(i)}scanIdentical(){return 0}static split(e,i){let r=[],n=-1;for(let o of e)r.push(o),n+=o.length+1,r.length==32&&(i.push(new t(r,n)),r=[],n=-1);return n>-1&&i.push(new t(r,n)),i}},Ba=class t extends He{constructor(e,i){super(),this.children=e,this.length=i,this.lines=0;for(let r of e)this.lines+=r.lines}lineInner(e,i,r,n){for(let o=0;;o++){let s=this.children[o],a=n+s.length,l=r+s.lines-1;if((i?l:a)>=e)return s.lineInner(e,i,r,n);n=a+1,r=l+1}}decompose(e,i,r,n){for(let o=0,s=0;s<=i&&o=s){let c=n&((s<=e?1:0)|(l>=i?2:0));s>=e&&l<=i&&!c?r.push(a):a.decompose(e-s,i-s,r,c)}s=l+1}}replace(e,i,r){if([e,i]=Fa(this,e,i),r.lines=o&&i<=a){let l=s.replace(e-o,i-o,r),c=this.lines-s.lines+l.lines;if(l.lines>4&&l.lines>c>>6){let u=this.children.slice();return u[n]=l,new t(u,this.length-(i-e)+r.length)}return super.replace(o,a,l)}o=a+1}return super.replace(e,i,r)}sliceString(e,i=this.length,r=` `){[e,i]=Fa(this,e,i);let n="";for(let o=0,s=0;oe&&o&&(n+=r),es&&(n+=a.sliceString(e-s,i-s,r)),s=l+1}return n}flatten(e){for(let i of this.children)i.flatten(e)}scanIdentical(e,i){if(!(e instanceof t))return 0;let r=0,[n,o,s,a]=i>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;n+=i,o+=i){if(n==s||o==a)return r;let l=this.children[n],c=e.children[o];if(l!=c)return r+l.scanIdentical(c,i);r+=l.length+1}}static from(e,i=e.reduce((r,n)=>r+n.length+1,-1)){let r=0;for(let p of e)r+=p.lines;if(r<32){let p=[];for(let g of e)g.flatten(p);return new Gi(p,i)}let n=Math.max(32,r>>5),o=n<<1,s=n>>1,a=[],l=0,c=-1,u=[];function f(p){let g;if(p.lines>o&&p instanceof t)for(let x of p.children)f(x);else p.lines>s&&(l>s||!l)?(d(),a.push(p)):p instanceof Gi&&l&&(g=u[u.length-1])instanceof Gi&&p.lines+g.lines<=32?(l+=p.lines,c+=p.length+1,u[u.length-1]=new Gi(g.text.concat(p.text),g.length+1+p.length)):(l+p.lines>n&&d(),l+=p.lines,c+=p.length+1,u.push(p))}function d(){l!=0&&(a.push(u.length==1?u[0]:t.from(u,c)),c=-1,l=u.length=0)}for(let p of e)f(p);return d(),a.length==1?a[0]:new t(a,i)}};He.empty=new Gi([""],0);function Wj(t){let e=-1;for(let i of t)e+=i.length+1;return e}function Nd(t,e,i=0,r=1e9){for(let n=0,o=0,s=!0;o=i&&(l>r&&(a=a.slice(0,r-n)),n0?1:(e instanceof Gi?e.text.length:e.children.length)<<1]}nextInner(e,i){for(this.done=this.lineBreak=!1;;){let r=this.nodes.length-1,n=this.nodes[r],o=this.offsets[r],s=o>>1,a=n instanceof Gi?n.text.length:n.children.length;if(s==(i>0?a:0)){if(r==0)return this.done=!0,this.value="",this;i>0&&this.offsets[r-1]++,this.nodes.pop(),this.offsets.pop()}else if((o&1)==(i>0?0:1)){if(this.offsets[r]+=i,e==0)return this.lineBreak=!0,this.value=` -`,this;e--}else if(n instanceof Gi){let l=n.text[s+(i<0?-1:0)];if(this.offsets[r]+=i,l.length>Math.max(0,e))return this.value=e==0?l:i>0?l.slice(e):l.slice(0,l.length-e),this;e-=l.length}else{let l=n.children[s+(i<0?-1:0)];e>l.length?(e-=l.length,this.offsets[r]+=i):(i<0&&this.offsets[r]--,this.nodes.push(l),this.offsets.push(i>0?1:(l instanceof Gi?l.text.length:l.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}},Md=class{constructor(e,i,r){this.value="",this.done=!1,this.cursor=new _s(e,i>r?-1:1),this.pos=i>r?e.length:0,this.from=Math.min(i,r),this.to=Math.max(i,r)}nextInner(e,i){if(i<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,i<0?this.pos-this.to:this.from-this.pos);let r=i<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)*i,this.value=n.length<=r?n:i<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!=""}},Ud=class{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:i,lineBreak:r,value:n}=this.inner.next(e);return i&&this.afterBreak?(this.value="",this.afterBreak=!1):i?(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}};typeof Symbol!="undefined"&&(He.prototype[Symbol.iterator]=function(){return this.iter()},_s.prototype[Symbol.iterator]=Md.prototype[Symbol.iterator]=Ud.prototype[Symbol.iterator]=function(){return this});var Kb=class{constructor(e,i,r,n){this.from=e,this.to=i,this.number=r,this.text=n}get length(){return this.to-this.from}};function Fa(t,e,i){return e=Math.max(0,Math.min(t.length,e)),[e,Math.max(e,Math.min(t.length,i))]}var Za="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(t=>t?parseInt(t,36):1);for(let t=1;tt)return Za[e-1]<=t;return!1}function zE(t){return t>=127462&&t<=127487}var jE=8205;function Mt(t,e,i=!0,r=!0){return(i?YE:Zj)(t,e,r)}function YE(t,e,i){if(e==t.length)return e;e&&FE(t.charCodeAt(e))&&HE(t.charCodeAt(e-1))&&e--;let r=Nt(t,e);for(e+=Pi(r);e=0&&zE(Nt(t,s));)o++,s-=2;if(o%2==0)break;e+=2}else break}return e}function Zj(t,e,i){for(;e>0;){let r=YE(t,e-2,i);if(r=56320&&t<57344}function HE(t){return t>=55296&&t<56320}function Nt(t,e){let i=t.charCodeAt(e);if(!HE(i)||e+1==t.length)return i;let r=t.charCodeAt(e+1);return FE(r)?(i-55296<<10)+(r-56320)+65536:i}function ru(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode((t>>10)+55296,(t&1023)+56320))}function Pi(t){return t<65536?1:2}var Jb=/\r\n?|\n/,vt=function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t}(vt||(vt={})),jn=class t{constructor(e){this.sections=e}get length(){let e=0;for(let i=0;ie)return o+(e-n);o+=a}else{if(r!=vt.Simple&&c>=e&&(r==vt.TrackDel&&ne||r==vt.TrackBefore&&ne))return null;if(c>e||c==e&&i<0&&!a)return e==n||i<0?o:o+l;o+=l}n=c}if(e>n)throw new RangeError(`Position ${e} is out of range for changeset of length ${n}`);return o}touchesRange(e,i=e){for(let r=0,n=0;r=0&&n<=i&&a>=e)return ni?"cover":!0;n=a}return!1}toString(){let e="";for(let i=0;i=0?":"+n:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(i=>typeof i!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new t(e)}static create(e){return new t(e)}},Qi=class t extends jn{constructor(e,i){super(e),this.inserted=i}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return e1(this,(i,r,n,o,s)=>e=e.replace(n,n+(r-i),s),!1),e}mapDesc(e,i=!1){return t1(this,e,i,!0)}invert(e){let i=this.sections.slice(),r=[];for(let n=0,o=0;n=0){i[n]=a,i[n+1]=s;let l=n>>1;for(;r.length0&&Xo(r,i,o.text),o.forward(u),a+=u}let c=e[s++];for(;a>1].toJSON()))}return e}static of(e,i,r){let n=[],o=[],s=0,a=null;function l(u=!1){if(!u&&!n.length)return;sd||f<0||d>i)throw new RangeError(`Invalid change range ${f} to ${d} (in doc of length ${i})`);let g=p?typeof p=="string"?He.of(p.split(r||Jb)):p:He.empty,x=g.length;if(f==d&&x==0)return;fs&&gi(n,f-s,-1),gi(n,d-f,x),Xo(o,n,g),s=d}}return c(e),l(!a),a}static empty(e){return new t(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let i=[],r=[];for(let n=0;na&&typeof s!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(o.length==1)i.push(o[0],0);else{for(;r.length=0&&i<=0&&i==t[n+1]?t[n]+=e:e==0&&t[n]==0?t[n+1]+=i:r?(t[n]+=e,t[n+1]+=i):t.push(e,i)}function Xo(t,e,i){if(i.length==0)return;let r=e.length-2>>1;if(r>1])),!(i||s==t.sections.length||t.sections[s+1]<0);)a=t.sections[s++],l=t.sections[s++];e(n,c,o,u,f),n=c,o=u}}}function t1(t,e,i,r=!1){let n=[],o=r?[]:null,s=new Ps(t),a=new Ps(e);for(let l=-1;;)if(s.ins==-1&&a.ins==-1){let c=Math.min(s.len,a.len);gi(n,c,-1),s.forward(c),a.forward(c)}else if(a.ins>=0&&(s.ins<0||l==s.i||s.off==0&&(a.len=0&&l=0){let c=0,u=s.len;for(;u;)if(a.ins==-1){let f=Math.min(u,a.len);c+=f,u-=f,a.forward(f)}else if(a.ins==0&&a.lenl||s.ins>=0&&s.len>l)&&(a||r.length>c),o.forward2(l),s.forward(l)}}}}var Ps=class{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i>1;return i>=e.length?He.empty:e[i]}textBit(e){let{inserted:i}=this.set,r=this.i-2>>1;return r>=i.length&&!e?He.empty:i[r].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}},Wa=class t{constructor(e,i,r){this.from=e,this.to=i,this.flags=r}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}map(e,i=-1){let r,n;return this.empty?r=n=e.mapPos(this.from,i):(r=e.mapPos(this.from,1),n=e.mapPos(this.to,-1)),r==this.from&&n==this.to?this:new t(r,n,this.flags)}extend(e,i=e){if(e<=this.anchor&&i>=this.anchor)return J.range(e,i);let r=Math.abs(e-this.anchor)>Math.abs(i-this.anchor)?e:i;return J.range(this.anchor,r)}eq(e,i=!1){return this.anchor==e.anchor&&this.head==e.head&&(!i||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return J.range(e.anchor,e.head)}static create(e,i,r){return new t(e,i,r)}},J=class t{constructor(e,i){this.ranges=e,this.mainIndex=i}map(e,i=-1){return e.empty?this:t.create(this.ranges.map(r=>r.map(e,i)),this.mainIndex)}eq(e,i=!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)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new t(e.ranges.map(i=>Wa.fromJSON(i)),e.main)}static single(e,i=e){return new t([t.range(e,i)],0)}static create(e,i=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let r=0,n=0;ne?8:0)|o)}static normalized(e,i=0){let r=e[i];e.sort((n,o)=>n.from-o.from),i=e.indexOf(r);for(let n=1;no.head?t.range(l,a):t.range(a,l))}}return new t(e,i)}};function KE(t,e){for(let i of t.ranges)if(i.to>e)throw new RangeError("Selection points outside of document")}var f1=0,be=class t{constructor(e,i,r,n,o){this.combine=e,this.compareInput=i,this.compare=r,this.isStatic=n,this.id=f1++,this.default=e([]),this.extensions=typeof o=="function"?o(this):o}get reader(){return this}static define(e={}){return new t(e.combine||(i=>i),e.compareInput||((i,r)=>i===r),e.compare||(e.combine?(i,r)=>i===r:h1),!!e.static,e.enables)}of(e){return new Va([],this,0,e)}compute(e,i){if(this.isStatic)throw new Error("Can't compute a static facet");return new Va(e,this,1,i)}computeN(e,i){if(this.isStatic)throw new Error("Can't compute a static facet");return new Va(e,this,2,i)}from(e,i){return i||(i=r=>r),this.compute([e],r=>i(r.field(e)))}};function h1(t,e){return t==e||t.length==e.length&&t.every((i,r)=>i===e[r])}var Va=class{constructor(e,i,r,n){this.dependencies=e,this.facet=i,this.type=r,this.value=n,this.id=f1++}dynamicSlot(e){var i;let r=this.value,n=this.facet.compareInput,o=this.id,s=e[o]>>1,a=this.type==2,l=!1,c=!1,u=[];for(let f of this.dependencies)f=="doc"?l=!0:f=="selection"?c=!0:((i=e[f.id])!==null&&i!==void 0?i:1)&1||u.push(e[f.id]);return{create(f){return f.values[s]=r(f),1},update(f,d){if(l&&d.docChanged||c&&(d.docChanged||d.selection)||i1(f,u)){let p=r(f);if(a?!qE(p,f.values[s],n):!n(p,f.values[s]))return f.values[s]=p,1}return 0},reconfigure:(f,d)=>{let p,g=d.config.address[o];if(g!=null){let x=Wd(d,g);if(this.dependencies.every(w=>w instanceof be?d.facet(w)===f.facet(w):w instanceof Fe?d.field(w,!1)==f.field(w,!1):!0)||(a?qE(p=r(f),x,n):n(p=r(f),x)))return f.values[s]=x,0}else p=r(f);return f.values[s]=p,1}}}};function qE(t,e,i){if(t.length!=e.length)return!1;for(let r=0;rt[l.id]),n=i.map(l=>l.type),o=r.filter(l=>!(l&1)),s=t[e.id]>>1;function a(l){let c=[];for(let u=0;ur===n),e);return e.provide&&(i.provides=e.provide(i)),i}create(e){let i=e.facet(WE).find(r=>r.field==this);return((i==null?void 0:i.create)||this.createF)(e)}slot(e){let i=e[this.id]>>1;return{create:r=>(r.values[i]=this.create(r),1),update:(r,n)=>{let o=r.values[i],s=this.updateF(o,n);return this.compareF(o,s)?0:(r.values[i]=s,1)},reconfigure:(r,n)=>n.config.address[this.id]!=null?(r.values[i]=n.field(this),0):(r.values[i]=this.create(r),1)}}init(e){return[this,WE.of({field:this,create:e})]}get extension(){return this}},Es={lowest:4,low:3,default:2,high:1,highest:0};function Kc(t){return e=>new zd(e,t)}var Qt={highest:Kc(Es.highest),high:Kc(Es.high),default:Kc(Es.default),low:Kc(Es.low),lowest:Kc(Es.lowest)},zd=class{constructor(e,i){this.inner=e,this.prec=i}},jd=class t{of(e){return new eu(this,e)}reconfigure(e){return t.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}},eu=class{constructor(e,i){this.compartment=e,this.inner=i}},qd=class t{constructor(e,i,r,n,o,s){for(this.base=e,this.compartments=i,this.dynamicSlots=r,this.address=n,this.staticValues=o,this.facets=s,this.statusTemplate=[];this.statusTemplate.length>1]}static resolve(e,i,r){let n=[],o=Object.create(null),s=new Map;for(let d of Yj(e,i,s))d instanceof Fe?n.push(d):(o[d.facet.id]||(o[d.facet.id]=[])).push(d);let a=Object.create(null),l=[],c=[];for(let d of n)a[d.id]=c.length<<1,c.push(p=>d.slot(p));let u=r==null?void 0:r.config.facets;for(let d in o){let p=o[d],g=p[0].facet,x=u&&u[d]||[];if(p.every(w=>w.type==0))if(a[g.id]=l.length<<1|1,h1(x,p))l.push(r.facet(g));else{let w=g.combine(p.map(S=>S.value));l.push(r&&g.compare(w,r.facet(g))?r.facet(g):w)}else{for(let w of p)w.type==0?(a[w.id]=l.length<<1|1,l.push(w.value)):(a[w.id]=c.length<<1,c.push(S=>w.dynamicSlot(S)));a[g.id]=c.length<<1,c.push(w=>Vj(w,g,p))}}let f=c.map(d=>d(a));return new t(e,s,f,a,l,o)}};function Yj(t,e,i){let r=[[],[],[],[],[]],n=new Map;function o(s,a){let l=n.get(s);if(l!=null){if(l<=a)return;let c=r[l].indexOf(s);c>-1&&r[l].splice(c,1),s instanceof eu&&i.delete(s.compartment)}if(n.set(s,a),Array.isArray(s))for(let c of s)o(c,a);else if(s instanceof eu){if(i.has(s.compartment))throw new RangeError("Duplicate use of compartment in extensions");let c=e.get(s.compartment)||s.inner;i.set(s.compartment,c),o(c,a)}else if(s instanceof zd)o(s.inner,s.prec);else if(s instanceof Fe)r[a].push(s),s.provides&&o(s.provides,a);else if(s instanceof Va)r[a].push(s),s.facet.extensions&&o(s.facet.extensions,Es.default);else{let c=s.extension;if(!c)throw new Error(`Unrecognized extension value in extension set (${s}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);o(c,a)}}return o(t,Es.default),r.reduce((s,a)=>s.concat(a))}function Jc(t,e){if(e&1)return 2;let i=e>>1,r=t.status[i];if(r==4)throw new Error("Cyclic dependency between fields and/or facets");if(r&2)return r;t.status[i]=4;let n=t.computeSlot(t,t.config.dynamicSlots[i]);return t.status[i]=2|n}function Wd(t,e){return e&1?t.config.staticValues[e>>1]:t.values[e>>1]}var JE=be.define(),r1=be.define({combine:t=>t.some(e=>e),static:!0}),e5=be.define({combine:t=>t.length?t[0]:void 0,static:!0}),t5=be.define(),i5=be.define(),r5=be.define(),n5=be.define({combine:t=>t.length?t[0]:!1}),bi=class{constructor(e,i){this.type=e,this.value=i}static define(){return new n1}},n1=class{of(e){return new bi(this,e)}},o1=class{constructor(e){this.map=e}of(e){return new Se(this,e)}},Se=class t{constructor(e,i){this.type=e,this.value=i}map(e){let i=this.type.map(this.value,e);return i===void 0?void 0:i==this.value?this:new t(this.type,i)}is(e){return this.type==e}static define(e={}){return new o1(e.map||(i=>i))}static mapEffects(e,i){if(!e.length)return e;let r=[];for(let n of e){let o=n.map(i);o&&r.push(o)}return r}};Se.reconfigure=Se.define();Se.appendConfig=Se.define();var Tt=class t{constructor(e,i,r,n,o,s){this.startState=e,this.changes=i,this.selection=r,this.effects=n,this.annotations=o,this.scrollIntoView=s,this._doc=null,this._state=null,r&&KE(r,i.newLength),o.some(a=>a.type==t.time)||(this.annotations=o.concat(t.time.of(Date.now())))}static create(e,i,r,n,o,s){return new t(e,i,r,n,o,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 i of this.annotations)if(i.type==e)return i.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let i=this.annotation(t.userEvent);return!!(i&&(i==e||i.length>e.length&&i.slice(0,e.length)==e&&i[e.length]=="."))}};Tt.time=bi.define();Tt.userEvent=bi.define();Tt.addToHistory=bi.define();Tt.remote=bi.define();function Fj(t,e){let i=[];for(let r=0,n=0;;){let o,s;if(r=t[r]))o=t[r++],s=t[r++];else if(n=0;n--){let o=r[n](t);o instanceof Tt?t=o:Array.isArray(o)&&o.length==1&&o[0]instanceof Tt?t=o[0]:t=s5(e,Ya(o),!1)}return t}function Gj(t){let e=t.startState,i=e.facet(r5),r=t;for(let n=i.length-1;n>=0;n--){let o=i[n](t);o&&Object.keys(o).length&&(r=o5(r,s1(e,o,t.changes.newLength),!0))}return r==t?t:Tt.create(e,t.changes,t.selection,r.effects,r.annotations,r.scrollIntoView)}var Kj=[];function Ya(t){return t==null?Kj:Array.isArray(t)?t:[t]}var dt=function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t}(dt||(dt={})),Jj=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,a1;try{a1=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch(t){}function eq(t){if(a1)return a1.test(t);for(let e=0;e"\x80"&&(i.toUpperCase()!=i.toLowerCase()||Jj.test(i)))return!0}return!1}function tq(t){return e=>{if(!/\S/.test(e))return dt.Space;if(eq(e))return dt.Word;for(let i=0;i-1)return dt.Word;return dt.Other}}var rt=class t{constructor(e,i,r,n,o,s){this.config=e,this.doc=i,this.selection=r,this.values=n,this.status=e.statusTemplate.slice(),this.computeSlot=o,s&&(s._state=this);for(let a=0;an.set(c,l)),i=null),n.set(a.value.compartment,a.value.extension)):a.is(Se.reconfigure)?(i=null,r=a.value):a.is(Se.appendConfig)&&(i=null,r=Ya(r).concat(a.value));let o;i?o=e.startState.values.slice():(i=qd.resolve(r,n,this),o=new t(i,this.doc,this.selection,i.dynamicSlots.map(()=>null),(l,c)=>c.reconfigure(l,this),null).values);let s=e.startState.facet(r1)?e.newSelection:e.newSelection.asSingle();new t(i,e.newDoc,s,o,(a,l)=>l.update(a,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(i=>({changes:{from:i.from,to:i.to,insert:e},range:J.cursor(i.from+e.length)}))}changeByRange(e){let i=this.selection,r=e(i.ranges[0]),n=this.changes(r.changes),o=[r.range],s=Ya(r.effects);for(let a=1;as.spec.fromJSON(a,l)))}}return t.create({doc:e.doc,selection:J.fromJSON(e.selection),extensions:i.extensions?n.concat([i.extensions]):n})}static create(e={}){let i=qd.resolve(e.extensions||[],new Map),r=e.doc instanceof He?e.doc:He.of((e.doc||"").split(i.staticFacet(t.lineSeparator)||Jb)),n=e.selection?e.selection instanceof J?e.selection:J.single(e.selection.anchor,e.selection.head):J.single(0);return KE(n,r.length),i.staticFacet(r1)||(n=n.asSingle()),new t(i,r,n,i.dynamicSlots.map(()=>null),(o,s)=>s.create(o),null)}get tabSize(){return this.facet(t.tabSize)}get lineBreak(){return this.facet(t.lineSeparator)||` +`,this;e--}else if(n instanceof Gi){let l=n.text[s+(i<0?-1:0)];if(this.offsets[r]+=i,l.length>Math.max(0,e))return this.value=e==0?l:i>0?l.slice(e):l.slice(0,l.length-e),this;e-=l.length}else{let l=n.children[s+(i<0?-1:0)];e>l.length?(e-=l.length,this.offsets[r]+=i):(i<0&&this.offsets[r]--,this.nodes.push(l),this.offsets.push(i>0?1:(l instanceof Gi?l.text.length:l.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}},Md=class{constructor(e,i,r){this.value="",this.done=!1,this.cursor=new _s(e,i>r?-1:1),this.pos=i>r?e.length:0,this.from=Math.min(i,r),this.to=Math.max(i,r)}nextInner(e,i){if(i<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,i<0?this.pos-this.to:this.from-this.pos);let r=i<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)*i,this.value=n.length<=r?n:i<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!=""}},Ud=class{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:i,lineBreak:r,value:n}=this.inner.next(e);return i&&this.afterBreak?(this.value="",this.afterBreak=!1):i?(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}};typeof Symbol!="undefined"&&(He.prototype[Symbol.iterator]=function(){return this.iter()},_s.prototype[Symbol.iterator]=Md.prototype[Symbol.iterator]=Ud.prototype[Symbol.iterator]=function(){return this});var Kb=class{constructor(e,i,r,n){this.from=e,this.to=i,this.number=r,this.text=n}get length(){return this.to-this.from}};function Fa(t,e,i){return e=Math.max(0,Math.min(t.length,e)),[e,Math.max(e,Math.min(t.length,i))]}var Za="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(t=>t?parseInt(t,36):1);for(let t=1;tt)return Za[e-1]<=t;return!1}function zE(t){return t>=127462&&t<=127487}var jE=8205;function Mt(t,e,i=!0,r=!0){return(i?YE:Zj)(t,e,r)}function YE(t,e,i){if(e==t.length)return e;e&&FE(t.charCodeAt(e))&&HE(t.charCodeAt(e-1))&&e--;let r=Nt(t,e);for(e+=Pi(r);e=0&&zE(Nt(t,s));)o++,s-=2;if(o%2==0)break;e+=2}else break}return e}function Zj(t,e,i){for(;e>0;){let r=YE(t,e-2,i);if(r=56320&&t<57344}function HE(t){return t>=55296&&t<56320}function Nt(t,e){let i=t.charCodeAt(e);if(!HE(i)||e+1==t.length)return i;let r=t.charCodeAt(e+1);return FE(r)?(i-55296<<10)+(r-56320)+65536:i}function ru(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode((t>>10)+55296,(t&1023)+56320))}function Pi(t){return t<65536?1:2}var Jb=/\r\n?|\n/,vt=function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t}(vt||(vt={})),jn=class t{constructor(e){this.sections=e}get length(){let e=0;for(let i=0;ie)return o+(e-n);o+=a}else{if(r!=vt.Simple&&c>=e&&(r==vt.TrackDel&&ne||r==vt.TrackBefore&&ne))return null;if(c>e||c==e&&i<0&&!a)return e==n||i<0?o:o+l;o+=l}n=c}if(e>n)throw new RangeError(`Position ${e} is out of range for changeset of length ${n}`);return o}touchesRange(e,i=e){for(let r=0,n=0;r=0&&n<=i&&a>=e)return ni?"cover":!0;n=a}return!1}toString(){let e="";for(let i=0;i=0?":"+n:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(i=>typeof i!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new t(e)}static create(e){return new t(e)}},Qi=class t extends jn{constructor(e,i){super(e),this.inserted=i}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return e1(this,(i,r,n,o,s)=>e=e.replace(n,n+(r-i),s),!1),e}mapDesc(e,i=!1){return t1(this,e,i,!0)}invert(e){let i=this.sections.slice(),r=[];for(let n=0,o=0;n=0){i[n]=a,i[n+1]=s;let l=n>>1;for(;r.length0&&Xo(r,i,o.text),o.forward(u),a+=u}let c=e[s++];for(;a>1].toJSON()))}return e}static of(e,i,r){let n=[],o=[],s=0,a=null;function l(u=!1){if(!u&&!n.length)return;sd||f<0||d>i)throw new RangeError(`Invalid change range ${f} to ${d} (in doc of length ${i})`);let g=p?typeof p=="string"?He.of(p.split(r||Jb)):p:He.empty,x=g.length;if(f==d&&x==0)return;fs&&gi(n,f-s,-1),gi(n,d-f,x),Xo(o,n,g),s=d}}return c(e),l(!a),a}static empty(e){return new t(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let i=[],r=[];for(let n=0;na&&typeof s!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(o.length==1)i.push(o[0],0);else{for(;r.length=0&&i<=0&&i==t[n+1]?t[n]+=e:e==0&&t[n]==0?t[n+1]+=i:r?(t[n]+=e,t[n+1]+=i):t.push(e,i)}function Xo(t,e,i){if(i.length==0)return;let r=e.length-2>>1;if(r>1])),!(i||s==t.sections.length||t.sections[s+1]<0);)a=t.sections[s++],l=t.sections[s++];e(n,c,o,u,f),n=c,o=u}}}function t1(t,e,i,r=!1){let n=[],o=r?[]:null,s=new Ps(t),a=new Ps(e);for(let l=-1;;)if(s.ins==-1&&a.ins==-1){let c=Math.min(s.len,a.len);gi(n,c,-1),s.forward(c),a.forward(c)}else if(a.ins>=0&&(s.ins<0||l==s.i||s.off==0&&(a.len=0&&l=0){let c=0,u=s.len;for(;u;)if(a.ins==-1){let f=Math.min(u,a.len);c+=f,u-=f,a.forward(f)}else if(a.ins==0&&a.lenl||s.ins>=0&&s.len>l)&&(a||r.length>c),o.forward2(l),s.forward(l)}}}}var Ps=class{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i>1;return i>=e.length?He.empty:e[i]}textBit(e){let{inserted:i}=this.set,r=this.i-2>>1;return r>=i.length&&!e?He.empty:i[r].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}},Wa=class t{constructor(e,i,r){this.from=e,this.to=i,this.flags=r}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}map(e,i=-1){let r,n;return this.empty?r=n=e.mapPos(this.from,i):(r=e.mapPos(this.from,1),n=e.mapPos(this.to,-1)),r==this.from&&n==this.to?this:new t(r,n,this.flags)}extend(e,i=e){if(e<=this.anchor&&i>=this.anchor)return J.range(e,i);let r=Math.abs(e-this.anchor)>Math.abs(i-this.anchor)?e:i;return J.range(this.anchor,r)}eq(e,i=!1){return this.anchor==e.anchor&&this.head==e.head&&(!i||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return J.range(e.anchor,e.head)}static create(e,i,r){return new t(e,i,r)}},J=class t{constructor(e,i){this.ranges=e,this.mainIndex=i}map(e,i=-1){return e.empty?this:t.create(this.ranges.map(r=>r.map(e,i)),this.mainIndex)}eq(e,i=!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)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new t(e.ranges.map(i=>Wa.fromJSON(i)),e.main)}static single(e,i=e){return new t([t.range(e,i)],0)}static create(e,i=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let r=0,n=0;ne?8:0)|o)}static normalized(e,i=0){let r=e[i];e.sort((n,o)=>n.from-o.from),i=e.indexOf(r);for(let n=1;no.head?t.range(l,a):t.range(a,l))}}return new t(e,i)}};function KE(t,e){for(let i of t.ranges)if(i.to>e)throw new RangeError("Selection points outside of document")}var f1=0,be=class t{constructor(e,i,r,n,o){this.combine=e,this.compareInput=i,this.compare=r,this.isStatic=n,this.id=f1++,this.default=e([]),this.extensions=typeof o=="function"?o(this):o}get reader(){return this}static define(e={}){return new t(e.combine||(i=>i),e.compareInput||((i,r)=>i===r),e.compare||(e.combine?(i,r)=>i===r:h1),!!e.static,e.enables)}of(e){return new Va([],this,0,e)}compute(e,i){if(this.isStatic)throw new Error("Can't compute a static facet");return new Va(e,this,1,i)}computeN(e,i){if(this.isStatic)throw new Error("Can't compute a static facet");return new Va(e,this,2,i)}from(e,i){return i||(i=r=>r),this.compute([e],r=>i(r.field(e)))}};function h1(t,e){return t==e||t.length==e.length&&t.every((i,r)=>i===e[r])}var Va=class{constructor(e,i,r,n){this.dependencies=e,this.facet=i,this.type=r,this.value=n,this.id=f1++}dynamicSlot(e){var i;let r=this.value,n=this.facet.compareInput,o=this.id,s=e[o]>>1,a=this.type==2,l=!1,c=!1,u=[];for(let f of this.dependencies)f=="doc"?l=!0:f=="selection"?c=!0:((i=e[f.id])!==null&&i!==void 0?i:1)&1||u.push(e[f.id]);return{create(f){return f.values[s]=r(f),1},update(f,d){if(l&&d.docChanged||c&&(d.docChanged||d.selection)||i1(f,u)){let p=r(f);if(a?!qE(p,f.values[s],n):!n(p,f.values[s]))return f.values[s]=p,1}return 0},reconfigure:(f,d)=>{let p,g=d.config.address[o];if(g!=null){let x=Wd(d,g);if(this.dependencies.every(w=>w instanceof be?d.facet(w)===f.facet(w):w instanceof Fe?d.field(w,!1)==f.field(w,!1):!0)||(a?qE(p=r(f),x,n):n(p=r(f),x)))return f.values[s]=x,0}else p=r(f);return f.values[s]=p,1}}}};function qE(t,e,i){if(t.length!=e.length)return!1;for(let r=0;rt[l.id]),n=i.map(l=>l.type),o=r.filter(l=>!(l&1)),s=t[e.id]>>1;function a(l){let c=[];for(let u=0;ur===n),e);return e.provide&&(i.provides=e.provide(i)),i}create(e){let i=e.facet(WE).find(r=>r.field==this);return((i==null?void 0:i.create)||this.createF)(e)}slot(e){let i=e[this.id]>>1;return{create:r=>(r.values[i]=this.create(r),1),update:(r,n)=>{let o=r.values[i],s=this.updateF(o,n);return this.compareF(o,s)?0:(r.values[i]=s,1)},reconfigure:(r,n)=>n.config.address[this.id]!=null?(r.values[i]=n.field(this),0):(r.values[i]=this.create(r),1)}}init(e){return[this,WE.of({field:this,create:e})]}get extension(){return this}},Es={lowest:4,low:3,default:2,high:1,highest:0};function Kc(t){return e=>new zd(e,t)}var Qt={highest:Kc(Es.highest),high:Kc(Es.high),default:Kc(Es.default),low:Kc(Es.low),lowest:Kc(Es.lowest)},zd=class{constructor(e,i){this.inner=e,this.prec=i}},jd=class t{of(e){return new eu(this,e)}reconfigure(e){return t.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}},eu=class{constructor(e,i){this.compartment=e,this.inner=i}},qd=class t{constructor(e,i,r,n,o,s){for(this.base=e,this.compartments=i,this.dynamicSlots=r,this.address=n,this.staticValues=o,this.facets=s,this.statusTemplate=[];this.statusTemplate.length>1]}static resolve(e,i,r){let n=[],o=Object.create(null),s=new Map;for(let d of Yj(e,i,s))d instanceof Fe?n.push(d):(o[d.facet.id]||(o[d.facet.id]=[])).push(d);let a=Object.create(null),l=[],c=[];for(let d of n)a[d.id]=c.length<<1,c.push(p=>d.slot(p));let u=r==null?void 0:r.config.facets;for(let d in o){let p=o[d],g=p[0].facet,x=u&&u[d]||[];if(p.every(w=>w.type==0))if(a[g.id]=l.length<<1|1,h1(x,p))l.push(r.facet(g));else{let w=g.combine(p.map(S=>S.value));l.push(r&&g.compare(w,r.facet(g))?r.facet(g):w)}else{for(let w of p)w.type==0?(a[w.id]=l.length<<1|1,l.push(w.value)):(a[w.id]=c.length<<1,c.push(S=>w.dynamicSlot(S)));a[g.id]=c.length<<1,c.push(w=>Vj(w,g,p))}}let f=c.map(d=>d(a));return new t(e,s,f,a,l,o)}};function Yj(t,e,i){let r=[[],[],[],[],[]],n=new Map;function o(s,a){let l=n.get(s);if(l!=null){if(l<=a)return;let c=r[l].indexOf(s);c>-1&&r[l].splice(c,1),s instanceof eu&&i.delete(s.compartment)}if(n.set(s,a),Array.isArray(s))for(let c of s)o(c,a);else if(s instanceof eu){if(i.has(s.compartment))throw new RangeError("Duplicate use of compartment in extensions");let c=e.get(s.compartment)||s.inner;i.set(s.compartment,c),o(c,a)}else if(s instanceof zd)o(s.inner,s.prec);else if(s instanceof Fe)r[a].push(s),s.provides&&o(s.provides,a);else if(s instanceof Va)r[a].push(s),s.facet.extensions&&o(s.facet.extensions,Es.default);else{let c=s.extension;if(!c)throw new Error(`Unrecognized extension value in extension set (${s}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);o(c,a)}}return o(t,Es.default),r.reduce((s,a)=>s.concat(a))}function Jc(t,e){if(e&1)return 2;let i=e>>1,r=t.status[i];if(r==4)throw new Error("Cyclic dependency between fields and/or facets");if(r&2)return r;t.status[i]=4;let n=t.computeSlot(t,t.config.dynamicSlots[i]);return t.status[i]=2|n}function Wd(t,e){return e&1?t.config.staticValues[e>>1]:t.values[e>>1]}var JE=be.define(),r1=be.define({combine:t=>t.some(e=>e),static:!0}),e5=be.define({combine:t=>t.length?t[0]:void 0,static:!0}),t5=be.define(),i5=be.define(),r5=be.define(),n5=be.define({combine:t=>t.length?t[0]:!1}),bi=class{constructor(e,i){this.type=e,this.value=i}static define(){return new n1}},n1=class{of(e){return new bi(this,e)}},o1=class{constructor(e){this.map=e}of(e){return new Se(this,e)}},Se=class t{constructor(e,i){this.type=e,this.value=i}map(e){let i=this.type.map(this.value,e);return i===void 0?void 0:i==this.value?this:new t(this.type,i)}is(e){return this.type==e}static define(e={}){return new o1(e.map||(i=>i))}static mapEffects(e,i){if(!e.length)return e;let r=[];for(let n of e){let o=n.map(i);o&&r.push(o)}return r}};Se.reconfigure=Se.define();Se.appendConfig=Se.define();var Et=class t{constructor(e,i,r,n,o,s){this.startState=e,this.changes=i,this.selection=r,this.effects=n,this.annotations=o,this.scrollIntoView=s,this._doc=null,this._state=null,r&&KE(r,i.newLength),o.some(a=>a.type==t.time)||(this.annotations=o.concat(t.time.of(Date.now())))}static create(e,i,r,n,o,s){return new t(e,i,r,n,o,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 i of this.annotations)if(i.type==e)return i.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let i=this.annotation(t.userEvent);return!!(i&&(i==e||i.length>e.length&&i.slice(0,e.length)==e&&i[e.length]=="."))}};Et.time=bi.define();Et.userEvent=bi.define();Et.addToHistory=bi.define();Et.remote=bi.define();function Fj(t,e){let i=[];for(let r=0,n=0;;){let o,s;if(r=t[r]))o=t[r++],s=t[r++];else if(n=0;n--){let o=r[n](t);o instanceof Et?t=o:Array.isArray(o)&&o.length==1&&o[0]instanceof Et?t=o[0]:t=s5(e,Ya(o),!1)}return t}function Gj(t){let e=t.startState,i=e.facet(r5),r=t;for(let n=i.length-1;n>=0;n--){let o=i[n](t);o&&Object.keys(o).length&&(r=o5(r,s1(e,o,t.changes.newLength),!0))}return r==t?t:Et.create(e,t.changes,t.selection,r.effects,r.annotations,r.scrollIntoView)}var Kj=[];function Ya(t){return t==null?Kj:Array.isArray(t)?t:[t]}var dt=function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t}(dt||(dt={})),Jj=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,a1;try{a1=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch(t){}function eq(t){if(a1)return a1.test(t);for(let e=0;e"\x80"&&(i.toUpperCase()!=i.toLowerCase()||Jj.test(i)))return!0}return!1}function tq(t){return e=>{if(!/\S/.test(e))return dt.Space;if(eq(e))return dt.Word;for(let i=0;i-1)return dt.Word;return dt.Other}}var rt=class t{constructor(e,i,r,n,o,s){this.config=e,this.doc=i,this.selection=r,this.values=n,this.status=e.statusTemplate.slice(),this.computeSlot=o,s&&(s._state=this);for(let a=0;an.set(c,l)),i=null),n.set(a.value.compartment,a.value.extension)):a.is(Se.reconfigure)?(i=null,r=a.value):a.is(Se.appendConfig)&&(i=null,r=Ya(r).concat(a.value));let o;i?o=e.startState.values.slice():(i=qd.resolve(r,n,this),o=new t(i,this.doc,this.selection,i.dynamicSlots.map(()=>null),(l,c)=>c.reconfigure(l,this),null).values);let s=e.startState.facet(r1)?e.newSelection:e.newSelection.asSingle();new t(i,e.newDoc,s,o,(a,l)=>l.update(a,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(i=>({changes:{from:i.from,to:i.to,insert:e},range:J.cursor(i.from+e.length)}))}changeByRange(e){let i=this.selection,r=e(i.ranges[0]),n=this.changes(r.changes),o=[r.range],s=Ya(r.effects);for(let a=1;as.spec.fromJSON(a,l)))}}return t.create({doc:e.doc,selection:J.fromJSON(e.selection),extensions:i.extensions?n.concat([i.extensions]):n})}static create(e={}){let i=qd.resolve(e.extensions||[],new Map),r=e.doc instanceof He?e.doc:He.of((e.doc||"").split(i.staticFacet(t.lineSeparator)||Jb)),n=e.selection?e.selection instanceof J?e.selection:J.single(e.selection.anchor,e.selection.head):J.single(0);return KE(n,r.length),i.staticFacet(r1)||(n=n.asSingle()),new t(i,r,n,i.dynamicSlots.map(()=>null),(o,s)=>s.create(o),null)}get tabSize(){return this.facet(t.tabSize)}get lineBreak(){return this.facet(t.lineSeparator)||` `}get readOnly(){return this.facet(n5)}phrase(e,...i){for(let r of this.facet(t.phrases))if(Object.prototype.hasOwnProperty.call(r,e)){e=r[e];break}return i.length&&(e=e.replace(/\$(\$|\d*)/g,(r,n)=>{if(n=="$")return"$";let o=+(n||1);return!o||o>i.length?r:i[o-1]})),e}languageDataAt(e,i,r=-1){let n=[];for(let o of this.facet(JE))for(let s of o(this,i,r))Object.prototype.hasOwnProperty.call(s,e)&&n.push(s[e]);return n}charCategorizer(e){return tq(this.languageDataAt("wordChars",e).join(""))}wordAt(e){let{text:i,from:r,length:n}=this.doc.lineAt(e),o=this.charCategorizer(e),s=e-r,a=e-r;for(;s>0;){let l=Mt(i,s,!1);if(o(i.slice(l,s))!=dt.Word)break;s=l}for(;at.length?t[0]:4});rt.lineSeparator=e5;rt.readOnly=n5;rt.phrases=be.define({compare(t,e){let i=Object.keys(t),r=Object.keys(e);return i.length==r.length&&i.every(n=>t[n]==e[n])}});rt.languageData=JE;rt.changeFilter=t5;rt.transactionFilter=i5;rt.transactionExtender=r5;jd.reconfigure=Se.define();function wt(t,e,i={}){let r={};for(let n of t)for(let o of Object.keys(n)){let s=n[o],a=r[o];if(a===void 0)r[o]=s;else if(!(a===s||s===void 0))if(Object.hasOwnProperty.call(i,o))r[o]=i[o](a,s);else throw new Error("Config merge conflict for field "+o)}for(let n in e)r[n]===void 0&&(r[n]=e[n]);return r}var Lr=class{eq(e){return this==e}range(e,i=e){return tu.create(e,i,this)}};Lr.prototype.startSide=Lr.prototype.endSide=0;Lr.prototype.point=!1;Lr.prototype.mapMode=vt.TrackDel;var tu=class t{constructor(e,i,r){this.from=e,this.to=i,this.value=r}static create(e,i,r){return new t(e,i,r)}};function l1(t,e){return t.from-e.from||t.value.startSide-e.value.startSide}var c1=class t{constructor(e,i,r,n){this.from=e,this.to=i,this.value=r,this.maxPoint=n}get length(){return this.to[this.to.length-1]}findIndex(e,i,r,n=0){let o=r?this.to:this.from;for(let s=n,a=o.length;;){if(s==a)return s;let l=s+a>>1,c=o[l]-e||(r?this.value[l].endSide:this.value[l].startSide)-i;if(l==s)return c>=0?s:a;c>=0?a=l:s=l+1}}between(e,i,r,n){for(let o=this.findIndex(i,-1e9,!0),s=this.findIndex(r,1e9,!1,o);op||d==p&&c.startSide>0&&c.endSide<=0)continue;(p-d||c.endSide-c.startSide)<0||(s<0&&(s=d),c.point&&(a=Math.max(a,p-d)),r.push(c),n.push(d-s),o.push(p-s))}return{mapped:r.length?new t(n,o,r,a):null,pos:s}}},nt=class t{constructor(e,i,r,n){this.chunkPos=e,this.chunk=i,this.nextLayer=r,this.maxPoint=n}static create(e,i,r,n){return new t(e,i,r,n)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let i of this.chunk)e+=i.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:i=[],sort:r=!1,filterFrom:n=0,filterTo:o=this.length}=e,s=e.filter;if(i.length==0&&!s)return this;if(r&&(i=i.slice().sort(l1)),this.isEmpty)return i.length?t.of(i):this;let a=new Bd(this,null,-1).goto(0),l=0,c=[],u=new Ki;for(;a.value||l=0){let f=i[l++];u.addInner(f.from,f.to,f.value)||c.push(f)}else a.rangeIndex==1&&a.chunkIndexthis.chunkEnd(a.chunkIndex)||oa.to||o=o&&e<=o+s.length&&s.between(o,e-o,i-o,r)===!1)return}this.nextLayer.between(e,i,r)}}iter(e=0){return iu.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,i=0){return iu.from(e).goto(i)}static compare(e,i,r,n,o=-1){let s=e.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=o),a=i.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=o),l=BE(s,a,r),c=new Cs(s,l,o),u=new Cs(a,l,o);r.iterGaps((f,d,p)=>ZE(c,f,u,d,p,n)),r.empty&&r.length==0&&ZE(c,0,u,0,0,n)}static eq(e,i,r=0,n){n==null&&(n=999999999);let o=e.filter(u=>!u.isEmpty&&i.indexOf(u)<0),s=i.filter(u=>!u.isEmpty&&e.indexOf(u)<0);if(o.length!=s.length)return!1;if(!o.length)return!0;let a=BE(o,s),l=new Cs(o,a,0).goto(r),c=new Cs(s,a,0).goto(r);for(;;){if(l.to!=c.to||!u1(l.active,c.active)||l.point&&(!c.point||!l.point.eq(c.point)))return!1;if(l.to>n)return!0;l.next(),c.next()}}static spans(e,i,r,n,o=-1){let s=new Cs(e,null,o).goto(i),a=i,l=s.openStart;for(;;){let c=Math.min(s.to,r);if(s.point){let u=s.activeForPoint(s.to),f=s.pointFroma&&(n.span(a,c,s.active,l),l=s.openEnd(c));if(s.to>r)return l+(s.point&&s.to>r?1:0);a=s.to,s.next()}}static of(e,i=!1){let r=new Ki;for(let n of e instanceof tu?[e]:i?iq(e):e)r.add(n.from,n.to,n.value);return r.finish()}static join(e){if(!e.length)return t.empty;let i=e[e.length-1];for(let r=e.length-2;r>=0;r--)for(let n=e[r];n!=t.empty;n=n.nextLayer)i=new t(n.chunkPos,n.chunk,i,Math.max(n.maxPoint,i.maxPoint));return i}};nt.empty=new nt([],[],null,-1);function iq(t){if(t.length>1)for(let e=t[0],i=1;i0)return t.slice().sort(l1);e=r}return t}nt.empty.nextLayer=nt.empty;var Ki=class t{finishChunk(e){this.chunks.push(new c1(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(e,i,r){this.addInner(e,i,r)||(this.nextLayer||(this.nextLayer=new t)).add(e,i,r)}addInner(e,i,r){let n=e-this.lastTo||r.startSide-this.last.endSide;if(n<=0&&(e-this.lastFrom||r.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return n<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(i-this.chunkStart),this.last=r,this.lastFrom=e,this.lastTo=i,this.value.push(r),r.point&&(this.maxPoint=Math.max(this.maxPoint,i-e)),!0)}addChunk(e,i){if((e-this.lastTo||i.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,i.maxPoint),this.chunks.push(i),this.chunkPos.push(e);let r=i.value.length-1;return this.last=i.value[r],this.lastFrom=i.from[r]+e,this.lastTo=i.to[r]+e,!0}finish(){return this.finishInner(nt.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let i=nt.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,i}};function BE(t,e,i){let r=new Map;for(let o of t)for(let s=0;s=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex=r&&n.push(new Bd(s,i,r,o));return n.length==1?n[0]:new t(n)}get startSide(){return this.value?this.value.startSide:0}goto(e,i=-1e9){for(let r of this.heap)r.goto(e,i);for(let r=this.heap.length>>1;r>=0;r--)Gb(this.heap,r);return this.next(),this}forward(e,i){for(let r of this.heap)r.forward(e,i);for(let r=this.heap.length>>1;r>=0;r--)Gb(this.heap,r);(this.to-e||this.value.endSide-i)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),Gb(this.heap,0)}}};function Gb(t,e){for(let i=t[e];;){let r=(e<<1)+1;if(r>=t.length)break;let n=t[r];if(r+1=0&&(n=t[r+1],r++),i.compare(n)<0)break;t[r]=i,t[e]=n,e=r}}var Cs=class{constructor(e,i,r){this.minPoint=r,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=iu.from(e,i,r)}goto(e,i=-1e9){return this.cursor.goto(e,i),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=i,this.openStart=-1,this.next(),this}forward(e,i){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-i)<0;)this.removeActive(this.minActive);this.cursor.forward(e,i)}removeActive(e){Ld(this.active,e),Ld(this.activeTo,e),Ld(this.activeRank,e),this.minActive=VE(this.active,this.activeTo)}addActive(e){let i=0,{value:r,to:n,rank:o}=this.cursor;for(;i0;)i++;Dd(this.active,i,r),Dd(this.activeTo,i,n),Dd(this.activeRank,i,o),e&&Dd(e,i,this.cursor.from),this.minActive=VE(this.active,this.activeTo)}next(){let e=this.to,i=this.point;this.point=null;let r=this.openStart<0?[]:null;for(;;){let n=this.minActive;if(n>-1&&(this.activeTo[n]-this.cursor.from||this.active[n].endSide-this.cursor.startSide)<0){if(this.activeTo[n]>e){this.to=this.activeTo[n],this.endSide=this.active[n].endSide;break}this.removeActive(n),r&&Ld(r,n)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let o=this.cursor.value;if(!o.point)this.addActive(r),this.cursor.next();else if(i&&this.cursor.to==this.to&&this.cursor.from=0&&r[n]=0&&!(this.activeRank[r]e||this.activeTo[r]==e&&this.active[r].endSide>=this.point.endSide)&&i.push(this.active[r]);return i.reverse()}openEnd(e){let i=0;for(let r=this.activeTo.length-1;r>=0&&this.activeTo[r]>e;r--)i++;return i}};function ZE(t,e,i,r,n,o){t.goto(e),i.goto(r);let s=r+n,a=r,l=r-e;for(;;){let c=t.to+l-i.to||t.endSide-i.endSide,u=c<0?t.to+l:i.to,f=Math.min(u,s);if(t.point||i.point?t.point&&i.point&&(t.point==i.point||t.point.eq(i.point))&&u1(t.activeForPoint(t.to),i.activeForPoint(i.to))||o.comparePoint(a,f,t.point,i.point):f>a&&!u1(t.active,i.active)&&o.compareRange(a,f,t.active,i.active),u>s)break;a=u,c<=0&&t.next(),c>=0&&i.next()}}function u1(t,e){if(t.length!=e.length)return!1;for(let i=0;i=e;r--)t[r+1]=t[r];t[e]=i}function VE(t,e){let i=-1,r=1e9;for(let n=0;n=e)return n;if(n==t.length)break;o+=t.charCodeAt(n)==9?i-o%i:1,n=Mt(t,n)}return r===!0?-1:t.length}var d1="\u037C",a5=typeof Symbol=="undefined"?"__"+d1:Symbol.for(d1),p1=typeof Symbol=="undefined"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),l5=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:{},zi=class{constructor(e,i){this.rules=[];let{finish:r}=i||{};function n(s){return/^@/.test(s)?[s]:s.split(/,\s*/)}function o(s,a,l,c){let u=[],f=/^@(\w+)\b/.exec(s[0]),d=f&&f[1]=="keyframes";if(f&&a==null)return l.push(s[0]+";");for(let p in a){let g=a[p];if(/&/.test(p))o(p.split(/,\s*/).map(x=>s.map(w=>x.replace(/&/,w))).reduce((x,w)=>x.concat(w)),g,l);else if(g&&typeof g=="object"){if(!f)throw new RangeError("The value of a property ("+p+") should be a primitive value.");o(n(p),g,u,d)}else g!=null&&u.push(p.replace(/_.*/,"").replace(/[A-Z]/g,x=>"-"+x.toLowerCase())+": "+g+";")}(u.length||d)&&l.push((r&&!f&&!c?s.map(r):s).join(", ")+" {"+u.join(" ")+"}")}for(let s in e)o(n(s),e[s],this.rules)}getRules(){return this.rules.join(` `)}static newName(){let e=l5[a5]||1;return l5[a5]=e+1,d1+e.toString(36)}static mount(e,i,r){let n=e[p1],o=r&&r.nonce;n?o&&n.setNonce(o):n=new O1(e,o),n.mount(Array.isArray(i)?i:[i])}},c5=new Map,O1=class{constructor(e,i){let r=e.ownerDocument||e,n=r.defaultView;if(!e.head&&e.adoptedStyleSheets&&n.CSSStyleSheet){let o=c5.get(r);if(o)return e.adoptedStyleSheets=[o.sheet,...e.adoptedStyleSheets],e[p1]=o;this.sheet=new n.CSSStyleSheet,e.adoptedStyleSheets=[this.sheet,...e.adoptedStyleSheets],c5.set(r,this)}else{this.styleTag=r.createElement("style"),i&&this.styleTag.setAttribute("nonce",i);let o=e.head||e;o.insertBefore(this.styleTag,o.firstChild)}this.modules=[],e[p1]=this}mount(e){let i=this.sheet,r=0,n=0;for(let o=0;o-1&&(this.modules.splice(a,1),n--,a=-1),a==-1){if(this.modules.splice(n++,0,s),i)for(let l=0;l",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},rq=typeof navigator!="undefined"&&/Mac/.test(navigator.platform),nq=typeof navigator!="undefined"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(Ut=0;Ut<10;Ut++)qn[48+Ut]=qn[96+Ut]=String(Ut);var Ut;for(Ut=1;Ut<=24;Ut++)qn[Ut+111]="F"+Ut;var Ut;for(Ut=65;Ut<=90;Ut++)qn[Ut]=String.fromCharCode(Ut+32),Ha[Ut]=String.fromCharCode(Ut);var Ut;for(Vd in qn)Ha.hasOwnProperty(Vd)||(Ha[Vd]=qn[Vd]);var Vd;function u5(t){var e=rq&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||nq&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",i=!e&&t.key||(t.shiftKey?Ha:qn)[t.keyCode]||t.key||"Unidentified";return i=="Esc"&&(i="Escape"),i=="Del"&&(i="Delete"),i=="Left"&&(i="ArrowLeft"),i=="Up"&&(i="ArrowUp"),i=="Right"&&(i="ArrowRight"),i=="Down"&&(i="ArrowDown"),i}function cp(t){let e;return t.nodeType==11?e=t.getSelection?t:t.ownerDocument:e=t,e.getSelection()}function k1(t,e){return e?t==e||t.contains(e.nodeType!=1?e.parentNode:e):!1}function oq(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function rp(t,e){if(!e.anchorNode)return!1;try{return k1(t,e.anchorNode)}catch(i){return!1}}function gu(t){return t.nodeType==3?As(t,0,t.nodeValue.length).getClientRects():t.nodeType==1?t.getClientRects():[]}function uu(t,e,i,r){return i?f5(t,e,i,r,-1)||f5(t,e,i,r,1):!1}function Qs(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e}function up(t){return t.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName)}function f5(t,e,i,r,n){for(;;){if(t==i&&e==r)return!0;if(e==(n<0?0:Wn(t))){if(t.nodeName=="DIV")return!1;let o=t.parentNode;if(!o||o.nodeType!=1)return!1;e=Qs(t)+(n<0?0:1),t=o}else if(t.nodeType==1){if(t=t.childNodes[e+(n<0?-1:0)],t.nodeType==1&&t.contentEditable=="false")return!1;e=n<0?Wn(t):0}else return!1}}function Wn(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function uy(t,e){let i=e?t.left:t.right;return{left:i,right:i,top:t.top,bottom:t.bottom}}function sq(t){let e=t.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.innerWidth,top:0,bottom:t.innerHeight}}function G5(t,e){let i=e.width/t.offsetWidth,r=e.height/t.offsetHeight;return(i>.995&&i<1.005||!isFinite(i)||Math.abs(e.width-t.offsetWidth)<1)&&(i=1),(r>.995&&r<1.005||!isFinite(r)||Math.abs(e.height-t.offsetHeight)<1)&&(r=1),{scaleX:i,scaleY:r}}function aq(t,e,i,r,n,o,s,a){let l=t.ownerDocument,c=l.defaultView||window;for(let u=t,f=!1;u&&!f;)if(u.nodeType==1){let d,p=u==l.body,g=1,x=1;if(p)d=sq(c);else{if(/^(fixed|sticky)$/.test(getComputedStyle(u).position)&&(f=!0),u.scrollHeight<=u.clientHeight&&u.scrollWidth<=u.clientWidth){u=u.assignedSlot||u.parentNode;continue}let T=u.getBoundingClientRect();({scaleX:g,scaleY:x}=G5(u,T)),d={left:T.left,right:T.left+u.clientWidth*g,top:T.top,bottom:T.top+u.clientHeight*x}}let w=0,S=0;if(n=="nearest")e.top0&&e.bottom>d.bottom+S&&(S=e.bottom-d.bottom+S+s)):e.bottom>d.bottom&&(S=e.bottom-d.bottom+s,i<0&&e.top-S0&&e.right>d.right+w&&(w=e.right-d.right+w+o)):e.right>d.right&&(w=e.right-d.right+o,i<0&&e.lefti.clientHeight||i.scrollWidth>i.clientWidth)return i;i=i.assignedSlot||i.parentNode}else if(i.nodeType==11)i=i.host;else break;return null}var S1=class{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:i,focusNode:r}=e;this.set(i,Math.min(e.anchorOffset,i?Wn(i):0),r,Math.min(e.focusOffset,r?Wn(r):0))}set(e,i,r,n){this.anchorNode=e,this.anchorOffset=i,this.focusNode=r,this.focusOffset=n}},Ga=null;function K5(t){if(t.setActive)return t.setActive();if(Ga)return t.focus(Ga);let e=[];for(let i=t;i&&(e.push(i,i.scrollTop,i.scrollLeft),i!=i.ownerDocument);i=i.parentNode);if(t.focus(Ga==null?{get preventScroll(){return Ga={preventScroll:!0},!0}}:void 0),!Ga){Ga=!1;for(let i=0;iMath.max(1,t.scrollHeight-t.clientHeight-4)}function tC(t,e){for(let i=t,r=e;;){if(i.nodeType==3&&r>0)return{node:i,offset:r};if(i.nodeType==1&&r>0){if(i.contentEditable=="false")return null;i=i.childNodes[r-1],r=Wn(i)}else if(i.parentNode&&!up(i))r=Qs(i),i=i.parentNode;else return null}}function iC(t,e){for(let i=t,r=e;;){if(i.nodeType==3&&ri)return f.domBoundsAround(e,i,c);if(d>=e&&n==-1&&(n=l,o=c),c>i&&f.dom.parentNode==this.dom){s=l,a=u;break}u=d,c=d+f.breakAfter}return{from:o,to:a<0?r+this.length:a,startDOM:(n?this.children[n-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:s=0?this.children[s].dom:null}}markDirty(e=!1){this.flags|=2,this.markParentsDirty(e)}markParentsDirty(e){for(let i=this.parent;i;i=i.parent){if(e&&(i.flags|=2),i.flags&1)return;i.flags|=1,e=!1}}setParent(e){this.parent!=e&&(this.parent=e,this.flags&7&&this.markParentsDirty(!0))}setDOM(e){this.dom!=e&&(this.dom&&(this.dom.cmView=null),this.dom=e,e.cmView=this)}get rootView(){for(let e=this;;){let i=e.parent;if(!i)return e;e=i}}replaceChildren(e,i,r=fy){this.markDirty();for(let n=e;nthis.pos||e==this.pos&&(i>0||this.i==0||this.children[this.i-1].breakAfter))return this.off=e-this.pos,this;let r=this.children[--this.i];this.pos-=r.length+r.breakAfter}}};function rC(t,e,i,r,n,o,s,a,l){let{children:c}=t,u=c.length?c[e]:null,f=o.length?o[o.length-1]:null,d=f?f.breakAfter:s;if(!(e==r&&u&&!s&&!d&&o.length<2&&u.merge(i,n,o.length?f:null,i==0,a,l))){if(r0&&(!s&&o.length&&u.merge(i,u.length,o[0],!1,a,0)?u.breakAfter=o.shift().breakAfter:(i2),Te={mac:m5||/Mac/.test(Ji.platform),windows:/Win/.test(Ji.platform),linux:/Linux|X11/.test(Ji.platform),ie:Sp,ie_version:oC?T1.documentMode||6:C1?+C1[1]:E1?+E1[1]:0,gecko:p5,gecko_version:p5?+(/Firefox\/(\d+)/.exec(Ji.userAgent)||[0,0])[1]:0,chrome:!!m1,chrome_version:m1?+m1[1]:0,ios:m5,android:/Android\b/.test(Ji.userAgent),webkit:O5,safari:sC,webkit_version:O5?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0,tabSize:T1.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"},fq=256,an=class t extends gt{constructor(e){super(),this.text=e}get length(){return this.text.length}createDOM(e){this.setDOM(e||document.createTextNode(this.text))}sync(e,i){this.dom||this.createDOM(),this.dom.nodeValue!=this.text&&(i&&i.node==this.dom&&(i.written=!0),this.dom.nodeValue=this.text)}reuseDOM(e){e.nodeType==3&&this.createDOM(e)}merge(e,i,r){return this.flags&8||r&&(!(r instanceof t)||this.length-(i-e)+r.length>fq||r.flags&8)?!1:(this.text=this.text.slice(0,e)+(r?r.text:"")+this.text.slice(i),this.markDirty(),!0)}split(e){let i=new t(this.text.slice(e));return this.text=this.text.slice(0,e),this.markDirty(),i.flags|=this.flags&8,i}localPosFromDOM(e,i){return e==this.dom?i:i?this.text.length:0}domAtPos(e){return new $i(this.dom,e)}domBoundsAround(e,i,r){return{from:r,to:r+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}coordsAt(e,i){return hq(this.dom,e,i)}},Lo=class t extends gt{constructor(e,i=[],r=0){super(),this.mark=e,this.children=i,this.length=r;for(let n of i)n.setParent(this)}setAttrs(e){if(J5(e),this.mark.class&&(e.className=this.mark.class),this.mark.attrs)for(let i in this.mark.attrs)e.setAttribute(i,this.mark.attrs[i]);return e}canReuseDOM(e){return super.canReuseDOM(e)&&!((this.flags|e.flags)&8)}reuseDOM(e){e.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(e),this.flags|=6)}sync(e,i){this.dom?this.flags&4&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),super.sync(e,i)}merge(e,i,r,n,o,s){return r&&(!(r instanceof t&&r.mark.eq(this.mark))||e&&o<=0||ie&&i.push(r=e&&(n=o),r=l,o++}let s=this.length-e;return this.length=e,n>-1&&(this.children.length=n,this.markDirty()),new t(this.mark,i,s)}domAtPos(e){return aC(this,e)}coordsAt(e,i){return cC(this,e,i)}};function hq(t,e,i){let r=t.nodeValue.length;e>r&&(e=r);let n=e,o=e,s=0;e==0&&i<0||e==r&&i>=0?Te.chrome||Te.gecko||(e?(n--,s=1):o=0)?0:a.length-1];return Te.safari&&!s&&l.width==0&&(l=Array.prototype.find.call(a,c=>c.width)||l),s?uy(l,s<0):l||null}var bu=class t extends gt{static create(e,i,r){return new t(e,i,r)}constructor(e,i,r){super(),this.widget=e,this.length=i,this.side=r,this.prevWidget=null}split(e){let i=t.create(this.widget,this.length-e,this.side);return this.length-=e,i}sync(e){(!this.dom||!this.widget.updateDOM(this.dom,e))&&(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(e)),this.widget.editable||(this.dom.contentEditable="false"))}getSide(){return this.side}merge(e,i,r,n,o,s){return r&&(!(r instanceof t)||!this.widget.compare(r.widget)||e>0&&o<=0||i0)?$i.before(this.dom):$i.after(this.dom,e==this.length)}domBoundsAround(){return null}coordsAt(e,i){let r=this.widget.coordsAt(this.dom,e,i);if(r)return r;let n=this.dom.getClientRects(),o=null;if(!n.length)return null;let s=this.side?this.side<0:e>0;for(let a=s?n.length-1:0;o=n[a],!(e>0?a==0:a==n.length-1||o.top0?$i.before(this.dom):$i.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(e){return this.dom.getBoundingClientRect()}get overrideDOMText(){return He.empty}get isHidden(){return!0}};an.prototype.children=bu.prototype.children=yu.prototype.children=fy;function aC(t,e){let i=t.dom,{children:r}=t,n=0;for(let o=0;no&&e0;o--){let s=r[o-1];if(s.dom.parentNode==i)return s.domAtPos(s.length)}for(let o=n;o0&&e instanceof Lo&&n.length&&(r=n[n.length-1])instanceof Lo&&r.mark.eq(e.mark)?lC(r,e.children[0],i-1):(n.push(e),e.setParent(t)),t.length+=e.length}function cC(t,e,i){let r=null,n=-1,o=null,s=-1;function a(c,u){for(let f=0,d=0;f=u&&(p.children.length?a(p,u-d):(!o||o.isHidden&&i>0)&&(g>u||d==g&&p.getSide()>0)?(o=p,s=u-d):(d-1?1:0)!=n.length-(i&&n.indexOf(i)>-1?1:0))return!1;for(let o of r)if(o!=i&&(n.indexOf(o)==-1||t[o]!==e[o]))return!1;return!0}function P1(t,e,i){let r=!1;if(e)for(let n in e)i&&n in i||(r=!0,n=="style"?t.style.cssText="":t.removeAttribute(n));if(i)for(let n in i)e&&e[n]==i[n]||(r=!0,n=="style"?t.style.cssText=i[n]:t.setAttribute(n,i[n]));return r}function pq(t){let e=Object.create(null);for(let i=0;i0&&this.children[r-1].length==0;)this.children[--r].destroy();return this.children.length=r,this.markDirty(),this.length=e,i}transferDOM(e){this.dom&&(this.markDirty(),e.setDOM(this.dom),e.prevAttrs=this.prevAttrs===void 0?this.attrs:this.prevAttrs,this.prevAttrs=void 0,this.dom=null)}setDeco(e){hy(this.attrs,e)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=e)}append(e,i){lC(this,e,i)}addLineDeco(e){let i=e.spec.attributes,r=e.spec.class;i&&(this.attrs=_1(i,this.attrs||{})),r&&(this.attrs=_1({class:r},this.attrs||{}))}domAtPos(e){return aC(this,e)}reuseDOM(e){e.nodeName=="DIV"&&(this.setDOM(e),this.flags|=6)}sync(e,i){var r;this.dom?this.flags&4&&(J5(this.dom),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0):(this.setDOM(document.createElement("div")),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0),this.prevAttrs!==void 0&&(P1(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),super.sync(e,i);let n=this.dom.lastChild;for(;n&>.get(n)instanceof Lo;)n=n.lastChild;if(!n||!this.length||n.nodeName!="BR"&&((r=gt.get(n))===null||r===void 0?void 0:r.isEditable)==!1&&(!Te.ios||!this.children.some(o=>o instanceof an))){let o=document.createElement("BR");o.cmIgnore=!0,this.dom.appendChild(o)}}measureTextSize(){if(this.children.length==0||this.length>20)return null;let e=0,i;for(let r of this.children){if(!(r instanceof an)||/[^ -~]/.test(r.text))return null;let n=gu(r.dom);if(n.length!=1)return null;e+=n[0].width,i=n[0].height}return e?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:e/this.length,textHeight:i}:null}coordsAt(e,i){let r=cC(this,e,i);if(!this.children.length&&r&&this.parent){let{heightOracle:n}=this.parent.view.viewState,o=r.bottom-r.top;if(Math.abs(o-n.lineHeight)<2&&n.textHeight=i){if(o instanceof t)return o;if(s>i)break}n=s+o.breakAfter}return null}},il=class t extends gt{constructor(e,i,r){super(),this.widget=e,this.length=i,this.deco=r,this.breakAfter=0,this.prevWidget=null}merge(e,i,r,n,o,s){return r&&(!(r instanceof t)||!this.widget.compare(r.widget)||e>0&&o<=0||i0}},Ft=class{eq(e){return!1}updateDOM(e,i){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(e){return!0}coordsAt(e,i,r){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}},Xi=function(t){return t[t.Text=0]="Text",t[t.WidgetBefore=1]="WidgetBefore",t[t.WidgetAfter=2]="WidgetAfter",t[t.WidgetRange=3]="WidgetRange",t}(Xi||(Xi={})),we=class extends Lr{constructor(e,i,r,n){super(),this.startSide=e,this.endSide=i,this.widget=r,this.spec=n}get heightRelevant(){return!1}static mark(e){return new xu(e)}static widget(e){let i=Math.max(-1e4,Math.min(1e4,e.side||0)),r=!!e.block;return i+=r&&!e.inlineOrder?i>0?3e8:-4e8:i>0?1e8:-1e8,new Do(e,i,i,r,e.widget||null,!1)}static replace(e){let i=!!e.block,r,n;if(e.isBlockGap)r=-5e8,n=4e8;else{let{start:o,end:s}=uC(e,i);r=(o?i?-3e8:-1:5e8)-1,n=(s?i?2e8:1:-6e8)+1}return new Do(e,r,n,i,e.widget||null,!0)}static line(e){return new vu(e)}static set(e,i=!1){return nt.of(e,i)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}};we.none=nt.empty;var xu=class t extends we{constructor(e){let{start:i,end:r}=uC(e);super(i?-1:5e8,r?1:-6e8,null,e),this.tagName=e.tagName||"span",this.class=e.class||"",this.attrs=e.attributes||null}eq(e){var i,r;return this==e||e instanceof t&&this.tagName==e.tagName&&(this.class||((i=this.attrs)===null||i===void 0?void 0:i.class))==(e.class||((r=e.attrs)===null||r===void 0?void 0:r.class))&&hy(this.attrs,e.attrs,"class")}range(e,i=e){if(e>=i)throw new RangeError("Mark decorations may not be empty");return super.range(e,i)}};xu.prototype.point=!1;var vu=class t extends we{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof t&&this.spec.class==e.spec.class&&hy(this.spec.attributes,e.spec.attributes)}range(e,i=e){if(i!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,i)}};vu.prototype.mapMode=vt.TrackBefore;vu.prototype.point=!0;var Do=class t extends we{constructor(e,i,r,n,o,s){super(i,r,o,e),this.block=n,this.isReplace=s,this.mapMode=n?i<=0?vt.TrackBefore:vt.TrackAfter:vt.TrackDel}get type(){return this.startSide!=this.endSide?Xi.WidgetRange:this.startSide<=0?Xi.WidgetBefore:Xi.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof t&&Oq(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,i=e){if(this.isReplace&&(e>i||e==i&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&i!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,i)}};Do.prototype.point=!0;function uC(t,e=!1){let{inclusiveStart:i,inclusiveEnd:r}=t;return i==null&&(i=t.inclusive),r==null&&(r=t.inclusive),{start:i!=null?i:e,end:r!=null?r:e}}function Oq(t,e){return t==e||!!(t&&e&&t.compare(e))}function Q1(t,e,i,r=0){let n=i.length-1;n>=0&&i[n]+r>=t?i[n]=Math.max(i[n],e):i.push(t,e)}var fu=class t{constructor(e,i,r,n){this.doc=e,this.pos=i,this.end=r,this.disallowBlockEffectsFor=n,this.content=[],this.curLine=null,this.breakAtStart=0,this.pendingBuffer=0,this.bufferMarks=[],this.atCursorPos=!0,this.openStart=-1,this.openEnd=-1,this.text="",this.textOff=0,this.cursor=e.iter(),this.skip=i}posCovered(){if(this.content.length==0)return!this.breakAtStart&&this.doc.lineAt(this.pos).from!=this.pos;let e=this.content[this.content.length-1];return!(e.breakAfter||e instanceof il&&e.deco.endSide<0)}getLine(){return this.curLine||(this.content.push(this.curLine=new ni),this.atCursorPos=!0),this.curLine}flushBuffer(e=this.bufferMarks){this.pendingBuffer&&(this.curLine.append(Yd(new yu(-1),e),e.length),this.pendingBuffer=0)}addBlockWidget(e){this.flushBuffer(),this.curLine=null,this.content.push(e)}finish(e){this.pendingBuffer&&e<=this.bufferMarks.length?this.flushBuffer():this.pendingBuffer=0,!this.posCovered()&&!(e&&this.content.length&&this.content[this.content.length-1]instanceof il)&&this.getLine()}buildText(e,i,r){for(;e>0;){if(this.textOff==this.text.length){let{value:o,lineBreak:s,done:a}=this.cursor.next(this.skip);if(this.skip=0,a)throw new Error("Ran out of text content when drawing inline views");if(s){this.posCovered()||this.getLine(),this.content.length?this.content[this.content.length-1].breakAfter=1:this.breakAtStart=1,this.flushBuffer(),this.curLine=null,this.atCursorPos=!0,e--;continue}else this.text=o,this.textOff=0}let n=Math.min(this.text.length-this.textOff,e,512);this.flushBuffer(i.slice(i.length-r)),this.getLine().append(Yd(new an(this.text.slice(this.textOff,this.textOff+n)),i),r),this.atCursorPos=!0,this.textOff+=n,e-=n,r=0}}span(e,i,r,n){this.buildText(i-e,r,n),this.pos=i,this.openStart<0&&(this.openStart=n)}point(e,i,r,n,o,s){if(this.disallowBlockEffectsFor[s]&&r instanceof Do){if(r.block)throw new RangeError("Block decorations may not be specified via plugins");if(i>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}let a=i-e;if(r instanceof Do)if(r.block)r.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new il(r.widget||No.block,a,r));else{let l=bu.create(r.widget||No.inline,a,a?0:r.startSide),c=this.atCursorPos&&!l.isEditable&&o<=n.length&&(e0),u=!l.isEditable&&(en.length||r.startSide<=0),f=this.getLine();this.pendingBuffer==2&&!c&&!l.isEditable&&(this.pendingBuffer=0),this.flushBuffer(n),c&&(f.append(Yd(new yu(1),n),o),o=n.length+Math.max(0,o-n.length)),f.append(Yd(l,n),o),this.atCursorPos=u,this.pendingBuffer=u?en.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=n.slice())}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(r);a&&(this.textOff+a<=this.text.length?this.textOff+=a:(this.skip+=a-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=i),this.openStart<0&&(this.openStart=o)}static build(e,i,r,n,o){let s=new t(e,i,r,o);return s.openEnd=nt.spans(n,i,r,s),s.openStart<0&&(s.openStart=s.openEnd),s.finish(s.openEnd),s}};function Yd(t,e){for(let i of e)t=new Lo(i,[t],t.length);return t}var No=class extends Ft{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}};No.inline=new No("span");No.block=new No("div");var ot=function(t){return t[t.LTR=0]="LTR",t[t.RTL=1]="RTL",t}(ot||(ot={})),$s=ot.LTR,dy=ot.RTL;function fC(t){let e=[];for(let i=0;i=i){if(a.level==r)return s;(o<0||(n!=0?n<0?a.fromi:e[o].level>a.level))&&(o=s)}}if(o<0)throw new RangeError("Index out of range");return o}};function dC(t,e){if(t.length!=e.length)return!1;for(let i=0;i=0;x-=3)if(rn[x+1]==-p){let w=rn[x+2],S=w&2?n:w&4?w&1?o:n:0;S&&(pt[f]=pt[rn[x]]=S),a=x;break}}else{if(rn.length==189)break;rn[a++]=f,rn[a++]=d,rn[a++]=l}else if((g=pt[f])==2||g==1){let x=g==n;l=x?0:1;for(let w=a-3;w>=0;w-=3){let S=rn[w+2];if(S&2)break;if(x)rn[w+2]|=2;else{if(S&4)break;rn[w+2]|=4}}}}}function vq(t,e,i,r){for(let n=0,o=r;n<=i.length;n++){let s=n?i[n-1].to:t,a=nl;)g==w&&(g=i[--x].from,w=x?i[x-1].to:t),pt[--g]=p;l=u}else o=c,l++}}}function $1(t,e,i,r,n,o,s){let a=r%2?2:1;if(r%2==n%2)for(let l=e,c=0;ll&&s.push(new on(l,x.from,p));let w=x.direction==$s!=!(p%2);X1(t,w?r+1:r,n,x.inner,x.from,x.to,s),l=x.to}g=x.to}else{if(g==i||(u?pt[g]!=a:pt[g]==a))break;g++}d?$1(t,l,g,r+1,n,d,s):le;){let u=!0,f=!1;if(!c||l>o[c-1].to){let x=pt[l-1];x!=a&&(u=!1,f=x==16)}let d=!u&&a==1?[]:null,p=u?r:r+1,g=l;e:for(;;)if(c&&g==o[c-1].to){if(f)break e;let x=o[--c];if(!u)for(let w=x.from,S=c;;){if(w==e)break e;if(S&&o[S-1].to==w)w=o[--S].from;else{if(pt[w-1]==a)break e;break}}if(d)d.push(x);else{x.topt.length;)pt[pt.length]=256;let r=[],n=e==$s?0:1;return X1(t,n,n,i,0,t.length,r),r}function pC(t){return[new on(0,t,0)]}var OC="";function kq(t,e,i,r,n){var o;let s=r.head-t.from,a=on.find(e,s,(o=r.bidiLevel)!==null&&o!==void 0?o:-1,r.assoc),l=e[a],c=l.side(n,i);if(s==c){let d=a+=n?1:-1;if(d<0||d>=e.length)return null;l=e[a=d],s=l.side(!n,i),c=l.side(n,i)}let u=Mt(t.text,s,l.forward(n,i));(ul.to)&&(u=c),OC=t.text.slice(Math.min(s,u),Math.max(s,u));let f=a==(n?e.length-1:0)?null:e[a+(n?1:-1)];return f&&u==c&&f.level+(n?0:1)t.some(e=>e)}),kC=be.define({combine:t=>t.some(e=>e)}),SC=be.define(),hu=class t{constructor(e,i="nearest",r="nearest",n=5,o=5,s=!1){this.range=e,this.y=i,this.x=r,this.yMargin=n,this.xMargin=o,this.isSnapshot=s}map(e){return e.empty?this:new t(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(e){return this.range.to<=e.doc.length?this:new t(J.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}},Fd=Se.define({map:(t,e)=>t.map(e)});function oi(t,e,i){let r=t.facet(yC);r.length?r[0](e):window.onerror?window.onerror(String(e),i,void 0,void 0,e):i?console.error(i+":",e):console.error(e)}var Tp=be.define({combine:t=>t.length?t[0]:!0}),Tq=0,ou=be.define(),Ye=class t{constructor(e,i,r,n,o){this.id=e,this.create=i,this.domEventHandlers=r,this.domEventObservers=n,this.extension=o(this)}static define(e,i){let{eventHandlers:r,eventObservers:n,provide:o,decorations:s}=i||{};return new t(Tq++,e,r,n,a=>{let l=[ou.of(a)];return s&&l.push(wu.of(c=>{let u=c.plugin(a);return u?s(u):we.none})),o&&l.push(o(a)),l})}static fromClass(e,i){return t.define(r=>new e(r),i)}},du=class{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}update(e){if(this.value){if(this.mustUpdate){let i=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(i)}catch(r){if(oi(i.state,r,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch(n){}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.create(e)}catch(i){oi(e.state,i,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var i;if(!((i=this.value)===null||i===void 0)&&i.destroy)try{this.value.destroy()}catch(r){oi(e.state,r,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}},TC=be.define(),py=be.define(),wu=be.define(),EC=be.define(),Oy=be.define(),CC=be.define();function b5(t,e){let i=t.state.facet(CC);if(!i.length)return i;let r=i.map(o=>o instanceof Function?o(t):o),n=[];return nt.spans(r,e.from,e.to,{point(){},span(o,s,a,l){let c=o-e.from,u=s-e.from,f=n;for(let d=a.length-1;d>=0;d--,l--){let p=a[d].spec.bidiIsolate,g;if(p==null&&(p=Sq(e.text,c,u)),l>0&&f.length&&(g=f[f.length-1]).to==c&&g.direction==p)g.to=u,f=g.inner;else{let x={from:c,to:u,direction:p,inner:[]};f.push(x),f=x.inner}}}}),n}var _C=be.define();function PC(t){let e=0,i=0,r=0,n=0;for(let o of t.state.facet(_C)){let s=o(t);s&&(s.left!=null&&(e=Math.max(e,s.left)),s.right!=null&&(i=Math.max(i,s.right)),s.top!=null&&(r=Math.max(r,s.top)),s.bottom!=null&&(n=Math.max(n,s.bottom)))}return{left:e,right:i,top:r,bottom:n}}var su=be.define(),sn=class t{constructor(e,i,r,n){this.fromA=e,this.toA=i,this.fromB=r,this.toB=n}join(e){return new t(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let i=e.length,r=this;for(;i>0;i--){let n=e[i-1];if(!(n.fromA>r.toA)){if(n.toAu)break;o+=2}if(!l)return r;new t(l.fromA,l.toA,l.fromB,l.toB).addToSet(r),s=l.toA,a=l.toB}}},hp=class t{constructor(e,i,r){this.view=e,this.state=i,this.transactions=r,this.flags=0,this.startState=e.state,this.changes=Qi.empty(this.startState.doc.length);for(let o of r)this.changes=this.changes.compose(o.changes);let n=[];this.changes.iterChangedRanges((o,s,a,l)=>n.push(new sn(o,s,a,l))),this.changedRanges=n}static create(e,i,r){return new t(e,i,r)}get viewportChanged(){return(this.flags&4)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&10)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return this.flags==0&&this.transactions.length==0}},dp=class extends gt{get length(){return this.view.state.doc.length}constructor(e){super(),this.view=e,this.decorations=[],this.dynamicDecorationMap=[],this.domChanged=null,this.hasComposition=null,this.markedForComposition=new Set,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.setDOM(e.contentDOM),this.children=[new ni],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new sn(0,0,0,e.state.doc.length)],0,null)}update(e){var i;let r=e.changedRanges;this.minWidth>0&&r.length&&(r.every(({fromA:c,toA:u})=>uthis.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0);let n=-1;this.view.inputState.composing>=0&&(!((i=this.domChanged)===null||i===void 0)&&i.newSel?n=this.domChanged.newSel.head:!$q(e.changes,this.hasComposition)&&!e.selectionSet&&(n=e.state.selection.main.head));let o=n>-1?Cq(this.view,e.changes,n):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();let{from:c,to:u}=this.hasComposition;r=new sn(c,u,e.changes.mapPos(c,-1),e.changes.mapPos(u,1)).addToSet(r.slice())}this.hasComposition=o?{from:o.range.fromB,to:o.range.toB}:null,(Te.ie||Te.chrome)&&!o&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let s=this.decorations,a=this.updateDeco(),l=Qq(s,a,e.changes);return r=sn.extendWithRanges(r,l),!(this.flags&7)&&r.length==0?!1:(this.updateInner(r,e.startState.doc.length,o),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,i,r){this.view.viewState.mustMeasureContent=!0,this.updateChildren(e,i,r);let{observer:n}=this.view;n.ignore(()=>{this.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let s=Te.chrome||Te.ios?{node:n.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,s),this.flags&=-8,s&&(s.written||n.selectionRange.focusNode!=s.node)&&(this.forceSelection=!0),this.dom.style.height=""}),this.markedForComposition.forEach(s=>s.flags&=-9);let o=[];if(this.view.viewport.from||this.view.viewport.to=0?n[s]:null;if(!a)break;let{fromA:l,toA:c,fromB:u,toB:f}=a,d,p,g,x;if(r&&r.range.fromBu){let I=fu.build(this.view.state.doc,u,r.range.fromB,this.decorations,this.dynamicDecorationMap),D=fu.build(this.view.state.doc,r.range.toB,f,this.decorations,this.dynamicDecorationMap);p=I.breakAtStart,g=I.openStart,x=D.openEnd;let C=this.compositionView(r);D.breakAtStart?C.breakAfter=1:D.content.length&&C.merge(C.length,C.length,D.content[0],!1,D.openStart,0)&&(C.breakAfter=D.content[0].breakAfter,D.content.shift()),I.content.length&&C.merge(0,0,I.content[I.content.length-1],!0,0,I.openEnd)&&I.content.pop(),d=I.content.concat(C).concat(D.content)}else({content:d,breakAtStart:p,openStart:g,openEnd:x}=fu.build(this.view.state.doc,u,f,this.decorations,this.dynamicDecorationMap));let{i:w,off:S}=o.findPos(c,1),{i:T,off:A}=o.findPos(l,-1);rC(this,T,A,w,S,d,p,g,x)}r&&this.fixCompositionDOM(r)}compositionView(e){let i=new an(e.text.nodeValue);i.flags|=8;for(let{deco:n}of e.marks)i=new Lo(n,[i],i.length);let r=new ni;return r.append(i,0),r}fixCompositionDOM(e){let i=(o,s)=>{s.flags|=8|(s.children.some(l=>l.flags&7)?1:0),this.markedForComposition.add(s);let a=gt.get(o);a&&a!=s&&(a.dom=null),s.setDOM(o)},r=this.childPos(e.range.fromB,1),n=this.children[r.i];i(e.line,n);for(let o=e.marks.length-1;o>=-1;o--)r=n.childPos(r.off,1),n=n.children[r.i],i(o>=0?e.marks[o].node:e.text,n)}updateSelection(e=!1,i=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let r=this.view.root.activeElement,n=r==this.dom,o=!n&&rp(this.dom,this.view.observer.selectionRange)&&!(r&&this.dom.contains(r));if(!(n||i||o))return;let s=this.forceSelection;this.forceSelection=!1;let a=this.view.state.selection.main,l=this.moveToLine(this.domAtPos(a.anchor)),c=a.empty?l:this.moveToLine(this.domAtPos(a.head));if(Te.gecko&&a.empty&&!this.hasComposition&&Eq(l)){let f=document.createTextNode("");this.view.observer.ignore(()=>l.node.insertBefore(f,l.node.childNodes[l.offset]||null)),l=c=new $i(f,0),s=!0}let u=this.view.observer.selectionRange;(s||!u.focusNode||(!uu(l.node,l.offset,u.anchorNode,u.anchorOffset)||!uu(c.node,c.offset,u.focusNode,u.focusOffset))&&!this.suppressWidgetCursorChange(u,a))&&(this.view.observer.ignore(()=>{Te.android&&Te.chrome&&this.dom.contains(u.focusNode)&&Aq(u.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let f=cp(this.view.root);if(f)if(a.empty){if(Te.gecko){let d=_q(l.node,l.offset);if(d&&d!=3){let p=(d==1?tC:iC)(l.node,l.offset);p&&(l=new $i(p.node,p.offset))}}f.collapse(l.node,l.offset),a.bidiLevel!=null&&f.caretBidiLevel!==void 0&&(f.caretBidiLevel=a.bidiLevel)}else if(f.extend){f.collapse(l.node,l.offset);try{f.extend(c.node,c.offset)}catch(d){}}else{let d=document.createRange();a.anchor>a.head&&([l,c]=[c,l]),d.setEnd(c.node,c.offset),d.setStart(l.node,l.offset),f.removeAllRanges(),f.addRange(d)}o&&this.view.root.activeElement==this.dom&&(this.dom.blur(),r&&r.focus())}),this.view.observer.setSelectionRange(l,c)),this.impreciseAnchor=l.precise?null:new $i(u.anchorNode,u.anchorOffset),this.impreciseHead=c.precise?null:new $i(u.focusNode,u.focusOffset)}suppressWidgetCursorChange(e,i){return this.hasComposition&&i.empty&&uu(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==i.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,i=e.state.selection.main,r=cp(e.root),{anchorNode:n,anchorOffset:o}=e.observer.selectionRange;if(!r||!i.empty||!i.assoc||!r.modify)return;let s=ni.find(this,i.head);if(!s)return;let a=s.posAtStart;if(i.head==a||i.head==a+s.length)return;let l=this.coordsAt(i.head,-1),c=this.coordsAt(i.head,1);if(!l||!c||l.bottom>c.top)return;let u=this.domAtPos(i.head+i.assoc);r.collapse(u.node,u.offset),r.modify("move",i.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let f=e.observer.selectionRange;e.docView.posFromDOM(f.anchorNode,f.anchorOffset)!=i.from&&r.collapse(n,o)}moveToLine(e){let i=this.dom,r;if(e.node!=i)return e;for(let n=e.offset;!r&&n=0;n--){let o=gt.get(i.childNodes[n]);o instanceof ni&&(r=o.domAtPos(o.length))}return r?new $i(r.node,r.offset,!0):e}nearest(e){for(let i=e;i;){let r=gt.get(i);if(r&&r.rootView==this)return r;i=i.parentNode}return null}posFromDOM(e,i){let r=this.nearest(e);if(!r)throw new RangeError("Trying to find position for a DOM position outside of the document");return r.localPosFromDOM(e,i)+r.posAtStart}domAtPos(e){let{i,off:r}=this.childCursor().findPos(e,-1);for(;i=0;s--){let a=this.children[s],l=o-a.breakAfter,c=l-a.length;if(le||a.covers(1))&&(!r||a instanceof ni&&!(r instanceof ni&&i>=0))&&(r=a,n=c),o=c}return r?r.coordsAt(e-n,i):null}coordsForChar(e){let{i,off:r}=this.childPos(e,1),n=this.children[i];if(!(n instanceof ni))return null;for(;n.children.length;){let{i:a,off:l}=n.childPos(r,1);for(;;a++){if(a==n.children.length)return null;if((n=n.children[a]).length)break}r=l}if(!(n instanceof an))return null;let o=Mt(n.text,r);if(o==r)return null;let s=As(n.dom,r,o).getClientRects();for(let a=0;aMath.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,a=-1,l=this.view.textDirection==ot.LTR;for(let c=0,u=0;un)break;if(c>=r){let p=f.dom.getBoundingClientRect();if(i.push(p.height),s){let g=f.dom.lastChild,x=g?gu(g):[];if(x.length){let w=x[x.length-1],S=l?w.right-p.left:p.right-w.left;S>a&&(a=S,this.minWidth=o,this.minWidthFrom=c,this.minWidthTo=d)}}}c=d+f.breakAfter}return i}textDirectionAt(e){let{i}=this.childPos(e,1);return getComputedStyle(this.children[i].dom).direction=="rtl"?ot.RTL:ot.LTR}measureTextSize(){for(let o of this.children)if(o instanceof ni){let s=o.measureTextSize();if(s)return s}let e=document.createElement("div"),i,r,n;return e.className="cm-line",e.style.width="99999px",e.style.position="absolute",e.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.dom.appendChild(e);let o=gu(e.firstChild)[0];i=e.getBoundingClientRect().height,r=o?o.width/27:7,n=o?o.height:i,e.remove()}),{lineHeight:i,charWidth:r,textHeight:n}}childCursor(e=this.length){let i=this.children.length;return i&&(e-=this.children[--i].length),new fp(this.children,e,i)}computeBlockGapDeco(){let e=[],i=this.view.viewState;for(let r=0,n=0;;n++){let o=n==i.viewports.length?null:i.viewports[n],s=o?o.from-1:this.length;if(s>r){let a=(i.lineBlockAt(s).bottom-i.lineBlockAt(r).top)/this.view.scaleY;e.push(we.replace({widget:new pp(a),block:!0,inclusive:!0,isBlockGap:!0}).range(r,s))}if(!o)break;r=o.to+1}return we.set(e)}updateDeco(){let e=0,i=this.view.state.facet(wu).map(o=>(this.dynamicDecorationMap[e++]=typeof o=="function")?o(this.view):o),r=!1,n=this.view.state.facet(EC).map((o,s)=>{let a=typeof o=="function";return a&&(r=!0),a?o(this.view):o});for(n.length&&(this.dynamicDecorationMap[e++]=r,i.push(nt.join(n))),this.decorations=[...i,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];ei.anchor?-1:1),n;if(!r)return;!i.empty&&(n=this.coordsAt(i.anchor,i.anchor>i.head?-1:1))&&(r={left:Math.min(r.left,n.left),top:Math.min(r.top,n.top),right:Math.max(r.right,n.right),bottom:Math.max(r.bottom,n.bottom)});let o=PC(this.view),s={left:r.left-o.left,top:r.top-o.top,right:r.right+o.right,bottom:r.bottom+o.bottom},{offsetWidth:a,offsetHeight:l}=this.view.scrollDOM;aq(this.view.scrollDOM,s,i.head{re.from&&(i=!0)}),i}function Xq(t,e,i=1){let r=t.charCategorizer(e),n=t.doc.lineAt(e),o=e-n.from;if(n.length==0)return J.cursor(e);o==0?i=1:o==n.length&&(i=-1);let s=o,a=o;i<0?s=Mt(n.text,o,!1):a=Mt(n.text,o);let l=r(n.text.slice(s,a));for(;s>0;){let c=Mt(n.text,s,!1);if(r(n.text.slice(c,s))!=l)break;s=c}for(;at?e.left-t:Math.max(0,t-e.right)}function Iq(t,e){return e.top>t?e.top-t:Math.max(0,t-e.bottom)}function g1(t,e){return t.tope.top+1}function y5(t,e){return et.bottom?{top:t.top,left:t.left,right:t.right,bottom:e}:t}function I1(t,e,i){let r,n,o,s,a=!1,l,c,u,f;for(let g=t.firstChild;g;g=g.nextSibling){let x=gu(g);for(let w=0;wA||s==A&&o>T){r=g,n=S,o=T,s=A;let I=A?i0?w0)}T==0?i>S.bottom&&(!u||u.bottomS.top)&&(c=g,f=S):u&&g1(u,S)?u=x5(u,S.bottom):f&&g1(f,S)&&(f=y5(f,S.top))}}if(u&&u.bottom>=i?(r=l,n=u):f&&f.top<=i&&(r=c,n=f),!r)return{node:t,offset:0};let d=Math.max(n.left,Math.min(n.right,e));if(r.nodeType==3)return v5(r,d,i);if(a&&r.contentEditable!="false")return I1(r,d,i);let p=Array.prototype.indexOf.call(t.childNodes,r)+(e>=(n.left+n.right)/2?1:0);return{node:t,offset:p}}function v5(t,e,i){let r=t.nodeValue.length,n=-1,o=1e9,s=0;for(let a=0;ai?u.top-i:i-u.bottom)-1;if(u.left-1<=e&&u.right+1>=e&&f=(u.left+u.right)/2,p=d;if((Te.chrome||Te.gecko)&&As(t,a).getBoundingClientRect().left==u.right&&(p=!d),f<=0)return{node:t,offset:a+(p?1:0)};n=a+(p?1:0),o=f}}}return{node:t,offset:n>-1?n:s>0?t.nodeValue.length:0}}function AC(t,e,i,r=-1){var n,o;let s=t.contentDOM.getBoundingClientRect(),a=s.top+t.viewState.paddingTop,l,{docHeight:c}=t.viewState,{x:u,y:f}=e,d=f-a;if(d<0)return 0;if(d>c)return t.state.doc.length;for(let I=t.viewState.heightOracle.textHeight/2,D=!1;l=t.elementAtHeight(d),l.type!=Xi.Text;)for(;d=r>0?l.bottom+I:l.top-I,!(d>=0&&d<=c);){if(D)return i?null:0;D=!0,r=-r}f=a+d;let p=l.from;if(pt.viewport.to)return t.viewport.to==t.state.doc.length?t.state.doc.length:i?null:w5(t,s,l,u,f);let g=t.dom.ownerDocument,x=t.root.elementFromPoint?t.root:g,w=x.elementFromPoint(u,f);w&&!t.contentDOM.contains(w)&&(w=null),w||(u=Math.max(s.left+1,Math.min(s.right-1,u)),w=x.elementFromPoint(u,f),w&&!t.contentDOM.contains(w)&&(w=null));let S,T=-1;if(w&&((n=t.docView.nearest(w))===null||n===void 0?void 0:n.isEditable)!=!1){if(g.caretPositionFromPoint){let I=g.caretPositionFromPoint(u,f);I&&({offsetNode:S,offset:T}=I)}else if(g.caretRangeFromPoint){let I=g.caretRangeFromPoint(u,f);I&&({startContainer:S,startOffset:T}=I,(!t.contentDOM.contains(S)||Te.safari&&Lq(S,T,u)||Te.chrome&&Dq(S,T,u))&&(S=void 0))}}if(!S||!t.docView.dom.contains(S)){let I=ni.find(t.docView,p);if(!I)return d>l.top+l.height/2?l.to:l.from;({node:S,offset:T}=I1(I.dom,u,f))}let A=t.docView.nearest(S);if(!A)return null;if(A.isWidget&&((o=A.dom)===null||o===void 0?void 0:o.nodeType)==1){let I=A.dom.getBoundingClientRect();return e.yt.defaultLineHeight*1.5){let a=t.viewState.heightOracle.textHeight,l=Math.floor((n-i.top-(t.defaultLineHeight-a)*.5)/a);o+=l*t.viewState.heightOracle.lineLength}let s=t.state.sliceDoc(i.from,i.to);return i.from+Zd(s,o,t.state.tabSize)}function Lq(t,e,i){let r;if(t.nodeType!=3||e!=(r=t.nodeValue.length))return!1;for(let n=t.nextSibling;n;n=n.nextSibling)if(n.nodeType!=1||n.nodeName!="BR")return!1;return As(t,r-1,r).getBoundingClientRect().left>i}function Dq(t,e,i){if(e!=0)return!1;for(let n=t;;){let o=n.parentNode;if(!o||o.nodeType!=1||o.firstChild!=n)return!1;if(o.classList.contains("cm-line"))break;n=o}let r=t.nodeType==1?t.getBoundingClientRect():As(t,0,Math.max(t.nodeValue.length,1)).getBoundingClientRect();return i-r.left>5}function L1(t,e){let i=t.lineBlockAt(e);if(Array.isArray(i.type)){for(let r of i.type)if(r.to>e||r.to==e&&(r.to==i.to||r.type==Xi.Text))return r}return i}function Nq(t,e,i,r){let n=L1(t,e.head),o=!r||n.type!=Xi.Text||!(t.lineWrapping||n.widgetLineBreaks)?null:t.coordsAtPos(e.assoc<0&&e.head>n.from?e.head-1:e.head);if(o){let s=t.dom.getBoundingClientRect(),a=t.textDirectionAt(n.from),l=t.posAtCoords({x:i==(a==ot.LTR)?s.right-1:s.left+1,y:(o.top+o.bottom)/2});if(l!=null)return J.cursor(l,i?-1:1)}return J.cursor(i?n.to:n.from,i?-1:1)}function k5(t,e,i,r){let n=t.state.doc.lineAt(e.head),o=t.bidiSpans(n),s=t.textDirectionAt(n.from);for(let a=e,l=null;;){let c=kq(n,o,s,a,i),u=OC;if(!c){if(n.number==(i?t.state.doc.lines:1))return a;u=` `,n=t.state.doc.line(n.number+(i?1:-1)),o=t.bidiSpans(n),c=t.visualLineSide(n,!i)}if(l){if(!l(u))return a}else{if(!r)return c;l=r(u)}a=c}}function Mq(t,e,i){let r=t.state.charCategorizer(e),n=r(i);return o=>{let s=r(o);return n==dt.Space&&(n=s),n==s}}function Uq(t,e,i,r){let n=e.head,o=i?1:-1;if(n==(i?t.state.doc.length:0))return J.cursor(n,e.assoc);let s=e.goalColumn,a,l=t.contentDOM.getBoundingClientRect(),c=t.coordsAtPos(n,e.assoc||-1),u=t.documentTop;if(c)s==null&&(s=c.left-l.left),a=o<0?c.top:c.bottom;else{let p=t.viewState.lineBlockAt(n);s==null&&(s=Math.min(l.right-l.left,t.defaultCharacterWidth*(n-p.from))),a=(o<0?p.top:p.bottom)+u}let f=l.left+s,d=r!=null?r:t.viewState.heightOracle.textHeight>>1;for(let p=0;;p+=10){let g=a+(d+p)*o,x=AC(t,{x:f,y:g},!1,o);if(gl.bottom||(o<0?xn)){let w=t.docView.coordsForChar(x),S=!w||g{if(e>o&&en(t)),i.from,e.head>i.from?-1:1);return r==i.from?i:J.cursor(r,rnull),Te.gecko&&tW(e.contentDOM.ownerDocument)}handleEvent(e){!Vq(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||this.runHandlers(e.type,e)}runHandlers(e,i){let r=this.handlers[e];if(r){for(let n of r.observers)n(this.view,i);for(let n of r.handlers){if(i.defaultPrevented)break;if(n(this.view,i)){i.preventDefault();break}}}}ensureHandlers(e){let i=zq(e),r=this.handlers,n=this.view.contentDOM;for(let o in i)if(o!="scroll"){let s=!i[o].handlers.length,a=r[o];a&&s!=!a.handlers.length&&(n.removeEventListener(o,this.handleEvent),a=null),a||n.addEventListener(o,this.handleEvent,{passive:s})}for(let o in r)o!="scroll"&&!i[o]&&n.removeEventListener(o,this.handleEvent);this.handlers=i}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&Date.now()r.keyCode==e.keyCode))&&!e.ctrlKey||jq.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey)?(this.pendingIOSKey=i||e,setTimeout(()=>this.flushIOSKey(),250),!0):(e.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(e){let i=this.pendingIOSKey;return!i||i.key=="Enter"&&e&&e.from0?!0:Te.safari&&!Te.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1:!1}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}};function S5(t,e){return(i,r)=>{try{return e.call(t,r,i)}catch(n){oi(i.state,n)}}}function zq(t){let e=Object.create(null);function i(r){return e[r]||(e[r]={observers:[],handlers:[]})}for(let r of t){let n=r.spec;if(n&&n.domEventHandlers)for(let o in n.domEventHandlers){let s=n.domEventHandlers[o];s&&i(o).handlers.push(S5(r.value,s))}if(n&&n.domEventObservers)for(let o in n.domEventObservers){let s=n.domEventObservers[o];s&&i(o).observers.push(S5(r.value,s))}}for(let r in Dr)i(r).handlers.push(Dr[r]);for(let r in br)i(r).observers.push(br[r]);return e}var $C=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],jq="dthko",XC=[16,17,18,20,91,92,224,225],Hd=6;function Gd(t){return Math.max(0,t)*.7+8}function qq(t,e){return Math.max(Math.abs(t.clientX-e.clientX),Math.abs(t.clientY-e.clientY))}var N1=class{constructor(e,i,r,n){this.view=e,this.startEvent=i,this.style=r,this.mustSelect=n,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=i,this.scrollParent=lq(e.contentDOM),this.atoms=e.state.facet(Oy).map(s=>s(e));let o=e.contentDOM.ownerDocument;o.addEventListener("mousemove",this.move=this.move.bind(this)),o.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=i.shiftKey,this.multiple=e.state.facet(rt.allowMultipleSelections)&&Wq(e,i),this.dragging=Zq(e,i)&&DC(i)==1?null:!1}start(e){this.dragging===!1&&this.select(e)}move(e){var i;if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&qq(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let r=0,n=0,o=((i=this.scrollParent)===null||i===void 0?void 0:i.getBoundingClientRect())||{left:0,top:0,right:this.view.win.innerWidth,bottom:this.view.win.innerHeight},s=PC(this.view);e.clientX-s.left<=o.left+Hd?r=-Gd(o.left-e.clientX):e.clientX+s.right>=o.right-Hd&&(r=Gd(e.clientX-o.right)),e.clientY-s.top<=o.top+Hd?n=-Gd(o.top-e.clientY):e.clientY+s.bottom>=o.bottom-Hd&&(n=Gd(e.clientY-o.bottom)),this.setScrollSpeed(r,n)}up(e){this.dragging==null&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,i){this.scrollSpeed={x:e,y:i},e||i?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){this.scrollParent?(this.scrollParent.scrollLeft+=this.scrollSpeed.x,this.scrollParent.scrollTop+=this.scrollSpeed.y):this.view.win.scrollBy(this.scrollSpeed.x,this.scrollSpeed.y),this.dragging===!1&&this.select(this.lastEvent)}skipAtoms(e){let i=null;for(let r=0;rthis.select(this.lastEvent),20)}};function Wq(t,e){let i=t.state.facet(mC);return i.length?i[0](e):Te.mac?e.metaKey:e.ctrlKey}function Bq(t,e){let i=t.state.facet(gC);return i.length?i[0](e):Te.mac?!e.altKey:!e.ctrlKey}function Zq(t,e){let{main:i}=t.state.selection;if(i.empty)return!1;let r=cp(t.root);if(!r||r.rangeCount==0)return!0;let n=r.getRangeAt(0).getClientRects();for(let o=0;o=e.clientX&&s.top<=e.clientY&&s.bottom>=e.clientY)return!0}return!1}function Vq(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let i=e.target,r;i!=t.contentDOM;i=i.parentNode)if(!i||i.nodeType==11||(r=gt.get(i))&&r.ignoreEvent(e))return!1;return!0}var Dr=Object.create(null),br=Object.create(null),RC=Te.ie&&Te.ie_version<15||Te.ios&&Te.webkit_version<604;function Yq(t){let e=t.dom.parentNode;if(!e)return;let i=e.appendChild(document.createElement("textarea"));i.style.cssText="position: fixed; left: -10000px; top: 10px",i.focus(),setTimeout(()=>{t.focus(),i.remove(),IC(t,i.value)},50)}function IC(t,e){let{state:i}=t,r,n=1,o=i.toText(e),s=o.lines==i.selection.ranges.length;if(M1!=null&&i.selection.ranges.every(l=>l.empty)&&M1==o.toString()){let l=-1;r=i.changeByRange(c=>{let u=i.doc.lineAt(c.from);if(u.from==l)return{range:c};l=u.from;let f=i.toText((s?o.line(n++).text:e)+i.lineBreak);return{changes:{from:u.from,insert:f},range:J.cursor(c.from+f.length)}})}else s?r=i.changeByRange(l=>{let c=o.line(n++);return{changes:{from:l.from,to:l.to,insert:c.text},range:J.cursor(l.from+c.length)}}):r=i.replaceSelection(o);t.dispatch(r,{userEvent:"input.paste",scrollIntoView:!0})}br.scroll=t=>{t.inputState.lastScrollTop=t.scrollDOM.scrollTop,t.inputState.lastScrollLeft=t.scrollDOM.scrollLeft};Dr.keydown=(t,e)=>(t.inputState.setSelectionOrigin("select"),e.keyCode==27&&(t.inputState.lastEscPress=Date.now()),!1);br.touchstart=(t,e)=>{t.inputState.lastTouchTime=Date.now(),t.inputState.setSelectionOrigin("select.pointer")};br.touchmove=t=>{t.inputState.setSelectionOrigin("select.pointer")};Dr.mousedown=(t,e)=>{if(t.observer.flush(),t.inputState.lastTouchTime>Date.now()-2e3)return!1;let i=null;for(let r of t.state.facet(bC))if(i=r(t,e),i)break;if(!i&&e.button==0&&(i=Gq(t,e)),i){let r=!t.hasFocus;t.inputState.startMouseSelection(new N1(t,e,i,r)),r&&t.observer.ignore(()=>K5(t.contentDOM));let n=t.inputState.mouseSelection;if(n)return n.start(e),n.dragging===!1}return!1};function T5(t,e,i,r){if(r==1)return J.cursor(e,i);if(r==2)return Xq(t.state,e,i);{let n=ni.find(t.docView,e),o=t.state.doc.lineAt(n?n.posAtEnd:e),s=n?n.posAtStart:o.from,a=n?n.posAtEnd:o.to;return at>=e.top&&t<=e.bottom,E5=(t,e,i)=>LC(e,i)&&t>=i.left&&t<=i.right;function Fq(t,e,i,r){let n=ni.find(t.docView,e);if(!n)return 1;let o=e-n.posAtStart;if(o==0)return 1;if(o==n.length)return-1;let s=n.coordsAt(o,-1);if(s&&E5(i,r,s))return-1;let a=n.coordsAt(o,1);return a&&E5(i,r,a)?1:s&&LC(r,s)?-1:1}function C5(t,e){let i=t.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:i,bias:Fq(t,i,e.clientX,e.clientY)}}var Hq=Te.ie&&Te.ie_version<=11,_5=null,P5=0,Q5=0;function DC(t){if(!Hq)return t.detail;let e=_5,i=Q5;return _5=t,Q5=Date.now(),P5=!e||i>Date.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(P5+1)%3:1}function Gq(t,e){let i=C5(t,e),r=DC(e),n=t.state.selection;return{update(o){o.docChanged&&(i.pos=o.changes.mapPos(i.pos),n=n.map(o.changes))},get(o,s,a){let l=C5(t,o),c,u=T5(t,l.pos,l.bias,r);if(i.pos!=l.pos&&!s){let f=T5(t,i.pos,i.bias,r),d=Math.min(f.from,u.from),p=Math.max(f.to,u.to);u=d1&&(c=Kq(n,l.pos))?c:a?n.addRange(u):J.create([u])}}}function Kq(t,e){for(let i=0;i=e)return J.create(t.ranges.slice(0,i).concat(t.ranges.slice(i+1)),t.mainIndex==i?0:t.mainIndex-(t.mainIndex>i?1:0))}return null}Dr.dragstart=(t,e)=>{let{selection:{main:i}}=t.state;if(e.target.draggable){let n=t.docView.nearest(e.target);if(n&&n.isWidget){let o=n.posAtStart,s=o+n.length;(o>=i.to||s<=i.from)&&(i=J.range(o,s))}}let{inputState:r}=t;return r.mouseSelection&&(r.mouseSelection.dragging=!0),r.draggedContent=i,e.dataTransfer&&(e.dataTransfer.setData("Text",t.state.sliceDoc(i.from,i.to)),e.dataTransfer.effectAllowed="copyMove"),!1};Dr.dragend=t=>(t.inputState.draggedContent=null,!1);function A5(t,e,i,r){if(!i)return;let n=t.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:o}=t.inputState,s=r&&o&&Bq(t,e)?{from:o.from,to:o.to}:null,a={from:n,insert:i},l=t.state.changes(s?[s,a]:a);t.focus(),t.dispatch({changes:l,selection:{anchor:l.mapPos(n,-1),head:l.mapPos(n,1)},userEvent:s?"move.drop":"input.drop"}),t.inputState.draggedContent=null}Dr.drop=(t,e)=>{if(!e.dataTransfer)return!1;if(t.state.readOnly)return!0;let i=e.dataTransfer.files;if(i&&i.length){let r=Array(i.length),n=0,o=()=>{++n==i.length&&A5(t,e,r.filter(s=>s!=null).join(t.state.lineBreak),!1)};for(let s=0;s{/[\x00-\x08\x0e-\x1f]{2}/.test(a.result)||(r[s]=a.result),o()},a.readAsText(i[s])}return!0}else{let r=e.dataTransfer.getData("Text");if(r)return A5(t,e,r,!0),!0}return!1};Dr.paste=(t,e)=>{if(t.state.readOnly)return!0;t.observer.flush();let i=RC?null:e.clipboardData;return i?(IC(t,i.getData("text/plain")||i.getData("text/uri-list")),!0):(Yq(t),!1)};function Jq(t,e){let i=t.dom.parentNode;if(!i)return;let r=i.appendChild(document.createElement("textarea"));r.style.cssText="position: fixed; left: -10000px; top: 10px",r.value=e,r.focus(),r.selectionEnd=e.length,r.selectionStart=0,setTimeout(()=>{r.remove(),t.focus()},50)}function eW(t){let e=[],i=[],r=!1;for(let n of t.selection.ranges)n.empty||(e.push(t.sliceDoc(n.from,n.to)),i.push(n));if(!e.length){let n=-1;for(let{from:o}of t.selection.ranges){let s=t.doc.lineAt(o);s.number>n&&(e.push(s.text),i.push({from:s.from,to:Math.min(t.doc.length,s.to+1)})),n=s.number}r=!0}return{text:e.join(t.lineBreak),ranges:i,linewise:r}}var M1=null;Dr.copy=Dr.cut=(t,e)=>{let{text:i,ranges:r,linewise:n}=eW(t.state);if(!i&&!n)return!1;M1=n?i:null,e.type=="cut"&&!t.state.readOnly&&t.dispatch({changes:r,scrollIntoView:!0,userEvent:"delete.cut"});let o=RC?null:e.clipboardData;return o?(o.clearData(),o.setData("text/plain",i),!0):(Jq(t,i),!1)};var NC=bi.define();function MC(t,e){let i=[];for(let r of t.facet(vC)){let n=r(t,e);n&&i.push(n)}return i?t.update({effects:i,annotations:NC.of(!0)}):null}function UC(t){setTimeout(()=>{let e=t.hasFocus;if(e!=t.inputState.notifiedFocused){let i=MC(t.state,e);i?t.dispatch(i):t.update([])}},10)}br.focus=t=>{t.inputState.lastFocusTime=Date.now(),!t.scrollDOM.scrollTop&&(t.inputState.lastScrollTop||t.inputState.lastScrollLeft)&&(t.scrollDOM.scrollTop=t.inputState.lastScrollTop,t.scrollDOM.scrollLeft=t.inputState.lastScrollLeft),UC(t)};br.blur=t=>{t.observer.clearSelectionRange(),UC(t)};br.compositionstart=br.compositionupdate=t=>{t.inputState.compositionFirstChange==null&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0)};br.compositionend=t=>{t.inputState.composing=-1,t.inputState.compositionEndedAt=Date.now(),t.inputState.compositionPendingKey=!0,t.inputState.compositionPendingChange=t.observer.pendingRecords().length>0,t.inputState.compositionFirstChange=null,Te.chrome&&Te.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then(()=>t.observer.flush()):setTimeout(()=>{t.inputState.composing<0&&t.docView.hasComposition&&t.update([])},50)};br.contextmenu=t=>{t.inputState.lastContextMenu=Date.now()};Dr.beforeinput=(t,e)=>{var i;let r;if(Te.chrome&&Te.android&&(r=$C.find(n=>n.inputType==e.inputType))&&(t.observer.delayAndroidKey(r.key,r.keyCode),r.key=="Backspace"||r.key=="Delete")){let n=((i=window.visualViewport)===null||i===void 0?void 0:i.height)||0;setTimeout(()=>{var o;(((o=window.visualViewport)===null||o===void 0?void 0:o.height)||0)>n+10&&t.hasFocus&&(t.contentDOM.blur(),t.focus())},100)}return Te.ios&&e.inputType=="deleteContentForward"&&t.observer.flushSoon(),Te.safari&&e.inputType=="insertText"&&t.inputState.composing>=0&&setTimeout(()=>br.compositionend(t,e),20),!1};var $5=new Set;function tW(t){$5.has(t)||($5.add(t),t.addEventListener("copy",()=>{}),t.addEventListener("cut",()=>{}))}var X5=["pre-wrap","normal","pre-line","break-spaces"],U1=class{constructor(e){this.lineWrapping=e,this.doc=He.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30,this.heightChanged=!1}heightForGap(e,i){let r=this.doc.lineAt(i).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(r+=Math.max(0,Math.ceil((i-e-r*this.lineLength*.5)/this.lineLength))),this.lineHeight*r}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/(this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return X5.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let i=!1;for(let r=0;r-1,l=Math.round(i)!=Math.round(this.lineHeight)||this.lineWrapping!=a;if(this.lineWrapping=a,this.lineHeight=i,this.charWidth=r,this.textHeight=n,this.lineLength=o,l){this.heightSamples={};for(let c=0;c0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e,i){this.height!=i&&(Math.abs(this.height-i)>op&&(e.heightChanged=!0),this.height=i)}replace(e,i,r){return t.of(r)}decomposeLeft(e,i){i.push(this)}decomposeRight(e,i){i.push(this)}applyChanges(e,i,r,n){let o=this,s=r.doc;for(let a=n.length-1;a>=0;a--){let{fromA:l,toA:c,fromB:u,toB:f}=n[a],d=o.lineAt(l,yt.ByPosNoHeight,r.setDoc(i),0,0),p=d.to>=c?d:o.lineAt(c,yt.ByPosNoHeight,r,0,0);for(f+=p.to-c,c=p.to;a>0&&d.from<=n[a-1].toA;)l=n[a-1].fromA,u=n[a-1].fromB,a--,lo*2){let a=e[i-1];a.break?e.splice(--i,1,a.left,null,a.right):e.splice(--i,1,a.left,a.right),r+=1+a.break,n-=a.size}else if(o>n*2){let a=e[r];a.break?e.splice(r,1,a.left,null,a.right):e.splice(r,1,a.left,a.right),r+=2+a.break,o-=a.size}else break;else if(n=o&&s(this.blockAt(0,r,n,o))}updateHeight(e,i=0,r=!1,n){return n&&n.from<=i&&n.more&&this.setHeight(e,n.heights[n.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}},gr=class t extends Op{constructor(e,i){super(e,i,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(e,i,r,n){return new nn(n,this.length,r,this.height,this.breaks)}replace(e,i,r){let n=r[0];return r.length==1&&(n instanceof t||n instanceof Io&&n.flags&4)&&Math.abs(this.length-n.length)<10?(n instanceof Io?n=new t(n.length,this.height):n.height=this.height,this.outdated||(n.outdated=!1),n):er.of(r)}updateHeight(e,i=0,r=!1,n){return n&&n.from<=i&&n.more?this.setHeight(e,n.heights[n.index++]):(r||this.outdated)&&this.setHeight(e,Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}},Io=class t extends er{constructor(e){super(e,0)}heightMetrics(e,i){let r=e.doc.lineAt(i).number,n=e.doc.lineAt(i+this.length).number,o=n-r+1,s,a=0;if(e.lineWrapping){let l=Math.min(this.height,e.lineHeight*o);s=l/o,this.length>o+1&&(a=(this.height-l)/(this.length-o-1))}else s=this.height/o;return{firstLine:r,lastLine:n,perLine:s,perChar:a}}blockAt(e,i,r,n){let{firstLine:o,lastLine:s,perLine:a,perChar:l}=this.heightMetrics(i,n);if(i.lineWrapping){let c=n+(e0){let o=r[r.length-1];o instanceof t?r[r.length-1]=new t(o.length+n):r.push(null,new t(n-1))}if(e>0){let o=r[0];o instanceof t?r[0]=new t(e+o.length):r.unshift(new t(e-1),null)}return er.of(r)}decomposeLeft(e,i){i.push(new t(e-1),null)}decomposeRight(e,i){i.push(null,new t(this.length-e-1))}updateHeight(e,i=0,r=!1,n){let o=i+this.length;if(n&&n.from<=i+this.length&&n.more){let s=[],a=Math.max(i,n.from),l=-1;for(n.from>i&&s.push(new t(n.from-i-1).updateHeight(e,i));a<=o&&n.more;){let u=e.doc.lineAt(a).length;s.length&&s.push(null);let f=n.heights[n.index++];l==-1?l=f:Math.abs(f-l)>=op&&(l=-2);let d=new gr(u,f);d.outdated=!1,s.push(d),a+=u+1}a<=o&&s.push(null,new t(o-a).updateHeight(e,a));let c=er.of(s);return(l<0||Math.abs(c.height-this.height)>=op||Math.abs(l-this.heightMetrics(e,i).perLine)>=op)&&(e.heightChanged=!0),c}else(r||this.outdated)&&(this.setHeight(e,e.heightForGap(i,i+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}},j1=class extends er{constructor(e,i,r){super(e.length+i+r.length,e.height+r.height,i|(e.outdated||r.outdated?2:0)),this.left=e,this.right=r,this.size=e.size+r.size}get break(){return this.flags&1}blockAt(e,i,r,n){let o=r+this.left.height;return ea))return c;let u=i==yt.ByPosNoHeight?yt.ByPosNoHeight:yt.ByPos;return l?c.join(this.right.lineAt(a,u,r,s,a)):this.left.lineAt(a,u,r,n,o).join(c)}forEachLine(e,i,r,n,o,s){let a=n+this.left.height,l=o+this.left.length+this.break;if(this.break)e=l&&this.right.forEachLine(e,i,r,a,l,s);else{let c=this.lineAt(l,yt.ByPos,r,n,o);e=e&&c.from<=i&&s(c),i>c.to&&this.right.forEachLine(c.to+1,i,r,a,l,s)}}replace(e,i,r){let n=this.left.length+this.break;if(ithis.left.length)return this.balanced(this.left,this.right.replace(e-n,i-n,r));let o=[];e>0&&this.decomposeLeft(e,o);let s=o.length;for(let a of r)o.push(a);if(e>0&&R5(o,s-1),i=r&&i.push(null)),e>r&&this.right.decomposeLeft(e-r,i)}decomposeRight(e,i){let r=this.left.length,n=r+this.break;if(e>=n)return this.right.decomposeRight(e-n,i);e2*i.size||i.size>2*e.size?er.of(this.break?[e,null,i]:[e,i]):(this.left=e,this.right=i,this.height=e.height+i.height,this.outdated=e.outdated||i.outdated,this.size=e.size+i.size,this.length=e.length+this.break+i.length,this)}updateHeight(e,i=0,r=!1,n){let{left:o,right:s}=this,a=i+o.length+this.break,l=null;return n&&n.from<=i+o.length&&n.more?l=o=o.updateHeight(e,i,r,n):o.updateHeight(e,i,r),n&&n.from<=a+s.length&&n.more?l=s=s.updateHeight(e,a,r,n):s.updateHeight(e,a,r),l?this.balanced(o,s):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}};function R5(t,e){let i,r;t[e]==null&&(i=t[e-1])instanceof Io&&(r=t[e+1])instanceof Io&&t.splice(e-1,3,new Io(i.length+1+r.length))}var iW=5,q1=class t{constructor(e,i){this.pos=e,this.oracle=i,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,i){if(this.lineStart>-1){let r=Math.min(i,this.lineEnd),n=this.nodes[this.nodes.length-1];n instanceof gr?n.length+=r-this.pos:(r>this.pos||!this.isCovered)&&this.nodes.push(new gr(r-this.pos,-1)),this.writtenTo=r,i>r&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=i}point(e,i,r){if(e=iW)&&this.addLineDeco(n,o,s)}else i>e&&this.span(e,i);this.lineEnd>-1&&this.lineEnd-1)return;let{from:e,to:i}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=i,this.writtenToe&&this.nodes.push(new gr(this.pos-e,-1)),this.writtenTo=this.pos}blankContent(e,i){let r=new Io(i-e);return this.oracle.doc.lineAt(e).to==i&&(r.flags|=4),r}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof gr)return e;let i=new gr(0,-1);return this.nodes.push(i),i}addBlock(e){this.enterLine();let i=e.deco;i&&i.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,i&&i.endSide>0&&(this.covering=e)}addLineDeco(e,i,r){let n=this.ensureLine();n.length+=r,n.collapsed+=r,n.widgetHeight=Math.max(n.widgetHeight,e),n.breaks+=i,this.writtenTo=this.pos=this.pos+r}finish(e){let i=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(i instanceof gr)&&!this.isCovered?this.nodes.push(new gr(0,-1)):(this.writtenTou.clientHeight||u.scrollWidth>u.clientWidth)&&f.overflow!="visible"){let d=u.getBoundingClientRect();o=Math.max(o,d.left),s=Math.min(s,d.right),a=Math.max(a,d.top),l=c==t.parentNode?d.bottom:Math.min(l,d.bottom)}c=f.position=="absolute"||f.position=="fixed"?u.offsetParent:u.parentNode}else if(c.nodeType==11)c=c.host;else break;return{left:o-i.left,right:Math.max(o,s)-i.left,top:a-(i.top+e),bottom:Math.max(a,l)-(i.top+e)}}function oW(t,e){let i=t.getBoundingClientRect();return{left:0,right:i.right-i.left,top:e,bottom:i.bottom-(i.top+e)}}var pu=class{constructor(e,i,r){this.from=e,this.to=i,this.size=r}static same(e,i){if(e.length!=i.length)return!1;for(let r=0;rtypeof r!="function"&&r.class=="cm-lineWrapping");this.heightOracle=new U1(i),this.stateDeco=e.facet(wu).filter(r=>typeof r!="function"),this.heightMap=er.empty().applyChanges(this.stateDeco,He.empty,this.heightOracle.setDoc(e.doc),[new sn(0,0,0,e.doc.length)]),this.viewport=this.getViewport(0,null),this.updateViewportLines(),this.updateForViewport(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=we.set(this.lineGaps.map(r=>r.draw(this,!1))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:i}=this.state.selection;for(let r=0;r<=1;r++){let n=r?i.head:i.anchor;if(!e.some(({from:o,to:s})=>n>=o&&n<=s)){let{from:o,to:s}=this.lineBlockAt(n);e.push(new Ka(o,s))}}this.viewports=e.sort((r,n)=>r.from-n.from),this.scaler=this.heightMap.height<=7e6?I5:new Z1(this.heightOracle,this.heightMap,this.viewports)}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push(this.scaler.scale==1?e:au(e,this.scaler))})}update(e,i=null){this.state=e.state;let r=this.stateDeco;this.stateDeco=this.state.facet(wu).filter(u=>typeof u!="function");let n=e.changedRanges,o=sn.extendWithRanges(n,rW(r,this.stateDeco,e?e.changes:Qi.empty(this.state.doc.length))),s=this.heightMap.height,a=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),o),this.heightMap.height!=s&&(e.flags|=2),a?(this.scrollAnchorPos=e.changes.mapPos(a.from,-1),this.scrollAnchorHeight=a.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=this.heightMap.height);let l=o.length?this.mapViewport(this.viewport,e.changes):this.viewport;(i&&(i.range.headl.to)||!this.viewportIsAppropriate(l))&&(l=this.getViewport(0,i));let c=!e.changes.empty||e.flags&2||l.from!=this.viewport.from||l.to!=this.viewport.to;this.viewport=l,this.updateForViewport(),c&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(),i&&(this.scrollTarget=i),!this.mustEnforceCursorAssoc&&e.selectionSet&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(kC)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let i=e.contentDOM,r=window.getComputedStyle(i),n=this.heightOracle,o=r.whiteSpace;this.defaultTextDirection=r.direction=="rtl"?ot.RTL:ot.LTR;let s=this.heightOracle.mustRefreshForWrapping(o),a=i.getBoundingClientRect(),l=s||this.mustMeasureContent||this.contentDOMHeight!=a.height;this.contentDOMHeight=a.height,this.mustMeasureContent=!1;let c=0,u=0;if(a.width&&a.height){let{scaleX:I,scaleY:D}=G5(i,a);(I>.005&&Math.abs(this.scaleX-I)>.005||D>.005&&Math.abs(this.scaleY-D)>.005)&&(this.scaleX=I,this.scaleY=D,c|=8,s=l=!0)}let f=(parseInt(r.paddingTop)||0)*this.scaleY,d=(parseInt(r.paddingBottom)||0)*this.scaleY;(this.paddingTop!=f||this.paddingBottom!=d)&&(this.paddingTop=f,this.paddingBottom=d,c|=10),this.editorWidth!=e.scrollDOM.clientWidth&&(n.lineWrapping&&(l=!0),this.editorWidth=e.scrollDOM.clientWidth,c|=8);let p=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=p&&(this.scrollAnchorHeight=-1,this.scrollTop=p),this.scrolledToBottom=eC(e.scrollDOM);let g=(this.printing?oW:nW)(i,this.paddingTop),x=g.top-this.pixelViewport.top,w=g.bottom-this.pixelViewport.bottom;this.pixelViewport=g;let S=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(S!=this.inView&&(this.inView=S,S&&(l=!0)),!this.inView&&!this.scrollTarget)return 0;let T=a.width;if((this.contentDOMWidth!=T||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=a.width,this.editorHeight=e.scrollDOM.clientHeight,c|=8),l){let I=e.docView.measureVisibleLineHeights(this.viewport);if(n.mustRefreshForHeights(I)&&(s=!0),s||n.lineWrapping&&Math.abs(T-this.contentDOMWidth)>n.charWidth){let{lineHeight:D,charWidth:C,textHeight:j}=e.docView.measureTextSize();s=D>0&&n.refresh(o,D,C,j,T/C,I),s&&(e.docView.minWidth=0,c|=8)}x>0&&w>0?u=Math.max(x,w):x<0&&w<0&&(u=Math.min(x,w)),n.heightChanged=!1;for(let D of this.viewports){let C=D.from==this.viewport.from?I:e.docView.measureVisibleLineHeights(D);this.heightMap=(s?er.empty().applyChanges(this.stateDeco,He.empty,this.heightOracle,[new sn(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(n,0,s,new z1(D.from,C))}n.heightChanged&&(c|=2)}let A=!this.viewportIsAppropriate(this.viewport,u)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return A&&(this.viewport=this.getViewport(u,this.scrollTarget)),this.updateForViewport(),(c&2||A)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(s?[]:this.lineGaps,e)),c|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),c}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,i){let r=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),n=this.heightMap,o=this.heightOracle,{visibleTop:s,visibleBottom:a}=this,l=new Ka(n.lineAt(s-r*1e3,yt.ByHeight,o,0,0).from,n.lineAt(a+(1-r)*1e3,yt.ByHeight,o,0,0).to);if(i){let{head:c}=i.range;if(cl.to){let u=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),f=n.lineAt(c,yt.ByPos,o,0,0),d;i.y=="center"?d=(f.top+f.bottom)/2-u/2:i.y=="start"||i.y=="nearest"&&c=a+Math.max(10,Math.min(r,250)))&&n>s-2*1e3&&o>1,s=n<<1;if(this.defaultTextDirection!=ot.LTR&&!r)return[];let a=[],l=(c,u,f,d)=>{if(u-cc&&ww.from>=f.from&&w.to<=f.to&&Math.abs(w.from-c)w.fromS));if(!x){if(uw.from<=u&&w.to>=u)){let w=i.moveToLineBoundary(J.cursor(u),!1,!0).head;w>c&&(u=w)}x=new pu(c,u,this.gapSize(f,c,u,d))}a.push(x)};for(let c of this.viewportLines){if(c.lengthc.from&&l(c.from,d,c,u),pi.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(){let e=this.stateDeco;this.lineGaps.length&&(e=e.concat(this.lineGapDeco));let i=[];nt.spans(e,this.viewport.from,this.viewport.to,{span(n,o){i.push({from:n,to:o})},point(){}},20);let r=i.length!=this.visibleRanges.length||this.visibleRanges.some((n,o)=>n.from!=i[o].from||n.to!=i[o].to);return this.visibleRanges=i,r?4:0}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(i=>i.from<=e&&i.to>=e)||au(this.heightMap.lineAt(e,yt.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return au(this.heightMap.lineAt(this.scaler.fromDOM(e),yt.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(e){let i=this.lineBlockAtHeight(e+8);return i.from>=this.viewport.from||this.viewportLines[0].top-e>200?i:this.viewportLines[0]}elementAtHeight(e){return au(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}},Ka=class{constructor(e,i){this.from=e,this.to=i}};function sW(t,e,i){let r=[],n=t,o=0;return nt.spans(i,t,e,{span(){},point(s,a){s>n&&(r.push({from:n,to:s}),o+=s-n),n=a}},20),n=1)return e[e.length-1].to;let r=Math.floor(t*i);for(let n=0;;n++){let{from:o,to:s}=e[n],a=s-o;if(r<=a)return o+r;r-=a}}function Jd(t,e){let i=0;for(let{from:r,to:n}of t.ranges){if(e<=n){i+=e-r;break}i+=n-r}return i/t.total}function aW(t,e){for(let i of t)if(e(i))return i}var I5={toDOM(t){return t},fromDOM(t){return t},scale:1},Z1=class{constructor(e,i,r){let n=0,o=0,s=0;this.viewports=r.map(({from:a,to:l})=>{let c=i.lineAt(a,yt.ByPos,e,0,0).top,u=i.lineAt(l,yt.ByPos,e,0,0).bottom;return n+=u-c,{from:a,to:l,top:c,bottom:u,domTop:0,domBottom:0}}),this.scale=(7e6-n)/(i.height-n);for(let a of this.viewports)a.domTop=s+(a.top-o)*this.scale,s=a.domBottom=a.domTop+(a.bottom-a.top),o=a.bottom}toDOM(e){for(let i=0,r=0,n=0;;i++){let o=iau(n,e)):t._content)}var ep=be.define({combine:t=>t.join(" ")}),V1=be.define({combine:t=>t.indexOf(!0)>-1}),Y1=zi.newName(),zC=zi.newName(),jC=zi.newName(),qC={"&light":"."+zC,"&dark":"."+jC};function F1(t,e,i){return new zi(e,{finish(r){return/&/.test(r)?r.replace(/&\w*/,n=>{if(n=="&")return t;if(!i||!i[n])throw new RangeError(`Unsupported selector: ${n}`);return i[n]}):t+" "+r}})}var lW=F1("."+Y1,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#444"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",insetInlineStart:0,zIndex:200},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",borderRight:"1px solid #ddd"},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top"},".cm-highlightSpace:before":{content:"attr(data-display)",position:"absolute",pointerEvents:"none",color:"#888"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},qC),lu="\uFFFF",H1=class{constructor(e,i){this.points=e,this.text="",this.lineSeparator=i.facet(rt.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=lu}readRange(e,i){if(!e)return this;let r=e.parentNode;for(let n=e;;){this.findPointBefore(r,n);let o=this.text.length;this.readNode(n);let s=n.nextSibling;if(s==i)break;let a=gt.get(n),l=gt.get(s);(a&&l?a.breakAfter:(a?a.breakAfter:up(n))||up(s)&&(n.nodeName!="BR"||n.cmIgnore)&&this.text.length>o)&&this.lineBreak(),n=s}return this.findPointBefore(r,i),this}readTextNode(e){let i=e.nodeValue;for(let r of this.points)r.node==e&&(r.pos=this.text.length+Math.min(r.offset,i.length));for(let r=0,n=this.lineSeparator?null:/\r\n?|\n/g;;){let o=-1,s=1,a;if(this.lineSeparator?(o=i.indexOf(this.lineSeparator,r),s=this.lineSeparator.length):(a=n.exec(i))&&(o=a.index,s=a[0].length),this.append(i.slice(r,o<0?i.length:o)),o<0)break;if(this.lineBreak(),s>1)for(let l of this.points)l.node==e&&l.pos>this.text.length&&(l.pos-=s-1);r=o+s}}readNode(e){if(e.cmIgnore)return;let i=gt.get(e),r=i&&i.overrideDOMText;if(r!=null){this.findPointInside(e,r.length);for(let n=r.iter();!n.next().done;)n.lineBreak?this.lineBreak():this.append(n.value)}else e.nodeType==3?this.readTextNode(e):e.nodeName=="BR"?e.nextSibling&&this.lineBreak():e.nodeType==1&&this.readRange(e.firstChild,null)}findPointBefore(e,i){for(let r of this.points)r.node==e&&e.childNodes[r.offset]==i&&(r.pos=this.text.length)}findPointInside(e,i){for(let r of this.points)(e.nodeType==3?r.node==e:e.contains(r.node))&&(r.pos=this.text.length+(cW(e,r.node,r.offset)?i:0))}};function cW(t,e,i){for(;;){if(!e||i-1)this.newSel=null;else if(i>-1&&(this.bounds=e.docView.domBoundsAround(i,r,0))){let a=o||s?[]:hW(e),l=new H1(a,e.state);l.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=l.text,this.newSel=dW(a,this.bounds.from)}else{let a=e.observer.selectionRange,l=o&&o.node==a.focusNode&&o.offset==a.focusOffset||!k1(e.contentDOM,a.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(a.focusNode,a.focusOffset),c=s&&s.node==a.anchorNode&&s.offset==a.anchorOffset||!k1(e.contentDOM,a.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(a.anchorNode,a.anchorOffset),u=e.viewport;if((Te.ios||Te.chrome)&&e.state.selection.main.empty&&l!=c&&(u.from>0||u.toDate.now()-100?t.inputState.lastKeyCode:-1;if(e.bounds){let{from:s,to:a}=e.bounds,l=n.from,c=null;(o===8||Te.android&&e.text.length=n.from&&i.to<=n.to&&(i.from!=n.from||i.to!=n.to)&&n.to-n.from-(i.to-i.from)<=4?i={from:n.from,to:n.to,insert:t.state.doc.slice(n.from,i.from).append(i.insert).append(t.state.doc.slice(i.to,n.to))}:(Te.mac||Te.android)&&i&&i.from==i.to&&i.from==n.head-1&&/^\. ?$/.test(i.insert.toString())&&t.contentDOM.getAttribute("autocorrect")=="off"?(r&&i.insert.length==2&&(r=J.single(r.main.anchor-1,r.main.head-1)),i={from:n.from,to:n.to,insert:He.of([" "])}):Te.chrome&&i&&i.from==i.to&&i.from==n.head&&i.insert.toString()==` - `&&t.lineWrapping&&(r&&(r=J.single(r.main.anchor-1,r.main.head-1)),i={from:n.from,to:n.to,insert:He.of([" "])}),i){if(Te.ios&&t.inputState.flushIOSKey(i)||Te.android&&(i.to==n.to&&(i.from==n.from||i.from==n.from-1&&t.state.sliceDoc(i.from,n.from)==" ")&&i.insert.length==1&&i.insert.lines==2&&tl(t.contentDOM,"Enter",13)||(i.from==n.from-1&&i.to==n.to&&i.insert.length==0||o==8&&i.insert.lengthn.head)&&tl(t.contentDOM,"Backspace",8)||i.from==n.from&&i.to==n.to+1&&i.insert.length==0&&tl(t.contentDOM,"Delete",46)))return!0;let s=i.insert.toString();t.inputState.composing>=0&&t.inputState.composing++;let a,l=()=>a||(a=uW(t,i,r));return t.state.facet(xC).some(c=>c(t,i.from,i.to,s,l))||t.dispatch(l()),!0}else if(r&&!r.main.eq(n)){let s=!1,a="select";return t.inputState.lastSelectionTime>Date.now()-50&&(t.inputState.lastSelectionOrigin=="select"&&(s=!0),a=t.inputState.lastSelectionOrigin),t.dispatch({selection:r,scrollIntoView:s,userEvent:a}),!0}else return!1}function uW(t,e,i){let r,n=t.state,o=n.selection.main;if(e.from>=o.from&&e.to<=o.to&&e.to-e.from>=(o.to-o.from)/3&&(!i||i.main.empty&&i.main.from==e.from+e.insert.length)&&t.inputState.composing<0){let a=o.frome.to?n.sliceDoc(e.to,o.to):"";r=n.replaceSelection(t.state.toText(a+e.insert.sliceString(0,void 0,t.state.lineBreak)+l))}else{let a=n.changes(e),l=i&&i.main.to<=a.newLength?i.main:void 0;if(n.selection.ranges.length>1&&t.inputState.composing>=0&&e.to<=o.to&&e.to>=o.to-10){let c=t.state.sliceDoc(e.from,e.to),u,f=i&&QC(t,i.main.head);if(f){let g=e.insert.length-(e.to-e.from);u={from:f.from,to:f.to-g}}else u=t.state.doc.lineAt(o.head);let d=o.to-e.to,p=o.to-o.from;r=n.changeByRange(g=>{if(g.from==o.from&&g.to==o.to)return{changes:a,range:l||g.map(a)};let x=g.to-d,w=x-c.length;if(g.to-g.from!=p||t.state.sliceDoc(w,x)!=c||g.to>=u.from&&g.from<=u.to)return{range:g};let S=n.changes({from:w,to:x,insert:e.insert}),T=g.to-o.to;return{changes:S,range:l?J.range(Math.max(0,l.anchor+T),Math.max(0,l.head+T)):g.map(S)}})}else r={changes:a,selection:l&&n.selection.replaceRange(l)}}let s="input.type";return(t.composing||t.inputState.compositionPendingChange&&t.inputState.compositionEndedAt>Date.now()-50)&&(t.inputState.compositionPendingChange=!1,s+=".compose",t.inputState.compositionFirstChange&&(s+=".start",t.inputState.compositionFirstChange=!1)),n.update(r,{userEvent:s,scrollIntoView:!0})}function fW(t,e,i,r){let n=Math.min(t.length,e.length),o=0;for(;o0&&a>0&&t.charCodeAt(s-1)==e.charCodeAt(a-1);)s--,a--;if(r=="end"){let l=Math.max(0,o-Math.min(s,a));i-=s+l-o}if(s=s?o-i:0;o-=l,a=o+(a-s),s=o}else if(a=a?o-i:0;o-=l,s=o+(s-a),a=o}return{from:o,toA:s,toB:a}}function hW(t){let e=[];if(t.root.activeElement!=t.contentDOM)return e;let{anchorNode:i,anchorOffset:r,focusNode:n,focusOffset:o}=t.observer.selectionRange;return i&&(e.push(new gp(i,r)),(n!=i||o!=r)&&e.push(new gp(n,o))),e}function dW(t,e){if(t.length==0)return null;let i=t[0].pos,r=t.length==2?t[1].pos:i;return i>-1&&r>-1?J.single(i+e,r+e):null}var pW={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},y1=Te.ie&&Te.ie_version<=11,K1=class{constructor(e){this.view=e,this.active=!1,this.selectionRange=new S1,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(i=>{for(let r of i)this.queue.push(r);(Te.ie&&Te.ie_version<=11||Te.ios&&e.composing)&&i.some(r=>r.type=="childList"&&r.removedNodes.length||r.type=="characterData"&&r.oldValue.length>r.target.nodeValue.length)?this.flushSoon():this.flush()}),y1&&(this.onCharData=i=>{this.queue.push({target:i.target,type:"characterData",oldValue:i.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var i;((i=this.view.docView)===null||i===void 0?void 0:i.lastUpdate){this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),i.length>0&&i[i.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(i=>{i.length>0&&i[i.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(e){e.type=="change"&&!e.matches||(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((i,r)=>i!=e[r]))){this.gapIntersection.disconnect();for(let i of e)this.gapIntersection.observe(i);this.gaps=e}}onSelectionChange(e){let i=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:r}=this,n=this.selectionRange;if(r.state.facet(Tp)?r.root.activeElement!=this.dom:!rp(r.dom,n))return;let o=n.anchorNode&&r.docView.nearest(n.anchorNode);if(o&&o.ignoreEvent(e)){i||(this.selectionChanged=!1);return}(Te.ie&&Te.ie_version<=11||Te.android&&Te.chrome)&&!r.state.selection.main.empty&&n.focusNode&&uu(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,i=cp(e.root);if(!i)return!1;let r=Te.safari&&e.root.nodeType==11&&oq(this.dom.ownerDocument)==this.dom&&OW(this.view,i)||i;if(!r||this.selectionRange.eq(r))return!1;let n=rp(this.dom,r);return n&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime{let o=this.delayedAndroidKey;o&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=o.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&o.force&&tl(this.dom,o.key,o.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(n)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:i,force:this.lastChange{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let i=-1,r=-1,n=!1;for(let o of e){let s=this.readMutation(o);s&&(s.typeOver&&(n=!0),i==-1?{from:i,to:r}=s:(i=Math.min(s.from,i),r=Math.max(s.to,r)))}return{from:i,to:r,typeOver:n}}readChange(){let{from:e,to:i,typeOver:r}=this.processRecords(),n=this.selectionChanged&&rp(this.dom,this.selectionRange);if(e<0&&!n)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let o=new G1(this.view,e,i,r);return this.view.docView.domChanged={newSel:o.newSel?o.newSel.main:null},o}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let i=this.readChange();if(!i)return this.view.requestMeasure(),!1;let r=this.view.state,n=WC(this.view,i);return this.view.state==r&&this.view.update([]),n}readMutation(e){let i=this.view.docView.nearest(e.target);if(!i||i.ignoreMutation(e))return null;if(i.markDirty(e.type=="attributes"),e.type=="attributes"&&(i.flags|=4),e.type=="childList"){let r=L5(i,e.previousSibling||e.target.previousSibling,-1),n=L5(i,e.nextSibling||e.target.nextSibling,1);return{from:r?i.posAfter(r):i.posAtStart,to:n?i.posBefore(n):i.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:i.posAtStart,to:i.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener("change",this.onPrint):e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener("change",this.onPrint):e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}destroy(){var e,i,r;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(i=this.gapIntersection)===null||i===void 0||i.disconnect(),(r=this.resizeScroll)===null||r===void 0||r.disconnect();for(let n of this.scrollTargets)n.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey)}};function L5(t,e,i){for(;e;){let r=gt.get(e);if(r&&r.parent==t)return r;let n=e.parentNode;e=n!=t.dom?n:i>0?e.nextSibling:e.previousSibling}return null}function D5(t,e){let i=e.startContainer,r=e.startOffset,n=e.endContainer,o=e.endOffset,s=t.docView.domAtPos(t.state.selection.main.anchor);return uu(s.node,s.offset,n,o)&&([i,r,n,o]=[n,o,i,r]),{anchorNode:i,anchorOffset:r,focusNode:n,focusOffset:o}}function OW(t,e){if(e.getComposedRanges){let n=e.getComposedRanges(t.root)[0];if(n)return D5(t,n)}let i=null;function r(n){n.preventDefault(),n.stopImmediatePropagation(),i=n.getTargetRanges()[0]}return t.contentDOM.addEventListener("beforeinput",r,!0),t.dom.ownerDocument.execCommand("indent"),t.contentDOM.removeEventListener("beforeinput",r,!0),i?D5(t,i):null}var de=class t{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return this.inputState.composing>0}get compositionStarted(){return this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:i}=e;this.dispatchTransactions=e.dispatchTransactions||i&&(r=>r.forEach(n=>i(n,this)))||(r=>this.update(r)),this.dispatch=this.dispatch.bind(this),this._root=e.root||cq(e.parent)||document,this.viewState=new mp(e.state||rt.create(e)),e.scrollTo&&e.scrollTo.is(Fd)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(ou).map(r=>new du(r));for(let r of this.plugins)r.update(this);this.observer=new K1(this),this.inputState=new D1(this),this.inputState.ensureHandlers(this.plugins),this.docView=new dp(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure()}dispatch(...e){let i=e.length==1&&e[0]instanceof Tt?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(i,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let i=!1,r=!1,n,o=this.state;for(let d of e){if(d.startState!=o)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");o=d.state}if(this.destroyed){this.viewState.state=o;return}let s=this.hasFocus,a=0,l=null;e.some(d=>d.annotation(NC))?(this.inputState.notifiedFocused=s,a=1):s!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=s,l=MC(o,s),l||(a=1));let c=this.observer.delayedAndroidKey,u=null;if(c?(this.observer.clearDelayedAndroidKey(),u=this.observer.readChange(),(u&&!this.state.doc.eq(o.doc)||!this.state.selection.eq(o.selection))&&(u=null)):this.observer.clear(),o.facet(rt.phrases)!=this.state.facet(rt.phrases))return this.setState(o);n=hp.create(this,o,e),n.flags|=a;let f=this.viewState.scrollTarget;try{this.updateState=2;for(let d of e){if(f&&(f=f.map(d.changes)),d.scrollIntoView){let{main:p}=d.state.selection;f=new hu(p.empty?p:J.cursor(p.head,p.head>p.anchor?-1:1))}for(let p of d.effects)p.is(Fd)&&(f=p.value.clip(this.state))}this.viewState.update(n,f),this.bidiCache=bp.update(this.bidiCache,n.changes),n.empty||(this.updatePlugins(n),this.inputState.update(n)),i=this.docView.update(n),this.state.facet(su)!=this.styleModules&&this.mountStyles(),r=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(i,e.some(d=>d.isUserEvent("select.pointer")))}finally{this.updateState=0}if(n.startState.facet(ep)!=n.state.facet(ep)&&(this.viewState.mustMeasureContent=!0),(i||r||f||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),i&&this.docViewUpdate(),!n.empty)for(let d of this.state.facet(R1))try{d(n)}catch(p){oi(this.state,p,"update listener")}(l||u)&&Promise.resolve().then(()=>{l&&this.state==l.startState&&this.dispatch(l),u&&!WC(this,u)&&c.force&&tl(this.contentDOM,c.key,c.keyCode)})}setState(e){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=e;return}this.updateState=2;let i=this.hasFocus;try{for(let r of this.plugins)r.destroy(this);this.viewState=new mp(e),this.plugins=e.facet(ou).map(r=>new du(r)),this.pluginMap.clear();for(let r of this.plugins)r.update(this);this.docView.destroy(),this.docView=new dp(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}i&&this.focus(),this.requestMeasure()}updatePlugins(e){let i=e.startState.facet(ou),r=e.state.facet(ou);if(i!=r){let n=[];for(let o of r){let s=i.indexOf(o);if(s<0)n.push(new du(o));else{let a=this.plugins[s];a.mustUpdate=e,n.push(a)}}for(let o of this.plugins)o.mustUpdate!=e&&o.destroy(this);this.plugins=n,this.pluginMap.clear()}else for(let n of this.plugins)n.mustUpdate=e;for(let n=0;n-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let i=null,r=this.scrollDOM,n=r.scrollTop*this.scaleY,{scrollAnchorPos:o,scrollAnchorHeight:s}=this.viewState;Math.abs(n-this.viewState.scrollTop)>1&&(s=-1),this.viewState.scrollAnchorHeight=-1;try{for(let a=0;;a++){if(s<0)if(eC(r))o=-1,s=this.viewState.heightMap.height;else{let p=this.viewState.scrollAnchorAt(n);o=p.from,s=p.top}this.updateState=1;let l=this.viewState.measure(this);if(!l&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(a>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let c=[];l&4||([this.measureRequests,c]=[c,this.measureRequests]);let u=c.map(p=>{try{return p.read(this)}catch(g){return oi(this.state,g),N5}}),f=hp.create(this,this.state,[]),d=!1;f.flags|=l,i?i.flags|=l:i=f,this.updateState=2,f.empty||(this.updatePlugins(f),this.inputState.update(f),this.updateAttrs(),d=this.docView.update(f),d&&this.docViewUpdate());for(let p=0;p1||g<-1){n=n+g,r.scrollTop=n/this.scaleY,s=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(i&&!i.empty)for(let a of this.state.facet(R1))a(i)}get themeClasses(){return Y1+" "+(this.state.facet(V1)?jC:zC)+" "+this.state.facet(ep)}updateAttrs(){let e=M5(this,TC,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),i={spellcheck:"false",autocorrect:"off",autocapitalize:"off",translate:"no",contenteditable:this.state.facet(Tp)?"true":"false",class:"cm-content",style:`${Te.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(i["aria-readonly"]="true"),M5(this,py,i);let r=this.observer.ignore(()=>{let n=P1(this.contentDOM,this.contentAttrs,i),o=P1(this.dom,this.editorAttrs,e);return n||o});return this.editorAttrs=e,this.contentAttrs=i,r}showAnnouncements(e){let i=!0;for(let r of e)for(let n of r.effects)if(n.is(t.announce)){i&&(this.announceDOM.textContent=""),i=!1;let o=this.announceDOM.appendChild(document.createElement("div"));o.textContent=n.value}}mountStyles(){this.styleModules=this.state.facet(su);let e=this.state.facet(t.cspNonce);zi.mount(this.root,this.styleModules.concat(lW).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(this.measureRequests.indexOf(e)>-1)return;if(e.key!=null){for(let i=0;ir.spec==e)||null),i&&i.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,i,r){return b1(this,e,k5(this,e,i,r))}moveByGroup(e,i){return b1(this,e,k5(this,e,i,r=>Mq(this,e.head,r)))}visualLineSide(e,i){let r=this.bidiSpans(e),n=this.textDirectionAt(e.from),o=r[i?r.length-1:0];return J.cursor(o.side(i,n)+e.from,o.forward(!i,n)?1:-1)}moveToLineBoundary(e,i,r=!0){return Nq(this,e,i,r)}moveVertically(e,i,r){return b1(this,e,Uq(this,e,i,r))}domAtPos(e){return this.docView.domAtPos(e)}posAtDOM(e,i=0){return this.docView.posFromDOM(e,i)}posAtCoords(e,i=!0){return this.readMeasured(),AC(this,e,i)}coordsAtPos(e,i=1){this.readMeasured();let r=this.docView.coordsAt(e,i);if(!r||r.left==r.right)return r;let n=this.state.doc.lineAt(e),o=this.bidiSpans(n),s=o[on.find(o,e-n.from,-1,i)];return uy(r,s.dir==ot.LTR==i>0)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(wC)||ethis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>mW)return pC(e.length);let i=this.textDirectionAt(e.from),r;for(let o of this.bidiCache)if(o.from==e.from&&o.dir==i&&(o.fresh||dC(o.isolates,r=b5(this,e))))return o.order;r||(r=b5(this,e));let n=wq(e.text,i,r);return this.bidiCache.push(new bp(e.from,e.to,i,r,!0,n)),n}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||Te.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{K5(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((e.nodeType==9?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,i={}){return Fd.of(new hu(typeof e=="number"?J.cursor(e):e,i.y,i.x,i.yMargin,i.xMargin))}scrollSnapshot(){let{scrollTop:e,scrollLeft:i}=this.scrollDOM,r=this.viewState.scrollAnchorAt(e);return Fd.of(new hu(J.cursor(r.from),"start","start",r.top-e,i,!0))}static domEventHandlers(e){return Ye.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return Ye.define(()=>({}),{eventObservers:e})}static theme(e,i){let r=zi.newName(),n=[ep.of(r),su.of(F1(`.${r}`,e))];return i&&i.dark&&n.push(V1.of(!0)),n}static baseTheme(e){return Qt.lowest(su.of(F1("."+Y1,e,qC)))}static findFromDOM(e){var i;let r=e.querySelector(".cm-content"),n=r&>.get(r)||gt.get(e);return((i=n==null?void 0:n.rootView)===null||i===void 0?void 0:i.view)||null}};de.styleModule=su;de.inputHandler=xC;de.scrollHandler=SC;de.focusChangeEffect=vC;de.perLineTextDirection=wC;de.exceptionSink=yC;de.updateListener=R1;de.editable=Tp;de.mouseSelectionStyle=bC;de.dragMovesSelection=gC;de.clickAddsSelectionRange=mC;de.decorations=wu;de.outerDecorations=EC;de.atomicRanges=Oy;de.bidiIsolatedRanges=CC;de.scrollMargins=_C;de.darkTheme=V1;de.cspNonce=be.define({combine:t=>t.length?t[0]:""});de.contentAttributes=py;de.editorAttributes=TC;de.lineWrapping=de.contentAttributes.of({class:"cm-lineWrapping"});de.announce=Se.define();var mW=4096,N5={},bp=class t{constructor(e,i,r,n,o,s){this.from=e,this.to=i,this.dir=r,this.isolates=n,this.fresh=o,this.order=s}static update(e,i){if(i.empty&&!e.some(o=>o.fresh))return e;let r=[],n=e.length?e[e.length-1].dir:ot.LTR;for(let o=Math.max(0,e.length-10);o=0;n--){let o=r[n],s=typeof o=="function"?o(t):o;s&&_1(s,i)}return i}var gW=Te.mac?"mac":Te.windows?"win":Te.linux?"linux":"key";function bW(t,e){let i=t.split(/-(?!$)/),r=i[i.length-1];r=="Space"&&(r=" ");let n,o,s,a;for(let l=0;lr.concat(n),[]))),i}function my(t,e,i){return ZC(BC(t.state),e,t,i)}var Ro=null,xW=4e3;function vW(t,e=gW){let i=Object.create(null),r=Object.create(null),n=(s,a)=>{let l=r[s];if(l==null)r[s]=a;else if(l!=a)throw new Error("Key binding "+s+" is used both as a regular binding and as a multi-stroke prefix")},o=(s,a,l,c,u)=>{var f,d;let p=i[s]||(i[s]=Object.create(null)),g=a.split(/ (?!$)/).map(S=>bW(S,e));for(let S=1;S{let I=Ro={view:A,prefix:T,scope:s};return setTimeout(()=>{Ro==I&&(Ro=null)},xW),!0}]})}let x=g.join(" ");n(x,!1);let w=p[x]||(p[x]={preventDefault:!1,stopPropagation:!1,run:((d=(f=p._any)===null||f===void 0?void 0:f.run)===null||d===void 0?void 0:d.slice())||[]});l&&w.run.push(l),c&&(w.preventDefault=!0),u&&(w.stopPropagation=!0)};for(let s of t){let a=s.scope?s.scope.split(" "):["editor"];if(s.any)for(let c of a){let u=i[c]||(i[c]=Object.create(null));u._any||(u._any={preventDefault:!1,stopPropagation:!1,run:[]});for(let f in u)u[f].run.push(s.any)}let l=s[e]||s.key;if(l)for(let c of a)o(c,l,s.run,s.preventDefault,s.stopPropagation),s.shift&&o(c,"Shift-"+l,s.shift,s.preventDefault,s.stopPropagation)}return i}function ZC(t,e,i,r){let n=u5(e),o=Nt(n,0),s=Pi(o)==n.length&&n!=" ",a="",l=!1,c=!1,u=!1;Ro&&Ro.view==i&&Ro.scope==r&&(a=Ro.prefix+" ",XC.indexOf(e.keyCode)<0&&(c=!0,Ro=null));let f=new Set,d=w=>{if(w){for(let S of w.run)if(!f.has(S)&&(f.add(S),S(i,e)))return w.stopPropagation&&(u=!0),!0;w.preventDefault&&(w.stopPropagation&&(u=!0),c=!0)}return!1},p=t[r],g,x;return p&&(d(p[a+tp(n,e,!s)])?l=!0:s&&(e.altKey||e.metaKey||e.ctrlKey)&&!(Te.windows&&e.ctrlKey&&e.altKey)&&(g=qn[e.keyCode])&&g!=n?(d(p[a+tp(g,e,!0)])||e.shiftKey&&(x=Ha[e.keyCode])!=n&&x!=g&&d(p[a+tp(x,e,!1)]))&&(l=!0):s&&e.shiftKey&&d(p[a+tp(n,e,!0)])&&(l=!0),!l&&d(p._any)&&(l=!0)),c&&(l=!0),l&&u&&e.stopPropagation(),l}var ku=class t{constructor(e,i,r,n,o){this.className=e,this.left=i,this.top=r,this.width=n,this.height=o}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}update(e,i){return i.className!=this.className?!1:(this.adjust(e),!0)}adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",this.width!=null&&(e.style.width=this.width+"px"),e.style.height=this.height+"px"}eq(e){return this.left==e.left&&this.top==e.top&&this.width==e.width&&this.height==e.height&&this.className==e.className}static forRange(e,i,r){if(r.empty){let n=e.coordsAtPos(r.head,r.assoc||1);if(!n)return[];let o=VC(e);return[new t(i,n.left-o.left,n.top-o.top,null,n.bottom-n.top)]}else return wW(e,i,r)}};function VC(t){let e=t.scrollDOM.getBoundingClientRect();return{left:(t.textDirection==ot.LTR?e.left:e.right-t.scrollDOM.clientWidth*t.scaleX)-t.scrollDOM.scrollLeft*t.scaleX,top:e.top-t.scrollDOM.scrollTop*t.scaleY}}function z5(t,e,i){let r=J.cursor(e);return{from:Math.max(i.from,t.moveToLineBoundary(r,!1,!0).from),to:Math.min(i.to,t.moveToLineBoundary(r,!0,!0).from),type:Xi.Text}}function wW(t,e,i){if(i.to<=t.viewport.from||i.from>=t.viewport.to)return[];let r=Math.max(i.from,t.viewport.from),n=Math.min(i.to,t.viewport.to),o=t.textDirection==ot.LTR,s=t.contentDOM,a=s.getBoundingClientRect(),l=VC(t),c=s.querySelector(".cm-line"),u=c&&window.getComputedStyle(c),f=a.left+(u?parseInt(u.paddingLeft)+Math.min(0,parseInt(u.textIndent)):0),d=a.right-(u?parseInt(u.paddingRight):0),p=L1(t,r),g=L1(t,n),x=p.type==Xi.Text?p:null,w=g.type==Xi.Text?g:null;if(x&&(t.lineWrapping||p.widgetLineBreaks)&&(x=z5(t,r,x)),w&&(t.lineWrapping||g.widgetLineBreaks)&&(w=z5(t,n,w)),x&&w&&x.from==w.from)return T(A(i.from,i.to,x));{let D=x?A(i.from,null,x):I(p,!1),C=w?A(null,i.to,w):I(g,!0),j=[];return(x||p).to<(w||g).from-(x&&w?1:0)||p.widgetLineBreaks>1&&D.bottom+t.defaultLineHeight/2ue&&he.from=ve)break;E>me&&ae(Math.max(V,me),D==null&&V<=ue,Math.min(E,ve),C==null&&E>=ie,le.dir)}if(me=q.to+1,me>=ve)break}return U.length==0&&ae(ue,D==null,ie,C==null,t.textDirection),{top:se,bottom:F,horizontal:U}}function I(D,C){let j=a.top+(C?D.top:D.bottom);return{top:j,bottom:j,horizontal:[]}}}function kW(t,e){return t.constructor==e.constructor&&t.eq(e)}var J1=class{constructor(e,i){this.view=e,this.layer=i,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=e.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),i.above&&this.dom.classList.add("cm-layer-above"),i.class&&this.dom.classList.add(i.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(e.state),e.requestMeasure(this.measureReq),i.mount&&i.mount(this.dom,e)}update(e){e.startState.facet(sp)!=e.state.facet(sp)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&(this.scale(),e.view.requestMeasure(this.measureReq))}docViewUpdate(e){this.layer.updateOnDocViewUpdate!==!1&&e.requestMeasure(this.measureReq)}setOrder(e){let i=0,r=e.facet(sp);for(;i!kW(i,this.drawn[r]))){let i=this.dom.firstChild,r=0;for(let n of e)n.update&&i&&n.constructor&&this.drawn[r].constructor&&n.update(i,this.drawn[r])?(i=i.nextSibling,r++):this.dom.insertBefore(n.draw(),i);for(;i;){let n=i.nextSibling;i.remove(),i=n}this.drawn=e}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}},sp=be.define();function YC(t){return[Ye.define(e=>new J1(e,t)),sp.of(t)]}var FC=!Te.ios,rl=be.define({combine(t){return wt(t,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,i)=>Math.min(e,i),drawRangeCursor:(e,i)=>e||i})}});function HC(t={}){return[rl.of(t),SW,TW,EW,kC.of(!0)]}function GC(t){return t.facet(rl)}function KC(t){return t.startState.facet(rl)!=t.state.facet(rl)}var SW=YC({above:!0,markers(t){let{state:e}=t,i=e.facet(rl),r=[];for(let n of e.selection.ranges){let o=n==e.selection.main;if(n.empty?!o||FC:i.drawRangeCursor){let s=o?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",a=n.empty?n:J.cursor(n.head,n.head>n.anchor?-1:1);for(let l of ku.forRange(t,s,a))r.push(l)}}return r},update(t,e){t.transactions.some(r=>r.selection)&&(e.style.animationName=e.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let i=KC(t);return i&&j5(t.state,e),t.docChanged||t.selectionSet||i},mount(t,e){j5(e.state,t)},class:"cm-cursorLayer"});function j5(t,e){e.style.animationDuration=t.facet(rl).cursorBlinkRate+"ms"}var TW=YC({above:!1,markers(t){return t.state.selection.ranges.map(e=>e.empty?[]:ku.forRange(t,"cm-selectionBackground",e)).reduce((e,i)=>e.concat(i))},update(t,e){return t.docChanged||t.selectionSet||t.viewportChanged||KC(t)},class:"cm-selectionLayer"}),ey={".cm-line":{"& ::selection":{backgroundColor:"transparent !important"},"&::selection":{backgroundColor:"transparent !important"}}};FC&&(ey[".cm-line"].caretColor="transparent !important",ey[".cm-content"]={caretColor:"transparent !important"});var EW=Qt.highest(de.theme(ey)),JC=Se.define({map(t,e){return t==null?null:e.mapPos(t)}}),cu=Fe.define({create(){return null},update(t,e){return t!=null&&(t=e.changes.mapPos(t)),e.effects.reduce((i,r)=>r.is(JC)?r.value:i,t)}}),CW=Ye.fromClass(class{constructor(t){this.view=t,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(t){var e;let i=t.state.field(cu);i==null?this.cursor!=null&&((e=this.cursor)===null||e===void 0||e.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(t.startState.field(cu)!=i||t.docChanged||t.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:t}=this,e=t.state.field(cu),i=e!=null&&t.coordsAtPos(e);if(!i)return null;let r=t.scrollDOM.getBoundingClientRect();return{left:i.left-r.left+t.scrollDOM.scrollLeft*t.scaleX,top:i.top-r.top+t.scrollDOM.scrollTop*t.scaleY,height:i.bottom-i.top}}drawCursor(t){if(this.cursor){let{scaleX:e,scaleY:i}=this.view;t?(this.cursor.style.left=t.left/e+"px",this.cursor.style.top=t.top/i+"px",this.cursor.style.height=t.height/i+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(t){this.view.state.field(cu)!=t&&this.view.dispatch({effects:JC.of(t)})}},{eventObservers:{dragover(t){this.setDropPos(this.view.posAtCoords({x:t.clientX,y:t.clientY}))},dragleave(t){(t.target==this.view.contentDOM||!this.view.contentDOM.contains(t.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function e_(){return[cu,CW]}function q5(t,e,i,r,n){e.lastIndex=0;for(let o=t.iterRange(i,r),s=i,a;!o.next().done;s+=o.value.length)if(!o.lineBreak)for(;a=e.exec(o.value);)n(s+a.index,a)}function _W(t,e){let i=t.visibleRanges;if(i.length==1&&i[0].from==t.viewport.from&&i[0].to==t.viewport.to)return i;let r=[];for(let{from:n,to:o}of i)n=Math.max(t.state.doc.lineAt(n).from,n-e),o=Math.min(t.state.doc.lineAt(o).to,o+e),r.length&&r[r.length-1].to>=n?r[r.length-1].to=o:r.push({from:n,to:o});return r}var ty=class{constructor(e){let{regexp:i,decoration:r,decorate:n,boundary:o,maxLength:s=1e3}=e;if(!i.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=i,n)this.addMatch=(a,l,c,u)=>n(u,c,c+a[0].length,a,l);else if(typeof r=="function")this.addMatch=(a,l,c,u)=>{let f=r(a,l,c);f&&u(c,c+a[0].length,f)};else if(r)this.addMatch=(a,l,c,u)=>u(c,c+a[0].length,r);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=o,this.maxLength=s}createDeco(e){let i=new Ki,r=i.add.bind(i);for(let{from:n,to:o}of _W(e,this.maxLength))q5(e.state.doc,this.regexp,n,o,(s,a)=>this.addMatch(a,e,s,r));return i.finish()}updateDeco(e,i){let r=1e9,n=-1;return e.docChanged&&e.changes.iterChanges((o,s,a,l)=>{l>e.view.viewport.from&&a1e3?this.createDeco(e.view):n>-1?this.updateRange(e.view,i.map(e.changes),r,n):i}updateRange(e,i,r,n){for(let o of e.visibleRanges){let s=Math.max(o.from,r),a=Math.min(o.to,n);if(a>s){let l=e.state.doc.lineAt(s),c=l.tol.from;s--)if(this.boundary.test(l.text[s-1-l.from])){u=s;break}for(;ad.push(S.range(x,w));if(l==c)for(this.regexp.lastIndex=u-l.from;(p=this.regexp.exec(l.text))&&p.indexthis.addMatch(w,e,x,g));i=i.update({filterFrom:u,filterTo:f,filter:(x,w)=>xf,add:d})}}return i}},iy=/x/.unicode!=null?"gu":"g",PW=new RegExp(`[\0-\b + `&&t.lineWrapping&&(r&&(r=J.single(r.main.anchor-1,r.main.head-1)),i={from:n.from,to:n.to,insert:He.of([" "])}),i){if(Te.ios&&t.inputState.flushIOSKey(i)||Te.android&&(i.to==n.to&&(i.from==n.from||i.from==n.from-1&&t.state.sliceDoc(i.from,n.from)==" ")&&i.insert.length==1&&i.insert.lines==2&&tl(t.contentDOM,"Enter",13)||(i.from==n.from-1&&i.to==n.to&&i.insert.length==0||o==8&&i.insert.lengthn.head)&&tl(t.contentDOM,"Backspace",8)||i.from==n.from&&i.to==n.to+1&&i.insert.length==0&&tl(t.contentDOM,"Delete",46)))return!0;let s=i.insert.toString();t.inputState.composing>=0&&t.inputState.composing++;let a,l=()=>a||(a=uW(t,i,r));return t.state.facet(xC).some(c=>c(t,i.from,i.to,s,l))||t.dispatch(l()),!0}else if(r&&!r.main.eq(n)){let s=!1,a="select";return t.inputState.lastSelectionTime>Date.now()-50&&(t.inputState.lastSelectionOrigin=="select"&&(s=!0),a=t.inputState.lastSelectionOrigin),t.dispatch({selection:r,scrollIntoView:s,userEvent:a}),!0}else return!1}function uW(t,e,i){let r,n=t.state,o=n.selection.main;if(e.from>=o.from&&e.to<=o.to&&e.to-e.from>=(o.to-o.from)/3&&(!i||i.main.empty&&i.main.from==e.from+e.insert.length)&&t.inputState.composing<0){let a=o.frome.to?n.sliceDoc(e.to,o.to):"";r=n.replaceSelection(t.state.toText(a+e.insert.sliceString(0,void 0,t.state.lineBreak)+l))}else{let a=n.changes(e),l=i&&i.main.to<=a.newLength?i.main:void 0;if(n.selection.ranges.length>1&&t.inputState.composing>=0&&e.to<=o.to&&e.to>=o.to-10){let c=t.state.sliceDoc(e.from,e.to),u,f=i&&QC(t,i.main.head);if(f){let g=e.insert.length-(e.to-e.from);u={from:f.from,to:f.to-g}}else u=t.state.doc.lineAt(o.head);let d=o.to-e.to,p=o.to-o.from;r=n.changeByRange(g=>{if(g.from==o.from&&g.to==o.to)return{changes:a,range:l||g.map(a)};let x=g.to-d,w=x-c.length;if(g.to-g.from!=p||t.state.sliceDoc(w,x)!=c||g.to>=u.from&&g.from<=u.to)return{range:g};let S=n.changes({from:w,to:x,insert:e.insert}),T=g.to-o.to;return{changes:S,range:l?J.range(Math.max(0,l.anchor+T),Math.max(0,l.head+T)):g.map(S)}})}else r={changes:a,selection:l&&n.selection.replaceRange(l)}}let s="input.type";return(t.composing||t.inputState.compositionPendingChange&&t.inputState.compositionEndedAt>Date.now()-50)&&(t.inputState.compositionPendingChange=!1,s+=".compose",t.inputState.compositionFirstChange&&(s+=".start",t.inputState.compositionFirstChange=!1)),n.update(r,{userEvent:s,scrollIntoView:!0})}function fW(t,e,i,r){let n=Math.min(t.length,e.length),o=0;for(;o0&&a>0&&t.charCodeAt(s-1)==e.charCodeAt(a-1);)s--,a--;if(r=="end"){let l=Math.max(0,o-Math.min(s,a));i-=s+l-o}if(s=s?o-i:0;o-=l,a=o+(a-s),s=o}else if(a=a?o-i:0;o-=l,s=o+(s-a),a=o}return{from:o,toA:s,toB:a}}function hW(t){let e=[];if(t.root.activeElement!=t.contentDOM)return e;let{anchorNode:i,anchorOffset:r,focusNode:n,focusOffset:o}=t.observer.selectionRange;return i&&(e.push(new gp(i,r)),(n!=i||o!=r)&&e.push(new gp(n,o))),e}function dW(t,e){if(t.length==0)return null;let i=t[0].pos,r=t.length==2?t[1].pos:i;return i>-1&&r>-1?J.single(i+e,r+e):null}var pW={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},y1=Te.ie&&Te.ie_version<=11,K1=class{constructor(e){this.view=e,this.active=!1,this.selectionRange=new S1,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(i=>{for(let r of i)this.queue.push(r);(Te.ie&&Te.ie_version<=11||Te.ios&&e.composing)&&i.some(r=>r.type=="childList"&&r.removedNodes.length||r.type=="characterData"&&r.oldValue.length>r.target.nodeValue.length)?this.flushSoon():this.flush()}),y1&&(this.onCharData=i=>{this.queue.push({target:i.target,type:"characterData",oldValue:i.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var i;((i=this.view.docView)===null||i===void 0?void 0:i.lastUpdate){this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),i.length>0&&i[i.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(i=>{i.length>0&&i[i.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(e){e.type=="change"&&!e.matches||(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((i,r)=>i!=e[r]))){this.gapIntersection.disconnect();for(let i of e)this.gapIntersection.observe(i);this.gaps=e}}onSelectionChange(e){let i=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:r}=this,n=this.selectionRange;if(r.state.facet(Tp)?r.root.activeElement!=this.dom:!rp(r.dom,n))return;let o=n.anchorNode&&r.docView.nearest(n.anchorNode);if(o&&o.ignoreEvent(e)){i||(this.selectionChanged=!1);return}(Te.ie&&Te.ie_version<=11||Te.android&&Te.chrome)&&!r.state.selection.main.empty&&n.focusNode&&uu(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,i=cp(e.root);if(!i)return!1;let r=Te.safari&&e.root.nodeType==11&&oq(this.dom.ownerDocument)==this.dom&&OW(this.view,i)||i;if(!r||this.selectionRange.eq(r))return!1;let n=rp(this.dom,r);return n&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime{let o=this.delayedAndroidKey;o&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=o.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&o.force&&tl(this.dom,o.key,o.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(n)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:i,force:this.lastChange{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let i=-1,r=-1,n=!1;for(let o of e){let s=this.readMutation(o);s&&(s.typeOver&&(n=!0),i==-1?{from:i,to:r}=s:(i=Math.min(s.from,i),r=Math.max(s.to,r)))}return{from:i,to:r,typeOver:n}}readChange(){let{from:e,to:i,typeOver:r}=this.processRecords(),n=this.selectionChanged&&rp(this.dom,this.selectionRange);if(e<0&&!n)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let o=new G1(this.view,e,i,r);return this.view.docView.domChanged={newSel:o.newSel?o.newSel.main:null},o}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let i=this.readChange();if(!i)return this.view.requestMeasure(),!1;let r=this.view.state,n=WC(this.view,i);return this.view.state==r&&this.view.update([]),n}readMutation(e){let i=this.view.docView.nearest(e.target);if(!i||i.ignoreMutation(e))return null;if(i.markDirty(e.type=="attributes"),e.type=="attributes"&&(i.flags|=4),e.type=="childList"){let r=L5(i,e.previousSibling||e.target.previousSibling,-1),n=L5(i,e.nextSibling||e.target.nextSibling,1);return{from:r?i.posAfter(r):i.posAtStart,to:n?i.posBefore(n):i.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:i.posAtStart,to:i.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener("change",this.onPrint):e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener("change",this.onPrint):e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}destroy(){var e,i,r;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(i=this.gapIntersection)===null||i===void 0||i.disconnect(),(r=this.resizeScroll)===null||r===void 0||r.disconnect();for(let n of this.scrollTargets)n.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey)}};function L5(t,e,i){for(;e;){let r=gt.get(e);if(r&&r.parent==t)return r;let n=e.parentNode;e=n!=t.dom?n:i>0?e.nextSibling:e.previousSibling}return null}function D5(t,e){let i=e.startContainer,r=e.startOffset,n=e.endContainer,o=e.endOffset,s=t.docView.domAtPos(t.state.selection.main.anchor);return uu(s.node,s.offset,n,o)&&([i,r,n,o]=[n,o,i,r]),{anchorNode:i,anchorOffset:r,focusNode:n,focusOffset:o}}function OW(t,e){if(e.getComposedRanges){let n=e.getComposedRanges(t.root)[0];if(n)return D5(t,n)}let i=null;function r(n){n.preventDefault(),n.stopImmediatePropagation(),i=n.getTargetRanges()[0]}return t.contentDOM.addEventListener("beforeinput",r,!0),t.dom.ownerDocument.execCommand("indent"),t.contentDOM.removeEventListener("beforeinput",r,!0),i?D5(t,i):null}var de=class t{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return this.inputState.composing>0}get compositionStarted(){return this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:i}=e;this.dispatchTransactions=e.dispatchTransactions||i&&(r=>r.forEach(n=>i(n,this)))||(r=>this.update(r)),this.dispatch=this.dispatch.bind(this),this._root=e.root||cq(e.parent)||document,this.viewState=new mp(e.state||rt.create(e)),e.scrollTo&&e.scrollTo.is(Fd)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(ou).map(r=>new du(r));for(let r of this.plugins)r.update(this);this.observer=new K1(this),this.inputState=new D1(this),this.inputState.ensureHandlers(this.plugins),this.docView=new dp(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure()}dispatch(...e){let i=e.length==1&&e[0]instanceof Et?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(i,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let i=!1,r=!1,n,o=this.state;for(let d of e){if(d.startState!=o)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");o=d.state}if(this.destroyed){this.viewState.state=o;return}let s=this.hasFocus,a=0,l=null;e.some(d=>d.annotation(NC))?(this.inputState.notifiedFocused=s,a=1):s!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=s,l=MC(o,s),l||(a=1));let c=this.observer.delayedAndroidKey,u=null;if(c?(this.observer.clearDelayedAndroidKey(),u=this.observer.readChange(),(u&&!this.state.doc.eq(o.doc)||!this.state.selection.eq(o.selection))&&(u=null)):this.observer.clear(),o.facet(rt.phrases)!=this.state.facet(rt.phrases))return this.setState(o);n=hp.create(this,o,e),n.flags|=a;let f=this.viewState.scrollTarget;try{this.updateState=2;for(let d of e){if(f&&(f=f.map(d.changes)),d.scrollIntoView){let{main:p}=d.state.selection;f=new hu(p.empty?p:J.cursor(p.head,p.head>p.anchor?-1:1))}for(let p of d.effects)p.is(Fd)&&(f=p.value.clip(this.state))}this.viewState.update(n,f),this.bidiCache=bp.update(this.bidiCache,n.changes),n.empty||(this.updatePlugins(n),this.inputState.update(n)),i=this.docView.update(n),this.state.facet(su)!=this.styleModules&&this.mountStyles(),r=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(i,e.some(d=>d.isUserEvent("select.pointer")))}finally{this.updateState=0}if(n.startState.facet(ep)!=n.state.facet(ep)&&(this.viewState.mustMeasureContent=!0),(i||r||f||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),i&&this.docViewUpdate(),!n.empty)for(let d of this.state.facet(R1))try{d(n)}catch(p){oi(this.state,p,"update listener")}(l||u)&&Promise.resolve().then(()=>{l&&this.state==l.startState&&this.dispatch(l),u&&!WC(this,u)&&c.force&&tl(this.contentDOM,c.key,c.keyCode)})}setState(e){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=e;return}this.updateState=2;let i=this.hasFocus;try{for(let r of this.plugins)r.destroy(this);this.viewState=new mp(e),this.plugins=e.facet(ou).map(r=>new du(r)),this.pluginMap.clear();for(let r of this.plugins)r.update(this);this.docView.destroy(),this.docView=new dp(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}i&&this.focus(),this.requestMeasure()}updatePlugins(e){let i=e.startState.facet(ou),r=e.state.facet(ou);if(i!=r){let n=[];for(let o of r){let s=i.indexOf(o);if(s<0)n.push(new du(o));else{let a=this.plugins[s];a.mustUpdate=e,n.push(a)}}for(let o of this.plugins)o.mustUpdate!=e&&o.destroy(this);this.plugins=n,this.pluginMap.clear()}else for(let n of this.plugins)n.mustUpdate=e;for(let n=0;n-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let i=null,r=this.scrollDOM,n=r.scrollTop*this.scaleY,{scrollAnchorPos:o,scrollAnchorHeight:s}=this.viewState;Math.abs(n-this.viewState.scrollTop)>1&&(s=-1),this.viewState.scrollAnchorHeight=-1;try{for(let a=0;;a++){if(s<0)if(eC(r))o=-1,s=this.viewState.heightMap.height;else{let p=this.viewState.scrollAnchorAt(n);o=p.from,s=p.top}this.updateState=1;let l=this.viewState.measure(this);if(!l&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(a>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let c=[];l&4||([this.measureRequests,c]=[c,this.measureRequests]);let u=c.map(p=>{try{return p.read(this)}catch(g){return oi(this.state,g),N5}}),f=hp.create(this,this.state,[]),d=!1;f.flags|=l,i?i.flags|=l:i=f,this.updateState=2,f.empty||(this.updatePlugins(f),this.inputState.update(f),this.updateAttrs(),d=this.docView.update(f),d&&this.docViewUpdate());for(let p=0;p1||g<-1){n=n+g,r.scrollTop=n/this.scaleY,s=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(i&&!i.empty)for(let a of this.state.facet(R1))a(i)}get themeClasses(){return Y1+" "+(this.state.facet(V1)?jC:zC)+" "+this.state.facet(ep)}updateAttrs(){let e=M5(this,TC,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),i={spellcheck:"false",autocorrect:"off",autocapitalize:"off",translate:"no",contenteditable:this.state.facet(Tp)?"true":"false",class:"cm-content",style:`${Te.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(i["aria-readonly"]="true"),M5(this,py,i);let r=this.observer.ignore(()=>{let n=P1(this.contentDOM,this.contentAttrs,i),o=P1(this.dom,this.editorAttrs,e);return n||o});return this.editorAttrs=e,this.contentAttrs=i,r}showAnnouncements(e){let i=!0;for(let r of e)for(let n of r.effects)if(n.is(t.announce)){i&&(this.announceDOM.textContent=""),i=!1;let o=this.announceDOM.appendChild(document.createElement("div"));o.textContent=n.value}}mountStyles(){this.styleModules=this.state.facet(su);let e=this.state.facet(t.cspNonce);zi.mount(this.root,this.styleModules.concat(lW).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(this.measureRequests.indexOf(e)>-1)return;if(e.key!=null){for(let i=0;ir.spec==e)||null),i&&i.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,i,r){return b1(this,e,k5(this,e,i,r))}moveByGroup(e,i){return b1(this,e,k5(this,e,i,r=>Mq(this,e.head,r)))}visualLineSide(e,i){let r=this.bidiSpans(e),n=this.textDirectionAt(e.from),o=r[i?r.length-1:0];return J.cursor(o.side(i,n)+e.from,o.forward(!i,n)?1:-1)}moveToLineBoundary(e,i,r=!0){return Nq(this,e,i,r)}moveVertically(e,i,r){return b1(this,e,Uq(this,e,i,r))}domAtPos(e){return this.docView.domAtPos(e)}posAtDOM(e,i=0){return this.docView.posFromDOM(e,i)}posAtCoords(e,i=!0){return this.readMeasured(),AC(this,e,i)}coordsAtPos(e,i=1){this.readMeasured();let r=this.docView.coordsAt(e,i);if(!r||r.left==r.right)return r;let n=this.state.doc.lineAt(e),o=this.bidiSpans(n),s=o[on.find(o,e-n.from,-1,i)];return uy(r,s.dir==ot.LTR==i>0)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(wC)||ethis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>mW)return pC(e.length);let i=this.textDirectionAt(e.from),r;for(let o of this.bidiCache)if(o.from==e.from&&o.dir==i&&(o.fresh||dC(o.isolates,r=b5(this,e))))return o.order;r||(r=b5(this,e));let n=wq(e.text,i,r);return this.bidiCache.push(new bp(e.from,e.to,i,r,!0,n)),n}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||Te.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{K5(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((e.nodeType==9?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,i={}){return Fd.of(new hu(typeof e=="number"?J.cursor(e):e,i.y,i.x,i.yMargin,i.xMargin))}scrollSnapshot(){let{scrollTop:e,scrollLeft:i}=this.scrollDOM,r=this.viewState.scrollAnchorAt(e);return Fd.of(new hu(J.cursor(r.from),"start","start",r.top-e,i,!0))}static domEventHandlers(e){return Ye.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return Ye.define(()=>({}),{eventObservers:e})}static theme(e,i){let r=zi.newName(),n=[ep.of(r),su.of(F1(`.${r}`,e))];return i&&i.dark&&n.push(V1.of(!0)),n}static baseTheme(e){return Qt.lowest(su.of(F1("."+Y1,e,qC)))}static findFromDOM(e){var i;let r=e.querySelector(".cm-content"),n=r&>.get(r)||gt.get(e);return((i=n==null?void 0:n.rootView)===null||i===void 0?void 0:i.view)||null}};de.styleModule=su;de.inputHandler=xC;de.scrollHandler=SC;de.focusChangeEffect=vC;de.perLineTextDirection=wC;de.exceptionSink=yC;de.updateListener=R1;de.editable=Tp;de.mouseSelectionStyle=bC;de.dragMovesSelection=gC;de.clickAddsSelectionRange=mC;de.decorations=wu;de.outerDecorations=EC;de.atomicRanges=Oy;de.bidiIsolatedRanges=CC;de.scrollMargins=_C;de.darkTheme=V1;de.cspNonce=be.define({combine:t=>t.length?t[0]:""});de.contentAttributes=py;de.editorAttributes=TC;de.lineWrapping=de.contentAttributes.of({class:"cm-lineWrapping"});de.announce=Se.define();var mW=4096,N5={},bp=class t{constructor(e,i,r,n,o,s){this.from=e,this.to=i,this.dir=r,this.isolates=n,this.fresh=o,this.order=s}static update(e,i){if(i.empty&&!e.some(o=>o.fresh))return e;let r=[],n=e.length?e[e.length-1].dir:ot.LTR;for(let o=Math.max(0,e.length-10);o=0;n--){let o=r[n],s=typeof o=="function"?o(t):o;s&&_1(s,i)}return i}var gW=Te.mac?"mac":Te.windows?"win":Te.linux?"linux":"key";function bW(t,e){let i=t.split(/-(?!$)/),r=i[i.length-1];r=="Space"&&(r=" ");let n,o,s,a;for(let l=0;lr.concat(n),[]))),i}function my(t,e,i){return ZC(BC(t.state),e,t,i)}var Ro=null,xW=4e3;function vW(t,e=gW){let i=Object.create(null),r=Object.create(null),n=(s,a)=>{let l=r[s];if(l==null)r[s]=a;else if(l!=a)throw new Error("Key binding "+s+" is used both as a regular binding and as a multi-stroke prefix")},o=(s,a,l,c,u)=>{var f,d;let p=i[s]||(i[s]=Object.create(null)),g=a.split(/ (?!$)/).map(S=>bW(S,e));for(let S=1;S{let I=Ro={view:A,prefix:T,scope:s};return setTimeout(()=>{Ro==I&&(Ro=null)},xW),!0}]})}let x=g.join(" ");n(x,!1);let w=p[x]||(p[x]={preventDefault:!1,stopPropagation:!1,run:((d=(f=p._any)===null||f===void 0?void 0:f.run)===null||d===void 0?void 0:d.slice())||[]});l&&w.run.push(l),c&&(w.preventDefault=!0),u&&(w.stopPropagation=!0)};for(let s of t){let a=s.scope?s.scope.split(" "):["editor"];if(s.any)for(let c of a){let u=i[c]||(i[c]=Object.create(null));u._any||(u._any={preventDefault:!1,stopPropagation:!1,run:[]});for(let f in u)u[f].run.push(s.any)}let l=s[e]||s.key;if(l)for(let c of a)o(c,l,s.run,s.preventDefault,s.stopPropagation),s.shift&&o(c,"Shift-"+l,s.shift,s.preventDefault,s.stopPropagation)}return i}function ZC(t,e,i,r){let n=u5(e),o=Nt(n,0),s=Pi(o)==n.length&&n!=" ",a="",l=!1,c=!1,u=!1;Ro&&Ro.view==i&&Ro.scope==r&&(a=Ro.prefix+" ",XC.indexOf(e.keyCode)<0&&(c=!0,Ro=null));let f=new Set,d=w=>{if(w){for(let S of w.run)if(!f.has(S)&&(f.add(S),S(i,e)))return w.stopPropagation&&(u=!0),!0;w.preventDefault&&(w.stopPropagation&&(u=!0),c=!0)}return!1},p=t[r],g,x;return p&&(d(p[a+tp(n,e,!s)])?l=!0:s&&(e.altKey||e.metaKey||e.ctrlKey)&&!(Te.windows&&e.ctrlKey&&e.altKey)&&(g=qn[e.keyCode])&&g!=n?(d(p[a+tp(g,e,!0)])||e.shiftKey&&(x=Ha[e.keyCode])!=n&&x!=g&&d(p[a+tp(x,e,!1)]))&&(l=!0):s&&e.shiftKey&&d(p[a+tp(n,e,!0)])&&(l=!0),!l&&d(p._any)&&(l=!0)),c&&(l=!0),l&&u&&e.stopPropagation(),l}var ku=class t{constructor(e,i,r,n,o){this.className=e,this.left=i,this.top=r,this.width=n,this.height=o}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}update(e,i){return i.className!=this.className?!1:(this.adjust(e),!0)}adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",this.width!=null&&(e.style.width=this.width+"px"),e.style.height=this.height+"px"}eq(e){return this.left==e.left&&this.top==e.top&&this.width==e.width&&this.height==e.height&&this.className==e.className}static forRange(e,i,r){if(r.empty){let n=e.coordsAtPos(r.head,r.assoc||1);if(!n)return[];let o=VC(e);return[new t(i,n.left-o.left,n.top-o.top,null,n.bottom-n.top)]}else return wW(e,i,r)}};function VC(t){let e=t.scrollDOM.getBoundingClientRect();return{left:(t.textDirection==ot.LTR?e.left:e.right-t.scrollDOM.clientWidth*t.scaleX)-t.scrollDOM.scrollLeft*t.scaleX,top:e.top-t.scrollDOM.scrollTop*t.scaleY}}function z5(t,e,i){let r=J.cursor(e);return{from:Math.max(i.from,t.moveToLineBoundary(r,!1,!0).from),to:Math.min(i.to,t.moveToLineBoundary(r,!0,!0).from),type:Xi.Text}}function wW(t,e,i){if(i.to<=t.viewport.from||i.from>=t.viewport.to)return[];let r=Math.max(i.from,t.viewport.from),n=Math.min(i.to,t.viewport.to),o=t.textDirection==ot.LTR,s=t.contentDOM,a=s.getBoundingClientRect(),l=VC(t),c=s.querySelector(".cm-line"),u=c&&window.getComputedStyle(c),f=a.left+(u?parseInt(u.paddingLeft)+Math.min(0,parseInt(u.textIndent)):0),d=a.right-(u?parseInt(u.paddingRight):0),p=L1(t,r),g=L1(t,n),x=p.type==Xi.Text?p:null,w=g.type==Xi.Text?g:null;if(x&&(t.lineWrapping||p.widgetLineBreaks)&&(x=z5(t,r,x)),w&&(t.lineWrapping||g.widgetLineBreaks)&&(w=z5(t,n,w)),x&&w&&x.from==w.from)return T(A(i.from,i.to,x));{let D=x?A(i.from,null,x):I(p,!1),C=w?A(null,i.to,w):I(g,!0),j=[];return(x||p).to<(w||g).from-(x&&w?1:0)||p.widgetLineBreaks>1&&D.bottom+t.defaultLineHeight/2ue&&he.from=ve)break;E>me&&ae(Math.max(V,me),D==null&&V<=ue,Math.min(E,ve),C==null&&E>=ie,le.dir)}if(me=q.to+1,me>=ve)break}return U.length==0&&ae(ue,D==null,ie,C==null,t.textDirection),{top:se,bottom:F,horizontal:U}}function I(D,C){let j=a.top+(C?D.top:D.bottom);return{top:j,bottom:j,horizontal:[]}}}function kW(t,e){return t.constructor==e.constructor&&t.eq(e)}var J1=class{constructor(e,i){this.view=e,this.layer=i,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=e.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),i.above&&this.dom.classList.add("cm-layer-above"),i.class&&this.dom.classList.add(i.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(e.state),e.requestMeasure(this.measureReq),i.mount&&i.mount(this.dom,e)}update(e){e.startState.facet(sp)!=e.state.facet(sp)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&(this.scale(),e.view.requestMeasure(this.measureReq))}docViewUpdate(e){this.layer.updateOnDocViewUpdate!==!1&&e.requestMeasure(this.measureReq)}setOrder(e){let i=0,r=e.facet(sp);for(;i!kW(i,this.drawn[r]))){let i=this.dom.firstChild,r=0;for(let n of e)n.update&&i&&n.constructor&&this.drawn[r].constructor&&n.update(i,this.drawn[r])?(i=i.nextSibling,r++):this.dom.insertBefore(n.draw(),i);for(;i;){let n=i.nextSibling;i.remove(),i=n}this.drawn=e}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}},sp=be.define();function YC(t){return[Ye.define(e=>new J1(e,t)),sp.of(t)]}var FC=!Te.ios,rl=be.define({combine(t){return wt(t,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,i)=>Math.min(e,i),drawRangeCursor:(e,i)=>e||i})}});function HC(t={}){return[rl.of(t),SW,TW,EW,kC.of(!0)]}function GC(t){return t.facet(rl)}function KC(t){return t.startState.facet(rl)!=t.state.facet(rl)}var SW=YC({above:!0,markers(t){let{state:e}=t,i=e.facet(rl),r=[];for(let n of e.selection.ranges){let o=n==e.selection.main;if(n.empty?!o||FC:i.drawRangeCursor){let s=o?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",a=n.empty?n:J.cursor(n.head,n.head>n.anchor?-1:1);for(let l of ku.forRange(t,s,a))r.push(l)}}return r},update(t,e){t.transactions.some(r=>r.selection)&&(e.style.animationName=e.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let i=KC(t);return i&&j5(t.state,e),t.docChanged||t.selectionSet||i},mount(t,e){j5(e.state,t)},class:"cm-cursorLayer"});function j5(t,e){e.style.animationDuration=t.facet(rl).cursorBlinkRate+"ms"}var TW=YC({above:!1,markers(t){return t.state.selection.ranges.map(e=>e.empty?[]:ku.forRange(t,"cm-selectionBackground",e)).reduce((e,i)=>e.concat(i))},update(t,e){return t.docChanged||t.selectionSet||t.viewportChanged||KC(t)},class:"cm-selectionLayer"}),ey={".cm-line":{"& ::selection":{backgroundColor:"transparent !important"},"&::selection":{backgroundColor:"transparent !important"}}};FC&&(ey[".cm-line"].caretColor="transparent !important",ey[".cm-content"]={caretColor:"transparent !important"});var EW=Qt.highest(de.theme(ey)),JC=Se.define({map(t,e){return t==null?null:e.mapPos(t)}}),cu=Fe.define({create(){return null},update(t,e){return t!=null&&(t=e.changes.mapPos(t)),e.effects.reduce((i,r)=>r.is(JC)?r.value:i,t)}}),CW=Ye.fromClass(class{constructor(t){this.view=t,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(t){var e;let i=t.state.field(cu);i==null?this.cursor!=null&&((e=this.cursor)===null||e===void 0||e.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(t.startState.field(cu)!=i||t.docChanged||t.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:t}=this,e=t.state.field(cu),i=e!=null&&t.coordsAtPos(e);if(!i)return null;let r=t.scrollDOM.getBoundingClientRect();return{left:i.left-r.left+t.scrollDOM.scrollLeft*t.scaleX,top:i.top-r.top+t.scrollDOM.scrollTop*t.scaleY,height:i.bottom-i.top}}drawCursor(t){if(this.cursor){let{scaleX:e,scaleY:i}=this.view;t?(this.cursor.style.left=t.left/e+"px",this.cursor.style.top=t.top/i+"px",this.cursor.style.height=t.height/i+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(t){this.view.state.field(cu)!=t&&this.view.dispatch({effects:JC.of(t)})}},{eventObservers:{dragover(t){this.setDropPos(this.view.posAtCoords({x:t.clientX,y:t.clientY}))},dragleave(t){(t.target==this.view.contentDOM||!this.view.contentDOM.contains(t.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function e_(){return[cu,CW]}function q5(t,e,i,r,n){e.lastIndex=0;for(let o=t.iterRange(i,r),s=i,a;!o.next().done;s+=o.value.length)if(!o.lineBreak)for(;a=e.exec(o.value);)n(s+a.index,a)}function _W(t,e){let i=t.visibleRanges;if(i.length==1&&i[0].from==t.viewport.from&&i[0].to==t.viewport.to)return i;let r=[];for(let{from:n,to:o}of i)n=Math.max(t.state.doc.lineAt(n).from,n-e),o=Math.min(t.state.doc.lineAt(o).to,o+e),r.length&&r[r.length-1].to>=n?r[r.length-1].to=o:r.push({from:n,to:o});return r}var ty=class{constructor(e){let{regexp:i,decoration:r,decorate:n,boundary:o,maxLength:s=1e3}=e;if(!i.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=i,n)this.addMatch=(a,l,c,u)=>n(u,c,c+a[0].length,a,l);else if(typeof r=="function")this.addMatch=(a,l,c,u)=>{let f=r(a,l,c);f&&u(c,c+a[0].length,f)};else if(r)this.addMatch=(a,l,c,u)=>u(c,c+a[0].length,r);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=o,this.maxLength=s}createDeco(e){let i=new Ki,r=i.add.bind(i);for(let{from:n,to:o}of _W(e,this.maxLength))q5(e.state.doc,this.regexp,n,o,(s,a)=>this.addMatch(a,e,s,r));return i.finish()}updateDeco(e,i){let r=1e9,n=-1;return e.docChanged&&e.changes.iterChanges((o,s,a,l)=>{l>e.view.viewport.from&&a1e3?this.createDeco(e.view):n>-1?this.updateRange(e.view,i.map(e.changes),r,n):i}updateRange(e,i,r,n){for(let o of e.visibleRanges){let s=Math.max(o.from,r),a=Math.min(o.to,n);if(a>s){let l=e.state.doc.lineAt(s),c=l.tol.from;s--)if(this.boundary.test(l.text[s-1-l.from])){u=s;break}for(;ad.push(S.range(x,w));if(l==c)for(this.regexp.lastIndex=u-l.from;(p=this.regexp.exec(l.text))&&p.indexthis.addMatch(w,e,x,g));i=i.update({filterFrom:u,filterTo:f,filter:(x,w)=>xf,add:d})}}return i}},iy=/x/.unicode!=null?"gu":"g",PW=new RegExp(`[\0-\b -\x7F-\x9F\xAD\u061C\u200B\u200E\u200F\u2028\u2029\u202D\u202E\u2066\u2067\u2069\uFEFF\uFFF9-\uFFFC]`,iy),QW={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"},x1=null;function AW(){var t;if(x1==null&&typeof document!="undefined"&&document.body){let e=document.body.style;x1=((t=e.tabSize)!==null&&t!==void 0?t:e.MozTabSize)!=null}return x1||!1}var ap=be.define({combine(t){let e=wt(t,{render:null,specialChars:PW,addSpecialChars:null});return(e.replaceTabs=!AW())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,iy)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,iy)),e}});function t_(t={}){return[ap.of(t),$W()]}var W5=null;function $W(){return W5||(W5=Ye.fromClass(class{constructor(t){this.view=t,this.decorations=we.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(t.state.facet(ap)),this.decorations=this.decorator.createDeco(t)}makeDecorator(t){return new ty({regexp:t.specialChars,decoration:(e,i,r)=>{let{doc:n}=i.state,o=Nt(e[0],0);if(o==9){let s=n.lineAt(r),a=i.state.tabSize,l=Ai(s.text,a,r-s.from);return we.replace({widget:new ny((a-l%a)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[o]||(this.decorationCache[o]=we.replace({widget:new ry(t,o)}))},boundary:t.replaceTabs?void 0:/[^]/})}update(t){let e=t.state.facet(ap);t.startState.facet(ap)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(t.view)):this.decorations=this.decorator.updateDeco(t,this.decorations)}},{decorations:t=>t.decorations}))}var XW="\u2022";function RW(t){return t>=32?XW:t==10?"\u2424":String.fromCharCode(9216+t)}var ry=class extends Ft{constructor(e,i){super(),this.options=e,this.code=i}eq(e){return e.code==this.code}toDOM(e){let i=RW(this.code),r=e.state.phrase("Control character")+" "+(QW[this.code]||"0x"+this.code.toString(16)),n=this.options.render&&this.options.render(this.code,r,i);if(n)return n;let o=document.createElement("span");return o.textContent=i,o.title=r,o.setAttribute("aria-label",r),o.className="cm-specialChar",o}ignoreEvent(){return!1}},ny=class extends Ft{constructor(e){super(),this.width=e}eq(e){return e.width==this.width}toDOM(){let e=document.createElement("span");return e.textContent=" ",e.className="cm-tab",e.style.width=this.width+"px",e}ignoreEvent(){return!1}};function i_(){return LW}var IW=we.line({class:"cm-activeLine"}),LW=Ye.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.docChanged||t.selectionSet)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=-1,i=[];for(let r of t.state.selection.ranges){let n=t.lineBlockAt(r.head);n.from>e&&(i.push(IW.range(n.from)),e=n.from)}return we.set(i)}},{decorations:t=>t.decorations});var oy=2e3;function DW(t,e,i){let r=Math.min(e.line,i.line),n=Math.max(e.line,i.line),o=[];if(e.off>oy||i.off>oy||e.col<0||i.col<0){let s=Math.min(e.off,i.off),a=Math.max(e.off,i.off);for(let l=r;l<=n;l++){let c=t.doc.line(l);c.length<=a&&o.push(J.range(c.from+s,c.to+a))}}else{let s=Math.min(e.col,i.col),a=Math.max(e.col,i.col);for(let l=r;l<=n;l++){let c=t.doc.line(l),u=Zd(c.text,s,t.tabSize,!0);if(u<0)o.push(J.cursor(c.to));else{let f=Zd(c.text,a,t.tabSize);o.push(J.range(c.from+u,c.from+f))}}}return o}function NW(t,e){let i=t.coordsAtPos(t.viewport.from);return i?Math.round(Math.abs((i.left-e)/t.defaultCharacterWidth)):-1}function B5(t,e){let i=t.posAtCoords({x:e.clientX,y:e.clientY},!1),r=t.state.doc.lineAt(i),n=i-r.from,o=n>oy?-1:n==r.length?NW(t,e.clientX):Ai(r.text,t.state.tabSize,i-r.from);return{line:r.number,col:o,off:n}}function MW(t,e){let i=B5(t,e),r=t.state.selection;return i?{update(n){if(n.docChanged){let o=n.changes.mapPos(n.startState.doc.line(i.line).from),s=n.state.doc.lineAt(o);i={line:s.number,col:i.col,off:Math.min(i.off,s.length)},r=r.map(n.changes)}},get(n,o,s){let a=B5(t,n);if(!a)return r;let l=DW(t.state,i,a);return l.length?s?J.create(l.concat(r.ranges)):J.create(l):r}}:null}function r_(t){let e=(t==null?void 0:t.eventFilter)||(i=>i.altKey&&i.button==0);return de.mouseSelectionStyle.of((i,r)=>e(r)?MW(i,r):null)}var UW={Alt:[18,t=>!!t.altKey],Control:[17,t=>!!t.ctrlKey],Shift:[16,t=>!!t.shiftKey],Meta:[91,t=>!!t.metaKey]},zW={style:"cursor: crosshair"};function n_(t={}){let[e,i]=UW[t.key||"Alt"],r=Ye.fromClass(class{constructor(n){this.view=n,this.isDown=!1}set(n){this.isDown!=n&&(this.isDown=n,this.view.update([]))}},{eventObservers:{keydown(n){this.set(n.keyCode==e||i(n))},keyup(n){(n.keyCode==e||!i(n))&&this.set(!1)},mousemove(n){this.set(i(n))}}});return[r,de.contentAttributes.of(n=>{var o;return!((o=n.plugin(r))===null||o===void 0)&&o.isDown?zW:null})]}var nu="-10000px",yp=class{constructor(e,i,r,n){this.facet=i,this.createTooltipView=r,this.removeTooltipView=n,this.input=e.state.facet(i),this.tooltips=this.input.filter(s=>s);let o=null;this.tooltipViews=this.tooltips.map(s=>o=r(s,o))}update(e,i){var r;let n=e.state.facet(this.facet),o=n.filter(l=>l);if(n===this.input){for(let l of this.tooltipViews)l.update&&l.update(e);return!1}let s=[],a=i?[]:null;for(let l=0;li[c]=l),i.length=a.length),this.input=n,this.tooltips=o,this.tooltipViews=s,!0}};function jW(t){let{win:e}=t;return{top:0,left:0,bottom:e.innerHeight,right:e.innerWidth}}var v1=be.define({combine:t=>{var e,i,r;return{position:Te.ios?"absolute":((e=t.find(n=>n.position))===null||e===void 0?void 0:e.position)||"fixed",parent:((i=t.find(n=>n.parent))===null||i===void 0?void 0:i.parent)||null,tooltipSpace:((r=t.find(n=>n.tooltipSpace))===null||r===void 0?void 0:r.tooltipSpace)||jW}}}),Z5=new WeakMap,gy=Ye.fromClass(class{constructor(t){this.view=t,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let e=t.state.facet(v1);this.position=e.position,this.parent=e.parent,this.classes=t.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver=typeof ResizeObserver=="function"?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new yp(t,Bn,(i,r)=>this.createTooltip(i,r),i=>{this.resizeObserver&&this.resizeObserver.unobserve(i.dom),i.dom.remove()}),this.above=this.manager.tooltips.map(i=>!!i.above),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(i=>{Date.now()>this.lastTransaction-50&&i.length>0&&i[i.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),t.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let t of this.manager.tooltipViews)this.intersectionObserver.observe(t.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(t){t.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(t,this.above);e&&this.observeIntersection();let i=e||t.geometryChanged,r=t.state.facet(v1);if(r.position!=this.position&&!this.madeAbsolute){this.position=r.position;for(let n of this.manager.tooltipViews)n.dom.style.position=this.position;i=!0}if(r.parent!=this.parent){this.parent&&this.container.remove(),this.parent=r.parent,this.createContainer();for(let n of this.manager.tooltipViews)this.container.appendChild(n.dom);i=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);i&&this.maybeMeasure()}createTooltip(t,e){let i=t.create(this.view),r=e?e.dom:null;if(i.dom.classList.add("cm-tooltip"),t.arrow&&!i.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let n=document.createElement("div");n.className="cm-tooltip-arrow",i.dom.appendChild(n)}return i.dom.style.position=this.position,i.dom.style.top=nu,i.dom.style.left="0px",this.container.insertBefore(i.dom,r),i.mount&&i.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(i.dom),i}destroy(){var t,e,i;this.view.win.removeEventListener("resize",this.measureSoon);for(let r of this.manager.tooltipViews)r.dom.remove(),(t=r.destroy)===null||t===void 0||t.call(r);this.parent&&this.container.remove(),(e=this.resizeObserver)===null||e===void 0||e.disconnect(),(i=this.intersectionObserver)===null||i===void 0||i.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let t=this.view.dom.getBoundingClientRect(),e=1,i=1,r=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:n}=this.manager.tooltipViews[0];if(Te.gecko)r=n.offsetParent!=this.container.ownerDocument.body;else if(n.style.top==nu&&n.style.left=="0px"){let o=n.getBoundingClientRect();r=Math.abs(o.top+1e4)>1||Math.abs(o.left)>1}}if(r||this.position=="absolute")if(this.parent){let n=this.parent.getBoundingClientRect();n.width&&n.height&&(e=n.width/this.parent.offsetWidth,i=n.height/this.parent.offsetHeight)}else({scaleX:e,scaleY:i}=this.view.viewState);return{editor:t,parent:this.parent?this.container.getBoundingClientRect():t,pos:this.manager.tooltips.map((n,o)=>{let s=this.manager.tooltipViews[o];return s.getCoords?s.getCoords(n.pos):this.view.coordsAtPos(n.pos)}),size:this.manager.tooltipViews.map(({dom:n})=>n.getBoundingClientRect()),space:this.view.state.facet(v1).tooltipSpace(this.view),scaleX:e,scaleY:i,makeAbsolute:r}}writeMeasure(t){var e;if(t.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let a of this.manager.tooltipViews)a.dom.style.position="absolute"}let{editor:i,space:r,scaleX:n,scaleY:o}=t,s=[];for(let a=0;a=Math.min(i.bottom,r.bottom)||f.rightMath.min(i.right,r.right)+.1){u.style.top=nu;continue}let p=l.arrow?c.dom.querySelector(".cm-tooltip-arrow"):null,g=p?7:0,x=d.right-d.left,w=(e=Z5.get(c))!==null&&e!==void 0?e:d.bottom-d.top,S=c.offset||WW,T=this.view.textDirection==ot.LTR,A=d.width>r.right-r.left?T?r.left:r.right-d.width:T?Math.min(f.left-(p?14:0)+S.x,r.right-x):Math.max(r.left,f.left-x+(p?14:0)-S.x),I=this.above[a];!l.strictSide&&(I?f.top-(d.bottom-d.top)-S.yr.bottom)&&I==r.bottom-f.bottom>f.top-r.top&&(I=this.above[a]=!I);let D=(I?f.top-r.top:r.bottom-f.bottom)-g;if(DA&&se.topC&&(C=I?se.top-w-2-g:se.bottom+g+2);if(this.position=="absolute"?(u.style.top=(C-t.parent.top)/o+"px",u.style.left=(A-t.parent.left)/n+"px"):(u.style.top=C/o+"px",u.style.left=A/n+"px"),p){let se=f.left+(T?S.x:-S.x)-(A+14-7);p.style.left=se/n+"px"}c.overlap!==!0&&s.push({left:A,top:C,right:j,bottom:C+w}),u.classList.toggle("cm-tooltip-above",I),u.classList.toggle("cm-tooltip-below",!I),c.positioned&&c.positioned(t.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let t of this.manager.tooltipViews)t.dom.style.top=nu}},{eventObservers:{scroll(){this.maybeMeasure()}}}),qW=de.baseTheme({".cm-tooltip":{zIndex:100,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:`${7*2}px`,position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),WW={x:0,y:0},Bn=be.define({enables:[gy,qW]}),xp=be.define({combine:t=>t.reduce((e,i)=>e.concat(i),[])}),vp=class t{static create(e){return new t(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new yp(e,xp,(i,r)=>this.createHostedView(i,r),i=>i.dom.remove())}createHostedView(e,i){let r=e.create(this.view);return r.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(r.dom,i?i.dom.nextSibling:this.dom.firstChild),this.mounted&&r.mount&&r.mount(this.view),r}mount(e){for(let i of this.manager.tooltipViews)i.mount&&i.mount(e);this.mounted=!0}positioned(e){for(let i of this.manager.tooltipViews)i.positioned&&i.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let i of this.manager.tooltipViews)(e=i.destroy)===null||e===void 0||e.call(i)}passProp(e){let i;for(let r of this.manager.tooltipViews){let n=r[e];if(n!==void 0){if(i===void 0)i=n;else if(i!==n)return}}return i}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}},BW=Bn.compute([xp],t=>{let e=t.facet(xp);return e.length===0?null:{pos:Math.min(...e.map(i=>i.pos)),end:Math.max(...e.map(i=>{var r;return(r=i.end)!==null&&r!==void 0?r:i.pos})),create:vp.create,above:e[0].above,arrow:e.some(i=>i.arrow)}}),sy=class{constructor(e,i,r,n,o){this.view=e,this.source=i,this.field=r,this.setHover=n,this.hoverTime=o,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:e.dom,time:0},this.checkHover=this.checkHover.bind(this),e.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),e.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let e=Date.now()-this.lastMove.time;ea.bottom||i.xa.right+e.defaultCharacterWidth)return;let l=e.bidiSpans(e.state.doc.lineAt(n)).find(u=>u.from<=n&&u.to>=n),c=l&&l.dir==ot.RTL?-1:1;o=i.x{this.pending==a&&(this.pending=null,l&&!(Array.isArray(l)&&!l.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(l)?l:[l])}))},l=>oi(e.state,l,"hover tooltip"))}else s&&!(Array.isArray(s)&&!s.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(s)?s:[s])})}get tooltip(){let e=this.view.plugin(gy),i=e?e.manager.tooltips.findIndex(r=>r.create==vp.create):-1;return i>-1?e.manager.tooltipViews[i]:null}mousemove(e){var i,r;this.lastMove={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:n,tooltip:o}=this;if(n.length&&o&&!ZW(o.dom,e)||this.pending){let{pos:s}=n[0]||this.pending,a=(r=(i=n[0])===null||i===void 0?void 0:i.end)!==null&&r!==void 0?r:s;(s==a?this.view.posAtCoords(this.lastMove)!=s:!VW(this.view,s,a,e.clientX,e.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:i}=this;if(i.length){let{tooltip:r}=this;r&&r.dom.contains(e.relatedTarget)?this.watchTooltipLeave(r.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(e){let i=r=>{e.removeEventListener("mouseleave",i),this.active.length&&!this.view.dom.contains(r.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};e.addEventListener("mouseleave",i)}destroy(){clearTimeout(this.hoverTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}},ip=4;function ZW(t,e){let i=t.getBoundingClientRect();return e.clientX>=i.left-ip&&e.clientX<=i.right+ip&&e.clientY>=i.top-ip&&e.clientY<=i.bottom+ip}function VW(t,e,i,r,n,o){let s=t.scrollDOM.getBoundingClientRect(),a=t.documentTop+t.documentPadding.top+t.contentHeight;if(s.left>r||s.rightn||Math.min(s.bottom,a)=e&&l<=i}function Ep(t,e={}){let i=Se.define(),r=Fe.define({create(){return[]},update(n,o){if(n.length&&(e.hideOnChange&&(o.docChanged||o.selection)?n=[]:e.hideOn&&(n=n.filter(s=>!e.hideOn(o,s))),o.docChanged)){let s=[];for(let a of n){let l=o.changes.mapPos(a.pos,-1,vt.TrackDel);if(l!=null){let c=Object.assign(Object.create(null),a);c.pos=l,c.end!=null&&(c.end=o.changes.mapPos(c.end)),s.push(c)}}n=s}for(let s of o.effects)s.is(i)&&(n=s.value),s.is(YW)&&(n=[]);return n},provide:n=>xp.from(n)});return[r,Ye.define(n=>new sy(n,t,r,i,e.hoverTime||300)),BW]}function by(t,e){let i=t.plugin(gy);if(!i)return null;let r=i.manager.tooltips.indexOf(e);return r<0?null:i.manager.tooltipViews[r]}var YW=Se.define();var V5=be.define({combine(t){let e,i;for(let r of t)e=e||r.topContainer,i=i||r.bottomContainer;return{topContainer:e,bottomContainer:i}}});function Xs(t,e){let i=t.plugin(o_),r=i?i.specs.indexOf(e):-1;return r>-1?i.panels[r]:null}var o_=Ye.fromClass(class{constructor(t){this.input=t.state.facet(yr),this.specs=this.input.filter(i=>i),this.panels=this.specs.map(i=>i(t));let e=t.state.facet(V5);this.top=new Ja(t,!0,e.topContainer),this.bottom=new Ja(t,!1,e.bottomContainer),this.top.sync(this.panels.filter(i=>i.top)),this.bottom.sync(this.panels.filter(i=>!i.top));for(let i of this.panels)i.dom.classList.add("cm-panel"),i.mount&&i.mount()}update(t){let e=t.state.facet(V5);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new Ja(t.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new Ja(t.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let i=t.state.facet(yr);if(i!=this.input){let r=i.filter(l=>l),n=[],o=[],s=[],a=[];for(let l of r){let c=this.specs.indexOf(l),u;c<0?(u=l(t.view),a.push(u)):(u=this.panels[c],u.update&&u.update(t)),n.push(u),(u.top?o:s).push(u)}this.specs=r,this.panels=n,this.top.sync(o),this.bottom.sync(s);for(let l of a)l.dom.classList.add("cm-panel"),l.mount&&l.mount()}else for(let r of this.panels)r.update&&r.update(t)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:t=>de.scrollMargins.of(e=>{let i=e.plugin(t);return i&&{top:i.top.scrollMargin(),bottom:i.bottom.scrollMargin()}})}),Ja=class{constructor(e,i,r){this.view=e,this.top=i,this.container=r,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let i of this.panels)i.destroy&&e.indexOf(i)<0&&i.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(this.panels.length==0){this.dom&&(this.dom.remove(),this.dom=void 0);return}if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let i=this.container||this.view.dom;i.insertBefore(this.dom,this.top?i.firstChild:null)}let e=this.dom.firstChild;for(let i of this.panels)if(i.dom.parentNode==this.dom){for(;e!=i.dom;)e=Y5(e);e=e.nextSibling}else this.dom.insertBefore(i.dom,e);for(;e;)e=Y5(e)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(!(!this.container||this.classes==this.view.themeClasses)){for(let e of this.classes.split(" "))e&&this.container.classList.remove(e);for(let e of(this.classes=this.view.themeClasses).split(" "))e&&this.container.classList.add(e)}}};function Y5(t){let e=t.nextSibling;return t.remove(),e}var yr=be.define({enables:o_}),tr=class extends Lr{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}};tr.prototype.elementClass="";tr.prototype.toDOM=void 0;tr.prototype.mapMode=vt.TrackBefore;tr.prototype.startSide=tr.prototype.endSide=-1;tr.prototype.point=!0;var lp=be.define(),FW={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>nt.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{}},Ou=be.define();function yy(t){return[s_(),Ou.of(Object.assign(Object.assign({},FW),t))]}var ay=be.define({combine:t=>t.some(e=>e)});function s_(t){let e=[HW];return t&&t.fixed===!1&&e.push(ay.of(!0)),e}var HW=Ye.fromClass(class{constructor(t){this.view=t,this.prevViewport=t.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=t.state.facet(Ou).map(e=>new wp(t,e));for(let e of this.gutters)this.dom.appendChild(e.dom);this.fixed=!t.state.facet(ay),this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),t.scrollDOM.insertBefore(this.dom,t.contentDOM)}update(t){if(this.updateGutters(t)){let e=this.prevViewport,i=t.view.viewport,r=Math.min(e.to,i.to)-Math.max(e.from,i.from);this.syncGutters(r<(i.to-i.from)*.8)}t.geometryChanged&&(this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px"),this.view.state.facet(ay)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":""),this.prevViewport=t.view.viewport}syncGutters(t){let e=this.dom.nextSibling;t&&this.dom.remove();let i=nt.iter(this.view.state.facet(lp),this.view.viewport.from),r=[],n=this.gutters.map(o=>new cy(o,this.view.viewport,-this.view.documentPadding.top));for(let o of this.view.viewportLineBlocks)if(r.length&&(r=[]),Array.isArray(o.type)){let s=!0;for(let a of o.type)if(a.type==Xi.Text&&s){ly(i,r,a.from);for(let l of n)l.line(this.view,a,r);s=!1}else if(a.widget)for(let l of n)l.widget(this.view,a)}else if(o.type==Xi.Text){ly(i,r,o.from);for(let s of n)s.line(this.view,o,r)}else if(o.widget)for(let s of n)s.widget(this.view,o);for(let o of n)o.finish();t&&this.view.scrollDOM.insertBefore(this.dom,e)}updateGutters(t){let e=t.startState.facet(Ou),i=t.state.facet(Ou),r=t.docChanged||t.heightChanged||t.viewportChanged||!nt.eq(t.startState.facet(lp),t.state.facet(lp),t.view.viewport.from,t.view.viewport.to);if(e==i)for(let n of this.gutters)n.update(t)&&(r=!0);else{r=!0;let n=[];for(let o of i){let s=e.indexOf(o);s<0?n.push(new wp(this.view,o)):(this.gutters[s].update(t),n.push(this.gutters[s]))}for(let o of this.gutters)o.dom.remove(),n.indexOf(o)<0&&o.destroy();for(let o of n)this.dom.appendChild(o.dom);this.gutters=n}return r}destroy(){for(let t of this.gutters)t.destroy();this.dom.remove()}},{provide:t=>de.scrollMargins.of(e=>{let i=e.plugin(t);return!i||i.gutters.length==0||!i.fixed?null:e.textDirection==ot.LTR?{left:i.dom.offsetWidth*e.scaleX}:{right:i.dom.offsetWidth*e.scaleX}})});function F5(t){return Array.isArray(t)?t:[t]}function ly(t,e,i){for(;t.value&&t.from<=i;)t.from==i&&e.push(t.value),t.next()}var cy=class{constructor(e,i,r){this.gutter=e,this.height=r,this.i=0,this.cursor=nt.iter(e.markers,i.from)}addElement(e,i,r){let{gutter:n}=this,o=(i.top-this.height)/e.scaleY,s=i.height/e.scaleY;if(this.i==n.elements.length){let a=new kp(e,s,o,r);n.elements.push(a),n.dom.appendChild(a.dom)}else n.elements[this.i].update(e,s,o,r);this.height=i.bottom,this.i++}line(e,i,r){let n=[];ly(this.cursor,n,i.from),r.length&&(n=n.concat(r));let o=this.gutter.config.lineMarker(e,i,n);o&&n.unshift(o);let s=this.gutter;n.length==0&&!s.config.renderEmptyElements||this.addElement(e,i,n)}widget(e,i){let r=this.gutter.config.widgetMarker(e,i.widget,i);r&&this.addElement(e,i,[r])}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let i=e.elements.pop();e.dom.removeChild(i.dom),i.destroy()}}},wp=class{constructor(e,i){this.view=e,this.config=i,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let r in i.domEventHandlers)this.dom.addEventListener(r,n=>{let o=n.target,s;if(o!=this.dom&&this.dom.contains(o)){for(;o.parentNode!=this.dom;)o=o.parentNode;let l=o.getBoundingClientRect();s=(l.top+l.bottom)/2}else s=n.clientY;let a=e.lineBlockAtHeight(s-e.documentTop);i.domEventHandlers[r](e,a,n)&&n.preventDefault()});this.markers=F5(i.markers(e)),i.initialSpacer&&(this.spacer=new kp(e,0,0,[i.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let i=this.markers;if(this.markers=F5(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let n=this.config.updateSpacer(this.spacer.markers[0],e);n!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[n])}let r=e.view.viewport;return!nt.eq(this.markers,i,r.from,r.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}},kp=class{constructor(e,i,r,n){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,i,r,n)}update(e,i,r,n){this.height!=i&&(this.height=i,this.dom.style.height=i+"px"),this.above!=r&&(this.dom.style.marginTop=(this.above=r)?r+"px":""),GW(this.markers,n)||this.setMarkers(e,n)}setMarkers(e,i){let r="cm-gutterElement",n=this.dom.firstChild;for(let o=0,s=0;;){let a=s,l=oo(a,l,c)||s(a,l,c):s}return r}})}}),mu=class extends tr{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}};function w1(t,e){return t.state.facet(el).formatNumber(e,t.state)}var JW=Ou.compute([el],t=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(KW)},lineMarker(e,i,r){return r.some(n=>n.toDOM)?null:new mu(w1(e,e.state.doc.lineAt(i.from).number))},widgetMarker:()=>null,lineMarkerChange:e=>e.startState.facet(el)!=e.state.facet(el),initialSpacer(e){return new mu(w1(e,H5(e.state.doc.lines)))},updateSpacer(e,i){let r=w1(i.view,H5(i.view.state.doc.lines));return r==e.number?e:new mu(r)},domEventHandlers:t.facet(el).domEventHandlers}));function a_(t={}){return[el.of(t),s_(),JW]}function H5(t){let e=9;for(;e{let e=[],i=-1;for(let r of t.selection.ranges){let n=t.doc.lineAt(r.head).from;n>i&&(i=n,e.push(eB.range(n)))}return nt.of(e)});function l_(){return tB}var rB=0,xr=class t{constructor(e,i,r){this.set=e,this.base=i,this.modified=r,this.id=rB++}static define(e){if(e!=null&&e.base)throw new Error("Can not derive from a modified tag");let i=new t([],null,[]);if(i.set.push(i),e)for(let r of e.set)i.set.push(r);return i}static defineModifier(){let e=new Qp;return i=>i.modified.indexOf(e)>-1?i:Qp.get(i.base||i,i.modified.concat(e).sort((r,n)=>r.id-n.id))}},nB=0,Qp=class t{constructor(){this.instances=[],this.id=nB++}static get(e,i){if(!i.length)return e;let r=i[0].instances.find(a=>a.base==e&&oB(i,a.modified));if(r)return r;let n=[],o=new xr(n,e,i);for(let a of i)a.instances.push(o);let s=sB(i);for(let a of e.set)if(!a.modified.length)for(let l of s)n.push(t.get(a,l));return o}};function oB(t,e){return t.length==e.length&&t.every((i,r)=>i==e[r])}function sB(t){let e=[[]];for(let i=0;ir.length-i.length)}function Bt(t){let e=Object.create(null);for(let i in t){let r=t[i];Array.isArray(r)||(r=[r]);for(let n of i.split(" "))if(n){let o=[],s=2,a=n;for(let f=0;;){if(a=="..."&&f>0&&f+3==n.length){s=1;break}let d=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(a);if(!d)throw new RangeError("Invalid path: "+n);if(o.push(d[0]=="*"?"":d[0][0]=='"'?JSON.parse(d[0]):d[0]),f+=d[0].length,f==n.length)break;let p=n[f++];if(f==n.length&&p=="!"){s=0;break}if(p!="/")throw new RangeError("Invalid path: "+n);a=n.slice(f)}let l=o.length-1,c=o[l];if(!c)throw new RangeError("Invalid path: "+n);let u=new nl(r,s,l>0?o.slice(0,l):null);e[c]=u.sort(e[c])}}return f_.add(e)}var f_=new Qe,nl=class{constructor(e,i,r,n){this.tags=e,this.mode=i,this.context=r,this.next=n}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth{let s=n;for(let a of o)for(let l of a.set){let c=i[l.id];if(c){s=s?s+" "+c:c;break}}return s},scope:r}}function aB(t,e){let i=null;for(let r of t){let n=r.style(e);n&&(i=i?i+" "+n:n)}return i}function Sy(t,e,i,r=0,n=t.length){let o=new vy(r,Array.isArray(e)?e:[e],i);o.highlightRange(t.cursor(),r,n,"",o.highlighters),o.flush(n)}function h_(t,e,i,r,n,o=0,s=t.length){let a=o;function l(c,u){if(!(c<=a)){for(let f=t.slice(a,c),d=0;;){let p=f.indexOf(` -`,d),g=p<0?f.length:p;if(g>d&&r(f.slice(d,g),u),p<0)break;n(),d=p+1}a=c}}Sy(e,i,(c,u,f)=>{l(c,""),l(u,f)},o,s),l(s,"")}var vy=class{constructor(e,i,r){this.at=e,this.highlighters=i,this.span=r,this.class=""}startSpan(e,i){i!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=i)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,i,r,n,o){let{type:s,from:a,to:l}=e;if(a>=r||l<=i)return;s.isTop&&(o=this.highlighters.filter(p=>!p.scope||p.scope(s)));let c=n,u=lB(e)||nl.empty,f=aB(o,u.tags);if(f&&(c&&(c+=" "),c+=f,u.mode==1&&(n+=(n?" ":"")+f)),this.startSpan(Math.max(i,a),c),u.opaque)return;let d=e.tree&&e.tree.prop(Qe.mounted);if(d&&d.overlay){let p=e.node.enter(d.overlay[0].from+a,1),g=this.highlighters.filter(w=>!w.scope||w.scope(d.tree.type)),x=e.firstChild();for(let w=0,S=a;;w++){let T=w=A||!e.nextSibling())););if(!T||A>r)break;S=T.to+a,S>i&&(this.highlightRange(p.cursor(),Math.max(i,T.from+a),Math.min(r,S),"",g),this.startSpan(Math.min(r,S),c))}x&&e.parent()}else if(e.firstChild()){d&&(n="");do if(!(e.to<=i)){if(e.from>=r)break;this.highlightRange(e,i,r,n,o),this.startSpan(Math.min(r,e.to),c)}while(e.nextSibling());e.parent()}}};function lB(t){let e=t.type.prop(f_);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}var xe=xr.define,Cp=xe(),Mo=xe(),c_=xe(Mo),u_=xe(Mo),Uo=xe(),_p=xe(Uo),xy=xe(Uo),un=xe(),Rs=xe(un),ln=xe(),cn=xe(),wy=xe(),Su=xe(wy),Pp=xe(),_={comment:Cp,lineComment:xe(Cp),blockComment:xe(Cp),docComment:xe(Cp),name:Mo,variableName:xe(Mo),typeName:c_,tagName:xe(c_),propertyName:u_,attributeName:xe(u_),className:xe(Mo),labelName:xe(Mo),namespace:xe(Mo),macroName:xe(Mo),literal:Uo,string:_p,docString:xe(_p),character:xe(_p),attributeValue:xe(_p),number:xy,integer:xe(xy),float:xe(xy),bool:xe(Uo),regexp:xe(Uo),escape:xe(Uo),color:xe(Uo),url:xe(Uo),keyword:ln,self:xe(ln),null:xe(ln),atom:xe(ln),unit:xe(ln),modifier:xe(ln),operatorKeyword:xe(ln),controlKeyword:xe(ln),definitionKeyword:xe(ln),moduleKeyword:xe(ln),operator:cn,derefOperator:xe(cn),arithmeticOperator:xe(cn),logicOperator:xe(cn),bitwiseOperator:xe(cn),compareOperator:xe(cn),updateOperator:xe(cn),definitionOperator:xe(cn),typeOperator:xe(cn),controlOperator:xe(cn),punctuation:wy,separator:xe(wy),bracket:Su,angleBracket:xe(Su),squareBracket:xe(Su),paren:xe(Su),brace:xe(Su),content:un,heading:Rs,heading1:xe(Rs),heading2:xe(Rs),heading3:xe(Rs),heading4:xe(Rs),heading5:xe(Rs),heading6:xe(Rs),contentSeparator:xe(un),list:xe(un),quote:xe(un),emphasis:xe(un),strong:xe(un),link:xe(un),monospace:xe(un),strikethrough:xe(un),inserted:xe(),deleted:xe(),changed:xe(),invalid:xe(),meta:Pp,documentMeta:xe(Pp),annotation:xe(Pp),processingInstruction:xe(Pp),definition:xr.defineModifier(),constant:xr.defineModifier(),function:xr.defineModifier(),standard:xr.defineModifier(),local:xr.defineModifier(),special:xr.defineModifier()},V1e=ky([{tag:_.link,class:"tok-link"},{tag:_.heading,class:"tok-heading"},{tag:_.emphasis,class:"tok-emphasis"},{tag:_.strong,class:"tok-strong"},{tag:_.keyword,class:"tok-keyword"},{tag:_.atom,class:"tok-atom"},{tag:_.bool,class:"tok-bool"},{tag:_.url,class:"tok-url"},{tag:_.labelName,class:"tok-labelName"},{tag:_.inserted,class:"tok-inserted"},{tag:_.deleted,class:"tok-deleted"},{tag:_.literal,class:"tok-literal"},{tag:_.string,class:"tok-string"},{tag:_.number,class:"tok-number"},{tag:[_.regexp,_.escape,_.special(_.string)],class:"tok-string2"},{tag:_.variableName,class:"tok-variableName"},{tag:_.local(_.variableName),class:"tok-variableName tok-local"},{tag:_.definition(_.variableName),class:"tok-variableName tok-definition"},{tag:_.special(_.variableName),class:"tok-variableName2"},{tag:_.definition(_.propertyName),class:"tok-propertyName tok-definition"},{tag:_.typeName,class:"tok-typeName"},{tag:_.namespace,class:"tok-namespace"},{tag:_.className,class:"tok-className"},{tag:_.macroName,class:"tok-macroName"},{tag:_.propertyName,class:"tok-propertyName"},{tag:_.operator,class:"tok-operator"},{tag:_.comment,class:"tok-comment"},{tag:_.meta,class:"tok-meta"},{tag:_.invalid,class:"tok-invalid"},{tag:_.punctuation,class:"tok-punctuation"}]);var Ty,Zn=new Qe;function al(t){return be.define({combine:t?e=>e.concat(t):void 0})}var Rp=new Qe,si=class{constructor(e,i,r=[],n=""){this.data=e,this.name=n,rt.prototype.hasOwnProperty("tree")||Object.defineProperty(rt.prototype,"tree",{get(){return ze(this)}}),this.parser=i,this.extension=[zo.of(this),rt.languageData.of((o,s,a)=>{let l=d_(o,s,a),c=l.type.prop(Zn);if(!c)return[];let u=o.facet(c),f=l.type.prop(Rp);if(f){let d=l.resolve(s-l.from,a);for(let p of f)if(p.test(d,o)){let g=o.facet(p.facet);return p.type=="replace"?g:g.concat(u)}}return u})].concat(r)}isActiveAt(e,i,r=-1){return d_(e,i,r).type.prop(Zn)==this.data}findRegions(e){let i=e.facet(zo);if((i==null?void 0:i.data)==this.data)return[{from:0,to:e.doc.length}];if(!i||!i.allowsNesting)return[];let r=[],n=(o,s)=>{if(o.prop(Zn)==this.data){r.push({from:s,to:s+o.length});return}let a=o.prop(Qe.mounted);if(a){if(a.tree.prop(Zn)==this.data){if(a.overlay)for(let l of a.overlay)r.push({from:l.from+s,to:l.to+s});else r.push({from:s,to:s+o.length});return}else if(a.overlay){let l=r.length;if(n(a.tree,a.overlay[0].from+s),r.length>l)return}}for(let l=0;lr.isTop?i:void 0)]}),e.name)}configure(e,i){return new t(this.data,this.parser.configure(e),i||this.name)}get allowsNesting(){return this.parser.hasWrappers()}};function ze(t){let e=t.field(si.state,!1);return e?e.tree:qe.empty}function Dy(t,e,i=50){var r;let n=(r=t.field(si.state,!1))===null||r===void 0?void 0:r.context;if(!n)return null;let o=n.viewport;n.updateViewport({from:0,to:e});let s=n.isDone(e)||n.work(i,e)?n.tree:null;return n.updateViewport(o),s}var Py=class{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,i){let r=this.cursorPos-this.string.length;return e=this.cursorPos?this.doc.sliceString(e,i):this.string.slice(e-r,i-r)}},Tu=null,Is=class t{constructor(e,i,r=[],n,o,s,a,l){this.parser=e,this.state=i,this.fragments=r,this.tree=n,this.treeLen=o,this.viewport=s,this.skipped=a,this.scheduleOn=l,this.parse=null,this.tempSkipped=[]}static create(e,i,r){return new t(e,i,[],qe.empty,0,r,[],null)}startParse(){return this.parser.startParse(new Py(this.state.doc),this.fragments)}work(e,i){return i!=null&&i>=this.state.doc.length&&(i=void 0),this.tree!=qe.empty&&this.isDone(i!=null?i:this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var r;if(typeof e=="number"){let n=Date.now()+e;e=()=>Date.now()>n}for(this.parse||(this.parse=this.startParse()),i!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>i)&&i=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(i=this.parse.advance()););}),this.treeLen=e,this.tree=i,this.fragments=this.withoutTempSkipped(Un.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let i=Tu;Tu=this;try{return e()}finally{Tu=i}}withoutTempSkipped(e){for(let i;i=this.tempSkipped.pop();)e=p_(e,i.from,i.to);return e}changes(e,i){let{fragments:r,tree:n,treeLen:o,viewport:s,skipped:a}=this;if(this.takeTree(),!e.empty){let l=[];if(e.iterChangedRanges((c,u,f,d)=>l.push({fromA:c,toA:u,fromB:f,toB:d})),r=Un.applyChanges(r,l),n=qe.empty,o=0,s={from:e.mapPos(s.from,-1),to:e.mapPos(s.to,1)},this.skipped.length){a=[];for(let c of this.skipped){let u=e.mapPos(c.from,1),f=e.mapPos(c.to,-1);ue.from&&(this.fragments=p_(this.fragments,n,o),this.skipped.splice(r--,1))}return this.skipped.length>=i?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,i){this.skipped.push({from:e,to:i})}static getSkippingParser(e){return new class extends zn{createParse(i,r,n){let o=n[0].from,s=n[n.length-1].to;return{parsedPos:o,advance(){let l=Tu;if(l){for(let c of n)l.tempSkipped.push(c);e&&(l.scheduleOn=l.scheduleOn?Promise.all([l.scheduleOn,e]):e)}return this.parsedPos=s,new qe(St.none,[],[],s-o)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let i=this.fragments;return this.treeLen>=e&&i.length&&i[0].from==0&&i[0].to>=e}static get(){return Tu}};function p_(t,e,i){return Un.applyChanges(t,[{fromA:e,toA:i,fromB:e,toB:i}])}var Cu=class t{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let i=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),i.viewport.to);return i.work(20,r)||i.takeTree(),new t(i)}static init(e){let i=Math.min(3e3,e.doc.length),r=Is.create(e.facet(zo).parser,e,{from:0,to:i});return r.work(20,i)||r.takeTree(),new t(r)}};si.state=Fe.define({create:Cu.init,update(t,e){for(let i of e.effects)if(i.is(si.setState))return i.value;return e.startState.facet(zo)!=e.state.facet(zo)?Cu.init(e.state):t.apply(e)}});var x_=t=>{let e=setTimeout(()=>t(),500);return()=>clearTimeout(e)};typeof requestIdleCallback!="undefined"&&(x_=t=>{let e=-1,i=setTimeout(()=>{e=requestIdleCallback(t,{timeout:400})},100);return()=>e<0?clearTimeout(i):cancelIdleCallback(e)});var Ey=typeof navigator!="undefined"&&(!((Ty=navigator.scheduling)===null||Ty===void 0)&&Ty.isInputPending)?()=>navigator.scheduling.isInputPending():null,cB=Ye.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 i=this.view.state.field(si.state).context;(i.updateViewport(e.view.viewport)||this.view.viewport.to>i.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(i)}scheduleWork(){if(this.working)return;let{state:e}=this.view,i=e.field(si.state);(i.tree!=i.context.tree||!i.context.isDone(e.doc.length))&&(this.working=x_(this.work))}work(e){this.working=null;let i=Date.now();if(this.chunkEndn+1e3,l=o.context.work(()=>Ey&&Ey()||Date.now()>s,n+(a?0:1e5));this.chunkBudget-=Date.now()-i,(l||this.chunkBudget<=0)&&(o.context.takeTree(),this.view.dispatch({effects:si.setState.of(new Cu(o.context))})),this.chunkBudget>0&&!(l&&!a)&&this.scheduleWork(),this.checkAsyncSchedule(o.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(i=>oi(this.view.state,i)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),zo=be.define({combine(t){return t.length?t[0]:null},enables:t=>[si.state,cB,de.contentAttributes.compute([t],e=>{let i=e.facet(t);return i&&i.name?{"data-language":i.name}:{}})]}),At=class{constructor(e,i=[]){this.language=e,this.support=i,this.extension=[e,i]}},zt=class t{constructor(e,i,r,n,o,s=void 0){this.name=e,this.alias=i,this.extensions=r,this.filename=n,this.loadFunc=o,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:i,support:r}=e;if(!i){if(!r)throw new RangeError("Must pass either 'load' or 'support' to LanguageDescription.of");i=()=>Promise.resolve(r)}return new t(e.name,(e.alias||[]).concat(e.name).map(n=>n.toLowerCase()),e.extensions||[],e.filename,i,r)}static matchFilename(e,i){for(let n of e)if(n.filename&&n.filename.test(i))return n;let r=/\.([^.]+)$/.exec(i);if(r){for(let n of e)if(n.extensions.indexOf(r[1])>-1)return n}return null}static matchLanguageName(e,i,r=!0){i=i.toLowerCase();for(let n of e)if(n.alias.some(o=>o==i))return n;if(r)for(let n of e)for(let o of n.alias){let s=i.indexOf(o);if(s>-1&&(o.length>2||!/\w/.test(i[s-1])&&!/\w/.test(i[s+o.length])))return n}return null}},v_=be.define(),Nr=be.define({combine:t=>{if(!t.length)return" ";let e=t[0];if(!e||/\S/.test(e)||Array.from(e).some(i=>i!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(t[0]));return e}});function fn(t){let e=t.facet(Nr);return e.charCodeAt(0)==9?t.tabSize*e.length:e.length}function Vn(t,e){let i="",r=t.tabSize,n=t.facet(Nr)[0];if(n==" "){for(;e>=r;)i+=" ",e-=r;n=" "}for(let o=0;o=e?uB(t,i,e):null}var Ls=class{constructor(e,i={}){this.state=e,this.options=i,this.unit=fn(e)}lineAt(e,i=1){let r=this.state.doc.lineAt(e),{simulateBreak:n,simulateDoubleBreak:o}=this.options;return n!=null&&n>=r.from&&n<=r.to?o&&n==e?{text:"",from:e}:(i<0?n-1&&(o+=s-this.countColumn(r,r.search(/\S|$/))),o}countColumn(e,i=e.length){return Ai(e,this.state.tabSize,i)}lineIndent(e,i=1){let{text:r,from:n}=this.lineAt(e,i),o=this.options.overrideIndentation;if(o){let s=o(n);if(s>-1)return s}return this.countColumn(r,r.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}},ai=new Qe;function uB(t,e,i){let r=e.resolveStack(i),n=r.node.enterUnfinishedNodesBefore(i);if(n!=r.node){let o=[];for(let s=n;s!=r.node;s=s.parent)o.push(s);for(let s=o.length-1;s>=0;s--)r={node:o[s],next:r}}return w_(r,t,i)}function w_(t,e,i){for(let r=t;r;r=r.next){let n=hB(r.node);if(n)return n(Qy.create(e,i,r))}return 0}function fB(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak}function hB(t){let e=t.type.prop(ai);if(e)return e;let i=t.firstChild,r;if(i&&(r=i.type.prop(Qe.closedBy))){let n=t.lastChild,o=n&&r.indexOf(n.name)>-1;return s=>k_(s,!0,1,void 0,o&&!fB(s)?n.from:void 0)}return t.parent==null?dB:null}function dB(){return 0}var Qy=class t extends Ls{constructor(e,i,r){super(e.state,e.options),this.base=e,this.pos=i,this.context=r}get node(){return this.context.node}static create(e,i,r){return new t(e,i,r)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let i=this.state.doc.lineAt(e.from);for(;;){let r=e.resolve(i.from);for(;r.parent&&r.parent.from==r.from;)r=r.parent;if(pB(r,e))break;i=this.state.doc.lineAt(r.from)}return this.lineIndent(i.from)}continue(){return w_(this.context.next,this.base,this.pos)}};function pB(t,e){for(let i=e;i;i=i.parent)if(t==i)return!0;return!1}function OB(t){let e=t.node,i=e.childAfter(e.from),r=e.lastChild;if(!i)return null;let n=t.options.simulateBreak,o=t.state.doc.lineAt(i.from),s=n==null||n<=o.from?o.to:Math.min(o.to,n);for(let a=i.to;;){let l=e.childAfter(a);if(!l||l==r)return null;if(!l.type.isSkipped)return l.fromk_(r,e,i,t)}function k_(t,e,i,r,n){let o=t.textAfter,s=o.match(/^\s*/)[0].length,a=r&&o.slice(s,s+r.length)==r||n==t.pos+s,l=e?OB(t):null;return l?a?t.column(l.from):t.column(l.to):t.baseIndent+(a?0:t.unit*i)}var Ip=t=>t.baseIndent;function xi({except:t,units:e=1}={}){return i=>{let r=t&&t.test(i.textAfter);return i.baseIndent+(r?0:e*i.unit)}}var mB=200;function S_(){return rt.transactionFilter.of(t=>{if(!t.docChanged||!t.isUserEvent("input.type")&&!t.isUserEvent("input.complete"))return t;let e=t.startState.languageDataAt("indentOnInput",t.startState.selection.main.head);if(!e.length)return t;let i=t.newDoc,{head:r}=t.newSelection.main,n=i.lineAt(r);if(r>n.from+mB)return t;let o=i.sliceString(n.from,r);if(!e.some(c=>c.test(o)))return t;let{state:s}=t,a=-1,l=[];for(let{head:c}of s.selection.ranges){let u=s.doc.lineAt(c);if(u.from==a)continue;a=u.from;let f=ll(s,u.from);if(f==null)continue;let d=/^\s*/.exec(u.text)[0],p=Vn(s,f);d!=p&&l.push({from:u.from,to:u.from+d.length,insert:p})}return l.length?[t,{changes:l,sequential:!0}]:t})}var Ny=be.define(),Ht=new Qe;function jo(t){let e=t.firstChild,i=t.lastChild;return e&&e.toi)continue;if(o&&a.from=e&&c.to>i&&(o=c)}}return o}function bB(t){let e=t.lastChild;return e&&e.to==t.to&&e.type.isError}function Ap(t,e,i){for(let r of t.facet(Ny)){let n=r(t,e,i);if(n)return n}return gB(t,e,i)}function T_(t,e){let i=e.mapPos(t.from,1),r=e.mapPos(t.to,-1);return i>=r?void 0:{from:i,to:r}}var Lp=Se.define({map:T_}),Qu=Se.define({map:T_});function E_(t){let e=[];for(let{head:i}of t.state.selection.ranges)e.some(r=>r.from<=i&&r.to>=i)||e.push(t.lineBlockAt(i));return e}var Ds=Fe.define({create(){return we.none},update(t,e){t=t.map(e.changes);for(let i of e.effects)if(i.is(Lp)&&!yB(t,i.value.from,i.value.to)){let{preparePlaceholder:r}=e.state.facet(My),n=r?we.replace({widget:new Ay(r(e.state,i.value))}):O_;t=t.update({add:[n.range(i.value.from,i.value.to)]})}else i.is(Qu)&&(t=t.update({filter:(r,n)=>i.value.from!=r||i.value.to!=n,filterFrom:i.value.from,filterTo:i.value.to}));if(e.selection){let i=!1,{head:r}=e.selection.main;t.between(r,r,(n,o)=>{nr&&(i=!0)}),i&&(t=t.update({filterFrom:r,filterTo:r,filter:(n,o)=>o<=r||n>=r}))}return t},provide:t=>de.decorations.from(t),toJSON(t,e){let i=[];return t.between(0,e.doc.length,(r,n)=>{i.push(r,n)}),i},fromJSON(t){if(!Array.isArray(t)||t.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let i=0;i{(!n||n.from>o)&&(n={from:o,to:s})}),n}function yB(t,e,i){let r=!1;return t.between(e,e,(n,o)=>{n==e&&o==i&&(r=!0)}),r}function C_(t,e){return t.field(Ds,!1)?e:e.concat(Se.appendConfig.of(Np()))}var Dp=t=>{for(let e of E_(t)){let i=Ap(t.state,e.from,e.to);if(i)return t.dispatch({effects:C_(t.state,[Lp.of(i),P_(t,i)])}),!0}return!1},__=t=>{if(!t.state.field(Ds,!1))return!1;let e=[];for(let i of E_(t)){let r=$p(t.state,i.from,i.to);r&&e.push(Qu.of(r),P_(t,r,!1))}return e.length&&t.dispatch({effects:e}),e.length>0};function P_(t,e,i=!0){let r=t.state.doc.lineAt(e.from).number,n=t.state.doc.lineAt(e.to).number;return de.announce.of(`${t.state.phrase(i?"Folded lines":"Unfolded lines")} ${r} ${t.state.phrase("to")} ${n}.`)}var Q_=t=>{let{state:e}=t,i=[];for(let r=0;r{let e=t.state.field(Ds,!1);if(!e||!e.size)return!1;let i=[];return e.between(0,t.state.doc.length,(r,n)=>{i.push(Qu.of({from:r,to:n}))}),t.dispatch({effects:i}),!0};var xB={placeholderDOM:null,preparePlaceholder:null,placeholderText:"\u2026"},My=be.define({combine(t){return wt(t,xB)}});function Np(t){let e=[Ds,wB];return t&&e.push(My.of(t)),e}function $_(t,e){let{state:i}=t,r=i.facet(My),n=s=>{let a=t.lineBlockAt(t.posAtDOM(s.target)),l=$p(t.state,a.from,a.to);l&&t.dispatch({effects:Qu.of(l)}),s.preventDefault()};if(r.placeholderDOM)return r.placeholderDOM(t,n,e);let o=document.createElement("span");return o.textContent=r.placeholderText,o.setAttribute("aria-label",i.phrase("folded code")),o.title=i.phrase("unfold"),o.className="cm-foldPlaceholder",o.onclick=n,o}var O_=we.replace({widget:new class extends Ft{toDOM(t){return $_(t,null)}}}),Ay=class extends Ft{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return $_(e,this.value)}},vB={openText:"\u2304",closedText:"\u203A",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1},Eu=class extends tr{constructor(e,i){super(),this.config=e,this.open=i}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let i=document.createElement("span");return i.textContent=this.open?this.config.openText:this.config.closedText,i.title=e.state.phrase(this.open?"Fold line":"Unfold line"),i}};function X_(t={}){let e=Object.assign(Object.assign({},vB),t),i=new Eu(e,!0),r=new Eu(e,!1),n=Ye.fromClass(class{constructor(s){this.from=s.viewport.from,this.markers=this.buildMarkers(s)}update(s){(s.docChanged||s.viewportChanged||s.startState.facet(zo)!=s.state.facet(zo)||s.startState.field(Ds,!1)!=s.state.field(Ds,!1)||ze(s.startState)!=ze(s.state)||e.foldingChanged(s))&&(this.markers=this.buildMarkers(s.view))}buildMarkers(s){let a=new Ki;for(let l of s.viewportLineBlocks){let c=$p(s.state,l.from,l.to)?r:Ap(s.state,l.from,l.to)?i:null;c&&a.add(l.from,l.from,c)}return a.finish()}}),{domEventHandlers:o}=e;return[n,yy({class:"cm-foldGutter",markers(s){var a;return((a=s.plugin(n))===null||a===void 0?void 0:a.markers)||nt.empty},initialSpacer(){return new Eu(e,!1)},domEventHandlers:Object.assign(Object.assign({},o),{click:(s,a,l)=>{if(o.click&&o.click(s,a,l))return!0;let c=$p(s.state,a.from,a.to);if(c)return s.dispatch({effects:Qu.of(c)}),!0;let u=Ap(s.state,a.from,a.to);return u?(s.dispatch({effects:Lp.of(u)}),!0):!1}})}),Np()]}var wB=de.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"}}),ol=class t{constructor(e,i){this.specs=e;let r;function n(a){let l=zi.newName();return(r||(r=Object.create(null)))["."+l]=a,l}let o=typeof i.all=="string"?i.all:i.all?n(i.all):void 0,s=i.scope;this.scope=s instanceof si?a=>a.prop(Zn)==s.data:s?a=>a==s:void 0,this.style=ky(e.map(a=>({tag:a.tag,class:a.class||n(Object.assign({},a,{tag:null}))})),{all:o}).style,this.module=r?new zi(r):null,this.themeType=i.themeType}static define(e,i){return new t(e,i||{})}},$y=be.define(),R_=be.define({combine(t){return t.length?[t[0]]:null}});function Cy(t){let e=t.facet($y);return e.length?e:t.facet(R_)}function Uy(t,e){let i=[kB],r;return t instanceof ol&&(t.module&&i.push(de.styleModule.of(t.module)),r=t.themeType),e!=null&&e.fallback?i.push(R_.of(t)):r?i.push($y.computeN([de.darkTheme],n=>n.facet(de.darkTheme)==(r=="dark")?[t]:[])):i.push($y.of(t)),i}var Xy=class{constructor(e){this.markCache=Object.create(null),this.tree=ze(e.state),this.decorations=this.buildDeco(e,Cy(e.state)),this.decoratedTo=e.viewport.to}update(e){let i=ze(e.state),r=Cy(e.state),n=r!=Cy(e.startState),{viewport:o}=e.view,s=e.changes.mapPos(this.decoratedTo,1);i.length=o.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=s):(i!=this.tree||e.viewportChanged||n)&&(this.tree=i,this.decorations=this.buildDeco(e.view,r),this.decoratedTo=o.to)}buildDeco(e,i){if(!i||!this.tree.length)return we.none;let r=new Ki;for(let{from:n,to:o}of e.visibleRanges)Sy(this.tree,i,(s,a,l)=>{r.add(s,a,this.markCache[l]||(this.markCache[l]=we.mark({class:l})))},n,o);return r.finish()}},kB=Qt.high(Ye.fromClass(Xy,{decorations:t=>t.decorations})),tye=ol.define([{tag:_.meta,color:"#404740"},{tag:_.link,textDecoration:"underline"},{tag:_.heading,textDecoration:"underline",fontWeight:"bold"},{tag:_.emphasis,fontStyle:"italic"},{tag:_.strong,fontWeight:"bold"},{tag:_.strikethrough,textDecoration:"line-through"},{tag:_.keyword,color:"#708"},{tag:[_.atom,_.bool,_.url,_.contentSeparator,_.labelName],color:"#219"},{tag:[_.literal,_.inserted],color:"#164"},{tag:[_.string,_.deleted],color:"#a11"},{tag:[_.regexp,_.escape,_.special(_.string)],color:"#e40"},{tag:_.definition(_.variableName),color:"#00f"},{tag:_.local(_.variableName),color:"#30a"},{tag:[_.typeName,_.namespace],color:"#085"},{tag:_.className,color:"#167"},{tag:[_.special(_.variableName),_.macroName],color:"#256"},{tag:_.definition(_.propertyName),color:"#00c"},{tag:_.comment,color:"#940"},{tag:_.invalid,color:"#f00"}]),SB=de.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),I_=1e4,L_="()[]{}",D_=be.define({combine(t){return wt(t,{afterCursor:!0,brackets:L_,maxScanDistance:I_,renderMatch:CB})}}),TB=we.mark({class:"cm-matchingBracket"}),EB=we.mark({class:"cm-nonmatchingBracket"});function CB(t){let e=[],i=t.matched?TB:EB;return e.push(i.range(t.start.from,t.start.to)),t.end&&e.push(i.range(t.end.from,t.end.to)),e}var _B=Fe.define({create(){return we.none},update(t,e){if(!e.docChanged&&!e.selection)return t;let i=[],r=e.state.facet(D_);for(let n of e.state.selection.ranges){if(!n.empty)continue;let o=vr(e.state,n.head,-1,r)||n.head>0&&vr(e.state,n.head-1,1,r)||r.afterCursor&&(vr(e.state,n.head,1,r)||n.headde.decorations.from(t)}),PB=[_B,SB];function N_(t={}){return[D_.of(t),PB]}var Au=new Qe;function Ry(t,e,i){let r=t.prop(e<0?Qe.openedBy:Qe.closedBy);if(r)return r;if(t.name.length==1){let n=i.indexOf(t.name);if(n>-1&&n%2==(e<0?1:0))return[i[n+e]]}return null}function Iy(t){let e=t.type.prop(Au);return e?e(t.node):t}function vr(t,e,i,r={}){let n=r.maxScanDistance||I_,o=r.brackets||L_,s=ze(t),a=s.resolveInner(e,i);for(let l=a;l;l=l.parent){let c=Ry(l.type,i,o);if(c&&l.from0?e>=u.from&&eu.from&&e<=u.to))return QB(t,e,i,l,u,c,o)}}return AB(t,e,i,s,a.type,n,o)}function QB(t,e,i,r,n,o,s){let a=r.parent,l={from:n.from,to:n.to},c=0,u=a==null?void 0:a.cursor();if(u&&(i<0?u.childBefore(r.from):u.childAfter(r.to)))do if(i<0?u.to<=r.from:u.from>=r.to){if(c==0&&o.indexOf(u.type.name)>-1&&u.from0)return null;let c={from:i<0?e-1:e,to:i>0?e+1:e},u=t.doc.iterRange(e,i>0?t.doc.length:0),f=0;for(let d=0;!u.next().done&&d<=o;){let p=u.value;i<0&&(d+=p.length);let g=e+d*i;for(let x=i>0?0:p.length-1,w=i>0?p.length:-1;x!=w;x+=i){let S=s.indexOf(p[x]);if(!(S<0||r.resolveInner(g+x,1).type!=n))if(S%2==0==i>0)f++;else{if(f==1)return{start:c,end:{from:g+x,to:g+x+1},matched:S>>1==l>>1};f--}}i>0&&(d+=p.length)}return u.done?{start:c,matched:!1}:null}function m_(t,e,i,r=0,n=0){e==null&&(e=t.search(/[^\s\u00a0]/),e==-1&&(e=t.length));let o=n;for(let s=r;s=this.string.length}sol(){return this.pos==0}peek(){return this.string.charAt(this.pos)||void 0}next(){if(this.posi}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 i=this.string.indexOf(e,this.pos);if(i>-1)return this.pos=i,!0}backUp(e){this.pos-=e}column(){return this.lastColumnPosr?s.toLowerCase():s,o=this.string.substr(this.pos,e.length);return n(o)==n(e)?(i!==!1&&(this.pos+=e.length),!0):null}else{let n=this.string.slice(this.pos).match(e);return n&&n.index>0?null:(n&&i!==!1&&(this.pos+=n[0].length),n)}}current(){return this.string.slice(this.start,this.pos)}};function $B(t){return{name:t.name||"",token:t.token,blankLine:t.blankLine||(()=>{}),startState:t.startState||(()=>!0),copyState:t.copyState||XB,indent:t.indent||(()=>null),languageData:t.languageData||{},tokenTable:t.tokenTable||jy}}function XB(t){if(typeof t!="object")return t;let e={};for(let i in t){let r=t[i];e[i]=r instanceof Array?r.slice():r}return e}var g_=new WeakMap,_u=class t extends si{constructor(e){let i=al(e.languageData),r=$B(e),n,o=new class extends zn{createParse(s,a,l){return new Ly(n,s,a,l)}};super(i,o,[v_.of((s,a)=>this.getIndent(s,a))],e.name),this.topNode=DB(i),n=this,this.streamParser=r,this.stateAfter=new Qe({perNode:!0}),this.tokenTable=e.tokenTable?new Xp(r.tokenTable):LB}static define(e){return new t(e)}getIndent(e,i){let r=ze(e.state),n=r.resolve(i);for(;n&&n.type!=this.topNode;)n=n.parent;if(!n)return null;let o,{overrideIndentation:s}=e.options;s&&(o=g_.get(e.state),o!=null&&o1e4)return null;for(;l=r&&i+e.length<=n&&e.prop(t.stateAfter);if(o)return{state:t.streamParser.copyState(o),pos:i+e.length};for(let s=e.children.length-1;s>=0;s--){let a=e.children[s],l=i+e.positions[s],c=a instanceof qe&&l=e.length)return e;!n&&e.type==t.topNode&&(n=!0);for(let o=e.children.length-1;o>=0;o--){let s=e.positions[o],a=e.children[o],l;if(si&&zy(t,n.tree,0-n.offset,i,s),l;if(a&&(l=M_(t,n.tree,i+n.offset,a.pos+n.offset,!1)))return{state:a.state,tree:l}}return{state:t.streamParser.startState(r?fn(r):4),tree:qe.empty}}var Ly=class{constructor(e,i,r,n){this.lang=e,this.input=i,this.fragments=r,this.ranges=n,this.stoppedAt=null,this.chunks=[],this.chunkPos=[],this.chunk=[],this.chunkReused=void 0,this.rangeIndex=0,this.to=n[n.length-1].to;let o=Is.get(),s=n[0].from,{state:a,tree:l}=RB(e,r,s,o==null?void 0:o.state);this.state=a,this.parsedPos=this.chunkStart=s+l.length;for(let c=0;c=i?this.finish():e&&this.parsedPos>=e.viewport.to?(e.skipUntilInView(this.parsedPos,i),this.finish()):null}stopAt(e){this.stoppedAt=e}lineAfter(e){let i=this.input.chunk(e);if(this.input.lineChunks)i==` +`,d),g=p<0?f.length:p;if(g>d&&r(f.slice(d,g),u),p<0)break;n(),d=p+1}a=c}}Sy(e,i,(c,u,f)=>{l(c,""),l(u,f)},o,s),l(s,"")}var vy=class{constructor(e,i,r){this.at=e,this.highlighters=i,this.span=r,this.class=""}startSpan(e,i){i!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=i)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,i,r,n,o){let{type:s,from:a,to:l}=e;if(a>=r||l<=i)return;s.isTop&&(o=this.highlighters.filter(p=>!p.scope||p.scope(s)));let c=n,u=lB(e)||nl.empty,f=aB(o,u.tags);if(f&&(c&&(c+=" "),c+=f,u.mode==1&&(n+=(n?" ":"")+f)),this.startSpan(Math.max(i,a),c),u.opaque)return;let d=e.tree&&e.tree.prop(Qe.mounted);if(d&&d.overlay){let p=e.node.enter(d.overlay[0].from+a,1),g=this.highlighters.filter(w=>!w.scope||w.scope(d.tree.type)),x=e.firstChild();for(let w=0,S=a;;w++){let T=w=A||!e.nextSibling())););if(!T||A>r)break;S=T.to+a,S>i&&(this.highlightRange(p.cursor(),Math.max(i,T.from+a),Math.min(r,S),"",g),this.startSpan(Math.min(r,S),c))}x&&e.parent()}else if(e.firstChild()){d&&(n="");do if(!(e.to<=i)){if(e.from>=r)break;this.highlightRange(e,i,r,n,o),this.startSpan(Math.min(r,e.to),c)}while(e.nextSibling());e.parent()}}};function lB(t){let e=t.type.prop(f_);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}var xe=xr.define,Cp=xe(),Mo=xe(),c_=xe(Mo),u_=xe(Mo),Uo=xe(),_p=xe(Uo),xy=xe(Uo),un=xe(),Rs=xe(un),ln=xe(),cn=xe(),wy=xe(),Su=xe(wy),Pp=xe(),_={comment:Cp,lineComment:xe(Cp),blockComment:xe(Cp),docComment:xe(Cp),name:Mo,variableName:xe(Mo),typeName:c_,tagName:xe(c_),propertyName:u_,attributeName:xe(u_),className:xe(Mo),labelName:xe(Mo),namespace:xe(Mo),macroName:xe(Mo),literal:Uo,string:_p,docString:xe(_p),character:xe(_p),attributeValue:xe(_p),number:xy,integer:xe(xy),float:xe(xy),bool:xe(Uo),regexp:xe(Uo),escape:xe(Uo),color:xe(Uo),url:xe(Uo),keyword:ln,self:xe(ln),null:xe(ln),atom:xe(ln),unit:xe(ln),modifier:xe(ln),operatorKeyword:xe(ln),controlKeyword:xe(ln),definitionKeyword:xe(ln),moduleKeyword:xe(ln),operator:cn,derefOperator:xe(cn),arithmeticOperator:xe(cn),logicOperator:xe(cn),bitwiseOperator:xe(cn),compareOperator:xe(cn),updateOperator:xe(cn),definitionOperator:xe(cn),typeOperator:xe(cn),controlOperator:xe(cn),punctuation:wy,separator:xe(wy),bracket:Su,angleBracket:xe(Su),squareBracket:xe(Su),paren:xe(Su),brace:xe(Su),content:un,heading:Rs,heading1:xe(Rs),heading2:xe(Rs),heading3:xe(Rs),heading4:xe(Rs),heading5:xe(Rs),heading6:xe(Rs),contentSeparator:xe(un),list:xe(un),quote:xe(un),emphasis:xe(un),strong:xe(un),link:xe(un),monospace:xe(un),strikethrough:xe(un),inserted:xe(),deleted:xe(),changed:xe(),invalid:xe(),meta:Pp,documentMeta:xe(Pp),annotation:xe(Pp),processingInstruction:xe(Pp),definition:xr.defineModifier(),constant:xr.defineModifier(),function:xr.defineModifier(),standard:xr.defineModifier(),local:xr.defineModifier(),special:xr.defineModifier()},V1e=ky([{tag:_.link,class:"tok-link"},{tag:_.heading,class:"tok-heading"},{tag:_.emphasis,class:"tok-emphasis"},{tag:_.strong,class:"tok-strong"},{tag:_.keyword,class:"tok-keyword"},{tag:_.atom,class:"tok-atom"},{tag:_.bool,class:"tok-bool"},{tag:_.url,class:"tok-url"},{tag:_.labelName,class:"tok-labelName"},{tag:_.inserted,class:"tok-inserted"},{tag:_.deleted,class:"tok-deleted"},{tag:_.literal,class:"tok-literal"},{tag:_.string,class:"tok-string"},{tag:_.number,class:"tok-number"},{tag:[_.regexp,_.escape,_.special(_.string)],class:"tok-string2"},{tag:_.variableName,class:"tok-variableName"},{tag:_.local(_.variableName),class:"tok-variableName tok-local"},{tag:_.definition(_.variableName),class:"tok-variableName tok-definition"},{tag:_.special(_.variableName),class:"tok-variableName2"},{tag:_.definition(_.propertyName),class:"tok-propertyName tok-definition"},{tag:_.typeName,class:"tok-typeName"},{tag:_.namespace,class:"tok-namespace"},{tag:_.className,class:"tok-className"},{tag:_.macroName,class:"tok-macroName"},{tag:_.propertyName,class:"tok-propertyName"},{tag:_.operator,class:"tok-operator"},{tag:_.comment,class:"tok-comment"},{tag:_.meta,class:"tok-meta"},{tag:_.invalid,class:"tok-invalid"},{tag:_.punctuation,class:"tok-punctuation"}]);var Ty,Zn=new Qe;function al(t){return be.define({combine:t?e=>e.concat(t):void 0})}var Rp=new Qe,si=class{constructor(e,i,r=[],n=""){this.data=e,this.name=n,rt.prototype.hasOwnProperty("tree")||Object.defineProperty(rt.prototype,"tree",{get(){return ze(this)}}),this.parser=i,this.extension=[zo.of(this),rt.languageData.of((o,s,a)=>{let l=d_(o,s,a),c=l.type.prop(Zn);if(!c)return[];let u=o.facet(c),f=l.type.prop(Rp);if(f){let d=l.resolve(s-l.from,a);for(let p of f)if(p.test(d,o)){let g=o.facet(p.facet);return p.type=="replace"?g:g.concat(u)}}return u})].concat(r)}isActiveAt(e,i,r=-1){return d_(e,i,r).type.prop(Zn)==this.data}findRegions(e){let i=e.facet(zo);if((i==null?void 0:i.data)==this.data)return[{from:0,to:e.doc.length}];if(!i||!i.allowsNesting)return[];let r=[],n=(o,s)=>{if(o.prop(Zn)==this.data){r.push({from:s,to:s+o.length});return}let a=o.prop(Qe.mounted);if(a){if(a.tree.prop(Zn)==this.data){if(a.overlay)for(let l of a.overlay)r.push({from:l.from+s,to:l.to+s});else r.push({from:s,to:s+o.length});return}else if(a.overlay){let l=r.length;if(n(a.tree,a.overlay[0].from+s),r.length>l)return}}for(let l=0;lr.isTop?i:void 0)]}),e.name)}configure(e,i){return new t(this.data,this.parser.configure(e),i||this.name)}get allowsNesting(){return this.parser.hasWrappers()}};function ze(t){let e=t.field(si.state,!1);return e?e.tree:qe.empty}function Dy(t,e,i=50){var r;let n=(r=t.field(si.state,!1))===null||r===void 0?void 0:r.context;if(!n)return null;let o=n.viewport;n.updateViewport({from:0,to:e});let s=n.isDone(e)||n.work(i,e)?n.tree:null;return n.updateViewport(o),s}var Py=class{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,i){let r=this.cursorPos-this.string.length;return e=this.cursorPos?this.doc.sliceString(e,i):this.string.slice(e-r,i-r)}},Tu=null,Is=class t{constructor(e,i,r=[],n,o,s,a,l){this.parser=e,this.state=i,this.fragments=r,this.tree=n,this.treeLen=o,this.viewport=s,this.skipped=a,this.scheduleOn=l,this.parse=null,this.tempSkipped=[]}static create(e,i,r){return new t(e,i,[],qe.empty,0,r,[],null)}startParse(){return this.parser.startParse(new Py(this.state.doc),this.fragments)}work(e,i){return i!=null&&i>=this.state.doc.length&&(i=void 0),this.tree!=qe.empty&&this.isDone(i!=null?i:this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var r;if(typeof e=="number"){let n=Date.now()+e;e=()=>Date.now()>n}for(this.parse||(this.parse=this.startParse()),i!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>i)&&i=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(i=this.parse.advance()););}),this.treeLen=e,this.tree=i,this.fragments=this.withoutTempSkipped(Un.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let i=Tu;Tu=this;try{return e()}finally{Tu=i}}withoutTempSkipped(e){for(let i;i=this.tempSkipped.pop();)e=p_(e,i.from,i.to);return e}changes(e,i){let{fragments:r,tree:n,treeLen:o,viewport:s,skipped:a}=this;if(this.takeTree(),!e.empty){let l=[];if(e.iterChangedRanges((c,u,f,d)=>l.push({fromA:c,toA:u,fromB:f,toB:d})),r=Un.applyChanges(r,l),n=qe.empty,o=0,s={from:e.mapPos(s.from,-1),to:e.mapPos(s.to,1)},this.skipped.length){a=[];for(let c of this.skipped){let u=e.mapPos(c.from,1),f=e.mapPos(c.to,-1);ue.from&&(this.fragments=p_(this.fragments,n,o),this.skipped.splice(r--,1))}return this.skipped.length>=i?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,i){this.skipped.push({from:e,to:i})}static getSkippingParser(e){return new class extends zn{createParse(i,r,n){let o=n[0].from,s=n[n.length-1].to;return{parsedPos:o,advance(){let l=Tu;if(l){for(let c of n)l.tempSkipped.push(c);e&&(l.scheduleOn=l.scheduleOn?Promise.all([l.scheduleOn,e]):e)}return this.parsedPos=s,new qe(Tt.none,[],[],s-o)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let i=this.fragments;return this.treeLen>=e&&i.length&&i[0].from==0&&i[0].to>=e}static get(){return Tu}};function p_(t,e,i){return Un.applyChanges(t,[{fromA:e,toA:i,fromB:e,toB:i}])}var Cu=class t{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let i=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),i.viewport.to);return i.work(20,r)||i.takeTree(),new t(i)}static init(e){let i=Math.min(3e3,e.doc.length),r=Is.create(e.facet(zo).parser,e,{from:0,to:i});return r.work(20,i)||r.takeTree(),new t(r)}};si.state=Fe.define({create:Cu.init,update(t,e){for(let i of e.effects)if(i.is(si.setState))return i.value;return e.startState.facet(zo)!=e.state.facet(zo)?Cu.init(e.state):t.apply(e)}});var x_=t=>{let e=setTimeout(()=>t(),500);return()=>clearTimeout(e)};typeof requestIdleCallback!="undefined"&&(x_=t=>{let e=-1,i=setTimeout(()=>{e=requestIdleCallback(t,{timeout:400})},100);return()=>e<0?clearTimeout(i):cancelIdleCallback(e)});var Ey=typeof navigator!="undefined"&&(!((Ty=navigator.scheduling)===null||Ty===void 0)&&Ty.isInputPending)?()=>navigator.scheduling.isInputPending():null,cB=Ye.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 i=this.view.state.field(si.state).context;(i.updateViewport(e.view.viewport)||this.view.viewport.to>i.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(i)}scheduleWork(){if(this.working)return;let{state:e}=this.view,i=e.field(si.state);(i.tree!=i.context.tree||!i.context.isDone(e.doc.length))&&(this.working=x_(this.work))}work(e){this.working=null;let i=Date.now();if(this.chunkEndn+1e3,l=o.context.work(()=>Ey&&Ey()||Date.now()>s,n+(a?0:1e5));this.chunkBudget-=Date.now()-i,(l||this.chunkBudget<=0)&&(o.context.takeTree(),this.view.dispatch({effects:si.setState.of(new Cu(o.context))})),this.chunkBudget>0&&!(l&&!a)&&this.scheduleWork(),this.checkAsyncSchedule(o.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(i=>oi(this.view.state,i)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),zo=be.define({combine(t){return t.length?t[0]:null},enables:t=>[si.state,cB,de.contentAttributes.compute([t],e=>{let i=e.facet(t);return i&&i.name?{"data-language":i.name}:{}})]}),At=class{constructor(e,i=[]){this.language=e,this.support=i,this.extension=[e,i]}},zt=class t{constructor(e,i,r,n,o,s=void 0){this.name=e,this.alias=i,this.extensions=r,this.filename=n,this.loadFunc=o,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:i,support:r}=e;if(!i){if(!r)throw new RangeError("Must pass either 'load' or 'support' to LanguageDescription.of");i=()=>Promise.resolve(r)}return new t(e.name,(e.alias||[]).concat(e.name).map(n=>n.toLowerCase()),e.extensions||[],e.filename,i,r)}static matchFilename(e,i){for(let n of e)if(n.filename&&n.filename.test(i))return n;let r=/\.([^.]+)$/.exec(i);if(r){for(let n of e)if(n.extensions.indexOf(r[1])>-1)return n}return null}static matchLanguageName(e,i,r=!0){i=i.toLowerCase();for(let n of e)if(n.alias.some(o=>o==i))return n;if(r)for(let n of e)for(let o of n.alias){let s=i.indexOf(o);if(s>-1&&(o.length>2||!/\w/.test(i[s-1])&&!/\w/.test(i[s+o.length])))return n}return null}},v_=be.define(),Nr=be.define({combine:t=>{if(!t.length)return" ";let e=t[0];if(!e||/\S/.test(e)||Array.from(e).some(i=>i!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(t[0]));return e}});function fn(t){let e=t.facet(Nr);return e.charCodeAt(0)==9?t.tabSize*e.length:e.length}function Vn(t,e){let i="",r=t.tabSize,n=t.facet(Nr)[0];if(n==" "){for(;e>=r;)i+=" ",e-=r;n=" "}for(let o=0;o=e?uB(t,i,e):null}var Ls=class{constructor(e,i={}){this.state=e,this.options=i,this.unit=fn(e)}lineAt(e,i=1){let r=this.state.doc.lineAt(e),{simulateBreak:n,simulateDoubleBreak:o}=this.options;return n!=null&&n>=r.from&&n<=r.to?o&&n==e?{text:"",from:e}:(i<0?n-1&&(o+=s-this.countColumn(r,r.search(/\S|$/))),o}countColumn(e,i=e.length){return Ai(e,this.state.tabSize,i)}lineIndent(e,i=1){let{text:r,from:n}=this.lineAt(e,i),o=this.options.overrideIndentation;if(o){let s=o(n);if(s>-1)return s}return this.countColumn(r,r.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}},ai=new Qe;function uB(t,e,i){let r=e.resolveStack(i),n=r.node.enterUnfinishedNodesBefore(i);if(n!=r.node){let o=[];for(let s=n;s!=r.node;s=s.parent)o.push(s);for(let s=o.length-1;s>=0;s--)r={node:o[s],next:r}}return w_(r,t,i)}function w_(t,e,i){for(let r=t;r;r=r.next){let n=hB(r.node);if(n)return n(Qy.create(e,i,r))}return 0}function fB(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak}function hB(t){let e=t.type.prop(ai);if(e)return e;let i=t.firstChild,r;if(i&&(r=i.type.prop(Qe.closedBy))){let n=t.lastChild,o=n&&r.indexOf(n.name)>-1;return s=>k_(s,!0,1,void 0,o&&!fB(s)?n.from:void 0)}return t.parent==null?dB:null}function dB(){return 0}var Qy=class t extends Ls{constructor(e,i,r){super(e.state,e.options),this.base=e,this.pos=i,this.context=r}get node(){return this.context.node}static create(e,i,r){return new t(e,i,r)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let i=this.state.doc.lineAt(e.from);for(;;){let r=e.resolve(i.from);for(;r.parent&&r.parent.from==r.from;)r=r.parent;if(pB(r,e))break;i=this.state.doc.lineAt(r.from)}return this.lineIndent(i.from)}continue(){return w_(this.context.next,this.base,this.pos)}};function pB(t,e){for(let i=e;i;i=i.parent)if(t==i)return!0;return!1}function OB(t){let e=t.node,i=e.childAfter(e.from),r=e.lastChild;if(!i)return null;let n=t.options.simulateBreak,o=t.state.doc.lineAt(i.from),s=n==null||n<=o.from?o.to:Math.min(o.to,n);for(let a=i.to;;){let l=e.childAfter(a);if(!l||l==r)return null;if(!l.type.isSkipped)return l.fromk_(r,e,i,t)}function k_(t,e,i,r,n){let o=t.textAfter,s=o.match(/^\s*/)[0].length,a=r&&o.slice(s,s+r.length)==r||n==t.pos+s,l=e?OB(t):null;return l?a?t.column(l.from):t.column(l.to):t.baseIndent+(a?0:t.unit*i)}var Ip=t=>t.baseIndent;function xi({except:t,units:e=1}={}){return i=>{let r=t&&t.test(i.textAfter);return i.baseIndent+(r?0:e*i.unit)}}var mB=200;function S_(){return rt.transactionFilter.of(t=>{if(!t.docChanged||!t.isUserEvent("input.type")&&!t.isUserEvent("input.complete"))return t;let e=t.startState.languageDataAt("indentOnInput",t.startState.selection.main.head);if(!e.length)return t;let i=t.newDoc,{head:r}=t.newSelection.main,n=i.lineAt(r);if(r>n.from+mB)return t;let o=i.sliceString(n.from,r);if(!e.some(c=>c.test(o)))return t;let{state:s}=t,a=-1,l=[];for(let{head:c}of s.selection.ranges){let u=s.doc.lineAt(c);if(u.from==a)continue;a=u.from;let f=ll(s,u.from);if(f==null)continue;let d=/^\s*/.exec(u.text)[0],p=Vn(s,f);d!=p&&l.push({from:u.from,to:u.from+d.length,insert:p})}return l.length?[t,{changes:l,sequential:!0}]:t})}var Ny=be.define(),Ht=new Qe;function jo(t){let e=t.firstChild,i=t.lastChild;return e&&e.toi)continue;if(o&&a.from=e&&c.to>i&&(o=c)}}return o}function bB(t){let e=t.lastChild;return e&&e.to==t.to&&e.type.isError}function Ap(t,e,i){for(let r of t.facet(Ny)){let n=r(t,e,i);if(n)return n}return gB(t,e,i)}function T_(t,e){let i=e.mapPos(t.from,1),r=e.mapPos(t.to,-1);return i>=r?void 0:{from:i,to:r}}var Lp=Se.define({map:T_}),Qu=Se.define({map:T_});function E_(t){let e=[];for(let{head:i}of t.state.selection.ranges)e.some(r=>r.from<=i&&r.to>=i)||e.push(t.lineBlockAt(i));return e}var Ds=Fe.define({create(){return we.none},update(t,e){t=t.map(e.changes);for(let i of e.effects)if(i.is(Lp)&&!yB(t,i.value.from,i.value.to)){let{preparePlaceholder:r}=e.state.facet(My),n=r?we.replace({widget:new Ay(r(e.state,i.value))}):O_;t=t.update({add:[n.range(i.value.from,i.value.to)]})}else i.is(Qu)&&(t=t.update({filter:(r,n)=>i.value.from!=r||i.value.to!=n,filterFrom:i.value.from,filterTo:i.value.to}));if(e.selection){let i=!1,{head:r}=e.selection.main;t.between(r,r,(n,o)=>{nr&&(i=!0)}),i&&(t=t.update({filterFrom:r,filterTo:r,filter:(n,o)=>o<=r||n>=r}))}return t},provide:t=>de.decorations.from(t),toJSON(t,e){let i=[];return t.between(0,e.doc.length,(r,n)=>{i.push(r,n)}),i},fromJSON(t){if(!Array.isArray(t)||t.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let i=0;i{(!n||n.from>o)&&(n={from:o,to:s})}),n}function yB(t,e,i){let r=!1;return t.between(e,e,(n,o)=>{n==e&&o==i&&(r=!0)}),r}function C_(t,e){return t.field(Ds,!1)?e:e.concat(Se.appendConfig.of(Np()))}var Dp=t=>{for(let e of E_(t)){let i=Ap(t.state,e.from,e.to);if(i)return t.dispatch({effects:C_(t.state,[Lp.of(i),P_(t,i)])}),!0}return!1},__=t=>{if(!t.state.field(Ds,!1))return!1;let e=[];for(let i of E_(t)){let r=$p(t.state,i.from,i.to);r&&e.push(Qu.of(r),P_(t,r,!1))}return e.length&&t.dispatch({effects:e}),e.length>0};function P_(t,e,i=!0){let r=t.state.doc.lineAt(e.from).number,n=t.state.doc.lineAt(e.to).number;return de.announce.of(`${t.state.phrase(i?"Folded lines":"Unfolded lines")} ${r} ${t.state.phrase("to")} ${n}.`)}var Q_=t=>{let{state:e}=t,i=[];for(let r=0;r{let e=t.state.field(Ds,!1);if(!e||!e.size)return!1;let i=[];return e.between(0,t.state.doc.length,(r,n)=>{i.push(Qu.of({from:r,to:n}))}),t.dispatch({effects:i}),!0};var xB={placeholderDOM:null,preparePlaceholder:null,placeholderText:"\u2026"},My=be.define({combine(t){return wt(t,xB)}});function Np(t){let e=[Ds,wB];return t&&e.push(My.of(t)),e}function $_(t,e){let{state:i}=t,r=i.facet(My),n=s=>{let a=t.lineBlockAt(t.posAtDOM(s.target)),l=$p(t.state,a.from,a.to);l&&t.dispatch({effects:Qu.of(l)}),s.preventDefault()};if(r.placeholderDOM)return r.placeholderDOM(t,n,e);let o=document.createElement("span");return o.textContent=r.placeholderText,o.setAttribute("aria-label",i.phrase("folded code")),o.title=i.phrase("unfold"),o.className="cm-foldPlaceholder",o.onclick=n,o}var O_=we.replace({widget:new class extends Ft{toDOM(t){return $_(t,null)}}}),Ay=class extends Ft{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return $_(e,this.value)}},vB={openText:"\u2304",closedText:"\u203A",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1},Eu=class extends tr{constructor(e,i){super(),this.config=e,this.open=i}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let i=document.createElement("span");return i.textContent=this.open?this.config.openText:this.config.closedText,i.title=e.state.phrase(this.open?"Fold line":"Unfold line"),i}};function X_(t={}){let e=Object.assign(Object.assign({},vB),t),i=new Eu(e,!0),r=new Eu(e,!1),n=Ye.fromClass(class{constructor(s){this.from=s.viewport.from,this.markers=this.buildMarkers(s)}update(s){(s.docChanged||s.viewportChanged||s.startState.facet(zo)!=s.state.facet(zo)||s.startState.field(Ds,!1)!=s.state.field(Ds,!1)||ze(s.startState)!=ze(s.state)||e.foldingChanged(s))&&(this.markers=this.buildMarkers(s.view))}buildMarkers(s){let a=new Ki;for(let l of s.viewportLineBlocks){let c=$p(s.state,l.from,l.to)?r:Ap(s.state,l.from,l.to)?i:null;c&&a.add(l.from,l.from,c)}return a.finish()}}),{domEventHandlers:o}=e;return[n,yy({class:"cm-foldGutter",markers(s){var a;return((a=s.plugin(n))===null||a===void 0?void 0:a.markers)||nt.empty},initialSpacer(){return new Eu(e,!1)},domEventHandlers:Object.assign(Object.assign({},o),{click:(s,a,l)=>{if(o.click&&o.click(s,a,l))return!0;let c=$p(s.state,a.from,a.to);if(c)return s.dispatch({effects:Qu.of(c)}),!0;let u=Ap(s.state,a.from,a.to);return u?(s.dispatch({effects:Lp.of(u)}),!0):!1}})}),Np()]}var wB=de.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"}}),ol=class t{constructor(e,i){this.specs=e;let r;function n(a){let l=zi.newName();return(r||(r=Object.create(null)))["."+l]=a,l}let o=typeof i.all=="string"?i.all:i.all?n(i.all):void 0,s=i.scope;this.scope=s instanceof si?a=>a.prop(Zn)==s.data:s?a=>a==s:void 0,this.style=ky(e.map(a=>({tag:a.tag,class:a.class||n(Object.assign({},a,{tag:null}))})),{all:o}).style,this.module=r?new zi(r):null,this.themeType=i.themeType}static define(e,i){return new t(e,i||{})}},$y=be.define(),R_=be.define({combine(t){return t.length?[t[0]]:null}});function Cy(t){let e=t.facet($y);return e.length?e:t.facet(R_)}function Uy(t,e){let i=[kB],r;return t instanceof ol&&(t.module&&i.push(de.styleModule.of(t.module)),r=t.themeType),e!=null&&e.fallback?i.push(R_.of(t)):r?i.push($y.computeN([de.darkTheme],n=>n.facet(de.darkTheme)==(r=="dark")?[t]:[])):i.push($y.of(t)),i}var Xy=class{constructor(e){this.markCache=Object.create(null),this.tree=ze(e.state),this.decorations=this.buildDeco(e,Cy(e.state)),this.decoratedTo=e.viewport.to}update(e){let i=ze(e.state),r=Cy(e.state),n=r!=Cy(e.startState),{viewport:o}=e.view,s=e.changes.mapPos(this.decoratedTo,1);i.length=o.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=s):(i!=this.tree||e.viewportChanged||n)&&(this.tree=i,this.decorations=this.buildDeco(e.view,r),this.decoratedTo=o.to)}buildDeco(e,i){if(!i||!this.tree.length)return we.none;let r=new Ki;for(let{from:n,to:o}of e.visibleRanges)Sy(this.tree,i,(s,a,l)=>{r.add(s,a,this.markCache[l]||(this.markCache[l]=we.mark({class:l})))},n,o);return r.finish()}},kB=Qt.high(Ye.fromClass(Xy,{decorations:t=>t.decorations})),tye=ol.define([{tag:_.meta,color:"#404740"},{tag:_.link,textDecoration:"underline"},{tag:_.heading,textDecoration:"underline",fontWeight:"bold"},{tag:_.emphasis,fontStyle:"italic"},{tag:_.strong,fontWeight:"bold"},{tag:_.strikethrough,textDecoration:"line-through"},{tag:_.keyword,color:"#708"},{tag:[_.atom,_.bool,_.url,_.contentSeparator,_.labelName],color:"#219"},{tag:[_.literal,_.inserted],color:"#164"},{tag:[_.string,_.deleted],color:"#a11"},{tag:[_.regexp,_.escape,_.special(_.string)],color:"#e40"},{tag:_.definition(_.variableName),color:"#00f"},{tag:_.local(_.variableName),color:"#30a"},{tag:[_.typeName,_.namespace],color:"#085"},{tag:_.className,color:"#167"},{tag:[_.special(_.variableName),_.macroName],color:"#256"},{tag:_.definition(_.propertyName),color:"#00c"},{tag:_.comment,color:"#940"},{tag:_.invalid,color:"#f00"}]),SB=de.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),I_=1e4,L_="()[]{}",D_=be.define({combine(t){return wt(t,{afterCursor:!0,brackets:L_,maxScanDistance:I_,renderMatch:CB})}}),TB=we.mark({class:"cm-matchingBracket"}),EB=we.mark({class:"cm-nonmatchingBracket"});function CB(t){let e=[],i=t.matched?TB:EB;return e.push(i.range(t.start.from,t.start.to)),t.end&&e.push(i.range(t.end.from,t.end.to)),e}var _B=Fe.define({create(){return we.none},update(t,e){if(!e.docChanged&&!e.selection)return t;let i=[],r=e.state.facet(D_);for(let n of e.state.selection.ranges){if(!n.empty)continue;let o=vr(e.state,n.head,-1,r)||n.head>0&&vr(e.state,n.head-1,1,r)||r.afterCursor&&(vr(e.state,n.head,1,r)||n.headde.decorations.from(t)}),PB=[_B,SB];function N_(t={}){return[D_.of(t),PB]}var Au=new Qe;function Ry(t,e,i){let r=t.prop(e<0?Qe.openedBy:Qe.closedBy);if(r)return r;if(t.name.length==1){let n=i.indexOf(t.name);if(n>-1&&n%2==(e<0?1:0))return[i[n+e]]}return null}function Iy(t){let e=t.type.prop(Au);return e?e(t.node):t}function vr(t,e,i,r={}){let n=r.maxScanDistance||I_,o=r.brackets||L_,s=ze(t),a=s.resolveInner(e,i);for(let l=a;l;l=l.parent){let c=Ry(l.type,i,o);if(c&&l.from0?e>=u.from&&eu.from&&e<=u.to))return QB(t,e,i,l,u,c,o)}}return AB(t,e,i,s,a.type,n,o)}function QB(t,e,i,r,n,o,s){let a=r.parent,l={from:n.from,to:n.to},c=0,u=a==null?void 0:a.cursor();if(u&&(i<0?u.childBefore(r.from):u.childAfter(r.to)))do if(i<0?u.to<=r.from:u.from>=r.to){if(c==0&&o.indexOf(u.type.name)>-1&&u.from0)return null;let c={from:i<0?e-1:e,to:i>0?e+1:e},u=t.doc.iterRange(e,i>0?t.doc.length:0),f=0;for(let d=0;!u.next().done&&d<=o;){let p=u.value;i<0&&(d+=p.length);let g=e+d*i;for(let x=i>0?0:p.length-1,w=i>0?p.length:-1;x!=w;x+=i){let S=s.indexOf(p[x]);if(!(S<0||r.resolveInner(g+x,1).type!=n))if(S%2==0==i>0)f++;else{if(f==1)return{start:c,end:{from:g+x,to:g+x+1},matched:S>>1==l>>1};f--}}i>0&&(d+=p.length)}return u.done?{start:c,matched:!1}:null}function m_(t,e,i,r=0,n=0){e==null&&(e=t.search(/[^\s\u00a0]/),e==-1&&(e=t.length));let o=n;for(let s=r;s=this.string.length}sol(){return this.pos==0}peek(){return this.string.charAt(this.pos)||void 0}next(){if(this.posi}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 i=this.string.indexOf(e,this.pos);if(i>-1)return this.pos=i,!0}backUp(e){this.pos-=e}column(){return this.lastColumnPosr?s.toLowerCase():s,o=this.string.substr(this.pos,e.length);return n(o)==n(e)?(i!==!1&&(this.pos+=e.length),!0):null}else{let n=this.string.slice(this.pos).match(e);return n&&n.index>0?null:(n&&i!==!1&&(this.pos+=n[0].length),n)}}current(){return this.string.slice(this.start,this.pos)}};function $B(t){return{name:t.name||"",token:t.token,blankLine:t.blankLine||(()=>{}),startState:t.startState||(()=>!0),copyState:t.copyState||XB,indent:t.indent||(()=>null),languageData:t.languageData||{},tokenTable:t.tokenTable||jy}}function XB(t){if(typeof t!="object")return t;let e={};for(let i in t){let r=t[i];e[i]=r instanceof Array?r.slice():r}return e}var g_=new WeakMap,_u=class t extends si{constructor(e){let i=al(e.languageData),r=$B(e),n,o=new class extends zn{createParse(s,a,l){return new Ly(n,s,a,l)}};super(i,o,[v_.of((s,a)=>this.getIndent(s,a))],e.name),this.topNode=DB(i),n=this,this.streamParser=r,this.stateAfter=new Qe({perNode:!0}),this.tokenTable=e.tokenTable?new Xp(r.tokenTable):LB}static define(e){return new t(e)}getIndent(e,i){let r=ze(e.state),n=r.resolve(i);for(;n&&n.type!=this.topNode;)n=n.parent;if(!n)return null;let o,{overrideIndentation:s}=e.options;s&&(o=g_.get(e.state),o!=null&&o1e4)return null;for(;l=r&&i+e.length<=n&&e.prop(t.stateAfter);if(o)return{state:t.streamParser.copyState(o),pos:i+e.length};for(let s=e.children.length-1;s>=0;s--){let a=e.children[s],l=i+e.positions[s],c=a instanceof qe&&l=e.length)return e;!n&&e.type==t.topNode&&(n=!0);for(let o=e.children.length-1;o>=0;o--){let s=e.positions[o],a=e.children[o],l;if(si&&zy(t,n.tree,0-n.offset,i,s),l;if(a&&(l=M_(t,n.tree,i+n.offset,a.pos+n.offset,!1)))return{state:a.state,tree:l}}return{state:t.streamParser.startState(r?fn(r):4),tree:qe.empty}}var Ly=class{constructor(e,i,r,n){this.lang=e,this.input=i,this.fragments=r,this.ranges=n,this.stoppedAt=null,this.chunks=[],this.chunkPos=[],this.chunk=[],this.chunkReused=void 0,this.rangeIndex=0,this.to=n[n.length-1].to;let o=Is.get(),s=n[0].from,{state:a,tree:l}=RB(e,r,s,o==null?void 0:o.state);this.state=a,this.parsedPos=this.chunkStart=s+l.length;for(let c=0;c=i?this.finish():e&&this.parsedPos>=e.viewport.to?(e.skipUntilInView(this.parsedPos,i),this.finish()):null}stopAt(e){this.stoppedAt=e}lineAfter(e){let i=this.input.chunk(e);if(this.input.lineChunks)i==` `&&(i="");else{let r=i.indexOf(` -`);r>-1&&(i=i.slice(0,r))}return e+i.length<=this.to?i:i.slice(0,this.to-e)}nextLine(){let e=this.parsedPos,i=this.lineAfter(e),r=e+i.length;for(let n=this.rangeIndex;;){let o=this.ranges[n].to;if(o>=r||(i=i.slice(0,o-(r-i.length)),n++,n==this.ranges.length))break;let s=this.ranges[n].from,a=this.lineAfter(s);i+=a,r=s+a.length}return{line:i,end:r}}skipGapsTo(e,i,r){for(;;){let n=this.ranges[this.rangeIndex].to,o=e+i;if(r>0?n>o:n>=o)break;let s=this.ranges[++this.rangeIndex].from;i+=s-n}return i}moveRangeIndex(){for(;this.ranges[this.rangeIndex].to1){o=this.skipGapsTo(i,o,1),i+=o;let s=this.chunk.length;o=this.skipGapsTo(r,o,-1),r+=o,n+=this.chunk.length-s}return this.chunk.push(e,i,r,n),o}parseLine(e){let{line:i,end:r}=this.nextLine(),n=0,{streamParser:o}=this.lang,s=new sl(i,e?e.state.tabSize:4,e?fn(e.state):2);if(s.eol())o.blankLine(this.state,s.indentUnit);else for(;!s.eol();){let a=U_(o.token,s,this.state);if(a&&(n=this.emitToken(this.lang.tokenTable.resolve(a),this.parsedPos+s.start,this.parsedPos+s.pos,4,n)),s.start>1e4)break}this.parsedPos=r,this.moveRangeIndex(),this.parsedPose.start)return n}throw new Error("Stream parser failed to advance stream.")}var jy=Object.create(null),Pu=[St.none],IB=new Mn(Pu),b_=[],y_=Object.create(null),z_=Object.create(null);for(let[t,e]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])z_[t]=j_(jy,e);var Xp=class{constructor(e){this.extra=e,this.table=Object.assign(Object.create(null),z_)}resolve(e){return e?this.table[e]||(this.table[e]=j_(this.extra,e)):0}},LB=new Xp(jy);function _y(t,e){b_.indexOf(t)>-1||(b_.push(t),console.warn(e))}function j_(t,e){let i=[];for(let a of e.split(" ")){let l=[];for(let c of a.split(".")){let u=t[c]||_[c];u?typeof u=="function"?l.length?l=l.map(u):_y(c,`Modifier ${c} used at start of tag`):l.length?_y(c,`Tag ${c} used as modifier`):l=Array.isArray(u)?u:[u]:_y(c,`Unknown highlighting tag ${c}`)}for(let c of l)i.push(c)}if(!i.length)return 0;let r=e.replace(/ /g,"_"),n=r+" "+i.map(a=>a.id),o=y_[n];if(o)return o.id;let s=y_[n]=St.define({id:Pu.length,name:r,props:[Bt({[r]:i})]});return Pu.push(s),s.id}function DB(t){let e=St.define({id:Pu.length,name:"Document",props:[Zn.add(()=>t)],top:!0});return Pu.push(e),e}var iye={rtl:we.mark({class:"cm-iso",inclusive:!0,attributes:{dir:"rtl"},bidiIsolate:ot.RTL}),ltr:we.mark({class:"cm-iso",inclusive:!0,attributes:{dir:"ltr"},bidiIsolate:ot.LTR}),auto:we.mark({class:"cm-iso",inclusive:!0,attributes:{dir:"auto"},bidiIsolate:null})};var cl=class{constructor(e,i,r){this.state=e,this.pos=i,this.explicit=r,this.abortListeners=[]}tokenBefore(e){let i=ze(this.state).resolveInner(this.pos,-1);for(;i&&e.indexOf(i.name)<0;)i=i.parent;return i?{from:i.from,to:this.pos,text:this.state.sliceDoc(i.from,this.pos),type:i.type}:null}matchBefore(e){let i=this.state.doc.lineAt(this.pos),r=Math.max(i.from,this.pos-250),n=i.text.slice(r-i.from,this.pos-i.from),o=n.search(G_(e,!1));return o<0?null:{from:r+o,to:this.pos,text:n.slice(o)}}get aborted(){return this.abortListeners==null}addEventListener(e,i){e=="abort"&&this.abortListeners&&this.abortListeners.push(i)}};function q_(t){let e=Object.keys(t).join(""),i=/\w/.test(e);return i&&(e=e.replace(/\w/g,"")),`[${i?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function NB(t){let e=Object.create(null),i=Object.create(null);for(let{label:n}of t){e[n[0]]=!0;for(let o=1;otypeof n=="string"?{label:n}:n),[i,r]=e.every(n=>/^\w+$/.test(n.label))?[/\w*$/,/\w+$/]:NB(e);return n=>{let o=n.matchBefore(r);return o||n.explicit?{from:o?o.from:n.pos,options:e,validFor:i}:null}}function jp(t,e){return i=>{for(let r=ze(i.state).resolveInner(i.pos,-1);r;r=r.parent){if(t.indexOf(r.name)>-1)return null;if(r.type.isTop)break}return e(i)}}var Mp=class{constructor(e,i,r,n){this.completion=e,this.source=i,this.match=r,this.score=n}};function qo(t){return t.selection.main.from}function G_(t,e){var i;let{source:r}=t,n=e&&r[0]!="^",o=r[r.length-1]!="$";return!n&&!o?t:new RegExp(`${n?"^":""}(?:${r})${o?"$":""}`,(i=t.flags)!==null&&i!==void 0?i:t.ignoreCase?"i":"")}var tx=bi.define();function MB(t,e,i,r){let{main:n}=t.selection,o=i-n.from,s=r-n.from;return Object.assign(Object.assign({},t.changeByRange(a=>a!=n&&i!=r&&t.sliceDoc(a.from+o,a.from+s)!=t.sliceDoc(i,r)?{range:a}:{changes:{from:a.from+o,to:r==n.from?a.to:a.from+s,insert:e},range:J.cursor(a.from+o+e.length)})),{scrollIntoView:!0,userEvent:"input.complete"})}var W_=new WeakMap;function UB(t){if(!Array.isArray(t))return t;let e=W_.get(t);return e||W_.set(t,e=Iu(t)),e}var Up=Se.define(),$u=Se.define(),By=class{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let i=0;i=48&&D<=57||D>=97&&D<=122?2:D>=65&&D<=90?1:0:(C=ru(D))!=C.toLowerCase()?1:C!=C.toUpperCase()?2:0;(!T||j==1&&w||I==0&&j!=0)&&(i[f]==D||r[f]==D&&(d=!0)?s[f++]=T:s.length&&(S=!1)),I=j,T+=Pi(D)}return f==l&&s[0]==0&&S?this.result(-100+(d?-200:0),s,e):p==l&&g==0?this.ret(-200-e.length+(x==e.length?0:-100),[0,x]):a>-1?this.ret(-700-e.length,[a,a+this.pattern.length]):p==l?this.ret(-900-e.length,[g,x]):f==l?this.result(-100+(d?-200:0)+-700+(S?0:-1100),s,e):i.length==2?null:this.result((n[0]?-700:0)+-200+-1100,n,e)}result(e,i,r){let n=[],o=0;for(let s of i){let a=s+(this.astral?Pi(Nt(r,s)):1);o&&n[o-1]==s?n[o-1]=a:(n[o++]=s,n[o++]=a)}return this.ret(e-r.length,n)}},Zy=class{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:zB,filterStrict:!1,compareCompletions:(e,i)=>e.label.localeCompare(i.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,i)=>e&&i,closeOnBlur:(e,i)=>e&&i,icons:(e,i)=>e&&i,tooltipClass:(e,i)=>r=>B_(e(r),i(r)),optionClass:(e,i)=>r=>B_(e(r),i(r)),addToOptions:(e,i)=>e.concat(i),filterStrict:(e,i)=>e||i})}});function B_(t,e){return t?e?t+" "+e:t:e}function zB(t,e,i,r,n,o){let s=t.textDirection==ot.RTL,a=s,l=!1,c="top",u,f,d=e.left-n.left,p=n.right-e.right,g=r.right-r.left,x=r.bottom-r.top;if(a&&d=x||T>e.top?u=i.bottom-e.top:(c="bottom",u=e.bottom-i.top)}let w=(e.bottom-e.top)/o.offsetHeight,S=(e.right-e.left)/o.offsetWidth;return{style:`${c}: ${u/w}px; max-width: ${f/S}px`,class:"cm-completionInfo-"+(l?s?"left-narrow":"right-narrow":a?"left":"right")}}function jB(t){let e=t.addToOptions.slice();return t.icons&&e.push({render(i){let r=document.createElement("div");return r.classList.add("cm-completionIcon"),i.type&&r.classList.add(...i.type.split(/\s+/g).map(n=>"cm-completionIcon-"+n)),r.setAttribute("aria-hidden","true"),r},position:20}),e.push({render(i,r,n,o){let s=document.createElement("span");s.className="cm-completionLabel";let a=i.displayLabel||i.label,l=0;for(let c=0;cl&&s.appendChild(document.createTextNode(a.slice(l,u)));let d=s.appendChild(document.createElement("span"));d.appendChild(document.createTextNode(a.slice(u,f))),d.className="cm-completionMatchedText",l=f}return li.position-r.position).map(i=>i.render)}function qy(t,e,i){if(t<=i)return{from:0,to:t};if(e<0&&(e=0),e<=t>>1){let n=Math.floor(e/i);return{from:n*i,to:(n+1)*i}}let r=Math.floor((t-e)/i);return{from:t-(r+1)*i,to:t-r*i}}var Vy=class{constructor(e,i,r){this.view=e,this.stateField=i,this.applyCompletion=r,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:l=>this.placeInfo(l),key:this},this.space=null,this.currentClass="";let n=e.state.field(i),{options:o,selected:s}=n.open,a=e.state.facet(li);this.optionContent=jB(a),this.optionClass=a.optionClass,this.tooltipClass=a.tooltipClass,this.range=qy(o.length,s,a.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",l=>{let{options:c}=e.state.field(i).open;for(let u=l.target,f;u&&u!=this.dom;u=u.parentNode)if(u.nodeName=="LI"&&(f=/-(\d+)$/.exec(u.id))&&+f[1]{let c=e.state.field(this.stateField,!1);c&&c.tooltip&&e.state.facet(li).closeOnBlur&&l.relatedTarget!=e.contentDOM&&e.dispatch({effects:$u.of(null)})}),this.showOptions(o,n.id)}mount(){this.updateSel()}showOptions(e,i){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,i,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var i;let r=e.state.field(this.stateField),n=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),r!=n){let{options:o,selected:s,disabled:a}=r.open;(!n.open||n.open.options!=o)&&(this.range=qy(o.length,s,e.state.facet(li).maxRenderedOptions),this.showOptions(o,r.id)),this.updateSel(),a!=((i=n.open)===null||i===void 0?void 0:i.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!a)}}updateTooltipClass(e){let i=this.tooltipClass(e);if(i!=this.currentClass){for(let r of this.currentClass.split(" "))r&&this.dom.classList.remove(r);for(let r of i.split(" "))r&&this.dom.classList.add(r);this.currentClass=i}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),i=e.open;if((i.selected>-1&&i.selected=this.range.to)&&(this.range=qy(i.options.length,i.selected,this.view.state.facet(li).maxRenderedOptions),this.showOptions(i.options,e.id)),this.updateSelectedOption(i.selected)){this.destroyInfo();let{completion:r}=i.options[i.selected],{info:n}=r;if(!n)return;let o=typeof n=="string"?document.createTextNode(n):n(r);if(!o)return;"then"in o?o.then(s=>{s&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(s,r)}).catch(s=>oi(this.view.state,s,"completion info")):this.addInfoPane(o,r)}}addInfoPane(e,i){this.destroyInfo();let r=this.info=document.createElement("div");if(r.className="cm-tooltip cm-completionInfo",e.nodeType!=null)r.appendChild(e),this.infoDestroy=null;else{let{dom:n,destroy:o}=e;r.appendChild(n),this.infoDestroy=o||null}this.dom.appendChild(r),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let i=null;for(let r=this.list.firstChild,n=this.range.from;r;r=r.nextSibling,n++)r.nodeName!="LI"||!r.id?n--:n==e?r.hasAttribute("aria-selected")||(r.setAttribute("aria-selected","true"),i=r):r.hasAttribute("aria-selected")&&r.removeAttribute("aria-selected");return i&&WB(this.list,i),i}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let i=this.dom.getBoundingClientRect(),r=this.info.getBoundingClientRect(),n=e.getBoundingClientRect(),o=this.space;if(!o){let s=this.dom.ownerDocument.defaultView||window;o={left:0,top:0,right:s.innerWidth,bottom:s.innerHeight}}return n.top>Math.min(o.bottom,i.bottom)-10||n.bottomr.from||r.from==0))if(o=d,typeof c!="string"&&c.header)n.appendChild(c.header(c));else{let p=n.appendChild(document.createElement("completion-section"));p.textContent=d}}let u=n.appendChild(document.createElement("li"));u.id=i+"-"+s,u.setAttribute("role","option");let f=this.optionClass(a);f&&(u.className=f);for(let d of this.optionContent){let p=d(a,this.view.state,this.view,l);p&&u.appendChild(p)}}return r.from&&n.classList.add("cm-completionListIncompleteTop"),r.tonew Vy(i,t,e)}function WB(t,e){let i=t.getBoundingClientRect(),r=e.getBoundingClientRect(),n=i.height/t.offsetHeight;r.topi.bottom&&(t.scrollTop+=(r.bottom-i.bottom)/n)}function Z_(t){return(t.boost||0)*100+(t.apply?10:0)+(t.info?5:0)+(t.type?1:0)}function BB(t,e){let i=[],r=null,n=c=>{i.push(c);let{section:u}=c.completion;if(u){r||(r=[]);let f=typeof u=="string"?u:u.name;r.some(d=>d.name==f)||r.push(typeof u=="string"?{name:f}:u)}},o=e.facet(li);for(let c of t)if(c.hasResult()){let u=c.result.getMatch;if(c.result.filter===!1)for(let f of c.result.options)n(new Mp(f,c.source,u?u(f):[],1e9-i.length));else{let f=e.sliceDoc(c.from,c.to),d,p=o.filterStrict?new Zy(f):new By(f);for(let g of c.result.options)if(d=p.match(g.label)){let x=g.displayLabel?u?u(g,d.matched):[]:d.matched;n(new Mp(g,c.source,x,d.score+(g.boost||0)))}}}if(r){let c=Object.create(null),u=0,f=(d,p)=>{var g,x;return((g=d.rank)!==null&&g!==void 0?g:1e9)-((x=p.rank)!==null&&x!==void 0?x:1e9)||(d.namef.score-u.score||l(u.completion,f.completion))){let u=c.completion;!a||a.label!=u.label||a.detail!=u.detail||a.type!=null&&u.type!=null&&a.type!=u.type||a.apply!=u.apply||a.boost!=u.boost?s.push(c):Z_(c.completion)>Z_(a)&&(s[s.length-1]=c),a=c.completion}return s}var Yy=class t{constructor(e,i,r,n,o,s){this.options=e,this.attrs=i,this.tooltip=r,this.timestamp=n,this.selected=o,this.disabled=s}setSelected(e,i){return e==this.selected||e>=this.options.length?this:new t(this.options,V_(i,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,i,r,n,o){let s=BB(e,i);if(!s.length)return n&&e.some(l=>l.state==1)?new t(n.options,n.attrs,n.tooltip,n.timestamp,n.selected,!0):null;let a=i.facet(li).selectOnOpen?0:-1;if(n&&n.selected!=a&&n.selected!=-1){let l=n.options[n.selected].completion;for(let c=0;cc.hasResult()?Math.min(l,c.from):l,1e8),create:HB,above:o.aboveCursor},n?n.timestamp:Date.now(),a,!1)}map(e){return new t(this.options,this.attrs,Object.assign(Object.assign({},this.tooltip),{pos:e.mapPos(this.tooltip.pos)}),this.timestamp,this.selected,this.disabled)}},Fy=class t{constructor(e,i,r){this.active=e,this.id=i,this.open=r}static start(){return new t(YB,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:i}=e,r=i.facet(li),o=(r.override||i.languageDataAt("autocomplete",qo(i)).map(UB)).map(a=>(this.active.find(c=>c.source==a)||new dn(a,this.active.some(c=>c.state!=0)?1:0)).update(e,r));o.length==this.active.length&&o.every((a,l)=>a==this.active[l])&&(o=this.active);let s=this.open;s&&e.docChanged&&(s=s.map(e.changes)),e.selection||o.some(a=>a.hasResult()&&e.changes.touchesRange(a.from,a.to))||!ZB(o,this.active)?s=Yy.build(o,i,this.id,s,r):s&&s.disabled&&!o.some(a=>a.state==1)&&(s=null),!s&&o.every(a=>a.state!=1)&&o.some(a=>a.hasResult())&&(o=o.map(a=>a.hasResult()?new dn(a.source,0):a));for(let a of e.effects)a.is(J_)&&(s=s&&s.setSelected(a.value,this.id));return o==this.active&&s==this.open?this:new t(o,this.id,s)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:VB}};function ZB(t,e){if(t==e)return!0;for(let i=0,r=0;;){for(;i-1&&(i["aria-activedescendant"]=t+"-"+e),i}var YB=[];function Hy(t,e){if(t.isUserEvent("input.complete")){let i=t.annotation(tx);if(i&&e.activateOnCompletion(i))return"input"}return t.isUserEvent("input.type")?"input":t.isUserEvent("delete.backward")?"delete":null}var dn=class t{constructor(e,i,r=-1){this.source=e,this.state=i,this.explicitPos=r}hasResult(){return!1}update(e,i){let r=Hy(e,i),n=this;r?n=n.handleUserEvent(e,r,i):e.docChanged?n=n.handleChange(e):e.selection&&n.state!=0&&(n=new t(n.source,0));for(let o of e.effects)if(o.is(Up))n=new t(n.source,1,o.value?qo(e.state):-1);else if(o.is($u))n=new t(n.source,0);else if(o.is(K_))for(let s of o.value)s.source==n.source&&(n=s);return n}handleUserEvent(e,i,r){return i=="delete"||!r.activateOnTyping?this.map(e.changes):new t(this.source,1)}handleChange(e){return e.changes.touchesRange(qo(e.startState))?new t(this.source,0):this.map(e.changes)}map(e){return e.empty||this.explicitPos<0?this:new t(this.source,this.state,e.mapPos(this.explicitPos))}},zp=class t extends dn{constructor(e,i,r,n,o){super(e,2,i),this.result=r,this.from=n,this.to=o}hasResult(){return!0}handleUserEvent(e,i,r){var n;let o=this.result;o.map&&!e.changes.empty&&(o=o.map(o,e.changes));let s=e.changes.mapPos(this.from),a=e.changes.mapPos(this.to,1),l=qo(e.state);if((this.explicitPos<0?l<=s:la||!o||i=="delete"&&qo(e.startState)==this.from)return new dn(this.source,i=="input"&&r.activateOnTyping?1:0);let c=this.explicitPos<0?-1:e.changes.mapPos(this.explicitPos);return FB(o.validFor,e.state,s,a)?new t(this.source,c,o,s,a):o.update&&(o=o.update(o,s,a,new cl(e.state,l,c>=0)))?new t(this.source,c,o,o.from,(n=o.to)!==null&&n!==void 0?n:qo(e.state)):new dn(this.source,1,c)}handleChange(e){return e.changes.touchesRange(this.from,this.to)?new dn(this.source,0):this.map(e.changes)}map(e){return e.empty?this:(this.result.map?this.result.map(this.result,e):this.result)?new t(this.source,this.explicitPos<0?-1:e.mapPos(this.explicitPos),this.result,e.mapPos(this.from),e.mapPos(this.to,1)):new dn(this.source,0)}};function FB(t,e,i,r){if(!t)return!1;let n=e.sliceDoc(i,r);return typeof t=="function"?t(n,i,r,e):G_(t,!0).test(n)}var K_=Se.define({map(t,e){return t.map(i=>i.map(e))}}),J_=Se.define(),ji=Fe.define({create(){return Fy.start()},update(t,e){return t.update(e)},provide:t=>[Bn.from(t,e=>e.tooltip),de.contentAttributes.from(t,e=>e.attrs)]});function ix(t,e){let i=e.completion.apply||e.completion.label,r=t.state.field(ji).active.find(n=>n.source==e.source);return r instanceof zp?(typeof i=="string"?t.dispatch(Object.assign(Object.assign({},MB(t.state,i,r.from,r.to)),{annotations:tx.of(e.completion)})):i(t,e.completion,r.from,r.to),!0):!1}var HB=qB(ji,ix);function Yn(t,e="option"){return i=>{let r=i.state.field(ji,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp-1?r.open.selected+n*(t?1:-1):t?0:s-1;return a<0?a=e=="page"?0:s-1:a>=s&&(a=e=="page"?s-1:0),i.dispatch({effects:J_.of(a)}),!0}}var qp=t=>{let e=t.state.field(ji,!1);return t.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestampt.state.field(ji,!1)?(t.dispatch({effects:Up.of(!0)}),!0):!1,rx=t=>{let e=t.state.field(ji,!1);return!e||!e.active.some(i=>i.state!=0)?!1:(t.dispatch({effects:$u.of(null)}),!0)},Gy=class{constructor(e,i){this.active=e,this.context=i,this.time=Date.now(),this.updates=[],this.done=void 0}},GB=50,KB=1e3,JB=Ye.fromClass(class{constructor(t){this.view=t,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let e of t.state.field(ji).active)e.state==1&&this.startQuery(e)}update(t){let e=t.state.field(ji),i=t.state.facet(li);if(!t.selectionSet&&!t.docChanged&&t.startState.field(ji)==e)return;let r=t.transactions.some(o=>(o.selection||o.docChanged)&&!Hy(o,i));for(let o=0;oGB&&Date.now()-s.time>KB){for(let a of s.context.abortListeners)try{a()}catch(l){oi(this.view.state,l)}s.context.abortListeners=null,this.running.splice(o--,1)}else s.updates.push(...t.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),t.transactions.some(o=>o.effects.some(s=>s.is(Up)))&&(this.pendingStart=!0);let n=this.pendingStart?50:i.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(o=>o.state==1&&!this.running.some(s=>s.active.source==o.source))?setTimeout(()=>this.startUpdate(),n):-1,this.composing!=0)for(let o of t.transactions)Hy(o,i)=="input"?this.composing=2:this.composing==2&&o.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:t}=this.view,e=t.field(ji);for(let i of e.active)i.state==1&&!this.running.some(r=>r.active.source==i.source)&&this.startQuery(i)}startQuery(t){let{state:e}=this.view,i=qo(e),r=new cl(e,i,t.explicitPos==i),n=new Gy(t,r);this.running.push(n),Promise.resolve(t.source(r)).then(o=>{n.context.aborted||(n.done=o||null,this.scheduleAccept())},o=>{this.view.dispatch({effects:$u.of(null)}),oi(this.view.state,o)})}scheduleAccept(){this.running.every(t=>t.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(li).updateSyncTime))}accept(){var t;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],i=this.view.state.facet(li);for(let r=0;rs.source==n.active.source);if(o&&o.state==1)if(n.done==null){let s=new dn(n.active.source,0);for(let a of n.updates)s=s.update(a,i);s.state!=1&&e.push(s)}else this.startQuery(o)}e.length&&this.view.dispatch({effects:K_.of(e)})}},{eventHandlers:{blur(t){let e=this.view.state.field(ji,!1);if(e&&e.tooltip&&this.view.state.facet(li).closeOnBlur){let i=e.open&&by(this.view,e.open.tooltip);(!i||!i.dom.contains(t.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:$u.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:Up.of(!1)}),20),this.composing=0}}}),eZ=typeof navigator=="object"&&/Win/.test(navigator.platform),tZ=Qt.highest(de.domEventHandlers({keydown(t,e){let i=e.state.field(ji,!1);if(!i||!i.open||i.open.disabled||i.open.selected<0||t.key.length>1||t.ctrlKey&&!(eZ&&t.altKey)||t.metaKey)return!1;let r=i.open.options[i.open.selected],n=i.active.find(s=>s.source==r.source),o=r.completion.commitCharacters||n.result.commitCharacters;return o&&o.indexOf(t.key)>-1&&ix(e,r),!1}})),eP=de.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:'"\xB7\xB7\xB7"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box"},".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:"'\u0192'"}},".cm-completionIcon-class":{"&:after":{content:"'\u25CB'"}},".cm-completionIcon-interface":{"&:after":{content:"'\u25CC'"}},".cm-completionIcon-variable":{"&:after":{content:"'\u{1D465}'"}},".cm-completionIcon-constant":{"&:after":{content:"'\u{1D436}'"}},".cm-completionIcon-type":{"&:after":{content:"'\u{1D461}'"}},".cm-completionIcon-enum":{"&:after":{content:"'\u222A'"}},".cm-completionIcon-property":{"&:after":{content:"'\u25A1'"}},".cm-completionIcon-keyword":{"&:after":{content:"'\u{1F511}\uFE0E'"}},".cm-completionIcon-namespace":{"&:after":{content:"'\u25A2'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}}),Ky=class{constructor(e,i,r,n){this.field=e,this.line=i,this.from=r,this.to=n}},Jy=class t{constructor(e,i,r){this.field=e,this.from=i,this.to=r}map(e){let i=e.mapPos(this.from,-1,vt.TrackDel),r=e.mapPos(this.to,1,vt.TrackDel);return i==null||r==null?null:new t(this.field,i,r)}},ex=class t{constructor(e,i){this.lines=e,this.fieldPositions=i}instantiate(e,i){let r=[],n=[i],o=e.doc.lineAt(i),s=/^\s*/.exec(o.text)[0];for(let l of this.lines){if(r.length){let c=s,u=/^\t*/.exec(l)[0].length;for(let f=0;fnew Jy(l.field,n[l.line]+l.from,n[l.line]+l.to));return{text:r,ranges:a}}static parse(e){let i=[],r=[],n=[],o;for(let s of e.split(/\r\n?|\n/)){for(;o=/[#$]\{(?:(\d+)(?::([^}]*))?|([^}]*))\}/.exec(s);){let a=o[1]?+o[1]:null,l=o[2]||o[3]||"",c=-1;for(let u=0;u=c&&f.field++}n.push(new Ky(c,r.length,o.index,o.index+l.length)),s=s.slice(0,o.index)+l+s.slice(o.index+o[0].length)}for(let a;a=/\\([{}])/.exec(s);){s=s.slice(0,a.index)+a[1]+s.slice(a.index+a[0].length);for(let l of n)l.line==r.length&&l.from>a.index&&(l.from--,l.to--)}r.push(s)}return new t(r,n)}},iZ=we.widget({widget:new class extends Ft{toDOM(){let t=document.createElement("span");return t.className="cm-snippetFieldPosition",t}ignoreEvent(){return!1}}}),rZ=we.mark({class:"cm-snippetField"}),ul=class t{constructor(e,i){this.ranges=e,this.active=i,this.deco=we.set(e.map(r=>(r.from==r.to?iZ:rZ).range(r.from,r.to)))}map(e){let i=[];for(let r of this.ranges){let n=r.map(e);if(!n)return null;i.push(n)}return new t(i,this.active)}selectionInsideField(e){return e.ranges.every(i=>this.ranges.some(r=>r.field==this.active&&r.from<=i.from&&r.to>=i.to))}},Du=Se.define({map(t,e){return t&&t.map(e)}}),nZ=Se.define(),Xu=Fe.define({create(){return null},update(t,e){for(let i of e.effects){if(i.is(Du))return i.value;if(i.is(nZ)&&t)return new ul(t.ranges,i.value)}return t&&e.docChanged&&(t=t.map(e.changes)),t&&e.selection&&!t.selectionInsideField(e.selection)&&(t=null),t},provide:t=>de.decorations.from(t,e=>e?e.deco:we.none)});function nx(t,e){return J.create(t.filter(i=>i.field==e).map(i=>J.range(i.from,i.to)))}function oZ(t){let e=ex.parse(t);return(i,r,n,o)=>{let{text:s,ranges:a}=e.instantiate(i.state,n),l={changes:{from:n,to:o,insert:He.of(s)},scrollIntoView:!0,annotations:r?[tx.of(r),Tt.userEvent.of("input.complete")]:void 0};if(a.length&&(l.selection=nx(a,0)),a.some(c=>c.field>0)){let c=new ul(a,0),u=l.effects=[Du.of(c)];i.state.field(Xu,!1)===void 0&&u.push(Se.appendConfig.of([Xu,uZ,fZ,eP]))}i.dispatch(i.state.update(l))}}function tP(t){return({state:e,dispatch:i})=>{let r=e.field(Xu,!1);if(!r||t<0&&r.active==0)return!1;let n=r.active+t,o=t>0&&!r.ranges.some(s=>s.field==n+t);return i(e.update({selection:nx(r.ranges,n),effects:Du.of(o?null:new ul(r.ranges,n)),scrollIntoView:!0})),!0}}var sZ=({state:t,dispatch:e})=>t.field(Xu,!1)?(e(t.update({effects:Du.of(null)})),!0):!1,aZ=tP(1),lZ=tP(-1);var cZ=[{key:"Tab",run:aZ,shift:lZ},{key:"Escape",run:sZ}],Y_=be.define({combine(t){return t.length?t[0]:cZ}}),uZ=Qt.highest(Wt.compute([Y_],t=>t.facet(Y_)));function ci(t,e){return Object.assign(Object.assign({},e),{apply:oZ(t)})}var fZ=de.domEventHandlers({mousedown(t,e){let i=e.state.field(Xu,!1),r;if(!i||(r=e.posAtCoords({x:t.clientX,y:t.clientY}))==null)return!1;let n=i.ranges.find(o=>o.from<=r&&o.to>=r);return!n||n.field==i.active?!1:(e.dispatch({selection:nx(i.ranges,n.field),effects:Du.of(i.ranges.some(o=>o.field>n.field)?new ul(i.ranges,n.field):null),scrollIntoView:!0}),!0)}});var Ru={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},Ns=Se.define({map(t,e){let i=e.mapPos(t,-1,vt.TrackAfter);return i==null?void 0:i}}),ox=new class extends Lr{};ox.startSide=1;ox.endSide=-1;var iP=Fe.define({create(){return nt.empty},update(t,e){if(t=t.map(e.changes),e.selection){let i=e.state.doc.lineAt(e.selection.main.head);t=t.update({filter:r=>r>=i.from&&r<=i.to})}for(let i of e.effects)i.is(Ns)&&(t=t.update({add:[ox.range(i.value,i.value+1)]}));return t}});function rP(){return[dZ,iP]}var Wy="()[]{}<>";function nP(t){for(let e=0;e{if((hZ?t.composing:t.compositionStarted)||t.state.readOnly)return!1;let n=t.state.selection.main;if(r.length>2||r.length==2&&Pi(Nt(r,0))==1||e!=n.from||i!=n.to)return!1;let o=pZ(t.state,r);return o?(t.dispatch(o),!0):!1}),sP=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let r=oP(t,t.selection.main.head).brackets||Ru.brackets,n=null,o=t.changeByRange(s=>{if(s.empty){let a=OZ(t.doc,s.head);for(let l of r)if(l==a&&Wp(t.doc,s.head)==nP(Nt(l,0)))return{changes:{from:s.head-l.length,to:s.head+l.length},range:J.cursor(s.head-l.length)}}return{range:n=s}});return n||e(t.update(o,{scrollIntoView:!0,userEvent:"delete.backward"})),!n};function pZ(t,e){let i=oP(t,t.selection.main.head),r=i.brackets||Ru.brackets;for(let n of r){let o=nP(Nt(n,0));if(e==n)return o==n?bZ(t,n,r.indexOf(n+n+n)>-1,i):mZ(t,n,o,i.before||Ru.before);if(e==o&&aP(t,t.selection.main.from))return gZ(t,n,o)}return null}function aP(t,e){let i=!1;return t.field(iP).between(0,t.doc.length,r=>{r==e&&(i=!0)}),i}function Wp(t,e){let i=t.sliceString(e,e+2);return i.slice(0,Pi(Nt(i,0)))}function OZ(t,e){let i=t.sliceString(e-2,e);return Pi(Nt(i,0))==i.length?i:i.slice(1)}function mZ(t,e,i,r){let n=null,o=t.changeByRange(s=>{if(!s.empty)return{changes:[{insert:e,from:s.from},{insert:i,from:s.to}],effects:Ns.of(s.to+e.length),range:J.range(s.anchor+e.length,s.head+e.length)};let a=Wp(t.doc,s.head);return!a||/\s/.test(a)||r.indexOf(a)>-1?{changes:{insert:e+i,from:s.head},effects:Ns.of(s.head+e.length),range:J.cursor(s.head+e.length)}:{range:n=s}});return n?null:t.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function gZ(t,e,i){let r=null,n=t.changeByRange(o=>o.empty&&Wp(t.doc,o.head)==i?{changes:{from:o.head,to:o.head+i.length,insert:i},range:J.cursor(o.head+i.length)}:r={range:o});return r?null:t.update(n,{scrollIntoView:!0,userEvent:"input.type"})}function bZ(t,e,i,r){let n=r.stringPrefixes||Ru.stringPrefixes,o=null,s=t.changeByRange(a=>{if(!a.empty)return{changes:[{insert:e,from:a.from},{insert:e,from:a.to}],effects:Ns.of(a.to+e.length),range:J.range(a.anchor+e.length,a.head+e.length)};let l=a.head,c=Wp(t.doc,l),u;if(c==e){if(F_(t,l))return{changes:{insert:e+e,from:l},effects:Ns.of(l+e.length),range:J.cursor(l+e.length)};if(aP(t,l)){let d=i&&t.sliceDoc(l,l+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:l,to:l+d.length,insert:d},range:J.cursor(l+d.length)}}}else{if(i&&t.sliceDoc(l-2*e.length,l)==e+e&&(u=H_(t,l-2*e.length,n))>-1&&F_(t,u))return{changes:{insert:e+e+e+e,from:l},effects:Ns.of(l+e.length),range:J.cursor(l+e.length)};if(t.charCategorizer(l)(c)!=dt.Word&&H_(t,l,n)>-1&&!yZ(t,l,e,n))return{changes:{insert:e+e,from:l},effects:Ns.of(l+e.length),range:J.cursor(l+e.length)}}return{range:o=a}});return o?null:t.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function F_(t,e){let i=ze(t).resolveInner(e+1);return i.parent&&i.from==e}function yZ(t,e,i,r){let n=ze(t).resolveInner(e,-1),o=r.reduce((s,a)=>Math.max(s,a.length),0);for(let s=0;s<5;s++){let a=t.sliceDoc(n.from,Math.min(n.to,n.from+i.length+o)),l=a.indexOf(i);if(!l||l>-1&&r.indexOf(a.slice(0,l))>-1){let u=n.firstChild;for(;u&&u.from==n.from&&u.to-u.from>i.length+l;){if(t.sliceDoc(u.to-i.length,u.to)==i)return!1;u=u.firstChild}return!0}let c=n.to==e&&n.parent;if(!c)break;n=c}return!1}function H_(t,e,i){let r=t.charCategorizer(e);if(r(t.sliceDoc(e-1,e))!=dt.Word)return e;for(let n of i){let o=e-n.length;if(t.sliceDoc(o,e)==n&&r(t.sliceDoc(o-1,o))!=dt.Word)return o}return-1}function sx(t={}){return[tZ,ji,li.of(t),JB,vZ,eP]}var xZ=[{key:"Ctrl-Space",run:Lu},{key:"Escape",run:rx},{key:"ArrowDown",run:Yn(!0)},{key:"ArrowUp",run:Yn(!1)},{key:"PageDown",run:Yn(!0,"page")},{key:"PageUp",run:Yn(!1,"page")},{key:"Enter",run:qp}],vZ=Qt.highest(Wt.computeN([li],t=>t.facet(li).defaultKeymap?[xZ]:[]));var Vp=class t{static create(e,i,r,n,o){let s=n+(n<<8)+e+(i<<4)|0;return new t(e,i,r,s,o,[],[])}constructor(e,i,r,n,o,s,a){this.type=e,this.value=i,this.from=r,this.hash=n,this.end=o,this.children=s,this.positions=a,this.hashProp=[[Qe.contextHash,n]]}addChild(e,i){e.prop(Qe.contextHash)!=this.hash&&(e=new qe(e.type,e.children,e.positions,e.length,this.hashProp)),this.children.push(e),this.positions.push(i)}toTree(e,i=this.end){let r=this.children.length-1;return r>=0&&(i=Math.max(i,this.positions[r]+this.children[r].length+this.from)),new qe(e.types[this.type],this.children,this.positions,i-this.from).balance({makeTree:(n,o,s)=>new qe(St.none,n,o,s,this.hashProp)})}},ge;(function(t){t[t.Document=1]="Document",t[t.CodeBlock=2]="CodeBlock",t[t.FencedCode=3]="FencedCode",t[t.Blockquote=4]="Blockquote",t[t.HorizontalRule=5]="HorizontalRule",t[t.BulletList=6]="BulletList",t[t.OrderedList=7]="OrderedList",t[t.ListItem=8]="ListItem",t[t.ATXHeading1=9]="ATXHeading1",t[t.ATXHeading2=10]="ATXHeading2",t[t.ATXHeading3=11]="ATXHeading3",t[t.ATXHeading4=12]="ATXHeading4",t[t.ATXHeading5=13]="ATXHeading5",t[t.ATXHeading6=14]="ATXHeading6",t[t.SetextHeading1=15]="SetextHeading1",t[t.SetextHeading2=16]="SetextHeading2",t[t.HTMLBlock=17]="HTMLBlock",t[t.LinkReference=18]="LinkReference",t[t.Paragraph=19]="Paragraph",t[t.CommentBlock=20]="CommentBlock",t[t.ProcessingInstructionBlock=21]="ProcessingInstructionBlock",t[t.Escape=22]="Escape",t[t.Entity=23]="Entity",t[t.HardBreak=24]="HardBreak",t[t.Emphasis=25]="Emphasis",t[t.StrongEmphasis=26]="StrongEmphasis",t[t.Link=27]="Link",t[t.Image=28]="Image",t[t.InlineCode=29]="InlineCode",t[t.HTMLTag=30]="HTMLTag",t[t.Comment=31]="Comment",t[t.ProcessingInstruction=32]="ProcessingInstruction",t[t.Autolink=33]="Autolink",t[t.HeaderMark=34]="HeaderMark",t[t.QuoteMark=35]="QuoteMark",t[t.ListMark=36]="ListMark",t[t.LinkMark=37]="LinkMark",t[t.EmphasisMark=38]="EmphasisMark",t[t.CodeMark=39]="CodeMark",t[t.CodeText=40]="CodeText",t[t.CodeInfo=41]="CodeInfo",t[t.LinkTitle=42]="LinkTitle",t[t.LinkLabel=43]="LinkLabel",t[t.URL=44]="URL"})(ge||(ge={}));var cx=class{constructor(e,i){this.start=e,this.content=i,this.marks=[],this.parsers=[]}},ux=class{constructor(){this.text="",this.baseIndent=0,this.basePos=0,this.depth=0,this.markers=[],this.pos=0,this.indent=0,this.next=-1}forward(){this.basePos>this.pos&&this.forwardInner()}forwardInner(){let e=this.skipSpace(this.basePos);this.indent=this.countIndent(e,this.pos,this.indent),this.pos=e,this.next=e==this.text.length?-1:this.text.charCodeAt(e)}skipSpace(e){return Uu(this.text,e)}reset(e){for(this.text=e,this.baseIndent=this.basePos=this.pos=this.indent=0,this.forwardInner(),this.depth=1;this.markers.length;)this.markers.pop()}moveBase(e){this.basePos=e,this.baseIndent=this.countIndent(e,this.pos,this.indent)}moveBaseColumn(e){this.baseIndent=e,this.basePos=this.findColumn(e)}addMarker(e){this.markers.push(e)}countIndent(e,i=0,r=0){for(let n=i;n=e.stack[i.depth+1].value+i.baseIndent)return!0;if(i.indent>=i.baseIndent+4)return!1;let r=(t.type==ge.OrderedList?kx:wx)(i,e,!1);return r>0&&(t.type!=ge.BulletList||vx(i,e,!1)<0)&&i.text.charCodeAt(i.pos+r-1)==t.value}var xP={[ge.Blockquote](t,e,i){return i.next!=62?!1:(i.markers.push(Ke(ge.QuoteMark,e.lineStart+i.pos,e.lineStart+i.pos+1)),i.moveBase(i.pos+(wr(i.text.charCodeAt(i.pos+1))?2:1)),t.end=e.lineStart+i.text.length,!0)},[ge.ListItem](t,e,i){return i.indent-1?!1:(i.moveBaseColumn(i.baseIndent+t.value),!0)},[ge.OrderedList]:lP,[ge.BulletList]:lP,[ge.Document](){return!0}};function wr(t){return t==32||t==9||t==10||t==13}function Uu(t,e=0){for(;ei&&wr(t.charCodeAt(e-1));)e--;return e}function vP(t){if(t.next!=96&&t.next!=126)return-1;let e=t.pos+1;for(;e-1&&t.depth==e.stack.length||r<3?-1:1}function kP(t,e){for(let i=t.stack.length-1;i>=0;i--)if(t.stack[i].type==e)return!0;return!1}function wx(t,e,i){return(t.next==45||t.next==43||t.next==42)&&(t.pos==t.text.length-1||wr(t.text.charCodeAt(t.pos+1)))&&(!i||kP(e,ge.BulletList)||t.skipSpace(t.pos+2)=48&&n<=57;){r++;if(r==t.text.length)return-1;n=t.text.charCodeAt(r)}return r==t.pos||r>t.pos+9||n!=46&&n!=41||rt.pos+1||t.next!=49)?-1:r+1-t.pos}function SP(t){if(t.next!=35)return-1;let e=t.pos+1;for(;e6?-1:i}function TP(t){if(t.next!=45&&t.next!=61||t.indent>=t.baseIndent+4)return-1;let e=t.pos+1;for(;e/,CP=/\?>/,hx=[[/^<(?:script|pre|style)(?:\s|>|$)/i,/<\/(?:script|pre|style)>/i],[/^\s*/,CP=/\?>/,hx=[[/^<(?:script|pre|style)(?:\s|>|$)/i,/<\/(?:script|pre|style)>/i],[/^\s*/i.exec(r);if(o)return t.append(Ke(ge.Comment,i,i+1+o[0].length));let s=/^\?[^]*?\?>/.exec(r);if(s)return t.append(Ke(ge.ProcessingInstruction,i,i+1+s[0].length));let a=/^(?:![A-Z][^]*?>|!\[CDATA\[[^]*?\]\]>|\/\s*[a-zA-Z][\w-]*\s*>|\s*[a-zA-Z][\w-]*(\s+[a-zA-Z:_][\w-.:]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*(\/\s*)?>)/.exec(r);return a?t.append(Ke(ge.HTMLTag,i,i+1+a[0].length)):-1},Emphasis(t,e,i){if(e!=95&&e!=42)return-1;let r=i+1;for(;t.char(r)==e;)r++;let n=t.slice(i-1,i),o=t.slice(r,r+1),s=qu.test(n),a=qu.test(o),l=/\s|^$/.test(n),c=/\s|^$/.test(o),u=!c&&(!a||l||s),f=!l&&(!s||c||a),d=u&&(e==42||!f||s),p=f&&(e==42||!u||a);return t.append(new ir(e==95?AP:$P,i,r,(d?1:0)|(p?2:0)))},HardBreak(t,e,i){if(e==92&&t.char(i+1)==10)return t.append(Ke(ge.HardBreak,i,i+2));if(e==32){let r=i+1;for(;t.char(r)==32;)r++;if(t.char(r)==10&&r>=i+2)return t.append(Ke(ge.HardBreak,i,r+1))}return-1},Link(t,e,i){return e==91?t.append(new ir(Mu,i,i+1,1)):-1},Image(t,e,i){return e==33&&t.char(i+1)==91?t.append(new ir(fP,i,i+2,1)):-1},LinkEnd(t,e,i){if(e!=93)return-1;for(let r=t.parts.length-1;r>=0;r--){let n=t.parts[r];if(n instanceof ir&&(n.type==Mu||n.type==fP)){if(!n.side||t.skipSpace(n.to)==i&&!/[(\[]/.test(t.slice(i+1,i+2)))return t.parts[r]=null,-1;let o=t.takeContent(r),s=t.parts[r]=TZ(t,o,n.type==Mu?ge.Link:ge.Image,n.from,i+1);if(n.type==Mu)for(let a=0;ae?Ke(ge.URL,e+i,o+i):o==t.length?null:!1}}function RP(t,e,i){let r=t.charCodeAt(e);if(r!=39&&r!=34&&r!=40)return!1;let n=r==40?41:r;for(let o=e+1,s=!1;o=this.end?-1:this.text.charCodeAt(e-this.offset)}get end(){return this.offset+this.text.length}slice(e,i){return this.text.slice(e-this.offset,i-this.offset)}append(e){return this.parts.push(e),e.to}addDelimiter(e,i,r,n,o){return this.append(new ir(e,i,r,(n?1:0)|(o?2:0)))}addElement(e){return this.append(e)}resolveMarkers(e){for(let r=e;r=e;l--){let x=this.parts[l];if(x instanceof ir&&x.side&1&&x.type==n.type&&!(o&&(n.side&1||x.side&2)&&(x.to-x.from+s)%3==0&&((x.to-x.from)%3||s%3))){a=x;break}}if(!a)continue;let c=n.type.resolve,u=[],f=a.from,d=n.to;if(o){let x=Math.min(2,a.to-a.from,s);f=a.to-x,d=n.from+x,c=x==1?"Emphasis":"StrongEmphasis"}a.type.mark&&u.push(this.elt(a.type.mark,f,a.to));for(let x=l+1;x=0;i--){let r=this.parts[i];if(r instanceof ir&&r.type==e)return i}return null}takeContent(e){let i=this.resolveMarkers(e);return this.parts.length=e,i}skipSpace(e){return Uu(this.text,e-this.offset)+this.offset}elt(e,i,r,n){return typeof e=="string"?Ke(this.parser.getNodeType(e),i,r,n):new Fp(e,i)}};function bx(t,e){if(!e.length)return t;if(!t.length)return e;let i=t.slice(),r=0;for(let n of e){for(;r(e?e-1:0))return!1;if(this.fragmentEnd<0){let o=this.fragment.to;for(;o>0&&this.input.read(o-1,o)!=` -`;)o--;this.fragmentEnd=o?o-1:0}let r=this.cursor;r||(r=this.cursor=this.fragment.tree.cursor(),r.firstChild());let n=e+this.fragment.offset;for(;r.to<=n;)if(!r.parent())return!1;for(;;){if(r.from>=n)return this.fragment.from<=i;if(!r.childAfter(n))return!1}}matches(e){let i=this.cursor.tree;return i&&i.prop(Qe.contextHash)==e}takeNodes(e){let i=this.cursor,r=this.fragment.offset,n=this.fragmentEnd-(this.fragment.openEnd?1:0),o=e.absoluteLineStart,s=o,a=e.block.children.length,l=s,c=a;for(;;){if(i.to-r>n){if(i.type.isAnonymous&&i.firstChild())continue;break}let u=LP(i.from-r,e.ranges);if(i.to-r<=e.ranges[e.rangeI].to)e.addNode(i.tree,u);else{let f=new qe(e.parser.nodeSet.types[ge.Paragraph],[],[],0,e.block.hashProp);e.reusePlaceholders.set(f,i.tree),e.addNode(f,u)}if(i.type.is("Block")&&(EZ.indexOf(i.type.id)<0?(s=i.to-r,a=e.block.children.length):(s=l,a=c,l=i.to-r,c=e.block.children.length)),!i.nextSibling())break}for(;e.block.children.length>a;)e.block.children.pop(),e.block.positions.pop();return s-o}};function LP(t,e){let i=t;for(let r=1;rBp[t]),Object.keys(Bp).map(t=>wZ[t]),Object.keys(Bp),kZ,xP,Object.keys(lx).map(t=>lx[t]),Object.keys(lx),[]);function _Z(t,e,i){let r=[];for(let n=t.firstChild,o=e;;n=n.nextSibling){let s=n?n.from:i;if(s>o&&r.push({from:o,to:s}),!n)break;o=n.to}return r}function NP(t){let{codeParser:e,htmlParser:i}=t;return{wrap:Id((n,o)=>{let s=n.type.id;if(e&&(s==ge.CodeBlock||s==ge.FencedCode)){let a="";if(s==ge.FencedCode){let c=n.node.getChild(ge.CodeInfo);c&&(a=o.read(c.from,c.to))}let l=e(a);if(l)return{parser:l,overlay:c=>c.type.id==ge.CodeText}}else if(i&&(s==ge.HTMLBlock||s==ge.HTMLTag))return{parser:i,overlay:_Z(n.node,n.from,n.to)};return null})}}var PZ={resolve:"Strikethrough",mark:"StrikethroughMark"},QZ={defineNodes:[{name:"Strikethrough",style:{"Strikethrough/...":_.strikethrough}},{name:"StrikethroughMark",style:_.processingInstruction}],parseInline:[{name:"Strikethrough",parse(t,e,i){if(e!=126||t.char(i+1)!=126||t.char(i+2)==126)return-1;let r=t.slice(i-1,i),n=t.slice(i+2,i+3),o=/\s|^$/.test(r),s=/\s|^$/.test(n),a=qu.test(r),l=qu.test(n);return t.addDelimiter(PZ,i,i+2,!s&&(!l||o||a),!o&&(!a||s||l))},after:"Emphasis"}]};function zu(t,e,i=0,r,n=0){let o=0,s=!0,a=-1,l=-1,c=!1,u=()=>{r.push(t.elt("TableCell",n+a,n+l,t.parser.parseInline(e.slice(a,l),n+a)))};for(let f=i;f-1)&&o++,s=!1,r&&(a>-1&&u(),r.push(t.elt("TableDelimiter",f+n,f+n+1))),a=l=-1):(c||d!=32&&d!=9)&&(a<0&&(a=f),l=f+1),c=!c&&d==92}return a>-1&&(o++,r&&u()),o}function dP(t,e){for(let i=e;in instanceof Hp)||!dP(e.text,e.basePos))return!1;let r=t.scanLine(t.absoluteLineEnd+1).text;return MP.test(r)&&zu(t,e.text,e.basePos)==zu(t,r,e.basePos)},before:"SetextHeading"}]},xx=class{nextLine(){return!1}finish(e,i){return e.addLeafElement(i,e.elt("Task",i.start,i.start+i.content.length,[e.elt("TaskMarker",i.start,i.start+3),...e.parser.parseInline(i.content.slice(3),i.start+3)])),!0}},$Z={defineNodes:[{name:"Task",block:!0,style:_.list},{name:"TaskMarker",style:_.atom}],parseBlock:[{name:"TaskList",leaf(t,e){return/^\[[ xX]\][ \t]/.test(e.content)&&t.parentType().name=="ListItem"?new xx:null},after:"SetextHeading"}]},pP=/(www\.)|(https?:\/\/)|([\w.+-]+@)|(mailto:|xmpp:)/gy,OP=/[\w-]+(\.[\w-]+)+(\/[^\s<]*)?/gy,XZ=/[\w-]+\.[\w-]+($|\/)/,mP=/[\w.+-]+@[\w-]+(\.[\w.-]+)+/gy,gP=/\/[a-zA-Z\d@.]+/gy;function bP(t,e,i,r){let n=0;for(let o=e;o-1)return-1;let r=e+i[0].length;for(;;){let n=t[r-1],o;if(/[?!.,:*_~]/.test(n)||n==")"&&bP(t,e,r,")")>bP(t,e,r,"("))r--;else if(n==";"&&(o=/&(?:#\d+|#x[a-f\d]+|\w+);$/.exec(t.slice(e,r))))r=e+o.index;else break}return r}function yP(t,e){mP.lastIndex=e;let i=mP.exec(t);if(!i)return-1;let r=i[0][i[0].length-1];return r=="_"||r=="-"?-1:e+i[0].length-(r=="."?1:0)}var IZ={parseInline:[{name:"Autolink",parse(t,e,i){let r=i-t.offset;pP.lastIndex=r;let n=pP.exec(t.text),o=-1;return!n||(n[1]||n[2]?o=RZ(t.text,r+n[0].length):n[3]?o=yP(t.text,r):(o=yP(t.text,r+n[0].length),o>-1&&n[0]=="xmpp:"&&(gP.lastIndex=o,n=gP.exec(t.text),n&&(o=n.index+n[0].length))),o<0)?-1:(t.addElement(t.elt("URL",i,o+t.offset)),o+t.offset)}}]},UP=[AZ,$Z,QZ,IZ];function zP(t,e,i){return(r,n,o)=>{if(n!=t||r.char(o+1)==t)return-1;let s=[r.elt(i,o,o+1)];for(let a=o+1;ai%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,i,r=0){let n=e.parser.context;return new t(e,[],i,r,r,0,[],0,n?new Gp(n,n.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,i){this.stack.push(this.state,i,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var i;let r=e>>19,n=e&65535,{parser:o}=this.p,s=o.dynamicPrecedence(n);if(s&&(this.score+=s),r==0){this.pushState(o.getGoto(this.state,n,!0),this.reducePos),n=2e3&&!(!((i=this.p.parser.nodeSet.types[n])===null||i===void 0)&&i.isAnonymous)&&(l==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=c):this.p.lastBigReductionSizea;)this.stack.pop();this.reduceContext(n,l)}storeNode(e,i,r,n=4,o=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]0&&s.buffer[a-4]==0&&s.buffer[a-1]>-1){if(i==r)return;if(s.buffer[a-2]>=i){s.buffer[a-2]=r;return}}}if(!o||this.pos==r)this.buffer.push(e,i,r,n);else{let s=this.buffer.length;if(s>0&&this.buffer[s-4]!=0)for(;s>0&&this.buffer[s-2]>r;)this.buffer[s]=this.buffer[s-4],this.buffer[s+1]=this.buffer[s-3],this.buffer[s+2]=this.buffer[s-2],this.buffer[s+3]=this.buffer[s-1],s-=4,n>4&&(n-=4);this.buffer[s]=e,this.buffer[s+1]=i,this.buffer[s+2]=r,this.buffer[s+3]=n}}shift(e,i,r,n){if(e&131072)this.pushState(e&65535,this.pos);else if(e&262144)this.pos=n,this.shiftContext(i,r),i<=this.p.parser.maxNode&&this.buffer.push(i,r,n,4);else{let o=e,{parser:s}=this.p;(n>this.pos||i<=s.maxNode)&&(this.pos=n,s.stateFlag(o,1)||(this.reducePos=n)),this.pushState(o,r),this.shiftContext(i,r),i<=s.maxNode&&this.buffer.push(i,r,n,4)}}apply(e,i,r,n){e&65536?this.reduce(e):this.shift(e,i,r,n)}useNode(e,i){let r=this.p.reused.length-1;(r<0||this.p.reused[r]!=e)&&(this.p.reused.push(e),r++);let n=this.pos;this.reducePos=this.pos=n+e.length,this.pushState(i,n),this.buffer.push(r,n,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,i=e.buffer.length;for(;i>0&&e.buffer[i-2]>e.reducePos;)i-=4;let r=e.buffer.slice(i),n=e.bufferBase+i;for(;e&&n==e.bufferBase;)e=e.parent;return new t(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,r,n,this.curContext,this.lookAhead,e)}recoverByDelete(e,i){let r=e<=this.p.parser.maxNode;r&&this.storeNode(e,this.pos,i,4),this.storeNode(0,this.pos,i,r?8:4),this.pos=this.reducePos=i,this.score-=190}canShift(e){for(let i=new Cx(this);;){let r=this.p.parser.stateSlot(i.state,4)||this.p.parser.hasAction(i.state,e);if(r==0)return!1;if(!(r&65536))return!0;i.reduce(r)}}recoverByInsert(e){if(this.stack.length>=300)return[];let i=this.p.parser.nextStates(this.state);if(i.length>8||this.stack.length>=120){let n=[];for(let o=0,s;ol&1&&a==s)||n.push(i[o],s)}i=n}let r=[];for(let n=0;n>19,n=i&65535,o=this.stack.length-r*3;if(o<0||e.getGoto(this.stack[o],n,!1)<0){let s=this.findForcedReduction();if(s==null)return!1;i=s}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(i),!0}findForcedReduction(){let{parser:e}=this.p,i=[],r=(n,o)=>{if(!i.includes(n))return i.push(n),e.allActions(n,s=>{if(!(s&393216))if(s&65536){let a=(s>>19)-o;if(a>1){let l=s&65535,c=this.stack.length-a*3;if(c>=0&&e.getGoto(this.stack[c],l,!1)>=0)return a<<19|65536|l}}else{let a=r(s,o+1);if(a!=null)return a}})};return r(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let i=0;ithis.lookAhead&&(this.emitLookAhead(),this.lookAhead=e)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}},Gp=class{constructor(e,i){this.tracker=e,this.context=i,this.hash=e.strict?e.hash(i):0}},Cx=class{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let i=e&65535,r=e>>19;r==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(r-1)*3;let n=this.start.p.parser.getGoto(this.stack[this.base-3],i,!0);this.state=n}},_x=class t{constructor(e,i,r){this.stack=e,this.pos=i,this.index=r,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,i=e.bufferBase+e.buffer.length){return new t(e,i,i-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new t(this.stack,this.pos,this.index)}};function Wu(t,e=Uint16Array){if(typeof t!="string")return t;let i=null;for(let r=0,n=0;r=92&&s--,s>=34&&s--;let l=s-32;if(l>=46&&(l-=46,a=!0),o+=l,a)break;o*=46}i?i[n++]=o:i=new e(o)}return i}var hl=class{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}},BP=new hl,Px=class{constructor(e,i){this.input=e,this.ranges=i,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=BP,this.rangeIndex=0,this.pos=this.chunkPos=i[0].from,this.range=i[0],this.end=i[i.length-1].to,this.readNext()}resolveOffset(e,i){let r=this.range,n=this.rangeIndex,o=this.pos+e;for(;or.to:o>=r.to;){if(n==this.ranges.length-1)return null;let s=this.ranges[++n];o+=s.from-r.to,r=s}return o}clipPos(e){if(e>=this.range.from&&ee)return Math.max(e,i.from);return this.end}peek(e){let i=this.chunkOff+e,r,n;if(i>=0&&i=this.chunk2Pos&&ra.to&&(this.chunk2=this.chunk2.slice(0,a.to-r)),n=this.chunk2.charCodeAt(0)}}return r>=this.token.lookAhead&&(this.token.lookAhead=r+1),n}acceptToken(e,i=0){let r=i?this.resolveOffset(i,-1):this.pos;if(r==null||r=this.chunk2Pos&&this.posthis.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,i){if(i?(this.token=i,i.start=e,i.lookAhead=e+1,i.value=i.extended=-1):this.token=BP,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e=this.chunkPos&&i<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,i-this.chunkPos);if(e>=this.chunk2Pos&&i<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,i-this.chunk2Pos);if(e>=this.range.from&&i<=this.range.to)return this.input.read(e,i);let r="";for(let n of this.ranges){if(n.from>=i)break;n.to>e&&(r+=this.input.read(Math.max(n.from,e),Math.min(n.to,i)))}return r}},Wo=class{constructor(e,i){this.data=e,this.id=i}token(e,i){let{parser:r}=i.p;HP(this.data,e,i,this.id,r.data,r.tokenPrecTable)}};Wo.prototype.contextual=Wo.prototype.fallback=Wo.prototype.extend=!1;var Bo=class{constructor(e,i,r){this.precTable=i,this.elseToken=r,this.data=typeof e=="string"?Wu(e):e}token(e,i){let r=e.pos,n=0;for(;;){let o=e.next<0,s=e.resolveOffset(1,1);if(HP(this.data,e,i,0,this.data,this.precTable),e.token.value>-1)break;if(this.elseToken==null)return;if(o||n++,s==null)break;e.reset(s,e.token)}n&&(e.reset(r,e.token),e.acceptToken(this.elseToken,n))}};Bo.prototype.contextual=Wo.prototype.fallback=Wo.prototype.extend=!1;var et=class{constructor(e,i={}){this.token=e,this.contextual=!!i.contextual,this.fallback=!!i.fallback,this.extend=!!i.extend}};function HP(t,e,i,r,n,o){let s=0,a=1<0){let g=t[p];if(l.allows(g)&&(e.token.value==-1||e.token.value==g||DZ(g,e.token.value,n,o))){e.acceptToken(g);break}}let u=e.next,f=0,d=t[s+2];if(e.next<0&&d>f&&t[c+d*3-3]==65535){s=t[c+d*3-1];continue e}for(;f>1,g=c+p+(p<<1),x=t[g],w=t[g+1]||65536;if(u=w)f=p+1;else{s=t[g+2],e.advance();continue e}}break}}function ZP(t,e,i){for(let r=e,n;(n=t[r])!=65535;r++)if(n==i)return r-e;return-1}function DZ(t,e,i,r){let n=ZP(i,r,e);return n<0||ZP(i,r,t)e)&&!r.type.isError)return i<0?Math.max(0,Math.min(r.to-1,e-25)):Math.min(t.length,Math.max(r.from+1,e+25));if(i<0?r.prevSibling():r.nextSibling())break;if(!r.parent())return i<0?0:t.length}}var Qx=class{constructor(e,i){this.fragments=e,this.nodeSet=i,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?VP(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?VP(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(ee)return this.nextStart=s,null;if(o instanceof qe){if(s==e){if(s=Math.max(this.safeFrom,e)&&(this.trees.push(o),this.start.push(s),this.index.push(0))}else this.index[i]++,this.nextStart=s+o.length}}},Ax=class{constructor(e,i){this.stream=i,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(r=>new hl)}getActions(e){let i=0,r=null,{parser:n}=e.p,{tokenizers:o}=n,s=n.stateSlot(e.state,3),a=e.curContext?e.curContext.hash:0,l=0;for(let c=0;cf.end+25&&(l=Math.max(f.lookAhead,l)),f.value!=0)){let d=i;if(f.extended>-1&&(i=this.addActions(e,f.extended,f.end,i)),i=this.addActions(e,f.value,f.end,i),!u.extend&&(r=f,i>d))break}}for(;this.actions.length>i;)this.actions.pop();return l&&e.setLookAhead(l),!r&&e.pos==this.stream.end&&(r=new hl,r.value=e.p.parser.eofTerm,r.start=r.end=e.pos,i=this.addActions(e,r.value,r.end,i)),this.mainToken=r,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let i=new hl,{pos:r,p:n}=e;return i.start=r,i.end=Math.min(r+1,n.stream.end),i.value=r==n.stream.end?n.parser.eofTerm:0,i}updateCachedToken(e,i,r){let n=this.stream.clipPos(r.pos);if(i.token(this.stream.reset(n,e),r),e.value>-1){let{parser:o}=r.p;for(let s=0;s=0&&r.p.parser.dialect.allows(a>>1)){a&1?e.extended=a>>1:e.value=a>>1;break}}}else e.value=0,e.end=this.stream.clipPos(n+1)}putAction(e,i,r,n){for(let o=0;oe.bufferLength*4?new Qx(r,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,i=this.minStackPos,r=this.stacks=[],n,o;if(this.bigReductionCount>300&&e.length==1){let[s]=e;for(;s.forceReduce()&&s.stack.length&&s.stack[s.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let s=0;si)r.push(a);else{if(this.advanceStack(a,r,e))continue;{n||(n=[],o=[]),n.push(a);let l=this.tokens.getMainToken(a);o.push(l.value,l.end)}}break}}if(!r.length){let s=n&&NZ(n);if(s)return rr&&console.log("Finish with "+this.stackID(s)),this.stackToTree(s);if(this.parser.strict)throw rr&&n&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+i);this.recovering||(this.recovering=5)}if(this.recovering&&n){let s=this.stoppedAt!=null&&n[0].pos>this.stoppedAt?n[0]:this.runRecovery(n,o,r);if(s)return rr&&console.log("Force-finish "+this.stackID(s)),this.stackToTree(s.forceAll())}if(this.recovering){let s=this.recovering==1?1:this.recovering*3;if(r.length>s)for(r.sort((a,l)=>l.score-a.score);r.length>s;)r.pop();r.some(a=>a.reducePos>i)&&this.recovering--}else if(r.length>1){e:for(let s=0;s500&&c.buffer.length>500)if((a.score-c.score||a.buffer.length-c.buffer.length)>0)r.splice(l--,1);else{r.splice(s--,1);continue e}}}r.length>12&&r.splice(12,r.length-12)}this.minStackPos=r[0].pos;for(let s=1;s ":"";if(this.stoppedAt!=null&&n>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let c=e.curContext&&e.curContext.tracker.strict,u=c?e.curContext.hash:0;for(let f=this.fragments.nodeAt(n);f;){let d=this.parser.nodeSet.types[f.type.id]==f.type?o.getGoto(e.state,f.type.id):-1;if(d>-1&&f.length&&(!c||(f.prop(Qe.contextHash)||0)==u))return e.useNode(f,d),rr&&console.log(s+this.stackID(e)+` (via reuse of ${o.getName(f.type.id)})`),!0;if(!(f instanceof qe)||f.children.length==0||f.positions[0]>0)break;let p=f.children[0];if(p instanceof qe&&f.positions[0]==0)f=p;else break}}let a=o.stateSlot(e.state,4);if(a>0)return e.reduce(a),rr&&console.log(s+this.stackID(e)+` (via always-reduce ${o.getName(a&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let l=this.tokens.getActions(e);for(let c=0;cn?i.push(g):r.push(g)}return!1}advanceFully(e,i){let r=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>r)return YP(e,i),!0}}runRecovery(e,i,r){let n=null,o=!1;for(let s=0;s ":"";if(a.deadEnd&&(o||(o=!0,a.restart(),rr&&console.log(u+this.stackID(a)+" (restarted)"),this.advanceFully(a,r))))continue;let f=a.split(),d=u;for(let p=0;f.forceReduce()&&p<10&&(rr&&console.log(d+this.stackID(f)+" (via force-reduce)"),!this.advanceFully(f,r));p++)rr&&(d=this.stackID(f)+" -> ");for(let p of a.recoverByInsert(l))rr&&console.log(u+this.stackID(p)+" (via recover-insert)"),this.advanceFully(p,r);this.stream.end>a.pos?(c==a.pos&&(c++,l=0),a.recoverByDelete(l,c),rr&&console.log(u+this.stackID(a)+` (via recover-delete ${this.parser.getName(l)})`),YP(a,r)):(!n||n.scoret,Zo=class{constructor(e){this.start=e.start,this.shift=e.shift||Tx,this.reduce=e.reduce||Tx,this.reuse=e.reuse||Tx,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}},vi=class t extends zn{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let i=e.nodeNames.split(" ");this.minRepeatTerm=i.length;for(let a=0;ae.topRules[a][1]),n=[];for(let a=0;a=0)o(u,l,a[c++]);else{let f=a[c+-u];for(let d=-u;d>0;d--)o(a[c++],l,f);c++}}}this.nodeSet=new Mn(i.map((a,l)=>St.define({name:l>=this.minRepeatTerm?void 0:a,id:l,props:n[l],top:r.indexOf(l)>-1,error:l==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(l)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=1024;let s=Wu(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let a=0;atypeof a=="number"?new Wo(s,a):a),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,i,r){let n=new $x(this,e,i,r);for(let o of this.wrappers)n=o(n,e,i,r);return n}getGoto(e,i,r=!1){let n=this.goto;if(i>=n[0])return-1;for(let o=n[i+1];;){let s=n[o++],a=s&1,l=n[o++];if(a&&r)return l;for(let c=o+(s>>1);o0}validAction(e,i){return!!this.allActions(e,r=>r==i?!0:null)}allActions(e,i){let r=this.stateSlot(e,4),n=r?i(r):void 0;for(let o=this.stateSlot(e,1);n==null;o+=3){if(this.data[o]==65535)if(this.data[o+1]==1)o=Fn(this.data,o+2);else break;n=i(Fn(this.data,o+1))}return n}nextStates(e){let i=[];for(let r=this.stateSlot(e,1);;r+=3){if(this.data[r]==65535)if(this.data[r+1]==1)r=Fn(this.data,r+2);else break;if(!(this.data[r+2]&1)){let n=this.data[r+1];i.some((o,s)=>s&1&&o==n)||i.push(this.data[r],n)}}return i}configure(e){let i=Object.assign(Object.create(t.prototype),this);if(e.props&&(i.nodeSet=this.nodeSet.extend(...e.props)),e.top){let r=this.topRules[e.top];if(!r)throw new RangeError(`Invalid top rule name ${e.top}`);i.top=r}return e.tokenizers&&(i.tokenizers=this.tokenizers.map(r=>{let n=e.tokenizers.find(o=>o.from==r);return n?n.to:r})),e.specializers&&(i.specializers=this.specializers.slice(),i.specializerSpecs=this.specializerSpecs.map((r,n)=>{let o=e.specializers.find(a=>a.from==r.external);if(!o)return r;let s=Object.assign(Object.assign({},r),{external:o.to});return i.specializers[n]=FP(s),s})),e.contextTracker&&(i.context=e.contextTracker),e.dialect&&(i.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(i.strict=e.strict),e.wrap&&(i.wrappers=i.wrappers.concat(e.wrap)),e.bufferLength!=null&&(i.bufferLength=e.bufferLength),i}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let i=this.dynamicPrecedences;return i==null?0:i[e]||0}parseDialect(e){let i=Object.keys(this.dialects),r=i.map(()=>!1);if(e)for(let o of e.split(" ")){let s=i.indexOf(o);s>=0&&(r[s]=!0)}let n=null;for(let o=0;or)&&i.p.parser.stateFlag(i.state,2)&&(!e||e.scoret.external(i,r)<<1|e}return t.get}var MZ=54,UZ=1,zZ=55,jZ=2,qZ=56,WZ=3,GP=4,BZ=5,Kp=6,oQ=7,sQ=8,aQ=9,lQ=10,ZZ=11,VZ=12,YZ=13,Rx=57,FZ=14,KP=58,cQ=20,HZ=22,uQ=23,GZ=24,Lx=26,fQ=27,KZ=28,JZ=31,eV=34,tV=36,iV=37,rV=0,nV=1,oV={area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},sV={dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},JP={dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}};function aV(t){return t==45||t==46||t==58||t>=65&&t<=90||t==95||t>=97&&t<=122||t>=161}function hQ(t){return t==9||t==10||t==13||t==32}var eQ=null,tQ=null,iQ=0;function Dx(t,e){let i=t.pos+e;if(iQ==i&&tQ==t)return eQ;let r=t.peek(e);for(;hQ(r);)r=t.peek(++e);let n="";for(;aV(r);)n+=String.fromCharCode(r),r=t.peek(++e);return tQ=t,iQ=i,eQ=n?n.toLowerCase():r==lV||r==cV?void 0:null}var dQ=60,Jp=62,Nx=47,lV=63,cV=33,uV=45;function rQ(t,e){this.name=t,this.parent=e,this.hash=e?e.hash:0;for(let i=0;i-1?new rQ(Dx(r,1)||"",t):t},reduce(t,e){return e==cQ&&t?t.parent:t},reuse(t,e,i,r){let n=e.type.id;return n==Kp||n==tV?new rQ(Dx(r,1)||"",t):t},hash(t){return t?t.hash:0},strict:!1}),dV=new et((t,e)=>{if(t.next!=dQ){t.next<0&&e.context&&t.acceptToken(Rx);return}t.advance();let i=t.next==Nx;i&&t.advance();let r=Dx(t,0);if(r===void 0)return;if(!r)return t.acceptToken(i?FZ:Kp);let n=e.context?e.context.name:null;if(i){if(r==n)return t.acceptToken(ZZ);if(n&&sV[n])return t.acceptToken(Rx,-2);if(e.dialectEnabled(rV))return t.acceptToken(VZ);for(let o=e.context;o;o=o.parent)if(o.name==r)return;t.acceptToken(YZ)}else{if(r=="script")return t.acceptToken(oQ);if(r=="style")return t.acceptToken(sQ);if(r=="textarea")return t.acceptToken(aQ);if(oV.hasOwnProperty(r))return t.acceptToken(lQ);n&&JP[n]&&JP[n][r]?t.acceptToken(Rx,-1):t.acceptToken(Kp)}},{contextual:!0}),pV=new et(t=>{for(let e=0,i=0;;i++){if(t.next<0){i&&t.acceptToken(KP);break}if(t.next==uV)e++;else if(t.next==Jp&&e>=2){i>=3&&t.acceptToken(KP,-2);break}else e=0;t.advance()}});function OV(t){for(;t;t=t.parent)if(t.name=="svg"||t.name=="math")return!0;return!1}var mV=new et((t,e)=>{if(t.next==Nx&&t.peek(1)==Jp){let i=e.dialectEnabled(nV)||OV(e.context);t.acceptToken(i?BZ:GP,2)}else t.next==Jp&&t.acceptToken(GP,1)});function Mx(t,e,i){let r=2+t.length;return new et(n=>{for(let o=0,s=0,a=0;;a++){if(n.next<0){a&&n.acceptToken(e);break}if(o==0&&n.next==dQ||o==1&&n.next==Nx||o>=2&&os?n.acceptToken(e,-s):n.acceptToken(i,-(s-2));break}else if((n.next==10||n.next==13)&&a){n.acceptToken(e,1);break}else o=s=0;n.advance()}})}var gV=Mx("script",MZ,UZ),bV=Mx("style",zZ,jZ),yV=Mx("textarea",qZ,WZ),xV=Bt({"Text RawText":_.content,"StartTag StartCloseTag SelfClosingEndTag EndTag":_.angleBracket,TagName:_.tagName,"MismatchedCloseTag/TagName":[_.tagName,_.invalid],AttributeName:_.attributeName,"AttributeValue UnquotedAttributeValue":_.attributeValue,Is:_.definitionOperator,"EntityReference CharacterReference":_.character,Comment:_.blockComment,ProcessingInst:_.processingInstruction,DoctypeDecl:_.documentMeta}),pQ=vi.deserialize({version:14,states:",xOVO!rOOO!WQ#tO'#CqO!]Q#tO'#CzO!bQ#tO'#C}O!gQ#tO'#DQO!lQ#tO'#DSO!qOaO'#CpO!|ObO'#CpO#XOdO'#CpO$eO!rO'#CpOOO`'#Cp'#CpO$lO$fO'#DTO$tQ#tO'#DVO$yQ#tO'#DWOOO`'#Dk'#DkOOO`'#DY'#DYQVO!rOOO%OQ&rO,59]O%WQ&rO,59fO%`Q&rO,59iO%hQ&rO,59lO%sQ&rO,59nOOOa'#D^'#D^O%{OaO'#CxO&WOaO,59[OOOb'#D_'#D_O&`ObO'#C{O&kObO,59[OOOd'#D`'#D`O&sOdO'#DOO'OOdO,59[OOO`'#Da'#DaO'WO!rO,59[O'_Q#tO'#DROOO`,59[,59[OOOp'#Db'#DbO'dO$fO,59oOOO`,59o,59oO'lQ#|O,59qO'qQ#|O,59rOOO`-E7W-E7WO'vQ&rO'#CsOOQW'#DZ'#DZO(UQ&rO1G.wOOOa1G.w1G.wO(^Q&rO1G/QOOOb1G/Q1G/QO(fQ&rO1G/TOOOd1G/T1G/TO(nQ&rO1G/WOOO`1G/W1G/WOOO`1G/Y1G/YO(yQ&rO1G/YOOOa-E7[-E7[O)RQ#tO'#CyOOO`1G.v1G.vOOOb-E7]-E7]O)WQ#tO'#C|OOOd-E7^-E7^O)]Q#tO'#DPOOO`-E7_-E7_O)bQ#|O,59mOOOp-E7`-E7`OOO`1G/Z1G/ZOOO`1G/]1G/]OOO`1G/^1G/^O)gQ,UO,59_OOQW-E7X-E7XOOOa7+$c7+$cOOOb7+$l7+$lOOOd7+$o7+$oOOO`7+$r7+$rOOO`7+$t7+$tO)rQ#|O,59eO)wQ#|O,59hO)|Q#|O,59kOOO`1G/X1G/XO*RO7[O'#CvO*dOMhO'#CvOOQW1G.y1G.yOOO`1G/P1G/POOO`1G/S1G/SOOO`1G/V1G/VOOOO'#D['#D[O*uO7[O,59bOOQW,59b,59bOOOO'#D]'#D]O+WOMhO,59bOOOO-E7Y-E7YOOQW1G.|1G.|OOOO-E7Z-E7Z",stateData:"+s~O!^OS~OUSOVPOWQOXROYTO[]O][O^^O`^Oa^Ob^Oc^Ox^O{_O!dZO~OfaO~OfbO~OfcO~OfdO~OfeO~O!WfOPlP!ZlP~O!XiOQoP!ZoP~O!YlORrP!ZrP~OUSOVPOWQOXROYTOZqO[]O][O^^O`^Oa^Ob^Oc^Ox^O!dZO~O!ZrO~P#dO![sO!euO~OfvO~OfwO~OS|OhyO~OS!OOhyO~OS!QOhyO~OS!SOT!TOhyO~OS!TOhyO~O!WfOPlX!ZlX~OP!WO!Z!XO~O!XiOQoX!ZoX~OQ!ZO!Z!XO~O!YlORrX!ZrX~OR!]O!Z!XO~O!Z!XO~P#dOf!_O~O![sO!e!aO~OS!bO~OS!cO~Oi!dOSgXhgXTgX~OS!fOhyO~OS!gOhyO~OS!hOhyO~OS!iOT!jOhyO~OS!jOhyO~Of!kO~Of!lO~Of!mO~OS!nO~Ok!qO!`!oO!b!pO~OS!rO~OS!sO~OS!tO~Oa!uOb!uOc!uO!`!wO!a!uO~Oa!xOb!xOc!xO!b!wO!c!xO~Oa!uOb!uOc!uO!`!{O!a!uO~Oa!xOb!xOc!xO!b!{O!c!xO~OT~bac!dx{!d~",goto:"%p!`PPPPPPPPPPPPPPPPPPPP!a!gP!mPP!yP!|#P#S#Y#]#`#f#i#l#r#x!aP!a!aP$O$U$l$r$x%O%U%[%bPPPPPPPP%hX^OX`pXUOX`pezabcde{}!P!R!UR!q!dRhUR!XhXVOX`pRkVR!XkXWOX`pRnWR!XnXXOX`pQrXR!XpXYOX`pQ`ORx`Q{aQ}bQ!PcQ!RdQ!UeZ!e{}!P!R!UQ!v!oR!z!vQ!y!pR!|!yQgUR!VgQjVR!YjQmWR![mQpXR!^pQtZR!`tS_O`ToXp",nodeNames:"\u26A0 StartCloseTag StartCloseTag StartCloseTag EndTag SelfClosingEndTag StartTag StartTag StartTag StartTag StartTag StartCloseTag StartCloseTag StartCloseTag IncompleteCloseTag Document Text EntityReference CharacterReference InvalidEntity Element OpenTag TagName Attribute AttributeName Is AttributeValue UnquotedAttributeValue ScriptText CloseTag OpenTag StyleText CloseTag OpenTag TextareaText CloseTag OpenTag CloseTag SelfClosingTag Comment ProcessingInst MismatchedCloseTag CloseTag DoctypeDecl",maxTerm:67,context:hV,nodeProps:[["closedBy",-10,1,2,3,7,8,9,10,11,12,13,"EndTag",6,"EndTag SelfClosingEndTag",-4,21,30,33,36,"CloseTag"],["openedBy",4,"StartTag StartCloseTag",5,"StartTag",-4,29,32,35,37,"OpenTag"],["group",-9,14,17,18,19,20,39,40,41,42,"Entity",16,"Entity TextContent",-3,28,31,34,"TextContent Entity"],["isolate",-11,21,29,30,32,33,35,36,37,38,41,42,"ltr",-3,26,27,39,""]],propSources:[xV],skippedNodes:[0],repeatNodeCount:9,tokenData:"!]tw8twx7Sx!P8t!P!Q5u!Q!]8t!]!^/^!^!a7S!a#S8t#S#T;{#T#s8t#s$f5u$f;'S8t;'S;=`>V<%l?Ah8t?Ah?BY5u?BY?Mn8t?MnO5u!Z5zbkWOX5uXZ7SZ[5u[^7S^p5uqr5urs7Sst+Ptw5uwx7Sx!]5u!]!^7w!^!a7S!a#S5u#S#T7S#T;'S5u;'S;=`8n<%lO5u!R7VVOp7Sqs7St!]7S!]!^7l!^;'S7S;'S;=`7q<%lO7S!R7qOa!R!R7tP;=`<%l7S!Z8OYkWa!ROX+PZ[+P^p+Pqr+Psw+Px!^+P!a#S+P#T;'S+P;'S;=`+t<%lO+P!Z8qP;=`<%l5u!_8{ihSkWOX5uXZ7SZ[5u[^7S^p5uqr8trs7Sst/^tw8twx7Sx!P8t!P!Q5u!Q!]8t!]!^:j!^!a7S!a#S8t#S#T;{#T#s8t#s$f5u$f;'S8t;'S;=`>V<%l?Ah8t?Ah?BY5u?BY?Mn8t?MnO5u!_:sbhSkWa!ROX+PZ[+P^p+Pqr/^sw/^x!P/^!P!Q+P!Q!^/^!a#S/^#S#T0m#T#s/^#s$f+P$f;'S/^;'S;=`1e<%l?Ah/^?Ah?BY+P?BY?Mn/^?MnO+P!VP<%l?Ah;{?Ah?BY7S?BY?Mn;{?MnO7S!V=dXhSa!Rqr0msw0mx!P0m!Q!^0m!a#s0m$f;'S0m;'S;=`1_<%l?Ah0m?BY?Mn0m!V>SP;=`<%l;{!_>YP;=`<%l8t!_>dhhSkWOX@OXZAYZ[@O[^AY^p@OqrBwrsAYswBwwxAYx!PBw!P!Q@O!Q!]Bw!]!^/^!^!aAY!a#SBw#S#TE{#T#sBw#s$f@O$f;'SBw;'S;=`HS<%l?AhBw?Ah?BY@O?BY?MnBw?MnO@O!Z@TakWOX@OXZAYZ[@O[^AY^p@Oqr@OrsAYsw@OwxAYx!]@O!]!^Az!^!aAY!a#S@O#S#TAY#T;'S@O;'S;=`Bq<%lO@O!RA]UOpAYq!]AY!]!^Ao!^;'SAY;'S;=`At<%lOAY!RAtOb!R!RAwP;=`<%lAY!ZBRYkWb!ROX+PZ[+P^p+Pqr+Psw+Px!^+P!a#S+P#T;'S+P;'S;=`+t<%lO+P!ZBtP;=`<%l@O!_COhhSkWOX@OXZAYZ[@O[^AY^p@OqrBwrsAYswBwwxAYx!PBw!P!Q@O!Q!]Bw!]!^Dj!^!aAY!a#SBw#S#TE{#T#sBw#s$f@O$f;'SBw;'S;=`HS<%l?AhBw?Ah?BY@O?BY?MnBw?MnO@O!_DsbhSkWb!ROX+PZ[+P^p+Pqr/^sw/^x!P/^!P!Q+P!Q!^/^!a#S/^#S#T0m#T#s/^#s$f+P$f;'S/^;'S;=`1e<%l?Ah/^?Ah?BY+P?BY?Mn/^?MnO+P!VFQbhSOpAYqrE{rsAYswE{wxAYx!PE{!P!QAY!Q!]E{!]!^GY!^!aAY!a#sE{#s$fAY$f;'SE{;'S;=`G|<%l?AhE{?Ah?BYAY?BY?MnE{?MnOAY!VGaXhSb!Rqr0msw0mx!P0m!Q!^0m!a#s0m$f;'S0m;'S;=`1_<%l?Ah0m?BY?Mn0m!VHPP;=`<%lE{!_HVP;=`<%lBw!ZHcW!bx`P!a`Or(trs'ksv(tw!^(t!^!_)e!_;'S(t;'S;=`*P<%lO(t!aIYlhS`PkW!a`!cpOX$qXZ&XZ[$q[^&X^p$qpq&Xqr-_rs&}sv-_vw/^wx(tx}-_}!OKQ!O!P-_!P!Q$q!Q!^-_!^!_*V!_!a&X!a#S-_#S#T1k#T#s-_#s$f$q$f;'S-_;'S;=`3X<%l?Ah-_?Ah?BY$q?BY?Mn-_?MnO$q!aK_khS`PkW!a`!cpOX$qXZ&XZ[$q[^&X^p$qpq&Xqr-_rs&}sv-_vw/^wx(tx!P-_!P!Q$q!Q!^-_!^!_*V!_!`&X!`!aMS!a#S-_#S#T1k#T#s-_#s$f$q$f;'S-_;'S;=`3X<%l?Ah-_?Ah?BY$q?BY?Mn-_?MnO$q!TM_X`P!a`!cp!eQOr&Xrs&}sv&Xwx(tx!^&X!^!_*V!_;'S&X;'S;=`*y<%lO&X!aNZ!ZhSfQ`PkW!a`!cpOX$qXZ&XZ[$q[^&X^p$qpq&Xqr-_rs&}sv-_vw/^wx(tx}-_}!OMz!O!PMz!P!Q$q!Q![Mz![!]Mz!]!^-_!^!_*V!_!a&X!a!c-_!c!}Mz!}#R-_#R#SMz#S#T1k#T#oMz#o#s-_#s$f$q$f$}-_$}%OMz%O%W-_%W%oMz%o%p-_%p&aMz&a&b-_&b1pMz1p4UMz4U4dMz4d4e-_4e$ISMz$IS$I`-_$I`$IbMz$Ib$Je-_$Je$JgMz$Jg$Kh-_$Kh%#tMz%#t&/x-_&/x&EtMz&Et&FV-_&FV;'SMz;'S;:j!#|;:j;=`3X<%l?&r-_?&r?AhMz?Ah?BY$q?BY?MnMz?MnO$q!a!$PP;=`<%lMz!R!$ZY!a`!cpOq*Vqr!$yrs(Vsv*Vwx)ex!a*V!a!b!4t!b;'S*V;'S;=`*s<%lO*V!R!%Q]!a`!cpOr*Vrs(Vsv*Vwx)ex}*V}!O!%y!O!f*V!f!g!']!g#W*V#W#X!0`#X;'S*V;'S;=`*s<%lO*V!R!&QX!a`!cpOr*Vrs(Vsv*Vwx)ex}*V}!O!&m!O;'S*V;'S;=`*s<%lO*V!R!&vV!a`!cp!dPOr*Vrs(Vsv*Vwx)ex;'S*V;'S;=`*s<%lO*V!R!'dX!a`!cpOr*Vrs(Vsv*Vwx)ex!q*V!q!r!(P!r;'S*V;'S;=`*s<%lO*V!R!(WX!a`!cpOr*Vrs(Vsv*Vwx)ex!e*V!e!f!(s!f;'S*V;'S;=`*s<%lO*V!R!(zX!a`!cpOr*Vrs(Vsv*Vwx)ex!v*V!v!w!)g!w;'S*V;'S;=`*s<%lO*V!R!)nX!a`!cpOr*Vrs(Vsv*Vwx)ex!{*V!{!|!*Z!|;'S*V;'S;=`*s<%lO*V!R!*bX!a`!cpOr*Vrs(Vsv*Vwx)ex!r*V!r!s!*}!s;'S*V;'S;=`*s<%lO*V!R!+UX!a`!cpOr*Vrs(Vsv*Vwx)ex!g*V!g!h!+q!h;'S*V;'S;=`*s<%lO*V!R!+xY!a`!cpOr!+qrs!,hsv!+qvw!-Swx!.[x!`!+q!`!a!/j!a;'S!+q;'S;=`!0Y<%lO!+qq!,mV!cpOv!,hvx!-Sx!`!,h!`!a!-q!a;'S!,h;'S;=`!.U<%lO!,hP!-VTO!`!-S!`!a!-f!a;'S!-S;'S;=`!-k<%lO!-SP!-kO{PP!-nP;=`<%l!-Sq!-xS!cp{POv(Vx;'S(V;'S;=`(h<%lO(Vq!.XP;=`<%l!,ha!.aX!a`Or!.[rs!-Ssv!.[vw!-Sw!`!.[!`!a!.|!a;'S!.[;'S;=`!/d<%lO!.[a!/TT!a`{POr)esv)ew;'S)e;'S;=`)y<%lO)ea!/gP;=`<%l!.[!R!/sV!a`!cp{POr*Vrs(Vsv*Vwx)ex;'S*V;'S;=`*s<%lO*V!R!0]P;=`<%l!+q!R!0gX!a`!cpOr*Vrs(Vsv*Vwx)ex#c*V#c#d!1S#d;'S*V;'S;=`*s<%lO*V!R!1ZX!a`!cpOr*Vrs(Vsv*Vwx)ex#V*V#V#W!1v#W;'S*V;'S;=`*s<%lO*V!R!1}X!a`!cpOr*Vrs(Vsv*Vwx)ex#h*V#h#i!2j#i;'S*V;'S;=`*s<%lO*V!R!2qX!a`!cpOr*Vrs(Vsv*Vwx)ex#m*V#m#n!3^#n;'S*V;'S;=`*s<%lO*V!R!3eX!a`!cpOr*Vrs(Vsv*Vwx)ex#d*V#d#e!4Q#e;'S*V;'S;=`*s<%lO*V!R!4XX!a`!cpOr*Vrs(Vsv*Vwx)ex#X*V#X#Y!+q#Y;'S*V;'S;=`*s<%lO*V!R!4{Y!a`!cpOr!4trs!5ksv!4tvw!6Vwx!8]x!a!4t!a!b!:]!b;'S!4t;'S;=`!;r<%lO!4tq!5pV!cpOv!5kvx!6Vx!a!5k!a!b!7W!b;'S!5k;'S;=`!8V<%lO!5kP!6YTO!a!6V!a!b!6i!b;'S!6V;'S;=`!7Q<%lO!6VP!6lTO!`!6V!`!a!6{!a;'S!6V;'S;=`!7Q<%lO!6VP!7QOxPP!7TP;=`<%l!6Vq!7]V!cpOv!5kvx!6Vx!`!5k!`!a!7r!a;'S!5k;'S;=`!8V<%lO!5kq!7yS!cpxPOv(Vx;'S(V;'S;=`(h<%lO(Vq!8YP;=`<%l!5ka!8bX!a`Or!8]rs!6Vsv!8]vw!6Vw!a!8]!a!b!8}!b;'S!8];'S;=`!:V<%lO!8]a!9SX!a`Or!8]rs!6Vsv!8]vw!6Vw!`!8]!`!a!9o!a;'S!8];'S;=`!:V<%lO!8]a!9vT!a`xPOr)esv)ew;'S)e;'S;=`)y<%lO)ea!:YP;=`<%l!8]!R!:dY!a`!cpOr!4trs!5ksv!4tvw!6Vwx!8]x!`!4t!`!a!;S!a;'S!4t;'S;=`!;r<%lO!4t!R!;]V!a`!cpxPOr*Vrs(Vsv*Vwx)ex;'S*V;'S;=`*s<%lO*V!R!;uP;=`<%l!4t!V!{let c=a.type.id;if(c==KZ)return Ix(a,l,i);if(c==JZ)return Ix(a,l,r);if(c==eV)return Ix(a,l,n);if(c==cQ&&o.length){let u=a.node,f=u.firstChild,d=f&&nQ(f,l),p;if(d){for(let g of o)if(g.tag==d&&(!g.attrs||g.attrs(p||(p=OQ(u,l))))){let x=u.lastChild,w=x.type.id==iV?x.from:u.to;if(w>f.to)return{parser:g.parser,overlay:[{from:f.to,to:w}]}}}}if(s&&c==uQ){let u=a.node,f;if(f=u.firstChild){let d=s[l.read(f.from,f.to)];if(d)for(let p of d){if(p.tagName&&p.tagName!=nQ(u.parent,l))continue;let g=u.lastChild;if(g.type.id==Lx){let x=g.from+1,w=g.lastChild,S=g.to-(w&&w.isError?0:1);if(S>x)return{parser:p.parser,overlay:[{from:x,to:S}]}}else if(g.type.id==fQ)return{parser:p.parser,overlay:[{from:g.from,to:g.to}]}}}}return null})}var vV=99,mQ=1,wV=100,kV=101,gQ=2,bQ=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],SV=58,TV=40,yQ=95,EV=91,eO=45,CV=46,_V=35,PV=37,QV=38,AV=92,$V=10;function Bu(t){return t>=65&&t<=90||t>=97&&t<=122||t>=161}function XV(t){return t>=48&&t<=57}var RV=new et((t,e)=>{for(let i=!1,r=0,n=0;;n++){let{next:o}=t;if(Bu(o)||o==eO||o==yQ||i&&XV(o))!i&&(o!=eO||n>0)&&(i=!0),r===n&&o==eO&&r++,t.advance();else if(o==AV&&t.peek(1)!=$V)t.advance(),t.next>-1&&t.advance(),i=!0;else{i&&t.acceptToken(o==TV?wV:r==2&&e.canShift(gQ)?gQ:kV);break}}}),IV=new et(t=>{if(bQ.includes(t.peek(-1))){let{next:e}=t;(Bu(e)||e==yQ||e==_V||e==CV||e==EV||e==SV&&Bu(t.peek(1))||e==eO||e==QV)&&t.acceptToken(vV)}}),LV=new et(t=>{if(!bQ.includes(t.peek(-1))){let{next:e}=t;if(e==PV&&(t.advance(),t.acceptToken(mQ)),Bu(e)){do t.advance();while(Bu(t.next));t.acceptToken(mQ)}}}),DV=Bt({"AtKeyword import charset namespace keyframes media supports":_.definitionKeyword,"from to selector":_.keyword,NamespaceName:_.namespace,KeyframeName:_.labelName,KeyframeRangeName:_.operatorKeyword,TagName:_.tagName,ClassName:_.className,PseudoClassName:_.constant(_.className),IdName:_.labelName,"FeatureName PropertyName":_.propertyName,AttributeName:_.attributeName,NumberLiteral:_.number,KeywordQuery:_.keyword,UnaryQueryOp:_.operatorKeyword,"CallTag ValueName":_.atom,VariableName:_.variableName,Callee:_.operatorKeyword,Unit:_.unit,"UniversalSelector NestingSelector":_.definitionOperator,MatchOp:_.compareOperator,"ChildOp SiblingOp, LogicOp":_.logicOperator,BinOp:_.arithmeticOperator,Important:_.modifier,Comment:_.blockComment,ColorLiteral:_.color,"ParenthesizedContent StringLiteral":_.string,":":_.punctuation,"PseudoOp #":_.derefOperator,"; ,":_.separator,"( )":_.paren,"[ ]":_.squareBracket,"{ }":_.brace}),NV={__proto__:null,lang:32,"nth-child":32,"nth-last-child":32,"nth-of-type":32,"nth-last-of-type":32,dir:32,"host-context":32,url:60,"url-prefix":60,domain:60,regexp:60,selector:138},MV={__proto__:null,"@import":118,"@media":142,"@charset":146,"@namespace":150,"@keyframes":156,"@supports":168},UV={__proto__:null,not:132,only:132},xQ=vi.deserialize({version:14,states:":^QYQ[OOO#_Q[OOP#fOWOOOOQP'#Cd'#CdOOQP'#Cc'#CcO#kQ[O'#CfO$_QXO'#CaO$fQ[O'#ChO$qQ[O'#DTO$vQ[O'#DWOOQP'#Em'#EmO${QdO'#DgO%jQ[O'#DtO${QdO'#DvO%{Q[O'#DxO&WQ[O'#D{O&`Q[O'#ERO&nQ[O'#ETOOQS'#El'#ElOOQS'#EW'#EWQYQ[OOO&uQXO'#CdO'jQWO'#DcO'oQWO'#EsO'zQ[O'#EsQOQWOOP(UO#tO'#C_POOO)C@[)C@[OOQP'#Cg'#CgOOQP,59Q,59QO#kQ[O,59QO(aQ[O'#E[O({QWO,58{O)TQ[O,59SO$qQ[O,59oO$vQ[O,59rO(aQ[O,59uO(aQ[O,59wO(aQ[O,59xO)`Q[O'#DbOOQS,58{,58{OOQP'#Ck'#CkOOQO'#DR'#DROOQP,59S,59SO)gQWO,59SO)lQWO,59SOOQP'#DV'#DVOOQP,59o,59oOOQO'#DX'#DXO)qQ`O,59rOOQS'#Cp'#CpO${QdO'#CqO)yQvO'#CsO+ZQtO,5:ROOQO'#Cx'#CxO)lQWO'#CwO+oQWO'#CyO+tQ[O'#DOOOQS'#Ep'#EpOOQO'#Dj'#DjO+|Q[O'#DqO,[QWO'#EtO&`Q[O'#DoO,jQWO'#DrOOQO'#Eu'#EuO)OQWO,5:`O,oQpO,5:bOOQS'#Dz'#DzO,wQWO,5:dO,|Q[O,5:dOOQO'#D}'#D}O-UQWO,5:gO-ZQWO,5:mO-cQWO,5:oOOQS-E8U-E8UO${QdO,59}O-kQ[O'#E^O-xQWO,5;_O-xQWO,5;_POOO'#EV'#EVP.TO#tO,58yPOOO,58y,58yOOQP1G.l1G.lO.zQXO,5:vOOQO-E8Y-E8YOOQS1G.g1G.gOOQP1G.n1G.nO)gQWO1G.nO)lQWO1G.nOOQP1G/Z1G/ZO/XQ`O1G/^O/rQXO1G/aO0YQXO1G/cO0pQXO1G/dO1WQWO,59|O1]Q[O'#DSO1dQdO'#CoOOQP1G/^1G/^O${QdO1G/^O1kQpO,59]OOQS,59_,59_O${QdO,59aO1sQWO1G/mOOQS,59c,59cO1xQ!bO,59eOOQS'#DP'#DPOOQS'#EY'#EYO2QQ[O,59jOOQS,59j,59jO2YQWO'#DjO2eQWO,5:VO2jQWO,5:]O&`Q[O,5:XO&`Q[O'#E_O2rQWO,5;`O2}QWO,5:ZO(aQ[O,5:^OOQS1G/z1G/zOOQS1G/|1G/|OOQS1G0O1G0OO3`QWO1G0OO3eQdO'#EOOOQS1G0R1G0ROOQS1G0X1G0XOOQS1G0Z1G0ZO3pQtO1G/iOOQO,5:x,5:xO4WQ[O,5:xOOQO-E8[-E8[O4eQWO1G0yPOOO-E8T-E8TPOOO1G.e1G.eOOQP7+$Y7+$YOOQP7+$x7+$xO${QdO7+$xOOQS1G/h1G/hO4pQXO'#ErO4wQWO,59nO4|QtO'#EXO5tQdO'#EoO6OQWO,59ZO6TQpO7+$xOOQS1G.w1G.wOOQS1G.{1G.{OOQS7+%X7+%XO6]QWO1G/POOQS-E8W-E8WOOQS1G/U1G/UO${QdO1G/qOOQO1G/w1G/wOOQO1G/s1G/sO6bQWO,5:yOOQO-E8]-E8]O6pQXO1G/xOOQS7+%j7+%jO6wQYO'#CsOOQO'#EQ'#EQO7SQ`O'#EPOOQO'#EP'#EPO7_QWO'#E`O7gQdO,5:jOOQS,5:j,5:jO7rQtO'#E]O${QdO'#E]O8sQdO7+%TOOQO7+%T7+%TOOQO1G0d1G0dO9WQpO<OAN>OO:xQdO,5:uOOQO-E8X-E8XOOQO<T![;'S%^;'S;=`%o<%lO%^l;TUo`Oy%^z!Q%^!Q![;g![;'S%^;'S;=`%o<%lO%^l;nYo`#e[Oy%^z!Q%^!Q![;g![!g%^!g!h<^!h#X%^#X#Y<^#Y;'S%^;'S;=`%o<%lO%^l[[o`#e[Oy%^z!O%^!O!P;g!P!Q%^!Q![>T![!g%^!g!h<^!h#X%^#X#Y<^#Y;'S%^;'S;=`%o<%lO%^n?VSt^Oy%^z;'S%^;'S;=`%o<%lO%^l?hWjWOy%^z!O%^!O!P;O!P!Q%^!Q![>T![;'S%^;'S;=`%o<%lO%^n@VU#bQOy%^z!Q%^!Q![;g![;'S%^;'S;=`%o<%lO%^~@nTjWOy%^z{@}{;'S%^;'S;=`%o<%lO%^~AUSo`#[~Oy%^z;'S%^;'S;=`%o<%lO%^lAg[#e[Oy%^z!O%^!O!P;g!P!Q%^!Q![>T![!g%^!g!h<^!h#X%^#X#Y<^#Y;'S%^;'S;=`%o<%lO%^bBbU]QOy%^z![%^![!]Bt!];'S%^;'S;=`%o<%lO%^bB{S^Qo`Oy%^z;'S%^;'S;=`%o<%lO%^nC^S!Y^Oy%^z;'S%^;'S;=`%o<%lO%^dCoS|SOy%^z;'S%^;'S;=`%o<%lO%^bDQU!OQOy%^z!`%^!`!aDd!a;'S%^;'S;=`%o<%lO%^bDkS!OQo`Oy%^z;'S%^;'S;=`%o<%lO%^bDzWOy%^z!c%^!c!}Ed!}#T%^#T#oEd#o;'S%^;'S;=`%o<%lO%^bEk[![Qo`Oy%^z}%^}!OEd!O!Q%^!Q![Ed![!c%^!c!}Ed!}#T%^#T#oEd#o;'S%^;'S;=`%o<%lO%^nFfSq^Oy%^z;'S%^;'S;=`%o<%lO%^nFwSp^Oy%^z;'S%^;'S;=`%o<%lO%^bGWUOy%^z#b%^#b#cGj#c;'S%^;'S;=`%o<%lO%^bGoUo`Oy%^z#W%^#W#XHR#X;'S%^;'S;=`%o<%lO%^bHYS!bQo`Oy%^z;'S%^;'S;=`%o<%lO%^bHiUOy%^z#f%^#f#gHR#g;'S%^;'S;=`%o<%lO%^fIQS!TUOy%^z;'S%^;'S;=`%o<%lO%^nIcS!S^Oy%^z;'S%^;'S;=`%o<%lO%^fItU!RQOy%^z!_%^!_!`6y!`;'S%^;'S;=`%o<%lO%^`JZP;=`<%l$}",tokenizers:[IV,LV,RV,1,2,3,4,new Bo("m~RRYZ[z{a~~g~aO#^~~dP!P!Qg~lO#_~~",28,105)],topRules:{StyleSheet:[0,4],Styles:[1,86]},specialized:[{term:100,get:t=>NV[t]||-1},{term:58,get:t=>MV[t]||-1},{term:101,get:t=>UV[t]||-1}],tokenPrec:1200});var zx=null;function jx(){if(!zx&&typeof document=="object"&&document.body){let{style:t}=document.body,e=[],i=new Set;for(let r in t)r!="cssText"&&r!="cssFloat"&&typeof t[r]=="string"&&(/[A-Z]/.test(r)&&(r=r.replace(/[A-Z]/g,n=>"-"+n.toLowerCase())),i.has(r)||(e.push(r),i.add(r)));zx=e.sort().map(r=>({type:"property",label:r}))}return zx||[]}var vQ=["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(t=>({type:"class",label:t})),wQ=["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(t=>({type:"keyword",label:t})).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(t=>({type:"constant",label:t}))),zV=["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(t=>({type:"type",label:t})),Vo=/^(\w[\w-]*|-\w[\w-]*|)$/,jV=/^-(-[\w-]*)?$/;function qV(t,e){var i;if((t.name=="("||t.type.isError)&&(t=t.parent||t),t.name!="ArgList")return!1;let r=(i=t.parent)===null||i===void 0?void 0:i.firstChild;return(r==null?void 0:r.name)!="Callee"?!1:e.sliceString(r.from,r.to)=="var"}var kQ=new qa,WV=["Declaration"];function BV(t){for(let e=t;;){if(e.type.isTop)return e;if(!(e=e.parent))return t}}function SQ(t,e,i){if(e.to-e.from>4096){let r=kQ.get(e);if(r)return r;let n=[],o=new Set,s=e.cursor(st.IncludeAnonymous);if(s.firstChild())do for(let a of SQ(t,s.node,i))o.has(a.label)||(o.add(a.label),n.push(a));while(s.nextSibling());return kQ.set(e,n),n}else{let r=[],n=new Set;return e.cursor().iterate(o=>{var s;if(i(o)&&o.matchContext(WV)&&((s=o.node.nextSibling)===null||s===void 0?void 0:s.name)==":"){let a=t.sliceString(o.from,o.to);n.has(a)||(n.add(a),r.push({label:a,type:"variable"}))}}),r}}var ZV=t=>e=>{let{state:i,pos:r}=e,n=ze(i).resolveInner(r,-1),o=n.type.isError&&n.from==n.to-1&&i.doc.sliceString(n.from,n.to)=="-";if(n.name=="PropertyName"||(o||n.name=="TagName")&&/^(Block|Styles)$/.test(n.resolve(n.to).name))return{from:n.from,options:jx(),validFor:Vo};if(n.name=="ValueName")return{from:n.from,options:wQ,validFor:Vo};if(n.name=="PseudoClassName")return{from:n.from,options:vQ,validFor:Vo};if(t(n)||(e.explicit||o)&&qV(n,i.doc))return{from:t(n)||o?n.from:r,options:SQ(i.doc,BV(n),t),validFor:jV};if(n.name=="TagName"){for(let{parent:l}=n;l;l=l.parent)if(l.name=="Block")return{from:n.from,options:jx(),validFor:Vo};return{from:n.from,options:zV,validFor:Vo}}if(!e.explicit)return null;let s=n.resolve(r),a=s.childBefore(r);return a&&a.name==":"&&s.name=="PseudoClassSelector"?{from:r,options:vQ,validFor:Vo}:a&&a.name==":"&&s.name=="Declaration"||s.name=="ArgList"?{from:r,options:wQ,validFor:Vo}:s.name=="Block"||s.name=="Styles"?{from:r,options:jx(),validFor:Vo}:null},VV=ZV(t=>t.name=="VariableName"),Zu=yi.define({name:"css",parser:xQ.configure({props:[ai.add({Declaration:xi()}),Ht.add({"Block KeyframeList":jo})]}),languageData:{commentTokens:{block:{open:"/*",close:"*/"}},indentOnInput:/^\s*\}$/,wordChars:"-"}});function tO(){return new At(Zu,Zu.data.of({autocomplete:VV}))}var YV=309,TQ=1,FV=2,HV=3,GV=310,KV=312,JV=313,eY=4,tY=5,iY=0,Wx=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],EQ=125,rY=59,Bx=47,nY=42,oY=43,sY=45,aY=60,lY=44,cY=new Zo({start:!1,shift(t,e){return e==eY||e==tY||e==KV?t:e==JV},strict:!1}),uY=new et((t,e)=>{let{next:i}=t;(i==EQ||i==-1||e.context)&&t.acceptToken(GV)},{contextual:!0,fallback:!0}),fY=new et((t,e)=>{let{next:i}=t,r;Wx.indexOf(i)>-1||i==Bx&&((r=t.peek(1))==Bx||r==nY)||i!=EQ&&i!=rY&&i!=-1&&!e.context&&t.acceptToken(YV)},{contextual:!0}),hY=new et((t,e)=>{let{next:i}=t;if((i==oY||i==sY)&&(t.advance(),i==t.next)){t.advance();let r=!e.context&&e.canShift(TQ);t.acceptToken(r?TQ:FV)}},{contextual:!0});function qx(t,e){return t>=65&&t<=90||t>=97&&t<=122||t==95||t>=192||!e&&t>=48&&t<=57}var dY=new et((t,e)=>{if(t.next!=aY||!e.dialectEnabled(iY)||(t.advance(),t.next==Bx))return;let i=0;for(;Wx.indexOf(t.next)>-1;)t.advance(),i++;if(qx(t.next,!0)){for(t.advance(),i++;qx(t.next,!1);)t.advance(),i++;for(;Wx.indexOf(t.next)>-1;)t.advance(),i++;if(t.next==lY)return;for(let r=0;;r++){if(r==7){if(!qx(t.next,!0))return;break}if(t.next!="extends".charCodeAt(r))break;t.advance(),i++}}t.acceptToken(HV,-i)}),pY=Bt({"get set async static":_.modifier,"for while do if else switch try catch finally return throw break continue default case":_.controlKeyword,"in of await yield void typeof delete instanceof":_.operatorKeyword,"let var const using function class extends":_.definitionKeyword,"import export from":_.moduleKeyword,"with debugger as new":_.keyword,TemplateString:_.special(_.string),super:_.atom,BooleanLiteral:_.bool,this:_.self,null:_.null,Star:_.modifier,VariableName:_.variableName,"CallExpression/VariableName TaggedTemplateExpression/VariableName":_.function(_.variableName),VariableDefinition:_.definition(_.variableName),Label:_.labelName,PropertyName:_.propertyName,PrivatePropertyName:_.special(_.propertyName),"CallExpression/MemberExpression/PropertyName":_.function(_.propertyName),"FunctionDeclaration/VariableDefinition":_.function(_.definition(_.variableName)),"ClassDeclaration/VariableDefinition":_.definition(_.className),PropertyDefinition:_.definition(_.propertyName),PrivatePropertyDefinition:_.definition(_.special(_.propertyName)),UpdateOp:_.updateOperator,"LineComment Hashbang":_.lineComment,BlockComment:_.blockComment,Number:_.number,String:_.string,Escape:_.escape,ArithOp:_.arithmeticOperator,LogicOp:_.logicOperator,BitOp:_.bitwiseOperator,CompareOp:_.compareOperator,RegExp:_.regexp,Equals:_.definitionOperator,Arrow:_.function(_.punctuation),": Spread":_.punctuation,"( )":_.paren,"[ ]":_.squareBracket,"{ }":_.brace,"InterpolationStart InterpolationEnd":_.special(_.brace),".":_.derefOperator,", ;":_.separator,"@":_.meta,TypeName:_.typeName,TypeDefinition:_.definition(_.typeName),"type enum interface implements namespace module declare":_.definitionKeyword,"abstract global Privacy readonly override":_.modifier,"is keyof unique infer":_.operatorKeyword,JSXAttributeValue:_.attributeValue,JSXText:_.content,"JSXStartTag JSXStartCloseTag JSXSelfCloseEndTag JSXEndTag":_.angleBracket,"JSXIdentifier JSXNameSpacedName":_.tagName,"JSXAttribute/JSXIdentifier JSXAttribute/JSXNameSpacedName":_.attributeName,"JSXBuiltin/JSXIdentifier":_.standard(_.tagName)}),OY={__proto__:null,export:18,as:23,from:31,default:34,async:39,function:40,extends:52,this:56,true:64,false:64,null:76,void:80,typeof:84,super:102,new:136,delete:152,yield:161,await:165,class:170,public:227,private:227,protected:227,readonly:229,instanceof:248,satisfies:251,in:252,const:254,import:286,keyof:339,unique:343,infer:349,is:385,abstract:405,implements:407,type:409,let:412,var:414,using:417,interface:423,enum:427,namespace:433,module:435,declare:439,global:443,for:462,of:471,while:474,with:478,do:482,if:486,else:488,switch:492,case:498,try:504,catch:508,finally:512,return:516,throw:520,break:524,continue:528,debugger:532},mY={__proto__:null,async:123,get:125,set:127,declare:187,public:189,private:189,protected:189,static:191,abstract:193,override:195,readonly:201,accessor:203,new:389},gY={__proto__:null,"<":143},CQ=vi.deserialize({version:14,states:"$RQWO'#CdO>cQWO'#H[O>kQWO'#HbO>kQWO'#HdO`Q^O'#HfO>kQWO'#HhO>kQWO'#HkO>pQWO'#HqO>uQ07iO'#HwO%[Q^O'#HyO?QQ07iO'#H{O?]Q07iO'#H}O9kQ07hO'#IPO?hQ08SO'#ChO@jQ`O'#DiQOQWOOO%[Q^O'#EPOAQQWO'#ESO:RQ7[O'#EjOA]QWO'#EjOAhQpO'#FbOOQU'#Cf'#CfOOQ07`'#Dn'#DnOOQ07`'#Jm'#JmO%[Q^O'#JmOOQO'#Jq'#JqOOQO'#Ib'#IbOBhQ`O'#EcOOQ07`'#Eb'#EbOCdQ07pO'#EcOCnQ`O'#EVOOQO'#Jp'#JpODSQ`O'#JqOEaQ`O'#EVOCnQ`O'#EcPEnO!0LbO'#CaPOOO)CDu)CDuOOOO'#IX'#IXOEyO!bO,59TOOQ07b,59T,59TOOOO'#IY'#IYOFXO#tO,59TO%[Q^O'#D`OOOO'#I['#I[OFgO?MpO,59xOOQ07b,59x,59xOFuQ^O'#I]OGYQWO'#JkOI[QrO'#JkO+}Q^O'#JkOIcQWO,5:OOIyQWO'#ElOJWQWO'#JyOJcQWO'#JxOJcQWO'#JxOJkQWO,5;YOJpQWO'#JwOOQ07f,5:Z,5:ZOJwQ^O,5:ZOLxQ08SO,5:eOMiQWO,5:mONSQ07hO'#JvONZQWO'#JuO9ZQWO'#JuONoQWO'#JuONwQWO,5;XON|QWO'#JuO!#UQrO'#JjOOQ07b'#Ch'#ChO%[Q^O'#ERO!#tQpO,5:rOOQO'#Jr'#JrOOQO-EmOOQU'#J`'#J`OOQU,5>n,5>nOOQU-EpQWO'#HQO9aQWO'#HSO!CgQWO'#HSO:RQ7[O'#HUO!ClQWO'#HUOOQU,5=j,5=jO!CqQWO'#HVO!DSQWO'#CnO!DXQWO,59OO!DcQWO,59OO!FhQ^O,59OOOQU,59O,59OO!FxQ07hO,59OO%[Q^O,59OO!ITQ^O'#H^OOQU'#H_'#H_OOQU'#H`'#H`O`Q^O,5=vO!IkQWO,5=vO`Q^O,5=|O`Q^O,5>OO!IpQWO,5>QO`Q^O,5>SO!IuQWO,5>VO!IzQ^O,5>]OOQU,5>c,5>cO%[Q^O,5>cO9kQ07hO,5>eOOQU,5>g,5>gO!NUQWO,5>gOOQU,5>i,5>iO!NUQWO,5>iOOQU,5>k,5>kO!NZQ`O'#D[O%[Q^O'#JmO!NxQ`O'#JmO# gQ`O'#DjO# xQ`O'#DjO#$ZQ^O'#DjO#$bQWO'#JlO#$jQWO,5:TO#$oQWO'#EpO#$}QWO'#JzO#%VQWO,5;ZO#%[Q`O'#DjO#%iQ`O'#EUOOQ07b,5:n,5:nO%[Q^O,5:nO#%pQWO,5:nO>pQWO,5;UO!@}Q`O,5;UO!AVQ7[O,5;UO:RQ7[O,5;UO#%xQWO,5@XO#%}Q$ISO,5:rOOQO-E<`-E<`O#'TQ07pO,5:}OCnQ`O,5:qO#'_Q`O,5:qOCnQ`O,5:}O!@rQ07hO,5:qOOQ07`'#Ef'#EfOOQO,5:},5:}O%[Q^O,5:}O#'lQ07hO,5:}O#'wQ07hO,5:}O!@}Q`O,5:qOOQO,5;T,5;TO#(VQ07hO,5:}POOO'#IV'#IVP#(kO!0LbO,58{POOO,58{,58{OOOO-EwO+}Q^O,5>wOOQO,5>},5>}O#)VQ^O'#I]OOQO-EpQ08SO1G0{O#>wQ08SO1G0{O#@oQ08SO1G0{O#CoQ(CYO'#ChO#EmQ(CYO1G1^O#EtQ(CYO'#JjO!,lQWO1G1dO#FUQ08SO,5?TOOQ07`-EkQWO1G3lO$2^Q^O1G3nO$6bQ^O'#HmOOQU1G3q1G3qO$6oQWO'#HsO>pQWO'#HuOOQU1G3w1G3wO$6wQ^O1G3wO9kQ07hO1G3}OOQU1G4P1G4POOQ07`'#GY'#GYO9kQ07hO1G4RO9kQ07hO1G4TO$;OQWO,5@XO!*fQ^O,5;[O9ZQWO,5;[O>pQWO,5:UO!*fQ^O,5:UO!@}Q`O,5:UO$;TQ(CYO,5:UOOQO,5;[,5;[O$;_Q`O'#I^O$;uQWO,5@WOOQ07b1G/o1G/oO$;}Q`O'#IdO$pQWO1G0pO!@}Q`O1G0pO!AVQ7[O1G0pOOQ07`1G5s1G5sO!@rQ07hO1G0]OOQO1G0i1G0iO%[Q^O1G0iO$wO$>TQWO1G5qO$>]QWO1G6OO$>eQrO1G6PO9ZQWO,5>}O$>oQ08SO1G5|O%[Q^O1G5|O$?PQ07hO1G5|O$?bQWO1G5{O$?bQWO1G5{O9ZQWO1G5{O$?jQWO,5?QO9ZQWO,5?QOOQO,5?Q,5?QO$@OQWO,5?QO$'TQWO,5?QOOQO-EXOOQU,5>X,5>XO%[Q^O'#HnO%7^QWO'#HpOOQU,5>_,5>_O9ZQWO,5>_OOQU,5>a,5>aOOQU7+)c7+)cOOQU7+)i7+)iOOQU7+)m7+)mOOQU7+)o7+)oO%7cQ`O1G5sO%7wQ(CYO1G0vO%8RQWO1G0vOOQO1G/p1G/pO%8^Q(CYO1G/pO>pQWO1G/pO!*fQ^O'#DjOOQO,5>x,5>xOOQO-E<[-E<[OOQO,5?O,5?OOOQO-EpQWO7+&[O!@}Q`O7+&[OOQO7+%w7+%wO$=gQ08SO7+&TOOQO7+&T7+&TO%[Q^O7+&TO%8hQ07hO7+&TO!@rQ07hO7+%wO!@}Q`O7+%wO%8sQ07hO7+&TO%9RQ08SO7++hO%[Q^O7++hO%9cQWO7++gO%9cQWO7++gOOQO1G4l1G4lO9ZQWO1G4lO%9kQWO1G4lOOQO7+%|7+%|O#%sQWO<tQ08SO1G2ZO%AVQ08SO1G2mO%CbQ08SO1G2oO%EmQ7[O,5>yOOQO-E<]-E<]O%EwQrO,5>zO%[Q^O,5>zOOQO-E<^-E<^O%FRQWO1G5uOOQ07b<YOOQU,5>[,5>[O&5cQWO1G3yO9ZQWO7+&bO!*fQ^O7+&bOOQO7+%[7+%[O&5hQ(CYO1G6PO>pQWO7+%[OOQ07b<pQWO<pQWO7+)eO'&gQWO<}AN>}O%[Q^OAN?ZOOQO<eQ(CYOG26}O!*fQ^O'#DyO1PQWO'#EWO'@ZQrO'#JiO!*fQ^O'#DqO'@bQ^O'#D}O'@iQrO'#ChO'CPQrO'#ChO!*fQ^O'#EPO'CaQ^O,5;VO!*fQ^O,5;aO!*fQ^O,5;aO!*fQ^O,5;aO!*fQ^O,5;aO!*fQ^O,5;aO!*fQ^O,5;aO!*fQ^O,5;aO!*fQ^O,5;aO!*fQ^O,5;aO!*fQ^O,5;aO!*fQ^O,5;aO!*fQ^O'#IiO'EdQWO,5a#@O#@^#@d#Ax#BW#Cr#DQ#DW#D^#Dd#Dn#Dt#Dz#EU#Eh#EnPPPPPPPPPP#EtPPPPPPP#Fi#Ip#KP#KW#K`PPPP$!d$%Z$+r$+u$+x$,q$,t$,w$-O$-WPP$-^$-b$.Y$/X$/]$/qPP$/u$/{$0PP$0S$0W$0Z$1P$1h$2P$2T$2W$2Z$2a$2d$2h$2lR!{RoqOXst!Z#c%j&m&o&p&r,h,m1w1zY!uQ'Z-Y1[5]Q%pvQ%xyQ&P|Q&e!VS'R!e-QQ'a!iS'g!r!xS*c$|*hQ+f%yQ+s&RQ,X&_Q-W'YQ-b'bQ-j'hQ/|*jQ1f,YR;Y:g%OdOPWXYZstuvw!Z!`!g!o#R#V#Y#c#n#t#x#{$O$P$Q$R$S$T$U$V$W$X$Y$a$e%j%p%}&f&i&m&o&p&r&v'O']'m'}(P(V(^(r(v(z)y+O+S,e,h,m-^-f-t-z.l.s0[0a0q1_1o1p1r1t1w1z1|2m2s3Z5Y5d5t5u5x6]7w7|8]8gS#p]:d!r)[$[$m'S)n,y,|.{2]3p5W6S9W9i:c:f:g:j:k:l:m:n:o:p:q:r:s:t:u:v:w:{;Y;Z;[;^;e;f;o;p<]Q*u%ZQ+k%{Q,Z&bQ,b&jQ.c;QQ0h+^Q0l+`Q0w+lQ1n,`Q2{.[Q4v0rQ5k1gQ6i3PQ6u;RQ7h4wR8m6j&|kOPWXYZstuvw!Z!`!g!o#R#V#Y#c#n#t#x#{$O$P$Q$R$S$T$U$V$W$X$Y$[$a$e$m%j%p%}&f&i&j&m&o&p&r&v'O'S']'m'}(P(V(^(r(v(z)n)y+O+S+^,e,h,m,y,|-^-f-t-z.[.l.s.{0[0a0q1_1o1p1r1t1w1z1|2]2m2s3P3Z3p5W5Y5d5t5u5x6S6]6j7w7|8]8g9W9i:c:f:g:j:k:l:m:n:o:p:q:r:s:t:u:v:w:{;Y;Z;[;^;e;f;o;p<]t!nQ!r!u!x!y'R'Y'Z'g'h'i-Q-W-Y-j1[5]5_$v$si#u#w$c$d$x${%O%Q%[%]%a)u){)}*P*R*Y*`*p*q+]+`+w+z.Z.i/Z/j/k/m0Q0S0^1R1U1^3O3x4S4[4f4n4p5c6g7T7^7y8j8w9[9n:O:W:y:z:|:};O;P;S;T;U;V;W;X;_;`;a;b;c;d;g;h;i;j;k;l;m;n;q;r < TypeParamList TypeDefinition extends ThisType this LiteralType ArithOp Number BooleanLiteral TemplateType InterpolationEnd Interpolation InterpolationStart NullType null VoidType void TypeofType typeof MemberExpression . ?. PropertyName [ TemplateString Escape Interpolation super RegExp ] ArrayExpression Spread , } { ObjectExpression Property async get set PropertyDefinition Block : NewExpression new TypeArgList CompareOp < ) ( ArgList UnaryExpression delete LogicOp BitOp YieldExpression yield AwaitExpression await ParenthesizedExpression ClassExpression class ClassBody MethodDeclaration Decorator @ MemberExpression PrivatePropertyName CallExpression declare Privacy static abstract override PrivatePropertyDefinition PropertyDeclaration readonly accessor Optional TypeAnnotation Equals StaticBlock FunctionExpression ArrowFunction ParamList ParamList ArrayPattern ObjectPattern PatternProperty Privacy readonly Arrow MemberExpression BinaryExpression ArithOp ArithOp ArithOp ArithOp BitOp CompareOp instanceof satisfies in const CompareOp BitOp BitOp BitOp LogicOp LogicOp ConditionalExpression LogicOp LogicOp AssignmentExpression UpdateOp PostfixExpression CallExpression TaggedTemplateExpression DynamicImport import ImportMeta JSXElement JSXSelfCloseEndTag JSXSelfClosingTag JSXIdentifier JSXBuiltin JSXIdentifier JSXNamespacedName JSXMemberExpression JSXSpreadAttribute JSXAttribute JSXAttributeValue JSXEscape JSXEndTag JSXOpenTag JSXFragmentTag JSXText JSXEscape JSXStartCloseTag JSXCloseTag PrefixCast ArrowFunction TypeParamList SequenceExpression KeyofType keyof UniqueType unique ImportType InferredType infer TypeName ParenthesizedType FunctionSignature ParamList NewSignature IndexedType TupleType Label ArrayType ReadonlyType ObjectType MethodType PropertyType IndexSignature PropertyDefinition CallSignature TypePredicate is NewSignature new UnionType LogicOp IntersectionType LogicOp ConditionalType ParameterizedType ClassDeclaration abstract implements type VariableDeclaration let var using TypeAliasDeclaration InterfaceDeclaration interface EnumDeclaration enum EnumBody NamespaceDeclaration namespace module AmbientDeclaration declare GlobalDeclaration global ClassDeclaration ClassBody AmbientFunctionDeclaration ExportGroup VariableName VariableName ImportDeclaration ImportGroup ForStatement for ForSpec ForInSpec ForOfSpec of WhileStatement while WithStatement with DoStatement do IfStatement if else SwitchStatement switch SwitchBody CaseLabel case DefaultLabel TryStatement try CatchClause catch FinallyClause finally ReturnStatement return ThrowStatement throw BreakStatement break ContinueStatement continue DebuggerStatement debugger LabeledStatement ExpressionStatement SingleExpression SingleClassItem",maxTerm:371,context:cY,nodeProps:[["isolate",-8,4,5,13,33,35,48,50,52,""],["group",-26,8,16,18,65,201,205,209,210,212,215,218,228,230,236,238,240,242,245,251,257,259,261,263,265,267,268,"Statement",-32,12,13,28,31,32,38,48,51,52,54,59,67,75,79,81,83,84,106,107,116,117,134,137,139,140,141,142,144,145,164,165,167,"Expression",-23,27,29,33,37,39,41,168,170,172,173,175,176,177,179,180,181,183,184,185,195,197,199,200,"Type",-3,87,99,105,"ClassItem"],["openedBy",22,"<",34,"InterpolationStart",53,"[",57,"{",72,"(",157,"JSXStartCloseTag"],["closedBy",23,">",36,"InterpolationEnd",47,"]",58,"}",73,")",162,"JSXEndTag"]],propSources:[pY],skippedNodes:[0,4,5,271],repeatNodeCount:37,tokenData:"$Fj(CSR!bOX%ZXY+gYZ-yZ[+g[]%Z]^.c^p%Zpq+gqr/mrs3cst:_tuEruvJSvwLkwx! Yxy!'iyz!(sz{!)}{|!,q|}!.O}!O!,q!O!P!/Y!P!Q!9j!Q!R#8g!R![#:v![!]#Gv!]!^#IS!^!_#J^!_!`#Ns!`!a$#_!a!b$(l!b!c$,k!c!}Er!}#O$-u#O#P$/P#P#Q$4h#Q#R$5r#R#SEr#S#T$7P#T#o$8Z#o#p$q#r#s$?}#s$f%Z$f$g+g$g#BYEr#BY#BZ$AX#BZ$ISEr$IS$I_$AX$I_$I|Er$I|$I}$Dd$I}$JO$Dd$JO$JTEr$JT$JU$AX$JU$KVEr$KV$KW$AX$KW&FUEr&FU&FV$AX&FV;'SEr;'S;=`I|<%l?HTEr?HT?HU$AX?HUOEr(n%d_$f&j(Op(R!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z&j&hT$f&jO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c&j&zP;=`<%l&c'|'U]$f&j(R!bOY&}YZ&cZw&}wx&cx!^&}!^!_'}!_#O&}#O#P&c#P#o&}#o#p'}#p;'S&};'S;=`(l<%lO&}!b(SU(R!bOY'}Zw'}x#O'}#P;'S'};'S;=`(f<%lO'}!b(iP;=`<%l'}'|(oP;=`<%l&}'[(y]$f&j(OpOY(rYZ&cZr(rrs&cs!^(r!^!_)r!_#O(r#O#P&c#P#o(r#o#p)r#p;'S(r;'S;=`*a<%lO(rp)wU(OpOY)rZr)rs#O)r#P;'S)r;'S;=`*Z<%lO)rp*^P;=`<%l)r'[*dP;=`<%l(r#S*nX(Op(R!bOY*gZr*grs'}sw*gwx)rx#O*g#P;'S*g;'S;=`+Z<%lO*g#S+^P;=`<%l*g(n+dP;=`<%l%Z(CS+rq$f&j(Op(R!b't(;dOX%ZXY+gYZ&cZ[+g[p%Zpq+gqr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p$f%Z$f$g+g$g#BY%Z#BY#BZ+g#BZ$IS%Z$IS$I_+g$I_$JT%Z$JT$JU+g$JU$KV%Z$KV$KW+g$KW&FU%Z&FU&FV+g&FV;'S%Z;'S;=`+a<%l?HT%Z?HT?HU+g?HUO%Z(CS.ST(P#S$f&j'u(;dO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c(CS.n_$f&j(Op(R!b'u(;dOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z%#`/x`$f&j!o$Ip(Op(R!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_!`0z!`#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z%#S1V`#t$Id$f&j(Op(R!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_!`2X!`#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z%#S2d_#t$Id$f&j(Op(R!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z$/|3l_'}$(n$f&j(R!bOY4kYZ5qZr4krs7nsw4kwx5qx!^4k!^!_8p!_#O4k#O#P5q#P#o4k#o#p8p#p;'S4k;'S;=`:X<%lO4k(^4r_$f&j(R!bOY4kYZ5qZr4krs7nsw4kwx5qx!^4k!^!_8p!_#O4k#O#P5q#P#o4k#o#p8p#p;'S4k;'S;=`:X<%lO4k&z5vX$f&jOr5qrs6cs!^5q!^!_6y!_#o5q#o#p6y#p;'S5q;'S;=`7h<%lO5q&z6jT$a`$f&jO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c`6|TOr6yrs7]s;'S6y;'S;=`7b<%lO6y`7bO$a``7eP;=`<%l6y&z7kP;=`<%l5q(^7w]$a`$f&j(R!bOY&}YZ&cZw&}wx&cx!^&}!^!_'}!_#O&}#O#P&c#P#o&}#o#p'}#p;'S&};'S;=`(l<%lO&}!r8uZ(R!bOY8pYZ6yZr8prs9hsw8pwx6yx#O8p#O#P6y#P;'S8p;'S;=`:R<%lO8p!r9oU$a`(R!bOY'}Zw'}x#O'}#P;'S'};'S;=`(f<%lO'}!r:UP;=`<%l8p(^:[P;=`<%l4k#%|:hh$f&j(Op(R!bOY%ZYZ&cZq%Zqr`#P#o`x!^=^!^!_?q!_#O=^#O#P>`#P#o=^#o#p?q#p;'S=^;'S;=`@h<%lO=^&n>gXVS$f&jOY>`YZ&cZ!^>`!^!_?S!_#o>`#o#p?S#p;'S>`;'S;=`?k<%lO>`S?XSVSOY?SZ;'S?S;'S;=`?e<%lO?SS?hP;=`<%l?S&n?nP;=`<%l>`!f?xWVS(R!bOY?qZw?qwx?Sx#O?q#O#P?S#P;'S?q;'S;=`@b<%lO?q!f@eP;=`<%l?q(Q@kP;=`<%l=^'`@w]VS$f&j(OpOY@nYZ&cZr@nrs>`s!^@n!^!_Ap!_#O@n#O#P>`#P#o@n#o#pAp#p;'S@n;'S;=`Bg<%lO@ntAwWVS(OpOYApZrAprs?Ss#OAp#O#P?S#P;'SAp;'S;=`Ba<%lOAptBdP;=`<%lAp'`BjP;=`<%l@n#WBvYVS(Op(R!bOYBmZrBmrs?qswBmwxApx#OBm#O#P?S#P;'SBm;'S;=`Cf<%lOBm#WCiP;=`<%lBm(rCoP;=`<%lQ^$f&j!USOY!=yYZ&cZ!P!=y!P!Q!>|!Q!^!=y!^!_!@Y!_!}!=y!}#O!Bw#O#P!Dj#P#o!=y#o#p!@Y#p;'S!=y;'S;=`!E[<%lO!=y&n!?Ta$f&j!USO!^&c!_#Z&c#Z#[!>|#[#]&c#]#^!>|#^#a&c#a#b!>|#b#g&c#g#h!>|#h#i&c#i#j!>|#j#m&c#m#n!>|#n#o&c#p;'S&c;'S;=`&w<%lO&cS!@_X!USOY!@YZ!P!@Y!P!Q!@z!Q!}!@Y!}#O!Ac#O#P!Bb#P;'S!@Y;'S;=`!Bq<%lO!@YS!APU!US#Z#[!@z#]#^!@z#a#b!@z#g#h!@z#i#j!@z#m#n!@zS!AfVOY!AcZ#O!Ac#O#P!A{#P#Q!@Y#Q;'S!Ac;'S;=`!B[<%lO!AcS!BOSOY!AcZ;'S!Ac;'S;=`!B[<%lO!AcS!B_P;=`<%l!AcS!BeSOY!@YZ;'S!@Y;'S;=`!Bq<%lO!@YS!BtP;=`<%l!@Y&n!B|[$f&jOY!BwYZ&cZ!^!Bw!^!_!Ac!_#O!Bw#O#P!Cr#P#Q!=y#Q#o!Bw#o#p!Ac#p;'S!Bw;'S;=`!Dd<%lO!Bw&n!CwX$f&jOY!BwYZ&cZ!^!Bw!^!_!Ac!_#o!Bw#o#p!Ac#p;'S!Bw;'S;=`!Dd<%lO!Bw&n!DgP;=`<%l!Bw&n!DoX$f&jOY!=yYZ&cZ!^!=y!^!_!@Y!_#o!=y#o#p!@Y#p;'S!=y;'S;=`!E[<%lO!=y&n!E_P;=`<%l!=y(Q!Eki$f&j(R!b!USOY&}YZ&cZw&}wx&cx!^&}!^!_'}!_#O&}#O#P&c#P#Z&}#Z#[!Eb#[#]&}#]#^!Eb#^#a&}#a#b!Eb#b#g&}#g#h!Eb#h#i&}#i#j!Eb#j#m&}#m#n!Eb#n#o&}#o#p'}#p;'S&};'S;=`(l<%lO&}!f!GaZ(R!b!USOY!GYZw!GYwx!@Yx!P!GY!P!Q!HS!Q!}!GY!}#O!Ic#O#P!Bb#P;'S!GY;'S;=`!JZ<%lO!GY!f!HZb(R!b!USOY'}Zw'}x#O'}#P#Z'}#Z#[!HS#[#]'}#]#^!HS#^#a'}#a#b!HS#b#g'}#g#h!HS#h#i'}#i#j!HS#j#m'}#m#n!HS#n;'S'};'S;=`(f<%lO'}!f!IhX(R!bOY!IcZw!Icwx!Acx#O!Ic#O#P!A{#P#Q!GY#Q;'S!Ic;'S;=`!JT<%lO!Ic!f!JWP;=`<%l!Ic!f!J^P;=`<%l!GY(Q!Jh^$f&j(R!bOY!JaYZ&cZw!Jawx!Bwx!^!Ja!^!_!Ic!_#O!Ja#O#P!Cr#P#Q!Q#V#X%Z#X#Y!4|#Y#b%Z#b#c#Zd$f&j(Op(R!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q!R#?i!R!S#?i!S!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S#?i#S#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z$/l#?tf$f&j(Op(R!bo$'|OY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q!R#?i!R!S#?i!S!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S#?i#S#b%Z#b#c#OY[t]||-1},{term:334,get:t=>mY[t]||-1},{term:70,get:t=>gY[t]||-1}],tokenPrec:14626});var AQ=[ci("function ${name}(${params}) {\n ${}\n}",{label:"function",detail:"definition",type:"keyword"}),ci("for (let ${index} = 0; ${index} < ${bound}; ${index}++) {\n ${}\n}",{label:"for",detail:"loop",type:"keyword"}),ci("for (let ${name} of ${collection}) {\n ${}\n}",{label:"for",detail:"of loop",type:"keyword"}),ci("do {\n ${}\n} while (${})",{label:"do",detail:"loop",type:"keyword"}),ci("while (${}) {\n ${}\n}",{label:"while",detail:"loop",type:"keyword"}),ci(`try { +`);r=n<0?i:i.slice(0,n)}return e+r.length>this.to?r.slice(0,this.to-e):r}prevLineEnd(){return this.atEnd?this.lineStart:this.lineStart-1}startContext(e,i,r=0){this.block=Vp.create(e,r,this.lineStart+i,this.block.hash,this.lineStart+this.line.text.length),this.stack.push(this.block)}startComposite(e,i,r=0){this.startContext(this.parser.getNodeType(e),i,r)}addNode(e,i,r){typeof e=="number"&&(e=new qe(this.parser.nodeSet.types[e],fl,fl,(r!=null?r:this.prevLineEnd())-i)),this.block.addChild(e,i-this.block.from)}addElement(e){this.block.addChild(e.toTree(this.parser.nodeSet),e.from-this.block.from)}addLeafElement(e,i){this.addNode(this.buffer.writeElements(bx(i.children,e.marks),-i.from).finish(i.type,i.to-i.from),i.from)}finishContext(){let e=this.stack.pop(),i=this.stack[this.stack.length-1];i.addChild(e.toTree(this.parser.nodeSet),e.from-i.from),this.block=i}finish(){for(;this.stack.length>1;)this.finishContext();return this.addGaps(this.block.toTree(this.parser.nodeSet,this.lineStart))}addGaps(e){return this.ranges.length>1?PP(this.ranges,0,e.topNode,this.ranges[0].from,this.reusePlaceholders):e}finishLeaf(e){for(let r of e.parsers)if(r.finish(this,e))return;let i=bx(this.parser.parseInline(e.content,e.start),e.marks);this.addNode(this.buffer.writeElements(i,-e.start).finish(ge.Paragraph,e.content.length),e.start)}elt(e,i,r,n){return typeof e=="string"?Ke(this.parser.getNodeType(e),i,r,n):new Fp(e,i)}get buffer(){return new Yp(this.parser.nodeSet)}};function PP(t,e,i,r,n){let o=t[e].to,s=[],a=[],l=i.from+r;function c(u,f){for(;f?u>=o:u>o;){let d=t[e+1].from-o;r+=d,u+=d,e++,o=t[e].to}}for(let u=i.firstChild;u;u=u.nextSibling){c(u.from+r,!0);let f=u.from+r,d,p=n.get(u.tree);p?d=p:u.to+r>o?(d=PP(t,e,u,r,n),c(u.to+r,!1)):d=u.toTree(),s.push(d),a.push(f-l)}return c(i.to+r,!1),new qe(i.type,s,a,i.to+r-l,i.tree?i.tree.propValues:void 0)}var ju=class t extends zn{constructor(e,i,r,n,o,s,a,l,c){super(),this.nodeSet=e,this.blockParsers=i,this.leafBlockParsers=r,this.blockNames=n,this.endLeafBlock=o,this.skipContextMarkup=s,this.inlineParsers=a,this.inlineNames=l,this.wrappers=c,this.nodeTypes=Object.create(null);for(let u of e.types)this.nodeTypes[u.name]=u.id}createParse(e,i,r){let n=new Ox(this,e,i,r);for(let o of this.wrappers)n=o(n,e,i,r);return n}configure(e){let i=mx(e);if(!i)return this;let{nodeSet:r,skipContextMarkup:n}=this,o=this.blockParsers.slice(),s=this.leafBlockParsers.slice(),a=this.blockNames.slice(),l=this.inlineParsers.slice(),c=this.inlineNames.slice(),u=this.endLeafBlock.slice(),f=this.wrappers;if(Nu(i.defineNodes)){n=Object.assign({},n);let d=r.types.slice(),p;for(let g of i.defineNodes){let{name:x,block:w,composite:S,style:T}=typeof g=="string"?{name:g}:g;if(d.some(D=>D.name==x))continue;S&&(n[d.length]=(D,C,j)=>S(C,j,D.value));let A=d.length,I=S?["Block","BlockContext"]:w?A>=ge.ATXHeading1&&A<=ge.SetextHeading2?["Block","LeafBlock","Heading"]:["Block","LeafBlock"]:void 0;d.push(Tt.define({id:A,name:x,props:I&&[[Qe.group,I]]})),T&&(p||(p={}),Array.isArray(T)||T instanceof xr?p[x]=T:Object.assign(p,T))}r=new Mn(d),p&&(r=r.extend(Bt(p)))}if(Nu(i.props)&&(r=r.extend(...i.props)),Nu(i.remove))for(let d of i.remove){let p=this.blockNames.indexOf(d),g=this.inlineNames.indexOf(d);p>-1&&(o[p]=s[p]=void 0),g>-1&&(l[g]=void 0)}if(Nu(i.parseBlock))for(let d of i.parseBlock){let p=a.indexOf(d.name);if(p>-1)o[p]=d.parse,s[p]=d.leaf;else{let g=d.before?Zp(a,d.before):d.after?Zp(a,d.after)+1:a.length-1;o.splice(g,0,d.parse),s.splice(g,0,d.leaf),a.splice(g,0,d.name)}d.endLeaf&&u.push(d.endLeaf)}if(Nu(i.parseInline))for(let d of i.parseInline){let p=c.indexOf(d.name);if(p>-1)l[p]=d.parse;else{let g=d.before?Zp(c,d.before):d.after?Zp(c,d.after)+1:c.length-1;l.splice(g,0,d.parse),c.splice(g,0,d.name)}}return i.wrap&&(f=f.concat(i.wrap)),new t(r,o,s,a,u,n,l,c,f)}getNodeType(e){let i=this.nodeTypes[e];if(i==null)throw new RangeError(`Unknown node type '${e}'`);return i}parseInline(e,i){let r=new gx(this,e,i);e:for(let n=i;n=0){n=a;continue e}}n++}return r.resolveMarkers(0)}};function Nu(t){return t!=null&&t.length>0}function mx(t){if(!Array.isArray(t))return t;if(t.length==0)return null;let e=mx(t[0]);if(t.length==1)return e;let i=mx(t.slice(1));if(!i||!e)return e||i;let r=(s,a)=>(s||fl).concat(a||fl),n=e.wrap,o=i.wrap;return{props:r(e.props,i.props),defineNodes:r(e.defineNodes,i.defineNodes),parseBlock:r(e.parseBlock,i.parseBlock),parseInline:r(e.parseInline,i.parseInline),remove:r(e.remove,i.remove),wrap:n?o?(s,a,l,c)=>n(o(s,a,l,c),a,l,c):n:o}}function Zp(t,e){let i=t.indexOf(e);if(i<0)throw new RangeError(`Position specified relative to unknown parser ${e}`);return i}var QP=[Tt.none];for(let t=1,e;e=ge[t];t++)QP[t]=Tt.define({id:t,name:e,props:t>=ge.Escape?[]:[[Qe.group,t in xP?["Block","BlockContext"]:["Block","LeafBlock"]]],top:e=="Document"});var fl=[],Yp=class{constructor(e){this.nodeSet=e,this.content=[],this.nodes=[]}write(e,i,r,n=0){return this.content.push(e,i,r,4+n*4),this}writeElements(e,i=0){for(let r of e)r.writeTo(this,i);return this}finish(e,i){return qe.build({buffer:this.content,nodeSet:this.nodeSet,reused:this.nodes,topID:e,length:i})}},Us=class{constructor(e,i,r,n=fl){this.type=e,this.from=i,this.to=r,this.children=n}writeTo(e,i){let r=e.content.length;e.writeElements(this.children,i),e.content.push(this.type,this.from+i,this.to+i,e.content.length+4-r)}toTree(e){return new Yp(e).writeElements(this.children,-this.from).finish(this.type,this.to-this.from)}},Fp=class{constructor(e,i){this.tree=e,this.from=i}get to(){return this.from+this.tree.length}get type(){return this.tree.type.id}get children(){return fl}writeTo(e,i){e.nodes.push(this.tree),e.content.push(e.nodes.length-1,this.from+i,this.to+i,-1)}toTree(){return this.tree}};function Ke(t,e,i,r){return new Us(t,e,i,r)}var AP={resolve:"Emphasis",mark:"EmphasisMark"},$P={resolve:"Emphasis",mark:"EmphasisMark"},Mu={},fP={},ir=class{constructor(e,i,r,n){this.type=e,this.from=i,this.to=r,this.side=n}},hP="!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~",qu=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\u2010-\u2027]/;try{qu=new RegExp("[\\p{Pc}|\\p{Pd}|\\p{Pe}|\\p{Pf}|\\p{Pi}|\\p{Po}|\\p{Ps}]","u")}catch(t){}var lx={Escape(t,e,i){if(e!=92||i==t.end-1)return-1;let r=t.char(i+1);for(let n=0;n]+|[a-z\d.!#$%&'*+/=?^_`{|}~-]+@[a-z\d](?:[a-z\d-]{0,61}[a-z\d])?(?:\.[a-z\d](?:[a-z\d-]{0,61}[a-z\d])?)*)>/i.exec(r);if(n)return t.append(Ke(ge.Autolink,i,i+1+n[0].length,[Ke(ge.LinkMark,i,i+1),Ke(ge.URL,i+1,i+n[0].length),Ke(ge.LinkMark,i+n[0].length,i+1+n[0].length)]));let o=/^!--[^>](?:-[^-]|[^-])*?-->/i.exec(r);if(o)return t.append(Ke(ge.Comment,i,i+1+o[0].length));let s=/^\?[^]*?\?>/.exec(r);if(s)return t.append(Ke(ge.ProcessingInstruction,i,i+1+s[0].length));let a=/^(?:![A-Z][^]*?>|!\[CDATA\[[^]*?\]\]>|\/\s*[a-zA-Z][\w-]*\s*>|\s*[a-zA-Z][\w-]*(\s+[a-zA-Z:_][\w-.:]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*(\/\s*)?>)/.exec(r);return a?t.append(Ke(ge.HTMLTag,i,i+1+a[0].length)):-1},Emphasis(t,e,i){if(e!=95&&e!=42)return-1;let r=i+1;for(;t.char(r)==e;)r++;let n=t.slice(i-1,i),o=t.slice(r,r+1),s=qu.test(n),a=qu.test(o),l=/\s|^$/.test(n),c=/\s|^$/.test(o),u=!c&&(!a||l||s),f=!l&&(!s||c||a),d=u&&(e==42||!f||s),p=f&&(e==42||!u||a);return t.append(new ir(e==95?AP:$P,i,r,(d?1:0)|(p?2:0)))},HardBreak(t,e,i){if(e==92&&t.char(i+1)==10)return t.append(Ke(ge.HardBreak,i,i+2));if(e==32){let r=i+1;for(;t.char(r)==32;)r++;if(t.char(r)==10&&r>=i+2)return t.append(Ke(ge.HardBreak,i,r+1))}return-1},Link(t,e,i){return e==91?t.append(new ir(Mu,i,i+1,1)):-1},Image(t,e,i){return e==33&&t.char(i+1)==91?t.append(new ir(fP,i,i+2,1)):-1},LinkEnd(t,e,i){if(e!=93)return-1;for(let r=t.parts.length-1;r>=0;r--){let n=t.parts[r];if(n instanceof ir&&(n.type==Mu||n.type==fP)){if(!n.side||t.skipSpace(n.to)==i&&!/[(\[]/.test(t.slice(i+1,i+2)))return t.parts[r]=null,-1;let o=t.takeContent(r),s=t.parts[r]=TZ(t,o,n.type==Mu?ge.Link:ge.Image,n.from,i+1);if(n.type==Mu)for(let a=0;ae?Ke(ge.URL,e+i,o+i):o==t.length?null:!1}}function RP(t,e,i){let r=t.charCodeAt(e);if(r!=39&&r!=34&&r!=40)return!1;let n=r==40?41:r;for(let o=e+1,s=!1;o=this.end?-1:this.text.charCodeAt(e-this.offset)}get end(){return this.offset+this.text.length}slice(e,i){return this.text.slice(e-this.offset,i-this.offset)}append(e){return this.parts.push(e),e.to}addDelimiter(e,i,r,n,o){return this.append(new ir(e,i,r,(n?1:0)|(o?2:0)))}addElement(e){return this.append(e)}resolveMarkers(e){for(let r=e;r=e;l--){let x=this.parts[l];if(x instanceof ir&&x.side&1&&x.type==n.type&&!(o&&(n.side&1||x.side&2)&&(x.to-x.from+s)%3==0&&((x.to-x.from)%3||s%3))){a=x;break}}if(!a)continue;let c=n.type.resolve,u=[],f=a.from,d=n.to;if(o){let x=Math.min(2,a.to-a.from,s);f=a.to-x,d=n.from+x,c=x==1?"Emphasis":"StrongEmphasis"}a.type.mark&&u.push(this.elt(a.type.mark,f,a.to));for(let x=l+1;x=0;i--){let r=this.parts[i];if(r instanceof ir&&r.type==e)return i}return null}takeContent(e){let i=this.resolveMarkers(e);return this.parts.length=e,i}skipSpace(e){return Uu(this.text,e-this.offset)+this.offset}elt(e,i,r,n){return typeof e=="string"?Ke(this.parser.getNodeType(e),i,r,n):new Fp(e,i)}};function bx(t,e){if(!e.length)return t;if(!t.length)return e;let i=t.slice(),r=0;for(let n of e){for(;r(e?e-1:0))return!1;if(this.fragmentEnd<0){let o=this.fragment.to;for(;o>0&&this.input.read(o-1,o)!=` +`;)o--;this.fragmentEnd=o?o-1:0}let r=this.cursor;r||(r=this.cursor=this.fragment.tree.cursor(),r.firstChild());let n=e+this.fragment.offset;for(;r.to<=n;)if(!r.parent())return!1;for(;;){if(r.from>=n)return this.fragment.from<=i;if(!r.childAfter(n))return!1}}matches(e){let i=this.cursor.tree;return i&&i.prop(Qe.contextHash)==e}takeNodes(e){let i=this.cursor,r=this.fragment.offset,n=this.fragmentEnd-(this.fragment.openEnd?1:0),o=e.absoluteLineStart,s=o,a=e.block.children.length,l=s,c=a;for(;;){if(i.to-r>n){if(i.type.isAnonymous&&i.firstChild())continue;break}let u=LP(i.from-r,e.ranges);if(i.to-r<=e.ranges[e.rangeI].to)e.addNode(i.tree,u);else{let f=new qe(e.parser.nodeSet.types[ge.Paragraph],[],[],0,e.block.hashProp);e.reusePlaceholders.set(f,i.tree),e.addNode(f,u)}if(i.type.is("Block")&&(EZ.indexOf(i.type.id)<0?(s=i.to-r,a=e.block.children.length):(s=l,a=c,l=i.to-r,c=e.block.children.length)),!i.nextSibling())break}for(;e.block.children.length>a;)e.block.children.pop(),e.block.positions.pop();return s-o}};function LP(t,e){let i=t;for(let r=1;rBp[t]),Object.keys(Bp).map(t=>wZ[t]),Object.keys(Bp),kZ,xP,Object.keys(lx).map(t=>lx[t]),Object.keys(lx),[]);function _Z(t,e,i){let r=[];for(let n=t.firstChild,o=e;;n=n.nextSibling){let s=n?n.from:i;if(s>o&&r.push({from:o,to:s}),!n)break;o=n.to}return r}function NP(t){let{codeParser:e,htmlParser:i}=t;return{wrap:Id((n,o)=>{let s=n.type.id;if(e&&(s==ge.CodeBlock||s==ge.FencedCode)){let a="";if(s==ge.FencedCode){let c=n.node.getChild(ge.CodeInfo);c&&(a=o.read(c.from,c.to))}let l=e(a);if(l)return{parser:l,overlay:c=>c.type.id==ge.CodeText}}else if(i&&(s==ge.HTMLBlock||s==ge.HTMLTag))return{parser:i,overlay:_Z(n.node,n.from,n.to)};return null})}}var PZ={resolve:"Strikethrough",mark:"StrikethroughMark"},QZ={defineNodes:[{name:"Strikethrough",style:{"Strikethrough/...":_.strikethrough}},{name:"StrikethroughMark",style:_.processingInstruction}],parseInline:[{name:"Strikethrough",parse(t,e,i){if(e!=126||t.char(i+1)!=126||t.char(i+2)==126)return-1;let r=t.slice(i-1,i),n=t.slice(i+2,i+3),o=/\s|^$/.test(r),s=/\s|^$/.test(n),a=qu.test(r),l=qu.test(n);return t.addDelimiter(PZ,i,i+2,!s&&(!l||o||a),!o&&(!a||s||l))},after:"Emphasis"}]};function zu(t,e,i=0,r,n=0){let o=0,s=!0,a=-1,l=-1,c=!1,u=()=>{r.push(t.elt("TableCell",n+a,n+l,t.parser.parseInline(e.slice(a,l),n+a)))};for(let f=i;f-1)&&o++,s=!1,r&&(a>-1&&u(),r.push(t.elt("TableDelimiter",f+n,f+n+1))),a=l=-1):(c||d!=32&&d!=9)&&(a<0&&(a=f),l=f+1),c=!c&&d==92}return a>-1&&(o++,r&&u()),o}function dP(t,e){for(let i=e;in instanceof Hp)||!dP(e.text,e.basePos))return!1;let r=t.scanLine(t.absoluteLineEnd+1).text;return MP.test(r)&&zu(t,e.text,e.basePos)==zu(t,r,e.basePos)},before:"SetextHeading"}]},xx=class{nextLine(){return!1}finish(e,i){return e.addLeafElement(i,e.elt("Task",i.start,i.start+i.content.length,[e.elt("TaskMarker",i.start,i.start+3),...e.parser.parseInline(i.content.slice(3),i.start+3)])),!0}},$Z={defineNodes:[{name:"Task",block:!0,style:_.list},{name:"TaskMarker",style:_.atom}],parseBlock:[{name:"TaskList",leaf(t,e){return/^\[[ xX]\][ \t]/.test(e.content)&&t.parentType().name=="ListItem"?new xx:null},after:"SetextHeading"}]},pP=/(www\.)|(https?:\/\/)|([\w.+-]+@)|(mailto:|xmpp:)/gy,OP=/[\w-]+(\.[\w-]+)+(\/[^\s<]*)?/gy,XZ=/[\w-]+\.[\w-]+($|\/)/,mP=/[\w.+-]+@[\w-]+(\.[\w.-]+)+/gy,gP=/\/[a-zA-Z\d@.]+/gy;function bP(t,e,i,r){let n=0;for(let o=e;o-1)return-1;let r=e+i[0].length;for(;;){let n=t[r-1],o;if(/[?!.,:*_~]/.test(n)||n==")"&&bP(t,e,r,")")>bP(t,e,r,"("))r--;else if(n==";"&&(o=/&(?:#\d+|#x[a-f\d]+|\w+);$/.exec(t.slice(e,r))))r=e+o.index;else break}return r}function yP(t,e){mP.lastIndex=e;let i=mP.exec(t);if(!i)return-1;let r=i[0][i[0].length-1];return r=="_"||r=="-"?-1:e+i[0].length-(r=="."?1:0)}var IZ={parseInline:[{name:"Autolink",parse(t,e,i){let r=i-t.offset;pP.lastIndex=r;let n=pP.exec(t.text),o=-1;return!n||(n[1]||n[2]?o=RZ(t.text,r+n[0].length):n[3]?o=yP(t.text,r):(o=yP(t.text,r+n[0].length),o>-1&&n[0]=="xmpp:"&&(gP.lastIndex=o,n=gP.exec(t.text),n&&(o=n.index+n[0].length))),o<0)?-1:(t.addElement(t.elt("URL",i,o+t.offset)),o+t.offset)}}]},UP=[AZ,$Z,QZ,IZ];function zP(t,e,i){return(r,n,o)=>{if(n!=t||r.char(o+1)==t)return-1;let s=[r.elt(i,o,o+1)];for(let a=o+1;ai%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,i,r=0){let n=e.parser.context;return new t(e,[],i,r,r,0,[],0,n?new Gp(n,n.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,i){this.stack.push(this.state,i,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var i;let r=e>>19,n=e&65535,{parser:o}=this.p,s=o.dynamicPrecedence(n);if(s&&(this.score+=s),r==0){this.pushState(o.getGoto(this.state,n,!0),this.reducePos),n=2e3&&!(!((i=this.p.parser.nodeSet.types[n])===null||i===void 0)&&i.isAnonymous)&&(l==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=c):this.p.lastBigReductionSizea;)this.stack.pop();this.reduceContext(n,l)}storeNode(e,i,r,n=4,o=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]0&&s.buffer[a-4]==0&&s.buffer[a-1]>-1){if(i==r)return;if(s.buffer[a-2]>=i){s.buffer[a-2]=r;return}}}if(!o||this.pos==r)this.buffer.push(e,i,r,n);else{let s=this.buffer.length;if(s>0&&this.buffer[s-4]!=0)for(;s>0&&this.buffer[s-2]>r;)this.buffer[s]=this.buffer[s-4],this.buffer[s+1]=this.buffer[s-3],this.buffer[s+2]=this.buffer[s-2],this.buffer[s+3]=this.buffer[s-1],s-=4,n>4&&(n-=4);this.buffer[s]=e,this.buffer[s+1]=i,this.buffer[s+2]=r,this.buffer[s+3]=n}}shift(e,i,r,n){if(e&131072)this.pushState(e&65535,this.pos);else if(e&262144)this.pos=n,this.shiftContext(i,r),i<=this.p.parser.maxNode&&this.buffer.push(i,r,n,4);else{let o=e,{parser:s}=this.p;(n>this.pos||i<=s.maxNode)&&(this.pos=n,s.stateFlag(o,1)||(this.reducePos=n)),this.pushState(o,r),this.shiftContext(i,r),i<=s.maxNode&&this.buffer.push(i,r,n,4)}}apply(e,i,r,n){e&65536?this.reduce(e):this.shift(e,i,r,n)}useNode(e,i){let r=this.p.reused.length-1;(r<0||this.p.reused[r]!=e)&&(this.p.reused.push(e),r++);let n=this.pos;this.reducePos=this.pos=n+e.length,this.pushState(i,n),this.buffer.push(r,n,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,i=e.buffer.length;for(;i>0&&e.buffer[i-2]>e.reducePos;)i-=4;let r=e.buffer.slice(i),n=e.bufferBase+i;for(;e&&n==e.bufferBase;)e=e.parent;return new t(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,r,n,this.curContext,this.lookAhead,e)}recoverByDelete(e,i){let r=e<=this.p.parser.maxNode;r&&this.storeNode(e,this.pos,i,4),this.storeNode(0,this.pos,i,r?8:4),this.pos=this.reducePos=i,this.score-=190}canShift(e){for(let i=new Cx(this);;){let r=this.p.parser.stateSlot(i.state,4)||this.p.parser.hasAction(i.state,e);if(r==0)return!1;if(!(r&65536))return!0;i.reduce(r)}}recoverByInsert(e){if(this.stack.length>=300)return[];let i=this.p.parser.nextStates(this.state);if(i.length>8||this.stack.length>=120){let n=[];for(let o=0,s;ol&1&&a==s)||n.push(i[o],s)}i=n}let r=[];for(let n=0;n>19,n=i&65535,o=this.stack.length-r*3;if(o<0||e.getGoto(this.stack[o],n,!1)<0){let s=this.findForcedReduction();if(s==null)return!1;i=s}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(i),!0}findForcedReduction(){let{parser:e}=this.p,i=[],r=(n,o)=>{if(!i.includes(n))return i.push(n),e.allActions(n,s=>{if(!(s&393216))if(s&65536){let a=(s>>19)-o;if(a>1){let l=s&65535,c=this.stack.length-a*3;if(c>=0&&e.getGoto(this.stack[c],l,!1)>=0)return a<<19|65536|l}}else{let a=r(s,o+1);if(a!=null)return a}})};return r(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let i=0;ithis.lookAhead&&(this.emitLookAhead(),this.lookAhead=e)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}},Gp=class{constructor(e,i){this.tracker=e,this.context=i,this.hash=e.strict?e.hash(i):0}},Cx=class{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let i=e&65535,r=e>>19;r==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(r-1)*3;let n=this.start.p.parser.getGoto(this.stack[this.base-3],i,!0);this.state=n}},_x=class t{constructor(e,i,r){this.stack=e,this.pos=i,this.index=r,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,i=e.bufferBase+e.buffer.length){return new t(e,i,i-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new t(this.stack,this.pos,this.index)}};function Wu(t,e=Uint16Array){if(typeof t!="string")return t;let i=null;for(let r=0,n=0;r=92&&s--,s>=34&&s--;let l=s-32;if(l>=46&&(l-=46,a=!0),o+=l,a)break;o*=46}i?i[n++]=o:i=new e(o)}return i}var hl=class{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}},BP=new hl,Px=class{constructor(e,i){this.input=e,this.ranges=i,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=BP,this.rangeIndex=0,this.pos=this.chunkPos=i[0].from,this.range=i[0],this.end=i[i.length-1].to,this.readNext()}resolveOffset(e,i){let r=this.range,n=this.rangeIndex,o=this.pos+e;for(;or.to:o>=r.to;){if(n==this.ranges.length-1)return null;let s=this.ranges[++n];o+=s.from-r.to,r=s}return o}clipPos(e){if(e>=this.range.from&&ee)return Math.max(e,i.from);return this.end}peek(e){let i=this.chunkOff+e,r,n;if(i>=0&&i=this.chunk2Pos&&ra.to&&(this.chunk2=this.chunk2.slice(0,a.to-r)),n=this.chunk2.charCodeAt(0)}}return r>=this.token.lookAhead&&(this.token.lookAhead=r+1),n}acceptToken(e,i=0){let r=i?this.resolveOffset(i,-1):this.pos;if(r==null||r=this.chunk2Pos&&this.posthis.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,i){if(i?(this.token=i,i.start=e,i.lookAhead=e+1,i.value=i.extended=-1):this.token=BP,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e=this.chunkPos&&i<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,i-this.chunkPos);if(e>=this.chunk2Pos&&i<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,i-this.chunk2Pos);if(e>=this.range.from&&i<=this.range.to)return this.input.read(e,i);let r="";for(let n of this.ranges){if(n.from>=i)break;n.to>e&&(r+=this.input.read(Math.max(n.from,e),Math.min(n.to,i)))}return r}},Wo=class{constructor(e,i){this.data=e,this.id=i}token(e,i){let{parser:r}=i.p;HP(this.data,e,i,this.id,r.data,r.tokenPrecTable)}};Wo.prototype.contextual=Wo.prototype.fallback=Wo.prototype.extend=!1;var Bo=class{constructor(e,i,r){this.precTable=i,this.elseToken=r,this.data=typeof e=="string"?Wu(e):e}token(e,i){let r=e.pos,n=0;for(;;){let o=e.next<0,s=e.resolveOffset(1,1);if(HP(this.data,e,i,0,this.data,this.precTable),e.token.value>-1)break;if(this.elseToken==null)return;if(o||n++,s==null)break;e.reset(s,e.token)}n&&(e.reset(r,e.token),e.acceptToken(this.elseToken,n))}};Bo.prototype.contextual=Wo.prototype.fallback=Wo.prototype.extend=!1;var et=class{constructor(e,i={}){this.token=e,this.contextual=!!i.contextual,this.fallback=!!i.fallback,this.extend=!!i.extend}};function HP(t,e,i,r,n,o){let s=0,a=1<0){let g=t[p];if(l.allows(g)&&(e.token.value==-1||e.token.value==g||DZ(g,e.token.value,n,o))){e.acceptToken(g);break}}let u=e.next,f=0,d=t[s+2];if(e.next<0&&d>f&&t[c+d*3-3]==65535){s=t[c+d*3-1];continue e}for(;f>1,g=c+p+(p<<1),x=t[g],w=t[g+1]||65536;if(u=w)f=p+1;else{s=t[g+2],e.advance();continue e}}break}}function ZP(t,e,i){for(let r=e,n;(n=t[r])!=65535;r++)if(n==i)return r-e;return-1}function DZ(t,e,i,r){let n=ZP(i,r,e);return n<0||ZP(i,r,t)e)&&!r.type.isError)return i<0?Math.max(0,Math.min(r.to-1,e-25)):Math.min(t.length,Math.max(r.from+1,e+25));if(i<0?r.prevSibling():r.nextSibling())break;if(!r.parent())return i<0?0:t.length}}var Qx=class{constructor(e,i){this.fragments=e,this.nodeSet=i,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?VP(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?VP(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(ee)return this.nextStart=s,null;if(o instanceof qe){if(s==e){if(s=Math.max(this.safeFrom,e)&&(this.trees.push(o),this.start.push(s),this.index.push(0))}else this.index[i]++,this.nextStart=s+o.length}}},Ax=class{constructor(e,i){this.stream=i,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(r=>new hl)}getActions(e){let i=0,r=null,{parser:n}=e.p,{tokenizers:o}=n,s=n.stateSlot(e.state,3),a=e.curContext?e.curContext.hash:0,l=0;for(let c=0;cf.end+25&&(l=Math.max(f.lookAhead,l)),f.value!=0)){let d=i;if(f.extended>-1&&(i=this.addActions(e,f.extended,f.end,i)),i=this.addActions(e,f.value,f.end,i),!u.extend&&(r=f,i>d))break}}for(;this.actions.length>i;)this.actions.pop();return l&&e.setLookAhead(l),!r&&e.pos==this.stream.end&&(r=new hl,r.value=e.p.parser.eofTerm,r.start=r.end=e.pos,i=this.addActions(e,r.value,r.end,i)),this.mainToken=r,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let i=new hl,{pos:r,p:n}=e;return i.start=r,i.end=Math.min(r+1,n.stream.end),i.value=r==n.stream.end?n.parser.eofTerm:0,i}updateCachedToken(e,i,r){let n=this.stream.clipPos(r.pos);if(i.token(this.stream.reset(n,e),r),e.value>-1){let{parser:o}=r.p;for(let s=0;s=0&&r.p.parser.dialect.allows(a>>1)){a&1?e.extended=a>>1:e.value=a>>1;break}}}else e.value=0,e.end=this.stream.clipPos(n+1)}putAction(e,i,r,n){for(let o=0;oe.bufferLength*4?new Qx(r,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,i=this.minStackPos,r=this.stacks=[],n,o;if(this.bigReductionCount>300&&e.length==1){let[s]=e;for(;s.forceReduce()&&s.stack.length&&s.stack[s.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let s=0;si)r.push(a);else{if(this.advanceStack(a,r,e))continue;{n||(n=[],o=[]),n.push(a);let l=this.tokens.getMainToken(a);o.push(l.value,l.end)}}break}}if(!r.length){let s=n&&NZ(n);if(s)return rr&&console.log("Finish with "+this.stackID(s)),this.stackToTree(s);if(this.parser.strict)throw rr&&n&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+i);this.recovering||(this.recovering=5)}if(this.recovering&&n){let s=this.stoppedAt!=null&&n[0].pos>this.stoppedAt?n[0]:this.runRecovery(n,o,r);if(s)return rr&&console.log("Force-finish "+this.stackID(s)),this.stackToTree(s.forceAll())}if(this.recovering){let s=this.recovering==1?1:this.recovering*3;if(r.length>s)for(r.sort((a,l)=>l.score-a.score);r.length>s;)r.pop();r.some(a=>a.reducePos>i)&&this.recovering--}else if(r.length>1){e:for(let s=0;s500&&c.buffer.length>500)if((a.score-c.score||a.buffer.length-c.buffer.length)>0)r.splice(l--,1);else{r.splice(s--,1);continue e}}}r.length>12&&r.splice(12,r.length-12)}this.minStackPos=r[0].pos;for(let s=1;s ":"";if(this.stoppedAt!=null&&n>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let c=e.curContext&&e.curContext.tracker.strict,u=c?e.curContext.hash:0;for(let f=this.fragments.nodeAt(n);f;){let d=this.parser.nodeSet.types[f.type.id]==f.type?o.getGoto(e.state,f.type.id):-1;if(d>-1&&f.length&&(!c||(f.prop(Qe.contextHash)||0)==u))return e.useNode(f,d),rr&&console.log(s+this.stackID(e)+` (via reuse of ${o.getName(f.type.id)})`),!0;if(!(f instanceof qe)||f.children.length==0||f.positions[0]>0)break;let p=f.children[0];if(p instanceof qe&&f.positions[0]==0)f=p;else break}}let a=o.stateSlot(e.state,4);if(a>0)return e.reduce(a),rr&&console.log(s+this.stackID(e)+` (via always-reduce ${o.getName(a&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let l=this.tokens.getActions(e);for(let c=0;cn?i.push(g):r.push(g)}return!1}advanceFully(e,i){let r=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>r)return YP(e,i),!0}}runRecovery(e,i,r){let n=null,o=!1;for(let s=0;s ":"";if(a.deadEnd&&(o||(o=!0,a.restart(),rr&&console.log(u+this.stackID(a)+" (restarted)"),this.advanceFully(a,r))))continue;let f=a.split(),d=u;for(let p=0;f.forceReduce()&&p<10&&(rr&&console.log(d+this.stackID(f)+" (via force-reduce)"),!this.advanceFully(f,r));p++)rr&&(d=this.stackID(f)+" -> ");for(let p of a.recoverByInsert(l))rr&&console.log(u+this.stackID(p)+" (via recover-insert)"),this.advanceFully(p,r);this.stream.end>a.pos?(c==a.pos&&(c++,l=0),a.recoverByDelete(l,c),rr&&console.log(u+this.stackID(a)+` (via recover-delete ${this.parser.getName(l)})`),YP(a,r)):(!n||n.scoret,Zo=class{constructor(e){this.start=e.start,this.shift=e.shift||Tx,this.reduce=e.reduce||Tx,this.reuse=e.reuse||Tx,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}},vi=class t extends zn{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let i=e.nodeNames.split(" ");this.minRepeatTerm=i.length;for(let a=0;ae.topRules[a][1]),n=[];for(let a=0;a=0)o(u,l,a[c++]);else{let f=a[c+-u];for(let d=-u;d>0;d--)o(a[c++],l,f);c++}}}this.nodeSet=new Mn(i.map((a,l)=>Tt.define({name:l>=this.minRepeatTerm?void 0:a,id:l,props:n[l],top:r.indexOf(l)>-1,error:l==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(l)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=1024;let s=Wu(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let a=0;atypeof a=="number"?new Wo(s,a):a),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,i,r){let n=new $x(this,e,i,r);for(let o of this.wrappers)n=o(n,e,i,r);return n}getGoto(e,i,r=!1){let n=this.goto;if(i>=n[0])return-1;for(let o=n[i+1];;){let s=n[o++],a=s&1,l=n[o++];if(a&&r)return l;for(let c=o+(s>>1);o0}validAction(e,i){return!!this.allActions(e,r=>r==i?!0:null)}allActions(e,i){let r=this.stateSlot(e,4),n=r?i(r):void 0;for(let o=this.stateSlot(e,1);n==null;o+=3){if(this.data[o]==65535)if(this.data[o+1]==1)o=Fn(this.data,o+2);else break;n=i(Fn(this.data,o+1))}return n}nextStates(e){let i=[];for(let r=this.stateSlot(e,1);;r+=3){if(this.data[r]==65535)if(this.data[r+1]==1)r=Fn(this.data,r+2);else break;if(!(this.data[r+2]&1)){let n=this.data[r+1];i.some((o,s)=>s&1&&o==n)||i.push(this.data[r],n)}}return i}configure(e){let i=Object.assign(Object.create(t.prototype),this);if(e.props&&(i.nodeSet=this.nodeSet.extend(...e.props)),e.top){let r=this.topRules[e.top];if(!r)throw new RangeError(`Invalid top rule name ${e.top}`);i.top=r}return e.tokenizers&&(i.tokenizers=this.tokenizers.map(r=>{let n=e.tokenizers.find(o=>o.from==r);return n?n.to:r})),e.specializers&&(i.specializers=this.specializers.slice(),i.specializerSpecs=this.specializerSpecs.map((r,n)=>{let o=e.specializers.find(a=>a.from==r.external);if(!o)return r;let s=Object.assign(Object.assign({},r),{external:o.to});return i.specializers[n]=FP(s),s})),e.contextTracker&&(i.context=e.contextTracker),e.dialect&&(i.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(i.strict=e.strict),e.wrap&&(i.wrappers=i.wrappers.concat(e.wrap)),e.bufferLength!=null&&(i.bufferLength=e.bufferLength),i}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let i=this.dynamicPrecedences;return i==null?0:i[e]||0}parseDialect(e){let i=Object.keys(this.dialects),r=i.map(()=>!1);if(e)for(let o of e.split(" ")){let s=i.indexOf(o);s>=0&&(r[s]=!0)}let n=null;for(let o=0;or)&&i.p.parser.stateFlag(i.state,2)&&(!e||e.scoret.external(i,r)<<1|e}return t.get}var MZ=54,UZ=1,zZ=55,jZ=2,qZ=56,WZ=3,GP=4,BZ=5,Kp=6,oQ=7,sQ=8,aQ=9,lQ=10,ZZ=11,VZ=12,YZ=13,Rx=57,FZ=14,KP=58,cQ=20,HZ=22,uQ=23,GZ=24,Lx=26,fQ=27,KZ=28,JZ=31,eV=34,tV=36,iV=37,rV=0,nV=1,oV={area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},sV={dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},JP={dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}};function aV(t){return t==45||t==46||t==58||t>=65&&t<=90||t==95||t>=97&&t<=122||t>=161}function hQ(t){return t==9||t==10||t==13||t==32}var eQ=null,tQ=null,iQ=0;function Dx(t,e){let i=t.pos+e;if(iQ==i&&tQ==t)return eQ;let r=t.peek(e);for(;hQ(r);)r=t.peek(++e);let n="";for(;aV(r);)n+=String.fromCharCode(r),r=t.peek(++e);return tQ=t,iQ=i,eQ=n?n.toLowerCase():r==lV||r==cV?void 0:null}var dQ=60,Jp=62,Nx=47,lV=63,cV=33,uV=45;function rQ(t,e){this.name=t,this.parent=e,this.hash=e?e.hash:0;for(let i=0;i-1?new rQ(Dx(r,1)||"",t):t},reduce(t,e){return e==cQ&&t?t.parent:t},reuse(t,e,i,r){let n=e.type.id;return n==Kp||n==tV?new rQ(Dx(r,1)||"",t):t},hash(t){return t?t.hash:0},strict:!1}),dV=new et((t,e)=>{if(t.next!=dQ){t.next<0&&e.context&&t.acceptToken(Rx);return}t.advance();let i=t.next==Nx;i&&t.advance();let r=Dx(t,0);if(r===void 0)return;if(!r)return t.acceptToken(i?FZ:Kp);let n=e.context?e.context.name:null;if(i){if(r==n)return t.acceptToken(ZZ);if(n&&sV[n])return t.acceptToken(Rx,-2);if(e.dialectEnabled(rV))return t.acceptToken(VZ);for(let o=e.context;o;o=o.parent)if(o.name==r)return;t.acceptToken(YZ)}else{if(r=="script")return t.acceptToken(oQ);if(r=="style")return t.acceptToken(sQ);if(r=="textarea")return t.acceptToken(aQ);if(oV.hasOwnProperty(r))return t.acceptToken(lQ);n&&JP[n]&&JP[n][r]?t.acceptToken(Rx,-1):t.acceptToken(Kp)}},{contextual:!0}),pV=new et(t=>{for(let e=0,i=0;;i++){if(t.next<0){i&&t.acceptToken(KP);break}if(t.next==uV)e++;else if(t.next==Jp&&e>=2){i>=3&&t.acceptToken(KP,-2);break}else e=0;t.advance()}});function OV(t){for(;t;t=t.parent)if(t.name=="svg"||t.name=="math")return!0;return!1}var mV=new et((t,e)=>{if(t.next==Nx&&t.peek(1)==Jp){let i=e.dialectEnabled(nV)||OV(e.context);t.acceptToken(i?BZ:GP,2)}else t.next==Jp&&t.acceptToken(GP,1)});function Mx(t,e,i){let r=2+t.length;return new et(n=>{for(let o=0,s=0,a=0;;a++){if(n.next<0){a&&n.acceptToken(e);break}if(o==0&&n.next==dQ||o==1&&n.next==Nx||o>=2&&os?n.acceptToken(e,-s):n.acceptToken(i,-(s-2));break}else if((n.next==10||n.next==13)&&a){n.acceptToken(e,1);break}else o=s=0;n.advance()}})}var gV=Mx("script",MZ,UZ),bV=Mx("style",zZ,jZ),yV=Mx("textarea",qZ,WZ),xV=Bt({"Text RawText":_.content,"StartTag StartCloseTag SelfClosingEndTag EndTag":_.angleBracket,TagName:_.tagName,"MismatchedCloseTag/TagName":[_.tagName,_.invalid],AttributeName:_.attributeName,"AttributeValue UnquotedAttributeValue":_.attributeValue,Is:_.definitionOperator,"EntityReference CharacterReference":_.character,Comment:_.blockComment,ProcessingInst:_.processingInstruction,DoctypeDecl:_.documentMeta}),pQ=vi.deserialize({version:14,states:",xOVO!rOOO!WQ#tO'#CqO!]Q#tO'#CzO!bQ#tO'#C}O!gQ#tO'#DQO!lQ#tO'#DSO!qOaO'#CpO!|ObO'#CpO#XOdO'#CpO$eO!rO'#CpOOO`'#Cp'#CpO$lO$fO'#DTO$tQ#tO'#DVO$yQ#tO'#DWOOO`'#Dk'#DkOOO`'#DY'#DYQVO!rOOO%OQ&rO,59]O%WQ&rO,59fO%`Q&rO,59iO%hQ&rO,59lO%sQ&rO,59nOOOa'#D^'#D^O%{OaO'#CxO&WOaO,59[OOOb'#D_'#D_O&`ObO'#C{O&kObO,59[OOOd'#D`'#D`O&sOdO'#DOO'OOdO,59[OOO`'#Da'#DaO'WO!rO,59[O'_Q#tO'#DROOO`,59[,59[OOOp'#Db'#DbO'dO$fO,59oOOO`,59o,59oO'lQ#|O,59qO'qQ#|O,59rOOO`-E7W-E7WO'vQ&rO'#CsOOQW'#DZ'#DZO(UQ&rO1G.wOOOa1G.w1G.wO(^Q&rO1G/QOOOb1G/Q1G/QO(fQ&rO1G/TOOOd1G/T1G/TO(nQ&rO1G/WOOO`1G/W1G/WOOO`1G/Y1G/YO(yQ&rO1G/YOOOa-E7[-E7[O)RQ#tO'#CyOOO`1G.v1G.vOOOb-E7]-E7]O)WQ#tO'#C|OOOd-E7^-E7^O)]Q#tO'#DPOOO`-E7_-E7_O)bQ#|O,59mOOOp-E7`-E7`OOO`1G/Z1G/ZOOO`1G/]1G/]OOO`1G/^1G/^O)gQ,UO,59_OOQW-E7X-E7XOOOa7+$c7+$cOOOb7+$l7+$lOOOd7+$o7+$oOOO`7+$r7+$rOOO`7+$t7+$tO)rQ#|O,59eO)wQ#|O,59hO)|Q#|O,59kOOO`1G/X1G/XO*RO7[O'#CvO*dOMhO'#CvOOQW1G.y1G.yOOO`1G/P1G/POOO`1G/S1G/SOOO`1G/V1G/VOOOO'#D['#D[O*uO7[O,59bOOQW,59b,59bOOOO'#D]'#D]O+WOMhO,59bOOOO-E7Y-E7YOOQW1G.|1G.|OOOO-E7Z-E7Z",stateData:"+s~O!^OS~OUSOVPOWQOXROYTO[]O][O^^O`^Oa^Ob^Oc^Ox^O{_O!dZO~OfaO~OfbO~OfcO~OfdO~OfeO~O!WfOPlP!ZlP~O!XiOQoP!ZoP~O!YlORrP!ZrP~OUSOVPOWQOXROYTOZqO[]O][O^^O`^Oa^Ob^Oc^Ox^O!dZO~O!ZrO~P#dO![sO!euO~OfvO~OfwO~OS|OhyO~OS!OOhyO~OS!QOhyO~OS!SOT!TOhyO~OS!TOhyO~O!WfOPlX!ZlX~OP!WO!Z!XO~O!XiOQoX!ZoX~OQ!ZO!Z!XO~O!YlORrX!ZrX~OR!]O!Z!XO~O!Z!XO~P#dOf!_O~O![sO!e!aO~OS!bO~OS!cO~Oi!dOSgXhgXTgX~OS!fOhyO~OS!gOhyO~OS!hOhyO~OS!iOT!jOhyO~OS!jOhyO~Of!kO~Of!lO~Of!mO~OS!nO~Ok!qO!`!oO!b!pO~OS!rO~OS!sO~OS!tO~Oa!uOb!uOc!uO!`!wO!a!uO~Oa!xOb!xOc!xO!b!wO!c!xO~Oa!uOb!uOc!uO!`!{O!a!uO~Oa!xOb!xOc!xO!b!{O!c!xO~OT~bac!dx{!d~",goto:"%p!`PPPPPPPPPPPPPPPPPPPP!a!gP!mPP!yP!|#P#S#Y#]#`#f#i#l#r#x!aP!a!aP$O$U$l$r$x%O%U%[%bPPPPPPPP%hX^OX`pXUOX`pezabcde{}!P!R!UR!q!dRhUR!XhXVOX`pRkVR!XkXWOX`pRnWR!XnXXOX`pQrXR!XpXYOX`pQ`ORx`Q{aQ}bQ!PcQ!RdQ!UeZ!e{}!P!R!UQ!v!oR!z!vQ!y!pR!|!yQgUR!VgQjVR!YjQmWR![mQpXR!^pQtZR!`tS_O`ToXp",nodeNames:"\u26A0 StartCloseTag StartCloseTag StartCloseTag EndTag SelfClosingEndTag StartTag StartTag StartTag StartTag StartTag StartCloseTag StartCloseTag StartCloseTag IncompleteCloseTag Document Text EntityReference CharacterReference InvalidEntity Element OpenTag TagName Attribute AttributeName Is AttributeValue UnquotedAttributeValue ScriptText CloseTag OpenTag StyleText CloseTag OpenTag TextareaText CloseTag OpenTag CloseTag SelfClosingTag Comment ProcessingInst MismatchedCloseTag CloseTag DoctypeDecl",maxTerm:67,context:hV,nodeProps:[["closedBy",-10,1,2,3,7,8,9,10,11,12,13,"EndTag",6,"EndTag SelfClosingEndTag",-4,21,30,33,36,"CloseTag"],["openedBy",4,"StartTag StartCloseTag",5,"StartTag",-4,29,32,35,37,"OpenTag"],["group",-9,14,17,18,19,20,39,40,41,42,"Entity",16,"Entity TextContent",-3,28,31,34,"TextContent Entity"],["isolate",-11,21,29,30,32,33,35,36,37,38,41,42,"ltr",-3,26,27,39,""]],propSources:[xV],skippedNodes:[0],repeatNodeCount:9,tokenData:"!]tw8twx7Sx!P8t!P!Q5u!Q!]8t!]!^/^!^!a7S!a#S8t#S#T;{#T#s8t#s$f5u$f;'S8t;'S;=`>V<%l?Ah8t?Ah?BY5u?BY?Mn8t?MnO5u!Z5zbkWOX5uXZ7SZ[5u[^7S^p5uqr5urs7Sst+Ptw5uwx7Sx!]5u!]!^7w!^!a7S!a#S5u#S#T7S#T;'S5u;'S;=`8n<%lO5u!R7VVOp7Sqs7St!]7S!]!^7l!^;'S7S;'S;=`7q<%lO7S!R7qOa!R!R7tP;=`<%l7S!Z8OYkWa!ROX+PZ[+P^p+Pqr+Psw+Px!^+P!a#S+P#T;'S+P;'S;=`+t<%lO+P!Z8qP;=`<%l5u!_8{ihSkWOX5uXZ7SZ[5u[^7S^p5uqr8trs7Sst/^tw8twx7Sx!P8t!P!Q5u!Q!]8t!]!^:j!^!a7S!a#S8t#S#T;{#T#s8t#s$f5u$f;'S8t;'S;=`>V<%l?Ah8t?Ah?BY5u?BY?Mn8t?MnO5u!_:sbhSkWa!ROX+PZ[+P^p+Pqr/^sw/^x!P/^!P!Q+P!Q!^/^!a#S/^#S#T0m#T#s/^#s$f+P$f;'S/^;'S;=`1e<%l?Ah/^?Ah?BY+P?BY?Mn/^?MnO+P!VP<%l?Ah;{?Ah?BY7S?BY?Mn;{?MnO7S!V=dXhSa!Rqr0msw0mx!P0m!Q!^0m!a#s0m$f;'S0m;'S;=`1_<%l?Ah0m?BY?Mn0m!V>SP;=`<%l;{!_>YP;=`<%l8t!_>dhhSkWOX@OXZAYZ[@O[^AY^p@OqrBwrsAYswBwwxAYx!PBw!P!Q@O!Q!]Bw!]!^/^!^!aAY!a#SBw#S#TE{#T#sBw#s$f@O$f;'SBw;'S;=`HS<%l?AhBw?Ah?BY@O?BY?MnBw?MnO@O!Z@TakWOX@OXZAYZ[@O[^AY^p@Oqr@OrsAYsw@OwxAYx!]@O!]!^Az!^!aAY!a#S@O#S#TAY#T;'S@O;'S;=`Bq<%lO@O!RA]UOpAYq!]AY!]!^Ao!^;'SAY;'S;=`At<%lOAY!RAtOb!R!RAwP;=`<%lAY!ZBRYkWb!ROX+PZ[+P^p+Pqr+Psw+Px!^+P!a#S+P#T;'S+P;'S;=`+t<%lO+P!ZBtP;=`<%l@O!_COhhSkWOX@OXZAYZ[@O[^AY^p@OqrBwrsAYswBwwxAYx!PBw!P!Q@O!Q!]Bw!]!^Dj!^!aAY!a#SBw#S#TE{#T#sBw#s$f@O$f;'SBw;'S;=`HS<%l?AhBw?Ah?BY@O?BY?MnBw?MnO@O!_DsbhSkWb!ROX+PZ[+P^p+Pqr/^sw/^x!P/^!P!Q+P!Q!^/^!a#S/^#S#T0m#T#s/^#s$f+P$f;'S/^;'S;=`1e<%l?Ah/^?Ah?BY+P?BY?Mn/^?MnO+P!VFQbhSOpAYqrE{rsAYswE{wxAYx!PE{!P!QAY!Q!]E{!]!^GY!^!aAY!a#sE{#s$fAY$f;'SE{;'S;=`G|<%l?AhE{?Ah?BYAY?BY?MnE{?MnOAY!VGaXhSb!Rqr0msw0mx!P0m!Q!^0m!a#s0m$f;'S0m;'S;=`1_<%l?Ah0m?BY?Mn0m!VHPP;=`<%lE{!_HVP;=`<%lBw!ZHcW!bx`P!a`Or(trs'ksv(tw!^(t!^!_)e!_;'S(t;'S;=`*P<%lO(t!aIYlhS`PkW!a`!cpOX$qXZ&XZ[$q[^&X^p$qpq&Xqr-_rs&}sv-_vw/^wx(tx}-_}!OKQ!O!P-_!P!Q$q!Q!^-_!^!_*V!_!a&X!a#S-_#S#T1k#T#s-_#s$f$q$f;'S-_;'S;=`3X<%l?Ah-_?Ah?BY$q?BY?Mn-_?MnO$q!aK_khS`PkW!a`!cpOX$qXZ&XZ[$q[^&X^p$qpq&Xqr-_rs&}sv-_vw/^wx(tx!P-_!P!Q$q!Q!^-_!^!_*V!_!`&X!`!aMS!a#S-_#S#T1k#T#s-_#s$f$q$f;'S-_;'S;=`3X<%l?Ah-_?Ah?BY$q?BY?Mn-_?MnO$q!TM_X`P!a`!cp!eQOr&Xrs&}sv&Xwx(tx!^&X!^!_*V!_;'S&X;'S;=`*y<%lO&X!aNZ!ZhSfQ`PkW!a`!cpOX$qXZ&XZ[$q[^&X^p$qpq&Xqr-_rs&}sv-_vw/^wx(tx}-_}!OMz!O!PMz!P!Q$q!Q![Mz![!]Mz!]!^-_!^!_*V!_!a&X!a!c-_!c!}Mz!}#R-_#R#SMz#S#T1k#T#oMz#o#s-_#s$f$q$f$}-_$}%OMz%O%W-_%W%oMz%o%p-_%p&aMz&a&b-_&b1pMz1p4UMz4U4dMz4d4e-_4e$ISMz$IS$I`-_$I`$IbMz$Ib$Je-_$Je$JgMz$Jg$Kh-_$Kh%#tMz%#t&/x-_&/x&EtMz&Et&FV-_&FV;'SMz;'S;:j!#|;:j;=`3X<%l?&r-_?&r?AhMz?Ah?BY$q?BY?MnMz?MnO$q!a!$PP;=`<%lMz!R!$ZY!a`!cpOq*Vqr!$yrs(Vsv*Vwx)ex!a*V!a!b!4t!b;'S*V;'S;=`*s<%lO*V!R!%Q]!a`!cpOr*Vrs(Vsv*Vwx)ex}*V}!O!%y!O!f*V!f!g!']!g#W*V#W#X!0`#X;'S*V;'S;=`*s<%lO*V!R!&QX!a`!cpOr*Vrs(Vsv*Vwx)ex}*V}!O!&m!O;'S*V;'S;=`*s<%lO*V!R!&vV!a`!cp!dPOr*Vrs(Vsv*Vwx)ex;'S*V;'S;=`*s<%lO*V!R!'dX!a`!cpOr*Vrs(Vsv*Vwx)ex!q*V!q!r!(P!r;'S*V;'S;=`*s<%lO*V!R!(WX!a`!cpOr*Vrs(Vsv*Vwx)ex!e*V!e!f!(s!f;'S*V;'S;=`*s<%lO*V!R!(zX!a`!cpOr*Vrs(Vsv*Vwx)ex!v*V!v!w!)g!w;'S*V;'S;=`*s<%lO*V!R!)nX!a`!cpOr*Vrs(Vsv*Vwx)ex!{*V!{!|!*Z!|;'S*V;'S;=`*s<%lO*V!R!*bX!a`!cpOr*Vrs(Vsv*Vwx)ex!r*V!r!s!*}!s;'S*V;'S;=`*s<%lO*V!R!+UX!a`!cpOr*Vrs(Vsv*Vwx)ex!g*V!g!h!+q!h;'S*V;'S;=`*s<%lO*V!R!+xY!a`!cpOr!+qrs!,hsv!+qvw!-Swx!.[x!`!+q!`!a!/j!a;'S!+q;'S;=`!0Y<%lO!+qq!,mV!cpOv!,hvx!-Sx!`!,h!`!a!-q!a;'S!,h;'S;=`!.U<%lO!,hP!-VTO!`!-S!`!a!-f!a;'S!-S;'S;=`!-k<%lO!-SP!-kO{PP!-nP;=`<%l!-Sq!-xS!cp{POv(Vx;'S(V;'S;=`(h<%lO(Vq!.XP;=`<%l!,ha!.aX!a`Or!.[rs!-Ssv!.[vw!-Sw!`!.[!`!a!.|!a;'S!.[;'S;=`!/d<%lO!.[a!/TT!a`{POr)esv)ew;'S)e;'S;=`)y<%lO)ea!/gP;=`<%l!.[!R!/sV!a`!cp{POr*Vrs(Vsv*Vwx)ex;'S*V;'S;=`*s<%lO*V!R!0]P;=`<%l!+q!R!0gX!a`!cpOr*Vrs(Vsv*Vwx)ex#c*V#c#d!1S#d;'S*V;'S;=`*s<%lO*V!R!1ZX!a`!cpOr*Vrs(Vsv*Vwx)ex#V*V#V#W!1v#W;'S*V;'S;=`*s<%lO*V!R!1}X!a`!cpOr*Vrs(Vsv*Vwx)ex#h*V#h#i!2j#i;'S*V;'S;=`*s<%lO*V!R!2qX!a`!cpOr*Vrs(Vsv*Vwx)ex#m*V#m#n!3^#n;'S*V;'S;=`*s<%lO*V!R!3eX!a`!cpOr*Vrs(Vsv*Vwx)ex#d*V#d#e!4Q#e;'S*V;'S;=`*s<%lO*V!R!4XX!a`!cpOr*Vrs(Vsv*Vwx)ex#X*V#X#Y!+q#Y;'S*V;'S;=`*s<%lO*V!R!4{Y!a`!cpOr!4trs!5ksv!4tvw!6Vwx!8]x!a!4t!a!b!:]!b;'S!4t;'S;=`!;r<%lO!4tq!5pV!cpOv!5kvx!6Vx!a!5k!a!b!7W!b;'S!5k;'S;=`!8V<%lO!5kP!6YTO!a!6V!a!b!6i!b;'S!6V;'S;=`!7Q<%lO!6VP!6lTO!`!6V!`!a!6{!a;'S!6V;'S;=`!7Q<%lO!6VP!7QOxPP!7TP;=`<%l!6Vq!7]V!cpOv!5kvx!6Vx!`!5k!`!a!7r!a;'S!5k;'S;=`!8V<%lO!5kq!7yS!cpxPOv(Vx;'S(V;'S;=`(h<%lO(Vq!8YP;=`<%l!5ka!8bX!a`Or!8]rs!6Vsv!8]vw!6Vw!a!8]!a!b!8}!b;'S!8];'S;=`!:V<%lO!8]a!9SX!a`Or!8]rs!6Vsv!8]vw!6Vw!`!8]!`!a!9o!a;'S!8];'S;=`!:V<%lO!8]a!9vT!a`xPOr)esv)ew;'S)e;'S;=`)y<%lO)ea!:YP;=`<%l!8]!R!:dY!a`!cpOr!4trs!5ksv!4tvw!6Vwx!8]x!`!4t!`!a!;S!a;'S!4t;'S;=`!;r<%lO!4t!R!;]V!a`!cpxPOr*Vrs(Vsv*Vwx)ex;'S*V;'S;=`*s<%lO*V!R!;uP;=`<%l!4t!V!{let c=a.type.id;if(c==KZ)return Ix(a,l,i);if(c==JZ)return Ix(a,l,r);if(c==eV)return Ix(a,l,n);if(c==cQ&&o.length){let u=a.node,f=u.firstChild,d=f&&nQ(f,l),p;if(d){for(let g of o)if(g.tag==d&&(!g.attrs||g.attrs(p||(p=OQ(u,l))))){let x=u.lastChild,w=x.type.id==iV?x.from:u.to;if(w>f.to)return{parser:g.parser,overlay:[{from:f.to,to:w}]}}}}if(s&&c==uQ){let u=a.node,f;if(f=u.firstChild){let d=s[l.read(f.from,f.to)];if(d)for(let p of d){if(p.tagName&&p.tagName!=nQ(u.parent,l))continue;let g=u.lastChild;if(g.type.id==Lx){let x=g.from+1,w=g.lastChild,S=g.to-(w&&w.isError?0:1);if(S>x)return{parser:p.parser,overlay:[{from:x,to:S}]}}else if(g.type.id==fQ)return{parser:p.parser,overlay:[{from:g.from,to:g.to}]}}}}return null})}var vV=99,mQ=1,wV=100,kV=101,gQ=2,bQ=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],SV=58,TV=40,yQ=95,EV=91,eO=45,CV=46,_V=35,PV=37,QV=38,AV=92,$V=10;function Bu(t){return t>=65&&t<=90||t>=97&&t<=122||t>=161}function XV(t){return t>=48&&t<=57}var RV=new et((t,e)=>{for(let i=!1,r=0,n=0;;n++){let{next:o}=t;if(Bu(o)||o==eO||o==yQ||i&&XV(o))!i&&(o!=eO||n>0)&&(i=!0),r===n&&o==eO&&r++,t.advance();else if(o==AV&&t.peek(1)!=$V)t.advance(),t.next>-1&&t.advance(),i=!0;else{i&&t.acceptToken(o==TV?wV:r==2&&e.canShift(gQ)?gQ:kV);break}}}),IV=new et(t=>{if(bQ.includes(t.peek(-1))){let{next:e}=t;(Bu(e)||e==yQ||e==_V||e==CV||e==EV||e==SV&&Bu(t.peek(1))||e==eO||e==QV)&&t.acceptToken(vV)}}),LV=new et(t=>{if(!bQ.includes(t.peek(-1))){let{next:e}=t;if(e==PV&&(t.advance(),t.acceptToken(mQ)),Bu(e)){do t.advance();while(Bu(t.next));t.acceptToken(mQ)}}}),DV=Bt({"AtKeyword import charset namespace keyframes media supports":_.definitionKeyword,"from to selector":_.keyword,NamespaceName:_.namespace,KeyframeName:_.labelName,KeyframeRangeName:_.operatorKeyword,TagName:_.tagName,ClassName:_.className,PseudoClassName:_.constant(_.className),IdName:_.labelName,"FeatureName PropertyName":_.propertyName,AttributeName:_.attributeName,NumberLiteral:_.number,KeywordQuery:_.keyword,UnaryQueryOp:_.operatorKeyword,"CallTag ValueName":_.atom,VariableName:_.variableName,Callee:_.operatorKeyword,Unit:_.unit,"UniversalSelector NestingSelector":_.definitionOperator,MatchOp:_.compareOperator,"ChildOp SiblingOp, LogicOp":_.logicOperator,BinOp:_.arithmeticOperator,Important:_.modifier,Comment:_.blockComment,ColorLiteral:_.color,"ParenthesizedContent StringLiteral":_.string,":":_.punctuation,"PseudoOp #":_.derefOperator,"; ,":_.separator,"( )":_.paren,"[ ]":_.squareBracket,"{ }":_.brace}),NV={__proto__:null,lang:32,"nth-child":32,"nth-last-child":32,"nth-of-type":32,"nth-last-of-type":32,dir:32,"host-context":32,url:60,"url-prefix":60,domain:60,regexp:60,selector:138},MV={__proto__:null,"@import":118,"@media":142,"@charset":146,"@namespace":150,"@keyframes":156,"@supports":168},UV={__proto__:null,not:132,only:132},xQ=vi.deserialize({version:14,states:":^QYQ[OOO#_Q[OOP#fOWOOOOQP'#Cd'#CdOOQP'#Cc'#CcO#kQ[O'#CfO$_QXO'#CaO$fQ[O'#ChO$qQ[O'#DTO$vQ[O'#DWOOQP'#Em'#EmO${QdO'#DgO%jQ[O'#DtO${QdO'#DvO%{Q[O'#DxO&WQ[O'#D{O&`Q[O'#ERO&nQ[O'#ETOOQS'#El'#ElOOQS'#EW'#EWQYQ[OOO&uQXO'#CdO'jQWO'#DcO'oQWO'#EsO'zQ[O'#EsQOQWOOP(UO#tO'#C_POOO)C@[)C@[OOQP'#Cg'#CgOOQP,59Q,59QO#kQ[O,59QO(aQ[O'#E[O({QWO,58{O)TQ[O,59SO$qQ[O,59oO$vQ[O,59rO(aQ[O,59uO(aQ[O,59wO(aQ[O,59xO)`Q[O'#DbOOQS,58{,58{OOQP'#Ck'#CkOOQO'#DR'#DROOQP,59S,59SO)gQWO,59SO)lQWO,59SOOQP'#DV'#DVOOQP,59o,59oOOQO'#DX'#DXO)qQ`O,59rOOQS'#Cp'#CpO${QdO'#CqO)yQvO'#CsO+ZQtO,5:ROOQO'#Cx'#CxO)lQWO'#CwO+oQWO'#CyO+tQ[O'#DOOOQS'#Ep'#EpOOQO'#Dj'#DjO+|Q[O'#DqO,[QWO'#EtO&`Q[O'#DoO,jQWO'#DrOOQO'#Eu'#EuO)OQWO,5:`O,oQpO,5:bOOQS'#Dz'#DzO,wQWO,5:dO,|Q[O,5:dOOQO'#D}'#D}O-UQWO,5:gO-ZQWO,5:mO-cQWO,5:oOOQS-E8U-E8UO${QdO,59}O-kQ[O'#E^O-xQWO,5;_O-xQWO,5;_POOO'#EV'#EVP.TO#tO,58yPOOO,58y,58yOOQP1G.l1G.lO.zQXO,5:vOOQO-E8Y-E8YOOQS1G.g1G.gOOQP1G.n1G.nO)gQWO1G.nO)lQWO1G.nOOQP1G/Z1G/ZO/XQ`O1G/^O/rQXO1G/aO0YQXO1G/cO0pQXO1G/dO1WQWO,59|O1]Q[O'#DSO1dQdO'#CoOOQP1G/^1G/^O${QdO1G/^O1kQpO,59]OOQS,59_,59_O${QdO,59aO1sQWO1G/mOOQS,59c,59cO1xQ!bO,59eOOQS'#DP'#DPOOQS'#EY'#EYO2QQ[O,59jOOQS,59j,59jO2YQWO'#DjO2eQWO,5:VO2jQWO,5:]O&`Q[O,5:XO&`Q[O'#E_O2rQWO,5;`O2}QWO,5:ZO(aQ[O,5:^OOQS1G/z1G/zOOQS1G/|1G/|OOQS1G0O1G0OO3`QWO1G0OO3eQdO'#EOOOQS1G0R1G0ROOQS1G0X1G0XOOQS1G0Z1G0ZO3pQtO1G/iOOQO,5:x,5:xO4WQ[O,5:xOOQO-E8[-E8[O4eQWO1G0yPOOO-E8T-E8TPOOO1G.e1G.eOOQP7+$Y7+$YOOQP7+$x7+$xO${QdO7+$xOOQS1G/h1G/hO4pQXO'#ErO4wQWO,59nO4|QtO'#EXO5tQdO'#EoO6OQWO,59ZO6TQpO7+$xOOQS1G.w1G.wOOQS1G.{1G.{OOQS7+%X7+%XO6]QWO1G/POOQS-E8W-E8WOOQS1G/U1G/UO${QdO1G/qOOQO1G/w1G/wOOQO1G/s1G/sO6bQWO,5:yOOQO-E8]-E8]O6pQXO1G/xOOQS7+%j7+%jO6wQYO'#CsOOQO'#EQ'#EQO7SQ`O'#EPOOQO'#EP'#EPO7_QWO'#E`O7gQdO,5:jOOQS,5:j,5:jO7rQtO'#E]O${QdO'#E]O8sQdO7+%TOOQO7+%T7+%TOOQO1G0d1G0dO9WQpO<OAN>OO:xQdO,5:uOOQO-E8X-E8XOOQO<T![;'S%^;'S;=`%o<%lO%^l;TUo`Oy%^z!Q%^!Q![;g![;'S%^;'S;=`%o<%lO%^l;nYo`#e[Oy%^z!Q%^!Q![;g![!g%^!g!h<^!h#X%^#X#Y<^#Y;'S%^;'S;=`%o<%lO%^l[[o`#e[Oy%^z!O%^!O!P;g!P!Q%^!Q![>T![!g%^!g!h<^!h#X%^#X#Y<^#Y;'S%^;'S;=`%o<%lO%^n?VSt^Oy%^z;'S%^;'S;=`%o<%lO%^l?hWjWOy%^z!O%^!O!P;O!P!Q%^!Q![>T![;'S%^;'S;=`%o<%lO%^n@VU#bQOy%^z!Q%^!Q![;g![;'S%^;'S;=`%o<%lO%^~@nTjWOy%^z{@}{;'S%^;'S;=`%o<%lO%^~AUSo`#[~Oy%^z;'S%^;'S;=`%o<%lO%^lAg[#e[Oy%^z!O%^!O!P;g!P!Q%^!Q![>T![!g%^!g!h<^!h#X%^#X#Y<^#Y;'S%^;'S;=`%o<%lO%^bBbU]QOy%^z![%^![!]Bt!];'S%^;'S;=`%o<%lO%^bB{S^Qo`Oy%^z;'S%^;'S;=`%o<%lO%^nC^S!Y^Oy%^z;'S%^;'S;=`%o<%lO%^dCoS|SOy%^z;'S%^;'S;=`%o<%lO%^bDQU!OQOy%^z!`%^!`!aDd!a;'S%^;'S;=`%o<%lO%^bDkS!OQo`Oy%^z;'S%^;'S;=`%o<%lO%^bDzWOy%^z!c%^!c!}Ed!}#T%^#T#oEd#o;'S%^;'S;=`%o<%lO%^bEk[![Qo`Oy%^z}%^}!OEd!O!Q%^!Q![Ed![!c%^!c!}Ed!}#T%^#T#oEd#o;'S%^;'S;=`%o<%lO%^nFfSq^Oy%^z;'S%^;'S;=`%o<%lO%^nFwSp^Oy%^z;'S%^;'S;=`%o<%lO%^bGWUOy%^z#b%^#b#cGj#c;'S%^;'S;=`%o<%lO%^bGoUo`Oy%^z#W%^#W#XHR#X;'S%^;'S;=`%o<%lO%^bHYS!bQo`Oy%^z;'S%^;'S;=`%o<%lO%^bHiUOy%^z#f%^#f#gHR#g;'S%^;'S;=`%o<%lO%^fIQS!TUOy%^z;'S%^;'S;=`%o<%lO%^nIcS!S^Oy%^z;'S%^;'S;=`%o<%lO%^fItU!RQOy%^z!_%^!_!`6y!`;'S%^;'S;=`%o<%lO%^`JZP;=`<%l$}",tokenizers:[IV,LV,RV,1,2,3,4,new Bo("m~RRYZ[z{a~~g~aO#^~~dP!P!Qg~lO#_~~",28,105)],topRules:{StyleSheet:[0,4],Styles:[1,86]},specialized:[{term:100,get:t=>NV[t]||-1},{term:58,get:t=>MV[t]||-1},{term:101,get:t=>UV[t]||-1}],tokenPrec:1200});var zx=null;function jx(){if(!zx&&typeof document=="object"&&document.body){let{style:t}=document.body,e=[],i=new Set;for(let r in t)r!="cssText"&&r!="cssFloat"&&typeof t[r]=="string"&&(/[A-Z]/.test(r)&&(r=r.replace(/[A-Z]/g,n=>"-"+n.toLowerCase())),i.has(r)||(e.push(r),i.add(r)));zx=e.sort().map(r=>({type:"property",label:r}))}return zx||[]}var vQ=["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(t=>({type:"class",label:t})),wQ=["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(t=>({type:"keyword",label:t})).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(t=>({type:"constant",label:t}))),zV=["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(t=>({type:"type",label:t})),Vo=/^(\w[\w-]*|-\w[\w-]*|)$/,jV=/^-(-[\w-]*)?$/;function qV(t,e){var i;if((t.name=="("||t.type.isError)&&(t=t.parent||t),t.name!="ArgList")return!1;let r=(i=t.parent)===null||i===void 0?void 0:i.firstChild;return(r==null?void 0:r.name)!="Callee"?!1:e.sliceString(r.from,r.to)=="var"}var kQ=new qa,WV=["Declaration"];function BV(t){for(let e=t;;){if(e.type.isTop)return e;if(!(e=e.parent))return t}}function SQ(t,e,i){if(e.to-e.from>4096){let r=kQ.get(e);if(r)return r;let n=[],o=new Set,s=e.cursor(st.IncludeAnonymous);if(s.firstChild())do for(let a of SQ(t,s.node,i))o.has(a.label)||(o.add(a.label),n.push(a));while(s.nextSibling());return kQ.set(e,n),n}else{let r=[],n=new Set;return e.cursor().iterate(o=>{var s;if(i(o)&&o.matchContext(WV)&&((s=o.node.nextSibling)===null||s===void 0?void 0:s.name)==":"){let a=t.sliceString(o.from,o.to);n.has(a)||(n.add(a),r.push({label:a,type:"variable"}))}}),r}}var ZV=t=>e=>{let{state:i,pos:r}=e,n=ze(i).resolveInner(r,-1),o=n.type.isError&&n.from==n.to-1&&i.doc.sliceString(n.from,n.to)=="-";if(n.name=="PropertyName"||(o||n.name=="TagName")&&/^(Block|Styles)$/.test(n.resolve(n.to).name))return{from:n.from,options:jx(),validFor:Vo};if(n.name=="ValueName")return{from:n.from,options:wQ,validFor:Vo};if(n.name=="PseudoClassName")return{from:n.from,options:vQ,validFor:Vo};if(t(n)||(e.explicit||o)&&qV(n,i.doc))return{from:t(n)||o?n.from:r,options:SQ(i.doc,BV(n),t),validFor:jV};if(n.name=="TagName"){for(let{parent:l}=n;l;l=l.parent)if(l.name=="Block")return{from:n.from,options:jx(),validFor:Vo};return{from:n.from,options:zV,validFor:Vo}}if(!e.explicit)return null;let s=n.resolve(r),a=s.childBefore(r);return a&&a.name==":"&&s.name=="PseudoClassSelector"?{from:r,options:vQ,validFor:Vo}:a&&a.name==":"&&s.name=="Declaration"||s.name=="ArgList"?{from:r,options:wQ,validFor:Vo}:s.name=="Block"||s.name=="Styles"?{from:r,options:jx(),validFor:Vo}:null},VV=ZV(t=>t.name=="VariableName"),Zu=yi.define({name:"css",parser:xQ.configure({props:[ai.add({Declaration:xi()}),Ht.add({"Block KeyframeList":jo})]}),languageData:{commentTokens:{block:{open:"/*",close:"*/"}},indentOnInput:/^\s*\}$/,wordChars:"-"}});function tO(){return new At(Zu,Zu.data.of({autocomplete:VV}))}var YV=309,TQ=1,FV=2,HV=3,GV=310,KV=312,JV=313,eY=4,tY=5,iY=0,Wx=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],EQ=125,rY=59,Bx=47,nY=42,oY=43,sY=45,aY=60,lY=44,cY=new Zo({start:!1,shift(t,e){return e==eY||e==tY||e==KV?t:e==JV},strict:!1}),uY=new et((t,e)=>{let{next:i}=t;(i==EQ||i==-1||e.context)&&t.acceptToken(GV)},{contextual:!0,fallback:!0}),fY=new et((t,e)=>{let{next:i}=t,r;Wx.indexOf(i)>-1||i==Bx&&((r=t.peek(1))==Bx||r==nY)||i!=EQ&&i!=rY&&i!=-1&&!e.context&&t.acceptToken(YV)},{contextual:!0}),hY=new et((t,e)=>{let{next:i}=t;if((i==oY||i==sY)&&(t.advance(),i==t.next)){t.advance();let r=!e.context&&e.canShift(TQ);t.acceptToken(r?TQ:FV)}},{contextual:!0});function qx(t,e){return t>=65&&t<=90||t>=97&&t<=122||t==95||t>=192||!e&&t>=48&&t<=57}var dY=new et((t,e)=>{if(t.next!=aY||!e.dialectEnabled(iY)||(t.advance(),t.next==Bx))return;let i=0;for(;Wx.indexOf(t.next)>-1;)t.advance(),i++;if(qx(t.next,!0)){for(t.advance(),i++;qx(t.next,!1);)t.advance(),i++;for(;Wx.indexOf(t.next)>-1;)t.advance(),i++;if(t.next==lY)return;for(let r=0;;r++){if(r==7){if(!qx(t.next,!0))return;break}if(t.next!="extends".charCodeAt(r))break;t.advance(),i++}}t.acceptToken(HV,-i)}),pY=Bt({"get set async static":_.modifier,"for while do if else switch try catch finally return throw break continue default case":_.controlKeyword,"in of await yield void typeof delete instanceof":_.operatorKeyword,"let var const using function class extends":_.definitionKeyword,"import export from":_.moduleKeyword,"with debugger as new":_.keyword,TemplateString:_.special(_.string),super:_.atom,BooleanLiteral:_.bool,this:_.self,null:_.null,Star:_.modifier,VariableName:_.variableName,"CallExpression/VariableName TaggedTemplateExpression/VariableName":_.function(_.variableName),VariableDefinition:_.definition(_.variableName),Label:_.labelName,PropertyName:_.propertyName,PrivatePropertyName:_.special(_.propertyName),"CallExpression/MemberExpression/PropertyName":_.function(_.propertyName),"FunctionDeclaration/VariableDefinition":_.function(_.definition(_.variableName)),"ClassDeclaration/VariableDefinition":_.definition(_.className),PropertyDefinition:_.definition(_.propertyName),PrivatePropertyDefinition:_.definition(_.special(_.propertyName)),UpdateOp:_.updateOperator,"LineComment Hashbang":_.lineComment,BlockComment:_.blockComment,Number:_.number,String:_.string,Escape:_.escape,ArithOp:_.arithmeticOperator,LogicOp:_.logicOperator,BitOp:_.bitwiseOperator,CompareOp:_.compareOperator,RegExp:_.regexp,Equals:_.definitionOperator,Arrow:_.function(_.punctuation),": Spread":_.punctuation,"( )":_.paren,"[ ]":_.squareBracket,"{ }":_.brace,"InterpolationStart InterpolationEnd":_.special(_.brace),".":_.derefOperator,", ;":_.separator,"@":_.meta,TypeName:_.typeName,TypeDefinition:_.definition(_.typeName),"type enum interface implements namespace module declare":_.definitionKeyword,"abstract global Privacy readonly override":_.modifier,"is keyof unique infer":_.operatorKeyword,JSXAttributeValue:_.attributeValue,JSXText:_.content,"JSXStartTag JSXStartCloseTag JSXSelfCloseEndTag JSXEndTag":_.angleBracket,"JSXIdentifier JSXNameSpacedName":_.tagName,"JSXAttribute/JSXIdentifier JSXAttribute/JSXNameSpacedName":_.attributeName,"JSXBuiltin/JSXIdentifier":_.standard(_.tagName)}),OY={__proto__:null,export:18,as:23,from:31,default:34,async:39,function:40,extends:52,this:56,true:64,false:64,null:76,void:80,typeof:84,super:102,new:136,delete:152,yield:161,await:165,class:170,public:227,private:227,protected:227,readonly:229,instanceof:248,satisfies:251,in:252,const:254,import:286,keyof:339,unique:343,infer:349,is:385,abstract:405,implements:407,type:409,let:412,var:414,using:417,interface:423,enum:427,namespace:433,module:435,declare:439,global:443,for:462,of:471,while:474,with:478,do:482,if:486,else:488,switch:492,case:498,try:504,catch:508,finally:512,return:516,throw:520,break:524,continue:528,debugger:532},mY={__proto__:null,async:123,get:125,set:127,declare:187,public:189,private:189,protected:189,static:191,abstract:193,override:195,readonly:201,accessor:203,new:389},gY={__proto__:null,"<":143},CQ=vi.deserialize({version:14,states:"$RQWO'#CdO>cQWO'#H[O>kQWO'#HbO>kQWO'#HdO`Q^O'#HfO>kQWO'#HhO>kQWO'#HkO>pQWO'#HqO>uQ07iO'#HwO%[Q^O'#HyO?QQ07iO'#H{O?]Q07iO'#H}O9kQ07hO'#IPO?hQ08SO'#ChO@jQ`O'#DiQOQWOOO%[Q^O'#EPOAQQWO'#ESO:RQ7[O'#EjOA]QWO'#EjOAhQpO'#FbOOQU'#Cf'#CfOOQ07`'#Dn'#DnOOQ07`'#Jm'#JmO%[Q^O'#JmOOQO'#Jq'#JqOOQO'#Ib'#IbOBhQ`O'#EcOOQ07`'#Eb'#EbOCdQ07pO'#EcOCnQ`O'#EVOOQO'#Jp'#JpODSQ`O'#JqOEaQ`O'#EVOCnQ`O'#EcPEnO!0LbO'#CaPOOO)CDu)CDuOOOO'#IX'#IXOEyO!bO,59TOOQ07b,59T,59TOOOO'#IY'#IYOFXO#tO,59TO%[Q^O'#D`OOOO'#I['#I[OFgO?MpO,59xOOQ07b,59x,59xOFuQ^O'#I]OGYQWO'#JkOI[QrO'#JkO+}Q^O'#JkOIcQWO,5:OOIyQWO'#ElOJWQWO'#JyOJcQWO'#JxOJcQWO'#JxOJkQWO,5;YOJpQWO'#JwOOQ07f,5:Z,5:ZOJwQ^O,5:ZOLxQ08SO,5:eOMiQWO,5:mONSQ07hO'#JvONZQWO'#JuO9ZQWO'#JuONoQWO'#JuONwQWO,5;XON|QWO'#JuO!#UQrO'#JjOOQ07b'#Ch'#ChO%[Q^O'#ERO!#tQpO,5:rOOQO'#Jr'#JrOOQO-EmOOQU'#J`'#J`OOQU,5>n,5>nOOQU-EpQWO'#HQO9aQWO'#HSO!CgQWO'#HSO:RQ7[O'#HUO!ClQWO'#HUOOQU,5=j,5=jO!CqQWO'#HVO!DSQWO'#CnO!DXQWO,59OO!DcQWO,59OO!FhQ^O,59OOOQU,59O,59OO!FxQ07hO,59OO%[Q^O,59OO!ITQ^O'#H^OOQU'#H_'#H_OOQU'#H`'#H`O`Q^O,5=vO!IkQWO,5=vO`Q^O,5=|O`Q^O,5>OO!IpQWO,5>QO`Q^O,5>SO!IuQWO,5>VO!IzQ^O,5>]OOQU,5>c,5>cO%[Q^O,5>cO9kQ07hO,5>eOOQU,5>g,5>gO!NUQWO,5>gOOQU,5>i,5>iO!NUQWO,5>iOOQU,5>k,5>kO!NZQ`O'#D[O%[Q^O'#JmO!NxQ`O'#JmO# gQ`O'#DjO# xQ`O'#DjO#$ZQ^O'#DjO#$bQWO'#JlO#$jQWO,5:TO#$oQWO'#EpO#$}QWO'#JzO#%VQWO,5;ZO#%[Q`O'#DjO#%iQ`O'#EUOOQ07b,5:n,5:nO%[Q^O,5:nO#%pQWO,5:nO>pQWO,5;UO!@}Q`O,5;UO!AVQ7[O,5;UO:RQ7[O,5;UO#%xQWO,5@XO#%}Q$ISO,5:rOOQO-E<`-E<`O#'TQ07pO,5:}OCnQ`O,5:qO#'_Q`O,5:qOCnQ`O,5:}O!@rQ07hO,5:qOOQ07`'#Ef'#EfOOQO,5:},5:}O%[Q^O,5:}O#'lQ07hO,5:}O#'wQ07hO,5:}O!@}Q`O,5:qOOQO,5;T,5;TO#(VQ07hO,5:}POOO'#IV'#IVP#(kO!0LbO,58{POOO,58{,58{OOOO-EwO+}Q^O,5>wOOQO,5>},5>}O#)VQ^O'#I]OOQO-EpQ08SO1G0{O#>wQ08SO1G0{O#@oQ08SO1G0{O#CoQ(CYO'#ChO#EmQ(CYO1G1^O#EtQ(CYO'#JjO!,lQWO1G1dO#FUQ08SO,5?TOOQ07`-EkQWO1G3lO$2^Q^O1G3nO$6bQ^O'#HmOOQU1G3q1G3qO$6oQWO'#HsO>pQWO'#HuOOQU1G3w1G3wO$6wQ^O1G3wO9kQ07hO1G3}OOQU1G4P1G4POOQ07`'#GY'#GYO9kQ07hO1G4RO9kQ07hO1G4TO$;OQWO,5@XO!*fQ^O,5;[O9ZQWO,5;[O>pQWO,5:UO!*fQ^O,5:UO!@}Q`O,5:UO$;TQ(CYO,5:UOOQO,5;[,5;[O$;_Q`O'#I^O$;uQWO,5@WOOQ07b1G/o1G/oO$;}Q`O'#IdO$pQWO1G0pO!@}Q`O1G0pO!AVQ7[O1G0pOOQ07`1G5s1G5sO!@rQ07hO1G0]OOQO1G0i1G0iO%[Q^O1G0iO$wO$>TQWO1G5qO$>]QWO1G6OO$>eQrO1G6PO9ZQWO,5>}O$>oQ08SO1G5|O%[Q^O1G5|O$?PQ07hO1G5|O$?bQWO1G5{O$?bQWO1G5{O9ZQWO1G5{O$?jQWO,5?QO9ZQWO,5?QOOQO,5?Q,5?QO$@OQWO,5?QO$'TQWO,5?QOOQO-EXOOQU,5>X,5>XO%[Q^O'#HnO%7^QWO'#HpOOQU,5>_,5>_O9ZQWO,5>_OOQU,5>a,5>aOOQU7+)c7+)cOOQU7+)i7+)iOOQU7+)m7+)mOOQU7+)o7+)oO%7cQ`O1G5sO%7wQ(CYO1G0vO%8RQWO1G0vOOQO1G/p1G/pO%8^Q(CYO1G/pO>pQWO1G/pO!*fQ^O'#DjOOQO,5>x,5>xOOQO-E<[-E<[OOQO,5?O,5?OOOQO-EpQWO7+&[O!@}Q`O7+&[OOQO7+%w7+%wO$=gQ08SO7+&TOOQO7+&T7+&TO%[Q^O7+&TO%8hQ07hO7+&TO!@rQ07hO7+%wO!@}Q`O7+%wO%8sQ07hO7+&TO%9RQ08SO7++hO%[Q^O7++hO%9cQWO7++gO%9cQWO7++gOOQO1G4l1G4lO9ZQWO1G4lO%9kQWO1G4lOOQO7+%|7+%|O#%sQWO<tQ08SO1G2ZO%AVQ08SO1G2mO%CbQ08SO1G2oO%EmQ7[O,5>yOOQO-E<]-E<]O%EwQrO,5>zO%[Q^O,5>zOOQO-E<^-E<^O%FRQWO1G5uOOQ07b<YOOQU,5>[,5>[O&5cQWO1G3yO9ZQWO7+&bO!*fQ^O7+&bOOQO7+%[7+%[O&5hQ(CYO1G6PO>pQWO7+%[OOQ07b<pQWO<pQWO7+)eO'&gQWO<}AN>}O%[Q^OAN?ZOOQO<eQ(CYOG26}O!*fQ^O'#DyO1PQWO'#EWO'@ZQrO'#JiO!*fQ^O'#DqO'@bQ^O'#D}O'@iQrO'#ChO'CPQrO'#ChO!*fQ^O'#EPO'CaQ^O,5;VO!*fQ^O,5;aO!*fQ^O,5;aO!*fQ^O,5;aO!*fQ^O,5;aO!*fQ^O,5;aO!*fQ^O,5;aO!*fQ^O,5;aO!*fQ^O,5;aO!*fQ^O,5;aO!*fQ^O,5;aO!*fQ^O,5;aO!*fQ^O'#IiO'EdQWO,5a#@O#@^#@d#Ax#BW#Cr#DQ#DW#D^#Dd#Dn#Dt#Dz#EU#Eh#EnPPPPPPPPPP#EtPPPPPPP#Fi#Ip#KP#KW#K`PPPP$!d$%Z$+r$+u$+x$,q$,t$,w$-O$-WPP$-^$-b$.Y$/X$/]$/qPP$/u$/{$0PP$0S$0W$0Z$1P$1h$2P$2T$2W$2Z$2a$2d$2h$2lR!{RoqOXst!Z#c%j&m&o&p&r,h,m1w1zY!uQ'Z-Y1[5]Q%pvQ%xyQ&P|Q&e!VS'R!e-QQ'a!iS'g!r!xS*c$|*hQ+f%yQ+s&RQ,X&_Q-W'YQ-b'bQ-j'hQ/|*jQ1f,YR;Y:g%OdOPWXYZstuvw!Z!`!g!o#R#V#Y#c#n#t#x#{$O$P$Q$R$S$T$U$V$W$X$Y$a$e%j%p%}&f&i&m&o&p&r&v'O']'m'}(P(V(^(r(v(z)y+O+S,e,h,m-^-f-t-z.l.s0[0a0q1_1o1p1r1t1w1z1|2m2s3Z5Y5d5t5u5x6]7w7|8]8gS#p]:d!r)[$[$m'S)n,y,|.{2]3p5W6S9W9i:c:f:g:j:k:l:m:n:o:p:q:r:s:t:u:v:w:{;Y;Z;[;^;e;f;o;p<]Q*u%ZQ+k%{Q,Z&bQ,b&jQ.c;QQ0h+^Q0l+`Q0w+lQ1n,`Q2{.[Q4v0rQ5k1gQ6i3PQ6u;RQ7h4wR8m6j&|kOPWXYZstuvw!Z!`!g!o#R#V#Y#c#n#t#x#{$O$P$Q$R$S$T$U$V$W$X$Y$[$a$e$m%j%p%}&f&i&j&m&o&p&r&v'O'S']'m'}(P(V(^(r(v(z)n)y+O+S+^,e,h,m,y,|-^-f-t-z.[.l.s.{0[0a0q1_1o1p1r1t1w1z1|2]2m2s3P3Z3p5W5Y5d5t5u5x6S6]6j7w7|8]8g9W9i:c:f:g:j:k:l:m:n:o:p:q:r:s:t:u:v:w:{;Y;Z;[;^;e;f;o;p<]t!nQ!r!u!x!y'R'Y'Z'g'h'i-Q-W-Y-j1[5]5_$v$si#u#w$c$d$x${%O%Q%[%]%a)u){)}*P*R*Y*`*p*q+]+`+w+z.Z.i/Z/j/k/m0Q0S0^1R1U1^3O3x4S4[4f4n4p5c6g7T7^7y8j8w9[9n:O:W:y:z:|:};O;P;S;T;U;V;W;X;_;`;a;b;c;d;g;h;i;j;k;l;m;n;q;r < TypeParamList TypeDefinition extends ThisType this LiteralType ArithOp Number BooleanLiteral TemplateType InterpolationEnd Interpolation InterpolationStart NullType null VoidType void TypeofType typeof MemberExpression . ?. PropertyName [ TemplateString Escape Interpolation super RegExp ] ArrayExpression Spread , } { ObjectExpression Property async get set PropertyDefinition Block : NewExpression new TypeArgList CompareOp < ) ( ArgList UnaryExpression delete LogicOp BitOp YieldExpression yield AwaitExpression await ParenthesizedExpression ClassExpression class ClassBody MethodDeclaration Decorator @ MemberExpression PrivatePropertyName CallExpression declare Privacy static abstract override PrivatePropertyDefinition PropertyDeclaration readonly accessor Optional TypeAnnotation Equals StaticBlock FunctionExpression ArrowFunction ParamList ParamList ArrayPattern ObjectPattern PatternProperty Privacy readonly Arrow MemberExpression BinaryExpression ArithOp ArithOp ArithOp ArithOp BitOp CompareOp instanceof satisfies in const CompareOp BitOp BitOp BitOp LogicOp LogicOp ConditionalExpression LogicOp LogicOp AssignmentExpression UpdateOp PostfixExpression CallExpression TaggedTemplateExpression DynamicImport import ImportMeta JSXElement JSXSelfCloseEndTag JSXSelfClosingTag JSXIdentifier JSXBuiltin JSXIdentifier JSXNamespacedName JSXMemberExpression JSXSpreadAttribute JSXAttribute JSXAttributeValue JSXEscape JSXEndTag JSXOpenTag JSXFragmentTag JSXText JSXEscape JSXStartCloseTag JSXCloseTag PrefixCast ArrowFunction TypeParamList SequenceExpression KeyofType keyof UniqueType unique ImportType InferredType infer TypeName ParenthesizedType FunctionSignature ParamList NewSignature IndexedType TupleType Label ArrayType ReadonlyType ObjectType MethodType PropertyType IndexSignature PropertyDefinition CallSignature TypePredicate is NewSignature new UnionType LogicOp IntersectionType LogicOp ConditionalType ParameterizedType ClassDeclaration abstract implements type VariableDeclaration let var using TypeAliasDeclaration InterfaceDeclaration interface EnumDeclaration enum EnumBody NamespaceDeclaration namespace module AmbientDeclaration declare GlobalDeclaration global ClassDeclaration ClassBody AmbientFunctionDeclaration ExportGroup VariableName VariableName ImportDeclaration ImportGroup ForStatement for ForSpec ForInSpec ForOfSpec of WhileStatement while WithStatement with DoStatement do IfStatement if else SwitchStatement switch SwitchBody CaseLabel case DefaultLabel TryStatement try CatchClause catch FinallyClause finally ReturnStatement return ThrowStatement throw BreakStatement break ContinueStatement continue DebuggerStatement debugger LabeledStatement ExpressionStatement SingleExpression SingleClassItem",maxTerm:371,context:cY,nodeProps:[["isolate",-8,4,5,13,33,35,48,50,52,""],["group",-26,8,16,18,65,201,205,209,210,212,215,218,228,230,236,238,240,242,245,251,257,259,261,263,265,267,268,"Statement",-32,12,13,28,31,32,38,48,51,52,54,59,67,75,79,81,83,84,106,107,116,117,134,137,139,140,141,142,144,145,164,165,167,"Expression",-23,27,29,33,37,39,41,168,170,172,173,175,176,177,179,180,181,183,184,185,195,197,199,200,"Type",-3,87,99,105,"ClassItem"],["openedBy",22,"<",34,"InterpolationStart",53,"[",57,"{",72,"(",157,"JSXStartCloseTag"],["closedBy",23,">",36,"InterpolationEnd",47,"]",58,"}",73,")",162,"JSXEndTag"]],propSources:[pY],skippedNodes:[0,4,5,271],repeatNodeCount:37,tokenData:"$Fj(CSR!bOX%ZXY+gYZ-yZ[+g[]%Z]^.c^p%Zpq+gqr/mrs3cst:_tuEruvJSvwLkwx! Yxy!'iyz!(sz{!)}{|!,q|}!.O}!O!,q!O!P!/Y!P!Q!9j!Q!R#8g!R![#:v![!]#Gv!]!^#IS!^!_#J^!_!`#Ns!`!a$#_!a!b$(l!b!c$,k!c!}Er!}#O$-u#O#P$/P#P#Q$4h#Q#R$5r#R#SEr#S#T$7P#T#o$8Z#o#p$q#r#s$?}#s$f%Z$f$g+g$g#BYEr#BY#BZ$AX#BZ$ISEr$IS$I_$AX$I_$I|Er$I|$I}$Dd$I}$JO$Dd$JO$JTEr$JT$JU$AX$JU$KVEr$KV$KW$AX$KW&FUEr&FU&FV$AX&FV;'SEr;'S;=`I|<%l?HTEr?HT?HU$AX?HUOEr(n%d_$f&j(Op(R!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z&j&hT$f&jO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c&j&zP;=`<%l&c'|'U]$f&j(R!bOY&}YZ&cZw&}wx&cx!^&}!^!_'}!_#O&}#O#P&c#P#o&}#o#p'}#p;'S&};'S;=`(l<%lO&}!b(SU(R!bOY'}Zw'}x#O'}#P;'S'};'S;=`(f<%lO'}!b(iP;=`<%l'}'|(oP;=`<%l&}'[(y]$f&j(OpOY(rYZ&cZr(rrs&cs!^(r!^!_)r!_#O(r#O#P&c#P#o(r#o#p)r#p;'S(r;'S;=`*a<%lO(rp)wU(OpOY)rZr)rs#O)r#P;'S)r;'S;=`*Z<%lO)rp*^P;=`<%l)r'[*dP;=`<%l(r#S*nX(Op(R!bOY*gZr*grs'}sw*gwx)rx#O*g#P;'S*g;'S;=`+Z<%lO*g#S+^P;=`<%l*g(n+dP;=`<%l%Z(CS+rq$f&j(Op(R!b't(;dOX%ZXY+gYZ&cZ[+g[p%Zpq+gqr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p$f%Z$f$g+g$g#BY%Z#BY#BZ+g#BZ$IS%Z$IS$I_+g$I_$JT%Z$JT$JU+g$JU$KV%Z$KV$KW+g$KW&FU%Z&FU&FV+g&FV;'S%Z;'S;=`+a<%l?HT%Z?HT?HU+g?HUO%Z(CS.ST(P#S$f&j'u(;dO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c(CS.n_$f&j(Op(R!b'u(;dOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z%#`/x`$f&j!o$Ip(Op(R!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_!`0z!`#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z%#S1V`#t$Id$f&j(Op(R!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_!`2X!`#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z%#S2d_#t$Id$f&j(Op(R!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z$/|3l_'}$(n$f&j(R!bOY4kYZ5qZr4krs7nsw4kwx5qx!^4k!^!_8p!_#O4k#O#P5q#P#o4k#o#p8p#p;'S4k;'S;=`:X<%lO4k(^4r_$f&j(R!bOY4kYZ5qZr4krs7nsw4kwx5qx!^4k!^!_8p!_#O4k#O#P5q#P#o4k#o#p8p#p;'S4k;'S;=`:X<%lO4k&z5vX$f&jOr5qrs6cs!^5q!^!_6y!_#o5q#o#p6y#p;'S5q;'S;=`7h<%lO5q&z6jT$a`$f&jO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c`6|TOr6yrs7]s;'S6y;'S;=`7b<%lO6y`7bO$a``7eP;=`<%l6y&z7kP;=`<%l5q(^7w]$a`$f&j(R!bOY&}YZ&cZw&}wx&cx!^&}!^!_'}!_#O&}#O#P&c#P#o&}#o#p'}#p;'S&};'S;=`(l<%lO&}!r8uZ(R!bOY8pYZ6yZr8prs9hsw8pwx6yx#O8p#O#P6y#P;'S8p;'S;=`:R<%lO8p!r9oU$a`(R!bOY'}Zw'}x#O'}#P;'S'};'S;=`(f<%lO'}!r:UP;=`<%l8p(^:[P;=`<%l4k#%|:hh$f&j(Op(R!bOY%ZYZ&cZq%Zqr`#P#o`x!^=^!^!_?q!_#O=^#O#P>`#P#o=^#o#p?q#p;'S=^;'S;=`@h<%lO=^&n>gXVS$f&jOY>`YZ&cZ!^>`!^!_?S!_#o>`#o#p?S#p;'S>`;'S;=`?k<%lO>`S?XSVSOY?SZ;'S?S;'S;=`?e<%lO?SS?hP;=`<%l?S&n?nP;=`<%l>`!f?xWVS(R!bOY?qZw?qwx?Sx#O?q#O#P?S#P;'S?q;'S;=`@b<%lO?q!f@eP;=`<%l?q(Q@kP;=`<%l=^'`@w]VS$f&j(OpOY@nYZ&cZr@nrs>`s!^@n!^!_Ap!_#O@n#O#P>`#P#o@n#o#pAp#p;'S@n;'S;=`Bg<%lO@ntAwWVS(OpOYApZrAprs?Ss#OAp#O#P?S#P;'SAp;'S;=`Ba<%lOAptBdP;=`<%lAp'`BjP;=`<%l@n#WBvYVS(Op(R!bOYBmZrBmrs?qswBmwxApx#OBm#O#P?S#P;'SBm;'S;=`Cf<%lOBm#WCiP;=`<%lBm(rCoP;=`<%lQ^$f&j!USOY!=yYZ&cZ!P!=y!P!Q!>|!Q!^!=y!^!_!@Y!_!}!=y!}#O!Bw#O#P!Dj#P#o!=y#o#p!@Y#p;'S!=y;'S;=`!E[<%lO!=y&n!?Ta$f&j!USO!^&c!_#Z&c#Z#[!>|#[#]&c#]#^!>|#^#a&c#a#b!>|#b#g&c#g#h!>|#h#i&c#i#j!>|#j#m&c#m#n!>|#n#o&c#p;'S&c;'S;=`&w<%lO&cS!@_X!USOY!@YZ!P!@Y!P!Q!@z!Q!}!@Y!}#O!Ac#O#P!Bb#P;'S!@Y;'S;=`!Bq<%lO!@YS!APU!US#Z#[!@z#]#^!@z#a#b!@z#g#h!@z#i#j!@z#m#n!@zS!AfVOY!AcZ#O!Ac#O#P!A{#P#Q!@Y#Q;'S!Ac;'S;=`!B[<%lO!AcS!BOSOY!AcZ;'S!Ac;'S;=`!B[<%lO!AcS!B_P;=`<%l!AcS!BeSOY!@YZ;'S!@Y;'S;=`!Bq<%lO!@YS!BtP;=`<%l!@Y&n!B|[$f&jOY!BwYZ&cZ!^!Bw!^!_!Ac!_#O!Bw#O#P!Cr#P#Q!=y#Q#o!Bw#o#p!Ac#p;'S!Bw;'S;=`!Dd<%lO!Bw&n!CwX$f&jOY!BwYZ&cZ!^!Bw!^!_!Ac!_#o!Bw#o#p!Ac#p;'S!Bw;'S;=`!Dd<%lO!Bw&n!DgP;=`<%l!Bw&n!DoX$f&jOY!=yYZ&cZ!^!=y!^!_!@Y!_#o!=y#o#p!@Y#p;'S!=y;'S;=`!E[<%lO!=y&n!E_P;=`<%l!=y(Q!Eki$f&j(R!b!USOY&}YZ&cZw&}wx&cx!^&}!^!_'}!_#O&}#O#P&c#P#Z&}#Z#[!Eb#[#]&}#]#^!Eb#^#a&}#a#b!Eb#b#g&}#g#h!Eb#h#i&}#i#j!Eb#j#m&}#m#n!Eb#n#o&}#o#p'}#p;'S&};'S;=`(l<%lO&}!f!GaZ(R!b!USOY!GYZw!GYwx!@Yx!P!GY!P!Q!HS!Q!}!GY!}#O!Ic#O#P!Bb#P;'S!GY;'S;=`!JZ<%lO!GY!f!HZb(R!b!USOY'}Zw'}x#O'}#P#Z'}#Z#[!HS#[#]'}#]#^!HS#^#a'}#a#b!HS#b#g'}#g#h!HS#h#i'}#i#j!HS#j#m'}#m#n!HS#n;'S'};'S;=`(f<%lO'}!f!IhX(R!bOY!IcZw!Icwx!Acx#O!Ic#O#P!A{#P#Q!GY#Q;'S!Ic;'S;=`!JT<%lO!Ic!f!JWP;=`<%l!Ic!f!J^P;=`<%l!GY(Q!Jh^$f&j(R!bOY!JaYZ&cZw!Jawx!Bwx!^!Ja!^!_!Ic!_#O!Ja#O#P!Cr#P#Q!Q#V#X%Z#X#Y!4|#Y#b%Z#b#c#Zd$f&j(Op(R!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q!R#?i!R!S#?i!S!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S#?i#S#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z$/l#?tf$f&j(Op(R!bo$'|OY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q!R#?i!R!S#?i!S!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S#?i#S#b%Z#b#c#OY[t]||-1},{term:334,get:t=>mY[t]||-1},{term:70,get:t=>gY[t]||-1}],tokenPrec:14626});var AQ=[ci("function ${name}(${params}) {\n ${}\n}",{label:"function",detail:"definition",type:"keyword"}),ci("for (let ${index} = 0; ${index} < ${bound}; ${index}++) {\n ${}\n}",{label:"for",detail:"loop",type:"keyword"}),ci("for (let ${name} of ${collection}) {\n ${}\n}",{label:"for",detail:"of loop",type:"keyword"}),ci("do {\n ${}\n} while (${})",{label:"do",detail:"loop",type:"keyword"}),ci("while (${}) {\n ${}\n}",{label:"while",detail:"loop",type:"keyword"}),ci(`try { \${} } catch (\${error}) { \${} @@ -84,22 +84,22 @@ removing illegal node: "${(r.outerHTML||r.nodeValue).trim()}" }`,{label:"class",detail:"definition",type:"keyword"}),ci('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),ci('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],bY=AQ.concat([ci("interface ${name} {\n ${}\n}",{label:"interface",detail:"definition",type:"keyword"}),ci("type ${name} = ${type}",{label:"type",detail:"definition",type:"keyword"}),ci("enum ${name} {\n ${}\n}",{label:"enum",detail:"definition",type:"keyword"})]),_Q=new qa,$Q=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function Vu(t){return(e,i)=>{let r=e.node.getChild("VariableDefinition");return r&&i(r,t),!0}}var yY=["FunctionDeclaration"],xY={FunctionDeclaration:Vu("function"),ClassDeclaration:Vu("class"),ClassExpression:()=>!0,EnumDeclaration:Vu("constant"),TypeAliasDeclaration:Vu("type"),NamespaceDeclaration:Vu("namespace"),VariableDefinition(t,e){t.matchContext(yY)||e(t,"variable")},TypeDefinition(t,e){e(t,"type")},__proto__:null};function XQ(t,e){let i=_Q.get(e);if(i)return i;let r=[],n=!0;function o(s,a){let l=t.sliceString(s.from,s.to);r.push({label:l,type:a})}return e.cursor(st.IncludeAnonymous).iterate(s=>{if(n)n=!1;else if(s.name){let a=xY[s.name];if(a&&a(s,o)||$Q.has(s.name))return!1}else if(s.to-s.from>8192){for(let a of XQ(t,s.node))r.push(a);return!1}}),_Q.set(e,r),r}var PQ=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,RQ=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName",".","?."];function vY(t){let e=ze(t.state).resolveInner(t.pos,-1);if(RQ.indexOf(e.name)>-1)return null;let i=e.name=="VariableName"||e.to-e.from<20&&PQ.test(t.state.sliceDoc(e.from,e.to));if(!i&&!t.explicit)return null;let r=[];for(let n=e;n;n=n.parent)$Q.has(n.name)&&(r=r.concat(XQ(t.state.doc,n)));return{options:r,from:i?e.from:t.pos,validFor:PQ}}var Mr=yi.define({name:"javascript",parser:CQ.configure({props:[ai.add({IfStatement:xi({except:/^\s*({|else\b)/}),TryStatement:xi({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:Ip,SwitchBody:t=>{let e=t.textAfter,i=/^\s*\}/.test(e),r=/^\s*(case|default)\b/.test(e);return t.baseIndent+(i?0:r?1:2)*t.unit},Block:hn({closing:"}"}),ArrowFunction:t=>t.baseIndent+t.unit,"TemplateString BlockComment":()=>null,"Statement Property":xi({except:/^{/}),JSXElement(t){let e=/^\s*<\//.test(t.textAfter);return t.lineIndent(t.node.from)+(e?0:t.unit)},JSXEscape(t){let e=/\s*\}/.test(t.textAfter);return t.lineIndent(t.node.from)+(e?0:t.unit)},"JSXOpenTag JSXSelfClosingTag"(t){return t.column(t.node.from)+t.unit}}),Ht.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":jo,BlockComment(t){return{from:t.from+2,to:t.to-2}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),IQ={test:t=>/^JSX/.test(t.name),facet:al({commentTokens:{block:{open:"{/*",close:"*/}"}}})},Zx=Mr.configure({dialect:"ts"},"typescript"),Vx=Mr.configure({dialect:"jsx",props:[Rp.add(t=>t.isTop?[IQ]:void 0)]}),Yx=Mr.configure({dialect:"jsx ts",props:[Rp.add(t=>t.isTop?[IQ]:void 0)]},"typescript"),LQ=t=>({label:t,type:"keyword"}),DQ="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(LQ),wY=DQ.concat(["declare","implements","private","protected","public"].map(LQ));function iO(t={}){let e=t.jsx?t.typescript?Yx:Vx:t.typescript?Zx:Mr,i=t.typescript?bY.concat(wY):AQ.concat(DQ);return new At(e,[Mr.data.of({autocomplete:jp(RQ,Iu(i))}),Mr.data.of({autocomplete:vY}),t.jsx?TY:[]])}function kY(t){for(;;){if(t.name=="JSXOpenTag"||t.name=="JSXSelfClosingTag"||t.name=="JSXFragmentTag")return t;if(t.name=="JSXEscape"||!t.parent)return null;t=t.parent}}function QQ(t,e,i=t.length){for(let r=e==null?void 0:e.firstChild;r;r=r.nextSibling)if(r.name=="JSXIdentifier"||r.name=="JSXBuiltin"||r.name=="JSXNamespacedName"||r.name=="JSXMemberExpression")return t.sliceString(r.from,Math.min(r.to,i));return""}var SY=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),TY=de.inputHandler.of((t,e,i,r,n)=>{if((SY?t.composing:t.compositionStarted)||t.state.readOnly||e!=i||r!=">"&&r!="/"||!Mr.isActiveAt(t.state,e,-1))return!1;let o=n(),{state:s}=o,a=s.changeByRange(l=>{var c;let{head:u}=l,f=ze(s).resolveInner(u-1,-1),d;if(f.name=="JSXStartTag"&&(f=f.parent),!(s.doc.sliceString(u-1,u)!=r||f.name=="JSXAttributeValue"&&f.to>u)){if(r==">"&&f.name=="JSXFragmentTag")return{range:l,changes:{from:u,insert:""}};if(r=="/"&&f.name=="JSXStartCloseTag"){let p=f.parent,g=p.parent;if(g&&p.from==u-2&&((d=QQ(s.doc,g.firstChild,u))||((c=g.firstChild)===null||c===void 0?void 0:c.name)=="JSXFragmentTag")){let x=`${d}>`;return{range:J.cursor(u+x.length,-1),changes:{from:u,insert:x}}}}else if(r==">"){let p=kY(f);if(p&&p.name=="JSXOpenTag"&&!/^\/?>|^<\//.test(s.doc.sliceString(u,u+2))&&(d=QQ(s.doc,p,u)))return{range:l,changes:{from:u,insert:``}}}}return{range:l}});return a.changes.empty?!1:(t.dispatch([o,s.update(a,{userEvent:"input.complete",scrollIntoView:!0})]),!0)});var Yu=["_blank","_self","_top","_parent"],Fx=["ascii","utf-8","utf-16","latin1","latin1"],Hx=["get","post","put","delete"],Gx=["application/x-www-form-urlencoded","multipart/form-data","text/plain"],nr=["true","false"],_e={},EY={a:{attrs:{href:null,ping:null,type:null,media:null,target:Yu,hreflang:null}},abbr:_e,address:_e,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:null,hreflang:null,type:null,shape:["default","rect","circle","poly"]}},article:_e,aside:_e,audio:{attrs:{src:null,mediagroup:null,crossorigin:["anonymous","use-credentials"],preload:["none","metadata","auto"],autoplay:["autoplay"],loop:["loop"],controls:["controls"]}},b:_e,base:{attrs:{href:null,target:Yu}},bdi:_e,bdo:_e,blockquote:{attrs:{cite:null}},body:_e,br:_e,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:["autofocus"],disabled:["autofocus"],formenctype:Gx,formmethod:Hx,formnovalidate:["novalidate"],formtarget:Yu,type:["submit","reset","button"]}},canvas:{attrs:{width:null,height:null}},caption:_e,center:_e,cite:_e,code:_e,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:_e,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:["open"]}},dfn:_e,div:_e,dl:_e,dt:_e,em:_e,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:["disabled"],form:null,name:null}},figcaption:_e,figure:_e,footer:_e,form:{attrs:{action:null,name:null,"accept-charset":Fx,autocomplete:["on","off"],enctype:Gx,method:Hx,novalidate:["novalidate"],target:Yu}},h1:_e,h2:_e,h3:_e,h4:_e,h5:_e,h6:_e,head:{children:["title","base","link","style","meta","script","noscript","command"]},header:_e,hgroup:_e,hr:_e,html:{attrs:{manifest:null}},i:_e,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:Gx,formmethod:Hx,formnovalidate:["novalidate"],formtarget:Yu,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:_e,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:["autofocus"],disabled:["disabled"],keytype:["RSA"]}},label:{attrs:{for:null,form:null}},legend:_e,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:_e,menu:{attrs:{label:null,type:["list","context","toolbar"]}},meta:{attrs:{content:null,charset:Fx,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:_e,noscript:_e,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:_e,param:{attrs:{name:null,value:null}},pre:_e,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:_e,rt:_e,ruby:_e,samp:_e,script:{attrs:{type:["text/javascript"],src:null,async:["async"],defer:["defer"],charset:Fx}},section:_e,select:{attrs:{form:null,name:null,size:null,autofocus:["autofocus"],disabled:["disabled"],multiple:["multiple"]}},slot:{attrs:{name:null}},small:_e,source:{attrs:{src:null,type:null,media:null}},span:_e,strong:_e,style:{attrs:{type:["text/css"],media:null,scoped:null}},sub:_e,summary:_e,sup:_e,table:_e,tbody:_e,td:{attrs:{colspan:null,rowspan:null,headers:null}},template:_e,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:_e,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:["row","col","rowgroup","colgroup"]}},thead:_e,time:{attrs:{datetime:null}},title:_e,tr:_e,track:{attrs:{src:null,label:null,default:null,kind:["subtitles","captions","descriptions","chapters","metadata"],srclang:null}},ul:{children:["li","script","template","ul","ol"]},var:_e,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:_e},zQ={accesskey:null,class:null,contenteditable:nr,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:nr,autocorrect:nr,autocapitalize:nr,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":nr,"aria-autocomplete":["inline","list","both","none"],"aria-busy":nr,"aria-checked":["true","false","mixed","undefined"],"aria-controls":null,"aria-describedby":null,"aria-disabled":nr,"aria-dropeffect":null,"aria-expanded":["true","false","undefined"],"aria-flowto":null,"aria-grabbed":["true","false","undefined"],"aria-haspopup":nr,"aria-hidden":nr,"aria-invalid":["true","false","grammar","spelling"],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":["off","polite","assertive"],"aria-multiline":nr,"aria-multiselectable":nr,"aria-owns":null,"aria-posinset":null,"aria-pressed":["true","false","mixed","undefined"],"aria-readonly":nr,"aria-relevant":null,"aria-required":nr,"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},jQ="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(t=>"on"+t);for(let t of jQ)zQ[t]=null;var zs=class{constructor(e,i){this.tags=Object.assign(Object.assign({},EY),e),this.globalAttrs=Object.assign(Object.assign({},zQ),i),this.allTags=Object.keys(this.tags),this.globalAttrNames=Object.keys(this.globalAttrs)}};zs.default=new zs;function dl(t,e,i=t.length){if(!e)return"";let r=e.firstChild,n=r&&r.getChild("TagName");return n?t.sliceString(n.from,Math.min(n.to,i)):""}function pl(t,e=!1){for(;t;t=t.parent)if(t.name=="Element")if(e)e=!1;else return t;return null}function qQ(t,e,i){let r=i.tags[dl(t,pl(e))];return(r==null?void 0:r.children)||i.allTags}function Kx(t,e){let i=[];for(let r=pl(e);r&&!r.type.isTop;r=pl(r.parent)){let n=dl(t,r);if(n&&r.lastChild.name=="CloseTag")break;n&&i.indexOf(n)<0&&(e.name=="EndTag"||e.from>=r.firstChild.to)&&i.push(n)}return i}var WQ=/^[:\-\.\w\u00b7-\uffff]*$/;function NQ(t,e,i,r,n){let o=/\s*>/.test(t.sliceDoc(n,n+5))?"":">",s=pl(i,!0);return{from:r,to:n,options:qQ(t.doc,s,e).map(a=>({label:a,type:"type"})).concat(Kx(t.doc,i).map((a,l)=>({label:"/"+a,apply:"/"+a+o,type:"type",boost:99-l}))),validFor:/^\/?[:\-\.\w\u00b7-\uffff]*$/}}function MQ(t,e,i,r){let n=/\s*>/.test(t.sliceDoc(r,r+5))?"":">";return{from:i,to:r,options:Kx(t.doc,e).map((o,s)=>({label:o,apply:o+n,type:"type",boost:99-s})),validFor:WQ}}function CY(t,e,i,r){let n=[],o=0;for(let s of qQ(t.doc,i,e))n.push({label:"<"+s,type:"type"});for(let s of Kx(t.doc,i))n.push({label:"",type:"type",boost:99-o++});return{from:r,to:r,options:n,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}function _Y(t,e,i,r,n){let o=pl(i),s=o?e.tags[dl(t.doc,o)]:null,a=s&&s.attrs?Object.keys(s.attrs):[],l=s&&s.globalAttrs===!1?a:a.length?a.concat(e.globalAttrNames):e.globalAttrNames;return{from:r,to:n,options:l.map(c=>({label:c,type:"property"})),validFor:WQ}}function PY(t,e,i,r,n){var o;let s=(o=i.parent)===null||o===void 0?void 0:o.getChild("AttributeName"),a=[],l;if(s){let c=t.sliceDoc(s.from,s.to),u=e.globalAttrs[c];if(!u){let f=pl(i),d=f?e.tags[dl(t.doc,f)]:null;u=(d==null?void 0:d.attrs)&&d.attrs[c]}if(u){let f=t.sliceDoc(r,n).toLowerCase(),d='"',p='"';/^['"]/.test(f)?(l=f[0]=='"'?/^[^"]*$/:/^[^']*$/,d="",p=t.sliceDoc(n,n+1)==f[0]?"":f[0],f=f.slice(1),r++):l=/^[^\s<>='"]*$/;for(let g of u)a.push({label:g,apply:d+g+p,type:"constant"})}}return{from:r,to:n,options:a,validFor:l}}function BQ(t,e){let{state:i,pos:r}=e,n=ze(i).resolveInner(r,-1),o=n.resolve(r);for(let s=r,a;o==n&&(a=n.childBefore(s));){let l=a.lastChild;if(!l||!l.type.isError||l.fromBQ(r,n)}var AY=Mr.parser.configure({top:"SingleExpression"}),VQ=[{tag:"script",attrs:t=>t.type=="text/typescript"||t.lang=="ts",parser:Zx.parser},{tag:"script",attrs:t=>t.type=="text/babel"||t.type=="text/jsx",parser:Vx.parser},{tag:"script",attrs:t=>t.type=="text/typescript-jsx",parser:Yx.parser},{tag:"script",attrs(t){return/^(importmap|speculationrules|application\/(.+\+)?json)$/i.test(t.type)},parser:AY},{tag:"script",attrs(t){return!t.type||/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(t.type)},parser:Mr.parser},{tag:"style",attrs(t){return(!t.lang||t.lang=="css")&&(!t.type||/^(text\/)?(x-)?(stylesheet|css)$/i.test(t.type))},parser:Zu.parser}],YQ=[{name:"style",parser:Zu.parser.configure({top:"Styles"})}].concat(jQ.map(t=>({name:t,parser:Mr.parser}))),FQ=yi.define({name:"html",parser:pQ.configure({props:[ai.add({Element(t){let e=/^(\s*)(<\/)?/.exec(t.textAfter);return t.node.to<=t.pos+e[0].length?t.continue():t.lineIndent(t.node.from)+(e[2]?0:t.unit)},"OpenTag CloseTag SelfClosingTag"(t){return t.column(t.node.from)+t.unit},Document(t){if(t.pos+/\s*/.exec(t.textAfter)[0].lengtht.getChild("TagName")})]}),languageData:{commentTokens:{block:{open:""}},indentOnInput:/^\s*<\/\w+\W$/,wordChars:"-._"}}),rO=FQ.configure({wrap:Ux(VQ,YQ)});function nO(t={}){let e="",i;t.matchClosingTags===!1&&(e="noMatch"),t.selfClosingTags===!0&&(e=(e?e+" ":"")+"selfClosing"),(t.nestedLanguages&&t.nestedLanguages.length||t.nestedAttributes&&t.nestedAttributes.length)&&(i=Ux((t.nestedLanguages||[]).concat(VQ),(t.nestedAttributes||[]).concat(YQ)));let r=i?FQ.configure({wrap:i,dialect:e}):e?rO.configure({dialect:e}):rO;return new At(r,[rO.data.of({autocomplete:QY(t)}),t.autoCloseTags!==!1?$Y:[],iO().support,tO().support])}var UQ=new Set("area base br col command embed frame hr img input keygen link meta param source track wbr menuitem".split(" ")),$Y=de.inputHandler.of((t,e,i,r,n)=>{if(t.composing||t.state.readOnly||e!=i||r!=">"&&r!="/"||!rO.isActiveAt(t.state,e,-1))return!1;let o=n(),{state:s}=o,a=s.changeByRange(l=>{var c,u,f;let d=s.doc.sliceString(l.from-1,l.to)==r,{head:p}=l,g=ze(s).resolveInner(p,-1),x;if(d&&r==">"&&g.name=="EndTag"){let w=g.parent;if(((u=(c=w.parent)===null||c===void 0?void 0:c.lastChild)===null||u===void 0?void 0:u.name)!="CloseTag"&&(x=dl(s.doc,w.parent,p))&&!UQ.has(x)){let S=p+(s.doc.sliceString(p,p+1)===">"?1:0),T=``;return{range:l,changes:{from:p,to:S,insert:T}}}}else if(d&&r=="/"&&g.name=="IncompleteCloseTag"){let w=g.parent;if(g.from==p-2&&((f=w.lastChild)===null||f===void 0?void 0:f.name)!="CloseTag"&&(x=dl(s.doc,w,p))&&!UQ.has(x)){let S=p+(s.doc.sliceString(p,p+1)===">"?1:0),T=`${x}>`;return{range:J.cursor(p+T.length,-1),changes:{from:p,to:S,insert:T}}}}return{range:l}});return a.changes.empty?!1:(t.dispatch([o,s.update(a,{userEvent:"input.complete",scrollIntoView:!0})]),!0)});var KQ=al({commentTokens:{block:{open:""}}}),JQ=new Qe,eA=DP.configure({props:[Ht.add(t=>!t.is("Block")||t.is("Document")||tv(t)!=null||XY(t)?void 0:(e,i)=>({from:i.doc.lineAt(e.from).to,to:e.to})),JQ.add(tv),ai.add({Document:()=>null}),Zn.add({Document:KQ})]});function tv(t){let e=/^(?:ATX|Setext)Heading(\d)$/.exec(t.name);return e?+e[1]:void 0}function XY(t){return t.name=="OrderedList"||t.name=="BulletList"}function RY(t,e){let i=t;for(;;){let r=i.nextSibling,n;if(!r||(n=tv(r.type))!=null&&n<=e)break;i=r}return i.to}var IY=Ny.of((t,e,i)=>{for(let r=ze(t).resolveInner(i,-1);r&&!(r.fromi)return{from:i,to:o}}return null});function rv(t){return new si(KQ,t,[IY],"markdown")}var LY=rv(eA),DY=eA.configure([UP,qP,jP,WP,{props:[Ht.add({Table:(t,e)=>({from:e.doc.lineAt(t.from).to,to:t.to})})]}]),oO=rv(DY);function NY(t,e){return i=>{if(i&&t){let r=null;if(i=/\S*/.exec(i)[0],typeof t=="function"?r=t(i):r=zt.matchLanguageName(t,i,!0),r instanceof zt)return r.support?r.support.language.parser:Is.getSkippingParser(r.load());if(r)return r.parser}return e?e.parser:null}}var Ol=class{constructor(e,i,r,n,o,s,a){this.node=e,this.from=i,this.to=r,this.spaceBefore=n,this.spaceAfter=o,this.type=s,this.item=a}blank(e,i=!0){let r=this.spaceBefore+(this.node.name=="Blockquote"?">":"");if(e!=null){for(;r.length0;n--)r+=" ";return r+(i?this.spaceAfter:"")}}marker(e,i){let r=this.node.name=="OrderedList"?String(+iA(this.item,e)[2]+i):"";return this.spaceBefore+r+this.type+this.spaceAfter}};function tA(t,e){let i=[];for(let n=t;n&&n.name!="Document";n=n.parent)(n.name=="ListItem"||n.name=="Blockquote"||n.name=="FencedCode")&&i.push(n);let r=[];for(let n=i.length-1;n>=0;n--){let o=i[n],s,a=e.lineAt(o.from),l=o.from-a.from;if(o.name=="FencedCode")r.push(new Ol(o,l,l,"","","",null));else if(o.name=="Blockquote"&&(s=/^ *>( ?)/.exec(a.text.slice(l))))r.push(new Ol(o,l,l+s[0].length,"",s[1],">",null));else if(o.name=="ListItem"&&o.parent.name=="OrderedList"&&(s=/^( *)\d+([.)])( *)/.exec(a.text.slice(l)))){let c=s[3],u=s[0].length;c.length>=4&&(c=c.slice(0,c.length-4),u-=4),r.push(new Ol(o.parent,l,l+u,s[1],c,s[2],o))}else if(o.name=="ListItem"&&o.parent.name=="BulletList"&&(s=/^( *)([-+*])( {1,4}\[[ xX]\])?( +)/.exec(a.text.slice(l)))){let c=s[4],u=s[0].length;c.length>4&&(c=c.slice(0,c.length-4),u-=4);let f=s[2];s[3]&&(f+=s[3].replace(/[xX]/," ")),r.push(new Ol(o.parent,l,l+u,s[1],c,f,o))}}return r}function iA(t,e){return/^(\s*)(\d+)(?=[.)])/.exec(e.sliceString(t.from,t.from+10))}function Jx(t,e,i,r=0){for(let n=-1,o=t;;){if(o.name=="ListItem"){let a=iA(o,e),l=+a[2];if(n>=0){if(l!=n+1)return;i.push({from:o.from+a[1].length,to:o.from+a[0].length,insert:String(n+2+r)})}n=l}let s=o.nextSibling;if(!s)break;o=s}}function nv(t,e){let i=/^[ \t]*/.exec(t)[0].length;if(!i||e.facet(Nr)!=" ")return t;let r=Ai(t,4,i),n="";for(let o=r;o>0;)o>=4?(n+=" ",o-=4):(n+=" ",o--);return n+t.slice(i)}var MY=({state:t,dispatch:e})=>{let i=ze(t),{doc:r}=t,n=null,o=t.changeByRange(s=>{if(!s.empty||!oO.isActiveAt(t,s.from))return n={range:s};let a=s.from,l=r.lineAt(a),c=tA(i.resolveInner(a,-1),r);for(;c.length&&c[c.length-1].from>a-l.from;)c.pop();if(!c.length)return n={range:s};let u=c[c.length-1];if(u.to-u.spaceAfter.length>a-l.from)return n={range:s};let f=a>=u.to-u.spaceAfter.length&&!/\S/.test(l.text.slice(u.to));if(u.item&&f){let w=u.node.firstChild,S=u.node.getChild("ListItem","ListItem");if(w.to>=a||S&&S.to0&&!/[^\s>]/.test(r.lineAt(l.from-1).text)){let T=c.length>1?c[c.length-2]:null,A,I="";T&&T.item?(A=l.from+T.from,I=T.marker(r,1)):A=l.from+(T?T.to:0);let D=[{from:A,to:a,insert:I}];return u.node.name=="OrderedList"&&Jx(u.item,r,D,-2),T&&T.node.name=="OrderedList"&&Jx(T.item,r,D),{range:J.cursor(A+I.length),changes:D}}else{let T=GQ(c,t,l);return{range:J.cursor(a+T.length+1),changes:{from:l.from,insert:T+t.lineBreak}}}}if(u.node.name=="Blockquote"&&f&&l.from){let w=r.lineAt(l.from-1),S=/>\s*$/.exec(w.text);if(S&&S.index==u.from){let T=t.changes([{from:w.from+S.index,to:w.to},{from:l.from+u.from,to:l.to}]);return{range:s.map(T),changes:T}}}let d=[];u.node.name=="OrderedList"&&Jx(u.item,r,d);let p=u.item&&u.item.from]*/.exec(l.text)[0].length>=u.to)for(let w=0,S=c.length-1;w<=S;w++)g+=w==S&&!p?c[w].marker(r,1):c[w].blank(wl.from&&/\s/.test(l.text.charAt(x-l.from-1));)x--;return g=nv(g,t),UY(u.node,t.doc)&&(g=GQ(c,t,l)+t.lineBreak+g),d.push({from:x,to:a,insert:t.lineBreak+g}),{range:J.cursor(x+g.length+1),changes:d}});return n?!1:(e(t.update(o,{scrollIntoView:!0,userEvent:"input"})),!0)};function HQ(t){return t.name=="QuoteMark"||t.name=="ListMark"}function UY(t,e){if(t.name!="OrderedList"&&t.name!="BulletList")return!1;let i=t.firstChild,r=t.getChild("ListItem","ListItem");if(!r)return!1;let n=e.lineAt(i.to),o=e.lineAt(r.from),s=/^[\s>]*$/.test(n.text);return n.number+(s?0:1){let i=ze(t),r=null,n=t.changeByRange(o=>{let s=o.from,{doc:a}=t;if(o.empty&&oO.isActiveAt(t,o.from)){let l=a.lineAt(s),c=tA(zY(i,s),a);if(c.length){let u=c[c.length-1],f=u.to-u.spaceAfter.length+(u.spaceAfter?1:0);if(s-l.from>f&&!/\S/.test(l.text.slice(f,s-l.from)))return{range:J.cursor(l.from+f),changes:{from:l.from+f,to:s}};if(s-l.from==f&&(!u.item||l.from<=u.item.from||!/\S/.test(l.text.slice(0,u.to)))){let d=l.from+u.from;if(u.item&&u.node.from=65&&t<=90||t>=97&&t<=122||t>=48&&t<=57}function uF(t){return t>=48&&t<=57||t>=97&&t<=102||t>=65&&t<=70}function qs(t,e,i){for(let r=!1;;){if(t.next<0)return;if(t.next==e&&!r){t.advance();return}r=i&&!r&&t.next==92,t.advance()}}function fF(t,e){e:for(;;){if(t.next<0)return console.log("exit at end",t.pos);if(t.next==36){t.advance();for(let i=0;i)".charCodeAt(i);for(;;){if(t.next<0)return;if(t.next==r&&t.peek(1)==39){t.advance(2);return}t.advance()}}function lv(t,e){for(;!(t.next!=95&&!av(t.next));)e!=null&&(e+=String.fromCharCode(t.next)),t.advance();return e}function dF(t){if(t.next==39||t.next==34||t.next==96){let e=t.next;t.advance(),qs(t,e,!1)}else lv(t)}function aA(t,e){for(;t.next==48||t.next==49;)t.advance();e&&t.next==e&&t.advance()}function lA(t,e){for(;;){if(t.next==46){if(e)break;e=!0}else if(t.next<48||t.next>57)break;t.advance()}if(t.next==69||t.next==101)for(t.advance(),(t.next==43||t.next==45)&&t.advance();t.next>=48&&t.next<=57;)t.advance()}function cA(t){for(;!(t.next<0||t.next==10);)t.advance()}function js(t,e){for(let i=0;i!=&|~^/",specialVar:"?",identifierQuotes:'"',words:OA(Bs,Ws)};function pF(t,e,i,r){let n={};for(let o in cv)n[o]=(t.hasOwnProperty(o)?t:cv)[o];return e&&(n.words=OA(e,i||"",r)),n}function mA(t){return new et(e=>{var i;let{next:r}=e;if(e.advance(),js(r,sv)){for(;js(e.next,sv);)e.advance();e.acceptToken(ZY)}else if(r==36&&t.doubleDollarQuotedStrings){let n=lv(e,"");e.next==36&&(e.advance(),fF(e,n),e.acceptToken(Fu))}else if(r==39||r==34&&t.doubleQuotedStrings)qs(e,r,t.backslashEscapes),e.acceptToken(Fu);else if(r==35&&t.hashComments||r==47&&e.next==47&&t.slashComments)cA(e),e.acceptToken(nA);else if(r==45&&e.next==45&&(!t.spaceAfterDashes||e.peek(1)==32))cA(e),e.acceptToken(nA);else if(r==47&&e.next==42){e.advance();for(let n=1;;){let o=e.next;if(e.next<0)break;if(e.advance(),o==42&&e.next==47){if(n--,e.advance(),!n)break}else o==47&&e.next==42&&(n++,e.advance())}e.acceptToken(VY)}else if((r==101||r==69)&&e.next==39)e.advance(),qs(e,39,!0);else if((r==110||r==78)&&e.next==39&&t.charSetCasts)e.advance(),qs(e,39,t.backslashEscapes),e.acceptToken(Fu);else if(r==95&&t.charSetCasts)for(let n=0;;n++){if(e.next==39&&n>1){e.advance(),qs(e,39,t.backslashEscapes),e.acceptToken(Fu);break}if(!av(e.next))break;e.advance()}else if(t.plsqlQuotingMechanism&&(r==113||r==81)&&e.next==39&&e.peek(1)>0&&!js(e.peek(1),sv)){let n=e.peek(1);e.advance(2),hF(e,n),e.acceptToken(Fu)}else if(r==40)e.acceptToken(HY);else if(r==41)e.acceptToken(GY);else if(r==123)e.acceptToken(KY);else if(r==125)e.acceptToken(JY);else if(r==91)e.acceptToken(eF);else if(r==93)e.acceptToken(tF);else if(r==59)e.acceptToken(iF);else if(t.unquotedBitLiterals&&r==48&&e.next==98)e.advance(),aA(e),e.acceptToken(sA);else if((r==98||r==66)&&(e.next==39||e.next==34)){let n=e.next;e.advance(),t.treatBitsAsBytes?(qs(e,n,t.backslashEscapes),e.acceptToken(lF)):(aA(e,n),e.acceptToken(sA))}else if(r==48&&(e.next==120||e.next==88)||(r==120||r==88)&&e.next==39){let n=e.next==39;for(e.advance();uF(e.next);)e.advance();n&&e.next==39&&e.advance(),e.acceptToken(ov)}else if(r==46&&e.next>=48&&e.next<=57)lA(e,!0),e.acceptToken(ov);else if(r==46)e.acceptToken(rF);else if(r>=48&&r<=57)lA(e,!1),e.acceptToken(ov);else if(js(r,t.operatorChars)){for(;js(e.next,t.operatorChars);)e.advance();e.acceptToken(nF)}else if(js(r,t.specialVar))e.next==r&&e.advance(),dF(e),e.acceptToken(sF);else if(js(r,t.identifierQuotes))qs(e,r,!1),e.acceptToken(aF);else if(r==58||r==44)e.acceptToken(oF);else if(av(r)){let n=lv(e,String.fromCharCode(r));e.acceptToken(e.next==46||e.peek(-n.length-1)==46?oA:(i=t.words[n.toLowerCase()])!==null&&i!==void 0?i:oA)}})}var gA=mA(cv),OF=vi.deserialize({version:14,states:"%vQ]QQOOO#wQRO'#DSO$OQQO'#CwO%eQQO'#CxO%lQQO'#CyO%sQQO'#CzOOQQ'#DS'#DSOOQQ'#C}'#C}O'UQRO'#C{OOQQ'#Cv'#CvOOQQ'#C|'#C|Q]QQOOQOQQOOO'`QQO'#DOO(xQRO,59cO)PQQO,59cO)UQQO'#DSOOQQ,59d,59dO)cQQO,59dOOQQ,59e,59eO)jQQO,59eOOQQ,59f,59fO)qQQO,59fOOQQ-E6{-E6{OOQQ,59b,59bOOQQ-E6z-E6zOOQQ,59j,59jOOQQ-E6|-E6|O+VQRO1G.}O+^QQO,59cOOQQ1G/O1G/OOOQQ1G/P1G/POOQQ1G/Q1G/QP+kQQO'#C}O+rQQO1G.}O)PQQO,59cO,PQQO'#Cw",stateData:",[~OtOSPOSQOS~ORUOSUOTUOUUOVROXSOZTO]XO^QO_UO`UOaPObPOcPOdUOeUOfUOgUOhUO~O^]ORvXSvXTvXUvXVvXXvXZvX]vX_vX`vXavXbvXcvXdvXevXfvXgvXhvX~OsvX~P!jOa_Ob_Oc_O~ORUOSUOTUOUUOVROXSOZTO^tO_UO`UOa`Ob`Oc`OdUOeUOfUOgUOhUO~OWaO~P$ZOYcO~P$ZO[eO~P$ZORUOSUOTUOUUOVROXSOZTO^QO_UO`UOaPObPOcPOdUOeUOfUOgUOhUO~O]hOsoX~P%zOajObjOcjO~O^]ORkaSkaTkaUkaVkaXkaZka]ka_ka`kaakabkackadkaekafkagkahka~Oska~P'kO^]O~OWvXYvX[vX~P!jOWnO~P$ZOYoO~P$ZO[pO~P$ZO^]ORkiSkiTkiUkiVkiXkiZki]ki_ki`kiakibkickidkiekifkigkihki~Oski~P)xOWkaYka[ka~P'kO]hO~P$ZOWkiYki[ki~P)xOasObsOcsO~O",goto:"#hwPPPPPPPPPPPPPPPPPPPPPPPPPPx||||!Y!^!d!xPPP#[TYOZeUORSTWZbdfqT[OZQZORiZSWOZQbRQdSQfTZgWbdfqQ^PWk^lmrQl_Qm`RrseVORSTWZbdfq",nodeNames:"\u26A0 LineComment BlockComment String Number Bool Null ( ) { } [ ] ; . Operator Punctuation SpecialVar Identifier QuotedIdentifier Keyword Type Bits Bytes Builtin Script Statement CompositeIdentifier Parens Braces Brackets Statement",maxTerm:38,nodeProps:[["isolate",-4,1,2,3,19,""]],skippedNodes:[0,1,2],repeatNodeCount:3,tokenData:"RORO",tokenizers:[0,gA],topRules:{Script:[0,25]},tokenPrec:0});function uv(t){let e=t.cursor().moveTo(t.from,-1);for(;/Comment/.test(e.name);)e.moveTo(e.from,-1);return e.node}function Hu(t,e){let i=t.sliceString(e.from,e.to),r=/^([`'"])(.*)\1$/.exec(i);return r?r[2]:i}function sO(t){return t&&(t.name=="Identifier"||t.name=="QuotedIdentifier")}function mF(t,e){if(e.name=="CompositeIdentifier"){let i=[];for(let r=e.firstChild;r;r=r.nextSibling)sO(r)&&i.push(Hu(t,r));return i}return[Hu(t,e)]}function uA(t,e){for(let i=[];;){if(!e||e.name!=".")return i;let r=uv(e);if(!sO(r))return i;i.unshift(Hu(t,r)),e=uv(r)}}function gF(t,e){let i=ze(t).resolveInner(e,-1),r=yF(t.doc,i);return i.name=="Identifier"||i.name=="QuotedIdentifier"||i.name=="Keyword"?{from:i.from,quoted:i.name=="QuotedIdentifier"?t.doc.sliceString(i.from,i.from+1):null,parents:uA(t.doc,uv(i)),aliases:r}:i.name=="."?{from:e,quoted:null,parents:uA(t.doc,i),aliases:r}:{from:e,quoted:null,parents:[],empty:!0,aliases:r}}var bF=new Set("where group having order union intersect except all distinct limit offset fetch for".split(" "));function yF(t,e){let i;for(let n=e;!i;n=n.parent){if(!n)return null;n.name=="Statement"&&(i=n)}let r=null;for(let n=i.firstChild,o=!1,s=null;n;n=n.nextSibling){let a=n.name=="Keyword"?t.sliceString(n.from,n.to).toLowerCase():null,l=null;if(!o)o=a=="from";else if(a=="as"&&s&&sO(n.nextSibling))l=Hu(t,n.nextSibling);else{if(a&&bF.has(a))break;s&&sO(n)&&(l=Hu(t,n))}l&&(r||(r=Object.create(null)),r[l]=mF(t,s)),s=/Identifier$/.test(n.name)?n:null}return r}function xF(t,e){return t?e.map(i=>Object.assign(Object.assign({},i),{label:i.label[0]==t?i.label:t+i.label+t,apply:void 0})):e}var vF=/^\w*$/,wF=/^[`'"]?\w*[`'"]?$/;function fA(t){return t.self&&typeof t.self.label=="string"}var fv=class t{constructor(e){this.idQuote=e,this.list=[],this.children=void 0}child(e){let i=this.children||(this.children=Object.create(null)),r=i[e];return r||(e&&!this.list.some(n=>n.label==e)&&this.list.push(hA(e,"type",this.idQuote)),i[e]=new t(this.idQuote))}maybeChild(e){return this.children?this.children[e]:null}addCompletion(e){let i=this.list.findIndex(r=>r.label==e.label);i>-1?this.list[i]=e:this.list.push(e)}addCompletions(e){for(let i of e)this.addCompletion(typeof i=="string"?hA(i,"property",this.idQuote):i)}addNamespace(e){Array.isArray(e)?this.addCompletions(e):fA(e)?this.addNamespace(e.children):this.addNamespaceObject(e)}addNamespaceObject(e){for(let i of Object.keys(e)){let r=e[i],n=null,o=i.replace(/\\?\./g,a=>a=="."?"\0":a).split("\0"),s=this;fA(r)&&(n=r.self,r=r.children);for(let a=0;a{let{parents:f,from:d,quoted:p,empty:g,aliases:x}=gF(u.state,u.pos);if(g&&!u.explicit)return null;x&&f.length==1&&(f=x[f[0]]||f);let w=l;for(let A of f){for(;!w.children||!w.children[A];)if(w==l&&c)w=c;else if(w==c&&r)w=w.child(r);else return null;let I=w.maybeChild(A);if(!I)return null;w=I}let S=p&&u.state.sliceDoc(u.pos,u.pos+1)==p,T=w.list;return w==l&&x&&(T=T.concat(Object.keys(x).map(A=>({label:A,type:"constant"})))),{from:d,to:S?u.pos+1:void 0,options:xF(p,T),validFor:p?wF:vF}}}function SF(t,e){let i=Object.keys(t).map(r=>({label:e?r.toUpperCase():r,type:t[r]==pA?"type":t[r]==dA?"keyword":"variable",boost:-1}));return jp(["QuotedIdentifier","SpecialVar","String","LineComment","BlockComment","."],Iu(i))}var TF=OF.configure({props:[ai.add({Statement:xi()}),Ht.add({Statement(t,e){return{from:Math.min(t.from+100,e.doc.lineAt(t.from).to),to:t.to}},BlockComment(t){return{from:t.from+2,to:t.to-2}}}),Bt({Keyword:_.keyword,Type:_.typeName,Builtin:_.standard(_.name),Bits:_.number,Bytes:_.string,Bool:_.bool,Null:_.null,Number:_.number,String:_.string,Identifier:_.name,QuotedIdentifier:_.special(_.string),SpecialVar:_.special(_.name),LineComment:_.lineComment,BlockComment:_.blockComment,Operator:_.operator,"Semi Punctuation":_.punctuation,"( )":_.paren,"{ }":_.brace,"[ ]":_.squareBracket})]}),pn=class t{constructor(e,i,r){this.dialect=e,this.language=i,this.spec=r}get extension(){return this.language.extension}static define(e){let i=pF(e,e.keywords,e.types,e.builtin),r=yi.define({name:"sql",parser:TF.configure({tokenizers:[{from:gA,to:mA(i)}]}),languageData:{commentTokens:{line:"--",block:{open:"/*",close:"*/"}},closeBrackets:{brackets:["(","[","{","'",'"',"`"]}}});return new t(i,r,e)}};function EF(t,e=!1){return SF(t.dialect.words,e)}function CF(t,e=!1){return t.language.data.of({autocomplete:EF(t,e)})}function _F(t){return t.schema?kF(t.schema,t.tables,t.schemas,t.defaultTable,t.defaultSchema,t.dialect||hv):()=>null}function PF(t){return t.schema?(t.dialect||hv).language.data.of({autocomplete:_F(t)}):[]}function bA(t={}){let e=t.dialect||hv;return new At(e.language,[PF(t),CF(e,!!t.upperCaseKeywords)])}var hv=pn.define({}),sxe=pn.define({charSetCasts:!0,doubleDollarQuotedStrings:!0,operatorChars:"+-*/<>=~!@#%^&|`?",specialVar:"",keywords:Bs+"a abort abs absent access according ada admin aggregate alias also always analyse analyze array_agg array_max_cardinality asensitive assert assignment asymmetric atomic attach attribute attributes avg backward base64 begin_frame begin_partition bernoulli bit_length blocked bom c cache called cardinality catalog_name ceil ceiling chain char_length character_length character_set_catalog character_set_name character_set_schema characteristics characters checkpoint class class_origin cluster coalesce cobol collation_catalog collation_name collation_schema collect column_name columns command_function command_function_code comment comments committed concurrently condition_number configuration conflict connection_name constant constraint_catalog constraint_name constraint_schema contains content control conversion convert copy corr cost covar_pop covar_samp csv cume_dist current_catalog current_row current_schema cursor_name database datalink datatype datetime_interval_code datetime_interval_precision db debug defaults defined definer degree delimiter delimiters dense_rank depends derived detach detail dictionary disable discard dispatch dlnewcopy dlpreviouscopy dlurlcomplete dlurlcompleteonly dlurlcompletewrite dlurlpath dlurlpathonly dlurlpathwrite dlurlscheme dlurlserver dlvalue document dump dynamic_function dynamic_function_code element elsif empty enable encoding encrypted end_frame end_partition endexec enforced enum errcode error event every exclude excluding exclusive exp explain expression extension extract family file filter final first_value flag floor following force foreach fortran forward frame_row freeze fs functions fusion g generated granted greatest groups handler header hex hierarchy hint id ignore ilike immediately immutable implementation implicit import include including increment indent index indexes info inherit inherits inline insensitive instance instantiable instead integrity intersection invoker isnull k key_member key_type label lag last_value lead leakproof least length library like_regex link listen ln load location lock locked log logged lower m mapping matched materialized max max_cardinality maxvalue member merge message message_length message_octet_length message_text min minvalue mod mode more move multiset mumps name namespace nfc nfd nfkc nfkd nil normalize normalized nothing notice notify notnull nowait nth_value ntile nullable nullif nulls number occurrences_regex octet_length octets off offset oids operator options ordering others over overlay overriding owned owner p parallel parameter_mode parameter_name parameter_ordinal_position parameter_specific_catalog parameter_specific_name parameter_specific_schema parser partition pascal passing passthrough password percent percent_rank percentile_cont percentile_disc perform period permission pg_context pg_datatype_name pg_exception_context pg_exception_detail pg_exception_hint placing plans pli policy portion position position_regex power precedes preceding prepared print_strict_params procedural procedures program publication query quote raise range rank reassign recheck recovery refresh regr_avgx regr_avgy regr_count regr_intercept regr_r2 regr_slope regr_sxx regr_sxy regr_syy reindex rename repeatable replace replica requiring reset respect restart restore result_oid returned_cardinality returned_length returned_octet_length returned_sqlstate returning reverse routine_catalog routine_name routine_schema routines row_count row_number rowtype rule scale schema_name schemas scope scope_catalog scope_name scope_schema security selective self sensitive sequence sequences serializable server server_name setof share show simple skip slice snapshot source specific_name sqlcode sqlerror sqrt stable stacked standalone statement statistics stddev_pop stddev_samp stdin stdout storage strict strip structure style subclass_origin submultiset subscription substring substring_regex succeeds sum symmetric sysid system system_time t table_name tables tablesample tablespace temp template ties token top_level_count transaction_active transactions_committed transactions_rolled_back transform transforms translate translate_regex trigger_catalog trigger_name trigger_schema trim trim_array truncate trusted type types uescape unbounded uncommitted unencrypted unlink unlisten unlogged unnamed untyped upper uri use_column use_variable user_defined_type_catalog user_defined_type_code user_defined_type_name user_defined_type_schema vacuum valid validate validator value_of var_pop var_samp varbinary variable_conflict variadic verbose version versioning views volatile warning whitespace width_bucket window within wrapper xmlagg xmlattributes xmlbinary xmlcast xmlcomment xmlconcat xmldeclaration xmldocument xmlelement xmlexists xmlforest xmliterate xmlnamespaces xmlparse xmlpi xmlquery xmlroot xmlschema xmlserialize xmltable xmltext xmlvalidate yes",types:Ws+"bigint int8 bigserial serial8 varbit bool box bytea cidr circle precision float8 inet int4 json jsonb line lseg macaddr macaddr8 money numeric pg_lsn point polygon float4 int2 smallserial serial2 serial serial4 text timetz timestamptz tsquery tsvector txid_snapshot uuid xml"}),yA="accessible algorithm analyze asensitive authors auto_increment autocommit avg avg_row_length binlog btree cache catalog_name chain change changed checkpoint checksum class_origin client_statistics coalesce code collations columns comment committed completion concurrent consistent contains contributors convert database databases day_hour day_microsecond day_minute day_second delay_key_write delayed delimiter des_key_file dev_pop dev_samp deviance directory disable discard distinctrow div dual dumpfile enable enclosed ends engine engines enum errors escaped even event events every explain extended fast field fields flush force found_rows fulltext grants handler hash high_priority hosts hour_microsecond hour_minute hour_second ignore ignore_server_ids import index index_statistics infile innodb insensitive insert_method install invoker iterate keys kill linear lines list load lock logs low_priority master master_heartbeat_period master_ssl_verify_server_cert masters max max_rows maxvalue message_text middleint migrate min min_rows minute_microsecond minute_second mod mode modify mutex mysql_errno no_write_to_binlog offline offset one online optimize optionally outfile pack_keys parser partition partitions password phase plugin plugins prev processlist profile profiles purge query quick range read_write rebuild recover regexp relaylog remove rename reorganize repair repeatable replace require resume rlike row_format rtree schedule schema_name schemas second_microsecond security sensitive separator serializable server share show slave slow snapshot soname spatial sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_no_cache sql_small_result ssl starting starts std stddev stddev_pop stddev_samp storage straight_join subclass_origin sum suspend table_name table_statistics tables tablespace terminated triggers truncate uncommitted uninstall unlock upgrade use use_frm user_resources user_statistics utc_date utc_time utc_timestamp variables views warnings xa xor year_month zerofill",xA=Ws+"bool blob long longblob longtext medium mediumblob mediumint mediumtext tinyblob tinyint tinytext text bigint int1 int2 int3 int4 int8 float4 float8 varbinary varcharacter precision datetime unsigned signed",vA="charset clear edit ego help nopager notee nowarning pager print prompt quit rehash source status system tee",axe=pn.define({operatorChars:"*+-%<>!=&|^",charSetCasts:!0,doubleQuotedStrings:!0,unquotedBitLiterals:!0,hashComments:!0,spaceAfterDashes:!0,specialVar:"@?",identifierQuotes:"`",keywords:Bs+"group_concat "+yA,types:xA,builtin:vA}),lxe=pn.define({operatorChars:"*+-%<>!=&|^",charSetCasts:!0,doubleQuotedStrings:!0,unquotedBitLiterals:!0,hashComments:!0,spaceAfterDashes:!0,specialVar:"@?",identifierQuotes:"`",keywords:Bs+"always generated groupby_concat hard persistent shutdown soft virtual "+yA,types:xA,builtin:vA}),cxe=pn.define({keywords:Bs+"trigger proc view index for add constraint key primary foreign collate clustered nonclustered declare exec go if use index holdlock nolock nowait paglock pivot readcommitted readcommittedlock readpast readuncommitted repeatableread rowlock serializable snapshot tablock tablockx unpivot updlock with",types:Ws+"bigint smallint smallmoney tinyint money real text nvarchar ntext varbinary image hierarchyid uniqueidentifier sql_variant xml",builtin:"binary_checksum checksum connectionproperty context_info current_request_id error_line error_message error_number error_procedure error_severity error_state formatmessage get_filestream_transaction_context getansinull host_id host_name isnull isnumeric min_active_rowversion newid newsequentialid rowcount_big xact_state object_id",operatorChars:"*+-%<>!=^&|/",specialVar:"@"}),uxe=pn.define({keywords:Bs+"abort analyze attach autoincrement conflict database detach exclusive fail glob ignore index indexed instead isnull notnull offset plan pragma query raise regexp reindex rename replace temp vacuum virtual",types:Ws+"bool blob long longblob longtext medium mediumblob mediumint mediumtext tinyblob tinyint tinytext text bigint int2 int8 unsigned signed real",builtin:"auth backup bail changes clone databases dbinfo dump echo eqp explain fullschema headers help import imposter indexes iotrace lint load log mode nullvalue once print prompt quit restore save scanstats separator shell show stats system tables testcase timeout timer trace vfsinfo vfslist vfsname width",operatorChars:"*+-%<>!=&|/~",identifierQuotes:'`"',specialVar:"@:?$"}),fxe=pn.define({keywords:"add all allow alter and any apply as asc authorize batch begin by clustering columnfamily compact consistency count create custom delete desc distinct drop each_quorum exists filtering from grant if in index insert into key keyspace keyspaces level limit local_one local_quorum modify nan norecursive nosuperuser not of on one order password permission permissions primary quorum rename revoke schema select set storage superuser table three to token truncate ttl two type unlogged update use user users using values where with writetime infinity NaN",types:Ws+"ascii bigint blob counter frozen inet list map static text timeuuid tuple uuid varint",slashComments:!0}),hxe=pn.define({keywords:Bs+"abort accept access add all alter and any arraylen as asc assert assign at attributes audit authorization avg base_table begin between binary_integer body by case cast char_base check close cluster clusters colauth column comment commit compress connected constant constraint crash create current currval cursor data_base database dba deallocate debugoff debugon declare default definition delay delete desc digits dispose distinct do drop else elseif elsif enable end entry exception exception_init exchange exclusive exists external fast fetch file for force form from function generic goto grant group having identified if immediate in increment index indexes indicator initial initrans insert interface intersect into is key level library like limited local lock log logging loop master maxextents maxtrans member minextents minus mislabel mode modify multiset new next no noaudit nocompress nologging noparallel not nowait number_base of off offline on online only option or order out package parallel partition pctfree pctincrease pctused pls_integer positive positiven pragma primary prior private privileges procedure public raise range raw rebuild record ref references refresh rename replace resource restrict return returning returns reverse revoke rollback row rowid rowlabel rownum rows run savepoint schema segment select separate set share snapshot some space split sql start statement storage subtype successful synonym tabauth table tables tablespace task terminate then to trigger truncate type union unique unlimited unrecoverable unusable update use using validate value values variable view views when whenever where while with work",builtin:"appinfo arraysize autocommit autoprint autorecovery autotrace blockterminator break btitle cmdsep colsep compatibility compute concat copycommit copytypecheck define echo editfile embedded feedback flagger flush heading headsep instance linesize lno loboffset logsource longchunksize markup native newpage numformat numwidth pagesize pause pno recsep recsepchar repfooter repheader serveroutput shiftinout show showmode spool sqlblanklines sqlcase sqlcode sqlcontinue sqlnumber sqlpluscompatibility sqlprefix sqlprompt sqlterminator suffix tab term termout timing trimout trimspool ttitle underline verify version wrap",types:Ws+"ascii bfile bfilename bigserial bit blob dec long number nvarchar nvarchar2 serial smallint string text uid varchar2 xml",operatorChars:"*/+-%<>!=~",doubleQuotedStrings:!0,charSetCasts:!0,plsqlQuotingMechanism:!0});var QF=Bt({String:_.string,Number:_.number,"True False":_.bool,PropertyName:_.propertyName,Null:_.null,",":_.separator,"[ ]":_.squareBracket,"{ }":_.brace}),wA=vi.deserialize({version:14,states:"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#CjOOQO'#Cp'#CpQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CrOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59U,59UO!iQPO,59UOVQPO,59QOqQPO'#CkO!nQPO,59^OOQO1G.k1G.kOVQPO'#ClO!vQPO,59aOOQO1G.p1G.pOOQO1G.l1G.lOOQO,59V,59VOOQO-E6i-E6iOOQO,59W,59WOOQO-E6j-E6j",stateData:"#O~OcOS~OQSORSOSSOTSOWQO]ROePO~OVXOeUO~O[[O~PVOg^O~Oh_OVfX~OVaO~OhbO[iX~O[dO~Oh_OVfa~OhbO[ia~O",goto:"!kjPPPPPPkPPkqwPPk{!RPPP!XP!ePP!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",nodeNames:"\u26A0 JsonText True False Null Number String } { Object Property PropertyName ] [ Array",maxTerm:25,nodeProps:[["isolate",-2,6,11,""],["openedBy",7,"{",12,"["],["closedBy",8,"}",13,"]"]],propSources:[QF],skippedNodes:[0],repeatNodeCount:2,tokenData:"(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oc~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Oe~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zOh~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yOg~~'OO]~~'TO[~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",tokenizers:[0],topRules:{JsonText:[0,1]},tokenPrec:0});var AF=yi.define({name:"json",parser:wA.configure({props:[ai.add({Object:xi({except:/^\s*\}/}),Array:xi({except:/^\s*\]/})}),Ht.add({"Object Array":jo})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function kA(){return new At(AF)}var dv=1,$F=2,XF=3,RF=4,IF=5,LF=35,DF=36,NF=37,MF=11,UF=13;function zF(t){return t==45||t==46||t==58||t>=65&&t<=90||t==95||t>=97&&t<=122||t>=161}function jF(t){return t==9||t==10||t==13||t==32}var SA=null,TA=null,EA=0;function pv(t,e){let i=t.pos+e;if(TA==t&&EA==i)return SA;for(;jF(t.peek(e));)e++;let r="";for(;;){let n=t.peek(e);if(!zF(n))break;r+=String.fromCharCode(n),e++}return TA=t,EA=i,SA=r||null}function CA(t,e){this.name=t,this.parent=e,this.hash=e?e.hash:0;for(let i=0;i{if(t.next==60){if(t.advance(),t.next==47){t.advance();let i=pv(t,0);if(!i)return t.acceptToken(IF);if(e.context&&i==e.context.name)return t.acceptToken($F);for(let r=e.context;r;r=r.parent)if(r.name==i)return t.acceptToken(XF,-2);t.acceptToken(RF)}else if(t.next!=33&&t.next!=63)return t.acceptToken(dv)}},{contextual:!0});function Ov(t,e){return new et(i=>{let r=0,n=e.charCodeAt(0);e:for(;!(i.next<0);i.advance(),r++)if(i.next==n){for(let o=1;o"),ZF=Ov(DF,"?>"),VF=Ov(NF,"]]>"),YF=Bt({Text:_.content,"StartTag StartCloseTag EndTag SelfCloseEndTag":_.angleBracket,TagName:_.tagName,"MismatchedCloseTag/Tagname":[_.tagName,_.invalid],AttributeName:_.attributeName,AttributeValue:_.attributeValue,Is:_.definitionOperator,"EntityReference CharacterReference":_.character,Comment:_.blockComment,ProcessingInst:_.processingInstruction,DoctypeDecl:_.documentMeta,Cdata:_.special(_.string)}),_A=vi.deserialize({version:14,states:",SOQOaOOOrOxO'#CfOzOpO'#CiO!tOaO'#CgOOOP'#Cg'#CgO!{OrO'#CrO#TOtO'#CsO#]OpO'#CtOOOP'#DS'#DSOOOP'#Cv'#CvQQOaOOOOOW'#Cw'#CwO#eOxO,59QOOOP,59Q,59QOOOO'#Cx'#CxO#mOpO,59TO#uO!bO,59TOOOP'#C{'#C{O$TOaO,59RO$[OpO'#CoOOOP,59R,59ROOOQ'#C|'#C|O$dOrO,59^OOOP,59^,59^OOOS'#C}'#C}O$lOtO,59_OOOP,59_,59_O$tOpO,59`O$|OpO,59`OOOP-E6t-E6tOOOW-E6u-E6uOOOP1G.l1G.lOOOO-E6v-E6vO%UO!bO1G.oO%UO!bO1G.oO%dOpO'#CkO%lO!bO'#CyO%zO!bO1G.oOOOP1G.o1G.oOOOP1G.w1G.wOOOP-E6y-E6yOOOP1G.m1G.mO&VOpO,59ZO&_OpO,59ZOOOQ-E6z-E6zOOOP1G.x1G.xOOOS-E6{-E6{OOOP1G.y1G.yO&gOpO1G.zO&gOpO1G.zOOOP1G.z1G.zO&oO!bO7+$ZO&}O!bO7+$ZOOOP7+$Z7+$ZOOOP7+$c7+$cO'YOpO,59VO'bOpO,59VO'jO!bO,59eOOOO-E6w-E6wO'xOpO1G.uO'xOpO1G.uOOOP1G.u1G.uO(QOpO7+$fOOOP7+$f7+$fO(YO!bO<d!d;'S%y;'S;=`&_<%lO%yX>iV{WOr%ysv%yw!}%y!}#O?O#O;'S%y;'S;=`&_<%lO%yX?VT{WxPOr%ysv%yw;'S%y;'S;=`&_<%lO%yX?kV{WOr%ysv%yw#W%y#W#X@Q#X;'S%y;'S;=`&_<%lO%yX@VV{WOr%ysv%yw#T%y#T#U@l#U;'S%y;'S;=`&_<%lO%yX@qV{WOr%ysv%yw#h%y#h#iAW#i;'S%y;'S;=`&_<%lO%yXA]V{WOr%ysv%yw#T%y#T#U>d#U;'S%y;'S;=`&_<%lO%yXAwV{WOr%ysv%yw#c%y#c#dB^#d;'S%y;'S;=`&_<%lO%yXBcV{WOr%ysv%yw#V%y#V#WBx#W;'S%y;'S;=`&_<%lO%yXB}V{WOr%ysv%yw#h%y#h#iCd#i;'S%y;'S;=`&_<%lO%yXCiV{WOr%ysv%yw#m%y#m#nDO#n;'S%y;'S;=`&_<%lO%yXDTV{WOr%ysv%yw#d%y#d#eDj#e;'S%y;'S;=`&_<%lO%yXDoV{WOr%ysv%yw#X%y#X#Y9i#Y;'S%y;'S;=`&_<%lO%yXE]T!PP{WOr%ysv%yw;'S%y;'S;=`&_<%lO%yZEuWaQVP{WOr$nrs%_sv$nw!^$n!^!_%y!_;'S$n;'S;=`&e<%lO$n_FhW[UVP{WOr$nrs%_sv$nw!^$n!^!_%y!_;'S$n;'S;=`&e<%lO$nZGXYVP{WOr$nrs%_sv$nw!^$n!^!_%y!_!`$n!`!aGw!a;'S$n;'S;=`&e<%lO$nZHQW!OQVP{WOr$nrs%_sv$nw!^$n!^!_%y!_;'S$n;'S;=`&e<%lO$nZHqYVP{WOr$nrs%_sv$nw!^$n!^!_%y!_#P$n#P#QIa#Q;'S$n;'S;=`&e<%lO$nZIhYVP{WOr$nrs%_sv$nw!^$n!^!_%y!_!`$n!`!aJW!a;'S$n;'S;=`&e<%lO$nZJaWwQVP{WOr$nrs%_sv$nw!^$n!^!_%y!_;'S$n;'S;=`&e<%lO$n",tokenizers:[WF,BF,ZF,VF,0,1,2,3],topRules:{Document:[0,6]},tokenPrec:0});function aO(t,e){let i=e&&e.getChild("TagName");return i?t.sliceString(i.from,i.to):""}function mv(t,e){let i=e&&e.firstChild;return!i||i.name!="OpenTag"?"":aO(t,i)}function FF(t,e,i){let r=e&&e.getChildren("Attribute").find(o=>o.from<=i&&o.to>=i),n=r&&r.getChild("AttributeName");return n?t.sliceString(n.from,n.to):""}function gv(t){for(let e=t&&t.parent;e;e=e.parent)if(e.name=="Element")return e;return null}function HF(t,e){var i;let r=ze(t).resolveInner(e,-1),n=null;for(let o=r;!n&&o.parent;o=o.parent)(o.name=="OpenTag"||o.name=="CloseTag"||o.name=="SelfClosingTag"||o.name=="MismatchedCloseTag")&&(n=o);if(n&&(n.to>e||n.lastChild.type.isError)){let o=n.parent;if(r.name=="TagName")return n.name=="CloseTag"||n.name=="MismatchedCloseTag"?{type:"closeTag",from:r.from,context:o}:{type:"openTag",from:r.from,context:gv(o)};if(r.name=="AttributeName")return{type:"attrName",from:r.from,context:n};if(r.name=="AttributeValue")return{type:"attrValue",from:r.from,context:n};let s=r==n||r.name=="Attribute"?r.childBefore(e):r;return(s==null?void 0:s.name)=="StartTag"?{type:"openTag",from:e,context:gv(o)}:(s==null?void 0:s.name)=="StartCloseTag"&&s.to<=e?{type:"closeTag",from:e,context:o}:(s==null?void 0:s.name)=="Is"?{type:"attrValue",from:e,context:n}:s?{type:"attrName",from:e,context:n}:null}else if(r.name=="StartCloseTag")return{type:"closeTag",from:e,context:r.parent};for(;r.parent&&r.to==e&&!(!((i=r.lastChild)===null||i===void 0)&&i.type.isError);)r=r.parent;return r.name=="Element"||r.name=="Text"||r.name=="Document"?{type:"tag",from:e,context:r.name=="Element"?r:gv(r)}:null}var yv=class{constructor(e,i,r){this.attrs=i,this.attrValues=r,this.children=[],this.name=e.name,this.completion=Object.assign(Object.assign({type:"type"},e.completion||{}),{label:this.name}),this.openCompletion=Object.assign(Object.assign({},this.completion),{label:"<"+this.name}),this.closeCompletion=Object.assign(Object.assign({},this.completion),{label:"",boost:2}),this.closeNameCompletion=Object.assign(Object.assign({},this.completion),{label:this.name+">"}),this.text=e.textContent?e.textContent.map(n=>({label:n,type:"text"})):[]}},bv=/^[:\-\.\w\u00b7-\uffff]*$/;function PA(t){return Object.assign(Object.assign({type:"property"},t.completion||{}),{label:t.name})}function QA(t){return typeof t=="string"?{label:`"${t}"`,type:"constant"}:/^"/.test(t.label)?t:Object.assign(Object.assign({},t),{label:`"${t.label}"`})}function GF(t,e){let i=[],r=[],n=Object.create(null);for(let l of e){let c=PA(l);i.push(c),l.global&&r.push(c),l.values&&(n[l.name]=l.values.map(QA))}let o=[],s=[],a=Object.create(null);for(let l of t){let c=r,u=n;l.attributes&&(c=c.concat(l.attributes.map(d=>typeof d=="string"?i.find(p=>p.label==d)||{label:d,type:"property"}:(d.values&&(u==n&&(u=Object.create(u)),u[d.name]=d.values.map(QA)),PA(d)))));let f=new yv(l,c,u);a[f.name]=f,o.push(f),l.top&&s.push(f)}s.length||(s=o);for(let l=0;l{var c;let{doc:u}=l.state,f=HF(l.state,l.pos);if(!f||f.type=="tag"&&!l.explicit)return null;let{type:d,from:p,context:g}=f;if(d=="openTag"){let x=s,w=mv(u,g);if(w){let S=a[w];x=(S==null?void 0:S.children)||o}return{from:p,options:x.map(S=>S.completion),validFor:bv}}else if(d=="closeTag"){let x=mv(u,g);return x?{from:p,to:l.pos+(u.sliceString(l.pos,l.pos+1)==">"?1:0),options:[((c=a[x])===null||c===void 0?void 0:c.closeNameCompletion)||{label:x+">",type:"type"}],validFor:bv}:null}else if(d=="attrName"){let x=a[aO(u,g)];return{from:p,options:(x==null?void 0:x.attrs)||r,validFor:bv}}else if(d=="attrValue"){let x=FF(u,g,p);if(!x)return null;let w=a[aO(u,g)],S=((w==null?void 0:w.attrValues)||n)[x];return!S||!S.length?null:{from:p,to:l.pos+(u.sliceString(l.pos,l.pos+1)=='"'?1:0),options:S,validFor:/^"[^"]*"?$/}}else if(d=="tag"){let x=mv(u,g),w=a[x],S=[],T=g&&g.lastChild;x&&(!T||T.name!="CloseTag"||aO(u,T)!=x)&&S.push(w?w.closeCompletion:{label:"",type:"type",boost:2});let A=S.concat(((w==null?void 0:w.children)||(g?o:s)).map(I=>I.openCompletion));if(g&&(w!=null&&w.text.length)){let I=g.firstChild;I.to>l.pos-20&&!/\S/.test(l.state.sliceDoc(I.to,l.pos))&&(A=A.concat(w.text))}return{from:p,options:A,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}else return null}}var xv=yi.define({name:"xml",parser:_A.configure({props:[ai.add({Element(t){let e=/^\s*<\//.test(t.textAfter);return t.lineIndent(t.node.from)+(e?0:t.unit)},"OpenTag CloseTag SelfClosingTag"(t){return t.column(t.node.from)+t.unit}}),Ht.add({Element(t){let e=t.firstChild,i=t.lastChild;return!e||e.name!="OpenTag"?null:{from:e.to,to:i.name=="CloseTag"?i.from:t.to}}}),Au.add({"OpenTag CloseTag":t=>t.getChild("TagName")})]}),languageData:{commentTokens:{block:{open:""}},indentOnInput:/^\s*<\/$/}});function $A(t={}){let e=[xv.data.of({autocomplete:GF(t.elements||[],t.attributes||[])})];return t.autoCloseTags!==!1&&e.push(KF),new At(xv,e)}function AA(t,e,i=t.length){if(!e)return"";let r=e.firstChild,n=r&&r.getChild("TagName");return n?t.sliceString(n.from,Math.min(n.to,i)):""}var KF=de.inputHandler.of((t,e,i,r,n)=>{if(t.composing||t.state.readOnly||e!=i||r!=">"&&r!="/"||!xv.isActiveAt(t.state,e,-1))return!1;let o=n(),{state:s}=o,a=s.changeByRange(l=>{var c,u,f;let{head:d}=l,p=s.doc.sliceString(d-1,d)==r,g=ze(s).resolveInner(d,-1),x;if(p&&r==">"&&g.name=="EndTag"){let w=g.parent;if(((u=(c=w.parent)===null||c===void 0?void 0:c.lastChild)===null||u===void 0?void 0:u.name)!="CloseTag"&&(x=AA(s.doc,w.parent,d))){let S=d+(s.doc.sliceString(d,d+1)===">"?1:0),T=``;return{range:l,changes:{from:d,to:S,insert:T}}}}else if(p&&r=="/"&&g.name=="StartCloseTag"){let w=g.parent;if(g.from==d-2&&((f=w.lastChild)===null||f===void 0?void 0:f.name)!="CloseTag"&&(x=AA(s.doc,w,d))){let S=d+(s.doc.sliceString(d,d+1)===">"?1:0),T=`${x}>`;return{range:J.cursor(d+T.length,-1),changes:{from:d,to:S,insert:T}}}}return{range:l}});return a.changes.empty?!1:(t.dispatch([o,s.update(a,{userEvent:"input.complete",scrollIntoView:!0})]),!0)});var JF=["-type","-spec","-export_type","-opaque"],eH=["after","begin","catch","case","cond","end","fun","if","let","of","query","receive","try","when"],tH=/[\->,;]/,iH=["->",";",","],rH=["and","andalso","band","bnot","bor","bsl","bsr","bxor","div","not","or","orelse","rem","xor"],nH=/[\+\-\*\/<>=\|:!]/,oH=["=","+","-","*","/",">",">=","<","=<","=:=","==","=/=","/=","||","<-","!"],sH=/[<\(\[\{]/,wv=["<<","(","[","{"],aH=/[>\)\]\}]/,DA=["}","]",")",">>"],lH=["is_atom","is_binary","is_bitstring","is_boolean","is_float","is_function","is_integer","is_list","is_number","is_pid","is_port","is_record","is_reference","is_tuple","atom","binary","bitstring","boolean","function","integer","list","number","pid","port","record","reference","tuple"],cH=["abs","adler32","adler32_combine","alive","apply","atom_to_binary","atom_to_list","binary_to_atom","binary_to_existing_atom","binary_to_list","binary_to_term","bit_size","bitstring_to_list","byte_size","check_process_code","contact_binary","crc32","crc32_combine","date","decode_packet","delete_module","disconnect_node","element","erase","exit","float","float_to_list","garbage_collect","get","get_keys","group_leader","halt","hd","integer_to_list","internal_bif","iolist_size","iolist_to_binary","is_alive","is_atom","is_binary","is_bitstring","is_boolean","is_float","is_function","is_integer","is_list","is_number","is_pid","is_port","is_process_alive","is_record","is_reference","is_tuple","length","link","list_to_atom","list_to_binary","list_to_bitstring","list_to_existing_atom","list_to_float","list_to_integer","list_to_pid","list_to_tuple","load_module","make_ref","module_loaded","monitor_node","node","node_link","node_unlink","nodes","notalive","now","open_port","pid_to_list","port_close","port_command","port_connect","port_control","pre_loaded","process_flag","process_info","processes","purge_module","put","register","registered","round","self","setelement","size","spawn","spawn_link","spawn_monitor","spawn_opt","split_binary","statistics","term_to_binary","time","throw","tl","trunc","tuple_size","tuple_to_list","unlink","unregister","whereis"],lO=/[\w@Ø-ÞÀ-Öß-öø-ÿ]/,uH=/[0-7]{1,3}|[bdefnrstv\\"']|\^[a-zA-Z]|x[0-9a-zA-Z]{2}|x{[0-9a-zA-Z]+}/;function fH(t,e){if(e.in_string)return e.in_string=!IA(t),tt(e,t,"string");if(e.in_atom)return e.in_atom=!LA(t),tt(e,t,"atom");if(t.eatSpace())return tt(e,t,"whitespace");if(!Gu(e)&&t.match(/-\s*[a-zß-öø-ÿ][\wØ-ÞÀ-Öß-öø-ÿ]*/))return wi(t.current(),JF)?tt(e,t,"type"):tt(e,t,"attribute");var i=t.next();if(i=="%")return t.skipToEnd(),tt(e,t,"comment");if(i==":")return tt(e,t,"colon");if(i=="?")return t.eatSpace(),t.eatWhile(lO),tt(e,t,"macro");if(i=="#")return t.eatSpace(),t.eatWhile(lO),tt(e,t,"record");if(i=="$")return t.next()=="\\"&&!t.match(uH)?tt(e,t,"error"):tt(e,t,"number");if(i==".")return tt(e,t,"dot");if(i=="'"){if(!(e.in_atom=!LA(t))){if(t.match(/\s*\/\s*[0-9]/,!1))return t.match(/\s*\/\s*[0-9]/,!0),tt(e,t,"fun");if(t.match(/\s*\(/,!1)||t.match(/\s*:/,!1))return tt(e,t,"function")}return tt(e,t,"atom")}if(i=='"')return e.in_string=!IA(t),tt(e,t,"string");if(/[A-Z_Ø-ÞÀ-Ö]/.test(i))return t.eatWhile(lO),tt(e,t,"variable");if(/[a-z_ß-öø-ÿ]/.test(i)){if(t.eatWhile(lO),t.match(/\s*\/\s*[0-9]/,!1))return t.match(/\s*\/\s*[0-9]/,!0),tt(e,t,"fun");var r=t.current();return wi(r,eH)?tt(e,t,"keyword"):wi(r,rH)?tt(e,t,"operator"):t.match(/\s*\(/,!1)?wi(r,cH)&&(Gu(e).token!=":"||Gu(e,2).token=="erlang")?tt(e,t,"builtin"):wi(r,lH)?tt(e,t,"guard"):tt(e,t,"function"):hH(t)==":"?r=="erlang"?tt(e,t,"builtin"):tt(e,t,"function"):wi(r,["true","false"])?tt(e,t,"boolean"):tt(e,t,"atom")}var n=/[0-9]/,o=/[0-9a-zA-Z]/;return n.test(i)?(t.eatWhile(n),t.eat("#")?t.eatWhile(o)||t.backUp(1):t.eat(".")&&(t.eatWhile(n)?t.eat(/[eE]/)&&(t.eat(/[-+]/)?t.eatWhile(n)||t.backUp(2):t.eatWhile(n)||t.backUp(1)):t.backUp(1)),tt(e,t,"number")):XA(t,sH,wv)?tt(e,t,"open_paren"):XA(t,aH,DA)?tt(e,t,"close_paren"):RA(t,tH,iH)?tt(e,t,"separator"):RA(t,nH,oH)?tt(e,t,"operator"):tt(e,t,null)}function XA(t,e,i){if(t.current().length==1&&e.test(t.current())){for(t.backUp(1);e.test(t.peek());)if(t.next(),wi(t.current(),i))return!0;t.backUp(t.current().length-1)}return!1}function RA(t,e,i){if(t.current().length==1&&e.test(t.current())){for(;e.test(t.peek());)t.next();for(;01&&t[e].type==="fun"&&t[e-1].token==="fun")return t.slice(0,e-1);switch(t[e].token){case"}":return Ur(t,{g:["{"]});case"]":return Ur(t,{i:["["]});case")":return Ur(t,{i:["("]});case">>":return Ur(t,{i:["<<"]});case"end":return Ur(t,{i:["begin","case","fun","if","receive","try"]});case",":return Ur(t,{e:["begin","try","when","->",",","(","[","{","<<"]});case"->":return Ur(t,{r:["when"],m:["try","if","case","receive"]});case";":return Ur(t,{E:["case","fun","if","receive","try","when"]});case"catch":return Ur(t,{e:["try"]});case"of":return Ur(t,{e:["case"]});case"after":return Ur(t,{e:["receive","try"]});default:return t}}function Ur(t,e){for(var i in e)for(var r=t.length-1,n=e[i],o=r-1;-1"?wi(s.token,["receive","case","if","try"])?s.column+i.unit+i.unit:s.column+i.unit:wi(o.token,wv)?o.column+o.token.length:(r=vH(t),Zs(r)?r.column+i.unit:0):0}function yH(t){var e=t.match(/,|[a-z]+|\}|\]|\)|>>|\|+|\(/);return Zs(e)&&e.index===0?e[0]:""}function xH(t){var e=t.tokenStack.slice(0,-1),i=cO(e,"type",["open_paren"]);return Zs(e[i])?e[i]:!1}function vH(t){var e=t.tokenStack,i=cO(e,"type",["open_paren","separator","keyword"]),r=cO(e,"type",["operator"]);return Zs(i)&&Zs(r)&&i2&&s.token&&typeof s.token!="string"){i.pending=[];for(var c=2;c-1)return null;var n=i.indent.length-1,o=t[i.state];e:for(;;){for(var s=0;s{let i=vG.find(r=>e.canShift(r.token));kG(t,i)&&t.acceptToken(i.token)});function kG(t,e){let i=e.delimiterLength===3;for(let r=!1;;r=!0){let n=!1;if(d$(t.next))for(t.advance(),r=!0,n=!0;or(t.next);)t.advance();if(t.next===e.endDelimiter){let o=1;for(;o{let i=0;for(;c$<=t.next&&t.next<=xG||uG<=t.next&&t.next<=fG||n$<=t.next&&t.next<=o$;)t.advance(),i++;i>0&&t.acceptToken(oG)}),TG=new et((t,e)=>{or(t.peek(-1))||(e.canShift(KA)&&t.next===r$?(t.advance(),t.acceptToken(KA)):e.canShift(JA)&&t.next===l$?(t.advance(),t.acceptToken(JA)):e.canShift(e$)&&t.next===Hn&&(t.advance(),or(t.next)&&t.acceptToken(e$)))}),EG=new et((t,e)=>{if(tf(t.next)){for(t.advance();tf(t.next);)t.advance();if(t.next===gl){let i=t.peek(1);i!==gl&&i!==Hn&&i!==On&&!or(i)&&t.acceptToken(YA)}else if(t.next===Ho){let i=t.peek(1);i!==Ho&&i!==Ri&&i!==Hn&&i!==On&&!or(i)&&t.acceptToken(YA)}}}),f$=/[\p{ID_Start}_]/u,h$=/[\p{ID_Continue}@]/u,CG=new et((t,e)=>{if(t.next===Hn){t.advance();let[i,r]=bl(t);if(f$.test(i)){do t.advance(r),[i,r]=bl(t);while(h$.test(i));(t.next===$v||t.next===OO)&&t.advance(),t.acceptToken(DH)}}}),_G=new et((t,e)=>{let[i,r]=bl(t);if(f$.test(i)){do t.advance(r),[i,r]=bl(t);while(h$.test(i));(t.next===$v||t.next===OO)&&t.advance(),t.next===Hn&&(t.advance(),or(t.next)&&t.acceptToken(NH))}}),PG=/[_\p{Ll}\p{Lm}\p{Lo}\p{Nl}\u1885\u1886\u2118\u212E\u309B\u309C]/u,QG=/[\p{ID_Continue}]/u,AG=new et((t,e)=>{let[i,r]=bl(t),o=i==="_"?aG:sG;if(PG.test(i)){do t.advance(r),[i,r]=bl(t);while(QG.test(i));(t.next===$v||t.next===OO)&&t.advance(),t.acceptToken(o)}else t.next===Fs&&(t.advance(),t.next===Fs&&(t.advance(),t.next===Fs&&(t.advance(),Fo(t.next)&&t.acceptToken(o))))}),$G=new et((t,e)=>{if(t.next===Vs&&(t.advance(),t.next===Go&&(t.advance(),t.next===Xv))){for(t.advance();tf(t.next);)t.advance();t.next===_v&&(t.advance(),t.next===Vs&&(t.advance(),Fo(t.next)&&t.acceptToken(RH)))}}),XG=new et((t,e)=>{t.next===On&&(t.advance(),t.next===On&&(t.advance(),t.acceptToken(IH)))}),RG=new et((t,e)=>{t.next===a$&&(t.advance(),(t.next===ml&&t.peek(1)===Go&&t.peek(2)===kv&&or(t.peek(3))||t.next===pG&&t.peek(1)===Go&&t.peek(2)===ml&&t.peek(3)===gG&&t.peek(4)===dG&&t.peek(5)===Cv&&t.peek(6)===ml&&t.peek(7)===Go&&t.peek(8)===kv&&or(t.peek(9))||t.next===Xv&&t.peek(1)===yG&&t.peek(2)===OG&&t.peek(3)===Cv&&t.peek(4)===ml&&t.peek(5)===Go&&t.peek(6)===kv&&or(t.peek(7)))&&t.acceptToken(LH))}),IG=new et((t,e)=>{if(t.next===Qv&&t.advance(),t.next===pO){t.advance();let i=0,r=!1;for(;or(t.peek(i));)r=r||d$(t.peek(i)),i++;if(e.canShift(GA)&&t.peek(i)===ml&&t.peek(i+1)===Go&&Fo(t.peek(i+2))){t.acceptToken(GA);return}if(e.canShift(HA)&&LG(t,i)){t.acceptToken(HA);return}e.canShift(FA)&&t.peek(i)!==s$&&t.peek(i)!==Av&&!r&&t.acceptToken(FA)}});function LG(t,e=0){if(t.peek(e)===uO){if(e++,t.peek(e)===uO)return e++,t.peek(e)===uO,Ne(t,e)}else{if(t.peek(e)===Yo)return t.peek(e)===Yo?(e++,t.peek(e)===Yo&&e++,Ne(t,e)):t.peek(e)===ef?(e++,Ne(t,e)):(t.peek(1)===Ri&&e++,Ne(t,e));if(t.peek(e)===Hn){if(e++,t.peek(e)===Hn)return e++,t.peek(e)===Hn?!1:Ne(t,e)}else if(t.peek(e)===gl){if(e++,t.peek(e)===gl)return e++,t.peek(e)===gl&&e++,Ne(t,e)}else if(t.peek(e)===Ho){if(e++,t.peek(e)===Ho)return e++,t.peek(e)===Ho&&e++,Ne(t,e);if(t.peek(e)===Ri)return e++,Ne(t,e)}else if(t.peek(e)===fO){if(e++,t.peek(e)===Yo||t.peek(e)===Ho||t.peek(e)===Ri)return e++,Ne(t,e);if(t.peek(e)===ef)return e++,t.peek(e)===Ri&&e++,Ne(t,e);if(t.peek(e)===Ys){if(e++,t.peek(e)===Ri)return e++,Ne(t,e)}else if(t.peek(e)===fO){if(e++,t.peek(e)===fO||t.peek(e)===ef)return e++,Ne(t,e)}else return Ne(t,e)}else if(t.peek(e)===Ri){if(e++,t.peek(e)===Yo)return e++,Ne(t,e);if(t.peek(e)===Ri){if(e++,t.peek(e)===Ri)return e++,Ne(t,e)}else return Ne(t,e)}else if(t.peek(e)===hO){if(e++,t.peek(e)===hO&&(e++,t.peek(e)===hO))return e++,Ne(t,e)}else if(t.peek(e)===OO){if(e++,t.peek(e)===Yo)return e++,t.peek(e)===Yo&&e++,Ne(t,e)}else if(t.peek(e)===ef){if(e++,t.peek(e)===Ri)return e++,t.peek(e)===Ri&&e++,Ne(t,e)}else{if(t.peek(e)===Ys)return e++,t.peek(e)===Ys?(e++,t.peek(e)===Ys&&e++,Ne(t,e)):(t.peek(e)===Ri&&e++,Ne(t,e));if(t.peek(e)===Tv)return e++,t.peek(e)===Tv&&e++,Ne(t,e);if(t.peek(e)===On)return e++,t.peek(e)===On&&e++,Ne(t,e);if(t.peek(e)===Fs)return e++,t.peek(e)===Fs?(e++,t.peek(e)===Fs?!1:Ne(t,e)):Ne(t,e);if(t.peek(e)===dO){if(e++,t.peek(e)===dO)return e++,Ne(t,e)}else if(t.peek(e)===bG){if(e++,t.peek(e)===hG&&(e++,t.peek(e)===Cv&&(e++,t.peek(e)===Vs)))return e++,Fo(t.peek(e))&&Ne(t,e)}else if(t.peek(e)===c$){if(e++,t.peek(e)===Vs&&(e++,t.peek(e)===ml))return e++,Fo(t.peek(e))&&Ne(t,e)}else if(t.peek(e)===Go){if(e++,t.peek(e)===mG)return e++,Fo(t.peek(e))&&Ne(t,e)}else if(t.peek(e)===_v){if(e++,t.peek(e)===Vs)return e++,Fo(t.peek(e))&&Ne(t,e)}else if(t.peek(e)===Vs&&(e++,t.peek(e)===Go&&(e++,t.peek(e)===Xv))){for(e++;tf(t.peek(e));)e++;if(t.peek(e)===_v&&(e++,t.peek(e)===Vs))return e++,Fo(t.peek(e))&&Ne(t,e)}}}}function Ne(t,e){if(t.peek(e)===Hn)return!or(t.peek(e+1));for(;tf(t.peek(e));)e++;if(t.peek(e)===On){for(e++;or(t.peek(e));)e++;if(DG(t.peek(e)))return!1}return!0}function tf(t){return t===i$||t===t$}function or(t){return t===i$||t===t$||t===pO||t===Qv}function d$(t){return t===pO||t===Qv}function DG(t){return n$<=t&&t<=o$}var NG=new Set([a$,Fs,gl,Ho,hO,Ho,Tv,On,fO,Ri,Ys,ef,Yo,uO,dO,lG,u$,Pv,l$,Ev,r$,Sv,Ku,Ju,cG,s$,Av]);function Fo(t){return NG.has(t)?!0:or(t)||t===-1}function bl(t){let e=t.next;if(55296<=e&&e<=56319){let i=t.peek(1);if(56320<=i&&i<=57343)return[String.fromCharCode(e,i),2]}return[String.fromCharCode(e),1]}var MG=Bt({"Atom QuotedAtom QuotedAtom/QuotedContent Keyword QuotedKeyword QuotedKeyword/QuotedContent":_.atom,Alias:_.namespace,Boolean:_.bool,Nil:_.null,Integer:_.integer,Float:_.float,Char:_.character,Identifier:_.variableName,Comment:_.lineComment,SpecialIdentifier:_.special(_.variableName),UnderscoredIdentifier:_.comment,"String String/QuotedContent":_.string,"Charlist Charlist/QuotedContent":_.string,"StringSigil StringSigil/SigilName StringSigil/SigilModifiers StringSigil/QuotedContent StringSigil/{ StringSigil/} StringSigil/[ StringSigil/] StringSigil/( StringSigil/)":_.string,"Sigil Sigil/SigilName Sigil/SigilModifiers Sigil/QuotedContent Sigil/{ Sigil/} Sigil/[ Sigil/] Sigil/( Sigil/)":_.special(_.string),EscapeSequence:_.escape,"Interpolation/#{ Interpolation/}":_.special(_.brace),"( )":_.paren,"[ ]":_.squareBracket,"% { }":_.brace,", ;":_.separator,"<< >>":_.angleBracket,"fn do end catch rescue after else":_.keyword,Operator:_.operator,WordOperator:_.keyword,"CaptureOperand/Integer":_.operator,"AtOperator/Operator AtOperator/Identifier AtOperator/Boolean AtOperator/Nil AtOperator/Call/Identifier":_.attributeName,"DocAtOperator/Operator DocAtOperator/Identifier DocAtOperator/Call/Identifier DocAtOperator/Call/Arguments/Boolean DocAtOperator/Call/Arguments/String DocAtOperator/Call/Arguments/String/QuotedContent DocAtOperator/Call/Arguments/Charlist DocAtOperator/Call/Arguments/Charlist/QuotedContent DocAtOperator/Call/Arguments/StringSigil DocAtOperator/Call/Arguments/StringSigil/QuotedContent DocAtOperator/Call/Arguments/StringSigil/SigilName DocAtOperator/Call/Arguments/StringSigil/SigilModifiers DocAtOperator/Call/Arguments/StringSigil/{ DocAtOperator/Call/Arguments/StringSigil/} DocAtOperator/Call/Arguments/StringSigil/[ DocAtOperator/Call/Arguments/StringSigil/] DocAtOperator/Call/Arguments/StringSigil/( DocAtOperator/Call/Arguments/StringSigil/)":_.docString,"Call/Identifier Call/UnderscoredIdentifier":_.function(_.variableName),"Call/Dot/Right/Identifier Call/Dot/Right/SpecialIdentifier Call/Dot/Right/UnderscoredIdentifier":_.function(_.variableName),"Call/Dot/Atom":_.namespace,"PipeOperator/Right/Identifier":_.function(_.variableName),"FunctionDefinitionCall/Identifier":_.keyword,"FunctionDefinitionCall/Arguments/Identifier FunctionDefinitionCall/Arguments/UnderscoredIdentifier FunctionDefinitionCall/Arguments/SpecialIdentifier":_.definition(_.function(_.variableName)),"FunctionDefinitionCall/Arguments/Call/Identifier FunctionDefinitionCall/Arguments/Call/UnderscoredIdentifier FunctionDefinitionCall/Arguments/Call/SpecialIdentifier":_.definition(_.function(_.variableName)),"FunctionDefinitionCall/Arguments/WhenOperator/Identifier FunctionDefinitionCall/Arguments/WhenOperator/UnderscoredIdentifier FunctionDefinitionCall/Arguments/WhenOperator/SpecialIdentifier":_.definition(_.function(_.variableName)),"FunctionDefinitionCall/Arguments/WhenOperator/Call/Identifier FunctionDefinitionCall/Arguments/WhenOperator/Call/UnderscoredIdentifier FunctionDefinitionCall/Arguments/WhenOperator/Call/SpecialIdentifier":_.definition(_.function(_.variableName)),"FunctionDefinitionCall/Arguments/PipeOperator/Right/Identifier":_.variableName,"KernelCall/Identifier":_.keyword}),UG={__proto__:null,when:432,def:446,defdelegate:448,defguard:450,defguardp:452,defmacro:454,defmacrop:456,defn:458,defnp:460,defp:462,defexception:464,defimpl:466,defmodule:468,defoverridable:470,defprotocol:472,defstruct:474,alias:476,case:478,cond:480,for:482,if:484,import:486,quote:488,raise:490,receive:492,require:494,reraise:496,super:498,throw:500,try:502,unless:504,unquote:506,unquote_splicing:508,use:510,with:512,true:514,false:516,nil:518,not:588,do:600,after:604,rescue:608,catch:612,else:616,end:618,and:624,in:626,or:628,fn:630},zG={__proto__:null,__MODULE__:436,__DIR__:438,__ENV__:440,__CALLER__:442,__STACKTRACE__:444},p$=vi.deserialize({version:14,states:"$CWQ'_Q!7uOOP'iOMhOOOOQYQ!6yOOO>dQ!;_O'#GsOOQ8a'#E]'#E]OEwQ!;_O'#GsOOQ8a'#Ej'#EjO>dQ!;_O'#GsOOQ8a'#Ek'#EkOOQ8a'#Iq'#IqO!&fQ!;_O'#FmO!&pQMxO'#FRO!&uQ!6yO'#IpOOQ8a'#Ip'#IpO!/aQ!7uO'#D{OOQ8a'#FW'#FWOOQ9]'#F_'#F_OOQ`'#Fa'#FaO!/kQMxO'#FYOOQ8a'#JU'#JUOOQ8a'#Fg'#FgOOQ8a'#Fi'#FiOOQ8a'#Fj'#FjOOQ8a'#JX'#JXOOQ8a'#J]'#J]OOQ8a'#JW'#JWOOQ8a'#JV'#JVOOQ8a'#Gs'#GsQcQ!7uOOOOQiOOQCg,5>i,5>iO#3nQ!LbO,5>iO#3yQ##|O'#FyO#4XQ!LbO,5>kOOQCg,5>k,5>kO#4XQ!LbO,5>kO#4dQ!LbO,5:VO#5UQ!LbO,5:VO#4dQ!LbO,5:^O#5UQ!LbO,5:^O#5vQMxO'#DvO#6XQ!6yO'#IkOOQ`'#Ik'#IkOOQ8a,5:a,5:aO#6iQMxO,5:aOOQ8a,5:c,5:cO#6nQMxO,5:cOOQ8a,5:d,5:dO#6sQMxO,5:dO#8uQ!6yO,5:iOcQ!7uO,5:iOOQ8a,5:m,5:mOOQ8a,5:o,5:oO([Q!:kO'#CvO#9uQ!6yO'#IoOOQ8a,5:q,5:qOOQ8a,5:s,5:sQcQ!7uO'#FwQ#&}QMxOOO#=nQ!6UO,5;nOOQ9]'#F`'#F`OcQ!7uO,5;tOcQ!7uO,5;tO/fQ!:kO,5;tOcQ!7uO,5;tOcQ!7uO,5;tOcQ!7uO,5;tOcQ!7uO,5;tOcQ!7uO,5;tOcQ!7uO,5;tOcQ!7uO,5;tOcQ!7uO,5;tOcQ!7uO,5;tOcQ!7uO,5;tOcQ!7uO,5;tOcQ!7uO,5;tOcQ!7uO,5;tOcQ!7uO,5;tO/fQ!:kO,5;|OcQ!7uO,5TQ!6yO1G.|O%9yQMxO1G.|OOQ9],59i,59iOOQ`,5[Q!LbO1G4TOOQ`,5gQ!LbO1G4VO%>rQ##|O'#IUO%?QQ##|O'#IVO%?`Q##|O'#IWO%?nQ##|O'#IXO%?|Q##|O'#I[O%@[Q##|O'#I^O%BjQ!BPO1G/qOOQCg'#IT'#ITO%CjQ##|O'#IaO%CxQ##|O'#IbO%DWQ##|O'#IcO%DfQ##|O'#IdO%DtQ##|O'#IeO%ESQ##|O'#IfO%EbQ##|O'#IgO%EpQ##|O'#IhO%FOQ##|O'#IiO%F^Q##|O'#IjOOQCg'#I`'#I`O%HlQ!BPO1G/xO%IlQ!!nO,5:bO%JWQMxO,5:bO%JiQ!:kO,5?VO%J|QMxO,5?VOOQ8a1G/{1G/{OOQ8a1G/}1G/}OOQ8a1G0O1G0OO%MXQ!6yO1G0TO%NXQ!6yO,59bO%N`Q!6yO,5pOOQCg,5>p,5>pO'5oQ!LbO,5>pO'5zQ##|O'#F{O'6YQ!LbO,5>qOOQCg,5>q,5>qO'6YQ!LbO,5>qO'6eQ##|O'#F|O'6sQ!LbO,5>rOOQCg,5>r,5>rO'6sQ!LbO,5>rO'7OQ##|O'#F}O'7^Q!LbO,5>sOOQCg,5>s,5>sO'7^Q!LbO,5>sO'7iQ##|O'#GOO'7wQ!LbO,5>vOOQCg,5>v,5>vO'7wQ!LbO,5>vO'8SQ##|O'#GPO'8bQ!LbO,5>xOOQCg,5>x,5>xO'8bQ!LbO,5>xOOQ8a7+%]7+%]O'8mQ##|O'#GQO'8{Q!LbO,5>{OOQCg,5>{,5>{O'8{Q!LbO,5>{O'9WQ##|O'#GRO'9fQ!LbO,5>|OOQCg,5>|,5>|O'9fQ!LbO,5>|O'9qQ##|O'#GSO':PQ!LbO,5>}OOQCg,5>},5>}O':PQ!LbO,5>}O':[Q##|O'#GTO':jQ!LbO,5?OOOQCg,5?O,5?OO':jQ!LbO,5?OO':uQ##|O'#GUO';TQ!LbO,5?POOQCg,5?P,5?PO';TQ!LbO,5?PO';`Q##|O'#GVO';nQ!LbO,5?QOOQCg,5?Q,5?QO';nQ!LbO,5?QO';yQ##|O'#GWO'RQ!!nO1G/|OOQ`-E:Z-E:ZO'>mQ!6yO,5RQ!;_O'#GsO)>]Q!;_O'#GsO)BlQ!;_O'#GsO)GkQ!;_O'#GsO)K}Q!;_O'#GsO* zQ!;_O'#GsO*&|Q!;_O'#GsO**pQ!;_O'#GsO*.jQ!;_O'#GsO)>RQ!;_O'#GsO*2vQ!;_O'#GsO*7SQ!;_O'#GsO)GkQ!;_O'#GsO*RQ!;_O'#GsO)>]Q!;_O'#GsO)BlQ!;_O'#GsO)GkQ!;_O'#GsO)K}Q!;_O'#GsO* zQ!;_O'#GsO*&|Q!;_O'#GsO**pQ!;_O'#GsO*G`Q!;_O'#FmO*KoQ!;_O'#FmO*KyQ!;_O'#FmO+!YQ!;_O'#FmO+&PQ!;_O'#FmO+)|Q!;_O'#FmO+.]Q!;_O'#FmO+2SQ!;_O'#FmO+5vQ!;_O'#FmO+9pQ!6yO'#IpOcQ!7uO'#C{O+9zQ!7uO'#C{O(LwQ!7uO'#C{O+=OQ!7uO'#C{O+@SQ!7uO'#C{O+@^Q!7uO'#C{O!6VQ!7uO'#C{O+CbQ!7uO'#C{O+FfQ!7uO'#CxO#4dQ!LbO,5:VO#5UQ!LbO,5:VO#4dQ!LbO,5:^O#5UQ!LbO,5:^O!=^Q!7uO,5:iO(LwQ!7uO,5:iO+9zQ!7uO,5:iO+@SQ!7uO,5:iO!6VQ!7uO,5:iO+@^Q!7uO,5:iO)+TQ!7uO,5:iO+CbQ!7uO,5:iO%3XQ!7uO,5:iO+=OQ!7uO,5:iO!=^Q!7uO,5;tO(LwQ!7uO,5;tO+9zQ!7uO,5;tO+@SQ!7uO,5;tO!6VQ!7uO,5;tO)+TQ!7uO,5;tO+@^Q!7uO,5;tO+CbQ!7uO,5;tO%3XQ!7uO,5;tO+=OQ!7uO,5;tO!=^Q!7uO,5;tO(LwQ!7uO,5;tO+9zQ!7uO,5;tO+@SQ!7uO,5;tO!6VQ!7uO,5;tO)+TQ!7uO,5;tO+@^Q!7uO,5;tO+CbQ!7uO,5;tO%3XQ!7uO,5;tO+=OQ!7uO,5;tO%6]Q!:kO,5;tO&@eQ!:kO,5;tO+JYQ!:kO,5;tO+MdQ!:kO,5;tO+MtQ!:kO,5;tO+NOQ!:kO,5;tO,#YQ!:kO,5;tO,&dQ!:kO,5;tO,)nQ!:kO,5;tO,,xQ!:kO,5;tO'%vQ!:kO,5;tO!=^Q!7uO,5;tO(LwQ!7uO,5;tO+9zQ!7uO,5;tO+@SQ!7uO,5;tO!6VQ!7uO,5;tO)+TQ!7uO,5;tO+@^Q!7uO,5;tO+CbQ!7uO,5;tO%3XQ!7uO,5;tO+=OQ!7uO,5;tO!=^Q!7uO,5;tO(LwQ!7uO,5;tO+9zQ!7uO,5;tO+@SQ!7uO,5;tO!6VQ!7uO,5;tO)+TQ!7uO,5;tO+@^Q!7uO,5;tO+CbQ!7uO,5;tO%3XQ!7uO,5;tO+=OQ!7uO,5;tO!=^Q!7uO,5;tO(LwQ!7uO,5;tO+9zQ!7uO,5;tO+@SQ!7uO,5;tO!6VQ!7uO,5;tO)+TQ!7uO,5;tO+@^Q!7uO,5;tO+CbQ!7uO,5;tO%3XQ!7uO,5;tO+=OQ!7uO,5;tO!=^Q!7uO,5;tO(LwQ!7uO,5;tO+9zQ!7uO,5;tO+@SQ!7uO,5;tO!6VQ!7uO,5;tO)+TQ!7uO,5;tO+@^Q!7uO,5;tO+CbQ!7uO,5;tO%3XQ!7uO,5;tO+=OQ!7uO,5;tO!=^Q!7uO,5;tO(LwQ!7uO,5;tO+9zQ!7uO,5;tO+@SQ!7uO,5;tO!6VQ!7uO,5;tO)+TQ!7uO,5;tO+@^Q!7uO,5;tO+CbQ!7uO,5;tO%3XQ!7uO,5;tO+=OQ!7uO,5;tO!=^Q!7uO,5;tO(LwQ!7uO,5;tO+9zQ!7uO,5;tO+@SQ!7uO,5;tO!6VQ!7uO,5;tO)+TQ!7uO,5;tO+@^Q!7uO,5;tO+CbQ!7uO,5;tO%3XQ!7uO,5;tO+=OQ!7uO,5;tO!=^Q!7uO,5;tO(LwQ!7uO,5;tO+9zQ!7uO,5;tO+@SQ!7uO,5;tO!6VQ!7uO,5;tO)+TQ!7uO,5;tO+@^Q!7uO,5;tO+CbQ!7uO,5;tO%3XQ!7uO,5;tO+=OQ!7uO,5;tO!=^Q!7uO,5;tO(LwQ!7uO,5;tO+9zQ!7uO,5;tO+@SQ!7uO,5;tO!6VQ!7uO,5;tO)+TQ!7uO,5;tO+@^Q!7uO,5;tO+CbQ!7uO,5;tO%3XQ!7uO,5;tO+=OQ!7uO,5;tO!=^Q!7uO,5;tO(LwQ!7uO,5;tO+9zQ!7uO,5;tO+@SQ!7uO,5;tO!6VQ!7uO,5;tO)+TQ!7uO,5;tO+@^Q!7uO,5;tO+CbQ!7uO,5;tO%3XQ!7uO,5;tO+=OQ!7uO,5;tO!=^Q!7uO,5;tO(LwQ!7uO,5;tO+9zQ!7uO,5;tO+@SQ!7uO,5;tO!6VQ!7uO,5;tO)+TQ!7uO,5;tO+@^Q!7uO,5;tO+CbQ!7uO,5;tO%3XQ!7uO,5;tO+=OQ!7uO,5;tO!=^Q!7uO,5;tO(LwQ!7uO,5;tO+9zQ!7uO,5;tO+@SQ!7uO,5;tO!6VQ!7uO,5;tO)+TQ!7uO,5;tO+@^Q!7uO,5;tO+CbQ!7uO,5;tO%3XQ!7uO,5;tO+=OQ!7uO,5;tO!=^Q!7uO,5;tO(LwQ!7uO,5;tO+9zQ!7uO,5;tO+@SQ!7uO,5;tO!6VQ!7uO,5;tO)+TQ!7uO,5;tO+@^Q!7uO,5;tO+CbQ!7uO,5;tO%3XQ!7uO,5;tO+=OQ!7uO,5;tO!=^Q!7uO,5;tO(LwQ!7uO,5;tO+9zQ!7uO,5;tO+@SQ!7uO,5;tO!6VQ!7uO,5;tO)+TQ!7uO,5;tO+@^Q!7uO,5;tO+CbQ!7uO,5;tO%3XQ!7uO,5;tO+=OQ!7uO,5;tO!=^Q!7uO,5;tO(LwQ!7uO,5;tO+9zQ!7uO,5;tO+@SQ!7uO,5;tO!6VQ!7uO,5;tO)+TQ!7uO,5;tO+@^Q!7uO,5;tO+CbQ!7uO,5;tO%3XQ!7uO,5;tO+=OQ!7uO,5;tO%6]Q!:kO,5;|O&@eQ!:kO,5;|O+JYQ!:kO,5;|O+MdQ!:kO,5;|O+MtQ!:kO,5;|O+NOQ!:kO,5;|O,#YQ!:kO,5;|O,&dQ!:kO,5;|O,)nQ!:kO,5;|O,,xQ!:kO,5;|O'%vQ!:kO,5;|O!=^Q!7uO,5xQ!6yO1G1`O-@sQ!6yO1G1`O-BtQ!6yO1G1`O-B{Q!6yO1G1`O-CSQ!6yO1G1`O-CZQ!6yO1G1`O-CbQ!6yO1G1`O-CiQ!6yO1G1`O-CpQ!6yO1G1`O-CwQ!6yO1G1`O-DOQ!6yO1G1`O-DVQ!6yO1G1`O-D^Q!6yO1G1`O-FtQ!6yO1G1`O-IkQ!6yO1G1`O-LOQ!6yO1G1`O-M|Q!6yO1G1`O. }Q!6yO1G1`O.$kQ!6yO1G1`O.&oQ!6yO1G1`O.)PQ!6yO1G1`O.*zQ!6yO1G1`O.,{Q!6yO1G1`O.-SQ!6yO1G1`O.-ZQ!6yO1G1`O.-bQ!6yO1G1`O.-iQ!6yO1G1`O.-pQ!6yO1G1`O.-wQ!6yO1G1`O..OQ!6yO1G1`O..VQ!6yO1G1`O..^Q!6yO1G1`O.0nQ!6yO1G1`O.3eQ!6yO1G1`O.5xQ!6yO1G1`O.7vQ!6yO1G1`O.9wQ!6yO1G1`O.iQ!6yO1G1`O.@dQ!6yO1G1`O.BeQ!6yO1G1`O.BrQ!6yO1G1`O.CPQ!6yO1G1`O.C^Q!6yO1G1`O.CkQ!6yO1G1`O.CxQ!6yO1G1`O.DVQ!6yO1G1`O.DdQ!6yO1G1`O.DqQ!6yO1G1`O.EOQ!6yO1G1`O.GlQ!6yO1G1`O.JcQ!6yO1G1`O.LvQ!6yO1G1`O.NtQ!6yO1G1`O/!uQ!6yO1G1`O/%cQ!6yO1G1`O/'gQ!6yO1G1`O/)bQ!6yO1G1`O/+cQ!6yO1G1`O/+jQ!6yO1G1`O/+qQ!6yO1G1`O/+xQ!6yO1G1`O/,PQ!6yO1G1`O/,WQ!6yO1G1`O/,_Q!6yO1G1`O/,fQ!6yO1G1`O/,mQ!6yO1G1`O/,tQ!6yO1G1`O//XQ!6yO1G1`O/2OQ!6yO1G1`O/4cQ!6yO1G1`O/6aQ!6yO1G1`O/8bQ!6yO1G1`O/;OQ!6yO1G1`O/=SQ!6yO1G1`O/>}Q!6yO1G1`O/AOQ!6yO1G1`O/AYQ!6yO1G1`O/AdQ!6yO1G1`O/AnQ!6yO1G1`O/AxQ!6yO1G1`O/BSQ!6yO1G1`O/B^Q!6yO1G1`O/BhQ!6yO1G1`O/BrQ!6yO1G1`O/B|Q!6yO1G1`O/EgQ!6yO1G1`O/H^Q!6yO1G1`O/JqQ!6yO1G1`O/LoQ!6yO1G1`O/NpQ!6yO1G1`O0#^Q!6yO1G1`O0%bQ!6yO1G1`O0']Q!6yO1G1`O0)^Q!6yO1G1`O0)eQ!6yO1G1`O0)lQ!6yO1G1`O0)sQ!6yO1G1`O0)zQ!6yO1G1`O0*RQ!6yO1G1`O0*YQ!6yO1G1`O0*aQ!6yO1G1`O0*hQ!6yO1G1`O0*oQ!6yO1G1`O0-VQ!6yO1G1`O0/|Q!6yO1G1`O02aQ!6yO1G1`O04_Q!6yO1G1`O06`Q!6yO1G1`O08|Q!6yO1G1`O0;QQ!6yO1G1`O0<{Q!6yO1G1`O0>|Q!6yO1G1`O0?TQ!6yO1G1`O0?[Q!6yO1G1`O0?cQ!6yO1G1`O0?jQ!6yO1G1`O0?qQ!6yO1G1`O0?xQ!6yO1G1`O0@PQ!6yO1G1`O0@WQ!6yO1G1`O0@_Q!6yO1G1`O0BrQ!6yO1G1`O0EiQ!6yO1G1`O0G|Q!6yO1G1`O0IzQ!6yO1G1`O0K{Q!6yO1G1`O0NiQ!6yO1G1`O1!mQ!6yO1G1`O1$hQ!6yO1G1`O1&iQ!6yO1G1`O1&sQ!6yO1G1`O1&}Q!6yO1G1`O1'UQ!6yO1G1`O1'`Q!6yO1G1`O1'jQ!6yO1G1`O1'tQ!6yO1G1`O1(OQ!6yO1G1`O1(YQ!6yO1G1`O1(dQ!6yO1G1`O1*_Q!6yO'#FcO1,xQ!6yO'#FcO1/rQ!6yO'#FcO12YQ!6yO'#FcO14ZQ!6yO'#FcO16_Q!6yO'#FcO19OQ!6yO'#FcO1;VQ!6yO'#FcO1=jQ!6yO'#FcO1?hQ!6yO'#FcO1AxQ!6yO'#FfO1BiQ!6yO'#FfO1EYQ!6yO'#FfO1G^Q!6yO'#FfO1IeQ!6yO'#FfO1JUQ!6yO'#FfO1J{Q!6yO'#FfO1MSQ!6yO'#FfO1MsQ!6yO'#FfO,#YQ!:kO,5WQ!6yO'#FfO4?WQ%2eO'#IoO4?hQ%2eO'#CzO4C_Q%2eO1G1`O4CfQ%2eO1G1`O4EjQ%2eO1G1`O4EqQ%2eO1G1`O4GoQ%2eO1G1`O4G|Q%2eO1G1`O4JWQ%2eO1G1`O4J_Q%2eO1G1`O4L`Q%2eO1G1`O4LjQ%2eO1G1`O4NqQ%2eO1G1`O4NxQ%2eO1G1`O5!|Q%2eO1G1`O5#TQ%2eO1G1`O5%UQ%2eO1G1`O5%`Q%2eO1G1`O5&eQ%2eO'#FcO5'nQ%2eO'#FfO5(eQ%2eO,59gO5(oQ%2eO,59fO5*iQ!6UO'#D}O5*tQ!7uO'#FaO5-xQ!6UO'#D}O5*tQ!7uO'#FaO2(YQ!7uO'#ET",stateData:"5.[~O%bOS%cOShOS%YOS%dPQ~OkTO|xO!T!SO!U!SO!V!SO!W!SO!a`O!c_O!maO!rbO!sbO!vdO!zgO#exO#fxO#gxO#hxO#ixO#jxO#kxO#lxO#mxO#nxO#oxO#pxO#qxO#rxO#{vO%TwO%VeO%WcO%]XO%_UO%`VO%mRO%oSO%p!UO%r!VO%s!VO%t!VO%u!VO%v!VO%w!WO%x!WO%y!WO%z!WO%{!WO%|!WO%}!WO&O!WO&P!WO&Q!XO&R!XO&S!XO&T!XO&U!XO&V!XO&W!XO&X!XO&Y!XO&Z!XO&[!XO&]!XO&^!XO&_!XO&`!XO&a!XO&b!XO&c!XO&d!XO&e!XO&f!XO&g!XO&h!XO&i!XO&j!XO&k!YO&l!YO&m!ZO&oXO&p![O&rZO&t[O&v]O'`uO'b!_O't!aO'u!bO'v!`O'w!cO~O%XQO%fQO~PcO%d!eO~OR!jOr!gOt!fO%m!iO~OS!nOr!kOt!fO%o!mO~Ok!sOv!{O|!yO!T!SO!U!SO!V!SO!W!SO!a`O!c_O!maO!r:`O!s:`O!v:sO!z;VO#exO#fxO#gxO#hxO#ixO#jxO#kxO#lxO#mxO#nxO#oxO#pxO#qxO#rxO#{vO%TwO%VeO%W:iO%XQO%]XO%^!oO%_UO%`VO%fQO%k!oO%mRO%oSO%p!UO%r!VO%s!VO%t!VO%u!VO%v!VO%w!WO%x!WO%y!WO%z!WO%{!WO%|!WO%}!WO&O!WO&P!WO&Q!XO&R!XO&S!XO&T!XO&U!XO&V!XO&W!XO&X!XO&Y!XO&Z!XO&[!XO&]!XO&^!XO&_!XO&`!XO&a!XO&b!XO&c!XO&d!XO&e!XO&f!XO&g!XO&h!XO&i!XO&j!XO&k!YO&l!YO&m!ZO&oXO&p![O&rZO&t[O&v]O'`uO'b!_O't!aO'u!bO'v!`O'w!cO~OT#TOr#QOt!fO&r#SO~OU#XOr#UOt!fO&t#WO~O!`#YO!e#ZO!g#[O!h#]O~O!d#aO%^!oO%k!oO~PcO!b#cO%^!oO%k!oO~PcO!n#eO%^!oO%k!oO~PcOkTO|xO!T!SO!U!SO!V!SO!W!SO!a`O!c_O!maO!rbO!sbO!vdO!zgO#exO#fxO#gxO#hxO#ixO#jxO#kxO#lxO#mxO#nxO#oxO#pxO#rxO#{vO%TwO%VeO%WcO%]XO%_UO%`VO%mRO%oSO%p!UO%r!VO%s!VO%t!VO%u!VO%v!VO%w!WO%x!WO%y!WO%z!WO%{!WO%|!WO%}!WO&O!WO&P!WO&Q!XO&R!XO&S!XO&T!XO&U!XO&V!XO&W!XO&X!XO&Y!XO&Z!XO&[!XO&]!XO&^!XO&_!XO&`!XO&a!XO&b!XO&c!XO&d!XO&e!XO&f!XO&g!XO&h!XO&i!XO&j!XO&k!YO&l!YO&m!ZO&oXO&p![O&rZO&t[O&v]O'`uO'b!_O't!aO'u!bO'v!`O'w!cO#q$TX~O!r#hO!s#hO'b!_O~O|xO!T!SO!V!SO!W!SO!a`O!c_O!maO!rbO!sbO!vdO!zgO#exO#fxO#gxO#hxO#ixO#jxO#kxO#lxO#mxO#nxO#oxO#pxO#qxO#rxO#{vO%TwO%VeO%WcO%]XO%_UO%`VO%mRO%oSO%p!UO%r!VO%s!VO%t!VO%u!VO%v!VO%w!WO%x!WO%y!WO%z!WO%{!WO%|!WO%}!WO&O!WO&P!WO&Q!XO&R!XO&S!XO&T!XO&U!XO&V!XO&W!XO&X!XO&Y!XO&Z!XO&[!XO&]!XO&^!XO&_!XO&`!XO&a!XO&b!XO&c!XO&d!XO&e!XO&f!XO&g!XO&h!XO&i!XO&j!XO&k!YO&l!YO&m!ZO&oXO&p![O&rZO&t[O&v]O'`uO'b!_O't!aO'u!bO'v!`O'w!cO~Ok#kO!U#nO#q$TX~P6cOQ$WO!r$RO!}#qO#e#sO#f#tO#g#uO#h#wO#i#xO#j#yO#k#zO#l#{O#m#|O#n$OO#o$PO#p$SO#q$SO#r$TO#{$QO#}#vO$X$VO%TwO%U#rO%p!UO't!aO'u!bO'v!`O~O%XQO%fQO~PvOQ$WO!r4mO!}#qO#j2yO#k3TO#l3_O#m3iO#n3}O#o4XO#p4wO#q4wO#r5RO#{4cO$X5hO%TwO%U#rO't!aO'u!bOv#|i|#|i#e#|i#f#|i#g#|i#}#|i%i#|i%p#|i~O#h2eO#i2oO'v!`O~P.@qO#h#|i#i#|i'v#|i~P..eO#h#|i#i#|i'v#|i~P.0{O#h#|i#i#|i'v#|i~P.3rO#h#|i#i#|i'v#|i~P.6VO#h#|i#i#|i'v#|i~P.8TO#h#|i#i#|i'v#|i~P.:UO#h#|i#i#|i'v#|i~P.vO#h#|i#i#|i'v#|i~P.@qOQ$WO!r4dO!}#qO#l3UO#m3`O#n3tO#o4OO#p4nO#q4nO#r4xO#{4YO$X5_O%TwO%U#rO'u!bOv#|i|#|i#e#|i#f#|i#g#|i#h#|i#i#|i#j#|i#}#|i%X#|i%f#|i%i#|i%p#|i't#|i'v#|i'j#|i'l#|i'n#|i'p#|i'q#|i~O#k2zO~P.E]OQ$WO!r4eO!}#qO#l3VO#m3aO#n3uO#o4PO#p4oO#q4oO#r4yO#{4ZO$X5`O%TwO%U#rO'u!bO#e#|i#f#|i#g#|i#h#|i#i#|i#j#|i#}#|i%S#|i%X#|i%Z#|i%f#|i%i#|i%p#|i'h#|i't#|i'v#|i!d#|i!b#|i!n#|iv#|i'q#|i'j#|i'l#|i'n#|i'p#|i~O#k2{O~P.GsOQ$WO!r4fO!}#qO#l3WO#m3bO#n3vO#o4QO#p4pO#q4pO#r4zO#{4[O$X5aO%TwO%U#rO'u!bO#e#|i#f#|i#g#|i#h#|i#i#|i#j#|i#}#|i%i#|i%p#|i't#|i'v#|iv#|i%X#|i%f#|i'q#|i'j#|i'l#|i'n#|i'p#|i~O#k2|O~P.JjOQ$WO!r4gO!}#qO#l3XO#m3cO#n3wO#o4RO#p4qO#q4qO#r4{O#{4]O$X5bO%TwO%U#rO'u!bO!a#|i#e#|i#f#|i#g#|i#h#|i#i#|i#j#|i#}#|i%p#|i't#|i'v#|i%i#|i~O#k2}O~P.L}OQ$WO!r4iO!}#qO#l3ZO#m3eO#n3yO#o4TO#p4sO#q4sO#r4}O#{4_O$X5dO%TwO%U#rO'u!bO#e#|i#f#|i#g#|i#h#|i#i#|i#j#|i#}#|i%p#|i't#|i'v#|iv#|i%X#|i%f#|i~O#k3PO~P.N{OQ$WO!r4jO!}#qO#l3[O#m3fO#n3zO#o4UO#p4tO#q4tO#r5OO#{4`O$X5eO%TwO%U#rO'u!bOv#|i|#|i#e#|i#f#|i#g#|i#h#|i#i#|i#j#|i#}#|i%X#|i%Z#|i%f#|i%i#|i%p#|i'h#|i't#|i'v#|i'j#|i'l#|i'n#|i'p#|i'q#|i~O#k3QO~P/!|OQ$WO!r4kO!}#qO#l3]O#m3gO#n3{O#o4VO#p4uO#q4uO#r5PO#{4aO$X5fO%TwO%U#rO'u!bO!a#|i#e#|i#f#|i#g#|i#h#|i#i#|i#j#|i#}#|i%Z#|i%i#|i%p#|i'h#|i't#|i'v#|i~O#k3RO~P/%jOQ$WO!r4lO!}#qO#l3^O#m3hO#n3|O#o4WO#p4vO#q4vO#r5QO#{4bO$X5gO%TwO%U#rO'u!bO|#|i#e#|i#f#|i#g#|i#h#|i#i#|i#j#|i#}#|i%p#|i't#|i'v#|i~O#k3SO~P/'nOQ$WO!r4mO!}#qO#l3_O#m3iO#n3}O#o4XO#p4wO#q4wO#r5RO#{4cO$X5hO%TwO%U#rO'u!bOv#|i|#|i#e#|i#f#|i#g#|i#h#|i#i#|i#j#|i#}#|i%i#|i%p#|i't#|i'v#|i~O#k3TO~P/)iO#k#|i~P.E]O#k#|i~P.GsO#k#|i~P.JjO#k#|i~P.L}O#k#|i~P.N{O#k#|i~P/!|O#k#|i~P/%jO#k#|i~P/'nO#k#|i~P/)iOQ$WO!r4dO!}#qO#n3tO#o4OO#p4nO#q4nO#r4xO#{4YO%TwO%U#rO'u!bOv#|i|#|i#e#|i#f#|i#g#|i#h#|i#i#|i#j#|i#k#|i#l#|i#}#|i%X#|i%f#|i%i#|i%p#|i't#|i'v#|i'j#|i'l#|i'n#|i'p#|i'q#|i~O#m3`O$X5_O~P/,{OQ$WO!r4eO!}#qO#n3uO#o4PO#p4oO#q4oO#r4yO#{4ZO%TwO%U#rO'u!bO#e#|i#f#|i#g#|i#h#|i#i#|i#j#|i#k#|i#l#|i#}#|i%S#|i%X#|i%Z#|i%f#|i%i#|i%p#|i'h#|i't#|i'v#|i!d#|i!b#|i!n#|iv#|i'q#|i'j#|i'l#|i'n#|i'p#|i~O#m3aO$X5`O~P//cOQ$WO!r4fO!}#qO#n3vO#o4QO#p4pO#q4pO#r4zO#{4[O%TwO%U#rO'u!bO#e#|i#f#|i#g#|i#h#|i#i#|i#j#|i#k#|i#l#|i#}#|i%i#|i%p#|i't#|i'v#|iv#|i%X#|i%f#|i'q#|i'j#|i'l#|i'n#|i'p#|i~O#m3bO$X5aO~P/2YOQ$WO!r4gO!}#qO#n3wO#o4RO#p4qO#q4qO#r4{O#{4]O%TwO%U#rO'u!bO!a#|i#e#|i#f#|i#g#|i#h#|i#i#|i#j#|i#k#|i#l#|i#}#|i%p#|i't#|i'v#|i%i#|i~O#m3cO$X5bO~P/4mOQ$WO!r4iO!}#qO#n3yO#o4TO#p4sO#q4sO#r4}O#{4_O%TwO%U#rO'u!bO#e#|i#f#|i#g#|i#h#|i#i#|i#j#|i#k#|i#l#|i#}#|i%p#|i't#|i'v#|iv#|i%X#|i%f#|i~O#m3eO$X5dO~P/6kOQ$WO!r4jO!}#qO#n3zO#o4UO#p4tO#q4tO#r5OO#{4`O%TwO%U#rO'u!bOv#|i|#|i#e#|i#f#|i#g#|i#h#|i#i#|i#j#|i#k#|i#l#|i#}#|i%X#|i%Z#|i%f#|i%i#|i%p#|i'h#|i't#|i'v#|i'j#|i'l#|i'n#|i'p#|i'q#|i~O#m3fO$X5eO~P/8lOQ$WO!r4kO!}#qO#n3{O#o4VO#p4uO#q4uO#r5PO#{4aO%TwO%U#rO'u!bO!a#|i#e#|i#f#|i#g#|i#h#|i#i#|i#j#|i#k#|i#l#|i#}#|i%Z#|i%i#|i%p#|i'h#|i't#|i'v#|i~O#m3gO$X5fO~P/;YOQ$WO!r4lO!}#qO#n3|O#o4WO#p4vO#q4vO#r5QO#{4bO%TwO%U#rO'u!bO|#|i#e#|i#f#|i#g#|i#h#|i#i#|i#j#|i#k#|i#l#|i#}#|i%p#|i't#|i'v#|i~O#m3hO$X5gO~P/=^OQ$WO!r4mO!}#qO#n3}O#o4XO#p4wO#q4wO#r5RO#{4cO%TwO%U#rO'u!bOv#|i|#|i#e#|i#f#|i#g#|i#h#|i#i#|i#j#|i#k#|i#l#|i#}#|i%i#|i%p#|i't#|i'v#|i~O#m3iO$X5hO~P/?XO#m#|i$X#|i~P/,{O#m#|i$X#|i~P//cO#m#|i$X#|i~P/2YO#m#|i$X#|i~P/4mO#m#|i$X#|i~P/6kO#m#|i$X#|i~P/8lO#m#|i$X#|i~P/;YO#m#|i$X#|i~P/=^O#m#|i$X#|i~P/?XOQ$WO!r4dO!}#qO#o4OO#p4nO#q4nO#r4xO#{4YO%U#rOv#|i|#|i#e#|i#f#|i#g#|i#h#|i#i#|i#j#|i#k#|i#l#|i#m#|i#}#|i$X#|i%T#|i%X#|i%f#|i%i#|i%p#|i't#|i'u#|i'v#|i'j#|i'l#|i'n#|i'p#|i'q#|i~O#n3tO~P/CWOQ$WO!r4eO!}#qO#o4PO#p4oO#q4oO#r4yO#{4ZO%U#rO#e#|i#f#|i#g#|i#h#|i#i#|i#j#|i#k#|i#l#|i#m#|i#}#|i$X#|i%S#|i%T#|i%X#|i%Z#|i%f#|i%i#|i%p#|i'h#|i't#|i'u#|i'v#|i!d#|i!b#|i!n#|iv#|i'q#|i'j#|i'l#|i'n#|i'p#|i~O#n3uO~P/EnOQ$WO!r4fO!}#qO#o4QO#p4pO#q4pO#r4zO#{4[O%U#rO#e#|i#f#|i#g#|i#h#|i#i#|i#j#|i#k#|i#l#|i#m#|i#}#|i$X#|i%T#|i%i#|i%p#|i't#|i'u#|i'v#|iv#|i%X#|i%f#|i'q#|i'j#|i'l#|i'n#|i'p#|i~O#n3vO~P/HeOQ$WO!r4gO!}#qO#o4RO#p4qO#q4qO#r4{O#{4]O%U#rO!a#|i#e#|i#f#|i#g#|i#h#|i#i#|i#j#|i#k#|i#l#|i#m#|i#}#|i$X#|i%T#|i%p#|i't#|i'u#|i'v#|i%i#|i~O#n3wO~P/JxOQ$WO!r4iO!}#qO#o4TO#p4sO#q4sO#r4}O#{4_O%U#rO#e#|i#f#|i#g#|i#h#|i#i#|i#j#|i#k#|i#l#|i#m#|i#}#|i$X#|i%T#|i%p#|i't#|i'u#|i'v#|iv#|i%X#|i%f#|i~O#n3yO~P/LvOQ$WO!r4jO!}#qO#o4UO#p4tO#q4tO#r5OO#{4`O%U#rOv#|i|#|i#e#|i#f#|i#g#|i#h#|i#i#|i#j#|i#k#|i#l#|i#m#|i#}#|i$X#|i%T#|i%X#|i%Z#|i%f#|i%i#|i%p#|i'h#|i't#|i'u#|i'v#|i'j#|i'l#|i'n#|i'p#|i'q#|i~O#n3zO~P/NwOQ$WO!r4kO!}#qO#o4VO#p4uO#q4uO#r5PO#{4aO%U#rO!a#|i#e#|i#f#|i#g#|i#h#|i#i#|i#j#|i#k#|i#l#|i#m#|i#}#|i$X#|i%T#|i%Z#|i%i#|i%p#|i'h#|i't#|i'u#|i'v#|i~O#n3{O~P0#eOQ$WO!r4lO!}#qO#o4WO#p4vO#q4vO#r5QO#{4bO%U#rO|#|i#e#|i#f#|i#g#|i#h#|i#i#|i#j#|i#k#|i#l#|i#m#|i#}#|i$X#|i%T#|i%p#|i't#|i'u#|i'v#|i~O#n3|O~P0%iOQ$WO!r4mO!}#qO#o4XO#p4wO#q4wO#r5RO#{4cO%U#rOv#|i|#|i#e#|i#f#|i#g#|i#h#|i#i#|i#j#|i#k#|i#l#|i#m#|i#}#|i$X#|i%T#|i%i#|i%p#|i't#|i'u#|i'v#|i~O#n3}O~P0'dO#n#|i~P/CWO#n#|i~P/EnO#n#|i~P/HeO#n#|i~P/JxO#n#|i~P/LvO#n#|i~P/NwO#n#|i~P0#eO#n#|i~P0%iO#n#|i~P0'dOQ$WO!r4dO!}#qO#p4nO#q4nO#r4xO#{4YOv#|i|#|i#e#|i#f#|i#g#|i#h#|i#i#|i#j#|i#k#|i#l#|i#m#|i#n#|i#}#|i$X#|i%T#|i%U#|i%X#|i%f#|i%i#|i%p#|i't#|i'u#|i'v#|i'j#|i'l#|i'n#|i'p#|i'q#|i~O#o4OO~P0*vOQ$WO!r4eO!}#qO#p4oO#q4oO#r4yO#{4ZO#e#|i#f#|i#g#|i#h#|i#i#|i#j#|i#k#|i#l#|i#m#|i#n#|i#}#|i$X#|i%S#|i%T#|i%U#|i%X#|i%Z#|i%f#|i%i#|i%p#|i'h#|i't#|i'u#|i'v#|i!d#|i!b#|i!n#|iv#|i'q#|i'j#|i'l#|i'n#|i'p#|i~O#o4PO~P0-^OQ$WO!r4fO!}#qO#p4pO#q4pO#r4zO#{4[O#e#|i#f#|i#g#|i#h#|i#i#|i#j#|i#k#|i#l#|i#m#|i#n#|i#}#|i$X#|i%T#|i%U#|i%i#|i%p#|i't#|i'u#|i'v#|iv#|i%X#|i%f#|i'q#|i'j#|i'l#|i'n#|i'p#|i~O#o4QO~P00TOQ$WO!r4gO!}#qO#p4qO#q4qO#r4{O#{4]O!a#|i#e#|i#f#|i#g#|i#h#|i#i#|i#j#|i#k#|i#l#|i#m#|i#n#|i#}#|i$X#|i%T#|i%U#|i%p#|i't#|i'u#|i'v#|i%i#|i~O#o4RO~P02hOQ$WO!r4iO!}#qO#p4sO#q4sO#r4}O#{4_O#e#|i#f#|i#g#|i#h#|i#i#|i#j#|i#k#|i#l#|i#m#|i#n#|i#}#|i$X#|i%T#|i%U#|i%p#|i't#|i'u#|i'v#|iv#|i%X#|i%f#|i~O#o4TO~P04fOQ$WO!r4jO!}#qO#p4tO#q4tO#r5OO#{4`Ov#|i|#|i#e#|i#f#|i#g#|i#h#|i#i#|i#j#|i#k#|i#l#|i#m#|i#n#|i#}#|i$X#|i%T#|i%U#|i%X#|i%Z#|i%f#|i%i#|i%p#|i'h#|i't#|i'u#|i'v#|i'j#|i'l#|i'n#|i'p#|i'q#|i~O#o4UO~P06gOQ$WO!r4kO!}#qO#p4uO#q4uO#r5PO#{4aO!a#|i#e#|i#f#|i#g#|i#h#|i#i#|i#j#|i#k#|i#l#|i#m#|i#n#|i#}#|i$X#|i%T#|i%U#|i%Z#|i%i#|i%p#|i'h#|i't#|i'u#|i'v#|i~O#o4VO~P09TOQ$WO!r4lO!}#qO#p4vO#q4vO#r5QO#{4bO|#|i#e#|i#f#|i#g#|i#h#|i#i#|i#j#|i#k#|i#l#|i#m#|i#n#|i#}#|i$X#|i%T#|i%U#|i%p#|i't#|i'u#|i'v#|i~O#o4WO~P0;XOQ$WO!r4mO!}#qO#p4wO#q4wO#r5RO#{4cOv#|i|#|i#e#|i#f#|i#g#|i#h#|i#i#|i#j#|i#k#|i#l#|i#m#|i#n#|i#}#|i$X#|i%T#|i%U#|i%i#|i%p#|i't#|i'u#|i'v#|i~O#o4XO~P0=SO#o#|i~P0*vO#o#|i~P0-^O#o#|i~P00TO#o#|i~P02hO#o#|i~P04fO#o#|i~P06gO#o#|i~P09TO#o#|i~P0;XO#o#|i~P0=SOQ$WO!}#qO#r4xOv#|i|#|i!r#|i#e#|i#f#|i#g#|i#h#|i#i#|i#j#|i#k#|i#l#|i#m#|i#n#|i#o#|i#{#|i#}#|i$X#|i%T#|i%U#|i%X#|i%f#|i%i#|i%p#|i't#|i'u#|i'v#|i'j#|i'l#|i'n#|i'p#|i'q#|i~O#p4nO#q4nO~P0@fOQ$WO!}#qO#r4yO!r#|i#e#|i#f#|i#g#|i#h#|i#i#|i#j#|i#k#|i#l#|i#m#|i#n#|i#o#|i#{#|i#}#|i$X#|i%S#|i%T#|i%U#|i%X#|i%Z#|i%f#|i%i#|i%p#|i'h#|i't#|i'u#|i'v#|i!d#|i!b#|i!n#|iv#|i'q#|i'j#|i'l#|i'n#|i'p#|i~O#p4oO#q4oO~P0B|OQ$WO!}#qO#r4zO!r#|i#e#|i#f#|i#g#|i#h#|i#i#|i#j#|i#k#|i#l#|i#m#|i#n#|i#o#|i#{#|i#}#|i$X#|i%T#|i%U#|i%i#|i%p#|i't#|i'u#|i'v#|iv#|i%X#|i%f#|i'q#|i'j#|i'l#|i'n#|i'p#|i~O#p4pO#q4pO~P0EsOQ$WO!}#qO#r4{O!a#|i!r#|i#e#|i#f#|i#g#|i#h#|i#i#|i#j#|i#k#|i#l#|i#m#|i#n#|i#o#|i#{#|i#}#|i$X#|i%T#|i%U#|i%p#|i't#|i'u#|i'v#|i%i#|i~O#p4qO#q4qO~P0HWOQ$WO!}#qO#r4}O!r#|i#e#|i#f#|i#g#|i#h#|i#i#|i#j#|i#k#|i#l#|i#m#|i#n#|i#o#|i#{#|i#}#|i$X#|i%T#|i%U#|i%p#|i't#|i'u#|i'v#|iv#|i%X#|i%f#|i~O#p4sO#q4sO~P0JUOQ$WO!}#qO#r5OOv#|i|#|i!r#|i#e#|i#f#|i#g#|i#h#|i#i#|i#j#|i#k#|i#l#|i#m#|i#n#|i#o#|i#{#|i#}#|i$X#|i%T#|i%U#|i%X#|i%Z#|i%f#|i%i#|i%p#|i'h#|i't#|i'u#|i'v#|i'j#|i'l#|i'n#|i'p#|i'q#|i~O#p4tO#q4tO~P0LVOQ$WO!}#qO#r5PO!a#|i!r#|i#e#|i#f#|i#g#|i#h#|i#i#|i#j#|i#k#|i#l#|i#m#|i#n#|i#o#|i#{#|i#}#|i$X#|i%T#|i%U#|i%Z#|i%i#|i%p#|i'h#|i't#|i'u#|i'v#|i~O#p4uO#q4uO~P0NsOQ$WO!}#qO#r5QO|#|i!r#|i#e#|i#f#|i#g#|i#h#|i#i#|i#j#|i#k#|i#l#|i#m#|i#n#|i#o#|i#{#|i#}#|i$X#|i%T#|i%U#|i%p#|i't#|i'u#|i'v#|i~O#p4vO#q4vO~P1!wOQ$WO!}#qO#r5ROv#|i|#|i!r#|i#e#|i#f#|i#g#|i#h#|i#i#|i#j#|i#k#|i#l#|i#m#|i#n#|i#o#|i#{#|i#}#|i$X#|i%T#|i%U#|i%i#|i%p#|i't#|i'u#|i'v#|i~O#p4wO#q4wO~P1$rO#p#|i#q#|i~P0@fO#r4yO~P&7vO#p#|i#q#|i~P0EsO#p#|i#q#|i~P0HWO#p#|i#q#|i~P0JUO#p#|i#q#|i~P0LVO#p#|i#q#|i~P0NsO#p#|i#q#|i~P1!wO#p#|i#q#|i~P1$rOQ$WO!r4dO!}#qO#f1kO#g1uO#h2[O#i2fO#j2pO#k2zO#l3UO#m3`O#n3tO#o4OO#p4nO#q4nO#r4xO#{4YO#}2QO$X5_O%TwO%U#rO%p!UO't!aO'u!bO'v!`O~Ov$VX|$VX#e$VX%X$VX%f$VX%i$VX%p$VX'j$VX'l$VX'n$VX'p$VX'q$VX~P1(nOQ$WO!r4eO!}#qO#f1lO#g1vO#h2]O#i2gO#j2qO#k2{O#l3VO#m3aO#n3uO#o4PO#p4oO#q4oO#r4yO#{4ZO#}2RO$X5`O%TwO%U#rO%p!UO't!aO'u!bO'v!`O~O#e$VX%S$VX%X$VX%Z$VX%f$VX%i$VX%p$VX'h$VX!d$VX!b$VX!n$VXv$VX'q$VX'j$VX'l$VX'n$VX'p$VX~P1+XOQ$WO!r4fO!}#qO#f1mO#g1wO#h2^O#i2hO#j2rO#k2|O#l3WO#m3bO#n3vO#o4QO#p4pO#q4pO#r4zO#{4[O#}2SO$X5aO%TwO%U#rO%p!UO't!aO'u!bO'v!`O~O#e$VX%i$VX%p$VXv$VX%X$VX%f$VX'q$VX'j$VX'l$VX'n$VX'p$VX~P1.ROQ$WO!r4gO!}#qO#f1nO#g1xO#h2_O#i2iO#j2sO#k2}O#l3XO#m3cO#n3wO#o4RO#p4qO#q4qO#r4{O#{4]O#}2TO$X5bO%TwO%U#rO%p!UO't!aO'u!bO'v!`O~O!a$VX#e$VX%p$VX%i$VX~P10iOQ$WO!r4iO!}#qO#f1pO#g1zO#h2aO#i2kO#j2uO#k3PO#l3ZO#m3eO#n3yO#o4TO#p4sO#q4sO#r4}O#{4_O#}2VO$X5dO%TwO%U#rO%p!UO't!aO'u!bO'v!`O~O#e$VX%p$VXv$VX%X$VX%f$VX~P12jOQ$WO!r4jO!}#qO#f1qO#g1{O#h2bO#i2lO#j2vO#k3QO#l3[O#m3fO#n3zO#o4UO#p4tO#q4tO#r5OO#{4`O#}2WO$X5eO%TwO%U#rO%p!UO't!aO'u!bO'v!`O~Ov$VX|$VX#e$VX%X$VX%Z$VX%f$VX%i$VX%p$VX'h$VX'j$VX'l$VX'n$VX'p$VX'q$VX~P14nOQ$WO!r4kO!}#qO#f1rO#g1|O#h2cO#i2mO#j2wO#k3RO#l3]O#m3gO#n3{O#o4VO#p4uO#q4uO#r5PO#{4aO#}2XO$X5fO%TwO%U#rO%p!UO't!aO'u!bO'v!`O~O!a$VX#e$VX%Z$VX%i$VX%p$VX'h$VX~P17_OQ$WO!roP)HyP(RP*%T)Hs)Hs)Hs)HsPP)HsP)HsP*%a*%m*%m*%m*%m*%m*%m*%m*%m*%m*%m*%sP#NeP*&Q*&a$> Map Struct UnaryOperator Operator Operator WordOperator AtOperator Operator DocAtOperator Operator CaptureOperator Operator CaptureOperand Dot Operator Right Call Arguments DoBlock do AfterBlock after RescueBlock rescue CatchBlock catch ElseBlock else end FunctionDefinitionCall KernelCall Call Dot Right Identifier OperatorIdentifier Operator Operator Operator Operator Operator Operator Operator Operator Operator Operator Operator Operator Operator Operator String Charlist Call Dot Arguments Call MapContent OperatorIdentifier Operator BinaryOperator Operator WordOperator WordOperator WordOperator WordOperator Operator OperatorIdentifier WhenOperator Right PipeOperator Operator Right Call Arguments FunctionDefinitionCall KernelCall Call KernelCall Call AccessCall AnonymousFunction fn",maxTerm:323,nodeProps:[["closedBy",36,"interpolationEnd",75,">>"],["openedBy",37,"interpolationStart",76,"<<"]],propSources:[MG],skippedNodes:[0,24],repeatNodeCount:29,tokenData:"Eu~RyXY#rYZ#}]^$Spq#rqr$Yrs%^st%quv'_vw'vwx(fxy(yyz)Oz{)T{|)h|}*W}!O*]!O!P+O!P!Q+o!Q!R+|!R![/n![!]1e!]!^8b!^!_8g!_!`:d!`!a:z!a!b;d!b!cu!v!}T!c!}T#T#o>TT=bTXY=_YZ=_]^=_pq=_!O!P=qT=tTXY=qYZ=q]^=qpq=q!c!}>TT>YX!TTXY=_YZ=_]^=_pq=_!O!P=q!Q![>T!c!}>T#R#S>T#T#o>TV>|X!TT!hQXY=_YZ=_]^=_pq=_!O!P=q!Q![>T!c!}T#T#o>T~?nO!c~~?sX%d~O#O@`#O#P@e#P#i@`#i#j@o#j#l@`#l#mBa#m;'S@`;'S;=`CO<%lO@`Q@eOrQV@lPrQ#eT![!]$eQ@rS!Q![AO!c!iAO#T#ZAO#o#pAtQARR!Q![A[!c!iA[#T#ZA[QA_R!Q![Ah!c!iAh#T#ZAhQAkR!Q![@`!c!i@`#T#Z@`QAwR!Q![BQ!c!iBQ#T#ZBQQBTS!Q![BQ!c!iBQ#T#ZBQ#q#r@`QBdS!Q![Bp!c!iBp#T#ZBp#o#pAtQBuRrQ!Q![@`!c!i@`#T#Z@`QCRP;=`<%l@`~CZO!d~~C`Q!s~![!]$e#Q#RCf~CiP#Q#RCl~CqP#n~![!]$e~CyO!`~~DOO!g~~DTP!a~#q#r'pVD_R'PQ#gT![!]$e!`!aDh#p#qDpTDmP$XT![!]$eTDuQ#iT![!]$e#p#qD{TEQP#iT![!]$eVE[O!bRuS~EaQ&v~!`!a:X#r#sEg~EjP#r#sEm~ErP!s~![!]$e",tokenizers:[$G,XG,RG,EG,IG,TG,CG,_G,wG,SG,AG,0,1,2],topRules:{Source:[0,25]},dynamicPrecedences:{43:1,79:-1,150:-1},specialized:[{term:199,get:t=>UG[t]||-1},{term:200,get:t=>zG[t]||-1}],tokenPrec:42923});var O$=yi.define({name:"elixir",parser:p$.configure({props:[ai.add({"DoBlock AfterBlock ElseBlock CatchBlock RescueBlock":Rv(xi({except:/^\s*(after|else|catch|rescue|end)\b/})),AnonymousFunction:Rv(hn({closing:"end",align:!1})),Block:Rv(hn({closing:")",align:!1})),StabClause:xi(),List:hn({closing:"]",align:!1}),Tuple:hn({closing:"}",align:!1}),Bitstring:hn({closing:">>",align:!1}),Arguments:hn({closing:")",align:!1}),Map:hn({closing:"}",align:!1}),"String Charlist Sigil":Ip,BinaryOperator:xi(),Pair:xi()}),Ht.add({"DoBlock Block List Tuple Bitstring AnonymousFunction":jo,Map:jG})]}),languageData:{commentTokens:{line:"#"},closeBrackets:{brackets:["(","[","{","'",'"',"'''",'"""'],stringPrefixes:["~s","~S","~r","~R","~c","~C","~D","~N"]},indentOnInput:/^\s*([\}\]\)]|>>|after|else|catch|rescue|end)|.*->$/}});function Rv(t){return e=>{var i,r,n,o;let s=e.node.childBefore(e.pos);return((r=(i=e.node.lastChild)===null||i===void 0?void 0:i.type)===null||r===void 0?void 0:r.name)==="end"&&e.textAfter.endsWith("end")?e.baseIndentFor(e.node):((n=s==null?void 0:s.type)===null||n===void 0?void 0:n.name)==="StabClause"&&e.textAfter.endsWith("->")?e.baseIndentFor(s):((o=s==null?void 0:s.type)===null||o===void 0?void 0:o.name)==="StabClause"?e.baseIndentFor(s)+e.unit:t(e)}}function jG(t){let e=t.getChild("{"),i=t.getChild("}");return e&&i?{from:e.to,to:i.from}:null}var qG=t=>{let{state:e,dispatch:i}=t,r=ze(e),n=fn(e),o=!0,s=e.changeByRange(a=>{if(!a.empty||!O$.isActiveAt(e,a.from))return o=!1,{range:a};let l=r.resolve(a.from,-1),c=WG(l);if(c&&!BG(c)){let u=ll(e,c.from+1)||n,f=Vn(e,u),d=Vn(e,u-n),p=` ${f}`,g=` -${d}end`,x=a.from+p.length;return{range:J.cursor(x),changes:[{from:a.from,to:a.to,insert:p+g}]}}return o=!1,{range:a}});return o?(i(e.update(s,{scrollIntoView:!0,userEvent:"input"})),!0):!1};function WG(t){let e=t;return e&&e.type.name==="do"&&(e=e.parent),e&&e.type.name==="Operator"&&(e=e.parent),e&&(e.type.name==="StabClause"||e.type.name==="fn")&&(e=e.parent),e&&m$(e)?e:null}function m$(t){return t.type.name==="DoBlock"||t.type.name==="AnonymousFunction"}function BG(t){var e,i;let r=t;for(;r;){if(m$(r)&&((i=(e=r.lastChild)===null||e===void 0?void 0:e.type)===null||i===void 0?void 0:i.name)!=="end")return!1;r=r.parent}return!0}var ZG=[{key:"Enter",run:qG}];function g$(){let t=[Qt.high(Wt.of(ZG))];return new At(O$,t)}var b$=zt.of({name:"Elixir",support:g$()}),y$=zt.of({name:"Erlang",support:new At(_u.define(UA))}),x$=zt.of({name:"SQL",support:bA()}),v$=zt.of({name:"JSON",support:kA()}),w$=zt.of({name:"XML",support:$A()}),k$=zt.of({name:"CSS",support:tO()}),S$=zt.of({name:"HTML",support:nO()}),T$=zt.of({name:"JavaScript",support:iO()}),E$=zt.of({name:"Dockerfile",support:new At(_u.define(VA))}),VG=zt.of({name:"Markdown",support:rA({base:oO,codeLanguages:[b$,y$,x$,v$,w$,k$,S$,T$,E$]})}),mO=[b$,y$,x$,v$,w$,k$,S$,T$,E$,VG];function C$(t,{dark:e}){let i={sans:"Inter",mono:"JetBrains Mono, monospace"};return de.theme({"&":{color:t.text,backgroundColor:t.background,fontSize:"14px",fontFamily:i.mono,fontVariantLigatures:"none"},"&.cm-focused":{outline:"none"},".cm-scroller":{fontFamily:"inherit"},".cm-content":{caretColor:t.cursor,padding:"0"},"*":{"&::-webkit-scrollbar":{width:"8px",height:"8px"},"&::-webkit-scrollbar-thumb":{borderRadius:"4px",background:"transparent"},"&:hover::-webkit-scrollbar-thumb":{background:t.backgroundLightest},"&::-webkit-scrollbar-track":{background:"transparent"}},".cm-activeLine":{backgroundColor:"transparent"},"&.cm-focused:not(.cm-selecting) .cm-activeLine":{backgroundColor:t.activeLine},".cm-cursor, .cm-dropCursor":{borderLeft:"1px solid",borderRight:"1px solid",marginLeft:"-1px",marginRight:"-1px",borderColor:t.cursor},".cm-selectionBackground":{backgroundColor:t.inactiveSelectionBackground},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{backgroundColor:t.selectionBackground},".cm-selectionMatch":{backgroundColor:t.selectionMatchBackground},"&:not(.cm-focused) .cm-fat-cursor":{outline:"none !important"},".cm-gutters":{backgroundColor:t.background,color:t.gutterText,border:"none"},".cm-gutters .cm-activeLineGutter":{backgroundColor:"transparent"},"&.cm-focused:not(.cm-selecting) .cm-gutters .cm-activeLineGutter":{backgroundColor:t.activeLine},".cm-tooltip":{backgroundColor:t.backgroundLighter,boxShadow:"0 2px 6px 0 rgba(0, 0, 0, 0.2)",color:t.text,borderRadius:"8px",border:`1px solid ${t.border}`,"& .cm-tooltip-arrow::before":{borderTopColor:t.backgroundLighter,borderBottomColor:t.backgroundLighter}},".cm-panels":{backgroundColor:t.background,color:t.text,"&.cm-panels-top":{borderBottom:`2px solid ${t.separator}`},"&.cm-panels-bottom":{borderTop:`2px solid ${t.separator}`}},".cm-gutter.cm-lineNumbers":{"& .cm-gutterElement":{color:t.lineNumber,whiteSpace:"pre","&.cm-activeLineGutter":{color:t.lineNumberActive}}},".cm-gutter.cm-foldGutter":{"& .cm-gutterElement":{cursor:"pointer"},"&:not(:hover) .cm-gutterElement > .cm-gutterFoldMarker-open":{visibility:"hidden"}},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"unset",borderRadius:"2px","&:hover":{backgroundColor:t.selectionBackground}},".cm-searchMatch":{backgroundColor:t.searchMatchBackground,"&.cm-searchMatch-selected":{backgroundColor:t.searchMatchActiveBackground}},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:t.selectionBackground},".cm-tooltip.cm-tooltip-autocomplete":{padding:"4px",backgroundColor:t.backgroundLighter,color:t.text,"& > ul":{fontFamily:"inherit","& > li":{padding:"4px",borderRadius:"4px",display:"flex",alignItems:"center","&[aria-selected]":{background:"none",backgroundColor:t.backgroundLightest,color:"unset"},"& .cm-completionIcon":{lineHeight:"1","&:after":{fontVariantLigatures:"normal"},"&.cm-completionIcon-function:after":{content:"'\u0192'"},"&.cm-completionIcon-module:after":{content:"'m'"},"&.cm-completionIcon-struct:after":{content:"'\u2B58'"},"&.cm-completionIcon-interface:after":{content:"'*'"},"&.cm-completionIcon-type:after":{content:"'t'"},"&.cm-completionIcon-variable:after":{content:"'\u{1D465}'"},"&.cm-completionIcon-field:after":{content:"'\u2022'"},"&.cm-completionIcon-keyword:after":{content:"'\u26A1'"}}}},"& .cm-completionMatchedText":{textDecoration:"none",color:t.matchingText}},".cm-tooltip.cm-completionInfo":{borderRadius:"8px",backgroundColor:t.backgroundLighter,color:t.text,top:"0 !important",padding:"0","&.cm-completionInfo-right":{marginLeft:"4px"},"&.cm-completionInfo-left":{marginRight:"4px"},"& .cm-completionInfoDocs":{padding:"6px"}},".cm-tooltip .cm-hoverDocs":{maxWidth:"800px",maxHeight:"300px",overflowY:"auto",padding:"8px",display:"flex",flexDirection:"column",gap:"64px"},".cm-tooltip.cm-signatureHint":{"& .cm-signatureHintStepper":{borderColor:t.separator},"& .cm-signatureHintActiveArgument":{color:t.matchingText}},".cm-tooltip-lint":{display:"flex",flexDirection:"column",gap:"8px",maxWidth:"600px","& .cm-diagnostic":{display:"flex",border:"none",margin:"0","&::before":{content:"'\u279C'",fontVariantLigatures:"common-ligatures",fontSize:"1.5em",lineHeight:"1",whiteSpace:"nowrap",marginRight:"6px"},"&.cm-diagnostic-error::before":{color:"#be5046"},"&.cm-diagnostic-warning::before":{color:"#d19a66"}}},".cm-panel.cm-search":{display:"flex",alignItems:"center",flexWrap:"wrap",padding:"8px 8px 0 8px","& br":{content:'" "',display:"block",width:"100%"},"& .cm-textfield":{borderRadius:"4px",border:`1px solid ${t.border}`},"& .cm-button":{borderRadius:"4px",background:t.backgroundLightest,border:"none"},"& label:first-of-type":{marginLeft:"8px"},"& label":{display:"inline-flex",alignItems:"center",gap:"4px"},"& label input":{appearance:"none",border:`1px solid ${t.backgroundLightest}`,borderRadius:"4px",width:"18px",height:"18px","&:checked":{backgroundImage:`url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z'/%3e%3c/svg%3e")`,backgroundColor:t.backgroundLightest,borderColor:"transparent"}},'& button[name="close"]':{display:"none"}},".cm-markdown":{"&":{fontFamily:i.sans},"& p":{marginTop:"0.5rem",marginBottom:"0.5rem"},"& hr":{borderTop:`1px solid ${t.separator}`,marginTop:"0.5rem",marginBottom:"0.5rem",marginRight:"-6px",marginLeft:"-6px"},"& a":{borderBottom:`1px solid ${t.text}`},"& h2":{marginTop:"0.5rem",marginBottom:"0.5rem",fontSize:"1.125em",fontWeight:"600"},"& ul":{marginTop:"1rem",marginBottom:"1rem",marginLeft:"2rem",listStylePosition:"outside",listStyleType:"disc","& ul":{listStyleType:"circle","& ul":{listStyleType:"square"}}},"& li":{marginTop:"0.25rem",marginBottom:"0.25rem","& > ul, & > ol":{marginTop:"0",marginBottom:"0"}},"& ol":{marginTop:"1rem",marginBottom:"1rem",marginLeft:"2rem",listStylePosition:"outside",listStyleType:"decimal"},"& code":{background:t.selectionBackground,borderRadius:"3px"},"& pre":{marginTop:"0.5rem",marginBottom:"0.5rem","& code":{background:"transparent",whiteSpace:"pre-wrap"}},"& > :first-child":{marginTop:"0"},"& > :last-child":{marginBottom:"0"}}},{dark:e})}function _$({base:t,lightRed:e,blue:i,gray:r,green:n,purple:o,red:s,teal:a,peach:l,yellow:c}){return ol.define([{tag:_.keyword,color:o},{tag:_.null,color:i},{tag:_.bool,color:i},{tag:_.number,color:i},{tag:_.string,color:n},{tag:_.special(_.string),color:c},{tag:_.character,color:i},{tag:_.escape,color:i},{tag:_.atom,color:i},{tag:_.variableName,color:t},{tag:_.special(_.variableName),color:e},{tag:[_.function(_.variableName),_.function(_.propertyName)],color:i},{tag:_.namespace,color:a},{tag:_.operator,color:l},{tag:_.comment,color:r},{tag:[_.docString,_.docComment],color:r},{tag:[_.paren,_.squareBracket,_.brace,_.angleBracket,_.separator],color:t},{tag:_.special(_.brace),color:s},{tag:_.strong,fontWeight:"bold"},{tag:_.emphasis,fontStyle:"italic"},{tag:_.strikethrough,textDecoration:"line-through"},{tag:_.link,color:i},{tag:_.heading,color:e},{tag:_.monospace,color:n},{tag:_.propertyName,color:e},{tag:_.tagName,color:o},{tag:_.className,color:l}])}var YG=C$({text:"#c8ccd4",background:"#282c34",backgroundLighter:"#2f343e",backgroundLightest:"#454a56",border:"#363c46",cursor:"#73ade8",activeLine:"#2d323b",selectionBackground:"#394c5f",inactiveSelectionBackground:"#29333d",selectionMatchBackground:"#343f4d",gutterText:"#c8ccd4",lineNumber:"#60646c",lineNumberActive:"#c8ccd4",matchingText:"#73ade8",searchMatchBackground:"#4c6582",searchMatchActiveBackground:"#54789e",separator:"#464b57"},{dark:!0}),Iv=_$({base:"#c8ccd4",lightRed:"#e06c75",blue:"#61afef",gray:"#8c92a3",green:"#98c379",purple:"#c678dd",red:"#be5046",teal:"#56b6c2",peach:"#d19a66",yellow:"#e5c07b"}),P$=[YG,Uy(Iv)],FG=C$({text:"#383a41",background:"#fafafa",backgroundLighter:"#ebebec",backgroundLightest:"#cacaca",border:"#dfdfe0",cursor:"#5c79e2",activeLine:"#efeff0",selectionBackground:"#d4dbf4",inactiveSelectionBackground:"#ebeef9",selectionMatchBackground:"#d3d5e1",gutterText:"#383a41",lineNumber:"#b6b7b9",lineNumberActive:"#383a41",matchingText:"#73ade8",searchMatchBackground:"#bbc6f1",searchMatchActiveBackground:"#9daeec",separator:"#c9c9ca"},{dark:!1}),Lv=_$({base:"#304254",lightRed:"#e45649",blue:"#4078F2",gray:"#707177",green:"#50a14f",purple:"#a726a4",red:"#ca1243",teal:"#0084bc",peach:"#986801",yellow:"#c18401"}),Q$=[FG,Uy(Lv)];var M$=da(R$()),U$=da(L$()),Dv=da(N$());function wO(){return/(Mac|iPhone|iPod|iPad)/i.test(navigator.platform)}function Ko(t){return t.matches&&t.matches("input, textarea, [contenteditable]")}function Nv(t,e=0){let i=t.getBoundingClientRect();return i.bottom>=-e&&i.top<=window.innerHeight+e}function mn(t){return t.offsetParent===null}function z$(t){let e=null;return new Promise((i,r)=>{mn(t)?(e=new ResizeObserver(n=>{mn(t)||(e.disconnect(),i())}),e.observe(t)):i()})}function kO(t,{root:e=null,proximity:i=0}={}){let r=null;return{promise:new Promise((s,a)=>{HG(t,i)?s():(r=new IntersectionObserver(l=>{l[0].isIntersecting&&(r.disconnect(),r=null,s())},{root:e,rootMargin:`${i}px`}),r.observe(t))}),cancel:()=>{r&&r.disconnect()}}}function HG(t,e=0){return!mn(t)&&Nv(t,e)}function j$(t,e,i){return Math.min(Math.max(t,e),i)}function q$(t){let e=window.getComputedStyle(t),i=parseInt(e.lineHeight,10);if(Number.isNaN(i)){let r=t.cloneNode();r.innerHTML="
",t.appendChild(r);let n=r.clientHeight;r.innerHTML="

";let o=r.clientHeight;return t.removeChild(r),o-n}else return i}function W$(t){let e=window.getSelection(),i=document.createRange();i.selectNodeContents(t),e.removeAllRanges(),e.addRange(i)}function Hs(t){let{height:e}=t.getBoundingClientRect();e":">",'"':""","'":"'"};function nf(t){return(t||"").replace(/[&<>"']/g,e=>GG[e])}function K$(t){let e=atob(t),i=new Uint8Array(e.length),r=i.byteLength;for(let n=0;n{setTimeout(()=>e(),t)})}function eX(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}var Gt=class{constructor(){this.callbacks=[]}get event(){return this.addListener.bind(this)}addListener(e){return this.callbacks.push(e),{destroy:()=>{this.removeListener(e)}}}removeListener(e){let i=this.callbacks.indexOf(e);i!==-1&&this.callbacks.splice(i,1)}dispatch(...e){this.callbacks.forEach(i=>{i(...e)})}};var tX="settings",of={normal:14,large:16},KG={default:"default",emacs:"emacs",vim:"vim"},yl={default:"default",light:"light"},JG={editor_auto_completion:!0,editor_auto_signature:!0,editor_font_size:of.normal,editor_theme:yl.default,editor_markdown_word_wrap:!0,editor_mode:KG.default,custom_view_show_section:!0,custom_view_show_markdown:!0,custom_view_show_output:!0,custom_view_spotlight:!1},Mv=class{constructor(){bt(this,"_onChange",new Gt);this.settings=JG,this.loadSettings()}get(){return this.settings}update(e){let i=this.settings;this.settings=H(H({},this.settings),e),this._onChange.dispatch(this.settings,i),this.storeSettings()}getAndSubscribe(e){return e(this.settings),this._onChange.addListener(e)}loadSettings(){let e=cs(tX);e&&(Object.values(yl).includes(e.editor_theme)||delete e.editor_theme,this.settings=H(H({},this.settings),e))}storeSettings(){ka(tX,this.settings)}},Et=new Mv;function _O(t,e){let i=zt.matchLanguageName(mO,e);if(!i)return nf(t);let r=eK();zi.mount(window.document,r.module);let n=i.support.language.parser.parse(t),o="";return h_(t,n,r,(s,a)=>{o+=`${nf(s)}`},()=>{o+="
"}),o}function eK(){return Et.get().editor_theme==="light"?Lv:Iv}var sf=class{constructor(e){this.size=e,this.cache=new Map}get(e){if(this.cache.has(e)){let i=this.cache.get(e);return this.cache.delete(e),this.cache.set(e,i),i}else return}set(e,i){if(this.cache.has(e))this.cache.delete(e);else if(this.cache.size===this.size){let r=this.cache.keys().next().value;this.cache.delete(r)}this.cache.set(e,i)}};var tK=0,iK=()=>`mermaid-graph-${tK++}`,iX=!1,rK="5.15.4",rX=new sf(25);function nX(t){let e=SO(t),i=rX.get(e);return i?Promise.resolve(i):nK().then(r=>(oK(t),r.render(iK(),t).then(({svg:n})=>(rX.set(e,n),n)).catch(n=>`
Mermaid +${d}end`,x=a.from+p.length;return{range:J.cursor(x),changes:[{from:a.from,to:a.to,insert:p+g}]}}return o=!1,{range:a}});return o?(i(e.update(s,{scrollIntoView:!0,userEvent:"input"})),!0):!1};function WG(t){let e=t;return e&&e.type.name==="do"&&(e=e.parent),e&&e.type.name==="Operator"&&(e=e.parent),e&&(e.type.name==="StabClause"||e.type.name==="fn")&&(e=e.parent),e&&m$(e)?e:null}function m$(t){return t.type.name==="DoBlock"||t.type.name==="AnonymousFunction"}function BG(t){var e,i;let r=t;for(;r;){if(m$(r)&&((i=(e=r.lastChild)===null||e===void 0?void 0:e.type)===null||i===void 0?void 0:i.name)!=="end")return!1;r=r.parent}return!0}var ZG=[{key:"Enter",run:qG}];function g$(){let t=[Qt.high(Wt.of(ZG))];return new At(O$,t)}var b$=zt.of({name:"Elixir",support:g$()}),y$=zt.of({name:"Erlang",support:new At(_u.define(UA))}),x$=zt.of({name:"SQL",support:bA()}),v$=zt.of({name:"JSON",support:kA()}),w$=zt.of({name:"XML",support:$A()}),k$=zt.of({name:"CSS",support:tO()}),S$=zt.of({name:"HTML",support:nO()}),T$=zt.of({name:"JavaScript",support:iO()}),E$=zt.of({name:"Dockerfile",support:new At(_u.define(VA))}),VG=zt.of({name:"Markdown",support:rA({base:oO,codeLanguages:[b$,y$,x$,v$,w$,k$,S$,T$,E$]})}),mO=[b$,y$,x$,v$,w$,k$,S$,T$,E$,VG];function C$(t,{dark:e}){let i={sans:"Inter",mono:"JetBrains Mono, monospace"};return de.theme({"&":{color:t.text,backgroundColor:t.background,fontSize:"14px",fontFamily:i.mono},"&.cm-focused":{outline:"none"},".cm-scroller":{fontFamily:"inherit"},".cm-content":{caretColor:t.cursor,padding:"0"},"*":{"&::-webkit-scrollbar":{width:"8px",height:"8px"},"&::-webkit-scrollbar-thumb":{borderRadius:"4px",background:"transparent"},"&:hover::-webkit-scrollbar-thumb":{background:t.backgroundLightest},"&::-webkit-scrollbar-track":{background:"transparent"}},".cm-activeLine":{backgroundColor:"transparent"},"&.cm-focused:not(.cm-selecting) .cm-activeLine":{backgroundColor:t.activeLine},".cm-cursor, .cm-dropCursor":{borderLeft:"1px solid",borderRight:"1px solid",marginLeft:"-1px",marginRight:"-1px",borderColor:t.cursor},".cm-selectionBackground":{backgroundColor:t.inactiveSelectionBackground},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{backgroundColor:t.selectionBackground},".cm-selectionMatch":{backgroundColor:t.selectionMatchBackground},"&:not(.cm-focused) .cm-fat-cursor":{outline:"none !important"},".cm-gutters":{backgroundColor:t.background,color:t.gutterText,border:"none"},".cm-gutters .cm-activeLineGutter":{backgroundColor:"transparent"},"&.cm-focused:not(.cm-selecting) .cm-gutters .cm-activeLineGutter":{backgroundColor:t.activeLine},".cm-tooltip":{backgroundColor:t.backgroundLighter,boxShadow:"0 2px 6px 0 rgba(0, 0, 0, 0.2)",color:t.text,borderRadius:"8px",border:`1px solid ${t.border}`,"& .cm-tooltip-arrow::before":{borderTopColor:t.backgroundLighter,borderBottomColor:t.backgroundLighter}},".cm-panels":{backgroundColor:t.background,color:t.text,"&.cm-panels-top":{borderBottom:`2px solid ${t.separator}`},"&.cm-panels-bottom":{borderTop:`2px solid ${t.separator}`}},".cm-gutter.cm-lineNumbers":{"& .cm-gutterElement":{color:t.lineNumber,whiteSpace:"pre","&.cm-activeLineGutter":{color:t.lineNumberActive}}},".cm-gutter.cm-foldGutter":{"& .cm-gutterElement":{cursor:"pointer"},"&:not(:hover) .cm-gutterElement > .cm-gutterFoldMarker-open":{visibility:"hidden"}},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"unset",borderRadius:"2px","&:hover":{backgroundColor:t.selectionBackground}},".cm-searchMatch":{backgroundColor:t.searchMatchBackground,"&.cm-searchMatch-selected":{backgroundColor:t.searchMatchActiveBackground}},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:t.selectionBackground},".cm-tooltip.cm-tooltip-autocomplete":{padding:"4px",backgroundColor:t.backgroundLighter,color:t.text,"& > ul":{fontFamily:"inherit","& > li":{padding:"4px",borderRadius:"4px",display:"flex",alignItems:"center","&[aria-selected]":{background:"none",backgroundColor:t.backgroundLightest,color:"unset"},"& .cm-completionIcon":{lineHeight:"1","&:after":{fontVariantLigatures:"normal"},"&.cm-completionIcon-function:after":{content:"'\u0192'"},"&.cm-completionIcon-module:after":{content:"'m'"},"&.cm-completionIcon-struct:after":{content:"'\u2B58'"},"&.cm-completionIcon-interface:after":{content:"'*'"},"&.cm-completionIcon-type:after":{content:"'t'"},"&.cm-completionIcon-variable:after":{content:"'\u{1D465}'"},"&.cm-completionIcon-field:after":{content:"'\u2022'"},"&.cm-completionIcon-keyword:after":{content:"'\u26A1'"}}}},"& .cm-completionMatchedText":{textDecoration:"none",color:t.matchingText}},".cm-tooltip.cm-completionInfo":{borderRadius:"8px",backgroundColor:t.backgroundLighter,color:t.text,top:"0 !important",padding:"0","&.cm-completionInfo-right":{marginLeft:"4px"},"&.cm-completionInfo-left":{marginRight:"4px"},"& .cm-completionInfoDocs":{padding:"6px"}},".cm-tooltip .cm-hoverDocs":{maxWidth:"800px",maxHeight:"300px",overflowY:"auto",padding:"8px",display:"flex",flexDirection:"column",gap:"64px"},".cm-tooltip.cm-signatureHint":{"& .cm-signatureHintStepper":{borderColor:t.separator},"& .cm-signatureHintActiveArgument":{color:t.matchingText}},".cm-tooltip-lint":{display:"flex",flexDirection:"column",gap:"8px",maxWidth:"600px","& .cm-diagnostic":{display:"flex",border:"none",margin:"0","&::before":{content:"'\u279C'",fontVariantLigatures:"common-ligatures",fontSize:"1.5em",lineHeight:"1",whiteSpace:"nowrap",marginRight:"6px"},"&.cm-diagnostic-error::before":{color:"#be5046"},"&.cm-diagnostic-warning::before":{color:"#d19a66"}}},".cm-panel.cm-search":{display:"flex",alignItems:"center",flexWrap:"wrap",padding:"8px 8px 0 8px","& br":{content:'" "',display:"block",width:"100%"},"& .cm-textfield":{borderRadius:"4px",border:`1px solid ${t.border}`},"& .cm-button":{borderRadius:"4px",background:t.backgroundLightest,border:"none"},"& label:first-of-type":{marginLeft:"8px"},"& label":{display:"inline-flex",alignItems:"center",gap:"4px"},"& label input":{appearance:"none",border:`1px solid ${t.backgroundLightest}`,borderRadius:"4px",width:"18px",height:"18px","&:checked":{backgroundImage:`url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z'/%3e%3c/svg%3e")`,backgroundColor:t.backgroundLightest,borderColor:"transparent"}},'& button[name="close"]':{display:"none"}},".cm-markdown":{"&":{fontFamily:i.sans},"& p":{marginTop:"0.5rem",marginBottom:"0.5rem"},"& hr":{borderTop:`1px solid ${t.separator}`,marginTop:"0.5rem",marginBottom:"0.5rem",marginRight:"-6px",marginLeft:"-6px"},"& a":{borderBottom:`1px solid ${t.text}`},"& h2":{marginTop:"0.5rem",marginBottom:"0.5rem",fontSize:"1.125em",fontWeight:"600"},"& ul":{marginTop:"1rem",marginBottom:"1rem",marginLeft:"2rem",listStylePosition:"outside",listStyleType:"disc","& ul":{listStyleType:"circle","& ul":{listStyleType:"square"}}},"& li":{marginTop:"0.25rem",marginBottom:"0.25rem","& > ul, & > ol":{marginTop:"0",marginBottom:"0"}},"& ol":{marginTop:"1rem",marginBottom:"1rem",marginLeft:"2rem",listStylePosition:"outside",listStyleType:"decimal"},"& code":{background:t.selectionBackground,borderRadius:"3px"},"& pre":{marginTop:"0.5rem",marginBottom:"0.5rem","& code":{background:"transparent",whiteSpace:"pre-wrap"}},"& > :first-child":{marginTop:"0"},"& > :last-child":{marginBottom:"0"}}},{dark:e})}function _$({base:t,lightRed:e,blue:i,gray:r,green:n,purple:o,red:s,teal:a,peach:l,yellow:c}){return ol.define([{tag:_.keyword,color:o},{tag:_.null,color:i},{tag:_.bool,color:i},{tag:_.number,color:i},{tag:_.string,color:n},{tag:_.special(_.string),color:c},{tag:_.character,color:i},{tag:_.escape,color:i},{tag:_.atom,color:i},{tag:_.variableName,color:t},{tag:_.special(_.variableName),color:e},{tag:[_.function(_.variableName),_.function(_.propertyName)],color:i},{tag:_.namespace,color:a},{tag:_.operator,color:l},{tag:_.comment,color:r},{tag:[_.docString,_.docComment],color:r},{tag:[_.paren,_.squareBracket,_.brace,_.angleBracket,_.separator],color:t},{tag:_.special(_.brace),color:s},{tag:_.strong,fontWeight:"bold"},{tag:_.emphasis,fontStyle:"italic"},{tag:_.strikethrough,textDecoration:"line-through"},{tag:_.link,color:i},{tag:_.heading,color:e},{tag:_.monospace,color:n},{tag:_.propertyName,color:e},{tag:_.tagName,color:o},{tag:_.className,color:l}])}var YG=C$({text:"#c8ccd4",background:"#282c34",backgroundLighter:"#2f343e",backgroundLightest:"#454a56",border:"#363c46",cursor:"#73ade8",activeLine:"#2d323b",selectionBackground:"#394c5f",inactiveSelectionBackground:"#29333d",selectionMatchBackground:"#343f4d",gutterText:"#c8ccd4",lineNumber:"#60646c",lineNumberActive:"#c8ccd4",matchingText:"#73ade8",searchMatchBackground:"#4c6582",searchMatchActiveBackground:"#54789e",separator:"#464b57"},{dark:!0}),Iv=_$({base:"#c8ccd4",lightRed:"#e06c75",blue:"#61afef",gray:"#8c92a3",green:"#98c379",purple:"#c678dd",red:"#be5046",teal:"#56b6c2",peach:"#d19a66",yellow:"#e5c07b"}),P$=[YG,Uy(Iv)],FG=C$({text:"#383a41",background:"#fafafa",backgroundLighter:"#ebebec",backgroundLightest:"#cacaca",border:"#dfdfe0",cursor:"#5c79e2",activeLine:"#efeff0",selectionBackground:"#d4dbf4",inactiveSelectionBackground:"#ebeef9",selectionMatchBackground:"#d3d5e1",gutterText:"#383a41",lineNumber:"#b6b7b9",lineNumberActive:"#383a41",matchingText:"#73ade8",searchMatchBackground:"#bbc6f1",searchMatchActiveBackground:"#9daeec",separator:"#c9c9ca"},{dark:!1}),Lv=_$({base:"#304254",lightRed:"#e45649",blue:"#4078F2",gray:"#707177",green:"#50a14f",purple:"#a726a4",red:"#ca1243",teal:"#0084bc",peach:"#986801",yellow:"#c18401"}),Q$=[FG,Uy(Lv)];var M$=da(R$()),U$=da(L$()),Dv=da(N$());function wO(){return/(Mac|iPhone|iPod|iPad)/i.test(navigator.platform)}function Ko(t){return t.matches&&t.matches("input, textarea, [contenteditable]")}function Nv(t,e=0){let i=t.getBoundingClientRect();return i.bottom>=-e&&i.top<=window.innerHeight+e}function mn(t){return t.offsetParent===null}function z$(t){let e=null;return new Promise((i,r)=>{mn(t)?(e=new ResizeObserver(n=>{mn(t)||(e.disconnect(),i())}),e.observe(t)):i()})}function kO(t,{root:e=null,proximity:i=0}={}){let r=null;return{promise:new Promise((s,a)=>{HG(t,i)?s():(r=new IntersectionObserver(l=>{l[0].isIntersecting&&(r.disconnect(),r=null,s())},{root:e,rootMargin:`${i}px`}),r.observe(t))}),cancel:()=>{r&&r.disconnect()}}}function HG(t,e=0){return!mn(t)&&Nv(t,e)}function j$(t,e,i){return Math.min(Math.max(t,e),i)}function q$(t){let e=window.getComputedStyle(t),i=parseInt(e.lineHeight,10);if(Number.isNaN(i)){let r=t.cloneNode();r.innerHTML="
",t.appendChild(r);let n=r.clientHeight;r.innerHTML="

";let o=r.clientHeight;return t.removeChild(r),o-n}else return i}function W$(t){let e=window.getSelection(),i=document.createRange();i.selectNodeContents(t),e.removeAllRanges(),e.addRange(i)}function Hs(t){let{height:e}=t.getBoundingClientRect();e":">",'"':""","'":"'"};function nf(t){return(t||"").replace(/[&<>"']/g,e=>GG[e])}function K$(t){let e=atob(t),i=new Uint8Array(e.length),r=i.byteLength;for(let n=0;n{setTimeout(()=>e(),t)})}function eX(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}var Gt=class{constructor(){this.callbacks=[]}get event(){return this.addListener.bind(this)}addListener(e){return this.callbacks.push(e),{destroy:()=>{this.removeListener(e)}}}removeListener(e){let i=this.callbacks.indexOf(e);i!==-1&&this.callbacks.splice(i,1)}dispatch(...e){this.callbacks.forEach(i=>{i(...e)})}};var tX="settings",of={normal:14,large:16},KG={default:"default",emacs:"emacs",vim:"vim"},yl={default:"default",light:"light"},JG={editor_auto_completion:!0,editor_auto_signature:!0,editor_font_size:of.normal,editor_theme:yl.default,editor_ligatures:!1,editor_markdown_word_wrap:!0,editor_mode:KG.default,custom_view_show_section:!0,custom_view_show_markdown:!0,custom_view_show_output:!0,custom_view_spotlight:!1},Mv=class{constructor(){bt(this,"_onChange",new Gt);this.settings=JG,this.loadSettings()}get(){return this.settings}update(e){let i=this.settings;this.settings=H(H({},this.settings),e),this._onChange.dispatch(this.settings,i),this.storeSettings()}getAndSubscribe(e){return e(this.settings),this._onChange.addListener(e)}loadSettings(){let e=cs(tX);e&&(Object.values(yl).includes(e.editor_theme)||delete e.editor_theme,this.settings=H(H({},this.settings),e))}storeSettings(){ka(tX,this.settings)}},kt=new Mv;function _O(t,e){let i=zt.matchLanguageName(mO,e);if(!i)return nf(t);let r=eK();zi.mount(window.document,r.module);let n=i.support.language.parser.parse(t),o="";return h_(t,n,r,(s,a)=>{o+=`${nf(s)}`},()=>{o+="
"}),o}function eK(){return kt.get().editor_theme==="light"?Lv:Iv}var sf=class{constructor(e){this.size=e,this.cache=new Map}get(e){if(this.cache.has(e)){let i=this.cache.get(e);return this.cache.delete(e),this.cache.set(e,i),i}else return}set(e,i){if(this.cache.has(e))this.cache.delete(e);else if(this.cache.size===this.size){let r=this.cache.keys().next().value;this.cache.delete(r)}this.cache.set(e,i)}};var tK=0,iK=()=>`mermaid-graph-${tK++}`,iX=!1,rK="5.15.4",rX=new sf(25);function nX(t){let e=SO(t),i=rX.get(e);return i?Promise.resolve(i):nK().then(r=>(oK(t),r.render(iK(),t).then(({svg:n})=>(rX.set(e,n),n)).catch(n=>`
Mermaid ${n.message}
`)))}function nK(){return import("./mermaid.core-3DX6XKRB.js").then(({default:t})=>(iX||(t.initialize({startOnLoad:!1}),iX=!0),t))}function oK(t){let e=`https://cdnjs.cloudflare.com/ajax/libs/font-awesome/${rK}/css/all.min.css`;if(t.includes("fa:")&&!document.querySelector(`link[href="${e}"]`)){let i=document.createElement("link");i.rel="stylesheet",i.type="text/css",i.href=e,document.head.appendChild(i)}}var Uv=class{constructor(e,i,{baseUrl:r=null,defaultCodeLanguage:n=null,emptyText:o="",allowedUriSchemes:s=[]}={}){this.container=e,this.content=i,this.baseUrl=r,this.defaultCodeLanguage=n,this.emptyText=o,this.allowedUriSchemes=s,this.render()}setContent(e){this.content=e,this.render()}render(){this.getHtml().then(e=>{let i=`
${e}
`;pS(this.container,i,{childrenOnly:!0})})}getHtml(){return mh().use(Ch).use(Dh).use(Nh).use(uK).use(aK,{highlight:_O,defaultLanguage:this.defaultCodeLanguage}).use(Vh,{allowDangerousHtml:!0}).use(yd).use(lK,{baseUrl:this.baseUrl}).use(kd,sK(this.allowedUriSchemes)).use(vd).use(fK).use(hK,{baseUrl:this.baseUrl}).use(Pd).process(this.content).then(e=>String(e)).catch(e=>{console.error(`Failed to render markdown, reason: ${e.message}`)}).then(e=>e||`
${this.emptyText}
`)}},Gs=Uv;function sK(t){return Ce(H({},Ir),{attributes:Ce(H({},Ir.attributes),{"*":[...Ir.attributes["*"]||[],"className","style"]}),protocols:Ce(H({},Ir.protocols),{href:[...Ir.protocols.href,...t]})})}function aK(t){return e=>{let i=[];return pi(e,"code",r=>{let n=r.lang||t.defaultLanguage;if(n){let o=function(a){r.type="html",r.value=`
${a}
`},s=t.highlight(r.value,n);if(s&&typeof s.then=="function"){let a=Promise.resolve(s).then(o);i.push(a)}else o(s)}}),Promise.all(i).then(()=>null)}}function lK(t){return e=>{t.baseUrl&&pi(e,"element",i=>{if(i.tagName==="a"&&i.properties){let r=i.properties.href;r&&!zv(r)&&!jv(r)&&!dK(r)&&(i.properties.href=oX(t.baseUrl,r))}if(i.tagName==="img"&&i.properties){let r=i.properties.src;r&&!zv(r)&&!jv(r)&&(i.properties.src=oX(t.baseUrl,r))}}),pi(e,"element",i=>{i.tagName==="a"&&i.properties&&i.properties.href&&(i.properties.href=i.properties.href.split("/").map(r=>r===".."?"__parent__":r).join("/"))})}}var cK=mh().use(wd,{fragment:!0});function uK(t){return e=>{pi(e,"code",(i,r,n)=>{i.lang==="mermaid"&&(i.type="html",i.value=`
${nf(i.value)}
- `)})}}function fK(t){return e=>{let i=[];return pi(e,"element",r=>{if((r.properties&&Array.isArray(r.properties.className)?r.properties.className:[]).includes("mermaid")){let o=function(l){let c=cK.parse(l);Mb(c,!0),r.children=c.children},s=Yc(r,{whitespace:"pre"}),a=nX(s).then(o);i.push(a)}}),Promise.all(i).then(()=>null)}}function hK(t){return e=>{pi(e,"element",i=>{if(i.properties&&i.properties.href){let r=i.properties.href;jv(r)?(i.properties["data-phx-link"]=t.baseUrl&&r.startsWith(t.baseUrl)?"patch":"redirect",i.properties["data-phx-link-state"]="push"):zv(r)&&(i.properties.target="_blank",i.properties.rel="noreferrer noopener")}})}}function zv(t){return/^(?:[a-z]+:)?\/\//i.test(t)}function dK(t){return t.startsWith("#")}function jv(t){return t.startsWith("/")||t.startsWith(window.location.origin)}function oX(t,e){return t.replace(/\/$/,"")+"/"+e}var xl=class{constructor(){this.subscribersByTopic={}}subscribe(e,i){return Array.isArray(this.subscribersByTopic[e])||(this.subscribersByTopic[e]=[]),this.subscribersByTopic[e].push(i),{destroy:()=>{this.unsubscribe(e,i)}}}unsubscribe(e,i){let r=this.subscribersByTopic[e].indexOf(i);r!==-1&&(this.subscribersByTopic[e].splice(r,1),this.subscribersByTopic[e].length===0&&delete this.subscribersByTopic[e])}broadcast(e,i){Array.isArray(this.subscribersByTopic[e])&&this.subscribersByTopic[e].forEach(r=>{r(i)})}},Kt=new xl;var sX=t=>typeof t=="object"&&t!=null&&t.nodeType===1,aX=(t,e)=>(!e||t!=="hidden")&&t!=="visible"&&t!=="clip",qv=(t,e)=>{if(t.clientHeight{let n=(o=>{if(!o.ownerDocument||!o.ownerDocument.defaultView)return null;try{return o.ownerDocument.defaultView.frameElement}catch(s){return null}})(r);return!!n&&(n.clientHeightoe||o>t&&s=e&&a>=i?o-t-r:s>e&&ai?s-e+n:0,pK=t=>{let e=t.parentElement;return e==null?t.getRootNode().host||null:e},Wv=(t,e)=>{var i,r,n,o;if(typeof document=="undefined")return[];let{scrollMode:s,block:a,inline:l,boundary:c,skipOverflowHiddenElements:u}=e,f=typeof c=="function"?c:ue=>ue!==c;if(!sX(t))throw new TypeError("Invalid target");let d=document.scrollingElement||document.documentElement,p=[],g=t;for(;sX(g)&&f(g);){if(g=pK(g),g===d){p.push(g);break}g!=null&&g===document.body&&qv(g)&&!qv(document.documentElement)||g!=null&&qv(g,u)&&p.push(g)}let x=(r=(i=window.visualViewport)==null?void 0:i.width)!=null?r:innerWidth,w=(o=(n=window.visualViewport)==null?void 0:n.height)!=null?o:innerHeight,{scrollX:S,scrollY:T}=window,{height:A,width:I,top:D,right:C,bottom:j,left:se}=t.getBoundingClientRect(),F=a==="start"||a==="nearest"?D:a==="end"?j:D+A/2,U=l==="center"?se+I/2:l==="end"?C:se,ae=[];for(let ue=0;ue=0&&se>=0&&j<=w&&C<=x&&D>=ve&&j<=le&&se>=V&&C<=q)return ae;let E=getComputedStyle(ie),B=parseInt(E.borderLeftWidth,10),re=parseInt(E.borderTopWidth,10),L=parseInt(E.borderRightWidth,10),Ue=parseInt(E.borderBottomWidth,10),Be=0,Ze=0,$t="offsetWidth"in ie?ie.offsetWidth-ie.clientWidth-B-L:0,Xe="offsetHeight"in ie?ie.offsetHeight-ie.clientHeight-re-Ue:0,Ct="offsetWidth"in ie?ie.offsetWidth===0?0:me/ie.offsetWidth:0,_t="offsetHeight"in ie?ie.offsetHeight===0?0:he/ie.offsetHeight:0;if(d===ie)Be=a==="start"?F:a==="end"?F-w:a==="nearest"?PO(T,T+w,w,re,Ue,T+F,T+F+A,A):F-w/2,Ze=l==="start"?U:l==="center"?U-x/2:l==="end"?U-x:PO(S,S+x,x,B,L,S+U,S+U+I,I),Be=Math.max(0,Be+T),Ze=Math.max(0,Ze+S);else{Be=a==="start"?F-ve-re:a==="end"?F-le+Ue+Xe:a==="nearest"?PO(ve,le,he,re,Ue+Xe,F,F+A,A):F-(ve+he/2)+Xe/2,Ze=l==="start"?U-V-B:l==="center"?U-(V+me/2)+$t/2:l==="end"?U-q+L+$t:PO(V,q,me,B,L+$t,U,U+I,I);let{scrollLeft:cr,scrollTop:ur}=ie;Be=Math.max(0,Math.min(ur+Be/_t,ie.scrollHeight-he/_t+Xe)),Ze=Math.max(0,Math.min(cr+Ze/Ct,ie.scrollWidth-me/Ct+$t)),F+=ur-Be,U+=cr-Ze}ae.push({el:ie,top:Be,left:Ze})}return ae};var OK=t=>t===!1?{block:"end",inline:"nearest"}:(e=>e===Object(e)&&Object.keys(e).length!==0)(t)?t:{block:"start",inline:"nearest"};function QO(t,e){if(!t.isConnected||!(n=>{let o=n;for(;o&&o.parentNode;){if(o.parentNode===document)return!0;o=o.parentNode instanceof ShadowRoot?o.parentNode.host:o.parentNode}return!1})(t))return;let i=(n=>{let o=window.getComputedStyle(n);return{top:parseFloat(o.scrollMarginTop)||0,right:parseFloat(o.scrollMarginRight)||0,bottom:parseFloat(o.scrollMarginBottom)||0,left:parseFloat(o.scrollMarginLeft)||0}})(t);if((n=>typeof n=="object"&&typeof n.behavior=="function")(e))return e.behavior(Wv(t,e));let r=typeof e=="boolean"||e==null?void 0:e.behavior;for(let{el:n,top:o,left:s}of Wv(t,OK(e))){let a=o-i.top+i.bottom,l=s-i.left+i.right;n.scroll({top:a,left:l,behavior:r})}}function Ks(t){return["code","smart","setup"].includes(t)}function lX(t){return["markdown","code","setup"].includes(t)}var mK={mounted(){this.props=this.getProps(),this.isFocused=!1,this.insertMode=!1,this.liveEditors={},this.updateInsertModeAvailability(),["code","smart"].includes(this.props.type)&&this.el.querySelector("[data-el-amplify-outputs-button]").addEventListener("click",e=>{this.el.toggleAttribute("data-js-amplified")}),this.props.type==="smart"&&this.el.querySelector("[data-el-toggle-source-button]").addEventListener("click",e=>{this.el.toggleAttribute("data-js-source-visible"),this.updateInsertModeAvailability(),this.maybeFocusCurrentEditor()}),this.el.addEventListener("lb:cell:editor_created",t=>{let{tag:e,liveEditor:i}=t.detail;this.handleCellEditorCreated(e,i)}),this.el.addEventListener("lb:cell:editor_removed",t=>{let{tag:e}=t.detail;this.handleCellEditorRemoved(e)}),this.el.addEventListener("mouseenter",t=>{this.el.setAttribute("data-js-hover","")}),this.el.addEventListener("mouseleave",t=>{this.el.removeAttribute("data-js-hover")}),this.subscriptions=[Kt.subscribe("navigation",this.handleNavigationEvent.bind(this)),Kt.subscribe("cells",this.handleCellsEvent.bind(this)),Kt.subscribe(`cells:${this.props.cellId}`,this.handleCellEvent.bind(this))],this._handleViewportResize=this.handleViewportResize.bind(this),window.visualViewport.addEventListener("resize",this._handleViewportResize)},disconnected(){this.el.removeAttribute("id")},destroyed(){this.subscriptions.forEach(t=>t.destroy()),window.visualViewport.removeEventListener("resize",this._handleViewportResize)},updated(){let t=this.props;this.props=this.getProps(),this.props.evaluationDigest!==t.evaluationDigest&&this.updateChangeIndicator()},getProps(){return ht(this.el,["cell-id","type","session-path","evaluation-digest","smart-cell-js-view-ref","allowed-uri-schemes"])},handleNavigationEvent(t){t.type==="element_focused"?this.handleElementFocused(t.focusableId,t.scroll):t.type==="insert_mode_changed"&&this.handleInsertModeChanged(t.enabled)},handleCellsEvent(t){t.type==="cell_moved"&&this.handleCellMoved(t.cellId)},handleCellEvent(t){t.type==="dispatch_queue_evaluation"&&this.handleDispatchQueueEvaluation(t.dispatch)},handleElementFocused(t,e){this.props.cellId===t?(this.isFocused=!0,this.el.setAttribute("data-js-focused",""),e&&Hs(this.el)):this.isFocused&&(this.isFocused=!1,this.el.removeAttribute("data-js-focused"))},handleCellEditorCreated(t,e){if(this.liveEditors[t]=e,this.updateInsertModeAvailability(),e===this.currentEditor()&&this.maybeFocusCurrentEditor(),e.onBlur(()=>{this.isFocused&&this.insertMode&&this.currentEditor().focus()}),e.onFocus(()=>{(!this.isFocused||!this.insertMode)&&this.currentEditor().blur()}),t==="primary"){let i=e.getSource();if(this.el.toggleAttribute("data-js-empty",i===""),e.onChange(r=>{this.el.toggleAttribute("data-js-empty",r==="")}),this.props.type==="markdown"){let r=this.el.querySelector("[data-el-markdown-container]"),n=new Gs(r,i,{baseUrl:this.props.sessionPath,emptyText:"Empty markdown cell",allowedUriSchemes:this.props.allowedUriSchemes});e.onChange(o=>{n.setContent(o)})}Ks(this.props.type)&&(this.updateChangeIndicator(),e.onChange(r=>{this.updateChangeIndicator()}),this.handleEvent(`evaluation_finished:${this.props.cellId}`,({code_markers:r})=>{e.setCodeMarkers(r)}),this.handleEvent(`start_evaluation:${this.props.cellId}`,()=>{e.clearDoctests()}),this.handleEvent(`doctest_report:${this.props.cellId}`,r=>{e.updateDoctests([r])}),this.handleEvent("erase_outputs",()=>{e.setCodeMarkers([]),e.clearDoctests()}))}},handleCellEditorRemoved(t){delete this.liveEditors[t]},handleViewportResize(){this.isFocused&&this.scrollEditorCursorIntoViewIfNeeded()},currentEditor(){return this.liveEditors[this.currentEditorTag()]},currentEditorTag(){return this.props.type==="smart"?this.el.hasAttribute("data-js-source-visible")?"primary":"secondary":"primary"},updateInsertModeAvailability(){this.el.toggleAttribute("data-js-insert-mode-disabled",!this.currentEditor())},maybeFocusCurrentEditor(){this.isFocused&&this.insertMode&&this.currentEditor().focus()},updateChangeIndicator(){let t=this.el.querySelector("[data-el-cell-status]");if(t&&t.querySelector("[data-el-change-indicator]")&&this.props.evaluationDigest){let i=this.liveEditors.primary.getSource(),r=SO(i),n=this.props.evaluationDigest!==r;this.el.toggleAttribute("data-js-changed",n)}},handleInsertModeChanged(t){this.isFocused&&!this.insertMode&&t?(this.insertMode=t,this.currentEditor()&&(this.currentEditor().focus(),this.scrollEditorCursorIntoViewIfNeeded())):this.insertMode&&!t&&(this.insertMode=t,this.currentEditor()&&this.currentEditor().blur())},handleCellMoved(t){this.isFocused&&t===this.props.cellId&&Hs(this.el)},handleDispatchQueueEvaluation(t){this.props.type==="smart"&&this.props.smartCellJsViewRef?Kt.broadcast(`js_views:${this.props.smartCellJsViewRef}`,{type:"sync",callback:t}):t()},scrollEditorCursorIntoViewIfNeeded(){let t=this.currentEditor().getElementAtCursor();QO(t,{scrollMode:"if-needed",behavior:"smooth",block:"center"})}},cX=mK;var lf=t=>{let{state:e}=t,i=e.doc.lineAt(e.selection.main.from),r=Vv(t.state,i.from);return r.line?gK(t):r.block?bK(t):!1};function cf(t,e){return({state:i,dispatch:r})=>{if(i.readOnly)return!1;let n=t(e,i);return n?(r(i.update(n)),!0):!1}}var gK=cf(Yv,0),uX=cf(Yv,1),fX=cf(Yv,2),hX=cf(dX,0);var bK=cf((t,e)=>dX(t,e,xK(e)),0);function Vv(t,e){let i=t.languageDataAt("commentTokens",e);return i.length?i[0]:{}}var af=50;function yK(t,{open:e,close:i},r,n){let o=t.sliceDoc(r-af,r),s=t.sliceDoc(n,n+af),a=/\s*$/.exec(o)[0].length,l=/^\s*/.exec(s)[0].length,c=o.length-a;if(o.slice(c-e.length,c)==e&&s.slice(l,l+i.length)==i)return{open:{pos:r-a,margin:a&&1},close:{pos:n+l,margin:l&&1}};let u,f;n-r<=2*af?u=f=t.sliceDoc(r,n):(u=t.sliceDoc(r,r+af),f=t.sliceDoc(n-af,n));let d=/^\s*/.exec(u)[0].length,p=/\s*$/.exec(f)[0].length,g=f.length-p-i.length;return u.slice(d,d+e.length)==e&&f.slice(g,g+i.length)==i?{open:{pos:r+d+e.length,margin:/\s/.test(u.charAt(d+e.length))?1:0},close:{pos:n-p-i.length,margin:/\s/.test(f.charAt(g-1))?1:0}}:null}function xK(t){let e=[];for(let i of t.selection.ranges){let r=t.doc.lineAt(i.from),n=i.to<=r.to?r:t.doc.lineAt(i.to),o=e.length-1;o>=0&&e[o].to>r.from?e[o].to=n.to:e.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:n.to})}return e}function dX(t,e,i=e.selection.ranges){let r=i.map(o=>Vv(e,o.from).block);if(!r.every(o=>o))return null;let n=i.map((o,s)=>yK(e,r[s],o.from,o.to));if(t!=2&&!n.every(o=>o))return{changes:e.changes(i.map((o,s)=>n[s]?[]:[{from:o.from,insert:r[s].open+" "},{from:o.to,insert:" "+r[s].close}]))};if(t!=1&&n.some(o=>o)){let o=[];for(let s=0,a;sn&&(o==s||s>f.from)){n=f.from;let d=/^\s*/.exec(f.text)[0].length,p=d==f.length,g=f.text.slice(d,d+c.length)==c?d:-1;do.comment<0&&(!o.empty||o.single))){let o=[];for(let{line:a,token:l,indent:c,empty:u,single:f}of r)(f||!u)&&o.push({from:a.from+c,insert:l+" "});let s=e.changes(o);return{changes:s,selection:e.selection.map(s,1)}}else if(t!=1&&r.some(o=>o.comment>=0)){let o=[];for(let{line:s,comment:a,token:l}of r)if(a>=0){let c=s.from+a,u=c+l.length;s.text[u-s.from]==" "&&u++,o.push({from:c,to:u})}return{changes:o}}return null}var Zv=bi.define(),vK=bi.define(),wK=be.define(),pX=be.define({combine(t){return wt(t,{minDepth:100,newGroupDelay:500,joinToEvent:(e,i)=>i},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,i)=>(r,n)=>e(r,n)||i(r,n)})}}),OX=Fe.define({create(){return Js.empty},update(t,e){let i=e.state.facet(pX),r=e.annotation(Zv);if(r){let l=zr.fromTransaction(e,r.selection),c=r.side,u=c==0?t.undone:t.done;return l?u=$O(u,u.length,i.minDepth,l):u=yX(u,e.startState.selection),new Js(c==0?r.rest:u,c==0?u:r.rest)}let n=e.annotation(vK);if((n=="full"||n=="before")&&(t=t.isolate()),e.annotation(Tt.addToHistory)===!1)return e.changes.empty?t:t.addMapping(e.changes.desc);let o=zr.fromTransaction(e),s=e.annotation(Tt.time),a=e.annotation(Tt.userEvent);return o?t=t.addChanges(o,s,a,i,e):e.selection&&(t=t.addSelection(e.startState.selection,s,a,i.newGroupDelay)),(n=="full"||n=="after")&&(t=t.isolate()),t},toJSON(t){return{done:t.done.map(e=>e.toJSON()),undone:t.undone.map(e=>e.toJSON())}},fromJSON(t){return new Js(t.done.map(zr.fromJSON),t.undone.map(zr.fromJSON))}});function mX(t={}){return[OX,pX.of(t),de.domEventHandlers({beforeinput(e,i){let r=e.inputType=="historyUndo"?ea:e.inputType=="historyRedo"?Jo:null;return r?(e.preventDefault(),r(i)):!1}})]}function Fv(t,e){return function({state:i,dispatch:r}){if(!e&&i.readOnly)return!1;let n=i.field(OX,!1);if(!n)return!1;let o=n.pop(t,i,e);return o?(r(o),!0):!1}}var ea=Fv(0,!1),Jo=Fv(1,!1),gX=Fv(0,!0);var zr=class t{constructor(e,i,r,n,o){this.changes=e,this.effects=i,this.mapped=r,this.startSelection=n,this.selectionsAfter=o}setSelAfter(e){return new t(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,i,r;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(i=this.mapped)===null||i===void 0?void 0:i.toJSON(),startSelection:(r=this.startSelection)===null||r===void 0?void 0:r.toJSON(),selectionsAfter:this.selectionsAfter.map(n=>n.toJSON())}}static fromJSON(e){return new t(e.changes&&Qi.fromJSON(e.changes),[],e.mapped&&jn.fromJSON(e.mapped),e.startSelection&&J.fromJSON(e.startSelection),e.selectionsAfter.map(J.fromJSON))}static fromTransaction(e,i){let r=kr;for(let n of e.startState.facet(wK)){let o=n(e);o.length&&(r=r.concat(o))}return!r.length&&e.changes.empty?null:new t(e.changes.invert(e.startState.doc),r,void 0,i||e.startState.selection,kr)}static selection(e){return new t(void 0,kr,void 0,void 0,e)}};function $O(t,e,i,r){let n=e+1>i+20?e-i-1:0,o=t.slice(n,e);return o.push(r),o}function kK(t,e){let i=[],r=!1;return t.iterChangedRanges((n,o)=>i.push(n,o)),e.iterChangedRanges((n,o,s,a)=>{for(let l=0;l=c&&s<=u&&(r=!0)}}),r}function SK(t,e){return t.ranges.length==e.ranges.length&&t.ranges.filter((i,r)=>i.empty!=e.ranges[r].empty).length===0}function bX(t,e){return t.length?e.length?t.concat(e):t:e}var kr=[],TK=200;function yX(t,e){if(t.length){let i=t[t.length-1],r=i.selectionsAfter.slice(Math.max(0,i.selectionsAfter.length-TK));return r.length&&r[r.length-1].eq(e)?t:(r.push(e),$O(t,t.length-1,1e9,i.setSelAfter(r)))}else return[zr.selection([e])]}function EK(t){let e=t[t.length-1],i=t.slice();return i[t.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),i}function Bv(t,e){if(!t.length)return t;let i=t.length,r=kr;for(;i;){let n=CK(t[i-1],e,r);if(n.changes&&!n.changes.empty||n.effects.length){let o=t.slice(0,i);return o[i-1]=n,o}else e=n.mapped,i--,r=n.selectionsAfter}return r.length?[zr.selection(r)]:kr}function CK(t,e,i){let r=bX(t.selectionsAfter.length?t.selectionsAfter.map(a=>a.map(e)):kr,i);if(!t.changes)return zr.selection(r);let n=t.changes.map(e),o=e.mapDesc(t.changes,!0),s=t.mapped?t.mapped.composeDesc(o):o;return new zr(n,Se.mapEffects(t.effects,e),s,t.startSelection.map(o),r)}var _K=/^(input\.type|delete)($|\.)/,Js=class t{constructor(e,i,r=0,n=void 0){this.done=e,this.undone=i,this.prevTime=r,this.prevUserEvent=n}isolate(){return this.prevTime?new t(this.done,this.undone):this}addChanges(e,i,r,n,o){let s=this.done,a=s[s.length-1];return a&&a.changes&&!a.changes.empty&&e.changes&&(!r||_K.test(r))&&(!a.selectionsAfter.length&&i-this.prevTime0&&i-this.prevTimei.empty?t.moveByChar(i,e):XO(i,e))}function ts(t){return t.textDirectionAt(t.state.selection.main.head)==ot.LTR}var ff=t=>RO(t,!ts(t)),Hv=t=>RO(t,ts(t)),xX=t=>RO(t,!0),IO=t=>RO(t,!1);function vX(t,e){return ta(t,i=>i.empty?t.moveByGroup(i,e):XO(i,e))}var LO=t=>vX(t,!ts(t)),DO=t=>vX(t,ts(t));var awe=typeof Intl!="undefined"&&Intl.Segmenter?new Intl.Segmenter(void 0,{granularity:"word"}):null;function wX(t,e){return ta(t,i=>{if(!i.empty)return XO(i,e);let r=t.moveVertically(i,e);return r.head!=i.head?r:t.moveToLineBoundary(i,e)})}var hf=t=>wX(t,!1),df=t=>wX(t,!0);function kX(t){let e=t.scrollDOM.clientHeights.empty?t.moveVertically(s,e,i.height):XO(s,e));if(n.eq(r.selection))return!1;let o;if(i.selfScroll){let s=t.coordsAtPos(r.selection.main.head),a=t.scrollDOM.getBoundingClientRect(),l=a.top+i.marginTop,c=a.bottom-i.marginBottom;s&&s.top>l&&s.bottomSX(t,!1),wl=t=>SX(t,!0);function NO(t,e,i){let r=t.lineBlockAt(e.head),n=t.moveToLineBoundary(e,i);if(n.head==e.head&&n.head!=(i?r.to:r.from)&&(n=t.moveToLineBoundary(e,i,!1)),!i&&n.head==r.from&&r.length){let o=/^\s*/.exec(t.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;o&&e.head!=r.from+o&&(n=J.cursor(r.from+o))}return n}var pf=t=>ta(t,e=>NO(t,e,!0)),Of=t=>ta(t,e=>NO(t,e,!1));var MO=t=>ta(t,e=>J.cursor(t.lineBlockAt(e.head).from,1)),UO=t=>ta(t,e=>J.cursor(t.lineBlockAt(e.head).to,-1));function PK(t,e,i){let r=!1,n=uf(t.selection,o=>{let s=vr(t,o.head,-1)||vr(t,o.head,1)||o.head>0&&vr(t,o.head-1,1)||o.headPK(t,e,!1);function is(t,e){let i=uf(t.state.selection,r=>{let n=e(r);return J.range(r.anchor,n.head,n.goalColumn,n.bidiLevel||void 0)});return i.eq(t.state.selection)?!1:(t.dispatch(es(t.state,i)),!0)}function zO(t,e){return is(t,i=>t.moveByChar(i,e))}var Gv=t=>zO(t,!ts(t)),Kv=t=>zO(t,ts(t)),Jv=t=>zO(t,!0),ew=t=>zO(t,!1);function jO(t,e){return is(t,i=>t.moveByGroup(i,e))}var qO=t=>jO(t,!ts(t)),WO=t=>jO(t,ts(t)),EX=t=>jO(t,!0),CX=t=>jO(t,!1);function _X(t,e){return is(t,i=>t.moveVertically(i,e))}var kl=t=>_X(t,!1),Sl=t=>_X(t,!0);function PX(t,e){return is(t,i=>t.moveVertically(i,e,kX(t).height))}var mf=t=>PX(t,!1),ia=t=>PX(t,!0),tw=t=>is(t,e=>NO(t,e,!0)),iw=t=>is(t,e=>NO(t,e,!1));var gf=t=>is(t,e=>J.cursor(t.lineBlockAt(e.head).from)),bf=t=>is(t,e=>J.cursor(t.lineBlockAt(e.head).to)),yf=({state:t,dispatch:e})=>(e(es(t,{anchor:0})),!0),xf=({state:t,dispatch:e})=>(e(es(t,{anchor:t.doc.length})),!0),Tl=({state:t,dispatch:e})=>(e(es(t,{anchor:t.selection.main.anchor,head:0})),!0),El=({state:t,dispatch:e})=>(e(es(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0),BO=({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0),QX=({state:t,dispatch:e})=>{let i=YO(t).map(({from:r,to:n})=>J.range(r,Math.min(n+1,t.doc.length)));return e(t.update({selection:J.create(i),userEvent:"select"})),!0};function ZO(t,e){if(t.state.readOnly)return!1;let i="delete.selection",{state:r}=t,n=r.changeByRange(o=>{let{from:s,to:a}=o;if(s==a){let l=e(o);ls&&(i="delete.forward",l=AO(t,l,!0)),s=Math.min(s,l),a=Math.max(a,l)}else s=AO(t,s,!1),a=AO(t,a,!0);return s==a?{range:o}:{changes:{from:s,to:a},range:J.cursor(s,sn(t)))r.between(e,e,(n,o)=>{ne&&(e=i?o:n)});return e}var AX=(t,e,i)=>ZO(t,r=>{let n=r.from,{state:o}=t,s=o.doc.lineAt(n),a,l;if(i&&!e&&n>s.from&&nAX(t,!1,!0);var vf=t=>AX(t,!0,!1),$X=(t,e)=>ZO(t,i=>{let r=i.head,{state:n}=t,o=n.doc.lineAt(r),s=n.charCategorizer(r);for(let a=null;;){if(r==(e?o.to:o.from)){r==i.head&&o.number!=(e?n.doc.lines:1)&&(r+=e?1:-1);break}let l=Mt(o.text,r-o.from,e)+o.from,c=o.text.slice(Math.min(r,l)-o.from,Math.max(r,l)-o.from),u=s(c);if(a!=null&&u!=a)break;(c!=" "||r!=i.head)&&(a=u),r=l}return r}),rw=t=>$X(t,!1),XX=t=>$X(t,!0),nw=t=>ZO(t,e=>{let i=t.lineBlockAt(e.head).to;return e.headZO(t,e=>{let i=t.lineBlockAt(e.head).from;return e.head>i?i:Math.max(0,e.head-1)});var wf=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange(r=>({changes:{from:r.from,to:r.to,insert:He.of(["",""])},range:J.cursor(r.from)}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0},VO=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange(r=>{if(!r.empty||r.from==0||r.from==t.doc.length)return{range:r};let n=r.from,o=t.doc.lineAt(n),s=n==o.from?n-1:Mt(o.text,n-o.from,!1)+o.from,a=n==o.to?n+1:Mt(o.text,n-o.from,!0)+o.from;return{changes:{from:s,to:a,insert:t.doc.slice(n,a).append(t.doc.slice(s,n))},range:J.cursor(a)}});return i.changes.empty?!1:(e(t.update(i,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function YO(t){let e=[],i=-1;for(let r of t.selection.ranges){let n=t.doc.lineAt(r.from),o=t.doc.lineAt(r.to);if(!r.empty&&r.to==o.from&&(o=t.doc.lineAt(r.to-1)),i>=n.number){let s=e[e.length-1];s.to=o.to,s.ranges.push(r)}else e.push({from:n.from,to:o.to,ranges:[r]});i=o.number+1}return e}function IX(t,e,i){if(t.readOnly)return!1;let r=[],n=[];for(let o of YO(t)){if(i?o.to==t.doc.length:o.from==0)continue;let s=t.doc.lineAt(i?o.to+1:o.from-1),a=s.length+1;if(i){r.push({from:o.to,to:s.to},{from:o.from,insert:s.text+t.lineBreak});for(let l of o.ranges)n.push(J.range(Math.min(t.doc.length,l.anchor+a),Math.min(t.doc.length,l.head+a)))}else{r.push({from:s.from,to:o.from},{from:o.to,insert:t.lineBreak+s.text});for(let l of o.ranges)n.push(J.range(l.anchor-a,l.head-a))}}return r.length?(e(t.update({changes:r,scrollIntoView:!0,selection:J.create(n,t.selection.mainIndex),userEvent:"move.line"})),!0):!1}var LX=({state:t,dispatch:e})=>IX(t,e,!1),DX=({state:t,dispatch:e})=>IX(t,e,!0);function NX(t,e,i){if(t.readOnly)return!1;let r=[];for(let n of YO(t))i?r.push({from:n.from,insert:t.doc.slice(n.from,n.to)+t.lineBreak}):r.push({from:n.to,insert:t.lineBreak+t.doc.slice(n.from,n.to)});return e(t.update({changes:r,scrollIntoView:!0,userEvent:"input.copyline"})),!0}var MX=({state:t,dispatch:e})=>NX(t,e,!1),UX=({state:t,dispatch:e})=>NX(t,e,!0),zX=t=>{if(t.state.readOnly)return!1;let{state:e}=t,i=e.changes(YO(e).map(({from:n,to:o})=>(n>0?n--:o{let o;if(t.lineWrapping){let s=t.lineBlockAt(n.head),a=t.coordsAtPos(n.head,n.assoc||1);a&&(o=s.bottom+t.documentTop-a.bottom+t.defaultLineHeight/2)}return t.moveVertically(n,!0,o)}).map(i);return t.dispatch({changes:i,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0};function QK(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let i=ze(t).resolveInner(e),r=i.childBefore(e),n=i.childAfter(e),o;return r&&n&&r.to<=e&&n.from>=e&&(o=r.type.prop(Qe.closedBy))&&o.indexOf(n.name)>-1&&t.doc.lineAt(r.to).from==t.doc.lineAt(n.from).from&&!/\S/.test(t.sliceDoc(r.to,n.from))?{from:r.to,to:n.from}:null}var kf=AK(!1);function AK(t){return({state:e,dispatch:i})=>{if(e.readOnly)return!1;let r=e.changeByRange(n=>{let{from:o,to:s}=n,a=e.doc.lineAt(o),l=!t&&o==s&&QK(e,o);t&&(o=s=(s<=a.to?a:e.doc.lineAt(s)).to);let c=new Ls(e,{simulateBreak:o,simulateDoubleBreak:!!l}),u=ll(c,o);for(u==null&&(u=Ai(/^\s*/.exec(e.doc.lineAt(o).text)[0],e.tabSize));sa.from&&o{let n=[];for(let s=r.from;s<=r.to;){let a=t.doc.lineAt(s);a.number>i&&(r.empty||r.to>a.from)&&(e(a,n,r),i=a.number),s=a.to+1}let o=t.changes(n);return{changes:n,range:J.range(o.mapPos(r.anchor,1),o.mapPos(r.head,1))}})}var jX=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=Object.create(null),r=new Ls(t,{overrideIndentation:o=>{let s=i[o];return s==null?-1:s}}),n=ow(t,(o,s,a)=>{let l=ll(r,o.from);if(l==null)return;/\S/.test(o.text)||(l=0);let c=/^\s*/.exec(o.text)[0],u=Vn(t,l);(c!=u||a.fromt.readOnly?!1:(e(t.update(ow(t,(i,r)=>{r.push({from:i.from,insert:t.facet(Nr)})}),{userEvent:"input.indent"})),!0),Tf=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(ow(t,(i,r)=>{let n=/^\s*/.exec(i.text)[0];if(!n)return;let o=Ai(n,t.tabSize),s=0,a=Vn(t,Math.max(0,o-fn(t)));for(;st.normalize("NFKD"):t=>t,ns=class{constructor(e,i,r=0,n=e.length,o,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=o?a=>o(WX(a)):WX,this.query=this.normalize(i)}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 Nt(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 i=ru(e),r=this.bufferStart+this.bufferPos;this.bufferPos+=Pi(e);let n=this.normalize(i);for(let o=0,s=r;;o++){let a=n.charCodeAt(o),l=this.match(a,s,this.bufferPos+this.bufferStart);if(o==n.length-1){if(l)return this.value=l,this;break}s==r&&othis.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 i=this.matchPos<=this.to&&this.re.exec(this.curLine);if(i){let r=this.curLineStart+i.index,n=r+i[0].length;if(this.matchPos=JO(this.text,n+(r==n?1:0)),r==this.curLineStart+this.curLine.length&&this.nextLine(),(rthis.value.to)&&(!this.test||this.test(r,n,i)))return this.value={from:r,to:n,match:i},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length=r||n.to<=i){let a=new t(i,e.sliceString(i,r));return sw.set(e,a),a}if(n.from==i&&n.to==r)return n;let{text:o,from:s}=n;return s>i&&(o=e.sliceString(i,s)+o,s=i),n.to=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,i=this.re.exec(this.flat.text);if(i&&!i[0]&&i.index==e&&(this.re.lastIndex=e+1,i=this.re.exec(this.flat.text)),i){let r=this.flat.from+i.index,n=r+i[0].length;if((this.flat.to>=this.to||i.index+i[0].length<=this.flat.text.length-10)&&(!this.test||this.test(r,n,i)))return this.value={from:r,to:n,match:i},this.matchPos=JO(this.text,n+(r==n?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=GO.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}};typeof Symbol!="undefined"&&(Ql.prototype[Symbol.iterator]=KO.prototype[Symbol.iterator]=function(){return this});function XK(t){try{return new RegExp(t,hw),!0}catch(e){return!1}}function JO(t,e){if(e>=t.length)return e;let i=t.lineAt(e),r;for(;e=56320&&r<57344;)e++;return e}function aw(t){let e=String(t.state.doc.lineAt(t.state.selection.main.head).number),i=ct("input",{class:"cm-textfield",name:"line",value:e}),r=ct("form",{class:"cm-gotoLine",onkeydown:o=>{o.keyCode==27?(o.preventDefault(),t.dispatch({effects:em.of(!1)}),t.focus()):o.keyCode==13&&(o.preventDefault(),n())},onsubmit:o=>{o.preventDefault(),n()}},ct("label",t.state.phrase("Go to line"),": ",i)," ",ct("button",{class:"cm-button",type:"submit"},t.state.phrase("go")));function n(){let o=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(i.value);if(!o)return;let{state:s}=t,a=s.doc.lineAt(s.selection.main.head),[,l,c,u,f]=o,d=u?+u.slice(1):0,p=c?+c:a.number;if(c&&f){let w=p/100;l&&(w=w*(l=="-"?-1:1)+a.number/s.doc.lines),p=Math.round(s.doc.lines*w)}else c&&l&&(p=p*(l=="-"?-1:1)+a.number);let g=s.doc.line(Math.max(1,Math.min(s.doc.lines,p))),x=J.cursor(g.from+Math.max(0,Math.min(d,g.length)));t.dispatch({effects:[em.of(!1),de.scrollIntoView(x.from,{y:"center"})],selection:x}),t.focus()}return{dom:r}}var em=Se.define(),BX=Fe.define({create(){return!0},update(t,e){for(let i of e.effects)i.is(em)&&(t=i.value);return t},provide:t=>yr.from(t,e=>e?aw:null)}),GX=t=>{let e=Xs(t,aw);if(!e){let i=[em.of(!0)];t.state.field(BX,!1)==null&&i.push(Se.appendConfig.of([BX,RK])),t.dispatch({effects:i}),e=Xs(t,aw)}return e&&e.dom.querySelector("input").select(),!0},RK=de.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px","& label":{fontSize:"80%"}}}),IK={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},KX=be.define({combine(t){return wt(t,IK,{highlightWordAroundCursor:(e,i)=>e||i,minSelectionLength:Math.min,maxMatches:Math.min})}});function JX(t){let e=[UK,MK];return t&&e.push(KX.of(t)),e}var LK=we.mark({class:"cm-selectionMatch"}),DK=we.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function ZX(t,e,i,r){return(i==0||t(e.sliceDoc(i-1,i))!=dt.Word)&&(r==e.doc.length||t(e.sliceDoc(r,r+1))!=dt.Word)}function NK(t,e,i,r){return t(e.sliceDoc(i,i+1))==dt.Word&&t(e.sliceDoc(r-1,r))==dt.Word}var MK=Ye.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.selectionSet||t.docChanged||t.viewportChanged)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=t.state.facet(KX),{state:i}=t,r=i.selection;if(r.ranges.length>1)return we.none;let n=r.main,o,s=null;if(n.empty){if(!e.highlightWordAroundCursor)return we.none;let l=i.wordAt(n.head);if(!l)return we.none;s=i.charCategorizer(n.head),o=i.sliceDoc(l.from,l.to)}else{let l=n.to-n.from;if(l200)return we.none;if(e.wholeWords){if(o=i.sliceDoc(n.from,n.to),s=i.charCategorizer(n.head),!(ZX(s,i,n.from,n.to)&&NK(s,i,n.from,n.to)))return we.none}else if(o=i.sliceDoc(n.from,n.to),!o)return we.none}let a=[];for(let l of t.visibleRanges){let c=new ns(i.doc,o,l.from,l.to);for(;!c.next().done;){let{from:u,to:f}=c.value;if((!s||ZX(s,i,u,f))&&(n.empty&&u<=n.from&&f>=n.to?a.push(DK.range(u,f)):(u>=n.to||f<=n.from)&&a.push(LK.range(u,f)),a.length>e.maxMatches))return we.none}}return we.set(a)}},{decorations:t=>t.decorations}),UK=de.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),zK=({state:t,dispatch:e})=>{let{selection:i}=t,r=J.create(i.ranges.map(n=>t.wordAt(n.head)||J.cursor(n.head)),i.mainIndex);return r.eq(i)?!1:(e(t.update({selection:r})),!0)};function jK(t,e){let{main:i,ranges:r}=t.selection,n=t.wordAt(i.head),o=n&&n.from==i.from&&n.to==i.to;for(let s=!1,a=new ns(t.doc,e,r[r.length-1].to);;)if(a.next(),a.done){if(s)return null;a=new ns(t.doc,e,0,Math.max(0,r[r.length-1].from-1)),s=!0}else{if(s&&r.some(l=>l.from==a.value.from))continue;if(o){let l=t.wordAt(a.value.from);if(!l||l.from!=a.value.from||l.to!=a.value.to)continue}return a.value}}var e6=({state:t,dispatch:e})=>{let{ranges:i}=t.selection;if(i.some(o=>o.from===o.to))return zK({state:t,dispatch:e});let r=t.sliceDoc(i[0].from,i[0].to);if(t.selection.ranges.some(o=>t.sliceDoc(o.from,o.to)!=r))return!1;let n=jK(t,r);return n?(e(t.update({selection:t.selection.addRange(J.range(n.from,n.to),!1),effects:de.scrollIntoView(n.to)})),!0):!1},$l=be.define({combine(t){return wt(t,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new fw(e),scrollToMatch:e=>de.scrollIntoView(e)})}});var Al=class{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||XK(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(i,r)=>r=="n"?` -`:r=="r"?"\r":r=="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 cw(this):new lw(this)}getCursor(e,i=0,r){let n=e.doc?e:rt.create({doc:e});return r==null&&(r=n.doc.length),this.regexp?Pl(this,n,i,r):_l(this,n,i,r)}},tm=class{constructor(e){this.spec=e}};function _l(t,e,i,r){return new ns(e.doc,t.unquoted,i,r,t.caseSensitive?void 0:n=>n.toLowerCase(),t.wholeWord?qK(e.doc,e.charCategorizer(e.selection.main.head)):void 0)}function qK(t,e){return(i,r,n,o)=>((o>i||o+n.length=i)return null;n.push(r.value)}return n}highlight(e,i,r,n){let o=_l(this.spec,e,Math.max(0,i-this.spec.unquoted.length),Math.min(r+this.spec.unquoted.length,e.doc.length));for(;!o.next().done;)n(o.value.from,o.value.to)}};function Pl(t,e,i,r){return new Ql(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:t.wholeWord?WK(e.charCategorizer(e.selection.main.head)):void 0},i,r)}function im(t,e){return t.slice(Mt(t,e,!1),e)}function rm(t,e){return t.slice(e,Mt(t,e))}function WK(t){return(e,i,r)=>!r[0].length||(t(im(r.input,r.index))!=dt.Word||t(rm(r.input,r.index))!=dt.Word)&&(t(rm(r.input,r.index+r[0].length))!=dt.Word||t(im(r.input,r.index+r[0].length))!=dt.Word)}var cw=class extends tm{nextMatch(e,i,r){let n=Pl(this.spec,e,r,e.doc.length).next();return n.done&&(n=Pl(this.spec,e,0,i).next()),n.done?null:n.value}prevMatchInRange(e,i,r){for(let n=1;;n++){let o=Math.max(i,r-n*1e4),s=Pl(this.spec,e,o,r),a=null;for(;!s.next().done;)a=s.value;if(a&&(o==i||a.from>o+10))return a;if(o==i)return null}}prevMatch(e,i,r){return this.prevMatchInRange(e,0,i)||this.prevMatchInRange(e,r,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&\d+])/g,(i,r)=>r=="$"?"$":r=="&"?e.match[0]:r!="0"&&+r=i)return null;n.push(r.value)}return n}highlight(e,i,r,n){let o=Pl(this.spec,e,Math.max(0,i-250),Math.min(r+250,e.doc.length));for(;!o.next().done;)n(o.value.from,o.value.to)}},Kn=Se.define(),dw=Se.define(),rs=Fe.define({create(t){return new Ef(uw(t).create(),null)},update(t,e){for(let i of e.effects)i.is(Kn)?t=new Ef(i.value.create(),t.panel):i.is(dw)&&(t=new Ef(t.query,i.value?mw:null));return t},provide:t=>yr.from(t,e=>e.panel)});var Ef=class{constructor(e,i){this.query=e,this.panel=i}},BK=we.mark({class:"cm-searchMatch"}),ZK=we.mark({class:"cm-searchMatch cm-searchMatch-selected"}),VK=Ye.fromClass(class{constructor(t){this.view=t,this.decorations=this.highlight(t.state.field(rs))}update(t){let e=t.state.field(rs);(e!=t.startState.field(rs)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:t,panel:e}){if(!e||!t.spec.valid)return we.none;let{view:i}=this,r=new Ki;for(let n=0,o=i.visibleRanges,s=o.length;no[n+1].from-2*250;)l=o[++n].to;t.highlight(i.state,a,l,(c,u)=>{let f=i.state.selection.ranges.some(d=>d.from==c&&d.to==u);r.add(c,u,f?ZK:BK)})}return r.finish()}},{decorations:t=>t.decorations});function Cf(t){return e=>{let i=e.state.field(rs,!1);return i&&i.query.spec.valid?t(e,i):Xl(e)}}var VX=Cf((t,{query:e})=>{let{to:i}=t.state.selection.main,r=e.nextMatch(t.state,i,i);if(!r)return!1;let n=J.single(r.from,r.to),o=t.state.facet($l);return t.dispatch({selection:n,effects:[bw(t,r),o.scrollToMatch(n.main,t)],userEvent:"select.search"}),r6(t),!0}),YX=Cf((t,{query:e})=>{let{state:i}=t,{from:r}=i.selection.main,n=e.prevMatch(i,r,r);if(!n)return!1;let o=J.single(n.from,n.to),s=t.state.facet($l);return t.dispatch({selection:o,effects:[bw(t,n),s.scrollToMatch(o.main,t)],userEvent:"select.search"}),r6(t),!0}),pw=Cf((t,{query:e})=>{let i=e.matchAll(t.state,1e3);return!i||!i.length?!1:(t.dispatch({selection:J.create(i.map(r=>J.range(r.from,r.to))),userEvent:"select.search.matches"}),!0)}),t6=({state:t,dispatch:e})=>{let i=t.selection;if(i.ranges.length>1||i.main.empty)return!1;let{from:r,to:n}=i.main,o=[],s=0;for(let a=new ns(t.doc,t.sliceDoc(r,n));!a.next().done;){if(o.length>1e3)return!1;a.value.from==r&&(s=o.length),o.push(J.range(a.value.from,a.value.to))}return e(t.update({selection:J.create(o,s),userEvent:"select.search.matches"})),!0},FX=Cf((t,{query:e})=>{let{state:i}=t,{from:r,to:n}=i.selection.main;if(i.readOnly)return!1;let o=e.nextMatch(i,r,r);if(!o)return!1;let s=[],a,l,c=[];if(o.from==r&&o.to==n&&(l=i.toText(e.getReplacement(o)),s.push({from:o.from,to:o.to,insert:l}),o=e.nextMatch(i,o.from,o.to),c.push(de.announce.of(i.phrase("replaced match on line $",i.doc.lineAt(r).number)+"."))),o){let u=s.length==0||s[0].from>=o.to?0:o.to-o.from-l.length;a=J.single(o.from-u,o.to-u),c.push(bw(t,o)),c.push(i.facet($l).scrollToMatch(a.main,t))}return t.dispatch({changes:s,selection:a,effects:c,userEvent:"input.replace"}),!0}),Ow=Cf((t,{query:e})=>{if(t.state.readOnly)return!1;let i=e.matchAll(t.state,1e9).map(n=>{let{from:o,to:s}=n;return{from:o,to:s,insert:e.getReplacement(n)}});if(!i.length)return!1;let r=t.state.phrase("replaced $ matches",i.length)+".";return t.dispatch({changes:i,effects:de.announce.of(r),userEvent:"input.replace.all"}),!0});function mw(t){return t.state.facet($l).createPanel(t)}function uw(t,e){var i,r,n,o,s;let a=t.selection.main,l=a.empty||a.to>a.from+100?"":t.sliceDoc(a.from,a.to);if(e&&!l)return e;let c=t.facet($l);return new Al({search:((i=e==null?void 0:e.literal)!==null&&i!==void 0?i:c.literal)?l:l.replace(/\n/g,"\\n"),caseSensitive:(r=e==null?void 0:e.caseSensitive)!==null&&r!==void 0?r:c.caseSensitive,literal:(n=e==null?void 0:e.literal)!==null&&n!==void 0?n:c.literal,regexp:(o=e==null?void 0:e.regexp)!==null&&o!==void 0?o:c.regexp,wholeWord:(s=e==null?void 0:e.wholeWord)!==null&&s!==void 0?s:c.wholeWord})}function i6(t){let e=Xs(t,mw);return e&&e.dom.querySelector("[main-field]")}function r6(t){let e=i6(t);e&&e==t.root.activeElement&&e.select()}var Xl=t=>{let e=t.state.field(rs,!1);if(e&&e.panel){let i=i6(t);if(i&&i!=t.root.activeElement){let r=uw(t.state,e.query.spec);r.valid&&t.dispatch({effects:Kn.of(r)}),i.focus(),i.select()}}else t.dispatch({effects:[dw.of(!0),e?Kn.of(uw(t.state,e.query.spec)):Se.appendConfig.of(FK)]});return!0},gw=t=>{let e=t.state.field(rs,!1);if(!e||!e.panel)return!1;let i=Xs(t,mw);return i&&i.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:dw.of(!1)}),!0};var fw=class{constructor(e){this.view=e;let i=this.query=e.state.field(rs).query.spec;this.commit=this.commit.bind(this),this.searchField=ct("input",{value:i.search,placeholder:sr(e,"Find"),"aria-label":sr(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=ct("input",{value:i.replace,placeholder:sr(e,"Replace"),"aria-label":sr(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=ct("input",{type:"checkbox",name:"case",form:"",checked:i.caseSensitive,onchange:this.commit}),this.reField=ct("input",{type:"checkbox",name:"re",form:"",checked:i.regexp,onchange:this.commit}),this.wordField=ct("input",{type:"checkbox",name:"word",form:"",checked:i.wholeWord,onchange:this.commit});function r(n,o,s){return ct("button",{class:"cm-button",name:n,onclick:o,type:"button"},s)}this.dom=ct("div",{onkeydown:n=>this.keydown(n),class:"cm-search"},[this.searchField,r("next",()=>VX(e),[sr(e,"next")]),r("prev",()=>YX(e),[sr(e,"previous")]),r("select",()=>pw(e),[sr(e,"all")]),ct("label",null,[this.caseField,sr(e,"match case")]),ct("label",null,[this.reField,sr(e,"regexp")]),ct("label",null,[this.wordField,sr(e,"by word")]),...e.state.readOnly?[]:[ct("br"),this.replaceField,r("replace",()=>FX(e),[sr(e,"replace")]),r("replaceAll",()=>Ow(e),[sr(e,"replace all")])],ct("button",{name:"close",onclick:()=>gw(e),"aria-label":sr(e,"close"),type:"button"},["\xD7"])])}commit(){let e=new Al({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:Kn.of(e)}))}keydown(e){my(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?YX:VX)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),FX(this.view))}update(e){for(let i of e.transactions)for(let r of i.effects)r.is(Kn)&&!r.value.eq(this.query)&&this.setQuery(r.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($l).top}};function sr(t,e){return t.state.phrase(e)}var FO=30,HO=/[\s\.,:;?!]/;function bw(t,{from:e,to:i}){let r=t.state.doc.lineAt(e),n=t.state.doc.lineAt(i).to,o=Math.max(r.from,e-FO),s=Math.min(n,i+FO),a=t.state.sliceDoc(o,s);if(o!=r.from){for(let l=0;la.length-FO;l--)if(!HO.test(a[l-1])&&HO.test(a[l])){a=a.slice(0,l);break}}return de.announce.of(`${t.state.phrase("current match")}. ${a} ${t.state.phrase("on line")} ${r.number}.`)}var YK=de.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"}}),FK=[rs,Qt.low(VK),YK];var yw=class{constructor(e,i,r){this.from=e,this.to=i,this.diagnostic=r}},ra=class t{constructor(e,i,r){this.diagnostics=e,this.panel=i,this.selected=r}static init(e,i,r){let n=e,o=r.facet(kw).markerFilter;o&&(n=o(n,r));let s=we.set(n.map(a=>a.from==a.to||a.from==a.to-1&&r.doc.lineAt(a.from).to==a.from?we.widget({widget:new xw(a),diagnostic:a}).range(a.from):we.mark({attributes:{class:"cm-lintRange cm-lintRange-"+a.severity+(a.markClass?" "+a.markClass:"")},diagnostic:a,inclusive:!0}).range(a.from,a.to)),!0);return new t(s,i,Rl(s))}};function Rl(t,e=null,i=0){let r=null;return t.between(i,1e9,(n,o,{spec:s})=>{if(!(e&&s.diagnostic!=e))return r=new yw(n,o,s.diagnostic),!1}),r}function HK(t,e){let i=e.pos,r=e.end||i,n=t.state.facet(kw).hideOn(t,i,r);if(n!=null)return n;let o=t.startState.doc.lineAt(e.pos);return!!(t.effects.some(s=>s.is(vw))||t.changes.touchesRange(o.from,Math.max(o.to,r)))}function o6(t,e){return t.field(ar,!1)?e:e.concat(Se.appendConfig.of(iJ))}function s6(t,e){return{effects:o6(t,[vw.of(e)])}}var vw=Se.define(),ww=Se.define(),a6=Se.define(),ar=Fe.define({create(){return new ra(we.none,null,null)},update(t,e){if(e.docChanged){let i=t.diagnostics.map(e.changes),r=null;if(t.selected){let n=e.changes.mapPos(t.selected.from,1);r=Rl(i,t.selected.diagnostic,n)||Rl(i,null,n)}t=new ra(i,t.panel,r)}for(let i of e.effects)i.is(vw)?t=ra.init(i.value,t.panel,e.state):i.is(ww)?t=new ra(t.diagnostics,i.value?sm.open:null,t.selected):i.is(a6)&&(t=new ra(t.diagnostics,t.panel,i.value));return t},provide:t=>[yr.from(t,e=>e.panel),de.decorations.from(t,e=>e.diagnostics)]});var GK=we.mark({class:"cm-lintRange cm-lintRange-active",inclusive:!0});function KK(t,e,i){let{diagnostics:r}=t.state.field(ar),n=[],o=2e8,s=0;r.between(e-(i<0?1:0),e+(i>0?1:0),(l,c,{spec:u})=>{e>=l&&e<=c&&(l==c||(e>l||i>0)&&(ef6(t,i,!1)))}var l6=t=>{let e=t.state.field(ar,!1);(!e||!e.panel)&&t.dispatch({effects:o6(t.state,[ww.of(!0)])});let i=Xs(t,sm.open);return i&&i.dom.querySelector(".cm-panel-lint ul").focus(),!0},n6=t=>{let e=t.state.field(ar,!1);return!e||!e.panel?!1:(t.dispatch({effects:ww.of(!1)}),!0)},c6=t=>{let e=t.state.field(ar,!1);if(!e)return!1;let i=t.state.selection.main,r=e.diagnostics.iter(i.to+1);return!r.value&&(r=e.diagnostics.iter(0),!r.value||r.from==i.from&&r.to==i.to)?!1:(t.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0}),!0)};var kw=be.define({combine(t){return Object.assign({sources:t.map(e=>e.source).filter(e=>e!=null)},wt(t.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{needsRefresh:(e,i)=>e?i?r=>e(r)||i(r):e:i}))}});function u6(t){let e=[];if(t)e:for(let{name:i}of t){for(let r=0;ro.toLowerCase()==n.toLowerCase())){e.push(n);continue e}}e.push("")}return e}function f6(t,e,i){var r;let n=i?u6(e.actions):[];return ct("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},ct("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage(t):e.message),(r=e.actions)===null||r===void 0?void 0:r.map((o,s)=>{let a=!1,l=d=>{if(d.preventDefault(),a)return;a=!0;let p=Rl(t.state.field(ar).diagnostics,e);p&&o.apply(t,p.from,p.to)},{name:c}=o,u=n[s]?c.indexOf(n[s]):-1,f=u<0?c:[c.slice(0,u),ct("u",c.slice(u,u+1)),c.slice(u+1)];return ct("button",{type:"button",class:"cm-diagnosticAction",onclick:l,onmousedown:l,"aria-label":` Action: ${c}${u<0?"":` (access key "${n[s]})"`}.`},f)}),e.source&&ct("div",{class:"cm-diagnosticSource"},e.source))}var xw=class extends Ft{constructor(e){super(),this.diagnostic=e}eq(e){return e.diagnostic==this.diagnostic}toDOM(){return ct("span",{class:"cm-lintPoint cm-lintPoint-"+this.diagnostic.severity})}},om=class{constructor(e,i){this.diagnostic=i,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=f6(e,i,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}},sm=class t{constructor(e){this.view=e,this.items=[];let i=n=>{if(n.keyCode==27)n6(this.view),this.view.focus();else if(n.keyCode==38||n.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(n.keyCode==40||n.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(n.keyCode==36)this.moveSelection(0);else if(n.keyCode==35)this.moveSelection(this.items.length-1);else if(n.keyCode==13)this.view.focus();else if(n.keyCode>=65&&n.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:o}=this.items[this.selectedIndex],s=u6(o.actions);for(let a=0;a{for(let o=0;on6(this.view)},"\xD7")),this.update()}get selectedIndex(){let e=this.view.state.field(ar).selected;if(!e)return-1;for(let i=0;i{let c=-1,u;for(let f=r;fr&&(this.items.splice(r,c-r),n=!0)),i&&u.diagnostic==i.diagnostic?u.dom.hasAttribute("aria-selected")||(u.dom.setAttribute("aria-selected","true"),o=u):u.dom.hasAttribute("aria-selected")&&u.dom.removeAttribute("aria-selected"),r++});r({sel:o.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:s,panel:a})=>{let l=a.height/this.list.offsetHeight;s.topa.bottom&&(this.list.scrollTop+=(s.bottom-a.bottom)/l)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),n&&this.sync()}sync(){let e=this.list.firstChild;function i(){let r=e;e=r.nextSibling,r.remove()}for(let r of this.items)if(r.dom.parentNode==this.list){for(;e!=r.dom;)i();e=r.dom.nextSibling}else this.list.insertBefore(r.dom,e);for(;e;)i()}moveSelection(e){if(this.selectedIndex<0)return;let i=this.view.state.field(ar),r=Rl(i.diagnostics,this.items[e].diagnostic);r&&this.view.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0,effects:a6.of(r)})}static open(e){return new t(e)}};function eJ(t,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,${encodeURIComponent(t)}')`}function nm(t){return eJ(``,'width="6" height="3"')}var tJ=de.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:nm("#d11")},".cm-lintRange-warning":{backgroundImage:nm("orange")},".cm-lintRange-info":{backgroundImage:nm("#999")},".cm-lintRange-hint":{backgroundImage:nm("#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}}});var iJ=[ar,de.decorations.compute([ar],t=>{let{selected:e,panel:i}=t.field(ar);return!e||!i||e.from==e.to?we.none:we.set([GK.range(e.from,e.to)])}),Ep(KK,{hideOn:HK}),tJ];var h6=t=>e=>{let i=t==="down",r=e.state.selection;for(let n of r.ranges)r=r.addRange(e.moveVertically(n,i));return e.dispatch({selection:r}),!0},rJ=h6("up"),nJ=h6("down"),oJ=t=>{let e=null;for(let i of t.state.selection.ranges)if(!i.empty)for(let r=i.from;r<=i.to;){let n=t.state.doc.lineAt(r),o=Math.min(n.to,i.to);e?e=e.addRange(J.range(o,o)):e=J.single(o),r=n.to+1}return e?(t.dispatch({selection:e}),!0):!1},d6=[{key:"Ctrl-Space",run:Lu},{key:"Escape",run:rx},{key:"ArrowDown",run:Yn(!0)},{key:"ArrowUp",run:Yn(!1)},{key:"PageDown",run:Yn(!0,"page")},{key:"PageUp",run:Yn(!1,"page")},{key:"Enter",run:qp},{key:"Tab",run:qp},{key:"Mod-f",run:Xl,scope:"editor search-panel"},{key:"Escape",run:gw,scope:"editor search-panel"},{key:"Alt-Enter",run:pw,scope:"editor search-panel"},{key:"Mod-Alt-Enter",run:Ow,scope:"editor search-panel"},{key:"Ctrl-g",run:GX},{key:"Mod-d",run:e6,preventDefault:!0},{key:"Shift-Mod-l",run:t6},{key:"Enter",run:kf,shift:kf},{key:"ArrowLeft",run:ff,shift:Gv,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:LO,shift:qO},{key:"ArrowRight",run:Hv,shift:Kv,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:DO,shift:WO},{key:"ArrowUp",run:hf,shift:kl,preventDefault:!0},{key:"ArrowDown",run:df,shift:Sl,preventDefault:!0},{key:"Home",run:Of,shift:iw},{mac:"Cmd-ArrowLeft",run:Of,shift:iw},{key:"Mod-Home",run:yf,shift:Tl},{mac:"Cmd-ArrowUp",run:yf,shift:Tl},{key:"PageUp",run:vl,shift:mf},{mac:"Ctrl-ArrowUp",run:vl,shift:mf},{key:"PageDown",run:wl,shift:ia},{mac:"Ctrl-ArrowDown",run:wl,shift:ia},{key:"End",run:pf,shift:tw},{mac:"Cmd-ArrowRight",run:pf,shift:tw},{key:"Mod-Alt-ArrowUp",linux:"Shift-Alt-ArrowUp",run:rJ,preventDefault:!0},{key:"Mod-Alt-ArrowDown",linux:"Shift-Alt-ArrowDown",run:nJ,preventDefault:!0},{key:"Shift-Alt-i",run:oJ},{key:"Mod-End",run:xf,shift:El},{mac:"Cmd-ArrowDown",run:xf,shift:El},{key:"Mod-a",run:BO},{key:"Backspace",run:sP},{key:"Backspace",run:Cl,shift:Cl},{key:"Delete",run:vf},{key:"Mod-Backspace",mac:"Alt-Backspace",run:rw},{key:"Mod-Delete",mac:"Alt-Delete",run:XX},{mac:"Mod-Backspace",run:RX},{mac:"Mod-Delete",run:nw},{mac:"Ctrl-b",run:ff,shift:Gv,preventDefault:!0},{mac:"Ctrl-f",run:Hv,shift:Kv},{mac:"Ctrl-p",run:hf,shift:kl},{mac:"Ctrl-n",run:df,shift:Sl},{mac:"Ctrl-a",run:MO,shift:gf},{mac:"Ctrl-e",run:UO,shift:bf},{mac:"Ctrl-d",run:vf},{mac:"Ctrl-h",run:Cl},{mac:"Ctrl-k",run:nw},{mac:"Ctrl-Alt-h",run:rw},{mac:"Ctrl-o",run:wf},{mac:"Ctrl-t",run:VO},{mac:"Ctrl-v",run:wl},{mac:"Alt-v",run:vl},{key:"Shift-Mod-k",run:zX},{key:"Alt-ArrowDown",run:DX},{key:"Alt-ArrowUp",run:LX},{win:"Shift-Alt-ArrowDown",mac:"Shift-Alt-ArrowDown",run:UX},{win:"Shift-Alt-ArrowUp",mac:"Shift-Alt-ArrowUp",run:MX},{key:"Mod-l",run:QX,preventDefault:!0},{key:"Shift-Mod-\\",run:TX},{key:"Tab",run:Sf,shift:Tf,preventDefault:!0},{key:"Mod-[",run:Tf},{key:"Mod-]",run:Sf},{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:Dp},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:__},{key:"Mod-k Mod-0",run:Q_},{key:"Mod-k Mod-j",run:A_},{key:"Mod-k Mod-c",run:uX},{key:"Mod-k Mod-u",run:fX},{key:"Mod-/",run:lf},{key:"Shift-Alt-a",run:hX},{key:"Mod-z",run:ea,preventDefault:!0},{key:"Mod-y",run:Jo,preventDefault:!0},{key:"Mod-Shift-z",run:Jo,preventDefault:!0},{key:"Mod-u",run:gX,preventDefault:!0},{key:"Mod-Shift-m",run:l6},{key:"F8",run:c6}];function sJ(t){var e=t.Pos;function i(h,O,b){if(O.line===b.line&&O.ch>=b.ch-1){var y=h.getLine(O.line),v=y.charCodeAt(O.ch);55296<=v&&v<=55551&&(b.ch+=1)}return{start:O,end:b}}var r=[{keys:"",type:"keyToKey",toKeys:"h"},{keys:"",type:"keyToKey",toKeys:"l"},{keys:"",type:"keyToKey",toKeys:"k"},{keys:"",type:"keyToKey",toKeys:"j"},{keys:"g",type:"keyToKey",toKeys:"gk"},{keys:"g",type:"keyToKey",toKeys:"gj"},{keys:"",type:"keyToKey",toKeys:"l"},{keys:"",type:"keyToKey",toKeys:"h"},{keys:"",type:"keyToKey",toKeys:"x"},{keys:"",type:"keyToKey",toKeys:"W"},{keys:"",type:"keyToKey",toKeys:"B"},{keys:"",type:"keyToKey",toKeys:"w"},{keys:"",type:"keyToKey",toKeys:"b"},{keys:"",type:"keyToKey",toKeys:"j"},{keys:"",type:"keyToKey",toKeys:"k"},{keys:"",type:"keyToKey",toKeys:""},{keys:"",type:"keyToKey",toKeys:""},{keys:"",type:"keyToKey",toKeys:"",context:"insert"},{keys:"",type:"keyToKey",toKeys:"",context:"insert"},{keys:"",type:"keyToKey",toKeys:""},{keys:"",type:"keyToKey",toKeys:"",context:"insert"},{keys:"s",type:"keyToKey",toKeys:"cl",context:"normal"},{keys:"s",type:"keyToKey",toKeys:"c",context:"visual"},{keys:"S",type:"keyToKey",toKeys:"cc",context:"normal"},{keys:"S",type:"keyToKey",toKeys:"VdO",context:"visual"},{keys:"",type:"keyToKey",toKeys:"0"},{keys:"",type:"keyToKey",toKeys:"$"},{keys:"",type:"keyToKey",toKeys:""},{keys:"",type:"keyToKey",toKeys:""},{keys:"",type:"keyToKey",toKeys:"j^",context:"normal"},{keys:"",type:"keyToKey",toKeys:"i",context:"normal"},{keys:"",type:"action",action:"toggleOverwrite",context:"insert"},{keys:"H",type:"motion",motion:"moveToTopLine",motionArgs:{linewise:!0,toJumplist:!0}},{keys:"M",type:"motion",motion:"moveToMiddleLine",motionArgs:{linewise:!0,toJumplist:!0}},{keys:"L",type:"motion",motion:"moveToBottomLine",motionArgs:{linewise:!0,toJumplist:!0}},{keys:"h",type:"motion",motion:"moveByCharacters",motionArgs:{forward:!1}},{keys:"l",type:"motion",motion:"moveByCharacters",motionArgs:{forward:!0}},{keys:"j",type:"motion",motion:"moveByLines",motionArgs:{forward:!0,linewise:!0}},{keys:"k",type:"motion",motion:"moveByLines",motionArgs:{forward:!1,linewise:!0}},{keys:"gj",type:"motion",motion:"moveByDisplayLines",motionArgs:{forward:!0}},{keys:"gk",type:"motion",motion:"moveByDisplayLines",motionArgs:{forward:!1}},{keys:"w",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!1}},{keys:"W",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!1,bigWord:!0}},{keys:"e",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!0,inclusive:!0}},{keys:"E",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!0,bigWord:!0,inclusive:!0}},{keys:"b",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1}},{keys:"B",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1,bigWord:!0}},{keys:"ge",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!0,inclusive:!0}},{keys:"gE",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!0,bigWord:!0,inclusive:!0}},{keys:"{",type:"motion",motion:"moveByParagraph",motionArgs:{forward:!1,toJumplist:!0}},{keys:"}",type:"motion",motion:"moveByParagraph",motionArgs:{forward:!0,toJumplist:!0}},{keys:"(",type:"motion",motion:"moveBySentence",motionArgs:{forward:!1}},{keys:")",type:"motion",motion:"moveBySentence",motionArgs:{forward:!0}},{keys:"",type:"motion",motion:"moveByPage",motionArgs:{forward:!0}},{keys:"",type:"motion",motion:"moveByPage",motionArgs:{forward:!1}},{keys:"",type:"motion",motion:"moveByScroll",motionArgs:{forward:!0,explicitRepeat:!0}},{keys:"",type:"motion",motion:"moveByScroll",motionArgs:{forward:!1,explicitRepeat:!0}},{keys:"gg",type:"motion",motion:"moveToLineOrEdgeOfDocument",motionArgs:{forward:!1,explicitRepeat:!0,linewise:!0,toJumplist:!0}},{keys:"G",type:"motion",motion:"moveToLineOrEdgeOfDocument",motionArgs:{forward:!0,explicitRepeat:!0,linewise:!0,toJumplist:!0}},{keys:"g$",type:"motion",motion:"moveToEndOfDisplayLine"},{keys:"g^",type:"motion",motion:"moveToStartOfDisplayLine"},{keys:"g0",type:"motion",motion:"moveToStartOfDisplayLine"},{keys:"0",type:"motion",motion:"moveToStartOfLine"},{keys:"^",type:"motion",motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"+",type:"motion",motion:"moveByLines",motionArgs:{forward:!0,toFirstChar:!0}},{keys:"-",type:"motion",motion:"moveByLines",motionArgs:{forward:!1,toFirstChar:!0}},{keys:"_",type:"motion",motion:"moveByLines",motionArgs:{forward:!0,toFirstChar:!0,repeatOffset:-1}},{keys:"$",type:"motion",motion:"moveToEol",motionArgs:{inclusive:!0}},{keys:"%",type:"motion",motion:"moveToMatchedSymbol",motionArgs:{inclusive:!0,toJumplist:!0}},{keys:"f",type:"motion",motion:"moveToCharacter",motionArgs:{forward:!0,inclusive:!0}},{keys:"F",type:"motion",motion:"moveToCharacter",motionArgs:{forward:!1}},{keys:"t",type:"motion",motion:"moveTillCharacter",motionArgs:{forward:!0,inclusive:!0}},{keys:"T",type:"motion",motion:"moveTillCharacter",motionArgs:{forward:!1}},{keys:";",type:"motion",motion:"repeatLastCharacterSearch",motionArgs:{forward:!0}},{keys:",",type:"motion",motion:"repeatLastCharacterSearch",motionArgs:{forward:!1}},{keys:"'",type:"motion",motion:"goToMark",motionArgs:{toJumplist:!0,linewise:!0}},{keys:"`",type:"motion",motion:"goToMark",motionArgs:{toJumplist:!0}},{keys:"]`",type:"motion",motion:"jumpToMark",motionArgs:{forward:!0}},{keys:"[`",type:"motion",motion:"jumpToMark",motionArgs:{forward:!1}},{keys:"]'",type:"motion",motion:"jumpToMark",motionArgs:{forward:!0,linewise:!0}},{keys:"['",type:"motion",motion:"jumpToMark",motionArgs:{forward:!1,linewise:!0}},{keys:"]p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!0,isEdit:!0,matchIndent:!0}},{keys:"[p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!1,isEdit:!0,matchIndent:!0}},{keys:"]",type:"motion",motion:"moveToSymbol",motionArgs:{forward:!0,toJumplist:!0}},{keys:"[",type:"motion",motion:"moveToSymbol",motionArgs:{forward:!1,toJumplist:!0}},{keys:"|",type:"motion",motion:"moveToColumn"},{keys:"o",type:"motion",motion:"moveToOtherHighlightedEnd",context:"visual"},{keys:"O",type:"motion",motion:"moveToOtherHighlightedEnd",motionArgs:{sameLine:!0},context:"visual"},{keys:"d",type:"operator",operator:"delete"},{keys:"y",type:"operator",operator:"yank"},{keys:"c",type:"operator",operator:"change"},{keys:"=",type:"operator",operator:"indentAuto"},{keys:">",type:"operator",operator:"indent",operatorArgs:{indentRight:!0}},{keys:"<",type:"operator",operator:"indent",operatorArgs:{indentRight:!1}},{keys:"g~",type:"operator",operator:"changeCase"},{keys:"gu",type:"operator",operator:"changeCase",operatorArgs:{toLower:!0},isEdit:!0},{keys:"gU",type:"operator",operator:"changeCase",operatorArgs:{toLower:!1},isEdit:!0},{keys:"n",type:"motion",motion:"findNext",motionArgs:{forward:!0,toJumplist:!0}},{keys:"N",type:"motion",motion:"findNext",motionArgs:{forward:!1,toJumplist:!0}},{keys:"gn",type:"motion",motion:"findAndSelectNextInclusive",motionArgs:{forward:!0}},{keys:"gN",type:"motion",motion:"findAndSelectNextInclusive",motionArgs:{forward:!1}},{keys:"gq",type:"operator",operator:"hardWrap"},{keys:"gw",type:"operator",operator:"hardWrap",operatorArgs:{keepCursor:!0}},{keys:"x",type:"operatorMotion",operator:"delete",motion:"moveByCharacters",motionArgs:{forward:!0},operatorMotionArgs:{visualLine:!1}},{keys:"X",type:"operatorMotion",operator:"delete",motion:"moveByCharacters",motionArgs:{forward:!1},operatorMotionArgs:{visualLine:!0}},{keys:"D",type:"operatorMotion",operator:"delete",motion:"moveToEol",motionArgs:{inclusive:!0},context:"normal"},{keys:"D",type:"operator",operator:"delete",operatorArgs:{linewise:!0},context:"visual"},{keys:"Y",type:"operatorMotion",operator:"yank",motion:"expandToLine",motionArgs:{linewise:!0},context:"normal"},{keys:"Y",type:"operator",operator:"yank",operatorArgs:{linewise:!0},context:"visual"},{keys:"C",type:"operatorMotion",operator:"change",motion:"moveToEol",motionArgs:{inclusive:!0},context:"normal"},{keys:"C",type:"operator",operator:"change",operatorArgs:{linewise:!0},context:"visual"},{keys:"~",type:"operatorMotion",operator:"changeCase",motion:"moveByCharacters",motionArgs:{forward:!0},operatorArgs:{shouldMoveCursor:!0},context:"normal"},{keys:"~",type:"operator",operator:"changeCase",context:"visual"},{keys:"",type:"operatorMotion",operator:"delete",motion:"moveToStartOfLine",context:"insert"},{keys:"",type:"operatorMotion",operator:"delete",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1},context:"insert"},{keys:"",type:"idle",context:"normal"},{keys:"",type:"action",action:"jumpListWalk",actionArgs:{forward:!0}},{keys:"",type:"action",action:"jumpListWalk",actionArgs:{forward:!1}},{keys:"",type:"action",action:"scroll",actionArgs:{forward:!0,linewise:!0}},{keys:"",type:"action",action:"scroll",actionArgs:{forward:!1,linewise:!0}},{keys:"a",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"charAfter"},context:"normal"},{keys:"A",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"eol"},context:"normal"},{keys:"A",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"endOfSelectedArea"},context:"visual"},{keys:"i",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"inplace"},context:"normal"},{keys:"gi",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"lastEdit"},context:"normal"},{keys:"I",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"firstNonBlank"},context:"normal"},{keys:"gI",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"bol"},context:"normal"},{keys:"I",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"startOfSelectedArea"},context:"visual"},{keys:"o",type:"action",action:"newLineAndEnterInsertMode",isEdit:!0,interlaceInsertRepeat:!0,actionArgs:{after:!0},context:"normal"},{keys:"O",type:"action",action:"newLineAndEnterInsertMode",isEdit:!0,interlaceInsertRepeat:!0,actionArgs:{after:!1},context:"normal"},{keys:"v",type:"action",action:"toggleVisualMode"},{keys:"V",type:"action",action:"toggleVisualMode",actionArgs:{linewise:!0}},{keys:"",type:"action",action:"toggleVisualMode",actionArgs:{blockwise:!0}},{keys:"",type:"action",action:"toggleVisualMode",actionArgs:{blockwise:!0}},{keys:"gv",type:"action",action:"reselectLastSelection"},{keys:"J",type:"action",action:"joinLines",isEdit:!0},{keys:"gJ",type:"action",action:"joinLines",actionArgs:{keepSpaces:!0},isEdit:!0},{keys:"p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!0,isEdit:!0}},{keys:"P",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!1,isEdit:!0}},{keys:"r",type:"action",action:"replace",isEdit:!0},{keys:"@",type:"action",action:"replayMacro"},{keys:"q",type:"action",action:"enterMacroRecordMode"},{keys:"R",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{replace:!0},context:"normal"},{keys:"R",type:"operator",operator:"change",operatorArgs:{linewise:!0,fullLine:!0},context:"visual",exitVisualBlock:!0},{keys:"u",type:"action",action:"undo",context:"normal"},{keys:"u",type:"operator",operator:"changeCase",operatorArgs:{toLower:!0},context:"visual",isEdit:!0},{keys:"U",type:"operator",operator:"changeCase",operatorArgs:{toLower:!1},context:"visual",isEdit:!0},{keys:"",type:"action",action:"redo"},{keys:"m",type:"action",action:"setMark"},{keys:'"',type:"action",action:"setRegister"},{keys:"",type:"action",action:"insertRegister",context:"insert",isEdit:!0},{keys:"",type:"action",action:"oneNormalCommand",context:"insert"},{keys:"zz",type:"action",action:"scrollToCursor",actionArgs:{position:"center"}},{keys:"z.",type:"action",action:"scrollToCursor",actionArgs:{position:"center"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"zt",type:"action",action:"scrollToCursor",actionArgs:{position:"top"}},{keys:"z",type:"action",action:"scrollToCursor",actionArgs:{position:"top"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"zb",type:"action",action:"scrollToCursor",actionArgs:{position:"bottom"}},{keys:"z-",type:"action",action:"scrollToCursor",actionArgs:{position:"bottom"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:".",type:"action",action:"repeatLastEdit"},{keys:"",type:"action",action:"incrementNumberToken",isEdit:!0,actionArgs:{increase:!0,backtrack:!1}},{keys:"",type:"action",action:"incrementNumberToken",isEdit:!0,actionArgs:{increase:!1,backtrack:!1}},{keys:"",type:"action",action:"indent",actionArgs:{indentRight:!0},context:"insert"},{keys:"",type:"action",action:"indent",actionArgs:{indentRight:!1},context:"insert"},{keys:"a",type:"motion",motion:"textObjectManipulation"},{keys:"i",type:"motion",motion:"textObjectManipulation",motionArgs:{textObjectInner:!0}},{keys:"/",type:"search",searchArgs:{forward:!0,querySrc:"prompt",toJumplist:!0}},{keys:"?",type:"search",searchArgs:{forward:!1,querySrc:"prompt",toJumplist:!0}},{keys:"*",type:"search",searchArgs:{forward:!0,querySrc:"wordUnderCursor",wholeWordOnly:!0,toJumplist:!0}},{keys:"#",type:"search",searchArgs:{forward:!1,querySrc:"wordUnderCursor",wholeWordOnly:!0,toJumplist:!0}},{keys:"g*",type:"search",searchArgs:{forward:!0,querySrc:"wordUnderCursor",toJumplist:!0}},{keys:"g#",type:"search",searchArgs:{forward:!1,querySrc:"wordUnderCursor",toJumplist:!0}},{keys:":",type:"ex"}],n=r.length,o=[{name:"colorscheme",shortName:"colo"},{name:"map"},{name:"imap",shortName:"im"},{name:"nmap",shortName:"nm"},{name:"vmap",shortName:"vm"},{name:"omap",shortName:"om"},{name:"noremap",shortName:"no"},{name:"nnoremap",shortName:"nn"},{name:"vnoremap",shortName:"vn"},{name:"inoremap",shortName:"ino"},{name:"onoremap",shortName:"ono"},{name:"unmap"},{name:"mapclear",shortName:"mapc"},{name:"nmapclear",shortName:"nmapc"},{name:"vmapclear",shortName:"vmapc"},{name:"imapclear",shortName:"imapc"},{name:"omapclear",shortName:"omapc"},{name:"write",shortName:"w"},{name:"undo",shortName:"u"},{name:"redo",shortName:"red"},{name:"set",shortName:"se"},{name:"setlocal",shortName:"setl"},{name:"setglobal",shortName:"setg"},{name:"sort",shortName:"sor"},{name:"substitute",shortName:"s",possiblyAsync:!0},{name:"startinsert",shortName:"start"},{name:"nohlsearch",shortName:"noh"},{name:"yank",shortName:"y"},{name:"delmarks",shortName:"delm"},{name:"registers",shortName:"reg",excludeFromCommandHistory:!0},{name:"vglobal",shortName:"v"},{name:"delete",shortName:"d"},{name:"join",shortName:"j"},{name:"normal",shortName:"norm"},{name:"global",shortName:"g"}],s=cr("");function a(h){h.setOption("disableInput",!0),h.setOption("showCursorWhenSelecting",!1),t.signal(h,"vim-mode-change",{mode:"normal"}),h.on("cursorActivity",ck),ve(h),t.on(h.getInputField(),"paste",c(h))}function l(h){h.setOption("disableInput",!1),h.off("cursorActivity",ck),t.off(h.getInputField(),"paste",c(h)),h.state.vim=null,Wl&&clearTimeout(Wl)}function c(h){var O=h.state.vim;return O.onPasteFn||(O.onPasteFn=function(){O.insertMode||(h.setCursor($e(h.getCursor(),0,1)),ce.enterInsertMode(h,{},O))}),O.onPasteFn}var u=/[\d]/,f=[t.isWordChar,function(h){return h&&!t.isWordChar(h)&&!/\s/.test(h)}],d=[function(h){return/\S/.test(h)}],p=["<",">"],g=["-",'"',".",":","_","/","+"],x=/^\w$/,w;try{w=new RegExp("^[\\p{Lu}]$","u")}catch(h){w=/^[A-Z]$/}function S(h,O){return O>=h.firstLine()&&O<=h.lastLine()}function T(h){return/^[a-z]$/.test(h)}function A(h){return"()[]{}".indexOf(h)!=-1}function I(h){return u.test(h)}function D(h){return w.test(h)}function C(h){return/^\s*$/.test(h)}function j(h){return".?!".indexOf(h)!=-1}function se(h,O){for(var b=0;b1&&O.setOption("textwidth",y)}});var ie=function(){var h=100,O=-1,b=0,y=0,v=new Array(h);function k(X,M,z){var G=O%h,ee=v[G];function Y(ne){var fe=++O%h,Ae=v[fe];Ae&&Ae.clear(),v[fe]=X.setBookmark(ne)}if(ee){var W=ee.find();W&&!Ot(W,M)&&Y(M)}else Y(M);Y(z),b=O,y=O-h+1,y<0&&(y=0)}function P(X,M){O+=M,O>b?O=b:O0?1:-1,ee,Y=X.getCursor();do if(O+=G,z=v[(h+O)%h],z&&(ee=z.find())&&!Ot(Y,ee))break;while(Oy)}return z}function $(X,M){var z=O,G=P(X,M);return O=z,G&&G.find()}return{cachedCursor:void 0,add:k,find:$,move:P}},he=function(h){return h?{changes:h.changes,expectCursorActivityForChange:h.expectCursorActivityForChange}:{changes:[],expectCursorActivityForChange:!1}};class me{constructor(){this.latestRegister=void 0,this.isPlaying=!1,this.isRecording=!1,this.replaySearchQueries=[],this.onRecordingDone=void 0,this.lastInsertModeChanges=he()}exitMacroRecordMode(){var O=q.macroModeState;O.onRecordingDone&&O.onRecordingDone(),O.onRecordingDone=void 0,O.isRecording=!1}enterMacroRecordMode(O,b){var y=q.registerController.getRegister(b);if(y){if(y.clear(),this.latestRegister=b,O.openDialog){var v=ao("span",{class:"cm-vim-message"},"recording @"+b);this.onRecordingDone=O.openDialog(v,null,{bottom:!0})}this.isRecording=!0}}}function ve(h){return h.state.vim||(h.state.vim={inputState:new ur,lastEditInputState:void 0,lastEditActionCommand:void 0,lastHPos:-1,lastHSPos:-1,lastMotion:null,marks:{},insertMode:!1,insertModeReturn:!1,insertModeRepeat:void 0,visualMode:!1,visualLine:!1,visualBlock:!1,lastSelection:null,lastPastedText:null,sel:{},options:{},expectLiteralNext:!1}),h.state.vim}var q;function le(){q={searchQuery:null,searchIsReversed:!1,lastSubstituteReplacePart:void 0,jumpList:ie(),macroModeState:new me,lastCharacterSearch:{increment:0,forward:!0,selectedCharacter:""},registerController:new Mm({}),searchHistoryController:new Ul,exCommandHistoryController:new Ul};for(var h in F){var O=F[h];O.value=O.defaultValue}}var V,E={enterVimMode:a,leaveVimMode:l,buildKeyMap:function(){},getRegisterController:function(){return q.registerController},resetVimGlobalState_:le,getVimGlobalState_:function(){return q},maybeInitVimState_:ve,suppressErrorLogging:!1,InsertModeKey:Ym,map:function(h,O,b){Pr.map(h,O,b)},unmap:function(h,O){return Pr.unmap(h,O)},noremap:function(h,O,b){Pr.map(h,O,b,!0)},mapclear:function(h){var O=r.length,b=n,y=r.slice(0,O-b);if(r=r.slice(O-b),h)for(var v=y.length-1;v>=0;v--){var k=y[v];if(h!==k.context)if(k.context)this._mapCommand(k);else{var P=["normal","insert","visual"];for(var $ in P)if(P[$]!==h){var X=Object.assign({},k);X.context=P[$],this._mapCommand(X)}}}},langmap:_t,vimKeyFromEvent:Ct,setOption:ae,getOption:ue,defineOption:U,defineEx:function(h,O,b){if(!O)O=h;else if(h.indexOf(O)!==0)throw new Error('(Vim.defineEx) "'+O+'" is not a prefix of "'+h+'", command not registered');sk[h]=b,Pr.commandMap_[O]={name:h,shortName:O,type:"api"}},handleKey:function(h,O,b){var y=this.findKey(h,O,b);if(typeof y=="function")return y()},multiSelectHandleKey:dL,findKey:function(h,O,b){var y=ve(h),v=h;function k(){var z=q.macroModeState;if(z.isRecording){if(O=="q")return z.exitMacroRecordMode(),Xt(v),!0;b!="mapping"&&uL(z,O)}}function P(){if(O==""){if(y.visualMode)Zr(v);else if(y.insertMode)lo(v);else return;return Xt(v),!0}}function $(){if(P())return!0;y.inputState.keyBuffer.push(O);var z=y.inputState.keyBuffer.join(""),G=O.length==1,ee=Br.matchCommand(z,r,y.inputState,"insert"),Y=y.inputState.changeQueue;if(ee.type=="none")return Xt(v),!1;if(ee.type=="partial"){if(ee.expectLiteralNext&&(y.expectLiteralNext=!0),V&&window.clearTimeout(V),V=G&&window.setTimeout(function(){y.insertMode&&y.inputState.keyBuffer.length&&Xt(v)},ue("insertModeEscKeysTimeout")),G){var W=v.listSelections();(!Y||Y.removed.length!=W.length)&&(Y=y.inputState.changeQueue=new Zf),Y.inserted+=O;for(var ne=0;ne{let i=[];return pi(e,"element",r=>{if((r.properties&&Array.isArray(r.properties.className)?r.properties.className:[]).includes("mermaid")){let o=function(l){let c=cK.parse(l);Mb(c,!0),r.children=c.children},s=Yc(r,{whitespace:"pre"}),a=nX(s).then(o);i.push(a)}}),Promise.all(i).then(()=>null)}}function hK(t){return e=>{pi(e,"element",i=>{if(i.properties&&i.properties.href){let r=i.properties.href;jv(r)?(i.properties["data-phx-link"]=t.baseUrl&&r.startsWith(t.baseUrl)?"patch":"redirect",i.properties["data-phx-link-state"]="push"):zv(r)&&(i.properties.target="_blank",i.properties.rel="noreferrer noopener")}})}}function zv(t){return/^(?:[a-z]+:)?\/\//i.test(t)}function dK(t){return t.startsWith("#")}function jv(t){return t.startsWith("/")||t.startsWith(window.location.origin)}function oX(t,e){return t.replace(/\/$/,"")+"/"+e}var xl=class{constructor(){this.subscribersByTopic={}}subscribe(e,i){return Array.isArray(this.subscribersByTopic[e])||(this.subscribersByTopic[e]=[]),this.subscribersByTopic[e].push(i),{destroy:()=>{this.unsubscribe(e,i)}}}unsubscribe(e,i){let r=this.subscribersByTopic[e].indexOf(i);r!==-1&&(this.subscribersByTopic[e].splice(r,1),this.subscribersByTopic[e].length===0&&delete this.subscribersByTopic[e])}broadcast(e,i){Array.isArray(this.subscribersByTopic[e])&&this.subscribersByTopic[e].forEach(r=>{r(i)})}},Kt=new xl;var sX=t=>typeof t=="object"&&t!=null&&t.nodeType===1,aX=(t,e)=>(!e||t!=="hidden")&&t!=="visible"&&t!=="clip",qv=(t,e)=>{if(t.clientHeight{let n=(o=>{if(!o.ownerDocument||!o.ownerDocument.defaultView)return null;try{return o.ownerDocument.defaultView.frameElement}catch(s){return null}})(r);return!!n&&(n.clientHeightoe||o>t&&s=e&&a>=i?o-t-r:s>e&&ai?s-e+n:0,pK=t=>{let e=t.parentElement;return e==null?t.getRootNode().host||null:e},Wv=(t,e)=>{var i,r,n,o;if(typeof document=="undefined")return[];let{scrollMode:s,block:a,inline:l,boundary:c,skipOverflowHiddenElements:u}=e,f=typeof c=="function"?c:ue=>ue!==c;if(!sX(t))throw new TypeError("Invalid target");let d=document.scrollingElement||document.documentElement,p=[],g=t;for(;sX(g)&&f(g);){if(g=pK(g),g===d){p.push(g);break}g!=null&&g===document.body&&qv(g)&&!qv(document.documentElement)||g!=null&&qv(g,u)&&p.push(g)}let x=(r=(i=window.visualViewport)==null?void 0:i.width)!=null?r:innerWidth,w=(o=(n=window.visualViewport)==null?void 0:n.height)!=null?o:innerHeight,{scrollX:S,scrollY:T}=window,{height:A,width:I,top:D,right:C,bottom:j,left:se}=t.getBoundingClientRect(),F=a==="start"||a==="nearest"?D:a==="end"?j:D+A/2,U=l==="center"?se+I/2:l==="end"?C:se,ae=[];for(let ue=0;ue=0&&se>=0&&j<=w&&C<=x&&D>=ve&&j<=le&&se>=V&&C<=q)return ae;let E=getComputedStyle(ie),B=parseInt(E.borderLeftWidth,10),re=parseInt(E.borderTopWidth,10),L=parseInt(E.borderRightWidth,10),Ue=parseInt(E.borderBottomWidth,10),Be=0,Ze=0,$t="offsetWidth"in ie?ie.offsetWidth-ie.clientWidth-B-L:0,Xe="offsetHeight"in ie?ie.offsetHeight-ie.clientHeight-re-Ue:0,Ct="offsetWidth"in ie?ie.offsetWidth===0?0:me/ie.offsetWidth:0,_t="offsetHeight"in ie?ie.offsetHeight===0?0:he/ie.offsetHeight:0;if(d===ie)Be=a==="start"?F:a==="end"?F-w:a==="nearest"?PO(T,T+w,w,re,Ue,T+F,T+F+A,A):F-w/2,Ze=l==="start"?U:l==="center"?U-x/2:l==="end"?U-x:PO(S,S+x,x,B,L,S+U,S+U+I,I),Be=Math.max(0,Be+T),Ze=Math.max(0,Ze+S);else{Be=a==="start"?F-ve-re:a==="end"?F-le+Ue+Xe:a==="nearest"?PO(ve,le,he,re,Ue+Xe,F,F+A,A):F-(ve+he/2)+Xe/2,Ze=l==="start"?U-V-B:l==="center"?U-(V+me/2)+$t/2:l==="end"?U-q+L+$t:PO(V,q,me,B,L+$t,U,U+I,I);let{scrollLeft:cr,scrollTop:ur}=ie;Be=Math.max(0,Math.min(ur+Be/_t,ie.scrollHeight-he/_t+Xe)),Ze=Math.max(0,Math.min(cr+Ze/Ct,ie.scrollWidth-me/Ct+$t)),F+=ur-Be,U+=cr-Ze}ae.push({el:ie,top:Be,left:Ze})}return ae};var OK=t=>t===!1?{block:"end",inline:"nearest"}:(e=>e===Object(e)&&Object.keys(e).length!==0)(t)?t:{block:"start",inline:"nearest"};function QO(t,e){if(!t.isConnected||!(n=>{let o=n;for(;o&&o.parentNode;){if(o.parentNode===document)return!0;o=o.parentNode instanceof ShadowRoot?o.parentNode.host:o.parentNode}return!1})(t))return;let i=(n=>{let o=window.getComputedStyle(n);return{top:parseFloat(o.scrollMarginTop)||0,right:parseFloat(o.scrollMarginRight)||0,bottom:parseFloat(o.scrollMarginBottom)||0,left:parseFloat(o.scrollMarginLeft)||0}})(t);if((n=>typeof n=="object"&&typeof n.behavior=="function")(e))return e.behavior(Wv(t,e));let r=typeof e=="boolean"||e==null?void 0:e.behavior;for(let{el:n,top:o,left:s}of Wv(t,OK(e))){let a=o-i.top+i.bottom,l=s-i.left+i.right;n.scroll({top:a,left:l,behavior:r})}}function Ks(t){return["code","smart","setup"].includes(t)}function lX(t){return["markdown","code","setup"].includes(t)}var mK={mounted(){this.props=this.getProps(),this.isFocused=!1,this.insertMode=!1,this.liveEditors={},this.updateInsertModeAvailability(),["code","smart"].includes(this.props.type)&&this.el.querySelector("[data-el-amplify-outputs-button]").addEventListener("click",e=>{this.el.toggleAttribute("data-js-amplified")}),this.props.type==="smart"&&this.el.querySelector("[data-el-toggle-source-button]").addEventListener("click",e=>{this.el.toggleAttribute("data-js-source-visible"),this.updateInsertModeAvailability(),this.maybeFocusCurrentEditor()}),this.el.addEventListener("lb:cell:editor_created",t=>{let{tag:e,liveEditor:i}=t.detail;this.handleCellEditorCreated(e,i)}),this.el.addEventListener("lb:cell:editor_removed",t=>{let{tag:e}=t.detail;this.handleCellEditorRemoved(e)}),this.el.addEventListener("mouseenter",t=>{this.el.setAttribute("data-js-hover","")}),this.el.addEventListener("mouseleave",t=>{this.el.removeAttribute("data-js-hover")}),this.subscriptions=[Kt.subscribe("navigation",this.handleNavigationEvent.bind(this)),Kt.subscribe("cells",this.handleCellsEvent.bind(this)),Kt.subscribe(`cells:${this.props.cellId}`,this.handleCellEvent.bind(this))],this._handleViewportResize=this.handleViewportResize.bind(this),window.visualViewport.addEventListener("resize",this._handleViewportResize)},disconnected(){this.el.removeAttribute("id")},destroyed(){this.subscriptions.forEach(t=>t.destroy()),window.visualViewport.removeEventListener("resize",this._handleViewportResize)},updated(){let t=this.props;this.props=this.getProps(),this.props.evaluationDigest!==t.evaluationDigest&&this.updateChangeIndicator()},getProps(){return ht(this.el,["cell-id","type","session-path","evaluation-digest","smart-cell-js-view-ref","allowed-uri-schemes"])},handleNavigationEvent(t){t.type==="element_focused"?this.handleElementFocused(t.focusableId,t.scroll):t.type==="insert_mode_changed"&&this.handleInsertModeChanged(t.enabled)},handleCellsEvent(t){t.type==="cell_moved"&&this.handleCellMoved(t.cellId)},handleCellEvent(t){t.type==="dispatch_queue_evaluation"&&this.handleDispatchQueueEvaluation(t.dispatch)},handleElementFocused(t,e){this.props.cellId===t?(this.isFocused=!0,this.el.setAttribute("data-js-focused",""),e&&Hs(this.el)):this.isFocused&&(this.isFocused=!1,this.el.removeAttribute("data-js-focused"))},handleCellEditorCreated(t,e){if(this.liveEditors[t]=e,this.updateInsertModeAvailability(),e===this.currentEditor()&&this.maybeFocusCurrentEditor(),e.onBlur(()=>{this.isFocused&&this.insertMode&&this.currentEditor().focus()}),e.onFocus(()=>{(!this.isFocused||!this.insertMode)&&this.currentEditor().blur()}),t==="primary"){let i=e.getSource();if(this.el.toggleAttribute("data-js-empty",i===""),e.onChange(r=>{this.el.toggleAttribute("data-js-empty",r==="")}),this.props.type==="markdown"){let r=this.el.querySelector("[data-el-markdown-container]"),n=new Gs(r,i,{baseUrl:this.props.sessionPath,emptyText:"Empty markdown cell",allowedUriSchemes:this.props.allowedUriSchemes});e.onChange(o=>{n.setContent(o)})}Ks(this.props.type)&&(this.updateChangeIndicator(),e.onChange(r=>{this.updateChangeIndicator()}),this.handleEvent(`evaluation_finished:${this.props.cellId}`,({code_markers:r})=>{e.setCodeMarkers(r)}),this.handleEvent(`start_evaluation:${this.props.cellId}`,()=>{e.clearDoctests()}),this.handleEvent(`doctest_report:${this.props.cellId}`,r=>{e.updateDoctests([r])}),this.handleEvent("erase_outputs",()=>{e.setCodeMarkers([]),e.clearDoctests()}))}},handleCellEditorRemoved(t){delete this.liveEditors[t]},handleViewportResize(){this.isFocused&&this.scrollEditorCursorIntoViewIfNeeded()},currentEditor(){return this.liveEditors[this.currentEditorTag()]},currentEditorTag(){return this.props.type==="smart"?this.el.hasAttribute("data-js-source-visible")?"primary":"secondary":"primary"},updateInsertModeAvailability(){this.el.toggleAttribute("data-js-insert-mode-disabled",!this.currentEditor())},maybeFocusCurrentEditor(){this.isFocused&&this.insertMode&&this.currentEditor().focus()},updateChangeIndicator(){let t=this.el.querySelector("[data-el-cell-status]");if(t&&t.querySelector("[data-el-change-indicator]")&&this.props.evaluationDigest){let i=this.liveEditors.primary.getSource(),r=SO(i),n=this.props.evaluationDigest!==r;this.el.toggleAttribute("data-js-changed",n)}},handleInsertModeChanged(t){this.isFocused&&!this.insertMode&&t?(this.insertMode=t,this.currentEditor()&&(this.currentEditor().focus(),this.scrollEditorCursorIntoViewIfNeeded())):this.insertMode&&!t&&(this.insertMode=t,this.currentEditor()&&this.currentEditor().blur())},handleCellMoved(t){this.isFocused&&t===this.props.cellId&&Hs(this.el)},handleDispatchQueueEvaluation(t){this.props.type==="smart"&&this.props.smartCellJsViewRef?Kt.broadcast(`js_views:${this.props.smartCellJsViewRef}`,{type:"sync",callback:t}):t()},scrollEditorCursorIntoViewIfNeeded(){let t=this.currentEditor().getElementAtCursor();QO(t,{scrollMode:"if-needed",behavior:"smooth",block:"center"})}},cX=mK;var lf=t=>{let{state:e}=t,i=e.doc.lineAt(e.selection.main.from),r=Vv(t.state,i.from);return r.line?gK(t):r.block?bK(t):!1};function cf(t,e){return({state:i,dispatch:r})=>{if(i.readOnly)return!1;let n=t(e,i);return n?(r(i.update(n)),!0):!1}}var gK=cf(Yv,0),uX=cf(Yv,1),fX=cf(Yv,2),hX=cf(dX,0);var bK=cf((t,e)=>dX(t,e,xK(e)),0);function Vv(t,e){let i=t.languageDataAt("commentTokens",e);return i.length?i[0]:{}}var af=50;function yK(t,{open:e,close:i},r,n){let o=t.sliceDoc(r-af,r),s=t.sliceDoc(n,n+af),a=/\s*$/.exec(o)[0].length,l=/^\s*/.exec(s)[0].length,c=o.length-a;if(o.slice(c-e.length,c)==e&&s.slice(l,l+i.length)==i)return{open:{pos:r-a,margin:a&&1},close:{pos:n+l,margin:l&&1}};let u,f;n-r<=2*af?u=f=t.sliceDoc(r,n):(u=t.sliceDoc(r,r+af),f=t.sliceDoc(n-af,n));let d=/^\s*/.exec(u)[0].length,p=/\s*$/.exec(f)[0].length,g=f.length-p-i.length;return u.slice(d,d+e.length)==e&&f.slice(g,g+i.length)==i?{open:{pos:r+d+e.length,margin:/\s/.test(u.charAt(d+e.length))?1:0},close:{pos:n-p-i.length,margin:/\s/.test(f.charAt(g-1))?1:0}}:null}function xK(t){let e=[];for(let i of t.selection.ranges){let r=t.doc.lineAt(i.from),n=i.to<=r.to?r:t.doc.lineAt(i.to),o=e.length-1;o>=0&&e[o].to>r.from?e[o].to=n.to:e.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:n.to})}return e}function dX(t,e,i=e.selection.ranges){let r=i.map(o=>Vv(e,o.from).block);if(!r.every(o=>o))return null;let n=i.map((o,s)=>yK(e,r[s],o.from,o.to));if(t!=2&&!n.every(o=>o))return{changes:e.changes(i.map((o,s)=>n[s]?[]:[{from:o.from,insert:r[s].open+" "},{from:o.to,insert:" "+r[s].close}]))};if(t!=1&&n.some(o=>o)){let o=[];for(let s=0,a;sn&&(o==s||s>f.from)){n=f.from;let d=/^\s*/.exec(f.text)[0].length,p=d==f.length,g=f.text.slice(d,d+c.length)==c?d:-1;do.comment<0&&(!o.empty||o.single))){let o=[];for(let{line:a,token:l,indent:c,empty:u,single:f}of r)(f||!u)&&o.push({from:a.from+c,insert:l+" "});let s=e.changes(o);return{changes:s,selection:e.selection.map(s,1)}}else if(t!=1&&r.some(o=>o.comment>=0)){let o=[];for(let{line:s,comment:a,token:l}of r)if(a>=0){let c=s.from+a,u=c+l.length;s.text[u-s.from]==" "&&u++,o.push({from:c,to:u})}return{changes:o}}return null}var Zv=bi.define(),vK=bi.define(),wK=be.define(),pX=be.define({combine(t){return wt(t,{minDepth:100,newGroupDelay:500,joinToEvent:(e,i)=>i},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,i)=>(r,n)=>e(r,n)||i(r,n)})}}),OX=Fe.define({create(){return Js.empty},update(t,e){let i=e.state.facet(pX),r=e.annotation(Zv);if(r){let l=zr.fromTransaction(e,r.selection),c=r.side,u=c==0?t.undone:t.done;return l?u=$O(u,u.length,i.minDepth,l):u=yX(u,e.startState.selection),new Js(c==0?r.rest:u,c==0?u:r.rest)}let n=e.annotation(vK);if((n=="full"||n=="before")&&(t=t.isolate()),e.annotation(Et.addToHistory)===!1)return e.changes.empty?t:t.addMapping(e.changes.desc);let o=zr.fromTransaction(e),s=e.annotation(Et.time),a=e.annotation(Et.userEvent);return o?t=t.addChanges(o,s,a,i,e):e.selection&&(t=t.addSelection(e.startState.selection,s,a,i.newGroupDelay)),(n=="full"||n=="after")&&(t=t.isolate()),t},toJSON(t){return{done:t.done.map(e=>e.toJSON()),undone:t.undone.map(e=>e.toJSON())}},fromJSON(t){return new Js(t.done.map(zr.fromJSON),t.undone.map(zr.fromJSON))}});function mX(t={}){return[OX,pX.of(t),de.domEventHandlers({beforeinput(e,i){let r=e.inputType=="historyUndo"?ea:e.inputType=="historyRedo"?Jo:null;return r?(e.preventDefault(),r(i)):!1}})]}function Fv(t,e){return function({state:i,dispatch:r}){if(!e&&i.readOnly)return!1;let n=i.field(OX,!1);if(!n)return!1;let o=n.pop(t,i,e);return o?(r(o),!0):!1}}var ea=Fv(0,!1),Jo=Fv(1,!1),gX=Fv(0,!0);var zr=class t{constructor(e,i,r,n,o){this.changes=e,this.effects=i,this.mapped=r,this.startSelection=n,this.selectionsAfter=o}setSelAfter(e){return new t(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,i,r;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(i=this.mapped)===null||i===void 0?void 0:i.toJSON(),startSelection:(r=this.startSelection)===null||r===void 0?void 0:r.toJSON(),selectionsAfter:this.selectionsAfter.map(n=>n.toJSON())}}static fromJSON(e){return new t(e.changes&&Qi.fromJSON(e.changes),[],e.mapped&&jn.fromJSON(e.mapped),e.startSelection&&J.fromJSON(e.startSelection),e.selectionsAfter.map(J.fromJSON))}static fromTransaction(e,i){let r=kr;for(let n of e.startState.facet(wK)){let o=n(e);o.length&&(r=r.concat(o))}return!r.length&&e.changes.empty?null:new t(e.changes.invert(e.startState.doc),r,void 0,i||e.startState.selection,kr)}static selection(e){return new t(void 0,kr,void 0,void 0,e)}};function $O(t,e,i,r){let n=e+1>i+20?e-i-1:0,o=t.slice(n,e);return o.push(r),o}function kK(t,e){let i=[],r=!1;return t.iterChangedRanges((n,o)=>i.push(n,o)),e.iterChangedRanges((n,o,s,a)=>{for(let l=0;l=c&&s<=u&&(r=!0)}}),r}function SK(t,e){return t.ranges.length==e.ranges.length&&t.ranges.filter((i,r)=>i.empty!=e.ranges[r].empty).length===0}function bX(t,e){return t.length?e.length?t.concat(e):t:e}var kr=[],TK=200;function yX(t,e){if(t.length){let i=t[t.length-1],r=i.selectionsAfter.slice(Math.max(0,i.selectionsAfter.length-TK));return r.length&&r[r.length-1].eq(e)?t:(r.push(e),$O(t,t.length-1,1e9,i.setSelAfter(r)))}else return[zr.selection([e])]}function EK(t){let e=t[t.length-1],i=t.slice();return i[t.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),i}function Bv(t,e){if(!t.length)return t;let i=t.length,r=kr;for(;i;){let n=CK(t[i-1],e,r);if(n.changes&&!n.changes.empty||n.effects.length){let o=t.slice(0,i);return o[i-1]=n,o}else e=n.mapped,i--,r=n.selectionsAfter}return r.length?[zr.selection(r)]:kr}function CK(t,e,i){let r=bX(t.selectionsAfter.length?t.selectionsAfter.map(a=>a.map(e)):kr,i);if(!t.changes)return zr.selection(r);let n=t.changes.map(e),o=e.mapDesc(t.changes,!0),s=t.mapped?t.mapped.composeDesc(o):o;return new zr(n,Se.mapEffects(t.effects,e),s,t.startSelection.map(o),r)}var _K=/^(input\.type|delete)($|\.)/,Js=class t{constructor(e,i,r=0,n=void 0){this.done=e,this.undone=i,this.prevTime=r,this.prevUserEvent=n}isolate(){return this.prevTime?new t(this.done,this.undone):this}addChanges(e,i,r,n,o){let s=this.done,a=s[s.length-1];return a&&a.changes&&!a.changes.empty&&e.changes&&(!r||_K.test(r))&&(!a.selectionsAfter.length&&i-this.prevTime0&&i-this.prevTimei.empty?t.moveByChar(i,e):XO(i,e))}function ts(t){return t.textDirectionAt(t.state.selection.main.head)==ot.LTR}var ff=t=>RO(t,!ts(t)),Hv=t=>RO(t,ts(t)),xX=t=>RO(t,!0),IO=t=>RO(t,!1);function vX(t,e){return ta(t,i=>i.empty?t.moveByGroup(i,e):XO(i,e))}var LO=t=>vX(t,!ts(t)),DO=t=>vX(t,ts(t));var awe=typeof Intl!="undefined"&&Intl.Segmenter?new Intl.Segmenter(void 0,{granularity:"word"}):null;function wX(t,e){return ta(t,i=>{if(!i.empty)return XO(i,e);let r=t.moveVertically(i,e);return r.head!=i.head?r:t.moveToLineBoundary(i,e)})}var hf=t=>wX(t,!1),df=t=>wX(t,!0);function kX(t){let e=t.scrollDOM.clientHeights.empty?t.moveVertically(s,e,i.height):XO(s,e));if(n.eq(r.selection))return!1;let o;if(i.selfScroll){let s=t.coordsAtPos(r.selection.main.head),a=t.scrollDOM.getBoundingClientRect(),l=a.top+i.marginTop,c=a.bottom-i.marginBottom;s&&s.top>l&&s.bottomSX(t,!1),wl=t=>SX(t,!0);function NO(t,e,i){let r=t.lineBlockAt(e.head),n=t.moveToLineBoundary(e,i);if(n.head==e.head&&n.head!=(i?r.to:r.from)&&(n=t.moveToLineBoundary(e,i,!1)),!i&&n.head==r.from&&r.length){let o=/^\s*/.exec(t.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;o&&e.head!=r.from+o&&(n=J.cursor(r.from+o))}return n}var pf=t=>ta(t,e=>NO(t,e,!0)),Of=t=>ta(t,e=>NO(t,e,!1));var MO=t=>ta(t,e=>J.cursor(t.lineBlockAt(e.head).from,1)),UO=t=>ta(t,e=>J.cursor(t.lineBlockAt(e.head).to,-1));function PK(t,e,i){let r=!1,n=uf(t.selection,o=>{let s=vr(t,o.head,-1)||vr(t,o.head,1)||o.head>0&&vr(t,o.head-1,1)||o.headPK(t,e,!1);function is(t,e){let i=uf(t.state.selection,r=>{let n=e(r);return J.range(r.anchor,n.head,n.goalColumn,n.bidiLevel||void 0)});return i.eq(t.state.selection)?!1:(t.dispatch(es(t.state,i)),!0)}function zO(t,e){return is(t,i=>t.moveByChar(i,e))}var Gv=t=>zO(t,!ts(t)),Kv=t=>zO(t,ts(t)),Jv=t=>zO(t,!0),ew=t=>zO(t,!1);function jO(t,e){return is(t,i=>t.moveByGroup(i,e))}var qO=t=>jO(t,!ts(t)),WO=t=>jO(t,ts(t)),EX=t=>jO(t,!0),CX=t=>jO(t,!1);function _X(t,e){return is(t,i=>t.moveVertically(i,e))}var kl=t=>_X(t,!1),Sl=t=>_X(t,!0);function PX(t,e){return is(t,i=>t.moveVertically(i,e,kX(t).height))}var mf=t=>PX(t,!1),ia=t=>PX(t,!0),tw=t=>is(t,e=>NO(t,e,!0)),iw=t=>is(t,e=>NO(t,e,!1));var gf=t=>is(t,e=>J.cursor(t.lineBlockAt(e.head).from)),bf=t=>is(t,e=>J.cursor(t.lineBlockAt(e.head).to)),yf=({state:t,dispatch:e})=>(e(es(t,{anchor:0})),!0),xf=({state:t,dispatch:e})=>(e(es(t,{anchor:t.doc.length})),!0),Tl=({state:t,dispatch:e})=>(e(es(t,{anchor:t.selection.main.anchor,head:0})),!0),El=({state:t,dispatch:e})=>(e(es(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0),BO=({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0),QX=({state:t,dispatch:e})=>{let i=YO(t).map(({from:r,to:n})=>J.range(r,Math.min(n+1,t.doc.length)));return e(t.update({selection:J.create(i),userEvent:"select"})),!0};function ZO(t,e){if(t.state.readOnly)return!1;let i="delete.selection",{state:r}=t,n=r.changeByRange(o=>{let{from:s,to:a}=o;if(s==a){let l=e(o);ls&&(i="delete.forward",l=AO(t,l,!0)),s=Math.min(s,l),a=Math.max(a,l)}else s=AO(t,s,!1),a=AO(t,a,!0);return s==a?{range:o}:{changes:{from:s,to:a},range:J.cursor(s,sn(t)))r.between(e,e,(n,o)=>{ne&&(e=i?o:n)});return e}var AX=(t,e,i)=>ZO(t,r=>{let n=r.from,{state:o}=t,s=o.doc.lineAt(n),a,l;if(i&&!e&&n>s.from&&nAX(t,!1,!0);var vf=t=>AX(t,!0,!1),$X=(t,e)=>ZO(t,i=>{let r=i.head,{state:n}=t,o=n.doc.lineAt(r),s=n.charCategorizer(r);for(let a=null;;){if(r==(e?o.to:o.from)){r==i.head&&o.number!=(e?n.doc.lines:1)&&(r+=e?1:-1);break}let l=Mt(o.text,r-o.from,e)+o.from,c=o.text.slice(Math.min(r,l)-o.from,Math.max(r,l)-o.from),u=s(c);if(a!=null&&u!=a)break;(c!=" "||r!=i.head)&&(a=u),r=l}return r}),rw=t=>$X(t,!1),XX=t=>$X(t,!0),nw=t=>ZO(t,e=>{let i=t.lineBlockAt(e.head).to;return e.headZO(t,e=>{let i=t.lineBlockAt(e.head).from;return e.head>i?i:Math.max(0,e.head-1)});var wf=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange(r=>({changes:{from:r.from,to:r.to,insert:He.of(["",""])},range:J.cursor(r.from)}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0},VO=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange(r=>{if(!r.empty||r.from==0||r.from==t.doc.length)return{range:r};let n=r.from,o=t.doc.lineAt(n),s=n==o.from?n-1:Mt(o.text,n-o.from,!1)+o.from,a=n==o.to?n+1:Mt(o.text,n-o.from,!0)+o.from;return{changes:{from:s,to:a,insert:t.doc.slice(n,a).append(t.doc.slice(s,n))},range:J.cursor(a)}});return i.changes.empty?!1:(e(t.update(i,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function YO(t){let e=[],i=-1;for(let r of t.selection.ranges){let n=t.doc.lineAt(r.from),o=t.doc.lineAt(r.to);if(!r.empty&&r.to==o.from&&(o=t.doc.lineAt(r.to-1)),i>=n.number){let s=e[e.length-1];s.to=o.to,s.ranges.push(r)}else e.push({from:n.from,to:o.to,ranges:[r]});i=o.number+1}return e}function IX(t,e,i){if(t.readOnly)return!1;let r=[],n=[];for(let o of YO(t)){if(i?o.to==t.doc.length:o.from==0)continue;let s=t.doc.lineAt(i?o.to+1:o.from-1),a=s.length+1;if(i){r.push({from:o.to,to:s.to},{from:o.from,insert:s.text+t.lineBreak});for(let l of o.ranges)n.push(J.range(Math.min(t.doc.length,l.anchor+a),Math.min(t.doc.length,l.head+a)))}else{r.push({from:s.from,to:o.from},{from:o.to,insert:t.lineBreak+s.text});for(let l of o.ranges)n.push(J.range(l.anchor-a,l.head-a))}}return r.length?(e(t.update({changes:r,scrollIntoView:!0,selection:J.create(n,t.selection.mainIndex),userEvent:"move.line"})),!0):!1}var LX=({state:t,dispatch:e})=>IX(t,e,!1),DX=({state:t,dispatch:e})=>IX(t,e,!0);function NX(t,e,i){if(t.readOnly)return!1;let r=[];for(let n of YO(t))i?r.push({from:n.from,insert:t.doc.slice(n.from,n.to)+t.lineBreak}):r.push({from:n.to,insert:t.lineBreak+t.doc.slice(n.from,n.to)});return e(t.update({changes:r,scrollIntoView:!0,userEvent:"input.copyline"})),!0}var MX=({state:t,dispatch:e})=>NX(t,e,!1),UX=({state:t,dispatch:e})=>NX(t,e,!0),zX=t=>{if(t.state.readOnly)return!1;let{state:e}=t,i=e.changes(YO(e).map(({from:n,to:o})=>(n>0?n--:o{let o;if(t.lineWrapping){let s=t.lineBlockAt(n.head),a=t.coordsAtPos(n.head,n.assoc||1);a&&(o=s.bottom+t.documentTop-a.bottom+t.defaultLineHeight/2)}return t.moveVertically(n,!0,o)}).map(i);return t.dispatch({changes:i,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0};function QK(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let i=ze(t).resolveInner(e),r=i.childBefore(e),n=i.childAfter(e),o;return r&&n&&r.to<=e&&n.from>=e&&(o=r.type.prop(Qe.closedBy))&&o.indexOf(n.name)>-1&&t.doc.lineAt(r.to).from==t.doc.lineAt(n.from).from&&!/\S/.test(t.sliceDoc(r.to,n.from))?{from:r.to,to:n.from}:null}var kf=AK(!1);function AK(t){return({state:e,dispatch:i})=>{if(e.readOnly)return!1;let r=e.changeByRange(n=>{let{from:o,to:s}=n,a=e.doc.lineAt(o),l=!t&&o==s&&QK(e,o);t&&(o=s=(s<=a.to?a:e.doc.lineAt(s)).to);let c=new Ls(e,{simulateBreak:o,simulateDoubleBreak:!!l}),u=ll(c,o);for(u==null&&(u=Ai(/^\s*/.exec(e.doc.lineAt(o).text)[0],e.tabSize));sa.from&&o{let n=[];for(let s=r.from;s<=r.to;){let a=t.doc.lineAt(s);a.number>i&&(r.empty||r.to>a.from)&&(e(a,n,r),i=a.number),s=a.to+1}let o=t.changes(n);return{changes:n,range:J.range(o.mapPos(r.anchor,1),o.mapPos(r.head,1))}})}var jX=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=Object.create(null),r=new Ls(t,{overrideIndentation:o=>{let s=i[o];return s==null?-1:s}}),n=ow(t,(o,s,a)=>{let l=ll(r,o.from);if(l==null)return;/\S/.test(o.text)||(l=0);let c=/^\s*/.exec(o.text)[0],u=Vn(t,l);(c!=u||a.fromt.readOnly?!1:(e(t.update(ow(t,(i,r)=>{r.push({from:i.from,insert:t.facet(Nr)})}),{userEvent:"input.indent"})),!0),Tf=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(ow(t,(i,r)=>{let n=/^\s*/.exec(i.text)[0];if(!n)return;let o=Ai(n,t.tabSize),s=0,a=Vn(t,Math.max(0,o-fn(t)));for(;st.normalize("NFKD"):t=>t,ns=class{constructor(e,i,r=0,n=e.length,o,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=o?a=>o(WX(a)):WX,this.query=this.normalize(i)}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 Nt(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 i=ru(e),r=this.bufferStart+this.bufferPos;this.bufferPos+=Pi(e);let n=this.normalize(i);for(let o=0,s=r;;o++){let a=n.charCodeAt(o),l=this.match(a,s,this.bufferPos+this.bufferStart);if(o==n.length-1){if(l)return this.value=l,this;break}s==r&&othis.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 i=this.matchPos<=this.to&&this.re.exec(this.curLine);if(i){let r=this.curLineStart+i.index,n=r+i[0].length;if(this.matchPos=JO(this.text,n+(r==n?1:0)),r==this.curLineStart+this.curLine.length&&this.nextLine(),(rthis.value.to)&&(!this.test||this.test(r,n,i)))return this.value={from:r,to:n,match:i},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length=r||n.to<=i){let a=new t(i,e.sliceString(i,r));return sw.set(e,a),a}if(n.from==i&&n.to==r)return n;let{text:o,from:s}=n;return s>i&&(o=e.sliceString(i,s)+o,s=i),n.to=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,i=this.re.exec(this.flat.text);if(i&&!i[0]&&i.index==e&&(this.re.lastIndex=e+1,i=this.re.exec(this.flat.text)),i){let r=this.flat.from+i.index,n=r+i[0].length;if((this.flat.to>=this.to||i.index+i[0].length<=this.flat.text.length-10)&&(!this.test||this.test(r,n,i)))return this.value={from:r,to:n,match:i},this.matchPos=JO(this.text,n+(r==n?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=GO.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}};typeof Symbol!="undefined"&&(Ql.prototype[Symbol.iterator]=KO.prototype[Symbol.iterator]=function(){return this});function XK(t){try{return new RegExp(t,hw),!0}catch(e){return!1}}function JO(t,e){if(e>=t.length)return e;let i=t.lineAt(e),r;for(;e=56320&&r<57344;)e++;return e}function aw(t){let e=String(t.state.doc.lineAt(t.state.selection.main.head).number),i=ct("input",{class:"cm-textfield",name:"line",value:e}),r=ct("form",{class:"cm-gotoLine",onkeydown:o=>{o.keyCode==27?(o.preventDefault(),t.dispatch({effects:em.of(!1)}),t.focus()):o.keyCode==13&&(o.preventDefault(),n())},onsubmit:o=>{o.preventDefault(),n()}},ct("label",t.state.phrase("Go to line"),": ",i)," ",ct("button",{class:"cm-button",type:"submit"},t.state.phrase("go")));function n(){let o=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(i.value);if(!o)return;let{state:s}=t,a=s.doc.lineAt(s.selection.main.head),[,l,c,u,f]=o,d=u?+u.slice(1):0,p=c?+c:a.number;if(c&&f){let w=p/100;l&&(w=w*(l=="-"?-1:1)+a.number/s.doc.lines),p=Math.round(s.doc.lines*w)}else c&&l&&(p=p*(l=="-"?-1:1)+a.number);let g=s.doc.line(Math.max(1,Math.min(s.doc.lines,p))),x=J.cursor(g.from+Math.max(0,Math.min(d,g.length)));t.dispatch({effects:[em.of(!1),de.scrollIntoView(x.from,{y:"center"})],selection:x}),t.focus()}return{dom:r}}var em=Se.define(),BX=Fe.define({create(){return!0},update(t,e){for(let i of e.effects)i.is(em)&&(t=i.value);return t},provide:t=>yr.from(t,e=>e?aw:null)}),GX=t=>{let e=Xs(t,aw);if(!e){let i=[em.of(!0)];t.state.field(BX,!1)==null&&i.push(Se.appendConfig.of([BX,RK])),t.dispatch({effects:i}),e=Xs(t,aw)}return e&&e.dom.querySelector("input").select(),!0},RK=de.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px","& label":{fontSize:"80%"}}}),IK={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},KX=be.define({combine(t){return wt(t,IK,{highlightWordAroundCursor:(e,i)=>e||i,minSelectionLength:Math.min,maxMatches:Math.min})}});function JX(t){let e=[UK,MK];return t&&e.push(KX.of(t)),e}var LK=we.mark({class:"cm-selectionMatch"}),DK=we.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function ZX(t,e,i,r){return(i==0||t(e.sliceDoc(i-1,i))!=dt.Word)&&(r==e.doc.length||t(e.sliceDoc(r,r+1))!=dt.Word)}function NK(t,e,i,r){return t(e.sliceDoc(i,i+1))==dt.Word&&t(e.sliceDoc(r-1,r))==dt.Word}var MK=Ye.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.selectionSet||t.docChanged||t.viewportChanged)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=t.state.facet(KX),{state:i}=t,r=i.selection;if(r.ranges.length>1)return we.none;let n=r.main,o,s=null;if(n.empty){if(!e.highlightWordAroundCursor)return we.none;let l=i.wordAt(n.head);if(!l)return we.none;s=i.charCategorizer(n.head),o=i.sliceDoc(l.from,l.to)}else{let l=n.to-n.from;if(l200)return we.none;if(e.wholeWords){if(o=i.sliceDoc(n.from,n.to),s=i.charCategorizer(n.head),!(ZX(s,i,n.from,n.to)&&NK(s,i,n.from,n.to)))return we.none}else if(o=i.sliceDoc(n.from,n.to),!o)return we.none}let a=[];for(let l of t.visibleRanges){let c=new ns(i.doc,o,l.from,l.to);for(;!c.next().done;){let{from:u,to:f}=c.value;if((!s||ZX(s,i,u,f))&&(n.empty&&u<=n.from&&f>=n.to?a.push(DK.range(u,f)):(u>=n.to||f<=n.from)&&a.push(LK.range(u,f)),a.length>e.maxMatches))return we.none}}return we.set(a)}},{decorations:t=>t.decorations}),UK=de.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),zK=({state:t,dispatch:e})=>{let{selection:i}=t,r=J.create(i.ranges.map(n=>t.wordAt(n.head)||J.cursor(n.head)),i.mainIndex);return r.eq(i)?!1:(e(t.update({selection:r})),!0)};function jK(t,e){let{main:i,ranges:r}=t.selection,n=t.wordAt(i.head),o=n&&n.from==i.from&&n.to==i.to;for(let s=!1,a=new ns(t.doc,e,r[r.length-1].to);;)if(a.next(),a.done){if(s)return null;a=new ns(t.doc,e,0,Math.max(0,r[r.length-1].from-1)),s=!0}else{if(s&&r.some(l=>l.from==a.value.from))continue;if(o){let l=t.wordAt(a.value.from);if(!l||l.from!=a.value.from||l.to!=a.value.to)continue}return a.value}}var e6=({state:t,dispatch:e})=>{let{ranges:i}=t.selection;if(i.some(o=>o.from===o.to))return zK({state:t,dispatch:e});let r=t.sliceDoc(i[0].from,i[0].to);if(t.selection.ranges.some(o=>t.sliceDoc(o.from,o.to)!=r))return!1;let n=jK(t,r);return n?(e(t.update({selection:t.selection.addRange(J.range(n.from,n.to),!1),effects:de.scrollIntoView(n.to)})),!0):!1},$l=be.define({combine(t){return wt(t,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new fw(e),scrollToMatch:e=>de.scrollIntoView(e)})}});var Al=class{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||XK(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(i,r)=>r=="n"?` +`:r=="r"?"\r":r=="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 cw(this):new lw(this)}getCursor(e,i=0,r){let n=e.doc?e:rt.create({doc:e});return r==null&&(r=n.doc.length),this.regexp?Pl(this,n,i,r):_l(this,n,i,r)}},tm=class{constructor(e){this.spec=e}};function _l(t,e,i,r){return new ns(e.doc,t.unquoted,i,r,t.caseSensitive?void 0:n=>n.toLowerCase(),t.wholeWord?qK(e.doc,e.charCategorizer(e.selection.main.head)):void 0)}function qK(t,e){return(i,r,n,o)=>((o>i||o+n.length=i)return null;n.push(r.value)}return n}highlight(e,i,r,n){let o=_l(this.spec,e,Math.max(0,i-this.spec.unquoted.length),Math.min(r+this.spec.unquoted.length,e.doc.length));for(;!o.next().done;)n(o.value.from,o.value.to)}};function Pl(t,e,i,r){return new Ql(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:t.wholeWord?WK(e.charCategorizer(e.selection.main.head)):void 0},i,r)}function im(t,e){return t.slice(Mt(t,e,!1),e)}function rm(t,e){return t.slice(e,Mt(t,e))}function WK(t){return(e,i,r)=>!r[0].length||(t(im(r.input,r.index))!=dt.Word||t(rm(r.input,r.index))!=dt.Word)&&(t(rm(r.input,r.index+r[0].length))!=dt.Word||t(im(r.input,r.index+r[0].length))!=dt.Word)}var cw=class extends tm{nextMatch(e,i,r){let n=Pl(this.spec,e,r,e.doc.length).next();return n.done&&(n=Pl(this.spec,e,0,i).next()),n.done?null:n.value}prevMatchInRange(e,i,r){for(let n=1;;n++){let o=Math.max(i,r-n*1e4),s=Pl(this.spec,e,o,r),a=null;for(;!s.next().done;)a=s.value;if(a&&(o==i||a.from>o+10))return a;if(o==i)return null}}prevMatch(e,i,r){return this.prevMatchInRange(e,0,i)||this.prevMatchInRange(e,r,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&\d+])/g,(i,r)=>r=="$"?"$":r=="&"?e.match[0]:r!="0"&&+r=i)return null;n.push(r.value)}return n}highlight(e,i,r,n){let o=Pl(this.spec,e,Math.max(0,i-250),Math.min(r+250,e.doc.length));for(;!o.next().done;)n(o.value.from,o.value.to)}},Kn=Se.define(),dw=Se.define(),rs=Fe.define({create(t){return new Ef(uw(t).create(),null)},update(t,e){for(let i of e.effects)i.is(Kn)?t=new Ef(i.value.create(),t.panel):i.is(dw)&&(t=new Ef(t.query,i.value?mw:null));return t},provide:t=>yr.from(t,e=>e.panel)});var Ef=class{constructor(e,i){this.query=e,this.panel=i}},BK=we.mark({class:"cm-searchMatch"}),ZK=we.mark({class:"cm-searchMatch cm-searchMatch-selected"}),VK=Ye.fromClass(class{constructor(t){this.view=t,this.decorations=this.highlight(t.state.field(rs))}update(t){let e=t.state.field(rs);(e!=t.startState.field(rs)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:t,panel:e}){if(!e||!t.spec.valid)return we.none;let{view:i}=this,r=new Ki;for(let n=0,o=i.visibleRanges,s=o.length;no[n+1].from-2*250;)l=o[++n].to;t.highlight(i.state,a,l,(c,u)=>{let f=i.state.selection.ranges.some(d=>d.from==c&&d.to==u);r.add(c,u,f?ZK:BK)})}return r.finish()}},{decorations:t=>t.decorations});function Cf(t){return e=>{let i=e.state.field(rs,!1);return i&&i.query.spec.valid?t(e,i):Xl(e)}}var VX=Cf((t,{query:e})=>{let{to:i}=t.state.selection.main,r=e.nextMatch(t.state,i,i);if(!r)return!1;let n=J.single(r.from,r.to),o=t.state.facet($l);return t.dispatch({selection:n,effects:[bw(t,r),o.scrollToMatch(n.main,t)],userEvent:"select.search"}),r6(t),!0}),YX=Cf((t,{query:e})=>{let{state:i}=t,{from:r}=i.selection.main,n=e.prevMatch(i,r,r);if(!n)return!1;let o=J.single(n.from,n.to),s=t.state.facet($l);return t.dispatch({selection:o,effects:[bw(t,n),s.scrollToMatch(o.main,t)],userEvent:"select.search"}),r6(t),!0}),pw=Cf((t,{query:e})=>{let i=e.matchAll(t.state,1e3);return!i||!i.length?!1:(t.dispatch({selection:J.create(i.map(r=>J.range(r.from,r.to))),userEvent:"select.search.matches"}),!0)}),t6=({state:t,dispatch:e})=>{let i=t.selection;if(i.ranges.length>1||i.main.empty)return!1;let{from:r,to:n}=i.main,o=[],s=0;for(let a=new ns(t.doc,t.sliceDoc(r,n));!a.next().done;){if(o.length>1e3)return!1;a.value.from==r&&(s=o.length),o.push(J.range(a.value.from,a.value.to))}return e(t.update({selection:J.create(o,s),userEvent:"select.search.matches"})),!0},FX=Cf((t,{query:e})=>{let{state:i}=t,{from:r,to:n}=i.selection.main;if(i.readOnly)return!1;let o=e.nextMatch(i,r,r);if(!o)return!1;let s=[],a,l,c=[];if(o.from==r&&o.to==n&&(l=i.toText(e.getReplacement(o)),s.push({from:o.from,to:o.to,insert:l}),o=e.nextMatch(i,o.from,o.to),c.push(de.announce.of(i.phrase("replaced match on line $",i.doc.lineAt(r).number)+"."))),o){let u=s.length==0||s[0].from>=o.to?0:o.to-o.from-l.length;a=J.single(o.from-u,o.to-u),c.push(bw(t,o)),c.push(i.facet($l).scrollToMatch(a.main,t))}return t.dispatch({changes:s,selection:a,effects:c,userEvent:"input.replace"}),!0}),Ow=Cf((t,{query:e})=>{if(t.state.readOnly)return!1;let i=e.matchAll(t.state,1e9).map(n=>{let{from:o,to:s}=n;return{from:o,to:s,insert:e.getReplacement(n)}});if(!i.length)return!1;let r=t.state.phrase("replaced $ matches",i.length)+".";return t.dispatch({changes:i,effects:de.announce.of(r),userEvent:"input.replace.all"}),!0});function mw(t){return t.state.facet($l).createPanel(t)}function uw(t,e){var i,r,n,o,s;let a=t.selection.main,l=a.empty||a.to>a.from+100?"":t.sliceDoc(a.from,a.to);if(e&&!l)return e;let c=t.facet($l);return new Al({search:((i=e==null?void 0:e.literal)!==null&&i!==void 0?i:c.literal)?l:l.replace(/\n/g,"\\n"),caseSensitive:(r=e==null?void 0:e.caseSensitive)!==null&&r!==void 0?r:c.caseSensitive,literal:(n=e==null?void 0:e.literal)!==null&&n!==void 0?n:c.literal,regexp:(o=e==null?void 0:e.regexp)!==null&&o!==void 0?o:c.regexp,wholeWord:(s=e==null?void 0:e.wholeWord)!==null&&s!==void 0?s:c.wholeWord})}function i6(t){let e=Xs(t,mw);return e&&e.dom.querySelector("[main-field]")}function r6(t){let e=i6(t);e&&e==t.root.activeElement&&e.select()}var Xl=t=>{let e=t.state.field(rs,!1);if(e&&e.panel){let i=i6(t);if(i&&i!=t.root.activeElement){let r=uw(t.state,e.query.spec);r.valid&&t.dispatch({effects:Kn.of(r)}),i.focus(),i.select()}}else t.dispatch({effects:[dw.of(!0),e?Kn.of(uw(t.state,e.query.spec)):Se.appendConfig.of(FK)]});return!0},gw=t=>{let e=t.state.field(rs,!1);if(!e||!e.panel)return!1;let i=Xs(t,mw);return i&&i.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:dw.of(!1)}),!0};var fw=class{constructor(e){this.view=e;let i=this.query=e.state.field(rs).query.spec;this.commit=this.commit.bind(this),this.searchField=ct("input",{value:i.search,placeholder:sr(e,"Find"),"aria-label":sr(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=ct("input",{value:i.replace,placeholder:sr(e,"Replace"),"aria-label":sr(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=ct("input",{type:"checkbox",name:"case",form:"",checked:i.caseSensitive,onchange:this.commit}),this.reField=ct("input",{type:"checkbox",name:"re",form:"",checked:i.regexp,onchange:this.commit}),this.wordField=ct("input",{type:"checkbox",name:"word",form:"",checked:i.wholeWord,onchange:this.commit});function r(n,o,s){return ct("button",{class:"cm-button",name:n,onclick:o,type:"button"},s)}this.dom=ct("div",{onkeydown:n=>this.keydown(n),class:"cm-search"},[this.searchField,r("next",()=>VX(e),[sr(e,"next")]),r("prev",()=>YX(e),[sr(e,"previous")]),r("select",()=>pw(e),[sr(e,"all")]),ct("label",null,[this.caseField,sr(e,"match case")]),ct("label",null,[this.reField,sr(e,"regexp")]),ct("label",null,[this.wordField,sr(e,"by word")]),...e.state.readOnly?[]:[ct("br"),this.replaceField,r("replace",()=>FX(e),[sr(e,"replace")]),r("replaceAll",()=>Ow(e),[sr(e,"replace all")])],ct("button",{name:"close",onclick:()=>gw(e),"aria-label":sr(e,"close"),type:"button"},["\xD7"])])}commit(){let e=new Al({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:Kn.of(e)}))}keydown(e){my(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?YX:VX)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),FX(this.view))}update(e){for(let i of e.transactions)for(let r of i.effects)r.is(Kn)&&!r.value.eq(this.query)&&this.setQuery(r.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($l).top}};function sr(t,e){return t.state.phrase(e)}var FO=30,HO=/[\s\.,:;?!]/;function bw(t,{from:e,to:i}){let r=t.state.doc.lineAt(e),n=t.state.doc.lineAt(i).to,o=Math.max(r.from,e-FO),s=Math.min(n,i+FO),a=t.state.sliceDoc(o,s);if(o!=r.from){for(let l=0;la.length-FO;l--)if(!HO.test(a[l-1])&&HO.test(a[l])){a=a.slice(0,l);break}}return de.announce.of(`${t.state.phrase("current match")}. ${a} ${t.state.phrase("on line")} ${r.number}.`)}var YK=de.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"}}),FK=[rs,Qt.low(VK),YK];var yw=class{constructor(e,i,r){this.from=e,this.to=i,this.diagnostic=r}},ra=class t{constructor(e,i,r){this.diagnostics=e,this.panel=i,this.selected=r}static init(e,i,r){let n=e,o=r.facet(kw).markerFilter;o&&(n=o(n,r));let s=we.set(n.map(a=>a.from==a.to||a.from==a.to-1&&r.doc.lineAt(a.from).to==a.from?we.widget({widget:new xw(a),diagnostic:a}).range(a.from):we.mark({attributes:{class:"cm-lintRange cm-lintRange-"+a.severity+(a.markClass?" "+a.markClass:"")},diagnostic:a,inclusive:!0}).range(a.from,a.to)),!0);return new t(s,i,Rl(s))}};function Rl(t,e=null,i=0){let r=null;return t.between(i,1e9,(n,o,{spec:s})=>{if(!(e&&s.diagnostic!=e))return r=new yw(n,o,s.diagnostic),!1}),r}function HK(t,e){let i=e.pos,r=e.end||i,n=t.state.facet(kw).hideOn(t,i,r);if(n!=null)return n;let o=t.startState.doc.lineAt(e.pos);return!!(t.effects.some(s=>s.is(vw))||t.changes.touchesRange(o.from,Math.max(o.to,r)))}function o6(t,e){return t.field(ar,!1)?e:e.concat(Se.appendConfig.of(iJ))}function s6(t,e){return{effects:o6(t,[vw.of(e)])}}var vw=Se.define(),ww=Se.define(),a6=Se.define(),ar=Fe.define({create(){return new ra(we.none,null,null)},update(t,e){if(e.docChanged){let i=t.diagnostics.map(e.changes),r=null;if(t.selected){let n=e.changes.mapPos(t.selected.from,1);r=Rl(i,t.selected.diagnostic,n)||Rl(i,null,n)}t=new ra(i,t.panel,r)}for(let i of e.effects)i.is(vw)?t=ra.init(i.value,t.panel,e.state):i.is(ww)?t=new ra(t.diagnostics,i.value?sm.open:null,t.selected):i.is(a6)&&(t=new ra(t.diagnostics,t.panel,i.value));return t},provide:t=>[yr.from(t,e=>e.panel),de.decorations.from(t,e=>e.diagnostics)]});var GK=we.mark({class:"cm-lintRange cm-lintRange-active",inclusive:!0});function KK(t,e,i){let{diagnostics:r}=t.state.field(ar),n=[],o=2e8,s=0;r.between(e-(i<0?1:0),e+(i>0?1:0),(l,c,{spec:u})=>{e>=l&&e<=c&&(l==c||(e>l||i>0)&&(ef6(t,i,!1)))}var l6=t=>{let e=t.state.field(ar,!1);(!e||!e.panel)&&t.dispatch({effects:o6(t.state,[ww.of(!0)])});let i=Xs(t,sm.open);return i&&i.dom.querySelector(".cm-panel-lint ul").focus(),!0},n6=t=>{let e=t.state.field(ar,!1);return!e||!e.panel?!1:(t.dispatch({effects:ww.of(!1)}),!0)},c6=t=>{let e=t.state.field(ar,!1);if(!e)return!1;let i=t.state.selection.main,r=e.diagnostics.iter(i.to+1);return!r.value&&(r=e.diagnostics.iter(0),!r.value||r.from==i.from&&r.to==i.to)?!1:(t.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0}),!0)};var kw=be.define({combine(t){return Object.assign({sources:t.map(e=>e.source).filter(e=>e!=null)},wt(t.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{needsRefresh:(e,i)=>e?i?r=>e(r)||i(r):e:i}))}});function u6(t){let e=[];if(t)e:for(let{name:i}of t){for(let r=0;ro.toLowerCase()==n.toLowerCase())){e.push(n);continue e}}e.push("")}return e}function f6(t,e,i){var r;let n=i?u6(e.actions):[];return ct("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},ct("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage(t):e.message),(r=e.actions)===null||r===void 0?void 0:r.map((o,s)=>{let a=!1,l=d=>{if(d.preventDefault(),a)return;a=!0;let p=Rl(t.state.field(ar).diagnostics,e);p&&o.apply(t,p.from,p.to)},{name:c}=o,u=n[s]?c.indexOf(n[s]):-1,f=u<0?c:[c.slice(0,u),ct("u",c.slice(u,u+1)),c.slice(u+1)];return ct("button",{type:"button",class:"cm-diagnosticAction",onclick:l,onmousedown:l,"aria-label":` Action: ${c}${u<0?"":` (access key "${n[s]})"`}.`},f)}),e.source&&ct("div",{class:"cm-diagnosticSource"},e.source))}var xw=class extends Ft{constructor(e){super(),this.diagnostic=e}eq(e){return e.diagnostic==this.diagnostic}toDOM(){return ct("span",{class:"cm-lintPoint cm-lintPoint-"+this.diagnostic.severity})}},om=class{constructor(e,i){this.diagnostic=i,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=f6(e,i,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}},sm=class t{constructor(e){this.view=e,this.items=[];let i=n=>{if(n.keyCode==27)n6(this.view),this.view.focus();else if(n.keyCode==38||n.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(n.keyCode==40||n.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(n.keyCode==36)this.moveSelection(0);else if(n.keyCode==35)this.moveSelection(this.items.length-1);else if(n.keyCode==13)this.view.focus();else if(n.keyCode>=65&&n.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:o}=this.items[this.selectedIndex],s=u6(o.actions);for(let a=0;a{for(let o=0;on6(this.view)},"\xD7")),this.update()}get selectedIndex(){let e=this.view.state.field(ar).selected;if(!e)return-1;for(let i=0;i{let c=-1,u;for(let f=r;fr&&(this.items.splice(r,c-r),n=!0)),i&&u.diagnostic==i.diagnostic?u.dom.hasAttribute("aria-selected")||(u.dom.setAttribute("aria-selected","true"),o=u):u.dom.hasAttribute("aria-selected")&&u.dom.removeAttribute("aria-selected"),r++});r({sel:o.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:s,panel:a})=>{let l=a.height/this.list.offsetHeight;s.topa.bottom&&(this.list.scrollTop+=(s.bottom-a.bottom)/l)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),n&&this.sync()}sync(){let e=this.list.firstChild;function i(){let r=e;e=r.nextSibling,r.remove()}for(let r of this.items)if(r.dom.parentNode==this.list){for(;e!=r.dom;)i();e=r.dom.nextSibling}else this.list.insertBefore(r.dom,e);for(;e;)i()}moveSelection(e){if(this.selectedIndex<0)return;let i=this.view.state.field(ar),r=Rl(i.diagnostics,this.items[e].diagnostic);r&&this.view.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0,effects:a6.of(r)})}static open(e){return new t(e)}};function eJ(t,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,${encodeURIComponent(t)}')`}function nm(t){return eJ(``,'width="6" height="3"')}var tJ=de.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:nm("#d11")},".cm-lintRange-warning":{backgroundImage:nm("orange")},".cm-lintRange-info":{backgroundImage:nm("#999")},".cm-lintRange-hint":{backgroundImage:nm("#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}}});var iJ=[ar,de.decorations.compute([ar],t=>{let{selected:e,panel:i}=t.field(ar);return!e||!i||e.from==e.to?we.none:we.set([GK.range(e.from,e.to)])}),Ep(KK,{hideOn:HK}),tJ];var h6=t=>e=>{let i=t==="down",r=e.state.selection;for(let n of r.ranges)r=r.addRange(e.moveVertically(n,i));return e.dispatch({selection:r}),!0},rJ=h6("up"),nJ=h6("down"),oJ=t=>{let e=null;for(let i of t.state.selection.ranges)if(!i.empty)for(let r=i.from;r<=i.to;){let n=t.state.doc.lineAt(r),o=Math.min(n.to,i.to);e?e=e.addRange(J.range(o,o)):e=J.single(o),r=n.to+1}return e?(t.dispatch({selection:e}),!0):!1},d6=[{key:"Ctrl-Space",run:Lu},{key:"Escape",run:rx},{key:"ArrowDown",run:Yn(!0)},{key:"ArrowUp",run:Yn(!1)},{key:"PageDown",run:Yn(!0,"page")},{key:"PageUp",run:Yn(!1,"page")},{key:"Enter",run:qp},{key:"Tab",run:qp},{key:"Mod-f",run:Xl,scope:"editor search-panel"},{key:"Escape",run:gw,scope:"editor search-panel"},{key:"Alt-Enter",run:pw,scope:"editor search-panel"},{key:"Mod-Alt-Enter",run:Ow,scope:"editor search-panel"},{key:"Ctrl-g",run:GX},{key:"Mod-d",run:e6,preventDefault:!0},{key:"Shift-Mod-l",run:t6},{key:"Enter",run:kf,shift:kf},{key:"ArrowLeft",run:ff,shift:Gv,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:LO,shift:qO},{key:"ArrowRight",run:Hv,shift:Kv,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:DO,shift:WO},{key:"ArrowUp",run:hf,shift:kl,preventDefault:!0},{key:"ArrowDown",run:df,shift:Sl,preventDefault:!0},{key:"Home",run:Of,shift:iw},{mac:"Cmd-ArrowLeft",run:Of,shift:iw},{key:"Mod-Home",run:yf,shift:Tl},{mac:"Cmd-ArrowUp",run:yf,shift:Tl},{key:"PageUp",run:vl,shift:mf},{mac:"Ctrl-ArrowUp",run:vl,shift:mf},{key:"PageDown",run:wl,shift:ia},{mac:"Ctrl-ArrowDown",run:wl,shift:ia},{key:"End",run:pf,shift:tw},{mac:"Cmd-ArrowRight",run:pf,shift:tw},{key:"Mod-Alt-ArrowUp",linux:"Shift-Alt-ArrowUp",run:rJ,preventDefault:!0},{key:"Mod-Alt-ArrowDown",linux:"Shift-Alt-ArrowDown",run:nJ,preventDefault:!0},{key:"Shift-Alt-i",run:oJ},{key:"Mod-End",run:xf,shift:El},{mac:"Cmd-ArrowDown",run:xf,shift:El},{key:"Mod-a",run:BO},{key:"Backspace",run:sP},{key:"Backspace",run:Cl,shift:Cl},{key:"Delete",run:vf},{key:"Mod-Backspace",mac:"Alt-Backspace",run:rw},{key:"Mod-Delete",mac:"Alt-Delete",run:XX},{mac:"Mod-Backspace",run:RX},{mac:"Mod-Delete",run:nw},{mac:"Ctrl-b",run:ff,shift:Gv,preventDefault:!0},{mac:"Ctrl-f",run:Hv,shift:Kv},{mac:"Ctrl-p",run:hf,shift:kl},{mac:"Ctrl-n",run:df,shift:Sl},{mac:"Ctrl-a",run:MO,shift:gf},{mac:"Ctrl-e",run:UO,shift:bf},{mac:"Ctrl-d",run:vf},{mac:"Ctrl-h",run:Cl},{mac:"Ctrl-k",run:nw},{mac:"Ctrl-Alt-h",run:rw},{mac:"Ctrl-o",run:wf},{mac:"Ctrl-t",run:VO},{mac:"Ctrl-v",run:wl},{mac:"Alt-v",run:vl},{key:"Shift-Mod-k",run:zX},{key:"Alt-ArrowDown",run:DX},{key:"Alt-ArrowUp",run:LX},{win:"Shift-Alt-ArrowDown",mac:"Shift-Alt-ArrowDown",run:UX},{win:"Shift-Alt-ArrowUp",mac:"Shift-Alt-ArrowUp",run:MX},{key:"Mod-l",run:QX,preventDefault:!0},{key:"Shift-Mod-\\",run:TX},{key:"Tab",run:Sf,shift:Tf,preventDefault:!0},{key:"Mod-[",run:Tf},{key:"Mod-]",run:Sf},{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:Dp},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:__},{key:"Mod-k Mod-0",run:Q_},{key:"Mod-k Mod-j",run:A_},{key:"Mod-k Mod-c",run:uX},{key:"Mod-k Mod-u",run:fX},{key:"Mod-/",run:lf},{key:"Shift-Alt-a",run:hX},{key:"Mod-z",run:ea,preventDefault:!0},{key:"Mod-y",run:Jo,preventDefault:!0},{key:"Mod-Shift-z",run:Jo,preventDefault:!0},{key:"Mod-u",run:gX,preventDefault:!0},{key:"Mod-Shift-m",run:l6},{key:"F8",run:c6}];function sJ(t){var e=t.Pos;function i(h,O,b){if(O.line===b.line&&O.ch>=b.ch-1){var y=h.getLine(O.line),v=y.charCodeAt(O.ch);55296<=v&&v<=55551&&(b.ch+=1)}return{start:O,end:b}}var r=[{keys:"",type:"keyToKey",toKeys:"h"},{keys:"",type:"keyToKey",toKeys:"l"},{keys:"",type:"keyToKey",toKeys:"k"},{keys:"",type:"keyToKey",toKeys:"j"},{keys:"g",type:"keyToKey",toKeys:"gk"},{keys:"g",type:"keyToKey",toKeys:"gj"},{keys:"",type:"keyToKey",toKeys:"l"},{keys:"",type:"keyToKey",toKeys:"h"},{keys:"",type:"keyToKey",toKeys:"x"},{keys:"",type:"keyToKey",toKeys:"W"},{keys:"",type:"keyToKey",toKeys:"B"},{keys:"",type:"keyToKey",toKeys:"w"},{keys:"",type:"keyToKey",toKeys:"b"},{keys:"",type:"keyToKey",toKeys:"j"},{keys:"",type:"keyToKey",toKeys:"k"},{keys:"",type:"keyToKey",toKeys:""},{keys:"",type:"keyToKey",toKeys:""},{keys:"",type:"keyToKey",toKeys:"",context:"insert"},{keys:"",type:"keyToKey",toKeys:"",context:"insert"},{keys:"",type:"keyToKey",toKeys:""},{keys:"",type:"keyToKey",toKeys:"",context:"insert"},{keys:"s",type:"keyToKey",toKeys:"cl",context:"normal"},{keys:"s",type:"keyToKey",toKeys:"c",context:"visual"},{keys:"S",type:"keyToKey",toKeys:"cc",context:"normal"},{keys:"S",type:"keyToKey",toKeys:"VdO",context:"visual"},{keys:"",type:"keyToKey",toKeys:"0"},{keys:"",type:"keyToKey",toKeys:"$"},{keys:"",type:"keyToKey",toKeys:""},{keys:"",type:"keyToKey",toKeys:""},{keys:"",type:"keyToKey",toKeys:"j^",context:"normal"},{keys:"",type:"keyToKey",toKeys:"i",context:"normal"},{keys:"",type:"action",action:"toggleOverwrite",context:"insert"},{keys:"H",type:"motion",motion:"moveToTopLine",motionArgs:{linewise:!0,toJumplist:!0}},{keys:"M",type:"motion",motion:"moveToMiddleLine",motionArgs:{linewise:!0,toJumplist:!0}},{keys:"L",type:"motion",motion:"moveToBottomLine",motionArgs:{linewise:!0,toJumplist:!0}},{keys:"h",type:"motion",motion:"moveByCharacters",motionArgs:{forward:!1}},{keys:"l",type:"motion",motion:"moveByCharacters",motionArgs:{forward:!0}},{keys:"j",type:"motion",motion:"moveByLines",motionArgs:{forward:!0,linewise:!0}},{keys:"k",type:"motion",motion:"moveByLines",motionArgs:{forward:!1,linewise:!0}},{keys:"gj",type:"motion",motion:"moveByDisplayLines",motionArgs:{forward:!0}},{keys:"gk",type:"motion",motion:"moveByDisplayLines",motionArgs:{forward:!1}},{keys:"w",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!1}},{keys:"W",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!1,bigWord:!0}},{keys:"e",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!0,inclusive:!0}},{keys:"E",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!0,bigWord:!0,inclusive:!0}},{keys:"b",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1}},{keys:"B",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1,bigWord:!0}},{keys:"ge",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!0,inclusive:!0}},{keys:"gE",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!0,bigWord:!0,inclusive:!0}},{keys:"{",type:"motion",motion:"moveByParagraph",motionArgs:{forward:!1,toJumplist:!0}},{keys:"}",type:"motion",motion:"moveByParagraph",motionArgs:{forward:!0,toJumplist:!0}},{keys:"(",type:"motion",motion:"moveBySentence",motionArgs:{forward:!1}},{keys:")",type:"motion",motion:"moveBySentence",motionArgs:{forward:!0}},{keys:"",type:"motion",motion:"moveByPage",motionArgs:{forward:!0}},{keys:"",type:"motion",motion:"moveByPage",motionArgs:{forward:!1}},{keys:"",type:"motion",motion:"moveByScroll",motionArgs:{forward:!0,explicitRepeat:!0}},{keys:"",type:"motion",motion:"moveByScroll",motionArgs:{forward:!1,explicitRepeat:!0}},{keys:"gg",type:"motion",motion:"moveToLineOrEdgeOfDocument",motionArgs:{forward:!1,explicitRepeat:!0,linewise:!0,toJumplist:!0}},{keys:"G",type:"motion",motion:"moveToLineOrEdgeOfDocument",motionArgs:{forward:!0,explicitRepeat:!0,linewise:!0,toJumplist:!0}},{keys:"g$",type:"motion",motion:"moveToEndOfDisplayLine"},{keys:"g^",type:"motion",motion:"moveToStartOfDisplayLine"},{keys:"g0",type:"motion",motion:"moveToStartOfDisplayLine"},{keys:"0",type:"motion",motion:"moveToStartOfLine"},{keys:"^",type:"motion",motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"+",type:"motion",motion:"moveByLines",motionArgs:{forward:!0,toFirstChar:!0}},{keys:"-",type:"motion",motion:"moveByLines",motionArgs:{forward:!1,toFirstChar:!0}},{keys:"_",type:"motion",motion:"moveByLines",motionArgs:{forward:!0,toFirstChar:!0,repeatOffset:-1}},{keys:"$",type:"motion",motion:"moveToEol",motionArgs:{inclusive:!0}},{keys:"%",type:"motion",motion:"moveToMatchedSymbol",motionArgs:{inclusive:!0,toJumplist:!0}},{keys:"f",type:"motion",motion:"moveToCharacter",motionArgs:{forward:!0,inclusive:!0}},{keys:"F",type:"motion",motion:"moveToCharacter",motionArgs:{forward:!1}},{keys:"t",type:"motion",motion:"moveTillCharacter",motionArgs:{forward:!0,inclusive:!0}},{keys:"T",type:"motion",motion:"moveTillCharacter",motionArgs:{forward:!1}},{keys:";",type:"motion",motion:"repeatLastCharacterSearch",motionArgs:{forward:!0}},{keys:",",type:"motion",motion:"repeatLastCharacterSearch",motionArgs:{forward:!1}},{keys:"'",type:"motion",motion:"goToMark",motionArgs:{toJumplist:!0,linewise:!0}},{keys:"`",type:"motion",motion:"goToMark",motionArgs:{toJumplist:!0}},{keys:"]`",type:"motion",motion:"jumpToMark",motionArgs:{forward:!0}},{keys:"[`",type:"motion",motion:"jumpToMark",motionArgs:{forward:!1}},{keys:"]'",type:"motion",motion:"jumpToMark",motionArgs:{forward:!0,linewise:!0}},{keys:"['",type:"motion",motion:"jumpToMark",motionArgs:{forward:!1,linewise:!0}},{keys:"]p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!0,isEdit:!0,matchIndent:!0}},{keys:"[p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!1,isEdit:!0,matchIndent:!0}},{keys:"]",type:"motion",motion:"moveToSymbol",motionArgs:{forward:!0,toJumplist:!0}},{keys:"[",type:"motion",motion:"moveToSymbol",motionArgs:{forward:!1,toJumplist:!0}},{keys:"|",type:"motion",motion:"moveToColumn"},{keys:"o",type:"motion",motion:"moveToOtherHighlightedEnd",context:"visual"},{keys:"O",type:"motion",motion:"moveToOtherHighlightedEnd",motionArgs:{sameLine:!0},context:"visual"},{keys:"d",type:"operator",operator:"delete"},{keys:"y",type:"operator",operator:"yank"},{keys:"c",type:"operator",operator:"change"},{keys:"=",type:"operator",operator:"indentAuto"},{keys:">",type:"operator",operator:"indent",operatorArgs:{indentRight:!0}},{keys:"<",type:"operator",operator:"indent",operatorArgs:{indentRight:!1}},{keys:"g~",type:"operator",operator:"changeCase"},{keys:"gu",type:"operator",operator:"changeCase",operatorArgs:{toLower:!0},isEdit:!0},{keys:"gU",type:"operator",operator:"changeCase",operatorArgs:{toLower:!1},isEdit:!0},{keys:"n",type:"motion",motion:"findNext",motionArgs:{forward:!0,toJumplist:!0}},{keys:"N",type:"motion",motion:"findNext",motionArgs:{forward:!1,toJumplist:!0}},{keys:"gn",type:"motion",motion:"findAndSelectNextInclusive",motionArgs:{forward:!0}},{keys:"gN",type:"motion",motion:"findAndSelectNextInclusive",motionArgs:{forward:!1}},{keys:"gq",type:"operator",operator:"hardWrap"},{keys:"gw",type:"operator",operator:"hardWrap",operatorArgs:{keepCursor:!0}},{keys:"x",type:"operatorMotion",operator:"delete",motion:"moveByCharacters",motionArgs:{forward:!0},operatorMotionArgs:{visualLine:!1}},{keys:"X",type:"operatorMotion",operator:"delete",motion:"moveByCharacters",motionArgs:{forward:!1},operatorMotionArgs:{visualLine:!0}},{keys:"D",type:"operatorMotion",operator:"delete",motion:"moveToEol",motionArgs:{inclusive:!0},context:"normal"},{keys:"D",type:"operator",operator:"delete",operatorArgs:{linewise:!0},context:"visual"},{keys:"Y",type:"operatorMotion",operator:"yank",motion:"expandToLine",motionArgs:{linewise:!0},context:"normal"},{keys:"Y",type:"operator",operator:"yank",operatorArgs:{linewise:!0},context:"visual"},{keys:"C",type:"operatorMotion",operator:"change",motion:"moveToEol",motionArgs:{inclusive:!0},context:"normal"},{keys:"C",type:"operator",operator:"change",operatorArgs:{linewise:!0},context:"visual"},{keys:"~",type:"operatorMotion",operator:"changeCase",motion:"moveByCharacters",motionArgs:{forward:!0},operatorArgs:{shouldMoveCursor:!0},context:"normal"},{keys:"~",type:"operator",operator:"changeCase",context:"visual"},{keys:"",type:"operatorMotion",operator:"delete",motion:"moveToStartOfLine",context:"insert"},{keys:"",type:"operatorMotion",operator:"delete",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1},context:"insert"},{keys:"",type:"idle",context:"normal"},{keys:"",type:"action",action:"jumpListWalk",actionArgs:{forward:!0}},{keys:"",type:"action",action:"jumpListWalk",actionArgs:{forward:!1}},{keys:"",type:"action",action:"scroll",actionArgs:{forward:!0,linewise:!0}},{keys:"",type:"action",action:"scroll",actionArgs:{forward:!1,linewise:!0}},{keys:"a",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"charAfter"},context:"normal"},{keys:"A",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"eol"},context:"normal"},{keys:"A",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"endOfSelectedArea"},context:"visual"},{keys:"i",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"inplace"},context:"normal"},{keys:"gi",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"lastEdit"},context:"normal"},{keys:"I",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"firstNonBlank"},context:"normal"},{keys:"gI",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"bol"},context:"normal"},{keys:"I",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"startOfSelectedArea"},context:"visual"},{keys:"o",type:"action",action:"newLineAndEnterInsertMode",isEdit:!0,interlaceInsertRepeat:!0,actionArgs:{after:!0},context:"normal"},{keys:"O",type:"action",action:"newLineAndEnterInsertMode",isEdit:!0,interlaceInsertRepeat:!0,actionArgs:{after:!1},context:"normal"},{keys:"v",type:"action",action:"toggleVisualMode"},{keys:"V",type:"action",action:"toggleVisualMode",actionArgs:{linewise:!0}},{keys:"",type:"action",action:"toggleVisualMode",actionArgs:{blockwise:!0}},{keys:"",type:"action",action:"toggleVisualMode",actionArgs:{blockwise:!0}},{keys:"gv",type:"action",action:"reselectLastSelection"},{keys:"J",type:"action",action:"joinLines",isEdit:!0},{keys:"gJ",type:"action",action:"joinLines",actionArgs:{keepSpaces:!0},isEdit:!0},{keys:"p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!0,isEdit:!0}},{keys:"P",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!1,isEdit:!0}},{keys:"r",type:"action",action:"replace",isEdit:!0},{keys:"@",type:"action",action:"replayMacro"},{keys:"q",type:"action",action:"enterMacroRecordMode"},{keys:"R",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{replace:!0},context:"normal"},{keys:"R",type:"operator",operator:"change",operatorArgs:{linewise:!0,fullLine:!0},context:"visual",exitVisualBlock:!0},{keys:"u",type:"action",action:"undo",context:"normal"},{keys:"u",type:"operator",operator:"changeCase",operatorArgs:{toLower:!0},context:"visual",isEdit:!0},{keys:"U",type:"operator",operator:"changeCase",operatorArgs:{toLower:!1},context:"visual",isEdit:!0},{keys:"",type:"action",action:"redo"},{keys:"m",type:"action",action:"setMark"},{keys:'"',type:"action",action:"setRegister"},{keys:"",type:"action",action:"insertRegister",context:"insert",isEdit:!0},{keys:"",type:"action",action:"oneNormalCommand",context:"insert"},{keys:"zz",type:"action",action:"scrollToCursor",actionArgs:{position:"center"}},{keys:"z.",type:"action",action:"scrollToCursor",actionArgs:{position:"center"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"zt",type:"action",action:"scrollToCursor",actionArgs:{position:"top"}},{keys:"z",type:"action",action:"scrollToCursor",actionArgs:{position:"top"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"zb",type:"action",action:"scrollToCursor",actionArgs:{position:"bottom"}},{keys:"z-",type:"action",action:"scrollToCursor",actionArgs:{position:"bottom"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:".",type:"action",action:"repeatLastEdit"},{keys:"",type:"action",action:"incrementNumberToken",isEdit:!0,actionArgs:{increase:!0,backtrack:!1}},{keys:"",type:"action",action:"incrementNumberToken",isEdit:!0,actionArgs:{increase:!1,backtrack:!1}},{keys:"",type:"action",action:"indent",actionArgs:{indentRight:!0},context:"insert"},{keys:"",type:"action",action:"indent",actionArgs:{indentRight:!1},context:"insert"},{keys:"a",type:"motion",motion:"textObjectManipulation"},{keys:"i",type:"motion",motion:"textObjectManipulation",motionArgs:{textObjectInner:!0}},{keys:"/",type:"search",searchArgs:{forward:!0,querySrc:"prompt",toJumplist:!0}},{keys:"?",type:"search",searchArgs:{forward:!1,querySrc:"prompt",toJumplist:!0}},{keys:"*",type:"search",searchArgs:{forward:!0,querySrc:"wordUnderCursor",wholeWordOnly:!0,toJumplist:!0}},{keys:"#",type:"search",searchArgs:{forward:!1,querySrc:"wordUnderCursor",wholeWordOnly:!0,toJumplist:!0}},{keys:"g*",type:"search",searchArgs:{forward:!0,querySrc:"wordUnderCursor",toJumplist:!0}},{keys:"g#",type:"search",searchArgs:{forward:!1,querySrc:"wordUnderCursor",toJumplist:!0}},{keys:":",type:"ex"}],n=r.length,o=[{name:"colorscheme",shortName:"colo"},{name:"map"},{name:"imap",shortName:"im"},{name:"nmap",shortName:"nm"},{name:"vmap",shortName:"vm"},{name:"omap",shortName:"om"},{name:"noremap",shortName:"no"},{name:"nnoremap",shortName:"nn"},{name:"vnoremap",shortName:"vn"},{name:"inoremap",shortName:"ino"},{name:"onoremap",shortName:"ono"},{name:"unmap"},{name:"mapclear",shortName:"mapc"},{name:"nmapclear",shortName:"nmapc"},{name:"vmapclear",shortName:"vmapc"},{name:"imapclear",shortName:"imapc"},{name:"omapclear",shortName:"omapc"},{name:"write",shortName:"w"},{name:"undo",shortName:"u"},{name:"redo",shortName:"red"},{name:"set",shortName:"se"},{name:"setlocal",shortName:"setl"},{name:"setglobal",shortName:"setg"},{name:"sort",shortName:"sor"},{name:"substitute",shortName:"s",possiblyAsync:!0},{name:"startinsert",shortName:"start"},{name:"nohlsearch",shortName:"noh"},{name:"yank",shortName:"y"},{name:"delmarks",shortName:"delm"},{name:"registers",shortName:"reg",excludeFromCommandHistory:!0},{name:"vglobal",shortName:"v"},{name:"delete",shortName:"d"},{name:"join",shortName:"j"},{name:"normal",shortName:"norm"},{name:"global",shortName:"g"}],s=cr("");function a(h){h.setOption("disableInput",!0),h.setOption("showCursorWhenSelecting",!1),t.signal(h,"vim-mode-change",{mode:"normal"}),h.on("cursorActivity",ck),ve(h),t.on(h.getInputField(),"paste",c(h))}function l(h){h.setOption("disableInput",!1),h.off("cursorActivity",ck),t.off(h.getInputField(),"paste",c(h)),h.state.vim=null,Wl&&clearTimeout(Wl)}function c(h){var O=h.state.vim;return O.onPasteFn||(O.onPasteFn=function(){O.insertMode||(h.setCursor($e(h.getCursor(),0,1)),ce.enterInsertMode(h,{},O))}),O.onPasteFn}var u=/[\d]/,f=[t.isWordChar,function(h){return h&&!t.isWordChar(h)&&!/\s/.test(h)}],d=[function(h){return/\S/.test(h)}],p=["<",">"],g=["-",'"',".",":","_","/","+"],x=/^\w$/,w;try{w=new RegExp("^[\\p{Lu}]$","u")}catch(h){w=/^[A-Z]$/}function S(h,O){return O>=h.firstLine()&&O<=h.lastLine()}function T(h){return/^[a-z]$/.test(h)}function A(h){return"()[]{}".indexOf(h)!=-1}function I(h){return u.test(h)}function D(h){return w.test(h)}function C(h){return/^\s*$/.test(h)}function j(h){return".?!".indexOf(h)!=-1}function se(h,O){for(var b=0;b1&&O.setOption("textwidth",y)}});var ie=function(){var h=100,O=-1,b=0,y=0,v=new Array(h);function k(X,M,z){var G=O%h,ee=v[G];function Y(ne){var fe=++O%h,Ae=v[fe];Ae&&Ae.clear(),v[fe]=X.setBookmark(ne)}if(ee){var W=ee.find();W&&!Ot(W,M)&&Y(M)}else Y(M);Y(z),b=O,y=O-h+1,y<0&&(y=0)}function P(X,M){O+=M,O>b?O=b:O0?1:-1,ee,Y=X.getCursor();do if(O+=G,z=v[(h+O)%h],z&&(ee=z.find())&&!Ot(Y,ee))break;while(Oy)}return z}function $(X,M){var z=O,G=P(X,M);return O=z,G&&G.find()}return{cachedCursor:void 0,add:k,find:$,move:P}},he=function(h){return h?{changes:h.changes,expectCursorActivityForChange:h.expectCursorActivityForChange}:{changes:[],expectCursorActivityForChange:!1}};class me{constructor(){this.latestRegister=void 0,this.isPlaying=!1,this.isRecording=!1,this.replaySearchQueries=[],this.onRecordingDone=void 0,this.lastInsertModeChanges=he()}exitMacroRecordMode(){var O=q.macroModeState;O.onRecordingDone&&O.onRecordingDone(),O.onRecordingDone=void 0,O.isRecording=!1}enterMacroRecordMode(O,b){var y=q.registerController.getRegister(b);if(y){if(y.clear(),this.latestRegister=b,O.openDialog){var v=ao("span",{class:"cm-vim-message"},"recording @"+b);this.onRecordingDone=O.openDialog(v,null,{bottom:!0})}this.isRecording=!0}}}function ve(h){return h.state.vim||(h.state.vim={inputState:new ur,lastEditInputState:void 0,lastEditActionCommand:void 0,lastHPos:-1,lastHSPos:-1,lastMotion:null,marks:{},insertMode:!1,insertModeReturn:!1,insertModeRepeat:void 0,visualMode:!1,visualLine:!1,visualBlock:!1,lastSelection:null,lastPastedText:null,sel:{},options:{},expectLiteralNext:!1}),h.state.vim}var q;function le(){q={searchQuery:null,searchIsReversed:!1,lastSubstituteReplacePart:void 0,jumpList:ie(),macroModeState:new me,lastCharacterSearch:{increment:0,forward:!0,selectedCharacter:""},registerController:new Mm({}),searchHistoryController:new Ul,exCommandHistoryController:new Ul};for(var h in F){var O=F[h];O.value=O.defaultValue}}var V,E={enterVimMode:a,leaveVimMode:l,buildKeyMap:function(){},getRegisterController:function(){return q.registerController},resetVimGlobalState_:le,getVimGlobalState_:function(){return q},maybeInitVimState_:ve,suppressErrorLogging:!1,InsertModeKey:Ym,map:function(h,O,b){Pr.map(h,O,b)},unmap:function(h,O){return Pr.unmap(h,O)},noremap:function(h,O,b){Pr.map(h,O,b,!0)},mapclear:function(h){var O=r.length,b=n,y=r.slice(0,O-b);if(r=r.slice(O-b),h)for(var v=y.length-1;v>=0;v--){var k=y[v];if(h!==k.context)if(k.context)this._mapCommand(k);else{var P=["normal","insert","visual"];for(var $ in P)if(P[$]!==h){var X=Object.assign({},k);X.context=P[$],this._mapCommand(X)}}}},langmap:_t,vimKeyFromEvent:Ct,setOption:ae,getOption:ue,defineOption:U,defineEx:function(h,O,b){if(!O)O=h;else if(h.indexOf(O)!==0)throw new Error('(Vim.defineEx) "'+O+'" is not a prefix of "'+h+'", command not registered');sk[h]=b,Pr.commandMap_[O]={name:h,shortName:O,type:"api"}},handleKey:function(h,O,b){var y=this.findKey(h,O,b);if(typeof y=="function")return y()},multiSelectHandleKey:dL,findKey:function(h,O,b){var y=ve(h),v=h;function k(){var z=q.macroModeState;if(z.isRecording){if(O=="q")return z.exitMacroRecordMode(),Xt(v),!0;b!="mapping"&&uL(z,O)}}function P(){if(O==""){if(y.visualMode)Zr(v);else if(y.insertMode)lo(v);else return;return Xt(v),!0}}function $(){if(P())return!0;y.inputState.keyBuffer.push(O);var z=y.inputState.keyBuffer.join(""),G=O.length==1,ee=Br.matchCommand(z,r,y.inputState,"insert"),Y=y.inputState.changeQueue;if(ee.type=="none")return Xt(v),!1;if(ee.type=="partial"){if(ee.expectLiteralNext&&(y.expectLiteralNext=!0),V&&window.clearTimeout(V),V=G&&window.setTimeout(function(){y.insertMode&&y.inputState.keyBuffer.length&&Xt(v)},ue("insertModeEscKeysTimeout")),G){var W=v.listSelections();(!Y||Y.removed.length!=W.length)&&(Y=y.inputState.changeQueue=new Zf),Y.inserted+=O;for(var ne=0;ne|./gi,P;P=k.exec(O);){var $=P[0],X=v.insertMode;if(L){Ue($);continue}var M=E.handleKey(h,$,"mapping");if(!M&&X&&v.insertMode){if($[0]=="<"){var z=$.toLowerCase().slice(1,-1),G=z.split("-");if(z=G.pop()||"",z=="lt")$="<";else if(z=="space")$=" ";else if(z=="cr")$=` `;else if(Xe.hasOwnProperty(z)){$=Xe[z],dk(h,$);continue}else $=$[0],k.lastIndex=P.index+1}h.replaceSelection($)}}}finally{if(B.pop(),re=B.length?y:!1,!B.length&&L){var ee=L;L=null,jl(h,ee)}}}var Ze={Return:"CR",Backspace:"BS",Delete:"Del",Escape:"Esc",Insert:"Ins",ArrowLeft:"Left",ArrowRight:"Right",ArrowUp:"Up",ArrowDown:"Down",Enter:"CR"," ":"Space"},$t={Shift:1,Alt:1,Command:1,Control:1,CapsLock:1,AltGraph:1,Dead:1,Unidentified:1},Xe={};"Left|Right|Up|Down|End|Home".split("|").concat(Object.keys(Ze)).forEach(function(h){Xe[(Ze[h]||"").toLowerCase()]=Xe[h.toLowerCase()]=h});function Ct(h,O){var k;var b=h.key;if(!$t[b]){b.length>1&&b[0]=="n"&&(b=b.replace("Numpad","")),b=Ze[b]||b;var y="";if(h.ctrlKey&&(y+="C-"),h.altKey&&(y+="A-"),h.metaKey&&(y+="M-"),t.isMac&&h.altKey&&!h.metaKey&&!h.ctrlKey&&(y=y.slice(2)),(y||b.length>1)&&h.shiftKey&&(y+="S-"),O&&!O.expectLiteralNext&&b.length==1){if(s.keymap&&b in s.keymap)(s.remapCtrl!=!1||!y)&&(b=s.keymap[b]);else if(b.charCodeAt(0)>255){var v=((k=h.code)==null?void 0:k.slice(-1))||"";h.shiftKey||(v=v.toLowerCase()),v&&(b=v)}}return y+=b,y.length>1&&(y="<"+y+">"),y}}function _t(h,O){s.string!==h&&(s=cr(h)),s.remapCtrl=O}function cr(h){let O={};if(!h)return{keymap:O,string:""};function b(y){return y.split(/\\?(.)/).filter(Boolean)}return h.split(/((?:[^\\,]|\\.)+),/).map(y=>{if(!y)return;let v=y.split(/((?:[^\\;]|\\.)+);/);if(v.length==3){let k=b(v[1]),P=b(v[2]);if(k.length!==P.length)return;for(let $=0;$0||this.motionRepeat.length>0)&&(O=1,this.prefixRepeat.length>0&&(O*=parseInt(this.prefixRepeat.join(""),10)),this.motionRepeat.length>0&&(O*=parseInt(this.motionRepeat.join(""),10))),O}}function Xt(h,O){h.state.vim.inputState=new ur,h.state.vim.expectLiteralNext=!1,t.signal(h,"vim-command-done",O)}function Zf(){this.removed=[],this.inserted=""}class Bi{constructor(O,b,y){this.clear(),this.keyBuffer=[O||""],this.insertModeChanges=[],this.searchQueries=[],this.linewise=!!b,this.blockwise=!!y}setText(O,b,y){this.keyBuffer=[O||""],this.linewise=!!b,this.blockwise=!!y}pushText(O,b){b&&(this.linewise||this.keyBuffer.push(` `),this.linewise=!0),this.keyBuffer.push(O)}pushInsertModeChanges(O){this.insertModeChanges.push(he(O))}pushSearchQuery(O){this.searchQueries.push(O)}clear(){this.keyBuffer=[],this.insertModeChanges=[],this.searchQueries=[],this.linewise=!1}toString(){return this.keyBuffer.join("")}}function Vf(h,O){var b=q.registerController.registers;if(!h||h.length!=1)throw Error("Register name must be 1 character");if(b[h])throw Error("Register already defined "+h);b[h]=O,g.push(h)}class Mm{constructor(O){this.registers=O,this.unnamedRegister=O['"']=new Bi,O["."]=new Bi,O[":"]=new Bi,O["/"]=new Bi,O["+"]=new Bi}pushText(O,b,y,v,k){if(O!=="_"){v&&y.charAt(y.length-1)!==` `&&(y+=` `);var P=this.isValidRegister(O)?this.getRegister(O):null;if(!P){switch(b){case"yank":this.registers[0]=new Bi(y,v,k);break;case"delete":case"change":y.indexOf(` -`)==-1?this.registers["-"]=new Bi(y,v):(this.shiftNumericRegisters_(),this.registers[1]=new Bi(y,v));break}this.unnamedRegister.setText(y,v,k);return}var $=D(O);$?P.pushText(y,v):P.setText(y,v,k),O==="+"&&navigator.clipboard.writeText(y),this.unnamedRegister.setText(P.toString(),v)}}getRegister(O){return this.isValidRegister(O)?(O=O.toLowerCase(),this.registers[O]||(this.registers[O]=new Bi),this.registers[O]):this.unnamedRegister}isValidRegister(O){return O&&(se(O,g)||x.test(O))}shiftNumericRegisters_(){for(var O=9;O>=2;O--)this.registers[O]=this.getRegister(""+(O-1))}}class Ul{constructor(){this.historyBuffer=[],this.iterator=0,this.initialPrefix=null}nextMatch(O,b){var y=this.historyBuffer,v=b?-1:1;this.initialPrefix===null&&(this.initialPrefix=O);for(var k=this.iterator+v;b?k>=0:k=y.length)return this.iterator=y.length,this.initialPrefix;if(k<0)return O}pushInput(O){var b=this.historyBuffer.indexOf(O);b>-1&&this.historyBuffer.splice(b,1),O.length&&this.historyBuffer.push(O)}reset(){this.initialPrefix=null,this.iterator=this.historyBuffer.length}}var Br={matchCommand:function(h,O,b,y){var v=Zi(h,O,y,b);if(!v.full&&!v.partial)return{type:"none"};if(!v.full&&v.partial)return{type:"partial",expectLiteralNext:v.partial.length==1&&v.partial[0].keys.slice(-11)==""};for(var k,P=0;P"||k.keys.slice(-10)==""){var X=Cr(h);if(!X||X.length>1)return{type:"clear"};b.selectedCharacter=X}return{type:"full",command:k}},processCommand:function(h,O,b){switch(O.inputState.repeatOverride=b.repeatOverride,b.type){case"motion":this.processMotion(h,O,b);break;case"operator":this.processOperator(h,O,b);break;case"operatorMotion":this.processOperatorMotion(h,O,b);break;case"action":this.processAction(h,O,b);break;case"search":this.processSearch(h,O,b);break;case"ex":case"keyToEx":this.processEx(h,O,b);break}},processMotion:function(h,O,b){O.inputState.motion=b.motion,O.inputState.motionArgs=je(b.motionArgs),this.evalInput(h,O)},processOperator:function(h,O,b){var y=O.inputState;if(y.operator)if(y.operator==b.operator){y.motion="expandToLine",y.motionArgs={linewise:!0,repeat:1},this.evalInput(h,O);return}else Xt(h);y.operator=b.operator,y.operatorArgs=je(b.operatorArgs),b.keys.length>1&&(y.operatorShortcut=b.keys),b.exitVisualBlock&&(O.visualBlock=!1,ha(h)),O.visualMode&&this.evalInput(h,O)},processOperatorMotion:function(h,O,b){var y=O.visualMode,v=je(b.operatorMotionArgs);v&&y&&v.visualLine&&(O.visualLine=!0),this.processOperator(h,O,b),y||this.processMotion(h,O,b)},processAction:function(h,O,b){var y=O.inputState,v=y.getRepeat(),k=!!v,P=je(b.actionArgs)||{repeat:1};y.selectedCharacter&&(P.selectedCharacter=y.selectedCharacter),b.operator&&this.processOperator(h,O,b),b.motion&&this.processMotion(h,O,b),(b.motion||b.operator)&&this.evalInput(h,O),P.repeat=v||1,P.repeatIsExplicit=k,P.registerName=y.registerName,Xt(h),O.lastMotion=null,b.isEdit&&this.recordLastEdit(O,y,b),ce[b.action](h,P,O)},processSearch:function(h,O,b){if(!h.getSearchCursor)return;var y=b.searchArgs.forward,v=b.searchArgs.wholeWordOnly;_r(h).setReversed(!y);var k=y?"/":"?",P=_r(h).getQuery(),$=h.getScrollInfo();function X(ne,fe,Ae){q.searchHistoryController.pushInput(ne),q.searchHistoryController.reset();try{ql(h,ne,fe,Ae)}catch(Pe){ut(h,"Invalid regex: "+ne),Xt(h);return}Br.processMotion(h,O,{keys:"",type:"motion",motion:"findNext",motionArgs:{forward:!0,toJumplist:b.searchArgs.toJumplist}})}function M(ne){h.scrollTo($.left,$.top),X(ne,!0,!0);var fe=q.macroModeState;fe.isRecording&&hL(fe,ne)}function z(ne,fe,Ae){var Pe=Ct(ne),Re,ft;Pe==""||Pe==""?(Re=Pe=="",ft=ne.target?ne.target.selectionEnd:0,fe=q.searchHistoryController.nextMatch(fe,Re)||"",Ae(fe),ft&&ne.target&&(ne.target.selectionEnd=ne.target.selectionStart=Math.min(ft,ne.target.value.length))):Pe&&Pe!=""&&Pe!=""&&q.searchHistoryController.reset();var fi;try{fi=ql(h,fe,!0,!0)}catch(qt){}fi?h.scrollIntoView(nk(h,!y,fi),30):(Zm(h),h.scrollTo($.left,$.top))}function G(ne,fe,Ae){var Pe=Ct(ne);Pe==""||Pe==""||Pe==""||Pe==""&&fe==""?(q.searchHistoryController.pushInput(fe),q.searchHistoryController.reset(),ql(h,P),Zm(h),h.scrollTo($.left,$.top),t.e_stop(ne),Xt(h),Ae(),h.focus()):Pe==""||Pe==""?t.e_stop(ne):Pe==""&&(t.e_stop(ne),Ae(""))}switch(b.searchArgs.querySrc){case"prompt":var ee=q.macroModeState;if(ee.isPlaying){let fe=ee.replaySearchQueries.shift();X(fe,!0,!1)}else jl(h,{onClose:M,prefix:k,desc:"(JavaScript regexp)",onKeyUp:z,onKeyDown:G});break;case"wordUnderCursor":var Y=Wm(h,{noSymbol:!0}),W=!0;if(Y||(Y=Wm(h,{noSymbol:!1}),W=!1),!Y){ut(h,"No word under cursor"),Xt(h);return}let ne=h.getLine(Y.start.line).substring(Y.start.ch,Y.end.ch);W&&v?ne="\\b"+ne+"\\b":ne=$I(ne),q.jumpList.cachedCursor=h.getCursor(),h.setCursor(Y.start),X(ne,!0,!1);break}},processEx:function(h,O,b){function y(k){q.exCommandHistoryController.pushInput(k),q.exCommandHistoryController.reset(),Pr.processCommand(h,k),h.state.vim&&Xt(h)}function v(k,P,$){var X=Ct(k),M,z;(X==""||X==""||X==""||X==""&&P=="")&&(q.exCommandHistoryController.pushInput(P),q.exCommandHistoryController.reset(),t.e_stop(k),Xt(h),$(),h.focus()),X==""||X==""?(t.e_stop(k),M=X=="",z=k.target?k.target.selectionEnd:0,P=q.exCommandHistoryController.nextMatch(P,M)||"",$(P),z&&k.target&&(k.target.selectionEnd=k.target.selectionStart=Math.min(z,k.target.value.length))):X==""?(t.e_stop(k),$("")):X&&X!=""&&X!=""&&q.exCommandHistoryController.reset()}b.type=="keyToEx"?Pr.processCommand(h,b.exArgs.input):O.visualMode?jl(h,{onClose:y,prefix:":",value:"'<,'>",onKeyDown:v,selectValueOnOpen:!1}):jl(h,{onClose:y,prefix:":",onKeyDown:v})},evalInput:function(h,O){var b=O.inputState,y=b.motion,v=b.motionArgs||{repeat:1},k=b.operator,P=b.operatorArgs||{},$=b.registerName,X=O.sel,M=it(O.visualMode?Ee(h,X.head):h.getCursor("head")),z=it(O.visualMode?Ee(h,X.anchor):h.getCursor("anchor")),G=it(M),ee=it(z),Y,W,ne;if(k&&this.recordLastEdit(O,b),b.repeatOverride!==void 0?ne=b.repeatOverride:ne=b.getRepeat(),ne>0&&v.explicitRepeat?v.repeatIsExplicit=!0:(v.noRepeat||!v.explicitRepeat&&ne===0)&&(ne=1,v.repeatIsExplicit=!1),b.selectedCharacter&&(v.selectedCharacter=P.selectedCharacter=b.selectedCharacter),v.repeat=ne,Xt(h),y){var fe=Er[y](h,M,v,O,b);if(O.lastMotion=Er[y],!fe)return;if(v.toJumplist){var Ae=q.jumpList,Pe=Ae.cachedCursor;Pe?(B2(h,Pe,fe),delete Ae.cachedCursor):B2(h,M,fe)}fe instanceof Array?(W=fe[0],Y=fe[1]):Y=fe,Y||(Y=it(M)),O.visualMode?(O.visualBlock&&Y.ch===1/0||(Y=Ee(h,Y,G)),W&&(W=Ee(h,W)),W=W||ee,X.anchor=W,X.head=Y,ha(h),vn(h,O,"<",at(W,Y)?W:Y),vn(h,O,">",at(W,Y)?Y:W)):k||(Y=Ee(h,Y,G),h.setCursor(Y.line,Y.ch))}if(k){if(P.lastSel){W=ee;var Re=P.lastSel,ft=Math.abs(Re.head.line-Re.anchor.line),fi=Math.abs(Re.head.ch-Re.anchor.ch);Re.visualLine?Y=new e(ee.line+ft,ee.ch):Re.visualBlock?Y=new e(ee.line+ft,ee.ch+fi):Re.head.line==Re.anchor.line?Y=new e(ee.line,ee.ch+fi):Y=new e(ee.line+ft,ee.ch),O.visualMode=!0,O.visualLine=Re.visualLine,O.visualBlock=Re.visualBlock,X=O.sel={anchor:W,head:Y},ha(h)}else O.visualMode&&(P.lastSel={anchor:it(X.anchor),head:it(X.head),visualBlock:O.visualBlock,visualLine:O.visualLine});var qt,ei,Ge,Je,ki;if(O.visualMode){qt=kt(X.head,X.anchor),ei=so(X.head,X.anchor),Ge=O.visualLine||P.linewise,Je=O.visualBlock?"block":Ge?"line":"char";var ti=i(h,qt,ei);if(ki=qm(h,{anchor:ti.start,head:ti.end},Je),Ge){var Zt=ki.ranges;if(Je=="block")for(var Yr=0;Yr$:z.line<$;return G&&($=z.line,k=z.ch),$M&&v.line==M?F2(h,O,b,y,!0):(b.toFirstChar&&(k=Vr(h.getLine($)),y.lastHPos=k),y.lastHSPos=h.charCoords(new e($,k),"div").left,new e($,k))},moveByDisplayLines:function(h,O,b,y){var v=O;switch(y.lastMotion){case this.moveByDisplayLines:case this.moveByScroll:case this.moveByLines:case this.moveToColumn:case this.moveToEol:break;default:y.lastHSPos=h.charCoords(v,"div").left}var k=b.repeat,P=h.findPosV(v,b.forward?k:-k,"line",y.lastHSPos);if(P.hitSide)if(b.forward){var $=h.charCoords(P,"div"),X={top:$.top+8,left:y.lastHSPos};P=h.coordsChar(X,"div")}else{var M=h.charCoords(new e(h.firstLine(),0),"div");M.left=y.lastHSPos,P=h.coordsChar(M,"div")}return y.lastHPos=P.ch,P},moveByPage:function(h,O,b){var y=O,v=b.repeat;return h.findPosV(y,b.forward?v:-v,"page")},moveByParagraph:function(h,O,b){var y=b.forward?1:-1;return H2(h,O,b.repeat,y).start},moveBySentence:function(h,O,b){var y=b.forward?1:-1;return ZI(h,O,b.repeat,y)},moveByScroll:function(h,O,b,y){var v=h.getScrollInfo(),k=null,P=b.repeat;P||(P=v.clientHeight/(2*h.defaultTextHeight()));var $=h.charCoords(O,"local");if(b.repeat=P,k=Er.moveByDisplayLines(h,O,b,y),!k)return null;var X=h.charCoords(k,"local");return h.scrollTo(null,v.top+X.top-$.top),k},moveByWords:function(h,O,b){return qI(h,O,b.repeat,!!b.forward,!!b.wordEnd,!!b.bigWord)},moveTillCharacter:function(h,O,b){var y=b.repeat,v=Bm(h,y,b.forward,b.selectedCharacter,O),k=b.forward?-1:1;return Z2(k,b),v?(v.ch+=k,v):null},moveToCharacter:function(h,O,b){var y=b.repeat;return Z2(0,b),Bm(h,y,b.forward,b.selectedCharacter,O)||O},moveToSymbol:function(h,O,b){var y=b.repeat;return b.selectedCharacter&&jI(h,y,b.forward,b.selectedCharacter)||O},moveToColumn:function(h,O,b,y){var v=b.repeat;return y.lastHPos=v-1,y.lastHSPos=h.charCoords(O,"div").left,WI(h,v)},moveToEol:function(h,O,b,y){return F2(h,O,b,y,!1)},moveToFirstNonWhiteSpaceCharacter:function(h,O){var b=O;return new e(b.line,Vr(h.getLine(b.line)))},moveToMatchedSymbol:function(h,O){for(var b=O,y=b.line,v=b.ch,k=h.getLine(y),P;v"?/[(){}[\]<>]/:/[(){}[\]]/,M=h.findMatchingBracket(new e(y,v),{bracketRegex:X});return M.to}else return b},moveToStartOfLine:function(h,O){return new e(O.line,0)},moveToLineOrEdgeOfDocument:function(h,O,b){var y=b.forward?h.lastLine():h.firstLine();return b.repeatIsExplicit&&(y=b.repeat-h.getOption("firstLineNumber")),new e(y,Vr(h.getLine(y)))},moveToStartOfDisplayLine:function(h){return h.execCommand("goLineLeft"),h.getCursor()},moveToEndOfDisplayLine:function(h){h.execCommand("goLineRight");var O=h.getCursor();return O.sticky=="before"&&O.ch--,O},textObjectManipulation:function(h,O,b,y){var v={"(":")",")":"(","{":"}","}":"{","[":"]","]":"[","<":">",">":"<"},k={"'":!0,'"':!0,"`":!0},P=b.selectedCharacter||"";P=="b"?P="(":P=="B"&&(P="{");var $=!b.textObjectInner,X,M;if(v[P]){if(M=!0,X=K2(h,O,P,$),!X){var z=h.getSearchCursor(new RegExp("\\"+P,"g"),O);z.find()&&(X=K2(h,z.from(),P,$))}}else if(k[P])M=!0,X=VI(h,O,P,$);else if(P==="W"||P==="w")for(var G=b.repeat||1;G-- >0;){var ee=Wm(h,{inclusive:$,innerWord:!$,bigWord:P==="W",noSymbol:P==="W",multiline:!0},X&&X.end);ee&&(X||(X=ee),X.end=ee.end)}else if(P==="p")if(X=H2(h,O,b.repeat,0,$),b.linewise=!0,y.visualMode)y.visualLine||(y.visualLine=!0);else{var Y=y.inputState.operatorArgs;Y&&(Y.linewise=!0),X.end.line--}else if(P==="t")X=UI(h,O,$);else if(P==="s"){var W=h.getLine(O.line);O.ch>0&&j(W[O.ch])&&(O.ch-=1);var ne=G2(h,O,b.repeat,1,$),fe=G2(h,O,b.repeat,-1,$);C(h.getLine(fe.line)[fe.ch])&&C(h.getLine(ne.line)[ne.ch-1])&&(fe={line:fe.line,ch:fe.ch+1}),X={start:fe,end:ne}}return X?h.state.vim.visualMode?LI(h,X.start,X.end,M):[X.start,X.end]:null},repeatLastCharacterSearch:function(h,O,b){var y=q.lastCharacterSearch,v=b.repeat,k=b.forward===y.forward,P=(y.increment?1:0)*(k?-1:1);h.moveH(-P,"char"),b.inclusive=!!k;var $=Bm(h,v,k,y.selectedCharacter);return $?($.ch+=P,$):(h.moveH(P,"char"),O)}};function Um(h,O){Er[h]=O}function Yf(h,O){for(var b=[],y=0;yP.line&&($=new e($.line-1,Number.MAX_VALUE))),h.replaceRange("",P,$),y=P}q.registerController.pushText(O.registerName,"change",v,O.linewise,b.length>1),ce.enterInsertMode(h,{head:y},h.state.vim)},delete:function(h,O,b){var y,v,k=h.state.vim;if(k.visualBlock){v=h.getSelection();var X=Yf("",b.length);h.replaceSelections(X),y=kt(b[0].head,b[0].anchor)}else{var P=b[0].anchor,$=b[0].head;O.linewise&&$.line!=h.firstLine()&&P.line==h.lastLine()&&P.line==$.line-1&&(P.line==h.firstLine()?P.ch=0:P=new e(P.line-1,Jt(h,P.line-1))),v=h.getRange(P,$),h.replaceRange("",P,$),y=P,O.linewise&&(y=Er.moveToFirstNonWhiteSpaceCharacter(h,P))}return q.registerController.pushText(O.registerName,"delete",v,O.linewise,k.visualBlock),Ee(h,y)},indent:function(h,O,b){var y=h.state.vim,v=y.visualMode?O.repeat||0:1;if(h.indentMore)for(var k=0;kv&&O.linewise&&P--,O.keepCursor?y:new e(P,0)}},changeCase:function(h,O,b,y,v){for(var k=h.getSelections(),P=[],$=O.toLower,X=0;XM.top?(X.line+=($-M.top)/v,X.line=Math.ceil(X.line),h.setCursor(X),M=h.charCoords(X,"local"),h.scrollTo(null,M.top)):h.scrollTo(null,$);else{var z=$+h.getScrollInfo().clientHeight;z=v.anchor.line?k=$e(v.head,0,1):k=new e(v.anchor.line,0)}else if(y=="inplace"){if(b.visualMode)return}else y=="lastEdit"&&(k=ok(h)||k);h.setOption("disableInput",!1),O&&O.replace?(h.toggleOverwrite(!0),h.setOption("keyMap","vim-replace"),t.signal(h,"vim-mode-change",{mode:"replace"})):(h.toggleOverwrite(!1),h.setOption("keyMap","vim-insert"),t.signal(h,"vim-mode-change",{mode:"insert"})),q.macroModeState.isPlaying||(h.on("change",lk),b.insertEnd&&b.insertEnd.clear(),b.insertEnd=h.setBookmark(k,{insertLeft:!0}),t.on(h.getInputField(),"keydown",fk)),b.visualMode&&Zr(h),q2(h,k,P)}},toggleVisualMode:function(h,O,b){var y=O.repeat,v=h.getCursor(),k;if(b.visualMode)b.visualLine!=!!O.linewise||b.visualBlock!=!!O.blockwise?(b.visualLine=!!O.linewise,b.visualBlock=!!O.blockwise,t.signal(h,"vim-mode-change",{mode:"visual",subMode:b.visualLine?"linewise":b.visualBlock?"blockwise":""}),ha(h)):Zr(h);else{b.visualMode=!0,b.visualLine=!!O.linewise,b.visualBlock=!!O.blockwise,k=Ee(h,new e(v.line,v.ch+y-1));var P=i(h,v,k);b.sel={anchor:P.start,head:P.end},t.signal(h,"vim-mode-change",{mode:"visual",subMode:b.visualLine?"linewise":b.visualBlock?"blockwise":""}),ha(h),vn(h,b,"<",kt(v,k)),vn(h,b,">",so(v,k))}},reselectLastSelection:function(h,O,b){var y=b.lastSelection;if(b.visualMode&&W2(h,b),y){var v=y.anchorMark.find(),k=y.headMark.find();if(!v||!k)return;b.sel={anchor:v,head:k},b.visualMode=!0,b.visualLine=y.visualLine,b.visualBlock=y.visualBlock,ha(h),vn(h,b,"<",kt(v,k)),vn(h,b,">",so(v,k)),t.signal(h,"vim-mode-change",{mode:"visual",subMode:b.visualLine?"linewise":b.visualBlock?"blockwise":""})}},joinLines:function(h,O,b){var y,v;if(b.visualMode){if(y=h.getCursor("anchor"),v=h.getCursor("head"),at(v,y)){var k=v;v=y,y=k}v.ch=Jt(h,v.line)-1}else{var P=Math.max(O.repeat,2);y=h.getCursor(),v=Ee(h,new e(y.line+P-1,1/0))}for(var $=0,X=y.line;X=2;O--)this.registers[O]=this.getRegister(""+(O-1))}}class Ul{constructor(){this.historyBuffer=[],this.iterator=0,this.initialPrefix=null}nextMatch(O,b){var y=this.historyBuffer,v=b?-1:1;this.initialPrefix===null&&(this.initialPrefix=O);for(var k=this.iterator+v;b?k>=0:k=y.length)return this.iterator=y.length,this.initialPrefix;if(k<0)return O}pushInput(O){var b=this.historyBuffer.indexOf(O);b>-1&&this.historyBuffer.splice(b,1),O.length&&this.historyBuffer.push(O)}reset(){this.initialPrefix=null,this.iterator=this.historyBuffer.length}}var Br={matchCommand:function(h,O,b,y){var v=Zi(h,O,y,b);if(!v.full&&!v.partial)return{type:"none"};if(!v.full&&v.partial)return{type:"partial",expectLiteralNext:v.partial.length==1&&v.partial[0].keys.slice(-11)==""};for(var k,P=0;P"||k.keys.slice(-10)==""){var X=Cr(h);if(!X||X.length>1)return{type:"clear"};b.selectedCharacter=X}return{type:"full",command:k}},processCommand:function(h,O,b){switch(O.inputState.repeatOverride=b.repeatOverride,b.type){case"motion":this.processMotion(h,O,b);break;case"operator":this.processOperator(h,O,b);break;case"operatorMotion":this.processOperatorMotion(h,O,b);break;case"action":this.processAction(h,O,b);break;case"search":this.processSearch(h,O,b);break;case"ex":case"keyToEx":this.processEx(h,O,b);break}},processMotion:function(h,O,b){O.inputState.motion=b.motion,O.inputState.motionArgs=je(b.motionArgs),this.evalInput(h,O)},processOperator:function(h,O,b){var y=O.inputState;if(y.operator)if(y.operator==b.operator){y.motion="expandToLine",y.motionArgs={linewise:!0,repeat:1},this.evalInput(h,O);return}else Xt(h);y.operator=b.operator,y.operatorArgs=je(b.operatorArgs),b.keys.length>1&&(y.operatorShortcut=b.keys),b.exitVisualBlock&&(O.visualBlock=!1,ha(h)),O.visualMode&&this.evalInput(h,O)},processOperatorMotion:function(h,O,b){var y=O.visualMode,v=je(b.operatorMotionArgs);v&&y&&v.visualLine&&(O.visualLine=!0),this.processOperator(h,O,b),y||this.processMotion(h,O,b)},processAction:function(h,O,b){var y=O.inputState,v=y.getRepeat(),k=!!v,P=je(b.actionArgs)||{repeat:1};y.selectedCharacter&&(P.selectedCharacter=y.selectedCharacter),b.operator&&this.processOperator(h,O,b),b.motion&&this.processMotion(h,O,b),(b.motion||b.operator)&&this.evalInput(h,O),P.repeat=v||1,P.repeatIsExplicit=k,P.registerName=y.registerName,Xt(h),O.lastMotion=null,b.isEdit&&this.recordLastEdit(O,y,b),ce[b.action](h,P,O)},processSearch:function(h,O,b){if(!h.getSearchCursor)return;var y=b.searchArgs.forward,v=b.searchArgs.wholeWordOnly;_r(h).setReversed(!y);var k=y?"/":"?",P=_r(h).getQuery(),$=h.getScrollInfo();function X(ne,fe,Ae){q.searchHistoryController.pushInput(ne),q.searchHistoryController.reset();try{ql(h,ne,fe,Ae)}catch(Pe){ut(h,"Invalid regex: "+ne),Xt(h);return}Br.processMotion(h,O,{keys:"",type:"motion",motion:"findNext",motionArgs:{forward:!0,toJumplist:b.searchArgs.toJumplist}})}function M(ne){h.scrollTo($.left,$.top),X(ne,!0,!0);var fe=q.macroModeState;fe.isRecording&&hL(fe,ne)}function z(ne,fe,Ae){var Pe=Ct(ne),Re,ft;Pe==""||Pe==""?(Re=Pe=="",ft=ne.target?ne.target.selectionEnd:0,fe=q.searchHistoryController.nextMatch(fe,Re)||"",Ae(fe),ft&&ne.target&&(ne.target.selectionEnd=ne.target.selectionStart=Math.min(ft,ne.target.value.length))):Pe&&Pe!=""&&Pe!=""&&q.searchHistoryController.reset();var fi;try{fi=ql(h,fe,!0,!0)}catch(qt){}fi?h.scrollIntoView(nk(h,!y,fi),30):(Zm(h),h.scrollTo($.left,$.top))}function G(ne,fe,Ae){var Pe=Ct(ne);Pe==""||Pe==""||Pe==""||Pe==""&&fe==""?(q.searchHistoryController.pushInput(fe),q.searchHistoryController.reset(),ql(h,P),Zm(h),h.scrollTo($.left,$.top),t.e_stop(ne),Xt(h),Ae(),h.focus()):Pe==""||Pe==""?t.e_stop(ne):Pe==""&&(t.e_stop(ne),Ae(""))}switch(b.searchArgs.querySrc){case"prompt":var ee=q.macroModeState;if(ee.isPlaying){let fe=ee.replaySearchQueries.shift();X(fe,!0,!1)}else jl(h,{onClose:M,prefix:k,desc:"(JavaScript regexp)",onKeyUp:z,onKeyDown:G});break;case"wordUnderCursor":var Y=Wm(h,{noSymbol:!0}),W=!0;if(Y||(Y=Wm(h,{noSymbol:!1}),W=!1),!Y){ut(h,"No word under cursor"),Xt(h);return}let ne=h.getLine(Y.start.line).substring(Y.start.ch,Y.end.ch);W&&v?ne="\\b"+ne+"\\b":ne=$I(ne),q.jumpList.cachedCursor=h.getCursor(),h.setCursor(Y.start),X(ne,!0,!1);break}},processEx:function(h,O,b){function y(k){q.exCommandHistoryController.pushInput(k),q.exCommandHistoryController.reset(),Pr.processCommand(h,k),h.state.vim&&Xt(h)}function v(k,P,$){var X=Ct(k),M,z;(X==""||X==""||X==""||X==""&&P=="")&&(q.exCommandHistoryController.pushInput(P),q.exCommandHistoryController.reset(),t.e_stop(k),Xt(h),$(),h.focus()),X==""||X==""?(t.e_stop(k),M=X=="",z=k.target?k.target.selectionEnd:0,P=q.exCommandHistoryController.nextMatch(P,M)||"",$(P),z&&k.target&&(k.target.selectionEnd=k.target.selectionStart=Math.min(z,k.target.value.length))):X==""?(t.e_stop(k),$("")):X&&X!=""&&X!=""&&q.exCommandHistoryController.reset()}b.type=="keyToEx"?Pr.processCommand(h,b.exArgs.input):O.visualMode?jl(h,{onClose:y,prefix:":",value:"'<,'>",onKeyDown:v,selectValueOnOpen:!1}):jl(h,{onClose:y,prefix:":",onKeyDown:v})},evalInput:function(h,O){var b=O.inputState,y=b.motion,v=b.motionArgs||{repeat:1},k=b.operator,P=b.operatorArgs||{},$=b.registerName,X=O.sel,M=it(O.visualMode?Ee(h,X.head):h.getCursor("head")),z=it(O.visualMode?Ee(h,X.anchor):h.getCursor("anchor")),G=it(M),ee=it(z),Y,W,ne;if(k&&this.recordLastEdit(O,b),b.repeatOverride!==void 0?ne=b.repeatOverride:ne=b.getRepeat(),ne>0&&v.explicitRepeat?v.repeatIsExplicit=!0:(v.noRepeat||!v.explicitRepeat&&ne===0)&&(ne=1,v.repeatIsExplicit=!1),b.selectedCharacter&&(v.selectedCharacter=P.selectedCharacter=b.selectedCharacter),v.repeat=ne,Xt(h),y){var fe=Er[y](h,M,v,O,b);if(O.lastMotion=Er[y],!fe)return;if(v.toJumplist){var Ae=q.jumpList,Pe=Ae.cachedCursor;Pe?(B2(h,Pe,fe),delete Ae.cachedCursor):B2(h,M,fe)}fe instanceof Array?(W=fe[0],Y=fe[1]):Y=fe,Y||(Y=it(M)),O.visualMode?(O.visualBlock&&Y.ch===1/0||(Y=Ee(h,Y,G)),W&&(W=Ee(h,W)),W=W||ee,X.anchor=W,X.head=Y,ha(h),vn(h,O,"<",at(W,Y)?W:Y),vn(h,O,">",at(W,Y)?Y:W)):k||(Y=Ee(h,Y,G),h.setCursor(Y.line,Y.ch))}if(k){if(P.lastSel){W=ee;var Re=P.lastSel,ft=Math.abs(Re.head.line-Re.anchor.line),fi=Math.abs(Re.head.ch-Re.anchor.ch);Re.visualLine?Y=new e(ee.line+ft,ee.ch):Re.visualBlock?Y=new e(ee.line+ft,ee.ch+fi):Re.head.line==Re.anchor.line?Y=new e(ee.line,ee.ch+fi):Y=new e(ee.line+ft,ee.ch),O.visualMode=!0,O.visualLine=Re.visualLine,O.visualBlock=Re.visualBlock,X=O.sel={anchor:W,head:Y},ha(h)}else O.visualMode&&(P.lastSel={anchor:it(X.anchor),head:it(X.head),visualBlock:O.visualBlock,visualLine:O.visualLine});var qt,ei,Ge,Je,ki;if(O.visualMode){qt=St(X.head,X.anchor),ei=so(X.head,X.anchor),Ge=O.visualLine||P.linewise,Je=O.visualBlock?"block":Ge?"line":"char";var ti=i(h,qt,ei);if(ki=qm(h,{anchor:ti.start,head:ti.end},Je),Ge){var Zt=ki.ranges;if(Je=="block")for(var Yr=0;Yr$:z.line<$;return G&&($=z.line,k=z.ch),$M&&v.line==M?F2(h,O,b,y,!0):(b.toFirstChar&&(k=Vr(h.getLine($)),y.lastHPos=k),y.lastHSPos=h.charCoords(new e($,k),"div").left,new e($,k))},moveByDisplayLines:function(h,O,b,y){var v=O;switch(y.lastMotion){case this.moveByDisplayLines:case this.moveByScroll:case this.moveByLines:case this.moveToColumn:case this.moveToEol:break;default:y.lastHSPos=h.charCoords(v,"div").left}var k=b.repeat,P=h.findPosV(v,b.forward?k:-k,"line",y.lastHSPos);if(P.hitSide)if(b.forward){var $=h.charCoords(P,"div"),X={top:$.top+8,left:y.lastHSPos};P=h.coordsChar(X,"div")}else{var M=h.charCoords(new e(h.firstLine(),0),"div");M.left=y.lastHSPos,P=h.coordsChar(M,"div")}return y.lastHPos=P.ch,P},moveByPage:function(h,O,b){var y=O,v=b.repeat;return h.findPosV(y,b.forward?v:-v,"page")},moveByParagraph:function(h,O,b){var y=b.forward?1:-1;return H2(h,O,b.repeat,y).start},moveBySentence:function(h,O,b){var y=b.forward?1:-1;return ZI(h,O,b.repeat,y)},moveByScroll:function(h,O,b,y){var v=h.getScrollInfo(),k=null,P=b.repeat;P||(P=v.clientHeight/(2*h.defaultTextHeight()));var $=h.charCoords(O,"local");if(b.repeat=P,k=Er.moveByDisplayLines(h,O,b,y),!k)return null;var X=h.charCoords(k,"local");return h.scrollTo(null,v.top+X.top-$.top),k},moveByWords:function(h,O,b){return qI(h,O,b.repeat,!!b.forward,!!b.wordEnd,!!b.bigWord)},moveTillCharacter:function(h,O,b){var y=b.repeat,v=Bm(h,y,b.forward,b.selectedCharacter,O),k=b.forward?-1:1;return Z2(k,b),v?(v.ch+=k,v):null},moveToCharacter:function(h,O,b){var y=b.repeat;return Z2(0,b),Bm(h,y,b.forward,b.selectedCharacter,O)||O},moveToSymbol:function(h,O,b){var y=b.repeat;return b.selectedCharacter&&jI(h,y,b.forward,b.selectedCharacter)||O},moveToColumn:function(h,O,b,y){var v=b.repeat;return y.lastHPos=v-1,y.lastHSPos=h.charCoords(O,"div").left,WI(h,v)},moveToEol:function(h,O,b,y){return F2(h,O,b,y,!1)},moveToFirstNonWhiteSpaceCharacter:function(h,O){var b=O;return new e(b.line,Vr(h.getLine(b.line)))},moveToMatchedSymbol:function(h,O){for(var b=O,y=b.line,v=b.ch,k=h.getLine(y),P;v"?/[(){}[\]<>]/:/[(){}[\]]/,M=h.findMatchingBracket(new e(y,v),{bracketRegex:X});return M.to}else return b},moveToStartOfLine:function(h,O){return new e(O.line,0)},moveToLineOrEdgeOfDocument:function(h,O,b){var y=b.forward?h.lastLine():h.firstLine();return b.repeatIsExplicit&&(y=b.repeat-h.getOption("firstLineNumber")),new e(y,Vr(h.getLine(y)))},moveToStartOfDisplayLine:function(h){return h.execCommand("goLineLeft"),h.getCursor()},moveToEndOfDisplayLine:function(h){h.execCommand("goLineRight");var O=h.getCursor();return O.sticky=="before"&&O.ch--,O},textObjectManipulation:function(h,O,b,y){var v={"(":")",")":"(","{":"}","}":"{","[":"]","]":"[","<":">",">":"<"},k={"'":!0,'"':!0,"`":!0},P=b.selectedCharacter||"";P=="b"?P="(":P=="B"&&(P="{");var $=!b.textObjectInner,X,M;if(v[P]){if(M=!0,X=K2(h,O,P,$),!X){var z=h.getSearchCursor(new RegExp("\\"+P,"g"),O);z.find()&&(X=K2(h,z.from(),P,$))}}else if(k[P])M=!0,X=VI(h,O,P,$);else if(P==="W"||P==="w")for(var G=b.repeat||1;G-- >0;){var ee=Wm(h,{inclusive:$,innerWord:!$,bigWord:P==="W",noSymbol:P==="W",multiline:!0},X&&X.end);ee&&(X||(X=ee),X.end=ee.end)}else if(P==="p")if(X=H2(h,O,b.repeat,0,$),b.linewise=!0,y.visualMode)y.visualLine||(y.visualLine=!0);else{var Y=y.inputState.operatorArgs;Y&&(Y.linewise=!0),X.end.line--}else if(P==="t")X=UI(h,O,$);else if(P==="s"){var W=h.getLine(O.line);O.ch>0&&j(W[O.ch])&&(O.ch-=1);var ne=G2(h,O,b.repeat,1,$),fe=G2(h,O,b.repeat,-1,$);C(h.getLine(fe.line)[fe.ch])&&C(h.getLine(ne.line)[ne.ch-1])&&(fe={line:fe.line,ch:fe.ch+1}),X={start:fe,end:ne}}return X?h.state.vim.visualMode?LI(h,X.start,X.end,M):[X.start,X.end]:null},repeatLastCharacterSearch:function(h,O,b){var y=q.lastCharacterSearch,v=b.repeat,k=b.forward===y.forward,P=(y.increment?1:0)*(k?-1:1);h.moveH(-P,"char"),b.inclusive=!!k;var $=Bm(h,v,k,y.selectedCharacter);return $?($.ch+=P,$):(h.moveH(P,"char"),O)}};function Um(h,O){Er[h]=O}function Yf(h,O){for(var b=[],y=0;yP.line&&($=new e($.line-1,Number.MAX_VALUE))),h.replaceRange("",P,$),y=P}q.registerController.pushText(O.registerName,"change",v,O.linewise,b.length>1),ce.enterInsertMode(h,{head:y},h.state.vim)},delete:function(h,O,b){var y,v,k=h.state.vim;if(k.visualBlock){v=h.getSelection();var X=Yf("",b.length);h.replaceSelections(X),y=St(b[0].head,b[0].anchor)}else{var P=b[0].anchor,$=b[0].head;O.linewise&&$.line!=h.firstLine()&&P.line==h.lastLine()&&P.line==$.line-1&&(P.line==h.firstLine()?P.ch=0:P=new e(P.line-1,Jt(h,P.line-1))),v=h.getRange(P,$),h.replaceRange("",P,$),y=P,O.linewise&&(y=Er.moveToFirstNonWhiteSpaceCharacter(h,P))}return q.registerController.pushText(O.registerName,"delete",v,O.linewise,k.visualBlock),Ee(h,y)},indent:function(h,O,b){var y=h.state.vim,v=y.visualMode?O.repeat||0:1;if(h.indentMore)for(var k=0;kv&&O.linewise&&P--,O.keepCursor?y:new e(P,0)}},changeCase:function(h,O,b,y,v){for(var k=h.getSelections(),P=[],$=O.toLower,X=0;XM.top?(X.line+=($-M.top)/v,X.line=Math.ceil(X.line),h.setCursor(X),M=h.charCoords(X,"local"),h.scrollTo(null,M.top)):h.scrollTo(null,$);else{var z=$+h.getScrollInfo().clientHeight;z=v.anchor.line?k=$e(v.head,0,1):k=new e(v.anchor.line,0)}else if(y=="inplace"){if(b.visualMode)return}else y=="lastEdit"&&(k=ok(h)||k);h.setOption("disableInput",!1),O&&O.replace?(h.toggleOverwrite(!0),h.setOption("keyMap","vim-replace"),t.signal(h,"vim-mode-change",{mode:"replace"})):(h.toggleOverwrite(!1),h.setOption("keyMap","vim-insert"),t.signal(h,"vim-mode-change",{mode:"insert"})),q.macroModeState.isPlaying||(h.on("change",lk),b.insertEnd&&b.insertEnd.clear(),b.insertEnd=h.setBookmark(k,{insertLeft:!0}),t.on(h.getInputField(),"keydown",fk)),b.visualMode&&Zr(h),q2(h,k,P)}},toggleVisualMode:function(h,O,b){var y=O.repeat,v=h.getCursor(),k;if(b.visualMode)b.visualLine!=!!O.linewise||b.visualBlock!=!!O.blockwise?(b.visualLine=!!O.linewise,b.visualBlock=!!O.blockwise,t.signal(h,"vim-mode-change",{mode:"visual",subMode:b.visualLine?"linewise":b.visualBlock?"blockwise":""}),ha(h)):Zr(h);else{b.visualMode=!0,b.visualLine=!!O.linewise,b.visualBlock=!!O.blockwise,k=Ee(h,new e(v.line,v.ch+y-1));var P=i(h,v,k);b.sel={anchor:P.start,head:P.end},t.signal(h,"vim-mode-change",{mode:"visual",subMode:b.visualLine?"linewise":b.visualBlock?"blockwise":""}),ha(h),vn(h,b,"<",St(v,k)),vn(h,b,">",so(v,k))}},reselectLastSelection:function(h,O,b){var y=b.lastSelection;if(b.visualMode&&W2(h,b),y){var v=y.anchorMark.find(),k=y.headMark.find();if(!v||!k)return;b.sel={anchor:v,head:k},b.visualMode=!0,b.visualLine=y.visualLine,b.visualBlock=y.visualBlock,ha(h),vn(h,b,"<",St(v,k)),vn(h,b,">",so(v,k)),t.signal(h,"vim-mode-change",{mode:"visual",subMode:b.visualLine?"linewise":b.visualBlock?"blockwise":""})}},joinLines:function(h,O,b){var y,v;if(b.visualMode){if(y=h.getCursor("anchor"),v=h.getCursor("head"),at(v,y)){var k=v;v=y,y=k}v.ch=Jt(h,v.line)-1}else{var P=Math.max(O.repeat,2);y=h.getCursor(),v=Ee(h,new e(y.line+P-1,1/0))}for(var $=0,X=y.line;X{this.continuePaste(h,O,b,k,y)});else{var v=y.toString();this.continuePaste(h,O,b,v,y)}},continuePaste:function(h,O,b,y,v){var k=it(h.getCursor());if(y){if(O.matchIndent){var P=h.getOption("tabSize"),$=function(ti){var Zt=ti.split(" ").length-1,Yr=ti.split(" ").length-1;return Zt*P+Yr*1},X=h.getLine(h.getCursor().line),M=$(X.match(/^\s*/)[0]),z=y.replace(/\n$/,""),G=y!==z,ee=$(y.match(/^\s*/)[0]),y=z.replace(/^\s*/gm,function(ti){var Zt=M+($(ti)-ee);if(Zt<0)return"";if(h.getOption("indentWithTabs")){var Yr=Math.floor(Zt/P);return Array(Yr+1).join(" ")}else return Array(Zt+1).join(" ")});y+=G?` `:""}if(O.repeat>1)var y=Array(O.repeat+1).join(y);var Y=v.linewise,W=v.blockwise;if(W){y=y.split(` `),Y&&y.pop();for(var ne=0;ne`)))}function nK(){return import("./mermaid.core-3DX6XKRB.js") `,new e(Ge,0));var Je=Jt(h,Ge);JeX.length&&(k=X.length),P=new e(v.line,k)}var M=i(h,v,P);if(v=M.start,P=M.end,y==` `)b.visualMode||h.replaceRange("",v,P),(t.commands.newlineAndIndentContinueComment||t.commands.newlineAndIndent)(h);else{var z=h.getRange(v,P);if(z=z.replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,y),z=z.replace(/[^\n]/g,y),b.visualBlock){var G=new Array(h.getOption("tabSize")+1).join(" ");z=h.getSelection(),z=z.replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,y);var ee=z.replace(/\t/g,G).replace(/[^\n]/g,y).split(` `);h.replaceSelections(ee)}else h.replaceRange(z,v,P);b.visualMode?(v=at($[0].anchor,$[0].head)?$[0].anchor:$[0].head,h.setCursor(v),Zr(h,!1)):h.setCursor($e(P,0,-1))}},incrementNumberToken:function(h,O){for(var b=h.getCursor(),y=h.getLine(b.line),v=/(-?)(?:(0x)([\da-f]+)|(0b|0|)(\d+))/gi,k,P,$,X;(k=v.exec(y))!==null&&(P=k.index,$=P+k[0].length,!(b.ch<$)););if(!(!O.backtrack&&$<=b.ch)){if(k){var M=k[2]||k[4],z=k[3]||k[5],G=O.increase?1:-1,ee={"0b":2,0:8,"":10,"0x":16}[M.toLowerCase()],Y=parseInt(k[1]+z,ee)+G*O.repeat;X=Y.toString(ee);var W=M?new Array(z.length-X.length+1+k[1].length).join("0"):"";X.charAt(0)==="-"?X="-"+M+W+X.substr(1):X=M+W+X;var ne=new e(b.line,P),fe=new e(b.line,$);h.replaceRange(X,ne,fe)}else return;h.setCursor(new e(b.line,P+X.length-1))}},repeatLastEdit:function(h,O,b){var y=b.lastEditInputState;if(y){var v=O.repeat;v&&O.repeatIsExplicit?y.repeatOverride=v:v=y.repeatOverride||v,hk(h,b,v,!1)}},indent:function(h,O){h.indentLine(h.getCursor().line,O.indentRight)},exitInsertMode:function(h,O){lo(h)}};function ye(h,O){ce[h]=O}function Ee(h,O,b){var y=h.state.vim,v=y.insertMode||y.visualMode,k=Math.min(Math.max(h.firstLine(),O.line),h.lastLine()),P=h.getLine(k),$=P.length-1+ +!!v,X=Math.min(Math.max(0,O.ch),$),M=P.charCodeAt(X);if(56320<=M&&M<=57343){var z=1;b&&b.line==k&&b.ch>X&&(z=-1),X+=z,X>$&&(X-=2)}return new e(k,X)}function je(h){var O={};for(var b in h)h.hasOwnProperty(b)&&(O[b]=h[b]);return O}function $e(h,O,b){return typeof O=="object"&&(b=O.ch,O=O.line),new e(h.line+O,h.ch+b)}function Zi(h,O,b,y){y.operator&&(b="operatorPending");for(var v,k=[],P=[],$=re?O.length-n:0,X=$;X",y=O.slice(-10)=="";if(b||y){var v=O.length-(b?11:10),k=h.slice(0,v),P=O.slice(0,v);return k==P&&h.length>v?"full":P.indexOf(k)==0?"partial":!1}else return h==O?"full":O.indexOf(h)==0?"partial":!1}function Cr(h){var O=/^.*(<[^>]+>)$/.exec(h),b=O?O[1]:h.slice(-1);if(b.length>1)switch(b){case"":case"":b=` -`;break;case"":case"":b=" ";break;default:b="";break}return b}function oo(h,O,b){return function(){for(var y=0;y2&&(O=kt.apply(void 0,Array.prototype.slice.call(arguments,1))),at(h,O)?h:O}function so(h,O){return arguments.length>2&&(O=so.apply(void 0,Array.prototype.slice.call(arguments,1))),at(h,O)?O:h}function z2(h,O,b){var y=at(h,O),v=at(O,b);return y&&v}function Jt(h,O){return h.getLine(O).length}function jm(h){return h.trim?h.trim():h.replace(/^\s+|\s+$/g,"")}function $I(h){return h.replace(/([.?*+$\[\]\/\\(){}|\-])/g,"\\$1")}function XI(h,O,b){var y=Jt(h,O),v=new Array(b-y+1).join(" ");h.setCursor(new e(O,y)),h.replaceRange(v,h.getCursor())}function j2(h,O){var b=[],y=h.listSelections(),v=it(h.clipPos(O)),k=!Ot(O,v),P=h.getCursor("head"),$=RI(y,P),X=Ot(y[$].head,y[$].anchor),M=y.length-1,z=M-$>$?M:0,G=y[z].anchor,ee=Math.min(G.line,v.line),Y=Math.max(G.line,v.line),W=G.ch,ne=v.ch,fe=y[z].head.ch-W,Ae=ne-W;fe>0&&Ae<=0?(W++,k||ne--):fe<0&&Ae>=0?(W--,X||ne++):fe<0&&Ae==-1&&(W--,ne++);for(var Pe=ee;Pe<=Y;Pe++){var Re={anchor:new e(Pe,W),head:new e(Pe,ne)};b.push(Re)}return h.setSelections(b),O.ch=ne,G.ch=W,G}function q2(h,O,b){for(var y=[],v=0;vX&&(v.line=X),v.ch=Jt(h,v.line)}return{ranges:[{anchor:k,head:v}],primary:0}}else if(b=="block"){var M=Math.min(k.line,v.line),z=k.ch,G=Math.max(k.line,v.line),ee=v.ch;z":case"":b=" ";break;default:b="";break}return b}function oo(h,O,b){return function(){for(var y=0;y2&&(O=St.apply(void 0,Array.prototype.slice.call(arguments,1))),at(h,O)?h:O}function so(h,O){return arguments.length>2&&(O=so.apply(void 0,Array.prototype.slice.call(arguments,1))),at(h,O)?O:h}function z2(h,O,b){var y=at(h,O),v=at(O,b);return y&&v}function Jt(h,O){return h.getLine(O).length}function jm(h){return h.trim?h.trim():h.replace(/^\s+|\s+$/g,"")}function $I(h){return h.replace(/([.?*+$\[\]\/\\(){}|\-])/g,"\\$1")}function XI(h,O,b){var y=Jt(h,O),v=new Array(b-y+1).join(" ");h.setCursor(new e(O,y)),h.replaceRange(v,h.getCursor())}function j2(h,O){var b=[],y=h.listSelections(),v=it(h.clipPos(O)),k=!Ot(O,v),P=h.getCursor("head"),$=RI(y,P),X=Ot(y[$].head,y[$].anchor),M=y.length-1,z=M-$>$?M:0,G=y[z].anchor,ee=Math.min(G.line,v.line),Y=Math.max(G.line,v.line),W=G.ch,ne=v.ch,fe=y[z].head.ch-W,Ae=ne-W;fe>0&&Ae<=0?(W++,k||ne--):fe<0&&Ae>=0?(W--,X||ne++):fe<0&&Ae==-1&&(W--,ne++);for(var Pe=ee;Pe<=Y;Pe++){var Re={anchor:new e(Pe,W),head:new e(Pe,ne)};b.push(Re)}return h.setSelections(b),O.ch=ne,G.ch=W,G}function q2(h,O,b){for(var y=[],v=0;vX&&(v.line=X),v.ch=Jt(h,v.line)}return{ranges:[{anchor:k,head:v}],primary:0}}else if(b=="block"){var M=Math.min(k.line,v.line),z=k.ch,G=Math.max(k.line,v.line),ee=v.ch;z0&&k&&C(k);k=v.pop())b.line--,b.ch=0;k?(b.line--,b.ch=Jt(h,b.line)):b.ch=0}}function MI(h,O,b){O.ch=0,b.ch=0,b.line++}function Vr(h){if(!h)return 0;var O=h.search(/\S/);return O==-1?h.length:O}function Wm(h,{inclusive:O,innerWord:b,bigWord:y,noSymbol:v,multiline:k},P){var $=P||DI(h),X=h.getLine($.line),M=X,z=$.line,G=z,ee=$.ch,Y,W=v?f[0]:d[0];if(b&&/\s/.test(X.charAt(ee)))W=function(ft){return/\s/.test(ft)};else{for(;!W(X.charAt(ee));)if(ee++,ee>=X.length){if(!k)return null;ee--,Y=Y2(h,$,!0,y,!0);break}y?W=d[0]:(W=f[0],W(X.charAt(ee))||(W=f[1]))}for(var ne=ee,fe=ee;W(X.charAt(fe))&&fe>=0;)fe--;if(fe++,Y)ne=Y.to,G=Y.line,M=h.getLine(G),!M&&ne==0&&ne++;else for(;W(X.charAt(ne))&&ne0;)fe--;!fe&&!Pe&&(fe=Re)}}return{start:new e(z,fe),end:new e(G,ne)}}function UI(h,O,b){var y=O;if(!t.findMatchingTag||!t.findEnclosingTag)return{start:y,end:y};var v=t.findMatchingTag(h,O)||t.findEnclosingTag(h,O);return!v||!v.open||!v.close?{start:y,end:y}:b?{start:v.open.from,end:v.close.to}:{start:v.open.to,end:v.close.from}}function B2(h,O,b){Ot(O,b)||q.jumpList.add(h,O,b)}function Z2(h,O){q.lastCharacterSearch.increment=h,q.lastCharacterSearch.forward=O.forward,q.lastCharacterSearch.selectedCharacter=O.selectedCharacter}var zI={"(":"bracket",")":"bracket","{":"bracket","}":"bracket","[":"section","]":"section","*":"comment","/":"comment",m:"method",M:"method","#":"preprocess"},V2={bracket:{isComplete:function(h){if(h.nextCh===h.symb){if(h.depth++,h.depth>=1)return!0}else h.nextCh===h.reverseSymb&&h.depth--;return!1}},section:{init:function(h){h.curMoveThrough=!0,h.symb=(h.forward?"]":"[")===h.symb?"{":"}"},isComplete:function(h){return h.index===0&&h.nextCh===h.symb}},comment:{isComplete:function(h){var O=h.lastCh==="*"&&h.nextCh==="/";return h.lastCh=h.nextCh,O}},method:{init:function(h){h.symb=h.symb==="m"?"{":"}",h.reverseSymb=h.symb==="{"?"}":"{"},isComplete:function(h){return h.nextCh===h.symb}},preprocess:{init:function(h){h.index=0},isComplete:function(h){if(h.nextCh==="#"){var O=h.lineText.match(/^#(\w+)/)[1];if(O==="endif"){if(h.forward&&h.depth===0)return!0;h.depth++}else if(O==="if"){if(!h.forward&&h.depth===0)return!0;h.depth--}if(O==="else"&&h.depth===0)return!0}return!1}}};function jI(h,O,b,y){var v=it(h.getCursor()),k=b?1:-1,P=b?h.lineCount():-1,$=v.ch,X=v.line,M=h.getLine(X),z={lineText:M,nextCh:M.charAt($),lastCh:null,index:$,symb:y,reverseSymb:(b?{")":"(","}":"{"}:{"(":")","{":"}"})[y],forward:b,depth:0,curMoveThrough:!1},G=zI[y];if(!G)return v;var ee=V2[G].init,Y=V2[G].isComplete;for(ee&&ee(z);X!==P&&O;){if(z.index+=k,z.nextCh=z.lineText.charAt(z.index),!z.nextCh){if(X+=k,z.lineText=h.getLine(X)||"",k>0)z.index=0;else{var W=z.lineText.length;z.index=W>0?W-1:0}z.nextCh=z.lineText.charAt(z.index)}Y(z)&&(v.line=X,v.ch=z.index,O--)}return z.nextCh||z.curMoveThrough?new e(X,z.index):v}function Y2(h,O,b,y,v){var k=O.line,P=O.ch,$=h.getLine(k),X=b?1:-1,M=y?d:f;if(v&&$==""){if(k+=X,$=h.getLine(k),!S(h,k))return null;P=b?0:$.length}for(;;){if(v&&$=="")return{from:0,to:0,line:k};for(var z=X>0?$.length:-1,G=z,ee=z;P!=z;){for(var Y=!1,W=0;W0?0:$.length}}function qI(h,O,b,y,v,k){var P=it(O),$=[];(y&&!v||!y&&v)&&b++;for(var X=!(y&&v),M=0;M0;)ee(z,y)&&b--,z+=y;return{start:new e(z,0),end:O}}var Y=h.state.vim;if(Y.visualLine&&ee(k,1,!0)){var W=Y.sel.anchor;ee(W.line,-1,!0)&&(!v||W.line!=k)&&(k+=1)}var ne=G(k);for(z=k;z<=$&&b;z++)ee(z,1,!0)&&(!v||G(z)!=ne)&&b--;for(M=new e(z,0),z>$&&!ne?ne=!0:v=!1,z=k;z>P&&!((!v||G(z)==ne||z==k)&&ee(z,-1,!0));z--);return X=new e(z,0),{start:X,end:M}}function G2(h,O,b,y,v){function k(M){M.pos+M.dir<0||M.pos+M.dir>=M.line.length?M.line=null:M.pos+=M.dir}function P(M,z,G,ee){var Y=M.getLine(z),W={line:Y,ln:z,pos:G,dir:ee};if(W.line==="")return{ln:W.ln,pos:W.pos};var ne=W.pos;for(k(W);W.line!==null;){if(ne=W.pos,j(W.line[W.pos]))if(v){for(k(W);W.line!==null&&C(W.line[W.pos]);)ne=W.pos,k(W);return{ln:W.ln,pos:ne+1}}else return{ln:W.ln,pos:W.pos+1};k(W)}return{ln:W.ln,pos:ne+1}}function $(M,z,G,ee){var Y=M.getLine(z),W={line:Y,ln:z,pos:G,dir:ee};if(W.line==="")return{ln:W.ln,pos:W.pos};var ne=W.pos;for(k(W);W.line!==null;){if(!C(W.line[W.pos])&&!j(W.line[W.pos]))ne=W.pos;else if(j(W.line[W.pos]))return v?C(W.line[W.pos+1])?{ln:W.ln,pos:W.pos+1}:{ln:W.ln,pos:ne}:{ln:W.ln,pos:ne};k(W)}return W.line=Y,v&&C(W.line[W.pos])?{ln:W.ln,pos:W.pos}:{ln:W.ln,pos:ne}}for(var X={ln:O.line,pos:O.ch};b>0;)y<0?X=$(h,X.ln,X.pos,y):X=P(h,X.ln,X.pos,y),b--;return new e(X.ln,X.pos)}function ZI(h,O,b,y){function v(X,M){if(M.pos+M.dir<0||M.pos+M.dir>=M.line.length){if(M.ln+=M.dir,!S(X,M.ln)){M.line=null,M.ln=null,M.pos=null;return}M.line=X.getLine(M.ln),M.pos=M.dir>0?0:M.line.length-1}else M.pos+=M.dir}function k(X,M,z,G){var fe=X.getLine(M),ee=fe==="",Y={line:fe,ln:M,pos:z,dir:G},W={ln:Y.ln,pos:Y.pos},ne=Y.line==="";for(v(X,Y);Y.line!==null;){if(W.ln=Y.ln,W.pos=Y.pos,Y.line===""&&!ne)return{ln:Y.ln,pos:Y.pos};if(ee&&Y.line!==""&&!C(Y.line[Y.pos]))return{ln:Y.ln,pos:Y.pos};j(Y.line[Y.pos])&&!ee&&(Y.pos===Y.line.length-1||C(Y.line[Y.pos+1]))&&(ee=!0),v(X,Y)}var fe=X.getLine(W.ln);W.pos=0;for(var Ae=fe.length-1;Ae>=0;--Ae)if(!C(fe[Ae])){W.pos=Ae;break}return W}function P(X,M,z,G){var ne=X.getLine(M),ee={line:ne,ln:M,pos:z,dir:G},Y={ln:ee.ln,pos:null},W=ee.line==="";for(v(X,ee);ee.line!==null;){if(ee.line===""&&!W)return Y.pos!==null?Y:{ln:ee.ln,pos:ee.pos};if(j(ee.line[ee.pos])&&Y.pos!==null&&!(ee.ln===Y.ln&&ee.pos+1===Y.pos))return Y;ee.line!==""&&!C(ee.line[ee.pos])&&(W=!1,Y={ln:ee.ln,pos:ee.pos}),v(X,ee)}var ne=X.getLine(Y.ln);Y.pos=0;for(var fe=0;fe0;)y<0?$=P(h,$.ln,$.pos,y):$=k(h,$.ln,$.pos,y),b--;return new e($.ln,$.pos)}function K2(h,O,b,y){var v=O,k={"(":/[()]/,")":/[()]/,"[":/[[\]]/,"]":/[[\]]/,"{":/[{}]/,"}":/[{}]/,"<":/[<>]/,">":/[<>]/}[b],P={"(":"(",")":"(","[":"[","]":"[","{":"{","}":"{","<":"<",">":"<"}[b],$=h.getLine(v.line).charAt(v.ch),X=$===P?1:0,M=h.scanForBracket(new e(v.line,v.ch+X),-1,void 0,{bracketRegex:k}),z=h.scanForBracket(new e(v.line,v.ch+X),1,void 0,{bracketRegex:k});if(!M||!z)return null;var G=M.pos,ee=z.pos;if(G.line==ee.line&&G.ch>ee.ch||G.line>ee.line){var Y=G;G=ee,ee=Y}return y?ee.ch+=1:G.ch+=1,{start:G,end:ee}}function VI(h,O,b,y){var v=it(O),k=h.getLine(v.line),P=k.split(""),$,X,M,z,G=P.indexOf(b);if(v.ch-1&&!$;M--)P[M]==b&&($=M+1);if($&&!X)for(M=$,z=P.length;M=O&&h<=b:h==O}function Vm(h){var O=h.getScrollInfo(),b=6,y=10,v=h.coordsChar({left:0,top:b+O.top},"local"),k=O.clientHeight-y+O.top,P=h.coordsChar({left:0,top:k},"local");return{top:v.line,bottom:P.line}}function Ff(h,O,b){if(b=="'"||b=="`")return q.jumpList.find(h,-1)||new e(0,0);if(b==".")return ok(h);var y=O.marks[b];return y&&y.find()}function ok(h){if(h.getLastEditEnd)return h.getLastEditEnd();for(var O=h.doc.history.done,b=O.length;b--;)if(O[b].changes)return it(O[b].changes[0].to)}class sL{constructor(){this.commandMap_,this.buildCommandMap_()}processCommand(O,b,y){var v=this;O.operation(function(){O.curOp.isVimOp=!0,v._processCommand(O,b,y)})}_processCommand(O,b,y){var v=O.state.vim,k=q.registerController.getRegister(":"),P=k.toString(),$=new t.StringStream(b);k.setText(b);var X=y||{};X.input=b;try{this.parseInput_(O,$,X)}catch(G){throw ut(O,G+""),G}v.visualMode&&Zr(O);var M,z;if(!X.commandName)X.line!==void 0&&(z="move");else if(M=this.matchCommand_(X.commandName),M){if(z=M.name,M.excludeFromCommandHistory&&k.setText(P),this.parseCommandArgs_($,X,M),M.type=="exToKey"){Be(O,M.toKeys,M);return}else if(M.type=="exToEx"){this.processCommand(O,M.toInput);return}}if(!z){ut(O,'Not an editor command ":'+b+'"');return}try{sk[z](O,X),(!M||!M.possiblyAsync)&&X.callback&&X.callback()}catch(G){throw ut(O,G+""),G}}parseInput_(O,b,y){var k,P;b.eatWhile(":"),b.eat("%")?(y.line=O.firstLine(),y.lineEnd=O.lastLine()):(y.line=this.parseLineSpec_(O,b),y.line!==void 0&&b.eat(",")&&(y.lineEnd=this.parseLineSpec_(O,b))),y.line==null?O.state.vim.visualMode?(y.selectionLine=(k=Ff(O,O.state.vim,"<"))==null?void 0:k.line,y.selectionLineEnd=(P=Ff(O,O.state.vim,">"))==null?void 0:P.line):y.selectionLine=O.getCursor().line:(y.selectionLine=y.line,y.selectionLineEnd=y.lineEnd);var v=b.match(/^(\w+|!!|@@|[!#&*<=>@~])/);return v?y.commandName=v[1]:y.commandName=b.match(/.*/)[0],y}parseLineSpec_(O,b){var y=b.match(/^(\d+)/);if(y)return parseInt(y[1],10)-1;switch(b.next()){case".":return this.parseLineSpecOffset_(b,O.getCursor().line);case"$":return this.parseLineSpecOffset_(b,O.lastLine());case"'":var v=b.next(),k=Ff(O,O.state.vim,v);if(!k)throw new Error("Mark not set");return this.parseLineSpecOffset_(b,k.line);case"-":case"+":return b.backUp(1),this.parseLineSpecOffset_(b,O.getCursor().line);default:b.backUp(1);return}}parseLineSpecOffset_(O,b){var y=O.match(/^([+-])?(\d+)/);if(y){var v=parseInt(y[2],10);y[1]=="-"?b-=v:b+=v}return b}parseCommandArgs_(O,b,y){if(!O.eol()){b.argString=O.match(/.*/)[0];var v=y.argDelimiter||/\s+/,k=jm(b.argString).split(v);k.length&&k[0]&&(b.args=k)}}matchCommand_(O){for(var b=O.length;b>0;b--){var y=O.substring(0,b);if(this.commandMap_[y]){var v=this.commandMap_[y];if(v.name.indexOf(O)===0)return v}}return null}buildCommandMap_(){this.commandMap_={};for(var O=0;O0?v.join("="):void 0,$=!1,X=!1;if(k.charAt(k.length-1)=="?"){if(P)throw Error("Trailing characters: "+O.argString);k=k.substring(0,k.length-1),$=!0}else k.charAt(k.length-1)=="!"&&(k=k.substring(0,k.length-1),X=!0);P===void 0&&k.substring(0,2)=="no"&&(k=k.substring(2),P=!1);var M=F[k]&&F[k].type=="boolean";if(M&&(X?P=!ue(k,h,y):P==null&&(P=!0)),!M&&P===void 0||$){var z=ue(k,h,y);z instanceof Error?ut(h,z.message):z===!0||z===!1?ut(h," "+(z?"":"no")+k):ut(h," "+k+"="+z)}else{var G=ae(k,P,h,y);G instanceof Error&&ut(h,G.message)}},setlocal:function(h,O){O.setCfg={scope:"local"},this.set(h,O)},setglobal:function(h,O){O.setCfg={scope:"global"},this.set(h,O)},registers:function(h,O){var b=O.args,y=q.registerController.registers,v=`----------Registers---------- @@ -120,7 +120,7 @@ ${n.message}
`)))}function nK(){return import("./mermaid.core-3DX6XKRB.js") `),W=k=="decimal"?/(-?)([\d]+)/:k=="hex"?/(-?)(?:0x)?([0-9a-f]+)/i:k=="octal"?/([0-7]+)/:null,ne=k=="decimal"?10:k=="hex"?16:k=="octal"?8:void 0,fe=[],Ae=[];if(k||P)for(var Pe=0;Pe=M){ut(h,"Invalid argument: "+O.argString.substring(v));return}for(var z=0;z<=M-X;z++){var G=String.fromCharCode(X+z);delete b.marks[G]}}else{ut(h,"Invalid argument: "+P+"-");return}}else k&&delete b.marks[k]}}},Pr=new sL;function aL(h,O,b,y,v,k,P,$,X){h.state.vim.exMode=!0;var M=!1,z,G,ee;function Y(){h.operation(function(){for(;!M;)W(),fe();Ae()})}function W(){var Re=h.getRange(k.from(),k.to()),ft=Re.replace(P,$),fi=k.to().line;k.replace(ft),G=k.to().line,v+=G-fi,ee=G":case"":case"":Ae(fi);break}return M&&Ae(fi),!0}if(fe(),M){ut(h,"No matches for "+P.source);return}if(!O){Y(),X&&X();return}jl(h,{prefix:ao("span","replace with ",ao("strong",$)," (y/n/a/q/l)"),onKeyDown:Pe})}function lo(h,O){var b=h.state.vim,y=q.macroModeState,v=q.registerController.getRegister("."),k=y.isPlaying,P=y.lastInsertModeChanges;k||(h.off("change",lk),b.insertEnd&&b.insertEnd.clear(),b.insertEnd=void 0,t.off(h.getInputField(),"keydown",fk)),!k&&b.insertModeRepeat>1&&(hk(h,b,b.insertModeRepeat-1,!0),b.lastEditInputState.repeatOverride=b.insertModeRepeat),delete b.insertModeRepeat,b.insertMode=!1,O||h.setCursor(h.getCursor().line,h.getCursor().ch-1),h.setOption("keyMap","vim"),h.setOption("disableInput",!0),h.toggleOverwrite(!1),v.setText(P.changes.join("")),t.signal(h,"vim-mode-change",{mode:"normal"}),y.isRecording&&fL(y)}function ak(h){r.unshift(h)}function lL(h,O,b,y,v){var k={keys:h,type:O};k[O]=b,k[O+"Args"]=y;for(var P in v)k[P]=v[P];ak(k)}U("insertModeEscKeysTimeout",200,"number");function cL(h,O,b,y){var v=q.registerController.getRegister(y);if(y==":"){v.keyBuffer[0]&&Pr.processCommand(h,v.keyBuffer[0]),b.isPlaying=!1;return}var k=v.keyBuffer,P=0;b.isPlaying=!0,b.replaySearchQueries=v.searchQueries.slice(0);for(var $=0;$|./gi;M=G.exec(X);)if(z=M[0],E.handleKey(h,z,"macro"),O.insertMode){var ee=v.insertModeChanges[P++].changes;q.macroModeState.lastInsertModeChanges.changes=ee,pk(h,ee,1),lo(h)}b.isPlaying=!1}function uL(h,O){if(!h.isPlaying){var b=h.latestRegister,y=q.registerController.getRegister(b);y&&y.pushText(O)}}function fL(h){if(!h.isPlaying){var O=h.latestRegister,b=q.registerController.getRegister(O);b&&b.pushInsertModeChanges&&b.pushInsertModeChanges(h.lastInsertModeChanges)}}function hL(h,O){if(!h.isPlaying){var b=h.latestRegister,y=q.registerController.getRegister(b);y&&y.pushSearchQuery&&y.pushSearchQuery(O)}}function lk(h,O){var b=q.macroModeState,y=b.lastInsertModeChanges;if(!b.isPlaying)for(var v=h.state.vim;O;){if(y.expectCursorActivityForChange=!0,y.ignoreCount>1)y.ignoreCount--;else if(O.origin=="+input"||O.origin=="paste"||O.origin===void 0){var k=h.listSelections().length;k>1&&(y.ignoreCount=k);var P=O.text.join(` -`);if(y.maybeReset&&(y.changes=[],y.maybeReset=!1),P)if(h.state.overwrite&&!/\n/.test(P))y.changes.push([P]);else{if(P.length>1){var $=v&&v.insertEnd&&v.insertEnd.find(),X=h.getCursor();if($&&$.line==X.line){var M=$.ch-X.ch;M>0&&M",so(y,b))}else O.insertMode||(O.lastHPos=h.getCursor().ch)}function Ym(h,O){this.keyName=h,this.key=O.key,this.ctrlKey=O.ctrlKey,this.altKey=O.altKey,this.metaKey=O.metaKey,this.shiftKey=O.shiftKey}function fk(h){var O=q.macroModeState,b=O.lastInsertModeChanges,y=t.keyName?t.keyName(h):h.key;y&&(y.indexOf("Delete")!=-1||y.indexOf("Backspace")!=-1)&&(b.maybeReset&&(b.changes=[],b.maybeReset=!1),b.changes.push(new Ym(y,h)))}function hk(h,O,b,y){var v=q.macroModeState;v.isPlaying=!0;var k=O.lastEditActionCommand,P=O.inputState;function $(){k?Br.processAction(h,O,k):Br.evalInput(h,O)}function X(z){if(v.lastInsertModeChanges.changes.length>0){z=O.lastEditActionCommand?z:1;var G=v.lastInsertModeChanges;pk(h,G.changes,z)}}if(O.inputState=O.lastEditInputState,k&&k.interlaceInsertRepeat)for(var M=0;M"&&!k.insertMode&&!k.visualMode&&$&&k.status=="")Xt(y);else if(P||!$||y.inVirtualSelectionMode)v=E.handleKey(y,O,b);else{var X=Fm(k),M=k.inputState.changeQueueList||[];y.operation(function(){var G;y.curOp&&(y.curOp.isVimOp=!0);var z=0;y.forEachSelection(function(){y.state.vim.inputState.changeQueue=M[z];var ee=y.getCursor("head"),Y=y.getCursor("anchor"),W=at(ee,Y)?0:-1,ne=at(ee,Y)?-1:0;ee=$e(ee,0,W),Y=$e(Y,0,ne),y.state.vim.sel.head=ee,y.state.vim.sel.anchor=Y,v=E.handleKey(y,O,b),y.virtualSelection&&(M[z]=y.state.vim.inputState.changeQueue,y.state.vim=Fm(X)),z++}),(G=y.curOp)!=null&&G.cursorActivity&&!v&&(y.curOp.cursorActivity=!1),y.state.vim=k,k.inputState.changeQueueList=M,k.inputState.changeQueue=null},!0)}return v&&!k.visualMode&&!k.insert&&k.visualMode!=y.somethingSelected()&&uk(y,k),v}return le(),E}function lr(t,e){var i=e.ch,r=e.line+1;r<1&&(r=1,i=0),r>t.lines&&(r=t.lines,i=Number.MAX_VALUE);var n=t.line(r);return Math.min(n.from+Math.max(0,i),n.to)}function Sr(t,e){let i=t.lineAt(e);return{line:i.number-1,ch:e-i.from}}var Tr=class{constructor(e,i){this.line=e,this.ch=i}};function g6(t,e,i){if(t.addEventListener)t.addEventListener(e,i,!1);else{var r=t._handlers||(t._handlers={});r[e]=(r[e]||[]).concat(i)}}function b6(t,e,i){if(t.removeEventListener)t.removeEventListener(e,i,!1);else{var r=t._handlers,n=r&&r[e];if(n){var o=n.indexOf(i);o>-1&&(r[e]=n.slice(0,o).concat(n.slice(o+1)))}}}function y6(t,e,...i){var r,n=(r=t._handlers)===null||r===void 0?void 0:r[e];if(n)for(var o=0;o({anchor:Sr(e,i.anchor),head:Sr(e,i.head)}))}setSelections(e,i){var r=this.cm6.state.doc,n=e.map(o=>{var s=lr(r,o.head),a=lr(r,o.anchor);return s==a?J.cursor(s,1):J.range(a,s)});this.cm6.dispatch({selection:J.create(n,i)})}setSelection(e,i,r){this.setSelections([{anchor:e,head:i}],0),r&&r.origin=="*mouse"&&this.onBeforeEndOperation()}getLine(e){var i=this.cm6.state.doc;return e<0||e>=i.lines?"":this.cm6.state.doc.line(e+1).text}getLineHandle(e){return this.$lineHandleChanges||(this.$lineHandleChanges=[]),{row:e,index:this.indexFromPos(new Tr(e,0))}}getLineNumber(e){var i=this.$lineHandleChanges;if(!i)return null;for(var r=e.index,n=0;n({from:n.from,to:n.to,insert:e[o]||""}));_f(this,{changes:r})}getSelection(){return this.getSelections().join(` +`);if(y.maybeReset&&(y.changes=[],y.maybeReset=!1),P)if(h.state.overwrite&&!/\n/.test(P))y.changes.push([P]);else{if(P.length>1){var $=v&&v.insertEnd&&v.insertEnd.find(),X=h.getCursor();if($&&$.line==X.line){var M=$.ch-X.ch;M>0&&M",so(y,b))}else O.insertMode||(O.lastHPos=h.getCursor().ch)}function Ym(h,O){this.keyName=h,this.key=O.key,this.ctrlKey=O.ctrlKey,this.altKey=O.altKey,this.metaKey=O.metaKey,this.shiftKey=O.shiftKey}function fk(h){var O=q.macroModeState,b=O.lastInsertModeChanges,y=t.keyName?t.keyName(h):h.key;y&&(y.indexOf("Delete")!=-1||y.indexOf("Backspace")!=-1)&&(b.maybeReset&&(b.changes=[],b.maybeReset=!1),b.changes.push(new Ym(y,h)))}function hk(h,O,b,y){var v=q.macroModeState;v.isPlaying=!0;var k=O.lastEditActionCommand,P=O.inputState;function $(){k?Br.processAction(h,O,k):Br.evalInput(h,O)}function X(z){if(v.lastInsertModeChanges.changes.length>0){z=O.lastEditActionCommand?z:1;var G=v.lastInsertModeChanges;pk(h,G.changes,z)}}if(O.inputState=O.lastEditInputState,k&&k.interlaceInsertRepeat)for(var M=0;M"&&!k.insertMode&&!k.visualMode&&$&&k.status=="")Xt(y);else if(P||!$||y.inVirtualSelectionMode)v=E.handleKey(y,O,b);else{var X=Fm(k),M=k.inputState.changeQueueList||[];y.operation(function(){var G;y.curOp&&(y.curOp.isVimOp=!0);var z=0;y.forEachSelection(function(){y.state.vim.inputState.changeQueue=M[z];var ee=y.getCursor("head"),Y=y.getCursor("anchor"),W=at(ee,Y)?0:-1,ne=at(ee,Y)?-1:0;ee=$e(ee,0,W),Y=$e(Y,0,ne),y.state.vim.sel.head=ee,y.state.vim.sel.anchor=Y,v=E.handleKey(y,O,b),y.virtualSelection&&(M[z]=y.state.vim.inputState.changeQueue,y.state.vim=Fm(X)),z++}),(G=y.curOp)!=null&&G.cursorActivity&&!v&&(y.curOp.cursorActivity=!1),y.state.vim=k,k.inputState.changeQueueList=M,k.inputState.changeQueue=null},!0)}return v&&!k.visualMode&&!k.insert&&k.visualMode!=y.somethingSelected()&&uk(y,k),v}return le(),E}function lr(t,e){var i=e.ch,r=e.line+1;r<1&&(r=1,i=0),r>t.lines&&(r=t.lines,i=Number.MAX_VALUE);var n=t.line(r);return Math.min(n.from+Math.max(0,i),n.to)}function Sr(t,e){let i=t.lineAt(e);return{line:i.number-1,ch:e-i.from}}var Tr=class{constructor(e,i){this.line=e,this.ch=i}};function g6(t,e,i){if(t.addEventListener)t.addEventListener(e,i,!1);else{var r=t._handlers||(t._handlers={});r[e]=(r[e]||[]).concat(i)}}function b6(t,e,i){if(t.removeEventListener)t.removeEventListener(e,i,!1);else{var r=t._handlers,n=r&&r[e];if(n){var o=n.indexOf(i);o>-1&&(r[e]=n.slice(0,o).concat(n.slice(o+1)))}}}function y6(t,e,...i){var r,n=(r=t._handlers)===null||r===void 0?void 0:r[e];if(n)for(var o=0;o({anchor:Sr(e,i.anchor),head:Sr(e,i.head)}))}setSelections(e,i){var r=this.cm6.state.doc,n=e.map(o=>{var s=lr(r,o.head),a=lr(r,o.anchor);return s==a?J.cursor(s,1):J.range(a,s)});this.cm6.dispatch({selection:J.create(n,i)})}setSelection(e,i,r){this.setSelections([{anchor:e,head:i}],0),r&&r.origin=="*mouse"&&this.onBeforeEndOperation()}getLine(e){var i=this.cm6.state.doc;return e<0||e>=i.lines?"":this.cm6.state.doc.line(e+1).text}getLineHandle(e){return this.$lineHandleChanges||(this.$lineHandleChanges=[]),{row:e,index:this.indexFromPos(new Tr(e,0))}}getLineNumber(e){var i=this.$lineHandleChanges;if(!i)return null;for(var r=e.index,n=0;n({from:n.from,to:n.to,insert:e[o]||""}));_f(this,{changes:r})}getSelection(){return this.getSelections().join(` `)}getSelections(){var e=this.cm6;return e.state.selection.ranges.map(i=>e.state.sliceDoc(i.from,i.to))}somethingSelected(){return this.cm6.state.selection.ranges.some(e=>!e.empty)}getInputField(){return this.cm6.contentDOM}clipPos(e){var i=this.cm6.state.doc,r=e.ch,n=e.line+1;n<1&&(n=1,r=0),n>i.lines&&(n=i.lines,r=Number.MAX_VALUE);var o=i.line(n);return r=Math.min(Math.max(0,r),o.to-o.from),new Tr(n-1,r)}getValue(){return this.cm6.state.doc.toString()}setValue(e){var i=this.cm6;return i.dispatch({changes:{from:0,to:i.state.doc.length,insert:e},selection:J.range(0,0)})}focus(){return this.cm6.focus()}blur(){return this.cm6.contentDOM.blur()}defaultTextHeight(){return this.cm6.defaultLineHeight}findMatchingBracket(e,i){var r=this.cm6.state,n=lr(r.doc,e),o=vr(r,n+1,-1);return o&&o.end?{to:Sr(r.doc,o.end.from)}:(o=vr(r,n,1),o&&o.end?{to:Sr(r.doc,o.end.from)}:{to:void 0})}scanForBracket(e,i,r,n){return hJ(this,e,i,r,n)}indentLine(e,i){i?this.indentMore():this.indentLess()}indentMore(){Sf(this.cm6)}indentLess(){Tf(this.cm6)}execCommand(e){if(e=="indentAuto")t.commands.indentAuto(this);else if(e=="goLineLeft")Of(this.cm6);else if(e=="goLineRight"){pf(this.cm6);let i=this.cm6.state,r=i.selection.main.head;rp.length)return null;let g=l(p,d).next();return g.done?null:g.value}var u=1e4;function f(d,p){var g=r.cm6.state.doc;for(let x=1;;x++){let w=Math.max(d,p-x*u),S=l(g,w,p),T=null;for(;!S.next().done;)T=S.value;if(T&&(w==d||T.from>w+10))return T;if(w==d)return null}}return{findNext:function(){return this.find(!1)},findPrevious:function(){return this.find(!0)},find:function(d){var p=r.cm6.state.doc;if(d){let g=n?n.from==n.to?n.to-1:n.from:s;n=f(0,g)}else{let g=n?n.from==n.to?n.to+1:n.to:s;n=c(g)}return o=n&&{from:Sr(p,n.from),to:Sr(p,n.to),match:n.match},n&&n.match},from:function(){return o==null?void 0:o.from},to:function(){return o==null?void 0:o.to},replace:function(d){n&&(_f(r,{changes:{from:n.from,to:n.to,insert:d}}),n.to=n.from+d.length,o&&(o.to=Sr(r.cm6.state.doc,n.to)))}}}findPosV(e,i,r,n){let{cm6:o}=this,s=o.state.doc,a=r=="page"?o.dom.clientHeight:0,l=lr(s,e),c=J.cursor(l,1,void 0,n),u=Math.round(Math.abs(i));for(let d=0;d0,a):r=="line"&&(c=o.moveVertically(c,i>0));let f=Sr(s,c.head);return(i<0&&c.head==0&&n!=0&&e.line==0&&e.ch!=0||i>0&&c.head==s.length&&f.ch!=n&&e.line==f.line)&&(f.hitSide=!0),f}charCoords(e,i){var r=this.cm6.contentDOM.getBoundingClientRect(),n=lr(this.cm6.state.doc,e),o=this.cm6.coordsAtPos(n),s=-r.top;return{left:((o==null?void 0:o.left)||0)-r.left,top:((o==null?void 0:o.top)||0)+s,bottom:((o==null?void 0:o.bottom)||0)+s}}coordsChar(e,i){var r=this.cm6.contentDOM.getBoundingClientRect(),n=this.cm6.posAtCoords({x:e.left+r.left,y:e.top+r.top})||0;return Sr(this.cm6.state.doc,n)}getScrollInfo(){var e=this.cm6.scrollDOM;return{left:e.scrollLeft,top:e.scrollTop,height:e.scrollHeight,width:e.scrollWidth,clientHeight:e.clientHeight,clientWidth:e.clientWidth}}scrollTo(e,i){e!=null&&(this.cm6.scrollDOM.scrollLeft=e),i!=null&&(this.cm6.scrollDOM.scrollTop=i)}scrollIntoView(e,i){if(e){var r=this.indexFromPos(e);this.cm6.dispatch({effects:de.scrollIntoView(r)})}else this.cm6.dispatch({scrollIntoView:!0,userEvent:"scroll"})}getWrapperElement(){return this.cm6.dom}getMode(){return{name:this.getOption("mode")}}setSize(e,i){this.cm6.dom.style.width=e+4+"px",this.cm6.dom.style.height=i+"px",this.refresh()}refresh(){this.cm6.measure()}destroy(){this.removeOverlay()}getLastEditEnd(){return this.posFromIndex(this.$lastChangeEndOffset)}onChange(e){this.$lineHandleChanges&&this.$lineHandleChanges.push(e);for(let r in this.marks)this.marks[r].update(e.changes);this.virtualSelection&&(this.virtualSelection.ranges=this.virtualSelection.ranges.map(r=>r.map(e.changes)));var i=this.curOp=this.curOp||{};e.changes.iterChanges((r,n,o,s,a)=>{(i.$changeStart==null||i.$changeStart>o)&&(i.$changeStart=o),this.$lastChangeEndOffset=s;var l={text:a.toJSON()};i.lastChange?i.lastChange.next=i.lastChange=l:i.lastChange=i.change=l},!0),i.changeHandlers||(i.changeHandlers=this._handlers.change&&this._handlers.change.slice())}onSelectionChange(){var e=this.curOp=this.curOp||{};e.cursorActivityHandlers||(e.cursorActivityHandlers=this._handlers.cursorActivity&&this._handlers.cursorActivity.slice()),this.curOp.cursorActivity=!0}operation(e,i){this.curOp||(this.curOp={$d:0}),this.curOp.$d++;try{var r=e()}finally{this.curOp&&(this.curOp.$d--,this.curOp.$d||this.onBeforeEndOperation())}return r}onBeforeEndOperation(){var e=this.curOp,i=!1;e&&(e.change&&p6(e.changeHandlers,this,e.change),e&&e.cursorActivity&&(p6(e.cursorActivityHandlers,this,null),e.isVimOp&&(i=!0)),this.curOp=null),i&&this.scrollIntoView()}moveH(e,i){if(i=="char"){var r=this.getCursor();this.setCursor(r.line,r.ch+e)}}setOption(e,i){switch(e){case"keyMap":this.state.keyMap=i;break;case"textwidth":this.state.textwidth=i;break}}getOption(e){switch(e){case"firstLineNumber":return 1;case"tabSize":return this.cm6.state.tabSize||4;case"readOnly":return this.cm6.state.readOnly;case"indentWithTabs":return this.cm6.state.facet(Nr)==" ";case"indentUnit":return this.cm6.state.facet(Nr).length||2;case"textwidth":return this.state.textwidth;case"keyMap":return this.state.keyMap||"vim"}}toggleOverwrite(e){this.state.overwrite=e}getTokenTypeAt(e){var i,r=this.indexFromPos(e),n=Dy(this.cm6.state,r),o=n==null?void 0:n.resolve(r),s=((i=o==null?void 0:o.type)===null||i===void 0?void 0:i.name)||"";return/comment/i.test(s)?"comment":/string/i.test(s)?"string":""}overWriteSelection(e){var i=this.cm6.state.doc,r=this.cm6.state.selection,n=r.ranges.map(o=>{if(o.empty){var s=o.to1}virtualSelectionMode(){return!!this.virtualSelection}forEachSelection(e){var i=this.cm6.state.selection;this.virtualSelection=J.create(i.ranges,i.mainIndex);for(var r=0;r_f(t,e)})},indentAuto:function(t){jX(t.cm6)},newlineAndIndentContinueComment:void 0,save:void 0};We.isWordChar=function(t){return Sw.test(t)};We.keys=aJ;We.addClass=function(t,e){};We.rmClass=function(t,e){};We.e_preventDefault=function(t){t.preventDefault()};We.e_stop=function(t){var e,i;(e=t==null?void 0:t.stopPropagation)===null||e===void 0||e.call(t),(i=t==null?void 0:t.preventDefault)===null||i===void 0||i.call(t)};We.lookupKey=function(e,i,r){var n=We.keys[e];n&&r(n)};We.on=g6;We.off=b6;We.signal=y6;We.findMatchingTag=dJ;We.findEnclosingTag=pJ;We.keyName=void 0;function x6(t,e,i){var r=document.createElement("div");return r.appendChild(e),r}function v6(t,e){t.state.currentNotificationClose&&t.state.currentNotificationClose(),t.state.currentNotificationClose=e}function lJ(t,e,i){v6(t,a);var r=x6(t,e,i&&i.bottom),n=!1,o,s=i&&typeof i.duration!="undefined"?i.duration:5e3;function a(){n||(n=!0,clearTimeout(o),r.remove(),k6(t,r))}return r.onclick=function(l){l.preventDefault(),a()},w6(t,r),s&&(o=setTimeout(a,s)),a}function w6(t,e){var i=t.state.dialog;t.state.dialog=e,e&&i!==e&&(i&&i.contains(document.activeElement)&&t.focus(),i&&i.parentElement?i.parentElement.replaceChild(e,i):i&&i.remove(),We.signal(t,"dialog"))}function k6(t,e){t.state.dialog==e&&(t.state.dialog=null,We.signal(t,"dialog"))}function cJ(t,e,i,r){r||(r={}),v6(t,void 0);var n=x6(t,e,r.bottom),o=!1;w6(t,n);function s(l){if(typeof l=="string")a.value=l;else{if(o)return;o=!0,k6(t,n),t.state.dialog||t.focus(),r.onClose&&r.onClose(n)}}var a=n.getElementsByTagName("input")[0];return a&&(r.value&&(a.value=r.value,r.selectValueOnOpen!==!1&&a.select()),r.onInput&&We.on(a,"input",function(l){r.onInput(l,a.value,s)}),r.onKeyUp&&We.on(a,"keyup",function(l){r.onKeyUp(l,a.value,s)}),We.on(a,"keydown",function(l){r&&r.onKeyDown&&r.onKeyDown(l,a.value,s)||(l.keyCode==13&&i(a.value),(l.keyCode==27||r.closeOnEnter!==!1&&l.keyCode==13)&&(a.blur(),We.e_stop(l),s()))}),r.closeOnBlur!==!1&&We.on(a,"blur",function(){setTimeout(function(){document.activeElement!==a&&s()})}),a.focus()),s}var uJ={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<","<":">>",">":"<<"};function fJ(t){return t&&t.bracketRegex||/[(){}[\]]/}function hJ(t,e,i,r,n){for(var o=n&&n.maxScanLineLength||1e4,s=n&&n.maxScanLines||1e3,a=[],l=fJ(n),c=i>0?Math.min(e.line+s,t.lastLine()+1):Math.max(t.firstLine()-1,e.line-s),u=e.line;u!=c;u+=i){var f=t.getLine(u);if(f){var d=i>0?0:f.length-1,p=i>0?f.length:-1;if(!(f.length>o))for(u==e.line&&(d=e.ch-(i<0?1:0));d!=p;d+=i){var g=f.charAt(d);if(l.test(g)){var x=uJ[g];if(x&&x.charAt(1)==">"==i>0)a.push(g);else if(a.length)a.pop();else return{pos:new Tr(u,d),ch:g}}}}}return u-i==(i>0?t.lastLine():t.firstLine())?!1:null}function dJ(t,e){}function pJ(t,e){var i,r,n=t.cm6.state,o=t.indexFromPos(e);if(or){var l=g(a,r,5);if(l){var c=(i=/^\s*/.exec(a))===null||i===void 0?void 0:i[0];t.replaceRange(` `+c,new Tr(o,l.start),new Tr(o,l.end))}s++}else if(n&&/\S/.test(a)&&o!=s){var u=t.getLine(o+1);if(u&&/\S/.test(u)){var f=a.replace(/\s+$/,""),d=u.replace(/^\s+/,""),p=f+" "+d,l=g(p,r,5);l&&l.start>f.length||p.lengthS)return{start:D.index,end:D.index+D[2].length};if(I&&I[2])return C=w+I[2].length,{start:C,end:C+I[3].length}}}}var Ew=GC||function(){let t={cursorBlinkRate:1200};return function(){return t}}(),Cw=class{constructor(e,i,r,n,o,s,a,l,c,u){this.left=e,this.top=i,this.height=r,this.fontFamily=n,this.fontSize=o,this.fontWeight=s,this.color=a,this.className=l,this.letter=c,this.partial=u}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",e.style.height=this.height+"px",e.style.lineHeight=this.height+"px",e.style.fontFamily=this.fontFamily,e.style.fontSize=this.fontSize,e.style.fontWeight=this.fontWeight,e.style.color=this.partial?"transparent":this.color,e.className=this.className,e.textContent=this.letter}eq(e){return this.left==e.left&&this.top==e.top&&this.height==e.height&&this.fontFamily==e.fontFamily&&this.fontSize==e.fontSize&&this.fontWeight==e.fontWeight&&this.color==e.color&&this.className==e.className&&this.letter==e.letter}},_w=class{constructor(e,i){this.view=e,this.rangePieces=[],this.cursors=[],this.cm=i,this.measureReq={read:this.readPos.bind(this),write:this.drawSel.bind(this)},this.cursorLayer=e.scrollDOM.appendChild(document.createElement("div")),this.cursorLayer.className="cm-cursorLayer cm-vimCursorLayer",this.cursorLayer.setAttribute("aria-hidden","true"),e.requestMeasure(this.measureReq),this.setBlinkRate()}setBlinkRate(){let i=Ew(this.cm.cm6.state).cursorBlinkRate;this.cursorLayer.style.animationDuration=i+"ms"}update(e){(e.selectionSet||e.geometryChanged||e.viewportChanged)&&(this.view.requestMeasure(this.measureReq),this.cursorLayer.style.animationName=this.cursorLayer.style.animationName=="cm-blink"?"cm-blink2":"cm-blink"),mJ(e)&&this.setBlinkRate()}scheduleRedraw(){this.view.requestMeasure(this.measureReq)}readPos(){let{state:e}=this.view,i=[];for(let r of e.selection.ranges){let n=r==e.selection.main,o=xJ(this.cm,this.view,r,n);o&&i.push(o)}return{cursors:i}}drawSel({cursors:e}){if(e.length!=this.cursors.length||e.some((i,r)=>!i.eq(this.cursors[r]))){let i=this.cursorLayer.children;if(i.length!==e.length){this.cursorLayer.textContent="";for(let r of e)this.cursorLayer.appendChild(r.draw())}else e.forEach((r,n)=>r.adjust(i[n]));this.cursors=e}}destroy(){this.cursorLayer.remove()}};function mJ(t){return Ew(t.startState)!=Ew(t.state)}var gJ={".cm-vimMode .cm-line":{"& ::selection":{backgroundColor:"transparent !important"},"&::selection":{backgroundColor:"transparent !important"},caretColor:"transparent !important"},".cm-fat-cursor":{position:"absolute",background:"#ff9696",border:"none",whiteSpace:"pre"},"&:not(.cm-focused) .cm-fat-cursor":{background:"none",outline:"solid 1px #ff9696",color:"transparent !important"}},bJ=Qt.highest(de.theme(gJ));function yJ(t){let e=t.scrollDOM.getBoundingClientRect();return{left:(t.textDirection==ot.LTR?e.left:e.right-t.scrollDOM.clientWidth)-t.scrollDOM.scrollLeft,top:e.top-t.scrollDOM.scrollTop}}function xJ(t,e,i,r){var n,o;let s=i.head,a=!1,l=1,c=t.state.vim;if(c&&(!c.insertMode||t.state.overwrite)){if(a=!0,c.visualBlock&&!r)return null;i.anchor1&&(s--,f=e.state.sliceDoc(s,s+1));let d=e.coordsAtPos(s,1);if(!d)return null;let p=yJ(e),g=e.domAtPos(s),x=g?g.node:e.contentDOM;for(;g&&g.node instanceof HTMLElement;)x=g.node,g={node:g.node.childNodes[g.offset],offset:0};if(!(x instanceof HTMLElement)){if(!x.parentNode)return null;x=x.parentNode}let w=getComputedStyle(x),S=d.left,T=(o=(n=e).coordsForChar)===null||o===void 0?void 0:o.call(n,s);if(T&&(S=T.left),!f||f==` @@ -128,8 +128,8 @@ ${n.message}`)))}function nK(){return import("./mermaid.core-3DX6XKRB.js") `||l=="\r")&&(l="\xA0");let c=s.bottom-s.top;return new Qw(s.left-a.left,s.top-a.top+c*(1-o),c*o,r?"cm-fat-cursor cm-cursor-primary":"cm-fat-cursor cm-cursor-secondary",l,o!=1)}var IJ=de.theme({".cm-emacsMode .cm-cursorLayer:not(.cm-vimCursorLayer)":{display:"none"},".cm-vim-panel":{padding:"5px 10px",backgroundColor:"#fffa8f",fontFamily:"monospace"},".cm-vim-panel input":{border:"none",outline:"none",backgroundColor:"#fffa8f"}}),LJ=Ye.fromClass(class{constructor(t){this.status="",this.view=t,this.em=new Pf(t),this.blockCursor=new Aw(t),this.view.scrollDOM.classList.add("cm-emacsMode")}update(t){t.docChanged&&(this.em.$emacsMark=null,this.em.updateMarksOnChange(t.changes)),this.blockCursor.update(t)}destroy(){this.view.scrollDOM.classList.remove("cm-emacsMode"),this.blockCursor.destroy()}},{eventHandlers:{mousedown:function(){this.em.$emacsMark=null}},provide:t=>Wt.of([{any:function(e,i){var r;return!!(!((r=e.plugin(t))===null||r===void 0)&&r.em.handleKeyboard(i))}}])}),DJ=Se.define(),NJ=Fe.define({create:()=>!1,update(t,e){for(let i of e.effects)i.is(DJ)&&(t=i.value);return t},provide:t=>yr.from(t,e=>e?MJ:null)});function MJ(t){let e=document.createElement("div");return e.className="cm-vim-panel",{top:!1,dom:e}}function C6(t={}){return[IJ,LJ,$J,NJ]}var UJ={Return:"Return",Escape:"Esc",Insert:"Ins",ArrowLeft:"Left",ArrowRight:"Right",ArrowUp:"Up",ArrowDown:"Down",Enter:"Return",Divide:"/",Slash:"/",Multiply:"*",Subtract:"-",Minus:"-",Equal:"="},zJ={Shift:1,Alt:1,Command:1,Control:1,CapsLock:1},Pw={},Pf=class t{constructor(e){this.view=e,this.$data={count:0,keyChain:"",lastCommand:""},this.$emacsMarkRing=[],this.$emacsMark=null}static bindKey(e,i){e.split("|").forEach(function(r){let n="",o=r.split(/\s+/);o.forEach(function(s,a){let l=s.split(/-(?=.)/),c=l.pop();l.length&&(n+=l.sort().join("-")+"-"),n+=c,a===o.length-1?Pw[n]=i:(Pw[n]="null",n+=" ")})})}static getKey(e){var i=e.code,r=e.key;if(zJ[r])return["","",""];i.length>1&&(i[0]=="N"&&(i=i.replace(/^Numpad/,"")),i[0]=="K"&&(i=i.replace(/^Key/,""))),i=UJ[i]||i,i.length==1&&(i=i.toLowerCase());var n="";return e.ctrlKey&&(n+="C-"),e.metaKey&&(n+="CMD-"),e.altKey&&(n+="M-"),e.shiftKey&&(n+="S-"),[i,n,r]}static addCommands(e){Object.keys(e).forEach(function(i){var r=e[i];typeof r=="function"&&(r={exec:r}),t.commands[i]=r})}static execCommand(e,i,r,n=1){var o=void 0;if(typeof e=="function")for(var s=0;s1&&e.handlesCount&&(r||(r={}),typeof r=="object"&&(r.count=n),n=1);for(var s=0;sthis.updateMark(i,e)).filter(Boolean)}updateMark(e,i){if(e){var r=e.map(function(n){return i.mapPos(n,1,vt.TrackDel)}).filter(n=>n!=null);return r.length==0?null:r}}emacsMark(){return this.$emacsMark}setEmacsMark(e){this.$emacsMark=e}pushEmacsMark(e,i){var r=this.$emacsMark;r&&this.$emacsMarkRing.push(r),!e||i?this.setEmacsMark(e):this.$emacsMarkRing.push(e)}popEmacsMark(){var e=this.emacsMark();return e?(this.setEmacsMark(null),e):this.$emacsMarkRing.pop()}getLastEmacsMark(){return this.$emacsMark||this.$emacsMarkRing.slice(-1)[0]}getCopyText(){var e=this.view.state;return e.selection.ranges.map(i=>e.sliceDoc(i.from,i.to)).join(` `)}clearSelection(){var e=this.view,i=e.state.selection,r=!i.ranges.some(o=>o.from!=o.to);if(r)return!1;var n=i.ranges.map(o=>J.range(o.head,o.head));return e.dispatch({selection:J.create(n,i.mainIndex)}),!0}onPaste(e){var i=this.view,r=i.state.selection,n;if(r.ranges.length>1){var o=e.split(` `);o.length==r.ranges.length&&(n=o)}var s=0,a=i.state.changeByRange(l=>{var c=n?n[s]:e;return s++,{changes:{from:l.from,to:l.to,insert:c},range:J.cursor(l.from+c.length)}});i.dispatch(a)}};Pf.commands={};var E6={"Up|C-p":{command:"goOrSelect",args:[hf,kl]},"Down|C-n":{command:"goOrSelect",args:[df,Sl]},"Left|C-b":{command:"goOrSelect",args:[IO,ew]},"Right|C-f":{command:"goOrSelect",args:[xX,Jv]},"C-Left|M-b":{command:"goOrSelect",args:[LO,qO]},"C-Right|M-f":{command:"goOrSelect",args:[DO,WO]},"Home|C-a":{command:"goOrSelect",args:[MO,gf]},"End|C-e":{command:"goOrSelect",args:[UO,bf]},"C-Home|S-M-,":{command:"goOrSelect",args:[yf,Tl]},"C-End|S-M-.":{command:"goOrSelect",args:[xf,El]},"S-Up|S-C-p":kl,"S-Down|S-C-n":Sl,"S-Left|S-C-b":ew,"S-Right|S-C-f":Jv,"S-C-Left|S-M-b":CX,"S-C-Right|S-M-f":EX,"S-Home|S-C-a":gf,"S-End|S-C-e":bf,"S-C-Home":Tl,"S-C-End":El,"C-l":"recenterTopBottom","M-s":"centerSelection","M-g":"gotoline","C-x C-p|C-x h":BO,"PageDown|C-v|C-Down":{command:"goOrSelect",args:[wl,ia]},"PageUp|M-v|C-Up":{command:"goOrSelect",args:[vl,ia]},"S-C-Down":ia,"S-C-Up":mf,"C-s":Xl,"C-r":Xl,"M-C-s":"findnext","M-C-r":"findprevious","S-M-5":"replace",Backspace:Cl,"Delete|C-d":vf,"Return|C-m":{command:"insertstring",args:` -`},"C-o":wf,"M-d|C-Delete":{command:"killWord",args:"right"},"C-Backspace|M-Backspace|M-Delete":{command:"killWord",args:"left"},"C-k":"killLine","M-h":"selectParagraph","M-@|M-S-2":"markWord","C-y|S-Delete":"yank","M-y":"yankRotate","C-g":"keyboardQuit","C-w|C-S-w":"killRegion","M-w":"killRingSave","C-Space":"setMark","C-x C-x":"exchangePointAndMark","C-t":VO,"M-u":{command:"changeCase",args:{dir:1}},"M-l":{command:"changeCase",args:{dir:-1}},"C-x C-u":{command:"changeCase",args:{dir:1,region:!0}},"C-x C-l":{command:"changeCase",args:{dir:1,region:!0}},"M-/":Lu,"C-u":"universalArgument","M-;":lf,"C-/|C-x u|S-C--|C-z":ea,"S-C-/|S-C-x u|C--|S-C-z":Jo,"C-x r":"selectRectangularRegion","M-x":{command:"focusCommandLine",args:"M-x "},Esc:"unsetTransientMark"};for(let t in E6)E6[t];var Jn=class t{constructor(e=[]){this.ops=e}retain(e){return e<=0?this:this.append({retain:e})}insert(e){return e===""?this:this.append({insert:e})}delete(e){return e<=0?this:this.append({delete:e})}append(e){if(this.ops.length===0)return this.ops.push(e),this;let i=this.ops.pop();return qi(e)&&Wi(i)?this.append(e).append(i):qi(e)&&qi(i)?(this.ops.push({insert:i.insert+e.insert}),this):Wi(e)&&Wi(i)?(this.ops.push({delete:i.delete+e.delete}),this):jr(e)&&jr(i)?(this.ops.push({retain:i.retain+e.retain}),this):(this.ops.push(i,e),this)}compose(e){let i=new oa(this.ops),r=new oa(e.ops),n=new t;for(;i.hasNext()||r.hasNext();)if(qi(r.peek()))n.append(r.next());else if(Wi(i.peek()))n.append(i.next());else{let o=Math.min(i.peekLength(),r.peekLength()),s=i.next(o),a=r.next(o);jr(a)?n.append(s):Wi(a)&&jr(s)&&n.append(a)}return n._trim()}transform(e,i){if(i!=="left"&&i!=="right")throw new Error(`Invalid priority "${i}", should be either "left" or "right"`);let r=new oa(this.ops),n=new oa(e.ops),o=new t;for(;r.hasNext()||n.hasNext();)if(qi(r.peek())&&(!qi(n.peek())||i==="left")){let s=am(r.next());o.retain(s)}else if(qi(n.peek()))o.append(n.next());else{let s=Math.min(r.peekLength(),n.peekLength()),a=r.next(s),l=n.next(s);if(Wi(a))continue;Wi(l)?o.append(l):o.retain(s)}return o._trim()}_trim(){return this.ops.length>0&&jr(this.ops[this.ops.length-1])&&this.ops.pop(),this}transformPosition(e){let i=new oa(this.ops),r=0;for(;i.hasNext()&&r{if(qi(e))return e.insert;if(jr(e))return e.retain;if(Wi(e))return-e.delete;throw new Error(`Invalid operation ${e}`)})}static fromCompressed(e){return e.reduce((i,r)=>{if(typeof r=="string")return i.insert(r);if(typeof r=="number"&&r>=0)return i.retain(r);if(typeof r=="number"&&r<0)return i.delete(-r);throw new Error(`Invalid compressed operation ${r}`)},new this)}applyToString(e){let i="",r=0;return this.ops.forEach(n=>{jr(n)&&(i+=e.slice(r,r+n.retain),r+=n.retain),qi(n)&&(i+=n.insert),Wi(n)&&(r+=n.delete)}),i+=e.slice(r),i}},oa=class{constructor(e){this.ops=e,this.index=0,this.offset=0}hasNext(){return this.peekLength()<1/0}next(e=1/0){let i=this.ops[this.index];if(i){let r=this.offset,n=am(i);if(e>=n-r?(e=n-r,this.index+=1,this.offset=0):this.offset+=e,Wi(i))return{delete:e};if(jr(i))return{retain:e};if(qi(i))return{insert:i.insert.substr(r,e)}}else return{retain:e}}peek(){return this.ops[this.index]||{retain:1/0}}peekLength(){return this.ops[this.index]?am(this.ops[this.index])-this.offset:1/0}};function am(t){if(qi(t))return t.insert.length;if(jr(t))return t.retain;if(Wi(t))return t.delete}function qi(t){return typeof t.insert=="string"}function jr(t){return typeof t.retain=="number"}function Wi(t){return typeof t.delete=="number"}var Q6=be.define({combine(t){return wt(t,{})}}),_6=bi.define(),jJ=Ye.fromClass(class{constructor(t){let{collabClient:e}=t.state.facet(Q6);this.collabClient=e,this.deltaSubscription=e.onDelta((i,{remote:r})=>{if(r)return t.dispatch({changes:$w(i),selection:os(t.state.selection,i),annotations:[Tt.addToHistory.of(!1),Tt.remote.of(!0),_6.of(!0)],filter:!1})})}update(t){if(!t.transactions.some(i=>i.annotation(_6))){if(t.docChanged){let i=qJ(t.changes),r=P6(t);this.collabClient.handleClientDelta(i,r)}else if(t.focusChanged||!t.state.selection.eq(t.startState.selection)){let i=P6(t);this.collabClient.handleClientSelection(i)}}}destroy(){this.deltaSubscription.destroy()}});function $w(t){let e=[],i=0;for(let r of t.ops)jr(r)&&(i+=r.retain),qi(r)&&e.push({from:i,to:i,insert:r.insert}),Wi(r)&&(e.push({from:i,to:i+r.delete}),i+=r.delete);return e}function qJ(t){let e=[];return t.iterChanges((i,r,n,o,s)=>{let a=new Jn;i&&a.retain(i),i!==r&&a.delete(r-i);let l=s.toString();l&&a.insert(l),e.push(a)}),e.reverse().reduce((i,r)=>i.compose(r))}function P6(t){return t.view.hasFocus?t.state.selection:null}function os(t,e){let i=t.ranges.map(r=>J.range(e.transformPosition(r.anchor),e.transformPosition(r.head)));return J.create(i,t.mainIndex)}function A6(t){return[jJ,Q6.of({collabClient:t})]}var WJ=de.baseTheme({".cm-peerCursor":{position:"relative",display:"inline",zIndex:"1"},".cm-peerCursorCaret":{position:"absolute",left:"0",top:"0",bottom:"0",height:"100%",width:"2px"},".cm-peerCursorLabel":{position:"absolute",left:"0",top:"0",transform:"translateY(-100%)",whiteSpace:"nowrap",padding:"1px 8px",fontSize:"12px",color:"#f8fafc",visibility:"hidden",transitionProperty:"visibility",transitionDuration:"0s",transitionDelay:"1.5s"},".cm-peerCursor .cm-peerCursorLabel:hover":{visibility:"visible"},".cm-peerCursor .cm-peerCursorCaret:hover + .cm-peerCursorLabel":{visibility:"visible",transitionDelay:"0s"},".cm-peerCursor.cm-peerCursor-inline .cm-peerCursorLabel":{marginLeft:"4px",transform:"none"}}),X6=be.define({combine(t){return wt(t,{})}}),BJ=Ye.fromClass(class{constructor(t){let{collabClient:e}=t.state.facet(X6);this.peers=e.getPeers(),this.decorations=nt.of(Object.values(this.peers).flatMap($6),!0),this.peersSubscription=e.onPeersChange(i=>{let r=this.peers;if(r===i)return;let n=new Set,o=[];for(let s in i){let a=i[s],l=r[s];l&&a.eq(l)?n.add(s):o.push(a)}this.decorations=this.decorations.update({filter:(s,a,l)=>n.has(l.spec.id),add:o.flatMap($6),sort:!0}),this.peers=i,setTimeout(()=>{t.update([])},0)})}destroy(){this.peersSubscription.destroy()}},{decorations:t=>t.decorations}),Xw=class extends Ft{constructor(e,i,r){super(),this.cursorPos=e,this.color=i,this.label=r}toDOM(e){let i=document.createElement("div");i.classList.add("cm-peerCursor"),e.state.doc.lineAt(this.cursorPos).number===1&&i.classList.add("cm-peerCursor-inline");let n=document.createElement("div");n.classList.add("cm-peerCursorCaret"),n.style.backgroundColor=this.color;let o=document.createElement("div");return o.classList.add("cm-peerCursorLabel"),o.textContent=this.label,o.style.backgroundColor=this.color,i.appendChild(n),i.appendChild(o),i}eq(e){return e.cursorPos===this.cursorPos&&e.color===this.color&&e.label===this.label}};function $6(t){let{id:e,selection:i,meta:{hex_color:r,name:n}}=t;if(!i)return[];let o=we.mark({class:"cm-peerSelection",attributes:{style:`background-color: ${r}30`},id:e}),s=i.ranges.filter(l=>!l.empty).map(({from:l,to:c})=>o.range(l,c)),a=i.ranges.map(l=>{let c=l.head;return we.widget({widget:new Xw(c,r,n),id:e}).range(c)});return s.concat(a)}function R6(t){return[BJ,X6.of({collabClient:t}),WJ]}var ZJ=de.baseTheme({".cm-doctestDetails":{paddingTop:"4px",paddingBottom:"4px",paddingLeft:"6px"},".cm-doctestDetailsContent":{whiteSpace:"pre-wrap",border:"1px solid #424857",paddingTop:"6px",paddingBottom:"6px",marginLeft:"-8px",paddingLeft:"8px",borderRadius:"4px",marginRight:"16px"},"&light .cm-doctestDetailsContent":{borderColor:"#b6b7b9"},".cm-doctestStatus":{position:"relative"},".cm-doctestStatus::before":{borderRadius:"2px",width:"10px",height:"10px",display:"block",content:"''",position:"absolute",top:"50%",left:"0",transform:"translate(calc(-100% - 6px), -50%)"},".cm-doctestStatus-running::before":{backgroundColor:"#91a4b7"},".cm-doctestStatus-success::before":{backgroundColor:"#4ade80"},".cm-doctestStatus-failed::before":{backgroundColor:"#e97579"}}),I6=Se.define(),L6=Se.define(),D6=Fe.define({create(t){return we.none},update(t,e){t=t.map(e.changes);for(let i of e.effects){if(i.is(I6)){let r=i.value;t=t.update({filter:(n,o,s)=>!r.some(a=>s.spec.report.line===a.line),add:r.flatMap(n=>VJ(n,e.state.doc)),sort:!0})}i.is(L6)&&(t=we.none)}return t},provide(t){return de.decorations.from(t)}});function VJ(t,e){let i=e.line(t.line).from+t.column,r=[we.mark({class:`cm-doctestStatus cm-doctestStatus-${t.status}`,report:t}).range(i,i+1)];if(t.status==="failed"){let n=e.line(t.end_line+1);r.push(we.widget({widget:new Rw(t),block:!0,report:t}).range(n.from))}return r}var Rw=class extends Ft{constructor(e){super(),this.report=e}toDOM(e){let i=document.createElement("div");i.classList.add("cm-doctestDetails");let r=document.createElement("div");return r.classList.add("cm-doctestDetailsContent"),r.classList.add("editor-theme-aware-ansi"),i.style.marginLeft=`${this.report.column}ch`,r.innerHTML=this.report.details,i.appendChild(r),i}eq(e){return this.report===e.report}};function N6(t,e){let i=[I6.of(e)];t.dispatch({effects:U6(t.state,i)})}function M6(t){let e=[L6.of(null)];t.dispatch({effects:U6(t.state,e)})}var YJ=[D6,ZJ];function U6(t,e){return t.field(D6,!1)?e:e.concat(Se.appendConfig.of(YJ))}var FJ=de.baseTheme({".cm-signatureHint":{display:"flex"},".cm-signatureHintStepper":{padding:"4px 8px",borderRight:"1px solid black"},".cm-signatureHintContent":{padding:"4px"},".cm-signatureHintActiveArgument":{color:"gray"}}),Qf=be.define({combine(t){return wt(t,{})}}),q6=be.define({}).from(Qf,({triggerCharacters:t,retriggerCharacters:e})=>({triggerCharacters:new Set(t),retriggerCharacters:new Set(t.concat(e))})),W6=Se.define(),B6=Se.define(),Dw=Se.define(),Z6=Se.define(),qr=Fe.define({create(){return{context:null,hint:null}},update({context:t,hint:e},i){e=e&&e.setPosition(i.state.selection.main.head),HJ(i,!!e)&&(t=z6(i.state));for(let n of i.effects)n.is(W6)&&(n.value.signatureResult?e=Iw.build(i.state,n.value.signatureResult):(t=null,e=null)),n.is(B6)&&(t=z6(i.state)),n.is(Dw)&&(t=null,e=null),n.is(Z6)&&(e=e&&e.setSelected(n.value));return{context:t,hint:e}},provide(t){return Bn.from(t,e=>e.hint&&e.hint.tooltip)}});function HJ(t,e){let{activateOnTyping:i}=t.state.facet(Qf),{triggerCharacters:r,retriggerCharacters:n}=t.state.facet(q6),o=t.startState.selection.main.head,s=t.state.selection.main.head,a=t.isUserEvent("input");if(t.docChanged){let l=!1;return t.changes.iterChangedRanges((c,u,f,d)=>{if(!l){if(cnew Lw(r)})}setSelected(e){return new t(this.signatureResult,e,this.tooltip)}setPosition(e){return e===this.tooltip.pos?this:new t(this.signatureResult,this.selectedIdx,Ce(H({},this.tooltip),{pos:e}))}},Lw=class{constructor(e){this.view=e;let{signatureResult:i}=e.state.field(qr).hint;this.dom=document.createElement("div"),this.dom.classList.add("cm-signatureHint"),i.items.length>1&&(this.stepper=document.createElement("div"),this.stepper.classList.add("cm-signatureHintStepper"),this.dom.appendChild(this.stepper));let r=document.createElement("div");r.classList.add("cm-signatureHintContent"),this.contentLeft=document.createElement("span"),this.contentActive=document.createElement("span"),this.contentActive.classList.add("cm-signatureHintActiveArgument"),this.contentRight=document.createElement("span"),r.appendChild(this.contentLeft),r.appendChild(this.contentActive),r.appendChild(this.contentRight),this.dom.appendChild(r)}mount(){this.updateSelected()}update(e){let i=e.startState.field(qr),r=e.state.field(qr);i!==r&&this.updateSelected()}updateSelected(){let{signatureResult:e,selectedIdx:i}=this.view.state.field(qr).hint,{activeArgumentIdx:r,items:n}=e,o=n[i],s=o.arguments[r];this.stepper&&(this.stepper.textContent=`${i+1}/${n.length}`);let a=o.signature.indexOf(s);this.contentLeft.textContent=o.signature.slice(0,a),this.contentActive.textContent=s,this.contentRight.textContent=o.signature.slice(a+s.length)}},GJ=Ye.fromClass(class{constructor(t){this.view=t,this.query=null}update(t){let e=t.state.field(qr);e.context!==t.startState.field(qr).context&&(this.maybeAbortQuery(),e.context&&this.requestSignature(t.state))}destroy(){this.maybeAbortQuery()}requestSignature(t){let{context:e}=t.field(qr),{source:i}=t.facet(Qf),r={aborted:!1};i(e).then(n=>{r.aborted||this.view.dispatch({effects:W6.of({signatureResult:n})})}),this.query=r}maybeAbortQuery(){this.query&&(this.query.aborted=!0,this.query=null)}},{eventHandlers:{blur(t){let e=this.view.state.field(qr,!1);e&&e.hint&&this.view.state.facet(Qf).closeOnBlur&&setTimeout(()=>{this.view.dispatch({effects:[Dw.of(null)]})},0)}}});function KJ(t){return t.dispatch({effects:[B6.of(null)]}),!0}function JJ(t){let e=t.state.field(qr,!1);return!e||!e.hint?!1:(t.dispatch({effects:[Dw.of(null)]}),!0)}var j6=t=>e=>{let i=e.state.field(qr,!1);if(!i||!i.hint)return!1;let{signatureResult:r,selectedIdx:n}=i.hint;if(r.items.length===1)return!1;let o=r.items.length,s=n+(t?1:-1);return s<0&&(s+=o),s>=o&&(s-=o),e.dispatch({effects:[Z6.of(s)]}),!0},eee=[{key:"Mod-Shift-Space",run:KJ},{key:"Escape",run:JJ},{key:"ArrowDown",run:j6(!0)},{key:"ArrowUp",run:j6(!1)}];function V6(t,{activateOnTyping:e=!0,closeOnBlur:i=!0,triggerCharacters:r=["(",","],retriggerCharacters:n=[")"]}={}){return[qr,GJ,Qf.of({source:t,activateOnTyping:e,closeOnBlur:i,triggerCharacters:r,retriggerCharacters:n}),q6,Qt.high(Wt.of(eee)),FJ]}var Y6=be.define({combine(t){return wt(t,{})}}),F6=Se.define(),cm=Fe.define({create(){return{doc:null}},update({doc:t},e){e.docChanged&&(t=null);for(let i of e.effects)i.is(F6)&&(t=e.state.doc);return{doc:t}}}),tee=Ye.fromClass(class{constructor(t){this.view=t,this.query=null}update(t){let e=t.state.field(cm);e.doc!==t.startState.field(cm).doc&&(this.maybeAbortQuery(),e.doc&&this.requestFormatterChanges(t.state))}destroy(){this.maybeAbortQuery()}requestFormatterChanges(t){let{doc:e}=t.field(cm),{source:i}=t.facet(Y6),r={aborted:!1};i(e).then(n=>{!r.aborted&&n&&this.view.dispatch({changes:n})}),this.query=r}maybeAbortQuery(){this.query&&(this.query.aborted=!0,this.query=null)}});function iee(t){return t.state.readOnly?!1:(t.dispatch({effects:[F6.of(null)]}),!0)}var ree=[{key:"Ctrl-Shift-i",mac:"Alt-Shift-f",win:"Alt-Shift-f",run:iee}];function H6(t){return[cm,tee,Y6.of({source:t}),Wt.of(ree)]}function G6(t,e){let i=e;for(;!t.endsWith(i);)i=i.slice(0,-1);return i.length}var nee=de.baseTheme({".cm-readOnlyHint":{padding:"4px"}}),K6=Se.define(),Nw=Se.define(),um=Fe.define({create(){return{tooltip:null}},update({tooltip:t},e){e.state.selection.eq(e.startState.selection)||(t=null);for(let i of e.effects)i.is(K6)&&(t={pos:e.state.selection.main.head,above:!0,create:oee}),i.is(Nw)&&(t=null);return{tooltip:t}},provide(t){return Bn.from(t,e=>e.tooltip)}});function oee(t){let e=document.createElement("div");return e.classList.add("cm-readOnlyHint"),e.textContent="This editor is read-only",{dom:e}}var see=Ye.fromClass(class{constructor(t){this.view=t}},{eventHandlers:{input(t){this.view.state.readOnly&&(this.view.state.field(um).tooltip||this.view.dispatch({effects:K6.of(null)}))},blur(t){this.view.state.readOnly&&this.view.state.field(um).tooltip&&setTimeout(()=>{this.view.dispatch({effects:[Nw.of(null)]})},0)}}});function aee(t){let e=t.state.field(um,!1);return!e||!e.tooltip?!1:(t.dispatch({effects:[Nw.of(null)]}),!0)}var lee=[{key:"Escape",run:aee}];function J6(){return[um,see,Wt.of(lee),nee]}var cee=5e3,Af=class{constructor(e,i){bt(this,"_onDelta",new Gt);bt(this,"onDelta",this._onDelta.event);bt(this,"_onPeersChange",new Gt);bt(this,"onPeersChange",this._onPeersChange.event);this.connection=e,this.revision=i,this.clientId=e.getClientId(),this.peers={},this.updatePeers(e.getClients()),this.inflightDelta=null,this.bufferDelta=null,this.selection=null,this.selectionChanged=!1,this.revisionReportTimeoutId=null,this.subscriptions=[e.onDelta(this.handleServerDelta.bind(this)),e.onAcknowledgement(this.handleServerAcknowledgement.bind(this)),e.onSelection(this.handleServerSelection.bind(this)),e.onClientsUpdate(this.handleServerClientsUpdate.bind(this))]}destroy(){this.subscriptions.forEach(e=>e.destroy())}getPeers(){return this.peers}handleClientDelta(e,i){this.peers=eR(this.peers,e),this.selection=i,this.inflightDelta?this.bufferDelta?this.bufferDelta=this.bufferDelta.compose(e):this.bufferDelta=e:(this.inflightDelta=e,this.sendDelta()),this._onDelta.dispatch(e,{remote:!1}),this._onPeersChange.dispatch(this.peers)}handleClientSelection(e){this.selection=e,this.inflightDelta?this.selectionChanged=!0:this.sendSelection()}handleServerDelta(e,i,r){this.revision++;let{inflightDelta:n,bufferDelta:o}=this;n&&([e,n]=[n.transform(e,"right"),e.transform(n,"left")],i=i&&os(i,n)),o&&([e,o]=[o.transform(e,"right"),e.transform(o,"left")],i=i&&os(i,o)),this.inflightDelta=n,this.bufferDelta=o,this.selection=this.selection&&os(this.selection,e);let[s,a]=CO(this.peers,r);a=eR(a,e),s&&(a[r]=new Il(s.id,s.meta,i)),this.peers=a,this._onDelta.dispatch(e,{remote:!0}),this._onPeersChange.dispatch(this.peers),this.maybeScheduleRevisionReport()}handleServerAcknowledgement(){this.revision++,this.inflightDelta=null,this.bufferDelta&&(this.inflightDelta=this.bufferDelta,this.bufferDelta=null,this.sendDelta())}handleServerSelection(e,i){if(!this.peers.hasOwnProperty(i))return;let{inflightDelta:r,bufferDelta:n}=this;r&&(e=e&&os(e,r)),n&&(e=e&&os(e,n));let o=this.peers[i];this.peers=Ce(H({},this.peers),{[i]:new Il(o.id,o.meta,e)}),this._onPeersChange.dispatch(this.peers)}handleServerClientsUpdate(e){this.updatePeers(e),this._onPeersChange.dispatch(this.peers)}sendDelta(){this.connection.sendDelta(this.inflightDelta,this.selection,this.revision),this.selectionChanged=!1,this.maybeCancelRevisionReport()}sendSelection(){Object.keys(this.peers).length>0&&this.connection.sendSelection(this.selection,this.revision),this.selectionChanged=!1}sendRevision(){this.connection.sendRevision(this.revision)}updatePeers(e){let i={};for(let r in e)if(r!==this.clientId){let n=this.peers[r],o=e[r],s=n?n.selection:null;i[r]=new Il(r,o,s)}this.peers=i}maybeScheduleRevisionReport(){!this.inflightDelta&&!this.revisionReportTimeoutId&&(this.revisionReportTimeoutId=setTimeout(()=>{this.sendRevision(),this.revisionReportTimeoutId=null},cee))}maybeCancelRevisionReport(){this.revisionReportTimeoutId!==null&&(clearTimeout(this.revisionReportTimeoutId),this.revisionReportTimeoutId=null)}},Il=class{constructor(e,i,r){this.id=e,this.meta=i,this.selection=r}eq(e){return this.id===e.id&&this.meta===e.meta&&(this.selection===e.selection||this.selection&&e.selection&&this.selection.eq(e.selection))}};function eR(t,e){let i={};for(let r in t){let n=t[r],o=n.selection&&os(n.selection,e);i[r]=new Il(n.id,n.meta,o)}return i}function tR(t){let e=t.state.selection;return e.ranges.length>1?(t.dispatch({selection:e.asSingle()}),!0):!1}function Mw(t,e){for(;t;){if(e.includes(t.type.name))return t;t=t.parent}return null}function iR(t,e){let i=0;for(;it.selection.ranges.every(i=>i.empty)?{}:{class:"cm-selecting"});function rR(){return[uee]}var $f=class{constructor(e,i,r,n,o,s,a){bt(this,"_onMount",new Gt);bt(this,"onMount",this._onMount.event);bt(this,"_onChange",new Gt);bt(this,"onChange",this._onChange.event);bt(this,"_onBlur",new Gt);bt(this,"onBlur",this._onBlur.event);bt(this,"_onFocus",new Gt);bt(this,"onFocus",this._onFocus.event);this.container=e,this.source=r,this.language=o,this.intellisense=s,this.readOnly=a,this.initialWidgets={},this.connection=i,this.collabClient=new Af(i,n),this.deltaSubscription=this.collabClient.onDelta((l,c)=>{this.source=l.applyToString(this.source),this._onChange.dispatch(this.source)})}isMounted(){return!!this.view}mount(){if(this.isMounted())throw new Error("The editor is already mounted");this.mountEditor(),this.setInitialWidgets(),this._onMount.dispatch()}getSource(){return this.source}getElementAtCursor(){if(!this.isMounted())return this.container;let{node:e}=this.view.domAtPos(this.view.state.selection.main.head);return e instanceof Element?e:e.parentElement}focus(){this.isMounted()||this.mount(),this.view.focus()}blur(){this.isMounted()&&this.view.hasFocus&&this.view.contentDOM.blur()}destroy(){this.isMounted()&&this.view.destroy(),this.collabClient.destroy(),this.deltaSubscription.destroy()}updateDoctests(e){if(this.isMounted())N6(this.view,e);else{this.initialWidgets.doctestReportsByLine=this.initialWidgets.doctestReportsByLine||{};for(let i of e)this.initialWidgets.doctestReportsByLine[i.line]=i}}clearDoctests(){this.isMounted()?M6(this.view):delete this.initialWidgets.doctestReportsByLine}setCodeMarkers(e){if(this.isMounted()){let i=this.view.state.doc,r=e.map(n=>{let o=i.line(n.line),[,s,a]=o.text.match(/^(\s*).*?(\s*)$/),l=o.from+s.length,c=o.to-a.length;return{from:l,to:c,severity:n.severity,message:n.description}});this.view.dispatch(s6(this.view.state,r))}else this.initialWidgets.codeMarkers=e}mountEditor(){let e=Et.get(),i=l=>l.toString().padStart(3," "),r=l=>{let c=document.createElement("i");return c.classList.add(l?"ri-arrow-down-s-line":"ri-arrow-right-s-line",l?"cm-gutterFoldMarker-open":null),c},n=de.theme({"&":{fontSize:`${e.editor_font_size}px`}}),o=this.language==="markdown"&&e.editor_markdown_word_wrap,s=this.language&&zt.matchLanguageName(mO,this.language,!1),a=[{key:"Escape",run:tR}];this.view=new de({parent:this.container,doc:this.source,extensions:[a_({formatNumber:i}),i_(),l_(),t_(),JX(),X_({markerDOM:r}),Np({placeholderText:"\u22EF"}),HC(),e_(),r_(),rR(),n_(),rt.allowMultipleSelections.of(!0),N_(),rP(),S_(),mX(),rt.readOnly.of(this.readOnly),J6(),Wt.of(d6),Wt.of(a),rt.tabSize.of(2),rt.lineSeparator.of(` -`),o?de.lineWrapping:[],de.contentAttributes.of({tabIndex:-1}),n,e.editor_theme==="light"?Q$:P$,A6(this.collabClient),R6(this.collabClient),sx({activateOnTyping:e.editor_auto_completion,defaultKeymap:!1}),this.intellisense?[sx({override:[this.completionSource.bind(this)]}),Ep(this.docsHoverTooltipSource.bind(this)),V6(this.signatureSource.bind(this),{activateOnTyping:e.editor_auto_signature}),H6(this.formatterSource.bind(this))]:[],e.editor_mode==="vim"?[T6()]:[],e.editor_mode==="emacs"?[C6()]:[],s?s.support:[],de.domEventHandlers({keydown:this.handleEditorKeydown.bind(this),blur:this.handleEditorBlur.bind(this),focus:this.handleEditorFocus.bind(this)})]})}handleEditorKeydown(e){return e.key==="Escape"&&this.container.dispatchEvent(new CustomEvent("lb:editor_escape",{bubbles:!0})),!1}handleEditorBlur(e){return this.container.contains(e.relatedTarget)||this._onBlur.dispatch(),!1}handleEditorFocus(e){return this._onFocus.dispatch(),!1}completionSource(e){let i=Et.get();if(!e.matchBefore(/[\w?!.]$/)&&!e.explicit)return null;let n=this.getCompletionHint(e);return this.connection.intellisenseRequest("completion",{hint:n,editor_auto_completion:i.editor_auto_completion}).then(o=>{if(o.items.length===0)return null;let s=o.items.map((l,c)=>{let u=this.completionItemToCompletions(l);return Ce(H({},u),{boost:1-c/o.items.length})}),a=G6(n,o.items[0].insert_text);return{from:e.pos-a,options:s,validFor:/^\w*[!?]?$/}}).catch(()=>null)}getCompletionHint(e){let r=ze(e.state).resolve(e.pos);if(r&&this.language==="elixir"){let n=Mw(r,["Map","Bitstring"]);if(n)return e.state.doc.sliceString(n.from,e.pos)}return e.matchBefore(/^.*/).text}completionItemToCompletions(e){let i={label:e.label,type:e.kind,info:n=>e.documentation===null?null:J$(350).then(()=>{let o=document.createElement("div");return o.classList.add("cm-completionInfoDocs"),o.classList.add("cm-markdown"),new Gs(o,e.documentation,{defaultCodeLanguage:this.language}),o})},r=e.insert_text.includes("${}")?e.insert_text:e.insert_text+"${}";return ci(r,i)}docsHoverTooltipSource(e,i,r){let n=e.state.doc.lineAt(i),o=n.to-n.from,s=n.text,a=i-n.from+(r===1?1:0);return a<1||a>o?null:this.connection.intellisenseRequest("details",{line:s,column:a}).then(l=>({pos:n.from+l.range.from-1,end:n.from+l.range.to-1,above:!0,create:c=>{let u=document.createElement("div");u.classList.add("cm-hoverDocs");for(let f of l.contents){let d=document.createElement("div");d.classList.add("cm-hoverDocsContent"),d.classList.add("cm-markdown"),u.appendChild(d),new Gs(d,f,{defaultCodeLanguage:this.language})}return{dom:u}}})).catch(()=>null)}signatureSource({state:e,pos:i}){let r=this.getSignatureHint(e,i);return this.connection.intellisenseRequest("signature",{hint:r}).then(n=>({activeArgumentIdx:n.active_argument,items:n.items})).catch(()=>null)}getSignatureHint(e,i){let n=ze(e).resolve(i);if(n&&this.language==="elixir"){let o=Mw(n,["Call","FunctionDefinitionCall","KernelCall"]);if(o){let a=iR(o,["Right","PipeOperator"])||o;return e.doc.sliceString(a.from,i)}}return e.doc.sliceString(0,i)}formatterSource(e){return this.connection.intellisenseRequest("format",{code:e.toString()}).then(i=>{if(this.setCodeMarkers(i.code_markers),i.delta){let r=Jn.fromCompressed(i.delta);return $w(r)}else return null}).catch(()=>null)}setInitialWidgets(){if(this.initialWidgets.doctestReportsByLine){let e=Object.values(this.initialWidgets.doctestReportsByLine);this.updateDoctests(e)}this.initialWidgets.codeMarkers&&this.setCodeMarkers(this.initialWidgets.codeMarkers),this.initialWidgets={}}};var Xf={},Ll=class t{constructor(e){this.id=e,this.pubsub=new xl,this.map={}}static create(e){let i=new t(e);return Xf[e]=i,i}static getStore(e){if(!Xf.hasOwnProperty(e))throw new Error(`No store found for id "${e}"`);return Xf[e]}destroy(){Xf[this.id]===this&&delete Xf[this.id]}set(e,i){this.map[e]=i,this.pubsub.broadcast(e,i)}get(e){if(!this.map.hasOwnProperty(e))throw new Error(`Key "${e}" not found in the store`);return this.map[e]}watch(e,i){return this.pubsub.subscribe(e,i)}};var Rf=class{constructor(e,i,r){bt(this,"_onDelta",new Gt);bt(this,"onDelta",this._onDelta.event);bt(this,"_onAcknowledgement",new Gt);bt(this,"onAcknowledgement",this._onAcknowledgement.event);bt(this,"_onSelection",new Gt);bt(this,"onSelection",this._onSelection.event);bt(this,"_onClientsUpdate",new Gt);bt(this,"onClientsUpdate",this._onClientsUpdate.event);this.hook=e,this.cellId=i,this.tag=r,this.sessionStore=Ll.getStore("session"),this.handlerByRef={},this.setupCollaborationHandlers(),this.clientsSubscription=this.sessionStore.watch("clients",n=>{this._onClientsUpdate.dispatch(n)}),this.setupIntellisenseHandlers()}destroy(){this.clientsSubscription.destroy()}getClients(){return this.sessionStore.get("clients")}getClientId(){return this.sessionStore.get("clientId")}sendDelta(e,i,r){this.hook.pushEvent("apply_cell_delta",{cell_id:this.cellId,tag:this.tag,delta:e.toCompressed(),selection:i&&nR(i),revision:r})}sendSelection(e,i){this.hook.pushEvent("report_cell_selection",{cell_id:this.cellId,tag:this.tag,selection:e&&nR(e),revision:i})}sendRevision(e){this.hook.pushEvent("report_cell_revision",{cell_id:this.cellId,tag:this.tag,revision:e})}setupCollaborationHandlers(){this.hook.handleEvent(`cell_delta:${this.cellId}:${this.tag}`,({delta:e,selection:i,client_id:r})=>{e=Jn.fromCompressed(e),i=i&&oR(i),this._onDelta.dispatch(e,i,r)}),this.hook.handleEvent(`cell_acknowledgement:${this.cellId}:${this.tag}`,()=>{this._onAcknowledgement.dispatch()}),this.hook.handleEvent(`cell_selection:${this.cellId}:${this.tag}`,({selection:e,client_id:i})=>{e=e&&oR(e),this._onSelection.dispatch(e,i)})}setupIntellisenseHandlers(){this.hook.handleEvent("intellisense_response",({ref:e,response:i})=>{let r=this.handlerByRef[e];r&&(r(i),delete this.handlerByRef[e])})}intellisenseRequest(e,i){return new Promise((r,n)=>{this.hook.pushEvent("intellisense_request",H({cell_id:this.cellId,type:e},i),({ref:o})=>{o?this.handlerByRef[o]=s=>{s?r(s):n(new fm("No relevant intellisense response for the given parameters"))}:n(new fm("Intellisense request could not be completed"))})})}};function nR(t){return t.ranges.map(({anchor:e,head:i})=>[e,i])}function oR(t){let e=t.map(([i,r])=>J.range(i,r));return J.create(e)}var fm=class extends Error{constructor(e){super(e),this.name="IntellisenseError"}};var fee={mounted(){this.props=this.getProps(),this.handleEvent(`cell_editor_init:${this.props.cellId}:${this.props.tag}`,({source:t,revision:e,doctest_reports:i,code_markers:r})=>{let n=this.el.querySelector("[data-el-editor-container]"),o=document.createElement("div");n.appendChild(o),this.connection=new Rf(this,this.props.cellId,this.props.tag),this.liveEditor=new $f(o,this.connection,t,e,this.props.language,this.props.intellisense,this.props.readOnly),this.liveEditor.setCodeMarkers(r),this.liveEditor.updateDoctests(i);let s=n.querySelector("[data-el-skeleton]"),a=document.createElement("div");a.classList.add("whitespace-pre","overflow-x-auto","text-editor","font-editor","px-12"),a.textContent=t,s.replaceChildren(a),this.liveEditor.onMount(()=>{s.remove()}),this.el.dispatchEvent(new CustomEvent("lb:cell:editor_created",{detail:{tag:this.props.tag,liveEditor:this.liveEditor},bubbles:!0})),this.visibility=kO(this.el,{root:document.querySelector("[data-el-notebook]"),proximity:2e3}),this.visibility.promise.then(()=>{this.liveEditor.isMounted()||this.liveEditor.mount()})})},disconnected(){this.el.removeAttribute("id")},destroyed(){this.connection&&this.connection.destroy(),this.liveEditor&&(this.el.dispatchEvent(new CustomEvent("lb:cell:editor_removed",{detail:{tag:this.props.tag},bubbles:!0})),this.liveEditor.destroy()),this.visibility&&this.visibility.cancel()},getProps(){return ht(this.el,["cell-id","tag","language","intellisense","read-only"])}},sR=fee;var Uw="data-js-dragging",hee={mounted(){this.el.addEventListener("dragenter",t=>{this.el.setAttribute(Uw,"")}),this.el.addEventListener("dragleave",t=>{this.el.contains(t.relatedTarget)||this.el.removeAttribute(Uw)}),this.el.addEventListener("drop",t=>{this.el.removeAttribute(Uw)})}},aR=hee;var dee={mounted(){let t=Et.get(),e=this.el.querySelector('[name="editor_auto_completion"][value="true"]'),i=this.el.querySelector('[name="editor_auto_signature"][value="true"]'),r=this.el.querySelector('[name="editor_font_size"][value="true"]'),n=this.el.querySelector('[name="editor_light_theme"][value="true"]'),o=this.el.querySelector('[name="editor_markdown_word_wrap"][value="true"]'),s=this.el.querySelector('select[name="editor_mode"]');e.checked=t.editor_auto_completion,i.checked=t.editor_auto_signature,r.checked=t.editor_font_size===of.large,n.checked=t.editor_theme===yl.light,o.checked=t.editor_markdown_word_wrap,s.value=t.editor_mode,e.addEventListener("change",a=>{Et.update({editor_auto_completion:a.target.checked})}),i.addEventListener("change",a=>{Et.update({editor_auto_signature:a.target.checked})}),r.addEventListener("change",a=>{Et.update({editor_font_size:a.target.checked?of.large:of.normal})}),n.addEventListener("change",a=>{Et.update({editor_theme:a.target.checked?yl.light:yl.default})}),o.addEventListener("change",a=>{Et.update({editor_markdown_word_wrap:a.target.checked})}),s.addEventListener("change",a=>{Et.update({editor_mode:a.target.value})})}},lR=dee;var E2=(t,e,i)=>{if(!e.has(t))throw TypeError("Cannot "+i)},to=(t,e,i)=>(E2(t,e,"read from private field"),i?i.call(t):e.get(t)),eo=(t,e,i)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,i)},Vw=(t,e,i,r)=>(E2(t,e,"write to private field"),r?r.call(t,i):e.set(t,i),i),Wr=(t,e,i)=>(E2(t,e,"access private method"),i),pee="14.0";function Oee(t,e,i){let r=`https://cdn.jsdelivr.net/npm/emojibase-data@${e}/${t}`;return typeof i=="function"?r=i(t,e):typeof i=="string"&&(r=`${i}/${t}`),r}async function C2(t,e={}){let d=e,{local:i=!1,version:r="latest",cdnUrl:n}=d,o=hi(d,["local","version","cdnUrl"]),s=Oee(t,r,n),a=i?localStorage:sessionStorage,l=`emojibase/${r}/${t}`,c=a.getItem(l);if(c)return Promise.resolve(JSON.parse(c));let u=await fetch(s,H({credentials:"omit",mode:"cors",redirect:"error"},o));if(!u.ok)throw new Error("Failed to load Emojibase dataset.");let f=await u.json();try{a.setItem(l,JSON.stringify(f))}catch(p){}return f}var mee={discord:"joypixels",slack:"iamcal"};async function cR(t,e,i){var r;return C2(`${t}/shortcodes/${(r=mee[e])!==null&&r!==void 0?r:e}.json`,i)}function Nf(t,e){if(e.length===0)return t;let i=new Set(t.shortcodes);return e.forEach(r=>{let n=r[t.hexcode];Array.isArray(n)?n.forEach(o=>i.add(o)):n&&i.add(n)}),t.shortcodes=[...i],t.skins&&t.skins.forEach(r=>{Nf(r,e)}),t}function gee(t,e=[]){let i=[];return t.forEach(r=>{if(r.skins){let n=r,{skins:o}=n,s=hi(n,["skins"]);i.push(Nf(s,e)),o.forEach(a=>{let l=H({},a);s.tags&&(l.tags=[...s.tags]),i.push(Nf(l,e))})}else i.push(Nf(r,e))}),i}function bee(t,e){return e.length===0||t.forEach(i=>{Nf(i,e)}),t}async function bR(t,e={}){let l=e,{compact:i=!1,flat:r=!1,shortcodes:n=[]}=l,o=hi(l,["compact","flat","shortcodes"]),s=await C2(`${t}/${i?"compact":"data"}.json`,o),a=[];return n.length>0&&(a=await Promise.all(n.map(c=>{let u;if(c.includes("/")){let[f,d]=c.split("/");u=cR(f,d,o)}else u=cR(t,c,o);return u.catch(()=>({}))}))),r?gee(s,a):bee(s,a)}async function yR(t,e){return C2(`${t}/messages.json`,e)}function zw(t,e){let i=t.target.closest("[data-emoji]");if(i){let r=e.find(n=>n.emoji===i.dataset.emoji);if(r)return r}return null}function xR(t){var e;let i=(e=window.matchMedia)==null?void 0:e.call(window,"(prefers-reduced-motion: reduce)");return t.animate&&!(i!=null&&i.matches)}function uR(t,e){return t.toLowerCase().includes(e.toLowerCase())}function yee(t,e){let i=null;return()=>{i||(i=window.setTimeout(()=>{t(),i=null},e))}}function xee(t,e){let i=null;return(...r)=>{i&&window.clearTimeout(i),i=window.setTimeout(()=>{t(...r),i=null},e)}}function sa(t,e,i,r){if(xR(r)&&t.animate)return t.animate(e,i).finished;let n=i.direction==="normal"?1:0,o=Object.entries(e).reduce((s,[a,l])=>Ce(H({},s),{[a]:l[n]}),{});return Object.assign(t.style,o),Promise.resolve()}function Yw(t){var e;let i=document.createElement("template");return i.innerHTML=t,(e=i.content)==null?void 0:e.firstElementChild}async function vee(t){let e=new TextEncoder().encode(t),i=await crypto.subtle.digest("SHA-256",e);return Array.from(new Uint8Array(i)).map(r=>r.toString(16).padStart(2,"0")).join("")}function ui(...t){return t.reduce((e,i)=>Ce(H({},e),{[i]:_2(i)}),{})}function _2(t){return`picmo__${t}`}function Om(t){for(;t.firstChild;)t.removeChild(t.firstChild);return t}function Dl(t,...e){Om(t).append(...e)}function vR(t){try{return window[t].length,!0}catch(e){return!1}}function wee(){return vR("sessionStorage")}function kee(){return vR("localStorage")}function Uf(t){var e;return{emoji:t.emoji,label:t.label,tags:t.tags,skins:(e=t.skins)==null?void 0:e.map(i=>Uf(i)),order:t.order,custom:!1,hexcode:t.hexcode,version:t.version}}function wm(t,e,i){var r;return i&&!i.some(n=>n.order===t.group)?!1:uR(t.label,e)||((r=t.tags)==null?void 0:r.some(n=>uR(n,e)))}var km=class{constructor(e="en"){this.locale=e}},See=[(t,e)=>(t.hexcode==="1F91D"&&e<14&&(t.skins=[]),t),(t,e)=>(t.skins&&(t.skins=t.skins.filter(i=>!i.version||i.version<=e)),t)];function Tee(t,e){return See.some(i=>i(t,e)===null)?null:t}function Sm(t,e){return t.filter(i=>Tee(i,e)!==null)}var jw={};function wR(t){return jw[t]||(jw[t]=new Fw(t)),jw[t]}wR.deleteDatabase=t=>{};var Fw=class extends km{open(){return Promise.resolve()}delete(){return Promise.resolve()}close(){}isPopulated(){return Promise.resolve(!1)}getEmojiCount(){return Promise.resolve(this.emojis.length)}getEtags(){return Promise.resolve({foo:"bar"})}getHash(){return Promise.resolve("")}populate(e){return this.categories=e.groups,this.emojis=e.emojis,Promise.resolve()}getCategories(e){var i;let r=this.categories.filter(n=>n.key!=="component");if(e.showRecents&&r.unshift({key:"recents",order:-1}),(i=e.custom)!=null&&i.length&&r.push({key:"custom",order:10}),e.categories){let n=e.categories;r=r.filter(o=>n.includes(o.key)),r.sort((o,s)=>n.indexOf(o.key)-n.indexOf(s.key))}else r.sort((n,o)=>n.order-o.order);return Promise.resolve(r)}getEmojis(e,i){let r=this.emojis.filter(n=>n.group===e.order).filter(n=>n.version<=i).sort((n,o)=>n.order!=null&&o.order!=null?n.order-o.order:0).map(Uf);return Promise.resolve(Sm(r,i))}searchEmojis(e,i,r,n){let o=this.emojis.filter(l=>wm(l,e,n)&&l.version<=r).map(Uf),s=i.filter(l=>wm(l,e,n)),a=[...Sm(o,r),...s];return Promise.resolve(a)}setMeta(e){this.meta=e}};function Eee(t,e){let i=`https://cdn.jsdelivr.net/npm/emojibase-data@${t}/${e}`;return{emojisUrl:`${i}/data.json`,messagesUrl:`${i}/messages.json`}}async function fR(t){try{return(await fetch(t,{method:"HEAD"})).headers.get("etag")}catch(e){return null}}function Cee(t){let{emojisUrl:e,messagesUrl:i}=Eee("latest",t);try{return Promise.all([fR(e),fR(i)])}catch(r){return Promise.all([null,null])}}async function _ee(t,e,i){let r;try{r=await t.getEtags()}catch(s){r={}}let{storedEmojisEtag:n,storedMessagesEtag:o}=r;if(i!==o||e!==n){let[s,a]=await Promise.all([yR(t.locale),bR(t.locale)]);await t.populate({groups:s.groups,emojis:a,emojisEtag:e,messagesEtag:i})}}async function Pee(t,e){let i=await t.getHash();return e!==i}async function kR(t,e,i){let r=i||e(t);try{await r.open()}catch(n){console.warn("[picmo] IndexedDB not available, falling back to InMemoryStoreFactory"),r=wR(t)}return r}async function Qee(t,e,i){if(!wee()&&typeof window<"u")throw new Error("Session storage is required to use CDN emoji data.");let r=await kR(t,e,i),[n,o]=await Cee(t);if(await r.isPopulated())n&&o&&await _ee(r,n,o);else{let[s,a]=await Promise.all([yR(t),bR(t)]);await r.populate({groups:s.groups,emojis:a,emojisEtag:n,messagesEtag:o})}return r}async function Aee(t,e,i,r,n){let o=await kR(t,e,n),s=await vee(r);return(!await o.isPopulated()||await Pee(o,s))&&await o.populate({groups:i.groups,emojis:r,hash:s}),o}async function SR(t,e,i,r,n){return i&&r?Aee(t,e,i,r,n):Qee(t,e,n)}var zf=class{constructor(){this.handleKeyDown=this.handleKeyDown.bind(this)}activate(e){this.rootElement=e,this.rootElement.addEventListener("keydown",this.handleKeyDown)}deactivate(){var e;(e=this.rootElement)==null||e.removeEventListener("keydown",this.handleKeyDown)}get focusableElements(){return this.rootElement.querySelectorAll('input, [tabindex="0"]')}get lastFocusableElement(){return this.focusableElements[this.focusableElements.length-1]}get firstFocusableElement(){return this.focusableElements[0]}checkFocus(e,i,r){e.target===i&&(r.focus(),e.preventDefault())}handleKeyDown(e){e.key==="Tab"&&this.checkFocus(e,e.shiftKey?this.firstFocusableElement:this.lastFocusableElement,e.shiftKey?this.lastFocusableElement:this.firstFocusableElement)}},{light:$ee,dark:mke,auto:gke}=ui("light","dark","auto"),Me=class{constructor({template:e,classes:i,parent:r}){this.isDestroyed=!1,this.appEvents={},this.uiEvents=[],this.uiElements={},this.ui={},this.template=e,this.classes=i,this.parent=r,this.keyBindingHandler=this.keyBindingHandler.bind(this)}initialize(){this.bindAppEvents()}setCustomEmojis(e){this.customEmojis=e}setEvents(e){this.events=e}setPickerId(e){this.pickerId=e}emit(e,...i){this.events.emit(e,...i)}setI18n(e){this.i18n=e}setRenderer(e){this.renderer=e}setEmojiData(e){this.emojiDataPromise=e,e.then(i=>{this.emojiData=i})}updateEmojiData(e){this.emojiData=e,this.emojiDataPromise=Promise.resolve(e)}setOptions(e){this.options=e}renderSync(e={}){return this.el=this.template.renderSync(H({classes:this.classes,i18n:this.i18n,pickerId:this.pickerId},e)),this.postRender(),this.el}async render(e={}){return await this.emojiDataPromise,this.el=await this.template.renderAsync(H({classes:this.classes,i18n:this.i18n,pickerId:this.pickerId},e)),this.postRender(),this.el}postRender(){this.bindUIElements(),this.bindKeyBindings(),this.bindUIEvents(),this.scheduleShowAnimation()}bindAppEvents(){Object.keys(this.appEvents).forEach(e=>{this.events.on(e,this.appEvents[e],this)}),this.events.on("data:ready",this.updateEmojiData,this)}unbindAppEvents(){Object.keys(this.appEvents).forEach(e=>{this.events.off(e,this.appEvents[e])}),this.events.off("data:ready",this.updateEmojiData)}keyBindingHandler(e){let i=this.keyBindings[e.key];i&&i.call(this,e)}bindKeyBindings(){this.keyBindings&&this.el.addEventListener("keydown",this.keyBindingHandler)}unbindKeyBindings(){this.keyBindings&&this.el.removeEventListener("keydown",this.keyBindingHandler)}bindUIElements(){this.ui=Object.keys(this.uiElements).reduce((e,i)=>Ce(H({},e),{[i]:this.el.querySelector(this.uiElements[i])}),{})}bindUIEvents(){this.uiEvents.forEach(e=>{e.handler=e.handler.bind(this),(e.target?this.ui[e.target]:this.el).addEventListener(e.event,e.handler,e.options)})}unbindUIEvents(){this.uiEvents.forEach(e=>{(e.target?this.ui[e.target]:this.el).removeEventListener(e.event,e.handler)})}destroy(){this.unbindAppEvents(),this.unbindUIEvents(),this.unbindKeyBindings(),this.el.remove(),this.isDestroyed=!0}scheduleShowAnimation(){if(this.parent){let e=new MutationObserver(i=>{let[r]=i;r.type==="childList"&&r.addedNodes[0]===this.el&&(xR(this.options)&&this.animateShow&&this.animateShow(),e.disconnect)});e.observe(this.parent,{childList:!0})}}static childEvent(e,i,r,n={}){return{target:e,event:i,handler:r,options:n}}static uiEvent(e,i,r={}){return{event:e,handler:i,options:r}}static byClass(e){return`.${e}`}},Xee='',Ree='',Iee='',Lee='',Dee='',Nee='',Mee='',Uee='',zee=` +`},"C-o":wf,"M-d|C-Delete":{command:"killWord",args:"right"},"C-Backspace|M-Backspace|M-Delete":{command:"killWord",args:"left"},"C-k":"killLine","M-h":"selectParagraph","M-@|M-S-2":"markWord","C-y|S-Delete":"yank","M-y":"yankRotate","C-g":"keyboardQuit","C-w|C-S-w":"killRegion","M-w":"killRingSave","C-Space":"setMark","C-x C-x":"exchangePointAndMark","C-t":VO,"M-u":{command:"changeCase",args:{dir:1}},"M-l":{command:"changeCase",args:{dir:-1}},"C-x C-u":{command:"changeCase",args:{dir:1,region:!0}},"C-x C-l":{command:"changeCase",args:{dir:1,region:!0}},"M-/":Lu,"C-u":"universalArgument","M-;":lf,"C-/|C-x u|S-C--|C-z":ea,"S-C-/|S-C-x u|C--|S-C-z":Jo,"C-x r":"selectRectangularRegion","M-x":{command:"focusCommandLine",args:"M-x "},Esc:"unsetTransientMark"};for(let t in E6)E6[t];var Jn=class t{constructor(e=[]){this.ops=e}retain(e){return e<=0?this:this.append({retain:e})}insert(e){return e===""?this:this.append({insert:e})}delete(e){return e<=0?this:this.append({delete:e})}append(e){if(this.ops.length===0)return this.ops.push(e),this;let i=this.ops.pop();return qi(e)&&Wi(i)?this.append(e).append(i):qi(e)&&qi(i)?(this.ops.push({insert:i.insert+e.insert}),this):Wi(e)&&Wi(i)?(this.ops.push({delete:i.delete+e.delete}),this):jr(e)&&jr(i)?(this.ops.push({retain:i.retain+e.retain}),this):(this.ops.push(i,e),this)}compose(e){let i=new oa(this.ops),r=new oa(e.ops),n=new t;for(;i.hasNext()||r.hasNext();)if(qi(r.peek()))n.append(r.next());else if(Wi(i.peek()))n.append(i.next());else{let o=Math.min(i.peekLength(),r.peekLength()),s=i.next(o),a=r.next(o);jr(a)?n.append(s):Wi(a)&&jr(s)&&n.append(a)}return n._trim()}transform(e,i){if(i!=="left"&&i!=="right")throw new Error(`Invalid priority "${i}", should be either "left" or "right"`);let r=new oa(this.ops),n=new oa(e.ops),o=new t;for(;r.hasNext()||n.hasNext();)if(qi(r.peek())&&(!qi(n.peek())||i==="left")){let s=am(r.next());o.retain(s)}else if(qi(n.peek()))o.append(n.next());else{let s=Math.min(r.peekLength(),n.peekLength()),a=r.next(s),l=n.next(s);if(Wi(a))continue;Wi(l)?o.append(l):o.retain(s)}return o._trim()}_trim(){return this.ops.length>0&&jr(this.ops[this.ops.length-1])&&this.ops.pop(),this}transformPosition(e){let i=new oa(this.ops),r=0;for(;i.hasNext()&&r{if(qi(e))return e.insert;if(jr(e))return e.retain;if(Wi(e))return-e.delete;throw new Error(`Invalid operation ${e}`)})}static fromCompressed(e){return e.reduce((i,r)=>{if(typeof r=="string")return i.insert(r);if(typeof r=="number"&&r>=0)return i.retain(r);if(typeof r=="number"&&r<0)return i.delete(-r);throw new Error(`Invalid compressed operation ${r}`)},new this)}applyToString(e){let i="",r=0;return this.ops.forEach(n=>{jr(n)&&(i+=e.slice(r,r+n.retain),r+=n.retain),qi(n)&&(i+=n.insert),Wi(n)&&(r+=n.delete)}),i+=e.slice(r),i}},oa=class{constructor(e){this.ops=e,this.index=0,this.offset=0}hasNext(){return this.peekLength()<1/0}next(e=1/0){let i=this.ops[this.index];if(i){let r=this.offset,n=am(i);if(e>=n-r?(e=n-r,this.index+=1,this.offset=0):this.offset+=e,Wi(i))return{delete:e};if(jr(i))return{retain:e};if(qi(i))return{insert:i.insert.substr(r,e)}}else return{retain:e}}peek(){return this.ops[this.index]||{retain:1/0}}peekLength(){return this.ops[this.index]?am(this.ops[this.index])-this.offset:1/0}};function am(t){if(qi(t))return t.insert.length;if(jr(t))return t.retain;if(Wi(t))return t.delete}function qi(t){return typeof t.insert=="string"}function jr(t){return typeof t.retain=="number"}function Wi(t){return typeof t.delete=="number"}var Q6=be.define({combine(t){return wt(t,{})}}),_6=bi.define(),jJ=Ye.fromClass(class{constructor(t){let{collabClient:e}=t.state.facet(Q6);this.collabClient=e,this.deltaSubscription=e.onDelta((i,{remote:r})=>{if(r)return t.dispatch({changes:$w(i),selection:os(t.state.selection,i),annotations:[Et.addToHistory.of(!1),Et.remote.of(!0),_6.of(!0)],filter:!1})})}update(t){if(!t.transactions.some(i=>i.annotation(_6))){if(t.docChanged){let i=qJ(t.changes),r=P6(t);this.collabClient.handleClientDelta(i,r)}else if(t.focusChanged||!t.state.selection.eq(t.startState.selection)){let i=P6(t);this.collabClient.handleClientSelection(i)}}}destroy(){this.deltaSubscription.destroy()}});function $w(t){let e=[],i=0;for(let r of t.ops)jr(r)&&(i+=r.retain),qi(r)&&e.push({from:i,to:i,insert:r.insert}),Wi(r)&&(e.push({from:i,to:i+r.delete}),i+=r.delete);return e}function qJ(t){let e=[];return t.iterChanges((i,r,n,o,s)=>{let a=new Jn;i&&a.retain(i),i!==r&&a.delete(r-i);let l=s.toString();l&&a.insert(l),e.push(a)}),e.reverse().reduce((i,r)=>i.compose(r))}function P6(t){return t.view.hasFocus?t.state.selection:null}function os(t,e){let i=t.ranges.map(r=>J.range(e.transformPosition(r.anchor),e.transformPosition(r.head)));return J.create(i,t.mainIndex)}function A6(t){return[jJ,Q6.of({collabClient:t})]}var WJ=de.baseTheme({".cm-peerCursor":{position:"relative",display:"inline",zIndex:"1"},".cm-peerCursorCaret":{position:"absolute",left:"0",top:"0",bottom:"0",height:"100%",width:"2px"},".cm-peerCursorLabel":{position:"absolute",left:"0",top:"0",transform:"translateY(-100%)",whiteSpace:"nowrap",padding:"1px 8px",fontSize:"12px",color:"#f8fafc",visibility:"hidden",transitionProperty:"visibility",transitionDuration:"0s",transitionDelay:"1.5s"},".cm-peerCursor .cm-peerCursorLabel:hover":{visibility:"visible"},".cm-peerCursor .cm-peerCursorCaret:hover + .cm-peerCursorLabel":{visibility:"visible",transitionDelay:"0s"},".cm-peerCursor.cm-peerCursor-inline .cm-peerCursorLabel":{marginLeft:"4px",transform:"none"}}),X6=be.define({combine(t){return wt(t,{})}}),BJ=Ye.fromClass(class{constructor(t){let{collabClient:e}=t.state.facet(X6);this.peers=e.getPeers(),this.decorations=nt.of(Object.values(this.peers).flatMap($6),!0),this.peersSubscription=e.onPeersChange(i=>{let r=this.peers;if(r===i)return;let n=new Set,o=[];for(let s in i){let a=i[s],l=r[s];l&&a.eq(l)?n.add(s):o.push(a)}this.decorations=this.decorations.update({filter:(s,a,l)=>n.has(l.spec.id),add:o.flatMap($6),sort:!0}),this.peers=i,setTimeout(()=>{t.update([])},0)})}destroy(){this.peersSubscription.destroy()}},{decorations:t=>t.decorations}),Xw=class extends Ft{constructor(e,i,r){super(),this.cursorPos=e,this.color=i,this.label=r}toDOM(e){let i=document.createElement("div");i.classList.add("cm-peerCursor"),e.state.doc.lineAt(this.cursorPos).number===1&&i.classList.add("cm-peerCursor-inline");let n=document.createElement("div");n.classList.add("cm-peerCursorCaret"),n.style.backgroundColor=this.color;let o=document.createElement("div");return o.classList.add("cm-peerCursorLabel"),o.textContent=this.label,o.style.backgroundColor=this.color,i.appendChild(n),i.appendChild(o),i}eq(e){return e.cursorPos===this.cursorPos&&e.color===this.color&&e.label===this.label}};function $6(t){let{id:e,selection:i,meta:{hex_color:r,name:n}}=t;if(!i)return[];let o=we.mark({class:"cm-peerSelection",attributes:{style:`background-color: ${r}30`},id:e}),s=i.ranges.filter(l=>!l.empty).map(({from:l,to:c})=>o.range(l,c)),a=i.ranges.map(l=>{let c=l.head;return we.widget({widget:new Xw(c,r,n),id:e}).range(c)});return s.concat(a)}function R6(t){return[BJ,X6.of({collabClient:t}),WJ]}var ZJ=de.baseTheme({".cm-doctestDetails":{paddingTop:"4px",paddingBottom:"4px",paddingLeft:"6px"},".cm-doctestDetailsContent":{whiteSpace:"pre-wrap",border:"1px solid #424857",paddingTop:"6px",paddingBottom:"6px",marginLeft:"-8px",paddingLeft:"8px",borderRadius:"4px",marginRight:"16px"},"&light .cm-doctestDetailsContent":{borderColor:"#b6b7b9"},".cm-doctestStatus":{position:"relative"},".cm-doctestStatus::before":{borderRadius:"2px",width:"10px",height:"10px",display:"block",content:"''",position:"absolute",top:"50%",left:"0",transform:"translate(calc(-100% - 6px), -50%)"},".cm-doctestStatus-running::before":{backgroundColor:"#91a4b7"},".cm-doctestStatus-success::before":{backgroundColor:"#4ade80"},".cm-doctestStatus-failed::before":{backgroundColor:"#e97579"}}),I6=Se.define(),L6=Se.define(),D6=Fe.define({create(t){return we.none},update(t,e){t=t.map(e.changes);for(let i of e.effects){if(i.is(I6)){let r=i.value;t=t.update({filter:(n,o,s)=>!r.some(a=>s.spec.report.line===a.line),add:r.flatMap(n=>VJ(n,e.state.doc)),sort:!0})}i.is(L6)&&(t=we.none)}return t},provide(t){return de.decorations.from(t)}});function VJ(t,e){let i=e.line(t.line).from+t.column,r=[we.mark({class:`cm-doctestStatus cm-doctestStatus-${t.status}`,report:t}).range(i,i+1)];if(t.status==="failed"){let n=e.line(t.end_line+1);r.push(we.widget({widget:new Rw(t),block:!0,report:t}).range(n.from))}return r}var Rw=class extends Ft{constructor(e){super(),this.report=e}toDOM(e){let i=document.createElement("div");i.classList.add("cm-doctestDetails");let r=document.createElement("div");return r.classList.add("cm-doctestDetailsContent"),r.classList.add("editor-theme-aware-ansi"),i.style.marginLeft=`${this.report.column}ch`,r.innerHTML=this.report.details,i.appendChild(r),i}eq(e){return this.report===e.report}};function N6(t,e){let i=[I6.of(e)];t.dispatch({effects:U6(t.state,i)})}function M6(t){let e=[L6.of(null)];t.dispatch({effects:U6(t.state,e)})}var YJ=[D6,ZJ];function U6(t,e){return t.field(D6,!1)?e:e.concat(Se.appendConfig.of(YJ))}var FJ=de.baseTheme({".cm-signatureHint":{display:"flex"},".cm-signatureHintStepper":{padding:"4px 8px",borderRight:"1px solid black"},".cm-signatureHintContent":{padding:"4px"},".cm-signatureHintActiveArgument":{color:"gray"}}),Qf=be.define({combine(t){return wt(t,{})}}),q6=be.define({}).from(Qf,({triggerCharacters:t,retriggerCharacters:e})=>({triggerCharacters:new Set(t),retriggerCharacters:new Set(t.concat(e))})),W6=Se.define(),B6=Se.define(),Dw=Se.define(),Z6=Se.define(),qr=Fe.define({create(){return{context:null,hint:null}},update({context:t,hint:e},i){e=e&&e.setPosition(i.state.selection.main.head),HJ(i,!!e)&&(t=z6(i.state));for(let n of i.effects)n.is(W6)&&(n.value.signatureResult?e=Iw.build(i.state,n.value.signatureResult):(t=null,e=null)),n.is(B6)&&(t=z6(i.state)),n.is(Dw)&&(t=null,e=null),n.is(Z6)&&(e=e&&e.setSelected(n.value));return{context:t,hint:e}},provide(t){return Bn.from(t,e=>e.hint&&e.hint.tooltip)}});function HJ(t,e){let{activateOnTyping:i}=t.state.facet(Qf),{triggerCharacters:r,retriggerCharacters:n}=t.state.facet(q6),o=t.startState.selection.main.head,s=t.state.selection.main.head,a=t.isUserEvent("input");if(t.docChanged){let l=!1;return t.changes.iterChangedRanges((c,u,f,d)=>{if(!l){if(cnew Lw(r)})}setSelected(e){return new t(this.signatureResult,e,this.tooltip)}setPosition(e){return e===this.tooltip.pos?this:new t(this.signatureResult,this.selectedIdx,Ce(H({},this.tooltip),{pos:e}))}},Lw=class{constructor(e){this.view=e;let{signatureResult:i}=e.state.field(qr).hint;this.dom=document.createElement("div"),this.dom.classList.add("cm-signatureHint"),i.items.length>1&&(this.stepper=document.createElement("div"),this.stepper.classList.add("cm-signatureHintStepper"),this.dom.appendChild(this.stepper));let r=document.createElement("div");r.classList.add("cm-signatureHintContent"),this.contentLeft=document.createElement("span"),this.contentActive=document.createElement("span"),this.contentActive.classList.add("cm-signatureHintActiveArgument"),this.contentRight=document.createElement("span"),r.appendChild(this.contentLeft),r.appendChild(this.contentActive),r.appendChild(this.contentRight),this.dom.appendChild(r)}mount(){this.updateSelected()}update(e){let i=e.startState.field(qr),r=e.state.field(qr);i!==r&&this.updateSelected()}updateSelected(){let{signatureResult:e,selectedIdx:i}=this.view.state.field(qr).hint,{activeArgumentIdx:r,items:n}=e,o=n[i],s=o.arguments[r];this.stepper&&(this.stepper.textContent=`${i+1}/${n.length}`);let a=o.signature.indexOf(s);this.contentLeft.textContent=o.signature.slice(0,a),this.contentActive.textContent=s,this.contentRight.textContent=o.signature.slice(a+s.length)}},GJ=Ye.fromClass(class{constructor(t){this.view=t,this.query=null}update(t){let e=t.state.field(qr);e.context!==t.startState.field(qr).context&&(this.maybeAbortQuery(),e.context&&this.requestSignature(t.state))}destroy(){this.maybeAbortQuery()}requestSignature(t){let{context:e}=t.field(qr),{source:i}=t.facet(Qf),r={aborted:!1};i(e).then(n=>{r.aborted||this.view.dispatch({effects:W6.of({signatureResult:n})})}),this.query=r}maybeAbortQuery(){this.query&&(this.query.aborted=!0,this.query=null)}},{eventHandlers:{blur(t){let e=this.view.state.field(qr,!1);e&&e.hint&&this.view.state.facet(Qf).closeOnBlur&&setTimeout(()=>{this.view.dispatch({effects:[Dw.of(null)]})},0)}}});function KJ(t){return t.dispatch({effects:[B6.of(null)]}),!0}function JJ(t){let e=t.state.field(qr,!1);return!e||!e.hint?!1:(t.dispatch({effects:[Dw.of(null)]}),!0)}var j6=t=>e=>{let i=e.state.field(qr,!1);if(!i||!i.hint)return!1;let{signatureResult:r,selectedIdx:n}=i.hint;if(r.items.length===1)return!1;let o=r.items.length,s=n+(t?1:-1);return s<0&&(s+=o),s>=o&&(s-=o),e.dispatch({effects:[Z6.of(s)]}),!0},eee=[{key:"Mod-Shift-Space",run:KJ},{key:"Escape",run:JJ},{key:"ArrowDown",run:j6(!0)},{key:"ArrowUp",run:j6(!1)}];function V6(t,{activateOnTyping:e=!0,closeOnBlur:i=!0,triggerCharacters:r=["(",","],retriggerCharacters:n=[")"]}={}){return[qr,GJ,Qf.of({source:t,activateOnTyping:e,closeOnBlur:i,triggerCharacters:r,retriggerCharacters:n}),q6,Qt.high(Wt.of(eee)),FJ]}var Y6=be.define({combine(t){return wt(t,{})}}),F6=Se.define(),cm=Fe.define({create(){return{doc:null}},update({doc:t},e){e.docChanged&&(t=null);for(let i of e.effects)i.is(F6)&&(t=e.state.doc);return{doc:t}}}),tee=Ye.fromClass(class{constructor(t){this.view=t,this.query=null}update(t){let e=t.state.field(cm);e.doc!==t.startState.field(cm).doc&&(this.maybeAbortQuery(),e.doc&&this.requestFormatterChanges(t.state))}destroy(){this.maybeAbortQuery()}requestFormatterChanges(t){let{doc:e}=t.field(cm),{source:i}=t.facet(Y6),r={aborted:!1};i(e).then(n=>{!r.aborted&&n&&this.view.dispatch({changes:n})}),this.query=r}maybeAbortQuery(){this.query&&(this.query.aborted=!0,this.query=null)}});function iee(t){return t.state.readOnly?!1:(t.dispatch({effects:[F6.of(null)]}),!0)}var ree=[{key:"Ctrl-Shift-i",mac:"Alt-Shift-f",win:"Alt-Shift-f",run:iee}];function H6(t){return[cm,tee,Y6.of({source:t}),Wt.of(ree)]}function G6(t,e){let i=e;for(;!t.endsWith(i);)i=i.slice(0,-1);return i.length}var nee=de.baseTheme({".cm-readOnlyHint":{padding:"4px"}}),K6=Se.define(),Nw=Se.define(),um=Fe.define({create(){return{tooltip:null}},update({tooltip:t},e){e.state.selection.eq(e.startState.selection)||(t=null);for(let i of e.effects)i.is(K6)&&(t={pos:e.state.selection.main.head,above:!0,create:oee}),i.is(Nw)&&(t=null);return{tooltip:t}},provide(t){return Bn.from(t,e=>e.tooltip)}});function oee(t){let e=document.createElement("div");return e.classList.add("cm-readOnlyHint"),e.textContent="This editor is read-only",{dom:e}}var see=Ye.fromClass(class{constructor(t){this.view=t}},{eventHandlers:{input(t){this.view.state.readOnly&&(this.view.state.field(um).tooltip||this.view.dispatch({effects:K6.of(null)}))},blur(t){this.view.state.readOnly&&this.view.state.field(um).tooltip&&setTimeout(()=>{this.view.dispatch({effects:[Nw.of(null)]})},0)}}});function aee(t){let e=t.state.field(um,!1);return!e||!e.tooltip?!1:(t.dispatch({effects:[Nw.of(null)]}),!0)}var lee=[{key:"Escape",run:aee}];function J6(){return[um,see,Wt.of(lee),nee]}var cee=5e3,Af=class{constructor(e,i){bt(this,"_onDelta",new Gt);bt(this,"onDelta",this._onDelta.event);bt(this,"_onPeersChange",new Gt);bt(this,"onPeersChange",this._onPeersChange.event);this.connection=e,this.revision=i,this.clientId=e.getClientId(),this.peers={},this.updatePeers(e.getClients()),this.inflightDelta=null,this.bufferDelta=null,this.selection=null,this.selectionChanged=!1,this.revisionReportTimeoutId=null,this.subscriptions=[e.onDelta(this.handleServerDelta.bind(this)),e.onAcknowledgement(this.handleServerAcknowledgement.bind(this)),e.onSelection(this.handleServerSelection.bind(this)),e.onClientsUpdate(this.handleServerClientsUpdate.bind(this))]}destroy(){this.subscriptions.forEach(e=>e.destroy())}getPeers(){return this.peers}handleClientDelta(e,i){this.peers=eR(this.peers,e),this.selection=i,this.inflightDelta?this.bufferDelta?this.bufferDelta=this.bufferDelta.compose(e):this.bufferDelta=e:(this.inflightDelta=e,this.sendDelta()),this._onDelta.dispatch(e,{remote:!1}),this._onPeersChange.dispatch(this.peers)}handleClientSelection(e){this.selection=e,this.inflightDelta?this.selectionChanged=!0:this.sendSelection()}handleServerDelta(e,i,r){this.revision++;let{inflightDelta:n,bufferDelta:o}=this;n&&([e,n]=[n.transform(e,"right"),e.transform(n,"left")],i=i&&os(i,n)),o&&([e,o]=[o.transform(e,"right"),e.transform(o,"left")],i=i&&os(i,o)),this.inflightDelta=n,this.bufferDelta=o,this.selection=this.selection&&os(this.selection,e);let[s,a]=CO(this.peers,r);a=eR(a,e),s&&(a[r]=new Il(s.id,s.meta,i)),this.peers=a,this._onDelta.dispatch(e,{remote:!0}),this._onPeersChange.dispatch(this.peers),this.maybeScheduleRevisionReport()}handleServerAcknowledgement(){this.revision++,this.inflightDelta=null,this.bufferDelta&&(this.inflightDelta=this.bufferDelta,this.bufferDelta=null,this.sendDelta())}handleServerSelection(e,i){if(!this.peers.hasOwnProperty(i))return;let{inflightDelta:r,bufferDelta:n}=this;r&&(e=e&&os(e,r)),n&&(e=e&&os(e,n));let o=this.peers[i];this.peers=Ce(H({},this.peers),{[i]:new Il(o.id,o.meta,e)}),this._onPeersChange.dispatch(this.peers)}handleServerClientsUpdate(e){this.updatePeers(e),this._onPeersChange.dispatch(this.peers)}sendDelta(){this.connection.sendDelta(this.inflightDelta,this.selection,this.revision),this.selectionChanged=!1,this.maybeCancelRevisionReport()}sendSelection(){Object.keys(this.peers).length>0&&this.connection.sendSelection(this.selection,this.revision),this.selectionChanged=!1}sendRevision(){this.connection.sendRevision(this.revision)}updatePeers(e){let i={};for(let r in e)if(r!==this.clientId){let n=this.peers[r],o=e[r],s=n?n.selection:null;i[r]=new Il(r,o,s)}this.peers=i}maybeScheduleRevisionReport(){!this.inflightDelta&&!this.revisionReportTimeoutId&&(this.revisionReportTimeoutId=setTimeout(()=>{this.sendRevision(),this.revisionReportTimeoutId=null},cee))}maybeCancelRevisionReport(){this.revisionReportTimeoutId!==null&&(clearTimeout(this.revisionReportTimeoutId),this.revisionReportTimeoutId=null)}},Il=class{constructor(e,i,r){this.id=e,this.meta=i,this.selection=r}eq(e){return this.id===e.id&&this.meta===e.meta&&(this.selection===e.selection||this.selection&&e.selection&&this.selection.eq(e.selection))}};function eR(t,e){let i={};for(let r in t){let n=t[r],o=n.selection&&os(n.selection,e);i[r]=new Il(n.id,n.meta,o)}return i}function tR(t){let e=t.state.selection;return e.ranges.length>1?(t.dispatch({selection:e.asSingle()}),!0):!1}function Mw(t,e){for(;t;){if(e.includes(t.type.name))return t;t=t.parent}return null}function iR(t,e){let i=0;for(;it.selection.ranges.every(i=>i.empty)?{}:{class:"cm-selecting"});function rR(){return[uee]}var $f=class{constructor(e,i,r,n,o,s,a){bt(this,"_onMount",new Gt);bt(this,"onMount",this._onMount.event);bt(this,"_onChange",new Gt);bt(this,"onChange",this._onChange.event);bt(this,"_onBlur",new Gt);bt(this,"onBlur",this._onBlur.event);bt(this,"_onFocus",new Gt);bt(this,"onFocus",this._onFocus.event);this.container=e,this.source=r,this.language=o,this.intellisense=s,this.readOnly=a,this.initialWidgets={},this.connection=i,this.collabClient=new Af(i,n),this.deltaSubscription=this.collabClient.onDelta((l,c)=>{this.source=l.applyToString(this.source),this._onChange.dispatch(this.source)})}isMounted(){return!!this.view}mount(){if(this.isMounted())throw new Error("The editor is already mounted");this.mountEditor(),this.setInitialWidgets(),this._onMount.dispatch()}getSource(){return this.source}getElementAtCursor(){if(!this.isMounted())return this.container;let{node:e}=this.view.domAtPos(this.view.state.selection.main.head);return e instanceof Element?e:e.parentElement}focus(){this.isMounted()||this.mount(),this.view.focus()}blur(){this.isMounted()&&this.view.hasFocus&&this.view.contentDOM.blur()}destroy(){this.isMounted()&&this.view.destroy(),this.collabClient.destroy(),this.deltaSubscription.destroy()}updateDoctests(e){if(this.isMounted())N6(this.view,e);else{this.initialWidgets.doctestReportsByLine=this.initialWidgets.doctestReportsByLine||{};for(let i of e)this.initialWidgets.doctestReportsByLine[i.line]=i}}clearDoctests(){this.isMounted()?M6(this.view):delete this.initialWidgets.doctestReportsByLine}setCodeMarkers(e){if(this.isMounted()){let i=this.view.state.doc,r=e.map(n=>{let o=i.line(n.line),[,s,a]=o.text.match(/^(\s*).*?(\s*)$/),l=o.from+s.length,c=o.to-a.length;return{from:l,to:c,severity:n.severity,message:n.description}});this.view.dispatch(s6(this.view.state,r))}else this.initialWidgets.codeMarkers=e}mountEditor(){let e=kt.get(),i=c=>c.toString().padStart(3," "),r=c=>{let u=document.createElement("i");return u.classList.add(c?"ri-arrow-down-s-line":"ri-arrow-right-s-line",c?"cm-gutterFoldMarker-open":null),u},n=de.theme({"&":{fontSize:`${e.editor_font_size}px`}}),o=de.theme({"&":{fontVariantLigatures:`${e.editor_ligatures?"normal":"none"}`}}),s=this.language==="markdown"&&e.editor_markdown_word_wrap,a=this.language&&zt.matchLanguageName(mO,this.language,!1),l=[{key:"Escape",run:tR}];this.view=new de({parent:this.container,doc:this.source,extensions:[a_({formatNumber:i}),i_(),l_(),t_(),JX(),X_({markerDOM:r}),Np({placeholderText:"\u22EF"}),HC(),e_(),r_(),rR(),n_(),rt.allowMultipleSelections.of(!0),N_(),rP(),S_(),mX(),rt.readOnly.of(this.readOnly),J6(),Wt.of(d6),Wt.of(l),rt.tabSize.of(2),rt.lineSeparator.of(` +`),s?de.lineWrapping:[],de.contentAttributes.of({tabIndex:-1}),n,e.editor_theme==="light"?Q$:P$,o,A6(this.collabClient),R6(this.collabClient),sx({activateOnTyping:e.editor_auto_completion,defaultKeymap:!1}),this.intellisense?[sx({override:[this.completionSource.bind(this)]}),Ep(this.docsHoverTooltipSource.bind(this)),V6(this.signatureSource.bind(this),{activateOnTyping:e.editor_auto_signature}),H6(this.formatterSource.bind(this))]:[],e.editor_mode==="vim"?[T6()]:[],e.editor_mode==="emacs"?[C6()]:[],a?a.support:[],de.domEventHandlers({keydown:this.handleEditorKeydown.bind(this),blur:this.handleEditorBlur.bind(this),focus:this.handleEditorFocus.bind(this)})]})}handleEditorKeydown(e){return e.key==="Escape"&&this.container.dispatchEvent(new CustomEvent("lb:editor_escape",{bubbles:!0})),!1}handleEditorBlur(e){return this.container.contains(e.relatedTarget)||this._onBlur.dispatch(),!1}handleEditorFocus(e){return this._onFocus.dispatch(),!1}completionSource(e){let i=kt.get();if(!e.matchBefore(/[\w?!.]$/)&&!e.explicit)return null;let n=this.getCompletionHint(e);return this.connection.intellisenseRequest("completion",{hint:n,editor_auto_completion:i.editor_auto_completion}).then(o=>{if(o.items.length===0)return null;let s=o.items.map((l,c)=>{let u=this.completionItemToCompletions(l);return Ce(H({},u),{boost:1-c/o.items.length})}),a=G6(n,o.items[0].insert_text);return{from:e.pos-a,options:s,validFor:/^\w*[!?]?$/}}).catch(()=>null)}getCompletionHint(e){let r=ze(e.state).resolve(e.pos);if(r&&this.language==="elixir"){let n=Mw(r,["Map","Bitstring"]);if(n)return e.state.doc.sliceString(n.from,e.pos)}return e.matchBefore(/^.*/).text}completionItemToCompletions(e){let i={label:e.label,type:e.kind,info:n=>e.documentation===null?null:J$(350).then(()=>{let o=document.createElement("div");return o.classList.add("cm-completionInfoDocs"),o.classList.add("cm-markdown"),new Gs(o,e.documentation,{defaultCodeLanguage:this.language}),o})},r=e.insert_text.includes("${}")?e.insert_text:e.insert_text+"${}";return ci(r,i)}docsHoverTooltipSource(e,i,r){let n=e.state.doc.lineAt(i),o=n.to-n.from,s=n.text,a=i-n.from+(r===1?1:0);return a<1||a>o?null:this.connection.intellisenseRequest("details",{line:s,column:a}).then(l=>({pos:n.from+l.range.from-1,end:n.from+l.range.to-1,above:!0,create:c=>{let u=document.createElement("div");u.classList.add("cm-hoverDocs");for(let f of l.contents){let d=document.createElement("div");d.classList.add("cm-hoverDocsContent"),d.classList.add("cm-markdown"),u.appendChild(d),new Gs(d,f,{defaultCodeLanguage:this.language})}return{dom:u}}})).catch(()=>null)}signatureSource({state:e,pos:i}){let r=this.getSignatureHint(e,i);return this.connection.intellisenseRequest("signature",{hint:r}).then(n=>({activeArgumentIdx:n.active_argument,items:n.items})).catch(()=>null)}getSignatureHint(e,i){let n=ze(e).resolve(i);if(n&&this.language==="elixir"){let o=Mw(n,["Call","FunctionDefinitionCall","KernelCall"]);if(o){let a=iR(o,["Right","PipeOperator"])||o;return e.doc.sliceString(a.from,i)}}return e.doc.sliceString(0,i)}formatterSource(e){return this.connection.intellisenseRequest("format",{code:e.toString()}).then(i=>{if(this.setCodeMarkers(i.code_markers),i.delta){let r=Jn.fromCompressed(i.delta);return $w(r)}else return null}).catch(()=>null)}setInitialWidgets(){if(this.initialWidgets.doctestReportsByLine){let e=Object.values(this.initialWidgets.doctestReportsByLine);this.updateDoctests(e)}this.initialWidgets.codeMarkers&&this.setCodeMarkers(this.initialWidgets.codeMarkers),this.initialWidgets={}}};var Xf={},Ll=class t{constructor(e){this.id=e,this.pubsub=new xl,this.map={}}static create(e){let i=new t(e);return Xf[e]=i,i}static getStore(e){if(!Xf.hasOwnProperty(e))throw new Error(`No store found for id "${e}"`);return Xf[e]}destroy(){Xf[this.id]===this&&delete Xf[this.id]}set(e,i){this.map[e]=i,this.pubsub.broadcast(e,i)}get(e){if(!this.map.hasOwnProperty(e))throw new Error(`Key "${e}" not found in the store`);return this.map[e]}watch(e,i){return this.pubsub.subscribe(e,i)}};var Rf=class{constructor(e,i,r){bt(this,"_onDelta",new Gt);bt(this,"onDelta",this._onDelta.event);bt(this,"_onAcknowledgement",new Gt);bt(this,"onAcknowledgement",this._onAcknowledgement.event);bt(this,"_onSelection",new Gt);bt(this,"onSelection",this._onSelection.event);bt(this,"_onClientsUpdate",new Gt);bt(this,"onClientsUpdate",this._onClientsUpdate.event);this.hook=e,this.cellId=i,this.tag=r,this.sessionStore=Ll.getStore("session"),this.handlerByRef={},this.setupCollaborationHandlers(),this.clientsSubscription=this.sessionStore.watch("clients",n=>{this._onClientsUpdate.dispatch(n)}),this.setupIntellisenseHandlers()}destroy(){this.clientsSubscription.destroy()}getClients(){return this.sessionStore.get("clients")}getClientId(){return this.sessionStore.get("clientId")}sendDelta(e,i,r){this.hook.pushEvent("apply_cell_delta",{cell_id:this.cellId,tag:this.tag,delta:e.toCompressed(),selection:i&&nR(i),revision:r})}sendSelection(e,i){this.hook.pushEvent("report_cell_selection",{cell_id:this.cellId,tag:this.tag,selection:e&&nR(e),revision:i})}sendRevision(e){this.hook.pushEvent("report_cell_revision",{cell_id:this.cellId,tag:this.tag,revision:e})}setupCollaborationHandlers(){this.hook.handleEvent(`cell_delta:${this.cellId}:${this.tag}`,({delta:e,selection:i,client_id:r})=>{e=Jn.fromCompressed(e),i=i&&oR(i),this._onDelta.dispatch(e,i,r)}),this.hook.handleEvent(`cell_acknowledgement:${this.cellId}:${this.tag}`,()=>{this._onAcknowledgement.dispatch()}),this.hook.handleEvent(`cell_selection:${this.cellId}:${this.tag}`,({selection:e,client_id:i})=>{e=e&&oR(e),this._onSelection.dispatch(e,i)})}setupIntellisenseHandlers(){this.hook.handleEvent("intellisense_response",({ref:e,response:i})=>{let r=this.handlerByRef[e];r&&(r(i),delete this.handlerByRef[e])})}intellisenseRequest(e,i){return new Promise((r,n)=>{this.hook.pushEvent("intellisense_request",H({cell_id:this.cellId,type:e},i),({ref:o})=>{o?this.handlerByRef[o]=s=>{s?r(s):n(new fm("No relevant intellisense response for the given parameters"))}:n(new fm("Intellisense request could not be completed"))})})}};function nR(t){return t.ranges.map(({anchor:e,head:i})=>[e,i])}function oR(t){let e=t.map(([i,r])=>J.range(i,r));return J.create(e)}var fm=class extends Error{constructor(e){super(e),this.name="IntellisenseError"}};var fee={mounted(){this.props=this.getProps(),this.handleEvent(`cell_editor_init:${this.props.cellId}:${this.props.tag}`,({source:t,revision:e,doctest_reports:i,code_markers:r})=>{let n=this.el.querySelector("[data-el-editor-container]"),o=document.createElement("div");n.appendChild(o),this.connection=new Rf(this,this.props.cellId,this.props.tag),this.liveEditor=new $f(o,this.connection,t,e,this.props.language,this.props.intellisense,this.props.readOnly),this.liveEditor.setCodeMarkers(r),this.liveEditor.updateDoctests(i);let s=n.querySelector("[data-el-skeleton]"),a=document.createElement("div");a.classList.add("whitespace-pre","overflow-x-auto","text-editor","font-editor","px-12"),a.textContent=t,s.replaceChildren(a),this.liveEditor.onMount(()=>{s.remove()}),this.el.dispatchEvent(new CustomEvent("lb:cell:editor_created",{detail:{tag:this.props.tag,liveEditor:this.liveEditor},bubbles:!0})),this.visibility=kO(this.el,{root:document.querySelector("[data-el-notebook]"),proximity:2e3}),this.visibility.promise.then(()=>{this.liveEditor.isMounted()||this.liveEditor.mount()})})},disconnected(){this.el.removeAttribute("id")},destroyed(){this.connection&&this.connection.destroy(),this.liveEditor&&(this.el.dispatchEvent(new CustomEvent("lb:cell:editor_removed",{detail:{tag:this.props.tag},bubbles:!0})),this.liveEditor.destroy()),this.visibility&&this.visibility.cancel()},getProps(){return ht(this.el,["cell-id","tag","language","intellisense","read-only"])}},sR=fee;var Uw="data-js-dragging",hee={mounted(){this.el.addEventListener("dragenter",t=>{this.el.setAttribute(Uw,"")}),this.el.addEventListener("dragleave",t=>{this.el.contains(t.relatedTarget)||this.el.removeAttribute(Uw)}),this.el.addEventListener("drop",t=>{this.el.removeAttribute(Uw)})}},aR=hee;var dee={mounted(){let t=kt.get(),e=this.el.querySelector('[name="editor_auto_completion"][value="true"]'),i=this.el.querySelector('[name="editor_auto_signature"][value="true"]'),r=this.el.querySelector('[name="editor_font_size"][value="true"]'),n=this.el.querySelector('[name="editor_ligatures"][value="true"]'),o=this.el.querySelector('[name="editor_light_theme"][value="true"]'),s=this.el.querySelector('[name="editor_markdown_word_wrap"][value="true"]'),a=this.el.querySelector('select[name="editor_mode"]');e.checked=t.editor_auto_completion,i.checked=t.editor_auto_signature,r.checked=t.editor_font_size===of.large,n.checked=t.editor_ligatures,o.checked=t.editor_theme===yl.light,s.checked=t.editor_markdown_word_wrap,a.value=t.editor_mode,e.addEventListener("change",l=>{kt.update({editor_auto_completion:l.target.checked})}),i.addEventListener("change",l=>{kt.update({editor_auto_signature:l.target.checked})}),r.addEventListener("change",l=>{kt.update({editor_font_size:l.target.checked?of.large:of.normal})}),n.addEventListener("change",l=>{kt.update({editor_ligatures:l.target.checked})}),o.addEventListener("change",l=>{kt.update({editor_theme:l.target.checked?yl.light:yl.default})}),s.addEventListener("change",l=>{kt.update({editor_markdown_word_wrap:l.target.checked})}),a.addEventListener("change",l=>{kt.update({editor_mode:l.target.value})})}},lR=dee;var E2=(t,e,i)=>{if(!e.has(t))throw TypeError("Cannot "+i)},to=(t,e,i)=>(E2(t,e,"read from private field"),i?i.call(t):e.get(t)),eo=(t,e,i)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,i)},Vw=(t,e,i,r)=>(E2(t,e,"write to private field"),r?r.call(t,i):e.set(t,i),i),Wr=(t,e,i)=>(E2(t,e,"access private method"),i),pee="14.0";function Oee(t,e,i){let r=`https://cdn.jsdelivr.net/npm/emojibase-data@${e}/${t}`;return typeof i=="function"?r=i(t,e):typeof i=="string"&&(r=`${i}/${t}`),r}async function C2(t,e={}){let d=e,{local:i=!1,version:r="latest",cdnUrl:n}=d,o=hi(d,["local","version","cdnUrl"]),s=Oee(t,r,n),a=i?localStorage:sessionStorage,l=`emojibase/${r}/${t}`,c=a.getItem(l);if(c)return Promise.resolve(JSON.parse(c));let u=await fetch(s,H({credentials:"omit",mode:"cors",redirect:"error"},o));if(!u.ok)throw new Error("Failed to load Emojibase dataset.");let f=await u.json();try{a.setItem(l,JSON.stringify(f))}catch(p){}return f}var mee={discord:"joypixels",slack:"iamcal"};async function cR(t,e,i){var r;return C2(`${t}/shortcodes/${(r=mee[e])!==null&&r!==void 0?r:e}.json`,i)}function Nf(t,e){if(e.length===0)return t;let i=new Set(t.shortcodes);return e.forEach(r=>{let n=r[t.hexcode];Array.isArray(n)?n.forEach(o=>i.add(o)):n&&i.add(n)}),t.shortcodes=[...i],t.skins&&t.skins.forEach(r=>{Nf(r,e)}),t}function gee(t,e=[]){let i=[];return t.forEach(r=>{if(r.skins){let n=r,{skins:o}=n,s=hi(n,["skins"]);i.push(Nf(s,e)),o.forEach(a=>{let l=H({},a);s.tags&&(l.tags=[...s.tags]),i.push(Nf(l,e))})}else i.push(Nf(r,e))}),i}function bee(t,e){return e.length===0||t.forEach(i=>{Nf(i,e)}),t}async function bR(t,e={}){let l=e,{compact:i=!1,flat:r=!1,shortcodes:n=[]}=l,o=hi(l,["compact","flat","shortcodes"]),s=await C2(`${t}/${i?"compact":"data"}.json`,o),a=[];return n.length>0&&(a=await Promise.all(n.map(c=>{let u;if(c.includes("/")){let[f,d]=c.split("/");u=cR(f,d,o)}else u=cR(t,c,o);return u.catch(()=>({}))}))),r?gee(s,a):bee(s,a)}async function yR(t,e){return C2(`${t}/messages.json`,e)}function zw(t,e){let i=t.target.closest("[data-emoji]");if(i){let r=e.find(n=>n.emoji===i.dataset.emoji);if(r)return r}return null}function xR(t){var e;let i=(e=window.matchMedia)==null?void 0:e.call(window,"(prefers-reduced-motion: reduce)");return t.animate&&!(i!=null&&i.matches)}function uR(t,e){return t.toLowerCase().includes(e.toLowerCase())}function yee(t,e){let i=null;return()=>{i||(i=window.setTimeout(()=>{t(),i=null},e))}}function xee(t,e){let i=null;return(...r)=>{i&&window.clearTimeout(i),i=window.setTimeout(()=>{t(...r),i=null},e)}}function sa(t,e,i,r){if(xR(r)&&t.animate)return t.animate(e,i).finished;let n=i.direction==="normal"?1:0,o=Object.entries(e).reduce((s,[a,l])=>Ce(H({},s),{[a]:l[n]}),{});return Object.assign(t.style,o),Promise.resolve()}function Yw(t){var e;let i=document.createElement("template");return i.innerHTML=t,(e=i.content)==null?void 0:e.firstElementChild}async function vee(t){let e=new TextEncoder().encode(t),i=await crypto.subtle.digest("SHA-256",e);return Array.from(new Uint8Array(i)).map(r=>r.toString(16).padStart(2,"0")).join("")}function ui(...t){return t.reduce((e,i)=>Ce(H({},e),{[i]:_2(i)}),{})}function _2(t){return`picmo__${t}`}function Om(t){for(;t.firstChild;)t.removeChild(t.firstChild);return t}function Dl(t,...e){Om(t).append(...e)}function vR(t){try{return window[t].length,!0}catch(e){return!1}}function wee(){return vR("sessionStorage")}function kee(){return vR("localStorage")}function Uf(t){var e;return{emoji:t.emoji,label:t.label,tags:t.tags,skins:(e=t.skins)==null?void 0:e.map(i=>Uf(i)),order:t.order,custom:!1,hexcode:t.hexcode,version:t.version}}function wm(t,e,i){var r;return i&&!i.some(n=>n.order===t.group)?!1:uR(t.label,e)||((r=t.tags)==null?void 0:r.some(n=>uR(n,e)))}var km=class{constructor(e="en"){this.locale=e}},See=[(t,e)=>(t.hexcode==="1F91D"&&e<14&&(t.skins=[]),t),(t,e)=>(t.skins&&(t.skins=t.skins.filter(i=>!i.version||i.version<=e)),t)];function Tee(t,e){return See.some(i=>i(t,e)===null)?null:t}function Sm(t,e){return t.filter(i=>Tee(i,e)!==null)}var jw={};function wR(t){return jw[t]||(jw[t]=new Fw(t)),jw[t]}wR.deleteDatabase=t=>{};var Fw=class extends km{open(){return Promise.resolve()}delete(){return Promise.resolve()}close(){}isPopulated(){return Promise.resolve(!1)}getEmojiCount(){return Promise.resolve(this.emojis.length)}getEtags(){return Promise.resolve({foo:"bar"})}getHash(){return Promise.resolve("")}populate(e){return this.categories=e.groups,this.emojis=e.emojis,Promise.resolve()}getCategories(e){var i;let r=this.categories.filter(n=>n.key!=="component");if(e.showRecents&&r.unshift({key:"recents",order:-1}),(i=e.custom)!=null&&i.length&&r.push({key:"custom",order:10}),e.categories){let n=e.categories;r=r.filter(o=>n.includes(o.key)),r.sort((o,s)=>n.indexOf(o.key)-n.indexOf(s.key))}else r.sort((n,o)=>n.order-o.order);return Promise.resolve(r)}getEmojis(e,i){let r=this.emojis.filter(n=>n.group===e.order).filter(n=>n.version<=i).sort((n,o)=>n.order!=null&&o.order!=null?n.order-o.order:0).map(Uf);return Promise.resolve(Sm(r,i))}searchEmojis(e,i,r,n){let o=this.emojis.filter(l=>wm(l,e,n)&&l.version<=r).map(Uf),s=i.filter(l=>wm(l,e,n)),a=[...Sm(o,r),...s];return Promise.resolve(a)}setMeta(e){this.meta=e}};function Eee(t,e){let i=`https://cdn.jsdelivr.net/npm/emojibase-data@${t}/${e}`;return{emojisUrl:`${i}/data.json`,messagesUrl:`${i}/messages.json`}}async function fR(t){try{return(await fetch(t,{method:"HEAD"})).headers.get("etag")}catch(e){return null}}function Cee(t){let{emojisUrl:e,messagesUrl:i}=Eee("latest",t);try{return Promise.all([fR(e),fR(i)])}catch(r){return Promise.all([null,null])}}async function _ee(t,e,i){let r;try{r=await t.getEtags()}catch(s){r={}}let{storedEmojisEtag:n,storedMessagesEtag:o}=r;if(i!==o||e!==n){let[s,a]=await Promise.all([yR(t.locale),bR(t.locale)]);await t.populate({groups:s.groups,emojis:a,emojisEtag:e,messagesEtag:i})}}async function Pee(t,e){let i=await t.getHash();return e!==i}async function kR(t,e,i){let r=i||e(t);try{await r.open()}catch(n){console.warn("[picmo] IndexedDB not available, falling back to InMemoryStoreFactory"),r=wR(t)}return r}async function Qee(t,e,i){if(!wee()&&typeof window<"u")throw new Error("Session storage is required to use CDN emoji data.");let r=await kR(t,e,i),[n,o]=await Cee(t);if(await r.isPopulated())n&&o&&await _ee(r,n,o);else{let[s,a]=await Promise.all([yR(t),bR(t)]);await r.populate({groups:s.groups,emojis:a,emojisEtag:n,messagesEtag:o})}return r}async function Aee(t,e,i,r,n){let o=await kR(t,e,n),s=await vee(r);return(!await o.isPopulated()||await Pee(o,s))&&await o.populate({groups:i.groups,emojis:r,hash:s}),o}async function SR(t,e,i,r,n){return i&&r?Aee(t,e,i,r,n):Qee(t,e,n)}var zf=class{constructor(){this.handleKeyDown=this.handleKeyDown.bind(this)}activate(e){this.rootElement=e,this.rootElement.addEventListener("keydown",this.handleKeyDown)}deactivate(){var e;(e=this.rootElement)==null||e.removeEventListener("keydown",this.handleKeyDown)}get focusableElements(){return this.rootElement.querySelectorAll('input, [tabindex="0"]')}get lastFocusableElement(){return this.focusableElements[this.focusableElements.length-1]}get firstFocusableElement(){return this.focusableElements[0]}checkFocus(e,i,r){e.target===i&&(r.focus(),e.preventDefault())}handleKeyDown(e){e.key==="Tab"&&this.checkFocus(e,e.shiftKey?this.firstFocusableElement:this.lastFocusableElement,e.shiftKey?this.lastFocusableElement:this.firstFocusableElement)}},{light:$ee,dark:mke,auto:gke}=ui("light","dark","auto"),Me=class{constructor({template:e,classes:i,parent:r}){this.isDestroyed=!1,this.appEvents={},this.uiEvents=[],this.uiElements={},this.ui={},this.template=e,this.classes=i,this.parent=r,this.keyBindingHandler=this.keyBindingHandler.bind(this)}initialize(){this.bindAppEvents()}setCustomEmojis(e){this.customEmojis=e}setEvents(e){this.events=e}setPickerId(e){this.pickerId=e}emit(e,...i){this.events.emit(e,...i)}setI18n(e){this.i18n=e}setRenderer(e){this.renderer=e}setEmojiData(e){this.emojiDataPromise=e,e.then(i=>{this.emojiData=i})}updateEmojiData(e){this.emojiData=e,this.emojiDataPromise=Promise.resolve(e)}setOptions(e){this.options=e}renderSync(e={}){return this.el=this.template.renderSync(H({classes:this.classes,i18n:this.i18n,pickerId:this.pickerId},e)),this.postRender(),this.el}async render(e={}){return await this.emojiDataPromise,this.el=await this.template.renderAsync(H({classes:this.classes,i18n:this.i18n,pickerId:this.pickerId},e)),this.postRender(),this.el}postRender(){this.bindUIElements(),this.bindKeyBindings(),this.bindUIEvents(),this.scheduleShowAnimation()}bindAppEvents(){Object.keys(this.appEvents).forEach(e=>{this.events.on(e,this.appEvents[e],this)}),this.events.on("data:ready",this.updateEmojiData,this)}unbindAppEvents(){Object.keys(this.appEvents).forEach(e=>{this.events.off(e,this.appEvents[e])}),this.events.off("data:ready",this.updateEmojiData)}keyBindingHandler(e){let i=this.keyBindings[e.key];i&&i.call(this,e)}bindKeyBindings(){this.keyBindings&&this.el.addEventListener("keydown",this.keyBindingHandler)}unbindKeyBindings(){this.keyBindings&&this.el.removeEventListener("keydown",this.keyBindingHandler)}bindUIElements(){this.ui=Object.keys(this.uiElements).reduce((e,i)=>Ce(H({},e),{[i]:this.el.querySelector(this.uiElements[i])}),{})}bindUIEvents(){this.uiEvents.forEach(e=>{e.handler=e.handler.bind(this),(e.target?this.ui[e.target]:this.el).addEventListener(e.event,e.handler,e.options)})}unbindUIEvents(){this.uiEvents.forEach(e=>{(e.target?this.ui[e.target]:this.el).removeEventListener(e.event,e.handler)})}destroy(){this.unbindAppEvents(),this.unbindUIEvents(),this.unbindKeyBindings(),this.el.remove(),this.isDestroyed=!0}scheduleShowAnimation(){if(this.parent){let e=new MutationObserver(i=>{let[r]=i;r.type==="childList"&&r.addedNodes[0]===this.el&&(xR(this.options)&&this.animateShow&&this.animateShow(),e.disconnect)});e.observe(this.parent,{childList:!0})}}static childEvent(e,i,r,n={}){return{target:e,event:i,handler:r,options:n}}static uiEvent(e,i,r={}){return{event:e,handler:i,options:r}}static byClass(e){return`.${e}`}},Xee='',Ree='',Iee='',Lee='',Dee='',Nee='',Mee='',Uee='',zee=` @@ -301,8 +301,8 @@ ${n.message}`)))}function nK(){return import("./mermaid.core-3DX6XKRB.js") `}var Xte=new jt(t=>t.isLoaded?Ate(t):$te(t)),hm=ui("picker","skeleton","placeholder","searchSkeleton","searchInput","categoryTabsSkeleton","headerSkeleton","categoryTab","contentSkeleton","categoryName","emojiGrid","emoji","previewSkeleton","previewEmoji","previewName","tagList","tag","overlay","content","fullHeight","pluginContainer","header"),dm={emojisPerRow:"--emojis-per-row",visibleRows:"--row-count",emojiSize:"--emoji-size"},k2=class extends Me{constructor(){super({template:Xte,classes:hm}),this.pickerReady=!1,this.externalEvents=new c2,this.updaters={styleProperty:e=>i=>this.el.style.setProperty(dm[e],i.toString()),theme:e=>{let i=this.options.theme,r=this.el.closest(`.${i}`);this.el.classList.remove(i),r==null||r.classList.remove(i),this.el.classList.add(e),r==null||r.classList.add(e)},className:e=>{this.options.className&&this.el.classList.remove(this.options.className),this.el.classList.add(e)},emojisPerRow:this.updateStyleProperty.bind(this,"emojisPerRow"),emojiSize:this.updateStyleProperty.bind(this,"emojiSize"),visibleRows:this.updateStyleProperty.bind(this,"visibleRows")}}initialize(){this.uiElements={pickerContent:Me.byClass(hm.content),header:Me.byClass(hm.header)},this.uiEvents=[Me.uiEvent("keydown",this.handleKeyDown)],this.appEvents={error:this.onError,reinitialize:this.reinitialize,"data:ready":this.onDataReady,"content:show":this.showContent,"variantPopup:hide":this.hideVariantPopup,"emoji:select":this.selectEmoji},super.initialize(),this.options.recentsProvider}destroy(){var e,i;super.destroy(),(e=this.search)==null||e.destroy(),this.emojiArea.destroy(),(i=this.categoryTabs)==null||i.destroy(),this.events.removeAll(),this.externalEvents.removeAll()}clearRecents(){this.options.recentsProvider.clear()}addEventListener(e,i){this.externalEvents.on(e,i)}removeEventListener(e,i){this.externalEvents.off(e,i)}initializePickerView(){this.pickerReady&&(this.showContent(),this.emojiArea.reset(!1))}handleKeyDown(e){let i=e.ctrlKey||e.metaKey;e.key==="s"&&i&&this.search&&(e.preventDefault(),this.search.focus())}buildChildViews(){return this.options.showPreview&&(this.preview=this.viewFactory.create(b2)),this.options.showSearch&&(this.search=this.viewFactory.create(y2,{categories:this.categories,emojiVersion:this.emojiVersion})),this.options.showCategoryTabs&&(this.categoryTabs=this.viewFactory.create(w2,{categories:this.categories})),this.currentView=this.emojiArea=this.viewFactory.create(m2,{categoryTabs:this.categoryTabs,categories:this.categories,emojiVersion:this.emojiVersion}),[this.preview,this.search,this.emojiArea,this.categoryTabs]}setStyleProperties(){this.options.showSearch||this.el.style.setProperty("--search-height-full","0px"),this.options.showCategoryTabs||(this.el.style.setProperty("--category-tabs-height","0px"),this.el.style.setProperty("--category-tabs-offset","0px")),this.options.showPreview||this.el.style.setProperty("--emoji-preview-height-full","0px"),Object.keys(dm).forEach(e=>{this.options[e]&&this.el.style.setProperty(dm[e],this.options[e].toString())})}updateStyleProperty(e,i){this.el.style.setProperty(dm[e],i.toString())}reinitialize(){this.renderSync()}onError(e){let i=this.viewFactory.createWithOptions({data:!1},g2,{message:this.i18n.get("error.load")}),r=this.el.offsetHeight||375;throw this.el.style.height=`${r}px`,Dl(this.el,i.renderSync()),e}async onDataReady(e){let i=this.el;try{e?this.emojiData=e:await this.emojiDataPromise,this.options.emojiVersion==="auto"?this.emojiVersion=_te()||parseFloat(pee):this.emojiVersion=this.options.emojiVersion,this.categories=await this.emojiData.getCategories(this.options);let[r,n,o,s]=this.buildChildViews();await super.render({isLoaded:!0,search:n,categoryTabs:s,emojiArea:o,preview:r,showHeader:!!(this.search||this.categoryTabs),theme:this.options.theme,className:this.options.className}),this.el.style.setProperty("--category-count",this.categories.length.toString()),this.pickerReady=!0,i.replaceWith(this.el),this.setStyleProperties(),this.initializePickerView(),this.setInitialFocus(),this.externalEvents.emit("data:ready")}catch(r){this.events.emit("error",r)}}renderSync(){var e;let i=((e=this.options.categories)==null?void 0:e.length)||10;if(this.options.showRecents&&(i+=1),super.renderSync({isLoaded:!1,theme:this.options.theme,className:this.options.className,showSearch:this.options.showSearch,showPreview:this.options.showPreview,showCategoryTabs:this.options.showCategoryTabs,showHeader:this.options.showSearch||this.options.showCategoryTabs,emojiCount:this.options.emojisPerRow*this.options.visibleRows,categoryCount:i}),this.el.style.setProperty("--category-count",i.toString()),!this.options.rootElement)throw new Error("Picker must be given a root element via the rootElement option");return Dl(this.options.rootElement,this.el),this.setStyleProperties(),this.pickerReady&&this.initializePickerView(),this.el}getInitialFocusTarget(){if(typeof this.options.autoFocus<"u")switch(this.options.autoFocus){case"emojis":return this.emojiArea.focusableEmoji;case"search":return this.search;case"auto":return this.search||this.emojiArea.focusableEmoji;default:return null}if(this.options.autoFocusSearch===!0)return console.warn("options.autoFocusSearch is deprecated, please use options.focusTarget instead"),this.search}setInitialFocus(){var e;!this.pickerReady||(e=this.getInitialFocusTarget())==null||e.focus()}reset(e=!0){var i;this.pickerReady&&(this.emojiArea.reset(e),this.showContent(this.emojiArea)),(i=this.search)==null||i.clear(),this.hideVariantPopup()}showContent(e=this.emojiArea){var i,r;e!==this.currentView&&(this.currentView!==this.emojiArea&&((i=this.currentView)==null||i.destroy()),this.ui.pickerContent.classList.toggle(hm.fullHeight,e!==this.emojiArea),Dl(this.ui.pickerContent,e.el),this.currentView=e,e===this.emojiArea?(this.emojiArea.reset(),this.categoryTabs&&this.ui.header.appendChild(this.categoryTabs.el)):(r=this.categoryTabs)==null||r.el.remove())}hideVariantPopup(){var e;(e=this.variantPopup)==null||e.destroy()}isPickerClick(e){var i,r;let n=e.target,o=this.el.contains(n),s=(r=(i=this.variantPopup)==null?void 0:i.el)==null?void 0:r.contains(n);return o||s}async selectEmoji({emoji:e}){var i,r;(i=e.skins)!=null&&i.length&&this.options.showVariants&&!this.isVariantPopupOpen?this.showVariantPopup(e):(await((r=this.variantPopup)==null?void 0:r.animateHide()),this.events.emit("variantPopup:hide"),await this.emitEmoji(e))}get isVariantPopupOpen(){return this.variantPopup&&!this.variantPopup.isDestroyed}async showVariantPopup(e){let i=document.activeElement;this.events.once("variantPopup:hide",()=>{i==null||i.focus()}),this.variantPopup=this.viewFactory.create(x2,{emoji:e,parent:this.el}),this.el.appendChild(this.variantPopup.renderSync()),this.variantPopup.activate()}async emitEmoji(e){this.externalEvents.emit("emoji:select",await this.renderer.doEmit(e)),this.options.recentsProvider.addOrUpdateRecent(e,this.options.maxRecents),this.events.emit("recent:add",e)}updateOptions(e){Object.keys(e).forEach(i=>{this.updaters[i](e[i])}),Object.assign(this.options,e)}},S2=class{constructor({events:e,i18n:i,renderer:r,emojiData:n,options:o,customEmojis:s=[],pickerId:a}){this.events=e,this.i18n=i,this.renderer=r,this.emojiData=n,this.options=o,this.customEmojis=s,this.pickerId=a}setEmojiData(e){this.emojiData=Promise.resolve(e)}createWithOptions(e={},i,...r){let n=new i(...r);return n.setPickerId(this.pickerId),n.setEvents(this.events),n.setI18n(this.i18n),n.setRenderer(this.renderer),e.data!==!1&&n.setEmojiData(this.emojiData),n.setOptions(this.options),n.setCustomEmojis(this.customEmojis),n.viewFactory=this,n.initialize(),n}create(e,...i){return this.createWithOptions({},e,...i)}},vm,T2=class{constructor(e={}){eo(this,vm,void 0),Vw(this,vm,new Map(Object.entries(e)))}get(e,i=e){return to(this,vm).get(e)||i}};vm=new WeakMap;function Rte(t,e){e===void 0&&(e={});var i=e.insertAt;if(!(!t||typeof document>"u")){var r=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",i==="top"&&r.firstChild?r.insertBefore(n,r.firstChild):r.appendChild(n),n.styleSheet?n.styleSheet.cssText=t:n.appendChild(document.createTextNode(t))}}function Q2(){let t=!1;return function(e){nte.injectStyles&&!t&&(Rte(e),t=!0)}}var Ite=`.picmo__picker .picmo__icon{width:1.25em;height:1em;fill:currentColor}.picmo__icon-small{font-size:.8em}.picmo__icon-medium{font-size:1em}.picmo__icon-large{font-size:1.25em}.picmo__icon-2x{font-size:2em}.picmo__icon-3x{font-size:3em}.picmo__icon-4x{font-size:4em}.picmo__icon-5x{font-size:5em}.picmo__icon-8x{font-size:8em}.picmo__icon-10x{font-size:10em}.picmo__light,.picmo__auto{color-scheme:light;--accent-color: #4f46e5;--background-color: #f9fafb;--border-color: #cccccc;--category-name-background-color: #f9fafb;--category-name-button-color: #999999;--category-name-text-color: hsl(214, 30%, 50%);--category-tab-active-background-color: rgba(255, 255, 255, .6);--category-tab-active-color: var(--accent-color);--category-tab-color: #666;--category-tab-highlight-background-color: rgba(0, 0, 0, .15);--error-color-dark: hsl(0, 100%, 45%);--error-color: hsl(0, 100%, 40%);--focus-indicator-background-color: hsl(198, 65%, 85%);--focus-indicator-color: #333333;--hover-background-color: #c7d2fe;--placeholder-background-color: #cccccc;--search-background-color: #f9fafb;--search-focus-background-color: #ffffff;--search-icon-color: #999999;--search-placeholder-color: #71717a;--secondary-background-color: #e2e8f0;--secondary-text-color: #666666;--tag-background-color: rgba(162, 190, 245, .3);--text-color: #000000;--variant-popup-background-color: #ffffff}.picmo__dark{color-scheme:dark;--accent-color: #A580F9;--background-color: #333333;--border-color: #666666;--category-name-background-color: #333333;--category-name-button-color: #eeeeee;--category-name-text-color: #ffffff;--category-tab-active-background-color: #000000;--category-tab-active-color: var(--accent-color);--category-tab-color: #cccccc;--category-tab-highlight-background-color: #4A4A4A;--error-color-dark: hsl(0, 7%, 3%);--error-color: hsl(0, 30%, 60%);--focus-indicator-background-color: hsl(0, 0%, 50%);--focus-indicator-color: #999999;--hover-background-color: hsla(0, 0%, 40%, .85);--image-placeholder-color: #ffffff;--placeholder-background-color: #666666;--search-background-color: #71717a;--search-focus-background-color: #52525b;--search-icon-color: #cccccc;--search-placeholder-color: #d4d4d8;--secondary-background-color: #000000;--secondary-text-color: #999999;--tag-background-color: rgba(162, 190, 245, .3);--text-color: #ffffff;--variant-popup-background-color: #333333}@media (prefers-color-scheme: dark){.picmo__auto{color-scheme:dark;--accent-color: #A580F9;--background-color: #333333;--border-color: #666666;--category-name-background-color: #333333;--category-name-button-color: #eeeeee;--category-name-text-color: #ffffff;--category-tab-active-background-color: #000000;--category-tab-active-color: var(--accent-color);--category-tab-color: #cccccc;--category-tab-highlight-background-color: #4A4A4A;--error-color-dark: hsl(0, 7%, 3%);--error-color: hsl(0, 30%, 60%);--focus-indicator-background-color: hsl(0, 0%, 50%);--focus-indicator-color: #999999;--hover-background-color: hsla(0, 0%, 40%, .85);--image-placeholder-color: #ffffff;--placeholder-background-color: #666666;--search-background-color: #71717a;--search-focus-background-color: #52525b;--search-icon-color: #cccccc;--search-placeholder-color: #d4d4d8;--secondary-background-color: #000000;--secondary-text-color: #999999;--tag-background-color: rgba(162, 190, 245, .3);--text-color: #ffffff;--variant-popup-background-color: #333333}}.picmo__picker .picmo__categoryButtonsContainer{overflow:auto;padding:2px 0}.picmo__picker .picmo__categoryButtonsContainer.picmo__has-overflow-right{mask-image:linear-gradient(270deg,rgba(255,255,255,0) 0%,rgba(255,255,255,1) 10%);-webkit-mask-image:linear-gradient(270deg,rgba(255,255,255,0) 0%,rgba(255,255,255,1) 10%)}.picmo__picker .picmo__categoryButtonsContainer.picmo__has-overflow-left{mask-image:linear-gradient(90deg,rgba(255,255,255,0) 0%,rgba(255,255,255,1) 10%);-webkit-mask-image:linear-gradient(90deg,rgba(255,255,255,0) 0%,rgba(255,255,255,1) 10%)}.picmo__picker .picmo__categoryButtonsContainer.picmo__has-overflow-both{mask-image:linear-gradient(90deg,rgba(255,255,255,0) 0%,rgba(255,255,255,1) 10%,rgba(255,255,255,1) 90%,rgba(255,255,255,0) 100%);-webkit-mask-image:linear-gradient(90deg,rgba(255,255,255,0) 0%,rgba(255,255,255,1) 10%,rgba(255,255,255,1) 90%,rgba(255,255,255,0) 100%)}.picmo__picker .picmo__categoryButtons{display:flex;flex-direction:row;gap:var(--tab-gap);margin:0;padding:0 .5em;align-items:center;height:var(--category-tabs-height);box-sizing:border-box;width:100%;justify-content:space-between;position:relative;list-style-type:none;justify-self:center;max-width:min(23.55rem,calc(var(--category-count, 1) * 2.5rem))}.picmo__picker .picmo__categoryButtons .picmo__categoryTab{display:flex;align-items:center;transition:all .1s;width:2em}.picmo__picker .picmo__categoryButtons .picmo__categoryTab.picmo__categoryTabActive .picmo__categoryButton{color:var(--category-tab-active-color);background:linear-gradient(rgba(255,255,255,.75) 0%,rgba(255,255,255,.75) 100%),linear-gradient(var(--category-tab-active-color) 0%,var(--category-tab-active-color) 100%);border:2px solid var(--category-tab-active-color)}.picmo__picker .picmo__categoryButtons .picmo__categoryTab.picmo__categoryTabActive .picmo__categoryButton:hover{background-color:var(--category-tab-active-background-color)}.picmo__picker .picmo__categoryButtons .picmo__categoryTab button.picmo__categoryButton{border-radius:5px;background:transparent;border:2px solid transparent;color:var(--category-tab-color);cursor:pointer;padding:2px;vertical-align:middle;display:flex;align-items:center;justify-content:center;font-size:1.2rem;width:1.6em;height:1.6em;transition:all .1s}.picmo__picker .picmo__categoryButtons .picmo__categoryTab button.picmo__categoryButton:is(img){width:var(--category-tab-size);height:var(--category-tab-size)}.picmo__picker .picmo__categoryButtons .picmo__categoryTab button.picmo__categoryButton:hover{background:var(--category-tab-highlight-background-color)}.picmo__dataError [data-icon]{opacity:.8}@keyframes appear{0%{opacity:0}to{opacity:.8}}@keyframes appear-grow{0%{opacity:0;transform:scale(.8)}to{opacity:.8;transform:scale(1)}}.picmo__picker .picmo__error{display:flex;flex-direction:column;align-items:center;justify-content:center;height:100%;color:var(--secondary-text-color)}.picmo__picker .picmo__error .picmo__iconContainer{opacity:.8;animation:appear-grow .25s cubic-bezier(.175,.885,.32,1.275);--color-primary: var(--error-color);--color-secondary: var(--error-color-dark)}.picmo__picker .picmo__error .picmo__title{animation:appear .25s;animation-delay:50ms;animation-fill-mode:both}.picmo__picker .picmo__error button{padding:8px 16px;cursor:pointer;background:var(--background-color);border:1px solid var(--text-color);border-radius:5px;color:var(--text-color)}.picmo__picker .picmo__error button:hover{background:var(--text-color);color:var(--background-color)}.picmo__emojiButton{background:transparent;border:none;border-radius:15px;cursor:pointer;display:flex;font-family:var(--emoji-font);font-size:var(--emoji-size);height:100%;justify-content:center;align-items:center;margin:0;overflow:hidden;padding:0;width:100%}.picmo__emojiButton:hover{background:var(--hover-background-color)}.picmo__emojiButton:focus{border-radius:0;background:var(--focus-indicator-background-color);outline:1px solid var(--focus-indicator-color)}.picmo__picker .picmo__emojiArea{height:var(--emoji-area-height);overflow-y:auto;position:relative}.picmo__picker .picmo__emojiCategory{position:relative}.picmo__picker .picmo__emojiCategory .picmo__categoryName{font-size:.9em;padding:.5rem;margin:0;background:var(--category-name-background-color);color:var(--category-name-text-color);top:0;z-index:1;display:grid;gap:4px;grid-template-columns:auto 1fr auto;align-items:center;line-height:1;box-sizing:border-box;height:var(--category-name-height);justify-content:flex-start;text-transform:uppercase}.picmo__picker .picmo__emojiCategory .picmo__categoryName button{background:transparent;border:none;display:flex;align-items:center;cursor:pointer;color:var(--category-name-button-color)}.picmo__picker .picmo__emojiCategory .picmo__categoryName button:hover{opacity:1}.picmo__picker .picmo__emojiCategory .picmo__noRecents{color:var(--secondary-text-color);grid-column:1 / span var(--emojis-per-row);font-size:.9em;text-align:center;display:flex;align-items:center;justify-content:center;min-height:calc(var(--emoji-size) * var(--emoji-size-multiplier))}.picmo__picker .picmo__emojiCategory .picmo__recentEmojis[data-empty=true]{display:none}:is(.picmo__picker .picmo__emojiCategory) .picmo__recentEmojis[data-empty=false]+div{display:none}.picmo__picker .picmo__emojiContainer{display:grid;justify-content:space-between;gap:1px;padding:0 .5em;grid-template-columns:repeat(var(--emojis-per-row),calc(var(--emoji-size) * var(--emoji-size-multiplier)));grid-auto-rows:calc(var(--emoji-size) * var(--emoji-size-multiplier));align-items:center;justify-items:center}.picmo__picker.picmo__picker{--border-radius: 5px;--emoji-area-height: calc( (var(--row-count) * var(--emoji-size) * var(--emoji-size-multiplier)) + var(--category-name-height) );--content-height: var(--emoji-area-height);--emojis-per-row: 8;--row-count: 6;--emoji-preview-margin: 4px;--emoji-preview-height: calc(var(--emoji-preview-size) + 1em + 1px);--emoji-preview-height-full: calc(var(--emoji-preview-height) + var(--emoji-preview-margin));--emoji-preview-size: 2.75em;--emoji-size: 2rem;--emoji-size-multiplier: 1.3;--content-margin: 8px;--category-tabs-height:calc(1.5em + 9px);--category-tabs-offset: 8px;--category-tab-size: 1.2rem;--category-name-height: 2rem;--category-name-padding-y: 6px;--search-height: 2em;--search-margin: .5em;--search-margin-bottom: 4px;--search-height-full: calc(var(--search-height) + var(--search-margin) + var(--search-margin-bottom));--overlay-background-color: rgba(0, 0, 0, .8);--emoji-font: "Segoe UI Emoji", "Segoe UI Symbol", "Segoe UI", "Apple Color Emoji", "Twemoji Mozilla", "Noto Color Emoji", "EmojiOne Color", "Android Emoji";--ui-font: -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;--ui-font-size: 16px;--picker-width: calc(var(--emojis-per-row) * var(--emoji-size) * var(--emoji-size-multiplier) + 2.75rem);--preview-background-color: var(--secondary-background-color);background:var(--background-color);border-radius:var(--border-radius);border:1px solid var(--border-color);font-family:var(--ui-font);font-size:var(--ui-font-size);overflow:hidden;position:relative;width:var(--picker-width);display:grid;gap:8px}.picmo__picker.picmo__picker>*{font-family:var(--ui-font)}.picmo__picker.picmo__skeleton{background:var(--background-color);border-radius:var(--border-radius);border:1px solid var(--border-color);font-family:var(--ui-font);width:var(--picker-width);color:var(--secondary-text-color)}.picmo__picker.picmo__skeleton *{box-sizing:border-box}.picmo__picker.picmo__skeleton .picmo__placeholder{background:var(--placeholder-background-color);position:relative;overflow:hidden}.picmo__picker.picmo__skeleton .picmo__placeholder:after{position:absolute;top:0;right:0;bottom:0;left:0;transform:translate(-100%);background-image:linear-gradient(90deg,rgba(255,255,255,0) 0,rgba(255,255,255,.2) 20%,rgba(255,255,255,.5) 60%,rgba(255,255,255,0) 100%);animation:shine 2s infinite;content:""}.picmo__picker.picmo__skeleton .picmo__headerSkeleton{background-color:var(--secondary-background-color);padding-top:8px;padding-bottom:8px;display:flex;flex-direction:column;overflow:hidden;gap:8px;border-bottom:1px solid var(--border-color);width:var(--picker-width)}.picmo__picker.picmo__skeleton .picmo__searchSkeleton{padding:0 8px;height:var(--search-height)}.picmo__picker.picmo__skeleton .picmo__searchSkeleton .picmo__searchInput{width:100%;height:28px;border-radius:3px}.picmo__picker.picmo__skeleton .picmo__categoryTabsSkeleton{height:var(--category-tabs-height);display:flex;flex-direction:row;align-items:center;justify-self:center;width:calc(2rem * var(--category-count, 1))}.picmo__picker.picmo__skeleton .picmo__categoryTabsSkeleton .picmo__categoryTab{width:25px;height:25px;padding:2px;border-radius:5px;margin:.25em}.picmo__picker.picmo__skeleton .picmo__contentSkeleton{height:var(--content-height);padding-right:8px;opacity:.7}.picmo__picker.picmo__skeleton .picmo__contentSkeleton .picmo__categoryName{width:50%;height:1rem;margin:.5rem;box-sizing:border-box}.picmo__picker.picmo__skeleton .picmo__contentSkeleton .picmo__emojiGrid{display:grid;justify-content:space-between;gap:1px;padding:0 .5em;grid-template-columns:repeat(var(--emojis-per-row),calc(var(--emoji-size) * var(--emoji-size-multiplier)));grid-auto-rows:calc(var(--emoji-size) * var(--emoji-size-multiplier));align-items:center;justify-items:center;width:var(--picker-width)}.picmo__picker.picmo__skeleton .picmo__contentSkeleton .picmo__emojiGrid .picmo__emoji{width:var(--emoji-size);height:var(--emoji-size);border-radius:50%}.picmo__picker.picmo__skeleton .picmo__previewSkeleton{height:var(--emoji-preview-height);border-top:1px solid var(--border-color);display:grid;align-items:center;padding:.5em;gap:6px;grid-template-columns:auto 1fr;grid-template-rows:auto 1fr;grid-template-areas:"emoji name" "emoji tags"}.picmo__picker.picmo__skeleton .picmo__previewSkeleton .picmo__previewEmoji{grid-area:emoji;border-radius:50%;width:var(--emoji-preview-size);height:var(--emoji-preview-size)}.picmo__picker.picmo__skeleton .picmo__previewSkeleton .picmo__previewName{grid-area:name;height:.8em;width:80%}.picmo__picker.picmo__skeleton .picmo__previewSkeleton .picmo__tagList{grid-area:tags;list-style-type:none;display:flex;flex-direction:row;padding:0;margin:0}.picmo__picker.picmo__skeleton .picmo__previewSkeleton .picmo__tagList .picmo__tag{border-radius:3px;padding:2px 8px;margin-right:.25em;height:1em;width:20%}.picmo__overlay{background:rgba(0,0,0,.75);height:100%;left:0;position:fixed;top:0;width:100%;z-index:1000}.picmo__content{position:relative;overflow:hidden;height:var(--content-height)}.picmo__content.picmo__fullHeight{height:calc(var(--content-height) + var(--category-tabs-height) + var(--category-tabs-offset));overflow-y:auto}.picmo__pluginContainer{margin:.5em;display:flex;flex-direction:row}.picmo__header{background-color:var(--secondary-background-color);padding-top:8px;padding-bottom:8px;display:grid;gap:8px;border-bottom:1px solid var(--border-color)}@media (prefers-reduced-motion: reduce){.picmo__placeholder{background:var(--placeholder-background-color);position:relative;overflow:hidden}.picmo__placeholder:after{display:none}}.picmo__picker .picmo__preview{border-top:1px solid var(--border-color);display:grid;align-items:center;gap:6px;grid-template-columns:auto 1fr;grid-template-rows:auto 1fr;grid-template-areas:"emoji name" "emoji tags";height:var(--emoji-preview-height);box-sizing:border-box;padding:.5em;position:relative;background:var(--preview-background-color)}.picmo__picker .picmo__preview .picmo__previewEmoji{grid-area:emoji;font-size:var(--emoji-preview-size);font-family:var(--emoji-font);width:1.25em;display:flex;align-items:center;justify-content:center}.picmo__picker .picmo__preview .picmo__previewName{grid-area:name;color:var(--text-color);font-size:.8em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-weight:500}.picmo__picker .picmo__preview .picmo__tagList{grid-area:tags;list-style-type:none;display:flex;flex-direction:row;padding:0;margin:0;font-size:.75em;overflow:hidden}.picmo__picker .picmo__preview .picmo__tag{border-radius:3px;background:var(--tag-background-color);color:var(--text-color);padding:2px 8px;margin-right:.25em;white-space:nowrap}.picmo__picker .picmo__preview .picmo__tag:last-child{margin-right:0}.picmo__picker .picmo__searchContainer{display:flex;height:var(--search-height);box-sizing:border-box;padding:0 8px;position:relative}.picmo__picker .picmo__searchContainer .picmo__searchField{background:var(--search-background-color);border-radius:3px;border:none;box-sizing:border-box;color:var(--text-color);font-size:.9em;outline:none;padding:.5em 2.25em .5em .5em;width:100%}.picmo__picker .picmo__searchContainer .picmo__searchField:focus{background:var(--search-focus-background-color)}.picmo__picker .picmo__searchContainer .picmo__searchField::placeholder{color:var(--search-placeholder-color)}.picmo__picker .picmo__searchContainer .picmo__searchAccessory{color:var(--search-icon-color);height:100%;position:absolute;right:1em;top:0;width:1.25rem;display:flex;align-items:center}.picmo__picker .picmo__searchContainer .picmo__searchAccessory svg{fill:var(--search-icon-color)}.picmo__picker .picmo__searchContainer .picmo__clearButton{border:0;color:var(--search-icon-color);background:transparent;cursor:pointer}.picmo__picker .picmo__searchContainer .picmo__clearSearchButton{cursor:pointer;border:none;background:transparent;color:var(--search-icon-color);font-size:1em;width:100%;height:100%;display:flex;align-items:center;padding:0}.picmo__picker .picmo__searchContainer .picmo__notFound [data-icon]{fill:#f3e265}.picmo__picker .picmo__variantOverlay{background:var(--overlay-background-color);border-radius:5px;display:flex;flex-direction:column;height:100%;justify-content:center;left:0;position:absolute;top:0;width:100%;z-index:1}.picmo__picker .picmo__variantOverlay .picmo__variantPopup{background:var(--variant-popup-background-color);border-radius:5px;margin:.5em;padding:.5em;text-align:center;user-select:none;display:flex;align-items:center;justify-content:center}.picmo__customEmoji{width:1em;height:1em}@keyframes shine{to{transform:translate(100%)}}.picmo__picker .picmo__imagePlaceholder{width:2rem;height:2rem;border-radius:50%}.picmo__placeholder{background:#DDDBDD;position:relative}.picmo__placeholder:after{position:absolute;top:0;right:0;bottom:0;left:0;transform:translate(-100%);background-image:linear-gradient(90deg,rgba(255,255,255,0) 0,rgba(255,255,255,.2) 20%,rgba(255,255,255,.5) 60%,rgba(255,255,255,0) 100%);animation:shine 2s infinite;content:""} `;function Lte(t){return SR(t.locale,t.dataStore,t.messages,t.emojiData)}var Dte=0,pm;function Nte(){return`picmo-${Date.now()}-${Dte++}`}var Mte=Q2();function CR(t){Mte(Ite);let e=P2(t),i=((e==null?void 0:e.custom)||[]).map(s=>Ce(H({},s),{custom:!0,tags:["custom",...s.tags||[]]})),r=new l2;pm||(pm=Lte(e));let n=new T2(e.i18n);pm.then(s=>{r.emit("data:ready",s)}).catch(s=>{r.emit("error",s)});let o=new S2({events:r,i18n:n,customEmojis:i,renderer:e.renderer,options:e,emojiData:pm,pickerId:Nte()}).create(k2);return o.renderSync(),o}function ua(t){return t.split("-")[0]}function Nl(t){return t.split("-")[1]}function Xm(t){return["top","bottom"].includes(ua(t))?"x":"y"}function DR(t){return t==="y"?"height":"width"}function _R(t,e,i){let{reference:r,floating:n}=t,o=r.x+r.width/2-n.width/2,s=r.y+r.height/2-n.height/2,a=Xm(e),l=DR(a),c=r[l]/2-n[l]/2,u=ua(e),f=a==="x",d;switch(u){case"top":d={x:o,y:r.y-n.height};break;case"bottom":d={x:o,y:r.y+r.height};break;case"right":d={x:r.x+r.width,y:s};break;case"left":d={x:r.x-n.width,y:s};break;default:d={x:r.x,y:r.y}}switch(Nl(e)){case"start":d[a]-=c*(i&&f?-1:1);break;case"end":d[a]+=c*(i&&f?-1:1);break}return d}var Ute=async(t,e,i)=>{let{placement:r="bottom",strategy:n="absolute",middleware:o=[],platform:s}=i,a=await(s.isRTL==null?void 0:s.isRTL(e)),l=await s.getElementRects({reference:t,floating:e,strategy:n}),{x:c,y:u}=_R(l,r,a),f=r,d={},p=0;for(let g=0;gBte[e])}function NR(t,e,i){i===void 0&&(i=!1);let r=Nl(t),n=Xm(t),o=DR(n),s=n==="x"?r===(i?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[o]>e.floating[o]&&(s=Qm(s)),{main:s,cross:Qm(s)}}var Zte={start:"end",end:"start"};function A2(t){return t.replace(/start|end/g,e=>Zte[e])}var Vte=["top","right","bottom","left"],Yte=Vte.reduce((t,e)=>t.concat(e,e+"-start",e+"-end"),[]);function Fte(t,e,i){return(t?[...i.filter(r=>Nl(r)===t),...i.filter(r=>Nl(r)!==t)]:i.filter(r=>ua(r)===r)).filter(r=>t?Nl(r)===t||(e?A2(r)!==r:!1):!0)}var Hte=function(t){return t===void 0&&(t={}),{name:"autoPlacement",options:t,async fn(e){var i,r,n,o,s;let{x:a,y:l,rects:c,middlewareData:u,placement:f,platform:d,elements:p}=e,he=t,{alignment:g=null,allowedPlacements:x=Yte,autoAlignment:w=!0}=he,S=hi(he,["alignment","allowedPlacements","autoAlignment"]),T=Fte(g,w,x),A=await R2(e,S),I=(i=(r=u.autoPlacement)==null?void 0:r.index)!=null?i:0,D=T[I];if(D==null)return{};let{main:C,cross:j}=NR(D,c,await(d.isRTL==null?void 0:d.isRTL(p.floating)));if(f!==D)return{x:a,y:l,reset:{placement:T[0]}};let se=[A[ua(D)],A[C],A[j]],F=[...(n=(o=u.autoPlacement)==null?void 0:o.overflows)!=null?n:[],{placement:D,overflows:se}],U=T[I+1];if(U)return{data:{index:I+1,overflows:F},reset:{placement:U}};let ae=F.slice().sort((me,ve)=>me.overflows[0]-ve.overflows[0]),ue=(s=ae.find(me=>{let{overflows:ve}=me;return ve.every(q=>q<=0)}))==null?void 0:s.placement,ie=ue!=null?ue:ae[0].placement;return ie!==f?{data:{index:I+1,overflows:F},reset:{placement:ie}}:{}}}};function Gte(t){let e=Qm(t);return[A2(t),e,A2(e)]}var Kte=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var i;let{placement:r,middlewareData:n,rects:o,initialPlacement:s,platform:a,elements:l}=e,se=t,{mainAxis:c=!0,crossAxis:u=!0,fallbackPlacements:f,fallbackStrategy:d="bestFit",flipAlignment:p=!0}=se,g=hi(se,["mainAxis","crossAxis","fallbackPlacements","fallbackStrategy","flipAlignment"]),x=ua(r),w=f||(x===s||!p?[Qm(s)]:Gte(s)),S=[s,...w],T=await R2(e,g),A=[],I=((i=n.flip)==null?void 0:i.overflows)||[];if(c&&A.push(T[x]),u){let{main:F,cross:U}=NR(r,o,await(a.isRTL==null?void 0:a.isRTL(l.floating)));A.push(T[F],T[U])}if(I=[...I,{placement:r,overflows:A}],!A.every(F=>F<=0)){var D,C;let F=((D=(C=n.flip)==null?void 0:C.index)!=null?D:0)+1,U=S[F];if(U)return{data:{index:F,overflows:I},reset:{placement:U}};let ae="bottom";switch(d){case"bestFit":{var j;let ue=(j=I.map(ie=>[ie,ie.overflows.filter(he=>he>0).reduce((he,me)=>he+me,0)]).sort((ie,he)=>ie[1]-he[1])[0])==null?void 0:j[0].placement;ue&&(ae=ue);break}case"initialPlacement":ae=s;break}if(r!==ae)return{reset:{placement:ae}}}return{}}}};async function Jte(t,e){let{placement:i,platform:r,elements:n}=t,o=await(r.isRTL==null?void 0:r.isRTL(n.floating)),s=ua(i),a=Nl(i),l=Xm(i)==="x",c=["left","top"].includes(s)?-1:1,u=o&&l?-1:1,f=typeof e=="function"?e(t):e,{mainAxis:d,crossAxis:p,alignmentAxis:g}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:H({mainAxis:0,crossAxis:0,alignmentAxis:null},f);return a&&typeof g=="number"&&(p=a==="end"?g*-1:g),l?{x:p*u,y:d*c}:{x:d*c,y:p*u}}var QR=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){let{x:i,y:r}=e,n=await Jte(e,t);return{x:i+n.x,y:r+n.y,data:n}}}};function eie(t){return t==="x"?"y":"x"}var AR=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){let{x:i,y:r,placement:n}=e,w=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:a={fn:S=>{let{x:T,y:A}=S;return{x:T,y:A}}}}=w,l=hi(w,["mainAxis","crossAxis","limiter"]),c={x:i,y:r},u=await R2(e,l),f=Xm(ua(n)),d=eie(f),p=c[f],g=c[d];if(o){let S=f==="y"?"top":"left",T=f==="y"?"bottom":"right",A=p+u[S],I=p-u[T];p=PR(A,p,I)}if(s){let S=d==="y"?"top":"left",T=d==="y"?"bottom":"right",A=g+u[S],I=g-u[T];g=PR(A,g,I)}let x=a.fn(Ce(H({},e),{[f]:p,[d]:g}));return Ce(H({},x),{data:{x:x.x-i,y:x.y-r}})}}};function MR(t){return t&&t.document&&t.location&&t.alert&&t.setInterval}function no(t){if(t==null)return window;if(!MR(t)){let e=t.ownerDocument;return e&&e.defaultView||window}return t}function bn(t){return no(t).getComputedStyle(t)}function io(t){return MR(t)?"":t?(t.nodeName||"").toLowerCase():""}function UR(){let t=navigator.userAgentData;return t!=null&&t.brands?t.brands.map(e=>e.brand+"/"+e.version).join(" "):navigator.userAgent}function yn(t){return t instanceof no(t).HTMLElement}function ss(t){return t instanceof no(t).Element}function tie(t){return t instanceof no(t).Node}function Ml(t){if(typeof ShadowRoot>"u")return!1;let e=no(t).ShadowRoot;return t instanceof e||t instanceof ShadowRoot}function Rm(t){let{overflow:e,overflowX:i,overflowY:r}=bn(t);return/auto|scroll|overlay|hidden/.test(e+r+i)}function iie(t){return["table","td","th"].includes(io(t))}function zR(t){let e=/firefox/i.test(UR()),i=bn(t);return i.transform!=="none"||i.perspective!=="none"||i.contain==="paint"||["transform","perspective"].includes(i.willChange)||e&&i.willChange==="filter"||e&&(i.filter?i.filter!=="none":!1)}function jR(){return!/^((?!chrome|android).)*safari/i.test(UR())}var $R=Math.min,Wf=Math.max,Am=Math.round;function ro(t,e,i){var r,n,o,s;e===void 0&&(e=!1),i===void 0&&(i=!1);let a=t.getBoundingClientRect(),l=1,c=1;e&&yn(t)&&(l=t.offsetWidth>0&&Am(a.width)/t.offsetWidth||1,c=t.offsetHeight>0&&Am(a.height)/t.offsetHeight||1);let u=ss(t)?no(t):window,f=!jR()&&i,d=(a.left+(f&&(r=(n=u.visualViewport)==null?void 0:n.offsetLeft)!=null?r:0))/l,p=(a.top+(f&&(o=(s=u.visualViewport)==null?void 0:s.offsetTop)!=null?o:0))/c,g=a.width/l,x=a.height/c;return{width:g,height:x,top:p,right:d+g,bottom:p+x,left:d,x:d,y:p}}function as(t){return((tie(t)?t.ownerDocument:t.document)||window.document).documentElement}function Im(t){return ss(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function qR(t){return ro(as(t)).left+Im(t).scrollLeft}function rie(t){let e=ro(t);return Am(e.width)!==t.offsetWidth||Am(e.height)!==t.offsetHeight}function nie(t,e,i){let r=yn(e),n=as(e),o=ro(t,r&&rie(e),i==="fixed"),s={scrollLeft:0,scrollTop:0},a={x:0,y:0};if(r||!r&&i!=="fixed")if((io(e)!=="body"||Rm(n))&&(s=Im(e)),yn(e)){let l=ro(e,!0);a.x=l.x+e.clientLeft,a.y=l.y+e.clientTop}else n&&(a.x=qR(n));return{x:o.left+s.scrollLeft-a.x,y:o.top+s.scrollTop-a.y,width:o.width,height:o.height}}function WR(t){return io(t)==="html"?t:t.assignedSlot||t.parentNode||(Ml(t)?t.host:null)||as(t)}function XR(t){return!yn(t)||bn(t).position==="fixed"?null:oie(t)}function oie(t){let{offsetParent:e}=t,i=t,r=!1;for(;i&&i!==e;){let{assignedSlot:n}=i;if(n){let o=n.offsetParent;if(bn(n).display==="contents"){let s=n.hasAttribute("style"),a=n.style.display;n.style.display=bn(i).display,o=n.offsetParent,n.style.display=a,s||n.removeAttribute("style")}i=n,e!==o&&(e=o,r=!0)}else if(Ml(i)&&i.host&&r)break;i=Ml(i)&&i.host||i.parentNode}return e}function sie(t){let e=WR(t);for(Ml(e)&&(e=e.host);yn(e)&&!["html","body"].includes(io(e));){if(zR(e))return e;{let i=e.parentNode;e=Ml(i)?i.host:i}}return null}function $2(t){let e=no(t),i=XR(t);for(;i&&iie(i)&&bn(i).position==="static";)i=XR(i);return i&&(io(i)==="html"||io(i)==="body"&&bn(i).position==="static"&&!zR(i))?e:i||sie(t)||e}function RR(t){if(yn(t))return{width:t.offsetWidth,height:t.offsetHeight};let e=ro(t);return{width:e.width,height:e.height}}function aie(t){let{rect:e,offsetParent:i,strategy:r}=t,n=yn(i),o=as(i);if(i===o)return e;let s={scrollLeft:0,scrollTop:0},a={x:0,y:0};if((n||!n&&r!=="fixed")&&((io(i)!=="body"||Rm(o))&&(s=Im(i)),yn(i))){let l=ro(i,!0);a.x=l.x+i.clientLeft,a.y=l.y+i.clientTop}return Ce(H({},e),{x:e.x-s.scrollLeft+a.x,y:e.y-s.scrollTop+a.y})}function lie(t,e){let i=no(t),r=as(t),n=i.visualViewport,o=r.clientWidth,s=r.clientHeight,a=0,l=0;if(n){o=n.width,s=n.height;let c=jR();(c||!c&&e==="fixed")&&(a=n.offsetLeft,l=n.offsetTop)}return{width:o,height:s,x:a,y:l}}function cie(t){var e;let i=as(t),r=Im(t),n=(e=t.ownerDocument)==null?void 0:e.body,o=Wf(i.scrollWidth,i.clientWidth,n?n.scrollWidth:0,n?n.clientWidth:0),s=Wf(i.scrollHeight,i.clientHeight,n?n.scrollHeight:0,n?n.clientHeight:0),a=-r.scrollLeft+qR(t),l=-r.scrollTop;return bn(n||i).direction==="rtl"&&(a+=Wf(i.clientWidth,n?n.clientWidth:0)-o),{width:o,height:s,x:a,y:l}}function BR(t){let e=WR(t);return["html","body","#document"].includes(io(e))?t.ownerDocument.body:yn(e)&&Rm(e)?e:BR(e)}function $m(t,e){var i;e===void 0&&(e=[]);let r=BR(t),n=r===((i=t.ownerDocument)==null?void 0:i.body),o=no(r),s=n?[o].concat(o.visualViewport||[],Rm(r)?r:[]):r,a=e.concat(s);return n?a:a.concat($m(s))}function uie(t,e){let i=e.getRootNode==null?void 0:e.getRootNode();if(t.contains(e))return!0;if(i&&Ml(i)){let r=e;do{if(r&&t===r)return!0;r=r.parentNode||r.host}while(r)}return!1}function fie(t,e){let i=ro(t,!1,e==="fixed"),r=i.top+t.clientTop,n=i.left+t.clientLeft;return{top:r,left:n,x:n,y:r,right:n+t.clientWidth,bottom:r+t.clientHeight,width:t.clientWidth,height:t.clientHeight}}function IR(t,e,i){return e==="viewport"?Pm(lie(t,i)):ss(e)?fie(e,i):Pm(cie(as(t)))}function hie(t){let e=$m(t),i=["absolute","fixed"].includes(bn(t).position)&&yn(t)?$2(t):t;return ss(i)?e.filter(r=>ss(r)&&uie(r,i)&&io(r)!=="body"):[]}function die(t){let{element:e,boundary:i,rootBoundary:r,strategy:n}=t,o=[...i==="clippingAncestors"?hie(e):[].concat(i),r],s=o[0],a=o.reduce((l,c)=>{let u=IR(e,c,n);return l.top=Wf(u.top,l.top),l.right=$R(u.right,l.right),l.bottom=$R(u.bottom,l.bottom),l.left=Wf(u.left,l.left),l},IR(e,s,n));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}var pie={getClippingRect:die,convertOffsetParentRelativeRectToViewportRelativeRect:aie,isElement:ss,getDimensions:RR,getOffsetParent:$2,getDocumentElement:as,getElementRects:t=>{let{reference:e,floating:i,strategy:r}=t;return{reference:nie(e,$2(i),r),floating:Ce(H({},RR(i)),{x:0,y:0})}},getClientRects:t=>Array.from(t.getClientRects()),isRTL:t=>bn(t).direction==="rtl"};function Oie(t,e,i,r){r===void 0&&(r={});let{ancestorScroll:n=!0,ancestorResize:o=!0,elementResize:s=!0,animationFrame:a=!1}=r,l=n&&!a,c=o&&!a,u=l||c?[...ss(t)?$m(t):[],...$m(e)]:[];u.forEach(x=>{l&&x.addEventListener("scroll",i,{passive:!0}),c&&x.addEventListener("resize",i)});let f=null;if(s){let x=!0;f=new ResizeObserver(()=>{x||i(),x=!1}),ss(t)&&!a&&f.observe(t),f.observe(e)}let d,p=a?ro(t):null;a&&g();function g(){let x=ro(t);p&&(x.x!==p.x||x.y!==p.y||x.width!==p.width||x.height!==p.height)&&i(),p=x,d=requestAnimationFrame(g)}return i(),()=>{var x;u.forEach(w=>{l&&w.removeEventListener("scroll",i),c&&w.removeEventListener("resize",i)}),(x=f)==null||x.disconnect(),f=null,a&&cancelAnimationFrame(d)}}var mie=(t,e,i)=>Ute(t,e,H({platform:pie},i));async function gie(t,e,i,r){if(!r)throw new Error("Must provide a positioning option");return await(typeof r=="string"?bie(t,e,i,r):yie(e,r))}async function bie(t,e,i,r){if(!i)throw new Error("Reference element is required for relative positioning");let n;return r==="auto"?n={middleware:[Hte(),AR(),QR({mainAxis:5,crossAxis:12})]}:n={placement:r,middleware:[Kte(),AR(),QR(5)]},Oie(i,e,async()=>{if((!i.isConnected||!i.offsetParent)&&xie(t))return;let{x:o,y:s}=await mie(i,e,n);Object.assign(e.style,{position:"absolute",left:`${o}px`,top:`${s}px`})})}function yie(t,e){return t.style.position="fixed",Object.entries(e).forEach(([i,r])=>{t.style[i]=r}),()=>{}}function xie(t){switch(t.options.onPositionLost){case"close":return t.close(),!0;case"destroy":return t.destroy(),!0;case"hold":return!0}}var vie={hideOnClickOutside:!0,hideOnEmojiSelect:!0,hideOnEscape:!0,position:"auto",showCloseButton:!0,onPositionLost:"none"};function wie(t={}){return H(Ce(H({},vie),{rootElement:document.body}),t)}var kie='',LR=ui("popupContainer","closeButton"),X2=class{constructor(e,i){this.isOpen=!1,this.externalEvents=new la,this.options=H(H({},wie(i)),P2(e)),this.popupEl=document.createElement("div"),this.popupEl.classList.add(LR.popupContainer),this.popupEl.classList.add(this.options.theme),i.className&&this.popupEl.classList.add(i.className),this.options.showCloseButton&&(this.closeButton=document.createElement("button"),this.closeButton.type="button",this.closeButton.classList.add(LR.closeButton),this.closeButton.innerHTML=kie,this.closeButton.addEventListener("click",()=>{this.close()}),this.popupEl.appendChild(this.closeButton));let r=document.createElement("div");this.popupEl.appendChild(r),this.picker=CR(Ce(H({},this.options),{rootElement:r})),this.focusTrap=new zf,this.picker.addEventListener("data:ready",()=>{this.focusTrap.activate(this.picker.el),this.picker.setInitialFocus()}),this.options.hideOnEmojiSelect&&this.picker.addEventListener("emoji:select",()=>{var n;this.close(),(n=this.triggerElement)==null||n.focus()}),this.options.hideOnClickOutside&&(this.onDocumentClick=this.onDocumentClick.bind(this),document.addEventListener("click",this.onDocumentClick)),this.options.hideOnEscape&&(this.handleKeydown=this.handleKeydown.bind(this),this.popupEl.addEventListener("keydown",this.handleKeydown)),this.referenceElement=this.options.referenceElement,this.triggerElement=this.options.triggerElement}addEventListener(e,i){this.externalEvents.on(e,i),this.picker.addEventListener(e,i)}removeEventListener(e,i){this.externalEvents.off(e,i),this.picker.removeEventListener(e,i)}handleKeydown(e){var i;e.key==="Escape"&&(this.close(),(i=this.triggerElement)==null||i.focus())}async destroy(){this.isOpen&&await this.close(),document.removeEventListener("click",this.onDocumentClick),this.picker.destroy(),this.externalEvents.removeAll()}toggle(e){return this.isOpen?this.close():this.open(e)}async open({triggerElement:e,referenceElement:i}={}){this.isOpen||(e&&(this.triggerElement=e),i&&(this.referenceElement=i),await this.initiateOpenStateChange(!0),this.popupEl.style.opacity="0",this.options.rootElement.appendChild(this.popupEl),await this.setPosition(),this.picker.reset(!1),await this.animatePopup(!0),await this.animateCloseButton(!0),this.picker.setInitialFocus(),this.externalEvents.emit("picker:open"))}async close(){var e;!this.isOpen||(await this.initiateOpenStateChange(!1),await this.animateCloseButton(!1),await this.animatePopup(!1),this.popupEl.remove(),this.picker.reset(),(e=this.positionCleanup)==null||e.call(this),this.focusTrap.deactivate(),this.externalEvents.emit("picker:close"))}getRunningAnimations(){return this.picker.el.getAnimations().filter(e=>e.playState==="running")}async setPosition(){var e;(e=this.positionCleanup)==null||e.call(this),this.positionCleanup=await gie(this,this.popupEl,this.referenceElement,this.options.position)}awaitPendingAnimations(){return Promise.all(this.getRunningAnimations().map(e=>e.finished))}onDocumentClick(e){var i;let r=e.target,n=(i=this.triggerElement)==null?void 0:i.contains(r);this.isOpen&&!this.picker.isPickerClick(e)&&!n&&this.close()}animatePopup(e){return sa(this.popupEl,{opacity:[0,1],transform:["scale(0.9)","scale(1)"]},{duration:150,id:e?"show-picker":"hide-picker",easing:"ease-in-out",direction:e?"normal":"reverse",fill:"both"},this.options)}animateCloseButton(e){if(this.closeButton)return sa(this.closeButton,{opacity:[0,1]},{duration:25,id:e?"show-close":"hide-close",easing:"ease-in-out",direction:e?"normal":"reverse",fill:"both"},this.options)}async initiateOpenStateChange(e){this.isOpen=e,await this.awaitPendingAnimations()}},Sie=`.picmo__popupContainer{display:flex;flex-direction:column;position:absolute}.picmo__popupContainer .picmo__closeButton{position:absolute;opacity:0;background:transparent;border:none;z-index:1;right:0;top:0;cursor:pointer;padding:4px;align-self:flex-end;transform:translate(50%,-50%);background:#999999;width:1.5rem;height:1.5rem;display:flex;align-items:center;justify-content:center;border-radius:50%}.picmo__popupContainer .picmo__closeButton:hover{background:var(--accent-color)}.picmo__popupContainer .picmo__closeButton svg{fill:#fff;width:1.25rem;height:1.25rem} `,Tie=Q2();function ZR(t,e){return Tie(Sie),new X2(H({autoFocus:"auto"},t),e)}var Eie={mounted(){let t=this.el.querySelector("[data-emoji-button]"),e=this.el.querySelector("[data-emoji-preview]"),i=this.el.querySelector("[data-emoji-input]"),r=ZR({showPreview:!1},{triggerElement:t,referenceElement:t,position:"bottom"});r.addEventListener("emoji:select",({emoji:n})=>{e.innerHTML=n,i.value=n}),t.addEventListener("click",n=>{r.toggle()})}},VR=Eie;var Cie={mounted(){this.focus()},updated(){this.el!==document.activeElement&&this.focus()},focus(){Ko(document.activeElement)||(this.el.focus(),this.el.selectionStart=this.el.selectionEnd=this.el.value.length,this.el.scrollLeft=this.el.scrollWidth)}},YR=Cie;var _ie={mounted(){this.props=this.getProps(),this.isFocused=!1,this.insertMode=!1,this.initializeHeadingEl(),this.navigationSubscription=Kt.subscribe("navigation",this.handleNavigationEvent.bind(this))},updated(){this.props=this.getProps(),this.initializeHeadingEl()},destroyed(){this.navigationSubscription.destroy()},getProps(){return ht(this.el,["id","on-value-change","metadata"])},initializeHeadingEl(){let t=this.el.querySelector("[data-el-heading]");t!==this.headingEl&&(this.headingEl=t,this.headingEl.addEventListener("paste",e=>{e.preventDefault();let i=e.clipboardData.getData("text/plain").replace(` -`," ");document.execCommand("insertText",!1,i)}),this.headingEl.addEventListener("keydown",e=>{e.key==="Enter"&&e.preventDefault()}),this.headingEl.addEventListener("blur",e=>{setTimeout(()=>{this.isFocused&&this.insertMode&&(this.headingEl.focus(),FR(this.headingEl))},0)}))},handleNavigationEvent(t){t.type==="element_focused"?this.handleElementFocused(t.focusableId,t.scroll):t.type==="insert_mode_changed"&&this.handleInsertModeChanged(t.enabled)},handleElementFocused(t,e){this.props.id===t?(this.isFocused=!0,this.el.setAttribute("data-js-focused",""),e&&Hs(this.el)):this.isFocused&&(this.isFocused=!1,this.el.removeAttribute("data-js-focused"))},handleInsertModeChanged(t){this.isFocused&&!this.insertMode&&t?(this.insertMode=t,this.el.setAttribute("phx-update","ignore"),this.headingEl.setAttribute("contenteditable",""),this.headingEl.focus(),FR(this.headingEl)):this.insertMode&&!t&&(this.insertMode=t,this.headingEl.removeAttribute("contenteditable"),this.el.removeAttribute("phx-update"),this.pushEvent(this.props.onValueChange,{value:this.headingEl.textContent.trim(),metadata:this.props.metadata}))}};function FR(t){let e=document.createRange();e.selectNodeContents(t),e.collapse(!1);let i=window.getSelection();i.removeAllRanges(),i.addRange(e)}var HR=_ie;var Pie={mounted(){this.props=this.getProps(),this.sourceEl=Gn(this.el,"[data-source]"),this.targetEl=Gn(this.el,"[data-target]"),this.updateDOM()},updated(){this.props=this.getProps(),this.updateDOM()},getProps(){return ht(this.el,["language"])},updateDOM(){let t=this.sourceEl.innerText,e=_O(t,this.props.language);this.targetEl.innerHTML=e,this.el.setAttribute("data-highlighted","")}},GR=Pie;var I2=["bg-yellow-100","border-yellow-300"],Qie={mounted(){this.props=this.getProps(),this.inputEl=this.el.querySelector("[data-input]"),this.previewEl=this.el.querySelector("[data-preview]"),this.initialPreviewContentEl=this.previewEl.firstElementChild,this.cameraPreviewEl=this.el.querySelector("[data-camera-preview]"),this.cameraListEl=this.el.querySelector("[data-camera-list]"),this.cameraItemTemplateEl=this.cameraListEl.firstElementChild,this.cameraItemTemplateEl.remove(),this.uploadButton=this.el.querySelector("[data-btn-upload]"),this.openCameraButton=this.el.querySelector("[data-btn-open-camera]"),this.captureCameraButton=this.el.querySelector("[data-btn-capture-camera]"),this.cancelButton=this.el.querySelector("[data-btn-cancel]"),this.cameraListPopulated=!1,this.cameraVideoEl=null,this.cameraStream=null,this.updateImagePreview(),this.uploadButton.addEventListener("click",t=>{this.inputEl.click()}),this.inputEl.addEventListener("change",t=>{let[e]=t.target.files;e&&this.loadFile(e)}),this.el.addEventListener("dragover",t=>{t.stopPropagation(),t.preventDefault(),t.dataTransfer.dropEffect="copy"}),this.el.addEventListener("drop",t=>{t.stopPropagation(),t.preventDefault();let[e]=t.dataTransfer.files;e&&this.loadFile(e),this.closeCameraView()}),this.el.addEventListener("dragenter",t=>{this.el.classList.add(...I2)}),this.el.addEventListener("dragleave",t=>{this.el.contains(t.relatedTarget)||this.el.classList.remove(...I2)}),this.el.addEventListener("drop",t=>{this.el.classList.remove(...I2)}),this.openCameraButton.addEventListener("click",t=>{this.cameraListPopulated||(this.renderCameraList(),this.cameraListPopulated=!0)}),this.cameraListEl.addEventListener("click",t=>{let e=t.target.closest("[data-camera-id]");if(e){let i=e.dataset.cameraId;this.openCameraView(i)}}),this.captureCameraButton.addEventListener("click",t=>{let e=this.toCanvas(this.cameraVideoEl,this.cameraVideoEl.videoWidth,this.cameraVideoEl.videoHeight);this.pushImage(e),this.closeCameraView()}),this.cancelButton.addEventListener("click",t=>{this.closeCameraView()})},updated(){this.props=this.getProps(),this.updateImagePreview()},getProps(){return ht(this.el,["id","phx-target","height","width","format","fit","image-url","value-height","value-width"])},updateImagePreview(){this.props.imageUrl?Xie(this.props.imageUrl,this.props.valueHeight,this.props.valueWidth,this.props.format).then(t=>{this.setPreview(t)}):this.setPreview(this.initialPreviewContentEl)},loadFile(t){let e=new FileReader;e.onload=i=>{let r=document.createElement("img");r.addEventListener("load",n=>{let o=this.toCanvas(r,r.width,r.height);this.pushImage(o)}),r.src=i.target.result},e.readAsDataURL(t)},openCameraView(t){this.cameraPreviewEl.classList.remove("hidden"),this.cancelButton.classList.remove("hidden"),this.captureCameraButton.classList.remove("hidden"),this.previewEl.classList.add("hidden"),this.openCameraButton.classList.add("hidden"),this.uploadButton.classList.add("hidden"),navigator.mediaDevices.getUserMedia(this.cameraConstraints(t)).then(e=>{this.cameraStream=e,this.cameraVideoEl=document.createElement("video"),this.cameraVideoEl.autoplay=!0,this.cameraVideoEl.playsinline=!0,this.cameraVideoEl.muted=!0,this.cameraVideoEl.srcObject=e,this.setCameraPreview(this.cameraVideoEl)}).catch(()=>{})},cameraConstraints(t){return t==="system_default"?{audio:!1,video:!0}:{audio:!1,video:{deviceId:t}}},renderCameraList(){navigator.mediaDevices.getUserMedia({audio:!1,video:!0}).then(t=>navigator.mediaDevices.enumerateDevices().then(e=>(this.stopMediaStream(t),e))).then(t=>{let e=t.filter(i=>i.kind==="videoinput").map(i=>({deviceId:i.deviceId,label:i.label}));[{deviceId:"system_default",label:"System Default"},...e].forEach(({deviceId:i,label:r})=>{let n=this.cameraItemTemplateEl.cloneNode(!0);n.querySelector("[data-camera-id]").setAttribute("data-camera-id",i),n.querySelector("[data-label]").innerHTML=r,this.cameraListEl.appendChild(n)})}).catch(t=>{console.error(t),this.openCameraButton.disabled=!0})},closeCameraView(){return this.cameraStream!==null&&(this.stopMediaStream(this.cameraStream),this.cameraStream=null),this.cameraVideoEl!==null&&(this.cameraVideoEl.remove(),this.cameraVideoEl=null),this.cameraPreviewEl.classList.add("hidden"),this.cancelButton.classList.add("hidden"),this.captureCameraButton.classList.add("hidden"),this.previewEl.classList.remove("hidden"),this.openCameraButton.classList.remove("hidden"),this.uploadButton.classList.remove("hidden"),!0},stopMediaStream(t){t.getTracks().forEach(e=>{e.stop()})},pushImage(t){Aie(t,this.props.format).then(e=>{let i={height:t.height,width:t.width},r=new Blob([e]);r.meta=()=>i,this.uploadTo(this.props.phxTarget,"file",[r])})},toCanvas(t,e,i){let{width:r,height:n}=this.props,o=document.createElement("canvas"),s=o.getContext("2d");if(r===null&&n===null||r===e&&n===i)o.width=e,o.height=i,o.getContext("2d").drawImage(t,0,0,e,i,0,0,e,i);else if(this.props.fit==="contain"){let a=r/e,l=n/i,c=Math.min(a,l),u=Math.round(e*c),f=Math.round(i*c);o.width=u,o.height=f,s.drawImage(t,0,0,e,i,0,0,u,f)}else if(this.props.fit==="crop"){let a=r/e,l=n/i,c=Math.max(a,l),u=Math.round(e*c),f=Math.round(i*c);o.width=r,o.height=n,s.drawImage(t,Math.round((u-r)/c/2),Math.round((f-n)/c/2),e-Math.round((u-r)/c),i-Math.round((f-n)/c),0,0,r,n)}else if(this.props.fit==="pad"){let a=r/e,l=n/i,c=Math.min(a,l),u=Math.round(e*c),f=Math.round(i*c);o.width=r,o.height=n,s.fillStyle="black",s.fillRect(0,0,o.width,o.height),s.drawImage(t,0,0,e,i,Math.round((r-u)/2),Math.round((n-f)/2),u,f)}else o.width=r,o.height=n,s.drawImage(t,0,0,e,i,0,0,r,n);return o},setPreview(t){t.style.maxHeight="300px",t.style.maxWidth="100%",this.previewEl.replaceChildren(t)},setCameraPreview(t){t.style.maxHeight="300px",t.style.maxWidth="100%",this.cameraPreviewEl.replaceChildren(t)}};function Aie(t,e){if(e==="png"||e==="jpeg")return new Promise((i,r)=>{t.toBlob(n=>{n.arrayBuffer().then(o=>{i(o)})},`image/${e}`)});if(e==="rgb"){let i=t.getContext("2d").getImageData(0,0,t.width,t.height),r=$ie(i);return Promise.resolve(r)}throw new Error(`Unexpected format: ${e}`)}function $ie(t){let e=t.width*t.height,i=new Uint8ClampedArray(e*3);for(let r=0;rn.arrayBuffer()).then(n=>{let o=document.createElement("canvas");o.height=e,o.width=i;let s=Rie(n,i,e);return o.getContext("2d").putImageData(s,0,0),o});throw new Error(`Unexpected format: ${r}`)}function Rie(t,e,i){let r=e*i,n=new Uint8Array(t),o=new Uint8ClampedArray(r*4);for(let s=0;s{t.sandbox="allow-scripts allow-same-origin allow-downloads allow-forms allow-modals allow-popups allow-top-navigation",t.allow="accelerometer; ambient-light-sensor; camera; display-capture; encrypted-media; fullscreen; geolocation; gyroscope; microphone; midi; usb; xr-spatial-tracking; clipboard-read; clipboard-write; bluetooth; serial",t.src=r})}function Nie(t,e){let i=window.location.protocol;return e?e.replace(/^https?:/,i):i==="https:"?"https://livebookusercontent.com/iframe/v5.html":`http://${window.location.hostname}:${t}/iframe/v5.html`}var N2=null;function Mie(t){return N2||(N2=fetch(t).then(e=>e.text()).then(e=>{if(G$(e)!==rI)throw new Error(`The iframe loaded from ${t} doesn't have the expected checksum ${rI}`)})),N2}var Uie={mounted(){this.props=this.getProps(),this.id=Y$(),this.childToken=F$(),this.childReadyPromise=null,this.childReady=!1,this.initReceived=!1,this.syncCallbackQueue=[],this.pongCallbackQueue=[],this.initTimeout=setTimeout(()=>this.handleInitTimeout(),2e3),this.channel=eI(this.props.sessionToken),this.iframeActions=this.createIframe(),this.childReadyPromise=new Promise((n,o)=>{this._handleWindowMessage=s=>{s.source===this.iframe.contentWindow&&this.handleChildMessage(s.data,n)},window.addEventListener("message",this._handleWindowMessage)}),this.hiddenInput=document.createElement("input"),this.hiddenInput.style.display="none",this.el.appendChild(this.hiddenInput),this.iframeActions.visibilityPromise.then(()=>{this.loadIframe()});let t=this.channel.on(`init:${this.props.ref}:${this.id}`,n=>{let[,o]=D2(n);this.handleServerInit(o)}),e=this.channel.on(`event:${this.props.ref}`,n=>{let[[o],s]=D2(n);this.handleServerEvent(o,s)}),i=this.channel.on(`error:${this.props.ref}`,({message:n,init:o})=>{this.handleServerError(n,o)}),r=this.channel.on(`pong:${this.props.ref}`,()=>{this.handleServerPong()});this.unsubscribeFromChannelEvents=()=>{this.channel.off(`init:${this.props.ref}:${this.id}`,t),this.channel.off(`event:${this.props.ref}`,e),this.channel.off(`error:${this.props.ref}`,i),this.channel.off(`pong:${this.props.ref}`,r)},this.subscriptions=[Kt.subscribe(`js_views:${this.props.ref}`,this.handleJSViewEvent.bind(this)),Kt.subscribe("navigation",this.handleNavigationEvent.bind(this))],this.channel.push("connect",{connect_token:this.props.connectToken,ref:this.props.ref,id:this.id},3e4)},updated(){this.props=this.getProps(this)},disconnected(){this.el.removeAttribute("id")},destroyed(){window.removeEventListener("message",this._handleWindowMessage),this.iframeActions.remove(),this.unsubscribeFromChannelEvents(),this.channel.push("disconnect",{ref:this.props.ref}),this.subscriptions.forEach(t=>t.destroy())},getProps(){return ht(this.el,["ref","assets-base-path","assets-cdn-url","js-path","session-token","connect-token","iframe-port","iframe-url","timeout-message"])},createIframe(){this.iframePlaceholder=document.createElement("div"),this.el.appendChild(this.iframePlaceholder),this.iframe=document.createElement("iframe"),this.iframe.className="w-full h-0 absolute z-[1]";let t=document.querySelector("[data-el-notebook]"),e=t.querySelector("[data-el-notebook-content]"),i=new ResizeObserver(l=>{this.repositionIframe()});i.observe(e),i.observe(t);let r=mn(this.iframePlaceholder),n=new ResizeObserver(l=>{let c=mn(this.iframePlaceholder);r!==c&&(r=c,this.repositionIframe())});n.observe(this.iframePlaceholder);let o=Kt.subscribe("js_views",l=>{l.type==="reposition"&&this.repositionIframe()});this.iframe.addEventListener("mouseenter",l=>{this.iframePlaceholder.dispatchEvent(new MouseEvent("mouseenter",{bubbles:!0}))}),this.iframe.addEventListener("mouseleave",l=>{this.iframePlaceholder.dispatchEvent(new MouseEvent("mouseleave",{bubbles:!0}))});let s=kO(this.iframePlaceholder,{root:t,proximity:2e3});this.iframe.toggleAttribute("data-js-focused",!!this.el.closest("[data-js-focused]"));let a=()=>{i.disconnect(),n.disconnect(),o.destroy(),s.cancel(),this.iframe.remove(),this.iframePlaceholder.remove()};return{visibilityPromise:s.promise,remove:a}},repositionIframe(){let{iframe:t,iframePlaceholder:e}=this,i=document.querySelector("[data-el-notebook]");if(mn(e))t.classList.add("hidden");else{t.classList.remove("hidden");let r=i.getBoundingClientRect(),n=e.getBoundingClientRect(),o=n.top-r.top+i.scrollTop;t.style.top=`${o}px`;let s=n.left-r.left+i.scrollLeft;t.style.left=`${s}px`,t.style.height=`${n.height}px`,t.style.width=`${n.width}px`}},loadIframe(){let t=document.querySelector("[data-el-js-view-iframes]");nI(this.iframe,this.props.iframePort,this.props.iframeUrl).then(()=>{t.appendChild(this.iframe)})},handleChildMessage(t,e){if(t.type==="ready"&&!this.childReady)this.getAssetsBaseUrl().then(i=>{this.postMessage({type:"readyReply",token:this.childToken,baseUrl:i,jsPath:this.props.jsPath}),this.childReady=!0,e()});else{if(t.token!==this.childToken)throw new Error("Token mismatch");if(t.type==="resize")this.iframePlaceholder.style.height=`${t.height}px`,this.iframe.style.height=`${t.height}px`;else if(t.type==="domEvent"){let i=this.replicateDomEvent(t.event);t.isTargetEditable?this.hiddenInput.dispatchEvent(i):this.el.dispatchEvent(i)}else if(t.type==="event"){let{event:i,payload:r}=t,n=iI([i,this.props.ref],r);this.channel.push("event",n)}else t.type==="syncReply"?(this.pongCallbackQueue.push(this.syncCallbackQueue.shift()),this.channel.push("ping",{ref:this.props.ref})):t.type==="selectSecret"&&this.pushEvent("select_secret",{js_view_ref:this.props.ref,preselect_name:t.preselectName,options:t.options})}},getAssetsBaseUrl(){return Lm().then(t=>!t&&this.props.assetsCdnUrl?this.props.assetsCdnUrl:window.location.origin+this.props.assetsBasePath)},postMessage(t){this.iframe.contentWindow.postMessage(t,"*")},replicateDomEvent(t){if(t.type==="focus")return new FocusEvent("focus");if(t.type==="mousedown")return new MouseEvent("mousedown",{bubbles:!0});if(t.type==="keydown")return new KeyboardEvent(t.type,t.props)},handleInitTimeout(){this.initTimeoutContainer=document.createElement("div"),this.initTimeoutContainer.classList.add("info-box"),this.el.prepend(this.initTimeoutContainer),this.initTimeoutContainer.textContent=this.props.timeoutMessage},clearInitTimeout(){clearTimeout(this.initTimeout),this.initTimeoutContainer&&this.initTimeoutContainer.remove()},handleServerInit(t){this.clearInitTimeout(),this.initReceived=!0,this.childReadyPromise.then(()=>{this.postMessage({type:"init",data:t})})},handleServerEvent(t,e){this.initReceived&&this.childReadyPromise.then(()=>{this.postMessage({type:"event",event:t,payload:e})})},handleServerError(t,e){e&&this.clearInitTimeout(),this.errorContainer||(this.errorContainer=document.createElement("div"),this.errorContainer.classList.add("error-box","mb-4"),this.el.prepend(this.errorContainer)),this.errorContainer.textContent=t},handleServerPong(){this.pongCallbackQueue.shift()()},handleJSViewEvent(t){t.type==="sync"?(this.syncCallbackQueue.push(t.callback),this.postMessage({type:"sync"})):t.type=="secretSelected"&&this.postMessage({type:"secretSelected",secretName:t.secretName})},handleNavigationEvent(t){if(t.type==="element_focused"){let e=this.el.closest("[data-focusable-id]"),i=e?e.dataset.focusableId:null;this.iframe.toggleAttribute("data-js-focused",i===t.focusableId)}}};function Lm(){return Lm.promise=Lm.promise||fetch("/public/health").then(t=>t.status===200).catch(t=>!1),Lm.promise}var oI=Uie;var zie={mounted(){this.props=this.getProps(),this._handleDocumentKeyDown=this.handleDocumentKeyDown.bind(this),this._handleDocumentKeyUp=this.handleDocumentKeyUp.bind(this),this._handleDocumentFocus=this.handleDocumentFocus.bind(this),window.addEventListener("keydown",this._handleDocumentKeyDown,!0),window.addEventListener("keyup",this._handleDocumentKeyUp,!0),window.addEventListener("focus",this._handleDocumentFocus,!0)},updated(){this.props=this.getProps()},destroyed(){window.removeEventListener("keydown",this._handleDocumentKeyDown,!0),window.removeEventListener("keyup",this._handleDocumentKeyUp,!0),window.removeEventListener("focus",this._handleDocumentFocus,!0)},getProps(){return ht(this.el,["cell-id","default-handlers","keydown-enabled","keyup-enabled","target"])},handleDocumentKeyDown(t){if(this.isKeyboardToggle(t)&&!Ko(document.activeElement)){gn(t),this.keyboardEnabled()?this.disableKeyboard():this.enableKeyboard();return}if(this.keyboardEnabled()){if(this.props.defaultHandlers!=="on"&&gn(t),t.repeat)return;if(this.props.keydownEnabled){let{key:e}=t;this.pushEventTo(this.props.target,"keydown",{key:e})}}},handleDocumentKeyUp(t){if(this.keyboardEnabled()&&(this.props.defaultHandlers!=="on"&&gn(t),this.props.keyupEnabled)){let{key:e}=t;this.pushEventTo(this.props.target,"keyup",{key:e})}},handleDocumentFocus(t){this.props.keydownEnabled&&Ko(t.target)&&this.disableKeyboard()},enableKeyboard(){this.keyboardEnabled()||this.pushEventTo(this.props.target,"enable_keyboard",{})},disableKeyboard(){this.keyboardEnabled()&&this.pushEventTo(this.props.target,"disable_keyboard",{})},keyboardEnabled(){return this.props.keydownEnabled||this.props.keyupEnabled},isKeyboardToggle(t){if(t.repeat)return!1;let{metaKey:e,ctrlKey:i,key:r}=t;return(wO()?e:i)&&r==="k"&&this.isCellFocused()?!this.keyboardEnabled()||["on","disable_only"].includes(this.props.defaultHandlers):!1},isCellFocused(){let t=this.el.closest("[data-el-session]");return t&&t.getAttribute("data-js-focused-id")===this.props.cellId}},sI=zie;var jie={mounted(){this.props=this.getProps(),this.templateEl=Gn(this.el,"[data-template]"),this.contentEl=Gn(this.el,"[data-content]"),this.markdown=new Gs(this.contentEl,this.templateEl.textContent,{baseUrl:this.props.basePath,allowedUriSchemes:this.props.allowedUriSchemes})},updated(){this.props=this.getProps(),this.markdown.setContent(this.templateEl.textContent)},getProps(){return ht(this.el,["base-path","allowed-uri-schemes"])}},aI=jie;var qie={mounted(){this.scroll()},updated(){this.scroll()},scroll(){rf(this.el)}},lI=qie;var Bf=class{constructor(e=2e3){this.resetTimeout=e,this.buffer=[],this.resetTimeoutId=null}push(e){this.buffer.push(e),this.resetTimeoutId&&clearTimeout(this.resetTimeoutId),this.resetTimeoutId=setTimeout(()=>{this.reset()},this.resetTimeout)}reset(){this.resetTimeoutId&&clearTimeout(this.resetTimeoutId),this.resetTimeoutId=null,this.buffer=[]}tryMatch(e){if(e.length>this.buffer.length)return!1;let i=this.buffer.slice(-e.length),r=e.every((n,o)=>n===i[o]);return r&&this.reset(),r}};var Wie={mounted(){this.props=this.getProps(),this.focusedId=null,this.insertMode=!1,this.view=null,this.viewOptions=null,this.keyBuffer=new Bf,this.lastLocationReportByClientId={},this.followedClientId=null,this.store=Ll.create("session"),TO(this.faviconForEvaluationStatus(this.props.globalStatus)),this.updateSectionListHighlight(),this._handleDocumentKeyDown=this.handleDocumentKeyDown.bind(this),this._handleEditorEscape=this.handleEditorEscape.bind(this),this._handleDocumentMouseDown=this.handleDocumentMouseDown.bind(this),this._handleDocumentFocus=this.handleDocumentFocus.bind(this),this._handleDocumentClick=this.handleDocumentClick.bind(this),document.addEventListener("keydown",this._handleDocumentKeyDown,!0),document.addEventListener("lb:editor_escape",this._handleEditorEscape),document.addEventListener("mousedown",this._handleDocumentMouseDown),document.addEventListener("focus",this._handleDocumentFocus,!0),document.addEventListener("click",this._handleDocumentClick),this.getElement("sections-list").addEventListener("click",t=>{this.handleSectionsListClick(t),this.handleCellIndicatorsClick(t)}),this.getElement("clients-list").addEventListener("click",t=>this.handleClientsListClick(t)),this.getElement("sections-list-toggle").addEventListener("click",t=>this.toggleSectionsList()),this.getElement("clients-list-toggle").addEventListener("click",t=>this.toggleClientsList()),this.getElement("secrets-list-toggle").addEventListener("click",t=>this.toggleSecretsList()),this.getElement("runtime-info-toggle").addEventListener("click",t=>this.toggleRuntimeInfo()),this.getElement("app-info-toggle").addEventListener("click",t=>this.toggleAppInfo()),this.getElement("files-list-toggle").addEventListener("click",t=>this.toggleFilesList()),this.getElement("notebook").addEventListener("scroll",t=>this.updateSectionListHighlight()),this.getElement("notebook-indicators").addEventListener("click",t=>this.handleCellIndicatorsClick(t)),this.getElement("views").addEventListener("click",t=>{this.handleViewsClick(t)}),this.getElement("section-toggle-collapse-all-button").addEventListener("click",t=>this.toggleCollapseAllSections()),this.initializeDragAndDrop(),window.addEventListener("phx:page-loading-stop",()=>{this.initializeFocus()},{once:!0}),this.handleEvent("session_init",({clients:t,client_id:e})=>{let i={};for(let r of t)i[r.id]=r;this.store.set("clients",i),this.store.set("clientId",e)}),this.handleEvent("cell_inserted",({cell_id:t})=>{this.handleCellInserted(t)}),this.handleEvent("cell_deleted",({cell_id:t,sibling_cell_id:e})=>{this.handleCellDeleted(t,e)}),this.handleEvent("cell_restored",({cell_id:t})=>{this.handleCellRestored(t)}),this.handleEvent("cell_moved",({cell_id:t})=>{this.handleCellMoved(t)}),this.handleEvent("section_inserted",({section_id:t})=>{this.handleSectionInserted(t)}),this.handleEvent("section_deleted",({section_id:t})=>{this.handleSectionDeleted(t)}),this.handleEvent("section_moved",({section_id:t})=>{this.handleSectionMoved(t)}),this.handleEvent("client_joined",({client:t})=>{this.handleClientJoined(t)}),this.handleEvent("client_left",({client_id:t})=>{this.handleClientLeft(t)}),this.handleEvent("clients_updated",({clients:t})=>{this.handleClientsUpdated(t)}),this.handleEvent("secret_selected",({select_secret_ref:t,secret_name:e})=>{this.handleSecretSelected(t,e)}),this.handleEvent("location_report",({client_id:t,focusable_id:e})=>{let i={focusableId:e};this.handleLocationReport(t,i)})},updated(){let t=this.props;this.props=this.getProps(),this.props.globalStatus!==t.globalStatus&&TO(this.faviconForEvaluationStatus(this.props.globalStatus))},disconnected(){this.el.removeAttribute("id"),this.keepChannel=!0},destroyed(){document.removeEventListener("keydown",this._handleDocumentKeyDown,!0),document.removeEventListener("lb:editor_scape",this._handleEditorEscape),document.removeEventListener("mousedown",this._handleDocumentMouseDown),document.removeEventListener("focus",this._handleDocumentFocus,!0),document.removeEventListener("click",this._handleDocumentClick),TO("favicon"),this.keepChannel||tI(),this.store.destroy()},getProps(){return ht(this.el,["autofocus-cell-id","global-status"])},faviconForEvaluationStatus(t){return t==="evaluating"?"favicon-evaluating":t==="stale"?"favicon-stale":t==="errored"?"favicon-errored":"favicon"},handleDocumentKeyDown(t){if(t.repeat)return;let e=wO()?t.metaKey:t.ctrlKey,i=t.altKey,r=t.shiftKey,n=t.key,o=this.keyBuffer;if(!(Ko(t.target)&&t.target.closest("[data-el-outputs-container]"))){if(e&&r&&!i&&n==="Enter"){gn(t),this.queueFullCellsEvaluation(!0);return}else if(!e&&r&&!i&&n==="Enter"){gn(t),Ks(this.focusedCellType())&&this.queueFocusedCellEvaluation(),this.moveFocus(1);return}else if(e&&!i&&n==="Enter"){gn(t),Ks(this.focusedCellType())&&this.queueFocusedCellEvaluation();return}else if(e&&n==="s"){gn(t),this.saveNotebook();return}else if(e||i)return}this.insertMode?(o.reset(),!t.target.closest("[data-el-editor-container]")&&n==="Escape"&&this.escapeInsertMode()):Ko(t.target)?(o.reset(),n==="Escape"&&t.target.blur()):(o.push(t.key),o.tryMatch(["d","d"])?this.deleteFocusedCell():o.tryMatch(["e","a"])?this.queueFullCellsEvaluation(!1):o.tryMatch(["e","e"])?Ks(this.focusedCellType())&&this.queueFocusedCellEvaluation():o.tryMatch(["e","s"])?this.queueFocusedSectionEvaluation():o.tryMatch(["s","s"])?this.toggleSectionsList():o.tryMatch(["s","e"])?this.toggleSecretsList():o.tryMatch(["s","a"])?this.toggleAppInfo():o.tryMatch(["s","u"])?this.toggleClientsList():o.tryMatch(["s","f"])?this.toggleFilesList():o.tryMatch(["s","r"])?this.toggleRuntimeInfo():o.tryMatch(["s","b"])?this.showBin():o.tryMatch(["s","p"])?this.showPackageSearch():o.tryMatch(["e","x"])?this.cancelFocusedCellEvaluation():o.tryMatch(["0","0"])?this.reconnectRuntime():o.tryMatch(["Escape","Escape"])?this.setFocusedEl(null):o.tryMatch(["?"])?this.showShortcuts():o.tryMatch(["i"])||t.target.matches("body, [data-el-cell-body], [data-el-heading], [data-focusable-id]")&&this.focusedId&&n==="Enter"?(gn(t),this.isInsertModeAvailable()&&this.enterInsertMode()):o.tryMatch(["j"])?this.moveFocus(1):o.tryMatch(["k"])?this.moveFocus(-1):o.tryMatch(["J"])?this.moveFocusedCell(1):o.tryMatch(["K"])?this.moveFocusedCell(-1):o.tryMatch(["n"])?this.insertCellBelowFocused("code"):o.tryMatch(["N"])?this.insertCellAboveFocused("code"):o.tryMatch(["m"])?(!this.view||this.viewOptions.showMarkdown)&&this.insertCellBelowFocused("markdown"):o.tryMatch(["M"])?(!this.view||this.viewOptions.showMarkdown)&&this.insertCellAboveFocused("markdown"):o.tryMatch(["v","z"])?this.toggleView("code-zen"):o.tryMatch(["v","p"])?this.toggleView("presentation"):o.tryMatch(["v","c"])?this.toggleView("custom"):o.tryMatch(["c"])?(!this.view||this.viewOptions.showSection)&&this.toggleCollapseSection():o.tryMatch(["C"])&&(!this.view||this.viewOptions.showSection)&&this.toggleCollapseAllSections())},handleEditorEscape(){this.insertMode&&(this.keyBuffer.reset(),this.escapeInsertMode())},handleDocumentMouseDown(t){if(!t.target.closest("[data-el-notebook]")){this.insertMode&&this.setInsertMode(!1);return}if(t.target.closest(".cm-tooltip")){this.insertMode&&this.setInsertMode(!1);return}if(t.target.closest("[data-el-insert-buttons] button"))return;let e=t.target.closest("[data-focusable-id]"),i=e?e.dataset.focusableId:null,r=this.editableElementClicked(t,e);i!==this.focusedId&&this.setFocusedEl(i,{scroll:!1,focusElement:!1}),!t.target.closest("[data-el-actions]")&&this.insertMode!==r&&this.setInsertMode(r)},editableElementClicked(t,e){if(e){let i=t.target.closest("[data-el-editor-container], [data-el-heading]");return i&&e.contains(i)}return!1},handleDocumentFocus(t){let e=t.target.closest&&t.target.closest("[data-focusable-id]");if(e){let i=e.dataset.focusableId;i!==this.focusedId&&this.setFocusedEl(i,{scroll:!1,focusElement:!1})}},handleDocumentClick(t){t.target.closest("[data-el-enable-insert-mode-button]")&&this.setInsertMode(!0),t.target.closest("[data-btn-package-search]")&&this.insertMode&&this.setInsertMode(!1);let e=t.target.closest("[data-el-queue-cell-evaluation-button]");if(e){let r=e.getAttribute("data-cell-id"),n=e.hasAttribute("data-disable-dependencies-cache");this.queueCellEvaluation(r,n)}let i=window.location.hash;if(i){let r=i.replace(/^#/,"");!document.getElementById(r).contains(t.target)&&!t.target.closest("a")&&history.pushState(null,document.title,window.location.pathname+window.location.search)}},handleSectionsListClick(t){let e=t.target.closest("[data-el-sections-list-item]");if(e){let i=e.getAttribute("data-section-id");this.getSectionById(i).scrollIntoView({behavior:"smooth",block:"start"})}},handleClientsListClick(t){let e=t.target.closest("[data-el-clients-list-item]");if(e){let i=e.getAttribute("data-client-id");t.target.closest("[data-el-client-link]")&&this.handleClientLinkClick(i),t.target.closest("[data-el-client-follow-toggle]")&&this.handleClientFollowToggleClick(i,e)}},handleClientLinkClick(t){this.mirrorClientFocus(t)},handleClientFollowToggleClick(t,e){let i=this.el.querySelector("[data-el-clients-list-item][data-js-followed]");i&&i.removeAttribute("data-js-followed"),t===this.followedClientId?this.followedClientId=null:(e.setAttribute("data-js-followed",""),this.followedClientId=t,this.mirrorClientFocus(t))},mirrorClientFocus(t){let e=this.lastLocationReportByClientId[t];e&&e.focusableId&&this.setFocusedEl(e.focusableId)},handleCellIndicatorsClick(t){let e=t.target.closest("[data-el-focus-cell-button]");if(e){let i=e.getAttribute("data-target");this.setFocusedEl(i)}},initializeFocus(){let t=window.location.hash;if(t){let e=t.replace(/^#/,""),i=document.getElementById(e);if(i){let r=i.closest("[data-focusable-id]");r?this.setFocusedEl(r.dataset.focusableId):i.scrollIntoView()}}else this.props.autofocusCellId&&(this.setFocusedEl(this.props.autofocusCellId,{scroll:!1}),this.setInsertMode(!0))},updateSectionListHighlight(){let t=this.el.querySelector("[data-el-sections-list-item][data-js-is-viewed]");t&&t.removeAttribute("data-js-is-viewed");let e=this.getSections().reverse().find(i=>{let{top:r}=i.getBoundingClientRect(),n=document.documentElement.scrollTop;return r<=n+window.innerHeight*.35});if(e){let i=e.getAttribute("data-section-id");this.el.querySelector(`[data-el-sections-list-item][data-section-id="${i}"]`).setAttribute("data-js-is-viewed","")}},initializeDragAndDrop(){let t=!1,e=null,i=null,r=(o=null)=>{if(!t){t=!0,e=o;let s=o?"internal":"external";this.el.setAttribute("data-js-dragging",s),s==="external"&&this.toggleFilesList(!0)}},n=()=>{t&&(t=!1,this.el.removeAttribute("data-js-dragging"))};this.el.addEventListener("dragstart",o=>{r(o.target)}),this.el.addEventListener("dragenter",o=>{r()}),this.el.addEventListener("dragleave",o=>{eX()||this.el.contains(o.relatedTarget)||n()}),this.el.addEventListener("dragover",o=>{o.stopPropagation(),o.preventDefault()}),this.el.addEventListener("drop",o=>{o.stopPropagation(),o.preventDefault();let s=o.target.closest("[data-el-insert-drop-area]"),a=o.target.closest("[data-el-files-drop-area]");if(s){let l=s.getAttribute("data-section-id")||null,c=s.getAttribute("data-cell-id")||null;if(o.dataTransfer.files.length>0)i=o.dataTransfer.files,this.pushEvent("handle_file_drop",{section_id:l,cell_id:c});else if(e&&e.matches("[data-el-file-entry]")){let u=e.getAttribute("data-name");this.pushEvent("insert_file",{file_entry_name:u,section_id:l,cell_id:c})}}else a&&o.dataTransfer.files.length>0&&(i=o.dataTransfer.files,this.pushEvent("handle_file_drop",{}));n()}),this.handleEvent("finish_file_drop",o=>{let s=document.querySelector('#add-file-entry-modal input[type="file"]');s&&(s.files=i,s.dispatchEvent(new Event("change",{bubbles:!0})))})},toggleSectionsList(t=null){this.toggleSidePanelContent("sections-list",t)},toggleClientsList(t=null){this.toggleSidePanelContent("clients-list",t)},toggleSecretsList(t=null){this.toggleSidePanelContent("secrets-list",t)},toggleAppInfo(t=null){this.toggleSidePanelContent("app-info",t)},toggleFilesList(t=null){this.toggleSidePanelContent("files-list",t)},toggleRuntimeInfo(t=null){this.toggleSidePanelContent("runtime-info",t)},toggleSidePanelContent(t,e=null){(e===null?this.el.getAttribute("data-js-side-panel-content")!==t:e)?this.el.setAttribute("data-js-side-panel-content",t):this.el.removeAttribute("data-js-side-panel-content")},showBin(){let t=this.el.querySelector("[data-btn-show-bin]");t&&t.click()},showPackageSearch(){this.setFocusedEl("setup");let t=this.el.querySelector("[data-btn-package-search]");t&&t.click()},saveNotebook(){this.pushEvent("save",{})},deleteFocusedCell(){this.focusedId&&this.isCell(this.focusedId)&&this.pushEvent("delete_cell",{cell_id:this.focusedId})},queueCellEvaluation(t,e){this.dispatchQueueEvaluation(()=>{this.pushEvent("queue_cell_evaluation",{cell_id:t,disable_dependencies_cache:e})})},queueFocusedCellEvaluation(){this.focusedId&&this.isCell(this.focusedId)&&this.dispatchQueueEvaluation(()=>{this.pushEvent("queue_cell_evaluation",{cell_id:this.focusedId})})},queueFullCellsEvaluation(t){let e=t&&this.focusedId&&this.isCell(this.focusedId)?[this.focusedId]:[];this.dispatchQueueEvaluation(()=>{this.pushEvent("queue_full_evaluation",{forced_cell_ids:e})})},queueFocusedSectionEvaluation(){if(this.focusedId){let t=this.getSectionIdByFocusableId(this.focusedId);t&&this.dispatchQueueEvaluation(()=>{this.pushEvent("queue_section_evaluation",{section_id:t})})}},dispatchQueueEvaluation(t){Ks(this.focusedCellType())?Kt.broadcast(`cells:${this.focusedId}`,{type:"dispatch_queue_evaluation",dispatch:t}):t()},cancelFocusedCellEvaluation(){this.focusedId&&this.isCell(this.focusedId)&&this.pushEvent("cancel_cell_evaluation",{cell_id:this.focusedId})},reconnectRuntime(){this.pushEvent("reconnect_runtime",{})},showShortcuts(){let t=this.el.querySelector("[data-btn-show-shortcuts]");t&&t.click()},isInsertModeAvailable(){if(!this.focusedId)return!1;let t=this.getFocusableEl(this.focusedId);return!this.isCell(this.focusedId)||!t.hasAttribute("data-js-insert-mode-disabled")},enterInsertMode(){this.focusedId&&this.setInsertMode(!0)},escapeInsertMode(){this.setInsertMode(!1)},moveFocus(t){let e=this.nearbyFocusableId(this.focusedId,t);this.setFocusedEl(e)},moveFocusedCell(t){this.focusedId&&this.isCell(this.focusedId)&&this.pushEvent("move_cell",{cell_id:this.focusedId,offset:t})},insertCellBelowFocused(t){if(this.focusedId)this.insertCellBelowFocusableId(this.focusedId,t);else{let e=this.getFocusableIds();e.length>0&&this.insertCellBelowFocusableId(e[e.length-1],t)}},insertCellAboveFocused(t){if(this.focusedId){let e=this.nearbyFocusableId(this.focusedId,-1);this.insertCellBelowFocusableId(e,t)}else{let e=this.getFocusableIds();e.length>0&&this.insertCellBelowFocusableId(e[0],t)}},insertCellBelowFocusableId(t,e){if(this.isCell(t))this.pushEvent("insert_cell_below",{type:e,cell_id:t});else if(this.isSection(t))this.pushEvent("insert_cell_below",{type:e,section_id:t});else if(this.isNotebook(t)){let i=this.getSectionIds();i.length>0&&this.pushEvent("insert_cell_below",{type:e,section_id:i[0]})}},setFocusedEl(t,{scroll:e=!0,focusElement:i=!0}={}){if(this.focusedId=t,t?this.el.setAttribute("data-js-focused-id",t):this.el.removeAttribute("data-js-focused-id"),t){if(!this.isSection(t)){let n=this.getSectionIdByFocusableId(t);n&&this.getSectionById(n).removeAttribute("data-js-collapsed")}let r=this.getFocusableEl(t);i&&(r.querySelector("[data-el-cell-body]")||r.querySelector("[data-el-heading]")||r).focus({preventScroll:!0})}Kt.broadcast("navigation",{type:"element_focused",focusableId:t,scroll:e}),this.setInsertMode(!1),this.sendLocationReport({focusableId:t})},setInsertMode(t){this.insertMode=t,t?this.el.setAttribute("data-js-insert-mode",""):this.el.removeAttribute("data-js-insert-mode"),Kt.broadcast("navigation",{type:"insert_mode_changed",enabled:t})},handleViewsClick(t){let e=t.target.closest("[data-el-view-toggle]");if(e){let i=e.getAttribute("data-el-view-toggle");this.toggleView(i)}},toggleView(t){t===this.view?(this.unsetView(),t==="custom"&&this.customViewSettingsSubscription.destroy()):t==="code-zen"?this.setView(t,{showSection:!1,showMarkdown:!1,showOutput:!0,spotlight:!1}):t==="presentation"?this.setView(t,{showSection:!0,showMarkdown:!0,showOutput:!0,spotlight:!0}):t==="custom"&&(this.customViewSettingsSubscription=Et.getAndSubscribe(i=>{this.setView(t,{showSection:i.custom_view_show_section,showMarkdown:i.custom_view_show_markdown,showOutput:i.custom_view_show_output,spotlight:i.custom_view_spotlight})}),this.pushEvent("open_custom_view_settings"));let e=this.focusedId||this.nearbyFocusableId(null,0);if(e){let i=this.ensureVisibleFocusableEl(e);i!==this.focused&&this.setFocusedEl(i,{scroll:!1}),i&&this.getFocusableEl(i).scrollIntoView({block:"center"})}},setView(t,e){this.view=t,this.viewOptions=e,this.el.setAttribute("data-js-view",t),this.el.toggleAttribute("data-js-hide-section",!e.showSection),this.el.toggleAttribute("data-js-hide-markdown",!e.showMarkdown),this.el.toggleAttribute("data-js-hide-output",!e.showOutput),this.el.toggleAttribute("data-js-spotlight",e.spotlight)},unsetView(){this.view=null,this.viewOptions=null,this.el.removeAttribute("data-js-view"),this.el.removeAttribute("data-js-hide-section"),this.el.removeAttribute("data-js-hide-markdown"),this.el.removeAttribute("data-js-hide-output"),this.el.removeAttribute("data-js-spotlight")},toggleCollapseSection(){if(this.focusedId){let t=this.getSectionIdByFocusableId(this.focusedId);if(t){let e=this.getSectionById(t);e.hasAttribute("data-js-collapsed")?e.removeAttribute("data-js-collapsed"):(e.setAttribute("data-js-collapsed",""),this.setFocusedEl(t,{scroll:!0}))}}},toggleCollapseAllSections(){let t=this.getSections().every(e=>e.hasAttribute("data-js-collapsed"));if(this.getSections().forEach(e=>{e.toggleAttribute("data-js-collapsed",!t)}),this.focusedId){let e=this.getSectionIdByFocusableId(this.focusedId);e&&this.setFocusedEl(e,{scroll:!0})}},handleCellInserted(t){this.setFocusedEl(t),lX(this.focusedCellType())&&this.setInsertMode(!0)},handleCellDeleted(t,e){if(this.focusedId===t)if(this.view){let i=this.ensureVisibleFocusableEl(e);this.setFocusedEl(i)}else this.setFocusedEl(e)},handleCellRestored(t){this.setFocusedEl(t)},handleCellMoved(t){this.repositionJSViews(),this.focusedId===t&&Kt.broadcast("cells",{type:"cell_moved",cellId:t})},handleSectionInserted(t){let i=this.getSectionById(t).querySelector("[data-el-section-headline]"),{focusableId:r}=i.dataset;this.setFocusedEl(r),this.setInsertMode(!0),W$(document.activeElement)},handleSectionDeleted(t){this.focusedId&&!this.getFocusableEl(this.focusedId)&&this.setFocusedEl(null)},handleSectionMoved(t){this.repositionJSViews();let e=this.getSectionById(t);Hs(e)},handleClientJoined(t){let e=this.store.get("clients");this.store.set("clients",Ce(H({},e),{[t.id]:t}))},handleClientLeft(t){let e=this.store.get("clients"),i=e[t];if(i){let[,r]=CO(e,t);this.store.set("clients",r),i.id===this.followedClientId&&(this.followedClientId=null)}},handleClientsUpdated(t){let e=this.store.get("clients"),i=H({},e);for(let r of t)i[r.id]=r;this.store.set("clients",i)},handleSecretSelected(t,e){Kt.broadcast(`js_views:${t}`,{type:"secretSelected",secretName:e})},handleLocationReport(t,e){let i=this.store.get("clients")[t];this.lastLocationReportByClientId[t]=e,i&&i.id===this.followedClientId&&e.focusableId!==this.focusedId&&this.setFocusedEl(e.focusableId)},repositionJSViews(){Kt.broadcast("js_views",{type:"reposition"})},sendLocationReport(t){Object.keys(this.store.get("clients")).length>1&&this.pushEvent("location_report",{focusable_id:t.focusableId})},focusedCellType(){return this.focusedId&&this.isCell(this.focusedId)?this.getFocusableEl(this.focusedId).getAttribute("data-type"):null},nearbyFocusableId(t,e){let i=this.getFocusableIds();if(i.length===0)return null;let r=i.indexOf(t);if(r===-1){let n=this.getFocusableEls().find(Nv);return n?n.getAttribute("data-focusable-id"):i[0]}else{let n=j$(r+e,0,i.length-1);return i[n]}},ensureVisibleFocusableEl(t){let e=this.getFocusableEl(t),i=Array.from(this.el.querySelectorAll("[data-focusable-id]")),r=i.indexOf(e),n=[...i.slice(r,-1),...i.slice(0,r).reverse()].find(o=>!mn(o));return n&&n.getAttribute("data-focusable-id")},isCell(t){return this.getFocusableEl(t).hasAttribute("data-el-cell")},isSection(t){return this.getFocusableEl(t).hasAttribute("data-el-section-headline")},isNotebook(t){return this.getFocusableEl(t).hasAttribute("data-el-notebook-headline")},getFocusableEl(t){return this.el.querySelector(`[data-focusable-id="${t}"]`)},getFocusableEls(){return Array.from(this.el.querySelectorAll("[data-focusable-id]")).filter(t=>!mn(t))},getFocusableIds(){return this.getFocusableEls().map(t=>t.getAttribute("data-focusable-id"))},getSectionIdByFocusableId(t){let i=this.getFocusableEl(t).closest("[data-el-section]");return i&&i.getAttribute("data-section-id")},getSectionIds(){return this.getSections().map(e=>e.getAttribute("data-section-id"))},getSections(){return Array.from(this.el.querySelectorAll("[data-el-section]"))},getSectionById(t){return this.el.querySelector(`[data-el-section][data-section-id="${t}"]`)},getElement(t){return this.el.querySelector(`[data-el-${t}]`)}},cI=Wie;var Bie={mounted(){this.autosize(),this.el.addEventListener("input",t=>{this.autosize()})},updated(){this.autosize()},autosize(){this.el.style.height="0px",this.el.style.height=`${this.el.scrollHeight+2}px`}},uI=Bie;var Zie=100,Vie={mounted(){this.props=this.getProps(),this.interval=setInterval(()=>this.updateDOM(),Zie)},updated(){this.props=this.getProps(),this.updateDOM()},destroyed(){clearInterval(this.interval)},getProps(){return ht(this.el,["start"])},updateDOM(){let e=(Date.now()-new Date(this.props.start))/1e3;this.el.innerHTML=`${e.toFixed(1)}s`}},fI=Vie;var hI="lb_user_data";function dI(t){let e=JSON.stringify(t),i=Z$(e);Fie(hI,i,15768e4)}function pI(){let t=Yie(hI);if(t){let e=V$(t);return JSON.parse(e)}else return null}function Yie(t){let e=document.cookie.split("; ").find(i=>i.startsWith(`${t}=`));return e?e.replace(`${t}=`,""):null}function Fie(t,e,i){let r=`${t}=${e};max-age=${i};path=/${EO()}`;document.cookie=r}var Hie={mounted(){this.el.addEventListener("submit",t=>{let e=this.el.user_form_name.value,i=this.el.user_form_hex_color.value;dI({name:e,hex_color:i})})}},OI=Hie;var Gie={mounted(){this.props=this.getProps(),this.updateAttrs(),this.el.addEventListener("blur",t=>{let e=this.datetimeLocalToUtc(this.el.value);this.pushEventTo(this.props.phxTarget,"change",{html_value:e})})},updated(){this.props=this.getProps(),this.updateAttrs()},getProps(){return ht(this.el,["utc-value","utc-min","utc-max","phx-target"])},updateAttrs(){this.el.value=this.datetimeUtcToLocal(this.props.utcValue),this.el.min=this.datetimeUtcToLocal(this.props.utcMin),this.el.max=this.datetimeUtcToLocal(this.props.utcMax)},datetimeUtcToLocal(t){if(!t)return null;let e=new Date(t+"Z"),i=e.getFullYear().toString(),r=(e.getMonth()+1).toString().padStart(2,"0"),n=e.getDate().toString().padStart(2,"0"),o=e.getHours().toString().padStart(2,"0"),s=e.getMinutes().toString().padStart(2,"0"),a=e.getSeconds().toString().padStart(2,"0");return`${i}-${r}-${n}T${o}:${s}:${a}`},datetimeLocalToUtc(t){if(!t)return null;let e=new Date(t),i=e.getUTCFullYear().toString(),r=(e.getUTCMonth()+1).toString().padStart(2,"0"),n=e.getUTCDate().toString().padStart(2,"0"),o=e.getUTCHours().toString().padStart(2,"0"),s=e.getUTCMinutes().toString().padStart(2,"0"),a=e.getUTCSeconds().toString().padStart(2,"0");return`${i}-${r}-${n}T${o}:${s}:${a}`}},mI=Gie;var Kie={mounted(){this.props=this.getProps(),this.updateAttrs(),this.el.addEventListener("blur",t=>{let e=this.timeLocalToUtc(this.el.value);this.pushEventTo(this.props.phxTarget,"change",{html_value:e})})},updated(){this.props=this.getProps(),this.updateAttrs()},getProps(){return ht(this.el,["utc-value","utc-min","utc-max","phx-target"])},updateAttrs(){this.el.value=this.timeUtcToLocal(this.props.utcValue),this.el.min=this.timeUtcToLocal(this.props.utcMin),this.el.max=this.timeUtcToLocal(this.props.utcMax)},timeUtcToLocal(t){if(!t)return null;let e=new Date;e.setUTCHours(...t.split(":"));let i=e.getHours().toString().padStart(2,"0"),r=e.getMinutes().toString().padStart(2,"0"),n=e.getSeconds().toString().padStart(2,"0");return`${i}:${r}:${n}`},timeLocalToUtc(t){if(!t)return null;let e=new Date;e.setHours(...t.split(":"));let i=e.getUTCHours().toString().padStart(2,"0"),r=e.getUTCMinutes().toString().padStart(2,"0"),n=e.getUTCSeconds().toString().padStart(2,"0");return`${i}:${r}:${n}`}},gI=Kie;var xI=da(yI());var Jie={mounted(){this.props=this.getProps(),this.lineHeight=q$(this.el),this.templateEl=Gn(this.el,"[data-template]"),this.contentEl=Gn(this.el,"[data-content]"),this.capLines();let t=this.hyperListConfig();this.virtualizedList=new xI.default(this.contentEl,t),this.props.follow&&rf(this.contentEl)},updated(){this.props=this.getProps(),this.capLines();let t=this.props.follow&&B$(this.contentEl),e=this.hyperListConfig();this.virtualizedList.refresh(this.contentEl,e),t&&rf(this.contentEl)},getProps(){return ht(this.el,["max-height","follow","max-lines","ignore-trailing-empty-line"])},hyperListConfig(){let t=this.getLineElements(),e=t.length,i=Math.min(this.props.maxHeight,this.lineHeight*e);return{height:i,total:e,itemHeight:this.lineHeight,generate:r=>{let n=t[r].cloneNode(!0);return n.removeAttribute("id"),n},afterRender:()=>{this.contentEl.scrollWidth>this.contentEl.clientWidth?this.contentEl.style.height=`${i+12}px`:this.contentEl.style.height=`${i}px`}}},getLineElements(){let t=Array.from(this.templateEl.querySelectorAll("[data-line]"));if(t.length===0)return[];let e=t[t.length-1];return this.props.ignoreTrailingEmptyLine&&e.innerText===""?t.slice(0,-1):t},capLines(){if(this.props.maxLines){let e=Array.from(this.templateEl.querySelectorAll("[data-line]")).slice(0,-this.props.maxLines),[i,...r]=e;r.forEach(n=>n.remove()),i&&(i.innerHTML="...")}}},vI=Jie;var ere={mounted(){let t=Et.get(),e=this.el.querySelector('[name="show_section"][value="true"]'),i=this.el.querySelector('[name="show_markdown"][value="true"]'),r=this.el.querySelector('[name="show_output"][value="true"]'),n=this.el.querySelector('[name="spotlight"][value="true"]');e.checked=t.custom_view_show_section,i.checked=t.custom_view_show_markdown,r.checked=t.custom_view_show_output,n.checked=t.custom_view_spotlight,e.addEventListener("change",o=>{Et.update({custom_view_show_section:o.target.checked})}),i.addEventListener("change",o=>{Et.update({custom_view_show_markdown:o.target.checked})}),r.addEventListener("change",o=>{Et.update({custom_view_show_output:o.target.checked})}),n.addEventListener("change",o=>{Et.update({custom_view_spotlight:o.target.checked})})}},wI=ere;var kI={AppAuth:nS,AudioInput:lS,Cell:cX,CellEditor:sR,Dropzone:aR,EditorSettings:lR,EmojiPicker:VR,FocusOnUpdate:YR,Headline:HR,Highlight:GR,ImageInput:KR,ImageOutput:JR,JSView:oI,KeyboardControl:sI,MarkdownRenderer:aI,ScrollOnUpdate:lI,Session:cI,TextareaAutosize:uI,Timer:fI,UserForm:OI,UtcDateTimeInput:mI,UtcTimeInput:gI,VirtualizedLines:vI,CustomViewSettings:wI};var SI={onBeforeElUpdated(t,e){for(let i of t.attributes)i.name.startsWith("data-js-")&&e.setAttribute(i.name,i.value),i.name==="data-keep-attribute"&&(t.hasAttribute(i.value)?e.setAttribute(i.value,t.getAttribute(i.value)):e.removeAttribute(i.value))},onNodeAdded(t){if(t.nodeType===Node.ELEMENT_NODE&&t.hasAttribute("autofocus")&&(t.focus(),t.setSelectionRange&&t.value)){let e=t.value.length;t.setSelectionRange(e,e)}}};var Nm=da(EI());function CI(){Nm.default.config({barColors:{0:"#b2c1ff"},shadowColor:"rgba(0, 0, 0, .3)"}),window.addEventListener("phx:page-loading-start",()=>{Nm.default.show(500)}),window.addEventListener("phx:page-loading-stop",()=>{Nm.default.hide()})}function _I(){window.addEventListener("lb:focus",t=>{requestAnimationFrame(()=>{t.target.focus()})}),window.addEventListener("lb:set_value",t=>{t.target.value=t.detail.value}),window.addEventListener("lb:check",t=>{t.target.checked=!0}),window.addEventListener("lb:uncheck",t=>{t.target.checked=!1}),window.addEventListener("lb:set_text",t=>{t.target.textContent=t.detail.value}),window.addEventListener("lb:clipcopy",t=>{"clipboard"in navigator?t.detail.content?navigator.clipboard.writeText(t.detail.content):t.target.tagName==="INPUT"?navigator.clipboard.writeText(t.target.value):navigator.clipboard.writeText(t.target.textContent):alert(`Sorry, your browser does not support clipboard copy. -This generally requires a secure origin \u2014 either HTTPS or localhost.`)}),window.addEventListener("lb:scroll_into_view",t=>{z$(t.target).then(()=>{QO(t.target,{scrollMode:"if-needed",behavior:"smooth",block:"nearest",inline:"nearest"})})}),window.addEventListener("phx:lb:exec_js",t=>{let e=t.detail.to||"body";document.querySelectorAll(e).forEach(i=>{window.liveSocket.execJS(i,t.detail.js)})}),window.addEventListener("lb:session_list:on_selection_change",()=>{let t=!!document.querySelector("[name='session_ids[]']:checked"),e=document.querySelector("#edit-sessions [name='disconnect']"),i=document.querySelector("#edit-sessions [name='close_all']");e.parentElement.classList.toggle("pointer-events-none",!t),e.parentElement.classList.toggle("opacity-50",!t),i.parentElement.classList.toggle("pointer-events-none",!t),i.parentElement.classList.toggle("opacity-50",!t)}),window.addEventListener("contextmenu",t=>{let e=t.target.closest("[data-contextmenu-trigger-click]");e&&(t.preventDefault(),e.dispatchEvent(new Event("mousedown",{bubbles:!0})),e.dispatchEvent(new Event("click",{bubbles:!0})))}),window.addEventListener("submit",t=>{t.target.hasAttribute("phx-nosubmit")&&(t.preventDefault(),t.stopPropagation())},{capture:!0})}function PI(){let t=/AppleWebKit/.test(navigator.userAgent),e="ontouchstart"in window||navigator.maxTouchPoints>0;if(t&&e){let i=document.querySelector("meta[name='viewport']");i&&(i.content+=", maximum-scale=1.0")}}var U2="confirm-opted-out-ids";function QI(){return cs(U2)||[]}function AI(){window.addEventListener("phx:add_confirm_opt_out_id",t=>{let e=cs(U2)||[],i=t.detail.opt_out_id;e.push(i),ka(U2,e)})}function tre(){let t=document.querySelector("meta[name='csrf-token']").getAttribute("content"),e=new Jk(window.LIVEBOOK_BASE_URL_PATH+"/live",Jf,{params:i=>({_csrf_token:t,user_data:pI(),app_auth_token:rS(),confirm_opt_out_ids:QI()}),hooks:kI,dom:SI});CI(),_I(),AI(),PI(),Et.getAndSubscribe(i=>{document.body.setAttribute("data-editor-theme",i.editor_theme)}),e.connect(),window.liveSocket=e}if(ire())tre();else{let t=document.createElement("div");t.innerHTML=` +`," ");document.execCommand("insertText",!1,i)}),this.headingEl.addEventListener("keydown",e=>{e.key==="Enter"&&e.preventDefault()}),this.headingEl.addEventListener("blur",e=>{setTimeout(()=>{this.isFocused&&this.insertMode&&(this.headingEl.focus(),FR(this.headingEl))},0)}))},handleNavigationEvent(t){t.type==="element_focused"?this.handleElementFocused(t.focusableId,t.scroll):t.type==="insert_mode_changed"&&this.handleInsertModeChanged(t.enabled)},handleElementFocused(t,e){this.props.id===t?(this.isFocused=!0,this.el.setAttribute("data-js-focused",""),e&&Hs(this.el)):this.isFocused&&(this.isFocused=!1,this.el.removeAttribute("data-js-focused"))},handleInsertModeChanged(t){this.isFocused&&!this.insertMode&&t?(this.insertMode=t,this.el.setAttribute("phx-update","ignore"),this.headingEl.setAttribute("contenteditable",""),this.headingEl.focus(),FR(this.headingEl)):this.insertMode&&!t&&(this.insertMode=t,this.headingEl.removeAttribute("contenteditable"),this.el.removeAttribute("phx-update"),this.pushEvent(this.props.onValueChange,{value:this.headingEl.textContent.trim(),metadata:this.props.metadata}))}};function FR(t){let e=document.createRange();e.selectNodeContents(t),e.collapse(!1);let i=window.getSelection();i.removeAllRanges(),i.addRange(e)}var HR=_ie;var Pie={mounted(){this.props=this.getProps(),this.sourceEl=Gn(this.el,"[data-source]"),this.targetEl=Gn(this.el,"[data-target]"),this.updateDOM()},updated(){this.props=this.getProps(),this.updateDOM()},getProps(){return ht(this.el,["language"])},updateDOM(){let t=this.sourceEl.innerText,e=_O(t,this.props.language);this.targetEl.innerHTML=e,this.el.setAttribute("data-highlighted","")}},GR=Pie;var I2=["bg-yellow-100","border-yellow-300"],Qie={mounted(){this.props=this.getProps(),this.inputEl=this.el.querySelector("[data-input]"),this.previewEl=this.el.querySelector("[data-preview]"),this.initialPreviewContentEl=this.previewEl.firstElementChild,this.cameraPreviewEl=this.el.querySelector("[data-camera-preview]"),this.cameraListEl=this.el.querySelector("[data-camera-list]"),this.cameraItemTemplateEl=this.cameraListEl.firstElementChild,this.cameraItemTemplateEl.remove(),this.uploadButton=this.el.querySelector("[data-btn-upload]"),this.openCameraButton=this.el.querySelector("[data-btn-open-camera]"),this.captureCameraButton=this.el.querySelector("[data-btn-capture-camera]"),this.cancelButton=this.el.querySelector("[data-btn-cancel]"),this.cameraListPopulated=!1,this.cameraVideoEl=null,this.cameraStream=null,this.updateImagePreview(),this.uploadButton.addEventListener("click",t=>{this.inputEl.click()}),this.inputEl.addEventListener("change",t=>{let[e]=t.target.files;e&&this.loadFile(e)}),this.el.addEventListener("dragover",t=>{t.stopPropagation(),t.preventDefault(),t.dataTransfer.dropEffect="copy"}),this.el.addEventListener("drop",t=>{t.stopPropagation(),t.preventDefault();let[e]=t.dataTransfer.files;e&&this.loadFile(e),this.closeCameraView()}),this.el.addEventListener("dragenter",t=>{this.el.classList.add(...I2)}),this.el.addEventListener("dragleave",t=>{this.el.contains(t.relatedTarget)||this.el.classList.remove(...I2)}),this.el.addEventListener("drop",t=>{this.el.classList.remove(...I2)}),this.openCameraButton.addEventListener("click",t=>{this.cameraListPopulated||(this.renderCameraList(),this.cameraListPopulated=!0)}),this.cameraListEl.addEventListener("click",t=>{let e=t.target.closest("[data-camera-id]");if(e){let i=e.dataset.cameraId;this.openCameraView(i)}}),this.captureCameraButton.addEventListener("click",t=>{let e=this.toCanvas(this.cameraVideoEl,this.cameraVideoEl.videoWidth,this.cameraVideoEl.videoHeight);this.pushImage(e),this.closeCameraView()}),this.cancelButton.addEventListener("click",t=>{this.closeCameraView()})},updated(){this.props=this.getProps(),this.updateImagePreview()},getProps(){return ht(this.el,["id","phx-target","height","width","format","fit","image-url","value-height","value-width"])},updateImagePreview(){this.props.imageUrl?Xie(this.props.imageUrl,this.props.valueHeight,this.props.valueWidth,this.props.format).then(t=>{this.setPreview(t)}):this.setPreview(this.initialPreviewContentEl)},loadFile(t){let e=new FileReader;e.onload=i=>{let r=document.createElement("img");r.addEventListener("load",n=>{let o=this.toCanvas(r,r.width,r.height);this.pushImage(o)}),r.src=i.target.result},e.readAsDataURL(t)},openCameraView(t){this.cameraPreviewEl.classList.remove("hidden"),this.cancelButton.classList.remove("hidden"),this.captureCameraButton.classList.remove("hidden"),this.previewEl.classList.add("hidden"),this.openCameraButton.classList.add("hidden"),this.uploadButton.classList.add("hidden"),navigator.mediaDevices.getUserMedia(this.cameraConstraints(t)).then(e=>{this.cameraStream=e,this.cameraVideoEl=document.createElement("video"),this.cameraVideoEl.autoplay=!0,this.cameraVideoEl.playsinline=!0,this.cameraVideoEl.muted=!0,this.cameraVideoEl.srcObject=e,this.setCameraPreview(this.cameraVideoEl)}).catch(()=>{})},cameraConstraints(t){return t==="system_default"?{audio:!1,video:!0}:{audio:!1,video:{deviceId:t}}},renderCameraList(){navigator.mediaDevices.getUserMedia({audio:!1,video:!0}).then(t=>navigator.mediaDevices.enumerateDevices().then(e=>(this.stopMediaStream(t),e))).then(t=>{let e=t.filter(i=>i.kind==="videoinput").map(i=>({deviceId:i.deviceId,label:i.label}));[{deviceId:"system_default",label:"System Default"},...e].forEach(({deviceId:i,label:r})=>{let n=this.cameraItemTemplateEl.cloneNode(!0);n.querySelector("[data-camera-id]").setAttribute("data-camera-id",i),n.querySelector("[data-label]").innerHTML=r,this.cameraListEl.appendChild(n)})}).catch(t=>{console.error(t),this.openCameraButton.disabled=!0})},closeCameraView(){return this.cameraStream!==null&&(this.stopMediaStream(this.cameraStream),this.cameraStream=null),this.cameraVideoEl!==null&&(this.cameraVideoEl.remove(),this.cameraVideoEl=null),this.cameraPreviewEl.classList.add("hidden"),this.cancelButton.classList.add("hidden"),this.captureCameraButton.classList.add("hidden"),this.previewEl.classList.remove("hidden"),this.openCameraButton.classList.remove("hidden"),this.uploadButton.classList.remove("hidden"),!0},stopMediaStream(t){t.getTracks().forEach(e=>{e.stop()})},pushImage(t){Aie(t,this.props.format).then(e=>{let i={height:t.height,width:t.width},r=new Blob([e]);r.meta=()=>i,this.uploadTo(this.props.phxTarget,"file",[r])})},toCanvas(t,e,i){let{width:r,height:n}=this.props,o=document.createElement("canvas"),s=o.getContext("2d");if(r===null&&n===null||r===e&&n===i)o.width=e,o.height=i,o.getContext("2d").drawImage(t,0,0,e,i,0,0,e,i);else if(this.props.fit==="contain"){let a=r/e,l=n/i,c=Math.min(a,l),u=Math.round(e*c),f=Math.round(i*c);o.width=u,o.height=f,s.drawImage(t,0,0,e,i,0,0,u,f)}else if(this.props.fit==="crop"){let a=r/e,l=n/i,c=Math.max(a,l),u=Math.round(e*c),f=Math.round(i*c);o.width=r,o.height=n,s.drawImage(t,Math.round((u-r)/c/2),Math.round((f-n)/c/2),e-Math.round((u-r)/c),i-Math.round((f-n)/c),0,0,r,n)}else if(this.props.fit==="pad"){let a=r/e,l=n/i,c=Math.min(a,l),u=Math.round(e*c),f=Math.round(i*c);o.width=r,o.height=n,s.fillStyle="black",s.fillRect(0,0,o.width,o.height),s.drawImage(t,0,0,e,i,Math.round((r-u)/2),Math.round((n-f)/2),u,f)}else o.width=r,o.height=n,s.drawImage(t,0,0,e,i,0,0,r,n);return o},setPreview(t){t.style.maxHeight="300px",t.style.maxWidth="100%",this.previewEl.replaceChildren(t)},setCameraPreview(t){t.style.maxHeight="300px",t.style.maxWidth="100%",this.cameraPreviewEl.replaceChildren(t)}};function Aie(t,e){if(e==="png"||e==="jpeg")return new Promise((i,r)=>{t.toBlob(n=>{n.arrayBuffer().then(o=>{i(o)})},`image/${e}`)});if(e==="rgb"){let i=t.getContext("2d").getImageData(0,0,t.width,t.height),r=$ie(i);return Promise.resolve(r)}throw new Error(`Unexpected format: ${e}`)}function $ie(t){let e=t.width*t.height,i=new Uint8ClampedArray(e*3);for(let r=0;rn.arrayBuffer()).then(n=>{let o=document.createElement("canvas");o.height=e,o.width=i;let s=Rie(n,i,e);return o.getContext("2d").putImageData(s,0,0),o});throw new Error(`Unexpected format: ${r}`)}function Rie(t,e,i){let r=e*i,n=new Uint8Array(t),o=new Uint8ClampedArray(r*4);for(let s=0;s{t.sandbox="allow-scripts allow-same-origin allow-downloads allow-forms allow-modals allow-popups allow-top-navigation",t.allow="accelerometer; ambient-light-sensor; camera; display-capture; encrypted-media; fullscreen; geolocation; gyroscope; microphone; midi; usb; xr-spatial-tracking; clipboard-read; clipboard-write; bluetooth; serial",t.src=r})}function Nie(t,e){let i=window.location.protocol;return e?e.replace(/^https?:/,i):i==="https:"?"https://livebookusercontent.com/iframe/v5.html":`http://${window.location.hostname}:${t}/iframe/v5.html`}var N2=null;function Mie(t){return N2||(N2=fetch(t).then(e=>e.text()).then(e=>{if(G$(e)!==rI)throw new Error(`The iframe loaded from ${t} doesn't have the expected checksum ${rI}`)})),N2}var Uie={mounted(){this.props=this.getProps(),this.id=Y$(),this.childToken=F$(),this.childReadyPromise=null,this.childReady=!1,this.initReceived=!1,this.syncCallbackQueue=[],this.pongCallbackQueue=[],this.initTimeout=setTimeout(()=>this.handleInitTimeout(),2e3),this.channel=eI(this.props.sessionToken),this.iframeActions=this.createIframe(),this.childReadyPromise=new Promise((n,o)=>{this._handleWindowMessage=s=>{s.source===this.iframe.contentWindow&&this.handleChildMessage(s.data,n)},window.addEventListener("message",this._handleWindowMessage)}),this.hiddenInput=document.createElement("input"),this.hiddenInput.style.display="none",this.el.appendChild(this.hiddenInput),this.iframeActions.visibilityPromise.then(()=>{this.loadIframe()});let t=this.channel.on(`init:${this.props.ref}:${this.id}`,n=>{let[,o]=D2(n);this.handleServerInit(o)}),e=this.channel.on(`event:${this.props.ref}`,n=>{let[[o],s]=D2(n);this.handleServerEvent(o,s)}),i=this.channel.on(`error:${this.props.ref}`,({message:n,init:o})=>{this.handleServerError(n,o)}),r=this.channel.on(`pong:${this.props.ref}`,()=>{this.handleServerPong()});this.unsubscribeFromChannelEvents=()=>{this.channel.off(`init:${this.props.ref}:${this.id}`,t),this.channel.off(`event:${this.props.ref}`,e),this.channel.off(`error:${this.props.ref}`,i),this.channel.off(`pong:${this.props.ref}`,r)},this.subscriptions=[Kt.subscribe(`js_views:${this.props.ref}`,this.handleJSViewEvent.bind(this)),Kt.subscribe("navigation",this.handleNavigationEvent.bind(this))],this.channel.push("connect",{connect_token:this.props.connectToken,ref:this.props.ref,id:this.id},3e4)},updated(){this.props=this.getProps(this)},disconnected(){this.el.removeAttribute("id")},destroyed(){window.removeEventListener("message",this._handleWindowMessage),this.iframeActions.remove(),this.unsubscribeFromChannelEvents(),this.channel.push("disconnect",{ref:this.props.ref}),this.subscriptions.forEach(t=>t.destroy())},getProps(){return ht(this.el,["ref","assets-base-path","assets-cdn-url","js-path","session-token","connect-token","iframe-port","iframe-url","timeout-message"])},createIframe(){this.iframePlaceholder=document.createElement("div"),this.el.appendChild(this.iframePlaceholder),this.iframe=document.createElement("iframe"),this.iframe.className="w-full h-0 absolute z-[1]";let t=document.querySelector("[data-el-notebook]"),e=t.querySelector("[data-el-notebook-content]"),i=new ResizeObserver(l=>{this.repositionIframe()});i.observe(e),i.observe(t);let r=mn(this.iframePlaceholder),n=new ResizeObserver(l=>{let c=mn(this.iframePlaceholder);r!==c&&(r=c,this.repositionIframe())});n.observe(this.iframePlaceholder);let o=Kt.subscribe("js_views",l=>{l.type==="reposition"&&this.repositionIframe()});this.iframe.addEventListener("mouseenter",l=>{this.iframePlaceholder.dispatchEvent(new MouseEvent("mouseenter",{bubbles:!0}))}),this.iframe.addEventListener("mouseleave",l=>{this.iframePlaceholder.dispatchEvent(new MouseEvent("mouseleave",{bubbles:!0}))});let s=kO(this.iframePlaceholder,{root:t,proximity:2e3});this.iframe.toggleAttribute("data-js-focused",!!this.el.closest("[data-js-focused]"));let a=()=>{i.disconnect(),n.disconnect(),o.destroy(),s.cancel(),this.iframe.remove(),this.iframePlaceholder.remove()};return{visibilityPromise:s.promise,remove:a}},repositionIframe(){let{iframe:t,iframePlaceholder:e}=this,i=document.querySelector("[data-el-notebook]");if(mn(e))t.classList.add("hidden");else{t.classList.remove("hidden");let r=i.getBoundingClientRect(),n=e.getBoundingClientRect(),o=n.top-r.top+i.scrollTop;t.style.top=`${o}px`;let s=n.left-r.left+i.scrollLeft;t.style.left=`${s}px`,t.style.height=`${n.height}px`,t.style.width=`${n.width}px`}},loadIframe(){let t=document.querySelector("[data-el-js-view-iframes]");nI(this.iframe,this.props.iframePort,this.props.iframeUrl).then(()=>{t.appendChild(this.iframe)})},handleChildMessage(t,e){if(t.type==="ready"&&!this.childReady)this.getAssetsBaseUrl().then(i=>{this.postMessage({type:"readyReply",token:this.childToken,baseUrl:i,jsPath:this.props.jsPath}),this.childReady=!0,e()});else{if(t.token!==this.childToken)throw new Error("Token mismatch");if(t.type==="resize")this.iframePlaceholder.style.height=`${t.height}px`,this.iframe.style.height=`${t.height}px`;else if(t.type==="domEvent"){let i=this.replicateDomEvent(t.event);t.isTargetEditable?this.hiddenInput.dispatchEvent(i):this.el.dispatchEvent(i)}else if(t.type==="event"){let{event:i,payload:r}=t,n=iI([i,this.props.ref],r);this.channel.push("event",n)}else t.type==="syncReply"?(this.pongCallbackQueue.push(this.syncCallbackQueue.shift()),this.channel.push("ping",{ref:this.props.ref})):t.type==="selectSecret"&&this.pushEvent("select_secret",{js_view_ref:this.props.ref,preselect_name:t.preselectName,options:t.options})}},getAssetsBaseUrl(){return Lm().then(t=>!t&&this.props.assetsCdnUrl?this.props.assetsCdnUrl:window.location.origin+this.props.assetsBasePath)},postMessage(t){this.iframe.contentWindow.postMessage(t,"*")},replicateDomEvent(t){if(t.type==="focus")return new FocusEvent("focus");if(t.type==="mousedown")return new MouseEvent("mousedown",{bubbles:!0});if(t.type==="keydown")return new KeyboardEvent(t.type,t.props)},handleInitTimeout(){this.initTimeoutContainer=document.createElement("div"),this.initTimeoutContainer.classList.add("info-box"),this.el.prepend(this.initTimeoutContainer),this.initTimeoutContainer.textContent=this.props.timeoutMessage},clearInitTimeout(){clearTimeout(this.initTimeout),this.initTimeoutContainer&&this.initTimeoutContainer.remove()},handleServerInit(t){this.clearInitTimeout(),this.initReceived=!0,this.childReadyPromise.then(()=>{this.postMessage({type:"init",data:t})})},handleServerEvent(t,e){this.initReceived&&this.childReadyPromise.then(()=>{this.postMessage({type:"event",event:t,payload:e})})},handleServerError(t,e){e&&this.clearInitTimeout(),this.errorContainer||(this.errorContainer=document.createElement("div"),this.errorContainer.classList.add("error-box","mb-4"),this.el.prepend(this.errorContainer)),this.errorContainer.textContent=t},handleServerPong(){this.pongCallbackQueue.shift()()},handleJSViewEvent(t){t.type==="sync"?(this.syncCallbackQueue.push(t.callback),this.postMessage({type:"sync"})):t.type=="secretSelected"&&this.postMessage({type:"secretSelected",secretName:t.secretName})},handleNavigationEvent(t){if(t.type==="element_focused"){let e=this.el.closest("[data-focusable-id]"),i=e?e.dataset.focusableId:null;this.iframe.toggleAttribute("data-js-focused",i===t.focusableId)}}};function Lm(){return Lm.promise=Lm.promise||fetch("/public/health").then(t=>t.status===200).catch(t=>!1),Lm.promise}var oI=Uie;var zie={mounted(){this.props=this.getProps(),this._handleDocumentKeyDown=this.handleDocumentKeyDown.bind(this),this._handleDocumentKeyUp=this.handleDocumentKeyUp.bind(this),this._handleDocumentFocus=this.handleDocumentFocus.bind(this),window.addEventListener("keydown",this._handleDocumentKeyDown,!0),window.addEventListener("keyup",this._handleDocumentKeyUp,!0),window.addEventListener("focus",this._handleDocumentFocus,!0)},updated(){this.props=this.getProps()},destroyed(){window.removeEventListener("keydown",this._handleDocumentKeyDown,!0),window.removeEventListener("keyup",this._handleDocumentKeyUp,!0),window.removeEventListener("focus",this._handleDocumentFocus,!0)},getProps(){return ht(this.el,["cell-id","default-handlers","keydown-enabled","keyup-enabled","target"])},handleDocumentKeyDown(t){if(this.isKeyboardToggle(t)&&!Ko(document.activeElement)){gn(t),this.keyboardEnabled()?this.disableKeyboard():this.enableKeyboard();return}if(this.keyboardEnabled()){if(this.props.defaultHandlers!=="on"&&gn(t),t.repeat)return;if(this.props.keydownEnabled){let{key:e}=t;this.pushEventTo(this.props.target,"keydown",{key:e})}}},handleDocumentKeyUp(t){if(this.keyboardEnabled()&&(this.props.defaultHandlers!=="on"&&gn(t),this.props.keyupEnabled)){let{key:e}=t;this.pushEventTo(this.props.target,"keyup",{key:e})}},handleDocumentFocus(t){this.props.keydownEnabled&&Ko(t.target)&&this.disableKeyboard()},enableKeyboard(){this.keyboardEnabled()||this.pushEventTo(this.props.target,"enable_keyboard",{})},disableKeyboard(){this.keyboardEnabled()&&this.pushEventTo(this.props.target,"disable_keyboard",{})},keyboardEnabled(){return this.props.keydownEnabled||this.props.keyupEnabled},isKeyboardToggle(t){if(t.repeat)return!1;let{metaKey:e,ctrlKey:i,key:r}=t;return(wO()?e:i)&&r==="k"&&this.isCellFocused()?!this.keyboardEnabled()||["on","disable_only"].includes(this.props.defaultHandlers):!1},isCellFocused(){let t=this.el.closest("[data-el-session]");return t&&t.getAttribute("data-js-focused-id")===this.props.cellId}},sI=zie;var jie={mounted(){this.props=this.getProps(),this.templateEl=Gn(this.el,"[data-template]"),this.contentEl=Gn(this.el,"[data-content]"),this.markdown=new Gs(this.contentEl,this.templateEl.textContent,{baseUrl:this.props.basePath,allowedUriSchemes:this.props.allowedUriSchemes})},updated(){this.props=this.getProps(),this.markdown.setContent(this.templateEl.textContent)},getProps(){return ht(this.el,["base-path","allowed-uri-schemes"])}},aI=jie;var qie={mounted(){this.scroll()},updated(){this.scroll()},scroll(){rf(this.el)}},lI=qie;var Bf=class{constructor(e=2e3){this.resetTimeout=e,this.buffer=[],this.resetTimeoutId=null}push(e){this.buffer.push(e),this.resetTimeoutId&&clearTimeout(this.resetTimeoutId),this.resetTimeoutId=setTimeout(()=>{this.reset()},this.resetTimeout)}reset(){this.resetTimeoutId&&clearTimeout(this.resetTimeoutId),this.resetTimeoutId=null,this.buffer=[]}tryMatch(e){if(e.length>this.buffer.length)return!1;let i=this.buffer.slice(-e.length),r=e.every((n,o)=>n===i[o]);return r&&this.reset(),r}};var Wie={mounted(){this.props=this.getProps(),this.focusedId=null,this.insertMode=!1,this.view=null,this.viewOptions=null,this.keyBuffer=new Bf,this.lastLocationReportByClientId={},this.followedClientId=null,this.store=Ll.create("session"),TO(this.faviconForEvaluationStatus(this.props.globalStatus)),this.updateSectionListHighlight(),this._handleDocumentKeyDown=this.handleDocumentKeyDown.bind(this),this._handleEditorEscape=this.handleEditorEscape.bind(this),this._handleDocumentMouseDown=this.handleDocumentMouseDown.bind(this),this._handleDocumentFocus=this.handleDocumentFocus.bind(this),this._handleDocumentClick=this.handleDocumentClick.bind(this),document.addEventListener("keydown",this._handleDocumentKeyDown,!0),document.addEventListener("lb:editor_escape",this._handleEditorEscape),document.addEventListener("mousedown",this._handleDocumentMouseDown),document.addEventListener("focus",this._handleDocumentFocus,!0),document.addEventListener("click",this._handleDocumentClick),this.getElement("sections-list").addEventListener("click",t=>{this.handleSectionsListClick(t),this.handleCellIndicatorsClick(t)}),this.getElement("clients-list").addEventListener("click",t=>this.handleClientsListClick(t)),this.getElement("sections-list-toggle").addEventListener("click",t=>this.toggleSectionsList()),this.getElement("clients-list-toggle").addEventListener("click",t=>this.toggleClientsList()),this.getElement("secrets-list-toggle").addEventListener("click",t=>this.toggleSecretsList()),this.getElement("runtime-info-toggle").addEventListener("click",t=>this.toggleRuntimeInfo()),this.getElement("app-info-toggle").addEventListener("click",t=>this.toggleAppInfo()),this.getElement("files-list-toggle").addEventListener("click",t=>this.toggleFilesList()),this.getElement("notebook").addEventListener("scroll",t=>this.updateSectionListHighlight()),this.getElement("notebook-indicators").addEventListener("click",t=>this.handleCellIndicatorsClick(t)),this.getElement("views").addEventListener("click",t=>{this.handleViewsClick(t)}),this.getElement("section-toggle-collapse-all-button").addEventListener("click",t=>this.toggleCollapseAllSections()),this.initializeDragAndDrop(),window.addEventListener("phx:page-loading-stop",()=>{this.initializeFocus()},{once:!0}),this.handleEvent("session_init",({clients:t,client_id:e})=>{let i={};for(let r of t)i[r.id]=r;this.store.set("clients",i),this.store.set("clientId",e)}),this.handleEvent("cell_inserted",({cell_id:t})=>{this.handleCellInserted(t)}),this.handleEvent("cell_deleted",({cell_id:t,sibling_cell_id:e})=>{this.handleCellDeleted(t,e)}),this.handleEvent("cell_restored",({cell_id:t})=>{this.handleCellRestored(t)}),this.handleEvent("cell_moved",({cell_id:t})=>{this.handleCellMoved(t)}),this.handleEvent("section_inserted",({section_id:t})=>{this.handleSectionInserted(t)}),this.handleEvent("section_deleted",({section_id:t})=>{this.handleSectionDeleted(t)}),this.handleEvent("section_moved",({section_id:t})=>{this.handleSectionMoved(t)}),this.handleEvent("client_joined",({client:t})=>{this.handleClientJoined(t)}),this.handleEvent("client_left",({client_id:t})=>{this.handleClientLeft(t)}),this.handleEvent("clients_updated",({clients:t})=>{this.handleClientsUpdated(t)}),this.handleEvent("secret_selected",({select_secret_ref:t,secret_name:e})=>{this.handleSecretSelected(t,e)}),this.handleEvent("location_report",({client_id:t,focusable_id:e})=>{let i={focusableId:e};this.handleLocationReport(t,i)})},updated(){let t=this.props;this.props=this.getProps(),this.props.globalStatus!==t.globalStatus&&TO(this.faviconForEvaluationStatus(this.props.globalStatus))},disconnected(){this.el.removeAttribute("id"),this.keepChannel=!0},destroyed(){document.removeEventListener("keydown",this._handleDocumentKeyDown,!0),document.removeEventListener("lb:editor_scape",this._handleEditorEscape),document.removeEventListener("mousedown",this._handleDocumentMouseDown),document.removeEventListener("focus",this._handleDocumentFocus,!0),document.removeEventListener("click",this._handleDocumentClick),TO("favicon"),this.keepChannel||tI(),this.store.destroy()},getProps(){return ht(this.el,["autofocus-cell-id","global-status"])},faviconForEvaluationStatus(t){return t==="evaluating"?"favicon-evaluating":t==="stale"?"favicon-stale":t==="errored"?"favicon-errored":"favicon"},handleDocumentKeyDown(t){if(t.repeat)return;let e=wO()?t.metaKey:t.ctrlKey,i=t.altKey,r=t.shiftKey,n=t.key,o=this.keyBuffer;if(!(Ko(t.target)&&t.target.closest("[data-el-outputs-container]"))){if(e&&r&&!i&&n==="Enter"){gn(t),this.queueFullCellsEvaluation(!0);return}else if(!e&&r&&!i&&n==="Enter"){gn(t),Ks(this.focusedCellType())&&this.queueFocusedCellEvaluation(),this.moveFocus(1);return}else if(e&&!i&&n==="Enter"){gn(t),Ks(this.focusedCellType())&&this.queueFocusedCellEvaluation();return}else if(e&&n==="s"){gn(t),this.saveNotebook();return}else if(e||i)return}this.insertMode?(o.reset(),!t.target.closest("[data-el-editor-container]")&&n==="Escape"&&this.escapeInsertMode()):Ko(t.target)?(o.reset(),n==="Escape"&&t.target.blur()):(o.push(t.key),o.tryMatch(["d","d"])?this.deleteFocusedCell():o.tryMatch(["e","a"])?this.queueFullCellsEvaluation(!1):o.tryMatch(["e","e"])?Ks(this.focusedCellType())&&this.queueFocusedCellEvaluation():o.tryMatch(["e","s"])?this.queueFocusedSectionEvaluation():o.tryMatch(["s","s"])?this.toggleSectionsList():o.tryMatch(["s","e"])?this.toggleSecretsList():o.tryMatch(["s","a"])?this.toggleAppInfo():o.tryMatch(["s","u"])?this.toggleClientsList():o.tryMatch(["s","f"])?this.toggleFilesList():o.tryMatch(["s","r"])?this.toggleRuntimeInfo():o.tryMatch(["s","b"])?this.showBin():o.tryMatch(["s","p"])?this.showPackageSearch():o.tryMatch(["e","x"])?this.cancelFocusedCellEvaluation():o.tryMatch(["0","0"])?this.reconnectRuntime():o.tryMatch(["Escape","Escape"])?this.setFocusedEl(null):o.tryMatch(["?"])?this.showShortcuts():o.tryMatch(["i"])||t.target.matches("body, [data-el-cell-body], [data-el-heading], [data-focusable-id]")&&this.focusedId&&n==="Enter"?(gn(t),this.isInsertModeAvailable()&&this.enterInsertMode()):o.tryMatch(["j"])?this.moveFocus(1):o.tryMatch(["k"])?this.moveFocus(-1):o.tryMatch(["J"])?this.moveFocusedCell(1):o.tryMatch(["K"])?this.moveFocusedCell(-1):o.tryMatch(["n"])?this.insertCellBelowFocused("code"):o.tryMatch(["N"])?this.insertCellAboveFocused("code"):o.tryMatch(["m"])?(!this.view||this.viewOptions.showMarkdown)&&this.insertCellBelowFocused("markdown"):o.tryMatch(["M"])?(!this.view||this.viewOptions.showMarkdown)&&this.insertCellAboveFocused("markdown"):o.tryMatch(["v","z"])?this.toggleView("code-zen"):o.tryMatch(["v","p"])?this.toggleView("presentation"):o.tryMatch(["v","c"])?this.toggleView("custom"):o.tryMatch(["c"])?(!this.view||this.viewOptions.showSection)&&this.toggleCollapseSection():o.tryMatch(["C"])&&(!this.view||this.viewOptions.showSection)&&this.toggleCollapseAllSections())},handleEditorEscape(){this.insertMode&&(this.keyBuffer.reset(),this.escapeInsertMode())},handleDocumentMouseDown(t){if(!t.target.closest("[data-el-notebook]")){this.insertMode&&this.setInsertMode(!1);return}if(t.target.closest(".cm-tooltip")){this.insertMode&&this.setInsertMode(!1);return}if(t.target.closest("[data-el-insert-buttons] button"))return;let e=t.target.closest("[data-focusable-id]"),i=e?e.dataset.focusableId:null,r=this.editableElementClicked(t,e);i!==this.focusedId&&this.setFocusedEl(i,{scroll:!1,focusElement:!1}),!t.target.closest("[data-el-actions]")&&this.insertMode!==r&&this.setInsertMode(r)},editableElementClicked(t,e){if(e){let i=t.target.closest("[data-el-editor-container], [data-el-heading]");return i&&e.contains(i)}return!1},handleDocumentFocus(t){let e=t.target.closest&&t.target.closest("[data-focusable-id]");if(e){let i=e.dataset.focusableId;i!==this.focusedId&&this.setFocusedEl(i,{scroll:!1,focusElement:!1})}},handleDocumentClick(t){t.target.closest("[data-el-enable-insert-mode-button]")&&this.setInsertMode(!0),t.target.closest("[data-btn-package-search]")&&this.insertMode&&this.setInsertMode(!1);let e=t.target.closest("[data-el-queue-cell-evaluation-button]");if(e){let r=e.getAttribute("data-cell-id"),n=e.hasAttribute("data-disable-dependencies-cache");this.queueCellEvaluation(r,n)}let i=window.location.hash;if(i){let r=i.replace(/^#/,"");!document.getElementById(r).contains(t.target)&&!t.target.closest("a")&&history.pushState(null,document.title,window.location.pathname+window.location.search)}},handleSectionsListClick(t){let e=t.target.closest("[data-el-sections-list-item]");if(e){let i=e.getAttribute("data-section-id");this.getSectionById(i).scrollIntoView({behavior:"smooth",block:"start"})}},handleClientsListClick(t){let e=t.target.closest("[data-el-clients-list-item]");if(e){let i=e.getAttribute("data-client-id");t.target.closest("[data-el-client-link]")&&this.handleClientLinkClick(i),t.target.closest("[data-el-client-follow-toggle]")&&this.handleClientFollowToggleClick(i,e)}},handleClientLinkClick(t){this.mirrorClientFocus(t)},handleClientFollowToggleClick(t,e){let i=this.el.querySelector("[data-el-clients-list-item][data-js-followed]");i&&i.removeAttribute("data-js-followed"),t===this.followedClientId?this.followedClientId=null:(e.setAttribute("data-js-followed",""),this.followedClientId=t,this.mirrorClientFocus(t))},mirrorClientFocus(t){let e=this.lastLocationReportByClientId[t];e&&e.focusableId&&this.setFocusedEl(e.focusableId)},handleCellIndicatorsClick(t){let e=t.target.closest("[data-el-focus-cell-button]");if(e){let i=e.getAttribute("data-target");this.setFocusedEl(i)}},initializeFocus(){let t=window.location.hash;if(t){let e=t.replace(/^#/,""),i=document.getElementById(e);if(i){let r=i.closest("[data-focusable-id]");r?this.setFocusedEl(r.dataset.focusableId):i.scrollIntoView()}}else this.props.autofocusCellId&&(this.setFocusedEl(this.props.autofocusCellId,{scroll:!1}),this.setInsertMode(!0))},updateSectionListHighlight(){let t=this.el.querySelector("[data-el-sections-list-item][data-js-is-viewed]");t&&t.removeAttribute("data-js-is-viewed");let e=this.getSections().reverse().find(i=>{let{top:r}=i.getBoundingClientRect(),n=document.documentElement.scrollTop;return r<=n+window.innerHeight*.35});if(e){let i=e.getAttribute("data-section-id");this.el.querySelector(`[data-el-sections-list-item][data-section-id="${i}"]`).setAttribute("data-js-is-viewed","")}},initializeDragAndDrop(){let t=!1,e=null,i=null,r=(o=null)=>{if(!t){t=!0,e=o;let s=o?"internal":"external";this.el.setAttribute("data-js-dragging",s),s==="external"&&this.toggleFilesList(!0)}},n=()=>{t&&(t=!1,this.el.removeAttribute("data-js-dragging"))};this.el.addEventListener("dragstart",o=>{r(o.target)}),this.el.addEventListener("dragenter",o=>{r()}),this.el.addEventListener("dragleave",o=>{eX()||this.el.contains(o.relatedTarget)||n()}),this.el.addEventListener("dragover",o=>{o.stopPropagation(),o.preventDefault()}),this.el.addEventListener("drop",o=>{o.stopPropagation(),o.preventDefault();let s=o.target.closest("[data-el-insert-drop-area]"),a=o.target.closest("[data-el-files-drop-area]");if(s){let l=s.getAttribute("data-section-id")||null,c=s.getAttribute("data-cell-id")||null;if(o.dataTransfer.files.length>0)i=o.dataTransfer.files,this.pushEvent("handle_file_drop",{section_id:l,cell_id:c});else if(e&&e.matches("[data-el-file-entry]")){let u=e.getAttribute("data-name");this.pushEvent("insert_file",{file_entry_name:u,section_id:l,cell_id:c})}}else a&&o.dataTransfer.files.length>0&&(i=o.dataTransfer.files,this.pushEvent("handle_file_drop",{}));n()}),this.handleEvent("finish_file_drop",o=>{let s=document.querySelector('#add-file-entry-modal input[type="file"]');s&&(s.files=i,s.dispatchEvent(new Event("change",{bubbles:!0})))})},toggleSectionsList(t=null){this.toggleSidePanelContent("sections-list",t)},toggleClientsList(t=null){this.toggleSidePanelContent("clients-list",t)},toggleSecretsList(t=null){this.toggleSidePanelContent("secrets-list",t)},toggleAppInfo(t=null){this.toggleSidePanelContent("app-info",t)},toggleFilesList(t=null){this.toggleSidePanelContent("files-list",t)},toggleRuntimeInfo(t=null){this.toggleSidePanelContent("runtime-info",t)},toggleSidePanelContent(t,e=null){(e===null?this.el.getAttribute("data-js-side-panel-content")!==t:e)?this.el.setAttribute("data-js-side-panel-content",t):this.el.removeAttribute("data-js-side-panel-content")},showBin(){let t=this.el.querySelector("[data-btn-show-bin]");t&&t.click()},showPackageSearch(){this.setFocusedEl("setup");let t=this.el.querySelector("[data-btn-package-search]");t&&t.click()},saveNotebook(){this.pushEvent("save",{})},deleteFocusedCell(){this.focusedId&&this.isCell(this.focusedId)&&this.pushEvent("delete_cell",{cell_id:this.focusedId})},queueCellEvaluation(t,e){this.dispatchQueueEvaluation(()=>{this.pushEvent("queue_cell_evaluation",{cell_id:t,disable_dependencies_cache:e})})},queueFocusedCellEvaluation(){this.focusedId&&this.isCell(this.focusedId)&&this.dispatchQueueEvaluation(()=>{this.pushEvent("queue_cell_evaluation",{cell_id:this.focusedId})})},queueFullCellsEvaluation(t){let e=t&&this.focusedId&&this.isCell(this.focusedId)?[this.focusedId]:[];this.dispatchQueueEvaluation(()=>{this.pushEvent("queue_full_evaluation",{forced_cell_ids:e})})},queueFocusedSectionEvaluation(){if(this.focusedId){let t=this.getSectionIdByFocusableId(this.focusedId);t&&this.dispatchQueueEvaluation(()=>{this.pushEvent("queue_section_evaluation",{section_id:t})})}},dispatchQueueEvaluation(t){Ks(this.focusedCellType())?Kt.broadcast(`cells:${this.focusedId}`,{type:"dispatch_queue_evaluation",dispatch:t}):t()},cancelFocusedCellEvaluation(){this.focusedId&&this.isCell(this.focusedId)&&this.pushEvent("cancel_cell_evaluation",{cell_id:this.focusedId})},reconnectRuntime(){this.pushEvent("reconnect_runtime",{})},showShortcuts(){let t=this.el.querySelector("[data-btn-show-shortcuts]");t&&t.click()},isInsertModeAvailable(){if(!this.focusedId)return!1;let t=this.getFocusableEl(this.focusedId);return!this.isCell(this.focusedId)||!t.hasAttribute("data-js-insert-mode-disabled")},enterInsertMode(){this.focusedId&&this.setInsertMode(!0)},escapeInsertMode(){this.setInsertMode(!1)},moveFocus(t){let e=this.nearbyFocusableId(this.focusedId,t);this.setFocusedEl(e)},moveFocusedCell(t){this.focusedId&&this.isCell(this.focusedId)&&this.pushEvent("move_cell",{cell_id:this.focusedId,offset:t})},insertCellBelowFocused(t){if(this.focusedId)this.insertCellBelowFocusableId(this.focusedId,t);else{let e=this.getFocusableIds();e.length>0&&this.insertCellBelowFocusableId(e[e.length-1],t)}},insertCellAboveFocused(t){if(this.focusedId){let e=this.nearbyFocusableId(this.focusedId,-1);this.insertCellBelowFocusableId(e,t)}else{let e=this.getFocusableIds();e.length>0&&this.insertCellBelowFocusableId(e[0],t)}},insertCellBelowFocusableId(t,e){if(this.isCell(t))this.pushEvent("insert_cell_below",{type:e,cell_id:t});else if(this.isSection(t))this.pushEvent("insert_cell_below",{type:e,section_id:t});else if(this.isNotebook(t)){let i=this.getSectionIds();i.length>0&&this.pushEvent("insert_cell_below",{type:e,section_id:i[0]})}},setFocusedEl(t,{scroll:e=!0,focusElement:i=!0}={}){if(this.focusedId=t,t?this.el.setAttribute("data-js-focused-id",t):this.el.removeAttribute("data-js-focused-id"),t){if(!this.isSection(t)){let n=this.getSectionIdByFocusableId(t);n&&this.getSectionById(n).removeAttribute("data-js-collapsed")}let r=this.getFocusableEl(t);i&&(r.querySelector("[data-el-cell-body]")||r.querySelector("[data-el-heading]")||r).focus({preventScroll:!0})}Kt.broadcast("navigation",{type:"element_focused",focusableId:t,scroll:e}),this.setInsertMode(!1),this.sendLocationReport({focusableId:t})},setInsertMode(t){this.insertMode=t,t?this.el.setAttribute("data-js-insert-mode",""):this.el.removeAttribute("data-js-insert-mode"),Kt.broadcast("navigation",{type:"insert_mode_changed",enabled:t})},handleViewsClick(t){let e=t.target.closest("[data-el-view-toggle]");if(e){let i=e.getAttribute("data-el-view-toggle");this.toggleView(i)}},toggleView(t){t===this.view?(this.unsetView(),t==="custom"&&this.customViewSettingsSubscription.destroy()):t==="code-zen"?this.setView(t,{showSection:!1,showMarkdown:!1,showOutput:!0,spotlight:!1}):t==="presentation"?this.setView(t,{showSection:!0,showMarkdown:!0,showOutput:!0,spotlight:!0}):t==="custom"&&(this.customViewSettingsSubscription=kt.getAndSubscribe(i=>{this.setView(t,{showSection:i.custom_view_show_section,showMarkdown:i.custom_view_show_markdown,showOutput:i.custom_view_show_output,spotlight:i.custom_view_spotlight})}),this.pushEvent("open_custom_view_settings"));let e=this.focusedId||this.nearbyFocusableId(null,0);if(e){let i=this.ensureVisibleFocusableEl(e);i!==this.focused&&this.setFocusedEl(i,{scroll:!1}),i&&this.getFocusableEl(i).scrollIntoView({block:"center"})}},setView(t,e){this.view=t,this.viewOptions=e,this.el.setAttribute("data-js-view",t),this.el.toggleAttribute("data-js-hide-section",!e.showSection),this.el.toggleAttribute("data-js-hide-markdown",!e.showMarkdown),this.el.toggleAttribute("data-js-hide-output",!e.showOutput),this.el.toggleAttribute("data-js-spotlight",e.spotlight)},unsetView(){this.view=null,this.viewOptions=null,this.el.removeAttribute("data-js-view"),this.el.removeAttribute("data-js-hide-section"),this.el.removeAttribute("data-js-hide-markdown"),this.el.removeAttribute("data-js-hide-output"),this.el.removeAttribute("data-js-spotlight")},toggleCollapseSection(){if(this.focusedId){let t=this.getSectionIdByFocusableId(this.focusedId);if(t){let e=this.getSectionById(t);e.hasAttribute("data-js-collapsed")?e.removeAttribute("data-js-collapsed"):(e.setAttribute("data-js-collapsed",""),this.setFocusedEl(t,{scroll:!0}))}}},toggleCollapseAllSections(){let t=this.getSections().every(e=>e.hasAttribute("data-js-collapsed"));if(this.getSections().forEach(e=>{e.toggleAttribute("data-js-collapsed",!t)}),this.focusedId){let e=this.getSectionIdByFocusableId(this.focusedId);e&&this.setFocusedEl(e,{scroll:!0})}},handleCellInserted(t){this.setFocusedEl(t),lX(this.focusedCellType())&&this.setInsertMode(!0)},handleCellDeleted(t,e){if(this.focusedId===t)if(this.view){let i=this.ensureVisibleFocusableEl(e);this.setFocusedEl(i)}else this.setFocusedEl(e)},handleCellRestored(t){this.setFocusedEl(t)},handleCellMoved(t){this.repositionJSViews(),this.focusedId===t&&Kt.broadcast("cells",{type:"cell_moved",cellId:t})},handleSectionInserted(t){let i=this.getSectionById(t).querySelector("[data-el-section-headline]"),{focusableId:r}=i.dataset;this.setFocusedEl(r),this.setInsertMode(!0),W$(document.activeElement)},handleSectionDeleted(t){this.focusedId&&!this.getFocusableEl(this.focusedId)&&this.setFocusedEl(null)},handleSectionMoved(t){this.repositionJSViews();let e=this.getSectionById(t);Hs(e)},handleClientJoined(t){let e=this.store.get("clients");this.store.set("clients",Ce(H({},e),{[t.id]:t}))},handleClientLeft(t){let e=this.store.get("clients"),i=e[t];if(i){let[,r]=CO(e,t);this.store.set("clients",r),i.id===this.followedClientId&&(this.followedClientId=null)}},handleClientsUpdated(t){let e=this.store.get("clients"),i=H({},e);for(let r of t)i[r.id]=r;this.store.set("clients",i)},handleSecretSelected(t,e){Kt.broadcast(`js_views:${t}`,{type:"secretSelected",secretName:e})},handleLocationReport(t,e){let i=this.store.get("clients")[t];this.lastLocationReportByClientId[t]=e,i&&i.id===this.followedClientId&&e.focusableId!==this.focusedId&&this.setFocusedEl(e.focusableId)},repositionJSViews(){Kt.broadcast("js_views",{type:"reposition"})},sendLocationReport(t){Object.keys(this.store.get("clients")).length>1&&this.pushEvent("location_report",{focusable_id:t.focusableId})},focusedCellType(){return this.focusedId&&this.isCell(this.focusedId)?this.getFocusableEl(this.focusedId).getAttribute("data-type"):null},nearbyFocusableId(t,e){let i=this.getFocusableIds();if(i.length===0)return null;let r=i.indexOf(t);if(r===-1){let n=this.getFocusableEls().find(Nv);return n?n.getAttribute("data-focusable-id"):i[0]}else{let n=j$(r+e,0,i.length-1);return i[n]}},ensureVisibleFocusableEl(t){let e=this.getFocusableEl(t),i=Array.from(this.el.querySelectorAll("[data-focusable-id]")),r=i.indexOf(e),n=[...i.slice(r,-1),...i.slice(0,r).reverse()].find(o=>!mn(o));return n&&n.getAttribute("data-focusable-id")},isCell(t){return this.getFocusableEl(t).hasAttribute("data-el-cell")},isSection(t){return this.getFocusableEl(t).hasAttribute("data-el-section-headline")},isNotebook(t){return this.getFocusableEl(t).hasAttribute("data-el-notebook-headline")},getFocusableEl(t){return this.el.querySelector(`[data-focusable-id="${t}"]`)},getFocusableEls(){return Array.from(this.el.querySelectorAll("[data-focusable-id]")).filter(t=>!mn(t))},getFocusableIds(){return this.getFocusableEls().map(t=>t.getAttribute("data-focusable-id"))},getSectionIdByFocusableId(t){let i=this.getFocusableEl(t).closest("[data-el-section]");return i&&i.getAttribute("data-section-id")},getSectionIds(){return this.getSections().map(e=>e.getAttribute("data-section-id"))},getSections(){return Array.from(this.el.querySelectorAll("[data-el-section]"))},getSectionById(t){return this.el.querySelector(`[data-el-section][data-section-id="${t}"]`)},getElement(t){return this.el.querySelector(`[data-el-${t}]`)}},cI=Wie;var Bie={mounted(){this.autosize(),this.el.addEventListener("input",t=>{this.autosize()})},updated(){this.autosize()},autosize(){this.el.style.height="0px",this.el.style.height=`${this.el.scrollHeight+2}px`}},uI=Bie;var Zie=100,Vie={mounted(){this.props=this.getProps(),this.interval=setInterval(()=>this.updateDOM(),Zie)},updated(){this.props=this.getProps(),this.updateDOM()},destroyed(){clearInterval(this.interval)},getProps(){return ht(this.el,["start"])},updateDOM(){let e=(Date.now()-new Date(this.props.start))/1e3;this.el.innerHTML=`${e.toFixed(1)}s`}},fI=Vie;var hI="lb_user_data";function dI(t){let e=JSON.stringify(t),i=Z$(e);Fie(hI,i,15768e4)}function pI(){let t=Yie(hI);if(t){let e=V$(t);return JSON.parse(e)}else return null}function Yie(t){let e=document.cookie.split("; ").find(i=>i.startsWith(`${t}=`));return e?e.replace(`${t}=`,""):null}function Fie(t,e,i){let r=`${t}=${e};max-age=${i};path=/${EO()}`;document.cookie=r}var Hie={mounted(){this.el.addEventListener("submit",t=>{let e=this.el.user_form_name.value,i=this.el.user_form_hex_color.value;dI({name:e,hex_color:i})})}},OI=Hie;var Gie={mounted(){this.props=this.getProps(),this.updateAttrs(),this.el.addEventListener("blur",t=>{let e=this.datetimeLocalToUtc(this.el.value);this.pushEventTo(this.props.phxTarget,"change",{html_value:e})})},updated(){this.props=this.getProps(),this.updateAttrs()},getProps(){return ht(this.el,["utc-value","utc-min","utc-max","phx-target"])},updateAttrs(){this.el.value=this.datetimeUtcToLocal(this.props.utcValue),this.el.min=this.datetimeUtcToLocal(this.props.utcMin),this.el.max=this.datetimeUtcToLocal(this.props.utcMax)},datetimeUtcToLocal(t){if(!t)return null;let e=new Date(t+"Z"),i=e.getFullYear().toString(),r=(e.getMonth()+1).toString().padStart(2,"0"),n=e.getDate().toString().padStart(2,"0"),o=e.getHours().toString().padStart(2,"0"),s=e.getMinutes().toString().padStart(2,"0"),a=e.getSeconds().toString().padStart(2,"0");return`${i}-${r}-${n}T${o}:${s}:${a}`},datetimeLocalToUtc(t){if(!t)return null;let e=new Date(t),i=e.getUTCFullYear().toString(),r=(e.getUTCMonth()+1).toString().padStart(2,"0"),n=e.getUTCDate().toString().padStart(2,"0"),o=e.getUTCHours().toString().padStart(2,"0"),s=e.getUTCMinutes().toString().padStart(2,"0"),a=e.getUTCSeconds().toString().padStart(2,"0");return`${i}-${r}-${n}T${o}:${s}:${a}`}},mI=Gie;var Kie={mounted(){this.props=this.getProps(),this.updateAttrs(),this.el.addEventListener("blur",t=>{let e=this.timeLocalToUtc(this.el.value);this.pushEventTo(this.props.phxTarget,"change",{html_value:e})})},updated(){this.props=this.getProps(),this.updateAttrs()},getProps(){return ht(this.el,["utc-value","utc-min","utc-max","phx-target"])},updateAttrs(){this.el.value=this.timeUtcToLocal(this.props.utcValue),this.el.min=this.timeUtcToLocal(this.props.utcMin),this.el.max=this.timeUtcToLocal(this.props.utcMax)},timeUtcToLocal(t){if(!t)return null;let e=new Date;e.setUTCHours(...t.split(":"));let i=e.getHours().toString().padStart(2,"0"),r=e.getMinutes().toString().padStart(2,"0"),n=e.getSeconds().toString().padStart(2,"0");return`${i}:${r}:${n}`},timeLocalToUtc(t){if(!t)return null;let e=new Date;e.setHours(...t.split(":"));let i=e.getUTCHours().toString().padStart(2,"0"),r=e.getUTCMinutes().toString().padStart(2,"0"),n=e.getUTCSeconds().toString().padStart(2,"0");return`${i}:${r}:${n}`}},gI=Kie;var xI=da(yI());var Jie={mounted(){this.props=this.getProps(),this.lineHeight=q$(this.el),this.templateEl=Gn(this.el,"[data-template]"),this.contentEl=Gn(this.el,"[data-content]"),this.capLines();let t=this.hyperListConfig();this.virtualizedList=new xI.default(this.contentEl,t),this.props.follow&&rf(this.contentEl)},updated(){this.props=this.getProps(),this.capLines();let t=this.props.follow&&B$(this.contentEl),e=this.hyperListConfig();this.virtualizedList.refresh(this.contentEl,e),t&&rf(this.contentEl)},getProps(){return ht(this.el,["max-height","follow","max-lines","ignore-trailing-empty-line"])},hyperListConfig(){let t=this.getLineElements(),e=t.length,i=Math.min(this.props.maxHeight,this.lineHeight*e);return{height:i,total:e,itemHeight:this.lineHeight,generate:r=>{let n=t[r].cloneNode(!0);return n.removeAttribute("id"),n},afterRender:()=>{this.contentEl.scrollWidth>this.contentEl.clientWidth?this.contentEl.style.height=`${i+12}px`:this.contentEl.style.height=`${i}px`}}},getLineElements(){let t=Array.from(this.templateEl.querySelectorAll("[data-line]"));if(t.length===0)return[];let e=t[t.length-1];return this.props.ignoreTrailingEmptyLine&&e.innerText===""?t.slice(0,-1):t},capLines(){if(this.props.maxLines){let e=Array.from(this.templateEl.querySelectorAll("[data-line]")).slice(0,-this.props.maxLines),[i,...r]=e;r.forEach(n=>n.remove()),i&&(i.innerHTML="...")}}},vI=Jie;var ere={mounted(){let t=kt.get(),e=this.el.querySelector('[name="show_section"][value="true"]'),i=this.el.querySelector('[name="show_markdown"][value="true"]'),r=this.el.querySelector('[name="show_output"][value="true"]'),n=this.el.querySelector('[name="spotlight"][value="true"]');e.checked=t.custom_view_show_section,i.checked=t.custom_view_show_markdown,r.checked=t.custom_view_show_output,n.checked=t.custom_view_spotlight,e.addEventListener("change",o=>{kt.update({custom_view_show_section:o.target.checked})}),i.addEventListener("change",o=>{kt.update({custom_view_show_markdown:o.target.checked})}),r.addEventListener("change",o=>{kt.update({custom_view_show_output:o.target.checked})}),n.addEventListener("change",o=>{kt.update({custom_view_spotlight:o.target.checked})})}},wI=ere;var kI={AppAuth:nS,AudioInput:lS,Cell:cX,CellEditor:sR,Dropzone:aR,EditorSettings:lR,EmojiPicker:VR,FocusOnUpdate:YR,Headline:HR,Highlight:GR,ImageInput:KR,ImageOutput:JR,JSView:oI,KeyboardControl:sI,MarkdownRenderer:aI,ScrollOnUpdate:lI,Session:cI,TextareaAutosize:uI,Timer:fI,UserForm:OI,UtcDateTimeInput:mI,UtcTimeInput:gI,VirtualizedLines:vI,CustomViewSettings:wI};var SI={onBeforeElUpdated(t,e){for(let i of t.attributes)i.name.startsWith("data-js-")&&e.setAttribute(i.name,i.value),i.name==="data-keep-attribute"&&(t.hasAttribute(i.value)?e.setAttribute(i.value,t.getAttribute(i.value)):e.removeAttribute(i.value))},onNodeAdded(t){if(t.nodeType===Node.ELEMENT_NODE&&t.hasAttribute("autofocus")&&(t.focus(),t.setSelectionRange&&t.value)){let e=t.value.length;t.setSelectionRange(e,e)}}};var Nm=da(EI());function CI(){Nm.default.config({barColors:{0:"#b2c1ff"},shadowColor:"rgba(0, 0, 0, .3)"}),window.addEventListener("phx:page-loading-start",()=>{Nm.default.show(500)}),window.addEventListener("phx:page-loading-stop",()=>{Nm.default.hide()})}function _I(){window.addEventListener("lb:focus",t=>{requestAnimationFrame(()=>{t.target.focus()})}),window.addEventListener("lb:set_value",t=>{t.target.value=t.detail.value}),window.addEventListener("lb:check",t=>{t.target.checked=!0}),window.addEventListener("lb:uncheck",t=>{t.target.checked=!1}),window.addEventListener("lb:set_text",t=>{t.target.textContent=t.detail.value}),window.addEventListener("lb:clipcopy",t=>{"clipboard"in navigator?t.detail.content?navigator.clipboard.writeText(t.detail.content):t.target.tagName==="INPUT"?navigator.clipboard.writeText(t.target.value):navigator.clipboard.writeText(t.target.textContent):alert(`Sorry, your browser does not support clipboard copy. +This generally requires a secure origin \u2014 either HTTPS or localhost.`)}),window.addEventListener("lb:scroll_into_view",t=>{z$(t.target).then(()=>{QO(t.target,{scrollMode:"if-needed",behavior:"smooth",block:"nearest",inline:"nearest"})})}),window.addEventListener("phx:lb:exec_js",t=>{let e=t.detail.to||"body";document.querySelectorAll(e).forEach(i=>{window.liveSocket.execJS(i,t.detail.js)})}),window.addEventListener("lb:session_list:on_selection_change",()=>{let t=!!document.querySelector("[name='session_ids[]']:checked"),e=document.querySelector("#edit-sessions [name='disconnect']"),i=document.querySelector("#edit-sessions [name='close_all']");e.parentElement.classList.toggle("pointer-events-none",!t),e.parentElement.classList.toggle("opacity-50",!t),i.parentElement.classList.toggle("pointer-events-none",!t),i.parentElement.classList.toggle("opacity-50",!t)}),window.addEventListener("contextmenu",t=>{let e=t.target.closest("[data-contextmenu-trigger-click]");e&&(t.preventDefault(),e.dispatchEvent(new Event("mousedown",{bubbles:!0})),e.dispatchEvent(new Event("click",{bubbles:!0})))}),window.addEventListener("submit",t=>{t.target.hasAttribute("phx-nosubmit")&&(t.preventDefault(),t.stopPropagation())},{capture:!0})}function PI(){let t=/AppleWebKit/.test(navigator.userAgent),e="ontouchstart"in window||navigator.maxTouchPoints>0;if(t&&e){let i=document.querySelector("meta[name='viewport']");i&&(i.content+=", maximum-scale=1.0")}}var U2="confirm-opted-out-ids";function QI(){return cs(U2)||[]}function AI(){window.addEventListener("phx:add_confirm_opt_out_id",t=>{let e=cs(U2)||[],i=t.detail.opt_out_id;e.push(i),ka(U2,e)})}function tre(){let t=document.querySelector("meta[name='csrf-token']").getAttribute("content"),e=new Jk(window.LIVEBOOK_BASE_URL_PATH+"/live",Jf,{params:i=>({_csrf_token:t,user_data:pI(),app_auth_token:rS(),confirm_opt_out_ids:QI()}),hooks:kI,dom:SI});CI(),_I(),AI(),PI(),kt.getAndSubscribe(i=>{document.body.setAttribute("data-editor-theme",i.editor_theme)}),e.connect(),window.liveSocket=e}if(ire())tre();else{let t=document.createElement("div");t.innerHTML=`