From b16d7073372721d8f477883f7480fbeb32938540 Mon Sep 17 00:00:00 2001
From: jonatanklosko <17034772+jonatanklosko@users.noreply.github.com>
Date: Thu, 3 Apr 2025 14:07:47 +0000
Subject: [PATCH] Update assets
---
static/assets/app.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/static/assets/app.js b/static/assets/app.js
index 72ba42f46..4278e3531 100644
--- a/static/assets/app.js
+++ b/static/assets/app.js
@@ -95,7 +95,7 @@ ${o.message}`)))}function iie(){return import("./mermaid.core-PK4ATILI.js"
`)}},pa=zw;function nie(t){return Ee(Y({},Mr),{attributes:Ee(Y({},Mr.attributes),{"*":[...Mr.attributes["*"]||[],"className","style"]}),protocols:Ee(Y({},Mr.protocols),{href:[...Mr.protocols.href,...t]})})}function oie(t){return e=>{let i=[];return bi(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 sie(t){return e=>{t.baseUrl&&bi(e,"element",i=>{if(i.tagName==="a"&&i.properties){let r=i.properties.href;r&&!Uw(r)&&!Mw(r)&&!fie(r)&&(i.properties.href=HR(t.baseUrl,r))}if(i.tagName==="img"&&i.properties){let r=i.properties.src;r&&!Uw(r)&&!Mw(r)&&(i.properties.src=HR(t.baseUrl,r))}}),bi(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 aie=Wh().use(Hd,{fragment:!0});function lie(t){return e=>{bi(e,"code",(i,r,n)=>{i.lang==="mermaid"&&(i.type="html",i.value=`
${Qf(i.value)}
- `)})}}function cie(t){return e=>{let i=[];return bi(e,"element",r=>{if((r.properties&&Array.isArray(r.properties.className)?r.properties.className:[]).includes("mermaid")){let o=function(c){let u=aie.parse(c);g1(u,!0),r.children=u.children},s=pu(r,{whitespace:"pre"}),a=t.useDarkTheme?"dark":"default",l=FR(s,{theme:a}).then(o);i.push(l)}}),Promise.all(i).then(()=>null)}}function uie(t){return e=>{bi(e,"element",i=>{if(i.properties&&i.properties.href){let r=i.properties.href;Mw(r)?(i.properties["data-phx-link"]=t.baseUrl&&r.startsWith(t.baseUrl)?"patch":"redirect",i.properties["data-phx-link-state"]="push"):Uw(r)&&(i.properties.target="_blank",i.properties.rel="noreferrer noopener")}})}}function Uw(t){return/^(?:[a-z]+:)?\/\//i.test(t)}function fie(t){return t.startsWith("#")}function Mw(t){return t.startsWith("/")||t.startsWith(window.location.origin)}function HR(t,e){return t.replace(/\/$/,"")+"/"+e}var Ml=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)})}},at=new Ml;var GR=t=>typeof t=="object"&&t!=null&&t.nodeType===1,KR=(t,e)=>(!e||t!=="hidden")&&t!=="visible"&&t!=="clip",Nw=(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,hie=t=>{let e=t.parentElement;return e==null?t.getRootNode().host||null:e},qw=(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:re=>re!==c;if(!GR(t))throw new TypeError("Invalid target");let d=document.scrollingElement||document.documentElement,O=[],m=t;for(;GR(m)&&f(m);){if(m=hie(m),m===d){O.push(m);break}m!=null&&m===document.body&&Nw(m)&&!Nw(document.documentElement)||m!=null&&Nw(m,u)&&O.push(m)}let x=(r=(i=window.visualViewport)==null?void 0:i.width)!=null?r:innerWidth,v=(o=(n=window.visualViewport)==null?void 0:n.height)!=null?o:innerHeight,{scrollX:w,scrollY:T}=window,{height:A,width:L,top:D,right:P,bottom:q,left:le}=t.getBoundingClientRect(),G=a==="start"||a==="nearest"?D:a==="end"?q:D+A/2,M=l==="center"?le+L/2:l==="end"?P:le,ie=[];for(let re=0;re=0&&le>=0&&q<=v&&P<=x&&D>=ve&&q<=ue&&le>=Z&&P<=j)return ie;let C=getComputedStyle(ne),W=parseInt(C.borderLeftWidth,10),oe=parseInt(C.borderTopWidth,10),I=parseInt(C.borderRightWidth,10),Ne=parseInt(C.borderBottomWidth,10),We=0,Ve=0,Et="offsetWidth"in ne?ne.offsetWidth-ne.clientWidth-W-I:0,Xe="offsetHeight"in ne?ne.offsetHeight-ne.clientHeight-oe-Ne:0,Rt="offsetWidth"in ne?ne.offsetWidth===0?0:pe/ne.offsetWidth:0,Lt="offsetHeight"in ne?ne.offsetHeight===0?0:de/ne.offsetHeight:0;if(d===ne)We=a==="start"?G:a==="end"?G-v:a==="nearest"?cm(T,T+v,v,oe,Ne,T+G,T+G+A,A):G-v/2,Ve=l==="start"?M:l==="center"?M-x/2:l==="end"?M-x:cm(w,w+x,x,W,I,w+M,w+M+L,L),We=Math.max(0,We+T),Ve=Math.max(0,Ve+w);else{We=a==="start"?G-ve-oe:a==="end"?G-ue+Ne+Xe:a==="nearest"?cm(ve,ue,de,oe,Ne+Xe,G,G+A,A):G-(ve+de/2)+Xe/2,Ve=l==="start"?M-Z-W:l==="center"?M-(Z+pe/2)+Et/2:l==="end"?M-j+I+Et:cm(Z,j,pe,W,I+Et,M,M+L,L);let{scrollLeft:fr,scrollTop:hr}=ne;We=Math.max(0,Math.min(hr+We/Lt,ne.scrollHeight-de/Lt+Xe)),Ve=Math.max(0,Math.min(fr+Ve/Rt,ne.scrollWidth-pe/Rt+Et)),G+=hr-We,M+=fr-Ve}ie.push({el:ne,top:We,left:Ve})}return ie};var die=t=>t===!1?{block:"end",inline:"nearest"}:(e=>e===Object(e)&&Object.keys(e).length!==0)(t)?t:{block:"start",inline:"nearest"};function um(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(qw(t,e));let r=typeof e=="boolean"||e==null?void 0:e.behavior;for(let{el:n,top:o,left:s}of qw(t,die(e))){let a=o-i.top+i.bottom,l=s-i.left+i.right;n.scroll({top:a,left:l,behavior:r})}}function ma(t){return["code","smart","setup"].includes(t)}function JR(t){return["markdown","code","setup"].includes(t)}var Oie={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=[at.subscribe("navigation:focus_changed",({focusableId:t,scroll:e})=>this.handleElementFocused(t,e)),at.subscribe("navigation:insert_mode_changed",({enabled:t})=>this.handleInsertModeChanged(t)),at.subscribe("cells:cell_moved",({cellId:t})=>this.handleCellMoved(t)),at.subscribe(`cells:${this.props.cellId}:dispatch_queue_evaluation`,({dispatch:t})=>this.handleDispatchQueueEvaluation(t)),at.subscribe(`cells:${this.props.cellId}:jump_to_line`,({line:t,offset:e=0})=>this.handleJumpToLine(t,e))],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 Ot(this.el,["cell-id","type","session-path","evaluation-digest","smart-cell-js-view-ref","allowed-uri-schemes"])},handleElementFocused(t,e){this.props.cellId===t?(this.isFocused=!0,this.el.setAttribute("data-js-focused",""),e&&Oa(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(()=>{setTimeout(()=>{this.isFocused&&this.insertMode&&this.currentEditor().focus()},0)}),e.onFocus(()=>{setTimeout(()=>{!this.isFocused||!this.insertMode?this.currentEditor().blur():this.sendCursorHistory()},0)}),e.onSelectionChange(()=>{this.isFocused&&this.sendCursorHistory()}),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 pa(r,i,{baseUrl:this.props.sessionPath,emptyText:"Empty markdown cell",allowedUriSchemes:this.props.allowedUriSchemes});e.onChange(o=>{n.setContent(o)})}ma(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=nm(i),n=this.props.evaluationDigest!==r;this.el.toggleAttribute("data-js-changed",n)}},handleInsertModeChanged(t){this.isFocused&&!this.insertMode&&t?(this.insertMode=t,this.el.setAttribute("data-js-insert-mode",""),this.currentEditor()&&(this.currentEditor().focus(),this.scrollEditorCursorIntoViewIfNeeded())):this.insertMode&&!t&&(this.insertMode=t,this.el.removeAttribute("data-js-insert-mode"),this.currentEditor()&&this.currentEditor().blur())},handleCellMoved(t){this.isFocused&&t===this.props.cellId&&Oa(this.el)},handleDispatchQueueEvaluation(t){this.props.type==="smart"&&this.props.smartCellJsViewRef?at.broadcast(`js_views:${this.props.smartCellJsViewRef}:sync`,{callback:t}):t()},handleJumpToLine(t,e){this.isFocused&&this.currentEditor().moveCursorToLine(t,e)},scrollEditorCursorIntoViewIfNeeded(){let t=this.currentEditor().getElementAtCursor();ZR(t,{scrollMarginTop:"128px"},()=>{um(t,{scrollMode:"if-needed",behavior:"instant",block:"start"})})},sendCursorHistory(){let t=this.currentEditor().getCurrentCursorPosition();t!==null&&at.broadcast("navigation:cursor_moved",{line:t.line,offset:t.offset,cellId:this.props.cellId})}},e6=Oie;var Xf=t=>{let{state:e}=t,i=e.doc.lineAt(e.selection.main.from),r=Vw(t.state,i.from);return r.line?pie(t):r.block?mie(t):!1};function Rf(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 pie=Rf(Zw,0),t6=Rf(Zw,1),i6=Rf(Zw,2),r6=Rf(n6,0);var mie=Rf((t,e)=>n6(t,e,bie(e)),0);function Vw(t,e){let i=t.languageDataAt("commentTokens",e);return i.length?i[0]:{}}var $f=50;function gie(t,{open:e,close:i},r,n){let o=t.sliceDoc(r-$f,r),s=t.sliceDoc(n,n+$f),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*$f?u=f=t.sliceDoc(r,n):(u=t.sliceDoc(r,r+$f),f=t.sliceDoc(n-$f,n));let d=/^\s*/.exec(u)[0].length,O=/\s*$/.exec(f)[0].length,m=f.length-O-i.length;return u.slice(d,d+e.length)==e&&f.slice(m,m+i.length)==i?{open:{pos:r+d+e.length,margin:/\s/.test(u.charAt(d+e.length))?1:0},close:{pos:n-O-i.length,margin:/\s/.test(f.charAt(m-1))?1:0}}:null}function bie(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);n.from>r.from&&n.from==i.to&&(n=i.to==r.to+1?r:t.doc.lineAt(i.to-1));let 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 n6(t,e,i=e.selection.ranges){let r=i.map(o=>Vw(e,o.from).block);if(!r.every(o=>o))return null;let n=i.map((o,s)=>gie(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,O=d==f.length,m=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 Ww=wi.define(),yie=wi.define(),xie=be.define(),o6=be.define({combine(t){return Qt(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)})}}),s6=Ge.define({create(){return ga.empty},update(t,e){let i=e.state.facet(o6),r=e.annotation(Ww);if(r){let l=Zr.fromTransaction(e,r.selection),c=r.side,u=c==0?t.undone:t.done;return l?u=hm(u,u.length,i.minDepth,l):u=u6(u,e.startState.selection),new ga(c==0?r.rest:u,c==0?u:r.rest)}let n=e.annotation(yie);if((n=="full"||n=="before")&&(t=t.isolate()),e.annotation($t.addToHistory)===!1)return e.changes.empty?t:t.addMapping(e.changes.desc);let o=Zr.fromTransaction(e),s=e.annotation($t.time),a=e.annotation($t.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 ga(t.done.map(Zr.fromJSON),t.undone.map(Zr.fromJSON))}});function a6(t={}){return[s6,o6.of(t),fe.domEventHandlers({beforeinput(e,i){let r=e.inputType=="historyUndo"?ba:e.inputType=="historyRedo"?ss:null;return r?(e.preventDefault(),r(i)):!1}})]}function Bw(t,e){return function({state:i,dispatch:r}){if(!e&&i.readOnly)return!1;let n=i.field(s6,!1);if(!n)return!1;let o=n.pop(t,i,e);return o?(r(o),!0):!1}}var ba=Bw(0,!1),ss=Bw(1,!1),l6=Bw(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&&_i.fromJSON(e.changes),[],e.mapped&&Vn.fromJSON(e.mapped),e.startSelection&&K.fromJSON(e.startSelection),e.selectionsAfter.map(K.fromJSON))}static fromTransaction(e,i){let r=Cr;for(let n of e.startState.facet(xie)){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,Cr)}static selection(e){return new t(void 0,Cr,void 0,void 0,e)}};function hm(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 vie(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 wie(t,e){return t.ranges.length==e.ranges.length&&t.ranges.filter((i,r)=>i.empty!=e.ranges[r].empty).length===0}function c6(t,e){return t.length?e.length?t.concat(e):t:e}var Cr=[],kie=200;function u6(t,e){if(t.length){let i=t[t.length-1],r=i.selectionsAfter.slice(Math.max(0,i.selectionsAfter.length-kie));return r.length&&r[r.length-1].eq(e)?t:(r.push(e),hm(t,t.length-1,1e9,i.setSelAfter(r)))}else return[Zr.selection([e])]}function Sie(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 jw(t,e){if(!t.length)return t;let i=t.length,r=Cr;for(;i;){let n=Tie(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)]:Cr}function Tie(t,e,i){let r=c6(t.selectionsAfter.length?t.selectionsAfter.map(a=>a.map(e)):Cr,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 Eie=/^(input\.type|delete)($|\.)/,ga=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||Eie.test(r))&&(!a.selectionsAfter.length&&i-this.prevTime0&&i-this.prevTimei.empty?t.moveByChar(i,e):dm(i,e))}function ls(t){return t.textDirectionAt(t.state.selection.main.head)==st.LTR}var If=t=>Om(t,!ls(t)),Yw=t=>Om(t,ls(t)),f6=t=>Om(t,!0),pm=t=>Om(t,!1);function h6(t,e){return ya(t,i=>i.empty?t.moveByGroup(i,e):dm(i,e))}var mm=t=>h6(t,!ls(t)),gm=t=>h6(t,ls(t));var _Te=typeof Intl!="undefined"&&Intl.Segmenter?new Intl.Segmenter(void 0,{granularity:"word"}):null;function d6(t,e){return ya(t,i=>{if(!i.empty)return dm(i,e);let r=t.moveVertically(i,e);return r.head!=i.head?r:t.moveToLineBoundary(i,e)})}var Df=t=>d6(t,!1),zf=t=>d6(t,!0);function O6(t){let e=t.scrollDOM.clientHeights.empty?t.moveVertically(s,e,i.height):dm(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.bottomp6(t,!1),ql=t=>p6(t,!0);function bm(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=K.cursor(r.from+o))}return n}var Uf=t=>ya(t,e=>bm(t,e,!0)),Mf=t=>ya(t,e=>bm(t,e,!1));var ym=t=>ya(t,e=>K.cursor(t.lineBlockAt(e.head).from,1)),xm=t=>ya(t,e=>K.cursor(t.lineBlockAt(e.head).to,-1));function Pie(t,e,i){let r=!1,n=Lf(t.selection,o=>{let s=kr(t,o.head,-1)||kr(t,o.head,1)||o.head>0&&kr(t,o.head-1,1)||o.headPie(t,e,!1);function cs(t,e){let i=Lf(t.state.selection,r=>{let n=e(r);return K.range(r.anchor,n.head,n.goalColumn,n.bidiLevel||void 0)});return i.eq(t.state.selection)?!1:(t.dispatch(as(t.state,i)),!0)}function vm(t,e){return cs(t,i=>t.moveByChar(i,e))}var Fw=t=>vm(t,!ls(t)),Hw=t=>vm(t,ls(t)),Gw=t=>vm(t,!0),Kw=t=>vm(t,!1);function wm(t,e){return cs(t,i=>t.moveByGroup(i,e))}var km=t=>wm(t,!ls(t)),Sm=t=>wm(t,ls(t)),g6=t=>wm(t,!0),b6=t=>wm(t,!1);function y6(t,e){return cs(t,i=>t.moveVertically(i,e))}var jl=t=>y6(t,!1),Wl=t=>y6(t,!0);function x6(t,e){return cs(t,i=>t.moveVertically(i,e,O6(t).height))}var Nf=t=>x6(t,!1),xa=t=>x6(t,!0),Jw=t=>cs(t,e=>bm(t,e,!0)),ek=t=>cs(t,e=>bm(t,e,!1));var qf=t=>cs(t,e=>K.cursor(t.lineBlockAt(e.head).from)),jf=t=>cs(t,e=>K.cursor(t.lineBlockAt(e.head).to)),Wf=({state:t,dispatch:e})=>(e(as(t,{anchor:0})),!0),Vf=({state:t,dispatch:e})=>(e(as(t,{anchor:t.doc.length})),!0),Vl=({state:t,dispatch:e})=>(e(as(t,{anchor:t.selection.main.anchor,head:0})),!0),Zl=({state:t,dispatch:e})=>(e(as(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0),Tm=({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0),v6=({state:t,dispatch:e})=>{let i=Cm(t).map(({from:r,to:n})=>K.range(r,Math.min(n+1,t.doc.length)));return e(t.update({selection:K.create(i),userEvent:"select"})),!0};function Em(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=fm(t,l,!0)),s=Math.min(s,l),a=Math.max(a,l)}else s=fm(t,s,!1),a=fm(t,a,!0);return s==a?{range:o}:{changes:{from:s,to:a},range:K.cursor(s,sn(t)))r.between(e,e,(n,o)=>{ne&&(e=i?o:n)});return e}var w6=(t,e,i)=>Em(t,r=>{let n=r.from,{state:o}=t,s=o.doc.lineAt(n),a,l;if(i&&!e&&n>s.from&&nw6(t,!1,!0);var Zf=t=>w6(t,!0,!1),k6=(t,e)=>Em(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=Zt(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}),tk=t=>k6(t,!1),S6=t=>k6(t,!0),ik=t=>Em(t,e=>{let i=t.lineBlockAt(e.head).to;return e.headEm(t,e=>{let i=t.lineBlockAt(e.head).from;return e.head>i?i:Math.max(0,e.head-1)});var Bf=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange(r=>({changes:{from:r.from,to:r.to,insert:Fe.of(["",""])},range:K.cursor(r.from)}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0},Pm=({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:Zt(o.text,n-o.from,!1)+o.from,a=n==o.to?n+1:Zt(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:K.cursor(a)}});return i.changes.empty?!1:(e(t.update(i,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function Cm(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 E6(t,e,i){if(t.readOnly)return!1;let r=[],n=[];for(let o of Cm(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(K.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(K.range(l.anchor-a,l.head-a))}}return r.length?(e(t.update({changes:r,scrollIntoView:!0,selection:K.create(n,t.selection.mainIndex),userEvent:"move.line"})),!0):!1}var P6=({state:t,dispatch:e})=>E6(t,e,!1),C6=({state:t,dispatch:e})=>E6(t,e,!0);function Q6(t,e,i){if(t.readOnly)return!1;let r=[];for(let n of Cm(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 _6=({state:t,dispatch:e})=>Q6(t,e,!1),A6=({state:t,dispatch:e})=>Q6(t,e,!0),$6=t=>{if(t.state.readOnly)return!1;let{state:e}=t,i=e.changes(Cm(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 Cie(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let i=qe(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(_e.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 Yf=R6(!1),X6=R6(!0);function R6(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&&Cie(e,o);t&&(o=s=(s<=a.to?a:e.doc.lineAt(s)).to);let c=new Hs(e,{simulateBreak:o,simulateDoubleBreak:!!l}),u=wl(c,o);for(u==null&&(u=$i(/^\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:K.range(o.mapPos(r.anchor,1),o.mapPos(r.head,1))}})}var L6=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=Object.create(null),r=new Hs(t,{overrideIndentation:o=>{let s=i[o];return s==null?-1:s}}),n=rk(t,(o,s,a)=>{let l=wl(r,o.from);if(l==null)return;/\S/.test(o.text)||(l=0);let c=/^\s*/.exec(o.text)[0],u=Hn(t,l);(c!=u||a.fromt.readOnly?!1:(e(t.update(rk(t,(i,r)=>{r.push({from:i.from,insert:t.facet(jr)})}),{userEvent:"input.indent"})),!0),Hf=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(rk(t,(i,r)=>{let n=/^\s*/.exec(i.text)[0];if(!n)return;let o=$i(n,t.tabSize),s=0,a=Hn(t,Math.max(0,o-gn(t)));for(;st.normalize("NFKD"):t=>t,fs=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(D6(a)):D6,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 li(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=Tu(e),r=this.bufferStart+this.bufferPos;this.bufferPos+=tr(e);let n=this.normalize(i);if(n.length)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=Xm(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 nk.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=Xm(this.text,n+(r==n?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Am.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}};typeof Symbol!="undefined"&&(Hl.prototype[Symbol.iterator]=$m.prototype[Symbol.iterator]=function(){return this});function _ie(t){try{return new RegExp(t,uk),!0}catch(e){return!1}}function Xm(t,e){if(e>=t.length)return e;let i=t.lineAt(e),r;for(;e=56320&&r<57344;)e++;return e}function ok(t){let e=String(t.state.doc.lineAt(t.state.selection.main.head).number),i=ft("input",{class:"cm-textfield",name:"line",value:e}),r=ft("form",{class:"cm-gotoLine",onkeydown:o=>{o.keyCode==27?(o.preventDefault(),t.dispatch({effects:Rm.of(!1)}),t.focus()):o.keyCode==13&&(o.preventDefault(),n())},onsubmit:o=>{o.preventDefault(),n()}},ft("label",t.state.phrase("Go to line"),": ",i)," ",ft("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,O=c?+c:a.number;if(c&&f){let v=O/100;l&&(v=v*(l=="-"?-1:1)+a.number/s.doc.lines),O=Math.round(s.doc.lines*v)}else c&&l&&(O=O*(l=="-"?-1:1)+a.number);let m=s.doc.line(Math.max(1,Math.min(s.doc.lines,O))),x=K.cursor(m.from+Math.max(0,Math.min(d,m.length)));t.dispatch({effects:[Rm.of(!1),fe.scrollIntoView(x.from,{y:"center"})],selection:x}),t.focus()}return{dom:r}}var Rm=Se.define(),z6=Ge.define({create(){return!0},update(t,e){for(let i of e.effects)i.is(Rm)&&(t=i.value);return t},provide:t=>vr.from(t,e=>e?ok:null)}),W6=t=>{let e=Bs(t,ok);if(!e){let i=[Rm.of(!0)];t.state.field(z6,!1)==null&&i.push(Se.appendConfig.of([z6,Aie])),t.dispatch({effects:i}),e=Bs(t,ok)}return e&&e.dom.querySelector("input").select(),!0},Aie=fe.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px","& label":{fontSize:"80%"}}}),$ie={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},V6=be.define({combine(t){return Qt(t,$ie,{highlightWordAroundCursor:(e,i)=>e||i,minSelectionLength:Math.min,maxMatches:Math.min})}});function Z6(t){let e=[Die,Iie];return t&&e.push(V6.of(t)),e}var Xie=we.mark({class:"cm-selectionMatch"}),Rie=we.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function U6(t,e,i,r){return(i==0||t(e.sliceDoc(i-1,i))!=pt.Word)&&(r==e.doc.length||t(e.sliceDoc(r,r+1))!=pt.Word)}function Lie(t,e,i,r){return t(e.sliceDoc(i,i+1))==pt.Word&&t(e.sliceDoc(r-1,r))==pt.Word}var Iie=He.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(V6),{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),!(U6(s,i,n.from,n.to)&&Lie(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 fs(i.doc,o,l.from,l.to);for(;!c.next().done;){let{from:u,to:f}=c.value;if((!s||U6(s,i,u,f))&&(n.empty&&u<=n.from&&f>=n.to?a.push(Rie.range(u,f)):(u>=n.to||f<=n.from)&&a.push(Xie.range(u,f)),a.length>e.maxMatches))return we.none}}return we.set(a)}},{decorations:t=>t.decorations}),Die=fe.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),zie=({state:t,dispatch:e})=>{let{selection:i}=t,r=K.create(i.ranges.map(n=>t.wordAt(n.head)||K.cursor(n.head)),i.mainIndex);return r.eq(i)?!1:(e(t.update({selection:r})),!0)};function Uie(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 fs(t.doc,e,r[r.length-1].to);;)if(a.next(),a.done){if(s)return null;a=new fs(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 B6=({state:t,dispatch:e})=>{let{ranges:i}=t.selection;if(i.some(o=>o.from===o.to))return zie({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=Uie(t,r);return n?(e(t.update({selection:t.selection.addRange(K.range(n.from,n.to),!1),effects:fe.scrollIntoView(n.to)})),!0):!1},Kl=be.define({combine(t){return Qt(t,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new ck(e),scrollToMatch:e=>fe.scrollIntoView(e)})}});var Gl=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||_ie(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"?`
+ `)})}}function cie(t){return e=>{let i=[];return bi(e,"element",r=>{if((r.properties&&Array.isArray(r.properties.className)?r.properties.className:[]).includes("mermaid")){let o=function(c){let u=aie.parse(c);g1(u,!0),r.children=u.children},s=pu(r,{whitespace:"pre"}),a=t.useDarkTheme?"dark":"default",l=FR(s,{theme:a}).then(o);i.push(l)}}),Promise.all(i).then(()=>null)}}function uie(t){return e=>{bi(e,"element",i=>{if(i.properties&&i.properties.href){let r=i.properties.href;Mw(r)?(i.properties["data-phx-link"]=t.baseUrl&&r.startsWith(t.baseUrl)?"patch":"redirect",i.properties["data-phx-link-state"]="push"):Uw(r)&&(i.properties.target="_blank",i.properties.rel="noreferrer noopener")}})}}function Uw(t){return/^([a-z]+:|\/\/)/i.test(t)}function fie(t){return t.startsWith("#")}function Mw(t){return t.startsWith("/")||t.startsWith(window.location.origin)}function HR(t,e){return t.replace(/\/$/,"")+"/"+e}var Ml=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)})}},at=new Ml;var GR=t=>typeof t=="object"&&t!=null&&t.nodeType===1,KR=(t,e)=>(!e||t!=="hidden")&&t!=="visible"&&t!=="clip",Nw=(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,hie=t=>{let e=t.parentElement;return e==null?t.getRootNode().host||null:e},qw=(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:re=>re!==c;if(!GR(t))throw new TypeError("Invalid target");let d=document.scrollingElement||document.documentElement,O=[],m=t;for(;GR(m)&&f(m);){if(m=hie(m),m===d){O.push(m);break}m!=null&&m===document.body&&Nw(m)&&!Nw(document.documentElement)||m!=null&&Nw(m,u)&&O.push(m)}let x=(r=(i=window.visualViewport)==null?void 0:i.width)!=null?r:innerWidth,v=(o=(n=window.visualViewport)==null?void 0:n.height)!=null?o:innerHeight,{scrollX:w,scrollY:T}=window,{height:A,width:L,top:D,right:P,bottom:q,left:le}=t.getBoundingClientRect(),G=a==="start"||a==="nearest"?D:a==="end"?q:D+A/2,M=l==="center"?le+L/2:l==="end"?P:le,ie=[];for(let re=0;re=0&&le>=0&&q<=v&&P<=x&&D>=ve&&q<=ue&&le>=Z&&P<=j)return ie;let C=getComputedStyle(ne),W=parseInt(C.borderLeftWidth,10),oe=parseInt(C.borderTopWidth,10),I=parseInt(C.borderRightWidth,10),Ne=parseInt(C.borderBottomWidth,10),We=0,Ve=0,Et="offsetWidth"in ne?ne.offsetWidth-ne.clientWidth-W-I:0,Xe="offsetHeight"in ne?ne.offsetHeight-ne.clientHeight-oe-Ne:0,Rt="offsetWidth"in ne?ne.offsetWidth===0?0:pe/ne.offsetWidth:0,Lt="offsetHeight"in ne?ne.offsetHeight===0?0:de/ne.offsetHeight:0;if(d===ne)We=a==="start"?G:a==="end"?G-v:a==="nearest"?cm(T,T+v,v,oe,Ne,T+G,T+G+A,A):G-v/2,Ve=l==="start"?M:l==="center"?M-x/2:l==="end"?M-x:cm(w,w+x,x,W,I,w+M,w+M+L,L),We=Math.max(0,We+T),Ve=Math.max(0,Ve+w);else{We=a==="start"?G-ve-oe:a==="end"?G-ue+Ne+Xe:a==="nearest"?cm(ve,ue,de,oe,Ne+Xe,G,G+A,A):G-(ve+de/2)+Xe/2,Ve=l==="start"?M-Z-W:l==="center"?M-(Z+pe/2)+Et/2:l==="end"?M-j+I+Et:cm(Z,j,pe,W,I+Et,M,M+L,L);let{scrollLeft:fr,scrollTop:hr}=ne;We=Math.max(0,Math.min(hr+We/Lt,ne.scrollHeight-de/Lt+Xe)),Ve=Math.max(0,Math.min(fr+Ve/Rt,ne.scrollWidth-pe/Rt+Et)),G+=hr-We,M+=fr-Ve}ie.push({el:ne,top:We,left:Ve})}return ie};var die=t=>t===!1?{block:"end",inline:"nearest"}:(e=>e===Object(e)&&Object.keys(e).length!==0)(t)?t:{block:"start",inline:"nearest"};function um(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(qw(t,e));let r=typeof e=="boolean"||e==null?void 0:e.behavior;for(let{el:n,top:o,left:s}of qw(t,die(e))){let a=o-i.top+i.bottom,l=s-i.left+i.right;n.scroll({top:a,left:l,behavior:r})}}function ma(t){return["code","smart","setup"].includes(t)}function JR(t){return["markdown","code","setup"].includes(t)}var Oie={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=[at.subscribe("navigation:focus_changed",({focusableId:t,scroll:e})=>this.handleElementFocused(t,e)),at.subscribe("navigation:insert_mode_changed",({enabled:t})=>this.handleInsertModeChanged(t)),at.subscribe("cells:cell_moved",({cellId:t})=>this.handleCellMoved(t)),at.subscribe(`cells:${this.props.cellId}:dispatch_queue_evaluation`,({dispatch:t})=>this.handleDispatchQueueEvaluation(t)),at.subscribe(`cells:${this.props.cellId}:jump_to_line`,({line:t,offset:e=0})=>this.handleJumpToLine(t,e))],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 Ot(this.el,["cell-id","type","session-path","evaluation-digest","smart-cell-js-view-ref","allowed-uri-schemes"])},handleElementFocused(t,e){this.props.cellId===t?(this.isFocused=!0,this.el.setAttribute("data-js-focused",""),e&&Oa(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(()=>{setTimeout(()=>{this.isFocused&&this.insertMode&&this.currentEditor().focus()},0)}),e.onFocus(()=>{setTimeout(()=>{!this.isFocused||!this.insertMode?this.currentEditor().blur():this.sendCursorHistory()},0)}),e.onSelectionChange(()=>{this.isFocused&&this.sendCursorHistory()}),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 pa(r,i,{baseUrl:this.props.sessionPath,emptyText:"Empty markdown cell",allowedUriSchemes:this.props.allowedUriSchemes});e.onChange(o=>{n.setContent(o)})}ma(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=nm(i),n=this.props.evaluationDigest!==r;this.el.toggleAttribute("data-js-changed",n)}},handleInsertModeChanged(t){this.isFocused&&!this.insertMode&&t?(this.insertMode=t,this.el.setAttribute("data-js-insert-mode",""),this.currentEditor()&&(this.currentEditor().focus(),this.scrollEditorCursorIntoViewIfNeeded())):this.insertMode&&!t&&(this.insertMode=t,this.el.removeAttribute("data-js-insert-mode"),this.currentEditor()&&this.currentEditor().blur())},handleCellMoved(t){this.isFocused&&t===this.props.cellId&&Oa(this.el)},handleDispatchQueueEvaluation(t){this.props.type==="smart"&&this.props.smartCellJsViewRef?at.broadcast(`js_views:${this.props.smartCellJsViewRef}:sync`,{callback:t}):t()},handleJumpToLine(t,e){this.isFocused&&this.currentEditor().moveCursorToLine(t,e)},scrollEditorCursorIntoViewIfNeeded(){let t=this.currentEditor().getElementAtCursor();ZR(t,{scrollMarginTop:"128px"},()=>{um(t,{scrollMode:"if-needed",behavior:"instant",block:"start"})})},sendCursorHistory(){let t=this.currentEditor().getCurrentCursorPosition();t!==null&&at.broadcast("navigation:cursor_moved",{line:t.line,offset:t.offset,cellId:this.props.cellId})}},e6=Oie;var Xf=t=>{let{state:e}=t,i=e.doc.lineAt(e.selection.main.from),r=Vw(t.state,i.from);return r.line?pie(t):r.block?mie(t):!1};function Rf(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 pie=Rf(Zw,0),t6=Rf(Zw,1),i6=Rf(Zw,2),r6=Rf(n6,0);var mie=Rf((t,e)=>n6(t,e,bie(e)),0);function Vw(t,e){let i=t.languageDataAt("commentTokens",e);return i.length?i[0]:{}}var $f=50;function gie(t,{open:e,close:i},r,n){let o=t.sliceDoc(r-$f,r),s=t.sliceDoc(n,n+$f),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*$f?u=f=t.sliceDoc(r,n):(u=t.sliceDoc(r,r+$f),f=t.sliceDoc(n-$f,n));let d=/^\s*/.exec(u)[0].length,O=/\s*$/.exec(f)[0].length,m=f.length-O-i.length;return u.slice(d,d+e.length)==e&&f.slice(m,m+i.length)==i?{open:{pos:r+d+e.length,margin:/\s/.test(u.charAt(d+e.length))?1:0},close:{pos:n-O-i.length,margin:/\s/.test(f.charAt(m-1))?1:0}}:null}function bie(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);n.from>r.from&&n.from==i.to&&(n=i.to==r.to+1?r:t.doc.lineAt(i.to-1));let 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 n6(t,e,i=e.selection.ranges){let r=i.map(o=>Vw(e,o.from).block);if(!r.every(o=>o))return null;let n=i.map((o,s)=>gie(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,O=d==f.length,m=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 Ww=wi.define(),yie=wi.define(),xie=be.define(),o6=be.define({combine(t){return Qt(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)})}}),s6=Ge.define({create(){return ga.empty},update(t,e){let i=e.state.facet(o6),r=e.annotation(Ww);if(r){let l=Zr.fromTransaction(e,r.selection),c=r.side,u=c==0?t.undone:t.done;return l?u=hm(u,u.length,i.minDepth,l):u=u6(u,e.startState.selection),new ga(c==0?r.rest:u,c==0?u:r.rest)}let n=e.annotation(yie);if((n=="full"||n=="before")&&(t=t.isolate()),e.annotation($t.addToHistory)===!1)return e.changes.empty?t:t.addMapping(e.changes.desc);let o=Zr.fromTransaction(e),s=e.annotation($t.time),a=e.annotation($t.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 ga(t.done.map(Zr.fromJSON),t.undone.map(Zr.fromJSON))}});function a6(t={}){return[s6,o6.of(t),fe.domEventHandlers({beforeinput(e,i){let r=e.inputType=="historyUndo"?ba:e.inputType=="historyRedo"?ss:null;return r?(e.preventDefault(),r(i)):!1}})]}function Bw(t,e){return function({state:i,dispatch:r}){if(!e&&i.readOnly)return!1;let n=i.field(s6,!1);if(!n)return!1;let o=n.pop(t,i,e);return o?(r(o),!0):!1}}var ba=Bw(0,!1),ss=Bw(1,!1),l6=Bw(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&&_i.fromJSON(e.changes),[],e.mapped&&Vn.fromJSON(e.mapped),e.startSelection&&K.fromJSON(e.startSelection),e.selectionsAfter.map(K.fromJSON))}static fromTransaction(e,i){let r=Cr;for(let n of e.startState.facet(xie)){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,Cr)}static selection(e){return new t(void 0,Cr,void 0,void 0,e)}};function hm(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 vie(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 wie(t,e){return t.ranges.length==e.ranges.length&&t.ranges.filter((i,r)=>i.empty!=e.ranges[r].empty).length===0}function c6(t,e){return t.length?e.length?t.concat(e):t:e}var Cr=[],kie=200;function u6(t,e){if(t.length){let i=t[t.length-1],r=i.selectionsAfter.slice(Math.max(0,i.selectionsAfter.length-kie));return r.length&&r[r.length-1].eq(e)?t:(r.push(e),hm(t,t.length-1,1e9,i.setSelAfter(r)))}else return[Zr.selection([e])]}function Sie(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 jw(t,e){if(!t.length)return t;let i=t.length,r=Cr;for(;i;){let n=Tie(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)]:Cr}function Tie(t,e,i){let r=c6(t.selectionsAfter.length?t.selectionsAfter.map(a=>a.map(e)):Cr,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 Eie=/^(input\.type|delete)($|\.)/,ga=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||Eie.test(r))&&(!a.selectionsAfter.length&&i-this.prevTime0&&i-this.prevTimei.empty?t.moveByChar(i,e):dm(i,e))}function ls(t){return t.textDirectionAt(t.state.selection.main.head)==st.LTR}var If=t=>Om(t,!ls(t)),Yw=t=>Om(t,ls(t)),f6=t=>Om(t,!0),pm=t=>Om(t,!1);function h6(t,e){return ya(t,i=>i.empty?t.moveByGroup(i,e):dm(i,e))}var mm=t=>h6(t,!ls(t)),gm=t=>h6(t,ls(t));var _Te=typeof Intl!="undefined"&&Intl.Segmenter?new Intl.Segmenter(void 0,{granularity:"word"}):null;function d6(t,e){return ya(t,i=>{if(!i.empty)return dm(i,e);let r=t.moveVertically(i,e);return r.head!=i.head?r:t.moveToLineBoundary(i,e)})}var Df=t=>d6(t,!1),zf=t=>d6(t,!0);function O6(t){let e=t.scrollDOM.clientHeights.empty?t.moveVertically(s,e,i.height):dm(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.bottomp6(t,!1),ql=t=>p6(t,!0);function bm(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=K.cursor(r.from+o))}return n}var Uf=t=>ya(t,e=>bm(t,e,!0)),Mf=t=>ya(t,e=>bm(t,e,!1));var ym=t=>ya(t,e=>K.cursor(t.lineBlockAt(e.head).from,1)),xm=t=>ya(t,e=>K.cursor(t.lineBlockAt(e.head).to,-1));function Pie(t,e,i){let r=!1,n=Lf(t.selection,o=>{let s=kr(t,o.head,-1)||kr(t,o.head,1)||o.head>0&&kr(t,o.head-1,1)||o.headPie(t,e,!1);function cs(t,e){let i=Lf(t.state.selection,r=>{let n=e(r);return K.range(r.anchor,n.head,n.goalColumn,n.bidiLevel||void 0)});return i.eq(t.state.selection)?!1:(t.dispatch(as(t.state,i)),!0)}function vm(t,e){return cs(t,i=>t.moveByChar(i,e))}var Fw=t=>vm(t,!ls(t)),Hw=t=>vm(t,ls(t)),Gw=t=>vm(t,!0),Kw=t=>vm(t,!1);function wm(t,e){return cs(t,i=>t.moveByGroup(i,e))}var km=t=>wm(t,!ls(t)),Sm=t=>wm(t,ls(t)),g6=t=>wm(t,!0),b6=t=>wm(t,!1);function y6(t,e){return cs(t,i=>t.moveVertically(i,e))}var jl=t=>y6(t,!1),Wl=t=>y6(t,!0);function x6(t,e){return cs(t,i=>t.moveVertically(i,e,O6(t).height))}var Nf=t=>x6(t,!1),xa=t=>x6(t,!0),Jw=t=>cs(t,e=>bm(t,e,!0)),ek=t=>cs(t,e=>bm(t,e,!1));var qf=t=>cs(t,e=>K.cursor(t.lineBlockAt(e.head).from)),jf=t=>cs(t,e=>K.cursor(t.lineBlockAt(e.head).to)),Wf=({state:t,dispatch:e})=>(e(as(t,{anchor:0})),!0),Vf=({state:t,dispatch:e})=>(e(as(t,{anchor:t.doc.length})),!0),Vl=({state:t,dispatch:e})=>(e(as(t,{anchor:t.selection.main.anchor,head:0})),!0),Zl=({state:t,dispatch:e})=>(e(as(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0),Tm=({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0),v6=({state:t,dispatch:e})=>{let i=Cm(t).map(({from:r,to:n})=>K.range(r,Math.min(n+1,t.doc.length)));return e(t.update({selection:K.create(i),userEvent:"select"})),!0};function Em(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=fm(t,l,!0)),s=Math.min(s,l),a=Math.max(a,l)}else s=fm(t,s,!1),a=fm(t,a,!0);return s==a?{range:o}:{changes:{from:s,to:a},range:K.cursor(s,sn(t)))r.between(e,e,(n,o)=>{ne&&(e=i?o:n)});return e}var w6=(t,e,i)=>Em(t,r=>{let n=r.from,{state:o}=t,s=o.doc.lineAt(n),a,l;if(i&&!e&&n>s.from&&nw6(t,!1,!0);var Zf=t=>w6(t,!0,!1),k6=(t,e)=>Em(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=Zt(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}),tk=t=>k6(t,!1),S6=t=>k6(t,!0),ik=t=>Em(t,e=>{let i=t.lineBlockAt(e.head).to;return e.headEm(t,e=>{let i=t.lineBlockAt(e.head).from;return e.head>i?i:Math.max(0,e.head-1)});var Bf=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange(r=>({changes:{from:r.from,to:r.to,insert:Fe.of(["",""])},range:K.cursor(r.from)}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0},Pm=({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:Zt(o.text,n-o.from,!1)+o.from,a=n==o.to?n+1:Zt(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:K.cursor(a)}});return i.changes.empty?!1:(e(t.update(i,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function Cm(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 E6(t,e,i){if(t.readOnly)return!1;let r=[],n=[];for(let o of Cm(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(K.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(K.range(l.anchor-a,l.head-a))}}return r.length?(e(t.update({changes:r,scrollIntoView:!0,selection:K.create(n,t.selection.mainIndex),userEvent:"move.line"})),!0):!1}var P6=({state:t,dispatch:e})=>E6(t,e,!1),C6=({state:t,dispatch:e})=>E6(t,e,!0);function Q6(t,e,i){if(t.readOnly)return!1;let r=[];for(let n of Cm(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 _6=({state:t,dispatch:e})=>Q6(t,e,!1),A6=({state:t,dispatch:e})=>Q6(t,e,!0),$6=t=>{if(t.state.readOnly)return!1;let{state:e}=t,i=e.changes(Cm(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 Cie(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let i=qe(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(_e.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 Yf=R6(!1),X6=R6(!0);function R6(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&&Cie(e,o);t&&(o=s=(s<=a.to?a:e.doc.lineAt(s)).to);let c=new Hs(e,{simulateBreak:o,simulateDoubleBreak:!!l}),u=wl(c,o);for(u==null&&(u=$i(/^\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:K.range(o.mapPos(r.anchor,1),o.mapPos(r.head,1))}})}var L6=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=Object.create(null),r=new Hs(t,{overrideIndentation:o=>{let s=i[o];return s==null?-1:s}}),n=rk(t,(o,s,a)=>{let l=wl(r,o.from);if(l==null)return;/\S/.test(o.text)||(l=0);let c=/^\s*/.exec(o.text)[0],u=Hn(t,l);(c!=u||a.fromt.readOnly?!1:(e(t.update(rk(t,(i,r)=>{r.push({from:i.from,insert:t.facet(jr)})}),{userEvent:"input.indent"})),!0),Hf=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(rk(t,(i,r)=>{let n=/^\s*/.exec(i.text)[0];if(!n)return;let o=$i(n,t.tabSize),s=0,a=Hn(t,Math.max(0,o-gn(t)));for(;st.normalize("NFKD"):t=>t,fs=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(D6(a)):D6,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 li(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=Tu(e),r=this.bufferStart+this.bufferPos;this.bufferPos+=tr(e);let n=this.normalize(i);if(n.length)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=Xm(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 nk.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=Xm(this.text,n+(r==n?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Am.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}};typeof Symbol!="undefined"&&(Hl.prototype[Symbol.iterator]=$m.prototype[Symbol.iterator]=function(){return this});function _ie(t){try{return new RegExp(t,uk),!0}catch(e){return!1}}function Xm(t,e){if(e>=t.length)return e;let i=t.lineAt(e),r;for(;e=56320&&r<57344;)e++;return e}function ok(t){let e=String(t.state.doc.lineAt(t.state.selection.main.head).number),i=ft("input",{class:"cm-textfield",name:"line",value:e}),r=ft("form",{class:"cm-gotoLine",onkeydown:o=>{o.keyCode==27?(o.preventDefault(),t.dispatch({effects:Rm.of(!1)}),t.focus()):o.keyCode==13&&(o.preventDefault(),n())},onsubmit:o=>{o.preventDefault(),n()}},ft("label",t.state.phrase("Go to line"),": ",i)," ",ft("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,O=c?+c:a.number;if(c&&f){let v=O/100;l&&(v=v*(l=="-"?-1:1)+a.number/s.doc.lines),O=Math.round(s.doc.lines*v)}else c&&l&&(O=O*(l=="-"?-1:1)+a.number);let m=s.doc.line(Math.max(1,Math.min(s.doc.lines,O))),x=K.cursor(m.from+Math.max(0,Math.min(d,m.length)));t.dispatch({effects:[Rm.of(!1),fe.scrollIntoView(x.from,{y:"center"})],selection:x}),t.focus()}return{dom:r}}var Rm=Se.define(),z6=Ge.define({create(){return!0},update(t,e){for(let i of e.effects)i.is(Rm)&&(t=i.value);return t},provide:t=>vr.from(t,e=>e?ok:null)}),W6=t=>{let e=Bs(t,ok);if(!e){let i=[Rm.of(!0)];t.state.field(z6,!1)==null&&i.push(Se.appendConfig.of([z6,Aie])),t.dispatch({effects:i}),e=Bs(t,ok)}return e&&e.dom.querySelector("input").select(),!0},Aie=fe.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px","& label":{fontSize:"80%"}}}),$ie={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},V6=be.define({combine(t){return Qt(t,$ie,{highlightWordAroundCursor:(e,i)=>e||i,minSelectionLength:Math.min,maxMatches:Math.min})}});function Z6(t){let e=[Die,Iie];return t&&e.push(V6.of(t)),e}var Xie=we.mark({class:"cm-selectionMatch"}),Rie=we.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function U6(t,e,i,r){return(i==0||t(e.sliceDoc(i-1,i))!=pt.Word)&&(r==e.doc.length||t(e.sliceDoc(r,r+1))!=pt.Word)}function Lie(t,e,i,r){return t(e.sliceDoc(i,i+1))==pt.Word&&t(e.sliceDoc(r-1,r))==pt.Word}var Iie=He.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(V6),{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),!(U6(s,i,n.from,n.to)&&Lie(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 fs(i.doc,o,l.from,l.to);for(;!c.next().done;){let{from:u,to:f}=c.value;if((!s||U6(s,i,u,f))&&(n.empty&&u<=n.from&&f>=n.to?a.push(Rie.range(u,f)):(u>=n.to||f<=n.from)&&a.push(Xie.range(u,f)),a.length>e.maxMatches))return we.none}}return we.set(a)}},{decorations:t=>t.decorations}),Die=fe.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),zie=({state:t,dispatch:e})=>{let{selection:i}=t,r=K.create(i.ranges.map(n=>t.wordAt(n.head)||K.cursor(n.head)),i.mainIndex);return r.eq(i)?!1:(e(t.update({selection:r})),!0)};function Uie(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 fs(t.doc,e,r[r.length-1].to);;)if(a.next(),a.done){if(s)return null;a=new fs(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 B6=({state:t,dispatch:e})=>{let{ranges:i}=t.selection;if(i.some(o=>o.from===o.to))return zie({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=Uie(t,r);return n?(e(t.update({selection:t.selection.addRange(K.range(n.from,n.to),!1),effects:fe.scrollIntoView(n.to)})),!0):!1},Kl=be.define({combine(t){return Qt(t,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new ck(e),scrollToMatch:e=>fe.scrollIntoView(e)})}});var Gl=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||_ie(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 ak(this):new sk(this)}getCursor(e,i=0,r){let n=e.doc?e:ot.create({doc:e});return r==null&&(r=n.doc.length),this.regexp?Fl(this,n,i,r):Yl(this,n,i,r)}},Lm=class{constructor(e){this.spec=e}};function Yl(t,e,i,r){return new fs(e.doc,t.unquoted,i,r,t.caseSensitive?void 0:n=>n.toLowerCase(),t.wholeWord?Mie(e.doc,e.charCategorizer(e.selection.main.head)):void 0)}function Mie(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=Yl(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 Fl(t,e,i,r){return new Hl(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:t.wholeWord?Nie(e.charCategorizer(e.selection.main.head)):void 0},i,r)}function Im(t,e){return t.slice(Zt(t,e,!1),e)}function Dm(t,e){return t.slice(e,Zt(t,e))}function Nie(t){return(e,i,r)=>!r[0].length||(t(Im(r.input,r.index))!=pt.Word||t(Dm(r.input,r.index))!=pt.Word)&&(t(Dm(r.input,r.index+r[0].length))!=pt.Word||t(Im(r.input,r.index+r[0].length))!=pt.Word)}var ak=class extends Lm{nextMatch(e,i,r){let n=Fl(this.spec,e,r,e.doc.length).next();return n.done&&(n=Fl(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=Fl(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=Fl(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)}},co=Se.define(),fk=Se.define(),us=Ge.define({create(t){return new Gf(lk(t).create(),null)},update(t,e){for(let i of e.effects)i.is(co)?t=new Gf(i.value.create(),t.panel):i.is(fk)&&(t=new Gf(t.query,i.value?Ok:null));return t},provide:t=>vr.from(t,e=>e.panel)});var Gf=class{constructor(e,i){this.query=e,this.panel=i}},qie=we.mark({class:"cm-searchMatch"}),jie=we.mark({class:"cm-searchMatch cm-searchMatch-selected"}),Wie=He.fromClass(class{constructor(t){this.view=t,this.decorations=this.highlight(t.state.field(us))}update(t){let e=t.state.field(us);(e!=t.startState.field(us)||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 Ai;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?jie:qie)})}return r.finish()}},{decorations:t=>t.decorations});function Kf(t){return e=>{let i=e.state.field(us,!1);return i&&i.query.spec.valid?t(e,i):Jl(e)}}var M6=Kf((t,{query:e})=>{let{to:i}=t.state.selection.main,r=e.nextMatch(t.state,i,i);if(!r)return!1;let n=K.single(r.from,r.to),o=t.state.facet(Kl);return t.dispatch({selection:n,effects:[mk(t,r),o.scrollToMatch(n.main,t)],userEvent:"select.search"}),H6(t),!0}),N6=Kf((t,{query:e})=>{let{state:i}=t,{from:r}=i.selection.main,n=e.prevMatch(i,r,r);if(!n)return!1;let o=K.single(n.from,n.to),s=t.state.facet(Kl);return t.dispatch({selection:o,effects:[mk(t,n),s.scrollToMatch(o.main,t)],userEvent:"select.search"}),H6(t),!0}),hk=Kf((t,{query:e})=>{let i=e.matchAll(t.state,1e3);return!i||!i.length?!1:(t.dispatch({selection:K.create(i.map(r=>K.range(r.from,r.to))),userEvent:"select.search.matches"}),!0)}),Y6=({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 fs(t.doc,t.sliceDoc(r,n));!a.next().done;){if(o.length>1e3)return!1;a.value.from==r&&(s=o.length),o.push(K.range(a.value.from,a.value.to))}return e(t.update({selection:K.create(o,s),userEvent:"select.search.matches"})),!0},q6=Kf((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=o,a=[],l,c,u=[];if(s.from==r&&s.to==n&&(c=i.toText(e.getReplacement(s)),a.push({from:s.from,to:s.to,insert:c}),s=e.nextMatch(i,s.from,s.to),u.push(fe.announce.of(i.phrase("replaced match on line $",i.doc.lineAt(r).number)+"."))),s){let f=a.length==0||a[0].from>=o.to?0:o.to-o.from-c.length;l=K.single(s.from-f,s.to-f),u.push(mk(t,s)),u.push(i.facet(Kl).scrollToMatch(l.main,t))}return t.dispatch({changes:a,selection:l,effects:u,userEvent:"input.replace"}),!0}),dk=Kf((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:fe.announce.of(r),userEvent:"input.replace.all"}),!0});function Ok(t){return t.state.facet(Kl).createPanel(t)}function lk(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(Kl);return new Gl({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 F6(t){let e=Bs(t,Ok);return e&&e.dom.querySelector("[main-field]")}function H6(t){let e=F6(t);e&&e==t.root.activeElement&&e.select()}var Jl=t=>{let e=t.state.field(us,!1);if(e&&e.panel){let i=F6(t);if(i&&i!=t.root.activeElement){let r=lk(t.state,e.query.spec);r.valid&&t.dispatch({effects:co.of(r)}),i.focus(),i.select()}}else t.dispatch({effects:[fk.of(!0),e?co.of(lk(t.state,e.query.spec)):Se.appendConfig.of(Zie)]});return!0},pk=t=>{let e=t.state.field(us,!1);if(!e||!e.panel)return!1;let i=Bs(t,Ok);return i&&i.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:fk.of(!1)}),!0};var ck=class{constructor(e){this.view=e;let i=this.query=e.state.field(us).query.spec;this.commit=this.commit.bind(this),this.searchField=ft("input",{value:i.search,placeholder:lr(e,"Find"),"aria-label":lr(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=ft("input",{value:i.replace,placeholder:lr(e,"Replace"),"aria-label":lr(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=ft("input",{type:"checkbox",name:"case",form:"",checked:i.caseSensitive,onchange:this.commit}),this.reField=ft("input",{type:"checkbox",name:"re",form:"",checked:i.regexp,onchange:this.commit}),this.wordField=ft("input",{type:"checkbox",name:"word",form:"",checked:i.wholeWord,onchange:this.commit});function r(n,o,s){return ft("button",{class:"cm-button",name:n,onclick:o,type:"button"},s)}this.dom=ft("div",{onkeydown:n=>this.keydown(n),class:"cm-search"},[this.searchField,r("next",()=>M6(e),[lr(e,"next")]),r("prev",()=>N6(e),[lr(e,"previous")]),r("select",()=>hk(e),[lr(e,"all")]),ft("label",null,[this.caseField,lr(e,"match case")]),ft("label",null,[this.reField,lr(e,"regexp")]),ft("label",null,[this.wordField,lr(e,"by word")]),...e.state.readOnly?[]:[ft("br"),this.replaceField,r("replace",()=>q6(e),[lr(e,"replace")]),r("replaceAll",()=>dk(e),[lr(e,"replace all")])],ft("button",{name:"close",onclick:()=>pk(e),"aria-label":lr(e,"close"),type:"button"},["\xD7"])])}commit(){let e=new Gl({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:co.of(e)}))}keydown(e){Jy(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?N6:M6)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),q6(this.view))}update(e){for(let i of e.transactions)for(let r of i.effects)r.is(co)&&!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(Kl).top}};function lr(t,e){return t.state.phrase(e)}var Qm=30,_m=/[\s\.,:;?!]/;function mk(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-Qm),s=Math.min(n,i+Qm),a=t.state.sliceDoc(o,s);if(o!=r.from){for(let l=0;la.length-Qm;l--)if(!_m.test(a[l-1])&&_m.test(a[l])){a=a.slice(0,l);break}}return fe.announce.of(`${t.state.phrase("current match")}. ${a} ${t.state.phrase("on line")} ${r.number}.`)}var Vie=fe.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"}}),Zie=[us,Dt.low(Wie),Vie];var Um=class{constructor(e,i,r){this.from=e,this.to=i,this.diagnostic=r}},va=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(Jf).markerFilter;o&&(n=o(n,r));let s=e.slice().sort((f,d)=>f.from-d.from||f.to-d.to),a=new Ai,l=[],c=0;for(let f=0;;){let d=f==s.length?null:s[f];if(!d&&!l.length)break;let O,m;for(l.length?(O=c,m=l.reduce((v,w)=>Math.min(v,w.to),d&&d.from>O?d.from:1e8)):(O=d.from,m=d.to,l.push(d),f++);fv.from||v.to==O))l.push(v),f++,m=Math.min(v.to,m);else{m=Math.min(v.from,m);break}}let x=ere(l);if(l.some(v=>v.from==v.to||v.from==v.to-1&&r.doc.lineAt(v.from).to==v.from))a.add(O,O,we.widget({widget:new gk(x),diagnostics:l.slice()}));else{let v=l.reduce((w,T)=>T.markClass?w+" "+T.markClass:w,"");a.add(O,m,we.mark({class:"cm-lintRange cm-lintRange-"+x+v,diagnostics:l.slice(),inclusiveEnd:l.some(w=>w.to>m)}))}c=m;for(let v=0;v{if(!(e&&s.diagnostics.indexOf(e)<0))if(!r)r=new Um(n,o,e||s.diagnostics[0]);else{if(s.diagnostics.indexOf(r.diagnostic)<0)return!1;r=new Um(r.from,o,r.diagnostic)}}),r}function Bie(t,e){let i=e.pos,r=e.end||i,n=t.state.facet(Jf).hideOn(t,i,r);if(n!=null)return n;let o=t.startState.doc.lineAt(e.pos);return!!(t.effects.some(s=>s.is(bk))||t.changes.touchesRange(o.from,Math.max(o.to,r)))}function K6(t,e){return t.field(cr,!1)?e:e.concat(Se.appendConfig.of(tre))}function J6(t,e){return{effects:K6(t,[bk.of(e)])}}var bk=Se.define(),yk=Se.define(),eL=Se.define(),cr=Ge.define({create(){return new va(we.none,null,null)},update(t,e){if(e.docChanged&&t.diagnostics.size){let i=t.diagnostics.map(e.changes),r=null,n=t.panel;if(t.selected){let o=e.changes.mapPos(t.selected.from,1);r=ec(i,t.selected.diagnostic,o)||ec(i,null,o)}!i.size&&n&&e.state.facet(Jf).autoPanel&&(n=null),t=new va(i,n,r)}for(let i of e.effects)if(i.is(bk)){let r=e.state.facet(Jf).autoPanel?i.value.length?eh.open:null:t.panel;t=va.init(i.value,r,e.state)}else i.is(yk)?t=new va(t.diagnostics,i.value?eh.open:null,t.selected):i.is(eL)&&(t=new va(t.diagnostics,t.panel,i.value));return t},provide:t=>[vr.from(t,e=>e.panel),fe.decorations.from(t,e=>e.diagnostics)]});var Yie=we.mark({class:"cm-lintRange cm-lintRange-active"});function Fie(t,e,i){let{diagnostics:r}=t.state.field(cr),n,o=-1,s=-1;r.between(e-(i<0?1:0),e+(i>0?1:0),(l,c,{spec:u})=>{if(e>=l&&e<=c&&(l==c||(e>l||i>0)&&(enL(t,i,!1)))}var tL=t=>{let e=t.state.field(cr,!1);(!e||!e.panel)&&t.dispatch({effects:K6(t.state,[yk.of(!0)])});let i=Bs(t,eh.open);return i&&i.dom.querySelector(".cm-panel-lint ul").focus(),!0},G6=t=>{let e=t.state.field(cr,!1);return!e||!e.panel?!1:(t.dispatch({effects:yk.of(!1)}),!0)},iL=t=>{let e=t.state.field(cr,!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 Jf=be.define({combine(t){return Object.assign({sources:t.map(e=>e.source).filter(e=>e!=null)},Qt(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 rL(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 nL(t,e,i){var r;let n=i?rL(e.actions):[];return ft("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},ft("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 O=ec(t.state.field(cr).diagnostics,e);O&&o.apply(t,O.from,O.to)},{name:c}=o,u=n[s]?c.indexOf(n[s]):-1,f=u<0?c:[c.slice(0,u),ft("u",c.slice(u,u+1)),c.slice(u+1)];return ft("button",{type:"button",class:"cm-diagnosticAction",onclick:l,onmousedown:l,"aria-label":` Action: ${c}${u<0?"":` (access key "${n[s]})"`}.`},f)}),e.source&&ft("div",{class:"cm-diagnosticSource"},e.source))}var gk=class extends ti{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return ft("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}},Mm=class{constructor(e,i){this.diagnostic=i,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=nL(e,i,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}},eh=class t{constructor(e){this.view=e,this.items=[];let i=n=>{if(n.keyCode==27)G6(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=rL(o.actions);for(let a=0;a{for(let o=0;oG6(this.view)},"\xD7")),this.update()}get selectedIndex(){let e=this.view.state.field(cr).selected;if(!e)return-1;for(let i=0;i{for(let u of c.diagnostics){if(s.has(u))continue;s.add(u);let f=-1,d;for(let O=r;Or&&(this.items.splice(r,f-r),n=!0)),i&&d.diagnostic==i.diagnostic?d.dom.hasAttribute("aria-selected")||(d.dom.setAttribute("aria-selected","true"),o=d):d.dom.hasAttribute("aria-selected")&&d.dom.removeAttribute("aria-selected"),r++}});r({sel:o.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:a,panel:l})=>{let c=l.height/this.list.offsetHeight;a.topl.bottom&&(this.list.scrollTop+=(a.bottom-l.bottom)/c)}})):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(cr),r=ec(i.diagnostics,this.items[e].diagnostic);r&&this.view.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0,effects:eL.of(r)})}static open(e){return new t(e)}};function Gie(t,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,')`}function zm(t){return Gie(``,'width="6" height="3"')}var Kie=fe.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:zm("#d11")},".cm-lintRange-warning":{backgroundImage:zm("orange")},".cm-lintRange-info":{backgroundImage:zm("#999")},".cm-lintRange-hint":{backgroundImage:zm("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}}});function Jie(t){return t=="error"?4:t=="warning"?3:t=="info"?2:1}function ere(t){let e="hint",i=1;for(let r of t){let n=Jie(r.severity);n>i&&(i=n,e=r.severity)}return e}var tre=[cr,fe.decorations.compute([cr],t=>{let{selected:e,panel:i}=t.field(cr);return!e||!i||e.from==e.to?we.none:we.set([Yie.range(e.from,e.to)])}),ip(Fie,{hideOn:Bie}),Kie];var oL=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},ire=oL("up"),rre=oL("down"),nre=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(K.range(o,o)):e=K.single(o),r=n.to+1}return e?(t.dispatch({selection:e}),!0):!1},sL=[{key:"Ctrl-Space",run:Sl},{key:"Escape",run:of},{key:"ArrowDown",run:Kn(!0)},{key:"ArrowUp",run:Kn(!1)},{key:"PageDown",run:Kn(!0,"page")},{key:"PageUp",run:Kn(!1,"page")},{key:"Enter",run:bp},{key:"Tab",run:bp},{key:"Mod-f",run:Jl,scope:"editor search-panel"},{key:"Escape",run:pk,scope:"editor search-panel"},{key:"Alt-Enter",run:hk,scope:"editor search-panel"},{key:"Mod-Alt-Enter",run:dk,scope:"editor search-panel"},{key:"Ctrl-g",run:W6},{key:"Mod-d",run:B6,preventDefault:!0},{key:"Shift-Mod-l",run:Y6},{key:"Enter",run:Yf,shift:Yf},{key:"ArrowLeft",run:If,shift:Fw,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:mm,shift:km},{key:"ArrowRight",run:Yw,shift:Hw,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:gm,shift:Sm},{key:"ArrowUp",run:Df,shift:jl,preventDefault:!0},{key:"ArrowDown",run:zf,shift:Wl,preventDefault:!0},{key:"Home",run:Mf,shift:ek},{mac:"Cmd-ArrowLeft",run:Mf,shift:ek},{key:"Mod-Home",run:Wf,shift:Vl},{mac:"Cmd-ArrowUp",run:Wf,shift:Vl},{key:"PageUp",run:Nl,shift:Nf},{mac:"Ctrl-ArrowUp",run:Nl,shift:Nf},{key:"PageDown",run:ql,shift:xa},{mac:"Ctrl-ArrowDown",run:ql,shift:xa},{key:"End",run:Uf,shift:Jw},{mac:"Cmd-ArrowRight",run:Uf,shift:Jw},{key:"Mod-Alt-ArrowUp",linux:"Shift-Alt-ArrowUp",run:ire,preventDefault:!0},{key:"Mod-Alt-ArrowDown",linux:"Shift-Alt-ArrowDown",run:rre,preventDefault:!0},{key:"Shift-Alt-i",run:nre},{key:"Mod-End",run:Vf,shift:Zl},{mac:"Cmd-ArrowDown",run:Vf,shift:Zl},{key:"Mod-a",run:Tm},{key:"Backspace",run:f_},{key:"Backspace",run:Bl,shift:Bl},{key:"Delete",run:Zf},{key:"Mod-Backspace",mac:"Alt-Backspace",run:tk},{key:"Mod-Delete",mac:"Alt-Delete",run:S6},{mac:"Mod-Backspace",run:T6},{mac:"Mod-Delete",run:ik},{mac:"Ctrl-b",run:If,shift:Fw,preventDefault:!0},{mac:"Ctrl-f",run:Yw,shift:Hw},{mac:"Ctrl-p",run:Df,shift:jl},{mac:"Ctrl-n",run:zf,shift:Wl},{mac:"Ctrl-a",run:ym,shift:qf},{mac:"Ctrl-e",run:xm,shift:jf},{mac:"Ctrl-d",run:Zf},{mac:"Ctrl-h",run:Bl},{mac:"Ctrl-k",run:ik},{mac:"Ctrl-Alt-h",run:tk},{mac:"Ctrl-o",run:Bf},{mac:"Ctrl-t",run:Pm},{mac:"Ctrl-v",run:ql},{mac:"Alt-v",run:Nl},{key:"Shift-Mod-k",run:$6},{key:"Alt-ArrowDown",run:C6},{key:"Alt-ArrowUp",run:P6},{win:"Shift-Alt-ArrowDown",mac:"Shift-Alt-ArrowDown",run:A6},{win:"Shift-Alt-ArrowUp",mac:"Shift-Alt-ArrowUp",run:_6},{key:"Mod-l",run:v6,preventDefault:!0},{key:"Shift-Mod-\\",run:m6},{key:"Tab",run:Ff,shift:Hf,preventDefault:!0},{key:"Mod-[",run:Hf},{key:"Mod-]",run:Ff},{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:dp},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:XQ},{key:"Mod-k Mod-0",run:LQ},{key:"Mod-k Mod-j",run:IQ},{key:"Mod-k Mod-c",run:t6},{key:"Mod-k Mod-u",run:i6},{key:"Mod-/",run:Xf},{key:"Shift-Alt-a",run:r6},{key:"Mod-z",run:ba,preventDefault:!0},{key:"Mod-y",run:ss,preventDefault:!0},{key:"Mod-Shift-z",run:ss,preventDefault:!0},{key:"Mod-u",run:l6,preventDefault:!0},{key:"Mod-Shift-m",run:tL},{key:"F8",run:iL}];function ore(t){var e=t.Pos;function i(h,p,b){if(p.line===b.line&&p.ch>=b.ch-1){var y=h.getLine(p.line),k=y.charCodeAt(p.ch);55296<=k&&k<=55551&&(b.ch+=1)}return{start:p,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=fr("");function a(h){h.setOption("disableInput",!0),h.setOption("showCursorWhenSelecting",!1),t.signal(h,"vim-mode-change",{mode:"normal"}),h.on("cursorActivity",aS),ve(h),t.on(h.getInputField(),"paste",c(h))}function l(h){h.setOption("disableInput",!1),h.off("cursorActivity",aS),t.off(h.getInputField(),"paste",c(h)),h.state.vim=null,uc&&clearTimeout(uc)}function c(h){var p=h.state.vim;return p.onPasteFn||(p.onPasteFn=function(){p.insertMode||(h.setCursor($e(h.getCursor(),0,1)),ce.enterInsertMode(h,{},p))}),p.onPasteFn}var u=/[\d]/,f=[t.isWordChar,function(h){return h&&!t.isWordChar(h)&&!/\s/.test(h)}],d=[function(h){return/\S/.test(h)}],O=["<",">"],m=["-",'"',".",":","_","/","+"],x=/^\w$/,v;try{v=new RegExp("^[\\p{Lu}]$","u")}catch(h){v=/^[A-Z]$/}function w(h,p){return p>=h.firstLine()&&p<=h.lastLine()}function T(h){return/^[a-z]$/.test(h)}function A(h){return"()[]{}".indexOf(h)!=-1}function L(h){return u.test(h)}function D(h){return v.test(h)}function P(h){return/^\s*$/.test(h)}function q(h){return".?!".indexOf(h)!=-1}function le(h,p){for(var b=0;b1&&p.setOption("textwidth",y)}});var ne=function(){var h=100,p=-1,b=0,y=0,k=new Array(h);function S(X,U,N){var J=p%h,te=k[J];function F(se){var he=++p%h,Ae=k[he];Ae&&Ae.clear(),k[he]=X.setBookmark(se)}if(te){var V=te.find();V&&!vt(V,U)&&F(U)}else F(U);F(N),b=p,y=p-h+1,y<0&&(y=0)}function Q(X,U){p+=U,p>b?p=b:p0?1:-1,te,F=X.getCursor();do if(p+=J,N=k[(h+p)%h],N&&(te=N.find())&&!vt(F,te))break;while(py)}return N}function $(X,U){var N=p,J=Q(X,U);return p=N,J&&J.find()}return{cachedCursor:void 0,add:S,find:$,move:Q}},de=function(h){return h?{changes:h.changes,expectCursorActivityForChange:h.expectCursorActivityForChange}:{changes:[],expectCursorActivityForChange:!1}};class pe{constructor(){this.latestRegister=void 0,this.isPlaying=!1,this.isRecording=!1,this.replaySearchQueries=[],this.onRecordingDone=void 0,this.lastInsertModeChanges=de()}exitMacroRecordMode(){var p=j.macroModeState;p.onRecordingDone&&p.onRecordingDone(),p.onRecordingDone=void 0,p.isRecording=!1}enterMacroRecordMode(p,b){var y=j.registerController.getRegister(b);if(y){if(y.clear(),this.latestRegister=b,p.openDialog){var k=yo("span",{class:"cm-vim-message"},"recording @"+b);this.onRecordingDone=p.openDialog(k,null,{bottom:!0})}this.isRecording=!0}}}function ve(h){return h.state.vim||(h.state.vim={inputState:new hr,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 j;function ue(){j={searchQuery:null,searchIsReversed:!1,lastSubstituteReplacePart:void 0,jumpList:ne(),macroModeState:new pe,lastCharacterSearch:{increment:0,forward:!0,selectedCharacter:""},registerController:new yg({}),searchHistoryController:new sc,exCommandHistoryController:new sc};for(var h in G){var p=G[h];p.value=p.defaultValue}}var Z,C={enterVimMode:a,leaveVimMode:l,buildKeyMap:function(){},getRegisterController:function(){return j.registerController},resetVimGlobalState_:ue,getVimGlobalState_:function(){return j},maybeInitVimState_:ve,suppressErrorLogging:!1,InsertModeKey:Cg,map:function(h,p,b){Rr.map(h,p,b)},unmap:function(h,p){return Rr.unmap(h,p)},noremap:function(h,p,b){Rr.map(h,p,b,!0)},mapclear:function(h){var p=r.length,b=n,y=r.slice(0,p-b);if(r=r.slice(p-b),h)for(var k=y.length-1;k>=0;k--){var S=y[k];if(h!==S.context)if(S.context)this._mapCommand(S);else{var Q=["normal","insert","visual"];for(var $ in Q)if(Q[$]!==h){var X=Object.assign({},S);X.context=Q[$],this._mapCommand(X)}}}},langmap:Lt,vimKeyFromEvent:Rt,setOption:ie,getOption:re,defineOption:M,defineEx:function(h,p,b){if(!p)p=h;else if(h.indexOf(p)!==0)throw new Error('(Vim.defineEx) "'+p+'" is not a prefix of "'+h+'", command not registered');nS[h]=b,Rr.commandMap_[p]={name:h,shortName:p,type:"api"}},handleKey:function(h,p,b){var y=this.findKey(h,p,b);if(typeof y=="function")return y()},multiSelectHandleKey:cD,findKey:function(h,p,b){var y=ve(h),k=h;function S(){var N=j.macroModeState;if(N.isRecording){if(p=="q")return N.exitMacroRecordMode(),Nt(k),!0;b!="mapping"&&sD(N,p)}}function Q(){if(p==""){if(y.visualMode)Gr(k);else if(y.insertMode)xo(k);else return;return Nt(k),!0}}function $(){if(Q())return!0;y.inputState.keyBuffer.push(p);var N=y.inputState.keyBuffer.join(""),J=p.length==1,te=Hr.matchCommand(N,r,y.inputState,"insert"),F=y.inputState.changeQueue;if(te.type=="none")return Nt(k),!1;if(te.type=="partial"){if(te.expectLiteralNext&&(y.expectLiteralNext=!0),Z&&window.clearTimeout(Z),Z=J&&window.setTimeout(function(){y.insertMode&&y.inputState.keyBuffer.length&&Nt(k)},re("insertModeEscKeysTimeout")),J){var V=k.listSelections();(!F||F.removed.length!=V.length)&&(F=y.inputState.changeQueue=new xh),F.inserted+=p;for(var se=0;se|./gi,Q;Q=S.exec(p);){var $=Q[0],X=k.insertMode;if(I){Ne($);continue}var U=C.handleKey(h,$,"mapping");if(!U&&X&&k.insertMode){if($[0]=="<"){var N=$.toLowerCase().slice(1,-1),J=N.split("-");if(N=J.pop()||"",N=="lt")$="<";else if(N=="space")$=" ";else if(N=="cr")$=`