@foris/avocado-not-front 0.21.2 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -587,7 +587,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
587
587
|
`&&t.lineWrapping&&(r&&(r=Q.single(r.main.anchor-1,r.main.head-1)),n={from:i.from,to:i.to,insert:We.of([" "])}),n)return rg(t,n,r,o);if(r&&!r.main.eq(i)){let a=!1,s="select";return t.inputState.lastSelectionTime>Date.now()-50&&(t.inputState.lastSelectionOrigin=="select"&&(a=!0),s=t.inputState.lastSelectionOrigin),t.dispatch({selection:r,scrollIntoView:a,userEvent:s}),!0}else return!1}function rg(t,e,n,r=-1){if(se.ios&&t.inputState.flushIOSKey(e))return!0;let i=t.state.selection.main;if(se.android&&(e.to==i.to&&(e.from==i.from||e.from==i.from-1&&t.state.sliceDoc(e.from,i.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&Fs(t.contentDOM,"Enter",13)||(e.from==i.from-1&&e.to==i.to&&e.insert.length==0||r==8&&e.insert.length<e.to-e.from&&e.to>i.head)&&Fs(t.contentDOM,"Backspace",8)||e.from==i.from&&e.to==i.to+1&&e.insert.length==0&&Fs(t.contentDOM,"Delete",46)))return!0;let o=e.insert.toString();t.inputState.composing>=0&&t.inputState.composing++;let a,s=()=>a||(a=HY(t,e,n));return t.state.facet(m7).some(l=>l(t,e.from,e.to,o,s))||t.dispatch(s()),!0}function HY(t,e,n){let r,i=t.state,o=i.selection.main;if(e.from>=o.from&&e.to<=o.to&&e.to-e.from>=(o.to-o.from)/3&&(!n||n.main.empty&&n.main.from==e.from+e.insert.length)&&t.inputState.composing<0){let s=o.from<e.from?i.sliceDoc(o.from,e.from):"",l=o.to>e.to?i.sliceDoc(e.to,o.to):"";r=i.replaceSelection(t.state.toText(s+e.insert.sliceString(0,void 0,t.state.lineBreak)+l))}else{let s=i.changes(e),l=n&&n.main.to<=s.newLength?n.main:void 0;if(i.selection.ranges.length>1&&t.inputState.composing>=0&&e.to<=o.to&&e.to>=o.to-10){let c=t.state.sliceDoc(e.from,e.to),u,f=n&&P7(t,n.main.head);if(f){let m=e.insert.length-(e.to-e.from);u={from:f.from,to:f.to-m}}else u=t.state.doc.lineAt(o.head);let d=o.to-e.to,h=o.to-o.from;r=i.changeByRange(m=>{if(m.from==o.from&&m.to==o.to)return{changes:s,range:l||m.map(s)};let g=m.to-d,p=g-c.length;if(m.to-m.from!=h||t.state.sliceDoc(p,g)!=c||m.to>=u.from&&m.from<=u.to)return{range:m};let v=i.changes({from:p,to:g,insert:e.insert}),_=m.to-o.to;return{changes:v,range:l?Q.range(Math.max(0,l.anchor+_),Math.max(0,l.head+_)):m.map(v)}})}else r={changes:s,selection:l&&i.selection.replaceRange(l)}}let a="input.type";return(t.composing||t.inputState.compositionPendingChange&&t.inputState.compositionEndedAt>Date.now()-50)&&(t.inputState.compositionPendingChange=!1,a+=".compose",t.inputState.compositionFirstChange&&(a+=".start",t.inputState.compositionFirstChange=!1)),i.update(r,{userEvent:a,scrollIntoView:!0})}function VY(t,e,n,r){let i=Math.min(t.length,e.length),o=0;for(;o<i&&t.charCodeAt(o)==e.charCodeAt(o);)o++;if(o==i&&t.length==e.length)return null;let a=t.length,s=e.length;for(;a>0&&s>0&&t.charCodeAt(a-1)==e.charCodeAt(s-1);)a--,s--;if(r=="end"){let l=Math.max(0,o-Math.min(a,s));n-=a+l-o}if(a<o&&t.length<e.length){let l=n<=o&&n>=a?o-n:0;o-=l,s=o+(s-a),a=o}else if(s<o){let l=n<=o&&n>=s?o-n:0;o-=l,a=o+(a-s),s=o}return{from:o,toA:a,toB:s}}function WY(t){let e=[];if(t.root.activeElement!=t.contentDOM)return e;let{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:o}=t.observer.selectionRange;return n&&(e.push(new I7(n,r)),(i!=n||o!=r)&&e.push(new I7(i,o))),e}function zY(t,e){if(t.length==0)return null;let n=t[0].pos,r=t.length==2?t[1].pos:n;return n>-1&&r>-1?Q.single(n+e,r+e):null}class UY{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,se.safari&&e.contentDOM.addEventListener("input",()=>null),se.gecko&&sX(e.contentDOM.ownerDocument)}handleEvent(e){!JY(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||(this.view.updateState!=0?Promise.resolve().then(()=>this.runHandlers(e.type,e)):this.runHandlers(e.type,e))}runHandlers(e,n){let r=this.handlers[e];if(r){for(let i of r.observers)i(this.view,n);for(let i of r.handlers){if(n.defaultPrevented)break;if(i(this.view,n)){n.preventDefault();break}}}}ensureHandlers(e){let n=qY(e),r=this.handlers,i=this.view.contentDOM;for(let o in n)if(o!="scroll"){let a=!n[o].handlers.length,s=r[o];s&&a!=!s.handlers.length&&(i.removeEventListener(o,this.handleEvent),s=null),s||i.addEventListener(o,this.handleEvent,{passive:a})}for(let o in r)o!="scroll"&&!n[o]&&i.removeEventListener(o,this.handleEvent);this.handlers=n}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&e.keyCode!=27&&B7.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),se.android&&se.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let n;return se.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&((n=R7.find(r=>r.keyCode==e.keyCode))&&!e.ctrlKey||KY.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey)?(this.pendingIOSKey=n||e,setTimeout(()=>this.flushIOSKey(),250),!0):(e.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(e){let n=this.pendingIOSKey;return!n||n.key=="Enter"&&e&&e.from<e.to&&/^\S+$/.test(e.insert.toString())?!1:(this.pendingIOSKey=void 0,Fs(this.view.contentDOM,n.key,n.keyCode,n instanceof KeyboardEvent?n:void 0))}ignoreDuringComposition(e){return/^key/.test(e.type)?this.composing>0?!0:se.safari&&!se.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1:!1}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.view.observer.update(e),this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function j7(t,e){return(n,r)=>{try{return e.call(t,r,n)}catch(i){$n(n.state,i)}}}function qY(t){let e=Object.create(null);function n(r){return e[r]||(e[r]={observers:[],handlers:[]})}for(let r of t){let i=r.spec;if(i&&i.domEventHandlers)for(let o in i.domEventHandlers){let a=i.domEventHandlers[o];a&&n(o).handlers.push(j7(r.value,a))}if(i&&i.domEventObservers)for(let o in i.domEventObservers){let a=i.domEventObservers[o];a&&n(o).observers.push(j7(r.value,a))}}for(let r in $r)n(r).handlers.push($r[r]);for(let r in br)n(r).observers.push(br[r]);return e}const R7=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],KY="dthko",B7=[16,17,18,20,91,92,224,225],wd=6;function _d(t){return Math.max(0,t)*.7+8}function QY(t,e){return Math.max(Math.abs(t.clientX-e.clientX),Math.abs(t.clientY-e.clientY))}class YY{constructor(e,n,r,i){this.view=e,this.startEvent=n,this.style=r,this.mustSelect=i,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=n,this.scrollParents=rY(e.contentDOM),this.atoms=e.state.facet(Z0).map(a=>a(e));let o=e.contentDOM.ownerDocument;o.addEventListener("mousemove",this.move=this.move.bind(this)),o.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=n.shiftKey,this.multiple=e.state.facet(Ne.allowMultipleSelections)&&XY(e,n),this.dragging=GY(e,n)&&K7(n)==1?null:!1}start(e){this.dragging===!1&&this.select(e)}move(e){if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&QY(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let n=0,r=0,i=0,o=0,a=this.view.win.innerWidth,s=this.view.win.innerHeight;this.scrollParents.x&&({left:i,right:a}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:o,bottom:s}=this.scrollParents.y.getBoundingClientRect());let l=G0(this.view);e.clientX-l.left<=i+wd?n=-_d(i-e.clientX):e.clientX+l.right>=a-wd&&(n=_d(e.clientX-a)),e.clientY-l.top<=o+wd?r=-_d(o-e.clientY):e.clientY+l.bottom>=s-wd&&(r=_d(e.clientY-s)),this.setScrollSpeed(n,r)}up(e){this.dragging==null&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,n){this.scrollSpeed={x:e,y:n},e||n?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:n}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),n&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=n,n=0),(e||n)&&this.view.win.scrollBy(e,n),this.dragging===!1&&this.select(this.lastEvent)}skipAtoms(e){let n=null;for(let r=0;r<e.ranges.length;r++){let i=e.ranges[r],o=null;if(i.empty){let a=bd(this.atoms,i.from,0);a!=i.from&&(o=Q.cursor(a,-1))}else{let a=bd(this.atoms,i.from,-1),s=bd(this.atoms,i.to,1);(a!=i.from||s!=i.to)&&(o=Q.range(i.from==i.anchor?a:s,i.from==i.head?a:s))}o&&(n||(n=e.ranges.slice()),n[r]=o)}return n?Q.create(n,e.mainIndex):e}select(e){let{view:n}=this,r=this.skipAtoms(this.style.get(e,this.extend,this.multiple));(this.mustSelect||!r.eq(n.state.selection,this.dragging===!1))&&this.view.dispatch({selection:r,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(n=>n.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}function XY(t,e){let n=t.state.facet(f7);return n.length?n[0](e):se.mac?e.metaKey:e.ctrlKey}function ZY(t,e){let n=t.state.facet(d7);return n.length?n[0](e):se.mac?!e.altKey:!e.ctrlKey}function GY(t,e){let{main:n}=t.state.selection;if(n.empty)return!1;let r=yc(t.root);if(!r||r.rangeCount==0)return!0;let i=r.getRangeAt(0).getClientRects();for(let o=0;o<i.length;o++){let a=i[o];if(a.left<=e.clientX&&a.right>=e.clientX&&a.top<=e.clientY&&a.bottom>=e.clientY)return!0}return!1}function JY(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target,r;n!=t.contentDOM;n=n.parentNode)if(!n||n.nodeType==11||(r=nt.get(n))&&r.ignoreEvent(e))return!1;return!0}const $r=Object.create(null),br=Object.create(null),$7=se.ie&&se.ie_version<15||se.ios&&se.webkit_version<604;function eX(t){let e=t.dom.parentNode;if(!e)return;let n=e.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus(),setTimeout(()=>{t.focus(),n.remove(),F7(t,n.value)},50)}function xd(t,e,n){for(let r of t.facet(e))n=r(n,t);return n}function F7(t,e){e=xd(t.state,K0,e);let{state:n}=t,r,i=1,o=n.toText(e),a=o.lines==n.selection.ranges.length;if(ig!=null&&n.selection.ranges.every(l=>l.empty)&&ig==o.toString()){let l=-1;r=n.changeByRange(c=>{let u=n.doc.lineAt(c.from);if(u.from==l)return{range:c};l=u.from;let f=n.toText((a?o.line(i++).text:e)+n.lineBreak);return{changes:{from:u.from,insert:f},range:Q.cursor(c.from+f.length)}})}else a?r=n.changeByRange(l=>{let c=o.line(i++);return{changes:{from:l.from,to:l.to,insert:c.text},range:Q.cursor(l.from+c.length)}}):r=n.replaceSelection(o);t.dispatch(r,{userEvent:"input.paste",scrollIntoView:!0})}br.scroll=t=>{t.inputState.lastScrollTop=t.scrollDOM.scrollTop,t.inputState.lastScrollLeft=t.scrollDOM.scrollLeft},$r.keydown=(t,e)=>(t.inputState.setSelectionOrigin("select"),e.keyCode==27&&t.inputState.tabFocusMode!=0&&(t.inputState.tabFocusMode=Date.now()+2e3),!1),br.touchstart=(t,e)=>{t.inputState.lastTouchTime=Date.now(),t.inputState.setSelectionOrigin("select.pointer")},br.touchmove=t=>{t.inputState.setSelectionOrigin("select.pointer")},$r.mousedown=(t,e)=>{if(t.observer.flush(),t.inputState.lastTouchTime>Date.now()-2e3)return!1;let n=null;for(let r of t.state.facet(h7))if(n=r(t,e),n)break;if(!n&&e.button==0&&(n=rX(t,e)),n){let r=!t.hasFocus;t.inputState.startMouseSelection(new YY(t,e,n,r)),r&&t.observer.ignore(()=>{F8(t.contentDOM);let o=t.root.activeElement;o&&!o.contains(t.contentDOM)&&o.blur()});let i=t.inputState.mouseSelection;if(i)return i.start(e),i.dragging===!1}return!1};function H7(t,e,n,r){if(r==1)return Q.cursor(e,n);if(r==2)return DY(t.state,e,n);{let i=Tt.find(t.docView,e),o=t.state.doc.lineAt(i?i.posAtEnd:e),a=i?i.posAtStart:o.from,s=i?i.posAtEnd:o.to;return s<t.state.doc.length&&s==o.to&&s++,Q.range(a,s)}}let V7=(t,e,n)=>e>=n.top&&e<=n.bottom&&t>=n.left&&t<=n.right;function tX(t,e,n,r){let i=Tt.find(t.docView,e);if(!i)return 1;let o=e-i.posAtStart;if(o==0)return 1;if(o==i.length)return-1;let a=i.coordsAt(o,-1);if(a&&V7(n,r,a))return-1;let s=i.coordsAt(o,1);return s&&V7(n,r,s)?1:a&&a.bottom>=r?-1:1}function W7(t,e){let n=t.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:n,bias:tX(t,n,e.clientX,e.clientY)}}const nX=se.ie&&se.ie_version<=11;let z7=null,U7=0,q7=0;function K7(t){if(!nX)return t.detail;let e=z7,n=q7;return z7=t,q7=Date.now(),U7=!e||n>Date.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(U7+1)%3:1}function rX(t,e){let n=W7(t,e),r=K7(e),i=t.state.selection;return{update(o){o.docChanged&&(n.pos=o.changes.mapPos(n.pos),i=i.map(o.changes))},get(o,a,s){let l=W7(t,o),c,u=H7(t,l.pos,l.bias,r);if(n.pos!=l.pos&&!a){let f=H7(t,n.pos,n.bias,r),d=Math.min(f.from,u.from),h=Math.max(f.to,u.to);u=d<u.from?Q.range(d,h):Q.range(h,d)}return a?i.replaceRange(i.main.extend(u.from,u.to)):s&&r==1&&i.ranges.length>1&&(c=iX(i,l.pos))?c:s?i.addRange(u):Q.create([u])}}}function iX(t,e){for(let n=0;n<t.ranges.length;n++){let{from:r,to:i}=t.ranges[n];if(r<=e&&i>=e)return Q.create(t.ranges.slice(0,n).concat(t.ranges.slice(n+1)),t.mainIndex==n?0:t.mainIndex-(t.mainIndex>n?1:0))}return null}$r.dragstart=(t,e)=>{let{selection:{main:n}}=t.state;if(e.target.draggable){let i=t.docView.nearest(e.target);if(i&&i.isWidget){let o=i.posAtStart,a=o+i.length;(o>=n.to||a<=n.from)&&(n=Q.range(o,a))}}let{inputState:r}=t;return r.mouseSelection&&(r.mouseSelection.dragging=!0),r.draggedContent=n,e.dataTransfer&&(e.dataTransfer.setData("Text",xd(t.state,Q0,t.state.sliceDoc(n.from,n.to))),e.dataTransfer.effectAllowed="copyMove"),!1},$r.dragend=t=>(t.inputState.draggedContent=null,!1);function Q7(t,e,n,r){if(n=xd(t.state,K0,n),!n)return;let i=t.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:o}=t.inputState,a=r&&o&&ZY(t,e)?{from:o.from,to:o.to}:null,s={from:i,insert:n},l=t.state.changes(a?[a,s]:s);t.focus(),t.dispatch({changes:l,selection:{anchor:l.mapPos(i,-1),head:l.mapPos(i,1)},userEvent:a?"move.drop":"input.drop"}),t.inputState.draggedContent=null}$r.drop=(t,e)=>{if(!e.dataTransfer)return!1;if(t.state.readOnly)return!0;let n=e.dataTransfer.files;if(n&&n.length){let r=Array(n.length),i=0,o=()=>{++i==n.length&&Q7(t,e,r.filter(a=>a!=null).join(t.state.lineBreak),!1)};for(let a=0;a<n.length;a++){let s=new FileReader;s.onerror=o,s.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(s.result)||(r[a]=s.result),o()},s.readAsText(n[a])}return!0}else{let r=e.dataTransfer.getData("Text");if(r)return Q7(t,e,r,!0),!0}return!1},$r.paste=(t,e)=>{if(t.state.readOnly)return!0;t.observer.flush();let n=$7?null:e.clipboardData;return n?(F7(t,n.getData("text/plain")||n.getData("text/uri-list")),!0):(eX(t),!1)};function oX(t,e){let n=t.dom.parentNode;if(!n)return;let r=n.appendChild(document.createElement("textarea"));r.style.cssText="position: fixed; left: -10000px; top: 10px",r.value=e,r.focus(),r.selectionEnd=e.length,r.selectionStart=0,setTimeout(()=>{r.remove(),t.focus()},50)}function aX(t){let e=[],n=[],r=!1;for(let i of t.selection.ranges)i.empty||(e.push(t.sliceDoc(i.from,i.to)),n.push(i));if(!e.length){let i=-1;for(let{from:o}of t.selection.ranges){let a=t.doc.lineAt(o);a.number>i&&(e.push(a.text),n.push({from:a.from,to:Math.min(t.doc.length,a.to+1)})),i=a.number}r=!0}return{text:xd(t,Q0,e.join(t.lineBreak)),ranges:n,linewise:r}}let ig=null;$r.copy=$r.cut=(t,e)=>{let{text:n,ranges:r,linewise:i}=aX(t.state);if(!n&&!i)return!1;ig=i?n:null,e.type=="cut"&&!t.state.readOnly&&t.dispatch({changes:r,scrollIntoView:!0,userEvent:"delete.cut"});let o=$7?null:e.clipboardData;return o?(o.clearData(),o.setData("text/plain",n),!0):(oX(t,n),!1)};const Y7=fi.define();function X7(t,e){let n=[];for(let r of t.facet(g7)){let i=r(t,e);i&&n.push(i)}return n.length?t.update({effects:n,annotations:Y7.of(!0)}):null}function Z7(t){setTimeout(()=>{let e=t.hasFocus;if(e!=t.inputState.notifiedFocused){let n=X7(t.state,e);n?t.dispatch(n):t.update([])}},10)}br.focus=t=>{t.inputState.lastFocusTime=Date.now(),!t.scrollDOM.scrollTop&&(t.inputState.lastScrollTop||t.inputState.lastScrollLeft)&&(t.scrollDOM.scrollTop=t.inputState.lastScrollTop,t.scrollDOM.scrollLeft=t.inputState.lastScrollLeft),Z7(t)},br.blur=t=>{t.observer.clearSelectionRange(),Z7(t)},br.compositionstart=br.compositionupdate=t=>{t.observer.editContext||(t.inputState.compositionFirstChange==null&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0))},br.compositionend=t=>{t.observer.editContext||(t.inputState.composing=-1,t.inputState.compositionEndedAt=Date.now(),t.inputState.compositionPendingKey=!0,t.inputState.compositionPendingChange=t.observer.pendingRecords().length>0,t.inputState.compositionFirstChange=null,se.chrome&&se.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then(()=>t.observer.flush()):setTimeout(()=>{t.inputState.composing<0&&t.docView.hasComposition&&t.update([])},50))},br.contextmenu=t=>{t.inputState.lastContextMenu=Date.now()},$r.beforeinput=(t,e)=>{var n,r;if(e.inputType=="insertReplacementText"&&t.observer.editContext){let o=(n=e.dataTransfer)===null||n===void 0?void 0:n.getData("text/plain"),a=e.getTargetRanges();if(o&&a.length){let s=a[0],l=t.posAtDOM(s.startContainer,s.startOffset),c=t.posAtDOM(s.endContainer,s.endOffset);return rg(t,{from:l,to:c,insert:t.state.toText(o)},null),!0}}let i;if(se.chrome&&se.android&&(i=R7.find(o=>o.inputType==e.inputType))&&(t.observer.delayAndroidKey(i.key,i.keyCode),i.key=="Backspace"||i.key=="Delete")){let o=((r=window.visualViewport)===null||r===void 0?void 0:r.height)||0;setTimeout(()=>{var a;(((a=window.visualViewport)===null||a===void 0?void 0:a.height)||0)>o+10&&t.hasFocus&&(t.contentDOM.blur(),t.focus())},100)}return se.ios&&e.inputType=="deleteContentForward"&&t.observer.flushSoon(),se.safari&&e.inputType=="insertText"&&t.inputState.composing>=0&&setTimeout(()=>br.compositionend(t,e),20),!1};const G7=new Set;function sX(t){G7.has(t)||(G7.add(t),t.addEventListener("copy",()=>{}),t.addEventListener("cut",()=>{}))}const J7=["pre-wrap","normal","pre-line","break-spaces"];let zs=!1;function ew(){zs=!1}class lX{constructor(e){this.lineWrapping=e,this.doc=We.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,n){let r=this.doc.lineAt(n).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(r+=Math.max(0,Math.ceil((n-e-r*this.lineLength*.5)/this.lineLength))),this.lineHeight*r}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/(this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return J7.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let n=!1;for(let r=0;r<e.length;r++){let i=e[r];i<0?r++:this.heightSamples[Math.floor(i*10)]||(n=!0,this.heightSamples[Math.floor(i*10)]=!0)}return n}refresh(e,n,r,i,o,a){let s=J7.indexOf(e)>-1,l=Math.round(n)!=Math.round(this.lineHeight)||this.lineWrapping!=s;if(this.lineWrapping=s,this.lineHeight=n,this.charWidth=r,this.textHeight=i,this.lineLength=o,l){this.heightSamples={};for(let c=0;c<a.length;c++){let u=a[c];u<0?c++:this.heightSamples[Math.floor(u*10)]=!0}}return l}}class cX{constructor(e,n){this.from=e,this.heights=n,this.index=0}get more(){return this.index<this.heights.length}}class mi{constructor(e,n,r,i,o){this.from=e,this.length=n,this.top=r,this.height=i,this._content=o}get type(){return typeof this._content=="number"?En.Text:Array.isArray(this._content)?this._content:this._content.type}get to(){return this.from+this.length}get bottom(){return this.top+this.height}get widget(){return this._content instanceof Bo?this._content.widget:null}get widgetLineBreaks(){return typeof this._content=="number"?this._content:0}join(e){let n=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(e._content)?e._content:[e]);return new mi(this.from,this.length+e.length,this.top,this.height+e.height,n)}}var ut=function(t){return t[t.ByPos=0]="ByPos",t[t.ByHeight=1]="ByHeight",t[t.ByPosNoHeight=2]="ByPosNoHeight",t}(ut||(ut={}));const Cd=.001;class An{constructor(e,n,r=2){this.length=e,this.height=n,this.flags=r}get outdated(){return(this.flags&2)>0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>Cd&&(zs=!0),this.height=e)}replace(e,n,r){return An.of(r)}decomposeLeft(e,n){n.push(this)}decomposeRight(e,n){n.push(this)}applyChanges(e,n,r,i){let o=this,a=r.doc;for(let s=i.length-1;s>=0;s--){let{fromA:l,toA:c,fromB:u,toB:f}=i[s],d=o.lineAt(l,ut.ByPosNoHeight,r.setDoc(n),0,0),h=d.to>=c?d:o.lineAt(c,ut.ByPosNoHeight,r,0,0);for(f+=h.to-c,c=h.to;s>0&&d.from<=i[s-1].toA;)l=i[s-1].fromA,u=i[s-1].fromB,s--,l<d.from&&(d=o.lineAt(l,ut.ByPosNoHeight,r,0,0));u+=d.from-l,l=d.from;let m=og.build(r.setDoc(a),e,u,f);o=kd(o,o.replace(l,c,m))}return o.updateHeight(r,0)}static empty(){return new Gn(0,0)}static of(e){if(e.length==1)return e[0];let n=0,r=e.length,i=0,o=0;for(;;)if(n==r)if(i>o*2){let s=e[n-1];s.break?e.splice(--n,1,s.left,null,s.right):e.splice(--n,1,s.left,s.right),r+=1+s.break,i-=s.size}else if(o>i*2){let s=e[r];s.break?e.splice(r,1,s.left,null,s.right):e.splice(r,1,s.left,s.right),r+=2+s.break,o-=s.size}else break;else if(i<o){let s=e[n++];s&&(i+=s.size)}else{let s=e[--r];s&&(o+=s.size)}let a=0;return e[n-1]==null?(a=1,n--):e[n]==null&&(a=1,r++),new uX(An.of(e.slice(0,n)),a,An.of(e.slice(r)))}}function kd(t,e){return t==e?t:(t.constructor!=e.constructor&&(zs=!0),e)}An.prototype.size=1;class tw extends An{constructor(e,n,r){super(e,n),this.deco=r}blockAt(e,n,r,i){return new mi(i,this.length,r,this.height,this.deco||0)}lineAt(e,n,r,i,o){return this.blockAt(0,r,i,o)}forEachLine(e,n,r,i,o,a){e<=o+this.length&&n>=o&&a(this.blockAt(0,r,i,o))}updateHeight(e,n=0,r=!1,i){return i&&i.from<=n&&i.more&&this.setHeight(i.heights[i.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}}class Gn extends tw{constructor(e,n){super(e,n,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(e,n,r,i){return new mi(i,this.length,r,this.height,this.breaks)}replace(e,n,r){let i=r[0];return r.length==1&&(i instanceof Gn||i instanceof cn&&i.flags&4)&&Math.abs(this.length-i.length)<10?(i instanceof cn?i=new Gn(i.length,this.height):i.height=this.height,this.outdated||(i.outdated=!1),i):An.of(r)}updateHeight(e,n=0,r=!1,i){return i&&i.from<=n&&i.more?this.setHeight(i.heights[i.index++]):(r||this.outdated)&&this.setHeight(Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class cn extends An{constructor(e){super(e,0)}heightMetrics(e,n){let r=e.doc.lineAt(n).number,i=e.doc.lineAt(n+this.length).number,o=i-r+1,a,s=0;if(e.lineWrapping){let l=Math.min(this.height,e.lineHeight*o);a=l/o,this.length>o+1&&(s=(this.height-l)/(this.length-o-1))}else a=this.height/o;return{firstLine:r,lastLine:i,perLine:a,perChar:s}}blockAt(e,n,r,i){let{firstLine:o,lastLine:a,perLine:s,perChar:l}=this.heightMetrics(n,i);if(n.lineWrapping){let c=i+(e<n.lineHeight?0:Math.round(Math.max(0,Math.min(1,(e-r)/this.height))*this.length)),u=n.doc.lineAt(c),f=s+u.length*l,d=Math.max(r,e-f/2);return new mi(u.from,u.length,d,f,0)}else{let c=Math.max(0,Math.min(a-o,Math.floor((e-r)/s))),{from:u,length:f}=n.doc.line(o+c);return new mi(u,f,r+s*c,s,0)}}lineAt(e,n,r,i,o){if(n==ut.ByHeight)return this.blockAt(e,r,i,o);if(n==ut.ByPosNoHeight){let{from:h,to:m}=r.doc.lineAt(e);return new mi(h,m-h,0,0,0)}let{firstLine:a,perLine:s,perChar:l}=this.heightMetrics(r,o),c=r.doc.lineAt(e),u=s+c.length*l,f=c.number-a,d=i+s*f+l*(c.from-o-f);return new mi(c.from,c.length,Math.max(i,Math.min(d,i+this.height-u)),u,0)}forEachLine(e,n,r,i,o,a){e=Math.max(e,o),n=Math.min(n,o+this.length);let{firstLine:s,perLine:l,perChar:c}=this.heightMetrics(r,o);for(let u=e,f=i;u<=n;){let d=r.doc.lineAt(u);if(u==e){let m=d.number-s;f+=l*m+c*(e-o-m)}let h=l+c*d.length;a(new mi(d.from,d.length,f,h,0)),f+=h,u=d.to+1}}replace(e,n,r){let i=this.length-n;if(i>0){let o=r[r.length-1];o instanceof cn?r[r.length-1]=new cn(o.length+i):r.push(null,new cn(i-1))}if(e>0){let o=r[0];o instanceof cn?r[0]=new cn(e+o.length):r.unshift(new cn(e-1),null)}return An.of(r)}decomposeLeft(e,n){n.push(new cn(e-1),null)}decomposeRight(e,n){n.push(null,new cn(this.length-e-1))}updateHeight(e,n=0,r=!1,i){let o=n+this.length;if(i&&i.from<=n+this.length&&i.more){let a=[],s=Math.max(n,i.from),l=-1;for(i.from>n&&a.push(new cn(i.from-n-1).updateHeight(e,n));s<=o&&i.more;){let u=e.doc.lineAt(s).length;a.length&&a.push(null);let f=i.heights[i.index++];l==-1?l=f:Math.abs(f-l)>=Cd&&(l=-2);let d=new Gn(u,f);d.outdated=!1,a.push(d),s+=u+1}s<=o&&a.push(null,new cn(o-s).updateHeight(e,s));let c=An.of(a);return(l<0||Math.abs(c.height-this.height)>=Cd||Math.abs(l-this.heightMetrics(e,n).perLine)>=Cd)&&(zs=!0),kd(this,c)}else(r||this.outdated)&&(this.setHeight(e.heightForGap(n,n+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class uX extends An{constructor(e,n,r){super(e.length+n+r.length,e.height+r.height,n|(e.outdated||r.outdated?2:0)),this.left=e,this.right=r,this.size=e.size+r.size}get break(){return this.flags&1}blockAt(e,n,r,i){let o=r+this.left.height;return e<o?this.left.blockAt(e,n,r,i):this.right.blockAt(e,n,o,i+this.left.length+this.break)}lineAt(e,n,r,i,o){let a=i+this.left.height,s=o+this.left.length+this.break,l=n==ut.ByHeight?e<a:e<s,c=l?this.left.lineAt(e,n,r,i,o):this.right.lineAt(e,n,r,a,s);if(this.break||(l?c.to<s:c.from>s))return c;let u=n==ut.ByPosNoHeight?ut.ByPosNoHeight:ut.ByPos;return l?c.join(this.right.lineAt(s,u,r,a,s)):this.left.lineAt(s,u,r,i,o).join(c)}forEachLine(e,n,r,i,o,a){let s=i+this.left.height,l=o+this.left.length+this.break;if(this.break)e<l&&this.left.forEachLine(e,n,r,i,o,a),n>=l&&this.right.forEachLine(e,n,r,s,l,a);else{let c=this.lineAt(l,ut.ByPos,r,i,o);e<c.from&&this.left.forEachLine(e,c.from-1,r,i,o,a),c.to>=e&&c.from<=n&&a(c),n>c.to&&this.right.forEachLine(c.to+1,n,r,s,l,a)}}replace(e,n,r){let i=this.left.length+this.break;if(n<i)return this.balanced(this.left.replace(e,n,r),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-i,n-i,r));let o=[];e>0&&this.decomposeLeft(e,o);let a=o.length;for(let s of r)o.push(s);if(e>0&&nw(o,a-1),n<this.length){let s=o.length;this.decomposeRight(n,o),nw(o,s)}return An.of(o)}decomposeLeft(e,n){let r=this.left.length;if(e<=r)return this.left.decomposeLeft(e,n);n.push(this.left),this.break&&(r++,e>=r&&n.push(null)),e>r&&this.right.decomposeLeft(e-r,n)}decomposeRight(e,n){let r=this.left.length,i=r+this.break;if(e>=i)return this.right.decomposeRight(e-i,n);e<r&&this.left.decomposeRight(e,n),this.break&&e<i&&n.push(null),n.push(this.right)}balanced(e,n){return e.size>2*n.size||n.size>2*e.size?An.of(this.break?[e,null,n]:[e,n]):(this.left=kd(this.left,e),this.right=kd(this.right,n),this.setHeight(e.height+n.height),this.outdated=e.outdated||n.outdated,this.size=e.size+n.size,this.length=e.length+this.break+n.length,this)}updateHeight(e,n=0,r=!1,i){let{left:o,right:a}=this,s=n+o.length+this.break,l=null;return i&&i.from<=n+o.length&&i.more?l=o=o.updateHeight(e,n,r,i):o.updateHeight(e,n,r),i&&i.from<=s+a.length&&i.more?l=a=a.updateHeight(e,s,r,i):a.updateHeight(e,s,r),l?this.balanced(o,a):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function nw(t,e){let n,r;t[e]==null&&(n=t[e-1])instanceof cn&&(r=t[e+1])instanceof cn&&t.splice(e-1,3,new cn(n.length+1+r.length))}const fX=5;class og{constructor(e,n){this.pos=e,this.oracle=n,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,n){if(this.lineStart>-1){let r=Math.min(n,this.lineEnd),i=this.nodes[this.nodes.length-1];i instanceof Gn?i.length+=r-this.pos:(r>this.pos||!this.isCovered)&&this.nodes.push(new Gn(r-this.pos,-1)),this.writtenTo=r,n>r&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=n}point(e,n,r){if(e<n||r.heightRelevant){let i=r.widget?r.widget.estimatedHeight:0,o=r.widget?r.widget.lineBreaks:0;i<0&&(i=this.oracle.lineHeight);let a=n-e;r.block?this.addBlock(new tw(a,i,r)):(a||o||i>=fX)&&this.addLineDeco(i,o,a)}else n>e&&this.span(e,n);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}enterLine(){if(this.lineStart>-1)return;let{from:e,to:n}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=n,this.writtenTo<e&&((this.writtenTo<e-1||this.nodes[this.nodes.length-1]==null)&&this.nodes.push(this.blankContent(this.writtenTo,e-1)),this.nodes.push(null)),this.pos>e&&this.nodes.push(new Gn(this.pos-e,-1)),this.writtenTo=this.pos}blankContent(e,n){let r=new cn(n-e);return this.oracle.doc.lineAt(e).to==n&&(r.flags|=4),r}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof Gn)return e;let n=new Gn(0,-1);return this.nodes.push(n),n}addBlock(e){this.enterLine();let n=e.deco;n&&n.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,n&&n.endSide>0&&(this.covering=e)}addLineDeco(e,n,r){let i=this.ensureLine();i.length+=r,i.collapsed+=r,i.widgetHeight=Math.max(i.widgetHeight,e),i.breaks+=n,this.writtenTo=this.pos=this.pos+r}finish(e){let n=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(n instanceof Gn)&&!this.isCovered?this.nodes.push(new Gn(0,-1)):(this.writtenTo<this.pos||n==null)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos));let r=e;for(let i of this.nodes)i instanceof Gn&&i.updateHeight(this.oracle,r),r+=i?i.length:1;return this.nodes}static build(e,n,r,i){let o=new og(r,e);return Be.spans(n,r,i,o,0),o.finish(r)}}function dX(t,e,n){let r=new hX;return Be.compare(t,e,n,r,0),r.changes}class hX{constructor(){this.changes=[]}compareRange(){}comparePoint(e,n,r,i){(e<n||r&&r.heightRelevant||i&&i.heightRelevant)&&md(e,n,this.changes,5)}}function pX(t,e){let n=t.getBoundingClientRect(),r=t.ownerDocument,i=r.defaultView||window,o=Math.max(0,n.left),a=Math.min(i.innerWidth,n.right),s=Math.max(0,n.top),l=Math.min(i.innerHeight,n.bottom);for(let c=t.parentNode;c&&c!=r.body;)if(c.nodeType==1){let u=c,f=window.getComputedStyle(u);if((u.scrollHeight>u.clientHeight||u.scrollWidth>u.clientWidth)&&f.overflow!="visible"){let d=u.getBoundingClientRect();o=Math.max(o,d.left),a=Math.min(a,d.right),s=Math.max(s,d.top),l=Math.min(c==t.parentNode?i.innerHeight:l,d.bottom)}c=f.position=="absolute"||f.position=="fixed"?u.offsetParent:u.parentNode}else if(c.nodeType==11)c=c.host;else break;return{left:o-n.left,right:Math.max(o,a)-n.left,top:s-(n.top+e),bottom:Math.max(s,l)-(n.top+e)}}function mX(t){let e=t.getBoundingClientRect(),n=t.ownerDocument.defaultView||window;return e.left<n.innerWidth&&e.right>0&&e.top<n.innerHeight&&e.bottom>0}function gX(t,e){let n=t.getBoundingClientRect();return{left:0,right:n.right-n.left,top:e,bottom:n.bottom-(n.top+e)}}class ag{constructor(e,n,r,i){this.from=e,this.to=n,this.size=r,this.displaySize=i}static same(e,n){if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++){let i=e[r],o=n[r];if(i.from!=o.from||i.to!=o.to||i.size!=o.size)return!1}return!0}draw(e,n){return ge.replace({widget:new vX(this.displaySize*(n?e.scaleY:e.scaleX),n)}).range(this.from,this.to)}}class vX extends qi{constructor(e,n){super(),this.size=e,this.vertical=n}eq(e){return e.size==this.size&&e.vertical==this.vertical}toDOM(){let e=document.createElement("div");return this.vertical?e.style.height=this.size+"px":(e.style.width=this.size+"px",e.style.height="2px",e.style.display="inline-block"),e}get estimatedHeight(){return this.vertical?this.size:-1}}class rw{constructor(e){this.state=e,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scrollTop=0,this.scrolledToBottom=!1,this.scaleX=1,this.scaleY=1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=iw,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=ct.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let n=e.facet(X0).some(r=>typeof r!="function"&&r.class=="cm-lineWrapping");this.heightOracle=new lX(n),this.stateDeco=e.facet(Sc).filter(r=>typeof r!="function"),this.heightMap=An.empty().applyChanges(this.stateDeco,We.empty,this.heightOracle.setDoc(e.doc),[new yr(0,0,0,e.doc.length)]);for(let r=0;r<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());r++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=ge.set(this.lineGaps.map(r=>r.draw(this,!1))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:n}=this.state.selection;for(let r=0;r<=1;r++){let i=r?n.head:n.anchor;if(!e.some(({from:o,to:a})=>i>=o&&i<=a)){let{from:o,to:a}=this.lineBlockAt(i);e.push(new Sd(o,a))}}return this.viewports=e.sort((r,i)=>r.from-i.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?iw:new sg(this.heightOracle,this.heightMap,this.viewports),e.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push(Ec(e,this.scaler))})}update(e,n=null){this.state=e.state;let r=this.stateDeco;this.stateDeco=this.state.facet(Sc).filter(u=>typeof u!="function");let i=e.changedRanges,o=yr.extendWithRanges(i,dX(r,this.stateDeco,e?e.changes:$t.empty(this.state.doc.length))),a=this.heightMap.height,s=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);ew(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),o),(this.heightMap.height!=a||zs)&&(e.flags|=2),s?(this.scrollAnchorPos=e.changes.mapPos(s.from,-1),this.scrollAnchorHeight=s.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=a);let l=o.length?this.mapViewport(this.viewport,e.changes):this.viewport;(n&&(n.range.head<l.from||n.range.head>l.to)||!this.viewportIsAppropriate(l))&&(l=this.getViewport(0,n));let c=l.from!=this.viewport.from||l.to!=this.viewport.to;this.viewport=l,e.flags|=this.updateForViewport(),(c||!e.changes.empty||e.flags&2)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(e.changes),n&&(this.scrollTarget=n),!this.mustEnforceCursorAssoc&&e.selectionSet&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(y7)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let n=e.contentDOM,r=window.getComputedStyle(n),i=this.heightOracle,o=r.whiteSpace;this.defaultTextDirection=r.direction=="rtl"?ct.RTL:ct.LTR;let a=this.heightOracle.mustRefreshForWrapping(o),s=n.getBoundingClientRect(),l=a||this.mustMeasureContent||this.contentDOMHeight!=s.height;this.contentDOMHeight=s.height,this.mustMeasureContent=!1;let c=0,u=0;if(s.width&&s.height){let{scaleX:b,scaleY:y}=$8(n,s);(b>.005&&Math.abs(this.scaleX-b)>.005||y>.005&&Math.abs(this.scaleY-y)>.005)&&(this.scaleX=b,this.scaleY=y,c|=16,a=l=!0)}let f=(parseInt(r.paddingTop)||0)*this.scaleY,d=(parseInt(r.paddingBottom)||0)*this.scaleY;(this.paddingTop!=f||this.paddingBottom!=d)&&(this.paddingTop=f,this.paddingBottom=d,c|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(i.lineWrapping&&(l=!0),this.editorWidth=e.scrollDOM.clientWidth,c|=16);let h=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=h&&(this.scrollAnchorHeight=-1,this.scrollTop=h),this.scrolledToBottom=W8(e.scrollDOM);let m=(this.printing?gX:pX)(n,this.paddingTop),g=m.top-this.pixelViewport.top,p=m.bottom-this.pixelViewport.bottom;this.pixelViewport=m;let v=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(v!=this.inView&&(this.inView=v,v&&(l=!0)),!this.inView&&!this.scrollTarget&&!mX(e.dom))return 0;let _=s.width;if((this.contentDOMWidth!=_||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=s.width,this.editorHeight=e.scrollDOM.clientHeight,c|=16),l){let b=e.docView.measureVisibleLineHeights(this.viewport);if(i.mustRefreshForHeights(b)&&(a=!0),a||i.lineWrapping&&Math.abs(_-this.contentDOMWidth)>i.charWidth){let{lineHeight:y,charWidth:k,textHeight:C}=e.docView.measureTextSize();a=y>0&&i.refresh(o,y,k,C,_/k,b),a&&(e.docView.minWidth=0,c|=16)}g>0&&p>0?u=Math.max(g,p):g<0&&p<0&&(u=Math.min(g,p)),ew();for(let y of this.viewports){let k=y.from==this.viewport.from?b:e.docView.measureVisibleLineHeights(y);this.heightMap=(a?An.empty().applyChanges(this.stateDeco,We.empty,this.heightOracle,[new yr(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(i,0,a,new cX(y.from,k))}zs&&(c|=2)}let w=!this.viewportIsAppropriate(this.viewport,u)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return w&&(c&2&&(c|=this.updateScaler()),this.viewport=this.getViewport(u,this.scrollTarget),c|=this.updateForViewport()),(c&2||w)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(a?[]:this.lineGaps,e)),c|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),c}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,n){let r=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),i=this.heightMap,o=this.heightOracle,{visibleTop:a,visibleBottom:s}=this,l=new Sd(i.lineAt(a-r*1e3,ut.ByHeight,o,0,0).from,i.lineAt(s+(1-r)*1e3,ut.ByHeight,o,0,0).to);if(n){let{head:c}=n.range;if(c<l.from||c>l.to){let u=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),f=i.lineAt(c,ut.ByPos,o,0,0),d;n.y=="center"?d=(f.top+f.bottom)/2-u/2:n.y=="start"||n.y=="nearest"&&c<l.from?d=f.top:d=f.bottom-u,l=new Sd(i.lineAt(d-1e3/2,ut.ByHeight,o,0,0).from,i.lineAt(d+u+1e3/2,ut.ByHeight,o,0,0).to)}}return l}mapViewport(e,n){let r=n.mapPos(e.from,-1),i=n.mapPos(e.to,1);return new Sd(this.heightMap.lineAt(r,ut.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(i,ut.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:n},r=0){if(!this.inView)return!0;let{top:i}=this.heightMap.lineAt(e,ut.ByPos,this.heightOracle,0,0),{bottom:o}=this.heightMap.lineAt(n,ut.ByPos,this.heightOracle,0,0),{visibleTop:a,visibleBottom:s}=this;return(e==0||i<=a-Math.max(10,Math.min(-r,250)))&&(n==this.state.doc.length||o>=s+Math.max(10,Math.min(r,250)))&&i>a-2*1e3&&o<s+2*1e3}mapLineGaps(e,n){if(!e.length||n.empty)return e;let r=[];for(let i of e)n.touchesRange(i.from,i.to)||r.push(new ag(n.mapPos(i.from),n.mapPos(i.to),i.size,i.displaySize));return r}ensureLineGaps(e,n){let r=this.heightOracle.lineWrapping,i=r?1e4:2e3,o=i>>1,a=i<<1;if(this.defaultTextDirection!=ct.LTR&&!r)return[];let s=[],l=(u,f,d,h)=>{if(f-u<o)return;let m=this.state.selection.main,g=[m.from];m.empty||g.push(m.to);for(let v of g)if(v>u&&v<f){l(u,v-10,d,h),l(v+10,f,d,h);return}let p=bX(e,v=>v.from>=d.from&&v.to<=d.to&&Math.abs(v.from-u)<o&&Math.abs(v.to-f)<o&&!g.some(_=>v.from<_&&v.to>_));if(!p){if(f<d.to&&n&&r&&n.visibleRanges.some(w=>w.from<=f&&w.to>=f)){let w=n.moveToLineBoundary(Q.cursor(f),!1,!0).head;w>u&&(f=w)}let v=this.gapSize(d,u,f,h),_=r||v<2e6?v:2e6;p=new ag(u,f,v,_)}s.push(p)},c=u=>{if(u.length<a||u.type!=En.Text)return;let f=yX(u.from,u.to,this.stateDeco);if(f.total<a)return;let d=this.scrollTarget?this.scrollTarget.range.head:null,h,m;if(r){let g=i/this.heightOracle.lineLength*this.heightOracle.lineHeight,p,v;if(d!=null){let _=Pd(f,d),w=((this.visibleBottom-this.visibleTop)/2+g)/u.height;p=_-w,v=_+w}else p=(this.visibleTop-u.top-g)/u.height,v=(this.visibleBottom-u.top+g)/u.height;h=Od(f,p),m=Od(f,v)}else{let g=f.total*this.heightOracle.charWidth,p=i*this.heightOracle.charWidth,v=0;if(g>2e6)for(let k of e)k.from>=u.from&&k.from<u.to&&k.size!=k.displaySize&&k.from*this.heightOracle.charWidth+v<this.pixelViewport.left&&(v=k.size-k.displaySize);let _=this.pixelViewport.left+v,w=this.pixelViewport.right+v,b,y;if(d!=null){let k=Pd(f,d),C=((w-_)/2+p)/g;b=k-C,y=k+C}else b=(_-p)/g,y=(w+p)/g;h=Od(f,b),m=Od(f,y)}h>u.from&&l(u.from,h,u,f),m<u.to&&l(m,u.to,u,f)};for(let u of this.viewportLines)Array.isArray(u.type)?u.type.forEach(c):c(u);return s}gapSize(e,n,r,i){let o=Pd(i,r)-Pd(i,n);return this.heightOracle.lineWrapping?e.height*o:i.total*this.heightOracle.charWidth*o}updateLineGaps(e){ag.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=ge.set(e.map(n=>n.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let n=this.stateDeco;this.lineGaps.length&&(n=n.concat(this.lineGapDeco));let r=[];Be.spans(n,this.viewport.from,this.viewport.to,{span(o,a){r.push({from:o,to:a})},point(){}},20);let i=0;if(r.length!=this.visibleRanges.length)i=12;else for(let o=0;o<r.length&&!(i&8);o++){let a=this.visibleRanges[o],s=r[o];(a.from!=s.from||a.to!=s.to)&&(i|=4,e&&e.mapPos(a.from,-1)==s.from&&e.mapPos(a.to,1)==s.to||(i|=8))}return this.visibleRanges=r,i}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(n=>n.from<=e&&n.to>=e)||Ec(this.heightMap.lineAt(e,ut.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(n=>n.top<=e&&n.bottom>=e)||Ec(this.heightMap.lineAt(this.scaler.fromDOM(e),ut.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(e){let n=this.lineBlockAtHeight(e+8);return n.from>=this.viewport.from||this.viewportLines[0].top-e>200?n:this.viewportLines[0]}elementAtHeight(e){return Ec(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class Sd{constructor(e,n){this.from=e,this.to=n}}function yX(t,e,n){let r=[],i=t,o=0;return Be.spans(n,t,e,{span(){},point(a,s){a>i&&(r.push({from:i,to:a}),o+=a-i),i=s}},20),i<e&&(r.push({from:i,to:e}),o+=e-i),{total:o,ranges:r}}function Od({total:t,ranges:e},n){if(n<=0)return e[0].from;if(n>=1)return e[e.length-1].to;let r=Math.floor(t*n);for(let i=0;;i++){let{from:o,to:a}=e[i],s=a-o;if(r<=s)return o+r;r-=s}}function Pd(t,e){let n=0;for(let{from:r,to:i}of t.ranges){if(e<=i){n+=e-r;break}n+=i-r}return n/t.total}function bX(t,e){for(let n of t)if(e(n))return n}const iw={toDOM(t){return t},fromDOM(t){return t},scale:1,eq(t){return t==this}};class sg{constructor(e,n,r){let i=0,o=0,a=0;this.viewports=r.map(({from:s,to:l})=>{let c=n.lineAt(s,ut.ByPos,e,0,0).top,u=n.lineAt(l,ut.ByPos,e,0,0).bottom;return i+=u-c,{from:s,to:l,top:c,bottom:u,domTop:0,domBottom:0}}),this.scale=(7e6-i)/(n.height-i);for(let s of this.viewports)s.domTop=a+(s.top-o)*this.scale,a=s.domBottom=s.domTop+(s.bottom-s.top),o=s.bottom}toDOM(e){for(let n=0,r=0,i=0;;n++){let o=n<this.viewports.length?this.viewports[n]:null;if(!o||e<o.top)return i+(e-r)*this.scale;if(e<=o.bottom)return o.domTop+(e-o.top);r=o.bottom,i=o.domBottom}}fromDOM(e){for(let n=0,r=0,i=0;;n++){let o=n<this.viewports.length?this.viewports[n]:null;if(!o||e<o.domTop)return r+(e-i)/this.scale;if(e<=o.domBottom)return o.top+(e-o.domTop);r=o.bottom,i=o.domBottom}}eq(e){return e instanceof sg?this.scale==e.scale&&this.viewports.length==e.viewports.length&&this.viewports.every((n,r)=>n.from==e.viewports[r].from&&n.to==e.viewports[r].to):!1}}function Ec(t,e){if(e.scale==1)return t;let n=e.toDOM(t.top),r=e.toDOM(t.bottom);return new mi(t.from,t.length,n,r-n,Array.isArray(t._content)?t._content.map(i=>Ec(i,e)):t._content)}const Ed=ae.define({combine:t=>t.join(" ")}),lg=ae.define({combine:t=>t.indexOf(!0)>-1}),cg=Lo.newName(),ow=Lo.newName(),aw=Lo.newName(),sw={"&light":"."+ow,"&dark":"."+aw};function ug(t,e,n){return new Lo(e,{finish(r){return/&/.test(r)?r.replace(/&\w*/,i=>{if(i=="&")return t;if(!n||!n[i])throw new RangeError(`Unsupported selector: ${i}`);return n[i]}):t+" "+r}})}const wX=ug("."+cg,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#ddd"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",insetInlineStart:0,zIndex:200},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",borderRight:"1px solid #ddd"},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top",userSelect:"none"},".cm-highlightSpace":{backgroundImage:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 5%)",backgroundPosition:"center"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},sw),_X={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},fg=se.ie&&se.ie_version<=11;class xX{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new iY,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(n=>{for(let r of n)this.queue.push(r);(se.ie&&se.ie_version<=11||se.ios&&e.composing)&&n.some(r=>r.type=="childList"&&r.removedNodes.length||r.type=="characterData"&&r.oldValue.length>r.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&e.constructor.EDIT_CONTEXT!==!1&&!(se.chrome&&se.chrome_version<126)&&(this.editContext=new kX(e),e.state.facet(Qi)&&(e.contentDOM.editContext=this.editContext.editContext)),fg&&(this.onCharData=n=>{this.queue.push({target:n.target,type:"characterData",oldValue:n.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var n;((n=this.view.docView)===null||n===void 0?void 0:n.lastUpdate)<Date.now()-75&&this.onResize()}),this.resizeScroll.observe(e.scrollDOM)),this.addWindowListeners(this.win=e.win),this.start(),typeof IntersectionObserver=="function"&&(this.intersection=new IntersectionObserver(n=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),n.length>0&&n[n.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(n=>{n.length>0&&n[n.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(e){(e.type=="change"||!e.type)&&!e.matches||(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((n,r)=>n!=e[r]))){this.gapIntersection.disconnect();for(let n of e)this.gapIntersection.observe(n);this.gaps=e}}onSelectionChange(e){let n=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:r}=this,i=this.selectionRange;if(r.state.facet(Qi)?r.root.activeElement!=this.dom:!fd(this.dom,i))return;let o=i.anchorNode&&r.docView.nearest(i.anchorNode);if(o&&o.ignoreEvent(e)){n||(this.selectionChanged=!1);return}(se.ie&&se.ie_version<=11||se.android&&se.chrome)&&!r.state.selection.main.empty&&i.focusNode&&bc(i.focusNode,i.focusOffset,i.anchorNode,i.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,n=yc(e.root);if(!n)return!1;let r=se.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&CX(this.view,n)||n;if(!r||this.selectionRange.eq(r))return!1;let i=fd(this.dom,r);return i&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&aY(this.dom,r)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(r),i&&(this.selectionChanged=!0),!0)}setSelectionRange(e,n){this.selectionRange.set(e.node,e.offset,n.node,n.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let e=0,n=null;for(let r=this.dom;r;)if(r.nodeType==1)!n&&e<this.scrollTargets.length&&this.scrollTargets[e]==r?e++:n||(n=this.scrollTargets.slice(0,e)),n&&n.push(r),r=r.assignedSlot||r.parentNode;else if(r.nodeType==11)r=r.host;else break;if(e<this.scrollTargets.length&&!n&&(n=this.scrollTargets.slice(0,e)),n){for(let r of this.scrollTargets)r.removeEventListener("scroll",this.onScroll);for(let r of this.scrollTargets=n)r.addEventListener("scroll",this.onScroll)}}ignore(e){if(!this.active)return e();try{return this.stop(),e()}finally{this.start(),this.clear()}}start(){this.active||(this.observer.observe(this.dom,_X),fg&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),fg&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,n){var r;if(!this.delayedAndroidKey){let i=()=>{let o=this.delayedAndroidKey;o&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=o.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&o.force&&Fs(this.dom,o.key,o.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(i)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:n,force:this.lastChange<Date.now()-50||!!(!((r=this.delayedAndroidKey)===null||r===void 0)&&r.force)})}clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}flushSoon(){this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame(()=>{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let n=-1,r=-1,i=!1;for(let o of e){let a=this.readMutation(o);a&&(a.typeOver&&(i=!0),n==-1?{from:n,to:r}=a:(n=Math.min(a.from,n),r=Math.max(a.to,r)))}return{from:n,to:r,typeOver:i}}readChange(){let{from:e,to:n,typeOver:r}=this.processRecords(),i=this.selectionChanged&&fd(this.dom,this.selectionRange);if(e<0&&!i)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let o=new FY(this.view,e,n,r);return this.view.docView.domChanged={newSel:o.newSel?o.newSel.main:null},o}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let n=this.readChange();if(!n)return this.view.requestMeasure(),!1;let r=this.view.state,i=L7(this.view,n);return this.view.state==r&&(n.domChanged||n.newSel&&!n.newSel.main.eq(this.view.state.selection.main))&&this.view.update([]),i}readMutation(e){let n=this.view.docView.nearest(e.target);if(!n||n.ignoreMutation(e))return null;if(n.markDirty(e.type=="attributes"),e.type=="attributes"&&(n.flags|=4),e.type=="childList"){let r=lw(n,e.previousSibling||e.target.previousSibling,-1),i=lw(n,e.nextSibling||e.target.nextSibling,1);return{from:r?n.posAfter(r):n.posAtStart,to:i?n.posBefore(i):n.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet(Qi)!=e.state.facet(Qi)&&(e.view.contentDOM.editContext=e.state.facet(Qi)?this.editContext.editContext:null))}destroy(){var e,n,r;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(n=this.gapIntersection)===null||n===void 0||n.disconnect(),(r=this.resizeScroll)===null||r===void 0||r.disconnect();for(let i of this.scrollTargets)i.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function lw(t,e,n){for(;e;){let r=nt.get(e);if(r&&r.parent==t)return r;let i=e.parentNode;e=i!=t.dom?i:n>0?e.nextSibling:e.previousSibling}return null}function cw(t,e){let n=e.startContainer,r=e.startOffset,i=e.endContainer,o=e.endOffset,a=t.docView.domAtPos(t.state.selection.main.anchor);return bc(a.node,a.offset,i,o)&&([n,r,i,o]=[i,o,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:o}}function CX(t,e){if(e.getComposedRanges){let i=e.getComposedRanges(t.root)[0];if(i)return cw(t,i)}let n=null;function r(i){i.preventDefault(),i.stopImmediatePropagation(),n=i.getTargetRanges()[0]}return t.contentDOM.addEventListener("beforeinput",r,!0),t.dom.ownerDocument.execCommand("indent"),t.contentDOM.removeEventListener("beforeinput",r,!0),n?cw(t,n):null}class kX{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let n=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=r=>{let i=e.state.selection.main,{anchor:o,head:a}=i,s=this.toEditorPos(r.updateRangeStart),l=this.toEditorPos(r.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:r.updateRangeStart,editorBase:s,drifted:!1});let c={from:s,to:l,insert:We.of(r.text.split(`
|
|
588
588
|
`))};if(c.from==this.from&&o<this.from?c.from=o:c.to==this.to&&o>this.to&&(c.to=o),c.from==c.to&&!c.insert.length){let u=Q.single(this.toEditorPos(r.selectionStart),this.toEditorPos(r.selectionEnd));u.main.eq(i)||e.dispatch({selection:u,userEvent:"select"});return}if((se.mac||se.android)&&c.from==a-1&&/^\. ?$/.test(r.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(c={from:s,to:l,insert:We.of([r.text.replace("."," ")])}),this.pendingContextChange=c,!e.state.readOnly){let u=this.to-this.from+(c.to-c.from+c.insert.length);rg(e,c,Q.single(this.toEditorPos(r.selectionStart,u),this.toEditorPos(r.selectionEnd,u)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state))},this.handlers.characterboundsupdate=r=>{let i=[],o=null;for(let a=this.toEditorPos(r.rangeStart),s=this.toEditorPos(r.rangeEnd);a<s;a++){let l=e.coordsForChar(a);o=l&&new DOMRect(l.left,l.top,l.right-l.left,l.bottom-l.top)||o||new DOMRect,i.push(o)}n.updateCharacterBounds(r.rangeStart,i)},this.handlers.textformatupdate=r=>{let i=[];for(let o of r.getTextFormats()){let a=o.underlineStyle,s=o.underlineThickness;if(a!="None"&&s!="None"){let l=this.toEditorPos(o.rangeStart),c=this.toEditorPos(o.rangeEnd);if(l<c){let u=`text-decoration: underline ${a=="Dashed"?"dashed ":a=="Squiggle"?"wavy ":""}${s=="Thin"?1:2}px`;i.push(ge.mark({attributes:{style:u}}).range(l,c))}}}e.dispatch({effects:w7.of(ge.set(i))})},this.handlers.compositionstart=()=>{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:r}=this.composing;this.composing=null,r&&this.reset(e.state)}};for(let r in this.handlers)n.addEventListener(r,this.handlers[r]);this.measureReq={read:r=>{this.editContext.updateControlBounds(r.contentDOM.getBoundingClientRect());let i=yc(r.root);i&&i.rangeCount&&this.editContext.updateSelectionBounds(i.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let n=0,r=!1,i=this.pendingContextChange;return e.changes.iterChanges((o,a,s,l,c)=>{if(r)return;let u=c.length-(a-o);if(i&&a>=i.to)if(i.from==o&&i.to==a&&i.insert.eq(c)){i=this.pendingContextChange=null,n+=u,this.to+=u;return}else i=null,this.revertPending(e.state);if(o+=n,a+=n,a<=this.from)this.from+=u,this.to+=u;else if(o<this.to){if(o<this.from||a>this.to||this.to-this.from+c.length>3e4){r=!0;return}this.editContext.updateText(this.toContextPos(o),this.toContextPos(a),c.toString()),this.to+=u}n+=u}),i&&!r&&this.revertPending(e.state),!r}update(e){let n=this.pendingContextChange,r=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(r.from,r.to)&&e.transactions.some(i=>!i.isUserEvent("input.type")&&i.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.reset(e.state)):(e.docChanged||e.selectionSet||n)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:n}=e.selection.main;this.from=Math.max(0,n-1e4),this.to=Math.min(e.doc.length,n+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let n=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(n.from),this.toContextPos(n.from+n.insert.length),e.doc.sliceString(n.from,n.to))}setSelection(e){let{main:n}=e.selection,r=this.toContextPos(Math.max(this.from,Math.min(this.to,n.anchor))),i=this.toContextPos(n.head);(this.editContext.selectionStart!=r||this.editContext.selectionEnd!=i)&&this.editContext.updateSelection(r,i)}rangeIsValid(e){let{head:n}=e.selection.main;return!(this.from>0&&n-this.from<500||this.to<e.doc.length&&this.to-n<500||this.to-this.from>1e4*3)}toEditorPos(e,n=this.to-this.from){e=Math.min(e,n);let r=this.composing;return r&&r.drifted?r.editorBase+(e-r.contextBase):e+this.from}toContextPos(e){let n=this.composing;return n&&n.drifted?n.contextBase+(e-n.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class ne{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var n;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:r}=e;this.dispatchTransactions=e.dispatchTransactions||r&&(i=>i.forEach(o=>r(o,this)))||(i=>this.update(i)),this.dispatch=this.dispatch.bind(this),this._root=e.root||oY(e.parent)||document,this.viewState=new rw(e.state||Ne.create(e)),e.scrollTo&&e.scrollTo.is(vd)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(kc).map(i=>new Y0(i));for(let i of this.plugins)i.update(this);this.observer=new xX(this),this.inputState=new UY(this),this.inputState.ensureHandlers(this.plugins),this.docView=new O7(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((n=document.fonts)===null||n===void 0)&&n.ready&&document.fonts.ready.then(()=>this.requestMeasure())}dispatch(...e){let n=e.length==1&&e[0]instanceof Ft?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(n,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let n=!1,r=!1,i,o=this.state;for(let d of e){if(d.startState!=o)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");o=d.state}if(this.destroyed){this.viewState.state=o;return}let a=this.hasFocus,s=0,l=null;e.some(d=>d.annotation(Y7))?(this.inputState.notifiedFocused=a,s=1):a!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=a,l=X7(o,a),l||(s=1));let c=this.observer.delayedAndroidKey,u=null;if(c?(this.observer.clearDelayedAndroidKey(),u=this.observer.readChange(),(u&&!this.state.doc.eq(o.doc)||!this.state.selection.eq(o.selection))&&(u=null)):this.observer.clear(),o.facet(Ne.phrases)!=this.state.facet(Ne.phrases))return this.setState(o);i=yd.create(this,o,e),i.flags|=s;let f=this.viewState.scrollTarget;try{this.updateState=2;for(let d of e){if(f&&(f=f.map(d.changes)),d.scrollIntoView){let{main:h}=d.state.selection;f=new Ws(h.empty?h:Q.cursor(h.head,h.head>h.anchor?-1:1))}for(let h of d.effects)h.is(vd)&&(f=h.value.clip(this.state))}this.viewState.update(i,f),this.bidiCache=Ad.update(this.bidiCache,i.changes),i.empty||(this.updatePlugins(i),this.inputState.update(i)),n=this.docView.update(i),this.state.facet(Oc)!=this.styleModules&&this.mountStyles(),r=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(n,e.some(d=>d.isUserEvent("select.pointer")))}finally{this.updateState=0}if(i.startState.facet(Ed)!=i.state.facet(Ed)&&(this.viewState.mustMeasureContent=!0),(n||r||f||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),n&&this.docViewUpdate(),!i.empty)for(let d of this.state.facet(q0))try{d(i)}catch(h){$n(this.state,h,"update listener")}(l||u)&&Promise.resolve().then(()=>{l&&this.state==l.startState&&this.dispatch(l),u&&!L7(this,u)&&c.force&&Fs(this.contentDOM,c.key,c.keyCode)})}setState(e){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=e;return}this.updateState=2;let n=this.hasFocus;try{for(let r of this.plugins)r.destroy(this);this.viewState=new rw(e),this.plugins=e.facet(kc).map(r=>new Y0(r)),this.pluginMap.clear();for(let r of this.plugins)r.update(this);this.docView.destroy(),this.docView=new O7(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}n&&this.focus(),this.requestMeasure()}updatePlugins(e){let n=e.startState.facet(kc),r=e.state.facet(kc);if(n!=r){let i=[];for(let o of r){let a=n.indexOf(o);if(a<0)i.push(new Y0(o));else{let s=this.plugins[a];s.mustUpdate=e,i.push(s)}}for(let o of this.plugins)o.mustUpdate!=e&&o.destroy(this);this.plugins=i,this.pluginMap.clear()}else for(let i of this.plugins)i.mustUpdate=e;for(let i=0;i<this.plugins.length;i++)this.plugins[i].update(this);n!=r&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let e of this.plugins){let n=e.value;if(n&&n.docViewUpdate)try{n.docViewUpdate(this)}catch(r){$n(this.state,r,"doc view update listener")}}}measure(e=!0){if(this.destroyed)return;if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let n=null,r=this.scrollDOM,i=r.scrollTop*this.scaleY,{scrollAnchorPos:o,scrollAnchorHeight:a}=this.viewState;Math.abs(i-this.viewState.scrollTop)>1&&(a=-1),this.viewState.scrollAnchorHeight=-1;try{for(let s=0;;s++){if(a<0)if(W8(r))o=-1,a=this.viewState.heightMap.height;else{let h=this.viewState.scrollAnchorAt(i);o=h.from,a=h.top}this.updateState=1;let l=this.viewState.measure(this);if(!l&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(s>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let c=[];l&4||([this.measureRequests,c]=[c,this.measureRequests]);let u=c.map(h=>{try{return h.read(this)}catch(m){return $n(this.state,m),uw}}),f=yd.create(this,this.state,[]),d=!1;f.flags|=l,n?n.flags|=l:n=f,this.updateState=2,f.empty||(this.updatePlugins(f),this.inputState.update(f),this.updateAttrs(),d=this.docView.update(f),d&&this.docViewUpdate());for(let h=0;h<c.length;h++)if(u[h]!=uw)try{let m=c[h];m.write&&m.write(u[h],this)}catch(m){$n(this.state,m)}if(d&&this.docView.updateSelection(!0),!f.viewportChanged&&this.measureRequests.length==0){if(this.viewState.editorHeight)if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,a=-1;continue}else{let m=(o<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(o).top)-a;if(m>1||m<-1){i=i+m,r.scrollTop=i/this.scaleY,a=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(n&&!n.empty)for(let s of this.state.facet(q0))s(n)}get themeClasses(){return cg+" "+(this.state.facet(lg)?aw:ow)+" "+this.state.facet(Ed)}updateAttrs(){let e=fw(this,_7,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),n={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(Qi)?"true":"false",class:"cm-content",style:`${se.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(n["aria-readonly"]="true"),fw(this,X0,n);let r=this.observer.ignore(()=>{let i=F0(this.contentDOM,this.contentAttrs,n),o=F0(this.dom,this.editorAttrs,e);return i||o});return this.editorAttrs=e,this.contentAttrs=n,r}showAnnouncements(e){let n=!0;for(let r of e)for(let i of r.effects)if(i.is(ne.announce)){n&&(this.announceDOM.textContent=""),n=!1;let o=this.announceDOM.appendChild(document.createElement("div"));o.textContent=i.value}}mountStyles(){this.styleModules=this.state.facet(Oc);let e=this.state.facet(ne.cspNonce);Lo.mount(this.root,this.styleModules.concat(wX).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(this.measureRequests.indexOf(e)>-1)return;if(e.key!=null){for(let n=0;n<this.measureRequests.length;n++)if(this.measureRequests[n].key===e.key){this.measureRequests[n]=e;return}}this.measureRequests.push(e)}}plugin(e){let n=this.pluginMap.get(e);return(n===void 0||n&&n.spec!=e)&&this.pluginMap.set(e,n=this.plugins.find(r=>r.spec==e)||null),n&&n.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,n,r){return ng(this,e,N7(this,e,n,r))}moveByGroup(e,n){return ng(this,e,N7(this,e,n,r=>jY(this,e.head,r)))}visualLineSide(e,n){let r=this.bidiSpans(e),i=this.textDirectionAt(e.from),o=r[n?r.length-1:0];return Q.cursor(o.side(n,i)+e.from,o.forward(!n,i)?1:-1)}moveToLineBoundary(e,n,r=!0){return LY(this,e,n,r)}moveVertically(e,n,r){return ng(this,e,RY(this,e,n,r))}domAtPos(e){return this.docView.domAtPos(e)}posAtDOM(e,n=0){return this.docView.posFromDOM(e,n)}posAtCoords(e,n=!0){return this.readMeasured(),M7(this,e,n)}coordsAtPos(e,n=1){this.readMeasured();let r=this.docView.coordsAt(e,n);if(!r||r.left==r.right)return r;let i=this.state.doc.lineAt(e),o=this.bidiSpans(i),a=o[$o.find(o,e-i.from,-1,n)];return wc(r,a.dir==ct.LTR==n>0)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(v7)||e<this.viewport.from||e>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>SX)return c7(e.length);let n=this.textDirectionAt(e.from),r;for(let o of this.bidiCache)if(o.from==e.from&&o.dir==n&&(o.fresh||l7(o.isolates,r=k7(this,e))))return o.order;r||(r=k7(this,e));let i=bY(e.text,n,r);return this.bidiCache.push(new Ad(e.from,e.to,n,r,!0,i)),i}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||se.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{F8(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((e.nodeType==9?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,n={}){return vd.of(new Ws(typeof e=="number"?Q.cursor(e):e,n.y,n.x,n.yMargin,n.xMargin))}scrollSnapshot(){let{scrollTop:e,scrollLeft:n}=this.scrollDOM,r=this.viewState.scrollAnchorAt(e);return vd.of(new Ws(Q.cursor(r.from),"start","start",r.top-e,n,!0))}setTabFocusMode(e){e==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof e=="boolean"?this.inputState.tabFocusMode=e?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return Et.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return Et.define(()=>({}),{eventObservers:e})}static theme(e,n){let r=Lo.newName(),i=[Ed.of(r),Oc.of(ug(`.${r}`,e))];return n&&n.dark&&i.push(lg.of(!0)),i}static baseTheme(e){return Oa.lowest(Oc.of(ug("."+cg,e,sw)))}static findFromDOM(e){var n;let r=e.querySelector(".cm-content"),i=r&&nt.get(r)||nt.get(e);return((n=i==null?void 0:i.rootView)===null||n===void 0?void 0:n.view)||null}}ne.styleModule=Oc,ne.inputHandler=m7,ne.clipboardInputFilter=K0,ne.clipboardOutputFilter=Q0,ne.scrollHandler=b7,ne.focusChangeEffect=g7,ne.perLineTextDirection=v7,ne.exceptionSink=p7,ne.updateListener=q0,ne.editable=Qi,ne.mouseSelectionStyle=h7,ne.dragMovesSelection=d7,ne.clickAddsSelectionRange=f7,ne.decorations=Sc,ne.outerDecorations=x7,ne.atomicRanges=Z0,ne.bidiIsolatedRanges=C7,ne.scrollMargins=S7,ne.darkTheme=lg,ne.cspNonce=ae.define({combine:t=>t.length?t[0]:""}),ne.contentAttributes=X0,ne.editorAttributes=_7,ne.lineWrapping=ne.contentAttributes.of({class:"cm-lineWrapping"}),ne.announce=Se.define();const SX=4096,uw={};class Ad{constructor(e,n,r,i,o,a){this.from=e,this.to=n,this.dir=r,this.isolates=i,this.fresh=o,this.order=a}static update(e,n){if(n.empty&&!e.some(o=>o.fresh))return e;let r=[],i=e.length?e[e.length-1].dir:ct.LTR;for(let o=Math.max(0,e.length-10);o<e.length;o++){let a=e[o];a.dir==i&&!n.touchesRange(a.from,a.to)&&r.push(new Ad(n.mapPos(a.from,1),n.mapPos(a.to,-1),a.dir,a.isolates,!1,a.order))}return r}}function fw(t,e,n){for(let r=t.state.facet(e),i=r.length-1;i>=0;i--){let o=r[i],a=typeof o=="function"?o(t):o;a&&$0(a,n)}return n}const OX=se.mac?"mac":se.windows?"win":se.linux?"linux":"key";function PX(t,e){const n=t.split(/-(?!$)/);let r=n[n.length-1];r=="Space"&&(r=" ");let i,o,a,s;for(let l=0;l<n.length-1;++l){const c=n[l];if(/^(cmd|meta|m)$/i.test(c))s=!0;else if(/^a(lt)?$/i.test(c))i=!0;else if(/^(c|ctrl|control)$/i.test(c))o=!0;else if(/^s(hift)?$/i.test(c))a=!0;else if(/^mod$/i.test(c))e=="mac"?s=!0:o=!0;else throw new Error("Unrecognized modifier name: "+c)}return i&&(r="Alt-"+r),o&&(r="Ctrl-"+r),s&&(r="Meta-"+r),a&&(r="Shift-"+r),r}function Dd(t,e,n){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n!==!1&&e.shiftKey&&(t="Shift-"+t),t}const EX=Oa.default(ne.domEventHandlers({keydown(t,e){return pw(hw(e.state),t,e,"editor")}})),Md=ae.define({enables:EX}),dw=new WeakMap;function hw(t){let e=t.facet(Md),n=dw.get(e);return n||dw.set(e,n=MX(e.reduce((r,i)=>r.concat(i),[]))),n}function AX(t,e,n){return pw(hw(t.state),e,t,n)}let Fo=null;const DX=4e3;function MX(t,e=OX){let n=Object.create(null),r=Object.create(null),i=(a,s)=>{let l=r[a];if(l==null)r[a]=s;else if(l!=s)throw new Error("Key binding "+a+" is used both as a regular binding and as a multi-stroke prefix")},o=(a,s,l,c,u)=>{var f,d;let h=n[a]||(n[a]=Object.create(null)),m=s.split(/ (?!$)/).map(v=>PX(v,e));for(let v=1;v<m.length;v++){let _=m.slice(0,v).join(" ");i(_,!0),h[_]||(h[_]={preventDefault:!0,stopPropagation:!1,run:[w=>{let b=Fo={view:w,prefix:_,scope:a};return setTimeout(()=>{Fo==b&&(Fo=null)},DX),!0}]})}let g=m.join(" ");i(g,!1);let p=h[g]||(h[g]={preventDefault:!1,stopPropagation:!1,run:((d=(f=h._any)===null||f===void 0?void 0:f.run)===null||d===void 0?void 0:d.slice())||[]});l&&p.run.push(l),c&&(p.preventDefault=!0),u&&(p.stopPropagation=!0)};for(let a of t){let s=a.scope?a.scope.split(" "):["editor"];if(a.any)for(let c of s){let u=n[c]||(n[c]=Object.create(null));u._any||(u._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:f}=a;for(let d in u)u[d].run.push(h=>f(h,dg))}let l=a[e]||a.key;if(l)for(let c of s)o(c,l,a.run,a.preventDefault,a.stopPropagation),a.shift&&o(c,"Shift-"+l,a.shift,a.preventDefault,a.stopPropagation)}return n}let dg=null;function pw(t,e,n,r){dg=e;let i=eY(e),o=Rn(i,0),a=ci(o)==i.length&&i!=" ",s="",l=!1,c=!1,u=!1;Fo&&Fo.view==n&&Fo.scope==r&&(s=Fo.prefix+" ",B7.indexOf(e.keyCode)<0&&(c=!0,Fo=null));let f=new Set,d=p=>{if(p){for(let v of p.run)if(!f.has(v)&&(f.add(v),v(n)))return p.stopPropagation&&(u=!0),!0;p.preventDefault&&(p.stopPropagation&&(u=!0),c=!0)}return!1},h=t[r],m,g;return h&&(d(h[s+Dd(i,e,!a)])?l=!0:a&&(e.altKey||e.metaKey||e.ctrlKey)&&!(se.windows&&e.ctrlKey&&e.altKey)&&(m=jo[e.keyCode])&&m!=i?(d(h[s+Dd(m,e,!0)])||e.shiftKey&&(g=vc[e.keyCode])!=i&&g!=m&&d(h[s+Dd(g,e,!1)]))&&(l=!0):a&&e.shiftKey&&d(h[s+Dd(i,e,!0)])&&(l=!0),!l&&d(h._any)&&(l=!0)),c&&(l=!0),l&&u&&e.stopPropagation(),dg=null,l}class Ac{constructor(e,n,r,i,o){this.className=e,this.left=n,this.top=r,this.width=i,this.height=o}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}update(e,n){return n.className!=this.className?!1:(this.adjust(e),!0)}adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",this.width!=null&&(e.style.width=this.width+"px"),e.style.height=this.height+"px"}eq(e){return this.left==e.left&&this.top==e.top&&this.width==e.width&&this.height==e.height&&this.className==e.className}static forRange(e,n,r){if(r.empty){let i=e.coordsAtPos(r.head,r.assoc||1);if(!i)return[];let o=mw(e);return[new Ac(n,i.left-o.left,i.top-o.top,null,i.bottom-i.top)]}else return TX(e,n,r)}}function mw(t){let e=t.scrollDOM.getBoundingClientRect();return{left:(t.textDirection==ct.LTR?e.left:e.right-t.scrollDOM.clientWidth*t.scaleX)-t.scrollDOM.scrollLeft*t.scaleX,top:e.top-t.scrollDOM.scrollTop*t.scaleY}}function gw(t,e,n,r){let i=t.coordsAtPos(e,n*2);if(!i)return r;let o=t.dom.getBoundingClientRect(),a=(i.top+i.bottom)/2,s=t.posAtCoords({x:o.left+1,y:a}),l=t.posAtCoords({x:o.right-1,y:a});return s==null||l==null?r:{from:Math.max(r.from,Math.min(s,l)),to:Math.min(r.to,Math.max(s,l))}}function TX(t,e,n){if(n.to<=t.viewport.from||n.from>=t.viewport.to)return[];let r=Math.max(n.from,t.viewport.from),i=Math.min(n.to,t.viewport.to),o=t.textDirection==ct.LTR,a=t.contentDOM,s=a.getBoundingClientRect(),l=mw(t),c=a.querySelector(".cm-line"),u=c&&window.getComputedStyle(c),f=s.left+(u?parseInt(u.paddingLeft)+Math.min(0,parseInt(u.textIndent)):0),d=s.right-(u?parseInt(u.paddingRight):0),h=tg(t,r,1),m=tg(t,i,-1),g=h.type==En.Text?h:null,p=m.type==En.Text?m:null;if(g&&(t.lineWrapping||h.widgetLineBreaks)&&(g=gw(t,r,1,g)),p&&(t.lineWrapping||m.widgetLineBreaks)&&(p=gw(t,i,-1,p)),g&&p&&g.from==p.from&&g.to==p.to)return _(w(n.from,n.to,g));{let y=g?w(n.from,null,g):b(h,!1),k=p?w(null,n.to,p):b(m,!0),C=[];return(g||h).to<(p||m).from-(g&&p?1:0)||h.widgetLineBreaks>1&&y.bottom+t.defaultLineHeight/2<k.top?C.push(v(f,y.bottom,d,k.top)):y.bottom<k.top&&t.elementAtHeight((y.bottom+k.top)/2).type==En.Text&&(y.bottom=k.top=(y.bottom+k.top)/2),_(y).concat(C).concat(_(k))}function v(y,k,C,E){return new Ac(e,y-l.left,k-l.top,C-y,E-k)}function _({top:y,bottom:k,horizontal:C}){let E=[];for(let A=0;A<C.length;A+=2)E.push(v(C[A],y,C[A+1],k));return E}function w(y,k,C){let E=1e9,A=-1e9,N=[];function M(L,F,V,W,X){let J=t.coordsAtPos(L,L==C.to?-2:2),pe=t.coordsAtPos(V,V==C.from?2:-2);!J||!pe||(E=Math.min(J.top,pe.top,E),A=Math.max(J.bottom,pe.bottom,A),X==ct.LTR?N.push(o&&F?f:J.left,o&&W?d:pe.right):N.push(!o&&W?f:pe.left,!o&&F?d:J.right))}let T=y??C.from,I=k??C.to;for(let L of t.visibleRanges)if(L.to>T&&L.from<I)for(let F=Math.max(L.from,T),V=Math.min(L.to,I);;){let W=t.state.doc.lineAt(F);for(let X of t.bidiSpans(W)){let J=X.from+W.from,pe=X.to+W.from;if(J>=V)break;pe>F&&M(Math.max(J,F),y==null&&J<=T,Math.min(pe,V),k==null&&pe>=I,X.dir)}if(F=W.to+1,F>=V)break}return N.length==0&&M(T,y==null,I,k==null,t.textDirection),{top:E,bottom:A,horizontal:N}}function b(y,k){let C=s.top+(k?y.top:y.bottom);return{top:C,bottom:C,horizontal:[]}}}function NX(t,e){return t.constructor==e.constructor&&t.eq(e)}class IX{constructor(e,n){this.view=e,this.layer=n,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=e.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),n.above&&this.dom.classList.add("cm-layer-above"),n.class&&this.dom.classList.add(n.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(e.state),e.requestMeasure(this.measureReq),n.mount&&n.mount(this.dom,e)}update(e){e.startState.facet(Td)!=e.state.facet(Td)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&(this.scale(),e.view.requestMeasure(this.measureReq))}docViewUpdate(e){this.layer.updateOnDocViewUpdate!==!1&&e.requestMeasure(this.measureReq)}setOrder(e){let n=0,r=e.facet(Td);for(;n<r.length&&r[n]!=this.layer;)n++;this.dom.style.zIndex=String((this.layer.above?150:-1)-n)}measure(){return this.layer.markers(this.view)}scale(){let{scaleX:e,scaleY:n}=this.view;(e!=this.scaleX||n!=this.scaleY)&&(this.scaleX=e,this.scaleY=n,this.dom.style.transform=`scale(${1/e}, ${1/n})`)}draw(e){if(e.length!=this.drawn.length||e.some((n,r)=>!NX(n,this.drawn[r]))){let n=this.dom.firstChild,r=0;for(let i of e)i.update&&n&&i.constructor&&this.drawn[r].constructor&&i.update(n,this.drawn[r])?(n=n.nextSibling,r++):this.dom.insertBefore(i.draw(),n);for(;n;){let i=n.nextSibling;n.remove(),n=i}this.drawn=e}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const Td=ae.define();function vw(t){return[Et.define(e=>new IX(e,t)),Td.of(t)]}const Dc=ae.define({combine(t){return di(t,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,n)=>Math.min(e,n),drawRangeCursor:(e,n)=>e||n})}});function LX(t={}){return[Dc.of(t),jX,RX,BX,y7.of(!0)]}function yw(t){return t.startState.facet(Dc)!=t.state.facet(Dc)}const jX=vw({above:!0,markers(t){let{state:e}=t,n=e.facet(Dc),r=[];for(let i of e.selection.ranges){let o=i==e.selection.main;if(i.empty||n.drawRangeCursor){let a=o?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",s=i.empty?i:Q.cursor(i.head,i.head>i.anchor?-1:1);for(let l of Ac.forRange(t,a,s))r.push(l)}}return r},update(t,e){t.transactions.some(r=>r.selection)&&(e.style.animationName=e.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let n=yw(t);return n&&bw(t.state,e),t.docChanged||t.selectionSet||n},mount(t,e){bw(e.state,t)},class:"cm-cursorLayer"});function bw(t,e){e.style.animationDuration=t.facet(Dc).cursorBlinkRate+"ms"}const RX=vw({above:!1,markers(t){return t.state.selection.ranges.map(e=>e.empty?[]:Ac.forRange(t,"cm-selectionBackground",e)).reduce((e,n)=>e.concat(n))},update(t,e){return t.docChanged||t.selectionSet||t.viewportChanged||yw(t)},class:"cm-selectionLayer"}),BX=Oa.highest(ne.theme({".cm-line":{"& ::selection, &::selection":{backgroundColor:"transparent !important"},caretColor:"transparent !important"},".cm-content":{caretColor:"transparent !important","& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}})),ww=Se.define({map(t,e){return t==null?null:e.mapPos(t)}}),Mc=sn.define({create(){return null},update(t,e){return t!=null&&(t=e.changes.mapPos(t)),e.effects.reduce((n,r)=>r.is(ww)?r.value:n,t)}}),$X=Et.fromClass(class{constructor(t){this.view=t,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(t){var e;let n=t.state.field(Mc);n==null?this.cursor!=null&&((e=this.cursor)===null||e===void 0||e.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(t.startState.field(Mc)!=n||t.docChanged||t.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:t}=this,e=t.state.field(Mc),n=e!=null&&t.coordsAtPos(e);if(!n)return null;let r=t.scrollDOM.getBoundingClientRect();return{left:n.left-r.left+t.scrollDOM.scrollLeft*t.scaleX,top:n.top-r.top+t.scrollDOM.scrollTop*t.scaleY,height:n.bottom-n.top}}drawCursor(t){if(this.cursor){let{scaleX:e,scaleY:n}=this.view;t?(this.cursor.style.left=t.left/e+"px",this.cursor.style.top=t.top/n+"px",this.cursor.style.height=t.height/n+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(t){this.view.state.field(Mc)!=t&&this.view.dispatch({effects:ww.of(t)})}},{eventObservers:{dragover(t){this.setDropPos(this.view.posAtCoords({x:t.clientX,y:t.clientY}))},dragleave(t){(t.target==this.view.contentDOM||!this.view.contentDOM.contains(t.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function FX(){return[Mc,$X]}function _w(t,e,n,r,i){e.lastIndex=0;for(let o=t.iterRange(n,r),a=n,s;!o.next().done;a+=o.value.length)if(!o.lineBreak)for(;s=e.exec(o.value);)i(a+s.index,s)}function HX(t,e){let n=t.visibleRanges;if(n.length==1&&n[0].from==t.viewport.from&&n[0].to==t.viewport.to)return n;let r=[];for(let{from:i,to:o}of n)i=Math.max(t.state.doc.lineAt(i).from,i-e),o=Math.min(t.state.doc.lineAt(o).to,o+e),r.length&&r[r.length-1].to>=i?r[r.length-1].to=o:r.push({from:i,to:o});return r}class VX{constructor(e){const{regexp:n,decoration:r,decorate:i,boundary:o,maxLength:a=1e3}=e;if(!n.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=n,i)this.addMatch=(s,l,c,u)=>i(u,c,c+s[0].length,s,l);else if(typeof r=="function")this.addMatch=(s,l,c,u)=>{let f=r(s,l,c);f&&u(c,c+s[0].length,f)};else if(r)this.addMatch=(s,l,c,u)=>u(c,c+s[0].length,r);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=o,this.maxLength=a}createDeco(e){let n=new zi,r=n.add.bind(n);for(let{from:i,to:o}of HX(e,this.maxLength))_w(e.state.doc,this.regexp,i,o,(a,s)=>this.addMatch(s,e,a,r));return n.finish()}updateDeco(e,n){let r=1e9,i=-1;return e.docChanged&&e.changes.iterChanges((o,a,s,l)=>{l>=e.view.viewport.from&&s<=e.view.viewport.to&&(r=Math.min(s,r),i=Math.max(l,i))}),e.viewportMoved||i-r>1e3?this.createDeco(e.view):i>-1?this.updateRange(e.view,n.map(e.changes),r,i):n}updateRange(e,n,r,i){for(let o of e.visibleRanges){let a=Math.max(o.from,r),s=Math.min(o.to,i);if(s>a){let l=e.state.doc.lineAt(a),c=l.to<s?e.state.doc.lineAt(s):l,u=Math.max(o.from,l.from),f=Math.min(o.to,c.to);if(this.boundary){for(;a>l.from;a--)if(this.boundary.test(l.text[a-1-l.from])){u=a;break}for(;s<c.to;s++)if(this.boundary.test(c.text[s-c.from])){f=s;break}}let d=[],h,m=(g,p,v)=>d.push(v.range(g,p));if(l==c)for(this.regexp.lastIndex=u-l.from;(h=this.regexp.exec(l.text))&&h.index<f-l.from;)this.addMatch(h,e,h.index+l.from,m);else _w(e.state.doc,this.regexp,u,f,(g,p)=>this.addMatch(p,e,g,m));n=n.update({filterFrom:u,filterTo:f,filter:(g,p)=>g<u||p>f,add:d})}}return n}}const hg=/x/.unicode!=null?"gu":"g",WX=new RegExp(`[\0-\b
|
|
589
589
|
--\u2028\u2029\uFEFF-]`,hg),zX={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let pg=null;function UX(){var t;if(pg==null&&typeof document<"u"&&document.body){let e=document.body.style;pg=((t=e.tabSize)!==null&&t!==void 0?t:e.MozTabSize)!=null}return pg||!1}const Nd=ae.define({combine(t){let e=di(t,{render:null,specialChars:WX,addSpecialChars:null});return(e.replaceTabs=!UX())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,hg)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,hg)),e}});function qX(t={}){return[Nd.of(t),KX()]}let xw=null;function KX(){return xw||(xw=Et.fromClass(class{constructor(t){this.view=t,this.decorations=ge.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(t.state.facet(Nd)),this.decorations=this.decorator.createDeco(t)}makeDecorator(t){return new VX({regexp:t.specialChars,decoration:(e,n,r)=>{let{doc:i}=n.state,o=Rn(e[0],0);if(o==9){let a=i.lineAt(r),s=n.state.tabSize,l=Rs(a.text,s,r-a.from);return ge.replace({widget:new ZX((s-l%s)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[o]||(this.decorationCache[o]=ge.replace({widget:new XX(t,o)}))},boundary:t.replaceTabs?void 0:/[^]/})}update(t){let e=t.state.facet(Nd);t.startState.facet(Nd)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(t.view)):this.decorations=this.decorator.updateDeco(t,this.decorations)}},{decorations:t=>t.decorations}))}const QX="•";function YX(t){return t>=32?QX:t==10?"":String.fromCharCode(9216+t)}class XX extends qi{constructor(e,n){super(),this.options=e,this.code=n}eq(e){return e.code==this.code}toDOM(e){let n=YX(this.code),r=e.state.phrase("Control character")+" "+(zX[this.code]||"0x"+this.code.toString(16)),i=this.options.render&&this.options.render(this.code,r,n);if(i)return i;let o=document.createElement("span");return o.textContent=n,o.title=r,o.setAttribute("aria-label",r),o.className="cm-specialChar",o}ignoreEvent(){return!1}}class ZX extends qi{constructor(e){super(),this.width=e}eq(e){return e.width==this.width}toDOM(){let e=document.createElement("span");return e.textContent=" ",e.className="cm-tab",e.style.width=this.width+"px",e}ignoreEvent(){return!1}}function GX(){return eZ}const JX=ge.line({class:"cm-activeLine"}),eZ=Et.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.docChanged||t.selectionSet)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=-1,n=[];for(let r of t.state.selection.ranges){let i=t.lineBlockAt(r.head);i.from>e&&(n.push(JX.range(i.from)),e=i.from)}return ge.set(n)}},{decorations:t=>t.decorations});class tZ extends qi{constructor(e){super(),this.content=e}toDOM(e){let n=document.createElement("span");return n.className="cm-placeholder",n.style.pointerEvents="none",n.appendChild(typeof this.content=="string"?document.createTextNode(this.content):typeof this.content=="function"?this.content(e):this.content.cloneNode(!0)),n.setAttribute("aria-hidden","true"),n}coordsAt(e){let n=e.firstChild?Bs(e.firstChild):[];if(!n.length)return null;let r=window.getComputedStyle(e.parentNode),i=wc(n[0],r.direction!="rtl"),o=parseInt(r.lineHeight);return i.bottom-i.top>o*1.5?{left:i.left,right:i.right,top:i.top,bottom:i.top+o}:i}ignoreEvent(){return!1}}function nZ(t){let e=Et.fromClass(class{constructor(n){this.view=n,this.placeholder=t?ge.set([ge.widget({widget:new tZ(t),side:1}).range(0)]):ge.none}get decorations(){return this.view.state.doc.length?ge.none:this.placeholder}},{decorations:n=>n.decorations});return typeof t=="string"?[e,ne.contentAttributes.of({"aria-placeholder":t})]:e}const mg=2e3;function rZ(t,e,n){let r=Math.min(e.line,n.line),i=Math.max(e.line,n.line),o=[];if(e.off>mg||n.off>mg||e.col<0||n.col<0){let a=Math.min(e.off,n.off),s=Math.max(e.off,n.off);for(let l=r;l<=i;l++){let c=t.doc.line(l);c.length<=s&&o.push(Q.range(c.from+a,c.to+s))}}else{let a=Math.min(e.col,n.col),s=Math.max(e.col,n.col);for(let l=r;l<=i;l++){let c=t.doc.line(l),u=A0(c.text,a,t.tabSize,!0);if(u<0)o.push(Q.cursor(c.to));else{let f=A0(c.text,s,t.tabSize);o.push(Q.range(c.from+u,c.from+f))}}}return o}function iZ(t,e){let n=t.coordsAtPos(t.viewport.from);return n?Math.round(Math.abs((n.left-e)/t.defaultCharacterWidth)):-1}function Cw(t,e){let n=t.posAtCoords({x:e.clientX,y:e.clientY},!1),r=t.state.doc.lineAt(n),i=n-r.from,o=i>mg?-1:i==r.length?iZ(t,e.clientX):Rs(r.text,t.state.tabSize,n-r.from);return{line:r.number,col:o,off:i}}function oZ(t,e){let n=Cw(t,e),r=t.state.selection;return n?{update(i){if(i.docChanged){let o=i.changes.mapPos(i.startState.doc.line(n.line).from),a=i.state.doc.lineAt(o);n={line:a.number,col:n.col,off:Math.min(n.off,a.length)},r=r.map(i.changes)}},get(i,o,a){let s=Cw(t,i);if(!s)return r;let l=rZ(t.state,n,s);return l.length?a?Q.create(l.concat(r.ranges)):Q.create(l):r}}:null}function aZ(t){let e=n=>n.altKey&&n.button==0;return ne.mouseSelectionStyle.of((n,r)=>e(r)?oZ(n,r):null)}const sZ={Alt:[18,t=>!!t.altKey],Control:[17,t=>!!t.ctrlKey],Shift:[16,t=>!!t.shiftKey],Meta:[91,t=>!!t.metaKey]},lZ={style:"cursor: crosshair"};function cZ(t={}){let[e,n]=sZ[t.key||"Alt"],r=Et.fromClass(class{constructor(i){this.view=i,this.isDown=!1}set(i){this.isDown!=i&&(this.isDown=i,this.view.update([]))}},{eventObservers:{keydown(i){this.set(i.keyCode==e||n(i))},keyup(i){(i.keyCode==e||!n(i))&&this.set(!1)},mousemove(i){this.set(n(i))}}});return[r,ne.contentAttributes.of(i=>{var o;return!((o=i.plugin(r))===null||o===void 0)&&o.isDown?lZ:null})]}const Tc="-10000px";class kw{constructor(e,n,r,i){this.facet=n,this.createTooltipView=r,this.removeTooltipView=i,this.input=e.state.facet(n),this.tooltips=this.input.filter(a=>a);let o=null;this.tooltipViews=this.tooltips.map(a=>o=r(a,o))}update(e,n){var r;let i=e.state.facet(this.facet),o=i.filter(l=>l);if(i===this.input){for(let l of this.tooltipViews)l.update&&l.update(e);return!1}let a=[],s=n?[]:null;for(let l=0;l<o.length;l++){let c=o[l],u=-1;if(c){for(let f=0;f<this.tooltips.length;f++){let d=this.tooltips[f];d&&d.create==c.create&&(u=f)}if(u<0)a[l]=this.createTooltipView(c,l?a[l-1]:null),s&&(s[l]=!!c.above);else{let f=a[l]=this.tooltipViews[u];s&&(s[l]=n[u]),f.update&&f.update(e)}}}for(let l of this.tooltipViews)a.indexOf(l)<0&&(this.removeTooltipView(l),(r=l.destroy)===null||r===void 0||r.call(l));return n&&(s.forEach((l,c)=>n[c]=l),n.length=s.length),this.input=i,this.tooltips=o,this.tooltipViews=a,!0}}function uZ(t){let e=t.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:e.clientHeight,right:e.clientWidth}}const gg=ae.define({combine:t=>{var e,n,r;return{position:se.ios?"absolute":((e=t.find(i=>i.position))===null||e===void 0?void 0:e.position)||"fixed",parent:((n=t.find(i=>i.parent))===null||n===void 0?void 0:n.parent)||null,tooltipSpace:((r=t.find(i=>i.tooltipSpace))===null||r===void 0?void 0:r.tooltipSpace)||uZ}}}),Sw=new WeakMap,vg=Et.fromClass(class{constructor(t){this.view=t,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let e=t.state.facet(gg);this.position=e.position,this.parent=e.parent,this.classes=t.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver=typeof ResizeObserver=="function"?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new kw(t,yg,(n,r)=>this.createTooltip(n,r),n=>{this.resizeObserver&&this.resizeObserver.unobserve(n.dom),n.dom.remove()}),this.above=this.manager.tooltips.map(n=>!!n.above),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(n=>{Date.now()>this.lastTransaction-50&&n.length>0&&n[n.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),t.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let t of this.manager.tooltipViews)this.intersectionObserver.observe(t.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(t){t.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(t,this.above);e&&this.observeIntersection();let n=e||t.geometryChanged,r=t.state.facet(gg);if(r.position!=this.position&&!this.madeAbsolute){this.position=r.position;for(let i of this.manager.tooltipViews)i.dom.style.position=this.position;n=!0}if(r.parent!=this.parent){this.parent&&this.container.remove(),this.parent=r.parent,this.createContainer();for(let i of this.manager.tooltipViews)this.container.appendChild(i.dom);n=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);n&&this.maybeMeasure()}createTooltip(t,e){let n=t.create(this.view),r=e?e.dom:null;if(n.dom.classList.add("cm-tooltip"),t.arrow&&!n.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let i=document.createElement("div");i.className="cm-tooltip-arrow",n.dom.appendChild(i)}return n.dom.style.position=this.position,n.dom.style.top=Tc,n.dom.style.left="0px",this.container.insertBefore(n.dom,r),n.mount&&n.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(n.dom),n}destroy(){var t,e,n;this.view.win.removeEventListener("resize",this.measureSoon);for(let r of this.manager.tooltipViews)r.dom.remove(),(t=r.destroy)===null||t===void 0||t.call(r);this.parent&&this.container.remove(),(e=this.resizeObserver)===null||e===void 0||e.disconnect(),(n=this.intersectionObserver)===null||n===void 0||n.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let t=1,e=1,n=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:o}=this.manager.tooltipViews[0];if(se.gecko)n=o.offsetParent!=this.container.ownerDocument.body;else if(o.style.top==Tc&&o.style.left=="0px"){let a=o.getBoundingClientRect();n=Math.abs(a.top+1e4)>1||Math.abs(a.left)>1}}if(n||this.position=="absolute")if(this.parent){let o=this.parent.getBoundingClientRect();o.width&&o.height&&(t=o.width/this.parent.offsetWidth,e=o.height/this.parent.offsetHeight)}else({scaleX:t,scaleY:e}=this.view.viewState);let r=this.view.scrollDOM.getBoundingClientRect(),i=G0(this.view);return{visible:{left:r.left+i.left,top:r.top+i.top,right:r.right-i.right,bottom:r.bottom-i.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((o,a)=>{let s=this.manager.tooltipViews[a];return s.getCoords?s.getCoords(o.pos):this.view.coordsAtPos(o.pos)}),size:this.manager.tooltipViews.map(({dom:o})=>o.getBoundingClientRect()),space:this.view.state.facet(gg).tooltipSpace(this.view),scaleX:t,scaleY:e,makeAbsolute:n}}writeMeasure(t){var e;if(t.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let s of this.manager.tooltipViews)s.dom.style.position="absolute"}let{visible:n,space:r,scaleX:i,scaleY:o}=t,a=[];for(let s=0;s<this.manager.tooltips.length;s++){let l=this.manager.tooltips[s],c=this.manager.tooltipViews[s],{dom:u}=c,f=t.pos[s],d=t.size[s];if(!f||l.clip!==!1&&(f.bottom<=Math.max(n.top,r.top)||f.top>=Math.min(n.bottom,r.bottom)||f.right<Math.max(n.left,r.left)-.1||f.left>Math.min(n.right,r.right)+.1)){u.style.top=Tc;continue}let h=l.arrow?c.dom.querySelector(".cm-tooltip-arrow"):null,m=h?7:0,g=d.right-d.left,p=(e=Sw.get(c))!==null&&e!==void 0?e:d.bottom-d.top,v=c.offset||dZ,_=this.view.textDirection==ct.LTR,w=d.width>r.right-r.left?_?r.left:r.right-d.width:_?Math.max(r.left,Math.min(f.left-(h?14:0)+v.x,r.right-g)):Math.min(Math.max(r.left,f.left-g+(h?14:0)-v.x),r.right-g),b=this.above[s];!l.strictSide&&(b?f.top-p-m-v.y<r.top:f.bottom+p+m+v.y>r.bottom)&&b==r.bottom-f.bottom>f.top-r.top&&(b=this.above[s]=!b);let y=(b?f.top-r.top:r.bottom-f.bottom)-m;if(y<p&&c.resize!==!1){if(y<this.view.defaultLineHeight){u.style.top=Tc;continue}Sw.set(c,p),u.style.height=(p=y)/o+"px"}else u.style.height&&(u.style.height="");let k=b?f.top-p-m-v.y:f.bottom+m+v.y,C=w+g;if(c.overlap!==!0)for(let E of a)E.left<C&&E.right>w&&E.top<k+p&&E.bottom>k&&(k=b?E.top-p-2-m:E.bottom+m+2);if(this.position=="absolute"?(u.style.top=(k-t.parent.top)/o+"px",Ow(u,(w-t.parent.left)/i)):(u.style.top=k/o+"px",Ow(u,w/i)),h){let E=f.left+(_?v.x:-v.x)-(w+14-7);h.style.left=E/i+"px"}c.overlap!==!0&&a.push({left:w,top:k,right:C,bottom:k+p}),u.classList.toggle("cm-tooltip-above",b),u.classList.toggle("cm-tooltip-below",!b),c.positioned&&c.positioned(t.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let t of this.manager.tooltipViews)t.dom.style.top=Tc}},{eventObservers:{scroll(){this.maybeMeasure()}}});function Ow(t,e){let n=parseInt(t.style.left,10);(isNaN(n)||Math.abs(e-n)>1)&&(t.style.left=e+"px")}const fZ=ne.baseTheme({".cm-tooltip":{zIndex:500,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:`${7*2}px`,position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),dZ={x:0,y:0},yg=ae.define({enables:[vg,fZ]}),Id=ae.define({combine:t=>t.reduce((e,n)=>e.concat(n),[])});class Ld{static create(e){return new Ld(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new kw(e,Id,(n,r)=>this.createHostedView(n,r),n=>n.dom.remove())}createHostedView(e,n){let r=e.create(this.view);return r.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(r.dom,n?n.dom.nextSibling:this.dom.firstChild),this.mounted&&r.mount&&r.mount(this.view),r}mount(e){for(let n of this.manager.tooltipViews)n.mount&&n.mount(e);this.mounted=!0}positioned(e){for(let n of this.manager.tooltipViews)n.positioned&&n.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let n of this.manager.tooltipViews)(e=n.destroy)===null||e===void 0||e.call(n)}passProp(e){let n;for(let r of this.manager.tooltipViews){let i=r[e];if(i!==void 0){if(n===void 0)n=i;else if(n!==i)return}}return n}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}}const hZ=yg.compute([Id],t=>{let e=t.facet(Id);return e.length===0?null:{pos:Math.min(...e.map(n=>n.pos)),end:Math.max(...e.map(n=>{var r;return(r=n.end)!==null&&r!==void 0?r:n.pos})),create:Ld.create,above:e[0].above,arrow:e.some(n=>n.arrow)}});class pZ{constructor(e,n,r,i,o){this.view=e,this.source=n,this.field=r,this.setHover=i,this.hoverTime=o,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:e.dom,time:0},this.checkHover=this.checkHover.bind(this),e.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),e.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let e=Date.now()-this.lastMove.time;e<this.hoverTime?this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime-e):this.startHover()}startHover(){clearTimeout(this.restartTimeout);let{view:e,lastMove:n}=this,r=e.docView.nearest(n.target);if(!r)return;let i,o=1;if(r instanceof Ro)i=r.posAtStart;else{if(i=e.posAtCoords(n),i==null)return;let s=e.coordsAtPos(i);if(!s||n.y<s.top||n.y>s.bottom||n.x<s.left-e.defaultCharacterWidth||n.x>s.right+e.defaultCharacterWidth)return;let l=e.bidiSpans(e.state.doc.lineAt(i)).find(u=>u.from<=i&&u.to>=i),c=l&&l.dir==ct.RTL?-1:1;o=n.x<s.left?-c:c}let a=this.source(e,i,o);if(a!=null&&a.then){let s=this.pending={pos:i};a.then(l=>{this.pending==s&&(this.pending=null,l&&!(Array.isArray(l)&&!l.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(l)?l:[l])}))},l=>$n(e.state,l,"hover tooltip"))}else a&&!(Array.isArray(a)&&!a.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(a)?a:[a])})}get tooltip(){let e=this.view.plugin(vg),n=e?e.manager.tooltips.findIndex(r=>r.create==Ld.create):-1;return n>-1?e.manager.tooltipViews[n]:null}mousemove(e){var n,r;this.lastMove={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:i,tooltip:o}=this;if(i.length&&o&&!mZ(o.dom,e)||this.pending){let{pos:a}=i[0]||this.pending,s=(r=(n=i[0])===null||n===void 0?void 0:n.end)!==null&&r!==void 0?r:a;(a==s?this.view.posAtCoords(this.lastMove)!=a:!gZ(this.view,a,s,e.clientX,e.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:n}=this;if(n.length){let{tooltip:r}=this;r&&r.dom.contains(e.relatedTarget)?this.watchTooltipLeave(r.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(e){let n=r=>{e.removeEventListener("mouseleave",n),this.active.length&&!this.view.dom.contains(r.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};e.addEventListener("mouseleave",n)}destroy(){clearTimeout(this.hoverTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const jd=4;function mZ(t,e){let{left:n,right:r,top:i,bottom:o}=t.getBoundingClientRect(),a;if(a=t.querySelector(".cm-tooltip-arrow")){let s=a.getBoundingClientRect();i=Math.min(s.top,i),o=Math.max(s.bottom,o)}return e.clientX>=n-jd&&e.clientX<=r+jd&&e.clientY>=i-jd&&e.clientY<=o+jd}function gZ(t,e,n,r,i,o){let a=t.scrollDOM.getBoundingClientRect(),s=t.documentTop+t.documentPadding.top+t.contentHeight;if(a.left>r||a.right<r||a.top>i||Math.min(a.bottom,s)<i)return!1;let l=t.posAtCoords({x:r,y:i},!1);return l>=e&&l<=n}function vZ(t,e={}){let n=Se.define(),r=sn.define({create(){return[]},update(i,o){if(i.length&&(e.hideOnChange&&(o.docChanged||o.selection)?i=[]:e.hideOn&&(i=i.filter(a=>!e.hideOn(o,a))),o.docChanged)){let a=[];for(let s of i){let l=o.changes.mapPos(s.pos,-1,Pn.TrackDel);if(l!=null){let c=Object.assign(Object.create(null),s);c.pos=l,c.end!=null&&(c.end=o.changes.mapPos(c.end)),a.push(c)}}i=a}for(let a of o.effects)a.is(n)&&(i=a.value),a.is(yZ)&&(i=[]);return i},provide:i=>Id.from(i)});return{active:r,extension:[r,Et.define(i=>new pZ(i,t,r,n,e.hoverTime||300)),hZ]}}function Pw(t,e){let n=t.plugin(vg);if(!n)return null;let r=n.manager.tooltips.indexOf(e);return r<0?null:n.manager.tooltipViews[r]}const yZ=Se.define(),Ew=ae.define({combine(t){let e,n;for(let r of t)e=e||r.topContainer,n=n||r.bottomContainer;return{topContainer:e,bottomContainer:n}}});function Nc(t,e){let n=t.plugin(Aw),r=n?n.specs.indexOf(e):-1;return r>-1?n.panels[r]:null}const Aw=Et.fromClass(class{constructor(t){this.input=t.state.facet(Ic),this.specs=this.input.filter(n=>n),this.panels=this.specs.map(n=>n(t));let e=t.state.facet(Ew);this.top=new Rd(t,!0,e.topContainer),this.bottom=new Rd(t,!1,e.bottomContainer),this.top.sync(this.panels.filter(n=>n.top)),this.bottom.sync(this.panels.filter(n=>!n.top));for(let n of this.panels)n.dom.classList.add("cm-panel"),n.mount&&n.mount()}update(t){let e=t.state.facet(Ew);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new Rd(t.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new Rd(t.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let n=t.state.facet(Ic);if(n!=this.input){let r=n.filter(l=>l),i=[],o=[],a=[],s=[];for(let l of r){let c=this.specs.indexOf(l),u;c<0?(u=l(t.view),s.push(u)):(u=this.panels[c],u.update&&u.update(t)),i.push(u),(u.top?o:a).push(u)}this.specs=r,this.panels=i,this.top.sync(o),this.bottom.sync(a);for(let l of s)l.dom.classList.add("cm-panel"),l.mount&&l.mount()}else for(let r of this.panels)r.update&&r.update(t)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:t=>ne.scrollMargins.of(e=>{let n=e.plugin(t);return n&&{top:n.top.scrollMargin(),bottom:n.bottom.scrollMargin()}})});class Rd{constructor(e,n,r){this.view=e,this.top=n,this.container=r,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let n of this.panels)n.destroy&&e.indexOf(n)<0&&n.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(this.panels.length==0){this.dom&&(this.dom.remove(),this.dom=void 0);return}if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let n=this.container||this.view.dom;n.insertBefore(this.dom,this.top?n.firstChild:null)}let e=this.dom.firstChild;for(let n of this.panels)if(n.dom.parentNode==this.dom){for(;e!=n.dom;)e=Dw(e);e=e.nextSibling}else this.dom.insertBefore(n.dom,e);for(;e;)e=Dw(e)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(!(!this.container||this.classes==this.view.themeClasses)){for(let e of this.classes.split(" "))e&&this.container.classList.remove(e);for(let e of(this.classes=this.view.themeClasses).split(" "))e&&this.container.classList.add(e)}}}function Dw(t){let e=t.nextSibling;return t.remove(),e}const Ic=ae.define({enables:Aw});class Yi extends Pa{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}Yi.prototype.elementClass="",Yi.prototype.toDOM=void 0,Yi.prototype.mapMode=Pn.TrackBefore,Yi.prototype.startSide=Yi.prototype.endSide=-1,Yi.prototype.point=!0;const Bd=ae.define(),bZ=ae.define(),wZ={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>Be.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{}},Lc=ae.define();function _Z(t){return[Tw(),Lc.of(Object.assign(Object.assign({},wZ),t))]}const Mw=ae.define({combine:t=>t.some(e=>e)});function Tw(t){return[xZ]}const xZ=Et.fromClass(class{constructor(t){this.view=t,this.prevViewport=t.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=t.state.facet(Lc).map(e=>new Iw(t,e));for(let e of this.gutters)this.dom.appendChild(e.dom);this.fixed=!t.state.facet(Mw),this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),t.scrollDOM.insertBefore(this.dom,t.contentDOM)}update(t){if(this.updateGutters(t)){let e=this.prevViewport,n=t.view.viewport,r=Math.min(e.to,n.to)-Math.max(e.from,n.from);this.syncGutters(r<(n.to-n.from)*.8)}t.geometryChanged&&(this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px"),this.view.state.facet(Mw)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":""),this.prevViewport=t.view.viewport}syncGutters(t){let e=this.dom.nextSibling;t&&this.dom.remove();let n=Be.iter(this.view.state.facet(Bd),this.view.viewport.from),r=[],i=this.gutters.map(o=>new CZ(o,this.view.viewport,-this.view.documentPadding.top));for(let o of this.view.viewportLineBlocks)if(r.length&&(r=[]),Array.isArray(o.type)){let a=!0;for(let s of o.type)if(s.type==En.Text&&a){bg(n,r,s.from);for(let l of i)l.line(this.view,s,r);a=!1}else if(s.widget)for(let l of i)l.widget(this.view,s)}else if(o.type==En.Text){bg(n,r,o.from);for(let a of i)a.line(this.view,o,r)}else if(o.widget)for(let a of i)a.widget(this.view,o);for(let o of i)o.finish();t&&this.view.scrollDOM.insertBefore(this.dom,e)}updateGutters(t){let e=t.startState.facet(Lc),n=t.state.facet(Lc),r=t.docChanged||t.heightChanged||t.viewportChanged||!Be.eq(t.startState.facet(Bd),t.state.facet(Bd),t.view.viewport.from,t.view.viewport.to);if(e==n)for(let i of this.gutters)i.update(t)&&(r=!0);else{r=!0;let i=[];for(let o of n){let a=e.indexOf(o);a<0?i.push(new Iw(this.view,o)):(this.gutters[a].update(t),i.push(this.gutters[a]))}for(let o of this.gutters)o.dom.remove(),i.indexOf(o)<0&&o.destroy();for(let o of i)this.dom.appendChild(o.dom);this.gutters=i}return r}destroy(){for(let t of this.gutters)t.destroy();this.dom.remove()}},{provide:t=>ne.scrollMargins.of(e=>{let n=e.plugin(t);return!n||n.gutters.length==0||!n.fixed?null:e.textDirection==ct.LTR?{left:n.dom.offsetWidth*e.scaleX}:{right:n.dom.offsetWidth*e.scaleX}})});function Nw(t){return Array.isArray(t)?t:[t]}function bg(t,e,n){for(;t.value&&t.from<=n;)t.from==n&&e.push(t.value),t.next()}class CZ{constructor(e,n,r){this.gutter=e,this.height=r,this.i=0,this.cursor=Be.iter(e.markers,n.from)}addElement(e,n,r){let{gutter:i}=this,o=(n.top-this.height)/e.scaleY,a=n.height/e.scaleY;if(this.i==i.elements.length){let s=new Lw(e,a,o,r);i.elements.push(s),i.dom.appendChild(s.dom)}else i.elements[this.i].update(e,a,o,r);this.height=n.bottom,this.i++}line(e,n,r){let i=[];bg(this.cursor,i,n.from),r.length&&(i=i.concat(r));let o=this.gutter.config.lineMarker(e,n,i);o&&i.unshift(o);let a=this.gutter;i.length==0&&!a.config.renderEmptyElements||this.addElement(e,n,i)}widget(e,n){let r=this.gutter.config.widgetMarker(e,n.widget,n),i=r?[r]:null;for(let o of e.state.facet(bZ)){let a=o(e,n.widget,n);a&&(i||(i=[])).push(a)}i&&this.addElement(e,n,i)}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let n=e.elements.pop();e.dom.removeChild(n.dom),n.destroy()}}}class Iw{constructor(e,n){this.view=e,this.config=n,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let r in n.domEventHandlers)this.dom.addEventListener(r,i=>{let o=i.target,a;if(o!=this.dom&&this.dom.contains(o)){for(;o.parentNode!=this.dom;)o=o.parentNode;let l=o.getBoundingClientRect();a=(l.top+l.bottom)/2}else a=i.clientY;let s=e.lineBlockAtHeight(a-e.documentTop);n.domEventHandlers[r](e,s,i)&&i.preventDefault()});this.markers=Nw(n.markers(e)),n.initialSpacer&&(this.spacer=new Lw(e,0,0,[n.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let n=this.markers;if(this.markers=Nw(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let i=this.config.updateSpacer(this.spacer.markers[0],e);i!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[i])}let r=e.view.viewport;return!Be.eq(this.markers,n,r.from,r.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}}class Lw{constructor(e,n,r,i){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,n,r,i)}update(e,n,r,i){this.height!=n&&(this.height=n,this.dom.style.height=n+"px"),this.above!=r&&(this.dom.style.marginTop=(this.above=r)?r+"px":""),kZ(this.markers,i)||this.setMarkers(e,i)}setMarkers(e,n){let r="cm-gutterElement",i=this.dom.firstChild;for(let o=0,a=0;;){let s=a,l=o<n.length?n[o++]:null,c=!1;if(l){let u=l.elementClass;u&&(r+=" "+u);for(let f=a;f<this.markers.length;f++)if(this.markers[f].compare(l)){s=f,c=!0;break}}else s=this.markers.length;for(;a<s;){let u=this.markers[a++];if(u.toDOM){u.destroy(i);let f=i.nextSibling;i.remove(),i=f}}if(!l)break;l.toDOM&&(c?i=i.nextSibling:this.dom.insertBefore(l.toDOM(e),i)),c&&a++}this.dom.className=r,this.markers=n}destroy(){this.setMarkers(null,[])}}function kZ(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].compare(e[n]))return!1;return!0}const SZ=ae.define(),OZ=ae.define(),Us=ae.define({combine(t){return di(t,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(e,n){let r=Object.assign({},e);for(let i in n){let o=r[i],a=n[i];r[i]=o?(s,l,c)=>o(s,l,c)||a(s,l,c):a}return r}})}});class wg extends Yi{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function _g(t,e){return t.state.facet(Us).formatNumber(e,t.state)}const PZ=Lc.compute([Us],t=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(SZ)},lineMarker(e,n,r){return r.some(i=>i.toDOM)?null:new wg(_g(e,e.state.doc.lineAt(n.from).number))},widgetMarker:(e,n,r)=>{for(let i of e.state.facet(OZ)){let o=i(e,n,r);if(o)return o}return null},lineMarkerChange:e=>e.startState.facet(Us)!=e.state.facet(Us),initialSpacer(e){return new wg(_g(e,jw(e.state.doc.lines)))},updateSpacer(e,n){let r=_g(n.view,jw(n.view.state.doc.lines));return r==e.number?e:new wg(r)},domEventHandlers:t.facet(Us).domEventHandlers}));function EZ(t={}){return[Us.of(t),Tw(),PZ]}function jw(t){let e=9;for(;e<t;)e=e*10+9;return e}const AZ=new class extends Yi{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},DZ=Bd.compute(["selection"],t=>{let e=[],n=-1;for(let r of t.selection.ranges){let i=t.doc.lineAt(r.head).from;i>n&&(n=i,e.push(AZ.range(i)))}return Be.of(e)});function MZ(){return DZ}const Rw=1024;let TZ=0;class xg{constructor(e,n){this.from=e,this.to=n}}class De{constructor(e={}){this.id=TZ++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")})}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=Fn.match(e)),n=>{let r=e(n);return r===void 0?null:[this,r]}}}De.closedBy=new De({deserialize:t=>t.split(" ")}),De.openedBy=new De({deserialize:t=>t.split(" ")}),De.group=new De({deserialize:t=>t.split(" ")}),De.isolate=new De({deserialize:t=>{if(t&&t!="rtl"&&t!="ltr"&&t!="auto")throw new RangeError("Invalid value for isolate: "+t);return t||"auto"}}),De.contextHash=new De({perNode:!0}),De.lookAhead=new De({perNode:!0}),De.mounted=new De({perNode:!0});class $d{constructor(e,n,r){this.tree=e,this.overlay=n,this.parser=r}static get(e){return e&&e.props&&e.props[De.mounted.id]}}const NZ=Object.create(null);class Fn{constructor(e,n,r,i=0){this.name=e,this.props=n,this.id=r,this.flags=i}static define(e){let n=e.props&&e.props.length?Object.create(null):NZ,r=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),i=new Fn(e.name||"",n,e.id,r);if(e.props){for(let o of e.props)if(Array.isArray(o)||(o=o(i)),o){if(o[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");n[o[0].id]=o[1]}}return i}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let n=this.prop(De.group);return n?n.indexOf(e)>-1:!1}return this.id==e}static match(e){let n=Object.create(null);for(let r in e)for(let i of r.split(" "))n[i]=e[r];return r=>{for(let i=r.prop(De.group),o=-1;o<(i?i.length:0);o++){let a=n[o<0?r.name:i[o]];if(a)return a}}}}Fn.none=new Fn("",Object.create(null),0,8);class Cg{constructor(e){this.types=e;for(let n=0;n<e.length;n++)if(e[n].id!=n)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let n=[];for(let r of this.types){let i=null;for(let o of e){let a=o(r);a&&(i||(i=Object.assign({},r.props)),i[a[0].id]=a[1])}n.push(i?new Fn(r.name,i,r.id,r.flags):r)}return new Cg(n)}}const Fd=new WeakMap,Bw=new WeakMap;var Qt;(function(t){t[t.ExcludeBuffers=1]="ExcludeBuffers",t[t.IncludeAnonymous=2]="IncludeAnonymous",t[t.IgnoreMounts=4]="IgnoreMounts",t[t.IgnoreOverlays=8]="IgnoreOverlays"})(Qt||(Qt={}));class Nt{constructor(e,n,r,i,o){if(this.type=e,this.children=n,this.positions=r,this.length=i,this.props=null,o&&o.length){this.props=Object.create(null);for(let[a,s]of o)this.props[typeof a=="number"?a:a.id]=s}}toString(){let e=$d.get(this);if(e&&!e.overlay)return e.tree.toString();let n="";for(let r of this.children){let i=r.toString();i&&(n&&(n+=","),n+=i)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(n.length?"("+n+")":""):n}cursor(e=0){return new Og(this.topNode,e)}cursorAt(e,n=0,r=0){let i=Fd.get(this)||this.topNode,o=new Og(i);return o.moveTo(e,n),Fd.set(this,o._tree),o}get topNode(){return new wr(this,0,0,null)}resolve(e,n=0){let r=jc(Fd.get(this)||this.topNode,e,n,!1);return Fd.set(this,r),r}resolveInner(e,n=0){let r=jc(Bw.get(this)||this.topNode,e,n,!0);return Bw.set(this,r),r}resolveStack(e,n=0){return jZ(this,e,n)}iterate(e){let{enter:n,leave:r,from:i=0,to:o=this.length}=e,a=e.mode||0,s=(a&Qt.IncludeAnonymous)>0;for(let l=this.cursor(a|Qt.IncludeAnonymous);;){let c=!1;if(l.from<=o&&l.to>=i&&(!s&&l.type.isAnonymous||n(l)!==!1)){if(l.firstChild())continue;c=!0}for(;c&&r&&(s||!l.type.isAnonymous)&&r(l),!l.nextSibling();){if(!l.parent())return;c=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let n in this.props)e.push([+n,this.props[n]]);return e}balance(e={}){return this.children.length<=8?this:Eg(Fn.none,this.children,this.positions,0,this.children.length,0,this.length,(n,r,i)=>new Nt(this.type,n,r,i,this.propValues),e.makeTree||((n,r,i)=>new Nt(Fn.none,n,r,i)))}static build(e){return RZ(e)}}Nt.empty=new Nt(Fn.none,[],[],0);class kg{constructor(e,n){this.buffer=e,this.index=n}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new kg(this.buffer,this.index)}}class Ho{constructor(e,n,r){this.buffer=e,this.length=n,this.set=r}get type(){return Fn.none}toString(){let e=[];for(let n=0;n<this.buffer.length;)e.push(this.childString(n)),n=this.buffer[n+3];return e.join(",")}childString(e){let n=this.buffer[e],r=this.buffer[e+3],i=this.set.types[n],o=i.name;if(/\W/.test(o)&&!i.isError&&(o=JSON.stringify(o)),e+=4,r==e)return o;let a=[];for(;e<r;)a.push(this.childString(e)),e=this.buffer[e+3];return o+"("+a.join(",")+")"}findChild(e,n,r,i,o){let{buffer:a}=this,s=-1;for(let l=e;l!=n&&!($w(o,i,a[l+1],a[l+2])&&(s=l,r>0));l=a[l+3]);return s}slice(e,n,r){let i=this.buffer,o=new Uint16Array(n-e),a=0;for(let s=e,l=0;s<n;){o[l++]=i[s++],o[l++]=i[s++]-r;let c=o[l++]=i[s++]-r;o[l++]=i[s++]-e,a=Math.max(a,c)}return new Ho(o,a,this.set)}}function $w(t,e,n,r){switch(t){case-2:return n<e;case-1:return r>=e&&n<e;case 0:return n<e&&r>e;case 1:return n<=e&&r>e;case 2:return r>e;case 4:return!0}}function jc(t,e,n,r){for(var i;t.from==t.to||(n<1?t.from>=e:t.from>e)||(n>-1?t.to<=e:t.to<e);){let a=!r&&t instanceof wr&&t.index<0?null:t.parent;if(!a)return t;t=a}let o=r?0:Qt.IgnoreOverlays;if(r)for(let a=t,s=a.parent;s;a=s,s=a.parent)a instanceof wr&&a.index<0&&((i=s.enter(e,n,o))===null||i===void 0?void 0:i.from)!=a.from&&(t=s);for(;;){let a=t.enter(e,n,o);if(!a)return t;t=a}}class Fw{cursor(e=0){return new Og(this,e)}getChild(e,n=null,r=null){let i=Hw(this,e,n,r);return i.length?i[0]:null}getChildren(e,n=null,r=null){return Hw(this,e,n,r)}resolve(e,n=0){return jc(this,e,n,!1)}resolveInner(e,n=0){return jc(this,e,n,!0)}matchContext(e){return Sg(this.parent,e)}enterUnfinishedNodesBefore(e){let n=this.childBefore(e),r=this;for(;n;){let i=n.lastChild;if(!i||i.to!=n.to)break;i.type.isError&&i.from==i.to?(r=n,n=i.prevSibling):n=i}return r}get node(){return this}get next(){return this.parent}}class wr extends Fw{constructor(e,n,r,i){super(),this._tree=e,this.from=n,this.index=r,this._parent=i}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,n,r,i,o=0){for(let a=this;;){for(let{children:s,positions:l}=a._tree,c=n>0?s.length:-1;e!=c;e+=n){let u=s[e],f=l[e]+a.from;if($w(i,r,f,f+u.length)){if(u instanceof Ho){if(o&Qt.ExcludeBuffers)continue;let d=u.findChild(0,u.buffer.length,n,r-f,i);if(d>-1)return new Vo(new IZ(a,u,e,f),null,d)}else if(o&Qt.IncludeAnonymous||!u.type.isAnonymous||Pg(u)){let d;if(!(o&Qt.IgnoreMounts)&&(d=$d.get(u))&&!d.overlay)return new wr(d.tree,f,e,a);let h=new wr(u,f,e,a);return o&Qt.IncludeAnonymous||!h.type.isAnonymous?h:h.nextChild(n<0?u.children.length-1:0,n,r,i)}}}if(o&Qt.IncludeAnonymous||!a.type.isAnonymous||(a.index>=0?e=a.index+n:e=n<0?-1:a._parent._tree.children.length,a=a._parent,!a))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}enter(e,n,r=0){let i;if(!(r&Qt.IgnoreOverlays)&&(i=$d.get(this._tree))&&i.overlay){let o=e-this.from;for(let{from:a,to:s}of i.overlay)if((n>0?a<=o:a<o)&&(n<0?s>=o:s>o))return new wr(i.tree,i.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,n,r)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function Hw(t,e,n,r){let i=t.cursor(),o=[];if(!i.firstChild())return o;if(n!=null){for(let a=!1;!a;)if(a=i.type.is(n),!i.nextSibling())return o}for(;;){if(r!=null&&i.type.is(r))return o;if(i.type.is(e)&&o.push(i.node),!i.nextSibling())return r==null?o:[]}}function Sg(t,e,n=e.length-1){for(let r=t;n>=0;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(e[n]&&e[n]!=r.name)return!1;n--}}return!0}class IZ{constructor(e,n,r,i){this.parent=e,this.buffer=n,this.index=r,this.start=i}}class Vo extends Fw{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,n,r){super(),this.context=e,this._parent=n,this.index=r,this.type=e.buffer.set.types[e.buffer.buffer[r]]}child(e,n,r){let{buffer:i}=this.context,o=i.findChild(this.index+4,i.buffer[this.index+3],e,n-this.context.start,r);return o<0?null:new Vo(this.context,this,o)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}enter(e,n,r=0){if(r&Qt.ExcludeBuffers)return null;let{buffer:i}=this.context,o=i.findChild(this.index+4,i.buffer[this.index+3],n>0?1:-1,e-this.context.start,n);return o<0?null:new Vo(this.context,this,o)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,n=e.buffer[this.index+3];return n<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new Vo(this.context,this._parent,n):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,n=this._parent?this._parent.index+4:0;return this.index==n?this.externalSibling(-1):new Vo(this.context,this._parent,e.findChild(n,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],n=[],{buffer:r}=this.context,i=this.index+4,o=r.buffer[this.index+3];if(o>i){let a=r.buffer[this.index+1];e.push(r.slice(i,o,a)),n.push(0)}return new Nt(this.type,e,n,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function Vw(t){if(!t.length)return null;let e=0,n=t[0];for(let o=1;o<t.length;o++){let a=t[o];(a.from>n.from||a.to<n.to)&&(n=a,e=o)}let r=n instanceof wr&&n.index<0?null:n.parent,i=t.slice();return r?i[e]=r:i.splice(e,1),new LZ(i,n)}class LZ{constructor(e,n){this.heads=e,this.node=n}get next(){return Vw(this.heads)}}function jZ(t,e,n){let r=t.resolveInner(e,n),i=null;for(let o=r instanceof wr?r:r.context.parent;o;o=o.parent)if(o.index<0){let a=o.parent;(i||(i=[r])).push(a.resolve(e,n)),o=a}else{let a=$d.get(o.tree);if(a&&a.overlay&&a.overlay[0].from<=e&&a.overlay[a.overlay.length-1].to>=e){let s=new wr(a.tree,a.overlay[0].from+o.from,-1,o);(i||(i=[r])).push(jc(s,e,n,!1))}}return i?Vw(i):r}class Og{get name(){return this.type.name}constructor(e,n=0){if(this.mode=n,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,e instanceof wr)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let r=e._parent;r;r=r._parent)this.stack.unshift(r.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,n){this.index=e;let{start:r,buffer:i}=this.buffer;return this.type=n||i.set.types[i.buffer[e]],this.from=r+i.buffer[e+1],this.to=r+i.buffer[e+2],!0}yield(e){return e?e instanceof wr?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,n,r){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,n,r,this.mode));let{buffer:i}=this.buffer,o=i.findChild(this.index+4,i.buffer[this.index+3],e,n-this.buffer.start,r);return o<0?!1:(this.stack.push(this.index),this.yieldBuf(o))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,n,r=this.mode){return this.buffer?r&Qt.ExcludeBuffers?!1:this.enterChild(1,e,n):this.yield(this._tree.enter(e,n,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&Qt.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&Qt.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:n}=this.buffer,r=this.stack.length-1;if(e<0){let i=r<0?0:this.stack[r]+4;if(this.index!=i)return this.yieldBuf(n.findChild(i,this.index,-1,0,4))}else{let i=n.buffer[this.index+3];if(i<(r<0?n.buffer.length:n.buffer[this.stack[r]+3]))return this.yieldBuf(i)}return r<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let n,r,{buffer:i}=this;if(i){if(e>0){if(this.index<i.buffer.buffer.length)return!1}else for(let o=0;o<this.index;o++)if(i.buffer.buffer[o+3]<this.index)return!1;({index:n,parent:r}=i)}else({index:n,_parent:r}=this._tree);for(;r;{index:n,_parent:r}=r)if(n>-1)for(let o=n+e,a=e<0?-1:r._tree.children.length;o!=a;o+=e){let s=r._tree.children[o];if(this.mode&Qt.IncludeAnonymous||s instanceof Ho||!s.type.isAnonymous||Pg(s))return!1}return!0}move(e,n){if(n&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,n=0){for(;(this.from==this.to||(n<1?this.from>=e:this.from>e)||(n>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,n););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,n=null,r=0;if(e&&e.context==this.buffer)e:for(let i=this.index,o=this.stack.length;o>=0;){for(let a=e;a;a=a._parent)if(a.index==i){if(i==this.index)return a;n=a,r=o+1;break e}i=this.stack[--o]}for(let i=r;i<this.stack.length;i++)n=new Vo(this.buffer,n,this.stack[i]);return this.bufferNode=new Vo(this.buffer,n,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,n){for(let r=0;;){let i=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){r++;continue}this.type.isAnonymous||(i=!0)}for(;;){if(i&&n&&n(this),i=this.type.isAnonymous,!r)return;if(this.nextSibling())break;this.parent(),r--,i=!0}}}matchContext(e){if(!this.buffer)return Sg(this.node.parent,e);let{buffer:n}=this.buffer,{types:r}=n.set;for(let i=e.length-1,o=this.stack.length-1;i>=0;o--){if(o<0)return Sg(this._tree,e,i);let a=r[n.buffer[this.stack[o]]];if(!a.isAnonymous){if(e[i]&&e[i]!=a.name)return!1;i--}}return!0}}function Pg(t){return t.children.some(e=>e instanceof Ho||!e.type.isAnonymous||Pg(e))}function RZ(t){var e;let{buffer:n,nodeSet:r,maxBufferLength:i=Rw,reused:o=[],minRepeatType:a=r.types.length}=t,s=Array.isArray(n)?new kg(n,n.length):n,l=r.types,c=0,u=0;function f(y,k,C,E,A,N){let{id:M,start:T,end:I,size:L}=s,F=u,V=c;for(;L<0;)if(s.next(),L==-1){let he=o[M];C.push(he),E.push(T-y);return}else if(L==-3){c=M;return}else if(L==-4){u=M;return}else throw new RangeError(`Unrecognized record size: ${L}`);let W=l[M],X,J,pe=T-y;if(I-T<=i&&(J=p(s.pos-k,A))){let he=new Uint16Array(J.size-J.skip),oe=s.pos-J.size,$=he.length;for(;s.pos>oe;)$=v(J.start,he,$);X=new Ho(he,I-J.start,r),pe=J.start-y}else{let he=s.pos-L;s.next();let oe=[],$=[],U=M>=a?M:-1,Z=0,Ce=I;for(;s.pos>he;)U>=0&&s.id==U&&s.size>=0?(s.end<=Ce-i&&(m(oe,$,T,Z,s.end,Ce,U,F,V),Z=oe.length,Ce=s.end),s.next()):N>2500?d(T,he,oe,$):f(T,he,oe,$,U,N+1);if(U>=0&&Z>0&&Z<oe.length&&m(oe,$,T,Z,T,Ce,U,F,V),oe.reverse(),$.reverse(),U>-1&&Z>0){let ze=h(W,V);X=Eg(W,oe,$,0,oe.length,0,I-T,ze,ze)}else X=g(W,oe,$,I-T,F-I,V)}C.push(X),E.push(pe)}function d(y,k,C,E){let A=[],N=0,M=-1;for(;s.pos>k;){let{id:T,start:I,end:L,size:F}=s;if(F>4)s.next();else{if(M>-1&&I<M)break;M<0&&(M=L-i),A.push(T,I,L),N++,s.next()}}if(N){let T=new Uint16Array(N*4),I=A[A.length-2];for(let L=A.length-3,F=0;L>=0;L-=3)T[F++]=A[L],T[F++]=A[L+1]-I,T[F++]=A[L+2]-I,T[F++]=F;C.push(new Ho(T,A[2]-I,r)),E.push(I-y)}}function h(y,k){return(C,E,A)=>{let N=0,M=C.length-1,T,I;if(M>=0&&(T=C[M])instanceof Nt){if(!M&&T.type==y&&T.length==A)return T;(I=T.prop(De.lookAhead))&&(N=E[M]+T.length+I)}return g(y,C,E,A,N,k)}}function m(y,k,C,E,A,N,M,T,I){let L=[],F=[];for(;y.length>E;)L.push(y.pop()),F.push(k.pop()+C-A);y.push(g(r.types[M],L,F,N-A,T-N,I)),k.push(A-C)}function g(y,k,C,E,A,N,M){if(N){let T=[De.contextHash,N];M=M?[T].concat(M):[T]}if(A>25){let T=[De.lookAhead,A];M=M?[T].concat(M):[T]}return new Nt(y,k,C,E,M)}function p(y,k){let C=s.fork(),E=0,A=0,N=0,M=C.end-i,T={size:0,start:0,skip:0};e:for(let I=C.pos-y;C.pos>I;){let L=C.size;if(C.id==k&&L>=0){T.size=E,T.start=A,T.skip=N,N+=4,E+=4,C.next();continue}let F=C.pos-L;if(L<0||F<I||C.start<M)break;let V=C.id>=a?4:0,W=C.start;for(C.next();C.pos>F;){if(C.size<0)if(C.size==-3)V+=4;else break e;else C.id>=a&&(V+=4);C.next()}A=W,E+=L,N+=V}return(k<0||E==y)&&(T.size=E,T.start=A,T.skip=N),T.size>4?T:void 0}function v(y,k,C){let{id:E,start:A,end:N,size:M}=s;if(s.next(),M>=0&&E<a){let T=C;if(M>4){let I=s.pos-(M-4);for(;s.pos>I;)C=v(y,k,C)}k[--C]=T,k[--C]=N-y,k[--C]=A-y,k[--C]=E}else M==-3?c=E:M==-4&&(u=E);return C}let _=[],w=[];for(;s.pos>0;)f(t.start||0,t.bufferStart||0,_,w,-1,0);let b=(e=t.length)!==null&&e!==void 0?e:_.length?w[0]+_[0].length:0;return new Nt(l[t.topID],_.reverse(),w.reverse(),b)}const Ww=new WeakMap;function Hd(t,e){if(!t.isAnonymous||e instanceof Ho||e.type!=t)return 1;let n=Ww.get(e);if(n==null){n=1;for(let r of e.children){if(r.type!=t||!(r instanceof Nt)){n=1;break}n+=Hd(t,r)}Ww.set(e,n)}return n}function Eg(t,e,n,r,i,o,a,s,l){let c=0;for(let m=r;m<i;m++)c+=Hd(t,e[m]);let u=Math.ceil(c*1.5/8),f=[],d=[];function h(m,g,p,v,_){for(let w=p;w<v;){let b=w,y=g[w],k=Hd(t,m[w]);for(w++;w<v;w++){let C=Hd(t,m[w]);if(k+C>=u)break;k+=C}if(w==b+1){if(k>u){let C=m[b];h(C.children,C.positions,0,C.children.length,g[b]+_);continue}f.push(m[b])}else{let C=g[w-1]+m[w-1].length-y;f.push(Eg(t,m,g,b,w,y,C,null,l))}d.push(y+_-o)}}return h(e,n,r,i,0),(s||l)(f,d,a)}class Ma{constructor(e,n,r,i,o=!1,a=!1){this.from=e,this.to=n,this.tree=r,this.offset=i,this.open=(o?1:0)|(a?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,n=[],r=!1){let i=[new Ma(0,e.length,e,0,!1,r)];for(let o of n)o.to>e.length&&i.push(o);return i}static applyChanges(e,n,r=128){if(!n.length)return e;let i=[],o=1,a=e.length?e[0]:null;for(let s=0,l=0,c=0;;s++){let u=s<n.length?n[s]:null,f=u?u.fromA:1e9;if(f-l>=r)for(;a&&a.from<f;){let d=a;if(l>=d.from||f<=d.to||c){let h=Math.max(d.from,l)-c,m=Math.min(d.to,f)-c;d=h>=m?null:new Ma(h,m,d.tree,d.offset+c,s>0,!!u)}if(d&&i.push(d),a.to>f)break;a=o<e.length?e[o++]:null}if(!u)break;l=u.toA,c=u.toA-u.toB}return i}}class zw{startParse(e,n,r){return typeof e=="string"&&(e=new BZ(e)),r=r?r.length?r.map(i=>new xg(i.from,i.to)):[new xg(0,0)]:[new xg(0,e.length)],this.createParse(e,n||[],r)}parse(e,n,r){let i=this.startParse(e,n,r);for(;;){let o=i.advance();if(o)return o}}}class BZ{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,n){return this.string.slice(e,n)}}new De({perNode:!0});let $Z=0,Xi=class x2{constructor(e,n,r,i){this.name=e,this.set=n,this.base=r,this.modified=i,this.id=$Z++}toString(){let{name:e}=this;for(let n of this.modified)n.name&&(e=`${n.name}(${e})`);return e}static define(e,n){let r=typeof e=="string"?e:"?";if(e instanceof x2&&(n=e),n!=null&&n.base)throw new Error("Can not derive from a modified tag");let i=new x2(r,[],null,[]);if(i.set.push(i),n)for(let o of n.set)i.set.push(o);return i}static defineModifier(e){let n=new Vd(e);return r=>r.modified.indexOf(n)>-1?r:Vd.get(r.base||r,r.modified.concat(n).sort((i,o)=>i.id-o.id))}},FZ=0;class Vd{constructor(e){this.name=e,this.instances=[],this.id=FZ++}static get(e,n){if(!n.length)return e;let r=n[0].instances.find(s=>s.base==e&&HZ(n,s.modified));if(r)return r;let i=[],o=new Xi(e.name,i,e,n);for(let s of n)s.instances.push(o);let a=VZ(n);for(let s of e.set)if(!s.modified.length)for(let l of a)i.push(Vd.get(s,l));return o}}function HZ(t,e){return t.length==e.length&&t.every((n,r)=>n==e[r])}function VZ(t){let e=[[]];for(let n=0;n<t.length;n++)for(let r=0,i=e.length;r<i;r++)e.push(e[r].concat(t[n]));return e.sort((n,r)=>r.length-n.length)}function Rc(t){let e=Object.create(null);for(let n in t){let r=t[n];Array.isArray(r)||(r=[r]);for(let i of n.split(" "))if(i){let o=[],a=2,s=i;for(let f=0;;){if(s=="..."&&f>0&&f+3==i.length){a=1;break}let d=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(s);if(!d)throw new RangeError("Invalid path: "+i);if(o.push(d[0]=="*"?"":d[0][0]=='"'?JSON.parse(d[0]):d[0]),f+=d[0].length,f==i.length)break;let h=i[f++];if(f==i.length&&h=="!"){a=0;break}if(h!="/")throw new RangeError("Invalid path: "+i);s=i.slice(f)}let l=o.length-1,c=o[l];if(!c)throw new RangeError("Invalid path: "+i);let u=new Wd(r,a,l>0?o.slice(0,l):null);e[c]=u.sort(e[c])}}return Uw.add(e)}const Uw=new De;class Wd{constructor(e,n,r,i){this.tags=e,this.mode=n,this.context=r,this.next=i}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth<this.depth?(this.next=e,this):(e.next=this.sort(e.next),e)}get depth(){return this.context?this.context.length:0}}Wd.empty=new Wd([],2,null);function qw(t,e){let n=Object.create(null);for(let o of t)if(!Array.isArray(o.tag))n[o.tag.id]=o.class;else for(let a of o.tag)n[a.id]=o.class;let{scope:r,all:i=null}=e||{};return{style:o=>{let a=i;for(let s of o)for(let l of s.set){let c=n[l.id];if(c){a=a?a+" "+c:c;break}}return a},scope:r}}function WZ(t,e){let n=null;for(let r of t){let i=r.style(e);i&&(n=n?n+" "+i:i)}return n}function zZ(t,e,n,r=0,i=t.length){let o=new UZ(r,Array.isArray(e)?e:[e],n);o.highlightRange(t.cursor(),r,i,"",o.highlighters),o.flush(i)}class UZ{constructor(e,n,r){this.at=e,this.highlighters=n,this.span=r,this.class=""}startSpan(e,n){n!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=n)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,n,r,i,o){let{type:a,from:s,to:l}=e;if(s>=r||l<=n)return;a.isTop&&(o=this.highlighters.filter(h=>!h.scope||h.scope(a)));let c=i,u=qZ(e)||Wd.empty,f=WZ(o,u.tags);if(f&&(c&&(c+=" "),c+=f,u.mode==1&&(i+=(i?" ":"")+f)),this.startSpan(Math.max(n,s),c),u.opaque)return;let d=e.tree&&e.tree.prop(De.mounted);if(d&&d.overlay){let h=e.node.enter(d.overlay[0].from+s,1),m=this.highlighters.filter(p=>!p.scope||p.scope(d.tree.type)),g=e.firstChild();for(let p=0,v=s;;p++){let _=p<d.overlay.length?d.overlay[p]:null,w=_?_.from+s:l,b=Math.max(n,v),y=Math.min(r,w);if(b<y&&g)for(;e.from<y&&(this.highlightRange(e,b,y,i,o),this.startSpan(Math.min(y,e.to),c),!(e.to>=w||!e.nextSibling())););if(!_||w>r)break;v=_.to+s,v>n&&(this.highlightRange(h.cursor(),Math.max(n,_.from+s),Math.min(r,v),"",m),this.startSpan(Math.min(r,v),c))}g&&e.parent()}else if(e.firstChild()){d&&(i="");do if(!(e.to<=n)){if(e.from>=r)break;this.highlightRange(e,n,r,i,o),this.startSpan(Math.min(r,e.to),c)}while(e.nextSibling());e.parent()}}}function qZ(t){let e=t.type.prop(Uw);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}const ee=Xi.define,zd=ee(),Wo=ee(),Kw=ee(Wo),Qw=ee(Wo),zo=ee(),Ud=ee(zo),Ag=ee(zo),gi=ee(),Ta=ee(gi),vi=ee(),yi=ee(),Dg=ee(),Bc=ee(Dg),qd=ee(),B={comment:zd,lineComment:ee(zd),blockComment:ee(zd),docComment:ee(zd),name:Wo,variableName:ee(Wo),typeName:Kw,tagName:ee(Kw),propertyName:Qw,attributeName:ee(Qw),className:ee(Wo),labelName:ee(Wo),namespace:ee(Wo),macroName:ee(Wo),literal:zo,string:Ud,docString:ee(Ud),character:ee(Ud),attributeValue:ee(Ud),number:Ag,integer:ee(Ag),float:ee(Ag),bool:ee(zo),regexp:ee(zo),escape:ee(zo),color:ee(zo),url:ee(zo),keyword:vi,self:ee(vi),null:ee(vi),atom:ee(vi),unit:ee(vi),modifier:ee(vi),operatorKeyword:ee(vi),controlKeyword:ee(vi),definitionKeyword:ee(vi),moduleKeyword:ee(vi),operator:yi,derefOperator:ee(yi),arithmeticOperator:ee(yi),logicOperator:ee(yi),bitwiseOperator:ee(yi),compareOperator:ee(yi),updateOperator:ee(yi),definitionOperator:ee(yi),typeOperator:ee(yi),controlOperator:ee(yi),punctuation:Dg,separator:ee(Dg),bracket:Bc,angleBracket:ee(Bc),squareBracket:ee(Bc),paren:ee(Bc),brace:ee(Bc),content:gi,heading:Ta,heading1:ee(Ta),heading2:ee(Ta),heading3:ee(Ta),heading4:ee(Ta),heading5:ee(Ta),heading6:ee(Ta),contentSeparator:ee(gi),list:ee(gi),quote:ee(gi),emphasis:ee(gi),strong:ee(gi),link:ee(gi),monospace:ee(gi),strikethrough:ee(gi),inserted:ee(),deleted:ee(),changed:ee(),invalid:ee(),meta:qd,documentMeta:ee(qd),annotation:ee(qd),processingInstruction:ee(qd),definition:Xi.defineModifier("definition"),constant:Xi.defineModifier("constant"),function:Xi.defineModifier("function"),standard:Xi.defineModifier("standard"),local:Xi.defineModifier("local"),special:Xi.defineModifier("special")};for(let t in B){let e=B[t];e instanceof Xi&&(e.name=t)}qw([{tag:B.link,class:"tok-link"},{tag:B.heading,class:"tok-heading"},{tag:B.emphasis,class:"tok-emphasis"},{tag:B.strong,class:"tok-strong"},{tag:B.keyword,class:"tok-keyword"},{tag:B.atom,class:"tok-atom"},{tag:B.bool,class:"tok-bool"},{tag:B.url,class:"tok-url"},{tag:B.labelName,class:"tok-labelName"},{tag:B.inserted,class:"tok-inserted"},{tag:B.deleted,class:"tok-deleted"},{tag:B.literal,class:"tok-literal"},{tag:B.string,class:"tok-string"},{tag:B.number,class:"tok-number"},{tag:[B.regexp,B.escape,B.special(B.string)],class:"tok-string2"},{tag:B.variableName,class:"tok-variableName"},{tag:B.local(B.variableName),class:"tok-variableName tok-local"},{tag:B.definition(B.variableName),class:"tok-variableName tok-definition"},{tag:B.special(B.variableName),class:"tok-variableName2"},{tag:B.definition(B.propertyName),class:"tok-propertyName tok-definition"},{tag:B.typeName,class:"tok-typeName"},{tag:B.namespace,class:"tok-namespace"},{tag:B.className,class:"tok-className"},{tag:B.macroName,class:"tok-macroName"},{tag:B.propertyName,class:"tok-propertyName"},{tag:B.operator,class:"tok-operator"},{tag:B.comment,class:"tok-comment"},{tag:B.meta,class:"tok-meta"},{tag:B.invalid,class:"tok-invalid"},{tag:B.punctuation,class:"tok-punctuation"}]);var Mg;const qs=new De;function KZ(t){return ae.define({combine:t?e=>e.concat(t):void 0})}const QZ=new De;class Fr{constructor(e,n,r=[],i=""){this.data=e,this.name=i,Ne.prototype.hasOwnProperty("tree")||Object.defineProperty(Ne.prototype,"tree",{get(){return Yt(this)}}),this.parser=n,this.extension=[Uo.of(this),Ne.languageData.of((o,a,s)=>{let l=Yw(o,a,s),c=l.type.prop(qs);if(!c)return[];let u=o.facet(c),f=l.type.prop(QZ);if(f){let d=l.resolve(a-l.from,s);for(let h of f)if(h.test(d,o)){let m=o.facet(h.facet);return h.type=="replace"?m:m.concat(u)}}return u})].concat(r)}isActiveAt(e,n,r=-1){return Yw(e,n,r).type.prop(qs)==this.data}findRegions(e){let n=e.facet(Uo);if((n==null?void 0:n.data)==this.data)return[{from:0,to:e.doc.length}];if(!n||!n.allowsNesting)return[];let r=[],i=(o,a)=>{if(o.prop(qs)==this.data){r.push({from:a,to:a+o.length});return}let s=o.prop(De.mounted);if(s){if(s.tree.prop(qs)==this.data){if(s.overlay)for(let l of s.overlay)r.push({from:l.from+a,to:l.to+a});else r.push({from:a,to:a+o.length});return}else if(s.overlay){let l=r.length;if(i(s.tree,s.overlay[0].from+a),r.length>l)return}}for(let l=0;l<o.children.length;l++){let c=o.children[l];c instanceof Nt&&i(c,o.positions[l]+a)}};return i(Yt(e),0),r}get allowsNesting(){return!0}}Fr.setState=Se.define();function Yw(t,e,n){let r=t.facet(Uo),i=Yt(t).topNode;if(!r||r.allowsNesting)for(let o=i;o;o=o.enter(e,n,Qt.ExcludeBuffers))o.type.isTop&&(i=o);return i}class Na extends Fr{constructor(e,n,r){super(e,n,[],r),this.parser=n}static define(e){let n=KZ(e.languageData);return new Na(n,e.parser.configure({props:[qs.add(r=>r.isTop?n:void 0)]}),e.name)}configure(e,n){return new Na(this.data,this.parser.configure(e),n||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function Yt(t){let e=t.field(Fr.state,!1);return e?e.tree:Nt.empty}class YZ{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,n){let r=this.cursorPos-this.string.length;return e<r||n>=this.cursorPos?this.doc.sliceString(e,n):this.string.slice(e-r,n-r)}}let $c=null;class Kd{constructor(e,n,r=[],i,o,a,s,l){this.parser=e,this.state=n,this.fragments=r,this.tree=i,this.treeLen=o,this.viewport=a,this.skipped=s,this.scheduleOn=l,this.parse=null,this.tempSkipped=[]}static create(e,n,r){return new Kd(e,n,[],Nt.empty,0,r,[],null)}startParse(){return this.parser.startParse(new YZ(this.state.doc),this.fragments)}work(e,n){return n!=null&&n>=this.state.doc.length&&(n=void 0),this.tree!=Nt.empty&&this.isDone(n??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var r;if(typeof e=="number"){let i=Date.now()+e;e=()=>Date.now()>i}for(this.parse||(this.parse=this.startParse()),n!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>n)&&n<this.state.doc.length&&this.parse.stopAt(n);;){let i=this.parse.advance();if(i)if(this.fragments=this.withoutTempSkipped(Ma.addTree(i,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=(r=this.parse.stoppedAt)!==null&&r!==void 0?r:this.state.doc.length,this.tree=i,this.parse=null,this.treeLen<(n??this.state.doc.length))this.parse=this.startParse();else return!0;if(e())return!1}})}takeTree(){let e,n;this.parse&&(e=this.parse.parsedPos)>=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(n=this.parse.advance()););}),this.treeLen=e,this.tree=n,this.fragments=this.withoutTempSkipped(Ma.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let n=$c;$c=this;try{return e()}finally{$c=n}}withoutTempSkipped(e){for(let n;n=this.tempSkipped.pop();)e=Xw(e,n.from,n.to);return e}changes(e,n){let{fragments:r,tree:i,treeLen:o,viewport:a,skipped:s}=this;if(this.takeTree(),!e.empty){let l=[];if(e.iterChangedRanges((c,u,f,d)=>l.push({fromA:c,toA:u,fromB:f,toB:d})),r=Ma.applyChanges(r,l),i=Nt.empty,o=0,a={from:e.mapPos(a.from,-1),to:e.mapPos(a.to,1)},this.skipped.length){s=[];for(let c of this.skipped){let u=e.mapPos(c.from,1),f=e.mapPos(c.to,-1);u<f&&s.push({from:u,to:f})}}}return new Kd(this.parser,n,r,i,o,a,s,this.scheduleOn)}updateViewport(e){if(this.viewport.from==e.from&&this.viewport.to==e.to)return!1;this.viewport=e;let n=this.skipped.length;for(let r=0;r<this.skipped.length;r++){let{from:i,to:o}=this.skipped[r];i<e.to&&o>e.from&&(this.fragments=Xw(this.fragments,i,o),this.skipped.splice(r--,1))}return this.skipped.length>=n?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,n){this.skipped.push({from:e,to:n})}static getSkippingParser(e){return new class extends zw{createParse(n,r,i){let o=i[0].from,a=i[i.length-1].to;return{parsedPos:o,advance(){let l=$c;if(l){for(let c of i)l.tempSkipped.push(c);e&&(l.scheduleOn=l.scheduleOn?Promise.all([l.scheduleOn,e]):e)}return this.parsedPos=a,new Nt(Fn.none,[],[],a-o)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let n=this.fragments;return this.treeLen>=e&&n.length&&n[0].from==0&&n[0].to>=e}static get(){return $c}}function Xw(t,e,n){return Ma.applyChanges(t,[{fromA:e,toA:n,fromB:e,toB:n}])}class Ks{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let n=this.context.changes(e.changes,e.state),r=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),n.viewport.to);return n.work(20,r)||n.takeTree(),new Ks(n)}static init(e){let n=Math.min(3e3,e.doc.length),r=Kd.create(e.facet(Uo).parser,e,{from:0,to:n});return r.work(20,n)||r.takeTree(),new Ks(r)}}Fr.state=sn.define({create:Ks.init,update(t,e){for(let n of e.effects)if(n.is(Fr.setState))return n.value;return e.startState.facet(Uo)!=e.state.facet(Uo)?Ks.init(e.state):t.apply(e)}});let Zw=t=>{let e=setTimeout(()=>t(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(Zw=t=>{let e=-1,n=setTimeout(()=>{e=requestIdleCallback(t,{timeout:400})},100);return()=>e<0?clearTimeout(n):cancelIdleCallback(e)});const Tg=typeof navigator<"u"&&(!((Mg=navigator.scheduling)===null||Mg===void 0)&&Mg.isInputPending)?()=>navigator.scheduling.isInputPending():null,XZ=Et.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let n=this.view.state.field(Fr.state).context;(n.updateViewport(e.view.viewport)||this.view.viewport.to>n.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(n)}scheduleWork(){if(this.working)return;let{state:e}=this.view,n=e.field(Fr.state);(n.tree!=n.context.tree||!n.context.isDone(e.doc.length))&&(this.working=Zw(this.work))}work(e){this.working=null;let n=Date.now();if(this.chunkEnd<n&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=n+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:r,viewport:{to:i}}=this.view,o=r.field(Fr.state);if(o.tree==o.context.tree&&o.context.isDone(i+1e5))return;let a=Date.now()+Math.min(this.chunkBudget,100,e&&!Tg?Math.max(25,e.timeRemaining()-5):1e9),s=o.context.treeLen<i&&r.doc.length>i+1e3,l=o.context.work(()=>Tg&&Tg()||Date.now()>a,i+(s?0:1e5));this.chunkBudget-=Date.now()-n,(l||this.chunkBudget<=0)&&(o.context.takeTree(),this.view.dispatch({effects:Fr.setState.of(new Ks(o.context))})),this.chunkBudget>0&&!(l&&!s)&&this.scheduleWork(),this.checkAsyncSchedule(o.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(n=>$n(this.view.state,n)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),Uo=ae.define({combine(t){return t.length?t[0]:null},enables:t=>[Fr.state,XZ,ne.contentAttributes.compute([t],e=>{let n=e.facet(t);return n&&n.name?{"data-language":n.name}:{}})]});class Ng{constructor(e,n=[]){this.language=e,this.support=n,this.extension=[e,n]}}const ZZ=ae.define(),Qd=ae.define({combine:t=>{if(!t.length)return" ";let e=t[0];if(!e||/\S/.test(e)||Array.from(e).some(n=>n!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(t[0]));return e}});function Yd(t){let e=t.facet(Qd);return e.charCodeAt(0)==9?t.tabSize*e.length:e.length}function Fc(t,e){let n="",r=t.tabSize,i=t.facet(Qd)[0];if(i==" "){for(;e>=r;)n+=" ",e-=r;i=" "}for(let o=0;o<e;o++)n+=i;return n}function Ig(t,e){t instanceof Ne&&(t=new Xd(t));for(let r of t.state.facet(ZZ)){let i=r(t,e);if(i!==void 0)return i}let n=Yt(t.state);return n.length>=e?GZ(t,n,e):null}class Xd{constructor(e,n={}){this.state=e,this.options=n,this.unit=Yd(e)}lineAt(e,n=1){let r=this.state.doc.lineAt(e),{simulateBreak:i,simulateDoubleBreak:o}=this.options;return i!=null&&i>=r.from&&i<=r.to?o&&i==e?{text:"",from:e}:(n<0?i<e:i<=e)?{text:r.text.slice(i-r.from),from:i}:{text:r.text.slice(0,i-r.from),from:r.from}:r}textAfterPos(e,n=1){if(this.options.simulateDoubleBreak&&e==this.options.simulateBreak)return"";let{text:r,from:i}=this.lineAt(e,n);return r.slice(e-i,Math.min(r.length,e+100-i))}column(e,n=1){let{text:r,from:i}=this.lineAt(e,n),o=this.countColumn(r,e-i),a=this.options.overrideIndentation?this.options.overrideIndentation(i):-1;return a>-1&&(o+=a-this.countColumn(r,r.search(/\S|$/))),o}countColumn(e,n=e.length){return Rs(e,this.state.tabSize,n)}lineIndent(e,n=1){let{text:r,from:i}=this.lineAt(e,n),o=this.options.overrideIndentation;if(o){let a=o(i);if(a>-1)return a}return this.countColumn(r,r.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const Zd=new De;function GZ(t,e,n){let r=e.resolveStack(n),i=e.resolveInner(n,-1).resolve(n,0).enterUnfinishedNodesBefore(n);if(i!=r.node){let o=[];for(let a=i;a&&!(a.from==r.node.from&&a.type==r.node.type);a=a.parent)o.push(a);for(let a=o.length-1;a>=0;a--)r={node:o[a],next:r}}return Gw(r,t,n)}function Gw(t,e,n){for(let r=t;r;r=r.next){let i=eG(r.node);if(i)return i(Lg.create(e,n,r))}return 0}function JZ(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak}function eG(t){let e=t.type.prop(Zd);if(e)return e;let n=t.firstChild,r;if(n&&(r=n.type.prop(De.closedBy))){let i=t.lastChild,o=i&&r.indexOf(i.name)>-1;return a=>e_(a,!0,1,void 0,o&&!JZ(a)?i.from:void 0)}return t.parent==null?tG:null}function tG(){return 0}class Lg extends Xd{constructor(e,n,r){super(e.state,e.options),this.base=e,this.pos=n,this.context=r}get node(){return this.context.node}static create(e,n,r){return new Lg(e,n,r)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let n=this.state.doc.lineAt(e.from);for(;;){let r=e.resolve(n.from);for(;r.parent&&r.parent.from==r.from;)r=r.parent;if(nG(r,e))break;n=this.state.doc.lineAt(r.from)}return this.lineIndent(n.from)}continue(){return Gw(this.context.next,this.base,this.pos)}}function nG(t,e){for(let n=e;n;n=n.parent)if(t==n)return!0;return!1}function rG(t){let e=t.node,n=e.childAfter(e.from),r=e.lastChild;if(!n)return null;let i=t.options.simulateBreak,o=t.state.doc.lineAt(n.from),a=i==null||i<=o.from?o.to:Math.min(o.to,i);for(let s=n.to;;){let l=e.childAfter(s);if(!l||l==r)return null;if(!l.type.isSkipped){if(l.from>=a)return null;let c=/^ */.exec(o.text.slice(n.to-o.from))[0].length;return{from:n.from,to:n.to+c}}s=l.to}}function Jw({closing:t,align:e=!0,units:n=1}){return r=>e_(r,e,n,t)}function e_(t,e,n,r,i){let o=t.textAfter,a=o.match(/^\s*/)[0].length,s=r&&o.slice(a,a+r.length)==r||i==t.pos+a,l=e?rG(t):null;return l?s?t.column(l.from):t.column(l.to):t.baseIndent+(s?0:t.unit*n)}function jg({except:t,units:e=1}={}){return n=>{let r=t&&t.test(n.textAfter);return n.baseIndent+(r?0:e*n.unit)}}const iG=200;function oG(){return Ne.transactionFilter.of(t=>{if(!t.docChanged||!t.isUserEvent("input.type")&&!t.isUserEvent("input.complete"))return t;let e=t.startState.languageDataAt("indentOnInput",t.startState.selection.main.head);if(!e.length)return t;let n=t.newDoc,{head:r}=t.newSelection.main,i=n.lineAt(r);if(r>i.from+iG)return t;let o=n.sliceString(i.from,r);if(!e.some(c=>c.test(o)))return t;let{state:a}=t,s=-1,l=[];for(let{head:c}of a.selection.ranges){let u=a.doc.lineAt(c);if(u.from==s)continue;s=u.from;let f=Ig(a,u.from);if(f==null)continue;let d=/^\s*/.exec(u.text)[0],h=Fc(a,f);d!=h&&l.push({from:u.from,to:u.from+d.length,insert:h})}return l.length?[t,{changes:l,sequential:!0}]:t})}const aG=ae.define(),Gd=new De;function t_(t){let e=t.firstChild,n=t.lastChild;return e&&e.to<n.from?{from:e.to,to:n.type.isError?t.to:n.from}:null}function sG(t,e,n){let r=Yt(t);if(r.length<n)return null;let i=r.resolveStack(n,1),o=null;for(let a=i;a;a=a.next){let s=a.node;if(s.to<=n||s.from>n)continue;if(o&&s.from<e)break;let l=s.type.prop(Gd);if(l&&(s.to<r.length-50||r.length==t.doc.length||!lG(s))){let c=l(s,t);c&&c.from<=n&&c.from>=e&&c.to>n&&(o=c)}}return o}function lG(t){let e=t.lastChild;return e&&e.to==t.to&&e.type.isError}function Jd(t,e,n){for(let r of t.facet(aG)){let i=r(t,e,n);if(i)return i}return sG(t,e,n)}function n_(t,e){let n=e.mapPos(t.from,1),r=e.mapPos(t.to,-1);return n>=r?void 0:{from:n,to:r}}const eh=Se.define({map:n_}),Hc=Se.define({map:n_});function r_(t){let e=[];for(let{head:n}of t.state.selection.ranges)e.some(r=>r.from<=n&&r.to>=n)||e.push(t.lineBlockAt(n));return e}const Ia=sn.define({create(){return ge.none},update(t,e){t=t.map(e.changes);for(let n of e.effects)if(n.is(eh)&&!cG(t,n.value.from,n.value.to)){let{preparePlaceholder:r}=e.state.facet(a_),i=r?ge.replace({widget:new pG(r(e.state,n.value))}):c_;t=t.update({add:[i.range(n.value.from,n.value.to)]})}else n.is(Hc)&&(t=t.update({filter:(r,i)=>n.value.from!=r||n.value.to!=i,filterFrom:n.value.from,filterTo:n.value.to}));if(e.selection){let n=!1,{head:r}=e.selection.main;t.between(r,r,(i,o)=>{i<r&&o>r&&(n=!0)}),n&&(t=t.update({filterFrom:r,filterTo:r,filter:(i,o)=>o<=r||i>=r}))}return t},provide:t=>ne.decorations.from(t),toJSON(t,e){let n=[];return t.between(0,e.doc.length,(r,i)=>{n.push(r,i)}),n},fromJSON(t){if(!Array.isArray(t)||t.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let n=0;n<t.length;){let r=t[n++],i=t[n++];if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid JSON for fold state");e.push(c_.range(r,i))}return ge.set(e,!0)}});function th(t,e,n){var r;let i=null;return(r=t.field(Ia,!1))===null||r===void 0||r.between(e,n,(o,a)=>{(!i||i.from>o)&&(i={from:o,to:a})}),i}function cG(t,e,n){let r=!1;return t.between(e,e,(i,o)=>{i==e&&o==n&&(r=!0)}),r}function i_(t,e){return t.field(Ia,!1)?e:e.concat(Se.appendConfig.of(s_()))}const uG=t=>{for(let e of r_(t)){let n=Jd(t.state,e.from,e.to);if(n)return t.dispatch({effects:i_(t.state,[eh.of(n),o_(t,n)])}),!0}return!1},fG=t=>{if(!t.state.field(Ia,!1))return!1;let e=[];for(let n of r_(t)){let r=th(t.state,n.from,n.to);r&&e.push(Hc.of(r),o_(t,r,!1))}return e.length&&t.dispatch({effects:e}),e.length>0};function o_(t,e,n=!0){let r=t.state.doc.lineAt(e.from).number,i=t.state.doc.lineAt(e.to).number;return ne.announce.of(`${t.state.phrase(n?"Folded lines":"Unfolded lines")} ${r} ${t.state.phrase("to")} ${i}.`)}const dG=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:uG},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:fG},{key:"Ctrl-Alt-[",run:t=>{let{state:e}=t,n=[];for(let r=0;r<e.doc.length;){let i=t.lineBlockAt(r),o=Jd(e,i.from,i.to);o&&n.push(eh.of(o)),r=(o?t.lineBlockAt(o.to):i).to+1}return n.length&&t.dispatch({effects:i_(t.state,n)}),!!n.length}},{key:"Ctrl-Alt-]",run:t=>{let e=t.state.field(Ia,!1);if(!e||!e.size)return!1;let n=[];return e.between(0,t.state.doc.length,(r,i)=>{n.push(Hc.of({from:r,to:i}))}),t.dispatch({effects:n}),!0}}],hG={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},a_=ae.define({combine(t){return di(t,hG)}});function s_(t){return[Ia,vG]}function l_(t,e){let{state:n}=t,r=n.facet(a_),i=a=>{let s=t.lineBlockAt(t.posAtDOM(a.target)),l=th(t.state,s.from,s.to);l&&t.dispatch({effects:Hc.of(l)}),a.preventDefault()};if(r.placeholderDOM)return r.placeholderDOM(t,i,e);let o=document.createElement("span");return o.textContent=r.placeholderText,o.setAttribute("aria-label",n.phrase("folded code")),o.title=n.phrase("unfold"),o.className="cm-foldPlaceholder",o.onclick=i,o}const c_=ge.replace({widget:new class extends qi{toDOM(t){return l_(t,null)}}});class pG extends qi{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return l_(e,this.value)}}const mG={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class Rg extends Yi{constructor(e,n){super(),this.config=e,this.open=n}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let n=document.createElement("span");return n.textContent=this.open?this.config.openText:this.config.closedText,n.title=e.state.phrase(this.open?"Fold line":"Unfold line"),n}}function gG(t={}){let e=Object.assign(Object.assign({},mG),t),n=new Rg(e,!0),r=new Rg(e,!1),i=Et.fromClass(class{constructor(a){this.from=a.viewport.from,this.markers=this.buildMarkers(a)}update(a){(a.docChanged||a.viewportChanged||a.startState.facet(Uo)!=a.state.facet(Uo)||a.startState.field(Ia,!1)!=a.state.field(Ia,!1)||Yt(a.startState)!=Yt(a.state)||e.foldingChanged(a))&&(this.markers=this.buildMarkers(a.view))}buildMarkers(a){let s=new zi;for(let l of a.viewportLineBlocks){let c=th(a.state,l.from,l.to)?r:Jd(a.state,l.from,l.to)?n:null;c&&s.add(l.from,l.from,c)}return s.finish()}}),{domEventHandlers:o}=e;return[i,_Z({class:"cm-foldGutter",markers(a){var s;return((s=a.plugin(i))===null||s===void 0?void 0:s.markers)||Be.empty},initialSpacer(){return new Rg(e,!1)},domEventHandlers:Object.assign(Object.assign({},o),{click:(a,s,l)=>{if(o.click&&o.click(a,s,l))return!0;let c=th(a.state,s.from,s.to);if(c)return a.dispatch({effects:Hc.of(c)}),!0;let u=Jd(a.state,s.from,s.to);return u?(a.dispatch({effects:eh.of(u)}),!0):!1}})}),s_()]}const vG=ne.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class Vc{constructor(e,n){this.specs=e;let r;function i(s){let l=Lo.newName();return(r||(r=Object.create(null)))["."+l]=s,l}const o=typeof n.all=="string"?n.all:n.all?i(n.all):void 0,a=n.scope;this.scope=a instanceof Fr?s=>s.prop(qs)==a.data:a?s=>s==a:void 0,this.style=qw(e.map(s=>({tag:s.tag,class:s.class||i(Object.assign({},s,{tag:null}))})),{all:o}).style,this.module=r?new Lo(r):null,this.themeType=n.themeType}static define(e,n){return new Vc(e,n||{})}}const Bg=ae.define(),u_=ae.define({combine(t){return t.length?[t[0]]:null}});function $g(t){let e=t.facet(Bg);return e.length?e:t.facet(u_)}function f_(t,e){let n=[bG],r;return t instanceof Vc&&(t.module&&n.push(ne.styleModule.of(t.module)),r=t.themeType),e!=null&&e.fallback?n.push(u_.of(t)):r?n.push(Bg.computeN([ne.darkTheme],i=>i.facet(ne.darkTheme)==(r=="dark")?[t]:[])):n.push(Bg.of(t)),n}class yG{constructor(e){this.markCache=Object.create(null),this.tree=Yt(e.state),this.decorations=this.buildDeco(e,$g(e.state)),this.decoratedTo=e.viewport.to}update(e){let n=Yt(e.state),r=$g(e.state),i=r!=$g(e.startState),{viewport:o}=e.view,a=e.changes.mapPos(this.decoratedTo,1);n.length<o.to&&!i&&n.type==this.tree.type&&a>=o.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=a):(n!=this.tree||e.viewportChanged||i)&&(this.tree=n,this.decorations=this.buildDeco(e.view,r),this.decoratedTo=o.to)}buildDeco(e,n){if(!n||!this.tree.length)return ge.none;let r=new zi;for(let{from:i,to:o}of e.visibleRanges)zZ(this.tree,n,(a,s,l)=>{r.add(a,s,this.markCache[l]||(this.markCache[l]=ge.mark({class:l})))},i,o);return r.finish()}}const bG=Oa.high(Et.fromClass(yG,{decorations:t=>t.decorations})),wG=Vc.define([{tag:B.meta,color:"#404740"},{tag:B.link,textDecoration:"underline"},{tag:B.heading,textDecoration:"underline",fontWeight:"bold"},{tag:B.emphasis,fontStyle:"italic"},{tag:B.strong,fontWeight:"bold"},{tag:B.strikethrough,textDecoration:"line-through"},{tag:B.keyword,color:"#708"},{tag:[B.atom,B.bool,B.url,B.contentSeparator,B.labelName],color:"#219"},{tag:[B.literal,B.inserted],color:"#164"},{tag:[B.string,B.deleted],color:"#a11"},{tag:[B.regexp,B.escape,B.special(B.string)],color:"#e40"},{tag:B.definition(B.variableName),color:"#00f"},{tag:B.local(B.variableName),color:"#30a"},{tag:[B.typeName,B.namespace],color:"#085"},{tag:B.className,color:"#167"},{tag:[B.special(B.variableName),B.macroName],color:"#256"},{tag:B.definition(B.propertyName),color:"#00c"},{tag:B.comment,color:"#940"},{tag:B.invalid,color:"#f00"}]),_G=ne.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),d_=1e4,h_="()[]{}",p_=ae.define({combine(t){return di(t,{afterCursor:!0,brackets:h_,maxScanDistance:d_,renderMatch:kG})}}),xG=ge.mark({class:"cm-matchingBracket"}),CG=ge.mark({class:"cm-nonmatchingBracket"});function kG(t){let e=[],n=t.matched?xG:CG;return e.push(n.range(t.start.from,t.start.to)),t.end&&e.push(n.range(t.end.from,t.end.to)),e}const SG=[sn.define({create(){return ge.none},update(t,e){if(!e.docChanged&&!e.selection)return t;let n=[],r=e.state.facet(p_);for(let i of e.state.selection.ranges){if(!i.empty)continue;let o=bi(e.state,i.head,-1,r)||i.head>0&&bi(e.state,i.head-1,1,r)||r.afterCursor&&(bi(e.state,i.head,1,r)||i.head<e.state.doc.length&&bi(e.state,i.head+1,-1,r));o&&(n=n.concat(r.renderMatch(o,e.state)))}return ge.set(n,!0)},provide:t=>ne.decorations.from(t)}),_G];function OG(t={}){return[p_.of(t),SG]}const PG=new De;function Fg(t,e,n){let r=t.prop(e<0?De.openedBy:De.closedBy);if(r)return r;if(t.name.length==1){let i=n.indexOf(t.name);if(i>-1&&i%2==(e<0?1:0))return[n[i+e]]}return null}function Hg(t){let e=t.type.prop(PG);return e?e(t.node):t}function bi(t,e,n,r={}){let i=r.maxScanDistance||d_,o=r.brackets||h_,a=Yt(t),s=a.resolveInner(e,n);for(let l=s;l;l=l.parent){let c=Fg(l.type,n,o);if(c&&l.from<l.to){let u=Hg(l);if(u&&(n>0?e>=u.from&&e<u.to:e>u.from&&e<=u.to))return EG(t,e,n,l,u,c,o)}}return AG(t,e,n,a,s.type,i,o)}function EG(t,e,n,r,i,o,a){let s=r.parent,l={from:i.from,to:i.to},c=0,u=s==null?void 0:s.cursor();if(u&&(n<0?u.childBefore(r.from):u.childAfter(r.to)))do if(n<0?u.to<=r.from:u.from>=r.to){if(c==0&&o.indexOf(u.type.name)>-1&&u.from<u.to){let f=Hg(u);return{start:l,end:f?{from:f.from,to:f.to}:void 0,matched:!0}}else if(Fg(u.type,n,a))c++;else if(Fg(u.type,-n,a)){if(c==0){let f=Hg(u);return{start:l,end:f&&f.from<f.to?{from:f.from,to:f.to}:void 0,matched:!1}}c--}}while(n<0?u.prevSibling():u.nextSibling());return{start:l,matched:!1}}function AG(t,e,n,r,i,o,a){let s=n<0?t.sliceDoc(e-1,e):t.sliceDoc(e,e+1),l=a.indexOf(s);if(l<0||l%2==0!=n>0)return null;let c={from:n<0?e-1:e,to:n>0?e+1:e},u=t.doc.iterRange(e,n>0?t.doc.length:0),f=0;for(let d=0;!u.next().done&&d<=o;){let h=u.value;n<0&&(d+=h.length);let m=e+d*n;for(let g=n>0?0:h.length-1,p=n>0?h.length:-1;g!=p;g+=n){let v=a.indexOf(h[g]);if(!(v<0||r.resolveInner(m+g,1).type!=i))if(v%2==0==n>0)f++;else{if(f==1)return{start:c,end:{from:m+g,to:m+g+1},matched:v>>1==l>>1};f--}}n>0&&(d+=h.length)}return u.done?{start:c,matched:!1}:null}const DG=Object.create(null),m_=[Fn.none],g_=[],v_=Object.create(null),MG=Object.create(null);for(let[t,e]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])MG[t]=TG(DG,e);function Vg(t,e){g_.indexOf(t)>-1||(g_.push(t),console.warn(e))}function TG(t,e){let n=[];for(let s of e.split(" ")){let l=[];for(let c of s.split(".")){let u=t[c]||B[c];u?typeof u=="function"?l.length?l=l.map(u):Vg(c,`Modifier ${c} used at start of tag`):l.length?Vg(c,`Tag ${c} used as modifier`):l=Array.isArray(u)?u:[u]:Vg(c,`Unknown highlighting tag ${c}`)}for(let c of l)n.push(c)}if(!n.length)return 0;let r=e.replace(/ /g,"_"),i=r+" "+n.map(s=>s.id),o=v_[i];if(o)return o.id;let a=v_[i]=Fn.define({id:m_.length,name:r,props:[Rc({[r]:n})]});return m_.push(a),a.id}ct.RTL,ct.LTR;const NG=t=>{let{state:e}=t,n=e.doc.lineAt(e.selection.main.from),r=zg(t.state,n.from);return r.line?IG(t):r.block?jG(t):!1};function Wg(t,e){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let i=t(e,n);return i?(r(n.update(i)),!0):!1}}const IG=Wg($G,0),LG=Wg(y_,0),jG=Wg((t,e)=>y_(t,e,BG(e)),0);function zg(t,e){let n=t.languageDataAt("commentTokens",e,1);return n.length?n[0]:{}}const Wc=50;function RG(t,{open:e,close:n},r,i){let o=t.sliceDoc(r-Wc,r),a=t.sliceDoc(i,i+Wc),s=/\s*$/.exec(o)[0].length,l=/^\s*/.exec(a)[0].length,c=o.length-s;if(o.slice(c-e.length,c)==e&&a.slice(l,l+n.length)==n)return{open:{pos:r-s,margin:s&&1},close:{pos:i+l,margin:l&&1}};let u,f;i-r<=2*Wc?u=f=t.sliceDoc(r,i):(u=t.sliceDoc(r,r+Wc),f=t.sliceDoc(i-Wc,i));let d=/^\s*/.exec(u)[0].length,h=/\s*$/.exec(f)[0].length,m=f.length-h-n.length;return u.slice(d,d+e.length)==e&&f.slice(m,m+n.length)==n?{open:{pos:r+d+e.length,margin:/\s/.test(u.charAt(d+e.length))?1:0},close:{pos:i-h-n.length,margin:/\s/.test(f.charAt(m-1))?1:0}}:null}function BG(t){let e=[];for(let n of t.selection.ranges){let r=t.doc.lineAt(n.from),i=n.to<=r.to?r:t.doc.lineAt(n.to);i.from>r.from&&i.from==n.to&&(i=n.to==r.to+1?r:t.doc.lineAt(n.to-1));let o=e.length-1;o>=0&&e[o].to>r.from?e[o].to=i.to:e.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:i.to})}return e}function y_(t,e,n=e.selection.ranges){let r=n.map(o=>zg(e,o.from).block);if(!r.every(o=>o))return null;let i=n.map((o,a)=>RG(e,r[a],o.from,o.to));if(t!=2&&!i.every(o=>o))return{changes:e.changes(n.map((o,a)=>i[a]?[]:[{from:o.from,insert:r[a].open+" "},{from:o.to,insert:" "+r[a].close}]))};if(t!=1&&i.some(o=>o)){let o=[];for(let a=0,s;a<i.length;a++)if(s=i[a]){let l=r[a],{open:c,close:u}=s;o.push({from:c.pos-l.open.length,to:c.pos+c.margin},{from:u.pos-u.margin,to:u.pos+l.close.length})}return{changes:o}}return null}function $G(t,e,n=e.selection.ranges){let r=[],i=-1;for(let{from:o,to:a}of n){let s=r.length,l=1e9,c=zg(e,o).line;if(c){for(let u=o;u<=a;){let f=e.doc.lineAt(u);if(f.from>i&&(o==a||a>f.from)){i=f.from;let d=/^\s*/.exec(f.text)[0].length,h=d==f.length,m=f.text.slice(d,d+c.length)==c?d:-1;d<f.text.length&&d<l&&(l=d),r.push({line:f,comment:m,token:c,indent:d,empty:h,single:!1})}u=f.to+1}if(l<1e9)for(let u=s;u<r.length;u++)r[u].indent<r[u].line.text.length&&(r[u].indent=l);r.length==s+1&&(r[s].single=!0)}}if(t!=2&&r.some(o=>o.comment<0&&(!o.empty||o.single))){let o=[];for(let{line:s,token:l,indent:c,empty:u,single:f}of r)(f||!u)&&o.push({from:s.from+c,insert:l+" "});let a=e.changes(o);return{changes:a,selection:e.selection.map(a,1)}}else if(t!=1&&r.some(o=>o.comment>=0)){let o=[];for(let{line:a,comment:s,token:l}of r)if(s>=0){let c=a.from+s,u=c+l.length;a.text[u-a.from]==" "&&u++,o.push({from:c,to:u})}return{changes:o}}return null}const Ug=fi.define(),FG=fi.define(),HG=ae.define(),b_=ae.define({combine(t){return di(t,{minDepth:100,newGroupDelay:500,joinToEvent:(e,n)=>n},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,n)=>(r,i)=>e(r,i)||n(r,i)})}}),w_=sn.define({create(){return wi.empty},update(t,e){let n=e.state.facet(b_),r=e.annotation(Ug);if(r){let l=Hn.fromTransaction(e,r.selection),c=r.side,u=c==0?t.undone:t.done;return l?u=rh(u,u.length,n.minDepth,l):u=C_(u,e.startState.selection),new wi(c==0?r.rest:u,c==0?u:r.rest)}let i=e.annotation(FG);if((i=="full"||i=="before")&&(t=t.isolate()),e.annotation(Ft.addToHistory)===!1)return e.changes.empty?t:t.addMapping(e.changes.desc);let o=Hn.fromTransaction(e),a=e.annotation(Ft.time),s=e.annotation(Ft.userEvent);return o?t=t.addChanges(o,a,s,n,e):e.selection&&(t=t.addSelection(e.startState.selection,a,s,n.newGroupDelay)),(i=="full"||i=="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 wi(t.done.map(Hn.fromJSON),t.undone.map(Hn.fromJSON))}});function VG(t={}){return[w_,b_.of(t),ne.domEventHandlers({beforeinput(e,n){let r=e.inputType=="historyUndo"?__:e.inputType=="historyRedo"?qg:null;return r?(e.preventDefault(),r(n)):!1}})]}function nh(t,e){return function({state:n,dispatch:r}){if(!e&&n.readOnly)return!1;let i=n.field(w_,!1);if(!i)return!1;let o=i.pop(t,n,e);return o?(r(o),!0):!1}}const __=nh(0,!1),qg=nh(1,!1),WG=nh(0,!0),zG=nh(1,!0);class Hn{constructor(e,n,r,i,o){this.changes=e,this.effects=n,this.mapped=r,this.startSelection=i,this.selectionsAfter=o}setSelAfter(e){return new Hn(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,n,r;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(n=this.mapped)===null||n===void 0?void 0:n.toJSON(),startSelection:(r=this.startSelection)===null||r===void 0?void 0:r.toJSON(),selectionsAfter:this.selectionsAfter.map(i=>i.toJSON())}}static fromJSON(e){return new Hn(e.changes&&$t.fromJSON(e.changes),[],e.mapped&&ui.fromJSON(e.mapped),e.startSelection&&Q.fromJSON(e.startSelection),e.selectionsAfter.map(Q.fromJSON))}static fromTransaction(e,n){let r=_r;for(let i of e.startState.facet(HG)){let o=i(e);o.length&&(r=r.concat(o))}return!r.length&&e.changes.empty?null:new Hn(e.changes.invert(e.startState.doc),r,void 0,n||e.startState.selection,_r)}static selection(e){return new Hn(void 0,_r,void 0,void 0,e)}}function rh(t,e,n,r){let i=e+1>n+20?e-n-1:0,o=t.slice(i,e);return o.push(r),o}function UG(t,e){let n=[],r=!1;return t.iterChangedRanges((i,o)=>n.push(i,o)),e.iterChangedRanges((i,o,a,s)=>{for(let l=0;l<n.length;){let c=n[l++],u=n[l++];s>=c&&a<=u&&(r=!0)}}),r}function qG(t,e){return t.ranges.length==e.ranges.length&&t.ranges.filter((n,r)=>n.empty!=e.ranges[r].empty).length===0}function x_(t,e){return t.length?e.length?t.concat(e):t:e}const _r=[],KG=200;function C_(t,e){if(t.length){let n=t[t.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-KG));return r.length&&r[r.length-1].eq(e)?t:(r.push(e),rh(t,t.length-1,1e9,n.setSelAfter(r)))}else return[Hn.selection([e])]}function QG(t){let e=t[t.length-1],n=t.slice();return n[t.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),n}function Kg(t,e){if(!t.length)return t;let n=t.length,r=_r;for(;n;){let i=YG(t[n-1],e,r);if(i.changes&&!i.changes.empty||i.effects.length){let o=t.slice(0,n);return o[n-1]=i,o}else e=i.mapped,n--,r=i.selectionsAfter}return r.length?[Hn.selection(r)]:_r}function YG(t,e,n){let r=x_(t.selectionsAfter.length?t.selectionsAfter.map(s=>s.map(e)):_r,n);if(!t.changes)return Hn.selection(r);let i=t.changes.map(e),o=e.mapDesc(t.changes,!0),a=t.mapped?t.mapped.composeDesc(o):o;return new Hn(i,Se.mapEffects(t.effects,e),a,t.startSelection.map(o),r)}const XG=/^(input\.type|delete)($|\.)/;class wi{constructor(e,n,r=0,i=void 0){this.done=e,this.undone=n,this.prevTime=r,this.prevUserEvent=i}isolate(){return this.prevTime?new wi(this.done,this.undone):this}addChanges(e,n,r,i,o){let a=this.done,s=a[a.length-1];return s&&s.changes&&!s.changes.empty&&e.changes&&(!r||XG.test(r))&&(!s.selectionsAfter.length&&n-this.prevTime<i.newGroupDelay&&i.joinToEvent(o,UG(s.changes,e.changes))||r=="input.type.compose")?a=rh(a,a.length-1,i.minDepth,new Hn(e.changes.compose(s.changes),x_(Se.mapEffects(e.effects,s.changes),s.effects),s.mapped,s.startSelection,_r)):a=rh(a,a.length,i.minDepth,e),new wi(a,_r,n,r)}addSelection(e,n,r,i){let o=this.done.length?this.done[this.done.length-1].selectionsAfter:_r;return o.length>0&&n-this.prevTime<i&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&qG(o[o.length-1],e)?this:new wi(C_(this.done,e),this.undone,n,r)}addMapping(e){return new wi(Kg(this.done,e),Kg(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,n,r){let i=e==0?this.done:this.undone;if(i.length==0)return null;let o=i[i.length-1],a=o.selectionsAfter[0]||n.selection;if(r&&o.selectionsAfter.length)return n.update({selection:o.selectionsAfter[o.selectionsAfter.length-1],annotations:Ug.of({side:e,rest:QG(i),selection:a}),userEvent:e==0?"select.undo":"select.redo",scrollIntoView:!0});if(o.changes){let s=i.length==1?_r:i.slice(0,i.length-1);return o.mapped&&(s=Kg(s,o.mapped)),n.update({changes:o.changes,selection:o.startSelection,effects:o.effects,annotations:Ug.of({side:e,rest:s,selection:a}),filter:!1,userEvent:e==0?"undo":"redo",scrollIntoView:!0})}else return null}}wi.empty=new wi(_r,_r);const ZG=[{key:"Mod-z",run:__,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:qg,preventDefault:!0},{linux:"Ctrl-Shift-z",run:qg,preventDefault:!0},{key:"Mod-u",run:WG,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:zG,preventDefault:!0}];function Qs(t,e){return Q.create(t.ranges.map(e),t.mainIndex)}function _i(t,e){return t.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function Hr({state:t,dispatch:e},n){let r=Qs(t.selection,n);return r.eq(t.selection,!0)?!1:(e(_i(t,r)),!0)}function ih(t,e){return Q.cursor(e?t.to:t.from)}function k_(t,e){return Hr(t,n=>n.empty?t.moveByChar(n,e):ih(n,e))}function wn(t){return t.textDirectionAt(t.state.selection.main.head)==ct.LTR}const S_=t=>k_(t,!wn(t)),O_=t=>k_(t,wn(t));function P_(t,e){return Hr(t,n=>n.empty?t.moveByGroup(n,e):ih(n,e))}const GG=t=>P_(t,!wn(t)),JG=t=>P_(t,wn(t));function eJ(t,e,n){if(e.type.prop(n))return!0;let r=e.to-e.from;return r&&(r>2||/[^\s,.;:]/.test(t.sliceDoc(e.from,e.to)))||e.firstChild}function oh(t,e,n){let r=Yt(t).resolveInner(e.head),i=n?De.closedBy:De.openedBy;for(let l=e.head;;){let c=n?r.childAfter(l):r.childBefore(l);if(!c)break;eJ(t,c,i)?r=c:l=n?c.to:c.from}let o=r.type.prop(i),a,s;return o&&(a=n?bi(t,r.from,1):bi(t,r.to,-1))&&a.matched?s=n?a.end.to:a.end.from:s=n?r.to:r.from,Q.cursor(s,n?-1:1)}const tJ=t=>Hr(t,e=>oh(t.state,e,!wn(t))),nJ=t=>Hr(t,e=>oh(t.state,e,wn(t)));function E_(t,e){return Hr(t,n=>{if(!n.empty)return ih(n,e);let r=t.moveVertically(n,e);return r.head!=n.head?r:t.moveToLineBoundary(n,e)})}const A_=t=>E_(t,!1),D_=t=>E_(t,!0);function M_(t){let e=t.scrollDOM.clientHeight<t.scrollDOM.scrollHeight-2,n=0,r=0,i;if(e){for(let o of t.state.facet(ne.scrollMargins)){let a=o(t);a!=null&&a.top&&(n=Math.max(a==null?void 0:a.top,n)),a!=null&&a.bottom&&(r=Math.max(a==null?void 0:a.bottom,r))}i=t.scrollDOM.clientHeight-n-r}else i=(t.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:n,marginBottom:r,selfScroll:e,height:Math.max(t.defaultLineHeight,i-5)}}function T_(t,e){let n=M_(t),{state:r}=t,i=Qs(r.selection,a=>a.empty?t.moveVertically(a,e,n.height):ih(a,e));if(i.eq(r.selection))return!1;let o;if(n.selfScroll){let a=t.coordsAtPos(r.selection.main.head),s=t.scrollDOM.getBoundingClientRect(),l=s.top+n.marginTop,c=s.bottom-n.marginBottom;a&&a.top>l&&a.bottom<c&&(o=ne.scrollIntoView(i.main.head,{y:"start",yMargin:a.top-l}))}return t.dispatch(_i(r,i),{effects:o}),!0}const N_=t=>T_(t,!1),Qg=t=>T_(t,!0);function qo(t,e,n){let r=t.lineBlockAt(e.head),i=t.moveToLineBoundary(e,n);if(i.head==e.head&&i.head!=(n?r.to:r.from)&&(i=t.moveToLineBoundary(e,n,!1)),!n&&i.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&&(i=Q.cursor(r.from+o))}return i}const rJ=t=>Hr(t,e=>qo(t,e,!0)),iJ=t=>Hr(t,e=>qo(t,e,!1)),oJ=t=>Hr(t,e=>qo(t,e,!wn(t))),aJ=t=>Hr(t,e=>qo(t,e,wn(t))),sJ=t=>Hr(t,e=>Q.cursor(t.lineBlockAt(e.head).from,1)),lJ=t=>Hr(t,e=>Q.cursor(t.lineBlockAt(e.head).to,-1));function cJ(t,e,n){let r=!1,i=Qs(t.selection,o=>{let a=bi(t,o.head,-1)||bi(t,o.head,1)||o.head>0&&bi(t,o.head-1,1)||o.head<t.doc.length&&bi(t,o.head+1,-1);if(!a||!a.end)return o;r=!0;let s=a.start.from==o.head?a.end.to:a.end.from;return Q.cursor(s)});return r?(e(_i(t,i)),!0):!1}const uJ=({state:t,dispatch:e})=>cJ(t,e);function xr(t,e){let n=Qs(t.state.selection,r=>{let i=e(r);return Q.range(r.anchor,i.head,i.goalColumn,i.bidiLevel||void 0)});return n.eq(t.state.selection)?!1:(t.dispatch(_i(t.state,n)),!0)}function I_(t,e){return xr(t,n=>t.moveByChar(n,e))}const L_=t=>I_(t,!wn(t)),j_=t=>I_(t,wn(t));function R_(t,e){return xr(t,n=>t.moveByGroup(n,e))}const fJ=t=>R_(t,!wn(t)),dJ=t=>R_(t,wn(t)),hJ=t=>xr(t,e=>oh(t.state,e,!wn(t))),pJ=t=>xr(t,e=>oh(t.state,e,wn(t)));function B_(t,e){return xr(t,n=>t.moveVertically(n,e))}const $_=t=>B_(t,!1),F_=t=>B_(t,!0);function H_(t,e){return xr(t,n=>t.moveVertically(n,e,M_(t).height))}const V_=t=>H_(t,!1),W_=t=>H_(t,!0),mJ=t=>xr(t,e=>qo(t,e,!0)),gJ=t=>xr(t,e=>qo(t,e,!1)),vJ=t=>xr(t,e=>qo(t,e,!wn(t))),yJ=t=>xr(t,e=>qo(t,e,wn(t))),bJ=t=>xr(t,e=>Q.cursor(t.lineBlockAt(e.head).from)),wJ=t=>xr(t,e=>Q.cursor(t.lineBlockAt(e.head).to)),z_=({state:t,dispatch:e})=>(e(_i(t,{anchor:0})),!0),U_=({state:t,dispatch:e})=>(e(_i(t,{anchor:t.doc.length})),!0),q_=({state:t,dispatch:e})=>(e(_i(t,{anchor:t.selection.main.anchor,head:0})),!0),K_=({state:t,dispatch:e})=>(e(_i(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0),_J=({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0),xJ=({state:t,dispatch:e})=>{let n=sh(t).map(({from:r,to:i})=>Q.range(r,Math.min(i+1,t.doc.length)));return e(t.update({selection:Q.create(n),userEvent:"select"})),!0},CJ=({state:t,dispatch:e})=>{let n=Qs(t.selection,r=>{let i=Yt(t),o=i.resolveStack(r.from,1);if(r.empty){let a=i.resolveStack(r.from,-1);a.node.from>=o.node.from&&a.node.to<=o.node.to&&(o=a)}for(let a=o;a;a=a.next){let{node:s}=a;if((s.from<r.from&&s.to>=r.to||s.to>r.to&&s.from<=r.from)&&a.next)return Q.range(s.to,s.from)}return r});return n.eq(t.selection)?!1:(e(_i(t,n)),!0)},kJ=({state:t,dispatch:e})=>{let n=t.selection,r=null;return n.ranges.length>1?r=Q.create([n.main]):n.main.empty||(r=Q.create([Q.cursor(n.main.head)])),r?(e(_i(t,r)),!0):!1};function zc(t,e){if(t.state.readOnly)return!1;let n="delete.selection",{state:r}=t,i=r.changeByRange(o=>{let{from:a,to:s}=o;if(a==s){let l=e(o);l<a?(n="delete.backward",l=ah(t,l,!1)):l>a&&(n="delete.forward",l=ah(t,l,!0)),a=Math.min(a,l),s=Math.max(s,l)}else a=ah(t,a,!1),s=ah(t,s,!0);return a==s?{range:o}:{changes:{from:a,to:s},range:Q.cursor(a,a<o.head?-1:1)}});return i.changes.empty?!1:(t.dispatch(r.update(i,{scrollIntoView:!0,userEvent:n,effects:n=="delete.selection"?ne.announce.of(r.phrase("Selection deleted")):void 0})),!0)}function ah(t,e,n){if(t instanceof ne)for(let r of t.state.facet(ne.atomicRanges).map(i=>i(t)))r.between(e,e,(i,o)=>{i<e&&o>e&&(e=n?o:i)});return e}const Q_=(t,e,n)=>zc(t,r=>{let i=r.from,{state:o}=t,a=o.doc.lineAt(i),s,l;if(n&&!e&&i>a.from&&i<a.from+200&&!/[^ \t]/.test(s=a.text.slice(0,i-a.from))){if(s[s.length-1]==" ")return i-1;let c=Rs(s,o.tabSize),u=c%Yd(o)||Yd(o);for(let f=0;f<u&&s[s.length-1-f]==" ";f++)i--;l=i}else l=an(a.text,i-a.from,e,e)+a.from,l==i&&a.number!=(e?o.doc.lines:1)?l+=e?1:-1:!e&&/[\ufe00-\ufe0f]/.test(a.text.slice(l-a.from,i-a.from))&&(l=an(a.text,l-a.from,!1,!1)+a.from);return l}),Yg=t=>Q_(t,!1,!0),Y_=t=>Q_(t,!0,!1),X_=(t,e)=>zc(t,n=>{let r=n.head,{state:i}=t,o=i.doc.lineAt(r),a=i.charCategorizer(r);for(let s=null;;){if(r==(e?o.to:o.from)){r==n.head&&o.number!=(e?i.doc.lines:1)&&(r+=e?1:-1);break}let l=an(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=a(c);if(s!=null&&u!=s)break;(c!=" "||r!=n.head)&&(s=u),r=l}return r}),Z_=t=>X_(t,!1),SJ=t=>X_(t,!0),OJ=t=>zc(t,e=>{let n=t.lineBlockAt(e.head).to;return e.head<n?n:Math.min(t.state.doc.length,e.head+1)}),PJ=t=>zc(t,e=>{let n=t.moveToLineBoundary(e,!1).head;return e.head>n?n:Math.max(0,e.head-1)}),EJ=t=>zc(t,e=>{let n=t.moveToLineBoundary(e,!0).head;return e.head<n?n:Math.min(t.state.doc.length,e.head+1)}),AJ=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=t.changeByRange(r=>({changes:{from:r.from,to:r.to,insert:We.of(["",""])},range:Q.cursor(r.from)}));return e(t.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},DJ=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=t.changeByRange(r=>{if(!r.empty||r.from==0||r.from==t.doc.length)return{range:r};let i=r.from,o=t.doc.lineAt(i),a=i==o.from?i-1:an(o.text,i-o.from,!1)+o.from,s=i==o.to?i+1:an(o.text,i-o.from,!0)+o.from;return{changes:{from:a,to:s,insert:t.doc.slice(i,s).append(t.doc.slice(a,i))},range:Q.cursor(s)}});return n.changes.empty?!1:(e(t.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function sh(t){let e=[],n=-1;for(let r of t.selection.ranges){let i=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)),n>=i.number){let a=e[e.length-1];a.to=o.to,a.ranges.push(r)}else e.push({from:i.from,to:o.to,ranges:[r]});n=o.number+1}return e}function G_(t,e,n){if(t.readOnly)return!1;let r=[],i=[];for(let o of sh(t)){if(n?o.to==t.doc.length:o.from==0)continue;let a=t.doc.lineAt(n?o.to+1:o.from-1),s=a.length+1;if(n){r.push({from:o.to,to:a.to},{from:o.from,insert:a.text+t.lineBreak});for(let l of o.ranges)i.push(Q.range(Math.min(t.doc.length,l.anchor+s),Math.min(t.doc.length,l.head+s)))}else{r.push({from:a.from,to:o.from},{from:o.to,insert:t.lineBreak+a.text});for(let l of o.ranges)i.push(Q.range(l.anchor-s,l.head-s))}}return r.length?(e(t.update({changes:r,scrollIntoView:!0,selection:Q.create(i,t.selection.mainIndex),userEvent:"move.line"})),!0):!1}const MJ=({state:t,dispatch:e})=>G_(t,e,!1),TJ=({state:t,dispatch:e})=>G_(t,e,!0);function J_(t,e,n){if(t.readOnly)return!1;let r=[];for(let i of sh(t))n?r.push({from:i.from,insert:t.doc.slice(i.from,i.to)+t.lineBreak}):r.push({from:i.to,insert:t.lineBreak+t.doc.slice(i.from,i.to)});return e(t.update({changes:r,scrollIntoView:!0,userEvent:"input.copyline"})),!0}const NJ=({state:t,dispatch:e})=>J_(t,e,!1),IJ=({state:t,dispatch:e})=>J_(t,e,!0),LJ=t=>{if(t.state.readOnly)return!1;let{state:e}=t,n=e.changes(sh(e).map(({from:i,to:o})=>(i>0?i--:o<e.doc.length&&o++,{from:i,to:o}))),r=Qs(e.selection,i=>{let o;if(t.lineWrapping){let a=t.lineBlockAt(i.head),s=t.coordsAtPos(i.head,i.assoc||1);s&&(o=a.bottom+t.documentTop-s.bottom+t.defaultLineHeight/2)}return t.moveVertically(i,!0,o)}).map(n);return t.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0};function jJ(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let n=Yt(t).resolveInner(e),r=n.childBefore(e),i=n.childAfter(e),o;return r&&i&&r.to<=e&&i.from>=e&&(o=r.type.prop(De.closedBy))&&o.indexOf(i.name)>-1&&t.doc.lineAt(r.to).from==t.doc.lineAt(i.from).from&&!/\S/.test(t.sliceDoc(r.to,i.from))?{from:r.to,to:i.from}:null}const ex=tx(!1),RJ=tx(!0);function tx(t){return({state:e,dispatch:n})=>{if(e.readOnly)return!1;let r=e.changeByRange(i=>{let{from:o,to:a}=i,s=e.doc.lineAt(o),l=!t&&o==a&&jJ(e,o);t&&(o=a=(a<=s.to?s:e.doc.lineAt(a)).to);let c=new Xd(e,{simulateBreak:o,simulateDoubleBreak:!!l}),u=Ig(c,o);for(u==null&&(u=Rs(/^\s*/.exec(e.doc.lineAt(o).text)[0],e.tabSize));a<s.to&&/\s/.test(s.text[a-s.from]);)a++;l?{from:o,to:a}=l:o>s.from&&o<s.from+100&&!/\S/.test(s.text.slice(0,o))&&(o=s.from);let f=["",Fc(e,u)];return l&&f.push(Fc(e,c.lineIndent(s.from,-1))),{changes:{from:o,to:a,insert:We.of(f)},range:Q.cursor(o+1+f[1].length)}});return n(e.update(r,{scrollIntoView:!0,userEvent:"input"})),!0}}function Xg(t,e){let n=-1;return t.changeByRange(r=>{let i=[];for(let a=r.from;a<=r.to;){let s=t.doc.lineAt(a);s.number>n&&(r.empty||r.to>s.from)&&(e(s,i,r),n=s.number),a=s.to+1}let o=t.changes(i);return{changes:i,range:Q.range(o.mapPos(r.anchor,1),o.mapPos(r.head,1))}})}const BJ=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=Object.create(null),r=new Xd(t,{overrideIndentation:o=>{let a=n[o];return a??-1}}),i=Xg(t,(o,a,s)=>{let l=Ig(r,o.from);if(l==null)return;/\S/.test(o.text)||(l=0);let c=/^\s*/.exec(o.text)[0],u=Fc(t,l);(c!=u||s.from<o.from+c.length)&&(n[o.from]=l,a.push({from:o.from,to:o.from+c.length,insert:u}))});return i.changes.empty||e(t.update(i,{userEvent:"indent"})),!0},nx=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(Xg(t,(n,r)=>{r.push({from:n.from,insert:t.facet(Qd)})}),{userEvent:"input.indent"})),!0),rx=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(Xg(t,(n,r)=>{let i=/^\s*/.exec(n.text)[0];if(!i)return;let o=Rs(i,t.tabSize),a=0,s=Fc(t,Math.max(0,o-Yd(t)));for(;a<i.length&&a<s.length&&i.charCodeAt(a)==s.charCodeAt(a);)a++;r.push({from:n.from+a,to:n.from+i.length,insert:s.slice(a)})}),{userEvent:"delete.dedent"})),!0),$J=t=>(t.setTabFocusMode(),!0),FJ=[{key:"Ctrl-b",run:S_,shift:L_,preventDefault:!0},{key:"Ctrl-f",run:O_,shift:j_},{key:"Ctrl-p",run:A_,shift:$_},{key:"Ctrl-n",run:D_,shift:F_},{key:"Ctrl-a",run:sJ,shift:bJ},{key:"Ctrl-e",run:lJ,shift:wJ},{key:"Ctrl-d",run:Y_},{key:"Ctrl-h",run:Yg},{key:"Ctrl-k",run:OJ},{key:"Ctrl-Alt-h",run:Z_},{key:"Ctrl-o",run:AJ},{key:"Ctrl-t",run:DJ},{key:"Ctrl-v",run:Qg}],HJ=[{key:"ArrowLeft",run:S_,shift:L_,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:GG,shift:fJ,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:oJ,shift:vJ,preventDefault:!0},{key:"ArrowRight",run:O_,shift:j_,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:JG,shift:dJ,preventDefault:!0},{mac:"Cmd-ArrowRight",run:aJ,shift:yJ,preventDefault:!0},{key:"ArrowUp",run:A_,shift:$_,preventDefault:!0},{mac:"Cmd-ArrowUp",run:z_,shift:q_},{mac:"Ctrl-ArrowUp",run:N_,shift:V_},{key:"ArrowDown",run:D_,shift:F_,preventDefault:!0},{mac:"Cmd-ArrowDown",run:U_,shift:K_},{mac:"Ctrl-ArrowDown",run:Qg,shift:W_},{key:"PageUp",run:N_,shift:V_},{key:"PageDown",run:Qg,shift:W_},{key:"Home",run:iJ,shift:gJ,preventDefault:!0},{key:"Mod-Home",run:z_,shift:q_},{key:"End",run:rJ,shift:mJ,preventDefault:!0},{key:"Mod-End",run:U_,shift:K_},{key:"Enter",run:ex,shift:ex},{key:"Mod-a",run:_J},{key:"Backspace",run:Yg,shift:Yg},{key:"Delete",run:Y_},{key:"Mod-Backspace",mac:"Alt-Backspace",run:Z_},{key:"Mod-Delete",mac:"Alt-Delete",run:SJ},{mac:"Mod-Backspace",run:PJ},{mac:"Mod-Delete",run:EJ}].concat(FJ.map(t=>({mac:t.key,run:t.run,shift:t.shift}))),VJ=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:tJ,shift:hJ},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:nJ,shift:pJ},{key:"Alt-ArrowUp",run:MJ},{key:"Shift-Alt-ArrowUp",run:NJ},{key:"Alt-ArrowDown",run:TJ},{key:"Shift-Alt-ArrowDown",run:IJ},{key:"Escape",run:kJ},{key:"Mod-Enter",run:RJ},{key:"Alt-l",mac:"Ctrl-l",run:xJ},{key:"Mod-i",run:CJ,preventDefault:!0},{key:"Mod-[",run:rx},{key:"Mod-]",run:nx},{key:"Mod-Alt-\\",run:BJ},{key:"Shift-Mod-k",run:LJ},{key:"Shift-Mod-\\",run:uJ},{key:"Mod-/",run:NG},{key:"Alt-A",run:LG},{key:"Ctrl-m",mac:"Shift-Alt-m",run:$J}].concat(HJ),WJ={key:"Tab",run:nx,shift:rx};function it(){var t=arguments[0];typeof t=="string"&&(t=document.createElement(t));var e=1,n=arguments[1];if(n&&typeof n=="object"&&n.nodeType==null&&!Array.isArray(n)){for(var r in n)if(Object.prototype.hasOwnProperty.call(n,r)){var i=n[r];typeof i=="string"?t.setAttribute(r,i):i!=null&&(t[r]=i)}e++}for(;e<arguments.length;e++)ix(t,arguments[e]);return t}function ix(t,e){if(typeof e=="string")t.appendChild(document.createTextNode(e));else if(e!=null)if(e.nodeType!=null)t.appendChild(e);else if(Array.isArray(e))for(var n=0;n<e.length;n++)ix(t,e[n]);else throw new RangeError("Unsupported child node: "+e)}const ox=typeof String.prototype.normalize=="function"?t=>t.normalize("NFKD"):t=>t;class Ys{constructor(e,n,r=0,i=e.length,o,a){this.test=a,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(r,i),this.bufferStart=r,this.normalize=o?s=>o(ox(s)):ox,this.query=this.normalize(n)}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 Rn(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 n=h0(e),r=this.bufferStart+this.bufferPos;this.bufferPos+=ci(e);let i=this.normalize(n);if(i.length)for(let o=0,a=r;;o++){let s=i.charCodeAt(o),l=this.match(s,a,this.bufferPos+this.bufferStart);if(o==i.length-1){if(l)return this.value=l,this;break}a==r&&o<n.length&&n.charCodeAt(o)==s&&a++}}}match(e,n,r){let i=null;for(let o=0;o<this.matches.length;o+=2){let a=this.matches[o],s=!1;this.query.charCodeAt(a)==e&&(a==this.query.length-1?i={from:this.matches[o+1],to:r}:(this.matches[o]++,s=!0)),s||(this.matches.splice(o,2),o-=2)}return this.query.charCodeAt(0)==e&&(this.query.length==1?i={from:n,to:r}:this.matches.push(1,n)),i&&this.test&&!this.test(i.from,i.to,this.buffer,this.bufferStart)&&(i=null),i}}typeof Symbol<"u"&&(Ys.prototype[Symbol.iterator]=function(){return this});const ax={from:-1,to:-1,match:/.*/.exec("")},Zg="gm"+(/x/.unicode==null?"":"u");class sx{constructor(e,n,r,i=0,o=e.length){if(this.text=e,this.to=o,this.curLine="",this.done=!1,this.value=ax,/\\[sWDnr]|\n|\r|\[\^/.test(n))return new lx(e,n,r,i,o);this.re=new RegExp(n,Zg+(r!=null&&r.ignoreCase?"i":"")),this.test=r==null?void 0:r.test,this.iter=e.iter();let a=e.lineAt(i);this.curLineStart=a.from,this.matchPos=lh(e,i),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine="":(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let n=this.matchPos<=this.to&&this.re.exec(this.curLine);if(n){let r=this.curLineStart+n.index,i=r+n[0].length;if(this.matchPos=lh(this.text,i+(r==i?1:0)),r==this.curLineStart+this.curLine.length&&this.nextLine(),(r<i||r>this.value.to)&&(!this.test||this.test(r,i,n)))return this.value={from:r,to:i,match:n},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),e=0;else return this.done=!0,this}}}const Gg=new WeakMap;class Xs{constructor(e,n){this.from=e,this.text=n}get to(){return this.from+this.text.length}static get(e,n,r){let i=Gg.get(e);if(!i||i.from>=r||i.to<=n){let s=new Xs(n,e.sliceString(n,r));return Gg.set(e,s),s}if(i.from==n&&i.to==r)return i;let{text:o,from:a}=i;return a>n&&(o=e.sliceString(n,a)+o,a=n),i.to<r&&(o+=e.sliceString(i.to,r)),Gg.set(e,new Xs(a,o)),new Xs(n,o.slice(n-a,r-a))}}class lx{constructor(e,n,r,i,o){this.text=e,this.to=o,this.done=!1,this.value=ax,this.matchPos=lh(e,i),this.re=new RegExp(n,Zg+(r!=null&&r.ignoreCase?"i":"")),this.test=r==null?void 0:r.test,this.flat=Xs.get(e,i,this.chunkEnd(i+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,n=this.re.exec(this.flat.text);if(n&&!n[0]&&n.index==e&&(this.re.lastIndex=e+1,n=this.re.exec(this.flat.text)),n){let r=this.flat.from+n.index,i=r+n[0].length;if((this.flat.to>=this.to||n.index+n[0].length<=this.flat.text.length-10)&&(!this.test||this.test(r,i,n)))return this.value={from:r,to:i,match:n},this.matchPos=lh(this.text,i+(r==i?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Xs.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(sx.prototype[Symbol.iterator]=lx.prototype[Symbol.iterator]=function(){return this});function zJ(t){try{return new RegExp(t,Zg),!0}catch{return!1}}function lh(t,e){if(e>=t.length)return e;let n=t.lineAt(e),r;for(;e<n.to&&(r=n.text.charCodeAt(e-n.from))>=56320&&r<57344;)e++;return e}function Jg(t){let e=String(t.state.doc.lineAt(t.state.selection.main.head).number),n=it("input",{class:"cm-textfield",name:"line",value:e}),r=it("form",{class:"cm-gotoLine",onkeydown:o=>{o.keyCode==27?(o.preventDefault(),t.dispatch({effects:Uc.of(!1)}),t.focus()):o.keyCode==13&&(o.preventDefault(),i())},onsubmit:o=>{o.preventDefault(),i()}},it("label",t.state.phrase("Go to line"),": ",n)," ",it("button",{class:"cm-button",type:"submit"},t.state.phrase("go")),it("button",{name:"close",onclick:()=>{t.dispatch({effects:Uc.of(!1)}),t.focus()},"aria-label":t.state.phrase("close"),type:"button"},["×"]));function i(){let o=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(n.value);if(!o)return;let{state:a}=t,s=a.doc.lineAt(a.selection.main.head),[,l,c,u,f]=o,d=u?+u.slice(1):0,h=c?+c:s.number;if(c&&f){let p=h/100;l&&(p=p*(l=="-"?-1:1)+s.number/a.doc.lines),h=Math.round(a.doc.lines*p)}else c&&l&&(h=h*(l=="-"?-1:1)+s.number);let m=a.doc.line(Math.max(1,Math.min(a.doc.lines,h))),g=Q.cursor(m.from+Math.max(0,Math.min(d,m.length)));t.dispatch({effects:[Uc.of(!1),ne.scrollIntoView(g.from,{y:"center"})],selection:g}),t.focus()}return{dom:r}}const Uc=Se.define(),cx=sn.define({create(){return!0},update(t,e){for(let n of e.effects)n.is(Uc)&&(t=n.value);return t},provide:t=>Ic.from(t,e=>e?Jg:null)}),UJ=t=>{let e=Nc(t,Jg);if(!e){let n=[Uc.of(!0)];t.state.field(cx,!1)==null&&n.push(Se.appendConfig.of([cx,qJ])),t.dispatch({effects:n}),e=Nc(t,Jg)}return e&&e.dom.querySelector("input").select(),!0},qJ=ne.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px",position:"relative","& label":{fontSize:"80%"},"& [name=close]":{position:"absolute",top:"0",bottom:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:"0"}}}),KJ={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},QJ=ae.define({combine(t){return di(t,KJ,{highlightWordAroundCursor:(e,n)=>e||n,minSelectionLength:Math.min,maxMatches:Math.min})}});function YJ(t){return[eee,JJ]}const XJ=ge.mark({class:"cm-selectionMatch"}),ZJ=ge.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function ux(t,e,n,r){return(n==0||t(e.sliceDoc(n-1,n))!=dt.Word)&&(r==e.doc.length||t(e.sliceDoc(r,r+1))!=dt.Word)}function GJ(t,e,n,r){return t(e.sliceDoc(n,n+1))==dt.Word&&t(e.sliceDoc(r-1,r))==dt.Word}const JJ=Et.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(QJ),{state:n}=t,r=n.selection;if(r.ranges.length>1)return ge.none;let i=r.main,o,a=null;if(i.empty){if(!e.highlightWordAroundCursor)return ge.none;let l=n.wordAt(i.head);if(!l)return ge.none;a=n.charCategorizer(i.head),o=n.sliceDoc(l.from,l.to)}else{let l=i.to-i.from;if(l<e.minSelectionLength||l>200)return ge.none;if(e.wholeWords){if(o=n.sliceDoc(i.from,i.to),a=n.charCategorizer(i.head),!(ux(a,n,i.from,i.to)&&GJ(a,n,i.from,i.to)))return ge.none}else if(o=n.sliceDoc(i.from,i.to),!o)return ge.none}let s=[];for(let l of t.visibleRanges){let c=new Ys(n.doc,o,l.from,l.to);for(;!c.next().done;){let{from:u,to:f}=c.value;if((!a||ux(a,n,u,f))&&(i.empty&&u<=i.from&&f>=i.to?s.push(ZJ.range(u,f)):(u>=i.to||f<=i.from)&&s.push(XJ.range(u,f)),s.length>e.maxMatches))return ge.none}}return ge.set(s)}},{decorations:t=>t.decorations}),eee=ne.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),tee=({state:t,dispatch:e})=>{let{selection:n}=t,r=Q.create(n.ranges.map(i=>t.wordAt(i.head)||Q.cursor(i.head)),n.mainIndex);return r.eq(n)?!1:(e(t.update({selection:r})),!0)};function nee(t,e){let{main:n,ranges:r}=t.selection,i=t.wordAt(n.head),o=i&&i.from==n.from&&i.to==n.to;for(let a=!1,s=new Ys(t.doc,e,r[r.length-1].to);;)if(s.next(),s.done){if(a)return null;s=new Ys(t.doc,e,0,Math.max(0,r[r.length-1].from-1)),a=!0}else{if(a&&r.some(l=>l.from==s.value.from))continue;if(o){let l=t.wordAt(s.value.from);if(!l||l.from!=s.value.from||l.to!=s.value.to)continue}return s.value}}const ree=({state:t,dispatch:e})=>{let{ranges:n}=t.selection;if(n.some(o=>o.from===o.to))return tee({state:t,dispatch:e});let r=t.sliceDoc(n[0].from,n[0].to);if(t.selection.ranges.some(o=>t.sliceDoc(o.from,o.to)!=r))return!1;let i=nee(t,r);return i?(e(t.update({selection:t.selection.addRange(Q.range(i.from,i.to),!1),effects:ne.scrollIntoView(i.to)})),!0):!1},Zs=ae.define({combine(t){return di(t,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new mee(e),scrollToMatch:e=>ne.scrollIntoView(e)})}});class fx{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||zJ(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(n,r)=>r=="n"?`
|
|
590
|
-
`: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 see(this):new oee(this)}getCursor(e,n=0,r){let i=e.doc?e:Ne.create({doc:e});return r==null&&(r=i.doc.length),this.regexp?Js(this,i,n,r):Gs(this,i,n,r)}}class dx{constructor(e){this.spec=e}}function Gs(t,e,n,r){return new Ys(e.doc,t.unquoted,n,r,t.caseSensitive?void 0:i=>i.toLowerCase(),t.wholeWord?iee(e.doc,e.charCategorizer(e.selection.main.head)):void 0)}function iee(t,e){return(n,r,i,o)=>((o>n||o+i.length<r)&&(o=Math.max(0,n-2),i=t.sliceString(o,Math.min(t.length,r+2))),(e(ch(i,n-o))!=dt.Word||e(uh(i,n-o))!=dt.Word)&&(e(uh(i,r-o))!=dt.Word||e(ch(i,r-o))!=dt.Word))}class oee extends dx{constructor(e){super(e)}nextMatch(e,n,r){let i=Gs(this.spec,e,r,e.doc.length).nextOverlapping();if(i.done){let o=Math.min(e.doc.length,n+this.spec.unquoted.length);i=Gs(this.spec,e,0,o).nextOverlapping()}return i.done||i.value.from==n&&i.value.to==r?null:i.value}prevMatchInRange(e,n,r){for(let i=r;;){let o=Math.max(n,i-1e4-this.spec.unquoted.length),a=Gs(this.spec,e,o,i),s=null;for(;!a.nextOverlapping().done;)s=a.value;if(s)return s;if(o==n)return null;i-=1e4}}prevMatch(e,n,r){let i=this.prevMatchInRange(e,0,n);return i||(i=this.prevMatchInRange(e,Math.max(0,r-this.spec.unquoted.length),e.doc.length)),i&&(i.from!=n||i.to!=r)?i:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,n){let r=Gs(this.spec,e,0,e.doc.length),i=[];for(;!r.next().done;){if(i.length>=n)return null;i.push(r.value)}return i}highlight(e,n,r,i){let o=Gs(this.spec,e,Math.max(0,n-this.spec.unquoted.length),Math.min(r+this.spec.unquoted.length,e.doc.length));for(;!o.next().done;)i(o.value.from,o.value.to)}}function Js(t,e,n,r){return new sx(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:t.wholeWord?aee(e.charCategorizer(e.selection.main.head)):void 0},n,r)}function ch(t,e){return t.slice(an(t,e,!1),e)}function uh(t,e){return t.slice(e,an(t,e))}function aee(t){return(e,n,r)=>!r[0].length||(t(ch(r.input,r.index))!=dt.Word||t(uh(r.input,r.index))!=dt.Word)&&(t(uh(r.input,r.index+r[0].length))!=dt.Word||t(ch(r.input,r.index+r[0].length))!=dt.Word)}class see extends dx{nextMatch(e,n,r){let i=Js(this.spec,e,r,e.doc.length).next();return i.done&&(i=Js(this.spec,e,0,n).next()),i.done?null:i.value}prevMatchInRange(e,n,r){for(let i=1;;i++){let o=Math.max(n,r-i*1e4),a=Js(this.spec,e,o,r),s=null;for(;!a.next().done;)s=a.value;if(s&&(o==n||s.from>o+10))return s;if(o==n)return null}}prevMatch(e,n,r){return this.prevMatchInRange(e,0,n)||this.prevMatchInRange(e,r,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(n,r)=>{if(r=="&")return e.match[0];if(r=="$")return"$";for(let i=r.length;i>0;i--){let o=+r.slice(0,i);if(o>0&&o<e.match.length)return e.match[o]+r.slice(i)}return n})}matchAll(e,n){let r=Js(this.spec,e,0,e.doc.length),i=[];for(;!r.next().done;){if(i.length>=n)return null;i.push(r.value)}return i}highlight(e,n,r,i){let o=Js(this.spec,e,Math.max(0,n-250),Math.min(r+250,e.doc.length));for(;!o.next().done;)i(o.value.from,o.value.to)}}const qc=Se.define(),e3=Se.define(),Ko=sn.define({create(t){return new t3(r3(t).create(),null)},update(t,e){for(let n of e.effects)n.is(qc)?t=new t3(n.value.create(),t.panel):n.is(e3)&&(t=new t3(t.query,n.value?n3:null));return t},provide:t=>Ic.from(t,e=>e.panel)});class t3{constructor(e,n){this.query=e,this.panel=n}}const lee=ge.mark({class:"cm-searchMatch"}),cee=ge.mark({class:"cm-searchMatch cm-searchMatch-selected"}),uee=Et.fromClass(class{constructor(t){this.view=t,this.decorations=this.highlight(t.state.field(Ko))}update(t){let e=t.state.field(Ko);(e!=t.startState.field(Ko)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:t,panel:e}){if(!e||!t.spec.valid)return ge.none;let{view:n}=this,r=new zi;for(let i=0,o=n.visibleRanges,a=o.length;i<a;i++){let{from:s,to:l}=o[i];for(;i<a-1&&l>o[i+1].from-2*250;)l=o[++i].to;t.highlight(n.state,s,l,(c,u)=>{let f=n.state.selection.ranges.some(d=>d.from==c&&d.to==u);r.add(c,u,f?cee:lee)})}return r.finish()}},{decorations:t=>t.decorations});function Kc(t){return e=>{let n=e.state.field(Ko,!1);return n&&n.query.spec.valid?t(e,n):gx(e)}}const fh=Kc((t,{query:e})=>{let{to:n}=t.state.selection.main,r=e.nextMatch(t.state,n,n);if(!r)return!1;let i=Q.single(r.from,r.to),o=t.state.facet(Zs);return t.dispatch({selection:i,effects:[i3(t,r),o.scrollToMatch(i.main,t)],userEvent:"select.search"}),mx(t),!0}),dh=Kc((t,{query:e})=>{let{state:n}=t,{from:r}=n.selection.main,i=e.prevMatch(n,r,r);if(!i)return!1;let o=Q.single(i.from,i.to),a=t.state.facet(Zs);return t.dispatch({selection:o,effects:[i3(t,i),a.scrollToMatch(o.main,t)],userEvent:"select.search"}),mx(t),!0}),fee=Kc((t,{query:e})=>{let n=e.matchAll(t.state,1e3);return!n||!n.length?!1:(t.dispatch({selection:Q.create(n.map(r=>Q.range(r.from,r.to))),userEvent:"select.search.matches"}),!0)}),dee=({state:t,dispatch:e})=>{let n=t.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:r,to:i}=n.main,o=[],a=0;for(let s=new Ys(t.doc,t.sliceDoc(r,i));!s.next().done;){if(o.length>1e3)return!1;s.value.from==r&&(a=o.length),o.push(Q.range(s.value.from,s.value.to))}return e(t.update({selection:Q.create(o,a),userEvent:"select.search.matches"})),!0},hx=Kc((t,{query:e})=>{let{state:n}=t,{from:r,to:i}=n.selection.main;if(n.readOnly)return!1;let o=e.nextMatch(n,r,r);if(!o)return!1;let a=o,s=[],l,c,u=[];if(a.from==r&&a.to==i&&(c=n.toText(e.getReplacement(a)),s.push({from:a.from,to:a.to,insert:c}),a=e.nextMatch(n,a.from,a.to),u.push(ne.announce.of(n.phrase("replaced match on line $",n.doc.lineAt(r).number)+"."))),a){let f=s.length==0||s[0].from>=o.to?0:o.to-o.from-c.length;l=Q.single(a.from-f,a.to-f),u.push(i3(t,a)),u.push(n.facet(Zs).scrollToMatch(l.main,t))}return t.dispatch({changes:s,selection:l,effects:u,userEvent:"input.replace"}),!0}),hee=Kc((t,{query:e})=>{if(t.state.readOnly)return!1;let n=e.matchAll(t.state,1e9).map(i=>{let{from:o,to:a}=i;return{from:o,to:a,insert:e.getReplacement(i)}});if(!n.length)return!1;let r=t.state.phrase("replaced $ matches",n.length)+".";return t.dispatch({changes:n,effects:ne.announce.of(r),userEvent:"input.replace.all"}),!0});function n3(t){return t.state.facet(Zs).createPanel(t)}function r3(t,e){var n,r,i,o,a;let s=t.selection.main,l=s.empty||s.to>s.from+100?"":t.sliceDoc(s.from,s.to);if(e&&!l)return e;let c=t.facet(Zs);return new fx({search:((n=e==null?void 0:e.literal)!==null&&n!==void 0?n:c.literal)?l:l.replace(/\n/g,"\\n"),caseSensitive:(r=e==null?void 0:e.caseSensitive)!==null&&r!==void 0?r:c.caseSensitive,literal:(i=e==null?void 0:e.literal)!==null&&i!==void 0?i:c.literal,regexp:(o=e==null?void 0:e.regexp)!==null&&o!==void 0?o:c.regexp,wholeWord:(a=e==null?void 0:e.wholeWord)!==null&&a!==void 0?a:c.wholeWord})}function px(t){let e=Nc(t,n3);return e&&e.dom.querySelector("[main-field]")}function mx(t){let e=px(t);e&&e==t.root.activeElement&&e.select()}const gx=t=>{let e=t.state.field(Ko,!1);if(e&&e.panel){let n=px(t);if(n&&n!=t.root.activeElement){let r=r3(t.state,e.query.spec);r.valid&&t.dispatch({effects:qc.of(r)}),n.focus(),n.select()}}else t.dispatch({effects:[e3.of(!0),e?qc.of(r3(t.state,e.query.spec)):Se.appendConfig.of(vee)]});return!0},vx=t=>{let e=t.state.field(Ko,!1);if(!e||!e.panel)return!1;let n=Nc(t,n3);return n&&n.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:e3.of(!1)}),!0},pee=[{key:"Mod-f",run:gx,scope:"editor search-panel"},{key:"F3",run:fh,shift:dh,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:fh,shift:dh,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:vx,scope:"editor search-panel"},{key:"Mod-Shift-l",run:dee},{key:"Mod-Alt-g",run:UJ},{key:"Mod-d",run:ree,preventDefault:!0}];class mee{constructor(e){this.view=e;let n=this.query=e.state.field(Ko).query.spec;this.commit=this.commit.bind(this),this.searchField=it("input",{value:n.search,placeholder:Jn(e,"Find"),"aria-label":Jn(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=it("input",{value:n.replace,placeholder:Jn(e,"Replace"),"aria-label":Jn(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=it("input",{type:"checkbox",name:"case",form:"",checked:n.caseSensitive,onchange:this.commit}),this.reField=it("input",{type:"checkbox",name:"re",form:"",checked:n.regexp,onchange:this.commit}),this.wordField=it("input",{type:"checkbox",name:"word",form:"",checked:n.wholeWord,onchange:this.commit});function r(i,o,a){return it("button",{class:"cm-button",name:i,onclick:o,type:"button"},a)}this.dom=it("div",{onkeydown:i=>this.keydown(i),class:"cm-search"},[this.searchField,r("next",()=>fh(e),[Jn(e,"next")]),r("prev",()=>dh(e),[Jn(e,"previous")]),r("select",()=>fee(e),[Jn(e,"all")]),it("label",null,[this.caseField,Jn(e,"match case")]),it("label",null,[this.reField,Jn(e,"regexp")]),it("label",null,[this.wordField,Jn(e,"by word")]),...e.state.readOnly?[]:[it("br"),this.replaceField,r("replace",()=>hx(e),[Jn(e,"replace")]),r("replaceAll",()=>hee(e),[Jn(e,"replace all")])],it("button",{name:"close",onclick:()=>vx(e),"aria-label":Jn(e,"close"),type:"button"},["×"])])}commit(){let e=new fx({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:qc.of(e)}))}keydown(e){AX(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?dh:fh)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),hx(this.view))}update(e){for(let n of e.transactions)for(let r of n.effects)r.is(qc)&&!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(Zs).top}}function Jn(t,e){return t.state.phrase(e)}const hh=30,ph=/[\s\.,:;?!]/;function i3(t,{from:e,to:n}){let r=t.state.doc.lineAt(e),i=t.state.doc.lineAt(n).to,o=Math.max(r.from,e-hh),a=Math.min(i,n+hh),s=t.state.sliceDoc(o,a);if(o!=r.from){for(let l=0;l<hh;l++)if(!ph.test(s[l+1])&&ph.test(s[l])){s=s.slice(l);break}}if(a!=i){for(let l=s.length-1;l>s.length-hh;l--)if(!ph.test(s[l-1])&&ph.test(s[l])){s=s.slice(0,l);break}}return ne.announce.of(`${t.state.phrase("current match")}. ${s} ${t.state.phrase("on line")} ${r.number}.`)}const gee=ne.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"}}),vee=[Ko,Oa.low(uee),gee];class yx{constructor(e,n,r,i){this.state=e,this.pos=n,this.explicit=r,this.view=i,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let n=Yt(this.state).resolveInner(this.pos,-1);for(;n&&e.indexOf(n.name)<0;)n=n.parent;return n?{from:n.from,to:this.pos,text:this.state.sliceDoc(n.from,this.pos),type:n.type}:null}matchBefore(e){let n=this.state.doc.lineAt(this.pos),r=Math.max(n.from,this.pos-250),i=n.text.slice(r-n.from,this.pos-n.from),o=i.search(xx(e,!1));return o<0?null:{from:r+o,to:this.pos,text:i.slice(o)}}get aborted(){return this.abortListeners==null}addEventListener(e,n,r){e=="abort"&&this.abortListeners&&(this.abortListeners.push(n),r&&r.onDocChange&&(this.abortOnDocChange=!0))}}function bx(t){let e=Object.keys(t).join(""),n=/\w/.test(e);return n&&(e=e.replace(/\w/g,"")),`[${n?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function yee(t){let e=Object.create(null),n=Object.create(null);for(let{label:i}of t){e[i[0]]=!0;for(let o=1;o<i.length;o++)n[i[o]]=!0}let r=bx(e)+bx(n)+"*$";return[new RegExp("^"+r),new RegExp(r)]}function wx(t){let e=t.map(i=>typeof i=="string"?{label:i}:i),[n,r]=e.every(i=>/^\w+$/.test(i.label))?[/\w*$/,/\w+$/]:yee(e);return i=>{let o=i.matchBefore(r);return o||i.explicit?{from:o?o.from:i.pos,options:e,validFor:n}:null}}function bee(t,e){return n=>{for(let r=Yt(n.state).resolveInner(n.pos,-1);r;r=r.parent){if(t.indexOf(r.name)>-1)return null;if(r.type.isTop)break}return e(n)}}class _x{constructor(e,n,r,i){this.completion=e,this.source=n,this.match=r,this.score=i}}function La(t){return t.selection.main.from}function xx(t,e){var n;let{source:r}=t,i=e&&r[0]!="^",o=r[r.length-1]!="$";return!i&&!o?t:new RegExp(`${i?"^":""}(?:${r})${o?"$":""}`,(n=t.flags)!==null&&n!==void 0?n:t.ignoreCase?"i":"")}const Cx=fi.define();function wee(t,e,n,r){let{main:i}=t.selection,o=n-i.from,a=r-i.from;return Object.assign(Object.assign({},t.changeByRange(s=>{if(s!=i&&n!=r&&t.sliceDoc(s.from+o,s.from+a)!=t.sliceDoc(n,r))return{range:s};let l=t.toText(e);return{changes:{from:s.from+o,to:r==i.from?s.to:s.from+a,insert:l},range:Q.cursor(s.from+o+l.length)}})),{scrollIntoView:!0,userEvent:"input.complete"})}const kx=new WeakMap;function _ee(t){if(!Array.isArray(t))return t;let e=kx.get(t);return e||kx.set(t,e=wx(t)),e}const mh=Se.define(),Qc=Se.define();class xee{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let n=0;n<e.length;){let r=Rn(e,n),i=ci(r);this.chars.push(r);let o=e.slice(n,n+i),a=o.toUpperCase();this.folded.push(Rn(a==o?o.toLowerCase():a,0)),n+=i}this.astral=e.length!=this.chars.length}ret(e,n){return this.score=e,this.matched=n,this}match(e){if(this.pattern.length==0)return this.ret(-100,[]);if(e.length<this.pattern.length)return null;let{chars:n,folded:r,any:i,precise:o,byWord:a}=this;if(n.length==1){let _=Rn(e,0),w=ci(_),b=w==e.length?0:-100;if(_!=n[0])if(_==r[0])b+=-200;else return null;return this.ret(b,[0,w])}let s=e.indexOf(this.pattern);if(s==0)return this.ret(e.length==this.pattern.length?0:-100,[0,this.pattern.length]);let l=n.length,c=0;if(s<0){for(let _=0,w=Math.min(e.length,200);_<w&&c<l;){let b=Rn(e,_);(b==n[c]||b==r[c])&&(i[c++]=_),_+=ci(b)}if(c<l)return null}let u=0,f=0,d=!1,h=0,m=-1,g=-1,p=/[a-z]/.test(e),v=!0;for(let _=0,w=Math.min(e.length,200),b=0;_<w&&f<l;){let y=Rn(e,_);s<0&&(u<l&&y==n[u]&&(o[u++]=_),h<l&&(y==n[h]||y==r[h]?(h==0&&(m=_),g=_+1,h++):h=0));let k,C=y<255?y>=48&&y<=57||y>=97&&y<=122?2:y>=65&&y<=90?1:0:(k=h0(y))!=k.toLowerCase()?1:k!=k.toUpperCase()?2:0;(!_||C==1&&p||b==0&&C!=0)&&(n[f]==y||r[f]==y&&(d=!0)?a[f++]=_:a.length&&(v=!1)),b=C,_+=ci(y)}return f==l&&a[0]==0&&v?this.result(-100+(d?-200:0),a,e):h==l&&m==0?this.ret(-200-e.length+(g==e.length?0:-100),[0,g]):s>-1?this.ret(-700-e.length,[s,s+this.pattern.length]):h==l?this.ret(-900-e.length,[m,g]):f==l?this.result(-100+(d?-200:0)+-700+(v?0:-1100),a,e):n.length==2?null:this.result((i[0]?-700:0)+-200+-1100,i,e)}result(e,n,r){let i=[],o=0;for(let a of n){let s=a+(this.astral?ci(Rn(r,a)):1);o&&i[o-1]==a?i[o-1]=s:(i[o++]=a,i[o++]=s)}return this.ret(e-r.length,i)}}class Cee{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length<this.pattern.length)return null;let n=e.slice(0,this.pattern.length),r=n==this.pattern?0:n.toLowerCase()==this.folded?-200:null;return r==null?null:(this.matched=[0,n.length],this.score=r+(e.length==this.pattern.length?0:-100),this)}}const Xt=ae.define({combine(t){return di(t,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:kee,filterStrict:!1,compareCompletions:(e,n)=>e.label.localeCompare(n.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,n)=>e&&n,closeOnBlur:(e,n)=>e&&n,icons:(e,n)=>e&&n,tooltipClass:(e,n)=>r=>Sx(e(r),n(r)),optionClass:(e,n)=>r=>Sx(e(r),n(r)),addToOptions:(e,n)=>e.concat(n),filterStrict:(e,n)=>e||n})}});function Sx(t,e){return t?e?t+" "+e:t:e}function kee(t,e,n,r,i,o){let a=t.textDirection==ct.RTL,s=a,l=!1,c="top",u,f,d=e.left-i.left,h=i.right-e.right,m=r.right-r.left,g=r.bottom-r.top;if(s&&d<Math.min(m,h)?s=!1:!s&&h<Math.min(m,d)&&(s=!0),m<=(s?d:h))u=Math.max(i.top,Math.min(n.top,i.bottom-g))-e.top,f=Math.min(400,s?d:h);else{l=!0,f=Math.min(400,(a?e.right:i.right-e.left)-30);let _=i.bottom-e.bottom;_>=g||_>e.top?u=n.bottom-e.top:(c="bottom",u=e.bottom-n.top)}let p=(e.bottom-e.top)/o.offsetHeight,v=(e.right-e.left)/o.offsetWidth;return{style:`${c}: ${u/p}px; max-width: ${f/v}px`,class:"cm-completionInfo-"+(l?a?"left-narrow":"right-narrow":s?"left":"right")}}function See(t){let e=t.addToOptions.slice();return t.icons&&e.push({render(n){let r=document.createElement("div");return r.classList.add("cm-completionIcon"),n.type&&r.classList.add(...n.type.split(/\s+/g).map(i=>"cm-completionIcon-"+i)),r.setAttribute("aria-hidden","true"),r},position:20}),e.push({render(n,r,i,o){let a=document.createElement("span");a.className="cm-completionLabel";let s=n.displayLabel||n.label,l=0;for(let c=0;c<o.length;){let u=o[c++],f=o[c++];u>l&&a.appendChild(document.createTextNode(s.slice(l,u)));let d=a.appendChild(document.createElement("span"));d.appendChild(document.createTextNode(s.slice(u,f))),d.className="cm-completionMatchedText",l=f}return l<s.length&&a.appendChild(document.createTextNode(s.slice(l))),a},position:50},{render(n){if(!n.detail)return null;let r=document.createElement("span");return r.className="cm-completionDetail",r.textContent=n.detail,r},position:80}),e.sort((n,r)=>n.position-r.position).map(n=>n.render)}function o3(t,e,n){if(t<=n)return{from:0,to:t};if(e<0&&(e=0),e<=t>>1){let i=Math.floor(e/n);return{from:i*n,to:(i+1)*n}}let r=Math.floor((t-e)/n);return{from:t-(r+1)*n,to:t-r*n}}class Oee{constructor(e,n,r){this.view=e,this.stateField=n,this.applyCompletion=r,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:l=>this.placeInfo(l),key:this},this.space=null,this.currentClass="";let i=e.state.field(n),{options:o,selected:a}=i.open,s=e.state.facet(Xt);this.optionContent=See(s),this.optionClass=s.optionClass,this.tooltipClass=s.tooltipClass,this.range=o3(o.length,a,s.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",l=>{let{options:c}=e.state.field(n).open;for(let u=l.target,f;u&&u!=this.dom;u=u.parentNode)if(u.nodeName=="LI"&&(f=/-(\d+)$/.exec(u.id))&&+f[1]<c.length){this.applyCompletion(e,c[+f[1]]),l.preventDefault();return}}),this.dom.addEventListener("focusout",l=>{let c=e.state.field(this.stateField,!1);c&&c.tooltip&&e.state.facet(Xt).closeOnBlur&&l.relatedTarget!=e.contentDOM&&e.dispatch({effects:Qc.of(null)})}),this.showOptions(o,i.id)}mount(){this.updateSel()}showOptions(e,n){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,n,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var n;let r=e.state.field(this.stateField),i=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),r!=i){let{options:o,selected:a,disabled:s}=r.open;(!i.open||i.open.options!=o)&&(this.range=o3(o.length,a,e.state.facet(Xt).maxRenderedOptions),this.showOptions(o,r.id)),this.updateSel(),s!=((n=i.open)===null||n===void 0?void 0:n.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!s)}}updateTooltipClass(e){let n=this.tooltipClass(e);if(n!=this.currentClass){for(let r of this.currentClass.split(" "))r&&this.dom.classList.remove(r);for(let r of n.split(" "))r&&this.dom.classList.add(r);this.currentClass=n}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),n=e.open;if((n.selected>-1&&n.selected<this.range.from||n.selected>=this.range.to)&&(this.range=o3(n.options.length,n.selected,this.view.state.facet(Xt).maxRenderedOptions),this.showOptions(n.options,e.id)),this.updateSelectedOption(n.selected)){this.destroyInfo();let{completion:r}=n.options[n.selected],{info:i}=r;if(!i)return;let o=typeof i=="string"?document.createTextNode(i):i(r);if(!o)return;"then"in o?o.then(a=>{a&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(a,r)}).catch(a=>$n(this.view.state,a,"completion info")):this.addInfoPane(o,r)}}addInfoPane(e,n){this.destroyInfo();let r=this.info=document.createElement("div");if(r.className="cm-tooltip cm-completionInfo",e.nodeType!=null)r.appendChild(e),this.infoDestroy=null;else{let{dom:i,destroy:o}=e;r.appendChild(i),this.infoDestroy=o||null}this.dom.appendChild(r),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let n=null;for(let r=this.list.firstChild,i=this.range.from;r;r=r.nextSibling,i++)r.nodeName!="LI"||!r.id?i--:i==e?r.hasAttribute("aria-selected")||(r.setAttribute("aria-selected","true"),n=r):r.hasAttribute("aria-selected")&&r.removeAttribute("aria-selected");return n&&Eee(this.list,n),n}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let n=this.dom.getBoundingClientRect(),r=this.info.getBoundingClientRect(),i=e.getBoundingClientRect(),o=this.space;if(!o){let a=this.dom.ownerDocument.documentElement;o={left:0,top:0,right:a.clientWidth,bottom:a.clientHeight}}return i.top>Math.min(o.bottom,n.bottom)-10||i.bottom<Math.max(o.top,n.top)+10?null:this.view.state.facet(Xt).positionInfo(this.view,n,i,r,o,this.dom)}placeInfo(e){this.info&&(e?(e.style&&(this.info.style.cssText=e.style),this.info.className="cm-tooltip cm-completionInfo "+(e.class||"")):this.info.style.cssText="top: -1e6px")}createListBox(e,n,r){const i=document.createElement("ul");i.id=n,i.setAttribute("role","listbox"),i.setAttribute("aria-expanded","true"),i.setAttribute("aria-label",this.view.state.phrase("Completions")),i.addEventListener("mousedown",a=>{a.target==i&&a.preventDefault()});let o=null;for(let a=r.from;a<r.to;a++){let{completion:s,match:l}=e[a],{section:c}=s;if(c){let d=typeof c=="string"?c:c.name;if(d!=o&&(a>r.from||r.from==0))if(o=d,typeof c!="string"&&c.header)i.appendChild(c.header(c));else{let h=i.appendChild(document.createElement("completion-section"));h.textContent=d}}const u=i.appendChild(document.createElement("li"));u.id=n+"-"+a,u.setAttribute("role","option");let f=this.optionClass(s);f&&(u.className=f);for(let d of this.optionContent){let h=d(s,this.view.state,this.view,l);h&&u.appendChild(h)}}return r.from&&i.classList.add("cm-completionListIncompleteTop"),r.to<e.length&&i.classList.add("cm-completionListIncompleteBottom"),i}destroyInfo(){this.info&&(this.infoDestroy&&this.infoDestroy(),this.info.remove(),this.info=null)}destroy(){this.destroyInfo()}}function Pee(t,e){return n=>new Oee(n,t,e)}function Eee(t,e){let n=t.getBoundingClientRect(),r=e.getBoundingClientRect(),i=n.height/t.offsetHeight;r.top<n.top?t.scrollTop-=(n.top-r.top)/i:r.bottom>n.bottom&&(t.scrollTop+=(r.bottom-n.bottom)/i)}function Ox(t){return(t.boost||0)*100+(t.apply?10:0)+(t.info?5:0)+(t.type?1:0)}function Aee(t,e){let n=[],r=null,i=c=>{n.push(c);let{section:u}=c.completion;if(u){r||(r=[]);let f=typeof u=="string"?u:u.name;r.some(d=>d.name==f)||r.push(typeof u=="string"?{name:f}:u)}},o=e.facet(Xt);for(let c of t)if(c.hasResult()){let u=c.result.getMatch;if(c.result.filter===!1)for(let f of c.result.options)i(new _x(f,c.source,u?u(f):[],1e9-n.length));else{let f=e.sliceDoc(c.from,c.to),d,h=o.filterStrict?new Cee(f):new xee(f);for(let m of c.result.options)if(d=h.match(m.label)){let g=m.displayLabel?u?u(m,d.matched):[]:d.matched;i(new _x(m,c.source,g,d.score+(m.boost||0)))}}}if(r){let c=Object.create(null),u=0,f=(d,h)=>{var m,g;return((m=d.rank)!==null&&m!==void 0?m:1e9)-((g=h.rank)!==null&&g!==void 0?g:1e9)||(d.name<h.name?-1:1)};for(let d of r.sort(f))u-=1e5,c[d.name]=u;for(let d of n){let{section:h}=d.completion;h&&(d.score+=c[typeof h=="string"?h:h.name])}}let a=[],s=null,l=o.compareCompletions;for(let c of n.sort((u,f)=>f.score-u.score||l(u.completion,f.completion))){let u=c.completion;!s||s.label!=u.label||s.detail!=u.detail||s.type!=null&&u.type!=null&&s.type!=u.type||s.apply!=u.apply||s.boost!=u.boost?a.push(c):Ox(c.completion)>Ox(s)&&(a[a.length-1]=c),s=c.completion}return a}class el{constructor(e,n,r,i,o,a){this.options=e,this.attrs=n,this.tooltip=r,this.timestamp=i,this.selected=o,this.disabled=a}setSelected(e,n){return e==this.selected||e>=this.options.length?this:new el(this.options,Px(n,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,n,r,i,o,a){if(i&&!a&&e.some(c=>c.isPending))return i.setDisabled();let s=Aee(e,n);if(!s.length)return i&&e.some(c=>c.isPending)?i.setDisabled():null;let l=n.facet(Xt).selectOnOpen?0:-1;if(i&&i.selected!=l&&i.selected!=-1){let c=i.options[i.selected].completion;for(let u=0;u<s.length;u++)if(s[u].completion==c){l=u;break}}return new el(s,Px(r,l),{pos:e.reduce((c,u)=>u.hasResult()?Math.min(c,u.from):c,1e8),create:Lee,above:o.aboveCursor},i?i.timestamp:Date.now(),l,!1)}map(e){return new el(this.options,this.attrs,Object.assign(Object.assign({},this.tooltip),{pos:e.mapPos(this.tooltip.pos)}),this.timestamp,this.selected,this.disabled)}setDisabled(){return new el(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class gh{constructor(e,n,r){this.active=e,this.id=n,this.open=r}static start(){return new gh(Nee,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:n}=e,r=n.facet(Xt),o=(r.override||n.languageDataAt("autocomplete",La(n)).map(_ee)).map(l=>(this.active.find(u=>u.source==l)||new Cr(l,this.active.some(u=>u.state!=0)?1:0)).update(e,r));o.length==this.active.length&&o.every((l,c)=>l==this.active[c])&&(o=this.active);let a=this.open,s=e.effects.some(l=>l.is(a3));a&&e.docChanged&&(a=a.map(e.changes)),e.selection||o.some(l=>l.hasResult()&&e.changes.touchesRange(l.from,l.to))||!Dee(o,this.active)||s?a=el.build(o,n,this.id,a,r,s):a&&a.disabled&&!o.some(l=>l.isPending)&&(a=null),!a&&o.every(l=>!l.isPending)&&o.some(l=>l.hasResult())&&(o=o.map(l=>l.hasResult()?new Cr(l.source,0):l));for(let l of e.effects)l.is(Ax)&&(a=a&&a.setSelected(l.value,this.id));return o==this.active&&a==this.open?this:new gh(o,this.id,a)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?Mee:Tee}}function Dee(t,e){if(t==e)return!0;for(let n=0,r=0;;){for(;n<t.length&&!t[n].hasResult();)n++;for(;r<e.length&&!e[r].hasResult();)r++;let i=n==t.length,o=r==e.length;if(i||o)return i==o;if(t[n++].result!=e[r++].result)return!1}}const Mee={"aria-autocomplete":"list"},Tee={};function Px(t,e){let n={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":t};return e>-1&&(n["aria-activedescendant"]=t+"-"+e),n}const Nee=[];function Ex(t,e){if(t.isUserEvent("input.complete")){let r=t.annotation(Cx);if(r&&e.activateOnCompletion(r))return 12}let n=t.isUserEvent("input.type");return n&&e.activateOnTyping?5:n?1:t.isUserEvent("delete.backward")?2:t.selection?8:t.docChanged?16:0}class Cr{constructor(e,n,r=!1){this.source=e,this.state=n,this.explicit=r}hasResult(){return!1}get isPending(){return this.state==1}update(e,n){let r=Ex(e,n),i=this;(r&8||r&16&&this.touches(e))&&(i=new Cr(i.source,0)),r&4&&i.state==0&&(i=new Cr(this.source,1)),i=i.updateFor(e,r);for(let o of e.effects)if(o.is(mh))i=new Cr(i.source,1,o.value);else if(o.is(Qc))i=new Cr(i.source,0);else if(o.is(a3))for(let a of o.value)a.source==i.source&&(i=a);return i}updateFor(e,n){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(La(e.state))}}class tl extends Cr{constructor(e,n,r,i,o,a){super(e,3,n),this.limit=r,this.result=i,this.from=o,this.to=a}hasResult(){return!0}updateFor(e,n){var r;if(!(n&3))return this.map(e.changes);let i=this.result;i.map&&!e.changes.empty&&(i=i.map(i,e.changes));let o=e.changes.mapPos(this.from),a=e.changes.mapPos(this.to,1),s=La(e.state);if(s>a||!i||n&2&&(La(e.startState)==this.from||s<this.limit))return new Cr(this.source,n&4?1:0);let l=e.changes.mapPos(this.limit);return Iee(i.validFor,e.state,o,a)?new tl(this.source,this.explicit,l,i,o,a):i.update&&(i=i.update(i,o,a,new yx(e.state,s,!1)))?new tl(this.source,this.explicit,l,i,i.from,(r=i.to)!==null&&r!==void 0?r:La(e.state)):new Cr(this.source,1,this.explicit)}map(e){return e.empty?this:(this.result.map?this.result.map(this.result,e):this.result)?new tl(this.source,this.explicit,e.mapPos(this.limit),this.result,e.mapPos(this.from),e.mapPos(this.to,1)):new Cr(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}}function Iee(t,e,n,r){if(!t)return!1;let i=e.sliceDoc(n,r);return typeof t=="function"?t(i,n,r,e):xx(t,!0).test(i)}const a3=Se.define({map(t,e){return t.map(n=>n.map(e))}}),Ax=Se.define(),Vn=sn.define({create(){return gh.start()},update(t,e){return t.update(e)},provide:t=>[yg.from(t,e=>e.tooltip),ne.contentAttributes.from(t,e=>e.attrs)]});function s3(t,e){const n=e.completion.apply||e.completion.label;let r=t.state.field(Vn).active.find(i=>i.source==e.source);return r instanceof tl?(typeof n=="string"?t.dispatch(Object.assign(Object.assign({},wee(t.state,n,r.from,r.to)),{annotations:Cx.of(e.completion)})):n(t,e.completion,r.from,r.to),!0):!1}const Lee=Pee(Vn,s3);function vh(t,e="option"){return n=>{let r=n.state.field(Vn,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp<n.state.facet(Xt).interactionDelay)return!1;let i=1,o;e=="page"&&(o=Pw(n,r.open.tooltip))&&(i=Math.max(2,Math.floor(o.dom.offsetHeight/o.dom.querySelector("li").offsetHeight)-1));let{length:a}=r.open.options,s=r.open.selected>-1?r.open.selected+i*(t?1:-1):t?0:a-1;return s<0?s=e=="page"?0:a-1:s>=a&&(s=e=="page"?a-1:0),n.dispatch({effects:Ax.of(s)}),!0}}const jee=t=>{let e=t.state.field(Vn,!1);return t.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestamp<t.state.facet(Xt).interactionDelay?!1:s3(t,e.open.options[e.open.selected])},Dx=t=>t.state.field(Vn,!1)?(t.dispatch({effects:mh.of(!0)}),!0):!1,Ree=t=>{let e=t.state.field(Vn,!1);return!e||!e.active.some(n=>n.state!=0)?!1:(t.dispatch({effects:Qc.of(null)}),!0)};class Bee{constructor(e,n){this.active=e,this.context=n,this.time=Date.now(),this.updates=[],this.done=void 0}}const $ee=50,Fee=1e3,Hee=Et.fromClass(class{constructor(t){this.view=t,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let e of t.state.field(Vn).active)e.isPending&&this.startQuery(e)}update(t){let e=t.state.field(Vn),n=t.state.facet(Xt);if(!t.selectionSet&&!t.docChanged&&t.startState.field(Vn)==e)return;let r=t.transactions.some(o=>{let a=Ex(o,n);return a&8||(o.selection||o.docChanged)&&!(a&3)});for(let o=0;o<this.running.length;o++){let a=this.running[o];if(r||a.context.abortOnDocChange&&t.docChanged||a.updates.length+t.transactions.length>$ee&&Date.now()-a.time>Fee){for(let s of a.context.abortListeners)try{s()}catch(l){$n(this.view.state,l)}a.context.abortListeners=null,this.running.splice(o--,1)}else a.updates.push(...t.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),t.transactions.some(o=>o.effects.some(a=>a.is(mh)))&&(this.pendingStart=!0);let i=this.pendingStart?50:n.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(o=>o.isPending&&!this.running.some(a=>a.active.source==o.source))?setTimeout(()=>this.startUpdate(),i):-1,this.composing!=0)for(let o of t.transactions)o.isUserEvent("input.type")?this.composing=2:this.composing==2&&o.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:t}=this.view,e=t.field(Vn);for(let n of e.active)n.isPending&&!this.running.some(r=>r.active.source==n.source)&&this.startQuery(n);this.running.length&&e.open&&e.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Xt).updateSyncTime))}startQuery(t){let{state:e}=this.view,n=La(e),r=new yx(e,n,t.explicit,this.view),i=new Bee(t,r);this.running.push(i),Promise.resolve(t.source(r)).then(o=>{i.context.aborted||(i.done=o||null,this.scheduleAccept())},o=>{this.view.dispatch({effects:Qc.of(null)}),$n(this.view.state,o)})}scheduleAccept(){this.running.every(t=>t.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Xt).updateSyncTime))}accept(){var t;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],n=this.view.state.facet(Xt),r=this.view.state.field(Vn);for(let i=0;i<this.running.length;i++){let o=this.running[i];if(o.done===void 0)continue;if(this.running.splice(i--,1),o.done){let s=La(o.updates.length?o.updates[0].startState:this.view.state),l=Math.min(s,o.done.from+(o.active.explicit?0:1)),c=new tl(o.active.source,o.active.explicit,l,o.done,o.done.from,(t=o.done.to)!==null&&t!==void 0?t:s);for(let u of o.updates)c=c.update(u,n);if(c.hasResult()){e.push(c);continue}}let a=r.active.find(s=>s.source==o.active.source);if(a&&a.isPending)if(o.done==null){let s=new Cr(o.active.source,0);for(let l of o.updates)s=s.update(l,n);s.isPending||e.push(s)}else this.startQuery(a)}(e.length||r.open&&r.open.disabled)&&this.view.dispatch({effects:a3.of(e)})}},{eventHandlers:{blur(t){let e=this.view.state.field(Vn,!1);if(e&&e.tooltip&&this.view.state.facet(Xt).closeOnBlur){let n=e.open&&Pw(this.view,e.open.tooltip);(!n||!n.dom.contains(t.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:Qc.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:mh.of(!1)}),20),this.composing=0}}}),Vee=typeof navigator=="object"&&/Win/.test(navigator.platform),Wee=Oa.highest(ne.domEventHandlers({keydown(t,e){let n=e.state.field(Vn,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||t.key.length>1||t.ctrlKey&&!(Vee&&t.altKey)||t.metaKey)return!1;let r=n.open.options[n.open.selected],i=n.active.find(a=>a.source==r.source),o=r.completion.commitCharacters||i.result.commitCharacters;return o&&o.indexOf(t.key)>-1&&s3(e,r),!1}})),zee=ne.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}}),Yc={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},ja=Se.define({map(t,e){let n=e.mapPos(t,-1,Pn.TrackAfter);return n??void 0}}),l3=new class extends Pa{};l3.startSide=1,l3.endSide=-1;const Mx=sn.define({create(){return Be.empty},update(t,e){if(t=t.map(e.changes),e.selection){let n=e.state.doc.lineAt(e.selection.main.head);t=t.update({filter:r=>r>=n.from&&r<=n.to})}for(let n of e.effects)n.is(ja)&&(t=t.update({add:[l3.range(n.value,n.value+1)]}));return t}});function Uee(){return[Kee,Mx]}const c3="()[]{}<>«»»«[]{}";function Tx(t){for(let e=0;e<c3.length;e+=2)if(c3.charCodeAt(e)==t)return c3.charAt(e+1);return h0(t<128?t:t+1)}function Nx(t,e){return t.languageDataAt("closeBrackets",e)[0]||Yc}const qee=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),Kee=ne.inputHandler.of((t,e,n,r)=>{if((qee?t.composing:t.compositionStarted)||t.state.readOnly)return!1;let i=t.state.selection.main;if(r.length>2||r.length==2&&ci(Rn(r,0))==1||e!=i.from||n!=i.to)return!1;let o=Yee(t.state,r);return o?(t.dispatch(o),!0):!1}),Qee=[{key:"Backspace",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let r=Nx(t,t.selection.main.head).brackets||Yc.brackets,i=null,o=t.changeByRange(a=>{if(a.empty){let s=Xee(t.doc,a.head);for(let l of r)if(l==s&&yh(t.doc,a.head)==Tx(Rn(l,0)))return{changes:{from:a.head-l.length,to:a.head+l.length},range:Q.cursor(a.head-l.length)}}return{range:i=a}});return i||e(t.update(o,{scrollIntoView:!0,userEvent:"delete.backward"})),!i}}];function Yee(t,e){let n=Nx(t,t.selection.main.head),r=n.brackets||Yc.brackets;for(let i of r){let o=Tx(Rn(i,0));if(e==i)return o==i?Jee(t,i,r.indexOf(i+i+i)>-1,n):Zee(t,i,o,n.before||Yc.before);if(e==o&&Ix(t,t.selection.main.from))return Gee(t,i,o)}return null}function Ix(t,e){let n=!1;return t.field(Mx).between(0,t.doc.length,r=>{r==e&&(n=!0)}),n}function yh(t,e){let n=t.sliceString(e,e+2);return n.slice(0,ci(Rn(n,0)))}function Xee(t,e){let n=t.sliceString(e-2,e);return ci(Rn(n,0))==n.length?n:n.slice(1)}function Zee(t,e,n,r){let i=null,o=t.changeByRange(a=>{if(!a.empty)return{changes:[{insert:e,from:a.from},{insert:n,from:a.to}],effects:ja.of(a.to+e.length),range:Q.range(a.anchor+e.length,a.head+e.length)};let s=yh(t.doc,a.head);return!s||/\s/.test(s)||r.indexOf(s)>-1?{changes:{insert:e+n,from:a.head},effects:ja.of(a.head+e.length),range:Q.cursor(a.head+e.length)}:{range:i=a}});return i?null:t.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function Gee(t,e,n){let r=null,i=t.changeByRange(o=>o.empty&&yh(t.doc,o.head)==n?{changes:{from:o.head,to:o.head+n.length,insert:n},range:Q.cursor(o.head+n.length)}:r={range:o});return r?null:t.update(i,{scrollIntoView:!0,userEvent:"input.type"})}function Jee(t,e,n,r){let i=r.stringPrefixes||Yc.stringPrefixes,o=null,a=t.changeByRange(s=>{if(!s.empty)return{changes:[{insert:e,from:s.from},{insert:e,from:s.to}],effects:ja.of(s.to+e.length),range:Q.range(s.anchor+e.length,s.head+e.length)};let l=s.head,c=yh(t.doc,l),u;if(c==e){if(Lx(t,l))return{changes:{insert:e+e,from:l},effects:ja.of(l+e.length),range:Q.cursor(l+e.length)};if(Ix(t,l)){let d=n&&t.sliceDoc(l,l+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:l,to:l+d.length,insert:d},range:Q.cursor(l+d.length)}}}else{if(n&&t.sliceDoc(l-2*e.length,l)==e+e&&(u=jx(t,l-2*e.length,i))>-1&&Lx(t,u))return{changes:{insert:e+e+e+e,from:l},effects:ja.of(l+e.length),range:Q.cursor(l+e.length)};if(t.charCategorizer(l)(c)!=dt.Word&&jx(t,l,i)>-1&&!ete(t,l,e,i))return{changes:{insert:e+e,from:l},effects:ja.of(l+e.length),range:Q.cursor(l+e.length)}}return{range:o=s}});return o?null:t.update(a,{scrollIntoView:!0,userEvent:"input.type"})}function Lx(t,e){let n=Yt(t).resolveInner(e+1);return n.parent&&n.from==e}function ete(t,e,n,r){let i=Yt(t).resolveInner(e,-1),o=r.reduce((a,s)=>Math.max(a,s.length),0);for(let a=0;a<5;a++){let s=t.sliceDoc(i.from,Math.min(i.to,i.from+n.length+o)),l=s.indexOf(n);if(!l||l>-1&&r.indexOf(s.slice(0,l))>-1){let u=i.firstChild;for(;u&&u.from==i.from&&u.to-u.from>n.length+l;){if(t.sliceDoc(u.to-n.length,u.to)==n)return!1;u=u.firstChild}return!0}let c=i.to==e&&i.parent;if(!c)break;i=c}return!1}function jx(t,e,n){let r=t.charCategorizer(e);if(r(t.sliceDoc(e-1,e))!=dt.Word)return e;for(let i of n){let o=e-i.length;if(t.sliceDoc(o,e)==i&&r(t.sliceDoc(o-1,o))!=dt.Word)return o}return-1}function tte(t={}){return[Wee,Vn,Xt.of(t),Hee,nte,zee]}const Rx=[{key:"Ctrl-Space",run:Dx},{mac:"Alt-`",run:Dx},{key:"Escape",run:Ree},{key:"ArrowDown",run:vh(!0)},{key:"ArrowUp",run:vh(!1)},{key:"PageDown",run:vh(!0,"page")},{key:"PageUp",run:vh(!1,"page")},{key:"Enter",run:jee}],nte=Oa.highest(Md.computeN([Xt],t=>t.facet(Xt).defaultKeymap?[Rx]:[]));class Bx{constructor(e,n,r){this.from=e,this.to=n,this.diagnostic=r}}class Ra{constructor(e,n,r){this.diagnostics=e,this.panel=n,this.selected=r}static init(e,n,r){let i=r.facet(Xc).markerFilter;i&&(e=i(e,r));let o=e.slice().sort((u,f)=>u.from-f.from||u.to-f.to),a=new zi,s=[],l=0;for(let u=0;;){let f=u==o.length?null:o[u];if(!f&&!s.length)break;let d,h;for(s.length?(d=l,h=s.reduce((g,p)=>Math.min(g,p.to),f&&f.from>d?f.from:1e8)):(d=f.from,h=f.to,s.push(f),u++);u<o.length;){let g=o[u];if(g.from==d&&(g.to>g.from||g.to==d))s.push(g),u++,h=Math.min(g.to,h);else{h=Math.min(g.from,h);break}}let m=pte(s);if(s.some(g=>g.from==g.to||g.from==g.to-1&&r.doc.lineAt(g.from).to==g.from))a.add(d,d,ge.widget({widget:new ute(m),diagnostics:s.slice()}));else{let g=s.reduce((p,v)=>v.markClass?p+" "+v.markClass:p,"");a.add(d,h,ge.mark({class:"cm-lintRange cm-lintRange-"+m+g,diagnostics:s.slice(),inclusiveEnd:s.some(p=>p.to>h)}))}l=h;for(let g=0;g<s.length;g++)s[g].to<=l&&s.splice(g--,1)}let c=a.finish();return new Ra(c,n,nl(c))}}function nl(t,e=null,n=0){let r=null;return t.between(n,1e9,(i,o,{spec:a})=>{if(!(e&&a.diagnostics.indexOf(e)<0))if(!r)r=new Bx(i,o,e||a.diagnostics[0]);else{if(a.diagnostics.indexOf(r.diagnostic)<0)return!1;r=new Bx(r.from,o,r.diagnostic)}}),r}function rte(t,e){let n=e.pos,r=e.end||n,i=t.state.facet(Xc).hideOn(t,n,r);if(i!=null)return i;let o=t.startState.doc.lineAt(e.pos);return!!(t.effects.some(a=>a.is($x))||t.changes.touchesRange(o.from,Math.max(o.to,r)))}function ite(t,e){return t.field(er,!1)?e:e.concat(Se.appendConfig.of(mte))}const $x=Se.define(),u3=Se.define(),Fx=Se.define(),er=sn.define({create(){return new Ra(ge.none,null,null)},update(t,e){if(e.docChanged&&t.diagnostics.size){let n=t.diagnostics.map(e.changes),r=null,i=t.panel;if(t.selected){let o=e.changes.mapPos(t.selected.from,1);r=nl(n,t.selected.diagnostic,o)||nl(n,null,o)}!n.size&&i&&e.state.facet(Xc).autoPanel&&(i=null),t=new Ra(n,i,r)}for(let n of e.effects)if(n.is($x)){let r=e.state.facet(Xc).autoPanel?n.value.length?Zc.open:null:t.panel;t=Ra.init(n.value,r,e.state)}else n.is(u3)?t=new Ra(t.diagnostics,n.value?Zc.open:null,t.selected):n.is(Fx)&&(t=new Ra(t.diagnostics,t.panel,n.value));return t},provide:t=>[Ic.from(t,e=>e.panel),ne.decorations.from(t,e=>e.diagnostics)]}),ote=ge.mark({class:"cm-lintRange cm-lintRange-active"});function ate(t,e,n){let{diagnostics:r}=t.state.field(er),i,o=-1,a=-1;r.between(e-(n<0?1:0),e+(n>0?1:0),(l,c,{spec:u})=>{if(e>=l&&e<=c&&(l==c||(e>l||n>0)&&(e<c||n<0)))return i=u.diagnostics,o=l,a=c,!1});let s=t.state.facet(Xc).tooltipFilter;return i&&s&&(i=s(i,t.state)),i?{pos:o,end:a,above:t.state.doc.lineAt(o).to<a,create(){return{dom:ste(t,i)}}}:null}function ste(t,e){return it("ul",{class:"cm-tooltip-lint"},e.map(n=>Wx(t,n,!1)))}const lte=t=>{let e=t.state.field(er,!1);(!e||!e.panel)&&t.dispatch({effects:ite(t.state,[u3.of(!0)])});let n=Nc(t,Zc.open);return n&&n.dom.querySelector(".cm-panel-lint ul").focus(),!0},Hx=t=>{let e=t.state.field(er,!1);return!e||!e.panel?!1:(t.dispatch({effects:u3.of(!1)}),!0)},cte=[{key:"Mod-Shift-m",run:lte,preventDefault:!0},{key:"F8",run:t=>{let e=t.state.field(er,!1);if(!e)return!1;let n=t.state.selection.main,r=e.diagnostics.iter(n.to+1);return!r.value&&(r=e.diagnostics.iter(0),!r.value||r.from==n.from&&r.to==n.to)?!1:(t.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0}),!0)}}],Xc=ae.define({combine(t){return Object.assign({sources:t.map(e=>e.source).filter(e=>e!=null)},di(t.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{needsRefresh:(e,n)=>e?n?r=>e(r)||n(r):e:n}))}});function Vx(t){let e=[];if(t)e:for(let{name:n}of t){for(let r=0;r<n.length;r++){let i=n[r];if(/[a-zA-Z]/.test(i)&&!e.some(o=>o.toLowerCase()==i.toLowerCase())){e.push(i);continue e}}e.push("")}return e}function Wx(t,e,n){var r;let i=n?Vx(e.actions):[];return it("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},it("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage(t):e.message),(r=e.actions)===null||r===void 0?void 0:r.map((o,a)=>{let s=!1,l=d=>{if(d.preventDefault(),s)return;s=!0;let h=nl(t.state.field(er).diagnostics,e);h&&o.apply(t,h.from,h.to)},{name:c}=o,u=i[a]?c.indexOf(i[a]):-1,f=u<0?c:[c.slice(0,u),it("u",c.slice(u,u+1)),c.slice(u+1)];return it("button",{type:"button",class:"cm-diagnosticAction",onclick:l,onmousedown:l,"aria-label":` Action: ${c}${u<0?"":` (access key "${i[a]})"`}.`},f)}),e.source&&it("div",{class:"cm-diagnosticSource"},e.source))}class ute extends qi{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return it("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class zx{constructor(e,n){this.diagnostic=n,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=Wx(e,n,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class Zc{constructor(e){this.view=e,this.items=[];let n=i=>{if(i.keyCode==27)Hx(this.view),this.view.focus();else if(i.keyCode==38||i.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(i.keyCode==40||i.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(i.keyCode==36)this.moveSelection(0);else if(i.keyCode==35)this.moveSelection(this.items.length-1);else if(i.keyCode==13)this.view.focus();else if(i.keyCode>=65&&i.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:o}=this.items[this.selectedIndex],a=Vx(o.actions);for(let s=0;s<a.length;s++)if(a[s].toUpperCase().charCodeAt(0)==i.keyCode){let l=nl(this.view.state.field(er).diagnostics,o);l&&o.actions[s].apply(e,l.from,l.to)}}else return;i.preventDefault()},r=i=>{for(let o=0;o<this.items.length;o++)this.items[o].dom.contains(i.target)&&this.moveSelection(o)};this.list=it("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:n,onclick:r}),this.dom=it("div",{class:"cm-panel-lint"},this.list,it("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>Hx(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(er).selected;if(!e)return-1;for(let n=0;n<this.items.length;n++)if(this.items[n].diagnostic==e.diagnostic)return n;return-1}update(){let{diagnostics:e,selected:n}=this.view.state.field(er),r=0,i=!1,o=null,a=new Set;for(e.between(0,this.view.state.doc.length,(s,l,{spec:c})=>{for(let u of c.diagnostics){if(a.has(u))continue;a.add(u);let f=-1,d;for(let h=r;h<this.items.length;h++)if(this.items[h].diagnostic==u){f=h;break}f<0?(d=new zx(this.view,u),this.items.splice(r,0,d),i=!0):(d=this.items[f],f>r&&(this.items.splice(r,f-r),i=!0)),n&&d.diagnostic==n.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<this.items.length&&!(this.items.length==1&&this.items[0].diagnostic.from<0);)i=!0,this.items.pop();this.items.length==0&&(this.items.push(new zx(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),i=!0),o?(this.list.setAttribute("aria-activedescendant",o.id),this.view.requestMeasure({key:this,read:()=>({sel:o.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:s,panel:l})=>{let c=l.height/this.list.offsetHeight;s.top<l.top?this.list.scrollTop-=(l.top-s.top)/c:s.bottom>l.bottom&&(this.list.scrollTop+=(s.bottom-l.bottom)/c)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),i&&this.sync()}sync(){let e=this.list.firstChild;function n(){let r=e;e=r.nextSibling,r.remove()}for(let r of this.items)if(r.dom.parentNode==this.list){for(;e!=r.dom;)n();e=r.dom.nextSibling}else this.list.insertBefore(r.dom,e);for(;e;)n()}moveSelection(e){if(this.selectedIndex<0)return;let n=this.view.state.field(er),r=nl(n.diagnostics,this.items[e].diagnostic);r&&this.view.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0,effects:Fx.of(r)})}static open(e){return new Zc(e)}}function fte(t,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${e}>${encodeURIComponent(t)}</svg>')`}function bh(t){return fte(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${t}" fill="none" stroke-width=".7"/>`,'width="6" height="3"')}const dte=ne.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:bh("#d11")},".cm-lintRange-warning":{backgroundImage:bh("orange")},".cm-lintRange-info":{backgroundImage:bh("#999")},".cm-lintRange-hint":{backgroundImage:bh("#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 hte(t){return t=="error"?4:t=="warning"?3:t=="info"?2:1}function pte(t){let e="hint",n=1;for(let r of t){let i=hte(r.severity);i>n&&(n=i,e=r.severity)}return e}const mte=[er,ne.decorations.compute([er],t=>{let{selected:e,panel:n}=t.field(er);return!e||!n||e.from==e.to?ge.none:ge.set([ote.range(e.from,e.to)])}),vZ(ate,{hideOn:rte}),dte];var Ux=function(e){e===void 0&&(e={});var{crosshairCursor:n=!1}=e,r=[];e.closeBracketsKeymap!==!1&&(r=r.concat(Qee)),e.defaultKeymap!==!1&&(r=r.concat(VJ)),e.searchKeymap!==!1&&(r=r.concat(pee)),e.historyKeymap!==!1&&(r=r.concat(ZG)),e.foldKeymap!==!1&&(r=r.concat(dG)),e.completionKeymap!==!1&&(r=r.concat(Rx)),e.lintKeymap!==!1&&(r=r.concat(cte));var i=[];return e.lineNumbers!==!1&&i.push(EZ()),e.highlightActiveLineGutter!==!1&&i.push(MZ()),e.highlightSpecialChars!==!1&&i.push(qX()),e.history!==!1&&i.push(VG()),e.foldGutter!==!1&&i.push(gG()),e.drawSelection!==!1&&i.push(LX()),e.dropCursor!==!1&&i.push(FX()),e.allowMultipleSelections!==!1&&i.push(Ne.allowMultipleSelections.of(!0)),e.indentOnInput!==!1&&i.push(oG()),e.syntaxHighlighting!==!1&&i.push(f_(wG,{fallback:!0})),e.bracketMatching!==!1&&i.push(OG()),e.closeBrackets!==!1&&i.push(Uee()),e.autocompletion!==!1&&i.push(tte()),e.rectangularSelection!==!1&&i.push(aZ()),n!==!1&&i.push(cZ()),e.highlightActiveLine!==!1&&i.push(GX()),e.highlightSelectionMatches!==!1&&i.push(YJ()),e.tabSize&&typeof e.tabSize=="number"&&i.push(Qd.of(" ".repeat(e.tabSize))),i.concat([Md.of(r.flat())]).filter(Boolean)};const gte="#e5c07b",qx="#e06c75",vte="#56b6c2",yte="#ffffff",wh="#abb2bf",f3="#7d8799",bte="#61afef",wte="#98c379",Kx="#d19a66",_te="#c678dd",xte="#21252b",Qx="#2c313a",Yx="#282c34",d3="#353a42",Cte="#3E4451",Xx="#528bff",kte=ne.theme({"&":{color:wh,backgroundColor:Yx},".cm-content":{caretColor:Xx},".cm-cursor, .cm-dropCursor":{borderLeftColor:Xx},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:Cte},".cm-panels":{backgroundColor:xte,color:wh},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:"1px solid #457dff"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff2f"},".cm-activeLine":{backgroundColor:"#6699ff0b"},".cm-selectionMatch":{backgroundColor:"#aafe661a"},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bad0f847"},".cm-gutters":{backgroundColor:Yx,color:f3,border:"none"},".cm-activeLineGutter":{backgroundColor:Qx},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:d3},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:d3,borderBottomColor:d3},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:Qx,color:wh}}},{dark:!0}),Ste=Vc.define([{tag:B.keyword,color:_te},{tag:[B.name,B.deleted,B.character,B.propertyName,B.macroName],color:qx},{tag:[B.function(B.variableName),B.labelName],color:bte},{tag:[B.color,B.constant(B.name),B.standard(B.name)],color:Kx},{tag:[B.definition(B.name),B.separator],color:wh},{tag:[B.typeName,B.className,B.number,B.changed,B.annotation,B.modifier,B.self,B.namespace],color:gte},{tag:[B.operator,B.operatorKeyword,B.url,B.escape,B.regexp,B.link,B.special(B.string)],color:vte},{tag:[B.meta,B.comment],color:f3},{tag:B.strong,fontWeight:"bold"},{tag:B.emphasis,fontStyle:"italic"},{tag:B.strikethrough,textDecoration:"line-through"},{tag:B.link,color:f3,textDecoration:"underline"},{tag:B.heading,fontWeight:"bold",color:qx},{tag:[B.atom,B.bool,B.special(B.variableName)],color:Kx},{tag:[B.processingInstruction,B.string,B.inserted],color:wte},{tag:B.invalid,color:yte}]),Ote=[kte,f_(Ste)];var Pte=ne.theme({"&":{backgroundColor:"#fff"}},{dark:!1}),Ete=function(e){e===void 0&&(e={});var{indentWithTab:n=!0,editable:r=!0,readOnly:i=!1,theme:o="light",placeholder:a="",basicSetup:s=!0}=e,l=[];switch(n&&l.unshift(Md.of([WJ])),s&&(typeof s=="boolean"?l.unshift(Ux()):l.unshift(Ux(s))),a&&l.unshift(nZ(a)),o){case"light":l.push(Pte);break;case"dark":l.push(Ote);break;case"none":break;default:l.push(o);break}return r===!1&&l.push(ne.editable.of(!1)),i&&l.push(Ne.readOnly.of(!0)),[...l]},Ate=t=>({line:t.state.doc.lineAt(t.state.selection.main.from),lineCount:t.state.doc.lines,lineBreak:t.state.lineBreak,length:t.state.doc.length,readOnly:t.state.readOnly,tabSize:t.state.tabSize,selection:t.state.selection,selectionAsSingle:t.state.selection.asSingle().main,ranges:t.state.selection.ranges,selectionCode:t.state.sliceDoc(t.state.selection.main.from,t.state.selection.main.to),selections:t.state.selection.ranges.map(e=>t.state.sliceDoc(e.from,e.to)),selectedText:t.state.selection.ranges.some(e=>!e.empty)}),Zx=fi.define(),Dte=[];function Mte(t){var{value:e,selection:n,onChange:r,onStatistics:i,onCreateEditor:o,onUpdate:a,extensions:s=Dte,autoFocus:l,theme:c="light",height:u=null,minHeight:f=null,maxHeight:d=null,width:h=null,minWidth:m=null,maxWidth:g=null,placeholder:p="",editable:v=!0,readOnly:_=!1,indentWithTab:w=!0,basicSetup:b=!0,root:y,initialState:k}=t,[C,E]=S.useState(),[A,N]=S.useState(),[M,T]=S.useState(),I=ne.theme({"&":{height:u,minHeight:f,maxHeight:d,width:h,minWidth:m,maxWidth:g},"& .cm-scroller":{height:"100% !important"}}),L=ne.updateListener.of(W=>{if(W.docChanged&&typeof r=="function"&&!W.transactions.some(pe=>pe.annotation(Zx))){var X=W.state.doc,J=X.toString();r(J,W)}i&&i(Ate(W))}),F=Ete({theme:c,editable:v,readOnly:_,placeholder:p,indentWithTab:w,basicSetup:b}),V=[L,I,...F];return a&&typeof a=="function"&&V.push(ne.updateListener.of(a)),V=V.concat(s),S.useLayoutEffect(()=>{if(C&&!M){var W={doc:e,selection:n,extensions:V},X=k?Ne.fromJSON(k.json,W,k.fields):Ne.create(W);if(T(X),!A){var J=new ne({state:X,parent:C,root:y});N(J),o&&o(J,X)}}return()=>{A&&(T(void 0),N(void 0))}},[C,M]),S.useEffect(()=>{t.container&&E(t.container)},[t.container]),S.useEffect(()=>()=>{A&&(A.destroy(),N(void 0))},[A]),S.useEffect(()=>{l&&A&&A.focus()},[l,A]),S.useEffect(()=>{A&&A.dispatch({effects:Se.reconfigure.of(V)})},[c,s,u,f,d,h,m,g,p,v,_,w,b,r,a]),S.useEffect(()=>{if(e!==void 0){var W=A?A.state.doc.toString():"";A&&e!==W&&A.dispatch({changes:{from:0,to:W.length,insert:e||""},annotations:[Zx.of(!0)]})}},[e,A]),{state:M,setState:T,view:A,setView:N,container:C,setContainer:E}}var Tte=["className","value","selection","extensions","onChange","onStatistics","onCreateEditor","onUpdate","autoFocus","theme","height","minHeight","maxHeight","width","minWidth","maxWidth","basicSetup","placeholder","indentWithTab","editable","readOnly","root","initialState"],Gx=S.forwardRef((t,e)=>{var{className:n,value:r="",selection:i,extensions:o=[],onChange:a,onStatistics:s,onCreateEditor:l,onUpdate:c,autoFocus:u,theme:f="light",height:d,minHeight:h,maxHeight:m,width:g,minWidth:p,maxWidth:v,basicSetup:_,placeholder:w,indentWithTab:b,editable:y,readOnly:k,root:C,initialState:E}=t,A=MQ(t,Tte),N=S.useRef(null),{state:M,view:T,container:I,setContainer:L}=Mte({root:C,value:r,autoFocus:u,theme:f,height:d,minHeight:h,maxHeight:m,width:g,minWidth:p,maxWidth:v,basicSetup:_,placeholder:w,indentWithTab:b,editable:y,readOnly:k,selection:i,onChange:a,onStatistics:s,onCreateEditor:l,onUpdate:c,extensions:o,initialState:E});S.useImperativeHandle(e,()=>({editor:N.current,state:M,view:T}),[N,I,M,T]);var F=S.useCallback(W=>{N.current=W,L(W)},[L]);if(typeof r!="string")throw new Error("value must be typeof string but got "+typeof r);var V=typeof f=="string"?"cm-theme-"+f:"cm-theme";return K.jsx("div",u0({ref:F,className:""+V+(n?" "+n:"")},A))});Gx.displayName="CodeMirror";var Jx={npm_package_exports___require:"./dist/avocado-not-front.umd.js",npm_package_devDependencies__types_node:"20.2.5",npm_package_devDependencies__testing_library_jest_dom:"6.4.0",npm_config_user_agent:"pnpm/9.10.0 npm/? node/v20.17.0 linux x64",CI:"true",npm_package_devDependencies__testing_library_user_event:"14.5.2",npm_package_devDependencies_vite:"5.0.12",npm_node_execpath:"/opt/hostedtoolcache/node/20.17.0/x64/bin/node",npm_package_publishConfig_access:"public",npm_package_files_0:"dist",HOME:"/home/runner",npm_package_dependencies_react_select_async_paginate:"0.7.3",npm_package_devDependencies_classnames:"2.3.2",npm_package_devDependencies_sass:"1.62.1",npm_config_auto_install_peers:"true",npm_package_devDependencies_vite_plugin_dts:"3.7.1",npm_package_dependencies__codemirror_lang_yaml:"6.1.2",npm_package_devDependencies_typescript:"5.1.3",npm_package_peerDependencies_react_select_async_paginate:"0.7.3",npm_package_types:"./dist/index.d.ts",npm_package_devDependencies__types_react_dom:"18.0.11",npm_package_devDependencies__vitejs_plugin_react_swc:"3.5.0",npm_package_type:"module",npm_package_dependencies_zustand:"4.5.4",npm_package_module:"./dist/avocado-not-front.es.js",npm_package_devDependencies__types_testing_library__jest_dom:"6.0.0",npm_package_dependencies__foris_avocado_icons:"workspace:*",npm_config_registry:"https://registry.npmjs.org/",npm_config_node_linker:"hoisted",npm_package_dependencies__codemirror_lang_json:"6.0.1",npm_package_exports___import:"./dist/avocado-not-front.es.js",npm_package_dependencies__foris_avocado_core:"workspace:*",npm_package_dependencies_axios:"^1.8.4",npm_package_dependencies_recharts:"3.1.0",npm_config_node_gyp:"/home/runner/setup-pnpm/node_modules/.pnpm/pnpm@9.10.0/node_modules/pnpm/dist/node_modules/node-gyp/bin/node-gyp.js",PATH:"/home/runner/work/avocado/avocado/packages/avocado-not-front/node_modules/.bin:/home/runner/setup-pnpm/node_modules/.pnpm/pnpm@9.10.0/node_modules/pnpm/dist/node-gyp-bin:/home/runner/work/avocado/avocado/node_modules/.bin:/home/runner/work/avocado/avocado/node_modules/.bin:/home/runner/setup-pnpm/node_modules/.pnpm/pnpm@9.10.0/node_modules/pnpm/dist/node-gyp-bin:/home/runner/work/avocado/avocado/node_modules/.bin:/opt/hostedtoolcache/node/20.17.0/x64/bin:/home/runner/setup-pnpm/node_modules/.bin:/snap/bin:/home/runner/.local/bin:/opt/pipx_bin:/home/runner/.cargo/bin:/home/runner/.config/composer/vendor/bin:/usr/local/.ghcup/bin:/home/runner/.dotnet/tools:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin",TURBO_HASH:"d852372f73184180",npm_package_name:"@foris/avocado-not-front",npm_package_scripts_start_stubby_examples:"stubby -d src/services/stubs/stubby-examples.yml -w -s 8300 -q",NODE:"/opt/hostedtoolcache/node/20.17.0/x64/bin/node",npm_config_frozen_lockfile:"",npm_config_legacy_peer_deps:"true",LANG:"C.UTF-8",npm_package_dependencies_react_dom:"18.2.0",npm_package_main:"./dist/avocado-not-front.umd.js",npm_lifecycle_script:"tsc && vite build",npm_package_dependencies__uiw_react_codemirror:"4.23.12",SHELL:"/bin/bash",NODE_PATH:"/home/runner/setup-pnpm/node_modules/.pnpm/pnpm@9.10.0/node_modules/pnpm/bin/node_modules:/home/runner/setup-pnpm/node_modules/.pnpm/pnpm@9.10.0/node_modules/pnpm/node_modules:/home/runner/setup-pnpm/node_modules/.pnpm/pnpm@9.10.0/node_modules:/home/runner/setup-pnpm/node_modules/.pnpm/node_modules",npm_package_version:"0.21.2",npm_package_devDependencies__testing_library_react:"14.2.0",npm_package_devDependencies__types_react:"18.0.28",npm_package_devDependencies_jsdom:"24.0.0",npm_lifecycle_event:"build",npm_package_scripts_build:"tsc && vite build",npm_package_dependencies__codemirror_lang_sql:"6.8.0",npm_package_dependencies__foris_avocado_suite:"workspace:*",npm_package_dependencies_jsonpath:"1.1.1",npm_package_devDependencies__foris_tsconfig:"workspace:*",npm_package_dependencies_react_select:"5.8.0",PWD:"/home/runner/work/avocado/avocado/packages/avocado-not-front",npm_execpath:"/home/runner/setup-pnpm/node_modules/.pnpm/pnpm@9.10.0/node_modules/pnpm/bin/pnpm.cjs",npm_package_devDependencies_stubby:"^5.1.0",npm_command:"run-script",PNPM_SCRIPT_SRC_DIR:"/home/runner/work/avocado/avocado/packages/avocado-not-front",npm_package_scripts_start_stubby:"stubby -d src/services/stubs/stubby-config.yml -w -s 8200 -q",npm_package_dependencies_react:"18.2.0",npm_package_peerDependencies_react_select:"5.8.0",INIT_CWD:"/home/runner/work/avocado/avocado/packages/avocado-not-front",NODE_ENV:"production"};class _h{constructor(e,n,r,i,o,a,s,l,c,u=0,f){this.p=e,this.stack=n,this.state=r,this.reducePos=i,this.pos=o,this.score=a,this.buffer=s,this.bufferBase=l,this.curContext=c,this.lookAhead=u,this.parent=f}toString(){return`[${this.stack.filter((e,n)=>n%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,n,r=0){let i=e.parser.context;return new _h(e,[],n,r,r,0,[],0,i?new eC(i,i.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,n){this.stack.push(this.state,n,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var n;let r=e>>19,i=e&65535,{parser:o}=this.p,a=this.reducePos<this.pos-25;a&&this.setLookAhead(this.pos);let s=o.dynamicPrecedence(i);if(s&&(this.score+=s),r==0){this.pushState(o.getGoto(this.state,i,!0),this.reducePos),i<o.minRepeatTerm&&this.storeNode(i,this.reducePos,this.reducePos,a?8:4,!0),this.reduceContext(i,this.reducePos);return}let l=this.stack.length-(r-1)*3-(e&262144?6:0),c=l?this.stack[l-2]:this.p.ranges[0].from,u=this.reducePos-c;u>=2e3&&!(!((n=this.p.parser.nodeSet.types[i])===null||n===void 0)&&n.isAnonymous)&&(c==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=u):this.p.lastBigReductionSize<u&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=c,this.p.lastBigReductionSize=u));let f=l?this.stack[l-1]:0,d=this.bufferBase+this.buffer.length-f;if(i<o.minRepeatTerm||e&131072){let h=o.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(i,c,h,d+4,!0)}if(e&262144)this.state=this.stack[l];else{let h=this.stack[l-3];this.state=o.getGoto(h,i,!0)}for(;this.stack.length>l;)this.stack.pop();this.reduceContext(i,c)}storeNode(e,n,r,i=4,o=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let a=this,s=this.buffer.length;if(s==0&&a.parent&&(s=a.bufferBase-a.parent.bufferBase,a=a.parent),s>0&&a.buffer[s-4]==0&&a.buffer[s-1]>-1){if(n==r)return;if(a.buffer[s-2]>=n){a.buffer[s-2]=r;return}}}if(!o||this.pos==r)this.buffer.push(e,n,r,i);else{let a=this.buffer.length;if(a>0&&this.buffer[a-4]!=0){let s=!1;for(let l=a;l>0&&this.buffer[l-2]>r;l-=4)if(this.buffer[l-1]>=0){s=!0;break}if(s)for(;a>0&&this.buffer[a-2]>r;)this.buffer[a]=this.buffer[a-4],this.buffer[a+1]=this.buffer[a-3],this.buffer[a+2]=this.buffer[a-2],this.buffer[a+3]=this.buffer[a-1],a-=4,i>4&&(i-=4)}this.buffer[a]=e,this.buffer[a+1]=n,this.buffer[a+2]=r,this.buffer[a+3]=i}}shift(e,n,r,i){if(e&131072)this.pushState(e&65535,this.pos);else if(e&262144)this.pos=i,this.shiftContext(n,r),n<=this.p.parser.maxNode&&this.buffer.push(n,r,i,4);else{let o=e,{parser:a}=this.p;(i>this.pos||n<=a.maxNode)&&(this.pos=i,a.stateFlag(o,1)||(this.reducePos=i)),this.pushState(o,r),this.shiftContext(n,r),n<=a.maxNode&&this.buffer.push(n,r,i,4)}}apply(e,n,r,i){e&65536?this.reduce(e):this.shift(e,n,r,i)}useNode(e,n){let r=this.p.reused.length-1;(r<0||this.p.reused[r]!=e)&&(this.p.reused.push(e),r++);let i=this.pos;this.reducePos=this.pos=i+e.length,this.pushState(n,i),this.buffer.push(r,i,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,n=e.buffer.length;for(;n>0&&e.buffer[n-2]>e.reducePos;)n-=4;let r=e.buffer.slice(n),i=e.bufferBase+n;for(;e&&i==e.bufferBase;)e=e.parent;return new _h(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,r,i,this.curContext,this.lookAhead,e)}recoverByDelete(e,n){let r=e<=this.p.parser.maxNode;r&&this.storeNode(e,this.pos,n,4),this.storeNode(0,this.pos,n,r?8:4),this.pos=this.reducePos=n,this.score-=190}canShift(e){for(let n=new Nte(this);;){let r=this.p.parser.stateSlot(n.state,4)||this.p.parser.hasAction(n.state,e);if(r==0)return!1;if(!(r&65536))return!0;n.reduce(r)}}recoverByInsert(e){if(this.stack.length>=300)return[];let n=this.p.parser.nextStates(this.state);if(n.length>8||this.stack.length>=120){let i=[];for(let o=0,a;o<n.length;o+=2)(a=n[o+1])!=this.state&&this.p.parser.hasAction(a,e)&&i.push(n[o],a);if(this.stack.length<120)for(let o=0;i.length<8&&o<n.length;o+=2){let a=n[o+1];i.some((s,l)=>l&1&&s==a)||i.push(n[o],a)}n=i}let r=[];for(let i=0;i<n.length&&r.length<4;i+=2){let o=n[i+1];if(o==this.state)continue;let a=this.split();a.pushState(o,this.pos),a.storeNode(0,a.pos,a.pos,4,!0),a.shiftContext(n[i],this.pos),a.reducePos=this.pos,a.score-=200,r.push(a)}return r}forceReduce(){let{parser:e}=this.p,n=e.stateSlot(this.state,5);if(!(n&65536))return!1;if(!e.validAction(this.state,n)){let r=n>>19,i=n&65535,o=this.stack.length-r*3;if(o<0||e.getGoto(this.stack[o],i,!1)<0){let a=this.findForcedReduction();if(a==null)return!1;n=a}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(n),!0}findForcedReduction(){let{parser:e}=this.p,n=[],r=(i,o)=>{if(!n.includes(i))return n.push(i),e.allActions(i,a=>{if(!(a&393216))if(a&65536){let s=(a>>19)-o;if(s>1){let l=a&65535,c=this.stack.length-s*3;if(c>=0&&e.getGoto(this.stack[c],l,!1)>=0)return s<<19|65536|l}}else{let s=r(a,o+1);if(s!=null)return s}})};return r(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let n=0;n<this.stack.length;n+=3)if(this.stack[n]!=e.stack[n])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,n){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(n)))}reduceContext(e,n){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(n)))}emitContext(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-3)&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-4)&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(e){if(e!=this.curContext.context){let n=new eC(this.curContext.tracker,e);n.hash!=this.curContext.hash&&this.emitContext(),this.curContext=n}}setLookAhead(e){e>this.lookAhead&&(this.emitLookAhead(),this.lookAhead=e)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class eC{constructor(e,n){this.tracker=e,this.context=n,this.hash=e.strict?e.hash(n):0}}class Nte{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let n=e&65535,r=e>>19;r==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(r-1)*3;let i=this.start.p.parser.getGoto(this.stack[this.base-3],n,!0);this.state=i}}class xh{constructor(e,n,r){this.stack=e,this.pos=n,this.index=r,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,n=e.bufferBase+e.buffer.length){return new xh(e,n,n-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new xh(this.stack,this.pos,this.index)}}function Ch(t,e=Uint16Array){if(typeof t!="string")return t;let n=null;for(let r=0,i=0;r<t.length;){let o=0;for(;;){let a=t.charCodeAt(r++),s=!1;if(a==126){o=65535;break}a>=92&&a--,a>=34&&a--;let l=a-32;if(l>=46&&(l-=46,s=!0),o+=l,s)break;o*=46}n?n[i++]=o:n=new e(o)}return n}class kh{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const tC=new kh;class Ite{constructor(e,n){this.input=e,this.ranges=n,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=tC,this.rangeIndex=0,this.pos=this.chunkPos=n[0].from,this.range=n[0],this.end=n[n.length-1].to,this.readNext()}resolveOffset(e,n){let r=this.range,i=this.rangeIndex,o=this.pos+e;for(;o<r.from;){if(!i)return null;let a=this.ranges[--i];o-=r.from-a.to,r=a}for(;n<0?o>r.to:o>=r.to;){if(i==this.ranges.length-1)return null;let a=this.ranges[++i];o+=a.from-r.to,r=a}return o}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let n of this.ranges)if(n.to>e)return Math.max(e,n.from);return this.end}peek(e){let n=this.chunkOff+e,r,i;if(n>=0&&n<this.chunk.length)r=this.pos+e,i=this.chunk.charCodeAt(n);else{let o=this.resolveOffset(e,1);if(o==null)return-1;if(r=o,r>=this.chunk2Pos&&r<this.chunk2Pos+this.chunk2.length)i=this.chunk2.charCodeAt(r-this.chunk2Pos);else{let a=this.rangeIndex,s=this.range;for(;s.to<=r;)s=this.ranges[++a];this.chunk2=this.input.chunk(this.chunk2Pos=r),r+this.chunk2.length>s.to&&(this.chunk2=this.chunk2.slice(0,s.to-r)),i=this.chunk2.charCodeAt(0)}}return r>=this.token.lookAhead&&(this.token.lookAhead=r+1),i}acceptToken(e,n=0){let r=n?this.resolveOffset(n,-1):this.pos;if(r==null||r<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=e,this.token.end=r}acceptTokenTo(e,n){this.token.value=e,this.token.end=n}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:n}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=n,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),n=this.pos+e.length;this.chunk=n>this.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,n){if(n?(this.token=n,n.start=e,n.lookAhead=e+1,n.value=n.extended=-1):this.token=tC,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;e>=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e<this.chunkPos+this.chunk.length?this.chunkOff=e-this.chunkPos:(this.chunk="",this.chunkOff=0),this.readNext()}return this}read(e,n){if(e>=this.chunkPos&&n<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,n-this.chunkPos);if(e>=this.chunk2Pos&&n<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,n-this.chunk2Pos);if(e>=this.range.from&&n<=this.range.to)return this.input.read(e,n);let r="";for(let i of this.ranges){if(i.from>=n)break;i.to>e&&(r+=this.input.read(Math.max(i.from,e),Math.min(i.to,n)))}return r}}class rl{constructor(e,n){this.data=e,this.id=n}token(e,n){let{parser:r}=n.p;Lte(this.data,e,n,this.id,r.data,r.tokenPrecTable)}}rl.prototype.contextual=rl.prototype.fallback=rl.prototype.extend=!1,rl.prototype.fallback=rl.prototype.extend=!1;class Gc{constructor(e,n={}){this.token=e,this.contextual=!!n.contextual,this.fallback=!!n.fallback,this.extend=!!n.extend}}function Lte(t,e,n,r,i,o){let a=0,s=1<<r,{dialect:l}=n.p.parser;e:for(;s&t[a];){let c=t[a+1];for(let h=a+3;h<c;h+=2)if((t[h+1]&s)>0){let m=t[h];if(l.allows(m)&&(e.token.value==-1||e.token.value==m||jte(m,e.token.value,i,o))){e.acceptToken(m);break}}let u=e.next,f=0,d=t[a+2];if(e.next<0&&d>f&&t[c+d*3-3]==65535){a=t[c+d*3-1];continue e}for(;f<d;){let h=f+d>>1,m=c+h+(h<<1),g=t[m],p=t[m+1]||65536;if(u<g)d=h;else if(u>=p)f=h+1;else{a=t[m+2],e.advance();continue e}}break}}function nC(t,e,n){for(let r=e,i;(i=t[r])!=65535;r++)if(i==n)return r-e;return-1}function jte(t,e,n,r){let i=nC(n,r,e);return i<0||nC(n,r,t)<i}const tr=typeof process<"u"&&Jx&&/\bparse\b/.test(Jx.LOG);let h3=null;function rC(t,e,n){let r=t.cursor(Qt.IncludeAnonymous);for(r.moveTo(e);;)if(!(n<0?r.childBefore(e):r.childAfter(e)))for(;;){if((n<0?r.to<e:r.from>e)&&!r.type.isError)return n<0?Math.max(0,Math.min(r.to-1,e-25)):Math.min(t.length,Math.max(r.from+1,e+25));if(n<0?r.prevSibling():r.nextSibling())break;if(!r.parent())return n<0?0:t.length}}class Rte{constructor(e,n){this.fragments=e,this.nodeSet=n,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?rC(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?rC(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(e<this.nextStart)return null;for(;this.fragment&&this.safeTo<=e;)this.nextFragment();if(!this.fragment)return null;for(;;){let n=this.trees.length-1;if(n<0)return this.nextFragment(),null;let r=this.trees[n],i=this.index[n];if(i==r.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let o=r.children[i],a=this.start[n]+r.positions[i];if(a>e)return this.nextStart=a,null;if(o instanceof Nt){if(a==e){if(a<this.safeFrom)return null;let s=a+o.length;if(s<=this.safeTo){let l=o.prop(De.lookAhead);if(!l||s+l<this.fragment.to)return o}}this.index[n]++,a+o.length>=Math.max(this.safeFrom,e)&&(this.trees.push(o),this.start.push(a),this.index.push(0))}else this.index[n]++,this.nextStart=a+o.length}}}class Bte{constructor(e,n){this.stream=n,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(r=>new kh)}getActions(e){let n=0,r=null,{parser:i}=e.p,{tokenizers:o}=i,a=i.stateSlot(e.state,3),s=e.curContext?e.curContext.hash:0,l=0;for(let c=0;c<o.length;c++){if(!(1<<c&a))continue;let u=o[c],f=this.tokens[c];if(!(r&&!u.fallback)&&((u.contextual||f.start!=e.pos||f.mask!=a||f.context!=s)&&(this.updateCachedToken(f,u,e),f.mask=a,f.context=s),f.lookAhead>f.end+25&&(l=Math.max(f.lookAhead,l)),f.value!=0)){let d=n;if(f.extended>-1&&(n=this.addActions(e,f.extended,f.end,n)),n=this.addActions(e,f.value,f.end,n),!u.extend&&(r=f,n>d))break}}for(;this.actions.length>n;)this.actions.pop();return l&&e.setLookAhead(l),!r&&e.pos==this.stream.end&&(r=new kh,r.value=e.p.parser.eofTerm,r.start=r.end=e.pos,n=this.addActions(e,r.value,r.end,n)),this.mainToken=r,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let n=new kh,{pos:r,p:i}=e;return n.start=r,n.end=Math.min(r+1,i.stream.end),n.value=r==i.stream.end?i.parser.eofTerm:0,n}updateCachedToken(e,n,r){let i=this.stream.clipPos(r.pos);if(n.token(this.stream.reset(i,e),r),e.value>-1){let{parser:o}=r.p;for(let a=0;a<o.specialized.length;a++)if(o.specialized[a]==e.value){let s=o.specializers[a](this.stream.read(e.start,e.end),r);if(s>=0&&r.p.parser.dialect.allows(s>>1)){s&1?e.extended=s>>1:e.value=s>>1;break}}}else e.value=0,e.end=this.stream.clipPos(i+1)}putAction(e,n,r,i){for(let o=0;o<i;o+=3)if(this.actions[o]==e)return i;return this.actions[i++]=e,this.actions[i++]=n,this.actions[i++]=r,i}addActions(e,n,r,i){let{state:o}=e,{parser:a}=e.p,{data:s}=a;for(let l=0;l<2;l++)for(let c=a.stateSlot(o,l?2:1);;c+=3){if(s[c]==65535)if(s[c+1]==1)c=Zi(s,c+2);else{i==0&&s[c+1]==2&&(i=this.putAction(Zi(s,c+2),n,r,i));break}s[c]==n&&(i=this.putAction(Zi(s,c+1),n,r,i))}return i}}class $te{constructor(e,n,r,i){this.parser=e,this.input=n,this.ranges=i,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new Ite(n,i),this.tokens=new Bte(e,this.stream),this.topTerm=e.top[1];let{from:o}=i[0];this.stacks=[_h.start(this,e.top[0],o)],this.fragments=r.length&&this.stream.end-o>e.bufferLength*4?new Rte(r,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,n=this.minStackPos,r=this.stacks=[],i,o;if(this.bigReductionCount>300&&e.length==1){let[a]=e;for(;a.forceReduce()&&a.stack.length&&a.stack[a.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let a=0;a<e.length;a++){let s=e[a];for(;;){if(this.tokens.mainToken=null,s.pos>n)r.push(s);else{if(this.advanceStack(s,r,e))continue;{i||(i=[],o=[]),i.push(s);let l=this.tokens.getMainToken(s);o.push(l.value,l.end)}}break}}if(!r.length){let a=i&&Vte(i);if(a)return tr&&console.log("Finish with "+this.stackID(a)),this.stackToTree(a);if(this.parser.strict)throw tr&&i&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+n);this.recovering||(this.recovering=5)}if(this.recovering&&i){let a=this.stoppedAt!=null&&i[0].pos>this.stoppedAt?i[0]:this.runRecovery(i,o,r);if(a)return tr&&console.log("Force-finish "+this.stackID(a)),this.stackToTree(a.forceAll())}if(this.recovering){let a=this.recovering==1?1:this.recovering*3;if(r.length>a)for(r.sort((s,l)=>l.score-s.score);r.length>a;)r.pop();r.some(s=>s.reducePos>n)&&this.recovering--}else if(r.length>1){e:for(let a=0;a<r.length-1;a++){let s=r[a];for(let l=a+1;l<r.length;l++){let c=r[l];if(s.sameState(c)||s.buffer.length>500&&c.buffer.length>500)if((s.score-c.score||s.buffer.length-c.buffer.length)>0)r.splice(l--,1);else{r.splice(a--,1);continue e}}}r.length>12&&r.splice(12,r.length-12)}this.minStackPos=r[0].pos;for(let a=1;a<r.length;a++)r[a].pos<this.minStackPos&&(this.minStackPos=r[a].pos);return null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=e}advanceStack(e,n,r){let i=e.pos,{parser:o}=this,a=tr?this.stackID(e)+" -> ":"";if(this.stoppedAt!=null&&i>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let c=e.curContext&&e.curContext.tracker.strict,u=c?e.curContext.hash:0;for(let f=this.fragments.nodeAt(i);f;){let d=this.parser.nodeSet.types[f.type.id]==f.type?o.getGoto(e.state,f.type.id):-1;if(d>-1&&f.length&&(!c||(f.prop(De.contextHash)||0)==u))return e.useNode(f,d),tr&&console.log(a+this.stackID(e)+` (via reuse of ${o.getName(f.type.id)})`),!0;if(!(f instanceof Nt)||f.children.length==0||f.positions[0]>0)break;let h=f.children[0];if(h instanceof Nt&&f.positions[0]==0)f=h;else break}}let s=o.stateSlot(e.state,4);if(s>0)return e.reduce(s),tr&&console.log(a+this.stackID(e)+` (via always-reduce ${o.getName(s&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let l=this.tokens.getActions(e);for(let c=0;c<l.length;){let u=l[c++],f=l[c++],d=l[c++],h=c==l.length||!r,m=h?e:e.split(),g=this.tokens.mainToken;if(m.apply(u,f,g?g.start:m.pos,d),tr&&console.log(a+this.stackID(m)+` (via ${u&65536?`reduce of ${o.getName(u&65535)}`:"shift"} for ${o.getName(f)} @ ${i}${m==e?"":", split"})`),h)return!0;m.pos>i?n.push(m):r.push(m)}return!1}advanceFully(e,n){let r=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>r)return iC(e,n),!0}}runRecovery(e,n,r){let i=null,o=!1;for(let a=0;a<e.length;a++){let s=e[a],l=n[a<<1],c=n[(a<<1)+1],u=tr?this.stackID(s)+" -> ":"";if(s.deadEnd&&(o||(o=!0,s.restart(),tr&&console.log(u+this.stackID(s)+" (restarted)"),this.advanceFully(s,r))))continue;let f=s.split(),d=u;for(let h=0;f.forceReduce()&&h<10&&(tr&&console.log(d+this.stackID(f)+" (via force-reduce)"),!this.advanceFully(f,r));h++)tr&&(d=this.stackID(f)+" -> ");for(let h of s.recoverByInsert(l))tr&&console.log(u+this.stackID(h)+" (via recover-insert)"),this.advanceFully(h,r);this.stream.end>s.pos?(c==s.pos&&(c++,l=0),s.recoverByDelete(l,c),tr&&console.log(u+this.stackID(s)+` (via recover-delete ${this.parser.getName(l)})`),iC(s,r)):(!i||i.score<s.score)&&(i=s)}return i}stackToTree(e){return e.close(),Nt.build({buffer:xh.create(e),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:e.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(e){let n=(h3||(h3=new WeakMap)).get(e);return n||h3.set(e,n=String.fromCodePoint(this.nextStackID++)),n+e}}function iC(t,e){for(let n=0;n<e.length;n++){let r=e[n];if(r.pos==t.pos&&r.sameState(t)){e[n].score<t.score&&(e[n]=t);return}}e.push(t)}class Fte{constructor(e,n,r){this.source=e,this.flags=n,this.disabled=r}allows(e){return!this.disabled||this.disabled[e]==0}}const p3=t=>t;class Hte{constructor(e){this.start=e.start,this.shift=e.shift||p3,this.reduce=e.reduce||p3,this.reuse=e.reuse||p3,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}}class Ba extends zw{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let n=e.nodeNames.split(" ");this.minRepeatTerm=n.length;for(let s=0;s<e.repeatNodeCount;s++)n.push("");let r=Object.keys(e.topRules).map(s=>e.topRules[s][1]),i=[];for(let s=0;s<n.length;s++)i.push([]);function o(s,l,c){i[s].push([l,l.deserialize(String(c))])}if(e.nodeProps)for(let s of e.nodeProps){let l=s[0];typeof l=="string"&&(l=De[l]);for(let c=1;c<s.length;){let u=s[c++];if(u>=0)o(u,l,s[c++]);else{let f=s[c+-u];for(let d=-u;d>0;d--)o(s[c++],l,f);c++}}}this.nodeSet=new Cg(n.map((s,l)=>Fn.define({name:l>=this.minRepeatTerm?void 0:s,id:l,props:i[l],top:r.indexOf(l)>-1,error:l==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(l)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=Rw;let a=Ch(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let s=0;s<this.specializerSpecs.length;s++)this.specialized[s]=this.specializerSpecs[s].term;this.specializers=this.specializerSpecs.map(oC),this.states=Ch(e.states,Uint32Array),this.data=Ch(e.stateData),this.goto=Ch(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(s=>typeof s=="number"?new rl(a,s):s),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,n,r){let i=new $te(this,e,n,r);for(let o of this.wrappers)i=o(i,e,n,r);return i}getGoto(e,n,r=!1){let i=this.goto;if(n>=i[0])return-1;for(let o=i[n+1];;){let a=i[o++],s=a&1,l=i[o++];if(s&&r)return l;for(let c=o+(a>>1);o<c;o++)if(i[o]==e)return l;if(s)return-1}}hasAction(e,n){let r=this.data;for(let i=0;i<2;i++)for(let o=this.stateSlot(e,i?2:1),a;;o+=3){if((a=r[o])==65535)if(r[o+1]==1)a=r[o=Zi(r,o+2)];else{if(r[o+1]==2)return Zi(r,o+2);break}if(a==n||a==0)return Zi(r,o+1)}return 0}stateSlot(e,n){return this.states[e*6+n]}stateFlag(e,n){return(this.stateSlot(e,0)&n)>0}validAction(e,n){return!!this.allActions(e,r=>r==n?!0:null)}allActions(e,n){let r=this.stateSlot(e,4),i=r?n(r):void 0;for(let o=this.stateSlot(e,1);i==null;o+=3){if(this.data[o]==65535)if(this.data[o+1]==1)o=Zi(this.data,o+2);else break;i=n(Zi(this.data,o+1))}return i}nextStates(e){let n=[];for(let r=this.stateSlot(e,1);;r+=3){if(this.data[r]==65535)if(this.data[r+1]==1)r=Zi(this.data,r+2);else break;if(!(this.data[r+2]&1)){let i=this.data[r+1];n.some((o,a)=>a&1&&o==i)||n.push(this.data[r],i)}}return n}configure(e){let n=Object.assign(Object.create(Ba.prototype),this);if(e.props&&(n.nodeSet=this.nodeSet.extend(...e.props)),e.top){let r=this.topRules[e.top];if(!r)throw new RangeError(`Invalid top rule name ${e.top}`);n.top=r}return e.tokenizers&&(n.tokenizers=this.tokenizers.map(r=>{let i=e.tokenizers.find(o=>o.from==r);return i?i.to:r})),e.specializers&&(n.specializers=this.specializers.slice(),n.specializerSpecs=this.specializerSpecs.map((r,i)=>{let o=e.specializers.find(s=>s.from==r.external);if(!o)return r;let a=Object.assign(Object.assign({},r),{external:o.to});return n.specializers[i]=oC(a),a})),e.contextTracker&&(n.context=e.contextTracker),e.dialect&&(n.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(n.strict=e.strict),e.wrap&&(n.wrappers=n.wrappers.concat(e.wrap)),e.bufferLength!=null&&(n.bufferLength=e.bufferLength),n}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let n=this.dynamicPrecedences;return n==null?0:n[e]||0}parseDialect(e){let n=Object.keys(this.dialects),r=n.map(()=>!1);if(e)for(let o of e.split(" ")){let a=n.indexOf(o);a>=0&&(r[a]=!0)}let i=null;for(let o=0;o<n.length;o++)if(!r[o])for(let a=this.dialects[n[o]],s;(s=this.data[a++])!=65535;)(i||(i=new Uint8Array(this.maxTerm+1)))[s]=1;return new Fte(e,r,i)}static deserialize(e){return new Ba(e)}}function Zi(t,e){return t[e]|t[e+1]<<16}function Vte(t){let e=null;for(let n of t){let r=n.p.stoppedAt;(n.pos==n.p.stream.end||r!=null&&n.pos>r)&&n.p.parser.stateFlag(n.state,2)&&(!e||e.score<n.score)&&(e=n)}return e}function oC(t){if(t.external){let e=t.extend?1:0;return(n,r)=>t.external(n,r)<<1|e}return t.get}const Wte=Rc({String:B.string,Number:B.number,"True False":B.bool,PropertyName:B.propertyName,Null:B.null,", :":B.separator,"[ ]":B.squareBracket,"{ }":B.brace}),zte=Ba.deserialize({version:14,states:"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#ClOOQO'#Cr'#CrQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CtOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59W,59WO!iQPO,59WOVQPO,59QOqQPO'#CmO!nQPO,59`OOQO1G.k1G.kOVQPO'#CnO!vQPO,59aOOQO1G.r1G.rOOQO1G.l1G.lOOQO,59X,59XOOQO-E6k-E6kOOQO,59Y,59YOOQO-E6l-E6l",stateData:"#O~OeOS~OQSORSOSSOTSOWQO_ROgPO~OVXOgUO~O^[O~PVO[^O~O]_OVhX~OVaO~O]bO^iX~O^dO~O]_OVha~O]bO^ia~O",goto:"!kjPPPPPPkPPkqwPPPPk{!RPPP!XP!e!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",nodeNames:"⚠ JsonText True False Null Number String } { Object Property PropertyName : , ] [ Array",maxTerm:25,nodeProps:[["isolate",-2,6,11,""],["openedBy",7,"{",14,"["],["closedBy",8,"}",15,"]"]],propSources:[Wte],skippedNodes:[0],repeatNodeCount:2,tokenData:"(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oe~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Og~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zO]~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yO[~~'OO_~~'TO^~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",tokenizers:[0],topRules:{JsonText:[0,1]},tokenPrec:0}),Ute=Na.define({name:"json",parser:zte.configure({props:[Zd.add({Object:jg({except:/^\s*\}/}),Array:jg({except:/^\s*\]/})}),Gd.add({"Object Array":t_})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function aC(){return new Ng(Ute)}const qte=36,sC=1,Kte=2,il=3,m3=4,Qte=5,Yte=6,Xte=7,Zte=8,Gte=9,Jte=10,ene=11,tne=12,nne=13,rne=14,ine=15,one=16,ane=17,lC=18,sne=19,cC=20,uC=21,fC=22,lne=23,cne=24;function g3(t){return t>=65&&t<=90||t>=97&&t<=122||t>=48&&t<=57}function une(t){return t>=48&&t<=57||t>=97&&t<=102||t>=65&&t<=70}function $a(t,e,n){for(let r=!1;;){if(t.next<0)return;if(t.next==e&&!r){t.advance();return}r=n&&!r&&t.next==92,t.advance()}}function fne(t,e){e:for(;;){if(t.next<0)return;if(t.next==36){t.advance();for(let n=0;n<e.length;n++){if(t.next!=e.charCodeAt(n))continue e;t.advance()}if(t.next==36){t.advance();return}}else t.advance()}}function dne(t,e){let n="[{<(".indexOf(String.fromCharCode(e)),r=n<0?e:"]}>)".charCodeAt(n);for(;;){if(t.next<0)return;if(t.next==r&&t.peek(1)==39){t.advance(2);return}t.advance()}}function v3(t,e){for(;!(t.next!=95&&!g3(t.next));)e!=null&&(e+=String.fromCharCode(t.next)),t.advance();return e}function hne(t){if(t.next==39||t.next==34||t.next==96){let e=t.next;t.advance(),$a(t,e,!1)}else v3(t)}function dC(t,e){for(;t.next==48||t.next==49;)t.advance();e&&t.next==e&&t.advance()}function hC(t,e){for(;;){if(t.next==46){if(e)break;e=!0}else if(t.next<48||t.next>57)break;t.advance()}if(t.next==69||t.next==101)for(t.advance(),(t.next==43||t.next==45)&&t.advance();t.next>=48&&t.next<=57;)t.advance()}function pC(t){for(;!(t.next<0||t.next==10);)t.advance()}function Fa(t,e){for(let n=0;n<e.length;n++)if(e.charCodeAt(n)==t)return!0;return!1}const y3=` \r
|
|
590
|
+
`: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 see(this):new oee(this)}getCursor(e,n=0,r){let i=e.doc?e:Ne.create({doc:e});return r==null&&(r=i.doc.length),this.regexp?Js(this,i,n,r):Gs(this,i,n,r)}}class dx{constructor(e){this.spec=e}}function Gs(t,e,n,r){return new Ys(e.doc,t.unquoted,n,r,t.caseSensitive?void 0:i=>i.toLowerCase(),t.wholeWord?iee(e.doc,e.charCategorizer(e.selection.main.head)):void 0)}function iee(t,e){return(n,r,i,o)=>((o>n||o+i.length<r)&&(o=Math.max(0,n-2),i=t.sliceString(o,Math.min(t.length,r+2))),(e(ch(i,n-o))!=dt.Word||e(uh(i,n-o))!=dt.Word)&&(e(uh(i,r-o))!=dt.Word||e(ch(i,r-o))!=dt.Word))}class oee extends dx{constructor(e){super(e)}nextMatch(e,n,r){let i=Gs(this.spec,e,r,e.doc.length).nextOverlapping();if(i.done){let o=Math.min(e.doc.length,n+this.spec.unquoted.length);i=Gs(this.spec,e,0,o).nextOverlapping()}return i.done||i.value.from==n&&i.value.to==r?null:i.value}prevMatchInRange(e,n,r){for(let i=r;;){let o=Math.max(n,i-1e4-this.spec.unquoted.length),a=Gs(this.spec,e,o,i),s=null;for(;!a.nextOverlapping().done;)s=a.value;if(s)return s;if(o==n)return null;i-=1e4}}prevMatch(e,n,r){let i=this.prevMatchInRange(e,0,n);return i||(i=this.prevMatchInRange(e,Math.max(0,r-this.spec.unquoted.length),e.doc.length)),i&&(i.from!=n||i.to!=r)?i:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,n){let r=Gs(this.spec,e,0,e.doc.length),i=[];for(;!r.next().done;){if(i.length>=n)return null;i.push(r.value)}return i}highlight(e,n,r,i){let o=Gs(this.spec,e,Math.max(0,n-this.spec.unquoted.length),Math.min(r+this.spec.unquoted.length,e.doc.length));for(;!o.next().done;)i(o.value.from,o.value.to)}}function Js(t,e,n,r){return new sx(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:t.wholeWord?aee(e.charCategorizer(e.selection.main.head)):void 0},n,r)}function ch(t,e){return t.slice(an(t,e,!1),e)}function uh(t,e){return t.slice(e,an(t,e))}function aee(t){return(e,n,r)=>!r[0].length||(t(ch(r.input,r.index))!=dt.Word||t(uh(r.input,r.index))!=dt.Word)&&(t(uh(r.input,r.index+r[0].length))!=dt.Word||t(ch(r.input,r.index+r[0].length))!=dt.Word)}class see extends dx{nextMatch(e,n,r){let i=Js(this.spec,e,r,e.doc.length).next();return i.done&&(i=Js(this.spec,e,0,n).next()),i.done?null:i.value}prevMatchInRange(e,n,r){for(let i=1;;i++){let o=Math.max(n,r-i*1e4),a=Js(this.spec,e,o,r),s=null;for(;!a.next().done;)s=a.value;if(s&&(o==n||s.from>o+10))return s;if(o==n)return null}}prevMatch(e,n,r){return this.prevMatchInRange(e,0,n)||this.prevMatchInRange(e,r,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(n,r)=>{if(r=="&")return e.match[0];if(r=="$")return"$";for(let i=r.length;i>0;i--){let o=+r.slice(0,i);if(o>0&&o<e.match.length)return e.match[o]+r.slice(i)}return n})}matchAll(e,n){let r=Js(this.spec,e,0,e.doc.length),i=[];for(;!r.next().done;){if(i.length>=n)return null;i.push(r.value)}return i}highlight(e,n,r,i){let o=Js(this.spec,e,Math.max(0,n-250),Math.min(r+250,e.doc.length));for(;!o.next().done;)i(o.value.from,o.value.to)}}const qc=Se.define(),e3=Se.define(),Ko=sn.define({create(t){return new t3(r3(t).create(),null)},update(t,e){for(let n of e.effects)n.is(qc)?t=new t3(n.value.create(),t.panel):n.is(e3)&&(t=new t3(t.query,n.value?n3:null));return t},provide:t=>Ic.from(t,e=>e.panel)});class t3{constructor(e,n){this.query=e,this.panel=n}}const lee=ge.mark({class:"cm-searchMatch"}),cee=ge.mark({class:"cm-searchMatch cm-searchMatch-selected"}),uee=Et.fromClass(class{constructor(t){this.view=t,this.decorations=this.highlight(t.state.field(Ko))}update(t){let e=t.state.field(Ko);(e!=t.startState.field(Ko)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:t,panel:e}){if(!e||!t.spec.valid)return ge.none;let{view:n}=this,r=new zi;for(let i=0,o=n.visibleRanges,a=o.length;i<a;i++){let{from:s,to:l}=o[i];for(;i<a-1&&l>o[i+1].from-2*250;)l=o[++i].to;t.highlight(n.state,s,l,(c,u)=>{let f=n.state.selection.ranges.some(d=>d.from==c&&d.to==u);r.add(c,u,f?cee:lee)})}return r.finish()}},{decorations:t=>t.decorations});function Kc(t){return e=>{let n=e.state.field(Ko,!1);return n&&n.query.spec.valid?t(e,n):gx(e)}}const fh=Kc((t,{query:e})=>{let{to:n}=t.state.selection.main,r=e.nextMatch(t.state,n,n);if(!r)return!1;let i=Q.single(r.from,r.to),o=t.state.facet(Zs);return t.dispatch({selection:i,effects:[i3(t,r),o.scrollToMatch(i.main,t)],userEvent:"select.search"}),mx(t),!0}),dh=Kc((t,{query:e})=>{let{state:n}=t,{from:r}=n.selection.main,i=e.prevMatch(n,r,r);if(!i)return!1;let o=Q.single(i.from,i.to),a=t.state.facet(Zs);return t.dispatch({selection:o,effects:[i3(t,i),a.scrollToMatch(o.main,t)],userEvent:"select.search"}),mx(t),!0}),fee=Kc((t,{query:e})=>{let n=e.matchAll(t.state,1e3);return!n||!n.length?!1:(t.dispatch({selection:Q.create(n.map(r=>Q.range(r.from,r.to))),userEvent:"select.search.matches"}),!0)}),dee=({state:t,dispatch:e})=>{let n=t.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:r,to:i}=n.main,o=[],a=0;for(let s=new Ys(t.doc,t.sliceDoc(r,i));!s.next().done;){if(o.length>1e3)return!1;s.value.from==r&&(a=o.length),o.push(Q.range(s.value.from,s.value.to))}return e(t.update({selection:Q.create(o,a),userEvent:"select.search.matches"})),!0},hx=Kc((t,{query:e})=>{let{state:n}=t,{from:r,to:i}=n.selection.main;if(n.readOnly)return!1;let o=e.nextMatch(n,r,r);if(!o)return!1;let a=o,s=[],l,c,u=[];if(a.from==r&&a.to==i&&(c=n.toText(e.getReplacement(a)),s.push({from:a.from,to:a.to,insert:c}),a=e.nextMatch(n,a.from,a.to),u.push(ne.announce.of(n.phrase("replaced match on line $",n.doc.lineAt(r).number)+"."))),a){let f=s.length==0||s[0].from>=o.to?0:o.to-o.from-c.length;l=Q.single(a.from-f,a.to-f),u.push(i3(t,a)),u.push(n.facet(Zs).scrollToMatch(l.main,t))}return t.dispatch({changes:s,selection:l,effects:u,userEvent:"input.replace"}),!0}),hee=Kc((t,{query:e})=>{if(t.state.readOnly)return!1;let n=e.matchAll(t.state,1e9).map(i=>{let{from:o,to:a}=i;return{from:o,to:a,insert:e.getReplacement(i)}});if(!n.length)return!1;let r=t.state.phrase("replaced $ matches",n.length)+".";return t.dispatch({changes:n,effects:ne.announce.of(r),userEvent:"input.replace.all"}),!0});function n3(t){return t.state.facet(Zs).createPanel(t)}function r3(t,e){var n,r,i,o,a;let s=t.selection.main,l=s.empty||s.to>s.from+100?"":t.sliceDoc(s.from,s.to);if(e&&!l)return e;let c=t.facet(Zs);return new fx({search:((n=e==null?void 0:e.literal)!==null&&n!==void 0?n:c.literal)?l:l.replace(/\n/g,"\\n"),caseSensitive:(r=e==null?void 0:e.caseSensitive)!==null&&r!==void 0?r:c.caseSensitive,literal:(i=e==null?void 0:e.literal)!==null&&i!==void 0?i:c.literal,regexp:(o=e==null?void 0:e.regexp)!==null&&o!==void 0?o:c.regexp,wholeWord:(a=e==null?void 0:e.wholeWord)!==null&&a!==void 0?a:c.wholeWord})}function px(t){let e=Nc(t,n3);return e&&e.dom.querySelector("[main-field]")}function mx(t){let e=px(t);e&&e==t.root.activeElement&&e.select()}const gx=t=>{let e=t.state.field(Ko,!1);if(e&&e.panel){let n=px(t);if(n&&n!=t.root.activeElement){let r=r3(t.state,e.query.spec);r.valid&&t.dispatch({effects:qc.of(r)}),n.focus(),n.select()}}else t.dispatch({effects:[e3.of(!0),e?qc.of(r3(t.state,e.query.spec)):Se.appendConfig.of(vee)]});return!0},vx=t=>{let e=t.state.field(Ko,!1);if(!e||!e.panel)return!1;let n=Nc(t,n3);return n&&n.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:e3.of(!1)}),!0},pee=[{key:"Mod-f",run:gx,scope:"editor search-panel"},{key:"F3",run:fh,shift:dh,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:fh,shift:dh,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:vx,scope:"editor search-panel"},{key:"Mod-Shift-l",run:dee},{key:"Mod-Alt-g",run:UJ},{key:"Mod-d",run:ree,preventDefault:!0}];class mee{constructor(e){this.view=e;let n=this.query=e.state.field(Ko).query.spec;this.commit=this.commit.bind(this),this.searchField=it("input",{value:n.search,placeholder:Jn(e,"Find"),"aria-label":Jn(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=it("input",{value:n.replace,placeholder:Jn(e,"Replace"),"aria-label":Jn(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=it("input",{type:"checkbox",name:"case",form:"",checked:n.caseSensitive,onchange:this.commit}),this.reField=it("input",{type:"checkbox",name:"re",form:"",checked:n.regexp,onchange:this.commit}),this.wordField=it("input",{type:"checkbox",name:"word",form:"",checked:n.wholeWord,onchange:this.commit});function r(i,o,a){return it("button",{class:"cm-button",name:i,onclick:o,type:"button"},a)}this.dom=it("div",{onkeydown:i=>this.keydown(i),class:"cm-search"},[this.searchField,r("next",()=>fh(e),[Jn(e,"next")]),r("prev",()=>dh(e),[Jn(e,"previous")]),r("select",()=>fee(e),[Jn(e,"all")]),it("label",null,[this.caseField,Jn(e,"match case")]),it("label",null,[this.reField,Jn(e,"regexp")]),it("label",null,[this.wordField,Jn(e,"by word")]),...e.state.readOnly?[]:[it("br"),this.replaceField,r("replace",()=>hx(e),[Jn(e,"replace")]),r("replaceAll",()=>hee(e),[Jn(e,"replace all")])],it("button",{name:"close",onclick:()=>vx(e),"aria-label":Jn(e,"close"),type:"button"},["×"])])}commit(){let e=new fx({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:qc.of(e)}))}keydown(e){AX(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?dh:fh)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),hx(this.view))}update(e){for(let n of e.transactions)for(let r of n.effects)r.is(qc)&&!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(Zs).top}}function Jn(t,e){return t.state.phrase(e)}const hh=30,ph=/[\s\.,:;?!]/;function i3(t,{from:e,to:n}){let r=t.state.doc.lineAt(e),i=t.state.doc.lineAt(n).to,o=Math.max(r.from,e-hh),a=Math.min(i,n+hh),s=t.state.sliceDoc(o,a);if(o!=r.from){for(let l=0;l<hh;l++)if(!ph.test(s[l+1])&&ph.test(s[l])){s=s.slice(l);break}}if(a!=i){for(let l=s.length-1;l>s.length-hh;l--)if(!ph.test(s[l-1])&&ph.test(s[l])){s=s.slice(0,l);break}}return ne.announce.of(`${t.state.phrase("current match")}. ${s} ${t.state.phrase("on line")} ${r.number}.`)}const gee=ne.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"}}),vee=[Ko,Oa.low(uee),gee];class yx{constructor(e,n,r,i){this.state=e,this.pos=n,this.explicit=r,this.view=i,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let n=Yt(this.state).resolveInner(this.pos,-1);for(;n&&e.indexOf(n.name)<0;)n=n.parent;return n?{from:n.from,to:this.pos,text:this.state.sliceDoc(n.from,this.pos),type:n.type}:null}matchBefore(e){let n=this.state.doc.lineAt(this.pos),r=Math.max(n.from,this.pos-250),i=n.text.slice(r-n.from,this.pos-n.from),o=i.search(xx(e,!1));return o<0?null:{from:r+o,to:this.pos,text:i.slice(o)}}get aborted(){return this.abortListeners==null}addEventListener(e,n,r){e=="abort"&&this.abortListeners&&(this.abortListeners.push(n),r&&r.onDocChange&&(this.abortOnDocChange=!0))}}function bx(t){let e=Object.keys(t).join(""),n=/\w/.test(e);return n&&(e=e.replace(/\w/g,"")),`[${n?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function yee(t){let e=Object.create(null),n=Object.create(null);for(let{label:i}of t){e[i[0]]=!0;for(let o=1;o<i.length;o++)n[i[o]]=!0}let r=bx(e)+bx(n)+"*$";return[new RegExp("^"+r),new RegExp(r)]}function wx(t){let e=t.map(i=>typeof i=="string"?{label:i}:i),[n,r]=e.every(i=>/^\w+$/.test(i.label))?[/\w*$/,/\w+$/]:yee(e);return i=>{let o=i.matchBefore(r);return o||i.explicit?{from:o?o.from:i.pos,options:e,validFor:n}:null}}function bee(t,e){return n=>{for(let r=Yt(n.state).resolveInner(n.pos,-1);r;r=r.parent){if(t.indexOf(r.name)>-1)return null;if(r.type.isTop)break}return e(n)}}class _x{constructor(e,n,r,i){this.completion=e,this.source=n,this.match=r,this.score=i}}function La(t){return t.selection.main.from}function xx(t,e){var n;let{source:r}=t,i=e&&r[0]!="^",o=r[r.length-1]!="$";return!i&&!o?t:new RegExp(`${i?"^":""}(?:${r})${o?"$":""}`,(n=t.flags)!==null&&n!==void 0?n:t.ignoreCase?"i":"")}const Cx=fi.define();function wee(t,e,n,r){let{main:i}=t.selection,o=n-i.from,a=r-i.from;return Object.assign(Object.assign({},t.changeByRange(s=>{if(s!=i&&n!=r&&t.sliceDoc(s.from+o,s.from+a)!=t.sliceDoc(n,r))return{range:s};let l=t.toText(e);return{changes:{from:s.from+o,to:r==i.from?s.to:s.from+a,insert:l},range:Q.cursor(s.from+o+l.length)}})),{scrollIntoView:!0,userEvent:"input.complete"})}const kx=new WeakMap;function _ee(t){if(!Array.isArray(t))return t;let e=kx.get(t);return e||kx.set(t,e=wx(t)),e}const mh=Se.define(),Qc=Se.define();class xee{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let n=0;n<e.length;){let r=Rn(e,n),i=ci(r);this.chars.push(r);let o=e.slice(n,n+i),a=o.toUpperCase();this.folded.push(Rn(a==o?o.toLowerCase():a,0)),n+=i}this.astral=e.length!=this.chars.length}ret(e,n){return this.score=e,this.matched=n,this}match(e){if(this.pattern.length==0)return this.ret(-100,[]);if(e.length<this.pattern.length)return null;let{chars:n,folded:r,any:i,precise:o,byWord:a}=this;if(n.length==1){let _=Rn(e,0),w=ci(_),b=w==e.length?0:-100;if(_!=n[0])if(_==r[0])b+=-200;else return null;return this.ret(b,[0,w])}let s=e.indexOf(this.pattern);if(s==0)return this.ret(e.length==this.pattern.length?0:-100,[0,this.pattern.length]);let l=n.length,c=0;if(s<0){for(let _=0,w=Math.min(e.length,200);_<w&&c<l;){let b=Rn(e,_);(b==n[c]||b==r[c])&&(i[c++]=_),_+=ci(b)}if(c<l)return null}let u=0,f=0,d=!1,h=0,m=-1,g=-1,p=/[a-z]/.test(e),v=!0;for(let _=0,w=Math.min(e.length,200),b=0;_<w&&f<l;){let y=Rn(e,_);s<0&&(u<l&&y==n[u]&&(o[u++]=_),h<l&&(y==n[h]||y==r[h]?(h==0&&(m=_),g=_+1,h++):h=0));let k,C=y<255?y>=48&&y<=57||y>=97&&y<=122?2:y>=65&&y<=90?1:0:(k=h0(y))!=k.toLowerCase()?1:k!=k.toUpperCase()?2:0;(!_||C==1&&p||b==0&&C!=0)&&(n[f]==y||r[f]==y&&(d=!0)?a[f++]=_:a.length&&(v=!1)),b=C,_+=ci(y)}return f==l&&a[0]==0&&v?this.result(-100+(d?-200:0),a,e):h==l&&m==0?this.ret(-200-e.length+(g==e.length?0:-100),[0,g]):s>-1?this.ret(-700-e.length,[s,s+this.pattern.length]):h==l?this.ret(-900-e.length,[m,g]):f==l?this.result(-100+(d?-200:0)+-700+(v?0:-1100),a,e):n.length==2?null:this.result((i[0]?-700:0)+-200+-1100,i,e)}result(e,n,r){let i=[],o=0;for(let a of n){let s=a+(this.astral?ci(Rn(r,a)):1);o&&i[o-1]==a?i[o-1]=s:(i[o++]=a,i[o++]=s)}return this.ret(e-r.length,i)}}class Cee{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length<this.pattern.length)return null;let n=e.slice(0,this.pattern.length),r=n==this.pattern?0:n.toLowerCase()==this.folded?-200:null;return r==null?null:(this.matched=[0,n.length],this.score=r+(e.length==this.pattern.length?0:-100),this)}}const Xt=ae.define({combine(t){return di(t,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:kee,filterStrict:!1,compareCompletions:(e,n)=>e.label.localeCompare(n.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,n)=>e&&n,closeOnBlur:(e,n)=>e&&n,icons:(e,n)=>e&&n,tooltipClass:(e,n)=>r=>Sx(e(r),n(r)),optionClass:(e,n)=>r=>Sx(e(r),n(r)),addToOptions:(e,n)=>e.concat(n),filterStrict:(e,n)=>e||n})}});function Sx(t,e){return t?e?t+" "+e:t:e}function kee(t,e,n,r,i,o){let a=t.textDirection==ct.RTL,s=a,l=!1,c="top",u,f,d=e.left-i.left,h=i.right-e.right,m=r.right-r.left,g=r.bottom-r.top;if(s&&d<Math.min(m,h)?s=!1:!s&&h<Math.min(m,d)&&(s=!0),m<=(s?d:h))u=Math.max(i.top,Math.min(n.top,i.bottom-g))-e.top,f=Math.min(400,s?d:h);else{l=!0,f=Math.min(400,(a?e.right:i.right-e.left)-30);let _=i.bottom-e.bottom;_>=g||_>e.top?u=n.bottom-e.top:(c="bottom",u=e.bottom-n.top)}let p=(e.bottom-e.top)/o.offsetHeight,v=(e.right-e.left)/o.offsetWidth;return{style:`${c}: ${u/p}px; max-width: ${f/v}px`,class:"cm-completionInfo-"+(l?a?"left-narrow":"right-narrow":s?"left":"right")}}function See(t){let e=t.addToOptions.slice();return t.icons&&e.push({render(n){let r=document.createElement("div");return r.classList.add("cm-completionIcon"),n.type&&r.classList.add(...n.type.split(/\s+/g).map(i=>"cm-completionIcon-"+i)),r.setAttribute("aria-hidden","true"),r},position:20}),e.push({render(n,r,i,o){let a=document.createElement("span");a.className="cm-completionLabel";let s=n.displayLabel||n.label,l=0;for(let c=0;c<o.length;){let u=o[c++],f=o[c++];u>l&&a.appendChild(document.createTextNode(s.slice(l,u)));let d=a.appendChild(document.createElement("span"));d.appendChild(document.createTextNode(s.slice(u,f))),d.className="cm-completionMatchedText",l=f}return l<s.length&&a.appendChild(document.createTextNode(s.slice(l))),a},position:50},{render(n){if(!n.detail)return null;let r=document.createElement("span");return r.className="cm-completionDetail",r.textContent=n.detail,r},position:80}),e.sort((n,r)=>n.position-r.position).map(n=>n.render)}function o3(t,e,n){if(t<=n)return{from:0,to:t};if(e<0&&(e=0),e<=t>>1){let i=Math.floor(e/n);return{from:i*n,to:(i+1)*n}}let r=Math.floor((t-e)/n);return{from:t-(r+1)*n,to:t-r*n}}class Oee{constructor(e,n,r){this.view=e,this.stateField=n,this.applyCompletion=r,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:l=>this.placeInfo(l),key:this},this.space=null,this.currentClass="";let i=e.state.field(n),{options:o,selected:a}=i.open,s=e.state.facet(Xt);this.optionContent=See(s),this.optionClass=s.optionClass,this.tooltipClass=s.tooltipClass,this.range=o3(o.length,a,s.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",l=>{let{options:c}=e.state.field(n).open;for(let u=l.target,f;u&&u!=this.dom;u=u.parentNode)if(u.nodeName=="LI"&&(f=/-(\d+)$/.exec(u.id))&&+f[1]<c.length){this.applyCompletion(e,c[+f[1]]),l.preventDefault();return}}),this.dom.addEventListener("focusout",l=>{let c=e.state.field(this.stateField,!1);c&&c.tooltip&&e.state.facet(Xt).closeOnBlur&&l.relatedTarget!=e.contentDOM&&e.dispatch({effects:Qc.of(null)})}),this.showOptions(o,i.id)}mount(){this.updateSel()}showOptions(e,n){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,n,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var n;let r=e.state.field(this.stateField),i=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),r!=i){let{options:o,selected:a,disabled:s}=r.open;(!i.open||i.open.options!=o)&&(this.range=o3(o.length,a,e.state.facet(Xt).maxRenderedOptions),this.showOptions(o,r.id)),this.updateSel(),s!=((n=i.open)===null||n===void 0?void 0:n.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!s)}}updateTooltipClass(e){let n=this.tooltipClass(e);if(n!=this.currentClass){for(let r of this.currentClass.split(" "))r&&this.dom.classList.remove(r);for(let r of n.split(" "))r&&this.dom.classList.add(r);this.currentClass=n}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),n=e.open;if((n.selected>-1&&n.selected<this.range.from||n.selected>=this.range.to)&&(this.range=o3(n.options.length,n.selected,this.view.state.facet(Xt).maxRenderedOptions),this.showOptions(n.options,e.id)),this.updateSelectedOption(n.selected)){this.destroyInfo();let{completion:r}=n.options[n.selected],{info:i}=r;if(!i)return;let o=typeof i=="string"?document.createTextNode(i):i(r);if(!o)return;"then"in o?o.then(a=>{a&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(a,r)}).catch(a=>$n(this.view.state,a,"completion info")):this.addInfoPane(o,r)}}addInfoPane(e,n){this.destroyInfo();let r=this.info=document.createElement("div");if(r.className="cm-tooltip cm-completionInfo",e.nodeType!=null)r.appendChild(e),this.infoDestroy=null;else{let{dom:i,destroy:o}=e;r.appendChild(i),this.infoDestroy=o||null}this.dom.appendChild(r),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let n=null;for(let r=this.list.firstChild,i=this.range.from;r;r=r.nextSibling,i++)r.nodeName!="LI"||!r.id?i--:i==e?r.hasAttribute("aria-selected")||(r.setAttribute("aria-selected","true"),n=r):r.hasAttribute("aria-selected")&&r.removeAttribute("aria-selected");return n&&Eee(this.list,n),n}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let n=this.dom.getBoundingClientRect(),r=this.info.getBoundingClientRect(),i=e.getBoundingClientRect(),o=this.space;if(!o){let a=this.dom.ownerDocument.documentElement;o={left:0,top:0,right:a.clientWidth,bottom:a.clientHeight}}return i.top>Math.min(o.bottom,n.bottom)-10||i.bottom<Math.max(o.top,n.top)+10?null:this.view.state.facet(Xt).positionInfo(this.view,n,i,r,o,this.dom)}placeInfo(e){this.info&&(e?(e.style&&(this.info.style.cssText=e.style),this.info.className="cm-tooltip cm-completionInfo "+(e.class||"")):this.info.style.cssText="top: -1e6px")}createListBox(e,n,r){const i=document.createElement("ul");i.id=n,i.setAttribute("role","listbox"),i.setAttribute("aria-expanded","true"),i.setAttribute("aria-label",this.view.state.phrase("Completions")),i.addEventListener("mousedown",a=>{a.target==i&&a.preventDefault()});let o=null;for(let a=r.from;a<r.to;a++){let{completion:s,match:l}=e[a],{section:c}=s;if(c){let d=typeof c=="string"?c:c.name;if(d!=o&&(a>r.from||r.from==0))if(o=d,typeof c!="string"&&c.header)i.appendChild(c.header(c));else{let h=i.appendChild(document.createElement("completion-section"));h.textContent=d}}const u=i.appendChild(document.createElement("li"));u.id=n+"-"+a,u.setAttribute("role","option");let f=this.optionClass(s);f&&(u.className=f);for(let d of this.optionContent){let h=d(s,this.view.state,this.view,l);h&&u.appendChild(h)}}return r.from&&i.classList.add("cm-completionListIncompleteTop"),r.to<e.length&&i.classList.add("cm-completionListIncompleteBottom"),i}destroyInfo(){this.info&&(this.infoDestroy&&this.infoDestroy(),this.info.remove(),this.info=null)}destroy(){this.destroyInfo()}}function Pee(t,e){return n=>new Oee(n,t,e)}function Eee(t,e){let n=t.getBoundingClientRect(),r=e.getBoundingClientRect(),i=n.height/t.offsetHeight;r.top<n.top?t.scrollTop-=(n.top-r.top)/i:r.bottom>n.bottom&&(t.scrollTop+=(r.bottom-n.bottom)/i)}function Ox(t){return(t.boost||0)*100+(t.apply?10:0)+(t.info?5:0)+(t.type?1:0)}function Aee(t,e){let n=[],r=null,i=c=>{n.push(c);let{section:u}=c.completion;if(u){r||(r=[]);let f=typeof u=="string"?u:u.name;r.some(d=>d.name==f)||r.push(typeof u=="string"?{name:f}:u)}},o=e.facet(Xt);for(let c of t)if(c.hasResult()){let u=c.result.getMatch;if(c.result.filter===!1)for(let f of c.result.options)i(new _x(f,c.source,u?u(f):[],1e9-n.length));else{let f=e.sliceDoc(c.from,c.to),d,h=o.filterStrict?new Cee(f):new xee(f);for(let m of c.result.options)if(d=h.match(m.label)){let g=m.displayLabel?u?u(m,d.matched):[]:d.matched;i(new _x(m,c.source,g,d.score+(m.boost||0)))}}}if(r){let c=Object.create(null),u=0,f=(d,h)=>{var m,g;return((m=d.rank)!==null&&m!==void 0?m:1e9)-((g=h.rank)!==null&&g!==void 0?g:1e9)||(d.name<h.name?-1:1)};for(let d of r.sort(f))u-=1e5,c[d.name]=u;for(let d of n){let{section:h}=d.completion;h&&(d.score+=c[typeof h=="string"?h:h.name])}}let a=[],s=null,l=o.compareCompletions;for(let c of n.sort((u,f)=>f.score-u.score||l(u.completion,f.completion))){let u=c.completion;!s||s.label!=u.label||s.detail!=u.detail||s.type!=null&&u.type!=null&&s.type!=u.type||s.apply!=u.apply||s.boost!=u.boost?a.push(c):Ox(c.completion)>Ox(s)&&(a[a.length-1]=c),s=c.completion}return a}class el{constructor(e,n,r,i,o,a){this.options=e,this.attrs=n,this.tooltip=r,this.timestamp=i,this.selected=o,this.disabled=a}setSelected(e,n){return e==this.selected||e>=this.options.length?this:new el(this.options,Px(n,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,n,r,i,o,a){if(i&&!a&&e.some(c=>c.isPending))return i.setDisabled();let s=Aee(e,n);if(!s.length)return i&&e.some(c=>c.isPending)?i.setDisabled():null;let l=n.facet(Xt).selectOnOpen?0:-1;if(i&&i.selected!=l&&i.selected!=-1){let c=i.options[i.selected].completion;for(let u=0;u<s.length;u++)if(s[u].completion==c){l=u;break}}return new el(s,Px(r,l),{pos:e.reduce((c,u)=>u.hasResult()?Math.min(c,u.from):c,1e8),create:Lee,above:o.aboveCursor},i?i.timestamp:Date.now(),l,!1)}map(e){return new el(this.options,this.attrs,Object.assign(Object.assign({},this.tooltip),{pos:e.mapPos(this.tooltip.pos)}),this.timestamp,this.selected,this.disabled)}setDisabled(){return new el(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class gh{constructor(e,n,r){this.active=e,this.id=n,this.open=r}static start(){return new gh(Nee,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:n}=e,r=n.facet(Xt),o=(r.override||n.languageDataAt("autocomplete",La(n)).map(_ee)).map(l=>(this.active.find(u=>u.source==l)||new Cr(l,this.active.some(u=>u.state!=0)?1:0)).update(e,r));o.length==this.active.length&&o.every((l,c)=>l==this.active[c])&&(o=this.active);let a=this.open,s=e.effects.some(l=>l.is(a3));a&&e.docChanged&&(a=a.map(e.changes)),e.selection||o.some(l=>l.hasResult()&&e.changes.touchesRange(l.from,l.to))||!Dee(o,this.active)||s?a=el.build(o,n,this.id,a,r,s):a&&a.disabled&&!o.some(l=>l.isPending)&&(a=null),!a&&o.every(l=>!l.isPending)&&o.some(l=>l.hasResult())&&(o=o.map(l=>l.hasResult()?new Cr(l.source,0):l));for(let l of e.effects)l.is(Ax)&&(a=a&&a.setSelected(l.value,this.id));return o==this.active&&a==this.open?this:new gh(o,this.id,a)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?Mee:Tee}}function Dee(t,e){if(t==e)return!0;for(let n=0,r=0;;){for(;n<t.length&&!t[n].hasResult();)n++;for(;r<e.length&&!e[r].hasResult();)r++;let i=n==t.length,o=r==e.length;if(i||o)return i==o;if(t[n++].result!=e[r++].result)return!1}}const Mee={"aria-autocomplete":"list"},Tee={};function Px(t,e){let n={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":t};return e>-1&&(n["aria-activedescendant"]=t+"-"+e),n}const Nee=[];function Ex(t,e){if(t.isUserEvent("input.complete")){let r=t.annotation(Cx);if(r&&e.activateOnCompletion(r))return 12}let n=t.isUserEvent("input.type");return n&&e.activateOnTyping?5:n?1:t.isUserEvent("delete.backward")?2:t.selection?8:t.docChanged?16:0}class Cr{constructor(e,n,r=!1){this.source=e,this.state=n,this.explicit=r}hasResult(){return!1}get isPending(){return this.state==1}update(e,n){let r=Ex(e,n),i=this;(r&8||r&16&&this.touches(e))&&(i=new Cr(i.source,0)),r&4&&i.state==0&&(i=new Cr(this.source,1)),i=i.updateFor(e,r);for(let o of e.effects)if(o.is(mh))i=new Cr(i.source,1,o.value);else if(o.is(Qc))i=new Cr(i.source,0);else if(o.is(a3))for(let a of o.value)a.source==i.source&&(i=a);return i}updateFor(e,n){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(La(e.state))}}class tl extends Cr{constructor(e,n,r,i,o,a){super(e,3,n),this.limit=r,this.result=i,this.from=o,this.to=a}hasResult(){return!0}updateFor(e,n){var r;if(!(n&3))return this.map(e.changes);let i=this.result;i.map&&!e.changes.empty&&(i=i.map(i,e.changes));let o=e.changes.mapPos(this.from),a=e.changes.mapPos(this.to,1),s=La(e.state);if(s>a||!i||n&2&&(La(e.startState)==this.from||s<this.limit))return new Cr(this.source,n&4?1:0);let l=e.changes.mapPos(this.limit);return Iee(i.validFor,e.state,o,a)?new tl(this.source,this.explicit,l,i,o,a):i.update&&(i=i.update(i,o,a,new yx(e.state,s,!1)))?new tl(this.source,this.explicit,l,i,i.from,(r=i.to)!==null&&r!==void 0?r:La(e.state)):new Cr(this.source,1,this.explicit)}map(e){return e.empty?this:(this.result.map?this.result.map(this.result,e):this.result)?new tl(this.source,this.explicit,e.mapPos(this.limit),this.result,e.mapPos(this.from),e.mapPos(this.to,1)):new Cr(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}}function Iee(t,e,n,r){if(!t)return!1;let i=e.sliceDoc(n,r);return typeof t=="function"?t(i,n,r,e):xx(t,!0).test(i)}const a3=Se.define({map(t,e){return t.map(n=>n.map(e))}}),Ax=Se.define(),Vn=sn.define({create(){return gh.start()},update(t,e){return t.update(e)},provide:t=>[yg.from(t,e=>e.tooltip),ne.contentAttributes.from(t,e=>e.attrs)]});function s3(t,e){const n=e.completion.apply||e.completion.label;let r=t.state.field(Vn).active.find(i=>i.source==e.source);return r instanceof tl?(typeof n=="string"?t.dispatch(Object.assign(Object.assign({},wee(t.state,n,r.from,r.to)),{annotations:Cx.of(e.completion)})):n(t,e.completion,r.from,r.to),!0):!1}const Lee=Pee(Vn,s3);function vh(t,e="option"){return n=>{let r=n.state.field(Vn,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp<n.state.facet(Xt).interactionDelay)return!1;let i=1,o;e=="page"&&(o=Pw(n,r.open.tooltip))&&(i=Math.max(2,Math.floor(o.dom.offsetHeight/o.dom.querySelector("li").offsetHeight)-1));let{length:a}=r.open.options,s=r.open.selected>-1?r.open.selected+i*(t?1:-1):t?0:a-1;return s<0?s=e=="page"?0:a-1:s>=a&&(s=e=="page"?a-1:0),n.dispatch({effects:Ax.of(s)}),!0}}const jee=t=>{let e=t.state.field(Vn,!1);return t.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestamp<t.state.facet(Xt).interactionDelay?!1:s3(t,e.open.options[e.open.selected])},Dx=t=>t.state.field(Vn,!1)?(t.dispatch({effects:mh.of(!0)}),!0):!1,Ree=t=>{let e=t.state.field(Vn,!1);return!e||!e.active.some(n=>n.state!=0)?!1:(t.dispatch({effects:Qc.of(null)}),!0)};class Bee{constructor(e,n){this.active=e,this.context=n,this.time=Date.now(),this.updates=[],this.done=void 0}}const $ee=50,Fee=1e3,Hee=Et.fromClass(class{constructor(t){this.view=t,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let e of t.state.field(Vn).active)e.isPending&&this.startQuery(e)}update(t){let e=t.state.field(Vn),n=t.state.facet(Xt);if(!t.selectionSet&&!t.docChanged&&t.startState.field(Vn)==e)return;let r=t.transactions.some(o=>{let a=Ex(o,n);return a&8||(o.selection||o.docChanged)&&!(a&3)});for(let o=0;o<this.running.length;o++){let a=this.running[o];if(r||a.context.abortOnDocChange&&t.docChanged||a.updates.length+t.transactions.length>$ee&&Date.now()-a.time>Fee){for(let s of a.context.abortListeners)try{s()}catch(l){$n(this.view.state,l)}a.context.abortListeners=null,this.running.splice(o--,1)}else a.updates.push(...t.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),t.transactions.some(o=>o.effects.some(a=>a.is(mh)))&&(this.pendingStart=!0);let i=this.pendingStart?50:n.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(o=>o.isPending&&!this.running.some(a=>a.active.source==o.source))?setTimeout(()=>this.startUpdate(),i):-1,this.composing!=0)for(let o of t.transactions)o.isUserEvent("input.type")?this.composing=2:this.composing==2&&o.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:t}=this.view,e=t.field(Vn);for(let n of e.active)n.isPending&&!this.running.some(r=>r.active.source==n.source)&&this.startQuery(n);this.running.length&&e.open&&e.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Xt).updateSyncTime))}startQuery(t){let{state:e}=this.view,n=La(e),r=new yx(e,n,t.explicit,this.view),i=new Bee(t,r);this.running.push(i),Promise.resolve(t.source(r)).then(o=>{i.context.aborted||(i.done=o||null,this.scheduleAccept())},o=>{this.view.dispatch({effects:Qc.of(null)}),$n(this.view.state,o)})}scheduleAccept(){this.running.every(t=>t.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Xt).updateSyncTime))}accept(){var t;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],n=this.view.state.facet(Xt),r=this.view.state.field(Vn);for(let i=0;i<this.running.length;i++){let o=this.running[i];if(o.done===void 0)continue;if(this.running.splice(i--,1),o.done){let s=La(o.updates.length?o.updates[0].startState:this.view.state),l=Math.min(s,o.done.from+(o.active.explicit?0:1)),c=new tl(o.active.source,o.active.explicit,l,o.done,o.done.from,(t=o.done.to)!==null&&t!==void 0?t:s);for(let u of o.updates)c=c.update(u,n);if(c.hasResult()){e.push(c);continue}}let a=r.active.find(s=>s.source==o.active.source);if(a&&a.isPending)if(o.done==null){let s=new Cr(o.active.source,0);for(let l of o.updates)s=s.update(l,n);s.isPending||e.push(s)}else this.startQuery(a)}(e.length||r.open&&r.open.disabled)&&this.view.dispatch({effects:a3.of(e)})}},{eventHandlers:{blur(t){let e=this.view.state.field(Vn,!1);if(e&&e.tooltip&&this.view.state.facet(Xt).closeOnBlur){let n=e.open&&Pw(this.view,e.open.tooltip);(!n||!n.dom.contains(t.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:Qc.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:mh.of(!1)}),20),this.composing=0}}}),Vee=typeof navigator=="object"&&/Win/.test(navigator.platform),Wee=Oa.highest(ne.domEventHandlers({keydown(t,e){let n=e.state.field(Vn,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||t.key.length>1||t.ctrlKey&&!(Vee&&t.altKey)||t.metaKey)return!1;let r=n.open.options[n.open.selected],i=n.active.find(a=>a.source==r.source),o=r.completion.commitCharacters||i.result.commitCharacters;return o&&o.indexOf(t.key)>-1&&s3(e,r),!1}})),zee=ne.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}}),Yc={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},ja=Se.define({map(t,e){let n=e.mapPos(t,-1,Pn.TrackAfter);return n??void 0}}),l3=new class extends Pa{};l3.startSide=1,l3.endSide=-1;const Mx=sn.define({create(){return Be.empty},update(t,e){if(t=t.map(e.changes),e.selection){let n=e.state.doc.lineAt(e.selection.main.head);t=t.update({filter:r=>r>=n.from&&r<=n.to})}for(let n of e.effects)n.is(ja)&&(t=t.update({add:[l3.range(n.value,n.value+1)]}));return t}});function Uee(){return[Kee,Mx]}const c3="()[]{}<>«»»«[]{}";function Tx(t){for(let e=0;e<c3.length;e+=2)if(c3.charCodeAt(e)==t)return c3.charAt(e+1);return h0(t<128?t:t+1)}function Nx(t,e){return t.languageDataAt("closeBrackets",e)[0]||Yc}const qee=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),Kee=ne.inputHandler.of((t,e,n,r)=>{if((qee?t.composing:t.compositionStarted)||t.state.readOnly)return!1;let i=t.state.selection.main;if(r.length>2||r.length==2&&ci(Rn(r,0))==1||e!=i.from||n!=i.to)return!1;let o=Yee(t.state,r);return o?(t.dispatch(o),!0):!1}),Qee=[{key:"Backspace",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let r=Nx(t,t.selection.main.head).brackets||Yc.brackets,i=null,o=t.changeByRange(a=>{if(a.empty){let s=Xee(t.doc,a.head);for(let l of r)if(l==s&&yh(t.doc,a.head)==Tx(Rn(l,0)))return{changes:{from:a.head-l.length,to:a.head+l.length},range:Q.cursor(a.head-l.length)}}return{range:i=a}});return i||e(t.update(o,{scrollIntoView:!0,userEvent:"delete.backward"})),!i}}];function Yee(t,e){let n=Nx(t,t.selection.main.head),r=n.brackets||Yc.brackets;for(let i of r){let o=Tx(Rn(i,0));if(e==i)return o==i?Jee(t,i,r.indexOf(i+i+i)>-1,n):Zee(t,i,o,n.before||Yc.before);if(e==o&&Ix(t,t.selection.main.from))return Gee(t,i,o)}return null}function Ix(t,e){let n=!1;return t.field(Mx).between(0,t.doc.length,r=>{r==e&&(n=!0)}),n}function yh(t,e){let n=t.sliceString(e,e+2);return n.slice(0,ci(Rn(n,0)))}function Xee(t,e){let n=t.sliceString(e-2,e);return ci(Rn(n,0))==n.length?n:n.slice(1)}function Zee(t,e,n,r){let i=null,o=t.changeByRange(a=>{if(!a.empty)return{changes:[{insert:e,from:a.from},{insert:n,from:a.to}],effects:ja.of(a.to+e.length),range:Q.range(a.anchor+e.length,a.head+e.length)};let s=yh(t.doc,a.head);return!s||/\s/.test(s)||r.indexOf(s)>-1?{changes:{insert:e+n,from:a.head},effects:ja.of(a.head+e.length),range:Q.cursor(a.head+e.length)}:{range:i=a}});return i?null:t.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function Gee(t,e,n){let r=null,i=t.changeByRange(o=>o.empty&&yh(t.doc,o.head)==n?{changes:{from:o.head,to:o.head+n.length,insert:n},range:Q.cursor(o.head+n.length)}:r={range:o});return r?null:t.update(i,{scrollIntoView:!0,userEvent:"input.type"})}function Jee(t,e,n,r){let i=r.stringPrefixes||Yc.stringPrefixes,o=null,a=t.changeByRange(s=>{if(!s.empty)return{changes:[{insert:e,from:s.from},{insert:e,from:s.to}],effects:ja.of(s.to+e.length),range:Q.range(s.anchor+e.length,s.head+e.length)};let l=s.head,c=yh(t.doc,l),u;if(c==e){if(Lx(t,l))return{changes:{insert:e+e,from:l},effects:ja.of(l+e.length),range:Q.cursor(l+e.length)};if(Ix(t,l)){let d=n&&t.sliceDoc(l,l+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:l,to:l+d.length,insert:d},range:Q.cursor(l+d.length)}}}else{if(n&&t.sliceDoc(l-2*e.length,l)==e+e&&(u=jx(t,l-2*e.length,i))>-1&&Lx(t,u))return{changes:{insert:e+e+e+e,from:l},effects:ja.of(l+e.length),range:Q.cursor(l+e.length)};if(t.charCategorizer(l)(c)!=dt.Word&&jx(t,l,i)>-1&&!ete(t,l,e,i))return{changes:{insert:e+e,from:l},effects:ja.of(l+e.length),range:Q.cursor(l+e.length)}}return{range:o=s}});return o?null:t.update(a,{scrollIntoView:!0,userEvent:"input.type"})}function Lx(t,e){let n=Yt(t).resolveInner(e+1);return n.parent&&n.from==e}function ete(t,e,n,r){let i=Yt(t).resolveInner(e,-1),o=r.reduce((a,s)=>Math.max(a,s.length),0);for(let a=0;a<5;a++){let s=t.sliceDoc(i.from,Math.min(i.to,i.from+n.length+o)),l=s.indexOf(n);if(!l||l>-1&&r.indexOf(s.slice(0,l))>-1){let u=i.firstChild;for(;u&&u.from==i.from&&u.to-u.from>n.length+l;){if(t.sliceDoc(u.to-n.length,u.to)==n)return!1;u=u.firstChild}return!0}let c=i.to==e&&i.parent;if(!c)break;i=c}return!1}function jx(t,e,n){let r=t.charCategorizer(e);if(r(t.sliceDoc(e-1,e))!=dt.Word)return e;for(let i of n){let o=e-i.length;if(t.sliceDoc(o,e)==i&&r(t.sliceDoc(o-1,o))!=dt.Word)return o}return-1}function tte(t={}){return[Wee,Vn,Xt.of(t),Hee,nte,zee]}const Rx=[{key:"Ctrl-Space",run:Dx},{mac:"Alt-`",run:Dx},{key:"Escape",run:Ree},{key:"ArrowDown",run:vh(!0)},{key:"ArrowUp",run:vh(!1)},{key:"PageDown",run:vh(!0,"page")},{key:"PageUp",run:vh(!1,"page")},{key:"Enter",run:jee}],nte=Oa.highest(Md.computeN([Xt],t=>t.facet(Xt).defaultKeymap?[Rx]:[]));class Bx{constructor(e,n,r){this.from=e,this.to=n,this.diagnostic=r}}class Ra{constructor(e,n,r){this.diagnostics=e,this.panel=n,this.selected=r}static init(e,n,r){let i=r.facet(Xc).markerFilter;i&&(e=i(e,r));let o=e.slice().sort((u,f)=>u.from-f.from||u.to-f.to),a=new zi,s=[],l=0;for(let u=0;;){let f=u==o.length?null:o[u];if(!f&&!s.length)break;let d,h;for(s.length?(d=l,h=s.reduce((g,p)=>Math.min(g,p.to),f&&f.from>d?f.from:1e8)):(d=f.from,h=f.to,s.push(f),u++);u<o.length;){let g=o[u];if(g.from==d&&(g.to>g.from||g.to==d))s.push(g),u++,h=Math.min(g.to,h);else{h=Math.min(g.from,h);break}}let m=pte(s);if(s.some(g=>g.from==g.to||g.from==g.to-1&&r.doc.lineAt(g.from).to==g.from))a.add(d,d,ge.widget({widget:new ute(m),diagnostics:s.slice()}));else{let g=s.reduce((p,v)=>v.markClass?p+" "+v.markClass:p,"");a.add(d,h,ge.mark({class:"cm-lintRange cm-lintRange-"+m+g,diagnostics:s.slice(),inclusiveEnd:s.some(p=>p.to>h)}))}l=h;for(let g=0;g<s.length;g++)s[g].to<=l&&s.splice(g--,1)}let c=a.finish();return new Ra(c,n,nl(c))}}function nl(t,e=null,n=0){let r=null;return t.between(n,1e9,(i,o,{spec:a})=>{if(!(e&&a.diagnostics.indexOf(e)<0))if(!r)r=new Bx(i,o,e||a.diagnostics[0]);else{if(a.diagnostics.indexOf(r.diagnostic)<0)return!1;r=new Bx(r.from,o,r.diagnostic)}}),r}function rte(t,e){let n=e.pos,r=e.end||n,i=t.state.facet(Xc).hideOn(t,n,r);if(i!=null)return i;let o=t.startState.doc.lineAt(e.pos);return!!(t.effects.some(a=>a.is($x))||t.changes.touchesRange(o.from,Math.max(o.to,r)))}function ite(t,e){return t.field(er,!1)?e:e.concat(Se.appendConfig.of(mte))}const $x=Se.define(),u3=Se.define(),Fx=Se.define(),er=sn.define({create(){return new Ra(ge.none,null,null)},update(t,e){if(e.docChanged&&t.diagnostics.size){let n=t.diagnostics.map(e.changes),r=null,i=t.panel;if(t.selected){let o=e.changes.mapPos(t.selected.from,1);r=nl(n,t.selected.diagnostic,o)||nl(n,null,o)}!n.size&&i&&e.state.facet(Xc).autoPanel&&(i=null),t=new Ra(n,i,r)}for(let n of e.effects)if(n.is($x)){let r=e.state.facet(Xc).autoPanel?n.value.length?Zc.open:null:t.panel;t=Ra.init(n.value,r,e.state)}else n.is(u3)?t=new Ra(t.diagnostics,n.value?Zc.open:null,t.selected):n.is(Fx)&&(t=new Ra(t.diagnostics,t.panel,n.value));return t},provide:t=>[Ic.from(t,e=>e.panel),ne.decorations.from(t,e=>e.diagnostics)]}),ote=ge.mark({class:"cm-lintRange cm-lintRange-active"});function ate(t,e,n){let{diagnostics:r}=t.state.field(er),i,o=-1,a=-1;r.between(e-(n<0?1:0),e+(n>0?1:0),(l,c,{spec:u})=>{if(e>=l&&e<=c&&(l==c||(e>l||n>0)&&(e<c||n<0)))return i=u.diagnostics,o=l,a=c,!1});let s=t.state.facet(Xc).tooltipFilter;return i&&s&&(i=s(i,t.state)),i?{pos:o,end:a,above:t.state.doc.lineAt(o).to<a,create(){return{dom:ste(t,i)}}}:null}function ste(t,e){return it("ul",{class:"cm-tooltip-lint"},e.map(n=>Wx(t,n,!1)))}const lte=t=>{let e=t.state.field(er,!1);(!e||!e.panel)&&t.dispatch({effects:ite(t.state,[u3.of(!0)])});let n=Nc(t,Zc.open);return n&&n.dom.querySelector(".cm-panel-lint ul").focus(),!0},Hx=t=>{let e=t.state.field(er,!1);return!e||!e.panel?!1:(t.dispatch({effects:u3.of(!1)}),!0)},cte=[{key:"Mod-Shift-m",run:lte,preventDefault:!0},{key:"F8",run:t=>{let e=t.state.field(er,!1);if(!e)return!1;let n=t.state.selection.main,r=e.diagnostics.iter(n.to+1);return!r.value&&(r=e.diagnostics.iter(0),!r.value||r.from==n.from&&r.to==n.to)?!1:(t.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0}),!0)}}],Xc=ae.define({combine(t){return Object.assign({sources:t.map(e=>e.source).filter(e=>e!=null)},di(t.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{needsRefresh:(e,n)=>e?n?r=>e(r)||n(r):e:n}))}});function Vx(t){let e=[];if(t)e:for(let{name:n}of t){for(let r=0;r<n.length;r++){let i=n[r];if(/[a-zA-Z]/.test(i)&&!e.some(o=>o.toLowerCase()==i.toLowerCase())){e.push(i);continue e}}e.push("")}return e}function Wx(t,e,n){var r;let i=n?Vx(e.actions):[];return it("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},it("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage(t):e.message),(r=e.actions)===null||r===void 0?void 0:r.map((o,a)=>{let s=!1,l=d=>{if(d.preventDefault(),s)return;s=!0;let h=nl(t.state.field(er).diagnostics,e);h&&o.apply(t,h.from,h.to)},{name:c}=o,u=i[a]?c.indexOf(i[a]):-1,f=u<0?c:[c.slice(0,u),it("u",c.slice(u,u+1)),c.slice(u+1)];return it("button",{type:"button",class:"cm-diagnosticAction",onclick:l,onmousedown:l,"aria-label":` Action: ${c}${u<0?"":` (access key "${i[a]})"`}.`},f)}),e.source&&it("div",{class:"cm-diagnosticSource"},e.source))}class ute extends qi{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return it("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class zx{constructor(e,n){this.diagnostic=n,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=Wx(e,n,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class Zc{constructor(e){this.view=e,this.items=[];let n=i=>{if(i.keyCode==27)Hx(this.view),this.view.focus();else if(i.keyCode==38||i.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(i.keyCode==40||i.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(i.keyCode==36)this.moveSelection(0);else if(i.keyCode==35)this.moveSelection(this.items.length-1);else if(i.keyCode==13)this.view.focus();else if(i.keyCode>=65&&i.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:o}=this.items[this.selectedIndex],a=Vx(o.actions);for(let s=0;s<a.length;s++)if(a[s].toUpperCase().charCodeAt(0)==i.keyCode){let l=nl(this.view.state.field(er).diagnostics,o);l&&o.actions[s].apply(e,l.from,l.to)}}else return;i.preventDefault()},r=i=>{for(let o=0;o<this.items.length;o++)this.items[o].dom.contains(i.target)&&this.moveSelection(o)};this.list=it("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:n,onclick:r}),this.dom=it("div",{class:"cm-panel-lint"},this.list,it("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>Hx(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(er).selected;if(!e)return-1;for(let n=0;n<this.items.length;n++)if(this.items[n].diagnostic==e.diagnostic)return n;return-1}update(){let{diagnostics:e,selected:n}=this.view.state.field(er),r=0,i=!1,o=null,a=new Set;for(e.between(0,this.view.state.doc.length,(s,l,{spec:c})=>{for(let u of c.diagnostics){if(a.has(u))continue;a.add(u);let f=-1,d;for(let h=r;h<this.items.length;h++)if(this.items[h].diagnostic==u){f=h;break}f<0?(d=new zx(this.view,u),this.items.splice(r,0,d),i=!0):(d=this.items[f],f>r&&(this.items.splice(r,f-r),i=!0)),n&&d.diagnostic==n.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<this.items.length&&!(this.items.length==1&&this.items[0].diagnostic.from<0);)i=!0,this.items.pop();this.items.length==0&&(this.items.push(new zx(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),i=!0),o?(this.list.setAttribute("aria-activedescendant",o.id),this.view.requestMeasure({key:this,read:()=>({sel:o.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:s,panel:l})=>{let c=l.height/this.list.offsetHeight;s.top<l.top?this.list.scrollTop-=(l.top-s.top)/c:s.bottom>l.bottom&&(this.list.scrollTop+=(s.bottom-l.bottom)/c)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),i&&this.sync()}sync(){let e=this.list.firstChild;function n(){let r=e;e=r.nextSibling,r.remove()}for(let r of this.items)if(r.dom.parentNode==this.list){for(;e!=r.dom;)n();e=r.dom.nextSibling}else this.list.insertBefore(r.dom,e);for(;e;)n()}moveSelection(e){if(this.selectedIndex<0)return;let n=this.view.state.field(er),r=nl(n.diagnostics,this.items[e].diagnostic);r&&this.view.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0,effects:Fx.of(r)})}static open(e){return new Zc(e)}}function fte(t,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${e}>${encodeURIComponent(t)}</svg>')`}function bh(t){return fte(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${t}" fill="none" stroke-width=".7"/>`,'width="6" height="3"')}const dte=ne.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:bh("#d11")},".cm-lintRange-warning":{backgroundImage:bh("orange")},".cm-lintRange-info":{backgroundImage:bh("#999")},".cm-lintRange-hint":{backgroundImage:bh("#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 hte(t){return t=="error"?4:t=="warning"?3:t=="info"?2:1}function pte(t){let e="hint",n=1;for(let r of t){let i=hte(r.severity);i>n&&(n=i,e=r.severity)}return e}const mte=[er,ne.decorations.compute([er],t=>{let{selected:e,panel:n}=t.field(er);return!e||!n||e.from==e.to?ge.none:ge.set([ote.range(e.from,e.to)])}),vZ(ate,{hideOn:rte}),dte];var Ux=function(e){e===void 0&&(e={});var{crosshairCursor:n=!1}=e,r=[];e.closeBracketsKeymap!==!1&&(r=r.concat(Qee)),e.defaultKeymap!==!1&&(r=r.concat(VJ)),e.searchKeymap!==!1&&(r=r.concat(pee)),e.historyKeymap!==!1&&(r=r.concat(ZG)),e.foldKeymap!==!1&&(r=r.concat(dG)),e.completionKeymap!==!1&&(r=r.concat(Rx)),e.lintKeymap!==!1&&(r=r.concat(cte));var i=[];return e.lineNumbers!==!1&&i.push(EZ()),e.highlightActiveLineGutter!==!1&&i.push(MZ()),e.highlightSpecialChars!==!1&&i.push(qX()),e.history!==!1&&i.push(VG()),e.foldGutter!==!1&&i.push(gG()),e.drawSelection!==!1&&i.push(LX()),e.dropCursor!==!1&&i.push(FX()),e.allowMultipleSelections!==!1&&i.push(Ne.allowMultipleSelections.of(!0)),e.indentOnInput!==!1&&i.push(oG()),e.syntaxHighlighting!==!1&&i.push(f_(wG,{fallback:!0})),e.bracketMatching!==!1&&i.push(OG()),e.closeBrackets!==!1&&i.push(Uee()),e.autocompletion!==!1&&i.push(tte()),e.rectangularSelection!==!1&&i.push(aZ()),n!==!1&&i.push(cZ()),e.highlightActiveLine!==!1&&i.push(GX()),e.highlightSelectionMatches!==!1&&i.push(YJ()),e.tabSize&&typeof e.tabSize=="number"&&i.push(Qd.of(" ".repeat(e.tabSize))),i.concat([Md.of(r.flat())]).filter(Boolean)};const gte="#e5c07b",qx="#e06c75",vte="#56b6c2",yte="#ffffff",wh="#abb2bf",f3="#7d8799",bte="#61afef",wte="#98c379",Kx="#d19a66",_te="#c678dd",xte="#21252b",Qx="#2c313a",Yx="#282c34",d3="#353a42",Cte="#3E4451",Xx="#528bff",kte=ne.theme({"&":{color:wh,backgroundColor:Yx},".cm-content":{caretColor:Xx},".cm-cursor, .cm-dropCursor":{borderLeftColor:Xx},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:Cte},".cm-panels":{backgroundColor:xte,color:wh},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:"1px solid #457dff"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff2f"},".cm-activeLine":{backgroundColor:"#6699ff0b"},".cm-selectionMatch":{backgroundColor:"#aafe661a"},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bad0f847"},".cm-gutters":{backgroundColor:Yx,color:f3,border:"none"},".cm-activeLineGutter":{backgroundColor:Qx},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:d3},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:d3,borderBottomColor:d3},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:Qx,color:wh}}},{dark:!0}),Ste=Vc.define([{tag:B.keyword,color:_te},{tag:[B.name,B.deleted,B.character,B.propertyName,B.macroName],color:qx},{tag:[B.function(B.variableName),B.labelName],color:bte},{tag:[B.color,B.constant(B.name),B.standard(B.name)],color:Kx},{tag:[B.definition(B.name),B.separator],color:wh},{tag:[B.typeName,B.className,B.number,B.changed,B.annotation,B.modifier,B.self,B.namespace],color:gte},{tag:[B.operator,B.operatorKeyword,B.url,B.escape,B.regexp,B.link,B.special(B.string)],color:vte},{tag:[B.meta,B.comment],color:f3},{tag:B.strong,fontWeight:"bold"},{tag:B.emphasis,fontStyle:"italic"},{tag:B.strikethrough,textDecoration:"line-through"},{tag:B.link,color:f3,textDecoration:"underline"},{tag:B.heading,fontWeight:"bold",color:qx},{tag:[B.atom,B.bool,B.special(B.variableName)],color:Kx},{tag:[B.processingInstruction,B.string,B.inserted],color:wte},{tag:B.invalid,color:yte}]),Ote=[kte,f_(Ste)];var Pte=ne.theme({"&":{backgroundColor:"#fff"}},{dark:!1}),Ete=function(e){e===void 0&&(e={});var{indentWithTab:n=!0,editable:r=!0,readOnly:i=!1,theme:o="light",placeholder:a="",basicSetup:s=!0}=e,l=[];switch(n&&l.unshift(Md.of([WJ])),s&&(typeof s=="boolean"?l.unshift(Ux()):l.unshift(Ux(s))),a&&l.unshift(nZ(a)),o){case"light":l.push(Pte);break;case"dark":l.push(Ote);break;case"none":break;default:l.push(o);break}return r===!1&&l.push(ne.editable.of(!1)),i&&l.push(Ne.readOnly.of(!0)),[...l]},Ate=t=>({line:t.state.doc.lineAt(t.state.selection.main.from),lineCount:t.state.doc.lines,lineBreak:t.state.lineBreak,length:t.state.doc.length,readOnly:t.state.readOnly,tabSize:t.state.tabSize,selection:t.state.selection,selectionAsSingle:t.state.selection.asSingle().main,ranges:t.state.selection.ranges,selectionCode:t.state.sliceDoc(t.state.selection.main.from,t.state.selection.main.to),selections:t.state.selection.ranges.map(e=>t.state.sliceDoc(e.from,e.to)),selectedText:t.state.selection.ranges.some(e=>!e.empty)}),Zx=fi.define(),Dte=[];function Mte(t){var{value:e,selection:n,onChange:r,onStatistics:i,onCreateEditor:o,onUpdate:a,extensions:s=Dte,autoFocus:l,theme:c="light",height:u=null,minHeight:f=null,maxHeight:d=null,width:h=null,minWidth:m=null,maxWidth:g=null,placeholder:p="",editable:v=!0,readOnly:_=!1,indentWithTab:w=!0,basicSetup:b=!0,root:y,initialState:k}=t,[C,E]=S.useState(),[A,N]=S.useState(),[M,T]=S.useState(),I=ne.theme({"&":{height:u,minHeight:f,maxHeight:d,width:h,minWidth:m,maxWidth:g},"& .cm-scroller":{height:"100% !important"}}),L=ne.updateListener.of(W=>{if(W.docChanged&&typeof r=="function"&&!W.transactions.some(pe=>pe.annotation(Zx))){var X=W.state.doc,J=X.toString();r(J,W)}i&&i(Ate(W))}),F=Ete({theme:c,editable:v,readOnly:_,placeholder:p,indentWithTab:w,basicSetup:b}),V=[L,I,...F];return a&&typeof a=="function"&&V.push(ne.updateListener.of(a)),V=V.concat(s),S.useLayoutEffect(()=>{if(C&&!M){var W={doc:e,selection:n,extensions:V},X=k?Ne.fromJSON(k.json,W,k.fields):Ne.create(W);if(T(X),!A){var J=new ne({state:X,parent:C,root:y});N(J),o&&o(J,X)}}return()=>{A&&(T(void 0),N(void 0))}},[C,M]),S.useEffect(()=>{t.container&&E(t.container)},[t.container]),S.useEffect(()=>()=>{A&&(A.destroy(),N(void 0))},[A]),S.useEffect(()=>{l&&A&&A.focus()},[l,A]),S.useEffect(()=>{A&&A.dispatch({effects:Se.reconfigure.of(V)})},[c,s,u,f,d,h,m,g,p,v,_,w,b,r,a]),S.useEffect(()=>{if(e!==void 0){var W=A?A.state.doc.toString():"";A&&e!==W&&A.dispatch({changes:{from:0,to:W.length,insert:e||""},annotations:[Zx.of(!0)]})}},[e,A]),{state:M,setState:T,view:A,setView:N,container:C,setContainer:E}}var Tte=["className","value","selection","extensions","onChange","onStatistics","onCreateEditor","onUpdate","autoFocus","theme","height","minHeight","maxHeight","width","minWidth","maxWidth","basicSetup","placeholder","indentWithTab","editable","readOnly","root","initialState"],Gx=S.forwardRef((t,e)=>{var{className:n,value:r="",selection:i,extensions:o=[],onChange:a,onStatistics:s,onCreateEditor:l,onUpdate:c,autoFocus:u,theme:f="light",height:d,minHeight:h,maxHeight:m,width:g,minWidth:p,maxWidth:v,basicSetup:_,placeholder:w,indentWithTab:b,editable:y,readOnly:k,root:C,initialState:E}=t,A=MQ(t,Tte),N=S.useRef(null),{state:M,view:T,container:I,setContainer:L}=Mte({root:C,value:r,autoFocus:u,theme:f,height:d,minHeight:h,maxHeight:m,width:g,minWidth:p,maxWidth:v,basicSetup:_,placeholder:w,indentWithTab:b,editable:y,readOnly:k,selection:i,onChange:a,onStatistics:s,onCreateEditor:l,onUpdate:c,extensions:o,initialState:E});S.useImperativeHandle(e,()=>({editor:N.current,state:M,view:T}),[N,I,M,T]);var F=S.useCallback(W=>{N.current=W,L(W)},[L]);if(typeof r!="string")throw new Error("value must be typeof string but got "+typeof r);var V=typeof f=="string"?"cm-theme-"+f:"cm-theme";return K.jsx("div",u0({ref:F,className:""+V+(n?" "+n:"")},A))});Gx.displayName="CodeMirror";var Jx={npm_package_exports___require:"./dist/avocado-not-front.umd.js",npm_package_devDependencies__types_node:"20.2.5",npm_package_devDependencies__testing_library_jest_dom:"6.4.0",npm_config_user_agent:"pnpm/9.10.0 npm/? node/v20.17.0 linux x64",CI:"true",npm_package_devDependencies__testing_library_user_event:"14.5.2",npm_package_devDependencies_vite:"5.0.12",npm_node_execpath:"/opt/hostedtoolcache/node/20.17.0/x64/bin/node",npm_package_publishConfig_access:"public",npm_package_files_0:"dist",HOME:"/home/runner",npm_package_dependencies_react_select_async_paginate:"0.7.3",npm_package_devDependencies_classnames:"2.3.2",npm_package_devDependencies_sass:"1.62.1",npm_config_auto_install_peers:"true",npm_package_devDependencies_vite_plugin_dts:"3.7.1",npm_package_dependencies__codemirror_lang_yaml:"6.1.2",npm_package_devDependencies_typescript:"5.1.3",npm_package_peerDependencies_react_select_async_paginate:"0.7.3",npm_package_types:"./dist/index.d.ts",npm_package_devDependencies__types_react_dom:"18.0.11",npm_package_devDependencies__vitejs_plugin_react_swc:"3.5.0",npm_package_type:"module",npm_package_dependencies_zustand:"4.5.4",npm_package_module:"./dist/avocado-not-front.es.js",npm_package_devDependencies__types_testing_library__jest_dom:"6.0.0",npm_package_dependencies__foris_avocado_icons:"workspace:*",npm_config_registry:"https://registry.npmjs.org/",npm_config_node_linker:"hoisted",npm_package_dependencies__codemirror_lang_json:"6.0.1",npm_package_exports___import:"./dist/avocado-not-front.es.js",npm_package_dependencies__foris_avocado_core:"workspace:*",npm_package_dependencies_axios:"^1.8.4",npm_package_dependencies_recharts:"3.1.0",npm_config_node_gyp:"/home/runner/setup-pnpm/node_modules/.pnpm/pnpm@9.10.0/node_modules/pnpm/dist/node_modules/node-gyp/bin/node-gyp.js",PATH:"/home/runner/work/avocado/avocado/packages/avocado-not-front/node_modules/.bin:/home/runner/setup-pnpm/node_modules/.pnpm/pnpm@9.10.0/node_modules/pnpm/dist/node-gyp-bin:/home/runner/work/avocado/avocado/node_modules/.bin:/home/runner/work/avocado/avocado/node_modules/.bin:/home/runner/setup-pnpm/node_modules/.pnpm/pnpm@9.10.0/node_modules/pnpm/dist/node-gyp-bin:/home/runner/work/avocado/avocado/node_modules/.bin:/opt/hostedtoolcache/node/20.17.0/x64/bin:/home/runner/setup-pnpm/node_modules/.bin:/snap/bin:/home/runner/.local/bin:/opt/pipx_bin:/home/runner/.cargo/bin:/home/runner/.config/composer/vendor/bin:/usr/local/.ghcup/bin:/home/runner/.dotnet/tools:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin",TURBO_HASH:"7ddeedd9cb5f0580",npm_package_name:"@foris/avocado-not-front",npm_package_scripts_start_stubby_examples:"stubby -d src/services/stubs/stubby-examples.yml -w -s 8300 -q",NODE:"/opt/hostedtoolcache/node/20.17.0/x64/bin/node",npm_config_frozen_lockfile:"",npm_config_legacy_peer_deps:"true",LANG:"C.UTF-8",npm_package_dependencies_react_dom:"18.2.0",npm_package_main:"./dist/avocado-not-front.umd.js",npm_lifecycle_script:"tsc && vite build",npm_package_dependencies__uiw_react_codemirror:"4.23.12",SHELL:"/bin/bash",NODE_PATH:"/home/runner/setup-pnpm/node_modules/.pnpm/pnpm@9.10.0/node_modules/pnpm/bin/node_modules:/home/runner/setup-pnpm/node_modules/.pnpm/pnpm@9.10.0/node_modules/pnpm/node_modules:/home/runner/setup-pnpm/node_modules/.pnpm/pnpm@9.10.0/node_modules:/home/runner/setup-pnpm/node_modules/.pnpm/node_modules",npm_package_version:"1.0.0",npm_package_devDependencies__testing_library_react:"14.2.0",npm_package_devDependencies__types_react:"18.0.28",npm_package_devDependencies_jsdom:"24.0.0",npm_lifecycle_event:"build",npm_package_scripts_build:"tsc && vite build",npm_package_dependencies__codemirror_lang_sql:"6.8.0",npm_package_dependencies__foris_avocado_suite:"workspace:*",npm_package_dependencies_jsonpath:"1.1.1",npm_package_devDependencies__foris_tsconfig:"workspace:*",npm_package_dependencies_react_select:"5.8.0",PWD:"/home/runner/work/avocado/avocado/packages/avocado-not-front",npm_execpath:"/home/runner/setup-pnpm/node_modules/.pnpm/pnpm@9.10.0/node_modules/pnpm/bin/pnpm.cjs",npm_package_devDependencies_stubby:"^5.1.0",npm_command:"run-script",PNPM_SCRIPT_SRC_DIR:"/home/runner/work/avocado/avocado/packages/avocado-not-front",npm_package_scripts_start_stubby:"stubby -d src/services/stubs/stubby-config.yml -w -s 8200 -q",npm_package_dependencies_react:"18.2.0",npm_package_peerDependencies_react_select:"5.8.0",INIT_CWD:"/home/runner/work/avocado/avocado/packages/avocado-not-front",NODE_ENV:"production"};class _h{constructor(e,n,r,i,o,a,s,l,c,u=0,f){this.p=e,this.stack=n,this.state=r,this.reducePos=i,this.pos=o,this.score=a,this.buffer=s,this.bufferBase=l,this.curContext=c,this.lookAhead=u,this.parent=f}toString(){return`[${this.stack.filter((e,n)=>n%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,n,r=0){let i=e.parser.context;return new _h(e,[],n,r,r,0,[],0,i?new eC(i,i.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,n){this.stack.push(this.state,n,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var n;let r=e>>19,i=e&65535,{parser:o}=this.p,a=this.reducePos<this.pos-25;a&&this.setLookAhead(this.pos);let s=o.dynamicPrecedence(i);if(s&&(this.score+=s),r==0){this.pushState(o.getGoto(this.state,i,!0),this.reducePos),i<o.minRepeatTerm&&this.storeNode(i,this.reducePos,this.reducePos,a?8:4,!0),this.reduceContext(i,this.reducePos);return}let l=this.stack.length-(r-1)*3-(e&262144?6:0),c=l?this.stack[l-2]:this.p.ranges[0].from,u=this.reducePos-c;u>=2e3&&!(!((n=this.p.parser.nodeSet.types[i])===null||n===void 0)&&n.isAnonymous)&&(c==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=u):this.p.lastBigReductionSize<u&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=c,this.p.lastBigReductionSize=u));let f=l?this.stack[l-1]:0,d=this.bufferBase+this.buffer.length-f;if(i<o.minRepeatTerm||e&131072){let h=o.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(i,c,h,d+4,!0)}if(e&262144)this.state=this.stack[l];else{let h=this.stack[l-3];this.state=o.getGoto(h,i,!0)}for(;this.stack.length>l;)this.stack.pop();this.reduceContext(i,c)}storeNode(e,n,r,i=4,o=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let a=this,s=this.buffer.length;if(s==0&&a.parent&&(s=a.bufferBase-a.parent.bufferBase,a=a.parent),s>0&&a.buffer[s-4]==0&&a.buffer[s-1]>-1){if(n==r)return;if(a.buffer[s-2]>=n){a.buffer[s-2]=r;return}}}if(!o||this.pos==r)this.buffer.push(e,n,r,i);else{let a=this.buffer.length;if(a>0&&this.buffer[a-4]!=0){let s=!1;for(let l=a;l>0&&this.buffer[l-2]>r;l-=4)if(this.buffer[l-1]>=0){s=!0;break}if(s)for(;a>0&&this.buffer[a-2]>r;)this.buffer[a]=this.buffer[a-4],this.buffer[a+1]=this.buffer[a-3],this.buffer[a+2]=this.buffer[a-2],this.buffer[a+3]=this.buffer[a-1],a-=4,i>4&&(i-=4)}this.buffer[a]=e,this.buffer[a+1]=n,this.buffer[a+2]=r,this.buffer[a+3]=i}}shift(e,n,r,i){if(e&131072)this.pushState(e&65535,this.pos);else if(e&262144)this.pos=i,this.shiftContext(n,r),n<=this.p.parser.maxNode&&this.buffer.push(n,r,i,4);else{let o=e,{parser:a}=this.p;(i>this.pos||n<=a.maxNode)&&(this.pos=i,a.stateFlag(o,1)||(this.reducePos=i)),this.pushState(o,r),this.shiftContext(n,r),n<=a.maxNode&&this.buffer.push(n,r,i,4)}}apply(e,n,r,i){e&65536?this.reduce(e):this.shift(e,n,r,i)}useNode(e,n){let r=this.p.reused.length-1;(r<0||this.p.reused[r]!=e)&&(this.p.reused.push(e),r++);let i=this.pos;this.reducePos=this.pos=i+e.length,this.pushState(n,i),this.buffer.push(r,i,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,n=e.buffer.length;for(;n>0&&e.buffer[n-2]>e.reducePos;)n-=4;let r=e.buffer.slice(n),i=e.bufferBase+n;for(;e&&i==e.bufferBase;)e=e.parent;return new _h(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,r,i,this.curContext,this.lookAhead,e)}recoverByDelete(e,n){let r=e<=this.p.parser.maxNode;r&&this.storeNode(e,this.pos,n,4),this.storeNode(0,this.pos,n,r?8:4),this.pos=this.reducePos=n,this.score-=190}canShift(e){for(let n=new Nte(this);;){let r=this.p.parser.stateSlot(n.state,4)||this.p.parser.hasAction(n.state,e);if(r==0)return!1;if(!(r&65536))return!0;n.reduce(r)}}recoverByInsert(e){if(this.stack.length>=300)return[];let n=this.p.parser.nextStates(this.state);if(n.length>8||this.stack.length>=120){let i=[];for(let o=0,a;o<n.length;o+=2)(a=n[o+1])!=this.state&&this.p.parser.hasAction(a,e)&&i.push(n[o],a);if(this.stack.length<120)for(let o=0;i.length<8&&o<n.length;o+=2){let a=n[o+1];i.some((s,l)=>l&1&&s==a)||i.push(n[o],a)}n=i}let r=[];for(let i=0;i<n.length&&r.length<4;i+=2){let o=n[i+1];if(o==this.state)continue;let a=this.split();a.pushState(o,this.pos),a.storeNode(0,a.pos,a.pos,4,!0),a.shiftContext(n[i],this.pos),a.reducePos=this.pos,a.score-=200,r.push(a)}return r}forceReduce(){let{parser:e}=this.p,n=e.stateSlot(this.state,5);if(!(n&65536))return!1;if(!e.validAction(this.state,n)){let r=n>>19,i=n&65535,o=this.stack.length-r*3;if(o<0||e.getGoto(this.stack[o],i,!1)<0){let a=this.findForcedReduction();if(a==null)return!1;n=a}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(n),!0}findForcedReduction(){let{parser:e}=this.p,n=[],r=(i,o)=>{if(!n.includes(i))return n.push(i),e.allActions(i,a=>{if(!(a&393216))if(a&65536){let s=(a>>19)-o;if(s>1){let l=a&65535,c=this.stack.length-s*3;if(c>=0&&e.getGoto(this.stack[c],l,!1)>=0)return s<<19|65536|l}}else{let s=r(a,o+1);if(s!=null)return s}})};return r(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let n=0;n<this.stack.length;n+=3)if(this.stack[n]!=e.stack[n])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,n){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(n)))}reduceContext(e,n){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(n)))}emitContext(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-3)&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-4)&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(e){if(e!=this.curContext.context){let n=new eC(this.curContext.tracker,e);n.hash!=this.curContext.hash&&this.emitContext(),this.curContext=n}}setLookAhead(e){e>this.lookAhead&&(this.emitLookAhead(),this.lookAhead=e)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class eC{constructor(e,n){this.tracker=e,this.context=n,this.hash=e.strict?e.hash(n):0}}class Nte{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let n=e&65535,r=e>>19;r==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(r-1)*3;let i=this.start.p.parser.getGoto(this.stack[this.base-3],n,!0);this.state=i}}class xh{constructor(e,n,r){this.stack=e,this.pos=n,this.index=r,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,n=e.bufferBase+e.buffer.length){return new xh(e,n,n-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new xh(this.stack,this.pos,this.index)}}function Ch(t,e=Uint16Array){if(typeof t!="string")return t;let n=null;for(let r=0,i=0;r<t.length;){let o=0;for(;;){let a=t.charCodeAt(r++),s=!1;if(a==126){o=65535;break}a>=92&&a--,a>=34&&a--;let l=a-32;if(l>=46&&(l-=46,s=!0),o+=l,s)break;o*=46}n?n[i++]=o:n=new e(o)}return n}class kh{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const tC=new kh;class Ite{constructor(e,n){this.input=e,this.ranges=n,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=tC,this.rangeIndex=0,this.pos=this.chunkPos=n[0].from,this.range=n[0],this.end=n[n.length-1].to,this.readNext()}resolveOffset(e,n){let r=this.range,i=this.rangeIndex,o=this.pos+e;for(;o<r.from;){if(!i)return null;let a=this.ranges[--i];o-=r.from-a.to,r=a}for(;n<0?o>r.to:o>=r.to;){if(i==this.ranges.length-1)return null;let a=this.ranges[++i];o+=a.from-r.to,r=a}return o}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let n of this.ranges)if(n.to>e)return Math.max(e,n.from);return this.end}peek(e){let n=this.chunkOff+e,r,i;if(n>=0&&n<this.chunk.length)r=this.pos+e,i=this.chunk.charCodeAt(n);else{let o=this.resolveOffset(e,1);if(o==null)return-1;if(r=o,r>=this.chunk2Pos&&r<this.chunk2Pos+this.chunk2.length)i=this.chunk2.charCodeAt(r-this.chunk2Pos);else{let a=this.rangeIndex,s=this.range;for(;s.to<=r;)s=this.ranges[++a];this.chunk2=this.input.chunk(this.chunk2Pos=r),r+this.chunk2.length>s.to&&(this.chunk2=this.chunk2.slice(0,s.to-r)),i=this.chunk2.charCodeAt(0)}}return r>=this.token.lookAhead&&(this.token.lookAhead=r+1),i}acceptToken(e,n=0){let r=n?this.resolveOffset(n,-1):this.pos;if(r==null||r<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=e,this.token.end=r}acceptTokenTo(e,n){this.token.value=e,this.token.end=n}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:n}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=n,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),n=this.pos+e.length;this.chunk=n>this.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,n){if(n?(this.token=n,n.start=e,n.lookAhead=e+1,n.value=n.extended=-1):this.token=tC,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;e>=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e<this.chunkPos+this.chunk.length?this.chunkOff=e-this.chunkPos:(this.chunk="",this.chunkOff=0),this.readNext()}return this}read(e,n){if(e>=this.chunkPos&&n<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,n-this.chunkPos);if(e>=this.chunk2Pos&&n<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,n-this.chunk2Pos);if(e>=this.range.from&&n<=this.range.to)return this.input.read(e,n);let r="";for(let i of this.ranges){if(i.from>=n)break;i.to>e&&(r+=this.input.read(Math.max(i.from,e),Math.min(i.to,n)))}return r}}class rl{constructor(e,n){this.data=e,this.id=n}token(e,n){let{parser:r}=n.p;Lte(this.data,e,n,this.id,r.data,r.tokenPrecTable)}}rl.prototype.contextual=rl.prototype.fallback=rl.prototype.extend=!1,rl.prototype.fallback=rl.prototype.extend=!1;class Gc{constructor(e,n={}){this.token=e,this.contextual=!!n.contextual,this.fallback=!!n.fallback,this.extend=!!n.extend}}function Lte(t,e,n,r,i,o){let a=0,s=1<<r,{dialect:l}=n.p.parser;e:for(;s&t[a];){let c=t[a+1];for(let h=a+3;h<c;h+=2)if((t[h+1]&s)>0){let m=t[h];if(l.allows(m)&&(e.token.value==-1||e.token.value==m||jte(m,e.token.value,i,o))){e.acceptToken(m);break}}let u=e.next,f=0,d=t[a+2];if(e.next<0&&d>f&&t[c+d*3-3]==65535){a=t[c+d*3-1];continue e}for(;f<d;){let h=f+d>>1,m=c+h+(h<<1),g=t[m],p=t[m+1]||65536;if(u<g)d=h;else if(u>=p)f=h+1;else{a=t[m+2],e.advance();continue e}}break}}function nC(t,e,n){for(let r=e,i;(i=t[r])!=65535;r++)if(i==n)return r-e;return-1}function jte(t,e,n,r){let i=nC(n,r,e);return i<0||nC(n,r,t)<i}const tr=typeof process<"u"&&Jx&&/\bparse\b/.test(Jx.LOG);let h3=null;function rC(t,e,n){let r=t.cursor(Qt.IncludeAnonymous);for(r.moveTo(e);;)if(!(n<0?r.childBefore(e):r.childAfter(e)))for(;;){if((n<0?r.to<e:r.from>e)&&!r.type.isError)return n<0?Math.max(0,Math.min(r.to-1,e-25)):Math.min(t.length,Math.max(r.from+1,e+25));if(n<0?r.prevSibling():r.nextSibling())break;if(!r.parent())return n<0?0:t.length}}class Rte{constructor(e,n){this.fragments=e,this.nodeSet=n,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?rC(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?rC(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(e<this.nextStart)return null;for(;this.fragment&&this.safeTo<=e;)this.nextFragment();if(!this.fragment)return null;for(;;){let n=this.trees.length-1;if(n<0)return this.nextFragment(),null;let r=this.trees[n],i=this.index[n];if(i==r.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let o=r.children[i],a=this.start[n]+r.positions[i];if(a>e)return this.nextStart=a,null;if(o instanceof Nt){if(a==e){if(a<this.safeFrom)return null;let s=a+o.length;if(s<=this.safeTo){let l=o.prop(De.lookAhead);if(!l||s+l<this.fragment.to)return o}}this.index[n]++,a+o.length>=Math.max(this.safeFrom,e)&&(this.trees.push(o),this.start.push(a),this.index.push(0))}else this.index[n]++,this.nextStart=a+o.length}}}class Bte{constructor(e,n){this.stream=n,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(r=>new kh)}getActions(e){let n=0,r=null,{parser:i}=e.p,{tokenizers:o}=i,a=i.stateSlot(e.state,3),s=e.curContext?e.curContext.hash:0,l=0;for(let c=0;c<o.length;c++){if(!(1<<c&a))continue;let u=o[c],f=this.tokens[c];if(!(r&&!u.fallback)&&((u.contextual||f.start!=e.pos||f.mask!=a||f.context!=s)&&(this.updateCachedToken(f,u,e),f.mask=a,f.context=s),f.lookAhead>f.end+25&&(l=Math.max(f.lookAhead,l)),f.value!=0)){let d=n;if(f.extended>-1&&(n=this.addActions(e,f.extended,f.end,n)),n=this.addActions(e,f.value,f.end,n),!u.extend&&(r=f,n>d))break}}for(;this.actions.length>n;)this.actions.pop();return l&&e.setLookAhead(l),!r&&e.pos==this.stream.end&&(r=new kh,r.value=e.p.parser.eofTerm,r.start=r.end=e.pos,n=this.addActions(e,r.value,r.end,n)),this.mainToken=r,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let n=new kh,{pos:r,p:i}=e;return n.start=r,n.end=Math.min(r+1,i.stream.end),n.value=r==i.stream.end?i.parser.eofTerm:0,n}updateCachedToken(e,n,r){let i=this.stream.clipPos(r.pos);if(n.token(this.stream.reset(i,e),r),e.value>-1){let{parser:o}=r.p;for(let a=0;a<o.specialized.length;a++)if(o.specialized[a]==e.value){let s=o.specializers[a](this.stream.read(e.start,e.end),r);if(s>=0&&r.p.parser.dialect.allows(s>>1)){s&1?e.extended=s>>1:e.value=s>>1;break}}}else e.value=0,e.end=this.stream.clipPos(i+1)}putAction(e,n,r,i){for(let o=0;o<i;o+=3)if(this.actions[o]==e)return i;return this.actions[i++]=e,this.actions[i++]=n,this.actions[i++]=r,i}addActions(e,n,r,i){let{state:o}=e,{parser:a}=e.p,{data:s}=a;for(let l=0;l<2;l++)for(let c=a.stateSlot(o,l?2:1);;c+=3){if(s[c]==65535)if(s[c+1]==1)c=Zi(s,c+2);else{i==0&&s[c+1]==2&&(i=this.putAction(Zi(s,c+2),n,r,i));break}s[c]==n&&(i=this.putAction(Zi(s,c+1),n,r,i))}return i}}class $te{constructor(e,n,r,i){this.parser=e,this.input=n,this.ranges=i,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new Ite(n,i),this.tokens=new Bte(e,this.stream),this.topTerm=e.top[1];let{from:o}=i[0];this.stacks=[_h.start(this,e.top[0],o)],this.fragments=r.length&&this.stream.end-o>e.bufferLength*4?new Rte(r,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,n=this.minStackPos,r=this.stacks=[],i,o;if(this.bigReductionCount>300&&e.length==1){let[a]=e;for(;a.forceReduce()&&a.stack.length&&a.stack[a.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let a=0;a<e.length;a++){let s=e[a];for(;;){if(this.tokens.mainToken=null,s.pos>n)r.push(s);else{if(this.advanceStack(s,r,e))continue;{i||(i=[],o=[]),i.push(s);let l=this.tokens.getMainToken(s);o.push(l.value,l.end)}}break}}if(!r.length){let a=i&&Vte(i);if(a)return tr&&console.log("Finish with "+this.stackID(a)),this.stackToTree(a);if(this.parser.strict)throw tr&&i&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+n);this.recovering||(this.recovering=5)}if(this.recovering&&i){let a=this.stoppedAt!=null&&i[0].pos>this.stoppedAt?i[0]:this.runRecovery(i,o,r);if(a)return tr&&console.log("Force-finish "+this.stackID(a)),this.stackToTree(a.forceAll())}if(this.recovering){let a=this.recovering==1?1:this.recovering*3;if(r.length>a)for(r.sort((s,l)=>l.score-s.score);r.length>a;)r.pop();r.some(s=>s.reducePos>n)&&this.recovering--}else if(r.length>1){e:for(let a=0;a<r.length-1;a++){let s=r[a];for(let l=a+1;l<r.length;l++){let c=r[l];if(s.sameState(c)||s.buffer.length>500&&c.buffer.length>500)if((s.score-c.score||s.buffer.length-c.buffer.length)>0)r.splice(l--,1);else{r.splice(a--,1);continue e}}}r.length>12&&r.splice(12,r.length-12)}this.minStackPos=r[0].pos;for(let a=1;a<r.length;a++)r[a].pos<this.minStackPos&&(this.minStackPos=r[a].pos);return null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=e}advanceStack(e,n,r){let i=e.pos,{parser:o}=this,a=tr?this.stackID(e)+" -> ":"";if(this.stoppedAt!=null&&i>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let c=e.curContext&&e.curContext.tracker.strict,u=c?e.curContext.hash:0;for(let f=this.fragments.nodeAt(i);f;){let d=this.parser.nodeSet.types[f.type.id]==f.type?o.getGoto(e.state,f.type.id):-1;if(d>-1&&f.length&&(!c||(f.prop(De.contextHash)||0)==u))return e.useNode(f,d),tr&&console.log(a+this.stackID(e)+` (via reuse of ${o.getName(f.type.id)})`),!0;if(!(f instanceof Nt)||f.children.length==0||f.positions[0]>0)break;let h=f.children[0];if(h instanceof Nt&&f.positions[0]==0)f=h;else break}}let s=o.stateSlot(e.state,4);if(s>0)return e.reduce(s),tr&&console.log(a+this.stackID(e)+` (via always-reduce ${o.getName(s&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let l=this.tokens.getActions(e);for(let c=0;c<l.length;){let u=l[c++],f=l[c++],d=l[c++],h=c==l.length||!r,m=h?e:e.split(),g=this.tokens.mainToken;if(m.apply(u,f,g?g.start:m.pos,d),tr&&console.log(a+this.stackID(m)+` (via ${u&65536?`reduce of ${o.getName(u&65535)}`:"shift"} for ${o.getName(f)} @ ${i}${m==e?"":", split"})`),h)return!0;m.pos>i?n.push(m):r.push(m)}return!1}advanceFully(e,n){let r=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>r)return iC(e,n),!0}}runRecovery(e,n,r){let i=null,o=!1;for(let a=0;a<e.length;a++){let s=e[a],l=n[a<<1],c=n[(a<<1)+1],u=tr?this.stackID(s)+" -> ":"";if(s.deadEnd&&(o||(o=!0,s.restart(),tr&&console.log(u+this.stackID(s)+" (restarted)"),this.advanceFully(s,r))))continue;let f=s.split(),d=u;for(let h=0;f.forceReduce()&&h<10&&(tr&&console.log(d+this.stackID(f)+" (via force-reduce)"),!this.advanceFully(f,r));h++)tr&&(d=this.stackID(f)+" -> ");for(let h of s.recoverByInsert(l))tr&&console.log(u+this.stackID(h)+" (via recover-insert)"),this.advanceFully(h,r);this.stream.end>s.pos?(c==s.pos&&(c++,l=0),s.recoverByDelete(l,c),tr&&console.log(u+this.stackID(s)+` (via recover-delete ${this.parser.getName(l)})`),iC(s,r)):(!i||i.score<s.score)&&(i=s)}return i}stackToTree(e){return e.close(),Nt.build({buffer:xh.create(e),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:e.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(e){let n=(h3||(h3=new WeakMap)).get(e);return n||h3.set(e,n=String.fromCodePoint(this.nextStackID++)),n+e}}function iC(t,e){for(let n=0;n<e.length;n++){let r=e[n];if(r.pos==t.pos&&r.sameState(t)){e[n].score<t.score&&(e[n]=t);return}}e.push(t)}class Fte{constructor(e,n,r){this.source=e,this.flags=n,this.disabled=r}allows(e){return!this.disabled||this.disabled[e]==0}}const p3=t=>t;class Hte{constructor(e){this.start=e.start,this.shift=e.shift||p3,this.reduce=e.reduce||p3,this.reuse=e.reuse||p3,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}}class Ba extends zw{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let n=e.nodeNames.split(" ");this.minRepeatTerm=n.length;for(let s=0;s<e.repeatNodeCount;s++)n.push("");let r=Object.keys(e.topRules).map(s=>e.topRules[s][1]),i=[];for(let s=0;s<n.length;s++)i.push([]);function o(s,l,c){i[s].push([l,l.deserialize(String(c))])}if(e.nodeProps)for(let s of e.nodeProps){let l=s[0];typeof l=="string"&&(l=De[l]);for(let c=1;c<s.length;){let u=s[c++];if(u>=0)o(u,l,s[c++]);else{let f=s[c+-u];for(let d=-u;d>0;d--)o(s[c++],l,f);c++}}}this.nodeSet=new Cg(n.map((s,l)=>Fn.define({name:l>=this.minRepeatTerm?void 0:s,id:l,props:i[l],top:r.indexOf(l)>-1,error:l==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(l)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=Rw;let a=Ch(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let s=0;s<this.specializerSpecs.length;s++)this.specialized[s]=this.specializerSpecs[s].term;this.specializers=this.specializerSpecs.map(oC),this.states=Ch(e.states,Uint32Array),this.data=Ch(e.stateData),this.goto=Ch(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(s=>typeof s=="number"?new rl(a,s):s),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,n,r){let i=new $te(this,e,n,r);for(let o of this.wrappers)i=o(i,e,n,r);return i}getGoto(e,n,r=!1){let i=this.goto;if(n>=i[0])return-1;for(let o=i[n+1];;){let a=i[o++],s=a&1,l=i[o++];if(s&&r)return l;for(let c=o+(a>>1);o<c;o++)if(i[o]==e)return l;if(s)return-1}}hasAction(e,n){let r=this.data;for(let i=0;i<2;i++)for(let o=this.stateSlot(e,i?2:1),a;;o+=3){if((a=r[o])==65535)if(r[o+1]==1)a=r[o=Zi(r,o+2)];else{if(r[o+1]==2)return Zi(r,o+2);break}if(a==n||a==0)return Zi(r,o+1)}return 0}stateSlot(e,n){return this.states[e*6+n]}stateFlag(e,n){return(this.stateSlot(e,0)&n)>0}validAction(e,n){return!!this.allActions(e,r=>r==n?!0:null)}allActions(e,n){let r=this.stateSlot(e,4),i=r?n(r):void 0;for(let o=this.stateSlot(e,1);i==null;o+=3){if(this.data[o]==65535)if(this.data[o+1]==1)o=Zi(this.data,o+2);else break;i=n(Zi(this.data,o+1))}return i}nextStates(e){let n=[];for(let r=this.stateSlot(e,1);;r+=3){if(this.data[r]==65535)if(this.data[r+1]==1)r=Zi(this.data,r+2);else break;if(!(this.data[r+2]&1)){let i=this.data[r+1];n.some((o,a)=>a&1&&o==i)||n.push(this.data[r],i)}}return n}configure(e){let n=Object.assign(Object.create(Ba.prototype),this);if(e.props&&(n.nodeSet=this.nodeSet.extend(...e.props)),e.top){let r=this.topRules[e.top];if(!r)throw new RangeError(`Invalid top rule name ${e.top}`);n.top=r}return e.tokenizers&&(n.tokenizers=this.tokenizers.map(r=>{let i=e.tokenizers.find(o=>o.from==r);return i?i.to:r})),e.specializers&&(n.specializers=this.specializers.slice(),n.specializerSpecs=this.specializerSpecs.map((r,i)=>{let o=e.specializers.find(s=>s.from==r.external);if(!o)return r;let a=Object.assign(Object.assign({},r),{external:o.to});return n.specializers[i]=oC(a),a})),e.contextTracker&&(n.context=e.contextTracker),e.dialect&&(n.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(n.strict=e.strict),e.wrap&&(n.wrappers=n.wrappers.concat(e.wrap)),e.bufferLength!=null&&(n.bufferLength=e.bufferLength),n}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let n=this.dynamicPrecedences;return n==null?0:n[e]||0}parseDialect(e){let n=Object.keys(this.dialects),r=n.map(()=>!1);if(e)for(let o of e.split(" ")){let a=n.indexOf(o);a>=0&&(r[a]=!0)}let i=null;for(let o=0;o<n.length;o++)if(!r[o])for(let a=this.dialects[n[o]],s;(s=this.data[a++])!=65535;)(i||(i=new Uint8Array(this.maxTerm+1)))[s]=1;return new Fte(e,r,i)}static deserialize(e){return new Ba(e)}}function Zi(t,e){return t[e]|t[e+1]<<16}function Vte(t){let e=null;for(let n of t){let r=n.p.stoppedAt;(n.pos==n.p.stream.end||r!=null&&n.pos>r)&&n.p.parser.stateFlag(n.state,2)&&(!e||e.score<n.score)&&(e=n)}return e}function oC(t){if(t.external){let e=t.extend?1:0;return(n,r)=>t.external(n,r)<<1|e}return t.get}const Wte=Rc({String:B.string,Number:B.number,"True False":B.bool,PropertyName:B.propertyName,Null:B.null,", :":B.separator,"[ ]":B.squareBracket,"{ }":B.brace}),zte=Ba.deserialize({version:14,states:"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#ClOOQO'#Cr'#CrQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CtOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59W,59WO!iQPO,59WOVQPO,59QOqQPO'#CmO!nQPO,59`OOQO1G.k1G.kOVQPO'#CnO!vQPO,59aOOQO1G.r1G.rOOQO1G.l1G.lOOQO,59X,59XOOQO-E6k-E6kOOQO,59Y,59YOOQO-E6l-E6l",stateData:"#O~OeOS~OQSORSOSSOTSOWQO_ROgPO~OVXOgUO~O^[O~PVO[^O~O]_OVhX~OVaO~O]bO^iX~O^dO~O]_OVha~O]bO^ia~O",goto:"!kjPPPPPPkPPkqwPPPPk{!RPPP!XP!e!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",nodeNames:"⚠ JsonText True False Null Number String } { Object Property PropertyName : , ] [ Array",maxTerm:25,nodeProps:[["isolate",-2,6,11,""],["openedBy",7,"{",14,"["],["closedBy",8,"}",15,"]"]],propSources:[Wte],skippedNodes:[0],repeatNodeCount:2,tokenData:"(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oe~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Og~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zO]~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yO[~~'OO_~~'TO^~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",tokenizers:[0],topRules:{JsonText:[0,1]},tokenPrec:0}),Ute=Na.define({name:"json",parser:zte.configure({props:[Zd.add({Object:jg({except:/^\s*\}/}),Array:jg({except:/^\s*\]/})}),Gd.add({"Object Array":t_})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function aC(){return new Ng(Ute)}const qte=36,sC=1,Kte=2,il=3,m3=4,Qte=5,Yte=6,Xte=7,Zte=8,Gte=9,Jte=10,ene=11,tne=12,nne=13,rne=14,ine=15,one=16,ane=17,lC=18,sne=19,cC=20,uC=21,fC=22,lne=23,cne=24;function g3(t){return t>=65&&t<=90||t>=97&&t<=122||t>=48&&t<=57}function une(t){return t>=48&&t<=57||t>=97&&t<=102||t>=65&&t<=70}function $a(t,e,n){for(let r=!1;;){if(t.next<0)return;if(t.next==e&&!r){t.advance();return}r=n&&!r&&t.next==92,t.advance()}}function fne(t,e){e:for(;;){if(t.next<0)return;if(t.next==36){t.advance();for(let n=0;n<e.length;n++){if(t.next!=e.charCodeAt(n))continue e;t.advance()}if(t.next==36){t.advance();return}}else t.advance()}}function dne(t,e){let n="[{<(".indexOf(String.fromCharCode(e)),r=n<0?e:"]}>)".charCodeAt(n);for(;;){if(t.next<0)return;if(t.next==r&&t.peek(1)==39){t.advance(2);return}t.advance()}}function v3(t,e){for(;!(t.next!=95&&!g3(t.next));)e!=null&&(e+=String.fromCharCode(t.next)),t.advance();return e}function hne(t){if(t.next==39||t.next==34||t.next==96){let e=t.next;t.advance(),$a(t,e,!1)}else v3(t)}function dC(t,e){for(;t.next==48||t.next==49;)t.advance();e&&t.next==e&&t.advance()}function hC(t,e){for(;;){if(t.next==46){if(e)break;e=!0}else if(t.next<48||t.next>57)break;t.advance()}if(t.next==69||t.next==101)for(t.advance(),(t.next==43||t.next==45)&&t.advance();t.next>=48&&t.next<=57;)t.advance()}function pC(t){for(;!(t.next<0||t.next==10);)t.advance()}function Fa(t,e){for(let n=0;n<e.length;n++)if(e.charCodeAt(n)==t)return!0;return!1}const y3=` \r
|
|
591
591
|
`;function mC(t,e,n){let r=Object.create(null);r.true=r.false=Qte,r.null=r.unknown=Yte;for(let i of t.split(" "))i&&(r[i]=cC);for(let i of e.split(" "))i&&(r[i]=uC);for(let i of(n||"").split(" "))i&&(r[i]=cne);return r}const b3={backslashEscapes:!1,hashComments:!1,spaceAfterDashes:!1,slashComments:!1,doubleQuotedStrings:!1,doubleDollarQuotedStrings:!1,unquotedBitLiterals:!1,treatBitsAsBytes:!1,charSetCasts:!1,plsqlQuotingMechanism:!1,operatorChars:"*+-%<>!=&|~^/",specialVar:"?",identifierQuotes:'"',caseInsensitiveIdentifiers:!1,words:mC("absolute action add after all allocate alter and any are as asc assertion at authorization before begin between both breadth by call cascade cascaded case cast catalog check close collate collation column commit condition connect connection constraint constraints constructor continue corresponding count create cross cube current current_date current_default_transform_group current_transform_group_for_type current_path current_role current_time current_timestamp current_user cursor cycle data day deallocate declare default deferrable deferred delete depth deref desc describe descriptor deterministic diagnostics disconnect distinct do domain drop dynamic each else elseif end end-exec equals escape except exception exec execute exists exit external fetch first for foreign found from free full function general get global go goto grant group grouping handle having hold hour identity if immediate in indicator initially inner inout input insert intersect into is isolation join key language last lateral leading leave left level like limit local localtime localtimestamp locator loop map match method minute modifies module month names natural nesting new next no none not of old on only open option or order ordinality out outer output overlaps pad parameter partial path prepare preserve primary prior privileges procedure public read reads recursive redo ref references referencing relative release repeat resignal restrict result return returns revoke right role rollback rollup routine row rows savepoint schema scroll search second section select session session_user set sets signal similar size some space specific specifictype sql sqlexception sqlstate sqlwarning start state static system_user table temporary then timezone_hour timezone_minute to trailing transaction translation treat trigger under undo union unique unnest until update usage user using value values view when whenever where while with without work write year zone ","array binary bit boolean char character clob date decimal double float int integer interval large national nchar nclob numeric object precision real smallint time timestamp varchar varying ")};function pne(t,e,n,r){let i={};for(let o in b3)i[o]=(t.hasOwnProperty(o)?t:b3)[o];return e&&(i.words=mC(e,n||"",r)),i}function gC(t){return new Gc(e=>{var n;let{next:r}=e;if(e.advance(),Fa(r,y3)){for(;Fa(e.next,y3);)e.advance();e.acceptToken(qte)}else if(r==36&&t.doubleDollarQuotedStrings){let i=v3(e,"");e.next==36&&(e.advance(),fne(e,i),e.acceptToken(il))}else if(r==39||r==34&&t.doubleQuotedStrings)$a(e,r,t.backslashEscapes),e.acceptToken(il);else if(r==35&&t.hashComments||r==47&&e.next==47&&t.slashComments)pC(e),e.acceptToken(sC);else if(r==45&&e.next==45&&(!t.spaceAfterDashes||e.peek(1)==32))pC(e),e.acceptToken(sC);else if(r==47&&e.next==42){e.advance();for(let i=1;;){let o=e.next;if(e.next<0)break;if(e.advance(),o==42&&e.next==47){if(i--,e.advance(),!i)break}else o==47&&e.next==42&&(i++,e.advance())}e.acceptToken(Kte)}else if((r==101||r==69)&&e.next==39)e.advance(),$a(e,39,!0),e.acceptToken(il);else if((r==110||r==78)&&e.next==39&&t.charSetCasts)e.advance(),$a(e,39,t.backslashEscapes),e.acceptToken(il);else if(r==95&&t.charSetCasts)for(let i=0;;i++){if(e.next==39&&i>1){e.advance(),$a(e,39,t.backslashEscapes),e.acceptToken(il);break}if(!g3(e.next))break;e.advance()}else if(t.plsqlQuotingMechanism&&(r==113||r==81)&&e.next==39&&e.peek(1)>0&&!Fa(e.peek(1),y3)){let i=e.peek(1);e.advance(2),dne(e,i),e.acceptToken(il)}else if(r==40)e.acceptToken(Xte);else if(r==41)e.acceptToken(Zte);else if(r==123)e.acceptToken(Gte);else if(r==125)e.acceptToken(Jte);else if(r==91)e.acceptToken(ene);else if(r==93)e.acceptToken(tne);else if(r==59)e.acceptToken(nne);else if(t.unquotedBitLiterals&&r==48&&e.next==98)e.advance(),dC(e),e.acceptToken(fC);else if((r==98||r==66)&&(e.next==39||e.next==34)){const i=e.next;e.advance(),t.treatBitsAsBytes?($a(e,i,t.backslashEscapes),e.acceptToken(lne)):(dC(e,i),e.acceptToken(fC))}else if(r==48&&(e.next==120||e.next==88)||(r==120||r==88)&&e.next==39){let i=e.next==39;for(e.advance();une(e.next);)e.advance();i&&e.next==39&&e.advance(),e.acceptToken(m3)}else if(r==46&&e.next>=48&&e.next<=57)hC(e,!0),e.acceptToken(m3);else if(r==46)e.acceptToken(rne);else if(r>=48&&r<=57)hC(e,!1),e.acceptToken(m3);else if(Fa(r,t.operatorChars)){for(;Fa(e.next,t.operatorChars);)e.advance();e.acceptToken(ine)}else if(Fa(r,t.specialVar))e.next==r&&e.advance(),hne(e),e.acceptToken(ane);else if(Fa(r,t.identifierQuotes))$a(e,r,!1),e.acceptToken(sne);else if(r==58||r==44)e.acceptToken(one);else if(g3(r)){let i=v3(e,String.fromCharCode(r));e.acceptToken(e.next==46||e.peek(-i.length-1)==46?lC:(n=t.words[i.toLowerCase()])!==null&&n!==void 0?n:lC)}})}const vC=gC(b3),mne=Ba.deserialize({version:14,states:"%vQ]QQOOO#wQRO'#DSO$OQQO'#CwO%eQQO'#CxO%lQQO'#CyO%sQQO'#CzOOQQ'#DS'#DSOOQQ'#C}'#C}O'UQRO'#C{OOQQ'#Cv'#CvOOQQ'#C|'#C|Q]QQOOQOQQOOO'`QQO'#DOO(xQRO,59cO)PQQO,59cO)UQQO'#DSOOQQ,59d,59dO)cQQO,59dOOQQ,59e,59eO)jQQO,59eOOQQ,59f,59fO)qQQO,59fOOQQ-E6{-E6{OOQQ,59b,59bOOQQ-E6z-E6zOOQQ,59j,59jOOQQ-E6|-E6|O+VQRO1G.}O+^QQO,59cOOQQ1G/O1G/OOOQQ1G/P1G/POOQQ1G/Q1G/QP+kQQO'#C}O+rQQO1G.}O)PQQO,59cO,PQQO'#Cw",stateData:",[~OtOSPOSQOS~ORUOSUOTUOUUOVROXSOZTO]XO^QO_UO`UOaPObPOcPOdUOeUOfUOgUOhUO~O^]ORvXSvXTvXUvXVvXXvXZvX]vX_vX`vXavXbvXcvXdvXevXfvXgvXhvX~OsvX~P!jOa_Ob_Oc_O~ORUOSUOTUOUUOVROXSOZTO^tO_UO`UOa`Ob`Oc`OdUOeUOfUOgUOhUO~OWaO~P$ZOYcO~P$ZO[eO~P$ZORUOSUOTUOUUOVROXSOZTO^QO_UO`UOaPObPOcPOdUOeUOfUOgUOhUO~O]hOsoX~P%zOajObjOcjO~O^]ORkaSkaTkaUkaVkaXkaZka]ka_ka`kaakabkackadkaekafkagkahka~Oska~P'kO^]O~OWvXYvX[vX~P!jOWnO~P$ZOYoO~P$ZO[pO~P$ZO^]ORkiSkiTkiUkiVkiXkiZki]ki_ki`kiakibkickidkiekifkigkihki~Oski~P)xOWkaYka[ka~P'kO]hO~P$ZOWkiYki[ki~P)xOasObsOcsO~O",goto:"#hwPPPPPPPPPPPPPPPPPPPPPPPPPPx||||!Y!^!d!xPPP#[TYOZeUORSTWZbdfqT[OZQZORiZSWOZQbRQdSQfTZgWbdfqQ^PWk^lmrQl_Qm`RrseVORSTWZbdfq",nodeNames:"⚠ LineComment BlockComment String Number Bool Null ( ) { } [ ] ; . Operator Punctuation SpecialVar Identifier QuotedIdentifier Keyword Type Bits Bytes Builtin Script Statement CompositeIdentifier Parens Braces Brackets Statement",maxTerm:38,nodeProps:[["isolate",-4,1,2,3,19,""]],skippedNodes:[0,1,2],repeatNodeCount:3,tokenData:"RORO",tokenizers:[0,vC],topRules:{Script:[0,25]},tokenPrec:0});function w3(t){let e=t.cursor().moveTo(t.from,-1);for(;/Comment/.test(e.name);)e.moveTo(e.from,-1);return e.node}function Jc(t,e){let n=t.sliceString(e.from,e.to),r=/^([`'"])(.*)\1$/.exec(n);return r?r[2]:n}function Sh(t){return t&&(t.name=="Identifier"||t.name=="QuotedIdentifier")}function gne(t,e){if(e.name=="CompositeIdentifier"){let n=[];for(let r=e.firstChild;r;r=r.nextSibling)Sh(r)&&n.push(Jc(t,r));return n}return[Jc(t,e)]}function yC(t,e){for(let n=[];;){if(!e||e.name!=".")return n;let r=w3(e);if(!Sh(r))return n;n.unshift(Jc(t,r)),e=w3(r)}}function vne(t,e){let n=Yt(t).resolveInner(e,-1),r=bne(t.doc,n);return n.name=="Identifier"||n.name=="QuotedIdentifier"||n.name=="Keyword"?{from:n.from,quoted:n.name=="QuotedIdentifier"?t.doc.sliceString(n.from,n.from+1):null,parents:yC(t.doc,w3(n)),aliases:r}:n.name=="."?{from:e,quoted:null,parents:yC(t.doc,n),aliases:r}:{from:e,quoted:null,parents:[],empty:!0,aliases:r}}const yne=new Set("where group having order union intersect except all distinct limit offset fetch for".split(" "));function bne(t,e){let n;for(let i=e;!n;i=i.parent){if(!i)return null;i.name=="Statement"&&(n=i)}let r=null;for(let i=n.firstChild,o=!1,a=null;i;i=i.nextSibling){let s=i.name=="Keyword"?t.sliceString(i.from,i.to).toLowerCase():null,l=null;if(!o)o=s=="from";else if(s=="as"&&a&&Sh(i.nextSibling))l=Jc(t,i.nextSibling);else{if(s&&yne.has(s))break;a&&Sh(i)&&(l=Jc(t,i))}l&&(r||(r=Object.create(null)),r[l]=gne(t,a)),a=/Identifier$/.test(i.name)?i:null}return r}function wne(t,e){return t?e.map(n=>Object.assign(Object.assign({},n),{label:n.label[0]==t?n.label:t+n.label+t,apply:void 0})):e}const _ne=/^\w*$/,xne=/^[`'"]?\w*[`'"]?$/;function bC(t){return t.self&&typeof t.self.label=="string"}class _3{constructor(e,n){this.idQuote=e,this.idCaseInsensitive=n,this.list=[],this.children=void 0}child(e){let n=this.children||(this.children=Object.create(null)),r=n[e];return r||(e&&!this.list.some(i=>i.label==e)&&this.list.push(wC(e,"type",this.idQuote,this.idCaseInsensitive)),n[e]=new _3(this.idQuote,this.idCaseInsensitive))}maybeChild(e){return this.children?this.children[e]:null}addCompletion(e){let n=this.list.findIndex(r=>r.label==e.label);n>-1?this.list[n]=e:this.list.push(e)}addCompletions(e){for(let n of e)this.addCompletion(typeof n=="string"?wC(n,"property",this.idQuote,this.idCaseInsensitive):n)}addNamespace(e){Array.isArray(e)?this.addCompletions(e):bC(e)?this.addNamespace(e.children):this.addNamespaceObject(e)}addNamespaceObject(e){for(let n of Object.keys(e)){let r=e[n],i=null,o=n.replace(/\\?\./g,s=>s=="."?"\0":s).split("\0"),a=this;bC(r)&&(i=r.self,r=r.children);for(let s=0;s<o.length;s++)i&&s==o.length-1&&a.addCompletion(i),a=a.child(o[s].replace(/\\\./g,"."));a.addNamespace(r)}}}function wC(t,e,n,r){return new RegExp("^[a-z_][a-z_\\d]*$",r?"i":"").test(t)?{label:t,type:e}:{label:t,type:e,apply:n+t+n}}function Cne(t,e,n,r,i,o){var a;let s=((a=o==null?void 0:o.spec.identifierQuotes)===null||a===void 0?void 0:a[0])||'"',l=new _3(s,!!(o!=null&&o.spec.caseInsensitiveIdentifiers)),c=i?l.child(i):null;return l.addNamespace(t),e&&(c||l).addCompletions(e),n&&l.addCompletions(n),c&&l.addCompletions(c.list),r&&l.addCompletions((c||l).child(r).list),u=>{let{parents:f,from:d,quoted:h,empty:m,aliases:g}=vne(u.state,u.pos);if(m&&!u.explicit)return null;g&&f.length==1&&(f=g[f[0]]||f);let p=l;for(let w of f){for(;!p.children||!p.children[w];)if(p==l&&c)p=c;else if(p==c&&r)p=p.child(r);else return null;let b=p.maybeChild(w);if(!b)return null;p=b}let v=h&&u.state.sliceDoc(u.pos,u.pos+1)==h,_=p.list;return p==l&&g&&(_=_.concat(Object.keys(g).map(w=>({label:w,type:"constant"})))),{from:d,to:v?u.pos+1:void 0,options:wne(h,_),validFor:h?xne:_ne}}}function kne(t){return t==uC?"type":t==cC?"keyword":"variable"}function Sne(t,e,n){let r=Object.keys(t).map(i=>n(e?i.toUpperCase():i,kne(t[i])));return bee(["QuotedIdentifier","SpecialVar","String","LineComment","BlockComment","."],wx(r))}let One=mne.configure({props:[Zd.add({Statement:jg()}),Gd.add({Statement(t,e){return{from:Math.min(t.from+100,e.doc.lineAt(t.from).to),to:t.to}},BlockComment(t){return{from:t.from+2,to:t.to-2}}}),Rc({Keyword:B.keyword,Type:B.typeName,Builtin:B.standard(B.name),Bits:B.number,Bytes:B.string,Bool:B.bool,Null:B.null,Number:B.number,String:B.string,Identifier:B.name,QuotedIdentifier:B.special(B.string),SpecialVar:B.special(B.name),LineComment:B.lineComment,BlockComment:B.blockComment,Operator:B.operator,"Semi Punctuation":B.punctuation,"( )":B.paren,"{ }":B.brace,"[ ]":B.squareBracket})]});class x3{constructor(e,n,r){this.dialect=e,this.language=n,this.spec=r}get extension(){return this.language.extension}static define(e){let n=pne(e,e.keywords,e.types,e.builtin),r=Na.define({name:"sql",parser:One.configure({tokenizers:[{from:vC,to:gC(n)}]}),languageData:{commentTokens:{line:"--",block:{open:"/*",close:"*/"}},closeBrackets:{brackets:["(","[","{","'",'"',"`"]}}});return new x3(n,r,e)}}function Pne(t,e){return{label:t,type:e,boost:-1}}function Ene(t,e=!1,n){return Sne(t.dialect.words,e,n||Pne)}function Ane(t){return t.schema?Cne(t.schema,t.tables,t.schemas,t.defaultTable,t.defaultSchema,t.dialect||C3):()=>null}function Dne(t){return t.schema?(t.dialect||C3).language.data.of({autocomplete:Ane(t)}):[]}function Mne(t={}){let e=t.dialect||C3;return new Ng(e.language,[Dne(t),e.language.data.of({autocomplete:Ene(e,t.upperCaseKeywords,t.keywordCompletion)})])}const C3=x3.define({}),ol=63,_C=64,Tne=1,Nne=2,xC=3,Ine=4,CC=5,Lne=6,jne=7,kC=65,Rne=66,Bne=8,$ne=9,Fne=10,Hne=11,Vne=12,SC=13,Wne=19,zne=20,Une=29,qne=33,Kne=34,Qne=47,Yne=0,k3=1,S3=2,eu=3,O3=4;class Ha{constructor(e,n,r){this.parent=e,this.depth=n,this.type=r,this.hash=(e?e.hash+e.hash<<8:0)+n+(n<<4)+r}}Ha.top=new Ha(null,-1,Yne);function tu(t,e){for(let n=0,r=e-t.pos-1;;r--,n++){let i=t.peek(r);if(Gi(i)||i==-1)return n}}function P3(t){return t==32||t==9}function Gi(t){return t==10||t==13}function OC(t){return P3(t)||Gi(t)}function Va(t){return t<0||OC(t)}const Xne=new Hte({start:Ha.top,reduce(t,e){return t.type==eu&&(e==zne||e==Kne)?t.parent:t},shift(t,e,n,r){if(e==xC)return new Ha(t,tu(r,r.pos),k3);if(e==kC||e==CC)return new Ha(t,tu(r,r.pos),S3);if(e==ol)return t.parent;if(e==Wne||e==qne)return new Ha(t,0,eu);if(e==SC&&t.type==O3)return t.parent;if(e==Qne){let i=/[1-9]/.exec(r.read(r.pos,n.pos));if(i)return new Ha(t,t.depth+ +i[0],O3)}return t},hash(t){return t.hash}});function al(t,e,n=0){return t.peek(n)==e&&t.peek(n+1)==e&&t.peek(n+2)==e&&Va(t.peek(n+3))}const Zne=new Gc((t,e)=>{if(t.next==-1&&e.canShift(_C))return t.acceptToken(_C);let n=t.peek(-1);if((Gi(n)||n<0)&&e.context.type!=eu){if(al(t,45))if(e.canShift(ol))t.acceptToken(ol);else return t.acceptToken(Tne,3);if(al(t,46))if(e.canShift(ol))t.acceptToken(ol);else return t.acceptToken(Nne,3);let r=0;for(;t.next==32;)r++,t.advance();(r<e.context.depth||r==e.context.depth&&e.context.type==k3&&(t.next!=45||!Va(t.peek(1))))&&t.next!=-1&&!Gi(t.next)&&t.next!=35&&t.acceptToken(ol,-r)}},{contextual:!0}),Gne=new Gc((t,e)=>{if(e.context.type==eu){t.next==63&&(t.advance(),Va(t.next)&&t.acceptToken(jne));return}if(t.next==45)t.advance(),Va(t.next)&&t.acceptToken(e.context.type==k3&&e.context.depth==tu(t,t.pos-1)?Ine:xC);else if(t.next==63)t.advance(),Va(t.next)&&t.acceptToken(e.context.type==S3&&e.context.depth==tu(t,t.pos-1)?Lne:CC);else{let n=t.pos;for(;;)if(P3(t.next)){if(t.pos==n)return;t.advance()}else if(t.next==33)AC(t);else if(t.next==38)E3(t);else if(t.next==42){E3(t);break}else if(t.next==39||t.next==34){if(A3(t,!0))break;return}else if(t.next==91||t.next==123){if(!ere(t))return;break}else{DC(t,!0,!1,0);break}for(;P3(t.next);)t.advance();if(t.next==58){if(t.pos==n&&e.canShift(Une))return;let r=t.peek(1);Va(r)&&t.acceptTokenTo(e.context.type==S3&&e.context.depth==tu(t,n)?Rne:kC,n)}}},{contextual:!0});function Jne(t){return t>32&&t<127&&t!=34&&t!=37&&t!=44&&t!=60&&t!=62&&t!=92&&t!=94&&t!=96&&t!=123&&t!=124&&t!=125}function PC(t){return t>=48&&t<=57||t>=97&&t<=102||t>=65&&t<=70}function EC(t,e){return t.next==37?(t.advance(),PC(t.next)&&t.advance(),PC(t.next)&&t.advance(),!0):Jne(t.next)||e&&t.next==44?(t.advance(),!0):!1}function AC(t){if(t.advance(),t.next==60){for(t.advance();;)if(!EC(t,!0)){t.next==62&&t.advance();break}}else for(;EC(t,!1););}function E3(t){for(t.advance();!Va(t.next)&&Oh(t.tag)!="f";)t.advance()}function A3(t,e){let n=t.next,r=!1,i=t.pos;for(t.advance();;){let o=t.next;if(o<0)break;if(t.advance(),o==n)if(o==39)if(t.next==39)t.advance();else break;else break;else if(o==92&&n==34)t.next>=0&&t.advance();else if(Gi(o)){if(e)return!1;r=!0}else if(e&&t.pos>=i+1024)return!1}return!r}function ere(t){for(let e=[],n=t.pos+1024;;)if(t.next==91||t.next==123)e.push(t.next),t.advance();else if(t.next==39||t.next==34){if(!A3(t,!0))return!1}else if(t.next==93||t.next==125){if(e[e.length-1]!=t.next-2)return!1;if(e.pop(),t.advance(),!e.length)return!0}else{if(t.next<0||t.pos>n||Gi(t.next))return!1;t.advance()}}const tre="iiisiiissisfissssssssssssisssiiissssssssssssssssssssssssssfsfssissssssssssssssssssssssssssfif";function Oh(t){return t<33?"u":t>125?"s":tre[t-33]}function D3(t,e){let n=Oh(t);return n!="u"&&!(e&&n=="f")}function DC(t,e,n,r){if(Oh(t.next)=="s"||(t.next==63||t.next==58||t.next==45)&&D3(t.peek(1),n))t.advance();else return!1;let i=t.pos;for(;;){let o=t.next,a=0,s=r+1;for(;OC(o);){if(Gi(o)){if(e)return!1;s=0}else s++;o=t.peek(++a)}if(!(o>=0&&(o==58?D3(t.peek(a+1),n):o==35?t.peek(a-1)!=32:D3(o,n)))||!n&&s<=r||s==0&&!n&&(al(t,45,a)||al(t,46,a)))break;if(e&&Oh(o)=="f")return!1;for(let c=a;c>=0;c--)t.advance();if(e&&t.pos>i+1024)return!1}return!0}const nre=new Gc((t,e)=>{if(t.next==33)AC(t),t.acceptToken(Vne);else if(t.next==38||t.next==42){let n=t.next==38?Fne:Hne;E3(t),t.acceptToken(n)}else t.next==39||t.next==34?(A3(t,!1),t.acceptToken($ne)):DC(t,!1,e.context.type==eu,e.context.depth)&&t.acceptToken(Bne)}),rre=new Gc((t,e)=>{let n=e.context.type==O3?e.context.depth:-1,r=t.pos;e:for(;;){let i=0,o=t.next;for(;o==32;)o=t.peek(++i);if(!i&&(al(t,45,i)||al(t,46,i))||!Gi(o)&&(n<0&&(n=Math.max(e.context.depth+1,i)),i<n))break;for(;;){if(t.next<0)break e;let a=Gi(t.next);if(t.advance(),a)continue e;r=t.pos}}t.acceptTokenTo(SC,r)}),ire=Rc({DirectiveName:B.keyword,DirectiveContent:B.attributeValue,"DirectiveEnd DocEnd":B.meta,QuotedLiteral:B.string,BlockLiteralHeader:B.special(B.string),BlockLiteralContent:B.content,Literal:B.content,"Key/Literal Key/QuotedLiteral":B.definition(B.propertyName),"Anchor Alias":B.labelName,Tag:B.typeName,Comment:B.lineComment,": , -":B.separator,"?":B.punctuation,"[ ]":B.squareBracket,"{ }":B.brace}),ore=Ba.deserialize({version:14,states:"5lQ!ZQgOOO#PQfO'#CpO#uQfO'#DOOOQR'#Dv'#DvO$qQgO'#DRO%gQdO'#DUO%nQgO'#DUO&ROaO'#D[OOQR'#Du'#DuO&{QgO'#D^O'rQgO'#D`OOQR'#Dt'#DtO(iOqO'#DbOOQP'#Dj'#DjO(zQaO'#CmO)YQgO'#CmOOQP'#Cm'#CmQ)jQaOOQ)uQgOOQ]QgOOO*PQdO'#CrO*nQdO'#CtOOQO'#Dw'#DwO+]Q`O'#CxO+hQdO'#CwO+rQ`O'#CwOOQO'#Cv'#CvO+wQdO'#CvOOQO'#Cq'#CqO,UQ`O,59[O,^QfO,59[OOQR,59[,59[OOQO'#Cx'#CxO,eQ`O'#DPO,pQdO'#DPOOQO'#Dx'#DxO,zQdO'#DxO-XQ`O,59jO-aQfO,59jOOQR,59j,59jOOQR'#DS'#DSO-hQcO,59mO-sQgO'#DVO.TQ`O'#DVO.YQcO,59pOOQR'#DX'#DXO#|QfO'#DWO.hQcO'#DWOOQR,59v,59vO.yOWO,59vO/OOaO,59vO/WOaO,59vO/cQgO'#D_OOQR,59x,59xO0VQgO'#DaOOQR,59z,59zOOQP,59|,59|O0yOaO,59|O1ROaO,59|O1aOqO,59|OOQP-E7h-E7hO1oQgO,59XOOQP,59X,59XO2PQaO'#DeO2_QgO'#DeO2oQgO'#DkOOQP'#Dk'#DkQ)jQaOOO3PQdO'#CsOOQO,59^,59^O3kQdO'#CuOOQO,59`,59`OOQO,59c,59cO4VQdO,59cO4aQdO'#CzO4kQ`O'#CzOOQO,59b,59bOOQU,5:Q,5:QOOQR1G.v1G.vO4pQ`O1G.vOOQU-E7d-E7dO4xQdO,59kOOQO,59k,59kO5SQdO'#DQO5^Q`O'#DQOOQO,5:d,5:dOOQU,5:R,5:ROOQR1G/U1G/UO5cQ`O1G/UOOQU-E7e-E7eO5kQgO'#DhO5xQcO1G/XOOQR1G/X1G/XOOQR,59q,59qO6TQgO,59qO6eQdO'#DiO6lQgO'#DiO7PQcO1G/[OOQR1G/[1G/[OOQR,59r,59rO#|QfO,59rOOQR1G/b1G/bO7_OWO1G/bO7dOaO1G/bOOQR,59y,59yOOQR,59{,59{OOQP1G/h1G/hO7lOaO1G/hO7tOaO1G/hO8POaO1G/hOOQP1G.s1G.sO8_QgO,5:POOQP,5:P,5:POOQP,5:V,5:VOOQP-E7i-E7iOOQO,59_,59_OOQO,59a,59aOOQO1G.}1G.}OOQO,59f,59fO8oQdO,59fOOQR7+$b7+$bP,XQ`O'#DfOOQO1G/V1G/VOOQO,59l,59lO8yQdO,59lOOQR7+$p7+$pP9TQ`O'#DgOOQR'#DT'#DTOOQR,5:S,5:SOOQR-E7f-E7fOOQR7+$s7+$sOOQR1G/]1G/]O9YQgO'#DYO9jQ`O'#DYOOQR,5:T,5:TO#|QfO'#DZO9oQcO'#DZOOQR-E7g-E7gOOQR7+$v7+$vOOQR1G/^1G/^OOQR7+$|7+$|O:QOWO7+$|OOQP7+%S7+%SO:VOaO7+%SO:_OaO7+%SOOQP1G/k1G/kOOQO1G/Q1G/QOOQO1G/W1G/WOOQR,59t,59tO:jQgO,59tOOQR,59u,59uO#|QfO,59uOOQR<<Hh<<HhOOQP<<Hn<<HnO:zOaO<<HnOOQR1G/`1G/`OOQR1G/a1G/aOOQPAN>YAN>Y",stateData:";S~O!fOS!gOS^OS~OP_OQbORSOTUOWROXROYYOZZO[XOcPOqQO!PVO!V[O!cTO~O`cO~P]OVkOWROXROYeOZfO[dOcPOmhOqQO~OboO~P!bOVtOWROXROYeOZfO[dOcPOmrOqQO~OpwO~P#WORSOTUOWROXROYYOZZO[XOcPOqQO!PVO!cTO~OSvP!avP!bvP~P#|OWROXROYeOZfO[dOcPOqQO~OmzO~P%OOm!OOUzP!azP!bzP!dzP~P#|O^!SO!b!QO!f!TO!g!RO~ORSOTUOWROXROcPOqQO!PVO!cTO~OY!UOP!QXQ!QX!V!QX!`!QXS!QX!a!QX!b!QXU!QXm!QX!d!QX~P&aO[!WOP!SXQ!SX!V!SX!`!SXS!SX!a!SX!b!SXU!SXm!SX!d!SX~P&aO^!ZO!W![O!b!YO!f!]O!g!YO~OP!_O!V[OQaX!`aX~OPaXQaX!VaX!`aX~P#|OP!bOQ!cO!V[O~OP_O!V[O~P#|OWROXROY!fOcPOqQObfXmfXofXpfX~OWROXRO[!hOcPOqQObhXmhXohXphX~ObeXmlXoeX~ObkXokX~P%OOm!kO~Om!lObnPonP~P%OOb!pOo!oO~Ob!pO~P!bOm!sOosXpsX~OosXpsX~P%OOm!uOotPptP~P%OOo!xOp!yO~Op!yO~P#WOS!|O!a#OO!b#OO~OUyX!ayX!byX!dyX~P#|Om#QO~OU#SO!a#UO!b#UO!d#RO~Om#WOUzX!azX!bzX!dzX~O]#XO~O!b#XO!g#YO~O^#ZO!b#XO!g#YO~OP!RXQ!RX!V!RX!`!RXS!RX!a!RX!b!RXU!RXm!RX!d!RX~P&aOP!TXQ!TX!V!TX!`!TXS!TX!a!TX!b!TXU!TXm!TX!d!TX~P&aO!b#^O!g#^O~O^#_O!b#^O!f#`O!g#^O~O^#_O!W#aO!b#^O!g#^O~OPaaQaa!Vaa!`aa~P#|OP#cO!V[OQ!XX!`!XX~OP!XXQ!XX!V!XX!`!XX~P#|OP_O!V[OQ!_X!`!_X~P#|OWROXROcPOqQObgXmgXogXpgX~OWROXROcPOqQObiXmiXoiXpiX~Obkaoka~P%OObnXonX~P%OOm#kO~Ob#lOo!oO~Oosapsa~P%OOotXptX~P%OOm#pO~Oo!xOp#qO~OSwP!awP!bwP~P#|OS!|O!a#vO!b#vO~OUya!aya!bya!dya~P#|Om#xO~P%OOm#{OU}P!a}P!b}P!d}P~P#|OU#SO!a$OO!b$OO!d#RO~O]$QO~O!b$QO!g$RO~O!b$SO!g$SO~O^$TO!b$SO!g$SO~O^$TO!b$SO!f$UO!g$SO~OP!XaQ!Xa!V!Xa!`!Xa~P#|Obnaona~P%OOotapta~P%OOo!xO~OU|X!a|X!b|X!d|X~P#|Om$ZO~Om$]OU}X!a}X!b}X!d}X~O]$^O~O!b$_O!g$_O~O^$`O!b$_O!g$_O~OU|a!a|a!b|a!d|a~P#|O!b$cO!g$cO~O",goto:",]!mPPPPPPPPPPPPPPPPP!nPP!v#v#|$`#|$c$f$j$nP%VPPP!v%Y%^%a%{&O%a&R&U&X&_&b%aP&e&{&e'O'RPP']'a'g'm's'y(XPPPPPPPP(_)e*X+c,VUaObcR#e!c!{ROPQSTUXY_bcdehknrtvz!O!U!W!_!b!c!f!h!k!l!s!u!|#Q#R#S#W#c#k#p#x#{$Z$]QmPR!qnqfPQThknrtv!k!l!s!u#R#k#pR!gdR!ieTlPnTjPnSiPnSqQvQ{TQ!mkQ!trQ!vtR#y#RR!nkTsQvR!wt!RWOSUXY_bcz!O!U!W!_!b!c!|#Q#S#W#c#x#{$Z$]RySR#t!|R|TR|UQ!PUR#|#SR#z#RR#z#SyZOSU_bcz!O!_!b!c!|#Q#S#W#c#x#{$Z$]R!VXR!XYa]O^abc!a!c!eT!da!eQnPR!rnQvQR!{vQ!}yR#u!}Q#T|R#}#TW^Obc!cS!^^!aT!aa!eQ!eaR#f!eW`Obc!cQxSS}U#SQ!`_Q#PzQ#V!OQ#b!_Q#d!bQ#s!|Q#w#QQ$P#WQ$V#cQ$Y#xQ$[#{Q$a$ZR$b$]xZOSU_bcz!O!_!b!c!|#Q#S#W#c#x#{$Z$]Q!VXQ!XYQ#[!UR#]!W!QWOSUXY_bcz!O!U!W!_!b!c!|#Q#S#W#c#x#{$Z$]pfPQThknrtv!k!l!s!u#R#k#pQ!gdQ!ieQ#g!fR#h!hSgPn^pQTkrtv#RQ!jhQ#i!kQ#j!lQ#n!sQ#o!uQ$W#kR$X#pQuQR!zv",nodeNames:"⚠ DirectiveEnd DocEnd - - ? ? ? Literal QuotedLiteral Anchor Alias Tag BlockLiteralContent Comment Stream BOM Document ] [ FlowSequence Item Tagged Anchored Anchored Tagged FlowMapping Pair Key : Pair , } { FlowMapping Pair Pair BlockSequence Item Item BlockMapping Pair Pair Key Pair Pair BlockLiteral BlockLiteralHeader Tagged Anchored Anchored Tagged Directive DirectiveName DirectiveContent Document",maxTerm:74,context:Xne,nodeProps:[["isolate",-3,8,9,14,""],["openedBy",18,"[",32,"{"],["closedBy",19,"]",33,"}"]],propSources:[ire],skippedNodes:[0],repeatNodeCount:6,tokenData:"-Y~RnOX#PXY$QYZ$]Z]#P]^$]^p#Ppq$Qqs#Pst$btu#Puv$yv|#P|}&e}![#P![!]'O!]!`#P!`!a'i!a!}#P!}#O*g#O#P#P#P#Q+Q#Q#o#P#o#p+k#p#q'i#q#r,U#r;'S#P;'S;=`#z<%l?HT#P?HT?HU,o?HUO#PQ#UU!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PQ#kTOY#PZs#Pt;'S#P;'S;=`#z<%lO#PQ#}P;=`<%l#P~$VQ!f~XY$Qpq$Q~$bO!g~~$gS^~OY$bZ;'S$b;'S;=`$s<%lO$b~$vP;=`<%l$bR%OX!WQOX%kXY#PZ]%k]^#P^p%kpq#hq;'S%k;'S;=`&_<%lO%kR%rX!WQ!VPOX%kXY#PZ]%k]^#P^p%kpq#hq;'S%k;'S;=`&_<%lO%kR&bP;=`<%l%kR&lUoP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR'VUmP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR'p[!PP!WQOY#PZp#Ppq#hq{#P{|(f|}#P}!O(f!O!R#P!R![)p![;'S#P;'S;=`#z<%lO#PR(mW!PP!WQOY#PZp#Ppq#hq!R#P!R![)V![;'S#P;'S;=`#z<%lO#PR)^U!PP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR)wY!PP!WQOY#PZp#Ppq#hq{#P{|)V|}#P}!O)V!O;'S#P;'S;=`#z<%lO#PR*nUcP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR+XUbP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR+rUqP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR,]UpP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR,vU`P!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#P",tokenizers:[Zne,Gne,nre,rre,0,1],topRules:{Stream:[0,15]},tokenPrec:0}),are=Ba.deserialize({version:14,states:"!vOQOPOOO]OPO'#C_OhOPO'#C^OOOO'#Cc'#CcOpOPO'#CaQOOOOOO{OPOOOOOO'#Cb'#CbO!WOPO'#C`O!`OPO,58xOOOO-E6a-E6aOOOO-E6`-E6`OOOO'#C_'#C_OOOO1G.d1G.d",stateData:"!h~OXPOYROWTP~OWVXXRXYRX~OYVOXSP~OXROYROWTX~OXROYROWTP~OYVOXSX~OX[O~OXY~",goto:"vWPPX[beioRUOQQOR]XRXQTTOUQWQRZWSSOURYS",nodeNames:"⚠ Document Frontmatter DashLine FrontmatterContent Body",maxTerm:10,skippedNodes:[0],repeatNodeCount:2,tokenData:"$z~RXOYnYZ!^Z]n]^!^^}n}!O!i!O;'Sn;'S;=`!c<%lOn~qXOYnYZ!^Z]n]^!^^;'Sn;'S;=`!c<%l~n~On~~!^~!cOY~~!fP;=`<%ln~!lZOYnYZ!^Z]n]^!^^}n}!O#_!O;'Sn;'S;=`!c<%l~n~On~~!^~#bZOYnYZ!^Z]n]^!^^}n}!O$T!O;'Sn;'S;=`!c<%l~n~On~~!^~$WXOYnYZ$sZ]n]^$s^;'Sn;'S;=`!c<%l~n~On~~$s~$zOX~Y~",tokenizers:[0],topRules:{Document:[0,1]},tokenPrec:67}),sre=Na.define({name:"yaml",parser:ore.configure({props:[Zd.add({Stream:t=>{for(let e=t.node.resolve(t.pos,-1);e&&e.to>=t.pos;e=e.parent){if(e.name=="BlockLiteralContent"&&e.from<e.to)return t.baseIndentFor(e);if(e.name=="BlockLiteral")return t.baseIndentFor(e)+t.unit;if(e.name=="BlockSequence"||e.name=="BlockMapping")return t.column(e.from,1);if(e.name=="QuotedLiteral")return null;if(e.name=="Literal"){let n=t.column(e.from,1);if(n==t.lineIndent(e.from,1))return n;if(e.to>t.pos)return null}}return null},FlowMapping:Jw({closing:"}"}),FlowSequence:Jw({closing:"]"})}),Gd.add({"FlowMapping FlowSequence":t_,"Item Pair BlockLiteral":(t,e)=>({from:e.doc.lineAt(t.from).to,to:t.to})})]}),languageData:{commentTokens:{line:"#"},indentOnInput:/^\s*[\]\}]$/}});function lre(){return new Ng(sre)}B.meta;const M3={codeEditor:"_codeEditor_7ct2r_1",codeEditor_label:"_codeEditor_label_7ct2r_4",codeEditor_input:"_codeEditor_input_7ct2r_13"},cre=t=>{const{userFlow:e,responseKey:n,label:r,language:i,placeholder:o,value:a,required:s,dependencies:l,disabled:c}=t,[u,f]=S.useState(a??""),{disabled:d}=No(e,l),h=c??d,m={json:aC(),sql:Mne(),yaml:lre()},g=S.useMemo(()=>s&&r?`${r} *`:r??"",[r,s]),p=v=>{f(v);const _={[n]:v};oi(e,_)};return K.jsxs("div",{className:M3.codeEditor,children:[K.jsx("label",{className:M3.codeEditor_label,children:g}),K.jsx(Gx,{className:M3.codeEditor_input,value:u,height:"400px",placeholder:o,extensions:[m[i]??aC()],onChange:v=>p(v),theme:"dark",editable:!h})]})};var MC={exports:{}};/*!
|
|
592
592
|
Copyright (c) 2018 Jed Watson.
|
|
593
593
|
Licensed under the MIT License (MIT), see
|
|
@@ -637,7 +637,7 @@ Expecting `+J.join(", ")+", got '"+(this.terminals_[M]||M)+"'":pe="Parse error o
|
|
|
637
637
|
*
|
|
638
638
|
* This source code is licensed under the MIT license found in the
|
|
639
639
|
* LICENSE file in the root directory of this source tree.
|
|
640
|
-
*/var Rk;function Pie(){if(Rk)return dv;Rk=1;var t=S,e=Oie();function n(c,u){return c===u&&(c!==0||1/c===1/u)||c!==c&&u!==u}var r=typeof Object.is=="function"?Object.is:n,i=e.useSyncExternalStore,o=t.useRef,a=t.useEffect,s=t.useMemo,l=t.useDebugValue;return dv.useSyncExternalStoreWithSelector=function(c,u,f,d,h){var m=o(null);if(m.current===null){var g={hasValue:!1,value:null};m.current=g}else g=m.current;m=s(function(){function v(k){if(!_){if(_=!0,w=k,k=d(k),h!==void 0&&g.hasValue){var C=g.value;if(h(C,k))return b=C}return b=k}if(C=b,r(w,k))return C;var E=d(k);return h!==void 0&&h(C,E)?(w=k,C):(w=k,b=E)}var _=!1,w,b,y=f===void 0?null:f;return[function(){return v(u())},y===null?void 0:function(){return v(y())}]},[u,f,d,h]);var p=i(c,m[0],m[1]);return a(function(){g.hasValue=!0,g.value=p},[p]),l(p),p},dv}Ik.exports=Pie();var Eie=Ik.exports,mv=S.createContext(null),Aie=t=>t,ht=()=>{var t=S.useContext(mv);return t?t.store.dispatch:Aie},Uh=()=>{},Die=()=>Uh,Mie=(t,e)=>t===e;function de(t){var e=S.useContext(mv);return Eie.useSyncExternalStoreWithSelector(e?e.subscription.addNestedSub:Die,e?e.store.getState:Uh,e?e.store.getState:Uh,e?t:Uh,Mie)}function Tie(t,e=`expected a function, instead received ${typeof t}`){if(typeof t!="function")throw new TypeError(e)}function Nie(t,e=`expected an object, instead received ${typeof t}`){if(typeof t!="object")throw new TypeError(e)}function Iie(t,e="expected all items to be functions, instead received the following types: "){if(!t.every(n=>typeof n=="function")){const n=t.map(r=>typeof r=="function"?`function ${r.name||"unnamed"}()`:typeof r).join(", ");throw new TypeError(`${e}[${n}]`)}}var Bk=t=>Array.isArray(t)?t:[t];function Lie(t){const e=Array.isArray(t[0])?t[0]:t;return Iie(e,"createSelector expects all input-selectors to be functions, but received the following types: "),e}function jie(t,e){const n=[],{length:r}=t;for(let i=0;i<r;i++)n.push(t[i].apply(null,e));return n}var Rie=class{constructor(t){this.value=t}deref(){return this.value}},Bie=typeof WeakRef<"u"?WeakRef:Rie,$ie=0,$k=1;function qh(){return{s:$ie,v:void 0,o:null,p:null}}function Fk(t,e={}){let n=qh();const{resultEqualityCheck:r}=e;let i,o=0;function a(){var f;let s=n;const{length:l}=arguments;for(let d=0,h=l;d<h;d++){const m=arguments[d];if(typeof m=="function"||typeof m=="object"&&m!==null){let g=s.o;g===null&&(s.o=g=new WeakMap);const p=g.get(m);p===void 0?(s=qh(),g.set(m,s)):s=p}else{let g=s.p;g===null&&(s.p=g=new Map);const p=g.get(m);p===void 0?(s=qh(),g.set(m,s)):s=p}}const c=s;let u;if(s.s===$k)u=s.v;else if(u=t.apply(null,arguments),o++,r){const d=((f=i==null?void 0:i.deref)==null?void 0:f.call(i))??i;d!=null&&r(d,u)&&(u=d,o!==0&&o--),i=typeof u=="object"&&u!==null||typeof u=="function"?new Bie(u):u}return c.s=$k,c.v=u,u}return a.clearCache=()=>{n=qh(),a.resetResultsCount()},a.resultsCount=()=>o,a.resetResultsCount=()=>{o=0},a}function Fie(t,...e){const n=typeof t=="function"?{memoize:t,memoizeOptions:e}:t,r=(...i)=>{let o=0,a=0,s,l={},c=i.pop();typeof c=="object"&&(l=c,c=i.pop()),Tie(c,`createSelector expects an output function after the inputs, but received: [${typeof c}]`);const u={...n,...l},{memoize:f,memoizeOptions:d=[],argsMemoize:h=Fk,argsMemoizeOptions:m=[],devModeChecks:g={}}=u,p=Bk(d),v=Bk(m),_=Lie(i),w=f(function(){return o++,c.apply(null,arguments)},...p),b=h(function(){a++;const k=jie(_,arguments);return s=w.apply(null,k),s},...v);return Object.assign(b,{resultFunc:c,memoizedResultFunc:w,dependencies:_,dependencyRecomputations:()=>a,resetDependencyRecomputations:()=>{a=0},lastResult:()=>s,recomputations:()=>o,resetRecomputations:()=>{o=0},memoize:f,argsMemoize:h})};return Object.assign(r,{withTypes:()=>r}),r}var H=Fie(Fk),Hie=Object.assign((t,e=H)=>{Nie(t,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof t}`);const n=Object.keys(t),r=n.map(o=>t[o]);return e(r,(...o)=>o.reduce((a,s,l)=>(a[n[l]]=s,a),{}))},{withTypes:()=>Hie}),Hk={},Vk={},Wk={};(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function e(r){return typeof r=="symbol"?1:r===null?2:r===void 0?3:r!==r?4:0}const n=(r,i,o)=>{if(r!==i){const a=e(r),s=e(i);if(a===s&&a===0){if(r<i)return o==="desc"?1:-1;if(r>i)return o==="desc"?-1:1}return o==="desc"?s-a:a-s}return 0};t.compareValues=n})(Wk);var zk={},gv={};(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function e(n){return typeof n=="symbol"||n instanceof Symbol}t.isSymbol=e})(gv),function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=gv,n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;function i(o,a){return Array.isArray(o)?!1:typeof o=="number"||typeof o=="boolean"||o==null||e.isSymbol(o)?!0:typeof o=="string"&&(r.test(o)||!n.test(o))||a!=null&&Object.hasOwn(a,o)}t.isKey=i}(zk),function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=Wk,n=zk,r=Dh;function i(o,a,s,l){if(o==null)return[];s=l?void 0:s,Array.isArray(o)||(o=Object.values(o)),Array.isArray(a)||(a=a==null?[null]:[a]),a.length===0&&(a=[null]),Array.isArray(s)||(s=s==null?[]:[s]),s=s.map(h=>String(h));const c=(h,m)=>{let g=h;for(let p=0;p<m.length&&g!=null;++p)g=g[m[p]];return g},u=(h,m)=>m==null||h==null?m:typeof h=="object"&&"key"in h?Object.hasOwn(m,h.key)?m[h.key]:c(m,h.path):typeof h=="function"?h(m):Array.isArray(h)?c(m,h):typeof m=="object"?m[h]:m,f=a.map(h=>(Array.isArray(h)&&h.length===1&&(h=h[0]),h==null||typeof h=="function"||Array.isArray(h)||n.isKey(h)?h:{key:h,path:r.toPath(h)}));return o.map(h=>({original:h,criteria:f.map(m=>u(m,h))})).slice().sort((h,m)=>{for(let g=0;g<f.length;g++){const p=e.compareValues(h.criteria[g],m.criteria[g],s[g]);if(p!==0)return p}return 0}).map(h=>h.original)}t.orderBy=i}(Vk);var Uk={};(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function e(n,r=1){const i=[],o=Math.floor(r),a=(s,l)=>{for(let c=0;c<s.length;c++){const u=s[c];Array.isArray(u)&&l<o?a(u,l+1):i.push(u)}};return a(n,0),i}t.flatten=e})(Uk);var vv={};(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=fv,n=Hh,r=av,i=Vh;function o(a,s,l){return r.isObject(l)&&(typeof s=="number"&&n.isArrayLike(l)&&e.isIndex(s)&&s<l.length||typeof s=="string"&&s in l)?i.eq(l[s],a):!1}t.isIterateeCall=o})(vv),function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=Vk,n=Uk,r=vv;function i(o,...a){const s=a.length;return s>1&&r.isIterateeCall(o,a[0],a[1])?a=[]:s>2&&r.isIterateeCall(a[0],a[1],a[2])&&(a=[a[0]]),e.orderBy(o,n.flatten(a),["asc"])}t.sortBy=i}(Hk);var Vie=Hk.sortBy;const Kh=hr(Vie);var qk=t=>t.legend.settings,Wie=t=>t.legend.size,zie=t=>t.legend.payload,Uie=H([zie,qk],(t,e)=>{var{itemSorter:n}=e,r=t.flat(1);return n?Kh(r,n):r});function qie(){return de(Uie)}var Qh=1;function Kk(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],[e,n]=S.useState({height:0,left:0,top:0,width:0}),r=S.useCallback(i=>{if(i!=null){var o=i.getBoundingClientRect(),a={height:o.height,left:o.left,top:o.top,width:o.width};(Math.abs(a.height-e.height)>Qh||Math.abs(a.left-e.left)>Qh||Math.abs(a.top-e.top)>Qh||Math.abs(a.width-e.width)>Qh)&&n({height:a.height,left:a.left,top:a.top,width:a.width})}},[e.width,e.height,e.top,e.left,...t]);return[e,r]}function un(t){return`Minified Redux error #${t}; visit https://redux.js.org/Errors?code=${t} for the full message or use the non-minified dev environment for full errors. `}var Kie=typeof Symbol=="function"&&Symbol.observable||"@@observable",Qk=Kie,yv=()=>Math.random().toString(36).substring(7).split("").join("."),Qie={INIT:`@@redux/INIT${yv()}`,REPLACE:`@@redux/REPLACE${yv()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${yv()}`},Yh=Qie;function bv(t){if(typeof t!="object"||t===null)return!1;let e=t;for(;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e||Object.getPrototypeOf(t)===null}function Yk(t,e,n){if(typeof t!="function")throw new Error(un(2));if(typeof e=="function"&&typeof n=="function"||typeof n=="function"&&typeof arguments[3]=="function")throw new Error(un(0));if(typeof e=="function"&&typeof n>"u"&&(n=e,e=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(un(1));return n(Yk)(t,e)}let r=t,i=e,o=new Map,a=o,s=0,l=!1;function c(){a===o&&(a=new Map,o.forEach((p,v)=>{a.set(v,p)}))}function u(){if(l)throw new Error(un(3));return i}function f(p){if(typeof p!="function")throw new Error(un(4));if(l)throw new Error(un(5));let v=!0;c();const _=s++;return a.set(_,p),function(){if(v){if(l)throw new Error(un(6));v=!1,c(),a.delete(_),o=null}}}function d(p){if(!bv(p))throw new Error(un(7));if(typeof p.type>"u")throw new Error(un(8));if(typeof p.type!="string")throw new Error(un(17));if(l)throw new Error(un(9));try{l=!0,i=r(i,p)}finally{l=!1}return(o=a).forEach(_=>{_()}),p}function h(p){if(typeof p!="function")throw new Error(un(10));r=p,d({type:Yh.REPLACE})}function m(){const p=f;return{subscribe(v){if(typeof v!="object"||v===null)throw new Error(un(11));function _(){const b=v;b.next&&b.next(u())}return _(),{unsubscribe:p(_)}},[Qk](){return this}}}return d({type:Yh.INIT}),{dispatch:d,subscribe:f,getState:u,replaceReducer:h,[Qk]:m}}function Yie(t){Object.keys(t).forEach(e=>{const n=t[e];if(typeof n(void 0,{type:Yh.INIT})>"u")throw new Error(un(12));if(typeof n(void 0,{type:Yh.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(un(13))})}function Xk(t){const e=Object.keys(t),n={};for(let o=0;o<e.length;o++){const a=e[o];typeof t[a]=="function"&&(n[a]=t[a])}const r=Object.keys(n);let i;try{Yie(n)}catch(o){i=o}return function(a={},s){if(i)throw i;let l=!1;const c={};for(let u=0;u<r.length;u++){const f=r[u],d=n[f],h=a[f],m=d(h,s);if(typeof m>"u")throw s&&s.type,new Error(un(14));c[f]=m,l=l||m!==h}return l=l||r.length!==Object.keys(a).length,l?c:a}}function Xh(...t){return t.length===0?e=>e:t.length===1?t[0]:t.reduce((e,n)=>(...r)=>e(n(...r)))}function Xie(...t){return e=>(n,r)=>{const i=e(n,r);let o=()=>{throw new Error(un(15))};const a={getState:i.getState,dispatch:(l,...c)=>o(l,...c)},s=t.map(l=>l(a));return o=Xh(...s)(i.dispatch),{...i,dispatch:o}}}function Zk(t){return bv(t)&&"type"in t&&typeof t.type=="string"}var Gk=Symbol.for("immer-nothing"),Jk=Symbol.for("immer-draftable"),rr=Symbol.for("immer-state");function Wr(t,...e){throw new Error(`[Immer] minified error nr: ${t}. Full error at: https://bit.ly/3cXEKWf`)}var cl=Object.getPrototypeOf;function Ua(t){return!!t&&!!t[rr]}function eo(t){var e;return t?eS(t)||Array.isArray(t)||!!t[Jk]||!!((e=t.constructor)!=null&&e[Jk])||Jh(t)||ep(t):!1}var Zie=Object.prototype.constructor.toString();function eS(t){if(!t||typeof t!="object")return!1;const e=cl(t);if(e===null)return!0;const n=Object.hasOwnProperty.call(e,"constructor")&&e.constructor;return n===Object?!0:typeof n=="function"&&Function.toString.call(n)===Zie}function Zh(t,e){Gh(t)===0?Reflect.ownKeys(t).forEach(n=>{e(n,t[n],t)}):t.forEach((n,r)=>e(r,n,t))}function Gh(t){const e=t[rr];return e?e.type_:Array.isArray(t)?1:Jh(t)?2:ep(t)?3:0}function wv(t,e){return Gh(t)===2?t.has(e):Object.prototype.hasOwnProperty.call(t,e)}function tS(t,e,n){const r=Gh(t);r===2?t.set(e,n):r===3?t.add(n):t[e]=n}function Gie(t,e){return t===e?t!==0||1/t===1/e:t!==t&&e!==e}function Jh(t){return t instanceof Map}function ep(t){return t instanceof Set}function qa(t){return t.copy_||t.base_}function _v(t,e){if(Jh(t))return new Map(t);if(ep(t))return new Set(t);if(Array.isArray(t))return Array.prototype.slice.call(t);const n=eS(t);if(e===!0||e==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(t);delete r[rr];let i=Reflect.ownKeys(r);for(let o=0;o<i.length;o++){const a=i[o],s=r[a];s.writable===!1&&(s.writable=!0,s.configurable=!0),(s.get||s.set)&&(r[a]={configurable:!0,writable:!0,enumerable:s.enumerable,value:t[a]})}return Object.create(cl(t),r)}else{const r=cl(t);if(r!==null&&n)return{...t};const i=Object.create(r);return Object.assign(i,t)}}function xv(t,e=!1){return tp(t)||Ua(t)||!eo(t)||(Gh(t)>1&&(t.set=t.add=t.clear=t.delete=Jie),Object.freeze(t),e&&Object.entries(t).forEach(([n,r])=>xv(r,!0))),t}function Jie(){Wr(2)}function tp(t){return Object.isFrozen(t)}var eoe={};function Ka(t){const e=eoe[t];return e||Wr(0,t),e}var ou;function nS(){return ou}function toe(t,e){return{drafts_:[],parent_:t,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function rS(t,e){e&&(Ka("Patches"),t.patches_=[],t.inversePatches_=[],t.patchListener_=e)}function Cv(t){kv(t),t.drafts_.forEach(noe),t.drafts_=null}function kv(t){t===ou&&(ou=t.parent_)}function iS(t){return ou=toe(ou,t)}function noe(t){const e=t[rr];e.type_===0||e.type_===1?e.revoke_():e.revoked_=!0}function oS(t,e){e.unfinalizedDrafts_=e.drafts_.length;const n=e.drafts_[0];return t!==void 0&&t!==n?(n[rr].modified_&&(Cv(e),Wr(4)),eo(t)&&(t=np(e,t),e.parent_||rp(e,t)),e.patches_&&Ka("Patches").generateReplacementPatches_(n[rr].base_,t,e.patches_,e.inversePatches_)):t=np(e,n,[]),Cv(e),e.patches_&&e.patchListener_(e.patches_,e.inversePatches_),t!==Gk?t:void 0}function np(t,e,n){if(tp(e))return e;const r=e[rr];if(!r)return Zh(e,(i,o)=>aS(t,r,e,i,o,n)),e;if(r.scope_!==t)return e;if(!r.modified_)return rp(t,r.base_,!0),r.base_;if(!r.finalized_){r.finalized_=!0,r.scope_.unfinalizedDrafts_--;const i=r.copy_;let o=i,a=!1;r.type_===3&&(o=new Set(i),i.clear(),a=!0),Zh(o,(s,l)=>aS(t,r,i,s,l,n,a)),rp(t,i,!1),n&&t.patches_&&Ka("Patches").generatePatches_(r,n,t.patches_,t.inversePatches_)}return r.copy_}function aS(t,e,n,r,i,o,a){if(Ua(i)){const s=o&&e&&e.type_!==3&&!wv(e.assigned_,r)?o.concat(r):void 0,l=np(t,i,s);if(tS(n,r,l),Ua(l))t.canAutoFreeze_=!1;else return}else a&&n.add(i);if(eo(i)&&!tp(i)){if(!t.immer_.autoFreeze_&&t.unfinalizedDrafts_<1)return;np(t,i),(!e||!e.scope_.parent_)&&typeof r!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,r)&&rp(t,i)}}function rp(t,e,n=!1){!t.parent_&&t.immer_.autoFreeze_&&t.canAutoFreeze_&&xv(e,n)}function roe(t,e){const n=Array.isArray(t),r={type_:n?1:0,scope_:e?e.scope_:nS(),modified_:!1,finalized_:!1,assigned_:{},parent_:e,base_:t,draft_:null,copy_:null,revoke_:null,isManual_:!1};let i=r,o=Sv;n&&(i=[r],o=au);const{revoke:a,proxy:s}=Proxy.revocable(i,o);return r.draft_=s,r.revoke_=a,s}var Sv={get(t,e){if(e===rr)return t;const n=qa(t);if(!wv(n,e))return ioe(t,n,e);const r=n[e];return t.finalized_||!eo(r)?r:r===Ov(t.base_,e)?(Ev(t),t.copy_[e]=Av(r,t)):r},has(t,e){return e in qa(t)},ownKeys(t){return Reflect.ownKeys(qa(t))},set(t,e,n){const r=sS(qa(t),e);if(r!=null&&r.set)return r.set.call(t.draft_,n),!0;if(!t.modified_){const i=Ov(qa(t),e),o=i==null?void 0:i[rr];if(o&&o.base_===n)return t.copy_[e]=n,t.assigned_[e]=!1,!0;if(Gie(n,i)&&(n!==void 0||wv(t.base_,e)))return!0;Ev(t),Pv(t)}return t.copy_[e]===n&&(n!==void 0||e in t.copy_)||Number.isNaN(n)&&Number.isNaN(t.copy_[e])||(t.copy_[e]=n,t.assigned_[e]=!0),!0},deleteProperty(t,e){return Ov(t.base_,e)!==void 0||e in t.base_?(t.assigned_[e]=!1,Ev(t),Pv(t)):delete t.assigned_[e],t.copy_&&delete t.copy_[e],!0},getOwnPropertyDescriptor(t,e){const n=qa(t),r=Reflect.getOwnPropertyDescriptor(n,e);return r&&{writable:!0,configurable:t.type_!==1||e!=="length",enumerable:r.enumerable,value:n[e]}},defineProperty(){Wr(11)},getPrototypeOf(t){return cl(t.base_)},setPrototypeOf(){Wr(12)}},au={};Zh(Sv,(t,e)=>{au[t]=function(){return arguments[0]=arguments[0][0],e.apply(this,arguments)}}),au.deleteProperty=function(t,e){return au.set.call(this,t,e,void 0)},au.set=function(t,e,n){return Sv.set.call(this,t[0],e,n,t[0])};function Ov(t,e){const n=t[rr];return(n?qa(n):t)[e]}function ioe(t,e,n){var i;const r=sS(e,n);return r?"value"in r?r.value:(i=r.get)==null?void 0:i.call(t.draft_):void 0}function sS(t,e){if(!(e in t))return;let n=cl(t);for(;n;){const r=Object.getOwnPropertyDescriptor(n,e);if(r)return r;n=cl(n)}}function Pv(t){t.modified_||(t.modified_=!0,t.parent_&&Pv(t.parent_))}function Ev(t){t.copy_||(t.copy_=_v(t.base_,t.scope_.immer_.useStrictShallowCopy_))}var ooe=class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(e,n,r)=>{if(typeof e=="function"&&typeof n!="function"){const o=n;n=e;const a=this;return function(l=o,...c){return a.produce(l,u=>n.call(this,u,...c))}}typeof n!="function"&&Wr(6),r!==void 0&&typeof r!="function"&&Wr(7);let i;if(eo(e)){const o=iS(this),a=Av(e,void 0);let s=!0;try{i=n(a),s=!1}finally{s?Cv(o):kv(o)}return rS(o,r),oS(i,o)}else if(!e||typeof e!="object"){if(i=n(e),i===void 0&&(i=e),i===Gk&&(i=void 0),this.autoFreeze_&&xv(i,!0),r){const o=[],a=[];Ka("Patches").generateReplacementPatches_(e,i,o,a),r(o,a)}return i}else Wr(1,e)},this.produceWithPatches=(e,n)=>{if(typeof e=="function")return(a,...s)=>this.produceWithPatches(a,l=>e(l,...s));let r,i;return[this.produce(e,n,(a,s)=>{r=a,i=s}),r,i]},typeof(t==null?void 0:t.autoFreeze)=="boolean"&&this.setAutoFreeze(t.autoFreeze),typeof(t==null?void 0:t.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(t.useStrictShallowCopy)}createDraft(t){eo(t)||Wr(8),Ua(t)&&(t=to(t));const e=iS(this),n=Av(t,void 0);return n[rr].isManual_=!0,kv(e),n}finishDraft(t,e){const n=t&&t[rr];(!n||!n.isManual_)&&Wr(9);const{scope_:r}=n;return rS(r,e),oS(void 0,r)}setAutoFreeze(t){this.autoFreeze_=t}setUseStrictShallowCopy(t){this.useStrictShallowCopy_=t}applyPatches(t,e){let n;for(n=e.length-1;n>=0;n--){const i=e[n];if(i.path.length===0&&i.op==="replace"){t=i.value;break}}n>-1&&(e=e.slice(n+1));const r=Ka("Patches").applyPatches_;return Ua(t)?r(t,e):this.produce(t,i=>r(i,e))}};function Av(t,e){const n=Jh(t)?Ka("MapSet").proxyMap_(t,e):ep(t)?Ka("MapSet").proxySet_(t,e):roe(t,e);return(e?e.scope_:nS()).drafts_.push(n),n}function to(t){return Ua(t)||Wr(10,t),lS(t)}function lS(t){if(!eo(t)||tp(t))return t;const e=t[rr];let n;if(e){if(!e.modified_)return e.base_;e.finalized_=!0,n=_v(t,e.scope_.immer_.useStrictShallowCopy_)}else n=_v(t,!0);return Zh(n,(r,i)=>{tS(n,r,lS(i))}),e&&(e.finalized_=!1),n}var ir=new ooe,cS=ir.produce;ir.produceWithPatches.bind(ir),ir.setAutoFreeze.bind(ir),ir.setUseStrictShallowCopy.bind(ir),ir.applyPatches.bind(ir),ir.createDraft.bind(ir),ir.finishDraft.bind(ir);function Pye(t){return t}function uS(t){return({dispatch:n,getState:r})=>i=>o=>typeof o=="function"?o(n,r,t):i(o)}var aoe=uS(),soe=uS,fS={npm_package_exports___require:"./dist/avocado-not-front.umd.js",npm_package_devDependencies__types_node:"20.2.5",npm_package_devDependencies__testing_library_jest_dom:"6.4.0",npm_config_user_agent:"pnpm/9.10.0 npm/? node/v20.17.0 linux x64",CI:"true",npm_package_devDependencies__testing_library_user_event:"14.5.2",npm_package_devDependencies_vite:"5.0.12",npm_node_execpath:"/opt/hostedtoolcache/node/20.17.0/x64/bin/node",npm_package_publishConfig_access:"public",npm_package_files_0:"dist",HOME:"/home/runner",npm_package_dependencies_react_select_async_paginate:"0.7.3",npm_package_devDependencies_classnames:"2.3.2",npm_package_devDependencies_sass:"1.62.1",npm_config_auto_install_peers:"true",npm_package_devDependencies_vite_plugin_dts:"3.7.1",npm_package_dependencies__codemirror_lang_yaml:"6.1.2",npm_package_devDependencies_typescript:"5.1.3",npm_package_peerDependencies_react_select_async_paginate:"0.7.3",npm_package_types:"./dist/index.d.ts",npm_package_devDependencies__types_react_dom:"18.0.11",npm_package_devDependencies__vitejs_plugin_react_swc:"3.5.0",npm_package_type:"module",npm_package_dependencies_zustand:"4.5.4",npm_package_module:"./dist/avocado-not-front.es.js",npm_package_devDependencies__types_testing_library__jest_dom:"6.0.0",npm_package_dependencies__foris_avocado_icons:"workspace:*",npm_config_registry:"https://registry.npmjs.org/",npm_config_node_linker:"hoisted",npm_package_dependencies__codemirror_lang_json:"6.0.1",npm_package_exports___import:"./dist/avocado-not-front.es.js",npm_package_dependencies__foris_avocado_core:"workspace:*",npm_package_dependencies_axios:"^1.8.4",npm_package_dependencies_recharts:"3.1.0",npm_config_node_gyp:"/home/runner/setup-pnpm/node_modules/.pnpm/pnpm@9.10.0/node_modules/pnpm/dist/node_modules/node-gyp/bin/node-gyp.js",PATH:"/home/runner/work/avocado/avocado/packages/avocado-not-front/node_modules/.bin:/home/runner/setup-pnpm/node_modules/.pnpm/pnpm@9.10.0/node_modules/pnpm/dist/node-gyp-bin:/home/runner/work/avocado/avocado/node_modules/.bin:/home/runner/work/avocado/avocado/node_modules/.bin:/home/runner/setup-pnpm/node_modules/.pnpm/pnpm@9.10.0/node_modules/pnpm/dist/node-gyp-bin:/home/runner/work/avocado/avocado/node_modules/.bin:/opt/hostedtoolcache/node/20.17.0/x64/bin:/home/runner/setup-pnpm/node_modules/.bin:/snap/bin:/home/runner/.local/bin:/opt/pipx_bin:/home/runner/.cargo/bin:/home/runner/.config/composer/vendor/bin:/usr/local/.ghcup/bin:/home/runner/.dotnet/tools:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin",TURBO_HASH:"d852372f73184180",npm_package_name:"@foris/avocado-not-front",npm_package_scripts_start_stubby_examples:"stubby -d src/services/stubs/stubby-examples.yml -w -s 8300 -q",NODE:"/opt/hostedtoolcache/node/20.17.0/x64/bin/node",npm_config_frozen_lockfile:"",npm_config_legacy_peer_deps:"true",LANG:"C.UTF-8",npm_package_dependencies_react_dom:"18.2.0",npm_package_main:"./dist/avocado-not-front.umd.js",npm_lifecycle_script:"tsc && vite build",npm_package_dependencies__uiw_react_codemirror:"4.23.12",SHELL:"/bin/bash",NODE_PATH:"/home/runner/setup-pnpm/node_modules/.pnpm/pnpm@9.10.0/node_modules/pnpm/bin/node_modules:/home/runner/setup-pnpm/node_modules/.pnpm/pnpm@9.10.0/node_modules/pnpm/node_modules:/home/runner/setup-pnpm/node_modules/.pnpm/pnpm@9.10.0/node_modules:/home/runner/setup-pnpm/node_modules/.pnpm/node_modules",npm_package_version:"0.21.2",npm_package_devDependencies__testing_library_react:"14.2.0",npm_package_devDependencies__types_react:"18.0.28",npm_package_devDependencies_jsdom:"24.0.0",npm_lifecycle_event:"build",npm_package_scripts_build:"tsc && vite build",npm_package_dependencies__codemirror_lang_sql:"6.8.0",npm_package_dependencies__foris_avocado_suite:"workspace:*",npm_package_dependencies_jsonpath:"1.1.1",npm_package_devDependencies__foris_tsconfig:"workspace:*",npm_package_dependencies_react_select:"5.8.0",PWD:"/home/runner/work/avocado/avocado/packages/avocado-not-front",npm_execpath:"/home/runner/setup-pnpm/node_modules/.pnpm/pnpm@9.10.0/node_modules/pnpm/bin/pnpm.cjs",npm_package_devDependencies_stubby:"^5.1.0",npm_command:"run-script",PNPM_SCRIPT_SRC_DIR:"/home/runner/work/avocado/avocado/packages/avocado-not-front",npm_package_scripts_start_stubby:"stubby -d src/services/stubs/stubby-config.yml -w -s 8200 -q",npm_package_dependencies_react:"18.2.0",npm_package_peerDependencies_react_select:"5.8.0",INIT_CWD:"/home/runner/work/avocado/avocado/packages/avocado-not-front",NODE_ENV:"production"},loe=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?Xh:Xh.apply(null,arguments)};function Pr(t,e){function n(...r){if(e){let i=e(...r);if(!i)throw new Error(or(0));return{type:t,payload:i.payload,..."meta"in i&&{meta:i.meta},..."error"in i&&{error:i.error}}}return{type:t,payload:r[0]}}return n.toString=()=>`${t}`,n.type=t,n.match=r=>Zk(r)&&r.type===t,n}var dS=class zu extends Array{constructor(...e){super(...e),Object.setPrototypeOf(this,zu.prototype)}static get[Symbol.species](){return zu}concat(...e){return super.concat.apply(this,e)}prepend(...e){return e.length===1&&Array.isArray(e[0])?new zu(...e[0].concat(this)):new zu(...e.concat(this))}};function hS(t){return eo(t)?cS(t,()=>{}):t}function ip(t,e,n){return t.has(e)?t.get(e):t.set(e,n(e)).get(e)}function coe(t){return typeof t=="boolean"}var uoe=()=>function(e){const{thunk:n=!0,immutableCheck:r=!0,serializableCheck:i=!0,actionCreatorCheck:o=!0}=e??{};let a=new dS;return n&&(coe(n)?a.push(aoe):a.push(soe(n.extraArgument))),a},foe="RTK_autoBatch",pS=t=>e=>{setTimeout(e,t)},doe=(t={type:"raf"})=>e=>(...n)=>{const r=e(...n);let i=!0,o=!1,a=!1;const s=new Set,l=t.type==="tick"?queueMicrotask:t.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame:pS(10):t.type==="callback"?t.queueNotification:pS(t.timeout),c=()=>{a=!1,o&&(o=!1,s.forEach(u=>u()))};return Object.assign({},r,{subscribe(u){const f=()=>i&&u(),d=r.subscribe(f);return s.add(u),()=>{d(),s.delete(u)}},dispatch(u){var f;try{return i=!((f=u==null?void 0:u.meta)!=null&&f[foe]),o=!i,o&&(a||(a=!0,l(c))),r.dispatch(u)}finally{i=!0}}})},hoe=t=>function(n){const{autoBatch:r=!0}=n??{};let i=new dS(t);return r&&i.push(doe(typeof r=="object"?r:void 0)),i};function poe(t){const e=uoe(),{reducer:n=void 0,middleware:r,devTools:i=!0,duplicateMiddlewareCheck:o=!0,preloadedState:a=void 0,enhancers:s=void 0}=t||{};let l;if(typeof n=="function")l=n;else if(bv(n))l=Xk(n);else throw new Error(or(1));let c;typeof r=="function"?c=r(e):c=e();let u=Xh;i&&(u=loe({trace:fS.NODE_ENV!=="production",...typeof i=="object"&&i}));const f=Xie(...c),d=hoe(f);let h=typeof s=="function"?s(d):d();const m=u(...h);return Yk(l,a,m)}function mS(t){const e={},n=[];let r;const i={addCase(o,a){const s=typeof o=="string"?o:o.type;if(!s)throw new Error(or(28));if(s in e)throw new Error(or(29));return e[s]=a,i},addMatcher(o,a){return n.push({matcher:o,reducer:a}),i},addDefaultCase(o){return r=o,i}};return t(i),[e,n,r]}function moe(t){return typeof t=="function"}function goe(t,e){let[n,r,i]=mS(e),o;if(moe(t))o=()=>hS(t());else{const s=hS(t);o=()=>s}function a(s=o(),l){let c=[n[l.type],...r.filter(({matcher:u})=>u(l)).map(({reducer:u})=>u)];return c.filter(u=>!!u).length===0&&(c=[i]),c.reduce((u,f)=>{if(f)if(Ua(u)){const h=f(u,l);return h===void 0?u:h}else{if(eo(u))return cS(u,d=>f(d,l));{const d=f(u,l);if(d===void 0){if(u===null)return u;throw Error("A case reducer on a non-draftable value must not return undefined")}return d}}return u},s)}return a.getInitialState=o,a}var voe="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",yoe=(t=21)=>{let e="",n=t;for(;n--;)e+=voe[Math.random()*64|0];return e},boe=Symbol.for("rtk-slice-createasyncthunk");function woe(t,e){return`${t}/${e}`}function _oe({creators:t}={}){var n;const e=(n=t==null?void 0:t.asyncThunk)==null?void 0:n[boe];return function(i){const{name:o,reducerPath:a=o}=i;if(!o)throw new Error(or(11));typeof process<"u"&&fS.NODE_ENV==="development"&&i.initialState===void 0&&console.error("You must provide an `initialState` value that is not `undefined`. You may have misspelled `initialState`");const s=(typeof i.reducers=="function"?i.reducers(Coe()):i.reducers)||{},l=Object.keys(s),c={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},u={addCase(b,y){const k=typeof b=="string"?b:b.type;if(!k)throw new Error(or(12));if(k in c.sliceCaseReducersByType)throw new Error(or(13));return c.sliceCaseReducersByType[k]=y,u},addMatcher(b,y){return c.sliceMatchers.push({matcher:b,reducer:y}),u},exposeAction(b,y){return c.actionCreators[b]=y,u},exposeCaseReducer(b,y){return c.sliceCaseReducersByName[b]=y,u}};l.forEach(b=>{const y=s[b],k={reducerName:b,type:woe(o,b),createNotation:typeof i.reducers=="function"};Soe(y)?Poe(k,y,u,e):koe(k,y,u)});function f(){const[b={},y=[],k=void 0]=typeof i.extraReducers=="function"?mS(i.extraReducers):[i.extraReducers],C={...b,...c.sliceCaseReducersByType};return goe(i.initialState,E=>{for(let A in C)E.addCase(A,C[A]);for(let A of c.sliceMatchers)E.addMatcher(A.matcher,A.reducer);for(let A of y)E.addMatcher(A.matcher,A.reducer);k&&E.addDefaultCase(k)})}const d=b=>b,h=new Map,m=new WeakMap;let g;function p(b,y){return g||(g=f()),g(b,y)}function v(){return g||(g=f()),g.getInitialState()}function _(b,y=!1){function k(E){let A=E[b];return typeof A>"u"&&y&&(A=ip(m,k,v)),A}function C(E=d){const A=ip(h,y,()=>new WeakMap);return ip(A,E,()=>{const N={};for(const[M,T]of Object.entries(i.selectors??{}))N[M]=xoe(T,E,()=>ip(m,E,v),y);return N})}return{reducerPath:b,getSelectors:C,get selectors(){return C(k)},selectSlice:k}}const w={name:o,reducer:p,actions:c.actionCreators,caseReducers:c.sliceCaseReducersByName,getInitialState:v,..._(a),injectInto(b,{reducerPath:y,...k}={}){const C=y??a;return b.inject({reducerPath:C,reducer:p},k),{...w,..._(C,!0)}}};return w}}function xoe(t,e,n,r){function i(o,...a){let s=e(o);return typeof s>"u"&&r&&(s=n()),t(s,...a)}return i.unwrapped=t,i}var Er=_oe();function Coe(){function t(e,n){return{_reducerDefinitionType:"asyncThunk",payloadCreator:e,...n}}return t.withTypes=()=>t,{reducer(e){return Object.assign({[e.name](...n){return e(...n)}}[e.name],{_reducerDefinitionType:"reducer"})},preparedReducer(e,n){return{_reducerDefinitionType:"reducerWithPrepare",prepare:e,reducer:n}},asyncThunk:t}}function koe({type:t,reducerName:e,createNotation:n},r,i){let o,a;if("reducer"in r){if(n&&!Ooe(r))throw new Error(or(17));o=r.reducer,a=r.prepare}else o=r;i.addCase(t,o).exposeCaseReducer(e,o).exposeAction(e,a?Pr(t,a):Pr(t))}function Soe(t){return t._reducerDefinitionType==="asyncThunk"}function Ooe(t){return t._reducerDefinitionType==="reducerWithPrepare"}function Poe({type:t,reducerName:e},n,r,i){if(!i)throw new Error(or(18));const{payloadCreator:o,fulfilled:a,pending:s,rejected:l,settled:c,options:u}=n,f=i(t,o,u);r.exposeAction(e,f),a&&r.addCase(f.fulfilled,a),s&&r.addCase(f.pending,s),l&&r.addCase(f.rejected,l),c&&r.addMatcher(f.settled,c),r.exposeCaseReducer(e,{fulfilled:a||op,pending:s||op,rejected:l||op,settled:c||op})}function op(){}var Eoe="task",gS="listener",vS="completed",Dv="cancelled",Aoe=`task-${Dv}`,Doe=`task-${vS}`,Mv=`${gS}-${Dv}`,Moe=`${gS}-${vS}`,ap=class{constructor(t){_2(this,"name","TaskAbortError");_2(this,"message");this.code=t,this.message=`${Eoe} ${Dv} (reason: ${t})`}},Tv=(t,e)=>{if(typeof t!="function")throw new TypeError(or(32))},sp=()=>{},yS=(t,e=sp)=>(t.catch(e),t),bS=(t,e)=>(t.addEventListener("abort",e,{once:!0}),()=>t.removeEventListener("abort",e)),Qa=(t,e)=>{const n=t.signal;n.aborted||("reason"in n||Object.defineProperty(n,"reason",{enumerable:!0,value:e,configurable:!0,writable:!0}),t.abort(e))},Ya=t=>{if(t.aborted){const{reason:e}=t;throw new ap(e)}};function wS(t,e){let n=sp;return new Promise((r,i)=>{const o=()=>i(new ap(t.reason));if(t.aborted){o();return}n=bS(t,o),e.finally(()=>n()).then(r,i)}).finally(()=>{n=sp})}var Toe=async(t,e)=>{try{return await Promise.resolve(),{status:"ok",value:await t()}}catch(n){return{status:n instanceof ap?"cancelled":"rejected",error:n}}finally{e==null||e()}},lp=t=>e=>yS(wS(t,e).then(n=>(Ya(t),n))),_S=t=>{const e=lp(t);return n=>e(new Promise(r=>setTimeout(r,n)))},{assign:ul}=Object,xS={},cp="listenerMiddleware",Noe=(t,e)=>{const n=r=>bS(t,()=>Qa(r,t.reason));return(r,i)=>{Tv(r);const o=new AbortController;n(o);const a=Toe(async()=>{Ya(t),Ya(o.signal);const s=await r({pause:lp(o.signal),delay:_S(o.signal),signal:o.signal});return Ya(o.signal),s},()=>Qa(o,Doe));return i!=null&&i.autoJoin&&e.push(a.catch(sp)),{result:lp(t)(a),cancel(){Qa(o,Aoe)}}}},Ioe=(t,e)=>{const n=async(r,i)=>{Ya(e);let o=()=>{};const s=[new Promise((l,c)=>{let u=t({predicate:r,effect:(f,d)=>{d.unsubscribe(),l([f,d.getState(),d.getOriginalState()])}});o=()=>{u(),c()}})];i!=null&&s.push(new Promise(l=>setTimeout(l,i,null)));try{const l=await wS(e,Promise.race(s));return Ya(e),l}finally{o()}};return(r,i)=>yS(n(r,i))},CS=t=>{let{type:e,actionCreator:n,matcher:r,predicate:i,effect:o}=t;if(e)i=Pr(e).match;else if(n)e=n.type,i=n.match;else if(r)i=r;else if(!i)throw new Error(or(21));return Tv(o),{predicate:i,type:e,effect:o}},kS=ul(t=>{const{type:e,predicate:n,effect:r}=CS(t);return{id:yoe(),effect:r,type:e,predicate:n,pending:new Set,unsubscribe:()=>{throw new Error(or(22))}}},{withTypes:()=>kS}),SS=(t,e)=>{const{type:n,effect:r,predicate:i}=CS(e);return Array.from(t.values()).find(o=>(typeof n=="string"?o.type===n:o.predicate===i)&&o.effect===r)},Nv=t=>{t.pending.forEach(e=>{Qa(e,Mv)})},Loe=t=>()=>{t.forEach(Nv),t.clear()},OS=(t,e,n)=>{try{t(e,n)}catch(r){setTimeout(()=>{throw r},0)}},PS=ul(Pr(`${cp}/add`),{withTypes:()=>PS}),joe=Pr(`${cp}/removeAll`),ES=ul(Pr(`${cp}/remove`),{withTypes:()=>ES}),Roe=(...t)=>{console.error(`${cp}/error`,...t)},su=(t={})=>{const e=new Map,{extra:n,onError:r=Roe}=t;Tv(r);const i=u=>(u.unsubscribe=()=>e.delete(u.id),e.set(u.id,u),f=>{u.unsubscribe(),f!=null&&f.cancelActive&&Nv(u)}),o=u=>{const f=SS(e,u)??kS(u);return i(f)};ul(o,{withTypes:()=>o});const a=u=>{const f=SS(e,u);return f&&(f.unsubscribe(),u.cancelActive&&Nv(f)),!!f};ul(a,{withTypes:()=>a});const s=async(u,f,d,h)=>{const m=new AbortController,g=Ioe(o,m.signal),p=[];try{u.pending.add(m),await Promise.resolve(u.effect(f,ul({},d,{getOriginalState:h,condition:(v,_)=>g(v,_).then(Boolean),take:g,delay:_S(m.signal),pause:lp(m.signal),extra:n,signal:m.signal,fork:Noe(m.signal,p),unsubscribe:u.unsubscribe,subscribe:()=>{e.set(u.id,u)},cancelActiveListeners:()=>{u.pending.forEach((v,_,w)=>{v!==m&&(Qa(v,Mv),w.delete(v))})},cancel:()=>{Qa(m,Mv),u.pending.delete(m)},throwIfCancelled:()=>{Ya(m.signal)}})))}catch(v){v instanceof ap||OS(r,v,{raisedBy:"effect"})}finally{await Promise.all(p),Qa(m,Moe),u.pending.delete(m)}},l=Loe(e);return{middleware:u=>f=>d=>{if(!Zk(d))return f(d);if(PS.match(d))return o(d.payload);if(joe.match(d)){l();return}if(ES.match(d))return a(d.payload);let h=u.getState();const m=()=>{if(h===xS)throw new Error(or(23));return h};let g;try{if(g=f(d),e.size>0){const p=u.getState(),v=Array.from(e.values());for(const _ of v){let w=!1;try{w=_.predicate(d,p,h)}catch(b){w=!1,OS(r,b,{raisedBy:"predicate"})}w&&s(_,d,u,m)}}}finally{h=xS}return g},startListening:o,stopListening:a,clearListeners:l}};function or(t){return`Minified Redux Toolkit error #${t}; visit https://redux-toolkit.js.org/Errors?code=${t} for the full message or use the non-minified dev environment for full errors. `}var Boe={layoutType:"horizontal",width:0,height:0,margin:{top:5,right:5,bottom:5,left:5},scale:1},AS=Er({name:"chartLayout",initialState:Boe,reducers:{setLayout(t,e){t.layoutType=e.payload},setChartSize(t,e){t.width=e.payload.width,t.height=e.payload.height},setMargin(t,e){t.margin.top=e.payload.top,t.margin.right=e.payload.right,t.margin.bottom=e.payload.bottom,t.margin.left=e.payload.left},setScale(t,e){t.scale=e.payload}}}),{setMargin:$oe,setLayout:Foe,setChartSize:Hoe,setScale:Voe}=AS.actions,Woe=AS.reducer;function DS(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function MS(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?DS(Object(n),!0).forEach(function(r){zoe(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):DS(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function zoe(t,e,n){return(e=Uoe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Uoe(t){var e=qoe(t,"string");return typeof e=="symbol"?e:e+""}function qoe(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var up=Math.PI/180,Koe=t=>t*180/Math.PI,It=(t,e,n,r)=>({x:t+Math.cos(-up*r)*n,y:e+Math.sin(-up*r)*n}),TS=function(e,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{top:0,right:0,bottom:0,left:0,width:0,height:0,brushBottom:0};return Math.min(Math.abs(e-(r.left||0)-(r.right||0)),Math.abs(n-(r.top||0)-(r.bottom||0)))/2},Qoe=(t,e)=>{var{x:n,y:r}=t,{x:i,y:o}=e;return Math.sqrt((n-i)**2+(r-o)**2)},Yoe=(t,e)=>{var{x:n,y:r}=t,{cx:i,cy:o}=e,a=Qoe({x:n,y:r},{x:i,y:o});if(a<=0)return{radius:a,angle:0};var s=(n-i)/a,l=Math.acos(s);return r>o&&(l=2*Math.PI-l),{radius:a,angle:Koe(l),angleInRadian:l}},Xoe=t=>{var{startAngle:e,endAngle:n}=t,r=Math.floor(e/360),i=Math.floor(n/360),o=Math.min(r,i);return{startAngle:e-o*360,endAngle:n-o*360}},Zoe=(t,e)=>{var{startAngle:n,endAngle:r}=e,i=Math.floor(n/360),o=Math.floor(r/360),a=Math.min(i,o);return t+a*360},Goe=(t,e)=>{var{x:n,y:r}=t,{radius:i,angle:o}=Yoe({x:n,y:r},e),{innerRadius:a,outerRadius:s}=e;if(i<a||i>s||i===0)return null;var{startAngle:l,endAngle:c}=Xoe(e),u=o,f;if(l<=c){for(;u>c;)u-=360;for(;u<l;)u+=360;f=u>=l&&u<=c}else{for(;u>l;)u-=360;for(;u<c;)u+=360;f=u>=c&&u<=l}return f?MS(MS({},e),{},{radius:i,angle:Zoe(u,e)}):null};function NS(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Ar(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?NS(Object(n),!0).forEach(function(r){Joe(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):NS(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Joe(t,e,n){return(e=eae(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function eae(t){var e=tae(t,"string");return typeof e=="symbol"?e:e+""}function tae(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function ot(t,e,n){return Ze(t)||Ze(e)?n:xi(e)?Qo(t,e,n):typeof e=="function"?e(t):n}var nae=(t,e,n,r,i)=>{var o,a=-1,s=(o=e==null?void 0:e.length)!==null&&o!==void 0?o:0;if(s<=1||t==null)return 0;if(r==="angleAxis"&&i!=null&&Math.abs(Math.abs(i[1]-i[0])-360)<=1e-6)for(var l=0;l<s;l++){var c=l>0?n[l-1].coordinate:n[s-1].coordinate,u=n[l].coordinate,f=l>=s-1?n[0].coordinate:n[l+1].coordinate,d=void 0;if(Zt(u-c)!==Zt(f-u)){var h=[];if(Zt(f-u)===Zt(i[1]-i[0])){d=f;var m=u+i[1]-i[0];h[0]=Math.min(m,(m+c)/2),h[1]=Math.max(m,(m+c)/2)}else{d=c;var g=f+i[1]-i[0];h[0]=Math.min(u,(g+u)/2),h[1]=Math.max(u,(g+u)/2)}var p=[Math.min(u,(d+u)/2),Math.max(u,(d+u)/2)];if(t>p[0]&&t<=p[1]||t>=h[0]&&t<=h[1]){({index:a}=n[l]);break}}else{var v=Math.min(c,f),_=Math.max(c,f);if(t>(v+u)/2&&t<=(_+u)/2){({index:a}=n[l]);break}}}else if(e){for(var w=0;w<s;w++)if(w===0&&t<=(e[w].coordinate+e[w+1].coordinate)/2||w>0&&w<s-1&&t>(e[w].coordinate+e[w-1].coordinate)/2&&t<=(e[w].coordinate+e[w+1].coordinate)/2||w===s-1&&t>(e[w].coordinate+e[w-1].coordinate)/2){({index:a}=e[w]);break}}return a},rae=(t,e,n)=>{if(e&&n){var{width:r,height:i}=n,{align:o,verticalAlign:a,layout:s}=e;if((s==="vertical"||s==="horizontal"&&a==="middle")&&o!=="center"&&re(t[o]))return Ar(Ar({},t),{},{[o]:t[o]+(r||0)});if((s==="horizontal"||s==="vertical"&&o==="center")&&a!=="middle"&&re(t[a]))return Ar(Ar({},t),{},{[a]:t[a]+(i||0)})}return t},Ci=(t,e)=>t==="horizontal"&&e==="xAxis"||t==="vertical"&&e==="yAxis"||t==="centric"&&e==="angleAxis"||t==="radial"&&e==="radiusAxis",IS=(t,e,n,r)=>{if(r)return t.map(s=>s.coordinate);var i,o,a=t.map(s=>(s.coordinate===e&&(i=!0),s.coordinate===n&&(o=!0),s.coordinate));return i||a.push(e),o||a.push(n),a},LS=(t,e,n)=>{if(!t)return null;var{duplicateDomain:r,type:i,range:o,scale:a,realScaleType:s,isCategorical:l,categoricalDomain:c,tickCount:u,ticks:f,niceTicks:d,axisType:h}=t;if(!a)return null;var m=s==="scaleBand"&&a.bandwidth?a.bandwidth()/2:2,g=i==="category"&&a.bandwidth?a.bandwidth()/m:0;if(g=h==="angleAxis"&&o&&o.length>=2?Zt(o[0]-o[1])*2*g:g,f||d){var p=(f||d||[]).map((v,_)=>{var w=r?r.indexOf(v):v;return{coordinate:a(w)+g,value:v,offset:g,index:_}});return p.filter(v=>!Wn(v.coordinate))}return l&&c?c.map((v,_)=>({coordinate:a(v)+g,value:v,index:_,offset:g})):a.ticks&&!n&&u!=null?a.ticks(u).map((v,_)=>({coordinate:a(v)+g,value:v,offset:g,index:_})):a.domain().map((v,_)=>({coordinate:a(v)+g,value:r?r[v]:v,index:_,offset:g}))},jS=1e-4,iae=t=>{var e=t.domain();if(!(!e||e.length<=2)){var n=e.length,r=t.range(),i=Math.min(r[0],r[1])-jS,o=Math.max(r[0],r[1])+jS,a=t(e[0]),s=t(e[n-1]);(a<i||a>o||s<i||s>o)&&t.domain([e[0],e[n-1]])}},oae=(t,e)=>{if(!e||e.length!==2||!re(e[0])||!re(e[1]))return t;var n=Math.min(e[0],e[1]),r=Math.max(e[0],e[1]),i=[t[0],t[1]];return(!re(t[0])||t[0]<n)&&(i[0]=n),(!re(t[1])||t[1]>r)&&(i[1]=r),i[0]>r&&(i[0]=r),i[1]<n&&(i[1]=n),i},aae=t=>{var e=t.length;if(!(e<=0))for(var n=0,r=t[0].length;n<r;++n)for(var i=0,o=0,a=0;a<e;++a){var s=Wn(t[a][n][1])?t[a][n][0]:t[a][n][1];s>=0?(t[a][n][0]=i,t[a][n][1]=i+s,i=t[a][n][1]):(t[a][n][0]=o,t[a][n][1]=o+s,o=t[a][n][1])}},sae=t=>{var e=t.length;if(!(e<=0))for(var n=0,r=t[0].length;n<r;++n)for(var i=0,o=0;o<e;++o){var a=Wn(t[o][n][1])?t[o][n][0]:t[o][n][1];a>=0?(t[o][n][0]=i,t[o][n][1]=i+a,i=t[o][n][1]):(t[o][n][0]=0,t[o][n][1]=0)}},lae={sign:aae,expand:sie,none:ll,silhouette:lie,wiggle:cie,positive:sae},cae=(t,e,n)=>{var r=lae[n],i=aie().keys(e).value((o,a)=>+ot(o,a,0)).order(Z3).offset(r);return i(t)};function Iv(t){return t==null?void 0:String(t)}function fp(t){var{axis:e,ticks:n,bandSize:r,entry:i,index:o,dataKey:a}=t;if(e.type==="category"){if(!e.allowDuplicatedCategory&&e.dataKey&&!Ze(i[e.dataKey])){var s=$C(n,"value",i[e.dataKey]);if(s)return s.coordinate+r/2}return n[o]?n[o].coordinate+r/2:null}var l=ot(i,Ze(a)?e.dataKey:a);return Ze(l)?null:e.scale(l)}var RS=t=>{var{axis:e,ticks:n,offset:r,bandSize:i,entry:o,index:a}=t;if(e.type==="category")return n[a]?n[a].coordinate+r:null;var s=ot(o,e.dataKey,e.scale.domain()[a]);return Ze(s)?null:e.scale(s)-i/2+r},uae=t=>{var{numericAxis:e}=t,n=e.scale.domain();if(e.type==="number"){var r=Math.min(n[0],n[1]),i=Math.max(n[0],n[1]);return r<=0&&i>=0?0:i<0?i:r}return n[0]},fae=t=>{var e=t.flat(2).filter(re);return[Math.min(...e),Math.max(...e)]},dae=t=>[t[0]===1/0?0:t[0],t[1]===-1/0?0:t[1]],hae=(t,e,n)=>{if(t!=null)return dae(Object.keys(t).reduce((r,i)=>{var o=t[i],{stackedData:a}=o,s=a.reduce((l,c)=>{var u=fae(c.slice(e,n+1));return[Math.min(l[0],u[0]),Math.max(l[1],u[1])]},[1/0,-1/0]);return[Math.min(s[0],r[0]),Math.max(s[1],r[1])]},[1/0,-1/0]))},BS=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,$S=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,Xa=(t,e,n)=>{if(t&&t.scale&&t.scale.bandwidth){var r=t.scale.bandwidth();if(!n||r>0)return r}if(t&&e&&e.length>=2){for(var i=Kh(e,u=>u.coordinate),o=1/0,a=1,s=i.length;a<s;a++){var l=i[a],c=i[a-1];o=Math.min((l.coordinate||0)-(c.coordinate||0),o)}return o===1/0?0:o}return n?void 0:0};function FS(t){var{tooltipEntrySettings:e,dataKey:n,payload:r,value:i,name:o}=t;return Ar(Ar({},e),{},{dataKey:n,payload:r,value:i,name:o})}function Xo(t,e){if(t)return String(t);if(typeof e=="string")return e}function pae(t,e,n,r,i){if(n==="horizontal"||n==="vertical"){var o=t>=i.left&&t<=i.left+i.width&&e>=i.top&&e<=i.top+i.height;return o?{x:t,y:e}:null}return r?Goe({x:t,y:e},r):null}var mae=(t,e,n,r)=>{var i=e.find(c=>c&&c.index===n);if(i){if(t==="horizontal")return{x:i.coordinate,y:r.y};if(t==="vertical")return{x:r.x,y:i.coordinate};if(t==="centric"){var o=i.coordinate,{radius:a}=r;return Ar(Ar(Ar({},r),It(r.cx,r.cy,a,o)),{},{angle:o,radius:a})}var s=i.coordinate,{angle:l}=r;return Ar(Ar(Ar({},r),It(r.cx,r.cy,s,l)),{},{angle:l,radius:s})}return{x:0,y:0}},gae=(t,e)=>e==="horizontal"?t.x:e==="vertical"?t.y:e==="centric"?t.angle:t.radius,no=t=>t.layout.width,ro=t=>t.layout.height,vae=t=>t.layout.scale,HS=t=>t.layout.margin,Lv=H(t=>t.cartesianAxis.xAxis,t=>Object.values(t)),jv=H(t=>t.cartesianAxis.yAxis,t=>Object.values(t)),VS="data-recharts-item-index",WS="data-recharts-item-data-key",dp=60;function zS(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Zo(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?zS(Object(n),!0).forEach(function(r){yae(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):zS(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function yae(t,e,n){return(e=bae(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function bae(t){var e=wae(t,"string");return typeof e=="symbol"?e:e+""}function wae(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var _ae=t=>t.brush.height,Ht=H([no,ro,HS,_ae,Lv,jv,qk,Wie],(t,e,n,r,i,o,a,s)=>{var l=o.reduce((m,g)=>{var{orientation:p}=g;if(!g.mirror&&!g.hide){var v=typeof g.width=="number"?g.width:dp;return Zo(Zo({},m),{},{[p]:m[p]+v})}return m},{left:n.left||0,right:n.right||0}),c=i.reduce((m,g)=>{var{orientation:p}=g;return!g.mirror&&!g.hide?Zo(Zo({},m),{},{[p]:Qo(m,"".concat(p))+g.height}):m},{top:n.top||0,bottom:n.bottom||0}),u=Zo(Zo({},c),l),f=u.bottom;u.bottom+=r,u=rae(u,a,s);var d=t-u.left-u.right,h=e-u.top-u.bottom;return Zo(Zo({brushBottom:f},u),{},{width:Math.max(d,0),height:Math.max(h,0)})}),xae=H(Ht,t=>({x:t.left,y:t.top,width:t.width,height:t.height})),US=H(no,ro,(t,e)=>({x:0,y:0,width:t,height:e})),Cae=S.createContext(null),_n=()=>S.useContext(Cae)!=null,hp=t=>t.brush,pp=H([hp,Ht,HS],(t,e,n)=>({height:t.height,x:re(t.x)?t.x:e.left,y:re(t.y)?t.y:e.top+e.height+e.brushBottom-((n==null?void 0:n.bottom)||0),width:re(t.width)?t.width:e.width})),Rv=()=>{var t,e=_n(),n=de(xae),r=de(pp),i=(t=de(hp))===null||t===void 0?void 0:t.padding;return!e||!r||!i?n:{width:r.width-i.left-i.right,height:r.height-i.top-i.bottom,x:i.left,y:i.top}},kae={top:0,bottom:0,left:0,right:0,width:0,height:0,brushBottom:0},qS=()=>{var t;return(t=de(Ht))!==null&&t!==void 0?t:kae},Bv=()=>de(no),$v=()=>de(ro),Sae={top:0,right:0,bottom:0,left:0},Oae=()=>{var t;return(t=de(e=>e.layout.margin))!==null&&t!==void 0?t:Sae},je=t=>t.layout.layoutType,lu=()=>de(je),Pae={settings:{layout:"horizontal",align:"center",verticalAlign:"middle",itemSorter:"value"},size:{width:0,height:0},payload:[]},KS=Er({name:"legend",initialState:Pae,reducers:{setLegendSize(t,e){t.size.width=e.payload.width,t.size.height=e.payload.height},setLegendSettings(t,e){t.settings.align=e.payload.align,t.settings.layout=e.payload.layout,t.settings.verticalAlign=e.payload.verticalAlign,t.settings.itemSorter=e.payload.itemSorter},addLegendPayload(t,e){t.payload.push(e.payload)},removeLegendPayload(t,e){var n=to(t).payload.indexOf(e.payload);n>-1&&t.payload.splice(n,1)}}}),{setLegendSize:QS,setLegendSettings:Eae,addLegendPayload:YS,removeLegendPayload:XS}=KS.actions,Aae=KS.reducer,Dae=["contextPayload"];function Fv(){return Fv=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Fv.apply(null,arguments)}function ZS(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function fl(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?ZS(Object(n),!0).forEach(function(r){Hv(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ZS(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Hv(t,e,n){return(e=Mae(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Mae(t){var e=Tae(t,"string");return typeof e=="symbol"?e:e+""}function Tae(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Nae(t,e){if(t==null)return{};var n,r,i=Iae(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(r=0;r<o.length;r++)n=o[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function Iae(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}function Lae(t){return t.value}function jae(t){var{contextPayload:e}=t,n=Nae(t,Dae),r=Nk(e,t.payloadUniqBy,Lae),i=fl(fl({},n),{},{payload:r});return P.isValidElement(t.content)?P.cloneElement(t.content,i):typeof t.content=="function"?P.createElement(t.content,i):P.createElement(nv,i)}function Rae(t,e,n,r,i,o){var{layout:a,align:s,verticalAlign:l}=e,c,u;return(!t||(t.left===void 0||t.left===null)&&(t.right===void 0||t.right===null))&&(s==="center"&&a==="vertical"?c={left:((r||0)-o.width)/2}:c=s==="right"?{right:n&&n.right||0}:{left:n&&n.left||0}),(!t||(t.top===void 0||t.top===null)&&(t.bottom===void 0||t.bottom===null))&&(l==="middle"?u={top:((i||0)-o.height)/2}:u=l==="bottom"?{bottom:n&&n.bottom||0}:{top:n&&n.top||0}),fl(fl({},c),u)}function Bae(t){var e=ht();return S.useEffect(()=>{e(Eae(t))},[e,t]),null}function $ae(t){var e=ht();return S.useEffect(()=>(e(QS(t)),()=>{e(QS({width:0,height:0}))}),[e,t]),null}function Fae(t){var e=qie(),n=Dre(),r=Oae(),{width:i,height:o,wrapperStyle:a,portal:s}=t,[l,c]=Kk([e]),u=Bv(),f=$v(),d=u-(r.left||0)-(r.right||0),h=mp.getWidthOrHeight(t.layout,o,i,d),m=s?a:fl(fl({position:"absolute",width:(h==null?void 0:h.width)||i||"auto",height:(h==null?void 0:h.height)||o||"auto"},Rae(a,t,r,u,f,l)),a),g=s??n;if(g==null)return null;var p=P.createElement("div",{className:"recharts-legend-wrapper",style:m,ref:c},P.createElement(Bae,{layout:t.layout,align:t.align,verticalAlign:t.verticalAlign,itemSorter:t.itemSorter}),P.createElement($ae,{width:l.width,height:l.height}),P.createElement(jae,Fv({},t,h,{margin:r,chartWidth:u,chartHeight:f,contextPayload:e})));return dr.createPortal(p,g)}let mp=class extends S.PureComponent{static getWidthOrHeight(e,n,r,i){return e==="vertical"&&re(n)?{height:n}:e==="horizontal"?{width:r||i}:null}render(){return P.createElement(Fae,this.props)}};Hv(mp,"displayName","Legend"),Hv(mp,"defaultProps",{align:"center",iconSize:14,itemSorter:"value",layout:"horizontal",verticalAlign:"bottom"});function Vv(){return Vv=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Vv.apply(null,arguments)}function GS(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Wv(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?GS(Object(n),!0).forEach(function(r){Hae(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):GS(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Hae(t,e,n){return(e=Vae(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Vae(t){var e=Wae(t,"string");return typeof e=="symbol"?e:e+""}function Wae(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function zae(t){return Array.isArray(t)&&xi(t[0])&&xi(t[1])?t.join(" ~ "):t}var Uae=t=>{var{separator:e=" : ",contentStyle:n={},itemStyle:r={},labelStyle:i={},payload:o,formatter:a,itemSorter:s,wrapperClassName:l,labelClassName:c,label:u,labelFormatter:f,accessibilityLayer:d=!1}=t,h=()=>{if(o&&o.length){var y={padding:0,margin:0},k=(s?Kh(o,s):o).map((C,E)=>{if(C.type==="none")return null;var A=C.formatter||a||zae,{value:N,name:M}=C,T=N,I=M;if(A){var L=A(N,M,C,E,o);if(Array.isArray(L))[T,I]=L;else if(L!=null)T=L;else return null}var F=Wv({display:"block",paddingTop:4,paddingBottom:4,color:C.color||"#000"},r);return P.createElement("li",{className:"recharts-tooltip-item",key:"tooltip-item-".concat(E),style:F},xi(I)?P.createElement("span",{className:"recharts-tooltip-item-name"},I):null,xi(I)?P.createElement("span",{className:"recharts-tooltip-item-separator"},e):null,P.createElement("span",{className:"recharts-tooltip-item-value"},T),P.createElement("span",{className:"recharts-tooltip-item-unit"},C.unit||""))});return P.createElement("ul",{className:"recharts-tooltip-item-list",style:y},k)}return null},m=Wv({margin:0,padding:10,backgroundColor:"#fff",border:"1px solid #ccc",whiteSpace:"nowrap"},n),g=Wv({margin:0},i),p=!Ze(u),v=p?u:"",_=Le("recharts-default-tooltip",l),w=Le("recharts-tooltip-label",c);p&&f&&o!==void 0&&o!==null&&(v=f(u,o));var b=d?{role:"status","aria-live":"assertive"}:{};return P.createElement("div",Vv({className:_,style:m},b),P.createElement("p",{className:w,style:g},P.isValidElement(v)?v:"".concat(v)),h())},cu="recharts-tooltip-wrapper",qae={visibility:"hidden"};function Kae(t){var{coordinate:e,translateX:n,translateY:r}=t;return Le(cu,{["".concat(cu,"-right")]:re(n)&&e&&re(e.x)&&n>=e.x,["".concat(cu,"-left")]:re(n)&&e&&re(e.x)&&n<e.x,["".concat(cu,"-bottom")]:re(r)&&e&&re(e.y)&&r>=e.y,["".concat(cu,"-top")]:re(r)&&e&&re(e.y)&&r<e.y})}function JS(t){var{allowEscapeViewBox:e,coordinate:n,key:r,offsetTopLeft:i,position:o,reverseDirection:a,tooltipDimension:s,viewBox:l,viewBoxDimension:c}=t;if(o&&re(o[r]))return o[r];var u=n[r]-s-(i>0?i:0),f=n[r]+i;if(e[r])return a[r]?u:f;var d=l[r];if(d==null)return 0;if(a[r]){var h=u,m=d;return h<m?Math.max(f,d):Math.max(u,d)}if(c==null)return 0;var g=f+s,p=d+c;return g>p?Math.max(u,d):Math.max(f,d)}function Qae(t){var{translateX:e,translateY:n,useTranslate3d:r}=t;return{transform:r?"translate3d(".concat(e,"px, ").concat(n,"px, 0)"):"translate(".concat(e,"px, ").concat(n,"px)")}}function Yae(t){var{allowEscapeViewBox:e,coordinate:n,offsetTopLeft:r,position:i,reverseDirection:o,tooltipBox:a,useTranslate3d:s,viewBox:l}=t,c,u,f;return a.height>0&&a.width>0&&n?(u=JS({allowEscapeViewBox:e,coordinate:n,key:"x",offsetTopLeft:r,position:i,reverseDirection:o,tooltipDimension:a.width,viewBox:l,viewBoxDimension:l.width}),f=JS({allowEscapeViewBox:e,coordinate:n,key:"y",offsetTopLeft:r,position:i,reverseDirection:o,tooltipDimension:a.height,viewBox:l,viewBoxDimension:l.height}),c=Qae({translateX:u,translateY:f,useTranslate3d:s})):c=qae,{cssProperties:c,cssClasses:Kae({translateX:u,translateY:f,coordinate:n})}}function eO(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function gp(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?eO(Object(n),!0).forEach(function(r){zv(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):eO(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function zv(t,e,n){return(e=Xae(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Xae(t){var e=Zae(t,"string");return typeof e=="symbol"?e:e+""}function Zae(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}class Gae extends S.PureComponent{constructor(){super(...arguments),zv(this,"state",{dismissed:!1,dismissedAtCoordinate:{x:0,y:0}}),zv(this,"handleKeyDown",e=>{if(e.key==="Escape"){var n,r,i,o;this.setState({dismissed:!0,dismissedAtCoordinate:{x:(n=(r=this.props.coordinate)===null||r===void 0?void 0:r.x)!==null&&n!==void 0?n:0,y:(i=(o=this.props.coordinate)===null||o===void 0?void 0:o.y)!==null&&i!==void 0?i:0}})}})}componentDidMount(){document.addEventListener("keydown",this.handleKeyDown)}componentWillUnmount(){document.removeEventListener("keydown",this.handleKeyDown)}componentDidUpdate(){var e,n;this.state.dismissed&&(((e=this.props.coordinate)===null||e===void 0?void 0:e.x)!==this.state.dismissedAtCoordinate.x||((n=this.props.coordinate)===null||n===void 0?void 0:n.y)!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}render(){var{active:e,allowEscapeViewBox:n,animationDuration:r,animationEasing:i,children:o,coordinate:a,hasPayload:s,isAnimationActive:l,offset:c,position:u,reverseDirection:f,useTranslate3d:d,viewBox:h,wrapperStyle:m,lastBoundingBox:g,innerRef:p,hasPortalFromProps:v}=this.props,{cssClasses:_,cssProperties:w}=Yae({allowEscapeViewBox:n,coordinate:a,offsetTopLeft:c,position:u,reverseDirection:f,tooltipBox:{height:g.height,width:g.width},useTranslate3d:d,viewBox:h}),b=v?{}:gp(gp({transition:l&&e?"transform ".concat(r,"ms ").concat(i):void 0},w),{},{pointerEvents:"none",visibility:!this.state.dismissed&&e&&s?"visible":"hidden",position:"absolute",top:0,left:0}),y=gp(gp({},b),{},{visibility:!this.state.dismissed&&e&&s?"visible":"hidden"},m);return P.createElement("div",{xmlns:"http://www.w3.org/1999/xhtml",tabIndex:-1,className:_,style:y,ref:p},o)}}var Jae=()=>!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout),Go={isSsr:Jae()},tO=()=>de(t=>t.rootProps.accessibilityLayer);function fn(t){return Number.isFinite(t)}function dl(t){return typeof t=="number"&&t>0&&Number.isFinite(t)}function Uv(){return Uv=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Uv.apply(null,arguments)}function nO(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function rO(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?nO(Object(n),!0).forEach(function(r){ese(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):nO(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function ese(t,e,n){return(e=tse(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function tse(t){var e=nse(t,"string");return typeof e=="symbol"?e:e+""}function nse(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var iO={curveBasisClosed:Yre,curveBasisOpen:Xre,curveBasis:Qre,curveBumpX:Ire,curveBumpY:Lre,curveLinearClosed:Zre,curveLinear:Lh,curveMonotoneX:Gre,curveMonotoneY:Jre,curveNatural:eie,curveStep:tie,curveStepAfter:rie,curveStepBefore:nie},vp=t=>fn(t.x)&&fn(t.y),uu=t=>t.x,fu=t=>t.y,rse=(t,e)=>{if(typeof t=="function")return t;var n="curve".concat(nu(t));return(n==="curveMonotone"||n==="curveBump")&&e?iO["".concat(n).concat(e==="vertical"?"Y":"X")]:iO[n]||Lh},ise=t=>{var{type:e="linear",points:n=[],baseLine:r,layout:i,connectNulls:o=!1}=t,a=rse(e,i),s=o?n.filter(vp):n,l;if(Array.isArray(r)){var c=o?r.filter(f=>vp(f)):r,u=s.map((f,d)=>rO(rO({},f),{},{base:c[d]}));return i==="vertical"?l=jh().y(fu).x1(uu).x0(f=>f.base.x):l=jh().x(uu).y1(fu).y0(f=>f.base.y),l.defined(vp).curve(a),l(u)}return i==="vertical"&&re(r)?l=jh().y(fu).x1(uu).x0(r):re(r)?l=jh().x(uu).y1(fu).y0(r):l=XC().x(uu).y(fu),l.defined(vp).curve(a),l(s)},hl=t=>{var{className:e,points:n,path:r,pathRef:i}=t;if((!n||!n.length)&&!r)return null;var o=n&&n.length?ise(t):r;return P.createElement("path",Uv({},Oe(t,!1),B3(t),{className:Le("recharts-curve",e),d:o===null?void 0:o,ref:i}))},ose=["x","y","top","left","width","height","className"];function qv(){return qv=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},qv.apply(null,arguments)}function oO(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function ase(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?oO(Object(n),!0).forEach(function(r){sse(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):oO(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function sse(t,e,n){return(e=lse(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function lse(t){var e=cse(t,"string");return typeof e=="symbol"?e:e+""}function cse(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function use(t,e){if(t==null)return{};var n,r,i=fse(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(r=0;r<o.length;r++)n=o[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function fse(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}var dse=(t,e,n,r,i,o)=>"M".concat(t,",").concat(i,"v").concat(r,"M").concat(o,",").concat(e,"h").concat(n),hse=t=>{var{x:e=0,y:n=0,top:r=0,left:i=0,width:o=0,height:a=0,className:s}=t,l=use(t,ose),c=ase({x:e,y:n,top:r,left:i,width:o,height:a},l);return!re(e)||!re(n)||!re(o)||!re(a)||!re(r)||!re(i)?null:P.createElement("path",qv({},Oe(c,!0),{className:Le("recharts-cross",s),d:dse(e,n,o,a,r,i)}))};function pse(t,e,n,r){var i=r/2;return{stroke:"none",fill:"#ccc",x:t==="horizontal"?e.x-i:n.left+.5,y:t==="horizontal"?n.top+.5:e.y-i,width:t==="horizontal"?r:n.width-1,height:t==="horizontal"?n.height-1:r}}function aO(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function mse(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?aO(Object(n),!0).forEach(function(r){gse(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):aO(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function gse(t,e,n){return(e=vse(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function vse(t){var e=yse(t,"string");return typeof e=="symbol"?e:e+""}function yse(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function ar(t,e){var n=mse({},t),r=e,i=Object.keys(e),o=i.reduce((a,s)=>(a[s]===void 0&&r[s]!==void 0&&(a[s]=r[s]),a),n);return o}var sO={},lO={},cO={};(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function e(n){if(!n||typeof n!="object")return!1;const r=Object.getPrototypeOf(n);return r===null||r===Object.prototype||Object.getPrototypeOf(r)===null?Object.prototype.toString.call(n)==="[object Object]":!1}t.isPlainObject=e})(cO),function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=cO,n=uv,r=Wh,i=zh,o=Vh;function a(c,u,f){return s(c,u,void 0,void 0,void 0,void 0,f)}function s(c,u,f,d,h,m,g){const p=g(c,u,f,d,h,m);if(p!==void 0)return p;if(typeof c==typeof u)switch(typeof c){case"bigint":case"string":case"boolean":case"symbol":case"undefined":return c===u;case"number":return c===u||Object.is(c,u);case"function":return c===u;case"object":return l(c,u,m,g)}return l(c,u,m,g)}function l(c,u,f,d){if(Object.is(c,u))return!0;let h=r.getTag(c),m=r.getTag(u);if(h===i.argumentsTag&&(h=i.objectTag),m===i.argumentsTag&&(m=i.objectTag),h!==m)return!1;switch(h){case i.stringTag:return c.toString()===u.toString();case i.numberTag:{const v=c.valueOf(),_=u.valueOf();return o.eq(v,_)}case i.booleanTag:case i.dateTag:case i.symbolTag:return Object.is(c.valueOf(),u.valueOf());case i.regexpTag:return c.source===u.source&&c.flags===u.flags;case i.functionTag:return c===u}f=f??new Map;const g=f.get(c),p=f.get(u);if(g!=null&&p!=null)return g===u;f.set(c,u),f.set(u,c);try{switch(h){case i.mapTag:{if(c.size!==u.size)return!1;for(const[v,_]of c.entries())if(!u.has(v)||!s(_,u.get(v),v,c,u,f,d))return!1;return!0}case i.setTag:{if(c.size!==u.size)return!1;const v=Array.from(c.values()),_=Array.from(u.values());for(let w=0;w<v.length;w++){const b=v[w],y=_.findIndex(k=>s(b,k,void 0,c,u,f,d));if(y===-1)return!1;_.splice(y,1)}return!0}case i.arrayTag:case i.uint8ArrayTag:case i.uint8ClampedArrayTag:case i.uint16ArrayTag:case i.uint32ArrayTag:case i.bigUint64ArrayTag:case i.int8ArrayTag:case i.int16ArrayTag:case i.int32ArrayTag:case i.bigInt64ArrayTag:case i.float32ArrayTag:case i.float64ArrayTag:{if(typeof Buffer<"u"&&Buffer.isBuffer(c)!==Buffer.isBuffer(u)||c.length!==u.length)return!1;for(let v=0;v<c.length;v++)if(!s(c[v],u[v],v,c,u,f,d))return!1;return!0}case i.arrayBufferTag:return c.byteLength!==u.byteLength?!1:l(new Uint8Array(c),new Uint8Array(u),f,d);case i.dataViewTag:return c.byteLength!==u.byteLength||c.byteOffset!==u.byteOffset?!1:l(new Uint8Array(c),new Uint8Array(u),f,d);case i.errorTag:return c.name===u.name&&c.message===u.message;case i.objectTag:{if(!(l(c.constructor,u.constructor,f,d)||e.isPlainObject(c)&&e.isPlainObject(u)))return!1;const _=[...Object.keys(c),...n.getSymbols(c)],w=[...Object.keys(u),...n.getSymbols(u)];if(_.length!==w.length)return!1;for(let b=0;b<_.length;b++){const y=_[b],k=c[y];if(!Object.hasOwn(u,y))return!1;const C=u[y];if(!s(k,C,y,c,u,f,d))return!1}return!0}default:return!1}}finally{f.delete(c),f.delete(u)}}t.isEqualWith=a}(lO);var uO={};(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function e(){}t.noop=e})(uO),function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=lO,n=uO;function r(i,o){return e.isEqualWith(i,o,n.noop)}t.isEqual=r}(sO);var bse=sO.isEqual;const wse=hr(bse);function _se(t){var e={},n=()=>null,r=!1,i=null,o=a=>{if(!r){if(Array.isArray(a)){if(!a.length)return;var s=a,[l,...c]=s;if(typeof l=="number"){i=t.setTimeout(o.bind(null,c),l);return}o(l),i=t.setTimeout(o.bind(null,c));return}typeof a=="object"&&(e=a,n(e)),typeof a=="function"&&a()}};return{stop:()=>{r=!0},start:a=>{r=!1,i&&(i(),i=null),o(a)},subscribe:a=>(n=a,()=>{n=()=>null}),getTimeoutController:()=>t}}var yp=1e-4,fO=(t,e)=>[0,3*t,3*e-6*t,3*t-3*e+1],dO=(t,e)=>t.map((n,r)=>n*e**r).reduce((n,r)=>n+r),hO=(t,e)=>n=>{var r=fO(t,e);return dO(r,n)},xse=(t,e)=>n=>{var r=fO(t,e),i=[...r.map((o,a)=>o*a).slice(1),0];return dO(i,n)},pO=function(){for(var e,n,r,i,o=arguments.length,a=new Array(o),s=0;s<o;s++)a[s]=arguments[s];if(a.length===1)switch(a[0]){case"linear":[e,r,n,i]=[0,0,1,1];break;case"ease":[e,r,n,i]=[.25,.1,.25,1];break;case"ease-in":[e,r,n,i]=[.42,0,1,1];break;case"ease-out":[e,r,n,i]=[.42,0,.58,1];break;case"ease-in-out":[e,r,n,i]=[0,0,.58,1];break;default:{var l=a[0].split("(");l[0]==="cubic-bezier"&&l[1].split(")")[0].split(",").length===4&&([e,r,n,i]=l[1].split(")")[0].split(",").map(m=>parseFloat(m)))}}else a.length===4&&([e,r,n,i]=a);var c=hO(e,n),u=hO(r,i),f=xse(e,n),d=m=>m>1?1:m<0?0:m,h=m=>{for(var g=m>1?1:m,p=g,v=0;v<8;++v){var _=c(p)-g,w=f(p);if(Math.abs(_-g)<yp||w<yp)return u(p);p=d(p-_/w)}return u(p)};return h.isStepper=!1,h},Cse=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},{stiff:n=100,damping:r=8,dt:i=17}=e,o=(a,s,l)=>{var c=-(a-s)*n,u=l*r,f=l+(c-u)*i/1e3,d=l*i/1e3+a;return Math.abs(d-s)<yp&&Math.abs(f)<yp?[s,0]:[d,f]};return o.isStepper=!0,o.dt=i,o},kse=t=>{if(typeof t=="string")switch(t){case"ease":case"ease-in-out":case"ease-out":case"ease-in":case"linear":return pO(t);case"spring":return Cse();default:if(t.split("(")[0]==="cubic-bezier")return pO(t)}return typeof t=="function"?t:null};function mO(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function gO(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?mO(Object(n),!0).forEach(function(r){Sse(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):mO(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Sse(t,e,n){return(e=Ose(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Ose(t){var e=Pse(t,"string");return typeof e=="symbol"?e:e+""}function Pse(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Ese=t=>t.replace(/([A-Z])/g,e=>"-".concat(e.toLowerCase())),Ase=(t,e,n)=>t.map(r=>"".concat(Ese(r)," ").concat(e,"ms ").concat(n)).join(","),Dse=(t,e)=>[Object.keys(t),Object.keys(e)].reduce((n,r)=>n.filter(i=>r.includes(i))),du=(t,e)=>Object.keys(e).reduce((n,r)=>gO(gO({},n),{},{[r]:t(r,e[r])}),{});function vO(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function dn(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?vO(Object(n),!0).forEach(function(r){Mse(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):vO(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Mse(t,e,n){return(e=Tse(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Tse(t){var e=Nse(t,"string");return typeof e=="symbol"?e:e+""}function Nse(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var bp=(t,e,n)=>t+(e-t)*n,Kv=t=>{var{from:e,to:n}=t;return e!==n},yO=(t,e,n)=>{var r=du((i,o)=>{if(Kv(o)){var[a,s]=t(o.from,o.to,o.velocity);return dn(dn({},o),{},{from:a,velocity:s})}return o},e);return n<1?du((i,o)=>Kv(o)?dn(dn({},o),{},{velocity:bp(o.velocity,r[i].velocity,n),from:bp(o.from,r[i].from,n)}):o,e):yO(t,r,n-1)};function Ise(t,e,n,r,i,o){var a,s=r.reduce((d,h)=>dn(dn({},d),{},{[h]:{from:t[h],velocity:0,to:e[h]}}),{}),l=()=>du((d,h)=>h.from,s),c=()=>!Object.values(s).filter(Kv).length,u=null,f=d=>{a||(a=d);var h=d-a,m=h/n.dt;s=yO(n,s,m),i(dn(dn(dn({},t),e),l())),a=d,c()||(u=o.setTimeout(f))};return()=>(u=o.setTimeout(f),()=>{u()})}function Lse(t,e,n,r,i,o,a){var s=null,l=i.reduce((f,d)=>dn(dn({},f),{},{[d]:[t[d],e[d]]}),{}),c,u=f=>{c||(c=f);var d=(f-c)/r,h=du((g,p)=>bp(...p,n(d)),l);if(o(dn(dn(dn({},t),e),h)),d<1)s=a.setTimeout(u);else{var m=du((g,p)=>bp(...p,n(1)),l);o(dn(dn(dn({},t),e),m))}};return()=>(s=a.setTimeout(u),()=>{s()})}const jse=(t,e,n,r,i,o)=>{var a=Dse(t,e);return n.isStepper===!0?Ise(t,e,n,a,i,o):Lse(t,e,n,r,a,i,o)};class Rse{setTimeout(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=performance.now(),i=null,o=a=>{a-r>=n?e(a):typeof requestAnimationFrame=="function"&&(i=requestAnimationFrame(o))};return i=requestAnimationFrame(o),()=>{cancelAnimationFrame(i)}}}var Bse=["children","begin","duration","attributeName","easing","isActive","from","to","canBegin","onAnimationEnd","shouldReAnimate","onAnimationReStart","animationManager"];function Qv(){return Qv=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Qv.apply(null,arguments)}function $se(t,e){if(t==null)return{};var n,r,i=Fse(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(r=0;r<o.length;r++)n=o[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function Fse(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}function bO(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Jo(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?bO(Object(n),!0).forEach(function(r){Za(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):bO(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Za(t,e,n){return(e=Hse(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Hse(t){var e=Vse(t,"string");return typeof e=="symbol"?e:e+""}function Vse(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Wse(){return _se(new Rse)}class Yv extends S.PureComponent{constructor(e,n){super(e,n),Za(this,"mounted",!1),Za(this,"manager",null),Za(this,"stopJSAnimation",null),Za(this,"unSubscribe",null);var{isActive:r,attributeName:i,from:o,to:a,children:s,duration:l,animationManager:c}=this.props;if(this.manager=c,this.handleStyleChange=this.handleStyleChange.bind(this),this.changeStyle=this.changeStyle.bind(this),!r||l<=0){this.state={style:{}},typeof s=="function"&&(this.state={style:a});return}if(o){if(typeof s=="function"){this.state={style:o};return}this.state={style:i?{[i]:o}:o}}else this.state={style:{}}}componentDidMount(){var{isActive:e,canBegin:n}=this.props;this.mounted=!0,!(!e||!n)&&this.runAnimation(this.props)}componentDidUpdate(e){var{isActive:n,canBegin:r,attributeName:i,shouldReAnimate:o,to:a,from:s}=this.props,{style:l}=this.state;if(r){if(!n){var c={style:i?{[i]:a}:a};this.state&&l&&(i&&l[i]!==a||!i&&l!==a)&&this.setState(c);return}if(!(wse(e.to,a)&&e.canBegin&&e.isActive)){var u=!e.canBegin||!e.isActive;this.manager.stop(),this.stopJSAnimation&&this.stopJSAnimation();var f=u||o?s:e.to;if(this.state&&l){var d={style:i?{[i]:f}:f};(i&&l[i]!==f||!i&&l!==f)&&this.setState(d)}this.runAnimation(Jo(Jo({},this.props),{},{from:f,begin:0}))}}}componentWillUnmount(){this.mounted=!1;var{onAnimationEnd:e}=this.props;this.unSubscribe&&this.unSubscribe(),this.manager.stop(),this.stopJSAnimation&&this.stopJSAnimation(),e&&e()}handleStyleChange(e){this.changeStyle(e)}changeStyle(e){this.mounted&&this.setState({style:e})}runJSAnimation(e){var{from:n,to:r,duration:i,easing:o,begin:a,onAnimationEnd:s,onAnimationStart:l}=e,c=jse(n,r,kse(o),i,this.changeStyle,this.manager.getTimeoutController()),u=()=>{this.stopJSAnimation=c()};this.manager.start([l,a,u,i,s])}runAnimation(e){var{begin:n,duration:r,attributeName:i,to:o,easing:a,onAnimationStart:s,onAnimationEnd:l,children:c}=e;if(this.unSubscribe=this.manager.subscribe(this.handleStyleChange),typeof a=="function"||typeof c=="function"||a==="spring"){this.runJSAnimation(e);return}var u=i?{[i]:o}:o,f=Ase(Object.keys(u),r,a);this.manager.start([s,n,Jo(Jo({},u),{},{transition:f}),r,l])}render(){var e=this.props,{children:n,begin:r,duration:i,attributeName:o,easing:a,isActive:s,from:l,to:c,canBegin:u,onAnimationEnd:f,shouldReAnimate:d,onAnimationReStart:h,animationManager:m}=e,g=$se(e,Bse),p=S.Children.count(n),v=this.state.style;if(typeof n=="function")return n(v);if(!s||p===0||i<=0)return n;var _=w=>{var{style:b={},className:y}=w.props,k=S.cloneElement(w,Jo(Jo({},g),{},{style:Jo(Jo({},b),v),className:y}));return k};return p===1?_(S.Children.only(n)):P.createElement("div",null,S.Children.map(n,w=>_(w)))}}Za(Yv,"displayName","Animate"),Za(Yv,"defaultProps",{begin:0,duration:1e3,attributeName:"",easing:"ease",isActive:!0,canBegin:!0,onAnimationEnd:()=>{},onAnimationStart:()=>{}});var zse=S.createContext(null);function io(t){var e,n,r=S.useContext(zse);return P.createElement(Yv,Qv({},t,{animationManager:(e=(n=t.animationManager)!==null&&n!==void 0?n:r)!==null&&e!==void 0?e:Wse()}))}function wp(){return wp=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},wp.apply(null,arguments)}var wO=(t,e,n,r,i)=>{var o=Math.min(Math.abs(n)/2,Math.abs(r)/2),a=r>=0?1:-1,s=n>=0?1:-1,l=r>=0&&n>=0||r<0&&n<0?1:0,c;if(o>0&&i instanceof Array){for(var u=[0,0,0,0],f=0,d=4;f<d;f++)u[f]=i[f]>o?o:i[f];c="M".concat(t,",").concat(e+a*u[0]),u[0]>0&&(c+="A ".concat(u[0],",").concat(u[0],",0,0,").concat(l,",").concat(t+s*u[0],",").concat(e)),c+="L ".concat(t+n-s*u[1],",").concat(e),u[1]>0&&(c+="A ".concat(u[1],",").concat(u[1],",0,0,").concat(l,`,
|
|
640
|
+
*/var Rk;function Pie(){if(Rk)return dv;Rk=1;var t=S,e=Oie();function n(c,u){return c===u&&(c!==0||1/c===1/u)||c!==c&&u!==u}var r=typeof Object.is=="function"?Object.is:n,i=e.useSyncExternalStore,o=t.useRef,a=t.useEffect,s=t.useMemo,l=t.useDebugValue;return dv.useSyncExternalStoreWithSelector=function(c,u,f,d,h){var m=o(null);if(m.current===null){var g={hasValue:!1,value:null};m.current=g}else g=m.current;m=s(function(){function v(k){if(!_){if(_=!0,w=k,k=d(k),h!==void 0&&g.hasValue){var C=g.value;if(h(C,k))return b=C}return b=k}if(C=b,r(w,k))return C;var E=d(k);return h!==void 0&&h(C,E)?(w=k,C):(w=k,b=E)}var _=!1,w,b,y=f===void 0?null:f;return[function(){return v(u())},y===null?void 0:function(){return v(y())}]},[u,f,d,h]);var p=i(c,m[0],m[1]);return a(function(){g.hasValue=!0,g.value=p},[p]),l(p),p},dv}Ik.exports=Pie();var Eie=Ik.exports,mv=S.createContext(null),Aie=t=>t,ht=()=>{var t=S.useContext(mv);return t?t.store.dispatch:Aie},Uh=()=>{},Die=()=>Uh,Mie=(t,e)=>t===e;function de(t){var e=S.useContext(mv);return Eie.useSyncExternalStoreWithSelector(e?e.subscription.addNestedSub:Die,e?e.store.getState:Uh,e?e.store.getState:Uh,e?t:Uh,Mie)}function Tie(t,e=`expected a function, instead received ${typeof t}`){if(typeof t!="function")throw new TypeError(e)}function Nie(t,e=`expected an object, instead received ${typeof t}`){if(typeof t!="object")throw new TypeError(e)}function Iie(t,e="expected all items to be functions, instead received the following types: "){if(!t.every(n=>typeof n=="function")){const n=t.map(r=>typeof r=="function"?`function ${r.name||"unnamed"}()`:typeof r).join(", ");throw new TypeError(`${e}[${n}]`)}}var Bk=t=>Array.isArray(t)?t:[t];function Lie(t){const e=Array.isArray(t[0])?t[0]:t;return Iie(e,"createSelector expects all input-selectors to be functions, but received the following types: "),e}function jie(t,e){const n=[],{length:r}=t;for(let i=0;i<r;i++)n.push(t[i].apply(null,e));return n}var Rie=class{constructor(t){this.value=t}deref(){return this.value}},Bie=typeof WeakRef<"u"?WeakRef:Rie,$ie=0,$k=1;function qh(){return{s:$ie,v:void 0,o:null,p:null}}function Fk(t,e={}){let n=qh();const{resultEqualityCheck:r}=e;let i,o=0;function a(){var f;let s=n;const{length:l}=arguments;for(let d=0,h=l;d<h;d++){const m=arguments[d];if(typeof m=="function"||typeof m=="object"&&m!==null){let g=s.o;g===null&&(s.o=g=new WeakMap);const p=g.get(m);p===void 0?(s=qh(),g.set(m,s)):s=p}else{let g=s.p;g===null&&(s.p=g=new Map);const p=g.get(m);p===void 0?(s=qh(),g.set(m,s)):s=p}}const c=s;let u;if(s.s===$k)u=s.v;else if(u=t.apply(null,arguments),o++,r){const d=((f=i==null?void 0:i.deref)==null?void 0:f.call(i))??i;d!=null&&r(d,u)&&(u=d,o!==0&&o--),i=typeof u=="object"&&u!==null||typeof u=="function"?new Bie(u):u}return c.s=$k,c.v=u,u}return a.clearCache=()=>{n=qh(),a.resetResultsCount()},a.resultsCount=()=>o,a.resetResultsCount=()=>{o=0},a}function Fie(t,...e){const n=typeof t=="function"?{memoize:t,memoizeOptions:e}:t,r=(...i)=>{let o=0,a=0,s,l={},c=i.pop();typeof c=="object"&&(l=c,c=i.pop()),Tie(c,`createSelector expects an output function after the inputs, but received: [${typeof c}]`);const u={...n,...l},{memoize:f,memoizeOptions:d=[],argsMemoize:h=Fk,argsMemoizeOptions:m=[],devModeChecks:g={}}=u,p=Bk(d),v=Bk(m),_=Lie(i),w=f(function(){return o++,c.apply(null,arguments)},...p),b=h(function(){a++;const k=jie(_,arguments);return s=w.apply(null,k),s},...v);return Object.assign(b,{resultFunc:c,memoizedResultFunc:w,dependencies:_,dependencyRecomputations:()=>a,resetDependencyRecomputations:()=>{a=0},lastResult:()=>s,recomputations:()=>o,resetRecomputations:()=>{o=0},memoize:f,argsMemoize:h})};return Object.assign(r,{withTypes:()=>r}),r}var H=Fie(Fk),Hie=Object.assign((t,e=H)=>{Nie(t,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof t}`);const n=Object.keys(t),r=n.map(o=>t[o]);return e(r,(...o)=>o.reduce((a,s,l)=>(a[n[l]]=s,a),{}))},{withTypes:()=>Hie}),Hk={},Vk={},Wk={};(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function e(r){return typeof r=="symbol"?1:r===null?2:r===void 0?3:r!==r?4:0}const n=(r,i,o)=>{if(r!==i){const a=e(r),s=e(i);if(a===s&&a===0){if(r<i)return o==="desc"?1:-1;if(r>i)return o==="desc"?-1:1}return o==="desc"?s-a:a-s}return 0};t.compareValues=n})(Wk);var zk={},gv={};(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function e(n){return typeof n=="symbol"||n instanceof Symbol}t.isSymbol=e})(gv),function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=gv,n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;function i(o,a){return Array.isArray(o)?!1:typeof o=="number"||typeof o=="boolean"||o==null||e.isSymbol(o)?!0:typeof o=="string"&&(r.test(o)||!n.test(o))||a!=null&&Object.hasOwn(a,o)}t.isKey=i}(zk),function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=Wk,n=zk,r=Dh;function i(o,a,s,l){if(o==null)return[];s=l?void 0:s,Array.isArray(o)||(o=Object.values(o)),Array.isArray(a)||(a=a==null?[null]:[a]),a.length===0&&(a=[null]),Array.isArray(s)||(s=s==null?[]:[s]),s=s.map(h=>String(h));const c=(h,m)=>{let g=h;for(let p=0;p<m.length&&g!=null;++p)g=g[m[p]];return g},u=(h,m)=>m==null||h==null?m:typeof h=="object"&&"key"in h?Object.hasOwn(m,h.key)?m[h.key]:c(m,h.path):typeof h=="function"?h(m):Array.isArray(h)?c(m,h):typeof m=="object"?m[h]:m,f=a.map(h=>(Array.isArray(h)&&h.length===1&&(h=h[0]),h==null||typeof h=="function"||Array.isArray(h)||n.isKey(h)?h:{key:h,path:r.toPath(h)}));return o.map(h=>({original:h,criteria:f.map(m=>u(m,h))})).slice().sort((h,m)=>{for(let g=0;g<f.length;g++){const p=e.compareValues(h.criteria[g],m.criteria[g],s[g]);if(p!==0)return p}return 0}).map(h=>h.original)}t.orderBy=i}(Vk);var Uk={};(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function e(n,r=1){const i=[],o=Math.floor(r),a=(s,l)=>{for(let c=0;c<s.length;c++){const u=s[c];Array.isArray(u)&&l<o?a(u,l+1):i.push(u)}};return a(n,0),i}t.flatten=e})(Uk);var vv={};(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=fv,n=Hh,r=av,i=Vh;function o(a,s,l){return r.isObject(l)&&(typeof s=="number"&&n.isArrayLike(l)&&e.isIndex(s)&&s<l.length||typeof s=="string"&&s in l)?i.eq(l[s],a):!1}t.isIterateeCall=o})(vv),function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=Vk,n=Uk,r=vv;function i(o,...a){const s=a.length;return s>1&&r.isIterateeCall(o,a[0],a[1])?a=[]:s>2&&r.isIterateeCall(a[0],a[1],a[2])&&(a=[a[0]]),e.orderBy(o,n.flatten(a),["asc"])}t.sortBy=i}(Hk);var Vie=Hk.sortBy;const Kh=hr(Vie);var qk=t=>t.legend.settings,Wie=t=>t.legend.size,zie=t=>t.legend.payload,Uie=H([zie,qk],(t,e)=>{var{itemSorter:n}=e,r=t.flat(1);return n?Kh(r,n):r});function qie(){return de(Uie)}var Qh=1;function Kk(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],[e,n]=S.useState({height:0,left:0,top:0,width:0}),r=S.useCallback(i=>{if(i!=null){var o=i.getBoundingClientRect(),a={height:o.height,left:o.left,top:o.top,width:o.width};(Math.abs(a.height-e.height)>Qh||Math.abs(a.left-e.left)>Qh||Math.abs(a.top-e.top)>Qh||Math.abs(a.width-e.width)>Qh)&&n({height:a.height,left:a.left,top:a.top,width:a.width})}},[e.width,e.height,e.top,e.left,...t]);return[e,r]}function un(t){return`Minified Redux error #${t}; visit https://redux.js.org/Errors?code=${t} for the full message or use the non-minified dev environment for full errors. `}var Kie=typeof Symbol=="function"&&Symbol.observable||"@@observable",Qk=Kie,yv=()=>Math.random().toString(36).substring(7).split("").join("."),Qie={INIT:`@@redux/INIT${yv()}`,REPLACE:`@@redux/REPLACE${yv()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${yv()}`},Yh=Qie;function bv(t){if(typeof t!="object"||t===null)return!1;let e=t;for(;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e||Object.getPrototypeOf(t)===null}function Yk(t,e,n){if(typeof t!="function")throw new Error(un(2));if(typeof e=="function"&&typeof n=="function"||typeof n=="function"&&typeof arguments[3]=="function")throw new Error(un(0));if(typeof e=="function"&&typeof n>"u"&&(n=e,e=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(un(1));return n(Yk)(t,e)}let r=t,i=e,o=new Map,a=o,s=0,l=!1;function c(){a===o&&(a=new Map,o.forEach((p,v)=>{a.set(v,p)}))}function u(){if(l)throw new Error(un(3));return i}function f(p){if(typeof p!="function")throw new Error(un(4));if(l)throw new Error(un(5));let v=!0;c();const _=s++;return a.set(_,p),function(){if(v){if(l)throw new Error(un(6));v=!1,c(),a.delete(_),o=null}}}function d(p){if(!bv(p))throw new Error(un(7));if(typeof p.type>"u")throw new Error(un(8));if(typeof p.type!="string")throw new Error(un(17));if(l)throw new Error(un(9));try{l=!0,i=r(i,p)}finally{l=!1}return(o=a).forEach(_=>{_()}),p}function h(p){if(typeof p!="function")throw new Error(un(10));r=p,d({type:Yh.REPLACE})}function m(){const p=f;return{subscribe(v){if(typeof v!="object"||v===null)throw new Error(un(11));function _(){const b=v;b.next&&b.next(u())}return _(),{unsubscribe:p(_)}},[Qk](){return this}}}return d({type:Yh.INIT}),{dispatch:d,subscribe:f,getState:u,replaceReducer:h,[Qk]:m}}function Yie(t){Object.keys(t).forEach(e=>{const n=t[e];if(typeof n(void 0,{type:Yh.INIT})>"u")throw new Error(un(12));if(typeof n(void 0,{type:Yh.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(un(13))})}function Xk(t){const e=Object.keys(t),n={};for(let o=0;o<e.length;o++){const a=e[o];typeof t[a]=="function"&&(n[a]=t[a])}const r=Object.keys(n);let i;try{Yie(n)}catch(o){i=o}return function(a={},s){if(i)throw i;let l=!1;const c={};for(let u=0;u<r.length;u++){const f=r[u],d=n[f],h=a[f],m=d(h,s);if(typeof m>"u")throw s&&s.type,new Error(un(14));c[f]=m,l=l||m!==h}return l=l||r.length!==Object.keys(a).length,l?c:a}}function Xh(...t){return t.length===0?e=>e:t.length===1?t[0]:t.reduce((e,n)=>(...r)=>e(n(...r)))}function Xie(...t){return e=>(n,r)=>{const i=e(n,r);let o=()=>{throw new Error(un(15))};const a={getState:i.getState,dispatch:(l,...c)=>o(l,...c)},s=t.map(l=>l(a));return o=Xh(...s)(i.dispatch),{...i,dispatch:o}}}function Zk(t){return bv(t)&&"type"in t&&typeof t.type=="string"}var Gk=Symbol.for("immer-nothing"),Jk=Symbol.for("immer-draftable"),rr=Symbol.for("immer-state");function Wr(t,...e){throw new Error(`[Immer] minified error nr: ${t}. Full error at: https://bit.ly/3cXEKWf`)}var cl=Object.getPrototypeOf;function Ua(t){return!!t&&!!t[rr]}function eo(t){var e;return t?eS(t)||Array.isArray(t)||!!t[Jk]||!!((e=t.constructor)!=null&&e[Jk])||Jh(t)||ep(t):!1}var Zie=Object.prototype.constructor.toString();function eS(t){if(!t||typeof t!="object")return!1;const e=cl(t);if(e===null)return!0;const n=Object.hasOwnProperty.call(e,"constructor")&&e.constructor;return n===Object?!0:typeof n=="function"&&Function.toString.call(n)===Zie}function Zh(t,e){Gh(t)===0?Reflect.ownKeys(t).forEach(n=>{e(n,t[n],t)}):t.forEach((n,r)=>e(r,n,t))}function Gh(t){const e=t[rr];return e?e.type_:Array.isArray(t)?1:Jh(t)?2:ep(t)?3:0}function wv(t,e){return Gh(t)===2?t.has(e):Object.prototype.hasOwnProperty.call(t,e)}function tS(t,e,n){const r=Gh(t);r===2?t.set(e,n):r===3?t.add(n):t[e]=n}function Gie(t,e){return t===e?t!==0||1/t===1/e:t!==t&&e!==e}function Jh(t){return t instanceof Map}function ep(t){return t instanceof Set}function qa(t){return t.copy_||t.base_}function _v(t,e){if(Jh(t))return new Map(t);if(ep(t))return new Set(t);if(Array.isArray(t))return Array.prototype.slice.call(t);const n=eS(t);if(e===!0||e==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(t);delete r[rr];let i=Reflect.ownKeys(r);for(let o=0;o<i.length;o++){const a=i[o],s=r[a];s.writable===!1&&(s.writable=!0,s.configurable=!0),(s.get||s.set)&&(r[a]={configurable:!0,writable:!0,enumerable:s.enumerable,value:t[a]})}return Object.create(cl(t),r)}else{const r=cl(t);if(r!==null&&n)return{...t};const i=Object.create(r);return Object.assign(i,t)}}function xv(t,e=!1){return tp(t)||Ua(t)||!eo(t)||(Gh(t)>1&&(t.set=t.add=t.clear=t.delete=Jie),Object.freeze(t),e&&Object.entries(t).forEach(([n,r])=>xv(r,!0))),t}function Jie(){Wr(2)}function tp(t){return Object.isFrozen(t)}var eoe={};function Ka(t){const e=eoe[t];return e||Wr(0,t),e}var ou;function nS(){return ou}function toe(t,e){return{drafts_:[],parent_:t,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function rS(t,e){e&&(Ka("Patches"),t.patches_=[],t.inversePatches_=[],t.patchListener_=e)}function Cv(t){kv(t),t.drafts_.forEach(noe),t.drafts_=null}function kv(t){t===ou&&(ou=t.parent_)}function iS(t){return ou=toe(ou,t)}function noe(t){const e=t[rr];e.type_===0||e.type_===1?e.revoke_():e.revoked_=!0}function oS(t,e){e.unfinalizedDrafts_=e.drafts_.length;const n=e.drafts_[0];return t!==void 0&&t!==n?(n[rr].modified_&&(Cv(e),Wr(4)),eo(t)&&(t=np(e,t),e.parent_||rp(e,t)),e.patches_&&Ka("Patches").generateReplacementPatches_(n[rr].base_,t,e.patches_,e.inversePatches_)):t=np(e,n,[]),Cv(e),e.patches_&&e.patchListener_(e.patches_,e.inversePatches_),t!==Gk?t:void 0}function np(t,e,n){if(tp(e))return e;const r=e[rr];if(!r)return Zh(e,(i,o)=>aS(t,r,e,i,o,n)),e;if(r.scope_!==t)return e;if(!r.modified_)return rp(t,r.base_,!0),r.base_;if(!r.finalized_){r.finalized_=!0,r.scope_.unfinalizedDrafts_--;const i=r.copy_;let o=i,a=!1;r.type_===3&&(o=new Set(i),i.clear(),a=!0),Zh(o,(s,l)=>aS(t,r,i,s,l,n,a)),rp(t,i,!1),n&&t.patches_&&Ka("Patches").generatePatches_(r,n,t.patches_,t.inversePatches_)}return r.copy_}function aS(t,e,n,r,i,o,a){if(Ua(i)){const s=o&&e&&e.type_!==3&&!wv(e.assigned_,r)?o.concat(r):void 0,l=np(t,i,s);if(tS(n,r,l),Ua(l))t.canAutoFreeze_=!1;else return}else a&&n.add(i);if(eo(i)&&!tp(i)){if(!t.immer_.autoFreeze_&&t.unfinalizedDrafts_<1)return;np(t,i),(!e||!e.scope_.parent_)&&typeof r!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,r)&&rp(t,i)}}function rp(t,e,n=!1){!t.parent_&&t.immer_.autoFreeze_&&t.canAutoFreeze_&&xv(e,n)}function roe(t,e){const n=Array.isArray(t),r={type_:n?1:0,scope_:e?e.scope_:nS(),modified_:!1,finalized_:!1,assigned_:{},parent_:e,base_:t,draft_:null,copy_:null,revoke_:null,isManual_:!1};let i=r,o=Sv;n&&(i=[r],o=au);const{revoke:a,proxy:s}=Proxy.revocable(i,o);return r.draft_=s,r.revoke_=a,s}var Sv={get(t,e){if(e===rr)return t;const n=qa(t);if(!wv(n,e))return ioe(t,n,e);const r=n[e];return t.finalized_||!eo(r)?r:r===Ov(t.base_,e)?(Ev(t),t.copy_[e]=Av(r,t)):r},has(t,e){return e in qa(t)},ownKeys(t){return Reflect.ownKeys(qa(t))},set(t,e,n){const r=sS(qa(t),e);if(r!=null&&r.set)return r.set.call(t.draft_,n),!0;if(!t.modified_){const i=Ov(qa(t),e),o=i==null?void 0:i[rr];if(o&&o.base_===n)return t.copy_[e]=n,t.assigned_[e]=!1,!0;if(Gie(n,i)&&(n!==void 0||wv(t.base_,e)))return!0;Ev(t),Pv(t)}return t.copy_[e]===n&&(n!==void 0||e in t.copy_)||Number.isNaN(n)&&Number.isNaN(t.copy_[e])||(t.copy_[e]=n,t.assigned_[e]=!0),!0},deleteProperty(t,e){return Ov(t.base_,e)!==void 0||e in t.base_?(t.assigned_[e]=!1,Ev(t),Pv(t)):delete t.assigned_[e],t.copy_&&delete t.copy_[e],!0},getOwnPropertyDescriptor(t,e){const n=qa(t),r=Reflect.getOwnPropertyDescriptor(n,e);return r&&{writable:!0,configurable:t.type_!==1||e!=="length",enumerable:r.enumerable,value:n[e]}},defineProperty(){Wr(11)},getPrototypeOf(t){return cl(t.base_)},setPrototypeOf(){Wr(12)}},au={};Zh(Sv,(t,e)=>{au[t]=function(){return arguments[0]=arguments[0][0],e.apply(this,arguments)}}),au.deleteProperty=function(t,e){return au.set.call(this,t,e,void 0)},au.set=function(t,e,n){return Sv.set.call(this,t[0],e,n,t[0])};function Ov(t,e){const n=t[rr];return(n?qa(n):t)[e]}function ioe(t,e,n){var i;const r=sS(e,n);return r?"value"in r?r.value:(i=r.get)==null?void 0:i.call(t.draft_):void 0}function sS(t,e){if(!(e in t))return;let n=cl(t);for(;n;){const r=Object.getOwnPropertyDescriptor(n,e);if(r)return r;n=cl(n)}}function Pv(t){t.modified_||(t.modified_=!0,t.parent_&&Pv(t.parent_))}function Ev(t){t.copy_||(t.copy_=_v(t.base_,t.scope_.immer_.useStrictShallowCopy_))}var ooe=class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(e,n,r)=>{if(typeof e=="function"&&typeof n!="function"){const o=n;n=e;const a=this;return function(l=o,...c){return a.produce(l,u=>n.call(this,u,...c))}}typeof n!="function"&&Wr(6),r!==void 0&&typeof r!="function"&&Wr(7);let i;if(eo(e)){const o=iS(this),a=Av(e,void 0);let s=!0;try{i=n(a),s=!1}finally{s?Cv(o):kv(o)}return rS(o,r),oS(i,o)}else if(!e||typeof e!="object"){if(i=n(e),i===void 0&&(i=e),i===Gk&&(i=void 0),this.autoFreeze_&&xv(i,!0),r){const o=[],a=[];Ka("Patches").generateReplacementPatches_(e,i,o,a),r(o,a)}return i}else Wr(1,e)},this.produceWithPatches=(e,n)=>{if(typeof e=="function")return(a,...s)=>this.produceWithPatches(a,l=>e(l,...s));let r,i;return[this.produce(e,n,(a,s)=>{r=a,i=s}),r,i]},typeof(t==null?void 0:t.autoFreeze)=="boolean"&&this.setAutoFreeze(t.autoFreeze),typeof(t==null?void 0:t.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(t.useStrictShallowCopy)}createDraft(t){eo(t)||Wr(8),Ua(t)&&(t=to(t));const e=iS(this),n=Av(t,void 0);return n[rr].isManual_=!0,kv(e),n}finishDraft(t,e){const n=t&&t[rr];(!n||!n.isManual_)&&Wr(9);const{scope_:r}=n;return rS(r,e),oS(void 0,r)}setAutoFreeze(t){this.autoFreeze_=t}setUseStrictShallowCopy(t){this.useStrictShallowCopy_=t}applyPatches(t,e){let n;for(n=e.length-1;n>=0;n--){const i=e[n];if(i.path.length===0&&i.op==="replace"){t=i.value;break}}n>-1&&(e=e.slice(n+1));const r=Ka("Patches").applyPatches_;return Ua(t)?r(t,e):this.produce(t,i=>r(i,e))}};function Av(t,e){const n=Jh(t)?Ka("MapSet").proxyMap_(t,e):ep(t)?Ka("MapSet").proxySet_(t,e):roe(t,e);return(e?e.scope_:nS()).drafts_.push(n),n}function to(t){return Ua(t)||Wr(10,t),lS(t)}function lS(t){if(!eo(t)||tp(t))return t;const e=t[rr];let n;if(e){if(!e.modified_)return e.base_;e.finalized_=!0,n=_v(t,e.scope_.immer_.useStrictShallowCopy_)}else n=_v(t,!0);return Zh(n,(r,i)=>{tS(n,r,lS(i))}),e&&(e.finalized_=!1),n}var ir=new ooe,cS=ir.produce;ir.produceWithPatches.bind(ir),ir.setAutoFreeze.bind(ir),ir.setUseStrictShallowCopy.bind(ir),ir.applyPatches.bind(ir),ir.createDraft.bind(ir),ir.finishDraft.bind(ir);function Pye(t){return t}function uS(t){return({dispatch:n,getState:r})=>i=>o=>typeof o=="function"?o(n,r,t):i(o)}var aoe=uS(),soe=uS,fS={npm_package_exports___require:"./dist/avocado-not-front.umd.js",npm_package_devDependencies__types_node:"20.2.5",npm_package_devDependencies__testing_library_jest_dom:"6.4.0",npm_config_user_agent:"pnpm/9.10.0 npm/? node/v20.17.0 linux x64",CI:"true",npm_package_devDependencies__testing_library_user_event:"14.5.2",npm_package_devDependencies_vite:"5.0.12",npm_node_execpath:"/opt/hostedtoolcache/node/20.17.0/x64/bin/node",npm_package_publishConfig_access:"public",npm_package_files_0:"dist",HOME:"/home/runner",npm_package_dependencies_react_select_async_paginate:"0.7.3",npm_package_devDependencies_classnames:"2.3.2",npm_package_devDependencies_sass:"1.62.1",npm_config_auto_install_peers:"true",npm_package_devDependencies_vite_plugin_dts:"3.7.1",npm_package_dependencies__codemirror_lang_yaml:"6.1.2",npm_package_devDependencies_typescript:"5.1.3",npm_package_peerDependencies_react_select_async_paginate:"0.7.3",npm_package_types:"./dist/index.d.ts",npm_package_devDependencies__types_react_dom:"18.0.11",npm_package_devDependencies__vitejs_plugin_react_swc:"3.5.0",npm_package_type:"module",npm_package_dependencies_zustand:"4.5.4",npm_package_module:"./dist/avocado-not-front.es.js",npm_package_devDependencies__types_testing_library__jest_dom:"6.0.0",npm_package_dependencies__foris_avocado_icons:"workspace:*",npm_config_registry:"https://registry.npmjs.org/",npm_config_node_linker:"hoisted",npm_package_dependencies__codemirror_lang_json:"6.0.1",npm_package_exports___import:"./dist/avocado-not-front.es.js",npm_package_dependencies__foris_avocado_core:"workspace:*",npm_package_dependencies_axios:"^1.8.4",npm_package_dependencies_recharts:"3.1.0",npm_config_node_gyp:"/home/runner/setup-pnpm/node_modules/.pnpm/pnpm@9.10.0/node_modules/pnpm/dist/node_modules/node-gyp/bin/node-gyp.js",PATH:"/home/runner/work/avocado/avocado/packages/avocado-not-front/node_modules/.bin:/home/runner/setup-pnpm/node_modules/.pnpm/pnpm@9.10.0/node_modules/pnpm/dist/node-gyp-bin:/home/runner/work/avocado/avocado/node_modules/.bin:/home/runner/work/avocado/avocado/node_modules/.bin:/home/runner/setup-pnpm/node_modules/.pnpm/pnpm@9.10.0/node_modules/pnpm/dist/node-gyp-bin:/home/runner/work/avocado/avocado/node_modules/.bin:/opt/hostedtoolcache/node/20.17.0/x64/bin:/home/runner/setup-pnpm/node_modules/.bin:/snap/bin:/home/runner/.local/bin:/opt/pipx_bin:/home/runner/.cargo/bin:/home/runner/.config/composer/vendor/bin:/usr/local/.ghcup/bin:/home/runner/.dotnet/tools:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin",TURBO_HASH:"7ddeedd9cb5f0580",npm_package_name:"@foris/avocado-not-front",npm_package_scripts_start_stubby_examples:"stubby -d src/services/stubs/stubby-examples.yml -w -s 8300 -q",NODE:"/opt/hostedtoolcache/node/20.17.0/x64/bin/node",npm_config_frozen_lockfile:"",npm_config_legacy_peer_deps:"true",LANG:"C.UTF-8",npm_package_dependencies_react_dom:"18.2.0",npm_package_main:"./dist/avocado-not-front.umd.js",npm_lifecycle_script:"tsc && vite build",npm_package_dependencies__uiw_react_codemirror:"4.23.12",SHELL:"/bin/bash",NODE_PATH:"/home/runner/setup-pnpm/node_modules/.pnpm/pnpm@9.10.0/node_modules/pnpm/bin/node_modules:/home/runner/setup-pnpm/node_modules/.pnpm/pnpm@9.10.0/node_modules/pnpm/node_modules:/home/runner/setup-pnpm/node_modules/.pnpm/pnpm@9.10.0/node_modules:/home/runner/setup-pnpm/node_modules/.pnpm/node_modules",npm_package_version:"1.0.0",npm_package_devDependencies__testing_library_react:"14.2.0",npm_package_devDependencies__types_react:"18.0.28",npm_package_devDependencies_jsdom:"24.0.0",npm_lifecycle_event:"build",npm_package_scripts_build:"tsc && vite build",npm_package_dependencies__codemirror_lang_sql:"6.8.0",npm_package_dependencies__foris_avocado_suite:"workspace:*",npm_package_dependencies_jsonpath:"1.1.1",npm_package_devDependencies__foris_tsconfig:"workspace:*",npm_package_dependencies_react_select:"5.8.0",PWD:"/home/runner/work/avocado/avocado/packages/avocado-not-front",npm_execpath:"/home/runner/setup-pnpm/node_modules/.pnpm/pnpm@9.10.0/node_modules/pnpm/bin/pnpm.cjs",npm_package_devDependencies_stubby:"^5.1.0",npm_command:"run-script",PNPM_SCRIPT_SRC_DIR:"/home/runner/work/avocado/avocado/packages/avocado-not-front",npm_package_scripts_start_stubby:"stubby -d src/services/stubs/stubby-config.yml -w -s 8200 -q",npm_package_dependencies_react:"18.2.0",npm_package_peerDependencies_react_select:"5.8.0",INIT_CWD:"/home/runner/work/avocado/avocado/packages/avocado-not-front",NODE_ENV:"production"},loe=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?Xh:Xh.apply(null,arguments)};function Pr(t,e){function n(...r){if(e){let i=e(...r);if(!i)throw new Error(or(0));return{type:t,payload:i.payload,..."meta"in i&&{meta:i.meta},..."error"in i&&{error:i.error}}}return{type:t,payload:r[0]}}return n.toString=()=>`${t}`,n.type=t,n.match=r=>Zk(r)&&r.type===t,n}var dS=class zu extends Array{constructor(...e){super(...e),Object.setPrototypeOf(this,zu.prototype)}static get[Symbol.species](){return zu}concat(...e){return super.concat.apply(this,e)}prepend(...e){return e.length===1&&Array.isArray(e[0])?new zu(...e[0].concat(this)):new zu(...e.concat(this))}};function hS(t){return eo(t)?cS(t,()=>{}):t}function ip(t,e,n){return t.has(e)?t.get(e):t.set(e,n(e)).get(e)}function coe(t){return typeof t=="boolean"}var uoe=()=>function(e){const{thunk:n=!0,immutableCheck:r=!0,serializableCheck:i=!0,actionCreatorCheck:o=!0}=e??{};let a=new dS;return n&&(coe(n)?a.push(aoe):a.push(soe(n.extraArgument))),a},foe="RTK_autoBatch",pS=t=>e=>{setTimeout(e,t)},doe=(t={type:"raf"})=>e=>(...n)=>{const r=e(...n);let i=!0,o=!1,a=!1;const s=new Set,l=t.type==="tick"?queueMicrotask:t.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame:pS(10):t.type==="callback"?t.queueNotification:pS(t.timeout),c=()=>{a=!1,o&&(o=!1,s.forEach(u=>u()))};return Object.assign({},r,{subscribe(u){const f=()=>i&&u(),d=r.subscribe(f);return s.add(u),()=>{d(),s.delete(u)}},dispatch(u){var f;try{return i=!((f=u==null?void 0:u.meta)!=null&&f[foe]),o=!i,o&&(a||(a=!0,l(c))),r.dispatch(u)}finally{i=!0}}})},hoe=t=>function(n){const{autoBatch:r=!0}=n??{};let i=new dS(t);return r&&i.push(doe(typeof r=="object"?r:void 0)),i};function poe(t){const e=uoe(),{reducer:n=void 0,middleware:r,devTools:i=!0,duplicateMiddlewareCheck:o=!0,preloadedState:a=void 0,enhancers:s=void 0}=t||{};let l;if(typeof n=="function")l=n;else if(bv(n))l=Xk(n);else throw new Error(or(1));let c;typeof r=="function"?c=r(e):c=e();let u=Xh;i&&(u=loe({trace:fS.NODE_ENV!=="production",...typeof i=="object"&&i}));const f=Xie(...c),d=hoe(f);let h=typeof s=="function"?s(d):d();const m=u(...h);return Yk(l,a,m)}function mS(t){const e={},n=[];let r;const i={addCase(o,a){const s=typeof o=="string"?o:o.type;if(!s)throw new Error(or(28));if(s in e)throw new Error(or(29));return e[s]=a,i},addMatcher(o,a){return n.push({matcher:o,reducer:a}),i},addDefaultCase(o){return r=o,i}};return t(i),[e,n,r]}function moe(t){return typeof t=="function"}function goe(t,e){let[n,r,i]=mS(e),o;if(moe(t))o=()=>hS(t());else{const s=hS(t);o=()=>s}function a(s=o(),l){let c=[n[l.type],...r.filter(({matcher:u})=>u(l)).map(({reducer:u})=>u)];return c.filter(u=>!!u).length===0&&(c=[i]),c.reduce((u,f)=>{if(f)if(Ua(u)){const h=f(u,l);return h===void 0?u:h}else{if(eo(u))return cS(u,d=>f(d,l));{const d=f(u,l);if(d===void 0){if(u===null)return u;throw Error("A case reducer on a non-draftable value must not return undefined")}return d}}return u},s)}return a.getInitialState=o,a}var voe="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",yoe=(t=21)=>{let e="",n=t;for(;n--;)e+=voe[Math.random()*64|0];return e},boe=Symbol.for("rtk-slice-createasyncthunk");function woe(t,e){return`${t}/${e}`}function _oe({creators:t}={}){var n;const e=(n=t==null?void 0:t.asyncThunk)==null?void 0:n[boe];return function(i){const{name:o,reducerPath:a=o}=i;if(!o)throw new Error(or(11));typeof process<"u"&&fS.NODE_ENV==="development"&&i.initialState===void 0&&console.error("You must provide an `initialState` value that is not `undefined`. You may have misspelled `initialState`");const s=(typeof i.reducers=="function"?i.reducers(Coe()):i.reducers)||{},l=Object.keys(s),c={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},u={addCase(b,y){const k=typeof b=="string"?b:b.type;if(!k)throw new Error(or(12));if(k in c.sliceCaseReducersByType)throw new Error(or(13));return c.sliceCaseReducersByType[k]=y,u},addMatcher(b,y){return c.sliceMatchers.push({matcher:b,reducer:y}),u},exposeAction(b,y){return c.actionCreators[b]=y,u},exposeCaseReducer(b,y){return c.sliceCaseReducersByName[b]=y,u}};l.forEach(b=>{const y=s[b],k={reducerName:b,type:woe(o,b),createNotation:typeof i.reducers=="function"};Soe(y)?Poe(k,y,u,e):koe(k,y,u)});function f(){const[b={},y=[],k=void 0]=typeof i.extraReducers=="function"?mS(i.extraReducers):[i.extraReducers],C={...b,...c.sliceCaseReducersByType};return goe(i.initialState,E=>{for(let A in C)E.addCase(A,C[A]);for(let A of c.sliceMatchers)E.addMatcher(A.matcher,A.reducer);for(let A of y)E.addMatcher(A.matcher,A.reducer);k&&E.addDefaultCase(k)})}const d=b=>b,h=new Map,m=new WeakMap;let g;function p(b,y){return g||(g=f()),g(b,y)}function v(){return g||(g=f()),g.getInitialState()}function _(b,y=!1){function k(E){let A=E[b];return typeof A>"u"&&y&&(A=ip(m,k,v)),A}function C(E=d){const A=ip(h,y,()=>new WeakMap);return ip(A,E,()=>{const N={};for(const[M,T]of Object.entries(i.selectors??{}))N[M]=xoe(T,E,()=>ip(m,E,v),y);return N})}return{reducerPath:b,getSelectors:C,get selectors(){return C(k)},selectSlice:k}}const w={name:o,reducer:p,actions:c.actionCreators,caseReducers:c.sliceCaseReducersByName,getInitialState:v,..._(a),injectInto(b,{reducerPath:y,...k}={}){const C=y??a;return b.inject({reducerPath:C,reducer:p},k),{...w,..._(C,!0)}}};return w}}function xoe(t,e,n,r){function i(o,...a){let s=e(o);return typeof s>"u"&&r&&(s=n()),t(s,...a)}return i.unwrapped=t,i}var Er=_oe();function Coe(){function t(e,n){return{_reducerDefinitionType:"asyncThunk",payloadCreator:e,...n}}return t.withTypes=()=>t,{reducer(e){return Object.assign({[e.name](...n){return e(...n)}}[e.name],{_reducerDefinitionType:"reducer"})},preparedReducer(e,n){return{_reducerDefinitionType:"reducerWithPrepare",prepare:e,reducer:n}},asyncThunk:t}}function koe({type:t,reducerName:e,createNotation:n},r,i){let o,a;if("reducer"in r){if(n&&!Ooe(r))throw new Error(or(17));o=r.reducer,a=r.prepare}else o=r;i.addCase(t,o).exposeCaseReducer(e,o).exposeAction(e,a?Pr(t,a):Pr(t))}function Soe(t){return t._reducerDefinitionType==="asyncThunk"}function Ooe(t){return t._reducerDefinitionType==="reducerWithPrepare"}function Poe({type:t,reducerName:e},n,r,i){if(!i)throw new Error(or(18));const{payloadCreator:o,fulfilled:a,pending:s,rejected:l,settled:c,options:u}=n,f=i(t,o,u);r.exposeAction(e,f),a&&r.addCase(f.fulfilled,a),s&&r.addCase(f.pending,s),l&&r.addCase(f.rejected,l),c&&r.addMatcher(f.settled,c),r.exposeCaseReducer(e,{fulfilled:a||op,pending:s||op,rejected:l||op,settled:c||op})}function op(){}var Eoe="task",gS="listener",vS="completed",Dv="cancelled",Aoe=`task-${Dv}`,Doe=`task-${vS}`,Mv=`${gS}-${Dv}`,Moe=`${gS}-${vS}`,ap=class{constructor(t){_2(this,"name","TaskAbortError");_2(this,"message");this.code=t,this.message=`${Eoe} ${Dv} (reason: ${t})`}},Tv=(t,e)=>{if(typeof t!="function")throw new TypeError(or(32))},sp=()=>{},yS=(t,e=sp)=>(t.catch(e),t),bS=(t,e)=>(t.addEventListener("abort",e,{once:!0}),()=>t.removeEventListener("abort",e)),Qa=(t,e)=>{const n=t.signal;n.aborted||("reason"in n||Object.defineProperty(n,"reason",{enumerable:!0,value:e,configurable:!0,writable:!0}),t.abort(e))},Ya=t=>{if(t.aborted){const{reason:e}=t;throw new ap(e)}};function wS(t,e){let n=sp;return new Promise((r,i)=>{const o=()=>i(new ap(t.reason));if(t.aborted){o();return}n=bS(t,o),e.finally(()=>n()).then(r,i)}).finally(()=>{n=sp})}var Toe=async(t,e)=>{try{return await Promise.resolve(),{status:"ok",value:await t()}}catch(n){return{status:n instanceof ap?"cancelled":"rejected",error:n}}finally{e==null||e()}},lp=t=>e=>yS(wS(t,e).then(n=>(Ya(t),n))),_S=t=>{const e=lp(t);return n=>e(new Promise(r=>setTimeout(r,n)))},{assign:ul}=Object,xS={},cp="listenerMiddleware",Noe=(t,e)=>{const n=r=>bS(t,()=>Qa(r,t.reason));return(r,i)=>{Tv(r);const o=new AbortController;n(o);const a=Toe(async()=>{Ya(t),Ya(o.signal);const s=await r({pause:lp(o.signal),delay:_S(o.signal),signal:o.signal});return Ya(o.signal),s},()=>Qa(o,Doe));return i!=null&&i.autoJoin&&e.push(a.catch(sp)),{result:lp(t)(a),cancel(){Qa(o,Aoe)}}}},Ioe=(t,e)=>{const n=async(r,i)=>{Ya(e);let o=()=>{};const s=[new Promise((l,c)=>{let u=t({predicate:r,effect:(f,d)=>{d.unsubscribe(),l([f,d.getState(),d.getOriginalState()])}});o=()=>{u(),c()}})];i!=null&&s.push(new Promise(l=>setTimeout(l,i,null)));try{const l=await wS(e,Promise.race(s));return Ya(e),l}finally{o()}};return(r,i)=>yS(n(r,i))},CS=t=>{let{type:e,actionCreator:n,matcher:r,predicate:i,effect:o}=t;if(e)i=Pr(e).match;else if(n)e=n.type,i=n.match;else if(r)i=r;else if(!i)throw new Error(or(21));return Tv(o),{predicate:i,type:e,effect:o}},kS=ul(t=>{const{type:e,predicate:n,effect:r}=CS(t);return{id:yoe(),effect:r,type:e,predicate:n,pending:new Set,unsubscribe:()=>{throw new Error(or(22))}}},{withTypes:()=>kS}),SS=(t,e)=>{const{type:n,effect:r,predicate:i}=CS(e);return Array.from(t.values()).find(o=>(typeof n=="string"?o.type===n:o.predicate===i)&&o.effect===r)},Nv=t=>{t.pending.forEach(e=>{Qa(e,Mv)})},Loe=t=>()=>{t.forEach(Nv),t.clear()},OS=(t,e,n)=>{try{t(e,n)}catch(r){setTimeout(()=>{throw r},0)}},PS=ul(Pr(`${cp}/add`),{withTypes:()=>PS}),joe=Pr(`${cp}/removeAll`),ES=ul(Pr(`${cp}/remove`),{withTypes:()=>ES}),Roe=(...t)=>{console.error(`${cp}/error`,...t)},su=(t={})=>{const e=new Map,{extra:n,onError:r=Roe}=t;Tv(r);const i=u=>(u.unsubscribe=()=>e.delete(u.id),e.set(u.id,u),f=>{u.unsubscribe(),f!=null&&f.cancelActive&&Nv(u)}),o=u=>{const f=SS(e,u)??kS(u);return i(f)};ul(o,{withTypes:()=>o});const a=u=>{const f=SS(e,u);return f&&(f.unsubscribe(),u.cancelActive&&Nv(f)),!!f};ul(a,{withTypes:()=>a});const s=async(u,f,d,h)=>{const m=new AbortController,g=Ioe(o,m.signal),p=[];try{u.pending.add(m),await Promise.resolve(u.effect(f,ul({},d,{getOriginalState:h,condition:(v,_)=>g(v,_).then(Boolean),take:g,delay:_S(m.signal),pause:lp(m.signal),extra:n,signal:m.signal,fork:Noe(m.signal,p),unsubscribe:u.unsubscribe,subscribe:()=>{e.set(u.id,u)},cancelActiveListeners:()=>{u.pending.forEach((v,_,w)=>{v!==m&&(Qa(v,Mv),w.delete(v))})},cancel:()=>{Qa(m,Mv),u.pending.delete(m)},throwIfCancelled:()=>{Ya(m.signal)}})))}catch(v){v instanceof ap||OS(r,v,{raisedBy:"effect"})}finally{await Promise.all(p),Qa(m,Moe),u.pending.delete(m)}},l=Loe(e);return{middleware:u=>f=>d=>{if(!Zk(d))return f(d);if(PS.match(d))return o(d.payload);if(joe.match(d)){l();return}if(ES.match(d))return a(d.payload);let h=u.getState();const m=()=>{if(h===xS)throw new Error(or(23));return h};let g;try{if(g=f(d),e.size>0){const p=u.getState(),v=Array.from(e.values());for(const _ of v){let w=!1;try{w=_.predicate(d,p,h)}catch(b){w=!1,OS(r,b,{raisedBy:"predicate"})}w&&s(_,d,u,m)}}}finally{h=xS}return g},startListening:o,stopListening:a,clearListeners:l}};function or(t){return`Minified Redux Toolkit error #${t}; visit https://redux-toolkit.js.org/Errors?code=${t} for the full message or use the non-minified dev environment for full errors. `}var Boe={layoutType:"horizontal",width:0,height:0,margin:{top:5,right:5,bottom:5,left:5},scale:1},AS=Er({name:"chartLayout",initialState:Boe,reducers:{setLayout(t,e){t.layoutType=e.payload},setChartSize(t,e){t.width=e.payload.width,t.height=e.payload.height},setMargin(t,e){t.margin.top=e.payload.top,t.margin.right=e.payload.right,t.margin.bottom=e.payload.bottom,t.margin.left=e.payload.left},setScale(t,e){t.scale=e.payload}}}),{setMargin:$oe,setLayout:Foe,setChartSize:Hoe,setScale:Voe}=AS.actions,Woe=AS.reducer;function DS(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function MS(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?DS(Object(n),!0).forEach(function(r){zoe(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):DS(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function zoe(t,e,n){return(e=Uoe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Uoe(t){var e=qoe(t,"string");return typeof e=="symbol"?e:e+""}function qoe(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var up=Math.PI/180,Koe=t=>t*180/Math.PI,It=(t,e,n,r)=>({x:t+Math.cos(-up*r)*n,y:e+Math.sin(-up*r)*n}),TS=function(e,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{top:0,right:0,bottom:0,left:0,width:0,height:0,brushBottom:0};return Math.min(Math.abs(e-(r.left||0)-(r.right||0)),Math.abs(n-(r.top||0)-(r.bottom||0)))/2},Qoe=(t,e)=>{var{x:n,y:r}=t,{x:i,y:o}=e;return Math.sqrt((n-i)**2+(r-o)**2)},Yoe=(t,e)=>{var{x:n,y:r}=t,{cx:i,cy:o}=e,a=Qoe({x:n,y:r},{x:i,y:o});if(a<=0)return{radius:a,angle:0};var s=(n-i)/a,l=Math.acos(s);return r>o&&(l=2*Math.PI-l),{radius:a,angle:Koe(l),angleInRadian:l}},Xoe=t=>{var{startAngle:e,endAngle:n}=t,r=Math.floor(e/360),i=Math.floor(n/360),o=Math.min(r,i);return{startAngle:e-o*360,endAngle:n-o*360}},Zoe=(t,e)=>{var{startAngle:n,endAngle:r}=e,i=Math.floor(n/360),o=Math.floor(r/360),a=Math.min(i,o);return t+a*360},Goe=(t,e)=>{var{x:n,y:r}=t,{radius:i,angle:o}=Yoe({x:n,y:r},e),{innerRadius:a,outerRadius:s}=e;if(i<a||i>s||i===0)return null;var{startAngle:l,endAngle:c}=Xoe(e),u=o,f;if(l<=c){for(;u>c;)u-=360;for(;u<l;)u+=360;f=u>=l&&u<=c}else{for(;u>l;)u-=360;for(;u<c;)u+=360;f=u>=c&&u<=l}return f?MS(MS({},e),{},{radius:i,angle:Zoe(u,e)}):null};function NS(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Ar(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?NS(Object(n),!0).forEach(function(r){Joe(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):NS(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Joe(t,e,n){return(e=eae(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function eae(t){var e=tae(t,"string");return typeof e=="symbol"?e:e+""}function tae(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function ot(t,e,n){return Ze(t)||Ze(e)?n:xi(e)?Qo(t,e,n):typeof e=="function"?e(t):n}var nae=(t,e,n,r,i)=>{var o,a=-1,s=(o=e==null?void 0:e.length)!==null&&o!==void 0?o:0;if(s<=1||t==null)return 0;if(r==="angleAxis"&&i!=null&&Math.abs(Math.abs(i[1]-i[0])-360)<=1e-6)for(var l=0;l<s;l++){var c=l>0?n[l-1].coordinate:n[s-1].coordinate,u=n[l].coordinate,f=l>=s-1?n[0].coordinate:n[l+1].coordinate,d=void 0;if(Zt(u-c)!==Zt(f-u)){var h=[];if(Zt(f-u)===Zt(i[1]-i[0])){d=f;var m=u+i[1]-i[0];h[0]=Math.min(m,(m+c)/2),h[1]=Math.max(m,(m+c)/2)}else{d=c;var g=f+i[1]-i[0];h[0]=Math.min(u,(g+u)/2),h[1]=Math.max(u,(g+u)/2)}var p=[Math.min(u,(d+u)/2),Math.max(u,(d+u)/2)];if(t>p[0]&&t<=p[1]||t>=h[0]&&t<=h[1]){({index:a}=n[l]);break}}else{var v=Math.min(c,f),_=Math.max(c,f);if(t>(v+u)/2&&t<=(_+u)/2){({index:a}=n[l]);break}}}else if(e){for(var w=0;w<s;w++)if(w===0&&t<=(e[w].coordinate+e[w+1].coordinate)/2||w>0&&w<s-1&&t>(e[w].coordinate+e[w-1].coordinate)/2&&t<=(e[w].coordinate+e[w+1].coordinate)/2||w===s-1&&t>(e[w].coordinate+e[w-1].coordinate)/2){({index:a}=e[w]);break}}return a},rae=(t,e,n)=>{if(e&&n){var{width:r,height:i}=n,{align:o,verticalAlign:a,layout:s}=e;if((s==="vertical"||s==="horizontal"&&a==="middle")&&o!=="center"&&re(t[o]))return Ar(Ar({},t),{},{[o]:t[o]+(r||0)});if((s==="horizontal"||s==="vertical"&&o==="center")&&a!=="middle"&&re(t[a]))return Ar(Ar({},t),{},{[a]:t[a]+(i||0)})}return t},Ci=(t,e)=>t==="horizontal"&&e==="xAxis"||t==="vertical"&&e==="yAxis"||t==="centric"&&e==="angleAxis"||t==="radial"&&e==="radiusAxis",IS=(t,e,n,r)=>{if(r)return t.map(s=>s.coordinate);var i,o,a=t.map(s=>(s.coordinate===e&&(i=!0),s.coordinate===n&&(o=!0),s.coordinate));return i||a.push(e),o||a.push(n),a},LS=(t,e,n)=>{if(!t)return null;var{duplicateDomain:r,type:i,range:o,scale:a,realScaleType:s,isCategorical:l,categoricalDomain:c,tickCount:u,ticks:f,niceTicks:d,axisType:h}=t;if(!a)return null;var m=s==="scaleBand"&&a.bandwidth?a.bandwidth()/2:2,g=i==="category"&&a.bandwidth?a.bandwidth()/m:0;if(g=h==="angleAxis"&&o&&o.length>=2?Zt(o[0]-o[1])*2*g:g,f||d){var p=(f||d||[]).map((v,_)=>{var w=r?r.indexOf(v):v;return{coordinate:a(w)+g,value:v,offset:g,index:_}});return p.filter(v=>!Wn(v.coordinate))}return l&&c?c.map((v,_)=>({coordinate:a(v)+g,value:v,index:_,offset:g})):a.ticks&&!n&&u!=null?a.ticks(u).map((v,_)=>({coordinate:a(v)+g,value:v,offset:g,index:_})):a.domain().map((v,_)=>({coordinate:a(v)+g,value:r?r[v]:v,index:_,offset:g}))},jS=1e-4,iae=t=>{var e=t.domain();if(!(!e||e.length<=2)){var n=e.length,r=t.range(),i=Math.min(r[0],r[1])-jS,o=Math.max(r[0],r[1])+jS,a=t(e[0]),s=t(e[n-1]);(a<i||a>o||s<i||s>o)&&t.domain([e[0],e[n-1]])}},oae=(t,e)=>{if(!e||e.length!==2||!re(e[0])||!re(e[1]))return t;var n=Math.min(e[0],e[1]),r=Math.max(e[0],e[1]),i=[t[0],t[1]];return(!re(t[0])||t[0]<n)&&(i[0]=n),(!re(t[1])||t[1]>r)&&(i[1]=r),i[0]>r&&(i[0]=r),i[1]<n&&(i[1]=n),i},aae=t=>{var e=t.length;if(!(e<=0))for(var n=0,r=t[0].length;n<r;++n)for(var i=0,o=0,a=0;a<e;++a){var s=Wn(t[a][n][1])?t[a][n][0]:t[a][n][1];s>=0?(t[a][n][0]=i,t[a][n][1]=i+s,i=t[a][n][1]):(t[a][n][0]=o,t[a][n][1]=o+s,o=t[a][n][1])}},sae=t=>{var e=t.length;if(!(e<=0))for(var n=0,r=t[0].length;n<r;++n)for(var i=0,o=0;o<e;++o){var a=Wn(t[o][n][1])?t[o][n][0]:t[o][n][1];a>=0?(t[o][n][0]=i,t[o][n][1]=i+a,i=t[o][n][1]):(t[o][n][0]=0,t[o][n][1]=0)}},lae={sign:aae,expand:sie,none:ll,silhouette:lie,wiggle:cie,positive:sae},cae=(t,e,n)=>{var r=lae[n],i=aie().keys(e).value((o,a)=>+ot(o,a,0)).order(Z3).offset(r);return i(t)};function Iv(t){return t==null?void 0:String(t)}function fp(t){var{axis:e,ticks:n,bandSize:r,entry:i,index:o,dataKey:a}=t;if(e.type==="category"){if(!e.allowDuplicatedCategory&&e.dataKey&&!Ze(i[e.dataKey])){var s=$C(n,"value",i[e.dataKey]);if(s)return s.coordinate+r/2}return n[o]?n[o].coordinate+r/2:null}var l=ot(i,Ze(a)?e.dataKey:a);return Ze(l)?null:e.scale(l)}var RS=t=>{var{axis:e,ticks:n,offset:r,bandSize:i,entry:o,index:a}=t;if(e.type==="category")return n[a]?n[a].coordinate+r:null;var s=ot(o,e.dataKey,e.scale.domain()[a]);return Ze(s)?null:e.scale(s)-i/2+r},uae=t=>{var{numericAxis:e}=t,n=e.scale.domain();if(e.type==="number"){var r=Math.min(n[0],n[1]),i=Math.max(n[0],n[1]);return r<=0&&i>=0?0:i<0?i:r}return n[0]},fae=t=>{var e=t.flat(2).filter(re);return[Math.min(...e),Math.max(...e)]},dae=t=>[t[0]===1/0?0:t[0],t[1]===-1/0?0:t[1]],hae=(t,e,n)=>{if(t!=null)return dae(Object.keys(t).reduce((r,i)=>{var o=t[i],{stackedData:a}=o,s=a.reduce((l,c)=>{var u=fae(c.slice(e,n+1));return[Math.min(l[0],u[0]),Math.max(l[1],u[1])]},[1/0,-1/0]);return[Math.min(s[0],r[0]),Math.max(s[1],r[1])]},[1/0,-1/0]))},BS=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,$S=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,Xa=(t,e,n)=>{if(t&&t.scale&&t.scale.bandwidth){var r=t.scale.bandwidth();if(!n||r>0)return r}if(t&&e&&e.length>=2){for(var i=Kh(e,u=>u.coordinate),o=1/0,a=1,s=i.length;a<s;a++){var l=i[a],c=i[a-1];o=Math.min((l.coordinate||0)-(c.coordinate||0),o)}return o===1/0?0:o}return n?void 0:0};function FS(t){var{tooltipEntrySettings:e,dataKey:n,payload:r,value:i,name:o}=t;return Ar(Ar({},e),{},{dataKey:n,payload:r,value:i,name:o})}function Xo(t,e){if(t)return String(t);if(typeof e=="string")return e}function pae(t,e,n,r,i){if(n==="horizontal"||n==="vertical"){var o=t>=i.left&&t<=i.left+i.width&&e>=i.top&&e<=i.top+i.height;return o?{x:t,y:e}:null}return r?Goe({x:t,y:e},r):null}var mae=(t,e,n,r)=>{var i=e.find(c=>c&&c.index===n);if(i){if(t==="horizontal")return{x:i.coordinate,y:r.y};if(t==="vertical")return{x:r.x,y:i.coordinate};if(t==="centric"){var o=i.coordinate,{radius:a}=r;return Ar(Ar(Ar({},r),It(r.cx,r.cy,a,o)),{},{angle:o,radius:a})}var s=i.coordinate,{angle:l}=r;return Ar(Ar(Ar({},r),It(r.cx,r.cy,s,l)),{},{angle:l,radius:s})}return{x:0,y:0}},gae=(t,e)=>e==="horizontal"?t.x:e==="vertical"?t.y:e==="centric"?t.angle:t.radius,no=t=>t.layout.width,ro=t=>t.layout.height,vae=t=>t.layout.scale,HS=t=>t.layout.margin,Lv=H(t=>t.cartesianAxis.xAxis,t=>Object.values(t)),jv=H(t=>t.cartesianAxis.yAxis,t=>Object.values(t)),VS="data-recharts-item-index",WS="data-recharts-item-data-key",dp=60;function zS(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Zo(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?zS(Object(n),!0).forEach(function(r){yae(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):zS(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function yae(t,e,n){return(e=bae(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function bae(t){var e=wae(t,"string");return typeof e=="symbol"?e:e+""}function wae(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var _ae=t=>t.brush.height,Ht=H([no,ro,HS,_ae,Lv,jv,qk,Wie],(t,e,n,r,i,o,a,s)=>{var l=o.reduce((m,g)=>{var{orientation:p}=g;if(!g.mirror&&!g.hide){var v=typeof g.width=="number"?g.width:dp;return Zo(Zo({},m),{},{[p]:m[p]+v})}return m},{left:n.left||0,right:n.right||0}),c=i.reduce((m,g)=>{var{orientation:p}=g;return!g.mirror&&!g.hide?Zo(Zo({},m),{},{[p]:Qo(m,"".concat(p))+g.height}):m},{top:n.top||0,bottom:n.bottom||0}),u=Zo(Zo({},c),l),f=u.bottom;u.bottom+=r,u=rae(u,a,s);var d=t-u.left-u.right,h=e-u.top-u.bottom;return Zo(Zo({brushBottom:f},u),{},{width:Math.max(d,0),height:Math.max(h,0)})}),xae=H(Ht,t=>({x:t.left,y:t.top,width:t.width,height:t.height})),US=H(no,ro,(t,e)=>({x:0,y:0,width:t,height:e})),Cae=S.createContext(null),_n=()=>S.useContext(Cae)!=null,hp=t=>t.brush,pp=H([hp,Ht,HS],(t,e,n)=>({height:t.height,x:re(t.x)?t.x:e.left,y:re(t.y)?t.y:e.top+e.height+e.brushBottom-((n==null?void 0:n.bottom)||0),width:re(t.width)?t.width:e.width})),Rv=()=>{var t,e=_n(),n=de(xae),r=de(pp),i=(t=de(hp))===null||t===void 0?void 0:t.padding;return!e||!r||!i?n:{width:r.width-i.left-i.right,height:r.height-i.top-i.bottom,x:i.left,y:i.top}},kae={top:0,bottom:0,left:0,right:0,width:0,height:0,brushBottom:0},qS=()=>{var t;return(t=de(Ht))!==null&&t!==void 0?t:kae},Bv=()=>de(no),$v=()=>de(ro),Sae={top:0,right:0,bottom:0,left:0},Oae=()=>{var t;return(t=de(e=>e.layout.margin))!==null&&t!==void 0?t:Sae},je=t=>t.layout.layoutType,lu=()=>de(je),Pae={settings:{layout:"horizontal",align:"center",verticalAlign:"middle",itemSorter:"value"},size:{width:0,height:0},payload:[]},KS=Er({name:"legend",initialState:Pae,reducers:{setLegendSize(t,e){t.size.width=e.payload.width,t.size.height=e.payload.height},setLegendSettings(t,e){t.settings.align=e.payload.align,t.settings.layout=e.payload.layout,t.settings.verticalAlign=e.payload.verticalAlign,t.settings.itemSorter=e.payload.itemSorter},addLegendPayload(t,e){t.payload.push(e.payload)},removeLegendPayload(t,e){var n=to(t).payload.indexOf(e.payload);n>-1&&t.payload.splice(n,1)}}}),{setLegendSize:QS,setLegendSettings:Eae,addLegendPayload:YS,removeLegendPayload:XS}=KS.actions,Aae=KS.reducer,Dae=["contextPayload"];function Fv(){return Fv=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Fv.apply(null,arguments)}function ZS(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function fl(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?ZS(Object(n),!0).forEach(function(r){Hv(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ZS(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Hv(t,e,n){return(e=Mae(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Mae(t){var e=Tae(t,"string");return typeof e=="symbol"?e:e+""}function Tae(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Nae(t,e){if(t==null)return{};var n,r,i=Iae(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(r=0;r<o.length;r++)n=o[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function Iae(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}function Lae(t){return t.value}function jae(t){var{contextPayload:e}=t,n=Nae(t,Dae),r=Nk(e,t.payloadUniqBy,Lae),i=fl(fl({},n),{},{payload:r});return P.isValidElement(t.content)?P.cloneElement(t.content,i):typeof t.content=="function"?P.createElement(t.content,i):P.createElement(nv,i)}function Rae(t,e,n,r,i,o){var{layout:a,align:s,verticalAlign:l}=e,c,u;return(!t||(t.left===void 0||t.left===null)&&(t.right===void 0||t.right===null))&&(s==="center"&&a==="vertical"?c={left:((r||0)-o.width)/2}:c=s==="right"?{right:n&&n.right||0}:{left:n&&n.left||0}),(!t||(t.top===void 0||t.top===null)&&(t.bottom===void 0||t.bottom===null))&&(l==="middle"?u={top:((i||0)-o.height)/2}:u=l==="bottom"?{bottom:n&&n.bottom||0}:{top:n&&n.top||0}),fl(fl({},c),u)}function Bae(t){var e=ht();return S.useEffect(()=>{e(Eae(t))},[e,t]),null}function $ae(t){var e=ht();return S.useEffect(()=>(e(QS(t)),()=>{e(QS({width:0,height:0}))}),[e,t]),null}function Fae(t){var e=qie(),n=Dre(),r=Oae(),{width:i,height:o,wrapperStyle:a,portal:s}=t,[l,c]=Kk([e]),u=Bv(),f=$v(),d=u-(r.left||0)-(r.right||0),h=mp.getWidthOrHeight(t.layout,o,i,d),m=s?a:fl(fl({position:"absolute",width:(h==null?void 0:h.width)||i||"auto",height:(h==null?void 0:h.height)||o||"auto"},Rae(a,t,r,u,f,l)),a),g=s??n;if(g==null)return null;var p=P.createElement("div",{className:"recharts-legend-wrapper",style:m,ref:c},P.createElement(Bae,{layout:t.layout,align:t.align,verticalAlign:t.verticalAlign,itemSorter:t.itemSorter}),P.createElement($ae,{width:l.width,height:l.height}),P.createElement(jae,Fv({},t,h,{margin:r,chartWidth:u,chartHeight:f,contextPayload:e})));return dr.createPortal(p,g)}let mp=class extends S.PureComponent{static getWidthOrHeight(e,n,r,i){return e==="vertical"&&re(n)?{height:n}:e==="horizontal"?{width:r||i}:null}render(){return P.createElement(Fae,this.props)}};Hv(mp,"displayName","Legend"),Hv(mp,"defaultProps",{align:"center",iconSize:14,itemSorter:"value",layout:"horizontal",verticalAlign:"bottom"});function Vv(){return Vv=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Vv.apply(null,arguments)}function GS(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Wv(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?GS(Object(n),!0).forEach(function(r){Hae(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):GS(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Hae(t,e,n){return(e=Vae(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Vae(t){var e=Wae(t,"string");return typeof e=="symbol"?e:e+""}function Wae(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function zae(t){return Array.isArray(t)&&xi(t[0])&&xi(t[1])?t.join(" ~ "):t}var Uae=t=>{var{separator:e=" : ",contentStyle:n={},itemStyle:r={},labelStyle:i={},payload:o,formatter:a,itemSorter:s,wrapperClassName:l,labelClassName:c,label:u,labelFormatter:f,accessibilityLayer:d=!1}=t,h=()=>{if(o&&o.length){var y={padding:0,margin:0},k=(s?Kh(o,s):o).map((C,E)=>{if(C.type==="none")return null;var A=C.formatter||a||zae,{value:N,name:M}=C,T=N,I=M;if(A){var L=A(N,M,C,E,o);if(Array.isArray(L))[T,I]=L;else if(L!=null)T=L;else return null}var F=Wv({display:"block",paddingTop:4,paddingBottom:4,color:C.color||"#000"},r);return P.createElement("li",{className:"recharts-tooltip-item",key:"tooltip-item-".concat(E),style:F},xi(I)?P.createElement("span",{className:"recharts-tooltip-item-name"},I):null,xi(I)?P.createElement("span",{className:"recharts-tooltip-item-separator"},e):null,P.createElement("span",{className:"recharts-tooltip-item-value"},T),P.createElement("span",{className:"recharts-tooltip-item-unit"},C.unit||""))});return P.createElement("ul",{className:"recharts-tooltip-item-list",style:y},k)}return null},m=Wv({margin:0,padding:10,backgroundColor:"#fff",border:"1px solid #ccc",whiteSpace:"nowrap"},n),g=Wv({margin:0},i),p=!Ze(u),v=p?u:"",_=Le("recharts-default-tooltip",l),w=Le("recharts-tooltip-label",c);p&&f&&o!==void 0&&o!==null&&(v=f(u,o));var b=d?{role:"status","aria-live":"assertive"}:{};return P.createElement("div",Vv({className:_,style:m},b),P.createElement("p",{className:w,style:g},P.isValidElement(v)?v:"".concat(v)),h())},cu="recharts-tooltip-wrapper",qae={visibility:"hidden"};function Kae(t){var{coordinate:e,translateX:n,translateY:r}=t;return Le(cu,{["".concat(cu,"-right")]:re(n)&&e&&re(e.x)&&n>=e.x,["".concat(cu,"-left")]:re(n)&&e&&re(e.x)&&n<e.x,["".concat(cu,"-bottom")]:re(r)&&e&&re(e.y)&&r>=e.y,["".concat(cu,"-top")]:re(r)&&e&&re(e.y)&&r<e.y})}function JS(t){var{allowEscapeViewBox:e,coordinate:n,key:r,offsetTopLeft:i,position:o,reverseDirection:a,tooltipDimension:s,viewBox:l,viewBoxDimension:c}=t;if(o&&re(o[r]))return o[r];var u=n[r]-s-(i>0?i:0),f=n[r]+i;if(e[r])return a[r]?u:f;var d=l[r];if(d==null)return 0;if(a[r]){var h=u,m=d;return h<m?Math.max(f,d):Math.max(u,d)}if(c==null)return 0;var g=f+s,p=d+c;return g>p?Math.max(u,d):Math.max(f,d)}function Qae(t){var{translateX:e,translateY:n,useTranslate3d:r}=t;return{transform:r?"translate3d(".concat(e,"px, ").concat(n,"px, 0)"):"translate(".concat(e,"px, ").concat(n,"px)")}}function Yae(t){var{allowEscapeViewBox:e,coordinate:n,offsetTopLeft:r,position:i,reverseDirection:o,tooltipBox:a,useTranslate3d:s,viewBox:l}=t,c,u,f;return a.height>0&&a.width>0&&n?(u=JS({allowEscapeViewBox:e,coordinate:n,key:"x",offsetTopLeft:r,position:i,reverseDirection:o,tooltipDimension:a.width,viewBox:l,viewBoxDimension:l.width}),f=JS({allowEscapeViewBox:e,coordinate:n,key:"y",offsetTopLeft:r,position:i,reverseDirection:o,tooltipDimension:a.height,viewBox:l,viewBoxDimension:l.height}),c=Qae({translateX:u,translateY:f,useTranslate3d:s})):c=qae,{cssProperties:c,cssClasses:Kae({translateX:u,translateY:f,coordinate:n})}}function eO(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function gp(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?eO(Object(n),!0).forEach(function(r){zv(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):eO(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function zv(t,e,n){return(e=Xae(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Xae(t){var e=Zae(t,"string");return typeof e=="symbol"?e:e+""}function Zae(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}class Gae extends S.PureComponent{constructor(){super(...arguments),zv(this,"state",{dismissed:!1,dismissedAtCoordinate:{x:0,y:0}}),zv(this,"handleKeyDown",e=>{if(e.key==="Escape"){var n,r,i,o;this.setState({dismissed:!0,dismissedAtCoordinate:{x:(n=(r=this.props.coordinate)===null||r===void 0?void 0:r.x)!==null&&n!==void 0?n:0,y:(i=(o=this.props.coordinate)===null||o===void 0?void 0:o.y)!==null&&i!==void 0?i:0}})}})}componentDidMount(){document.addEventListener("keydown",this.handleKeyDown)}componentWillUnmount(){document.removeEventListener("keydown",this.handleKeyDown)}componentDidUpdate(){var e,n;this.state.dismissed&&(((e=this.props.coordinate)===null||e===void 0?void 0:e.x)!==this.state.dismissedAtCoordinate.x||((n=this.props.coordinate)===null||n===void 0?void 0:n.y)!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}render(){var{active:e,allowEscapeViewBox:n,animationDuration:r,animationEasing:i,children:o,coordinate:a,hasPayload:s,isAnimationActive:l,offset:c,position:u,reverseDirection:f,useTranslate3d:d,viewBox:h,wrapperStyle:m,lastBoundingBox:g,innerRef:p,hasPortalFromProps:v}=this.props,{cssClasses:_,cssProperties:w}=Yae({allowEscapeViewBox:n,coordinate:a,offsetTopLeft:c,position:u,reverseDirection:f,tooltipBox:{height:g.height,width:g.width},useTranslate3d:d,viewBox:h}),b=v?{}:gp(gp({transition:l&&e?"transform ".concat(r,"ms ").concat(i):void 0},w),{},{pointerEvents:"none",visibility:!this.state.dismissed&&e&&s?"visible":"hidden",position:"absolute",top:0,left:0}),y=gp(gp({},b),{},{visibility:!this.state.dismissed&&e&&s?"visible":"hidden"},m);return P.createElement("div",{xmlns:"http://www.w3.org/1999/xhtml",tabIndex:-1,className:_,style:y,ref:p},o)}}var Jae=()=>!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout),Go={isSsr:Jae()},tO=()=>de(t=>t.rootProps.accessibilityLayer);function fn(t){return Number.isFinite(t)}function dl(t){return typeof t=="number"&&t>0&&Number.isFinite(t)}function Uv(){return Uv=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Uv.apply(null,arguments)}function nO(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function rO(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?nO(Object(n),!0).forEach(function(r){ese(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):nO(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function ese(t,e,n){return(e=tse(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function tse(t){var e=nse(t,"string");return typeof e=="symbol"?e:e+""}function nse(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var iO={curveBasisClosed:Yre,curveBasisOpen:Xre,curveBasis:Qre,curveBumpX:Ire,curveBumpY:Lre,curveLinearClosed:Zre,curveLinear:Lh,curveMonotoneX:Gre,curveMonotoneY:Jre,curveNatural:eie,curveStep:tie,curveStepAfter:rie,curveStepBefore:nie},vp=t=>fn(t.x)&&fn(t.y),uu=t=>t.x,fu=t=>t.y,rse=(t,e)=>{if(typeof t=="function")return t;var n="curve".concat(nu(t));return(n==="curveMonotone"||n==="curveBump")&&e?iO["".concat(n).concat(e==="vertical"?"Y":"X")]:iO[n]||Lh},ise=t=>{var{type:e="linear",points:n=[],baseLine:r,layout:i,connectNulls:o=!1}=t,a=rse(e,i),s=o?n.filter(vp):n,l;if(Array.isArray(r)){var c=o?r.filter(f=>vp(f)):r,u=s.map((f,d)=>rO(rO({},f),{},{base:c[d]}));return i==="vertical"?l=jh().y(fu).x1(uu).x0(f=>f.base.x):l=jh().x(uu).y1(fu).y0(f=>f.base.y),l.defined(vp).curve(a),l(u)}return i==="vertical"&&re(r)?l=jh().y(fu).x1(uu).x0(r):re(r)?l=jh().x(uu).y1(fu).y0(r):l=XC().x(uu).y(fu),l.defined(vp).curve(a),l(s)},hl=t=>{var{className:e,points:n,path:r,pathRef:i}=t;if((!n||!n.length)&&!r)return null;var o=n&&n.length?ise(t):r;return P.createElement("path",Uv({},Oe(t,!1),B3(t),{className:Le("recharts-curve",e),d:o===null?void 0:o,ref:i}))},ose=["x","y","top","left","width","height","className"];function qv(){return qv=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},qv.apply(null,arguments)}function oO(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function ase(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?oO(Object(n),!0).forEach(function(r){sse(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):oO(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function sse(t,e,n){return(e=lse(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function lse(t){var e=cse(t,"string");return typeof e=="symbol"?e:e+""}function cse(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function use(t,e){if(t==null)return{};var n,r,i=fse(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(r=0;r<o.length;r++)n=o[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function fse(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}var dse=(t,e,n,r,i,o)=>"M".concat(t,",").concat(i,"v").concat(r,"M").concat(o,",").concat(e,"h").concat(n),hse=t=>{var{x:e=0,y:n=0,top:r=0,left:i=0,width:o=0,height:a=0,className:s}=t,l=use(t,ose),c=ase({x:e,y:n,top:r,left:i,width:o,height:a},l);return!re(e)||!re(n)||!re(o)||!re(a)||!re(r)||!re(i)?null:P.createElement("path",qv({},Oe(c,!0),{className:Le("recharts-cross",s),d:dse(e,n,o,a,r,i)}))};function pse(t,e,n,r){var i=r/2;return{stroke:"none",fill:"#ccc",x:t==="horizontal"?e.x-i:n.left+.5,y:t==="horizontal"?n.top+.5:e.y-i,width:t==="horizontal"?r:n.width-1,height:t==="horizontal"?n.height-1:r}}function aO(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function mse(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?aO(Object(n),!0).forEach(function(r){gse(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):aO(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function gse(t,e,n){return(e=vse(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function vse(t){var e=yse(t,"string");return typeof e=="symbol"?e:e+""}function yse(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function ar(t,e){var n=mse({},t),r=e,i=Object.keys(e),o=i.reduce((a,s)=>(a[s]===void 0&&r[s]!==void 0&&(a[s]=r[s]),a),n);return o}var sO={},lO={},cO={};(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function e(n){if(!n||typeof n!="object")return!1;const r=Object.getPrototypeOf(n);return r===null||r===Object.prototype||Object.getPrototypeOf(r)===null?Object.prototype.toString.call(n)==="[object Object]":!1}t.isPlainObject=e})(cO),function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=cO,n=uv,r=Wh,i=zh,o=Vh;function a(c,u,f){return s(c,u,void 0,void 0,void 0,void 0,f)}function s(c,u,f,d,h,m,g){const p=g(c,u,f,d,h,m);if(p!==void 0)return p;if(typeof c==typeof u)switch(typeof c){case"bigint":case"string":case"boolean":case"symbol":case"undefined":return c===u;case"number":return c===u||Object.is(c,u);case"function":return c===u;case"object":return l(c,u,m,g)}return l(c,u,m,g)}function l(c,u,f,d){if(Object.is(c,u))return!0;let h=r.getTag(c),m=r.getTag(u);if(h===i.argumentsTag&&(h=i.objectTag),m===i.argumentsTag&&(m=i.objectTag),h!==m)return!1;switch(h){case i.stringTag:return c.toString()===u.toString();case i.numberTag:{const v=c.valueOf(),_=u.valueOf();return o.eq(v,_)}case i.booleanTag:case i.dateTag:case i.symbolTag:return Object.is(c.valueOf(),u.valueOf());case i.regexpTag:return c.source===u.source&&c.flags===u.flags;case i.functionTag:return c===u}f=f??new Map;const g=f.get(c),p=f.get(u);if(g!=null&&p!=null)return g===u;f.set(c,u),f.set(u,c);try{switch(h){case i.mapTag:{if(c.size!==u.size)return!1;for(const[v,_]of c.entries())if(!u.has(v)||!s(_,u.get(v),v,c,u,f,d))return!1;return!0}case i.setTag:{if(c.size!==u.size)return!1;const v=Array.from(c.values()),_=Array.from(u.values());for(let w=0;w<v.length;w++){const b=v[w],y=_.findIndex(k=>s(b,k,void 0,c,u,f,d));if(y===-1)return!1;_.splice(y,1)}return!0}case i.arrayTag:case i.uint8ArrayTag:case i.uint8ClampedArrayTag:case i.uint16ArrayTag:case i.uint32ArrayTag:case i.bigUint64ArrayTag:case i.int8ArrayTag:case i.int16ArrayTag:case i.int32ArrayTag:case i.bigInt64ArrayTag:case i.float32ArrayTag:case i.float64ArrayTag:{if(typeof Buffer<"u"&&Buffer.isBuffer(c)!==Buffer.isBuffer(u)||c.length!==u.length)return!1;for(let v=0;v<c.length;v++)if(!s(c[v],u[v],v,c,u,f,d))return!1;return!0}case i.arrayBufferTag:return c.byteLength!==u.byteLength?!1:l(new Uint8Array(c),new Uint8Array(u),f,d);case i.dataViewTag:return c.byteLength!==u.byteLength||c.byteOffset!==u.byteOffset?!1:l(new Uint8Array(c),new Uint8Array(u),f,d);case i.errorTag:return c.name===u.name&&c.message===u.message;case i.objectTag:{if(!(l(c.constructor,u.constructor,f,d)||e.isPlainObject(c)&&e.isPlainObject(u)))return!1;const _=[...Object.keys(c),...n.getSymbols(c)],w=[...Object.keys(u),...n.getSymbols(u)];if(_.length!==w.length)return!1;for(let b=0;b<_.length;b++){const y=_[b],k=c[y];if(!Object.hasOwn(u,y))return!1;const C=u[y];if(!s(k,C,y,c,u,f,d))return!1}return!0}default:return!1}}finally{f.delete(c),f.delete(u)}}t.isEqualWith=a}(lO);var uO={};(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function e(){}t.noop=e})(uO),function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=lO,n=uO;function r(i,o){return e.isEqualWith(i,o,n.noop)}t.isEqual=r}(sO);var bse=sO.isEqual;const wse=hr(bse);function _se(t){var e={},n=()=>null,r=!1,i=null,o=a=>{if(!r){if(Array.isArray(a)){if(!a.length)return;var s=a,[l,...c]=s;if(typeof l=="number"){i=t.setTimeout(o.bind(null,c),l);return}o(l),i=t.setTimeout(o.bind(null,c));return}typeof a=="object"&&(e=a,n(e)),typeof a=="function"&&a()}};return{stop:()=>{r=!0},start:a=>{r=!1,i&&(i(),i=null),o(a)},subscribe:a=>(n=a,()=>{n=()=>null}),getTimeoutController:()=>t}}var yp=1e-4,fO=(t,e)=>[0,3*t,3*e-6*t,3*t-3*e+1],dO=(t,e)=>t.map((n,r)=>n*e**r).reduce((n,r)=>n+r),hO=(t,e)=>n=>{var r=fO(t,e);return dO(r,n)},xse=(t,e)=>n=>{var r=fO(t,e),i=[...r.map((o,a)=>o*a).slice(1),0];return dO(i,n)},pO=function(){for(var e,n,r,i,o=arguments.length,a=new Array(o),s=0;s<o;s++)a[s]=arguments[s];if(a.length===1)switch(a[0]){case"linear":[e,r,n,i]=[0,0,1,1];break;case"ease":[e,r,n,i]=[.25,.1,.25,1];break;case"ease-in":[e,r,n,i]=[.42,0,1,1];break;case"ease-out":[e,r,n,i]=[.42,0,.58,1];break;case"ease-in-out":[e,r,n,i]=[0,0,.58,1];break;default:{var l=a[0].split("(");l[0]==="cubic-bezier"&&l[1].split(")")[0].split(",").length===4&&([e,r,n,i]=l[1].split(")")[0].split(",").map(m=>parseFloat(m)))}}else a.length===4&&([e,r,n,i]=a);var c=hO(e,n),u=hO(r,i),f=xse(e,n),d=m=>m>1?1:m<0?0:m,h=m=>{for(var g=m>1?1:m,p=g,v=0;v<8;++v){var _=c(p)-g,w=f(p);if(Math.abs(_-g)<yp||w<yp)return u(p);p=d(p-_/w)}return u(p)};return h.isStepper=!1,h},Cse=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},{stiff:n=100,damping:r=8,dt:i=17}=e,o=(a,s,l)=>{var c=-(a-s)*n,u=l*r,f=l+(c-u)*i/1e3,d=l*i/1e3+a;return Math.abs(d-s)<yp&&Math.abs(f)<yp?[s,0]:[d,f]};return o.isStepper=!0,o.dt=i,o},kse=t=>{if(typeof t=="string")switch(t){case"ease":case"ease-in-out":case"ease-out":case"ease-in":case"linear":return pO(t);case"spring":return Cse();default:if(t.split("(")[0]==="cubic-bezier")return pO(t)}return typeof t=="function"?t:null};function mO(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function gO(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?mO(Object(n),!0).forEach(function(r){Sse(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):mO(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Sse(t,e,n){return(e=Ose(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Ose(t){var e=Pse(t,"string");return typeof e=="symbol"?e:e+""}function Pse(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Ese=t=>t.replace(/([A-Z])/g,e=>"-".concat(e.toLowerCase())),Ase=(t,e,n)=>t.map(r=>"".concat(Ese(r)," ").concat(e,"ms ").concat(n)).join(","),Dse=(t,e)=>[Object.keys(t),Object.keys(e)].reduce((n,r)=>n.filter(i=>r.includes(i))),du=(t,e)=>Object.keys(e).reduce((n,r)=>gO(gO({},n),{},{[r]:t(r,e[r])}),{});function vO(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function dn(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?vO(Object(n),!0).forEach(function(r){Mse(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):vO(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Mse(t,e,n){return(e=Tse(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Tse(t){var e=Nse(t,"string");return typeof e=="symbol"?e:e+""}function Nse(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var bp=(t,e,n)=>t+(e-t)*n,Kv=t=>{var{from:e,to:n}=t;return e!==n},yO=(t,e,n)=>{var r=du((i,o)=>{if(Kv(o)){var[a,s]=t(o.from,o.to,o.velocity);return dn(dn({},o),{},{from:a,velocity:s})}return o},e);return n<1?du((i,o)=>Kv(o)?dn(dn({},o),{},{velocity:bp(o.velocity,r[i].velocity,n),from:bp(o.from,r[i].from,n)}):o,e):yO(t,r,n-1)};function Ise(t,e,n,r,i,o){var a,s=r.reduce((d,h)=>dn(dn({},d),{},{[h]:{from:t[h],velocity:0,to:e[h]}}),{}),l=()=>du((d,h)=>h.from,s),c=()=>!Object.values(s).filter(Kv).length,u=null,f=d=>{a||(a=d);var h=d-a,m=h/n.dt;s=yO(n,s,m),i(dn(dn(dn({},t),e),l())),a=d,c()||(u=o.setTimeout(f))};return()=>(u=o.setTimeout(f),()=>{u()})}function Lse(t,e,n,r,i,o,a){var s=null,l=i.reduce((f,d)=>dn(dn({},f),{},{[d]:[t[d],e[d]]}),{}),c,u=f=>{c||(c=f);var d=(f-c)/r,h=du((g,p)=>bp(...p,n(d)),l);if(o(dn(dn(dn({},t),e),h)),d<1)s=a.setTimeout(u);else{var m=du((g,p)=>bp(...p,n(1)),l);o(dn(dn(dn({},t),e),m))}};return()=>(s=a.setTimeout(u),()=>{s()})}const jse=(t,e,n,r,i,o)=>{var a=Dse(t,e);return n.isStepper===!0?Ise(t,e,n,a,i,o):Lse(t,e,n,r,a,i,o)};class Rse{setTimeout(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=performance.now(),i=null,o=a=>{a-r>=n?e(a):typeof requestAnimationFrame=="function"&&(i=requestAnimationFrame(o))};return i=requestAnimationFrame(o),()=>{cancelAnimationFrame(i)}}}var Bse=["children","begin","duration","attributeName","easing","isActive","from","to","canBegin","onAnimationEnd","shouldReAnimate","onAnimationReStart","animationManager"];function Qv(){return Qv=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Qv.apply(null,arguments)}function $se(t,e){if(t==null)return{};var n,r,i=Fse(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(r=0;r<o.length;r++)n=o[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function Fse(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}function bO(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Jo(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?bO(Object(n),!0).forEach(function(r){Za(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):bO(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Za(t,e,n){return(e=Hse(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Hse(t){var e=Vse(t,"string");return typeof e=="symbol"?e:e+""}function Vse(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Wse(){return _se(new Rse)}class Yv extends S.PureComponent{constructor(e,n){super(e,n),Za(this,"mounted",!1),Za(this,"manager",null),Za(this,"stopJSAnimation",null),Za(this,"unSubscribe",null);var{isActive:r,attributeName:i,from:o,to:a,children:s,duration:l,animationManager:c}=this.props;if(this.manager=c,this.handleStyleChange=this.handleStyleChange.bind(this),this.changeStyle=this.changeStyle.bind(this),!r||l<=0){this.state={style:{}},typeof s=="function"&&(this.state={style:a});return}if(o){if(typeof s=="function"){this.state={style:o};return}this.state={style:i?{[i]:o}:o}}else this.state={style:{}}}componentDidMount(){var{isActive:e,canBegin:n}=this.props;this.mounted=!0,!(!e||!n)&&this.runAnimation(this.props)}componentDidUpdate(e){var{isActive:n,canBegin:r,attributeName:i,shouldReAnimate:o,to:a,from:s}=this.props,{style:l}=this.state;if(r){if(!n){var c={style:i?{[i]:a}:a};this.state&&l&&(i&&l[i]!==a||!i&&l!==a)&&this.setState(c);return}if(!(wse(e.to,a)&&e.canBegin&&e.isActive)){var u=!e.canBegin||!e.isActive;this.manager.stop(),this.stopJSAnimation&&this.stopJSAnimation();var f=u||o?s:e.to;if(this.state&&l){var d={style:i?{[i]:f}:f};(i&&l[i]!==f||!i&&l!==f)&&this.setState(d)}this.runAnimation(Jo(Jo({},this.props),{},{from:f,begin:0}))}}}componentWillUnmount(){this.mounted=!1;var{onAnimationEnd:e}=this.props;this.unSubscribe&&this.unSubscribe(),this.manager.stop(),this.stopJSAnimation&&this.stopJSAnimation(),e&&e()}handleStyleChange(e){this.changeStyle(e)}changeStyle(e){this.mounted&&this.setState({style:e})}runJSAnimation(e){var{from:n,to:r,duration:i,easing:o,begin:a,onAnimationEnd:s,onAnimationStart:l}=e,c=jse(n,r,kse(o),i,this.changeStyle,this.manager.getTimeoutController()),u=()=>{this.stopJSAnimation=c()};this.manager.start([l,a,u,i,s])}runAnimation(e){var{begin:n,duration:r,attributeName:i,to:o,easing:a,onAnimationStart:s,onAnimationEnd:l,children:c}=e;if(this.unSubscribe=this.manager.subscribe(this.handleStyleChange),typeof a=="function"||typeof c=="function"||a==="spring"){this.runJSAnimation(e);return}var u=i?{[i]:o}:o,f=Ase(Object.keys(u),r,a);this.manager.start([s,n,Jo(Jo({},u),{},{transition:f}),r,l])}render(){var e=this.props,{children:n,begin:r,duration:i,attributeName:o,easing:a,isActive:s,from:l,to:c,canBegin:u,onAnimationEnd:f,shouldReAnimate:d,onAnimationReStart:h,animationManager:m}=e,g=$se(e,Bse),p=S.Children.count(n),v=this.state.style;if(typeof n=="function")return n(v);if(!s||p===0||i<=0)return n;var _=w=>{var{style:b={},className:y}=w.props,k=S.cloneElement(w,Jo(Jo({},g),{},{style:Jo(Jo({},b),v),className:y}));return k};return p===1?_(S.Children.only(n)):P.createElement("div",null,S.Children.map(n,w=>_(w)))}}Za(Yv,"displayName","Animate"),Za(Yv,"defaultProps",{begin:0,duration:1e3,attributeName:"",easing:"ease",isActive:!0,canBegin:!0,onAnimationEnd:()=>{},onAnimationStart:()=>{}});var zse=S.createContext(null);function io(t){var e,n,r=S.useContext(zse);return P.createElement(Yv,Qv({},t,{animationManager:(e=(n=t.animationManager)!==null&&n!==void 0?n:r)!==null&&e!==void 0?e:Wse()}))}function wp(){return wp=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},wp.apply(null,arguments)}var wO=(t,e,n,r,i)=>{var o=Math.min(Math.abs(n)/2,Math.abs(r)/2),a=r>=0?1:-1,s=n>=0?1:-1,l=r>=0&&n>=0||r<0&&n<0?1:0,c;if(o>0&&i instanceof Array){for(var u=[0,0,0,0],f=0,d=4;f<d;f++)u[f]=i[f]>o?o:i[f];c="M".concat(t,",").concat(e+a*u[0]),u[0]>0&&(c+="A ".concat(u[0],",").concat(u[0],",0,0,").concat(l,",").concat(t+s*u[0],",").concat(e)),c+="L ".concat(t+n-s*u[1],",").concat(e),u[1]>0&&(c+="A ".concat(u[1],",").concat(u[1],",0,0,").concat(l,`,
|
|
641
641
|
`).concat(t+n,",").concat(e+a*u[1])),c+="L ".concat(t+n,",").concat(e+r-a*u[2]),u[2]>0&&(c+="A ".concat(u[2],",").concat(u[2],",0,0,").concat(l,`,
|
|
642
642
|
`).concat(t+n-s*u[2],",").concat(e+r)),c+="L ".concat(t+s*u[3],",").concat(e+r),u[3]>0&&(c+="A ".concat(u[3],",").concat(u[3],",0,0,").concat(l,`,
|
|
643
643
|
`).concat(t,",").concat(e+r-a*u[3])),c+="Z"}else if(o>0&&i===+i&&i>0){var h=Math.min(o,i);c="M ".concat(t,",").concat(e+a*h,`
|
|
@@ -678,4 +678,4 @@ Expecting `+J.join(", ")+", got '"+(this.terminals_[M]||M)+"'":pe="Parse error o
|
|
|
678
678
|
*
|
|
679
679
|
* This source code is licensed under the MIT license found in the
|
|
680
680
|
* LICENSE file in the root directory of this source tree.
|
|
681
|
-
*/var hM;function Uge(){if(hM)return i2;hM=1;var t=S;function e(l,c){return l===c&&(l!==0||1/l===1/c)||l!==l&&c!==c}var n=typeof Object.is=="function"?Object.is:e,r=t.useSyncExternalStore,i=t.useRef,o=t.useEffect,a=t.useMemo,s=t.useDebugValue;return i2.useSyncExternalStoreWithSelector=function(l,c,u,f,d){var h=i(null);if(h.current===null){var m={hasValue:!1,value:null};h.current=m}else m=h.current;h=a(function(){function p(y){if(!v){if(v=!0,_=y,y=f(y),d!==void 0&&m.hasValue){var k=m.value;if(d(k,y))return w=k}return w=y}if(k=w,n(_,y))return k;var C=f(y);return d!==void 0&&d(k,C)?(_=y,k):(_=y,w=C)}var v=!1,_,w,b=u===void 0?null:u;return[function(){return p(c())},b===null?void 0:function(){return p(b())}]},[c,u,f,d]);var g=r(l,h[0],h[1]);return o(function(){m.hasValue=!0,m.value=g},[g]),s(g),g},i2}Uge();function qge(t){t()}function Kge(){let t=null,e=null;return{clear(){t=null,e=null},notify(){qge(()=>{let n=t;for(;n;)n.callback(),n=n.next})},get(){const n=[];let r=t;for(;r;)n.push(r),r=r.next;return n},subscribe(n){let r=!0;const i=e={callback:n,next:null,prev:e};return i.prev?i.prev.next=i:t=i,function(){!r||t===null||(r=!1,i.next?i.next.prev=i.prev:e=i.prev,i.prev?i.prev.next=i.next:t=i.next)}}}}var pM={notify(){},get:()=>[]};function Qge(t,e){let n,r=pM,i=0,o=!1;function a(g){u();const p=r.subscribe(g);let v=!1;return()=>{v||(v=!0,p(),f())}}function s(){r.notify()}function l(){m.onStateChange&&m.onStateChange()}function c(){return o}function u(){i++,n||(n=t.subscribe(l),r=Kge())}function f(){i--,n&&i===0&&(n(),n=void 0,r.clear(),r=pM)}function d(){o||(o=!0,u())}function h(){o&&(o=!1,f())}const m={addNestedSub:a,notifyNestedSubs:s,handleChangeWrapper:l,isSubscribed:c,trySubscribe:d,tryUnsubscribe:h,getListeners:()=>r};return m}var Yge=()=>typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Xge=Yge(),Zge=()=>typeof navigator<"u"&&navigator.product==="ReactNative",Gge=Zge(),Jge=()=>Xge||Gge?P.useLayoutEffect:P.useEffect,e3e=Jge(),o2=Symbol.for("react-redux-context"),a2=typeof globalThis<"u"?globalThis:{};function t3e(){if(!P.createContext)return{};const t=a2[o2]??(a2[o2]=new Map);let e=t.get(P.createContext);return e||(e=P.createContext(null),t.set(P.createContext,e)),e}var n3e=t3e();function r3e(t){const{children:e,context:n,serverState:r,store:i}=t,o=P.useMemo(()=>{const l=Qge(i);return{store:i,subscription:l,getServerState:r?()=>r:void 0}},[i,r]),a=P.useMemo(()=>i.getState(),[i]);e3e(()=>{const{subscription:l}=o;return l.onStateChange=l.notifyNestedSubs,l.trySubscribe(),a!==i.getState()&&l.notifyNestedSubs(),()=>{l.tryUnsubscribe(),l.onStateChange=void 0}},[o,a]);const s=n||n3e;return P.createElement(s.Provider,{value:o},e)}var i3e=r3e,o3e=(t,e)=>e,s2=H([o3e,je,zue,en,aA,mo,Nde,Ht],Bde),l2=t=>{var e=t.currentTarget.getBoundingClientRect(),n=e.width/t.currentTarget.offsetWidth,r=e.height/t.currentTarget.offsetHeight;return{chartX:Math.round((t.clientX-e.left)/n),chartY:Math.round((t.clientY-e.top)/r)}},mM=Pr("mouseClick"),gM=su();gM.startListening({actionCreator:mM,effect:(t,e)=>{var n=t.payload,r=s2(e.getState(),l2(n));(r==null?void 0:r.activeIndex)!=null&&e.dispatch(zfe({activeIndex:r.activeIndex,activeDataKey:void 0,activeCoordinate:r.activeCoordinate}))}});var c2=Pr("mouseMove"),vM=su();vM.startListening({actionCreator:c2,effect:(t,e)=>{var n=t.payload,r=e.getState(),i=u6(r,r.tooltip.settings.shared),o=s2(r,l2(n));i==="axis"&&((o==null?void 0:o.activeIndex)!=null?e.dispatch(XE({activeIndex:o.activeIndex,activeDataKey:void 0,activeCoordinate:o.activeCoordinate})):e.dispatch(YE()))}});function a3e(t,e){return e instanceof HTMLElement?"HTMLElement <".concat(e.tagName,' class="').concat(e.className,'">'):e===window?"global.window":e}var yM={accessibilityLayer:!0,barCategoryGap:"10%",barGap:4,barSize:void 0,className:void 0,maxBarSize:void 0,stackOffset:"none",syncId:void 0,syncMethod:"index"},bM=Er({name:"rootProps",initialState:yM,reducers:{updateOptions:(t,e)=>{var n;t.accessibilityLayer=e.payload.accessibilityLayer,t.barCategoryGap=e.payload.barCategoryGap,t.barGap=(n=e.payload.barGap)!==null&&n!==void 0?n:yM.barGap,t.barSize=e.payload.barSize,t.maxBarSize=e.payload.maxBarSize,t.stackOffset=e.payload.stackOffset,t.syncId=e.payload.syncId,t.syncMethod=e.payload.syncMethod,t.className=e.payload.className}}}),s3e=bM.reducer,{updateOptions:l3e}=bM.actions,wM=Er({name:"polarOptions",initialState:null,reducers:{updatePolarOptions:(t,e)=>e.payload}}),{updatePolarOptions:c3e}=wM.actions,u3e=wM.reducer,_M=Pr("keyDown"),xM=Pr("focus"),u2=su();u2.startListening({actionCreator:_M,effect:(t,e)=>{var n=e.getState(),r=n.rootProps.accessibilityLayer!==!1;if(r){var{keyboardInteraction:i}=n.tooltip,o=t.payload;if(!(o!=="ArrowRight"&&o!=="ArrowLeft"&&o!=="Enter")){var a=Number(h6(i,ls(n))),s=mo(n);if(o==="Enter"){var l=Jp(n,"axis","hover",String(i.index));e.dispatch(d6({active:!i.active,activeIndex:i.index,activeDataKey:i.dataKey,activeCoordinate:l}));return}var c=Lfe(n),u=c==="left-to-right"?1:-1,f=o==="ArrowRight"?1:-1,d=a+f*u;if(!(s==null||d>=s.length||d<0)){var h=Jp(n,"axis","hover",String(d));e.dispatch(d6({active:!0,activeIndex:d.toString(),activeDataKey:void 0,activeCoordinate:h}))}}}}}),u2.startListening({actionCreator:xM,effect:(t,e)=>{var n=e.getState(),r=n.rootProps.accessibilityLayer!==!1;if(r){var{keyboardInteraction:i}=n.tooltip;if(!i.active&&i.index==null){var o="0",a=Jp(n,"axis","hover",String(o));e.dispatch(d6({activeDataKey:void 0,active:!0,activeIndex:o,activeCoordinate:a}))}}}});var Ir=Pr("externalEvent"),CM=su();CM.startListening({actionCreator:Ir,effect:(t,e)=>{if(t.payload.handler!=null){var n=e.getState(),r={activeCoordinate:kde(n),activeDataKey:uA(n),activeIndex:aa(n),activeLabel:cA(n),activeTooltipIndex:aa(n),isTooltipActive:Sde(n)};t.payload.handler(r,t.payload.reactEvent)}}});var f3e=H([Ol],t=>t.tooltipItemPayloads),d3e=H([f3e,Iu,(t,e,n)=>e,(t,e,n)=>n],(t,e,n,r)=>{var i=t.find(s=>s.settings.dataKey===r);if(i!=null){var{positions:o}=i;if(o!=null){var a=e(o,n);return a}}}),kM=Pr("touchMove"),SM=su();SM.startListening({actionCreator:kM,effect:(t,e)=>{var n=t.payload,r=e.getState(),i=u6(r,r.tooltip.settings.shared);if(i==="axis"){var o=s2(r,l2({clientX:n.touches[0].clientX,clientY:n.touches[0].clientY,currentTarget:n.currentTarget}));(o==null?void 0:o.activeIndex)!=null&&e.dispatch(XE({activeIndex:o.activeIndex,activeDataKey:void 0,activeCoordinate:o.activeCoordinate}))}else if(i==="item"){var a,s=n.touches[0],l=document.elementFromPoint(s.clientX,s.clientY);if(!l||!l.getAttribute)return;var c=l.getAttribute(VS),u=(a=l.getAttribute(WS))!==null&&a!==void 0?a:void 0,f=d3e(e.getState(),c,u);e.dispatch(QE({activeDataKey:u,activeIndex:c,activeCoordinate:f}))}}});var h3e=Xk({brush:Rme,cartesianAxis:Oge,chartData:Jde,graphicalItems:Ape,layout:Woe,legend:Aae,options:Qde,polarAxis:hpe,polarOptions:u3e,referenceElements:Ume,rootProps:s3e,tooltip:Ufe}),p3e=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"Chart";return poe({reducer:h3e,preloadedState:e,middleware:r=>r({serializableCheck:!1}).concat([gM.middleware,vM.middleware,u2.middleware,CM.middleware,SM.middleware]),devTools:{serialize:{replacer:a3e},name:"recharts-".concat(n)}})};function OM(t){var{preloadedState:e,children:n,reduxStoreName:r}=t,i=_n(),o=S.useRef(null);if(i)return n;o.current==null&&(o.current=p3e(e,r));var a=mv;return P.createElement(i3e,{context:a,store:o.current},n)}function PM(t){var{layout:e,width:n,height:r,margin:i}=t,o=ht(),a=_n();return S.useEffect(()=>{a||(o(Foe(e)),o(Hoe({width:n,height:r})),o($oe(i)))},[o,a,e,n,r,i]),null}function EM(t){var e=ht();return S.useEffect(()=>{e(l3e(t))},[e,t]),null}var m3e=["children"];function g3e(t,e){if(t==null)return{};var n,r,i=v3e(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(r=0;r<o.length;r++)n=o[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function v3e(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}function w1(){return w1=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},w1.apply(null,arguments)}var y3e={width:"100%",height:"100%"},b3e=S.forwardRef((t,e)=>{var n=Bv(),r=$v(),i=tO();if(!dl(n)||!dl(r))return null;var{children:o,otherAttributes:a,title:s,desc:l}=t,c,u;return typeof a.tabIndex=="number"?c=a.tabIndex:c=i?0:void 0,typeof a.role=="string"?u=a.role:u=i?"application":void 0,P.createElement(H3,w1({},a,{title:s,desc:l,role:u,tabIndex:c,width:n,height:r,style:y3e,ref:e}),o)}),w3e=t=>{var{children:e}=t,n=de(pp);if(!n)return null;var{width:r,height:i,y:o,x:a}=n;return P.createElement(H3,{width:r,height:i,x:a,y:o},e)},AM=S.forwardRef((t,e)=>{var{children:n}=t,r=g3e(t,m3e),i=_n();return i?P.createElement(w3e,null,n):P.createElement(b3e,w1({ref:e},r),n)});function _3e(){var t=ht(),[e,n]=S.useState(null),r=de(vae);return S.useEffect(()=>{if(e!=null){var i=e.getBoundingClientRect(),o=i.width/e.offsetWidth;fn(o)&&o!==r&&t(Voe(o))}},[e,t,r]),n}function DM(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function x3e(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?DM(Object(n),!0).forEach(function(r){C3e(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):DM(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function C3e(t,e,n){return(e=k3e(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function k3e(t){var e=S3e(t,"string");return typeof e=="symbol"?e:e+""}function S3e(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var O3e=S.forwardRef((t,e)=>{var{children:n,className:r,height:i,onClick:o,onContextMenu:a,onDoubleClick:s,onMouseDown:l,onMouseEnter:c,onMouseLeave:u,onMouseMove:f,onMouseUp:d,onTouchEnd:h,onTouchMove:m,onTouchStart:g,style:p,width:v}=t,_=ht(),[w,b]=S.useState(null),[y,k]=S.useState(null);nhe();var C=_3e(),E=S.useCallback(oe=>{C(oe),typeof e=="function"&&e(oe),b(oe),k(oe)},[C,e,b,k]),A=S.useCallback(oe=>{_(mM(oe)),_(Ir({handler:o,reactEvent:oe}))},[_,o]),N=S.useCallback(oe=>{_(c2(oe)),_(Ir({handler:c,reactEvent:oe}))},[_,c]),M=S.useCallback(oe=>{_(YE()),_(Ir({handler:u,reactEvent:oe}))},[_,u]),T=S.useCallback(oe=>{_(c2(oe)),_(Ir({handler:f,reactEvent:oe}))},[_,f]),I=S.useCallback(()=>{_(xM())},[_]),L=S.useCallback(oe=>{_(_M(oe.key))},[_]),F=S.useCallback(oe=>{_(Ir({handler:a,reactEvent:oe}))},[_,a]),V=S.useCallback(oe=>{_(Ir({handler:s,reactEvent:oe}))},[_,s]),W=S.useCallback(oe=>{_(Ir({handler:l,reactEvent:oe}))},[_,l]),X=S.useCallback(oe=>{_(Ir({handler:d,reactEvent:oe}))},[_,d]),J=S.useCallback(oe=>{_(Ir({handler:g,reactEvent:oe}))},[_,g]),pe=S.useCallback(oe=>{_(kM(oe)),_(Ir({handler:m,reactEvent:oe}))},[_,m]),he=S.useCallback(oe=>{_(Ir({handler:h,reactEvent:oe}))},[_,h]);return P.createElement(wA.Provider,{value:w},P.createElement(zC.Provider,{value:y},P.createElement("div",{className:Le("recharts-wrapper",r),style:x3e({position:"relative",cursor:"default",width:v,height:i},p),onClick:A,onContextMenu:F,onDoubleClick:V,onFocus:I,onKeyDown:L,onMouseDown:W,onMouseEnter:N,onMouseLeave:M,onMouseMove:T,onMouseUp:X,onTouchEnd:he,onTouchMove:pe,onTouchStart:J,ref:E},n)))}),P3e=["children","className","width","height","style","compact","title","desc"];function E3e(t,e){if(t==null)return{};var n,r,i=A3e(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(r=0;r<o.length;r++)n=o[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function A3e(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}var MM=S.forwardRef((t,e)=>{var{children:n,className:r,width:i,height:o,style:a,compact:s,title:l,desc:c}=t,u=E3e(t,P3e),f=Oe(u,!1);return s?P.createElement(AM,{otherAttributes:f,title:l,desc:c},n):P.createElement(O3e,{className:r,style:a,width:i,height:o,onClick:t.onClick,onMouseLeave:t.onMouseLeave,onMouseEnter:t.onMouseEnter,onMouseMove:t.onMouseMove,onMouseDown:t.onMouseDown,onMouseUp:t.onMouseUp,onContextMenu:t.onContextMenu,onDoubleClick:t.onDoubleClick,onTouchStart:t.onTouchStart,onTouchMove:t.onTouchMove,onTouchEnd:t.onTouchEnd},P.createElement(AM,{otherAttributes:f,title:l,desc:c,ref:e},P.createElement(Kme,null,n)))}),D3e=["width","height"];function f2(){return f2=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},f2.apply(null,arguments)}function M3e(t,e){if(t==null)return{};var n,r,i=T3e(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(r=0;r<o.length;r++)n=o[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function T3e(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}var N3e={top:5,right:5,bottom:5,left:5},I3e={accessibilityLayer:!0,layout:"horizontal",stackOffset:"none",barCategoryGap:"10%",barGap:4,margin:N3e,reverseStackOrder:!1,syncMethod:"index"},d2=S.forwardRef(function(e,n){var r,i=ar(e.categoricalChartProps,I3e),{width:o,height:a}=i,s=M3e(i,D3e);if(!dl(o)||!dl(a))return null;var{chartName:l,defaultTooltipEventType:c,validateTooltipEventTypes:u,tooltipPayloadSearcher:f,categoricalChartProps:d}=e,h={chartName:l,defaultTooltipEventType:c,validateTooltipEventTypes:u,tooltipPayloadSearcher:f,eventEmitter:void 0};return P.createElement(OM,{preloadedState:{options:h},reduxStoreName:(r=d.id)!==null&&r!==void 0?r:l},P.createElement(BD,{chartData:d.data}),P.createElement(PM,{width:o,height:a,layout:i.layout,margin:i.margin}),P.createElement(EM,{accessibilityLayer:i.accessibilityLayer,barCategoryGap:i.barCategoryGap,maxBarSize:i.maxBarSize,stackOffset:i.stackOffset,barGap:i.barGap,barSize:i.barSize,syncId:i.syncId,syncMethod:i.syncMethod,className:i.className}),P.createElement(MM,f2({},s,{width:o,height:a,ref:n})))}),L3e=["axis"],j3e=S.forwardRef((t,e)=>P.createElement(d2,{chartName:"LineChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:L3e,tooltipPayloadSearcher:t1,categoricalChartProps:t,ref:e})),R3e=["axis","item"],B3e=S.forwardRef((t,e)=>P.createElement(d2,{chartName:"BarChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:R3e,tooltipPayloadSearcher:t1,categoricalChartProps:t,ref:e}));function $3e(t){var e=ht();return S.useEffect(()=>{e(c3e(t))},[e,t]),null}var F3e=["width","height","layout"];function h2(){return h2=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},h2.apply(null,arguments)}function H3e(t,e){if(t==null)return{};var n,r,i=V3e(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(r=0;r<o.length;r++)n=o[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function V3e(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}var W3e={top:5,right:5,bottom:5,left:5},z3e={accessibilityLayer:!0,stackOffset:"none",barCategoryGap:"10%",barGap:4,margin:W3e,reverseStackOrder:!1,syncMethod:"index",layout:"radial"},U3e=S.forwardRef(function(e,n){var r,i=ar(e.categoricalChartProps,z3e),{width:o,height:a,layout:s}=i,l=H3e(i,F3e);if(!dl(o)||!dl(a))return null;var{chartName:c,defaultTooltipEventType:u,validateTooltipEventTypes:f,tooltipPayloadSearcher:d}=e,h={chartName:c,defaultTooltipEventType:u,validateTooltipEventTypes:f,tooltipPayloadSearcher:d,eventEmitter:void 0};return P.createElement(OM,{preloadedState:{options:h},reduxStoreName:(r=i.id)!==null&&r!==void 0?r:c},P.createElement(BD,{chartData:i.data}),P.createElement(PM,{width:o,height:a,layout:s,margin:i.margin}),P.createElement(EM,{accessibilityLayer:i.accessibilityLayer,barCategoryGap:i.barCategoryGap,maxBarSize:i.maxBarSize,stackOffset:i.stackOffset,barGap:i.barGap,barSize:i.barSize,syncId:i.syncId,syncMethod:i.syncMethod,className:i.className}),P.createElement($3e,{cx:i.cx,cy:i.cy,startAngle:i.startAngle,endAngle:i.endAngle,innerRadius:i.innerRadius,outerRadius:i.outerRadius}),P.createElement(MM,h2({width:o,height:a},l,{ref:n})))}),q3e=["item"],K3e={layout:"centric",startAngle:0,endAngle:360,cx:"50%",cy:"50%",innerRadius:0,outerRadius:"80%"},Q3e=S.forwardRef((t,e)=>{var n=ar(t,K3e);return P.createElement(U3e,{chartName:"PieChart",defaultTooltipEventType:"item",validateTooltipEventTypes:q3e,tooltipPayloadSearcher:t1,categoricalChartProps:n,ref:e})}),Y3e=["axis"],X3e=S.forwardRef((t,e)=>P.createElement(d2,{chartName:"AreaChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:Y3e,tooltipPayloadSearcher:t1,categoricalChartProps:t,ref:e}));const _1=()=>K.jsx(mp,{wrapperStyle:{color:yo.labelColor,fontSize:yo.fontSize}}),x1=()=>K.jsx(uhe,{contentStyle:{backgroundColor:yo.tooltipBg,borderRadius:yo.tooltipBorderRadius,color:yo.tooltipColor}}),p2=({dataKey:t})=>K.jsx(t2,{dataKey:t,tick:{fill:yo.labelColor,fontSize:yo.fontSize}}),m2=()=>K.jsx(r2,{tick:{fill:yo.labelColor,fontSize:yo.fontSize}}),Z3e={area:t=>{const{data:e,xKey:n,yKeys:r}=t;return K.jsx(n1,{width:"100%",height:400,children:K.jsxs(X3e,{data:e,children:[K.jsx(g1,{strokeDasharray:"3 3"}),K.jsx(p2,{dataKey:n}),K.jsx(m2,{}),K.jsx(x1,{}),K.jsx(_1,{}),r.map((i,o)=>K.jsx(J6,{type:"monotone",dataKey:i,stroke:Ei[o%Ei.length],fill:Ei[o%Ei.length]},i))]})})},bar:t=>{const{data:e,xKey:n,yKeys:r}=t;return K.jsx(n1,{width:"100%",height:400,children:K.jsxs(B3e,{data:e,children:[K.jsx(g1,{strokeDasharray:"3 3"}),K.jsx(p2,{dataKey:n}),K.jsx(m2,{}),K.jsx(x1,{}),K.jsx(_1,{}),r.map((i,o)=>K.jsx(z6,{dataKey:i,fill:Ei[o%Ei.length]},i))]})})},line:t=>{const{data:e,xKey:n,yKeys:r}=t;return K.jsx(n1,{width:"100%",height:400,children:K.jsxs(j3e,{data:e,children:[K.jsx(g1,{strokeDasharray:"3 3"}),K.jsx(p2,{dataKey:n}),K.jsx(m2,{}),K.jsx(x1,{}),K.jsx(_1,{}),r.map((i,o)=>K.jsx(Z6,{type:"monotone",dataKey:i,stroke:Ei[o%Ei.length],strokeWidth:2,dot:!1},i))]})})},pie:t=>{const{data:e,xKey:n,yKeys:r}=t;return K.jsx(n1,{width:"100%",height:400,children:K.jsxs(Q3e,{children:[K.jsx(x1,{}),K.jsx(_1,{}),K.jsx(B6,{data:e,dataKey:r[0],nameKey:n,label:!0,outerRadius:120,children:e.map((i,o)=>K.jsx(Ru,{fill:Ei[o%Ei.length]},`cell-${o}`))})]})})}},Ei=["var(--color-primitive-palette-1-50)","var(--color-primitive-palette-2-50)","var(--color-primitive-palette-3-50)","var(--color-primitive-palette-4-50)","var(--color-primitive-palette-5-50)","var(--color-primitive-palette-6-50)","var(--color-primitive-palette-7-50)","var(--color-primitive-palette-8-50)","var(--color-primitive-palette-9-50)","var(--color-primitive-palette-10-50)","var(--color-primitive-palette-11-50)","var(--color-primitive-palette-12-50)","var(--color-primitive-palette-13-50)","var(--color-primitive-palette-14-50)","var(--color-primitive-palette-15-50)","var(--color-primitive-palette-16-50)","var(--color-primitive-palette-17-50)"],yo={fontFamily:"Roboto, sans-serif",fontSize:12,labelColor:"var(--color-neutral-90)",tooltipBg:"#fff",tooltipColor:"#000",tooltipBorderRadius:"4px"},TM=t=>{const{component:e,userFlow:n,hash:r,responseKey:i,dataSource:o,...a}=t,s=Z3e[a.type];if(!s)return K.jsx("div",{children:"Not supported chart type"});const{fetchDataSource:l}=si(),[c,u]=S.useState(!1),[f,d]=S.useState([]),h=async()=>{var g,p;try{u(!0);const{jsonPathData:v,mapperData:_}=o,w=T3(o,1),b=await l(w,n,!1),y=v?(g=NC(b==null?void 0:b.data,v,_))==null?void 0:g.items:(p=b==null?void 0:b.data)==null?void 0:p.data;d(y),u(!1)}catch(v){alert(JSON.stringify(v)),u(!1)}};S.useEffect(()=>{o?h():d(a.data)},[]);const m={...a,data:f};return c?K.jsx(Q9,{height:400}):K.jsx(K.Fragment,{children:s(m)})},NM={header:"_header_1lcyj_1",header_content:"_header_content_1lcyj_5"},G3e=({className:t="",theme:e="dark",inputs:n=[]})=>{const r=e!=="auto"?`avocado-${e}-theme`:"";return K.jsx("section",{className:Ph(NM.header,r,t),children:K.jsx("div",{className:"container",children:K.jsx("div",{className:"container_row",children:K.jsx("div",{className:`${NM.header_content} col_6 col_md_12`,children:n.map((i,o)=>K.jsx(S.Fragment,{children:i},o))})})})})},ds=(t,e,n)=>{var o;const r={breadcrumbs:a=>K.jsx(OQ,{...a,userFlow:t,pageId:e}),button:a=>K.jsx(PQ,{...a,userFlow:t,pageId:e}),cardNotification:a=>K.jsx(AQ,{...a}),chart:a=>K.jsx(TM,{...a,userFlow:t}),checkbox:a=>K.jsx(DQ,{...a,userFlow:t,pageId:e}),code:a=>K.jsx(cre,{...a,userFlow:t,pageId:e}),divider:a=>K.jsx(dre,{...a}),heading:a=>f4(a),roundButton:a=>K.jsx(nve,{...a,userFlow:t,pageId:e}),row:a=>K.jsx(IM,{...a,userFlow:t,pageId:e}),select:a=>K.jsx(ave,{...a,userFlow:t,pageId:e}),switch:a=>K.jsx(lve,{...a,userFlow:t,pageId:e}),spacing:a=>K.jsx(sve,{...a,userFlow:t,pageId:e}),table:a=>K.jsx(dve,{...a,userFlow:t,pageId:e}),text:a=>d4(a),textField:a=>K.jsx(pve,{...a,userFlow:t,pageId:e}),toast:a=>K.jsx(mve,{...a,userFlow:t,pageId:e}),modal:a=>K.jsx(eve,{...a,userFlow:t,pageId:e})};return(o=n==null?void 0:n.filter(Boolean))==null?void 0:o.map(a=>{const s=r[a.component];return s?s({...a,userFlow:t,pageId:e}):null})},J3e={modalContent:"_modalContent_1piho_1"},eve=({userFlow:t,pageId:e,responseKey:n,header:r,body:i,footer:o,headerStatusColor:a,...s})=>{const l=St(g=>{var p;return(p=g[t])==null?void 0:p.isModalOpen}),c={...s},u=(c==null?void 0:c.headerStatusColor)??a,f=S.useCallback(()=>{x4(t),C4(t,!1)},[t,n]),d=Array.isArray(r)?ds(t,e,r):r,h=ds(t,e,i),m=ds(t,e,o);return K.jsx(_F,{...c,headerStatusColor:u,header:typeof d=="string"?d:K.jsx(K.Fragment,{children:d.map((g,p)=>K.jsx(S.Fragment,{children:g},`header-${p}`))}),children:K.jsx("section",{className:J3e.modalContent,children:h.map((g,p)=>K.jsx(S.Fragment,{children:g},`body-${p}`))}),actions:K.jsx(K.Fragment,{children:m.map((g,p)=>K.jsx(S.Fragment,{children:g},`footer-${p}`))}),open:l,onClose:f})},tve=({userFlow:t,pageId:e})=>{var o,a;const n=nK(t);if(!n)return null;const r=[...(n==null?void 0:n.components)||[],...((o=n==null?void 0:n.header)==null?void 0:o.components)||[],...((a=n==null?void 0:n.body)==null?void 0:a.components)||[]],i=ds(t,e,r);return K.jsx(K.Fragment,{children:i==null?void 0:i.map((s,l)=>{const c=`overlay-${l}-${Date.now()}`;return K.jsx(S.Fragment,{children:s},c)})})},nve=t=>{const{userFlow:e,pageId:n,responseKey:r,actionType:i,dataSource:o,dependencies:a,onClick:s,...l}=t,{getNextUI:c,fetchAndGetNextUI:u}=si(),{disabled:f}=No(e,a),d={...l},h=(d==null?void 0:d.disabled)??f,m=S.useCallback(async()=>{var g;try{const p={...(g=St.getState()[e])==null?void 0:g.entries,[r]:{status:200}};oi(e,p);const v=async _=>{const w=await _(e,n,p,r,o);w!=null&&w.data&&Wi(e,w==null?void 0:w.data)};switch(i){case"GO_TO_NEXT_UI":await v(c);break;case"FETCH_AND_GO_TO_NEXT_UI":await v(u);break;default:console.warn(`Unhandled actionType: ${i}`);break}}catch(p){alert(JSON.stringify(p))}},[i,n,r,e]);return K.jsx(vm,{...d,disabled:h,onClick:()=>!h&&(s??m)()})},ca={row:"_row_1bqj4_1","row__gap-none":"_row__gap-none_1bqj4_5","row__gap-xxs":"_row__gap-xxs_1bqj4_8","row__gap-xs":"_row__gap-xs_1bqj4_11","row__gap-sm":"_row__gap-sm_1bqj4_14","row__gap-md":"_row__gap-md_1bqj4_17","row__gap-lg":"_row__gap-lg_1bqj4_20","row__gap-xl":"_row__gap-xl_1bqj4_23","row__gap-xxl":"_row__gap-xxl_1bqj4_26","row__gap-xxxl":"_row__gap-xxxl_1bqj4_29","row__justify-start":"_row__justify-start_1bqj4_32","row__justify-end":"_row__justify-end_1bqj4_35","row__justify-center":"_row__justify-center_1bqj4_38","row__justify-space-between":"_row__justify-space-between_1bqj4_41","row__justify-space-around":"_row__justify-space-around_1bqj4_44","row__justify-space-evenly":"_row__justify-space-evenly_1bqj4_47","row__align-start":"_row__align-start_1bqj4_50","row__align-end":"_row__align-end_1bqj4_53","row__align-center":"_row__align-center_1bqj4_56","row__align-stretch":"_row__align-stretch_1bqj4_59","row__align-baseline":"_row__align-baseline_1bqj4_62",row_column:"_row_column_1bqj4_65","row_column__gap-none":"_row_column__gap-none_1bqj4_72","row_column__gap-xxs":"_row_column__gap-xxs_1bqj4_75","row_column__gap-xs":"_row_column__gap-xs_1bqj4_78","row_column__gap-sm":"_row_column__gap-sm_1bqj4_81","row_column__gap-md":"_row_column__gap-md_1bqj4_84","row_column__gap-lg":"_row_column__gap-lg_1bqj4_87","row_column__gap-xl":"_row_column__gap-xl_1bqj4_90","row_column__gap-xxl":"_row_column__gap-xxl_1bqj4_93","row_column__gap-xxxl":"_row_column__gap-xxxl_1bqj4_96","row_column__justify-start":"_row_column__justify-start_1bqj4_99","row_column__justify-end":"_row_column__justify-end_1bqj4_102","row_column__justify-center":"_row_column__justify-center_1bqj4_105","row_column__justify-space-between":"_row_column__justify-space-between_1bqj4_108","row_column__justify-space-around":"_row_column__justify-space-around_1bqj4_111","row_column__justify-space-evenly":"_row_column__justify-space-evenly_1bqj4_114","row_column__align-start":"_row_column__align-start_1bqj4_117","row_column__align-end":"_row_column__align-end_1bqj4_120","row_column__align-center":"_row_column__align-center_1bqj4_123","row_column__align-stretch":"_row_column__align-stretch_1bqj4_126","row_column__align-baseline":"_row_column__align-baseline_1bqj4_129"},IM=t=>{const{userFlow:e,pageId:n,columnWidth:r,columns:i,gap:o="md",justifyContent:a="start",alignItems:s="stretch"}=t,l=Array.isArray(i)?i.map((c,u)=>{const f=`col_${u}`,d=`col_${u}`;if(Array.isArray(c))return{gap:"md",justifyContent:"start",alignItems:"start",items:c,hash:f,responseKey:d};const h=c;return{gap:(h==null?void 0:h.gap)??"md",justifyContent:(h==null?void 0:h.justifyContent)??"start",alignItems:(h==null?void 0:h.alignItems)??"start",items:(h==null?void 0:h.items)??[],hash:(h==null?void 0:h.hash)??f,responseKey:(h==null?void 0:h.responseKey)??d}}):[];return l.length===0?null:K.jsx("div",{className:Ph(ca.row,ca[`row__gap-${o}`],ca[`row__justify-${a}`],ca[`row__align-${s}`]),children:l==null?void 0:l.map((c,u)=>{const f=(r==null?void 0:r[u])||`${100/l.length}%`,d=ds(e,n,c.items);return!d||d.length===0?null:K.jsx("div",{className:Ph(ca.row_column,ca[`row_column__gap-${c.gap}`],ca[`row_column__justify-${c.justifyContent}`],ca[`row_column__align-${c.alignItems}`]),style:{width:f},children:d},c.hash||u)})})},rve=(t,e,n,r)=>{const i=Ji.query(t,e);return(i==null?void 0:i.map(o=>{var l,c;const a=(l=Ji.query(o,n))==null?void 0:l[0],s=r?(c=Ji.query(o,r))==null?void 0:c[0]:o;return{label:a,value:s}}))??[]},LM={selectNotFront:"_selectNotFront_1yw9q_1"},ive=({userFlow:t,pageId:e,responseKey:n,required:r,dataSource:i,actionType:o,dependencies:a,...s})=>{const l={...s},{getNextUI:c,fetchDataSource:u}=si(),[f,d]=S.useState((l==null?void 0:l.value)??""),{disabled:h}=No(t,a),m=(l==null?void 0:l.disabled)??h,g=S.useMemo(()=>r&&(l!=null&&l.label)?`${l==null?void 0:l.label} *`:(l==null?void 0:l.label)??"",[l==null?void 0:l.label,r]),p=S.useCallback(async _=>{var b;d(_);const w={...(b=St.getState()[t])==null?void 0:b.entries,[n]:_};if(oi(t,w),o&&o==="GO_TO_NEXT_UI")try{const y=await c(t,e,w,n);y!=null&&y.data&&Wi(t,y.data)}catch(y){console.error("[SelectPaginationNotFront] Failed to fetch next UI",y)}},[t,e,n,o,c]),v=async(_,w,{page:b})=>{const{jsonPathLabel:y,jsonPathOptions:k,jsonPathValue:C}=i,E=T3(i,b,_),A=await u(E,t,!1),N=A==null?void 0:A.data,M=N?rve(N,k,y,C):[],T=N==null?void 0:N.meta,I=T?Math.ceil(T.total/10)>b:!1;return{options:M,hasMore:I,additional:{page:_?1:b+1}}};return K.jsx(Zz,{...l,className:LM.selectNotFront,label:g,value:f,disabled:m,noOptionsMessage:()=>K.jsx(K.Fragment,{children:"Sin opciones"}),onChange:_=>!m&&p(_),loadOptions:v,additional:{page:1}})},ove=({userFlow:t,pageId:e,responseKey:n,dataSource:r,required:i,actionType:o,dependencies:a,...s})=>{const l={...s},{getNextUI:c}=si(),[u,f]=S.useState(l.value||""),{disabled:d}=No(t,a),h=(l==null?void 0:l.disabled)??d,m=S.useMemo(()=>i&&(l!=null&&l.label)?`${l==null?void 0:l.label} *`:(l==null?void 0:l.label)??"",[l==null?void 0:l.label,i]),g=S.useCallback(async p=>{var _;f(p);const v={...(_=St.getState()[t])==null?void 0:_.entries,[n]:p};if(oi(t,v),o&&o==="GO_TO_NEXT_UI")try{const w=await c(t,e,v,n);w!=null&&w.data&&Wi(t,w.data)}catch(w){console.error("[SelectSimpleNotFront] Failed to fetch next UI",w)}},[t,e,n,o,c]);return K.jsx(R9,{...l,className:LM.selectNotFront,label:m,value:u,disabled:h,onChange:p=>!h&&g(p)})},ave=t=>{const{dataSource:e}=t;return e?K.jsx(ive,{...t}):K.jsx(ove,{...t})},jM={spacing:"_spacing_19hqa_1",spacing__xxs:"_spacing__xxs_19hqa_1",spacing__xs:"_spacing__xs_19hqa_4",spacing__sm:"_spacing__sm_19hqa_7",spacing__md:"_spacing__md_19hqa_10",spacing__lg:"_spacing__lg_19hqa_13",spacing__xl:"_spacing__xl_19hqa_16",spacing__xxl:"_spacing__xxl_19hqa_19",spacing__xxxl:"_spacing__xxxl_19hqa_22"},sve=t=>{const{size:e}=t,n=Ph(jM.spacing,jM[`spacing__${e}`]);return K.jsx("div",{className:n})},lve=t=>{const{userFlow:e,pageId:n,responseKey:r,actionType:i,label:o,value:a,required:s,dependencies:l,...c}=t,u={...c},{getNextUI:f}=si(),[d,h]=S.useState(a||!1),{disabled:m}=No(e,l),g=(u==null?void 0:u.disabled)??m,p=S.useMemo(()=>s&&o?`${o} *`:o??"",[o,s]),v=S.useCallback(async()=>{var _;try{const w=!d;h(w);const b={...(_=St.getState()[e])==null?void 0:_.entries,[r]:w};switch(oi(e,b),i){case"GO_TO_NEXT_UI":const y=await f(e,n,b,r);y!=null&&y.data&&Wi(e,y==null?void 0:y.data);break;default:console.warn(`Unhandled actionType: ${i}`);break}}catch(w){console.error("Error in switch action:",w),alert(JSON.stringify(w))}},[e,n,r,i,d]);return K.jsx(lU,{...u,label:p,checked:d,disabled:g,onChange:()=>!g&&v()})},cve=({userFlow:t,pageId:e,tableResponseKey:n,component:r,rowData:i})=>{const{getNextUI:o,fetchAndGetNextUI:a}=si(),s=ds(t,e,[{...r}]),l=(s==null?void 0:s[0])||null;if(!l)return null;const{actionType:c,responseKey:u,dataSource:f}=l.props,d=S.useCallback(async()=>{var h;try{const m={...(h=St.getState()[t])==null?void 0:h.entries,[u]:{status:200},[n]:[{...i}]};oi(t,m);const g=async p=>{const v=await p(t,e,m,u,f);v!=null&&v.data&&Wi(t,v==null?void 0:v.data)};switch(c){case"GO_TO_NEXT_UI":await g(o);break;case"FETCH_AND_GO_TO_NEXT_UI":await g(a);break;default:console.warn(`Unhandled actionType: ${c}`);break}}catch(m){alert(JSON.stringify(m))}},[c,e,u,t]);return S.cloneElement(l,{onClick:d})},uve={tableSkeleton:"_tableSkeleton_1621g_1"},fve=()=>K.jsx("div",{className:uve.tableSkeleton,children:[...Array(10)].map((t,e)=>K.jsx(Q9,{maxWidth:"100%",height:42,radius:8},`tableSkeletonBase${e}`))}),dve=({userFlow:t,pageId:e,responseKey:n,component:r,dataSource:i,rightActions:o,...a})=>{var _,w;const{fetchDataSource:s}=si(),[l,c]=S.useState(!1),[u,f]=S.useState(1),[d,h]=S.useState(null),m=S.useMemo(()=>{if(o!=null&&o.length)return o.map((b,y)=>({renderContent:k=>K.jsx(cve,{userFlow:t,pageId:e,tableResponseKey:n,component:b,rowData:k},`tableRowAction${y}`)}))},[o,t,e]),g=async(b=1)=>{try{c(!0);const{jsonPathData:y,mapperData:k,jsonPathPagination:C}=i,E=T3(i,b),A=await s(E,t,!1);h(NC(A==null?void 0:A.data,y,k,C)),c(!1)}catch(y){alert(JSON.stringify(y)),c(!1)}},p=b=>{f(b),g(b)};S.useEffect(()=>{g()},[]);const v={...a,data:d==null?void 0:d.items,rightActions:m};return K.jsx(K.Fragment,{children:l?K.jsx(fve,{}):K.jsxs(K.Fragment,{children:[K.jsx(Hq,{...v}),(d==null?void 0:d.pagination)&&((_=d==null?void 0:d.pagination)==null?void 0:_.totalPages)>1&&K.jsx($9,{page:u,size:d==null?void 0:d.pagination.size,total:(w=d==null?void 0:d.pagination)==null?void 0:w.total,onChange:p})]})})},hve={textFieldNotFront:"_textFieldNotFront_cps4i_1"},pve=t=>{const{userFlow:e,pageId:n,component:r,hash:i,responseKey:o,required:a,dependencies:s,...l}=t,c={...l},[u,f]=S.useState((c==null?void 0:c.value)??""),{disabled:d}=No(e,s),h=(c==null?void 0:c.disabled)??d,m=S.useMemo(()=>a&&(c!=null&&c.label)?`${c==null?void 0:c.label} *`:(c==null?void 0:c.label)??"",[c==null?void 0:c.label,a]),g=p=>{var w;const v=(w=p==null?void 0:p.target)==null?void 0:w.value;f(v);const _={[o]:v};oi(e,_)};return S.useEffect(()=>{f((c==null?void 0:c.value)??"")},[c==null?void 0:c.value]),K.jsx(X9,{...c,className:hve.textFieldNotFront,allowClear:!1,label:m,value:u,disabled:h,onChange:p=>!h&&g(p)})},mve=({userFlow:t,pageId:e,responseKey:n,variant:r,content:i,actionType:o,redirectUrl:a})=>{const s=S.useCallback(async()=>{x4(t);try{switch(o){case"AUTOCLOSE_AND_REDIRECT":window.location.href=a;break;default:console.warn(`Unhandled actionType: ${o}`);break}}catch(l){console.error("Error in toast action:",l),alert(JSON.stringify(l))}},[o,e,n,t,a]);return S.useEffect(()=>{({info:et.info,error:et.error,success:et.success,warning:et.warning}[r]||et.info)(i,{autoClose:o?!1:4e3,containerId:t,onClose:s})},[s,t]),null},RM=(t,e,n,r)=>{const i=ds(t,e,(r==null?void 0:r.components)||null);switch(n){case"body":return K.jsx(Vq,{...r,inputs:i||[]},JSON.stringify(r==null?void 0:r.components));case"header":return K.jsx(G3e,{...r,inputs:i||[]},JSON.stringify(r==null?void 0:r.components));default:return null}},gve=(t,e,n)=>{var f,d,h;const[r,i]=S.useState(!1),o=St(m=>m),a=(f=o[t])==null?void 0:f.currentPageId,s=a?RM(t,a,"header",((d=o[t].pages[a].page)==null?void 0:d.header)||null):null,l=a?RM(t,a,"body",((h=o[t].pages[a].page)==null?void 0:h.body)||null):null,c=S.useMemo(()=>{var m;return K.jsxs(K.Fragment,{children:[((m=o[t])==null?void 0:m.isLoading)&&K.jsx($$,{}),s,l,a&&K.jsx(tve,{userFlow:t,pageId:a}),o[t]&&K.jsx(a4,{})]})},[s,l,a,t]),u=async()=>{var m;try{const g=await l8(e,t),p=(m=g==null?void 0:g.data)==null?void 0:m.content;(g==null?void 0:g.status)===200?Ym(t,e,p):i(!0)}catch(g){console.error("[not-page]: API call failed",g),i(!0)}};return S.useEffect(()=>{e!=null&&e.api&&!n&&t?u():!(e!=null&&e.api)&&n&&t||e!=null&&e.api&&n&&t?Ym(t,e,n):(!(e!=null&&e.api)&&!n||!t)&&(i(!0),console.error("[not-page]: API call failed","not api config","not userFlow"))},[]),r&&console.error("[not-page]: No render page"),c};Ut.Chart=TM,Ut.Row=IM,Ut.heading=f4,Ut.text=d4,Ut.usePage=gve,Object.defineProperty(Ut,Symbol.toStringTag,{value:"Module"})});
|
|
681
|
+
*/var hM;function Uge(){if(hM)return i2;hM=1;var t=S;function e(l,c){return l===c&&(l!==0||1/l===1/c)||l!==l&&c!==c}var n=typeof Object.is=="function"?Object.is:e,r=t.useSyncExternalStore,i=t.useRef,o=t.useEffect,a=t.useMemo,s=t.useDebugValue;return i2.useSyncExternalStoreWithSelector=function(l,c,u,f,d){var h=i(null);if(h.current===null){var m={hasValue:!1,value:null};h.current=m}else m=h.current;h=a(function(){function p(y){if(!v){if(v=!0,_=y,y=f(y),d!==void 0&&m.hasValue){var k=m.value;if(d(k,y))return w=k}return w=y}if(k=w,n(_,y))return k;var C=f(y);return d!==void 0&&d(k,C)?(_=y,k):(_=y,w=C)}var v=!1,_,w,b=u===void 0?null:u;return[function(){return p(c())},b===null?void 0:function(){return p(b())}]},[c,u,f,d]);var g=r(l,h[0],h[1]);return o(function(){m.hasValue=!0,m.value=g},[g]),s(g),g},i2}Uge();function qge(t){t()}function Kge(){let t=null,e=null;return{clear(){t=null,e=null},notify(){qge(()=>{let n=t;for(;n;)n.callback(),n=n.next})},get(){const n=[];let r=t;for(;r;)n.push(r),r=r.next;return n},subscribe(n){let r=!0;const i=e={callback:n,next:null,prev:e};return i.prev?i.prev.next=i:t=i,function(){!r||t===null||(r=!1,i.next?i.next.prev=i.prev:e=i.prev,i.prev?i.prev.next=i.next:t=i.next)}}}}var pM={notify(){},get:()=>[]};function Qge(t,e){let n,r=pM,i=0,o=!1;function a(g){u();const p=r.subscribe(g);let v=!1;return()=>{v||(v=!0,p(),f())}}function s(){r.notify()}function l(){m.onStateChange&&m.onStateChange()}function c(){return o}function u(){i++,n||(n=t.subscribe(l),r=Kge())}function f(){i--,n&&i===0&&(n(),n=void 0,r.clear(),r=pM)}function d(){o||(o=!0,u())}function h(){o&&(o=!1,f())}const m={addNestedSub:a,notifyNestedSubs:s,handleChangeWrapper:l,isSubscribed:c,trySubscribe:d,tryUnsubscribe:h,getListeners:()=>r};return m}var Yge=()=>typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Xge=Yge(),Zge=()=>typeof navigator<"u"&&navigator.product==="ReactNative",Gge=Zge(),Jge=()=>Xge||Gge?P.useLayoutEffect:P.useEffect,e3e=Jge(),o2=Symbol.for("react-redux-context"),a2=typeof globalThis<"u"?globalThis:{};function t3e(){if(!P.createContext)return{};const t=a2[o2]??(a2[o2]=new Map);let e=t.get(P.createContext);return e||(e=P.createContext(null),t.set(P.createContext,e)),e}var n3e=t3e();function r3e(t){const{children:e,context:n,serverState:r,store:i}=t,o=P.useMemo(()=>{const l=Qge(i);return{store:i,subscription:l,getServerState:r?()=>r:void 0}},[i,r]),a=P.useMemo(()=>i.getState(),[i]);e3e(()=>{const{subscription:l}=o;return l.onStateChange=l.notifyNestedSubs,l.trySubscribe(),a!==i.getState()&&l.notifyNestedSubs(),()=>{l.tryUnsubscribe(),l.onStateChange=void 0}},[o,a]);const s=n||n3e;return P.createElement(s.Provider,{value:o},e)}var i3e=r3e,o3e=(t,e)=>e,s2=H([o3e,je,zue,en,aA,mo,Nde,Ht],Bde),l2=t=>{var e=t.currentTarget.getBoundingClientRect(),n=e.width/t.currentTarget.offsetWidth,r=e.height/t.currentTarget.offsetHeight;return{chartX:Math.round((t.clientX-e.left)/n),chartY:Math.round((t.clientY-e.top)/r)}},mM=Pr("mouseClick"),gM=su();gM.startListening({actionCreator:mM,effect:(t,e)=>{var n=t.payload,r=s2(e.getState(),l2(n));(r==null?void 0:r.activeIndex)!=null&&e.dispatch(zfe({activeIndex:r.activeIndex,activeDataKey:void 0,activeCoordinate:r.activeCoordinate}))}});var c2=Pr("mouseMove"),vM=su();vM.startListening({actionCreator:c2,effect:(t,e)=>{var n=t.payload,r=e.getState(),i=u6(r,r.tooltip.settings.shared),o=s2(r,l2(n));i==="axis"&&((o==null?void 0:o.activeIndex)!=null?e.dispatch(XE({activeIndex:o.activeIndex,activeDataKey:void 0,activeCoordinate:o.activeCoordinate})):e.dispatch(YE()))}});function a3e(t,e){return e instanceof HTMLElement?"HTMLElement <".concat(e.tagName,' class="').concat(e.className,'">'):e===window?"global.window":e}var yM={accessibilityLayer:!0,barCategoryGap:"10%",barGap:4,barSize:void 0,className:void 0,maxBarSize:void 0,stackOffset:"none",syncId:void 0,syncMethod:"index"},bM=Er({name:"rootProps",initialState:yM,reducers:{updateOptions:(t,e)=>{var n;t.accessibilityLayer=e.payload.accessibilityLayer,t.barCategoryGap=e.payload.barCategoryGap,t.barGap=(n=e.payload.barGap)!==null&&n!==void 0?n:yM.barGap,t.barSize=e.payload.barSize,t.maxBarSize=e.payload.maxBarSize,t.stackOffset=e.payload.stackOffset,t.syncId=e.payload.syncId,t.syncMethod=e.payload.syncMethod,t.className=e.payload.className}}}),s3e=bM.reducer,{updateOptions:l3e}=bM.actions,wM=Er({name:"polarOptions",initialState:null,reducers:{updatePolarOptions:(t,e)=>e.payload}}),{updatePolarOptions:c3e}=wM.actions,u3e=wM.reducer,_M=Pr("keyDown"),xM=Pr("focus"),u2=su();u2.startListening({actionCreator:_M,effect:(t,e)=>{var n=e.getState(),r=n.rootProps.accessibilityLayer!==!1;if(r){var{keyboardInteraction:i}=n.tooltip,o=t.payload;if(!(o!=="ArrowRight"&&o!=="ArrowLeft"&&o!=="Enter")){var a=Number(h6(i,ls(n))),s=mo(n);if(o==="Enter"){var l=Jp(n,"axis","hover",String(i.index));e.dispatch(d6({active:!i.active,activeIndex:i.index,activeDataKey:i.dataKey,activeCoordinate:l}));return}var c=Lfe(n),u=c==="left-to-right"?1:-1,f=o==="ArrowRight"?1:-1,d=a+f*u;if(!(s==null||d>=s.length||d<0)){var h=Jp(n,"axis","hover",String(d));e.dispatch(d6({active:!0,activeIndex:d.toString(),activeDataKey:void 0,activeCoordinate:h}))}}}}}),u2.startListening({actionCreator:xM,effect:(t,e)=>{var n=e.getState(),r=n.rootProps.accessibilityLayer!==!1;if(r){var{keyboardInteraction:i}=n.tooltip;if(!i.active&&i.index==null){var o="0",a=Jp(n,"axis","hover",String(o));e.dispatch(d6({activeDataKey:void 0,active:!0,activeIndex:o,activeCoordinate:a}))}}}});var Ir=Pr("externalEvent"),CM=su();CM.startListening({actionCreator:Ir,effect:(t,e)=>{if(t.payload.handler!=null){var n=e.getState(),r={activeCoordinate:kde(n),activeDataKey:uA(n),activeIndex:aa(n),activeLabel:cA(n),activeTooltipIndex:aa(n),isTooltipActive:Sde(n)};t.payload.handler(r,t.payload.reactEvent)}}});var f3e=H([Ol],t=>t.tooltipItemPayloads),d3e=H([f3e,Iu,(t,e,n)=>e,(t,e,n)=>n],(t,e,n,r)=>{var i=t.find(s=>s.settings.dataKey===r);if(i!=null){var{positions:o}=i;if(o!=null){var a=e(o,n);return a}}}),kM=Pr("touchMove"),SM=su();SM.startListening({actionCreator:kM,effect:(t,e)=>{var n=t.payload,r=e.getState(),i=u6(r,r.tooltip.settings.shared);if(i==="axis"){var o=s2(r,l2({clientX:n.touches[0].clientX,clientY:n.touches[0].clientY,currentTarget:n.currentTarget}));(o==null?void 0:o.activeIndex)!=null&&e.dispatch(XE({activeIndex:o.activeIndex,activeDataKey:void 0,activeCoordinate:o.activeCoordinate}))}else if(i==="item"){var a,s=n.touches[0],l=document.elementFromPoint(s.clientX,s.clientY);if(!l||!l.getAttribute)return;var c=l.getAttribute(VS),u=(a=l.getAttribute(WS))!==null&&a!==void 0?a:void 0,f=d3e(e.getState(),c,u);e.dispatch(QE({activeDataKey:u,activeIndex:c,activeCoordinate:f}))}}});var h3e=Xk({brush:Rme,cartesianAxis:Oge,chartData:Jde,graphicalItems:Ape,layout:Woe,legend:Aae,options:Qde,polarAxis:hpe,polarOptions:u3e,referenceElements:Ume,rootProps:s3e,tooltip:Ufe}),p3e=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"Chart";return poe({reducer:h3e,preloadedState:e,middleware:r=>r({serializableCheck:!1}).concat([gM.middleware,vM.middleware,u2.middleware,CM.middleware,SM.middleware]),devTools:{serialize:{replacer:a3e},name:"recharts-".concat(n)}})};function OM(t){var{preloadedState:e,children:n,reduxStoreName:r}=t,i=_n(),o=S.useRef(null);if(i)return n;o.current==null&&(o.current=p3e(e,r));var a=mv;return P.createElement(i3e,{context:a,store:o.current},n)}function PM(t){var{layout:e,width:n,height:r,margin:i}=t,o=ht(),a=_n();return S.useEffect(()=>{a||(o(Foe(e)),o(Hoe({width:n,height:r})),o($oe(i)))},[o,a,e,n,r,i]),null}function EM(t){var e=ht();return S.useEffect(()=>{e(l3e(t))},[e,t]),null}var m3e=["children"];function g3e(t,e){if(t==null)return{};var n,r,i=v3e(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(r=0;r<o.length;r++)n=o[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function v3e(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}function w1(){return w1=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},w1.apply(null,arguments)}var y3e={width:"100%",height:"100%"},b3e=S.forwardRef((t,e)=>{var n=Bv(),r=$v(),i=tO();if(!dl(n)||!dl(r))return null;var{children:o,otherAttributes:a,title:s,desc:l}=t,c,u;return typeof a.tabIndex=="number"?c=a.tabIndex:c=i?0:void 0,typeof a.role=="string"?u=a.role:u=i?"application":void 0,P.createElement(H3,w1({},a,{title:s,desc:l,role:u,tabIndex:c,width:n,height:r,style:y3e,ref:e}),o)}),w3e=t=>{var{children:e}=t,n=de(pp);if(!n)return null;var{width:r,height:i,y:o,x:a}=n;return P.createElement(H3,{width:r,height:i,x:a,y:o},e)},AM=S.forwardRef((t,e)=>{var{children:n}=t,r=g3e(t,m3e),i=_n();return i?P.createElement(w3e,null,n):P.createElement(b3e,w1({ref:e},r),n)});function _3e(){var t=ht(),[e,n]=S.useState(null),r=de(vae);return S.useEffect(()=>{if(e!=null){var i=e.getBoundingClientRect(),o=i.width/e.offsetWidth;fn(o)&&o!==r&&t(Voe(o))}},[e,t,r]),n}function DM(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function x3e(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?DM(Object(n),!0).forEach(function(r){C3e(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):DM(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function C3e(t,e,n){return(e=k3e(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function k3e(t){var e=S3e(t,"string");return typeof e=="symbol"?e:e+""}function S3e(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var O3e=S.forwardRef((t,e)=>{var{children:n,className:r,height:i,onClick:o,onContextMenu:a,onDoubleClick:s,onMouseDown:l,onMouseEnter:c,onMouseLeave:u,onMouseMove:f,onMouseUp:d,onTouchEnd:h,onTouchMove:m,onTouchStart:g,style:p,width:v}=t,_=ht(),[w,b]=S.useState(null),[y,k]=S.useState(null);nhe();var C=_3e(),E=S.useCallback(oe=>{C(oe),typeof e=="function"&&e(oe),b(oe),k(oe)},[C,e,b,k]),A=S.useCallback(oe=>{_(mM(oe)),_(Ir({handler:o,reactEvent:oe}))},[_,o]),N=S.useCallback(oe=>{_(c2(oe)),_(Ir({handler:c,reactEvent:oe}))},[_,c]),M=S.useCallback(oe=>{_(YE()),_(Ir({handler:u,reactEvent:oe}))},[_,u]),T=S.useCallback(oe=>{_(c2(oe)),_(Ir({handler:f,reactEvent:oe}))},[_,f]),I=S.useCallback(()=>{_(xM())},[_]),L=S.useCallback(oe=>{_(_M(oe.key))},[_]),F=S.useCallback(oe=>{_(Ir({handler:a,reactEvent:oe}))},[_,a]),V=S.useCallback(oe=>{_(Ir({handler:s,reactEvent:oe}))},[_,s]),W=S.useCallback(oe=>{_(Ir({handler:l,reactEvent:oe}))},[_,l]),X=S.useCallback(oe=>{_(Ir({handler:d,reactEvent:oe}))},[_,d]),J=S.useCallback(oe=>{_(Ir({handler:g,reactEvent:oe}))},[_,g]),pe=S.useCallback(oe=>{_(kM(oe)),_(Ir({handler:m,reactEvent:oe}))},[_,m]),he=S.useCallback(oe=>{_(Ir({handler:h,reactEvent:oe}))},[_,h]);return P.createElement(wA.Provider,{value:w},P.createElement(zC.Provider,{value:y},P.createElement("div",{className:Le("recharts-wrapper",r),style:x3e({position:"relative",cursor:"default",width:v,height:i},p),onClick:A,onContextMenu:F,onDoubleClick:V,onFocus:I,onKeyDown:L,onMouseDown:W,onMouseEnter:N,onMouseLeave:M,onMouseMove:T,onMouseUp:X,onTouchEnd:he,onTouchMove:pe,onTouchStart:J,ref:E},n)))}),P3e=["children","className","width","height","style","compact","title","desc"];function E3e(t,e){if(t==null)return{};var n,r,i=A3e(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(r=0;r<o.length;r++)n=o[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function A3e(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}var MM=S.forwardRef((t,e)=>{var{children:n,className:r,width:i,height:o,style:a,compact:s,title:l,desc:c}=t,u=E3e(t,P3e),f=Oe(u,!1);return s?P.createElement(AM,{otherAttributes:f,title:l,desc:c},n):P.createElement(O3e,{className:r,style:a,width:i,height:o,onClick:t.onClick,onMouseLeave:t.onMouseLeave,onMouseEnter:t.onMouseEnter,onMouseMove:t.onMouseMove,onMouseDown:t.onMouseDown,onMouseUp:t.onMouseUp,onContextMenu:t.onContextMenu,onDoubleClick:t.onDoubleClick,onTouchStart:t.onTouchStart,onTouchMove:t.onTouchMove,onTouchEnd:t.onTouchEnd},P.createElement(AM,{otherAttributes:f,title:l,desc:c,ref:e},P.createElement(Kme,null,n)))}),D3e=["width","height"];function f2(){return f2=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},f2.apply(null,arguments)}function M3e(t,e){if(t==null)return{};var n,r,i=T3e(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(r=0;r<o.length;r++)n=o[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function T3e(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}var N3e={top:5,right:5,bottom:5,left:5},I3e={accessibilityLayer:!0,layout:"horizontal",stackOffset:"none",barCategoryGap:"10%",barGap:4,margin:N3e,reverseStackOrder:!1,syncMethod:"index"},d2=S.forwardRef(function(e,n){var r,i=ar(e.categoricalChartProps,I3e),{width:o,height:a}=i,s=M3e(i,D3e);if(!dl(o)||!dl(a))return null;var{chartName:l,defaultTooltipEventType:c,validateTooltipEventTypes:u,tooltipPayloadSearcher:f,categoricalChartProps:d}=e,h={chartName:l,defaultTooltipEventType:c,validateTooltipEventTypes:u,tooltipPayloadSearcher:f,eventEmitter:void 0};return P.createElement(OM,{preloadedState:{options:h},reduxStoreName:(r=d.id)!==null&&r!==void 0?r:l},P.createElement(BD,{chartData:d.data}),P.createElement(PM,{width:o,height:a,layout:i.layout,margin:i.margin}),P.createElement(EM,{accessibilityLayer:i.accessibilityLayer,barCategoryGap:i.barCategoryGap,maxBarSize:i.maxBarSize,stackOffset:i.stackOffset,barGap:i.barGap,barSize:i.barSize,syncId:i.syncId,syncMethod:i.syncMethod,className:i.className}),P.createElement(MM,f2({},s,{width:o,height:a,ref:n})))}),L3e=["axis"],j3e=S.forwardRef((t,e)=>P.createElement(d2,{chartName:"LineChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:L3e,tooltipPayloadSearcher:t1,categoricalChartProps:t,ref:e})),R3e=["axis","item"],B3e=S.forwardRef((t,e)=>P.createElement(d2,{chartName:"BarChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:R3e,tooltipPayloadSearcher:t1,categoricalChartProps:t,ref:e}));function $3e(t){var e=ht();return S.useEffect(()=>{e(c3e(t))},[e,t]),null}var F3e=["width","height","layout"];function h2(){return h2=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},h2.apply(null,arguments)}function H3e(t,e){if(t==null)return{};var n,r,i=V3e(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(r=0;r<o.length;r++)n=o[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function V3e(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}var W3e={top:5,right:5,bottom:5,left:5},z3e={accessibilityLayer:!0,stackOffset:"none",barCategoryGap:"10%",barGap:4,margin:W3e,reverseStackOrder:!1,syncMethod:"index",layout:"radial"},U3e=S.forwardRef(function(e,n){var r,i=ar(e.categoricalChartProps,z3e),{width:o,height:a,layout:s}=i,l=H3e(i,F3e);if(!dl(o)||!dl(a))return null;var{chartName:c,defaultTooltipEventType:u,validateTooltipEventTypes:f,tooltipPayloadSearcher:d}=e,h={chartName:c,defaultTooltipEventType:u,validateTooltipEventTypes:f,tooltipPayloadSearcher:d,eventEmitter:void 0};return P.createElement(OM,{preloadedState:{options:h},reduxStoreName:(r=i.id)!==null&&r!==void 0?r:c},P.createElement(BD,{chartData:i.data}),P.createElement(PM,{width:o,height:a,layout:s,margin:i.margin}),P.createElement(EM,{accessibilityLayer:i.accessibilityLayer,barCategoryGap:i.barCategoryGap,maxBarSize:i.maxBarSize,stackOffset:i.stackOffset,barGap:i.barGap,barSize:i.barSize,syncId:i.syncId,syncMethod:i.syncMethod,className:i.className}),P.createElement($3e,{cx:i.cx,cy:i.cy,startAngle:i.startAngle,endAngle:i.endAngle,innerRadius:i.innerRadius,outerRadius:i.outerRadius}),P.createElement(MM,h2({width:o,height:a},l,{ref:n})))}),q3e=["item"],K3e={layout:"centric",startAngle:0,endAngle:360,cx:"50%",cy:"50%",innerRadius:0,outerRadius:"80%"},Q3e=S.forwardRef((t,e)=>{var n=ar(t,K3e);return P.createElement(U3e,{chartName:"PieChart",defaultTooltipEventType:"item",validateTooltipEventTypes:q3e,tooltipPayloadSearcher:t1,categoricalChartProps:n,ref:e})}),Y3e=["axis"],X3e=S.forwardRef((t,e)=>P.createElement(d2,{chartName:"AreaChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:Y3e,tooltipPayloadSearcher:t1,categoricalChartProps:t,ref:e}));const _1=()=>K.jsx(mp,{wrapperStyle:{color:yo.labelColor,fontSize:yo.fontSize}}),x1=()=>K.jsx(uhe,{contentStyle:{backgroundColor:yo.tooltipBg,borderRadius:yo.tooltipBorderRadius,color:yo.tooltipColor}}),p2=({dataKey:t})=>K.jsx(t2,{dataKey:t,tick:{fill:yo.labelColor,fontSize:yo.fontSize}}),m2=()=>K.jsx(r2,{tick:{fill:yo.labelColor,fontSize:yo.fontSize}}),Z3e={area:t=>{const{data:e,xKey:n,yKeys:r}=t;return K.jsx(n1,{width:"100%",height:400,children:K.jsxs(X3e,{data:e,children:[K.jsx(g1,{strokeDasharray:"3 3"}),K.jsx(p2,{dataKey:n}),K.jsx(m2,{}),K.jsx(x1,{}),K.jsx(_1,{}),r.map((i,o)=>K.jsx(J6,{type:"monotone",dataKey:i,stroke:Ei[o%Ei.length],fill:Ei[o%Ei.length]},i))]})})},bar:t=>{const{data:e,xKey:n,yKeys:r}=t;return K.jsx(n1,{width:"100%",height:400,children:K.jsxs(B3e,{data:e,children:[K.jsx(g1,{strokeDasharray:"3 3"}),K.jsx(p2,{dataKey:n}),K.jsx(m2,{}),K.jsx(x1,{}),K.jsx(_1,{}),r.map((i,o)=>K.jsx(z6,{dataKey:i,fill:Ei[o%Ei.length]},i))]})})},line:t=>{const{data:e,xKey:n,yKeys:r}=t;return K.jsx(n1,{width:"100%",height:400,children:K.jsxs(j3e,{data:e,children:[K.jsx(g1,{strokeDasharray:"3 3"}),K.jsx(p2,{dataKey:n}),K.jsx(m2,{}),K.jsx(x1,{}),K.jsx(_1,{}),r.map((i,o)=>K.jsx(Z6,{type:"monotone",dataKey:i,stroke:Ei[o%Ei.length],strokeWidth:2,dot:!1},i))]})})},pie:t=>{const{data:e,xKey:n,yKeys:r}=t;return K.jsx(n1,{width:"100%",height:400,children:K.jsxs(Q3e,{children:[K.jsx(x1,{}),K.jsx(_1,{}),K.jsx(B6,{data:e,dataKey:r[0],nameKey:n,label:!0,outerRadius:120,children:e.map((i,o)=>K.jsx(Ru,{fill:Ei[o%Ei.length]},`cell-${o}`))})]})})}},Ei=["var(--color-primitive-palette-1-50)","var(--color-primitive-palette-2-50)","var(--color-primitive-palette-3-50)","var(--color-primitive-palette-4-50)","var(--color-primitive-palette-5-50)","var(--color-primitive-palette-6-50)","var(--color-primitive-palette-7-50)","var(--color-primitive-palette-8-50)","var(--color-primitive-palette-9-50)","var(--color-primitive-palette-10-50)","var(--color-primitive-palette-11-50)","var(--color-primitive-palette-12-50)","var(--color-primitive-palette-13-50)","var(--color-primitive-palette-14-50)","var(--color-primitive-palette-15-50)","var(--color-primitive-palette-16-50)","var(--color-primitive-palette-17-50)"],yo={fontFamily:"Roboto, sans-serif",fontSize:12,labelColor:"var(--color-neutral-90)",tooltipBg:"#fff",tooltipColor:"#000",tooltipBorderRadius:"4px"},TM=t=>{const{component:e,userFlow:n,hash:r,responseKey:i,dataSource:o,...a}=t,s=Z3e[a.type];if(!s)return K.jsx("div",{children:"Not supported chart type"});const{fetchDataSource:l}=si(),[c,u]=S.useState(!1),[f,d]=S.useState([]),h=async()=>{var g,p;try{u(!0);const{jsonPathData:v,mapperData:_}=o,w=T3(o,1),b=await l(w,n,!1),y=v?(g=NC(b==null?void 0:b.data,v,_))==null?void 0:g.items:(p=b==null?void 0:b.data)==null?void 0:p.data;d(y),u(!1)}catch(v){alert(JSON.stringify(v)),u(!1)}};S.useEffect(()=>{o?h():d(a.data)},[]);const m={...a,data:f};return c?K.jsx(Q9,{height:400}):K.jsx(K.Fragment,{children:s(m)})},NM={header:"_header_g1eri_1",header_content:"_header_content_g1eri_5"},G3e=({components:t=[]})=>K.jsx("section",{className:Ph(NM.header,"avocado-dark-theme"),children:K.jsx("div",{className:NM.header_content,children:t.map((e,n)=>K.jsx(S.Fragment,{children:e},n))})}),ds=(t,e,n)=>{var o;const r={breadcrumbs:a=>K.jsx(OQ,{...a,userFlow:t,pageId:e}),button:a=>K.jsx(PQ,{...a,userFlow:t,pageId:e}),cardNotification:a=>K.jsx(AQ,{...a}),chart:a=>K.jsx(TM,{...a,userFlow:t}),checkbox:a=>K.jsx(DQ,{...a,userFlow:t,pageId:e}),code:a=>K.jsx(cre,{...a,userFlow:t,pageId:e}),divider:a=>K.jsx(dre,{...a}),heading:a=>f4(a),roundButton:a=>K.jsx(nve,{...a,userFlow:t,pageId:e}),row:a=>K.jsx(IM,{...a,userFlow:t,pageId:e}),select:a=>K.jsx(ave,{...a,userFlow:t,pageId:e}),switch:a=>K.jsx(lve,{...a,userFlow:t,pageId:e}),spacing:a=>K.jsx(sve,{...a,userFlow:t,pageId:e}),table:a=>K.jsx(dve,{...a,userFlow:t,pageId:e}),text:a=>d4(a),textField:a=>K.jsx(pve,{...a,userFlow:t,pageId:e}),toast:a=>K.jsx(mve,{...a,userFlow:t,pageId:e}),modal:a=>K.jsx(eve,{...a,userFlow:t,pageId:e})};return(o=n==null?void 0:n.filter(Boolean))==null?void 0:o.map(a=>{const s=r[a.component];return s?s({...a,userFlow:t,pageId:e}):null})},J3e={modalContent:"_modalContent_1piho_1"},eve=({userFlow:t,pageId:e,responseKey:n,header:r,body:i,footer:o,headerStatusColor:a,...s})=>{const l=St(g=>{var p;return(p=g[t])==null?void 0:p.isModalOpen}),c={...s},u=(c==null?void 0:c.headerStatusColor)??a,f=S.useCallback(()=>{x4(t),C4(t,!1)},[t,n]),d=Array.isArray(r)?ds(t,e,r):r,h=ds(t,e,i),m=ds(t,e,o);return K.jsx(_F,{...c,headerStatusColor:u,header:typeof d=="string"?d:K.jsx(K.Fragment,{children:d.map((g,p)=>K.jsx(S.Fragment,{children:g},`header-${p}`))}),children:K.jsx("section",{className:J3e.modalContent,children:h.map((g,p)=>K.jsx(S.Fragment,{children:g},`body-${p}`))}),actions:K.jsx(K.Fragment,{children:m.map((g,p)=>K.jsx(S.Fragment,{children:g},`footer-${p}`))}),open:l,onClose:f})},tve=({userFlow:t,pageId:e})=>{var o,a;const n=nK(t);if(!n)return null;const r=[...(n==null?void 0:n.components)||[],...((o=n==null?void 0:n.header)==null?void 0:o.components)||[],...((a=n==null?void 0:n.body)==null?void 0:a.components)||[]],i=ds(t,e,r);return K.jsx(K.Fragment,{children:i==null?void 0:i.map((s,l)=>{const c=`overlay-${l}-${Date.now()}`;return K.jsx(S.Fragment,{children:s},c)})})},nve=t=>{const{userFlow:e,pageId:n,responseKey:r,actionType:i,dataSource:o,dependencies:a,onClick:s,...l}=t,{getNextUI:c,fetchAndGetNextUI:u}=si(),{disabled:f}=No(e,a),d={...l},h=(d==null?void 0:d.disabled)??f,m=S.useCallback(async()=>{var g;try{const p={...(g=St.getState()[e])==null?void 0:g.entries,[r]:{status:200}};oi(e,p);const v=async _=>{const w=await _(e,n,p,r,o);w!=null&&w.data&&Wi(e,w==null?void 0:w.data)};switch(i){case"GO_TO_NEXT_UI":await v(c);break;case"FETCH_AND_GO_TO_NEXT_UI":await v(u);break;default:console.warn(`Unhandled actionType: ${i}`);break}}catch(p){alert(JSON.stringify(p))}},[i,n,r,e]);return K.jsx(vm,{...d,disabled:h,onClick:()=>!h&&(s??m)()})},ca={row:"_row_1bqj4_1","row__gap-none":"_row__gap-none_1bqj4_5","row__gap-xxs":"_row__gap-xxs_1bqj4_8","row__gap-xs":"_row__gap-xs_1bqj4_11","row__gap-sm":"_row__gap-sm_1bqj4_14","row__gap-md":"_row__gap-md_1bqj4_17","row__gap-lg":"_row__gap-lg_1bqj4_20","row__gap-xl":"_row__gap-xl_1bqj4_23","row__gap-xxl":"_row__gap-xxl_1bqj4_26","row__gap-xxxl":"_row__gap-xxxl_1bqj4_29","row__justify-start":"_row__justify-start_1bqj4_32","row__justify-end":"_row__justify-end_1bqj4_35","row__justify-center":"_row__justify-center_1bqj4_38","row__justify-space-between":"_row__justify-space-between_1bqj4_41","row__justify-space-around":"_row__justify-space-around_1bqj4_44","row__justify-space-evenly":"_row__justify-space-evenly_1bqj4_47","row__align-start":"_row__align-start_1bqj4_50","row__align-end":"_row__align-end_1bqj4_53","row__align-center":"_row__align-center_1bqj4_56","row__align-stretch":"_row__align-stretch_1bqj4_59","row__align-baseline":"_row__align-baseline_1bqj4_62",row_column:"_row_column_1bqj4_65","row_column__gap-none":"_row_column__gap-none_1bqj4_72","row_column__gap-xxs":"_row_column__gap-xxs_1bqj4_75","row_column__gap-xs":"_row_column__gap-xs_1bqj4_78","row_column__gap-sm":"_row_column__gap-sm_1bqj4_81","row_column__gap-md":"_row_column__gap-md_1bqj4_84","row_column__gap-lg":"_row_column__gap-lg_1bqj4_87","row_column__gap-xl":"_row_column__gap-xl_1bqj4_90","row_column__gap-xxl":"_row_column__gap-xxl_1bqj4_93","row_column__gap-xxxl":"_row_column__gap-xxxl_1bqj4_96","row_column__justify-start":"_row_column__justify-start_1bqj4_99","row_column__justify-end":"_row_column__justify-end_1bqj4_102","row_column__justify-center":"_row_column__justify-center_1bqj4_105","row_column__justify-space-between":"_row_column__justify-space-between_1bqj4_108","row_column__justify-space-around":"_row_column__justify-space-around_1bqj4_111","row_column__justify-space-evenly":"_row_column__justify-space-evenly_1bqj4_114","row_column__align-start":"_row_column__align-start_1bqj4_117","row_column__align-end":"_row_column__align-end_1bqj4_120","row_column__align-center":"_row_column__align-center_1bqj4_123","row_column__align-stretch":"_row_column__align-stretch_1bqj4_126","row_column__align-baseline":"_row_column__align-baseline_1bqj4_129"},IM=t=>{const{userFlow:e,pageId:n,columnWidth:r,columns:i,gap:o="md",justifyContent:a="start",alignItems:s="stretch"}=t,l=Array.isArray(i)?i.map((c,u)=>{const f=`col_${u}`,d=`col_${u}`;if(Array.isArray(c))return{gap:"md",justifyContent:"start",alignItems:"start",items:c,hash:f,responseKey:d};const h=c;return{gap:(h==null?void 0:h.gap)??"md",justifyContent:(h==null?void 0:h.justifyContent)??"start",alignItems:(h==null?void 0:h.alignItems)??"start",items:(h==null?void 0:h.items)??[],hash:(h==null?void 0:h.hash)??f,responseKey:(h==null?void 0:h.responseKey)??d}}):[];return l.length===0?null:K.jsx("div",{className:Ph(ca.row,ca[`row__gap-${o}`],ca[`row__justify-${a}`],ca[`row__align-${s}`]),children:l==null?void 0:l.map((c,u)=>{const f=(r==null?void 0:r[u])||`${100/l.length}%`,d=ds(e,n,c.items);return!d||d.length===0?null:K.jsx("div",{className:Ph(ca.row_column,ca[`row_column__gap-${c.gap}`],ca[`row_column__justify-${c.justifyContent}`],ca[`row_column__align-${c.alignItems}`]),style:{width:f},children:d},c.hash||u)})})},rve=(t,e,n,r)=>{const i=Ji.query(t,e);return(i==null?void 0:i.map(o=>{var l,c;const a=(l=Ji.query(o,n))==null?void 0:l[0],s=r?(c=Ji.query(o,r))==null?void 0:c[0]:o;return{label:a,value:s}}))??[]},LM={selectNotFront:"_selectNotFront_1yw9q_1"},ive=({userFlow:t,pageId:e,responseKey:n,required:r,dataSource:i,actionType:o,dependencies:a,...s})=>{const l={...s},{getNextUI:c,fetchDataSource:u}=si(),[f,d]=S.useState((l==null?void 0:l.value)??""),{disabled:h}=No(t,a),m=(l==null?void 0:l.disabled)??h,g=S.useMemo(()=>r&&(l!=null&&l.label)?`${l==null?void 0:l.label} *`:(l==null?void 0:l.label)??"",[l==null?void 0:l.label,r]),p=S.useCallback(async _=>{var b;d(_);const w={...(b=St.getState()[t])==null?void 0:b.entries,[n]:_};if(oi(t,w),o&&o==="GO_TO_NEXT_UI")try{const y=await c(t,e,w,n);y!=null&&y.data&&Wi(t,y.data)}catch(y){console.error("[SelectPaginationNotFront] Failed to fetch next UI",y)}},[t,e,n,o,c]),v=async(_,w,{page:b})=>{const{jsonPathLabel:y,jsonPathOptions:k,jsonPathValue:C}=i,E=T3(i,b,_),A=await u(E,t,!1),N=A==null?void 0:A.data,M=N?rve(N,k,y,C):[],T=N==null?void 0:N.meta,I=T?Math.ceil(T.total/10)>b:!1;return{options:M,hasMore:I,additional:{page:_?1:b+1}}};return K.jsx(Zz,{...l,className:LM.selectNotFront,label:g,value:f,disabled:m,noOptionsMessage:()=>K.jsx(K.Fragment,{children:"Sin opciones"}),onChange:_=>!m&&p(_),loadOptions:v,additional:{page:1}})},ove=({userFlow:t,pageId:e,responseKey:n,dataSource:r,required:i,actionType:o,dependencies:a,...s})=>{const l={...s},{getNextUI:c}=si(),[u,f]=S.useState(l.value||""),{disabled:d}=No(t,a),h=(l==null?void 0:l.disabled)??d,m=S.useMemo(()=>i&&(l!=null&&l.label)?`${l==null?void 0:l.label} *`:(l==null?void 0:l.label)??"",[l==null?void 0:l.label,i]),g=S.useCallback(async p=>{var _;f(p);const v={...(_=St.getState()[t])==null?void 0:_.entries,[n]:p};if(oi(t,v),o&&o==="GO_TO_NEXT_UI")try{const w=await c(t,e,v,n);w!=null&&w.data&&Wi(t,w.data)}catch(w){console.error("[SelectSimpleNotFront] Failed to fetch next UI",w)}},[t,e,n,o,c]);return K.jsx(R9,{...l,className:LM.selectNotFront,label:m,value:u,disabled:h,onChange:p=>!h&&g(p)})},ave=t=>{const{dataSource:e}=t;return e?K.jsx(ive,{...t}):K.jsx(ove,{...t})},jM={spacing:"_spacing_19hqa_1",spacing__xxs:"_spacing__xxs_19hqa_1",spacing__xs:"_spacing__xs_19hqa_4",spacing__sm:"_spacing__sm_19hqa_7",spacing__md:"_spacing__md_19hqa_10",spacing__lg:"_spacing__lg_19hqa_13",spacing__xl:"_spacing__xl_19hqa_16",spacing__xxl:"_spacing__xxl_19hqa_19",spacing__xxxl:"_spacing__xxxl_19hqa_22"},sve=t=>{const{size:e}=t,n=Ph(jM.spacing,jM[`spacing__${e}`]);return K.jsx("div",{className:n})},lve=t=>{const{userFlow:e,pageId:n,responseKey:r,actionType:i,label:o,value:a,required:s,dependencies:l,...c}=t,u={...c},{getNextUI:f}=si(),[d,h]=S.useState(a||!1),{disabled:m}=No(e,l),g=(u==null?void 0:u.disabled)??m,p=S.useMemo(()=>s&&o?`${o} *`:o??"",[o,s]),v=S.useCallback(async()=>{var _;try{const w=!d;h(w);const b={...(_=St.getState()[e])==null?void 0:_.entries,[r]:w};switch(oi(e,b),i){case"GO_TO_NEXT_UI":const y=await f(e,n,b,r);y!=null&&y.data&&Wi(e,y==null?void 0:y.data);break;default:console.warn(`Unhandled actionType: ${i}`);break}}catch(w){console.error("Error in switch action:",w),alert(JSON.stringify(w))}},[e,n,r,i,d]);return K.jsx(lU,{...u,label:p,checked:d,disabled:g,onChange:()=>!g&&v()})},cve=({userFlow:t,pageId:e,tableResponseKey:n,component:r,rowData:i})=>{const{getNextUI:o,fetchAndGetNextUI:a}=si(),s=ds(t,e,[{...r}]),l=(s==null?void 0:s[0])||null;if(!l)return null;const{actionType:c,responseKey:u,dataSource:f}=l.props,d=S.useCallback(async()=>{var h;try{const m={...(h=St.getState()[t])==null?void 0:h.entries,[u]:{status:200},[n]:[{...i}]};oi(t,m);const g=async p=>{const v=await p(t,e,m,u,f);v!=null&&v.data&&Wi(t,v==null?void 0:v.data)};switch(c){case"GO_TO_NEXT_UI":await g(o);break;case"FETCH_AND_GO_TO_NEXT_UI":await g(a);break;default:console.warn(`Unhandled actionType: ${c}`);break}}catch(m){alert(JSON.stringify(m))}},[c,e,u,t]);return S.cloneElement(l,{onClick:d})},uve={tableSkeleton:"_tableSkeleton_1621g_1"},fve=()=>K.jsx("div",{className:uve.tableSkeleton,children:[...Array(10)].map((t,e)=>K.jsx(Q9,{maxWidth:"100%",height:42,radius:8},`tableSkeletonBase${e}`))}),dve=({userFlow:t,pageId:e,responseKey:n,component:r,dataSource:i,rightActions:o,...a})=>{var _,w;const{fetchDataSource:s}=si(),[l,c]=S.useState(!1),[u,f]=S.useState(1),[d,h]=S.useState(null),m=S.useMemo(()=>{if(o!=null&&o.length)return o.map((b,y)=>({renderContent:k=>K.jsx(cve,{userFlow:t,pageId:e,tableResponseKey:n,component:b,rowData:k},`tableRowAction${y}`)}))},[o,t,e]),g=async(b=1)=>{try{c(!0);const{jsonPathData:y,mapperData:k,jsonPathPagination:C}=i,E=T3(i,b),A=await s(E,t,!1);h(NC(A==null?void 0:A.data,y,k,C)),c(!1)}catch(y){alert(JSON.stringify(y)),c(!1)}},p=b=>{f(b),g(b)};S.useEffect(()=>{g()},[]);const v={...a,data:d==null?void 0:d.items,rightActions:m};return K.jsx(K.Fragment,{children:l?K.jsx(fve,{}):K.jsxs(K.Fragment,{children:[K.jsx(Hq,{...v}),(d==null?void 0:d.pagination)&&((_=d==null?void 0:d.pagination)==null?void 0:_.totalPages)>1&&K.jsx($9,{page:u,size:d==null?void 0:d.pagination.size,total:(w=d==null?void 0:d.pagination)==null?void 0:w.total,onChange:p})]})})},hve={textFieldNotFront:"_textFieldNotFront_cps4i_1"},pve=t=>{const{userFlow:e,pageId:n,component:r,hash:i,responseKey:o,required:a,dependencies:s,...l}=t,c={...l},[u,f]=S.useState((c==null?void 0:c.value)??""),{disabled:d}=No(e,s),h=(c==null?void 0:c.disabled)??d,m=S.useMemo(()=>a&&(c!=null&&c.label)?`${c==null?void 0:c.label} *`:(c==null?void 0:c.label)??"",[c==null?void 0:c.label,a]),g=p=>{var w;const v=(w=p==null?void 0:p.target)==null?void 0:w.value;f(v);const _={[o]:v};oi(e,_)};return S.useEffect(()=>{f((c==null?void 0:c.value)??"")},[c==null?void 0:c.value]),K.jsx(X9,{...c,className:hve.textFieldNotFront,allowClear:!1,label:m,value:u,disabled:h,onChange:p=>!h&&g(p)})},mve=({userFlow:t,pageId:e,responseKey:n,variant:r,content:i,actionType:o,redirectUrl:a})=>{const s=S.useCallback(async()=>{x4(t);try{switch(o){case"AUTOCLOSE_AND_REDIRECT":window.location.href=a;break;default:console.warn(`Unhandled actionType: ${o}`);break}}catch(l){console.error("Error in toast action:",l),alert(JSON.stringify(l))}},[o,e,n,t,a]);return S.useEffect(()=>{({info:et.info,error:et.error,success:et.success,warning:et.warning}[r]||et.info)(i,{autoClose:o?!1:4e3,containerId:t,onClose:s})},[s,t]),null},RM=(t,e,n,r)=>{const i=ds(t,e,(r==null?void 0:r.components)||null);switch(n){case"body":return K.jsx(Vq,{...r,inputs:i||[]},JSON.stringify(r==null?void 0:r.components));case"header":return K.jsx(G3e,{...r,components:i||[]},JSON.stringify(r==null?void 0:r.components));default:return null}},gve=(t,e,n)=>{var f,d,h;const[r,i]=S.useState(!1),o=St(m=>m),a=(f=o[t])==null?void 0:f.currentPageId,s=a?RM(t,a,"header",((d=o[t].pages[a].page)==null?void 0:d.header)||null):null,l=a?RM(t,a,"body",((h=o[t].pages[a].page)==null?void 0:h.body)||null):null,c=S.useMemo(()=>{var m;return K.jsxs(K.Fragment,{children:[((m=o[t])==null?void 0:m.isLoading)&&K.jsx($$,{}),s,l,a&&K.jsx(tve,{userFlow:t,pageId:a}),o[t]&&K.jsx(a4,{})]})},[s,l,a,t]),u=async()=>{var m;try{const g=await l8(e,t),p=(m=g==null?void 0:g.data)==null?void 0:m.content;(g==null?void 0:g.status)===200?Ym(t,e,p):i(!0)}catch(g){console.error("[not-page]: API call failed",g),i(!0)}};return S.useEffect(()=>{e!=null&&e.api&&!n&&t?u():!(e!=null&&e.api)&&n&&t||e!=null&&e.api&&n&&t?Ym(t,e,n):(!(e!=null&&e.api)&&!n||!t)&&(i(!0),console.error("[not-page]: API call failed","not api config","not userFlow"))},[]),r&&console.error("[not-page]: No render page"),c};Ut.Chart=TM,Ut.Row=IM,Ut.heading=f4,Ut.text=d4,Ut.usePage=gve,Object.defineProperty(Ut,Symbol.toStringTag,{value:"Module"})});
|