bonzai-tools 1.0.101 → 1.0.102

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.
@@ -1,3 +0,0 @@
1
- /*! For license information please see main.601eb044.js.LICENSE.txt */
2
- (()=>{var e={43:(e,t,n)=>{"use strict";e.exports=n(202)},104:e=>{var t;self,t=()=>(()=>{"use strict";var e={4567:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,o=arguments.length,s=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,n,s):i(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.AccessibilityManager=void 0;const o=n(9042),s=n(6114),a=n(9924),l=n(844),c=n(5596),u=n(4725),d=n(3656);let h=t.AccessibilityManager=class extends l.Disposable{constructor(e,t){super(),this._terminal=e,this._renderService=t,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=document.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=document.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let n=0;n<this._terminal.rows;n++)this._rowElements[n]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[n]);if(this._topBoundaryFocusListener=e=>this._handleBoundaryFocus(e,0),this._bottomBoundaryFocusListener=e=>this._handleBoundaryFocus(e,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=document.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new a.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this.register(this._terminal.onResize(e=>this._handleResize(e.rows))),this.register(this._terminal.onRender(e=>this._refreshRows(e.start,e.end))),this.register(this._terminal.onScroll(()=>this._refreshRows())),this.register(this._terminal.onA11yChar(e=>this._handleChar(e))),this.register(this._terminal.onLineFeed(()=>this._handleChar("\n"))),this.register(this._terminal.onA11yTab(e=>this._handleTab(e))),this.register(this._terminal.onKey(e=>this._handleKey(e.key))),this.register(this._terminal.onBlur(()=>this._clearLiveRegion())),this.register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._screenDprMonitor=new c.ScreenDprMonitor(window),this.register(this._screenDprMonitor),this._screenDprMonitor.setListener(()=>this._refreshRowsDimensions()),this.register((0,d.addDisposableDomListener)(window,"resize",()=>this._refreshRowsDimensions())),this._refreshRows(),this.register((0,l.toDisposable)(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,"\n"===e&&(this._liveRegionLineCount++,21===this._liveRegionLineCount&&(this._liveRegion.textContent+=o.tooMuchOutput)),s.isMac&&this._liveRegion.textContent&&this._liveRegion.textContent.length>0&&!this._liveRegion.parentNode&&setTimeout(()=>{this._accessibilityContainer.appendChild(this._liveRegion)},0))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0,s.isMac&&this._liveRegion.remove()}_handleKey(e){this._clearLiveRegion(),/[\0-\x1F\x7F-\x9F]/.test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){const n=this._terminal.buffer,r=n.lines.length.toString();for(let i=e;i<=t;i++){const e=n.translateBufferLineToString(n.ydisp+i,!0),t=(n.ydisp+i+1).toString(),o=this._rowElements[i];o&&(0===e.length?o.innerText="\xa0":o.textContent=e,o.setAttribute("aria-posinset",t),o.setAttribute("aria-setsize",r))}this._announceCharacters()}_announceCharacters(){0!==this._charsToAnnounce.length&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){const n=e.target,r=this._rowElements[0===t?1:this._rowElements.length-2];if(n.getAttribute("aria-posinset")===(0===t?"1":"".concat(this._terminal.buffer.lines.length)))return;if(e.relatedTarget!==r)return;let i,o;if(0===t?(i=n,o=this._rowElements.pop(),this._rowContainer.removeChild(o)):(i=this._rowElements.shift(),o=n,this._rowContainer.removeChild(i)),i.removeEventListener("focus",this._topBoundaryFocusListener),o.removeEventListener("focus",this._bottomBoundaryFocusListener),0===t){const e=this._createAccessibilityTreeNode();this._rowElements.unshift(e),this._rowContainer.insertAdjacentElement("afterbegin",e)}else{const e=this._createAccessibilityTreeNode();this._rowElements.push(e),this._rowContainer.appendChild(e)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(0===t?-1:1),this._rowElements[0===t?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let t=this._rowContainer.children.length;t<this._terminal.rows;t++)this._rowElements[t]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[t]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const e=document.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){this._accessibilityContainer.style.width="".concat(this._renderService.dimensions.css.canvas.width,"px"),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height="".concat(this._renderService.dimensions.css.cell.height,"px")}};t.AccessibilityManager=h=r([i(1,u.IRenderService)],h)},3614:(e,t)=>{function n(e){return e.replace(/\r?\n/g,"\r")}function r(e,t){return t?"\x1b[200~"+e+"\x1b[201~":e}function i(e,t,i,o){e=r(e=n(e),i.decPrivateModes.bracketedPasteMode&&!0!==o.rawOptions.ignoreBracketedPasteMode),i.triggerDataEvent(e,!0),t.value=""}function o(e,t,n){const r=n.getBoundingClientRect(),i=e.clientX-r.left-10,o=e.clientY-r.top-10;t.style.width="20px",t.style.height="20px",t.style.left="".concat(i,"px"),t.style.top="".concat(o,"px"),t.style.zIndex="1000",t.focus()}Object.defineProperty(t,"__esModule",{value:!0}),t.rightClickHandler=t.moveTextAreaUnderMouseCursor=t.paste=t.handlePasteEvent=t.copyHandler=t.bracketTextForPaste=t.prepareTextForTerminal=void 0,t.prepareTextForTerminal=n,t.bracketTextForPaste=r,t.copyHandler=function(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()},t.handlePasteEvent=function(e,t,n,r){e.stopPropagation(),e.clipboardData&&i(e.clipboardData.getData("text/plain"),t,n,r)},t.paste=i,t.moveTextAreaUnderMouseCursor=o,t.rightClickHandler=function(e,t,n,r,i){o(e,t,n),i&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}},7239:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ColorContrastCache=void 0;const r=n(1505);t.ColorContrastCache=class{constructor(){this._color=new r.TwoKeyMap,this._css=new r.TwoKeyMap}setCss(e,t,n){this._css.set(e,t,n)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,n){this._color.set(e,t,n)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}}},3656:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.addDisposableDomListener=void 0,t.addDisposableDomListener=function(e,t,n,r){e.addEventListener(t,n,r);let i=!1;return{dispose:()=>{i||(i=!0,e.removeEventListener(t,n,r))}}}},6465:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,o=arguments.length,s=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,n,s):i(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Linkifier2=void 0;const o=n(3656),s=n(8460),a=n(844),l=n(2585);let c=t.Linkifier2=class extends a.Disposable{get currentLink(){return this._currentLink}constructor(e){super(),this._bufferService=e,this._linkProviders=[],this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new s.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new s.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,a.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,a.toDisposable)(()=>{this._lastMouseEvent=void 0})),this.register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0}))}registerLinkProvider(e){return this._linkProviders.push(e),{dispose:()=>{const t=this._linkProviders.indexOf(e);-1!==t&&this._linkProviders.splice(t,1)}}}attachToDom(e,t,n){this._element=e,this._mouseService=t,this._renderService=n,this.register((0,o.addDisposableDomListener)(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this.register((0,o.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,o.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,o.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(e){if(this._lastMouseEvent=e,!this._element||!this._mouseService)return;const t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;const n=e.composedPath();for(let r=0;r<n.length;r++){const e=n[r];if(e.classList.contains("xterm"))break;if(e.classList.contains("xterm-hover"))return}this._lastBufferCell&&t.x===this._lastBufferCell.x&&t.y===this._lastBufferCell.y||(this._handleHover(t),this._lastBufferCell=t)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(e,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,t){var n,r;this._activeProviderReplies&&t||(null===(n=this._activeProviderReplies)||void 0===n||n.forEach(e=>{null==e||e.forEach(e=>{e.link.dispose&&e.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let i=!1;for(const[o,s]of this._linkProviders.entries())t?(null===(r=this._activeProviderReplies)||void 0===r?void 0:r.get(o))&&(i=this._checkLinkProviderResult(o,e,i)):s.provideLinks(e.y,t=>{var n,r;if(this._isMouseOut)return;const s=null==t?void 0:t.map(e=>({link:e}));null===(n=this._activeProviderReplies)||void 0===n||n.set(o,s),i=this._checkLinkProviderResult(o,e,i),(null===(r=this._activeProviderReplies)||void 0===r?void 0:r.size)===this._linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){const n=new Set;for(let r=0;r<t.size;r++){const i=t.get(r);if(i)for(let t=0;t<i.length;t++){const r=i[t],o=r.link.range.start.y<e?0:r.link.range.start.x,s=r.link.range.end.y>e?this._bufferService.cols:r.link.range.end.x;for(let e=o;e<=s;e++){if(n.has(e)){i.splice(t--,1);break}n.add(e)}}}}_checkLinkProviderResult(e,t,n){var r;if(!this._activeProviderReplies)return n;const i=this._activeProviderReplies.get(e);let o=!1;for(let s=0;s<e;s++)this._activeProviderReplies.has(s)&&!this._activeProviderReplies.get(s)||(o=!0);if(!o&&i){const e=i.find(e=>this._linkAtPosition(e.link,t));e&&(n=!0,this._handleNewLink(e))}if(this._activeProviderReplies.size===this._linkProviders.length&&!n)for(let s=0;s<this._activeProviderReplies.size;s++){const e=null===(r=this._activeProviderReplies.get(s))||void 0===r?void 0:r.find(e=>this._linkAtPosition(e.link,t));if(e){n=!0,this._handleNewLink(e);break}}return n}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._element||!this._mouseService||!this._currentLink)return;const t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,t)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,t){this._element&&this._currentLink&&this._lastMouseEvent&&(!e||!t||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=t)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,a.disposeArray)(this._linkCacheDisposables))}_handleNewLink(e){if(!this._element||!this._lastMouseEvent||!this._mouseService)return;const t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:void 0===e.link.decorations||e.link.decorations.underline,pointerCursor:void 0===e.link.decorations||e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>{var e,t;return null===(t=null===(e=this._currentLink)||void 0===e?void 0:e.state)||void 0===t?void 0:t.decorations.pointerCursor},set:e=>{var t,n;(null===(t=this._currentLink)||void 0===t?void 0:t.state)&&this._currentLink.state.decorations.pointerCursor!==e&&(this._currentLink.state.decorations.pointerCursor=e,this._currentLink.state.isHovered&&(null===(n=this._element)||void 0===n||n.classList.toggle("xterm-cursor-pointer",e)))}},underline:{get:()=>{var e,t;return null===(t=null===(e=this._currentLink)||void 0===e?void 0:e.state)||void 0===t?void 0:t.decorations.underline},set:t=>{var n,r,i;(null===(n=this._currentLink)||void 0===n?void 0:n.state)&&(null===(i=null===(r=this._currentLink)||void 0===r?void 0:r.state)||void 0===i?void 0:i.decorations.underline)!==t&&(this._currentLink.state.decorations.underline=t,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,t))}}}),this._renderService&&this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(e=>{if(!this._currentLink)return;const t=0===e.start?0:e.start+1+this._bufferService.buffer.ydisp,n=this._bufferService.buffer.ydisp+1+e.end;if(this._currentLink.link.range.start.y>=t&&this._currentLink.link.range.end.y<=n&&(this._clearCurrentLink(t,n),this._lastMouseEvent&&this._element)){const e=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);e&&this._askForLink(e,!1)}})))}_linkHover(e,t,n){var r;(null===(r=this._currentLink)||void 0===r?void 0:r.state)&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add("xterm-cursor-pointer")),t.hover&&t.hover(n,t.text)}_fireUnderlineEvent(e,t){const n=e.range,r=this._bufferService.buffer.ydisp,i=this._createLinkUnderlineEvent(n.start.x-1,n.start.y-r-1,n.end.x,n.end.y-r-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(i)}_linkLeave(e,t,n){var r;(null===(r=this._currentLink)||void 0===r?void 0:r.state)&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove("xterm-cursor-pointer")),t.leave&&t.leave(n,t.text)}_linkAtPosition(e,t){const n=e.range.start.y*this._bufferService.cols+e.range.start.x,r=e.range.end.y*this._bufferService.cols+e.range.end.x,i=t.y*this._bufferService.cols+t.x;return n<=i&&i<=r}_positionFromMouseEvent(e,t,n){const r=n.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(r)return{x:r[0],y:r[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,n,r,i){return{x1:e,y1:t,x2:n,y2:r,cols:this._bufferService.cols,fg:i}}};t.Linkifier2=c=r([i(0,l.IBufferService)],c)},9042:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.tooMuchOutput=t.promptLabel=void 0,t.promptLabel="Terminal input",t.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,o=arguments.length,s=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,n,s):i(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OscLinkProvider=void 0;const o=n(511),s=n(2585);let a=t.OscLinkProvider=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){var n;const r=this._bufferService.buffer.lines.get(e-1);if(!r)return void t(void 0);const i=[],s=this._optionsService.rawOptions.linkHandler,a=new o.CellData,c=r.getTrimmedLength();let u=-1,d=-1,h=!1;for(let o=0;o<c;o++)if(-1!==d||r.hasContent(o)){if(r.loadCell(o,a),a.hasExtendedAttrs()&&a.extended.urlId){if(-1===d){d=o,u=a.extended.urlId;continue}h=a.extended.urlId!==u}else-1!==d&&(h=!0);if(h||-1!==d&&o===c-1){const t=null===(n=this._oscLinkService.getLinkData(u))||void 0===n?void 0:n.uri;if(t){const n={start:{x:d+1,y:e},end:{x:o+(h||o!==c-1?0:1),y:e}};let r=!1;if(!(null==s?void 0:s.allowNonHttpProtocols))try{const e=new URL(t);["http:","https:"].includes(e.protocol)||(r=!0)}catch(e){r=!0}r||i.push({text:t,range:n,activate:(e,t)=>s?s.activate(e,t,n):l(0,t),hover:(e,t)=>{var r;return null===(r=null==s?void 0:s.hover)||void 0===r?void 0:r.call(s,e,t,n)},leave:(e,t)=>{var r;return null===(r=null==s?void 0:s.leave)||void 0===r?void 0:r.call(s,e,t,n)}})}h=!1,a.hasExtendedAttrs()&&a.extended.urlId?(d=o,u=a.extended.urlId):(d=-1,u=-1)}}t(i)}};function l(e,t){if(confirm("Do you want to navigate to ".concat(t,"?\n\nWARNING: This link could potentially be dangerous"))){const n=window.open();if(n){try{n.opener=null}catch(e){}n.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}}t.OscLinkProvider=a=r([i(0,s.IBufferService),i(1,s.IOptionsService),i(2,s.IOscLinkService)],a)},6193:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.RenderDebouncer=void 0,t.RenderDebouncer=class{constructor(e,t){this._parentWindow=e,this._renderCallback=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._parentWindow.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||(this._animationFrame=this._parentWindow.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(e,t,n){this._rowCount=n,e=void 0!==e?e:0,t=void 0!==t?t:this._rowCount-1,this._rowStart=void 0!==this._rowStart?Math.min(this._rowStart,e):e,this._rowEnd=void 0!==this._rowEnd?Math.max(this._rowEnd,t):t,this._animationFrame||(this._animationFrame=this._parentWindow.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,void 0===this._rowStart||void 0===this._rowEnd||void 0===this._rowCount)return void this._runRefreshCallbacks();const e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}}},5596:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ScreenDprMonitor=void 0;const r=n(844);class i extends r.Disposable{constructor(e){super(),this._parentWindow=e,this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this.register((0,r.toDisposable)(()=>{this.clearListener()}))}setListener(e){this._listener&&this.clearListener(),this._listener=e,this._outerListener=()=>{this._listener&&(this._listener(this._parentWindow.devicePixelRatio,this._currentDevicePixelRatio),this._updateDpr())},this._updateDpr()}_updateDpr(){var e;this._outerListener&&(null===(e=this._resolutionMediaMatchList)||void 0===e||e.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia("screen and (resolution: ".concat(this._parentWindow.devicePixelRatio,"dppx)")),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){this._resolutionMediaMatchList&&this._listener&&this._outerListener&&(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._listener=void 0,this._outerListener=void 0)}}t.ScreenDprMonitor=i},3236:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Terminal=void 0;const r=n(3614),i=n(3656),o=n(6465),s=n(9042),a=n(3730),l=n(1680),c=n(3107),u=n(5744),d=n(2950),h=n(1296),f=n(428),p=n(4269),g=n(5114),v=n(8934),m=n(3230),_=n(9312),y=n(4725),b=n(6731),x=n(8055),w=n(8969),S=n(8460),C=n(844),k=n(6114),E=n(8437),R=n(2584),M=n(7399),L=n(5941),P=n(9074),T=n(2585),D=n(5435),O=n(4567),I="undefined"!=typeof window?window.document:null;class A extends w.CoreTerminal{get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),this.browser=k,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new C.MutableDisposable),this._onCursorMove=this.register(new S.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new S.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new S.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new S.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new S.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new S.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new S.EventEmitter),this._onBlur=this.register(new S.EventEmitter),this._onA11yCharEmitter=this.register(new S.EventEmitter),this._onA11yTabEmitter=this.register(new S.EventEmitter),this._onWillOpen=this.register(new S.EventEmitter),this._setup(),this.linkifier2=this.register(this._instantiationService.createInstance(o.Linkifier2)),this.linkifier2.registerLinkProvider(this._instantiationService.createInstance(a.OscLinkProvider)),this._decorationService=this._instantiationService.createInstance(P.DecorationService),this._instantiationService.setService(T.IDecorationService,this._decorationService),this.register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this.register(this._inputHandler.onRequestRefreshRows((e,t)=>this.refresh(e,t))),this.register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this.register(this._inputHandler.onRequestReset(()=>this.reset())),this.register(this._inputHandler.onRequestWindowsOptionsReport(e=>this._reportWindowsOptions(e))),this.register(this._inputHandler.onColor(e=>this._handleColorEvent(e))),this.register((0,S.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,S.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,S.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,S.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize(e=>this._afterResize(e.cols,e.rows))),this.register((0,C.toDisposable)(()=>{var e,t;this._customKeyEventHandler=void 0,null===(t=null===(e=this.element)||void 0===e?void 0:e.parentNode)||void 0===t||t.removeChild(this.element)}))}_handleColorEvent(e){if(this._themeService)for(const t of e){let e,n="";switch(t.index){case 256:e="foreground",n="10";break;case 257:e="background",n="11";break;case 258:e="cursor",n="12";break;default:e="ansi",n="4;"+t.index}switch(t.type){case 0:const r=x.color.toColorRGB("ansi"===e?this._themeService.colors.ansi[t.index]:this._themeService.colors[e]);this.coreService.triggerDataEvent("".concat(R.C0.ESC,"]").concat(n,";").concat((0,L.toRgbString)(r)).concat(R.C1_ESCAPED.ST));break;case 1:if("ansi"===e)this._themeService.modifyColors(e=>e.ansi[t.index]=x.rgba.toColor(...t.color));else{const n=e;this._themeService.modifyColors(e=>e[n]=x.rgba.toColor(...t.color))}break;case 2:this._themeService.restoreColor(t.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(O.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(R.C0.ESC+"[I"),this.updateCursorStyle(e),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var e;return null===(e=this.textarea)||void 0===e?void 0:e.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(R.C0.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;const e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;const n=Math.min(this.buffer.x,this.cols-1),r=this._renderService.dimensions.css.cell.height,i=t.getWidth(n),o=this._renderService.dimensions.css.cell.width*i,s=this.buffer.y*this._renderService.dimensions.css.cell.height,a=n*this._renderService.dimensions.css.cell.width;this.textarea.style.left=a+"px",this.textarea.style.top=s+"px",this.textarea.style.width=o+"px",this.textarea.style.height=r+"px",this.textarea.style.lineHeight=r+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,i.addDisposableDomListener)(this.element,"copy",e=>{this.hasSelection()&&(0,r.copyHandler)(e,this._selectionService)}));const e=e=>(0,r.handlePasteEvent)(e,this.textarea,this.coreService,this.optionsService);this.register((0,i.addDisposableDomListener)(this.textarea,"paste",e)),this.register((0,i.addDisposableDomListener)(this.element,"paste",e)),k.isFirefox?this.register((0,i.addDisposableDomListener)(this.element,"mousedown",e=>{2===e.button&&(0,r.rightClickHandler)(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this.register((0,i.addDisposableDomListener)(this.element,"contextmenu",e=>{(0,r.rightClickHandler)(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),k.isLinux&&this.register((0,i.addDisposableDomListener)(this.element,"auxclick",e=>{1===e.button&&(0,r.moveTextAreaUnderMouseCursor)(e,this.textarea,this.screenElement)}))}_bindKeys(){this.register((0,i.addDisposableDomListener)(this.textarea,"keyup",e=>this._keyUp(e),!0)),this.register((0,i.addDisposableDomListener)(this.textarea,"keydown",e=>this._keyDown(e),!0)),this.register((0,i.addDisposableDomListener)(this.textarea,"keypress",e=>this._keyPress(e),!0)),this.register((0,i.addDisposableDomListener)(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this.register((0,i.addDisposableDomListener)(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this.register((0,i.addDisposableDomListener)(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this.register((0,i.addDisposableDomListener)(this.textarea,"input",e=>this._inputEvent(e),!0)),this.register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){var t;if(!e)throw new Error("Terminal requires a parent element.");e.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),this._document=e.ownerDocument,this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),e.appendChild(this.element);const n=I.createDocumentFragment();this._viewportElement=I.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),n.appendChild(this._viewportElement),this._viewportScrollArea=I.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=I.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._helperContainer=I.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),n.appendChild(this.screenElement),this.textarea=I.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",s.promptLabel),k.isChromeOS||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._coreBrowserService=this._instantiationService.createInstance(g.CoreBrowserService,this.textarea,null!==(t=this._document.defaultView)&&void 0!==t?t:window),this._instantiationService.setService(y.ICoreBrowserService,this._coreBrowserService),this.register((0,i.addDisposableDomListener)(this.textarea,"focus",e=>this._handleTextAreaFocus(e))),this.register((0,i.addDisposableDomListener)(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(f.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(y.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(b.ThemeService),this._instantiationService.setService(y.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(p.CharacterJoinerService),this._instantiationService.setService(y.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(m.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(y.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange(e=>this._onRender.fire(e))),this.onResize(e=>this._renderService.resize(e.cols,e.rows)),this._compositionView=I.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(d.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this.element.appendChild(n);try{this._onWillOpen.fire(this.element)}catch(e){}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._mouseService=this._instantiationService.createInstance(v.MouseService),this._instantiationService.setService(y.IMouseService,this._mouseService),this.viewport=this._instantiationService.createInstance(l.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines(e=>this.scrollLines(e.amount,e.suppressScrollEvent,1)),this.register(this._inputHandler.onRequestSyncScrollBar(()=>this.viewport.syncScrollArea())),this.register(this.viewport),this.register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this.register(this.onResize(()=>this._renderService.handleResize(this.cols,this.rows))),this.register(this.onBlur(()=>this._renderService.handleBlur())),this.register(this.onFocus(()=>this._renderService.handleFocus())),this.register(this._renderService.onDimensionsChange(()=>this.viewport.syncScrollArea())),this._selectionService=this.register(this._instantiationService.createInstance(_.SelectionService,this.element,this.screenElement,this.linkifier2)),this._instantiationService.setService(y.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines(e=>this.scrollLines(e.amount,e.suppressScrollEvent))),this.register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this.register(this._selectionService.onRequestRedraw(e=>this._renderService.handleSelectionChanged(e.start,e.end,e.columnSelectMode))),this.register(this._selectionService.onLinuxMouseSelection(e=>{this.textarea.value=e,this.textarea.focus(),this.textarea.select()})),this.register(this._onScroll.event(e=>{this.viewport.syncScrollArea(),this._selectionService.refresh()})),this.register((0,i.addDisposableDomListener)(this._viewportElement,"scroll",()=>this._selectionService.refresh())),this.linkifier2.attachToDom(this.screenElement,this._mouseService,this._renderService),this.register(this._instantiationService.createInstance(c.BufferDecorationRenderer,this.screenElement)),this.register((0,i.addDisposableDomListener)(this.element,"mousedown",e=>this._selectionService.handleMouseDown(e))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(O.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",e=>this._handleScreenReaderModeOptionChange(e))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(u.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",e=>{!this._overviewRulerRenderer&&e&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(u.OverviewRulerRenderer,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(h.DomRenderer,this.element,this.screenElement,this._viewportElement,this.linkifier2)}bindMouse(){const e=this,t=this.element;function n(t){const n=e._mouseService.getMouseReportCoords(t,e.screenElement);if(!n)return!1;let r,i;switch(t.overrideType||t.type){case"mousemove":i=32,void 0===t.buttons?(r=3,void 0!==t.button&&(r=t.button<3?t.button:3)):r=1&t.buttons?0:4&t.buttons?1:2&t.buttons?2:3;break;case"mouseup":i=0,r=t.button<3?t.button:3;break;case"mousedown":i=1,r=t.button<3?t.button:3;break;case"wheel":if(0===e.viewport.getLinesScrolled(t))return!1;i=t.deltaY<0?0:1,r=4;break;default:return!1}return!(void 0===i||void 0===r||r>4)&&e.coreMouseService.triggerMouseEvent({col:n.col,row:n.row,x:n.x,y:n.y,button:r,action:i,ctrl:t.ctrlKey,alt:t.altKey,shift:t.shiftKey})}const r={mouseup:null,wheel:null,mousedrag:null,mousemove:null},o={mouseup:e=>(n(e),e.buttons||(this._document.removeEventListener("mouseup",r.mouseup),r.mousedrag&&this._document.removeEventListener("mousemove",r.mousedrag)),this.cancel(e)),wheel:e=>(n(e),this.cancel(e,!0)),mousedrag:e=>{e.buttons&&n(e)},mousemove:e=>{e.buttons||n(e)}};this.register(this.coreMouseService.onProtocolChange(e=>{e?("debug"===this.optionsService.rawOptions.logLevel&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(e)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),8&e?r.mousemove||(t.addEventListener("mousemove",o.mousemove),r.mousemove=o.mousemove):(t.removeEventListener("mousemove",r.mousemove),r.mousemove=null),16&e?r.wheel||(t.addEventListener("wheel",o.wheel,{passive:!1}),r.wheel=o.wheel):(t.removeEventListener("wheel",r.wheel),r.wheel=null),2&e?r.mouseup||(t.addEventListener("mouseup",o.mouseup),r.mouseup=o.mouseup):(this._document.removeEventListener("mouseup",r.mouseup),t.removeEventListener("mouseup",r.mouseup),r.mouseup=null),4&e?r.mousedrag||(r.mousedrag=o.mousedrag):(this._document.removeEventListener("mousemove",r.mousedrag),r.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,i.addDisposableDomListener)(t,"mousedown",e=>{if(e.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(e))return n(e),r.mouseup&&this._document.addEventListener("mouseup",r.mouseup),r.mousedrag&&this._document.addEventListener("mousemove",r.mousedrag),this.cancel(e)})),this.register((0,i.addDisposableDomListener)(t,"wheel",e=>{if(!r.wheel){if(!this.buffer.hasScrollback){const t=this.viewport.getLinesScrolled(e);if(0===t)return;const n=R.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(e.deltaY<0?"A":"B");let r="";for(let e=0;e<Math.abs(t);e++)r+=n;return this.coreService.triggerDataEvent(r,!0),this.cancel(e,!0)}return this.viewport.handleWheel(e)?this.cancel(e):void 0}},{passive:!1})),this.register((0,i.addDisposableDomListener)(t,"touchstart",e=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(e),this.cancel(e)},{passive:!0})),this.register((0,i.addDisposableDomListener)(t,"touchmove",e=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(e)?void 0:this.cancel(e)},{passive:!1}))}refresh(e,t){var n;null===(n=this._renderService)||void 0===n||n.refreshRows(e,t)}updateCursorStyle(e){var t;(null===(t=this._selectionService)||void 0===t?void 0:t.shouldColumnSelect(e))?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;var r;1===n?(super.scrollLines(e,t,n),this.refresh(0,this.rows-1)):null===(r=this.viewport)||void 0===r||r.scrollLines(e)}paste(e){(0,r.paste)(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}registerLinkProvider(e){return this.linkifier2.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const t=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),t}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(e,t,n){this._selectionService.setSelection(e,t,n)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(this._selectionService&&this._selectionService.hasSelection)return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){var e;null===(e=this._selectionService)||void 0===e||e.clearSelection()}selectAll(){var e;null===(e=this._selectionService)||void 0===e||e.selectAll()}selectLines(e,t){var n;null===(n=this._selectionService)||void 0===n||n.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&!1===this._customKeyEventHandler(e))return!1;const t=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!t&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;t||"Dead"!==e.key&&"AltGraph"!==e.key||(this._unprocessedDeadKey=!0);const n=(0,M.evaluateKeyboardEvent)(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),3===n.type||2===n.type){const t=this.rows-1;return this.scrollLines(2===n.type?-t:t),this.cancel(e,!0)}return 1===n.type&&this.selectAll(),!!this._isThirdLevelShift(this.browser,e)||(n.cancel&&this.cancel(e,!0),!n.key||!!(e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&1===e.key.length&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(n.key!==R.C0.ETX&&n.key!==R.C0.CR||(this.textarea.value=""),this._onKey.fire({key:n.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(n.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey?this.cancel(e,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(e,t){const n=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState("AltGraph");return"keypress"===t.type?n:n&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,this._customKeyEventHandler&&!1===this._customKeyEventHandler(e)||(function(e){return 16===e.keyCode||17===e.keyCode||18===e.keyCode}(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled)return!1;if(this._customKeyEventHandler&&!1===this._customKeyEventHandler(e))return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(null===e.which||void 0===e.which)t=e.keyCode;else{if(0===e.which||0===e.charCode)return!1;t=e.which}return!(!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)||(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(t,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(e){if(e.data&&"insertText"===e.inputType&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const t=e.data;return this.coreService.triggerDataEvent(t,!0),this.cancel(e),!0}return!1}resize(e,t){e!==this.cols||t!==this.rows?super.resize(e,t):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(e,t){var n,r;null===(n=this._charSizeService)||void 0===n||n.measure(),null===(r=this.viewport)||void 0===r||r.syncScrollArea(!0)}clear(){var e;if(0!==this.buffer.ybase||0!==this.buffer.y){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let e=1;e<this.rows;e++)this.buffer.lines.push(this.buffer.getBlankLine(E.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),null===(e=this.viewport)||void 0===e||e.reset(),this.refresh(0,this.rows-1)}}reset(){var e,t;this.options.rows=this.rows,this.options.cols=this.cols;const n=this._customKeyEventHandler;this._setup(),super.reset(),null===(e=this._selectionService)||void 0===e||e.reset(),this._decorationService.reset(),null===(t=this.viewport)||void 0===t||t.reset(),this._customKeyEventHandler=n,this.refresh(0,this.rows-1)}clearTextureAtlas(){var e;null===(e=this._renderService)||void 0===e||e.clearTextureAtlas()}_reportFocus(){var e;(null===(e=this.element)||void 0===e?void 0:e.classList.contains("focus"))?this.coreService.triggerDataEvent(R.C0.ESC+"[I"):this.coreService.triggerDataEvent(R.C0.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case D.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const e=this._renderService.dimensions.css.canvas.width.toFixed(0),t=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent("".concat(R.C0.ESC,"[4;").concat(t,";").concat(e,"t"));break;case D.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const n=this._renderService.dimensions.css.cell.width.toFixed(0),r=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent("".concat(R.C0.ESC,"[6;").concat(r,";").concat(n,"t"))}}cancel(e,t){if(this.options.cancelEvents||t)return e.preventDefault(),e.stopPropagation(),!1}}t.Terminal=A},9924:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TimeBasedDebouncer=void 0,t.TimeBasedDebouncer=class{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3;this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,n){this._rowCount=n,e=void 0!==e?e:0,t=void 0!==t?t:this._rowCount-1,this._rowStart=void 0!==this._rowStart?Math.min(this._rowStart,e):e,this._rowEnd=void 0!==this._rowEnd?Math.max(this._rowEnd,t):t;const r=Date.now();if(r-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=r,this._innerRefresh();else if(!this._additionalRefreshRequested){const e=r-this._lastRefreshMs,t=this._debounceThresholdMS-e;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},t)}}_innerRefresh(){if(void 0===this._rowStart||void 0===this._rowEnd||void 0===this._rowCount)return;const e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t)}}},1680:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,o=arguments.length,s=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,n,s):i(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Viewport=void 0;const o=n(3656),s=n(4725),a=n(8460),l=n(844),c=n(2585);let u=t.Viewport=class extends l.Disposable{constructor(e,t,n,r,i,s,l,c){super(),this._viewportElement=e,this._scrollArea=t,this._bufferService=n,this._optionsService=r,this._charSizeService=i,this._renderService=s,this._coreBrowserService=l,this.scrollBarWidth=0,this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._wheelPartialScroll=0,this._refreshAnimationFrame=null,this._ignoreNextScrollEvent=!1,this._smoothScrollState={startTime:0,origin:-1,target:-1},this._onRequestScrollLines=this.register(new a.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,o.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate(e=>this._activeBuffer=e.activeBuffer)),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange(e=>this._renderDimensions=e)),this._handleThemeChange(c.colors),this.register(c.onChangeColors(e=>this._handleThemeChange(e))),this.register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.syncScrollArea())),setTimeout(()=>this.syncScrollArea())}_handleThemeChange(e){this._viewportElement.style.backgroundColor=e.background.css}reset(){this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._coreBrowserService.window.requestAnimationFrame(()=>this.syncScrollArea())}_refresh(e){if(e)return this._innerRefresh(),void(null!==this._refreshAnimationFrame&&this._coreBrowserService.window.cancelAnimationFrame(this._refreshAnimationFrame));null===this._refreshAnimationFrame&&(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderService.dimensions.device.cell.height/this._coreBrowserService.dpr,this._currentDeviceCellHeight=this._renderService.dimensions.device.cell.height,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;const e=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderService.dimensions.css.canvas.height);this._lastRecordedBufferHeight!==e&&(this._lastRecordedBufferHeight=e,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const e=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==e&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=e),this._refreshAnimationFrame=null}syncScrollArea(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(e);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(e)}_handleScroll(e){if(this._lastScrollTop=this._viewportElement.scrollTop,!this._viewportElement.offsetParent)return;if(this._ignoreNextScrollEvent)return this._ignoreNextScrollEvent=!1,void this._onRequestScrollLines.fire({amount:0,suppressScrollEvent:!0});const t=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:t,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||-1===this._smoothScrollState.origin||-1===this._smoothScrollState.target)return;const e=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(e*(this._smoothScrollState.target-this._smoothScrollState.origin)),e<1?this._coreBrowserService.window.requestAnimationFrame(()=>this._smoothScroll()):this._clearSmoothScrollState()}_smoothScrollPercent(){return this._optionsService.rawOptions.smoothScrollDuration&&this._smoothScrollState.startTime?Math.max(Math.min((Date.now()-this._smoothScrollState.startTime)/this._optionsService.rawOptions.smoothScrollDuration,1),0):1}_clearSmoothScrollState(){this._smoothScrollState.startTime=0,this._smoothScrollState.origin=-1,this._smoothScrollState.target=-1}_bubbleScroll(e,t){const n=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(t<0&&0!==this._viewportElement.scrollTop||t>0&&n<this._lastRecordedBufferHeight)||(e.cancelable&&e.preventDefault(),!1)}handleWheel(e){const t=this._getPixelsScrolled(e);return 0!==t&&(this._optionsService.rawOptions.smoothScrollDuration?(this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,-1===this._smoothScrollState.target?this._smoothScrollState.target=this._viewportElement.scrollTop+t:this._smoothScrollState.target+=t,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=t,this._bubbleScroll(e,t))}scrollLines(e){if(0!==e)if(this._optionsService.rawOptions.smoothScrollDuration){const t=e*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+t,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:e,suppressScrollEvent:!1})}_getPixelsScrolled(e){if(0===e.deltaY||e.shiftKey)return 0;let t=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_LINE?t*=this._currentRowHeight:e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(t*=this._currentRowHeight*this._bufferService.rows),t}getBufferElements(e,t){var n;let r,i="";const o=[],s=null!=t?t:this._bufferService.buffer.lines.length,a=this._bufferService.buffer.lines;for(let l=e;l<s;l++){const e=a.get(l);if(!e)continue;const t=null===(n=a.get(l+1))||void 0===n?void 0:n.isWrapped;if(i+=e.translateToString(!t),!t||l===a.length-1){const e=document.createElement("div");e.textContent=i,o.push(e),i.length>0&&(r=e),i=""}}return{bufferElements:o,cursorElement:r}}getLinesScrolled(e){if(0===e.deltaY||e.shiftKey)return 0;let t=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(t/=this._currentRowHeight+0,this._wheelPartialScroll+=t,t=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(t*=this._bufferService.rows),t}_applyScrollModifier(e,t){const n=this._optionsService.rawOptions.fastScrollModifier;return"alt"===n&&t.altKey||"ctrl"===n&&t.ctrlKey||"shift"===n&&t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(e){this._lastTouchY=e.touches[0].pageY}handleTouchMove(e){const t=this._lastTouchY-e.touches[0].pageY;return this._lastTouchY=e.touches[0].pageY,0!==t&&(this._viewportElement.scrollTop+=t,this._bubbleScroll(e,t))}};t.Viewport=u=r([i(2,c.IBufferService),i(3,c.IOptionsService),i(4,s.ICharSizeService),i(5,s.IRenderService),i(6,s.ICoreBrowserService),i(7,s.IThemeService)],u)},3107:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,o=arguments.length,s=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,n,s):i(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.BufferDecorationRenderer=void 0;const o=n(3656),s=n(4725),a=n(844),l=n(2585);let c=t.BufferDecorationRenderer=class extends a.Disposable{constructor(e,t,n,r){super(),this._screenElement=e,this._bufferService=t,this._decorationService=n,this._renderService=r,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this.register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this.register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this.register((0,o.addDisposableDomListener)(window,"resize",()=>this._queueRefresh())),this.register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this.register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this.register(this._decorationService.onDecorationRemoved(e=>this._removeDecoration(e))),this.register((0,a.toDisposable)(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){void 0===this._animationFrame&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(const e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){var t,n;const r=document.createElement("div");r.classList.add("xterm-decoration"),r.classList.toggle("xterm-decoration-top-layer","top"===(null===(t=null==e?void 0:e.options)||void 0===t?void 0:t.layer)),r.style.width="".concat(Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width),"px"),r.style.height=(e.options.height||1)*this._renderService.dimensions.css.cell.height+"px",r.style.top=(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",r.style.lineHeight="".concat(this._renderService.dimensions.css.cell.height,"px");const i=null!==(n=e.options.x)&&void 0!==n?n:0;return i&&i>this._bufferService.cols&&(r.style.display="none"),this._refreshXPosition(e,r),r}_refreshStyle(e){const t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display="none",e.onRenderEmitter.fire(e.element));else{let n=this._decorationElements.get(e);n||(n=this._createElement(e),e.element=n,this._decorationElements.set(e,n),this._container.appendChild(n),e.onDispose(()=>{this._decorationElements.delete(e),n.remove()})),n.style.top=t*this._renderService.dimensions.css.cell.height+"px",n.style.display=this._altBufferIsActive?"none":"block",e.onRenderEmitter.fire(n)}}_refreshXPosition(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.element;var n;if(!t)return;const r=null!==(n=e.options.x)&&void 0!==n?n:0;"right"===(e.options.anchor||"left")?t.style.right=r?r*this._renderService.dimensions.css.cell.width+"px":"":t.style.left=r?r*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(e){var t;null===(t=this._decorationElements.get(e))||void 0===t||t.remove(),this._decorationElements.delete(e),e.dispose()}};t.BufferDecorationRenderer=c=r([i(1,l.IBufferService),i(2,l.IDecorationService),i(3,s.IRenderService)],c)},5871:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ColorZoneStore=void 0,t.ColorZoneStore=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(e){if(e.options.overviewRulerOptions){for(const t of this._zones)if(t.color===e.options.overviewRulerOptions.color&&t.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(t,e.marker.line))return;if(this._lineAdjacentToZone(t,e.marker.line,e.options.overviewRulerOptions.position))return void this._addLineToZone(t,e.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=e.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=e.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=e.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=e.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:e.options.overviewRulerOptions.color,position:e.options.overviewRulerOptions.position,startBufferLine:e.marker.line,endBufferLine:e.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(e){this._linePadding=e}_lineIntersectsZone(e,t){return t>=e.startBufferLine&&t<=e.endBufferLine}_lineAdjacentToZone(e,t,n){return t>=e.startBufferLine-this._linePadding[n||"full"]&&t<=e.endBufferLine+this._linePadding[n||"full"]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}}},5744:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,o=arguments.length,s=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,n,s):i(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OverviewRulerRenderer=void 0;const o=n(5871),s=n(3656),a=n(4725),l=n(844),c=n(2585),u={full:0,left:0,center:0,right:0},d={full:0,left:0,center:0,right:0},h={full:0,left:0,center:0,right:0};let f=t.OverviewRulerRenderer=class extends l.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(e,t,n,r,i,s,a){var c;super(),this._viewportElement=e,this._screenElement=t,this._bufferService=n,this._decorationService=r,this._renderService=i,this._optionsService=s,this._coreBrowseService=a,this._colorZoneStore=new o.ColorZoneStore,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=document.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),null===(c=this._viewportElement.parentElement)||void 0===c||c.insertBefore(this._canvas,this._viewportElement);const u=this._canvas.getContext("2d");if(!u)throw new Error("Ctx cannot be null");this._ctx=u,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,l.toDisposable)(()=>{var e;null===(e=this._canvas)||void 0===e||e.remove()}))}_registerDecorationListeners(){this.register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this.register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0)))}_registerBufferChangeListeners(){this.register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this.register(this._bufferService.buffers.onBufferActivate(()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"})),this.register(this._bufferService.onScroll(()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())}))}_registerDimensionChangeListeners(){this.register(this._renderService.onRender(()=>{this._containerHeight&&this._containerHeight===this._screenElement.clientHeight||(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this.register(this._optionsService.onSpecificOptionChange("overviewRulerWidth",()=>this._queueRefresh(!0))),this.register((0,s.addDisposableDomListener)(this._coreBrowseService.window,"resize",()=>this._queueRefresh(!0))),this._queueRefresh(!0)}_refreshDrawConstants(){const e=Math.floor(this._canvas.width/3),t=Math.ceil(this._canvas.width/3);d.full=this._canvas.width,d.left=e,d.center=t,d.right=e,this._refreshDrawHeightConstants(),h.full=0,h.left=0,h.center=d.left,h.right=d.left+d.center}_refreshDrawHeightConstants(){u.full=Math.round(2*this._coreBrowseService.dpr);const e=this._canvas.height/this._bufferService.buffer.lines.length,t=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowseService.dpr);u.left=t,u.center=t,u.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*u.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*u.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*u.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*u.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width="".concat(this._width,"px"),this._canvas.width=Math.round(this._width*this._coreBrowseService.dpr),this._canvas.style.height="".concat(this._screenElement.clientHeight,"px"),this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowseService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(const t of this._decorationService.decorations)this._colorZoneStore.addDecoration(t);this._ctx.lineWidth=1;const e=this._colorZoneStore.zones;for(const t of e)"full"!==t.position&&this._renderColorZone(t);for(const t of e)"full"===t.position&&this._renderColorZone(t);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(h[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-u[e.position||"full"]/2),d[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+u[e.position||"full"]))}_queueRefresh(e,t){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=t||this._shouldUpdateAnchor,void 0===this._animationFrame&&(this._animationFrame=this._coreBrowseService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};t.OverviewRulerRenderer=f=r([i(2,c.IBufferService),i(3,c.IDecorationService),i(4,a.IRenderService),i(5,c.IOptionsService),i(6,a.ICoreBrowserService)],f)},2950:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,o=arguments.length,s=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,n,s):i(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CompositionHelper=void 0;const o=n(4725),s=n(2585),a=n(2584);let l=t.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(e,t,n,r,i,o){this._textarea=e,this._compositionView=t,this._bufferService=n,this._optionsService=r,this._coreService=i,this._renderService=o,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(229===e.keyCode)return!1;if(16===e.keyCode||17===e.keyCode||18===e.keyCode)return!1;this._finalizeComposition(!1)}return 229!==e.keyCode||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(e){if(this._compositionView.classList.remove("active"),this._isComposing=!1,e){const e={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){let t;this._isSendingComposition=!1,e.start+=this._dataAlreadySent.length,t=this._isComposing?this._textarea.value.substring(e.start,e.end):this._textarea.value.substring(e.start),t.length>0&&this._coreService.triggerDataEvent(t,!0)}},0)}else{this._isSendingComposition=!1;const e=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(e,!0)}}_handleAnyTextareaChanges(){const e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){const t=this._textarea.value,n=t.replace(e,"");this._dataAlreadySent=n,t.length>e.length?this._coreService.triggerDataEvent(n,!0):t.length<e.length?this._coreService.triggerDataEvent("".concat(a.C0.DEL),!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){const e=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),t=this._renderService.dimensions.css.cell.height,n=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,r=e*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=r+"px",this._compositionView.style.top=n+"px",this._compositionView.style.height=t+"px",this._compositionView.style.lineHeight=t+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";const i=this._compositionView.getBoundingClientRect();this._textarea.style.left=r+"px",this._textarea.style.top=n+"px",this._textarea.style.width=Math.max(i.width,1)+"px",this._textarea.style.height=Math.max(i.height,1)+"px",this._textarea.style.lineHeight=i.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};t.CompositionHelper=l=r([i(2,s.IBufferService),i(3,s.IOptionsService),i(4,s.ICoreService),i(5,o.IRenderService)],l)},9806:(e,t)=>{function n(e,t,n){const r=n.getBoundingClientRect(),i=e.getComputedStyle(n),o=parseInt(i.getPropertyValue("padding-left")),s=parseInt(i.getPropertyValue("padding-top"));return[t.clientX-r.left-o,t.clientY-r.top-s]}Object.defineProperty(t,"__esModule",{value:!0}),t.getCoords=t.getCoordsRelativeToElement=void 0,t.getCoordsRelativeToElement=n,t.getCoords=function(e,t,r,i,o,s,a,l,c){if(!s)return;const u=n(e,t,r);return u?(u[0]=Math.ceil((u[0]+(c?a/2:0))/a),u[1]=Math.ceil(u[1]/l),u[0]=Math.min(Math.max(u[0],1),i+(c?1:0)),u[1]=Math.min(Math.max(u[1],1),o),u):void 0}},9504:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.moveToCellSequence=void 0;const r=n(2584);function i(e,t,n,r){const i=e-o(e,n),a=t-o(t,n),u=Math.abs(i-a)-function(e,t,n){let r=0;const i=e-o(e,n),a=t-o(t,n);for(let o=0;o<Math.abs(i-a);o++){const a="A"===s(e,t)?-1:1,l=n.buffer.lines.get(i+a*o);(null==l?void 0:l.isWrapped)&&r++}return r}(e,t,n);return c(u,l(s(e,t),r))}function o(e,t){let n=0,r=t.buffer.lines.get(e),i=null==r?void 0:r.isWrapped;for(;i&&e>=0&&e<t.rows;)n++,r=t.buffer.lines.get(--e),i=null==r?void 0:r.isWrapped;return n}function s(e,t){return e>t?"A":"B"}function a(e,t,n,r,i,o){let s=e,a=t,l="";for(;s!==n||a!==r;)s+=i?1:-1,i&&s>o.cols-1?(l+=o.buffer.translateBufferLineToString(a,!1,e,s),s=0,e=0,a++):!i&&s<0&&(l+=o.buffer.translateBufferLineToString(a,!1,0,e+1),s=o.cols-1,e=s,a--);return l+o.buffer.translateBufferLineToString(a,!1,e,s)}function l(e,t){const n=t?"O":"[";return r.C0.ESC+n+e}function c(e,t){e=Math.floor(e);let n="";for(let r=0;r<e;r++)n+=t;return n}t.moveToCellSequence=function(e,t,n,r){const s=n.buffer.x,u=n.buffer.y;if(!n.buffer.hasScrollback)return function(e,t,n,r,s,u){return 0===i(t,r,s,u).length?"":c(a(e,t,e,t-o(t,s),!1,s).length,l("D",u))}(s,u,0,t,n,r)+i(u,t,n,r)+function(e,t,n,r,s,u){let d;d=i(t,r,s,u).length>0?r-o(r,s):t;const h=r,f=function(e,t,n,r,s,a){let l;return l=i(n,r,s,a).length>0?r-o(r,s):t,e<n&&l<=r||e>=n&&l<r?"C":"D"}(e,t,n,r,s,u);return c(a(e,d,n,h,"C"===f,s).length,l(f,u))}(s,u,e,t,n,r);let d;if(u===t)return d=s>e?"D":"C",c(Math.abs(s-e),l(d,r));d=u>t?"D":"C";const h=Math.abs(u-t);return c(function(e,t){return t.cols-e}(u>t?e:s,n)+(h-1)*n.cols+1+((u>t?s:e)-1),l(d,r))}},1296:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,o=arguments.length,s=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,n,s):i(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DomRenderer=void 0;const o=n(3787),s=n(2550),a=n(2223),l=n(6171),c=n(4725),u=n(8055),d=n(8460),h=n(844),f=n(2585),p="xterm-dom-renderer-owner-",g="xterm-rows",v="xterm-fg-",m="xterm-bg-",_="xterm-focus",y="xterm-selection";let b=1,x=t.DomRenderer=class extends h.Disposable{constructor(e,t,n,r,i,a,c,u,f,v){super(),this._element=e,this._screenElement=t,this._viewportElement=n,this._linkifier2=r,this._charSizeService=a,this._optionsService=c,this._bufferService=u,this._coreBrowserService=f,this._themeService=v,this._terminalClass=b++,this._rowElements=[],this.onRequestRedraw=this.register(new d.EventEmitter).event,this._rowContainer=document.createElement("div"),this._rowContainer.classList.add(g),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=document.createElement("div"),this._selectionContainer.classList.add(y),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,l.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this.register(this._themeService.onChangeColors(e=>this._injectCss(e))),this._injectCss(this._themeService.colors),this._rowFactory=i.createInstance(o.DomRendererRowFactory,document),this._element.classList.add(p+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline(e=>this._handleLinkHover(e))),this.register(this._linkifier2.onHideLinkUnderline(e=>this._handleLinkLeave(e))),this.register((0,h.toDisposable)(()=>{this._element.classList.remove(p+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new s.WidthCache(document),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){const e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(const n of this._rowElements)n.style.width="".concat(this.dimensions.css.canvas.width,"px"),n.style.height="".concat(this.dimensions.css.cell.height,"px"),n.style.lineHeight="".concat(this.dimensions.css.cell.height,"px"),n.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const t="".concat(this._terminalSelector," .").concat(g," span { display: inline-block; height: 100%; vertical-align: top;}");this._dimensionsStyleElement.textContent=t,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width="".concat(this.dimensions.css.canvas.width,"px"),this._screenElement.style.height="".concat(this.dimensions.css.canvas.height,"px")}_injectCss(e){this._themeStyleElement||(this._themeStyleElement=document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let t="".concat(this._terminalSelector," .").concat(g," { color: ").concat(e.foreground.css,"; font-family: ").concat(this._optionsService.rawOptions.fontFamily,"; font-size: ").concat(this._optionsService.rawOptions.fontSize,"px; font-kerning: none; white-space: pre}");t+="".concat(this._terminalSelector," .").concat(g," .xterm-dim { color: ").concat(u.color.multiplyOpacity(e.foreground,.5).css,";}"),t+="".concat(this._terminalSelector," span:not(.xterm-bold) { font-weight: ").concat(this._optionsService.rawOptions.fontWeight,";}").concat(this._terminalSelector," span.xterm-bold { font-weight: ").concat(this._optionsService.rawOptions.fontWeightBold,";}").concat(this._terminalSelector," span.xterm-italic { font-style: italic;}"),t+="@keyframes blink_box_shadow_"+this._terminalClass+" { 50% { border-bottom-style: hidden; }}",t+="@keyframes blink_block_"+this._terminalClass+" { 0% {"+" background-color: ".concat(e.cursor.css,";")+" color: ".concat(e.cursorAccent.css,"; } 50% { background-color: inherit;")+" color: ".concat(e.cursor.css,"; }}"),t+="".concat(this._terminalSelector," .").concat(g,".").concat(_," .xterm-cursor.xterm-cursor-blink:not(.xterm-cursor-block) { animation: blink_box_shadow_")+this._terminalClass+" 1s step-end infinite;}"+"".concat(this._terminalSelector," .").concat(g,".").concat(_," .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: blink_block_")+this._terminalClass+" 1s step-end infinite;}"+"".concat(this._terminalSelector," .").concat(g," .xterm-cursor.xterm-cursor-block {")+" background-color: ".concat(e.cursor.css,";")+" color: ".concat(e.cursorAccent.css,";}")+"".concat(this._terminalSelector," .").concat(g," .xterm-cursor.xterm-cursor-outline {")+" outline: 1px solid ".concat(e.cursor.css,"; outline-offset: -1px;}")+"".concat(this._terminalSelector," .").concat(g," .xterm-cursor.xterm-cursor-bar {")+" box-shadow: ".concat(this._optionsService.rawOptions.cursorWidth,"px 0 0 ").concat(e.cursor.css," inset;}")+"".concat(this._terminalSelector," .").concat(g," .xterm-cursor.xterm-cursor-underline {")+" border-bottom: 1px ".concat(e.cursor.css,"; border-bottom-style: solid; height: calc(100% - 1px);}"),t+="".concat(this._terminalSelector," .").concat(y," { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}").concat(this._terminalSelector,".focus .").concat(y," div { position: absolute; background-color: ").concat(e.selectionBackgroundOpaque.css,";}").concat(this._terminalSelector," .").concat(y," div { position: absolute; background-color: ").concat(e.selectionInactiveBackgroundOpaque.css,";}");for(const[n,r]of e.ansi.entries())t+="".concat(this._terminalSelector," .").concat(v).concat(n," { color: ").concat(r.css,"; }").concat(this._terminalSelector," .").concat(v).concat(n,".xterm-dim { color: ").concat(u.color.multiplyOpacity(r,.5).css,"; }").concat(this._terminalSelector," .").concat(m).concat(n," { background-color: ").concat(r.css,"; }");t+="".concat(this._terminalSelector," .").concat(v).concat(a.INVERTED_DEFAULT_COLOR," { color: ").concat(u.color.opaque(e.background).css,"; }").concat(this._terminalSelector," .").concat(v).concat(a.INVERTED_DEFAULT_COLOR,".xterm-dim { color: ").concat(u.color.multiplyOpacity(u.color.opaque(e.background),.5).css,"; }").concat(this._terminalSelector," .").concat(m).concat(a.INVERTED_DEFAULT_COLOR," { background-color: ").concat(e.foreground.css,"; }"),this._themeStyleElement.textContent=t}_setDefaultSpacing(){const e=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing="".concat(e,"px"),this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,t){for(let n=this._rowElements.length;n<=t;n++){const e=document.createElement("div");this._rowContainer.appendChild(e),this._rowElements.push(e)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,t){this._refreshRowElements(e,t),this._updateDimensions()}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(_)}handleFocus(){this._rowContainer.classList.add(_),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,n){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,n),this.renderRows(0,this._bufferService.rows-1),!e||!t)return;const r=e[1]-this._bufferService.buffer.ydisp,i=t[1]-this._bufferService.buffer.ydisp,o=Math.max(r,0),s=Math.min(i,this._bufferService.rows-1);if(o>=this._bufferService.rows||s<0)return;const a=document.createDocumentFragment();if(n){const n=e[0]>t[0];a.appendChild(this._createSelectionElement(o,n?t[0]:e[0],n?e[0]:t[0],s-o+1))}else{const n=r===o?e[0]:0,l=o===i?t[0]:this._bufferService.cols;a.appendChild(this._createSelectionElement(o,n,l));const c=s-o-1;if(a.appendChild(this._createSelectionElement(o+1,0,this._bufferService.cols,c)),o!==s){const e=i===s?t[0]:this._bufferService.cols;a.appendChild(this._createSelectionElement(s,0,e))}}this._selectionContainer.appendChild(a)}_createSelectionElement(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;const i=document.createElement("div");return i.style.height=r*this.dimensions.css.cell.height+"px",i.style.top=e*this.dimensions.css.cell.height+"px",i.style.left=t*this.dimensions.css.cell.width+"px",i.style.width=this.dimensions.css.cell.width*(n-t)+"px",i}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(const e of this._rowElements)e.replaceChildren()}renderRows(e,t){const n=this._bufferService.buffer,r=n.ybase+n.y,i=Math.min(n.x,this._bufferService.cols-1),o=this._optionsService.rawOptions.cursorBlink,s=this._optionsService.rawOptions.cursorStyle,a=this._optionsService.rawOptions.cursorInactiveStyle;for(let l=e;l<=t;l++){const e=l+n.ydisp,t=this._rowElements[l],c=n.lines.get(e);if(!t||!c)break;t.replaceChildren(...this._rowFactory.createRow(c,e,e===r,s,a,i,o,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return".".concat(p).concat(this._terminalClass)}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,t,n,r,i,o){n<0&&(e=0),r<0&&(t=0);const s=this._bufferService.rows-1;n=Math.max(Math.min(n,s),0),r=Math.max(Math.min(r,s),0),i=Math.min(i,this._bufferService.cols);const a=this._bufferService.buffer,l=a.ybase+a.y,c=Math.min(a.x,i-1),u=this._optionsService.rawOptions.cursorBlink,d=this._optionsService.rawOptions.cursorStyle,h=this._optionsService.rawOptions.cursorInactiveStyle;for(let f=n;f<=r;++f){const s=f+a.ydisp,p=this._rowElements[f],g=a.lines.get(s);if(!p||!g)break;p.replaceChildren(...this._rowFactory.createRow(g,s,s===l,d,h,c,u,this.dimensions.css.cell.width,this._widthCache,o?f===n?e:0:-1,o?(f===r?t:i)-1:-1))}}};t.DomRenderer=x=r([i(4,f.IInstantiationService),i(5,c.ICharSizeService),i(6,f.IOptionsService),i(7,f.IBufferService),i(8,c.ICoreBrowserService),i(9,c.IThemeService)],x)},3787:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,o=arguments.length,s=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,n,s):i(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DomRendererRowFactory=void 0;const o=n(2223),s=n(643),a=n(511),l=n(2585),c=n(8055),u=n(4725),d=n(4269),h=n(6171),f=n(3734);let p=t.DomRendererRowFactory=class{constructor(e,t,n,r,i,o,s){this._document=e,this._characterJoinerService=t,this._optionsService=n,this._coreBrowserService=r,this._coreService=i,this._decorationService=o,this._themeService=s,this._workCell=new a.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,n){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=n}createRow(e,t,n,r,i,a,l,u,h,p,v){const m=[],_=this._characterJoinerService.getJoinedCharacters(t),y=this._themeService.colors;let b,x=e.getNoBgTrimmedLength();n&&x<a+1&&(x=a+1);let w=0,S="",C=0,k=0,E=0,R=!1,M=0,L=!1,P=0;const T=[],D=-1!==p&&-1!==v;for(let O=0;O<x;O++){e.loadCell(O,this._workCell);let x=this._workCell.getWidth();if(0===x)continue;let I=!1,A=O,j=this._workCell;if(_.length>0&&O===_[0][0]){I=!0;const t=_.shift();j=new d.JoinedCellData(this._workCell,e.translateToString(!0,t[0],t[1]),t[1]-t[0]),A=t[1]-1,x=j.getWidth()}const B=this._isCellInSelection(O,t),N=n&&O===a,F=D&&O>=p&&O<=v;let z=!1;this._decorationService.forEachDecorationAtCell(O,t,void 0,e=>{z=!0});let H=j.getChars()||s.WHITESPACE_CELL_CHAR;if(" "===H&&(j.isUnderline()||j.isOverline())&&(H="\xa0"),P=x*u-h.get(H,j.isBold(),j.isItalic()),b){if(w&&(B&&L||!B&&!L&&j.bg===C)&&(B&&L&&y.selectionForeground||j.fg===k)&&j.extended.ext===E&&F===R&&P===M&&!N&&!I&&!z){S+=H,w++;continue}w&&(b.textContent=S),b=this._document.createElement("span"),w=0,S=""}else b=this._document.createElement("span");if(C=j.bg,k=j.fg,E=j.extended.ext,R=F,M=P,L=B,I&&a>=O&&a<=A&&(a=O),!this._coreService.isCursorHidden&&N)if(T.push("xterm-cursor"),this._coreBrowserService.isFocused)l&&T.push("xterm-cursor-blink"),T.push("bar"===r?"xterm-cursor-bar":"underline"===r?"xterm-cursor-underline":"xterm-cursor-block");else if(i)switch(i){case"outline":T.push("xterm-cursor-outline");break;case"block":T.push("xterm-cursor-block");break;case"bar":T.push("xterm-cursor-bar");break;case"underline":T.push("xterm-cursor-underline")}if(j.isBold()&&T.push("xterm-bold"),j.isItalic()&&T.push("xterm-italic"),j.isDim()&&T.push("xterm-dim"),S=j.isInvisible()?s.WHITESPACE_CELL_CHAR:j.getChars()||s.WHITESPACE_CELL_CHAR,j.isUnderline()&&(T.push("xterm-underline-".concat(j.extended.underlineStyle))," "===S&&(S="\xa0"),!j.isUnderlineColorDefault()))if(j.isUnderlineColorRGB())b.style.textDecorationColor="rgb(".concat(f.AttributeData.toColorRGB(j.getUnderlineColor()).join(","),")");else{let e=j.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&j.isBold()&&e<8&&(e+=8),b.style.textDecorationColor=y.ansi[e].css}j.isOverline()&&(T.push("xterm-overline")," "===S&&(S="\xa0")),j.isStrikethrough()&&T.push("xterm-strikethrough"),F&&(b.style.textDecoration="underline");let W=j.getFgColor(),U=j.getFgColorMode(),V=j.getBgColor(),$=j.getBgColorMode();const q=!!j.isInverse();if(q){const e=W;W=V,V=e;const t=U;U=$,$=t}let K,Y,X,G=!1;switch(this._decorationService.forEachDecorationAtCell(O,t,void 0,e=>{"top"!==e.options.layer&&G||(e.backgroundColorRGB&&($=50331648,V=e.backgroundColorRGB.rgba>>8&16777215,K=e.backgroundColorRGB),e.foregroundColorRGB&&(U=50331648,W=e.foregroundColorRGB.rgba>>8&16777215,Y=e.foregroundColorRGB),G="top"===e.options.layer)}),!G&&B&&(K=this._coreBrowserService.isFocused?y.selectionBackgroundOpaque:y.selectionInactiveBackgroundOpaque,V=K.rgba>>8&16777215,$=50331648,G=!0,y.selectionForeground&&(U=50331648,W=y.selectionForeground.rgba>>8&16777215,Y=y.selectionForeground)),G&&T.push("xterm-decoration-top"),$){case 16777216:case 33554432:X=y.ansi[V],T.push("xterm-bg-".concat(V));break;case 50331648:X=c.rgba.toColor(V>>16,V>>8&255,255&V),this._addStyle(b,"background-color:#".concat(g((V>>>0).toString(16),"0",6)));break;default:q?(X=y.foreground,T.push("xterm-bg-".concat(o.INVERTED_DEFAULT_COLOR))):X=y.background}switch(K||j.isDim()&&(K=c.color.multiplyOpacity(X,.5)),U){case 16777216:case 33554432:j.isBold()&&W<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(W+=8),this._applyMinimumContrast(b,X,y.ansi[W],j,K,void 0)||T.push("xterm-fg-".concat(W));break;case 50331648:const e=c.rgba.toColor(W>>16&255,W>>8&255,255&W);this._applyMinimumContrast(b,X,e,j,K,Y)||this._addStyle(b,"color:#".concat(g(W.toString(16),"0",6)));break;default:this._applyMinimumContrast(b,X,y.foreground,j,K,void 0)||q&&T.push("xterm-fg-".concat(o.INVERTED_DEFAULT_COLOR))}T.length&&(b.className=T.join(" "),T.length=0),N||I||z?b.textContent=S:w++,P!==this.defaultSpacing&&(b.style.letterSpacing="".concat(P,"px")),m.push(b),O=A}return b&&w&&(b.textContent=S),m}_applyMinimumContrast(e,t,n,r,i,o){if(1===this._optionsService.rawOptions.minimumContrastRatio||(0,h.excludeFromContrastRatioDemands)(r.getCode()))return!1;const s=this._getContrastCache(r);let a;if(i||o||(a=s.getColor(t.rgba,n.rgba)),void 0===a){const e=this._optionsService.rawOptions.minimumContrastRatio/(r.isDim()?2:1);a=c.color.ensureContrastRatio(i||t,o||n,e),s.setColor((i||t).rgba,(o||n).rgba,null!=a?a:null)}return!!a&&(this._addStyle(e,"color:".concat(a.css)),!0)}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute("style","".concat(e.getAttribute("style")||"").concat(t,";"))}_isCellInSelection(e,t){const n=this._selectionStart,r=this._selectionEnd;return!(!n||!r)&&(this._columnSelectMode?n[0]<=r[0]?e>=n[0]&&t>=n[1]&&e<r[0]&&t<=r[1]:e<n[0]&&t>=n[1]&&e>=r[0]&&t<=r[1]:t>n[1]&&t<r[1]||n[1]===r[1]&&t===n[1]&&e>=n[0]&&e<r[0]||n[1]<r[1]&&t===r[1]&&e<r[0]||n[1]<r[1]&&t===n[1]&&e>=n[0])}};function g(e,t,n){for(;e.length<n;)e=t+e;return e}t.DomRendererRowFactory=p=r([i(1,u.ICharacterJoinerService),i(2,l.IOptionsService),i(3,u.ICoreBrowserService),i(4,l.ICoreService),i(5,l.IDecorationService),i(6,u.IThemeService)],p)},2550:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WidthCache=void 0,t.WidthCache=class{constructor(e){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=e.createElement("div"),this._container.style.position="absolute",this._container.style.top="-50000px",this._container.style.width="50000px",this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";const t=e.createElement("span"),n=e.createElement("span");n.style.fontWeight="bold";const r=e.createElement("span");r.style.fontStyle="italic";const i=e.createElement("span");i.style.fontWeight="bold",i.style.fontStyle="italic",this._measureElements=[t,n,r,i],this._container.appendChild(t),this._container.appendChild(n),this._container.appendChild(r),this._container.appendChild(i),e.body.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(e,t,n,r){e===this._font&&t===this._fontSize&&n===this._weight&&r===this._weightBold||(this._font=e,this._fontSize=t,this._weight=n,this._weightBold=r,this._container.style.fontFamily=this._font,this._container.style.fontSize="".concat(this._fontSize,"px"),this._measureElements[0].style.fontWeight="".concat(n),this._measureElements[1].style.fontWeight="".concat(r),this._measureElements[2].style.fontWeight="".concat(n),this._measureElements[3].style.fontWeight="".concat(r),this.clear())}get(e,t,n){let r=0;if(!t&&!n&&1===e.length&&(r=e.charCodeAt(0))<256)return-9999!==this._flat[r]?this._flat[r]:this._flat[r]=this._measure(e,0);let i=e;t&&(i+="B"),n&&(i+="I");let o=this._holey.get(i);if(void 0===o){let r=0;t&&(r|=1),n&&(r|=2),o=this._measure(e,r),this._holey.set(i,o)}return o}_measure(e,t){const n=this._measureElements[t];return n.textContent=e.repeat(32),n.offsetWidth/32}}},2223:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TEXT_BASELINE=t.DIM_OPACITY=t.INVERTED_DEFAULT_COLOR=void 0;const r=n(6114);t.INVERTED_DEFAULT_COLOR=257,t.DIM_OPACITY=.5,t.TEXT_BASELINE=r.isFirefox||r.isLegacyEdge?"bottom":"ideographic"},6171:(e,t)=>{function n(e){return 57508<=e&&e<=57558}Object.defineProperty(t,"__esModule",{value:!0}),t.createRenderDimensions=t.excludeFromContrastRatioDemands=t.isRestrictedPowerlineGlyph=t.isPowerlineGlyph=t.throwIfFalsy=void 0,t.throwIfFalsy=function(e){if(!e)throw new Error("value must not be falsy");return e},t.isPowerlineGlyph=n,t.isRestrictedPowerlineGlyph=function(e){return 57520<=e&&e<=57527},t.excludeFromContrastRatioDemands=function(e){return n(e)||function(e){return 9472<=e&&e<=9631}(e)},t.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}}},456:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SelectionModel=void 0,t.SelectionModel=class{constructor(e){this._bufferService=e,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:this.selectionEnd&&this.selectionStart&&this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){const e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?e%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)-1]:[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){const e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[Math.max(e,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){const e=this.selectionStart,t=this.selectionEnd;return!(!e||!t)&&(e[1]>t[1]||e[1]===t[1]&&e[0]>t[0])}handleTrim(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,o=arguments.length,s=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,n,s):i(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CharSizeService=void 0;const o=n(2585),s=n(8460),a=n(844);let l=t.CharSizeService=class extends a.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(e,t,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this.register(new s.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event,this._measureStrategy=new c(e,t,this._optionsService),this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],()=>this.measure()))}measure(){const e=this._measureStrategy.measure();e.width===this.width&&e.height===this.height||(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};t.CharSizeService=l=r([i(2,o.IOptionsService)],l);class c{constructor(e,t,n){this._document=e,this._parentElement=t,this._optionsService=n,this._result={width:0,height:0},this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize="".concat(this._optionsService.rawOptions.fontSize,"px");const e={height:Number(this._measureElement.offsetHeight),width:Number(this._measureElement.offsetWidth)};return 0!==e.width&&0!==e.height&&(this._result.width=e.width/32,this._result.height=Math.ceil(e.height)),this._result}}},4269:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,o=arguments.length,s=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,n,s):i(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CharacterJoinerService=t.JoinedCellData=void 0;const o=n(3734),s=n(643),a=n(511),l=n(2585);class c extends o.AttributeData{constructor(e,t,n){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=n}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}t.JoinedCellData=c;let u=t.CharacterJoinerService=class e{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new a.CellData}register(e){const t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1}getJoinedCharacters(e){if(0===this._characterJoiners.length)return[];const t=this._bufferService.buffer.lines.get(e);if(!t||0===t.length)return[];const n=[],r=t.translateToString(!0);let i=0,o=0,a=0,l=t.getFg(0),c=t.getBg(0);for(let u=0;u<t.getTrimmedLength();u++)if(t.loadCell(u,this._workCell),0!==this._workCell.getWidth()){if(this._workCell.fg!==l||this._workCell.bg!==c){if(u-i>1){const e=this._getJoinedRanges(r,a,o,t,i);for(let t=0;t<e.length;t++)n.push(e[t])}i=u,a=o,l=this._workCell.fg,c=this._workCell.bg}o+=this._workCell.getChars().length||s.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-i>1){const e=this._getJoinedRanges(r,a,o,t,i);for(let t=0;t<e.length;t++)n.push(e[t])}return n}_getJoinedRanges(t,n,r,i,o){const s=t.substring(n,r);let a=[];try{a=this._characterJoiners[0].handler(s)}catch(e){console.error(e)}for(let l=1;l<this._characterJoiners.length;l++)try{const t=this._characterJoiners[l].handler(s);for(let n=0;n<t.length;n++)e._mergeRanges(a,t[n])}catch(e){console.error(e)}return this._stringRangesToCellRanges(a,i,o),a}_stringRangesToCellRanges(e,t,n){let r=0,i=!1,o=0,a=e[r];if(a){for(let l=n;l<this._bufferService.cols;l++){const n=t.getWidth(l),c=t.getString(l).length||s.WHITESPACE_CELL_CHAR.length;if(0!==n){if(!i&&a[0]<=o&&(a[0]=l,i=!0),a[1]<=o){if(a[1]=l,a=e[++r],!a)break;a[0]<=o?(a[0]=l,i=!0):i=!1}o+=c}}a&&(a[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let n=!1;for(let r=0;r<e.length;r++){const i=e[r];if(n){if(t[1]<=i[0])return e[r-1][1]=t[1],e;if(t[1]<=i[1])return e[r-1][1]=Math.max(t[1],i[1]),e.splice(r,1),e;e.splice(r,1),r--}else{if(t[1]<=i[0])return e.splice(r,0,t),e;if(t[1]<=i[1])return i[0]=Math.min(t[0],i[0]),e;t[0]<i[1]&&(i[0]=Math.min(t[0],i[0]),n=!0)}}return n?e[e.length-1][1]=t[1]:e.push(t),e}};t.CharacterJoinerService=u=r([i(0,l.IBufferService)],u)},5114:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CoreBrowserService=void 0,t.CoreBrowserService=class{constructor(e,t){this._textarea=e,this.window=t,this._isFocused=!1,this._cachedIsFocused=void 0,this._textarea.addEventListener("focus",()=>this._isFocused=!0),this._textarea.addEventListener("blur",()=>this._isFocused=!1)}get dpr(){return this.window.devicePixelRatio}get isFocused(){return void 0===this._cachedIsFocused&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}}},8934:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,o=arguments.length,s=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,n,s):i(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.MouseService=void 0;const o=n(4725),s=n(9806);let a=t.MouseService=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,n,r,i){return(0,s.getCoords)(window,e,t,n,r,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,i)}getMouseReportCoords(e,t){const n=(0,s.getCoordsRelativeToElement)(window,e,t);if(this._charSizeService.hasValidSize)return n[0]=Math.min(Math.max(n[0],0),this._renderService.dimensions.css.canvas.width-1),n[1]=Math.min(Math.max(n[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(n[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(n[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(n[0]),y:Math.floor(n[1])}}};t.MouseService=a=r([i(0,o.IRenderService),i(1,o.ICharSizeService)],a)},3230:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,o=arguments.length,s=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,n,s):i(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.RenderService=void 0;const o=n(3656),s=n(6193),a=n(5596),l=n(4725),c=n(8460),u=n(844),d=n(7226),h=n(2585);let f=t.RenderService=class extends u.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(e,t,n,r,i,l,h,f){if(super(),this._rowCount=e,this._charSizeService=r,this._renderer=this.register(new u.MutableDisposable),this._pausedResizeTask=new d.DebouncedIdleTask,this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this.register(new c.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new c.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new c.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new c.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new s.RenderDebouncer(h.window,(e,t)=>this._renderRows(e,t)),this.register(this._renderDebouncer),this._screenDprMonitor=new a.ScreenDprMonitor(h.window),this._screenDprMonitor.setListener(()=>this.handleDevicePixelRatioChange()),this.register(this._screenDprMonitor),this.register(l.onResize(()=>this._fullRefresh())),this.register(l.buffers.onBufferActivate(()=>{var e;return null===(e=this._renderer.value)||void 0===e?void 0:e.clear()})),this.register(n.onOptionChange(()=>this._handleOptionsChanged())),this.register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this.register(i.onDecorationRegistered(()=>this._fullRefresh())),this.register(i.onDecorationRemoved(()=>this._fullRefresh())),this.register(n.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio"],()=>{this.clear(),this.handleResize(l.cols,l.rows),this._fullRefresh()})),this.register(n.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(l.buffer.y,l.buffer.y,!0))),this.register((0,o.addDisposableDomListener)(h.window,"resize",()=>this.handleDevicePixelRatioChange())),this.register(f.onChangeColors(()=>this._fullRefresh())),"IntersectionObserver"in h.window){const e=new h.window.IntersectionObserver(e=>this._handleIntersectionChange(e[e.length-1]),{threshold:0});e.observe(t),this.register({dispose:()=>e.disconnect()})}}_handleIntersectionChange(e){this._isPaused=void 0===e.isIntersecting?0===e.intersectionRatio:!e.isIntersecting,this._isPaused||this._charSizeService.hasValidSize||this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this._isPaused?this._needsFullRefresh=!0:(n||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount))}_renderRows(e,t){this._renderer.value&&(e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0)}resize(e,t){this._rowCount=t,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value.onRequestRedraw(e=>this.refreshRows(e.start,e.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh()}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var e,t;this._renderer.value&&(null===(t=(e=this._renderer.value).clearTextureAtlas)||void 0===t||t.call(e),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>this._renderer.value.handleResize(e,t)):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){var e;null===(e=this._renderer.value)||void 0===e||e.handleCharSizeChanged()}handleBlur(){var e;null===(e=this._renderer.value)||void 0===e||e.handleBlur()}handleFocus(){var e;null===(e=this._renderer.value)||void 0===e||e.handleFocus()}handleSelectionChanged(e,t,n){var r;this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=n,null===(r=this._renderer.value)||void 0===r||r.handleSelectionChanged(e,t,n)}handleCursorMove(){var e;null===(e=this._renderer.value)||void 0===e||e.handleCursorMove()}clear(){var e;null===(e=this._renderer.value)||void 0===e||e.clear()}};t.RenderService=f=r([i(2,h.IOptionsService),i(3,l.ICharSizeService),i(4,h.IDecorationService),i(5,h.IBufferService),i(6,l.ICoreBrowserService),i(7,l.IThemeService)],f)},9312:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,o=arguments.length,s=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,n,s):i(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.SelectionService=void 0;const o=n(9806),s=n(9504),a=n(456),l=n(4725),c=n(8460),u=n(844),d=n(6114),h=n(4841),f=n(511),p=n(2585),g=String.fromCharCode(160),v=new RegExp(g,"g");let m=t.SelectionService=class extends u.Disposable{constructor(e,t,n,r,i,o,s,l,d){super(),this._element=e,this._screenElement=t,this._linkifier=n,this._bufferService=r,this._coreService=i,this._mouseService=o,this._optionsService=s,this._renderService=l,this._coreBrowserService=d,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new f.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new c.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new c.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new c.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new c.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=e=>this._handleMouseMove(e),this._mouseUpListener=e=>this._handleMouseUp(e),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(e=>this._handleTrim(e)),this.register(this._bufferService.buffers.onBufferActivate(e=>this._handleBufferActivate(e))),this.enable(),this._model=new a.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,u.toDisposable)(()=>{this._removeMouseDownListeners()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){const e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!(!e||!t||e[0]===t[0]&&e[1]===t[1])}get selectionText(){const e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return"";const n=this._bufferService.buffer,r=[];if(3===this._activeSelectionMode){if(e[0]===t[0])return"";const i=e[0]<t[0]?e[0]:t[0],o=e[0]<t[0]?t[0]:e[0];for(let s=e[1];s<=t[1];s++){const e=n.translateBufferLineToString(s,!0,i,o);r.push(e)}}else{const i=e[1]===t[1]?t[0]:void 0;r.push(n.translateBufferLineToString(e[1],!0,e[0],i));for(let o=e[1]+1;o<=t[1]-1;o++){const e=n.lines.get(o),t=n.translateBufferLineToString(o,!0);(null==e?void 0:e.isWrapped)?r[r.length-1]+=t:r.push(t)}if(e[1]!==t[1]){const e=n.lines.get(t[1]),i=n.translateBufferLineToString(t[1],!0,0,t[0]);e&&e.isWrapped?r[r.length-1]+=i:r.push(i)}}return r.map(e=>e.replace(v," ")).join(d.isWindows?"\r\n":"\n")}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),d.isLinux&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:3===this._activeSelectionMode})}_isClickInSelection(e){const t=this._getMouseBufferCoords(e),n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!!(n&&r&&t)&&this._areCoordsInSelection(t,n,r)}isCellInSelection(e,t){const n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!(!n||!r)&&this._areCoordsInSelection([e,t],n,r)}_areCoordsInSelection(e,t,n){return e[1]>t[1]&&e[1]<n[1]||t[1]===n[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<n[0]||t[1]<n[1]&&e[1]===n[1]&&e[0]<n[0]||t[1]<n[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){var n,r;const i=null===(r=null===(n=this._linkifier.currentLink)||void 0===n?void 0:n.link)||void 0===r?void 0:r.range;if(i)return this._model.selectionStart=[i.start.x-1,i.start.y-1],this._model.selectionStartLength=(0,h.getRangeLength)(i,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const o=this._getMouseBufferCoords(e);return!!o&&(this._selectWordAt(o,t),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){const t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=(0,o.getCoordsRelativeToElement)(this._coreBrowserService.window,e,this._screenElement)[1];const n=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=n?0:(t>n&&(t-=n),t=Math.min(Math.max(t,-50),50),t/=50,t/Math.abs(t)+Math.round(14*t))}shouldForceSelection(e){return d.isMac?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,(2!==e.button||!this.hasSelection)&&0===e.button){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):1===e.detail?this._handleSingleClick(e):2===e.detail?this._handleDoubleClick(e):3===e.detail&&this._handleTripleClick(e),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),50)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const t=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);t&&t.length!==this._model.selectionStart[0]&&0===t.hasWidth(this._model.selectionStart[0])&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){const t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))}shouldColumnSelect(e){return e.altKey&&!(d.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;const t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd)return void this.refresh(!0);2===this._activeSelectionMode?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:1===this._activeSelectionMode&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(e),3!==this._activeSelectionMode&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const n=this._bufferService.buffer;if(this._model.selectionEnd[1]<n.lines.length){const e=n.lines.get(this._model.selectionEnd[1]);e&&0===e.hasWidth(this._model.selectionEnd[0])&&this._model.selectionEnd[0]++}t&&t[0]===this._model.selectionEnd[0]&&t[1]===this._model.selectionEnd[1]||this.refresh(!0)}_dragScroll(){if(this._model.selectionEnd&&this._model.selectionStart&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});const e=this._bufferService.buffer;this._dragScrollAmount>0?(3!==this._activeSelectionMode&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(3!==this._activeSelectionMode&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){const t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&t<500&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const t=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(t&&void 0!==t[0]&&void 0!==t[1]){const e=(0,s.moveToCellSequence)(t[0]-1,t[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(e,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,n=!(!e||!t||e[0]===t[0]&&e[1]===t[1]);n?e&&t&&(this._oldSelectionStart&&this._oldSelectionEnd&&e[0]===this._oldSelectionStart[0]&&e[1]===this._oldSelectionStart[1]&&t[0]===this._oldSelectionEnd[0]&&t[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(e,t,n)):this._oldHasSelection&&this._fireOnSelectionChange(e,t,n)}_fireOnSelectionChange(e,t,n){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=n,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(e=>this._handleTrim(e))}_convertViewportColToCharacterIndex(e,t){let n=t;for(let r=0;t>=r;r++){const i=e.loadCell(r,this._workCell).getChars().length;0===this._workCell.getWidth()?n--:i>1&&t!==r&&(n+=i-1)}return n}setSelection(e,t,n){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=n,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t){let n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];if(e[0]>=this._bufferService.cols)return;const i=this._bufferService.buffer,o=i.lines.get(e[1]);if(!o)return;const s=i.translateBufferLineToString(e[1],!1);let a=this._convertViewportColToCharacterIndex(o,e[0]),l=a;const c=e[0]-a;let u=0,d=0,h=0,f=0;if(" "===s.charAt(a)){for(;a>0&&" "===s.charAt(a-1);)a--;for(;l<s.length&&" "===s.charAt(l+1);)l++}else{let t=e[0],n=e[0];0===o.getWidth(t)&&(u++,t--),2===o.getWidth(n)&&(d++,n++);const r=o.getString(n).length;for(r>1&&(f+=r-1,l+=r-1);t>0&&a>0&&!this._isCharWordSeparator(o.loadCell(t-1,this._workCell));){o.loadCell(t-1,this._workCell);const e=this._workCell.getChars().length;0===this._workCell.getWidth()?(u++,t--):e>1&&(h+=e-1,a-=e-1),a--,t--}for(;n<o.length&&l+1<s.length&&!this._isCharWordSeparator(o.loadCell(n+1,this._workCell));){o.loadCell(n+1,this._workCell);const e=this._workCell.getChars().length;2===this._workCell.getWidth()?(d++,n++):e>1&&(f+=e-1,l+=e-1),l++,n++}}l++;let p=a+c-u+h,g=Math.min(this._bufferService.cols,l-a+u+d-h-f);if(t||""!==s.slice(a,l).trim()){if(n&&0===p&&32!==o.getCodePoint(0)){const t=i.lines.get(e[1]-1);if(t&&o.isWrapped&&32!==t.getCodePoint(this._bufferService.cols-1)){const t=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(t){const e=this._bufferService.cols-t.start;p-=e,g+=e}}}if(r&&p+g===this._bufferService.cols&&32!==o.getCodePoint(this._bufferService.cols-1)){const t=i.lines.get(e[1]+1);if((null==t?void 0:t.isWrapped)&&32!==t.getCodePoint(0)){const t=this._getWordAt([0,e[1]+1],!1,!1,!0);t&&(g+=t.length)}}return{start:p,length:g}}}_selectWordAt(e,t){const n=this._getWordAt(e,t);if(n){for(;n.start<0;)n.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[n.start,e[1]],this._model.selectionStartLength=n.length}}_selectToWordAt(e){const t=this._getWordAt(e,!0);if(t){let n=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,n--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,n++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,n]}}_isCharWordSeparator(e){return 0!==e.getWidth()&&this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){const t=this._bufferService.buffer.getWrappedRangeForLine(e),n={start:{x:0,y:t.first},end:{x:this._bufferService.cols-1,y:t.last}};this._model.selectionStart=[0,t.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,h.getRangeLength)(n,this._bufferService.cols)}};t.SelectionService=m=r([i(3,p.IBufferService),i(4,p.ICoreService),i(5,l.IMouseService),i(6,p.IOptionsService),i(7,l.IRenderService),i(8,l.ICoreBrowserService)],m)},4725:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.IThemeService=t.ICharacterJoinerService=t.ISelectionService=t.IRenderService=t.IMouseService=t.ICoreBrowserService=t.ICharSizeService=void 0;const r=n(8343);t.ICharSizeService=(0,r.createDecorator)("CharSizeService"),t.ICoreBrowserService=(0,r.createDecorator)("CoreBrowserService"),t.IMouseService=(0,r.createDecorator)("MouseService"),t.IRenderService=(0,r.createDecorator)("RenderService"),t.ISelectionService=(0,r.createDecorator)("SelectionService"),t.ICharacterJoinerService=(0,r.createDecorator)("CharacterJoinerService"),t.IThemeService=(0,r.createDecorator)("ThemeService")},6731:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,o=arguments.length,s=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,n,s):i(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.ThemeService=t.DEFAULT_ANSI_COLORS=void 0;const o=n(7239),s=n(8055),a=n(8460),l=n(844),c=n(2585),u=s.css.toColor("#ffffff"),d=s.css.toColor("#000000"),h=s.css.toColor("#ffffff"),f=s.css.toColor("#000000"),p={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};t.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const e=[s.css.toColor("#2e3436"),s.css.toColor("#cc0000"),s.css.toColor("#4e9a06"),s.css.toColor("#c4a000"),s.css.toColor("#3465a4"),s.css.toColor("#75507b"),s.css.toColor("#06989a"),s.css.toColor("#d3d7cf"),s.css.toColor("#555753"),s.css.toColor("#ef2929"),s.css.toColor("#8ae234"),s.css.toColor("#fce94f"),s.css.toColor("#729fcf"),s.css.toColor("#ad7fa8"),s.css.toColor("#34e2e2"),s.css.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let n=0;n<216;n++){const r=t[n/36%6|0],i=t[n/6%6|0],o=t[n%6];e.push({css:s.channels.toCss(r,i,o),rgba:s.channels.toRgba(r,i,o)})}for(let n=0;n<24;n++){const t=8+10*n;e.push({css:s.channels.toCss(t,t,t),rgba:s.channels.toRgba(t,t,t)})}return e})());let g=t.ThemeService=class extends l.Disposable{get colors(){return this._colors}constructor(e){super(),this._optionsService=e,this._contrastCache=new o.ColorContrastCache,this._halfContrastCache=new o.ColorContrastCache,this._onChangeColors=this.register(new a.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:u,background:d,cursor:h,cursorAccent:f,selectionForeground:void 0,selectionBackgroundTransparent:p,selectionBackgroundOpaque:s.color.blend(d,p),selectionInactiveBackgroundTransparent:p,selectionInactiveBackgroundOpaque:s.color.blend(d,p),ansi:t.DEFAULT_ANSI_COLORS.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this.register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",()=>this._contrastCache.clear())),this.register(this._optionsService.onSpecificOptionChange("theme",()=>this._setTheme(this._optionsService.rawOptions.theme)))}_setTheme(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=this._colors;if(n.foreground=v(e.foreground,u),n.background=v(e.background,d),n.cursor=v(e.cursor,h),n.cursorAccent=v(e.cursorAccent,f),n.selectionBackgroundTransparent=v(e.selectionBackground,p),n.selectionBackgroundOpaque=s.color.blend(n.background,n.selectionBackgroundTransparent),n.selectionInactiveBackgroundTransparent=v(e.selectionInactiveBackground,n.selectionBackgroundTransparent),n.selectionInactiveBackgroundOpaque=s.color.blend(n.background,n.selectionInactiveBackgroundTransparent),n.selectionForeground=e.selectionForeground?v(e.selectionForeground,s.NULL_COLOR):void 0,n.selectionForeground===s.NULL_COLOR&&(n.selectionForeground=void 0),s.color.isOpaque(n.selectionBackgroundTransparent)){const e=.3;n.selectionBackgroundTransparent=s.color.opacity(n.selectionBackgroundTransparent,e)}if(s.color.isOpaque(n.selectionInactiveBackgroundTransparent)){const e=.3;n.selectionInactiveBackgroundTransparent=s.color.opacity(n.selectionInactiveBackgroundTransparent,e)}if(n.ansi=t.DEFAULT_ANSI_COLORS.slice(),n.ansi[0]=v(e.black,t.DEFAULT_ANSI_COLORS[0]),n.ansi[1]=v(e.red,t.DEFAULT_ANSI_COLORS[1]),n.ansi[2]=v(e.green,t.DEFAULT_ANSI_COLORS[2]),n.ansi[3]=v(e.yellow,t.DEFAULT_ANSI_COLORS[3]),n.ansi[4]=v(e.blue,t.DEFAULT_ANSI_COLORS[4]),n.ansi[5]=v(e.magenta,t.DEFAULT_ANSI_COLORS[5]),n.ansi[6]=v(e.cyan,t.DEFAULT_ANSI_COLORS[6]),n.ansi[7]=v(e.white,t.DEFAULT_ANSI_COLORS[7]),n.ansi[8]=v(e.brightBlack,t.DEFAULT_ANSI_COLORS[8]),n.ansi[9]=v(e.brightRed,t.DEFAULT_ANSI_COLORS[9]),n.ansi[10]=v(e.brightGreen,t.DEFAULT_ANSI_COLORS[10]),n.ansi[11]=v(e.brightYellow,t.DEFAULT_ANSI_COLORS[11]),n.ansi[12]=v(e.brightBlue,t.DEFAULT_ANSI_COLORS[12]),n.ansi[13]=v(e.brightMagenta,t.DEFAULT_ANSI_COLORS[13]),n.ansi[14]=v(e.brightCyan,t.DEFAULT_ANSI_COLORS[14]),n.ansi[15]=v(e.brightWhite,t.DEFAULT_ANSI_COLORS[15]),e.extendedAnsi){const r=Math.min(n.ansi.length-16,e.extendedAnsi.length);for(let i=0;i<r;i++)n.ansi[i+16]=v(e.extendedAnsi[i],t.DEFAULT_ANSI_COLORS[i+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(e){this._restoreColor(e),this._onChangeColors.fire(this.colors)}_restoreColor(e){if(void 0!==e)switch(e){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[e]=this._restoreColors.ansi[e]}else for(let t=0;t<this._restoreColors.ansi.length;++t)this._colors.ansi[t]=this._restoreColors.ansi[t]}modifyColors(e){e(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};function v(e,t){if(void 0!==e)try{return s.css.toColor(e)}catch(e){}return t}t.ThemeService=g=r([i(0,c.IOptionsService)],g)},6349:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CircularList=void 0;const r=n(8460),i=n(844);class o extends i.Disposable{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this.register(new r.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new r.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new r.EventEmitter),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;const t=new Array(e);for(let n=0;n<Math.min(e,this.length);n++)t[n]=this._array[this._getCyclicIndex(n)];this._array=t,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let t=this._length;t<e;t++)this._array[t]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,t){this._array[this._getCyclicIndex(e)]=t}push(e){this._array[this._getCyclicIndex(this._length)]=e,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(e,t){if(t){for(let n=e;n<this._length-t;n++)this._array[this._getCyclicIndex(n)]=this._array[this._getCyclicIndex(n+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let n=this._length-1;n>=e;n--)this._array[this._getCyclicIndex(n+(arguments.length<=2?0:arguments.length-2))]=this._array[this._getCyclicIndex(n)];for(let n=0;n<(arguments.length<=2?0:arguments.length-2);n++)this._array[this._getCyclicIndex(e+n)]=n+2<2||arguments.length<=n+2?void 0:arguments[n+2];if((arguments.length<=2?0:arguments.length-2)&&this.onInsertEmitter.fire({index:e,amount:arguments.length<=2?0:arguments.length-2}),this._length+(arguments.length<=2?0:arguments.length-2)>this._maxLength){const e=this._length+(arguments.length<=2?0:arguments.length-2)-this._maxLength;this._startIndex+=e,this._length=this._maxLength,this.onTrimEmitter.fire(e)}else this._length+=arguments.length<=2?0:arguments.length-2}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,n){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+n<0)throw new Error("Cannot shift elements in list beyond index 0");if(n>0){for(let i=t-1;i>=0;i--)this.set(e+i+n,this.get(e+i));const r=e+t+n-this._length;if(r>0)for(this._length+=r;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let r=0;r<t;r++)this.set(e+r+n,this.get(e+r))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}}t.CircularList=o},1439:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.clone=void 0,t.clone=function e(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5;if("object"!=typeof t)return t;const r=Array.isArray(t)?[]:{};for(const i in t)r[i]=n<=1?t[i]:t[i]&&e(t[i],n-1);return r}},8055:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.contrastRatio=t.toPaddedHex=t.rgba=t.rgb=t.css=t.color=t.channels=t.NULL_COLOR=void 0;const r=n(6114);let i=0,o=0,s=0,a=0;var l,c,u,d,h;function f(e){const t=e.toString(16);return t.length<2?"0"+t:t}function p(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}t.NULL_COLOR={css:"#00000000",rgba:0},function(e){e.toCss=function(e,t,n,r){return void 0!==r?"#".concat(f(e)).concat(f(t)).concat(f(n)).concat(f(r)):"#".concat(f(e)).concat(f(t)).concat(f(n))},e.toRgba=function(e,t,n){return(e<<24|t<<16|n<<8|(arguments.length>3&&void 0!==arguments[3]?arguments[3]:255))>>>0}}(l||(t.channels=l={})),function(e){function t(e,t){return a=Math.round(255*t),[i,o,s]=h.toChannels(e.rgba),{css:l.toCss(i,o,s,a),rgba:l.toRgba(i,o,s,a)}}e.blend=function(e,t){if(a=(255&t.rgba)/255,1===a)return{css:t.css,rgba:t.rgba};const n=t.rgba>>24&255,r=t.rgba>>16&255,c=t.rgba>>8&255,u=e.rgba>>24&255,d=e.rgba>>16&255,h=e.rgba>>8&255;return i=u+Math.round((n-u)*a),o=d+Math.round((r-d)*a),s=h+Math.round((c-h)*a),{css:l.toCss(i,o,s),rgba:l.toRgba(i,o,s)}},e.isOpaque=function(e){return 255==(255&e.rgba)},e.ensureContrastRatio=function(e,t,n){const r=h.ensureContrastRatio(e.rgba,t.rgba,n);if(r)return h.toColor(r>>24&255,r>>16&255,r>>8&255)},e.opaque=function(e){const t=(255|e.rgba)>>>0;return[i,o,s]=h.toChannels(t),{css:l.toCss(i,o,s),rgba:t}},e.opacity=t,e.multiplyOpacity=function(e,n){return a=255&e.rgba,t(e,a*n/255)},e.toColorRGB=function(e){return[e.rgba>>24&255,e.rgba>>16&255,e.rgba>>8&255]}}(c||(t.color=c={})),function(e){let t,n;if(!r.isNode){const e=document.createElement("canvas");e.width=1,e.height=1;const r=e.getContext("2d",{willReadFrequently:!0});r&&(t=r,t.globalCompositeOperation="copy",n=t.createLinearGradient(0,0,1,1))}e.toColor=function(e){if(e.match(/#[\da-f]{3,8}/i))switch(e.length){case 4:return i=parseInt(e.slice(1,2).repeat(2),16),o=parseInt(e.slice(2,3).repeat(2),16),s=parseInt(e.slice(3,4).repeat(2),16),h.toColor(i,o,s);case 5:return i=parseInt(e.slice(1,2).repeat(2),16),o=parseInt(e.slice(2,3).repeat(2),16),s=parseInt(e.slice(3,4).repeat(2),16),a=parseInt(e.slice(4,5).repeat(2),16),h.toColor(i,o,s,a);case 7:return{css:e,rgba:(parseInt(e.slice(1),16)<<8|255)>>>0};case 9:return{css:e,rgba:parseInt(e.slice(1),16)>>>0}}const r=e.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(r)return i=parseInt(r[1]),o=parseInt(r[2]),s=parseInt(r[3]),a=Math.round(255*(void 0===r[5]?1:parseFloat(r[5]))),h.toColor(i,o,s,a);if(!t||!n)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=n,t.fillStyle=e,"string"!=typeof t.fillStyle)throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[i,o,s,a]=t.getImageData(0,0,1,1).data,255!==a)throw new Error("css.toColor: Unsupported css format");return{rgba:l.toRgba(i,o,s,a),css:e}}}(u||(t.css=u={})),function(e){function t(e,t,n){const r=e/255,i=t/255,o=n/255;return.2126*(r<=.03928?r/12.92:Math.pow((r+.055)/1.055,2.4))+.7152*(i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4))+.0722*(o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4))}e.relativeLuminance=function(e){return t(e>>16&255,e>>8&255,255&e)},e.relativeLuminance2=t}(d||(t.rgb=d={})),function(e){function t(e,t,n){const r=e>>24&255,i=e>>16&255,o=e>>8&255;let s=t>>24&255,a=t>>16&255,l=t>>8&255,c=p(d.relativeLuminance2(s,a,l),d.relativeLuminance2(r,i,o));for(;c<n&&(s>0||a>0||l>0);)s-=Math.max(0,Math.ceil(.1*s)),a-=Math.max(0,Math.ceil(.1*a)),l-=Math.max(0,Math.ceil(.1*l)),c=p(d.relativeLuminance2(s,a,l),d.relativeLuminance2(r,i,o));return(s<<24|a<<16|l<<8|255)>>>0}function n(e,t,n){const r=e>>24&255,i=e>>16&255,o=e>>8&255;let s=t>>24&255,a=t>>16&255,l=t>>8&255,c=p(d.relativeLuminance2(s,a,l),d.relativeLuminance2(r,i,o));for(;c<n&&(s<255||a<255||l<255);)s=Math.min(255,s+Math.ceil(.1*(255-s))),a=Math.min(255,a+Math.ceil(.1*(255-a))),l=Math.min(255,l+Math.ceil(.1*(255-l))),c=p(d.relativeLuminance2(s,a,l),d.relativeLuminance2(r,i,o));return(s<<24|a<<16|l<<8|255)>>>0}e.ensureContrastRatio=function(e,r,i){const o=d.relativeLuminance(e>>8),s=d.relativeLuminance(r>>8);if(p(o,s)<i){if(s<o){const s=t(e,r,i),a=p(o,d.relativeLuminance(s>>8));if(a<i){const t=n(e,r,i);return a>p(o,d.relativeLuminance(t>>8))?s:t}return s}const a=n(e,r,i),l=p(o,d.relativeLuminance(a>>8));if(l<i){const n=t(e,r,i);return l>p(o,d.relativeLuminance(n>>8))?a:n}return a}},e.reduceLuminance=t,e.increaseLuminance=n,e.toChannels=function(e){return[e>>24&255,e>>16&255,e>>8&255,255&e]},e.toColor=function(e,t,n,r){return{css:l.toCss(e,t,n,r),rgba:l.toRgba(e,t,n,r)}}}(h||(t.rgba=h={})),t.toPaddedHex=f,t.contrastRatio=p},8969:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CoreTerminal=void 0;const r=n(844),i=n(2585),o=n(4348),s=n(7866),a=n(744),l=n(7302),c=n(6975),u=n(8460),d=n(1753),h=n(1480),f=n(7994),p=n(9282),g=n(5435),v=n(5981),m=n(2660);let _=!1;class y extends r.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new u.EventEmitter),this._onScroll.event(e=>{var t;null===(t=this._onScrollApi)||void 0===t||t.fire(e.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(e){for(const t in e)this.optionsService.options[t]=e[t]}constructor(e){super(),this._windowsWrappingHeuristics=this.register(new r.MutableDisposable),this._onBinary=this.register(new u.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new u.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new u.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new u.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new u.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new u.EventEmitter),this._instantiationService=new o.InstantiationService,this.optionsService=this.register(new l.OptionsService(e)),this._instantiationService.setService(i.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(a.BufferService)),this._instantiationService.setService(i.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(s.LogService)),this._instantiationService.setService(i.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(c.CoreService)),this._instantiationService.setService(i.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(d.CoreMouseService)),this._instantiationService.setService(i.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(h.UnicodeService)),this._instantiationService.setService(i.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(f.CharsetService),this._instantiationService.setService(i.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(m.OscLinkService),this._instantiationService.setService(i.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new g.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,u.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,u.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,u.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,u.forwardEvent)(this.coreService.onBinary,this._onBinary)),this.register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom())),this.register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this.register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],()=>this._handleWindowsPtyOptionChange())),this.register(this._bufferService.onScroll(e=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this.register(this._inputHandler.onScroll(e=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this.register(new v.WriteBuffer((e,t)=>this._inputHandler.parse(e,t))),this.register((0,u.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=i.LogLevelEnum.WARN&&!_&&(this._logService.warn("writeSync is unreliable and will be removed soon."),_=!0),this._writeBuffer.writeSync(e,t)}resize(e,t){isNaN(e)||isNaN(t)||(e=Math.max(e,a.MINIMUM_COLS),t=Math.max(t,a.MINIMUM_ROWS),this._bufferService.resize(e,t))}scroll(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this._bufferService.scroll(e,t)}scrollLines(e,t,n){this._bufferService.scrollLines(e,t,n)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){const t=e-this._bufferService.buffer.ydisp;0!==t&&this.scrollLines(t)}registerEscHandler(e,t){return this._inputHandler.registerEscHandler(e,t)}registerDcsHandler(e,t){return this._inputHandler.registerDcsHandler(e,t)}registerCsiHandler(e,t){return this._inputHandler.registerCsiHandler(e,t)}registerOscHandler(e,t){return this._inputHandler.registerOscHandler(e,t)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1;const t=this.optionsService.rawOptions.windowsPty;t&&void 0!==t.buildNumber&&void 0!==t.buildNumber?e=!!("conpty"===t.backend&&t.buildNumber<21376):this.optionsService.rawOptions.windowsMode&&(e=!0),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const e=[];e.push(this.onLineFeed(p.updateWindowsModeWrappedState.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>((0,p.updateWindowsModeWrappedState)(this._bufferService),!1))),this._windowsWrappingHeuristics.value=(0,r.toDisposable)(()=>{for(const t of e)t.dispose()})}}}t.CoreTerminal=y},8460:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.forwardEvent=t.EventEmitter=void 0,t.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=e=>(this._listeners.push(e),{dispose:()=>{if(!this._disposed)for(let t=0;t<this._listeners.length;t++)if(this._listeners[t]===e)return void this._listeners.splice(t,1)}})),this._event}fire(e,t){const n=[];for(let r=0;r<this._listeners.length;r++)n.push(this._listeners[r]);for(let r=0;r<n.length;r++)n[r].call(void 0,e,t)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},t.forwardEvent=function(e,t){return e(e=>t.fire(e))}},5435:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,o=arguments.length,s=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,n,s):i(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.InputHandler=t.WindowsOptionsReportType=void 0;const o=n(2584),s=n(7116),a=n(2015),l=n(844),c=n(482),u=n(8437),d=n(8460),h=n(643),f=n(511),p=n(3734),g=n(2585),v=n(6242),m=n(6351),_=n(5941),y={"(":0,")":1,"*":2,"+":3,"-":1,".":2},b=131072;function x(e,t){if(e>24)return t.setWinLines||!1;switch(e){case 1:return!!t.restoreWin;case 2:return!!t.minimizeWin;case 3:return!!t.setWinPosition;case 4:return!!t.setWinSizePixels;case 5:return!!t.raiseWin;case 6:return!!t.lowerWin;case 7:return!!t.refreshWin;case 8:return!!t.setWinSizeChars;case 9:return!!t.maximizeWin;case 10:return!!t.fullscreenWin;case 11:return!!t.getWinState;case 13:return!!t.getWinPosition;case 14:return!!t.getWinSizePixels;case 15:return!!t.getScreenSizePixels;case 16:return!!t.getCellSizePixels;case 18:return!!t.getWinSizeChars;case 19:return!!t.getScreenSizeChars;case 20:return!!t.getIconTitle;case 21:return!!t.getWinTitle;case 22:return!!t.pushTitle;case 23:return!!t.popTitle;case 24:return!!t.setWinLines}return!1}var w;!function(e){e[e.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",e[e.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"}(w||(t.WindowsOptionsReportType=w={}));let S=0;class C extends l.Disposable{getAttrData(){return this._curAttrData}constructor(e,t,n,r,i,l,h,p){let g=arguments.length>8&&void 0!==arguments[8]?arguments[8]:new a.EscapeSequenceParser;super(),this._bufferService=e,this._charsetService=t,this._coreService=n,this._logService=r,this._optionsService=i,this._oscLinkService=l,this._coreMouseService=h,this._unicodeService=p,this._parser=g,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new c.StringToUtf32,this._utf8Decoder=new c.Utf8ToUtf32,this._workCell=new f.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=u.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=u.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new d.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new d.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new d.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new d.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new d.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new d.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new d.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new d.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new d.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new d.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new d.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new d.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new d.EventEmitter),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this.register(this._parser),this._dirtyRowTracker=new k(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate(e=>this._activeBuffer=e.activeBuffer)),this._parser.setCsiHandlerFallback((e,t)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(e),params:t.toArray()})}),this._parser.setEscHandlerFallback(e=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(e)})}),this._parser.setExecuteHandlerFallback(e=>{this._logService.debug("Unknown EXECUTE code: ",{code:e})}),this._parser.setOscHandlerFallback((e,t,n)=>{this._logService.debug("Unknown OSC code: ",{identifier:e,action:t,data:n})}),this._parser.setDcsHandlerFallback((e,t,n)=>{"HOOK"===t&&(n=n.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(e),action:t,payload:n})}),this._parser.setPrintHandler((e,t,n)=>this.print(e,t,n)),this._parser.registerCsiHandler({final:"@"},e=>this.insertChars(e)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},e=>this.scrollLeft(e)),this._parser.registerCsiHandler({final:"A"},e=>this.cursorUp(e)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},e=>this.scrollRight(e)),this._parser.registerCsiHandler({final:"B"},e=>this.cursorDown(e)),this._parser.registerCsiHandler({final:"C"},e=>this.cursorForward(e)),this._parser.registerCsiHandler({final:"D"},e=>this.cursorBackward(e)),this._parser.registerCsiHandler({final:"E"},e=>this.cursorNextLine(e)),this._parser.registerCsiHandler({final:"F"},e=>this.cursorPrecedingLine(e)),this._parser.registerCsiHandler({final:"G"},e=>this.cursorCharAbsolute(e)),this._parser.registerCsiHandler({final:"H"},e=>this.cursorPosition(e)),this._parser.registerCsiHandler({final:"I"},e=>this.cursorForwardTab(e)),this._parser.registerCsiHandler({final:"J"},e=>this.eraseInDisplay(e,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},e=>this.eraseInDisplay(e,!0)),this._parser.registerCsiHandler({final:"K"},e=>this.eraseInLine(e,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},e=>this.eraseInLine(e,!0)),this._parser.registerCsiHandler({final:"L"},e=>this.insertLines(e)),this._parser.registerCsiHandler({final:"M"},e=>this.deleteLines(e)),this._parser.registerCsiHandler({final:"P"},e=>this.deleteChars(e)),this._parser.registerCsiHandler({final:"S"},e=>this.scrollUp(e)),this._parser.registerCsiHandler({final:"T"},e=>this.scrollDown(e)),this._parser.registerCsiHandler({final:"X"},e=>this.eraseChars(e)),this._parser.registerCsiHandler({final:"Z"},e=>this.cursorBackwardTab(e)),this._parser.registerCsiHandler({final:"`"},e=>this.charPosAbsolute(e)),this._parser.registerCsiHandler({final:"a"},e=>this.hPositionRelative(e)),this._parser.registerCsiHandler({final:"b"},e=>this.repeatPrecedingCharacter(e)),this._parser.registerCsiHandler({final:"c"},e=>this.sendDeviceAttributesPrimary(e)),this._parser.registerCsiHandler({prefix:">",final:"c"},e=>this.sendDeviceAttributesSecondary(e)),this._parser.registerCsiHandler({final:"d"},e=>this.linePosAbsolute(e)),this._parser.registerCsiHandler({final:"e"},e=>this.vPositionRelative(e)),this._parser.registerCsiHandler({final:"f"},e=>this.hVPosition(e)),this._parser.registerCsiHandler({final:"g"},e=>this.tabClear(e)),this._parser.registerCsiHandler({final:"h"},e=>this.setMode(e)),this._parser.registerCsiHandler({prefix:"?",final:"h"},e=>this.setModePrivate(e)),this._parser.registerCsiHandler({final:"l"},e=>this.resetMode(e)),this._parser.registerCsiHandler({prefix:"?",final:"l"},e=>this.resetModePrivate(e)),this._parser.registerCsiHandler({final:"m"},e=>this.charAttributes(e)),this._parser.registerCsiHandler({final:"n"},e=>this.deviceStatus(e)),this._parser.registerCsiHandler({prefix:"?",final:"n"},e=>this.deviceStatusPrivate(e)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},e=>this.softReset(e)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},e=>this.setCursorStyle(e)),this._parser.registerCsiHandler({final:"r"},e=>this.setScrollRegion(e)),this._parser.registerCsiHandler({final:"s"},e=>this.saveCursor(e)),this._parser.registerCsiHandler({final:"t"},e=>this.windowOptions(e)),this._parser.registerCsiHandler({final:"u"},e=>this.restoreCursor(e)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},e=>this.insertColumns(e)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},e=>this.deleteColumns(e)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},e=>this.selectProtected(e)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},e=>this.requestMode(e,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},e=>this.requestMode(e,!1)),this._parser.setExecuteHandler(o.C0.BEL,()=>this.bell()),this._parser.setExecuteHandler(o.C0.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(o.C0.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(o.C0.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(o.C0.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(o.C0.BS,()=>this.backspace()),this._parser.setExecuteHandler(o.C0.HT,()=>this.tab()),this._parser.setExecuteHandler(o.C0.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(o.C0.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(o.C1.IND,()=>this.index()),this._parser.setExecuteHandler(o.C1.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(o.C1.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new v.OscHandler(e=>(this.setTitle(e),this.setIconName(e),!0))),this._parser.registerOscHandler(1,new v.OscHandler(e=>this.setIconName(e))),this._parser.registerOscHandler(2,new v.OscHandler(e=>this.setTitle(e))),this._parser.registerOscHandler(4,new v.OscHandler(e=>this.setOrReportIndexedColor(e))),this._parser.registerOscHandler(8,new v.OscHandler(e=>this.setHyperlink(e))),this._parser.registerOscHandler(10,new v.OscHandler(e=>this.setOrReportFgColor(e))),this._parser.registerOscHandler(11,new v.OscHandler(e=>this.setOrReportBgColor(e))),this._parser.registerOscHandler(12,new v.OscHandler(e=>this.setOrReportCursorColor(e))),this._parser.registerOscHandler(104,new v.OscHandler(e=>this.restoreIndexedColor(e))),this._parser.registerOscHandler(110,new v.OscHandler(e=>this.restoreFgColor(e))),this._parser.registerOscHandler(111,new v.OscHandler(e=>this.restoreBgColor(e))),this._parser.registerOscHandler(112,new v.OscHandler(e=>this.restoreCursorColor(e))),this._parser.registerEscHandler({final:"7"},()=>this.saveCursor()),this._parser.registerEscHandler({final:"8"},()=>this.restoreCursor()),this._parser.registerEscHandler({final:"D"},()=>this.index()),this._parser.registerEscHandler({final:"E"},()=>this.nextLine()),this._parser.registerEscHandler({final:"H"},()=>this.tabSet()),this._parser.registerEscHandler({final:"M"},()=>this.reverseIndex()),this._parser.registerEscHandler({final:"="},()=>this.keypadApplicationMode()),this._parser.registerEscHandler({final:">"},()=>this.keypadNumericMode()),this._parser.registerEscHandler({final:"c"},()=>this.fullReset()),this._parser.registerEscHandler({final:"n"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"o"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"|"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"}"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"~"},()=>this.setgLevel(1)),this._parser.registerEscHandler({intermediates:"%",final:"@"},()=>this.selectDefaultCharset()),this._parser.registerEscHandler({intermediates:"%",final:"G"},()=>this.selectDefaultCharset());for(const o in s.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:o},()=>this.selectCharset("("+o)),this._parser.registerEscHandler({intermediates:")",final:o},()=>this.selectCharset(")"+o)),this._parser.registerEscHandler({intermediates:"*",final:o},()=>this.selectCharset("*"+o)),this._parser.registerEscHandler({intermediates:"+",final:o},()=>this.selectCharset("+"+o)),this._parser.registerEscHandler({intermediates:"-",final:o},()=>this.selectCharset("-"+o)),this._parser.registerEscHandler({intermediates:".",final:o},()=>this.selectCharset("."+o)),this._parser.registerEscHandler({intermediates:"/",final:o},()=>this.selectCharset("/"+o));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(e=>(this._logService.error("Parsing error: ",e),e)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new m.DcsHandler((e,t)=>this.requestStatusString(e,t)))}_preserveStack(e,t,n,r){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=n,this._parseStack.position=r}_logSlowResolvingAsync(e){this._logService.logLevel<=g.LogLevelEnum.WARN&&Promise.race([e,new Promise((e,t)=>setTimeout(()=>t("#SLOW_TIMEOUT"),5e3))]).catch(e=>{if("#SLOW_TIMEOUT"!==e)throw e;console.warn("async parser handler taking longer than 5000 ms")})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let n,r=this._activeBuffer.x,i=this._activeBuffer.y,o=0;const s=this._parseStack.paused;if(s){if(n=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(n),n;r=this._parseStack.cursorStartX,i=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>b&&(o=this._parseStack.position+b)}if(this._logService.logLevel<=g.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+' "'.concat("string"==typeof e?e:Array.prototype.map.call(e,e=>String.fromCharCode(e)).join(""),'"'),"string"==typeof e?e.split("").map(e=>e.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<b&&(this._parseBuffer=new Uint32Array(Math.min(e.length,b))),s||this._dirtyRowTracker.clearRange(),e.length>b)for(let a=o;a<e.length;a+=b){const t=a+b<e.length?a+b:e.length,o="string"==typeof e?this._stringDecoder.decode(e.substring(a,t),this._parseBuffer):this._utf8Decoder.decode(e.subarray(a,t),this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,o))return this._preserveStack(r,i,o,a),this._logSlowResolvingAsync(n),n}else if(!s){const t="string"==typeof e?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,t))return this._preserveStack(r,i,t,0),this._logSlowResolvingAsync(n),n}this._activeBuffer.x===r&&this._activeBuffer.y===i||this._onCursorMove.fire(),this._onRequestRefreshRows.fire(this._dirtyRowTracker.start,this._dirtyRowTracker.end)}print(e,t,n){let r,i;const o=this._charsetService.charset,s=this._optionsService.rawOptions.screenReaderMode,a=this._bufferService.cols,l=this._coreService.decPrivateModes.wraparound,u=this._coreService.modes.insertMode,d=this._curAttrData;let f=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&n-t>0&&2===f.getWidth(this._activeBuffer.x-1)&&f.setCellFromCodePoint(this._activeBuffer.x-1,0,1,d.fg,d.bg,d.extended);for(let p=t;p<n;++p){if(r=e[p],i=this._unicodeService.wcwidth(r),r<127&&o){const e=o[String.fromCharCode(r)];e&&(r=e.charCodeAt(0))}if(s&&this._onA11yChar.fire((0,c.stringFromCodePoint)(r)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),i||!this._activeBuffer.x){if(this._activeBuffer.x+i-1>=a)if(l){for(;this._activeBuffer.x<a;)f.setCellFromCodePoint(this._activeBuffer.x++,0,1,d.fg,d.bg,d.extended);this._activeBuffer.x=0,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),f=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)}else if(this._activeBuffer.x=a-1,2===i)continue;if(u&&(f.insertCells(this._activeBuffer.x,i,this._activeBuffer.getNullCell(d),d),2===f.getWidth(a-1)&&f.setCellFromCodePoint(a-1,h.NULL_CELL_CODE,h.NULL_CELL_WIDTH,d.fg,d.bg,d.extended)),f.setCellFromCodePoint(this._activeBuffer.x++,r,i,d.fg,d.bg,d.extended),i>0)for(;--i;)f.setCellFromCodePoint(this._activeBuffer.x++,0,0,d.fg,d.bg,d.extended)}else f.getWidth(this._activeBuffer.x-1)?f.addCodepointToCell(this._activeBuffer.x-1,r):f.addCodepointToCell(this._activeBuffer.x-2,r)}n-t>0&&(f.loadCell(this._activeBuffer.x-1,this._workCell),2===this._workCell.getWidth()||this._workCell.getCode()>65535?this._parser.precedingCodepoint=0:this._workCell.isCombined()?this._parser.precedingCodepoint=this._workCell.getChars().charCodeAt(0):this._parser.precedingCodepoint=this._workCell.content),this._activeBuffer.x<a&&n-t>0&&0===f.getWidth(this._activeBuffer.x)&&!f.hasContent(this._activeBuffer.x)&&f.setCellFromCodePoint(this._activeBuffer.x,0,1,d.fg,d.bg,d.extended),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return"t"!==e.final||e.prefix||e.intermediates?this._parser.registerCsiHandler(e,t):this._parser.registerCsiHandler(e,e=>!x(e.params[0],this._optionsService.rawOptions.windowOptions)||t(e))}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new m.DcsHandler(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new v.OscHandler(t))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){var e;if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(0===this._activeBuffer.x&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&(null===(e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))||void 0===e?void 0:e.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);e.hasWidth(this._activeBuffer.x)&&!e.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this._bufferService.cols-1;this._activeBuffer.x=Math.min(e,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(e,t){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+t):(this._activeBuffer.x=e,this._activeBuffer.y=t),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,t){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+t)}cursorUp(e){const t=this._activeBuffer.y-this._activeBuffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){const t=this._activeBuffer.scrollBottom-this._activeBuffer.y;return t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){const t=e.params[0];return 0===t?delete this._activeBuffer.tabs[this._activeBuffer.x]:3===t&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){const t=e.params[0];return 1===t&&(this._curAttrData.bg|=536870912),2!==t&&0!==t||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],i=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const o=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);o.replaceCells(t,n,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData(),i),r&&(o.isWrapped=!1)}_resetBufferLine(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n&&(n.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),n.isWrapped=!1)}eraseInDisplay(e){let t,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:for(t=this._activeBuffer.y,this._dirtyRowTracker.markDirty(t),this._eraseInBufferLine(t++,this._activeBuffer.x,this._bufferService.cols,0===this._activeBuffer.x,n);t<this._bufferService.rows;t++)this._resetBufferLine(t,n);this._dirtyRowTracker.markDirty(t);break;case 1:for(t=this._activeBuffer.y,this._dirtyRowTracker.markDirty(t),this._eraseInBufferLine(t,0,this._activeBuffer.x+1,!0,n),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(t+1).isWrapped=!1);t--;)this._resetBufferLine(t,n);this._dirtyRowTracker.markDirty(0);break;case 2:for(t=this._bufferService.rows,this._dirtyRowTracker.markDirty(t-1);t--;)this._resetBufferLine(t,n);this._dirtyRowTracker.markDirty(0);break;case 3:const e=this._activeBuffer.lines.length-this._bufferService.rows;e>0&&(this._activeBuffer.lines.trimStart(e),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-e,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-e,0),this._onScroll.fire(0))}return!0}eraseInLine(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,0===this._activeBuffer.x,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const n=this._activeBuffer.ybase+this._activeBuffer.y,r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,i=this._bufferService.rows-1+this._activeBuffer.ybase-r+1;for(;t--;)this._activeBuffer.lines.splice(i-1,1),this._activeBuffer.lines.splice(n,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const n=this._activeBuffer.ybase+this._activeBuffer.y;let r;for(r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,r=this._bufferService.rows-1+this._activeBuffer.ybase-r;t--;)this._activeBuffer.lines.splice(n,1),this._activeBuffer.lines.splice(r,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(e){this._restrictCursor();const t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.insertCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(e){this._restrictCursor();const t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.deleteCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(u.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){const e=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);e.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),e.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){const e=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);e.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),e.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){const e=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);e.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),e.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){const e=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);e.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),e.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();const t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(e.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(e){if(!this._parser.precedingCodepoint)return!0;const t=e.params[0]||1,n=new Uint32Array(t);for(let r=0;r<t;++r)n[r]=this._parser.precedingCodepoint;return this.print(n,0,n.length),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(o.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(o.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(o.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(o.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(o.C0.ESC+"[>83;40003;0c")),!0}_is(e){return 0===(this._optionsService.rawOptions.termName+"").indexOf(e)}setMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,s.DEFAULT_CHARSET),this._charsetService.setgCharset(1,s.DEFAULT_CHARSET),this._charsetService.setgCharset(2,s.DEFAULT_CHARSET),this._charsetService.setgCharset(3,s.DEFAULT_CHARSET);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0}return!0}resetMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),1049===e.params[t]&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1}return!0}requestMode(e,t){const n=this._coreService.decPrivateModes,{activeProtocol:r,activeEncoding:i}=this._coreMouseService,s=this._coreService,{buffers:a,cols:l}=this._bufferService,{active:c,alt:u}=a,d=this._optionsService.rawOptions,h=e=>e?1:2,f=e.params[0];return p=f,g=t?2===f?4:4===f?h(s.modes.insertMode):12===f?3:20===f?h(d.convertEol):0:1===f?h(n.applicationCursorKeys):3===f?d.windowOptions.setWinLines?80===l?2:132===l?1:0:0:6===f?h(n.origin):7===f?h(n.wraparound):8===f?3:9===f?h("X10"===r):12===f?h(d.cursorBlink):25===f?h(!s.isCursorHidden):45===f?h(n.reverseWraparound):66===f?h(n.applicationKeypad):67===f?4:1e3===f?h("VT200"===r):1002===f?h("DRAG"===r):1003===f?h("ANY"===r):1004===f?h(n.sendFocus):1005===f?4:1006===f?h("SGR"===i):1015===f?4:1016===f?h("SGR_PIXELS"===i):1048===f?1:47===f||1047===f||1049===f?h(c===u):2004===f?h(n.bracketedPasteMode):0,s.triggerDataEvent("".concat(o.C0.ESC,"[").concat(t?"":"?").concat(p,";").concat(g,"$y")),!0;var p,g}_updateAttrColor(e,t,n,r,i){return 2===t?(e|=50331648,e&=-16777216,e|=p.AttributeData.fromColorRGB([n,r,i])):5===t&&(e&=-50331904,e|=33554432|255&n),e}_extractColor(e,t,n){const r=[0,0,-1,0,0,0];let i=0,o=0;do{if(r[o+i]=e.params[t+o],e.hasSubParams(t+o)){const n=e.getSubParams(t+o);let s=0;do{5===r[1]&&(i=1),r[o+s+1+i]=n[s]}while(++s<n.length&&s+o+1+i<r.length);break}if(5===r[1]&&o+i>=2||2===r[1]&&o+i>=5)break;r[1]&&(i=1)}while(++o+t<e.length&&o+i<r.length);for(let s=2;s<r.length;++s)-1===r[s]&&(r[s]=0);switch(r[0]){case 38:n.fg=this._updateAttrColor(n.fg,r[1],r[3],r[4],r[5]);break;case 48:n.bg=this._updateAttrColor(n.bg,r[1],r[3],r[4],r[5]);break;case 58:n.extended=n.extended.clone(),n.extended.underlineColor=this._updateAttrColor(n.extended.underlineColor,r[1],r[3],r[4],r[5])}return o}_processUnderline(e,t){t.extended=t.extended.clone(),(!~e||e>5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,0===e&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=u.DEFAULT_ATTR_DATA.fg,e.bg=u.DEFAULT_ATTR_DATA.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(1===e.length&&0===e.params[0])return this._processSGR0(this._curAttrData),!0;const t=e.length;let n;const r=this._curAttrData;for(let i=0;i<t;i++)n=e.params[i],n>=30&&n<=37?(r.fg&=-50331904,r.fg|=16777216|n-30):n>=40&&n<=47?(r.bg&=-50331904,r.bg|=16777216|n-40):n>=90&&n<=97?(r.fg&=-50331904,r.fg|=16777224|n-90):n>=100&&n<=107?(r.bg&=-50331904,r.bg|=16777224|n-100):0===n?this._processSGR0(r):1===n?r.fg|=134217728:3===n?r.bg|=67108864:4===n?(r.fg|=268435456,this._processUnderline(e.hasSubParams(i)?e.getSubParams(i)[0]:1,r)):5===n?r.fg|=536870912:7===n?r.fg|=67108864:8===n?r.fg|=1073741824:9===n?r.fg|=2147483648:2===n?r.bg|=134217728:21===n?this._processUnderline(2,r):22===n?(r.fg&=-134217729,r.bg&=-134217729):23===n?r.bg&=-67108865:24===n?(r.fg&=-268435457,this._processUnderline(0,r)):25===n?r.fg&=-536870913:27===n?r.fg&=-67108865:28===n?r.fg&=-1073741825:29===n?r.fg&=2147483647:39===n?(r.fg&=-67108864,r.fg|=16777215&u.DEFAULT_ATTR_DATA.fg):49===n?(r.bg&=-67108864,r.bg|=16777215&u.DEFAULT_ATTR_DATA.bg):38===n||48===n||58===n?i+=this._extractColor(e,i,r):53===n?r.bg|=1073741824:55===n?r.bg&=-1073741825:59===n?(r.extended=r.extended.clone(),r.extended.underlineColor=-1,r.updateExtended()):100===n?(r.fg&=-67108864,r.fg|=16777215&u.DEFAULT_ATTR_DATA.fg,r.bg&=-67108864,r.bg|=16777215&u.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",n);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent("".concat(o.C0.ESC,"[0n"));break;case 6:const e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent("".concat(o.C0.ESC,"[").concat(e,";").concat(t,"R"))}return!0}deviceStatusPrivate(e){if(6===e.params[0]){const e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent("".concat(o.C0.ESC,"[?").concat(e,";").concat(t,"R"))}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=u.DEFAULT_ATTR_DATA.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(e){const t=e.params[0]||1;switch(t){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}const n=t%2==1;return this._optionsService.options.cursorBlink=n,!0}setScrollRegion(e){const t=e.params[0]||1;let n;return(e.length<2||(n=e.params[1])>this._bufferService.rows||0===n)&&(n=this._bufferService.rows),n>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=n-1,this._setCursor(0,0)),!0}windowOptions(e){if(!x(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;const t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:2!==t&&this._onRequestWindowsOptionsReport.fire(w.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(w.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent("".concat(o.C0.ESC,"[8;").concat(this._bufferService.rows,";").concat(this._bufferService.cols,"t"));break;case 22:0!==t&&2!==t||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),0!==t&&1!==t||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:0!==t&&2!==t||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),0!==t&&1!==t||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(e){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(e){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){const t=[],n=e.split(";");for(;n.length>1;){const e=n.shift(),r=n.shift();if(/^\d+$/.exec(e)){const n=parseInt(e);if(E(n))if("?"===r)t.push({type:0,index:n});else{const e=(0,_.parseColor)(r);e&&t.push({type:1,index:n,color:e})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){const t=e.split(";");return!(t.length<2)&&(t[1]?this._createHyperlink(t[0],t[1]):!t[0]&&this._finishHyperlink())}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();const n=e.split(":");let r;const i=n.findIndex(e=>e.startsWith("id="));return-1!==i&&(r=n[i].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:r,uri:t}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,t){const n=e.split(";");for(let r=0;r<n.length&&!(t>=this._specialColors.length);++r,++t)if("?"===n[r])this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{const e=(0,_.parseColor)(n[r]);e&&this._onColor.fire([{type:1,index:this._specialColors[t],color:e}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;const t=[],n=e.split(";");for(let r=0;r<n.length;++r)if(/^\d+$/.exec(n[r])){const e=parseInt(n[r]);E(e)&&t.push({type:2,index:e})}return t.length&&this._onColor.fire(t),!0}restoreFgColor(e){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(e){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(e){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,s.DEFAULT_CHARSET),!0}selectCharset(e){return 2!==e.length?(this.selectDefaultCharset(),!0):("/"===e[0]||this._charsetService.setgCharset(y[e[0]],s.CHARSETS[e[1]]||s.DEFAULT_CHARSET),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){const e=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,e,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=u.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=u.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){const e=new f.CellData;e.content=1<<22|"E".charCodeAt(0),e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t<this._bufferService.rows;++t){const n=this._activeBuffer.ybase+this._activeBuffer.y+t,r=this._activeBuffer.lines.get(n);r&&(r.fill(e),r.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){const n=this._bufferService.buffer,r=this._optionsService.rawOptions;return(e=>(this._coreService.triggerDataEvent("".concat(o.C0.ESC).concat(e).concat(o.C0.ESC,"\\")),!0))('"q'===e?"P1$r".concat(this._curAttrData.isProtected()?1:0,'"q'):'"p'===e?'P1$r61;1"p':"r"===e?"P1$r".concat(n.scrollTop+1,";").concat(n.scrollBottom+1,"r"):"m"===e?"P1$r0m":" q"===e?"P1$r".concat({block:2,underline:4,bar:6}[r.cursorStyle]-(r.cursorBlink?1:0)," q"):"P0$r")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}}t.InputHandler=C;let k=class{constructor(e){this._bufferService=e,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(e){e<this.start?this.start=e:e>this.end&&(this.end=e)}markRangeDirty(e,t){e>t&&(S=e,e=t,t=S),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function E(e){return 0<=e&&e<256}k=r([i(0,g.IBufferService)],k)},844:(e,t)=>{function n(e){for(const t of e)t.dispose();e.length=0}Object.defineProperty(t,"__esModule",{value:!0}),t.getDisposeArrayDisposable=t.disposeArray=t.toDisposable=t.MutableDisposable=t.Disposable=void 0,t.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const e of this._disposables)e.dispose();this._disposables.length=0}register(e){return this._disposables.push(e),e}unregister(e){const t=this._disposables.indexOf(e);-1!==t&&this._disposables.splice(t,1)}},t.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){var t;this._isDisposed||e===this._value||(null===(t=this._value)||void 0===t||t.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){var e;this._isDisposed=!0,null===(e=this._value)||void 0===e||e.dispose(),this._value=void 0}},t.toDisposable=function(e){return{dispose:e}},t.disposeArray=n,t.getDisposeArrayDisposable=function(e){return{dispose:()=>n(e)}}},1505:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FourKeyMap=t.TwoKeyMap=void 0;class n{constructor(){this._data={}}set(e,t,n){this._data[e]||(this._data[e]={}),this._data[e][t]=n}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}}t.TwoKeyMap=n,t.FourKeyMap=class{constructor(){this._data=new n}set(e,t,r,i,o){this._data.get(e,t)||this._data.set(e,t,new n),this._data.get(e,t).set(r,i,o)}get(e,t,n,r){var i;return null===(i=this._data.get(e,t))||void 0===i?void 0:i.get(n,r)}clear(){this._data.clear()}}},6114:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isChromeOS=t.isLinux=t.isWindows=t.isIphone=t.isIpad=t.isMac=t.getSafariVersion=t.isSafari=t.isLegacyEdge=t.isFirefox=t.isNode=void 0,t.isNode="undefined"==typeof navigator;const n=t.isNode?"node":navigator.userAgent,r=t.isNode?"node":navigator.platform;t.isFirefox=n.includes("Firefox"),t.isLegacyEdge=n.includes("Edge"),t.isSafari=/^((?!chrome|android).)*safari/i.test(n),t.getSafariVersion=function(){if(!t.isSafari)return 0;const e=n.match(/Version\/(\d+)/);return null===e||e.length<2?0:parseInt(e[1])},t.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(r),t.isIpad="iPad"===r,t.isIphone="iPhone"===r,t.isWindows=["Windows","Win16","Win32","WinCE"].includes(r),t.isLinux=r.indexOf("Linux")>=0,t.isChromeOS=/\bCrOS\b/.test(n)},6106:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SortedList=void 0;let n=0;t.SortedList=class{constructor(e){this._getKey=e,this._array=[]}clear(){this._array.length=0}insert(e){0!==this._array.length?(n=this._search(this._getKey(e)),this._array.splice(n,0,e)):this._array.push(e)}delete(e){if(0===this._array.length)return!1;const t=this._getKey(e);if(void 0===t)return!1;if(n=this._search(t),-1===n)return!1;if(this._getKey(this._array[n])!==t)return!1;do{if(this._array[n]===e)return this._array.splice(n,1),!0}while(++n<this._array.length&&this._getKey(this._array[n])===t);return!1}*getKeyIterator(e){if(0!==this._array.length&&(n=this._search(e),!(n<0||n>=this._array.length)&&this._getKey(this._array[n])===e))do{yield this._array[n]}while(++n<this._array.length&&this._getKey(this._array[n])===e)}forEachByKey(e,t){if(0!==this._array.length&&(n=this._search(e),!(n<0||n>=this._array.length)&&this._getKey(this._array[n])===e))do{t(this._array[n])}while(++n<this._array.length&&this._getKey(this._array[n])===e)}values(){return[...this._array].values()}_search(e){let t=0,n=this._array.length-1;for(;n>=t;){let r=t+n>>1;const i=this._getKey(this._array[r]);if(i>e)n=r-1;else{if(!(i<e)){for(;r>0&&this._getKey(this._array[r-1])===e;)r--;return r}t=r+1}}return t}}},7226:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DebouncedIdleTask=t.IdleTaskQueue=t.PriorityTaskQueue=void 0;const r=n(6114);class i{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(e){this._idleCallback=void 0;let t=0,n=0,r=e.timeRemaining(),i=0;for(;this._i<this._tasks.length;){if(t=Date.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,Date.now()-t),n=Math.max(t,n),i=e.timeRemaining(),1.5*n>i)return r-t<-20&&console.warn("task queue exceeded allotted deadline by ".concat(Math.abs(Math.round(r-t)),"ms")),void this._start();r=i}this.clear()}}class o extends i{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){const t=Date.now()+e;return{timeRemaining:()=>Math.max(0,t-Date.now())}}}t.PriorityTaskQueue=o,t.IdleTaskQueue=!r.isNode&&"requestIdleCallback"in window?class extends i{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}}:o,t.DebouncedIdleTask=class{constructor(){this._queue=new t.IdleTaskQueue}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}}},9282:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.updateWindowsModeWrappedState=void 0;const r=n(643);t.updateWindowsModeWrappedState=function(e){const t=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1),n=null==t?void 0:t.get(e.cols-1),i=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);i&&n&&(i.isWrapped=n[r.CHAR_DATA_CODE_INDEX]!==r.NULL_CELL_CODE&&n[r.CHAR_DATA_CODE_INDEX]!==r.WHITESPACE_CELL_CODE)}},3734:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ExtendedAttrs=t.AttributeData=void 0;class n{constructor(){this.fg=0,this.bg=0,this.extended=new r}static toColorRGB(e){return[e>>>16&255,e>>>8&255,255&e]}static fromColorRGB(e){return(255&e[0])<<16|(255&e[1])<<8|255&e[2]}clone(){const e=new n;return e.fg=this.fg,e.bg=this.bg,e.extended=this.extended.clone(),e}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&0!==this.extended.underlineStyle?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return 50331648==(50331648&this.fg)}isBgRGB(){return 50331648==(50331648&this.bg)}isFgPalette(){return 16777216==(50331648&this.fg)||33554432==(50331648&this.fg)}isBgPalette(){return 16777216==(50331648&this.bg)||33554432==(50331648&this.bg)}isFgDefault(){return 0==(50331648&this.fg)}isBgDefault(){return 0==(50331648&this.bg)}isAttributeDefault(){return 0===this.fg&&0===this.bg}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?50331648==(50331648&this.extended.underlineColor):this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?16777216==(50331648&this.extended.underlineColor)||33554432==(50331648&this.extended.underlineColor):this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?0==(50331648&this.extended.underlineColor):this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}}t.AttributeData=n;class r{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(e){this._ext&=-67108864,this._ext|=67108863&e}get urlId(){return this._urlId}set urlId(e){this._urlId=e}constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}clone(){return new r(this._ext,this._urlId)}isEmpty(){return 0===this.underlineStyle&&0===this._urlId}}t.ExtendedAttrs=r},9092:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Buffer=t.MAX_BUFFER_SIZE=void 0;const r=n(6349),i=n(7226),o=n(3734),s=n(8437),a=n(4634),l=n(511),c=n(643),u=n(4863),d=n(7116);t.MAX_BUFFER_SIZE=4294967295,t.Buffer=class{constructor(e,t,n){this._hasScrollback=e,this._optionsService=t,this._bufferService=n,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=s.DEFAULT_ATTR_DATA.clone(),this.savedCharset=d.DEFAULT_CHARSET,this.markers=[],this._nullCell=l.CellData.fromCharData([0,c.NULL_CELL_CHAR,c.NULL_CELL_WIDTH,c.NULL_CELL_CODE]),this._whitespaceCell=l.CellData.fromCharData([0,c.WHITESPACE_CELL_CHAR,c.WHITESPACE_CELL_WIDTH,c.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new i.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new r.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new o.ExtendedAttrs),this._nullCell}getWhitespaceCell(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new o.ExtendedAttrs),this._whitespaceCell}getBlankLine(e,t){return new s.BufferLine(this._bufferService.cols,this.getNullCell(e),t)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const e=this.ybase+this.y-this.ydisp;return e>=0&&e<this._rows}_getCorrectBufferLength(e){if(!this._hasScrollback)return e;const n=e+this._optionsService.rawOptions.scrollback;return n>t.MAX_BUFFER_SIZE?t.MAX_BUFFER_SIZE:n}fillViewportRows(e){if(0===this.lines.length){void 0===e&&(e=s.DEFAULT_ATTR_DATA);let t=this._rows;for(;t--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new r.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){const n=this.getNullCell(s.DEFAULT_ATTR_DATA);let r=0;const i=this._getCorrectBufferLength(t);if(i>this.lines.maxLength&&(this.lines.maxLength=i),this.lines.length>0){if(this._cols<e)for(let t=0;t<this.lines.length;t++)r+=+this.lines.get(t).resize(e,n);let o=0;if(this._rows<t)for(let r=this._rows;r<t;r++)this.lines.length<t+this.ybase&&(this._optionsService.rawOptions.windowsMode||void 0!==this._optionsService.rawOptions.windowsPty.backend||void 0!==this._optionsService.rawOptions.windowsPty.buildNumber?this.lines.push(new s.BufferLine(e,n)):this.ybase>0&&this.lines.length<=this.ybase+this.y+o+1?(this.ybase--,o++,this.ydisp>0&&this.ydisp--):this.lines.push(new s.BufferLine(e,n)));else for(let e=this._rows;e>t;e--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(i<this.lines.maxLength){const e=this.lines.length-i;e>0&&(this.lines.trimStart(e),this.ybase=Math.max(this.ybase-e,0),this.ydisp=Math.max(this.ydisp-e,0),this.savedY=Math.max(this.savedY-e,0)),this.lines.maxLength=i}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),o&&(this.y+=o),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(let o=0;o<this.lines.length;o++)r+=+this.lines.get(o).resize(e,n);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),r>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let t=0;for(;this._memoryCleanupPosition<this.lines.length;)if(t+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),t>100)return!0;return e}get _isReflowEnabled(){const e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&"conpty"===e.backend&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){const n=(0,a.reflowLargerGetLinesToRemove)(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(s.DEFAULT_ATTR_DATA));if(n.length>0){const r=(0,a.reflowLargerCreateNewLayout)(this.lines,n);(0,a.reflowLargerApplyNewLayout)(this.lines,r.layout),this._reflowLargerAdjustViewport(e,t,r.countRemoved)}}_reflowLargerAdjustViewport(e,t,n){const r=this.getNullCell(s.DEFAULT_ATTR_DATA);let i=n;for(;i-- >0;)0===this.ybase?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new s.BufferLine(e,r))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-n,0)}_reflowSmaller(e,t){const n=this.getNullCell(s.DEFAULT_ATTR_DATA),r=[];let i=0;for(let o=this.lines.length-1;o>=0;o--){let l=this.lines.get(o);if(!l||!l.isWrapped&&l.getTrimmedLength()<=e)continue;const c=[l];for(;l.isWrapped&&o>0;)l=this.lines.get(--o),c.unshift(l);const u=this.ybase+this.y;if(u>=o&&u<o+c.length)continue;const d=c[c.length-1].getTrimmedLength(),h=(0,a.reflowSmallerGetNewLineLengths)(c,this._cols,e),f=h.length-c.length;let p;p=0===this.ybase&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+f):Math.max(0,this.lines.length-this.lines.maxLength+f);const g=[];for(let e=0;e<f;e++){const e=this.getBlankLine(s.DEFAULT_ATTR_DATA,!0);g.push(e)}g.length>0&&(r.push({start:o+c.length+i,newLines:g}),i+=g.length),c.push(...g);let v=h.length-1,m=h[v];0===m&&(v--,m=h[v]);let _=c.length-f-1,y=d;for(;_>=0;){const e=Math.min(y,m);if(void 0===c[v])break;if(c[v].copyCellsFrom(c[_],y-e,m-e,e,!0),m-=e,0===m&&(v--,m=h[v]),y-=e,0===y){_--;const e=Math.max(_,0);y=(0,a.getWrappedLineTrimmedLength)(c,e,this._cols)}}for(let t=0;t<c.length;t++)h[t]<e&&c[t].setCell(h[t],n);let b=f-p;for(;b-- >0;)0===this.ybase?this.y<t-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+i)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+f,this.ybase+t-1)}if(r.length>0){const e=[],t=[];for(let r=0;r<this.lines.length;r++)t.push(this.lines.get(r));const n=this.lines.length;let o=n-1,s=0,a=r[s];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+i);let l=0;for(let d=Math.min(this.lines.maxLength-1,n+i-1);d>=0;d--)if(a&&a.start>o+l){for(let e=a.newLines.length-1;e>=0;e--)this.lines.set(d--,a.newLines[e]);d++,e.push({index:o+1,amount:a.newLines.length}),l+=a.newLines.length,a=r[++s]}else this.lines.set(d,t[o--]);let c=0;for(let r=e.length-1;r>=0;r--)e[r].index+=c,this.lines.onInsertEmitter.fire(e[r]),c+=e[r].amount;const u=Math.max(0,n+i-this.lines.maxLength);u>0&&this.lines.onTrimEmitter.fire(u)}}translateBufferLineToString(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3?arguments[3]:void 0;const i=this.lines.get(e);return i?i.translateToString(t,n,r):""}getWrappedRangeForLine(e){let t=e,n=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;n+1<this.lines.length&&this.lines.get(n+1).isWrapped;)n++;return{first:t,last:n}}setupTabStops(e){for(null!=e?this.tabs[e]||(e=this.prevStop(e)):(this.tabs={},e=0);e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(null==e&&(e=this.x);!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(null==e&&(e=this.x);!this.tabs[++e]&&e<this._cols;);return e>=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let t=0;t<this.markers.length;t++)this.markers[t].line===e&&(this.markers[t].dispose(),this.markers.splice(t--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose(),this.markers.splice(e--,1);this._isClearing=!1}addMarker(e){const t=new u.Marker(e);return this.markers.push(t),t.register(this.lines.onTrim(e=>{t.line-=e,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(e=>{t.line>=e.index&&(t.line+=e.amount)})),t.register(this.lines.onDelete(e=>{t.line>=e.index&&t.line<e.index+e.amount&&t.dispose(),t.line>e.index&&(t.line-=e.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}}},8437:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferLine=t.DEFAULT_ATTR_DATA=void 0;const r=n(3734),i=n(511),o=n(643),s=n(482);t.DEFAULT_ATTR_DATA=Object.freeze(new r.AttributeData);let a=0;class l{constructor(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.isWrapped=n,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*e);const r=t||i.CellData.fromCharData([0,o.NULL_CELL_CHAR,o.NULL_CELL_WIDTH,o.NULL_CELL_CODE]);for(let i=0;i<e;++i)this.setCell(i,r);this.length=e}get(e){const t=this._data[3*e+0],n=2097151&t;return[this._data[3*e+1],2097152&t?this._combined[e]:n?(0,s.stringFromCodePoint)(n):"",t>>22,2097152&t?this._combined[e].charCodeAt(this._combined[e].length-1):n]}set(e,t){this._data[3*e+1]=t[o.CHAR_DATA_ATTR_INDEX],t[o.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[e]=t[1],this._data[3*e+0]=2097152|e|t[o.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*e+0]=t[o.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|t[o.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(e){return this._data[3*e+0]>>22}hasWidth(e){return 12582912&this._data[3*e+0]}getFg(e){return this._data[3*e+1]}getBg(e){return this._data[3*e+2]}hasContent(e){return 4194303&this._data[3*e+0]}getCodePoint(e){const t=this._data[3*e+0];return 2097152&t?this._combined[e].charCodeAt(this._combined[e].length-1):2097151&t}isCombined(e){return 2097152&this._data[3*e+0]}getString(e){const t=this._data[3*e+0];return 2097152&t?this._combined[e]:2097151&t?(0,s.stringFromCodePoint)(2097151&t):""}isProtected(e){return 536870912&this._data[3*e+2]}loadCell(e,t){return a=3*e,t.content=this._data[a+0],t.fg=this._data[a+1],t.bg=this._data[a+2],2097152&t.content&&(t.combinedData=this._combined[e]),268435456&t.bg&&(t.extended=this._extendedAttrs[e]),t}setCell(e,t){2097152&t.content&&(this._combined[e]=t.combinedData),268435456&t.bg&&(this._extendedAttrs[e]=t.extended),this._data[3*e+0]=t.content,this._data[3*e+1]=t.fg,this._data[3*e+2]=t.bg}setCellFromCodePoint(e,t,n,r,i,o){268435456&i&&(this._extendedAttrs[e]=o),this._data[3*e+0]=t|n<<22,this._data[3*e+1]=r,this._data[3*e+2]=i}addCodepointToCell(e,t){let n=this._data[3*e+0];2097152&n?this._combined[e]+=(0,s.stringFromCodePoint)(t):(2097151&n?(this._combined[e]=(0,s.stringFromCodePoint)(2097151&n)+(0,s.stringFromCodePoint)(t),n&=-2097152,n|=2097152):n=t|1<<22,this._data[3*e+0]=n)}insertCells(e,t,n,o){if((e%=this.length)&&2===this.getWidth(e-1)&&this.setCellFromCodePoint(e-1,0,1,(null==o?void 0:o.fg)||0,(null==o?void 0:o.bg)||0,(null==o?void 0:o.extended)||new r.ExtendedAttrs),t<this.length-e){const r=new i.CellData;for(let n=this.length-e-t-1;n>=0;--n)this.setCell(e+t+n,this.loadCell(e+n,r));for(let i=0;i<t;++i)this.setCell(e+i,n)}else for(let r=e;r<this.length;++r)this.setCell(r,n);2===this.getWidth(this.length-1)&&this.setCellFromCodePoint(this.length-1,0,1,(null==o?void 0:o.fg)||0,(null==o?void 0:o.bg)||0,(null==o?void 0:o.extended)||new r.ExtendedAttrs)}deleteCells(e,t,n,o){if(e%=this.length,t<this.length-e){const r=new i.CellData;for(let n=0;n<this.length-e-t;++n)this.setCell(e+n,this.loadCell(e+t+n,r));for(let e=this.length-t;e<this.length;++e)this.setCell(e,n)}else for(let r=e;r<this.length;++r)this.setCell(r,n);e&&2===this.getWidth(e-1)&&this.setCellFromCodePoint(e-1,0,1,(null==o?void 0:o.fg)||0,(null==o?void 0:o.bg)||0,(null==o?void 0:o.extended)||new r.ExtendedAttrs),0!==this.getWidth(e)||this.hasContent(e)||this.setCellFromCodePoint(e,0,1,(null==o?void 0:o.fg)||0,(null==o?void 0:o.bg)||0,(null==o?void 0:o.extended)||new r.ExtendedAttrs)}replaceCells(e,t,n,i){if(arguments.length>4&&void 0!==arguments[4]&&arguments[4])for(e&&2===this.getWidth(e-1)&&!this.isProtected(e-1)&&this.setCellFromCodePoint(e-1,0,1,(null==i?void 0:i.fg)||0,(null==i?void 0:i.bg)||0,(null==i?void 0:i.extended)||new r.ExtendedAttrs),t<this.length&&2===this.getWidth(t-1)&&!this.isProtected(t)&&this.setCellFromCodePoint(t,0,1,(null==i?void 0:i.fg)||0,(null==i?void 0:i.bg)||0,(null==i?void 0:i.extended)||new r.ExtendedAttrs);e<t&&e<this.length;)this.isProtected(e)||this.setCell(e,n),e++;else for(e&&2===this.getWidth(e-1)&&this.setCellFromCodePoint(e-1,0,1,(null==i?void 0:i.fg)||0,(null==i?void 0:i.bg)||0,(null==i?void 0:i.extended)||new r.ExtendedAttrs),t<this.length&&2===this.getWidth(t-1)&&this.setCellFromCodePoint(t,0,1,(null==i?void 0:i.fg)||0,(null==i?void 0:i.bg)||0,(null==i?void 0:i.extended)||new r.ExtendedAttrs);e<t&&e<this.length;)this.setCell(e++,n)}resize(e,t){if(e===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const n=3*e;if(e>this.length){if(this._data.buffer.byteLength>=4*n)this._data=new Uint32Array(this._data.buffer,0,n);else{const e=new Uint32Array(n);e.set(this._data),this._data=e}for(let n=this.length;n<e;++n)this.setCell(n,t)}else{this._data=this._data.subarray(0,n);const t=Object.keys(this._combined);for(let n=0;n<t.length;n++){const r=parseInt(t[n],10);r>=e&&delete this._combined[r]}const r=Object.keys(this._extendedAttrs);for(let n=0;n<r.length;n++){const t=parseInt(r[n],10);t>=e&&delete this._extendedAttrs[t]}}return this.length=e,4*n*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){const e=new Uint32Array(this._data.length);return e.set(this._data),this._data=e,1}return 0}fill(e){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1])for(let t=0;t<this.length;++t)this.isProtected(t)||this.setCell(t,e);else{this._combined={},this._extendedAttrs={};for(let t=0;t<this.length;++t)this.setCell(t,e)}}copyFrom(e){this.length!==e.length?this._data=new Uint32Array(e._data):this._data.set(e._data),this.length=e.length,this._combined={};for(const t in e._combined)this._combined[t]=e._combined[t];this._extendedAttrs={};for(const t in e._extendedAttrs)this._extendedAttrs[t]=e._extendedAttrs[t];this.isWrapped=e.isWrapped}clone(){const e=new l(0);e._data=new Uint32Array(this._data),e.length=this.length;for(const t in this._combined)e._combined[t]=this._combined[t];for(const t in this._extendedAttrs)e._extendedAttrs[t]=this._extendedAttrs[t];return e.isWrapped=this.isWrapped,e}getTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(4194303&this._data[3*e+0])return e+(this._data[3*e+0]>>22);return 0}getNoBgTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(4194303&this._data[3*e+0]||50331648&this._data[3*e+2])return e+(this._data[3*e+0]>>22);return 0}copyCellsFrom(e,t,n,r,i){const o=e._data;if(i)for(let a=r-1;a>=0;a--){for(let e=0;e<3;e++)this._data[3*(n+a)+e]=o[3*(t+a)+e];268435456&o[3*(t+a)+2]&&(this._extendedAttrs[n+a]=e._extendedAttrs[t+a])}else for(let a=0;a<r;a++){for(let e=0;e<3;e++)this._data[3*(n+a)+e]=o[3*(t+a)+e];268435456&o[3*(t+a)+2]&&(this._extendedAttrs[n+a]=e._extendedAttrs[t+a])}const s=Object.keys(e._combined);for(let a=0;a<s.length;a++){const r=parseInt(s[a],10);r>=t&&(this._combined[r-t+n]=e._combined[r])}}translateToString(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.length;e&&(n=Math.min(n,this.getTrimmedLength()));let r="";for(;t<n;){const e=this._data[3*t+0],n=2097151&e;r+=2097152&e?this._combined[t]:n?(0,s.stringFromCodePoint)(n):o.WHITESPACE_CELL_CHAR,t+=e>>22||1}return r}}t.BufferLine=l},4841:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getRangeLength=void 0,t.getRangeLength=function(e,t){if(e.start.y>e.end.y)throw new Error("Buffer range end (".concat(e.end.x,", ").concat(e.end.y,") cannot be before start (").concat(e.start.x,", ").concat(e.start.y,")"));return t*(e.end.y-e.start.y)+(e.end.x-e.start.x+1)}},4634:(e,t)=>{function n(e,t,n){if(t===e.length-1)return e[t].getTrimmedLength();const r=!e[t].hasContent(n-1)&&1===e[t].getWidth(n-1),i=2===e[t+1].getWidth(0);return r&&i?n-1:n}Object.defineProperty(t,"__esModule",{value:!0}),t.getWrappedLineTrimmedLength=t.reflowSmallerGetNewLineLengths=t.reflowLargerApplyNewLayout=t.reflowLargerCreateNewLayout=t.reflowLargerGetLinesToRemove=void 0,t.reflowLargerGetLinesToRemove=function(e,t,r,i,o){const s=[];for(let a=0;a<e.length-1;a++){let l=a,c=e.get(++l);if(!c.isWrapped)continue;const u=[e.get(a)];for(;l<e.length&&c.isWrapped;)u.push(c),c=e.get(++l);if(i>=a&&i<l){a+=u.length-1;continue}let d=0,h=n(u,d,t),f=1,p=0;for(;f<u.length;){const e=n(u,f,t),i=e-p,s=r-h,a=Math.min(i,s);u[d].copyCellsFrom(u[f],p,h,a,!1),h+=a,h===r&&(d++,h=0),p+=a,p===e&&(f++,p=0),0===h&&0!==d&&2===u[d-1].getWidth(r-1)&&(u[d].copyCellsFrom(u[d-1],r-1,h++,1,!1),u[d-1].setCell(r-1,o))}u[d].replaceCells(h,r,o);let g=0;for(let e=u.length-1;e>0&&(e>d||0===u[e].getTrimmedLength());e--)g++;g>0&&(s.push(a+u.length-g),s.push(g)),a+=u.length-1}return s},t.reflowLargerCreateNewLayout=function(e,t){const n=[];let r=0,i=t[r],o=0;for(let s=0;s<e.length;s++)if(i===s){const n=t[++r];e.onDeleteEmitter.fire({index:s-o,amount:n}),s+=n-1,o+=n,i=t[++r]}else n.push(s);return{layout:n,countRemoved:o}},t.reflowLargerApplyNewLayout=function(e,t){const n=[];for(let r=0;r<t.length;r++)n.push(e.get(t[r]));for(let r=0;r<n.length;r++)e.set(r,n[r]);e.length=t.length},t.reflowSmallerGetNewLineLengths=function(e,t,r){const i=[],o=e.map((r,i)=>n(e,i,t)).reduce((e,t)=>e+t);let s=0,a=0,l=0;for(;l<o;){if(o-l<r){i.push(o-l);break}s+=r;const c=n(e,a,t);s>c&&(s-=c,a++);const u=2===e[a].getWidth(s-1);u&&s--;const d=u?r-1:r;i.push(d),l+=d}return i},t.getWrappedLineTrimmedLength=n},5295:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferSet=void 0;const r=n(8460),i=n(844),o=n(9092);class s extends i.Disposable{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this.register(new r.EventEmitter),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this.register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.resize(this._bufferService.cols,this._bufferService.rows))),this.register(this._optionsService.onSpecificOptionChange("tabStopWidth",()=>this.setupTabStops()))}reset(){this._normal=new o.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new o.Buffer(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(e){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(e),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(e,t){this._normal.resize(e,t),this._alt.resize(e,t),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}}t.BufferSet=s},511:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CellData=void 0;const r=n(482),i=n(643),o=n(3734);class s extends o.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new o.ExtendedAttrs,this.combinedData=""}static fromCharData(e){const t=new s;return t.setFromCharData(e),t}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,r.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(e){this.fg=e[i.CHAR_DATA_ATTR_INDEX],this.bg=0;let t=!1;if(e[i.CHAR_DATA_CHAR_INDEX].length>2)t=!0;else if(2===e[i.CHAR_DATA_CHAR_INDEX].length){const n=e[i.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=n&&n<=56319){const r=e[i.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=r&&r<=57343?this.content=1024*(n-55296)+r-56320+65536|e[i.CHAR_DATA_WIDTH_INDEX]<<22:t=!0}else t=!0}else this.content=e[i.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|e[i.CHAR_DATA_WIDTH_INDEX]<<22;t&&(this.combinedData=e[i.CHAR_DATA_CHAR_INDEX],this.content=2097152|e[i.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}t.CellData=s},643:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WHITESPACE_CELL_CODE=t.WHITESPACE_CELL_WIDTH=t.WHITESPACE_CELL_CHAR=t.NULL_CELL_CODE=t.NULL_CELL_WIDTH=t.NULL_CELL_CHAR=t.CHAR_DATA_CODE_INDEX=t.CHAR_DATA_WIDTH_INDEX=t.CHAR_DATA_CHAR_INDEX=t.CHAR_DATA_ATTR_INDEX=t.DEFAULT_EXT=t.DEFAULT_ATTR=t.DEFAULT_COLOR=void 0,t.DEFAULT_COLOR=0,t.DEFAULT_ATTR=256|t.DEFAULT_COLOR<<9,t.DEFAULT_EXT=0,t.CHAR_DATA_ATTR_INDEX=0,t.CHAR_DATA_CHAR_INDEX=1,t.CHAR_DATA_WIDTH_INDEX=2,t.CHAR_DATA_CODE_INDEX=3,t.NULL_CELL_CHAR="",t.NULL_CELL_WIDTH=1,t.NULL_CELL_CODE=0,t.WHITESPACE_CELL_CHAR=" ",t.WHITESPACE_CELL_WIDTH=1,t.WHITESPACE_CELL_CODE=32},4863:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Marker=void 0;const r=n(8460),i=n(844);class o{get id(){return this._id}constructor(e){this.line=e,this.isDisposed=!1,this._disposables=[],this._id=o._nextId++,this._onDispose=this.register(new r.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,i.disposeArray)(this._disposables),this._disposables.length=0)}register(e){return this._disposables.push(e),e}}t.Marker=o,o._nextId=1},7116:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_CHARSET=t.CHARSETS=void 0,t.CHARSETS={},t.DEFAULT_CHARSET=t.CHARSETS.B,t.CHARSETS[0]={"`":"\u25c6",a:"\u2592",b:"\u2409",c:"\u240c",d:"\u240d",e:"\u240a",f:"\xb0",g:"\xb1",h:"\u2424",i:"\u240b",j:"\u2518",k:"\u2510",l:"\u250c",m:"\u2514",n:"\u253c",o:"\u23ba",p:"\u23bb",q:"\u2500",r:"\u23bc",s:"\u23bd",t:"\u251c",u:"\u2524",v:"\u2534",w:"\u252c",x:"\u2502",y:"\u2264",z:"\u2265","{":"\u03c0","|":"\u2260","}":"\xa3","~":"\xb7"},t.CHARSETS.A={"#":"\xa3"},t.CHARSETS.B=void 0,t.CHARSETS[4]={"#":"\xa3","@":"\xbe","[":"ij","\\":"\xbd","]":"|","{":"\xa8","|":"f","}":"\xbc","~":"\xb4"},t.CHARSETS.C=t.CHARSETS[5]={"[":"\xc4","\\":"\xd6","]":"\xc5","^":"\xdc","`":"\xe9","{":"\xe4","|":"\xf6","}":"\xe5","~":"\xfc"},t.CHARSETS.R={"#":"\xa3","@":"\xe0","[":"\xb0","\\":"\xe7","]":"\xa7","{":"\xe9","|":"\xf9","}":"\xe8","~":"\xa8"},t.CHARSETS.Q={"@":"\xe0","[":"\xe2","\\":"\xe7","]":"\xea","^":"\xee","`":"\xf4","{":"\xe9","|":"\xf9","}":"\xe8","~":"\xfb"},t.CHARSETS.K={"@":"\xa7","[":"\xc4","\\":"\xd6","]":"\xdc","{":"\xe4","|":"\xf6","}":"\xfc","~":"\xdf"},t.CHARSETS.Y={"#":"\xa3","@":"\xa7","[":"\xb0","\\":"\xe7","]":"\xe9","`":"\xf9","{":"\xe0","|":"\xf2","}":"\xe8","~":"\xec"},t.CHARSETS.E=t.CHARSETS[6]={"@":"\xc4","[":"\xc6","\\":"\xd8","]":"\xc5","^":"\xdc","`":"\xe4","{":"\xe6","|":"\xf8","}":"\xe5","~":"\xfc"},t.CHARSETS.Z={"#":"\xa3","@":"\xa7","[":"\xa1","\\":"\xd1","]":"\xbf","{":"\xb0","|":"\xf1","}":"\xe7"},t.CHARSETS.H=t.CHARSETS[7]={"@":"\xc9","[":"\xc4","\\":"\xd6","]":"\xc5","^":"\xdc","`":"\xe9","{":"\xe4","|":"\xf6","}":"\xe5","~":"\xfc"},t.CHARSETS["="]={"#":"\xf9","@":"\xe0","[":"\xe9","\\":"\xe7","]":"\xea","^":"\xee",_:"\xe8","`":"\xf4","{":"\xe4","|":"\xf6","}":"\xfc","~":"\xfb"}},2584:(e,t)=>{var n,r,i;Object.defineProperty(t,"__esModule",{value:!0}),t.C1_ESCAPED=t.C1=t.C0=void 0,function(e){e.NUL="\0",e.SOH="\x01",e.STX="\x02",e.ETX="\x03",e.EOT="\x04",e.ENQ="\x05",e.ACK="\x06",e.BEL="\x07",e.BS="\b",e.HT="\t",e.LF="\n",e.VT="\v",e.FF="\f",e.CR="\r",e.SO="\x0e",e.SI="\x0f",e.DLE="\x10",e.DC1="\x11",e.DC2="\x12",e.DC3="\x13",e.DC4="\x14",e.NAK="\x15",e.SYN="\x16",e.ETB="\x17",e.CAN="\x18",e.EM="\x19",e.SUB="\x1a",e.ESC="\x1b",e.FS="\x1c",e.GS="\x1d",e.RS="\x1e",e.US="\x1f",e.SP=" ",e.DEL="\x7f"}(n||(t.C0=n={})),function(e){e.PAD="\x80",e.HOP="\x81",e.BPH="\x82",e.NBH="\x83",e.IND="\x84",e.NEL="\x85",e.SSA="\x86",e.ESA="\x87",e.HTS="\x88",e.HTJ="\x89",e.VTS="\x8a",e.PLD="\x8b",e.PLU="\x8c",e.RI="\x8d",e.SS2="\x8e",e.SS3="\x8f",e.DCS="\x90",e.PU1="\x91",e.PU2="\x92",e.STS="\x93",e.CCH="\x94",e.MW="\x95",e.SPA="\x96",e.EPA="\x97",e.SOS="\x98",e.SGCI="\x99",e.SCI="\x9a",e.CSI="\x9b",e.ST="\x9c",e.OSC="\x9d",e.PM="\x9e",e.APC="\x9f"}(r||(t.C1=r={})),function(e){e.ST="".concat(n.ESC,"\\")}(i||(t.C1_ESCAPED=i={}))},7399:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.evaluateKeyboardEvent=void 0;const r=n(2584),i={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};t.evaluateKeyboardEvent=function(e,t,n,o){const s={type:0,cancel:!1,key:void 0},a=(e.shiftKey?1:0)|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:"UIKeyInputUpArrow"===e.key?s.key=t?r.C0.ESC+"OA":r.C0.ESC+"[A":"UIKeyInputLeftArrow"===e.key?s.key=t?r.C0.ESC+"OD":r.C0.ESC+"[D":"UIKeyInputRightArrow"===e.key?s.key=t?r.C0.ESC+"OC":r.C0.ESC+"[C":"UIKeyInputDownArrow"===e.key&&(s.key=t?r.C0.ESC+"OB":r.C0.ESC+"[B");break;case 8:if(e.altKey){s.key=r.C0.ESC+r.C0.DEL;break}s.key=r.C0.DEL;break;case 9:if(e.shiftKey){s.key=r.C0.ESC+"[Z";break}s.key=r.C0.HT,s.cancel=!0;break;case 13:s.key=e.altKey?r.C0.ESC+r.C0.CR:r.C0.CR,s.cancel=!0;break;case 27:s.key=r.C0.ESC,e.altKey&&(s.key=r.C0.ESC+r.C0.ESC),s.cancel=!0;break;case 37:if(e.metaKey)break;a?(s.key=r.C0.ESC+"[1;"+(a+1)+"D",s.key===r.C0.ESC+"[1;3D"&&(s.key=r.C0.ESC+(n?"b":"[1;5D"))):s.key=t?r.C0.ESC+"OD":r.C0.ESC+"[D";break;case 39:if(e.metaKey)break;a?(s.key=r.C0.ESC+"[1;"+(a+1)+"C",s.key===r.C0.ESC+"[1;3C"&&(s.key=r.C0.ESC+(n?"f":"[1;5C"))):s.key=t?r.C0.ESC+"OC":r.C0.ESC+"[C";break;case 38:if(e.metaKey)break;a?(s.key=r.C0.ESC+"[1;"+(a+1)+"A",n||s.key!==r.C0.ESC+"[1;3A"||(s.key=r.C0.ESC+"[1;5A")):s.key=t?r.C0.ESC+"OA":r.C0.ESC+"[A";break;case 40:if(e.metaKey)break;a?(s.key=r.C0.ESC+"[1;"+(a+1)+"B",n||s.key!==r.C0.ESC+"[1;3B"||(s.key=r.C0.ESC+"[1;5B")):s.key=t?r.C0.ESC+"OB":r.C0.ESC+"[B";break;case 45:e.shiftKey||e.ctrlKey||(s.key=r.C0.ESC+"[2~");break;case 46:s.key=a?r.C0.ESC+"[3;"+(a+1)+"~":r.C0.ESC+"[3~";break;case 36:s.key=a?r.C0.ESC+"[1;"+(a+1)+"H":t?r.C0.ESC+"OH":r.C0.ESC+"[H";break;case 35:s.key=a?r.C0.ESC+"[1;"+(a+1)+"F":t?r.C0.ESC+"OF":r.C0.ESC+"[F";break;case 33:e.shiftKey?s.type=2:e.ctrlKey?s.key=r.C0.ESC+"[5;"+(a+1)+"~":s.key=r.C0.ESC+"[5~";break;case 34:e.shiftKey?s.type=3:e.ctrlKey?s.key=r.C0.ESC+"[6;"+(a+1)+"~":s.key=r.C0.ESC+"[6~";break;case 112:s.key=a?r.C0.ESC+"[1;"+(a+1)+"P":r.C0.ESC+"OP";break;case 113:s.key=a?r.C0.ESC+"[1;"+(a+1)+"Q":r.C0.ESC+"OQ";break;case 114:s.key=a?r.C0.ESC+"[1;"+(a+1)+"R":r.C0.ESC+"OR";break;case 115:s.key=a?r.C0.ESC+"[1;"+(a+1)+"S":r.C0.ESC+"OS";break;case 116:s.key=a?r.C0.ESC+"[15;"+(a+1)+"~":r.C0.ESC+"[15~";break;case 117:s.key=a?r.C0.ESC+"[17;"+(a+1)+"~":r.C0.ESC+"[17~";break;case 118:s.key=a?r.C0.ESC+"[18;"+(a+1)+"~":r.C0.ESC+"[18~";break;case 119:s.key=a?r.C0.ESC+"[19;"+(a+1)+"~":r.C0.ESC+"[19~";break;case 120:s.key=a?r.C0.ESC+"[20;"+(a+1)+"~":r.C0.ESC+"[20~";break;case 121:s.key=a?r.C0.ESC+"[21;"+(a+1)+"~":r.C0.ESC+"[21~";break;case 122:s.key=a?r.C0.ESC+"[23;"+(a+1)+"~":r.C0.ESC+"[23~";break;case 123:s.key=a?r.C0.ESC+"[24;"+(a+1)+"~":r.C0.ESC+"[24~";break;default:if(!e.ctrlKey||e.shiftKey||e.altKey||e.metaKey)if(n&&!o||!e.altKey||e.metaKey)!n||e.altKey||e.ctrlKey||e.shiftKey||!e.metaKey?e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&1===e.key.length?s.key=e.key:e.key&&e.ctrlKey&&("_"===e.key&&(s.key=r.C0.US),"@"===e.key&&(s.key=r.C0.NUL)):65===e.keyCode&&(s.type=1);else{const t=i[e.keyCode],n=null==t?void 0:t[e.shiftKey?1:0];if(n)s.key=r.C0.ESC+n;else if(e.keyCode>=65&&e.keyCode<=90){const t=e.ctrlKey?e.keyCode-64:e.keyCode+32;let n=String.fromCharCode(t);e.shiftKey&&(n=n.toUpperCase()),s.key=r.C0.ESC+n}else if(32===e.keyCode)s.key=r.C0.ESC+(e.ctrlKey?r.C0.NUL:" ");else if("Dead"===e.key&&e.code.startsWith("Key")){let t=e.code.slice(3,4);e.shiftKey||(t=t.toLowerCase()),s.key=r.C0.ESC+t,s.cancel=!0}}else e.keyCode>=65&&e.keyCode<=90?s.key=String.fromCharCode(e.keyCode-64):32===e.keyCode?s.key=r.C0.NUL:e.keyCode>=51&&e.keyCode<=55?s.key=String.fromCharCode(e.keyCode-51+27):56===e.keyCode?s.key=r.C0.DEL:219===e.keyCode?s.key=r.C0.ESC:220===e.keyCode?s.key=r.C0.FS:221===e.keyCode&&(s.key=r.C0.GS)}return s}},482:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Utf8ToUtf32=t.StringToUtf32=t.utf32ToString=t.stringFromCodePoint=void 0,t.stringFromCodePoint=function(e){return e>65535?(e-=65536,String.fromCharCode(55296+(e>>10))+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)},t.utf32ToString=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r="";for(let i=t;i<n;++i){let t=e[i];t>65535?(t-=65536,r+=String.fromCharCode(55296+(t>>10))+String.fromCharCode(t%1024+56320)):r+=String.fromCharCode(t)}return r},t.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){const n=e.length;if(!n)return 0;let r=0,i=0;if(this._interim){const n=e.charCodeAt(i++);56320<=n&&n<=57343?t[r++]=1024*(this._interim-55296)+n-56320+65536:(t[r++]=this._interim,t[r++]=n),this._interim=0}for(let o=i;o<n;++o){const i=e.charCodeAt(o);if(55296<=i&&i<=56319){if(++o>=n)return this._interim=i,r;const s=e.charCodeAt(o);56320<=s&&s<=57343?t[r++]=1024*(i-55296)+s-56320+65536:(t[r++]=i,t[r++]=s)}else 65279!==i&&(t[r++]=i)}return r}},t.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){const n=e.length;if(!n)return 0;let r,i,o,s,a=0,l=0,c=0;if(this.interim[0]){let r=!1,i=this.interim[0];i&=192==(224&i)?31:224==(240&i)?15:7;let o,s=0;for(;(o=63&this.interim[++s])&&s<4;)i<<=6,i|=o;const l=192==(224&this.interim[0])?2:224==(240&this.interim[0])?3:4,u=l-s;for(;c<u;){if(c>=n)return 0;if(o=e[c++],128!=(192&o)){c--,r=!0;break}this.interim[s++]=o,i<<=6,i|=63&o}r||(2===l?i<128?c--:t[a++]=i:3===l?i<2048||i>=55296&&i<=57343||65279===i||(t[a++]=i):i<65536||i>1114111||(t[a++]=i)),this.interim.fill(0)}const u=n-4;let d=c;for(;d<n;){for(;!(!(d<u)||128&(r=e[d])||128&(i=e[d+1])||128&(o=e[d+2])||128&(s=e[d+3]));)t[a++]=r,t[a++]=i,t[a++]=o,t[a++]=s,d+=4;if(r=e[d++],r<128)t[a++]=r;else if(192==(224&r)){if(d>=n)return this.interim[0]=r,a;if(i=e[d++],128!=(192&i)){d--;continue}if(l=(31&r)<<6|63&i,l<128){d--;continue}t[a++]=l}else if(224==(240&r)){if(d>=n)return this.interim[0]=r,a;if(i=e[d++],128!=(192&i)){d--;continue}if(d>=n)return this.interim[0]=r,this.interim[1]=i,a;if(o=e[d++],128!=(192&o)){d--;continue}if(l=(15&r)<<12|(63&i)<<6|63&o,l<2048||l>=55296&&l<=57343||65279===l)continue;t[a++]=l}else if(240==(248&r)){if(d>=n)return this.interim[0]=r,a;if(i=e[d++],128!=(192&i)){d--;continue}if(d>=n)return this.interim[0]=r,this.interim[1]=i,a;if(o=e[d++],128!=(192&o)){d--;continue}if(d>=n)return this.interim[0]=r,this.interim[1]=i,this.interim[2]=o,a;if(s=e[d++],128!=(192&s)){d--;continue}if(l=(7&r)<<18|(63&i)<<12|(63&o)<<6|63&s,l<65536||l>1114111)continue;t[a++]=l}}return a}}},225:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeV6=void 0;const n=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],r=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]];let i;t.UnicodeV6=class{constructor(){if(this.version="6",!i){i=new Uint8Array(65536),i.fill(1),i[0]=0,i.fill(0,1,32),i.fill(0,127,160),i.fill(2,4352,4448),i[9001]=2,i[9002]=2,i.fill(2,11904,42192),i[12351]=1,i.fill(2,44032,55204),i.fill(2,63744,64256),i.fill(2,65040,65050),i.fill(2,65072,65136),i.fill(2,65280,65377),i.fill(2,65504,65511);for(let e=0;e<n.length;++e)i.fill(0,n[e][0],n[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?i[e]:function(e,t){let n,r=0,i=t.length-1;if(e<t[0][0]||e>t[i][1])return!1;for(;i>=r;)if(n=r+i>>1,e>t[n][1])r=n+1;else{if(!(e<t[n][0]))return!0;i=n-1}return!1}(e,r)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}}},5981:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WriteBuffer=void 0;const r=n(8460),i=n(844);class o extends i.Disposable{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new r.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(void 0!==t&&this._syncCalls>t)return void(this._syncCalls=0);if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let n;for(this._isSyncWriting=!0;n=this._writeBuffer.shift();){this._action(n);const e=this._callbacks.shift();e&&e()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>5e7)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput)return this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),void this._innerWrite();setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:0)||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const n=this._writeBuffer[this._bufferOffset],r=this._action(n,e);if(r){const e=e=>Date.now()-t>=12?setTimeout(()=>this._innerWrite(0,e)):this._innerWrite(t,e);return void r.catch(e=>(queueMicrotask(()=>{throw e}),Promise.resolve(!1))).then(e)}const i=this._callbacks[this._bufferOffset];if(i&&i(),this._bufferOffset++,this._pendingData-=n.length,Date.now()-t>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout(()=>this._innerWrite())):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}}t.WriteBuffer=o},5941:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.toRgbString=t.parseColor=void 0;const n=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,r=/^[\da-f]+$/;function i(e,t){const n=e.toString(16),r=n.length<2?"0"+n:n;switch(t){case 4:return n[0];case 8:return r;case 12:return(r+r).slice(0,3);default:return r+r}}t.parseColor=function(e){if(!e)return;let t=e.toLowerCase();if(0===t.indexOf("rgb:")){t=t.slice(4);const e=n.exec(t);if(e){const t=e[1]?15:e[4]?255:e[7]?4095:65535;return[Math.round(parseInt(e[1]||e[4]||e[7]||e[10],16)/t*255),Math.round(parseInt(e[2]||e[5]||e[8]||e[11],16)/t*255),Math.round(parseInt(e[3]||e[6]||e[9]||e[12],16)/t*255)]}}else if(0===t.indexOf("#")&&(t=t.slice(1),r.exec(t)&&[3,6,9,12].includes(t.length))){const e=t.length/3,n=[0,0,0];for(let r=0;r<3;++r){const i=parseInt(t.slice(e*r,e*r+e),16);n[r]=1===e?i<<4:2===e?i:3===e?i>>4:i>>8}return n}},t.toRgbString=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:16;const[n,r,o]=e;return"rgb:".concat(i(n,t),"/").concat(i(r,t),"/").concat(i(o,t))}},5770:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PAYLOAD_LIMIT=void 0,t.PAYLOAD_LIMIT=1e7},6351:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DcsHandler=t.DcsParser=void 0;const r=n(482),i=n(8742),o=n(5770),s=[];t.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=s,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=s}registerHandler(e,t){void 0===this._handlers[e]&&(this._handlers[e]=[]);const n=this._handlers[e];return n.push(t),{dispose:()=>{const e=n.indexOf(t);-1!==e&&n.splice(e,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}reset(){if(this._active.length)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].unhook(!1);this._stack.paused=!1,this._active=s,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||s,this._active.length)for(let n=this._active.length-1;n>=0;n--)this._active[n].hook(t);else this._handlerFb(this._ident,"HOOK",t)}put(e,t,n){if(this._active.length)for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n);else this._handlerFb(this._ident,"PUT",(0,r.utf32ToString)(e,t,n))}unhook(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this._active.length){let n=!1,r=this._active.length-1,i=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&!1===n){for(;r>=0&&(n=this._active[r].unhook(e),!0!==n);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].unhook(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}else this._handlerFb(this._ident,"UNHOOK",e);this._active=s,this._ident=0}};const a=new i.Params;a.addParam(0),t.DcsHandler=class{constructor(e){this._handler=e,this._data="",this._params=a,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():a,this._data="",this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=(0,r.utf32ToString)(e,t,n),this._data.length>o.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data,this._params),t instanceof Promise))return t.then(e=>(this._params=a,this._data="",this._hitLimit=!1,e));return this._params=a,this._data="",this._hitLimit=!1,t}}},2015:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.EscapeSequenceParser=t.VT500_TRANSITION_TABLE=t.TransitionTable=void 0;const r=n(844),i=n(8742),o=n(6242),s=n(6351);class a{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,n,r){this.table[t<<8|e]=n<<4|r}addMany(e,t,n,r){for(let i=0;i<e.length;i++)this.table[t<<8|e[i]]=n<<4|r}}t.TransitionTable=a;const l=160;t.VT500_TRANSITION_TABLE=function(){const e=new a(4095),t=Array.apply(null,Array(256)).map((e,t)=>t),n=(e,n)=>t.slice(e,n),r=n(32,127),i=n(0,24);i.push(25),i.push.apply(i,n(28,32));const o=n(0,14);let s;for(s in e.setDefault(1,0),e.addMany(r,0,2,0),o)e.addMany([24,26,153,154],s,3,0),e.addMany(n(128,144),s,3,0),e.addMany(n(144,152),s,3,0),e.add(156,s,0,0),e.add(27,s,11,1),e.add(157,s,4,8),e.addMany([152,158,159],s,0,7),e.add(155,s,11,3),e.add(144,s,11,9);return e.addMany(i,0,3,0),e.addMany(i,1,3,1),e.add(127,1,0,1),e.addMany(i,8,0,8),e.addMany(i,3,3,3),e.add(127,3,0,3),e.addMany(i,4,3,4),e.add(127,4,0,4),e.addMany(i,6,3,6),e.addMany(i,5,3,5),e.add(127,5,0,5),e.addMany(i,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(r,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(n(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(r,7,0,7),e.addMany(i,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(n(64,127),3,7,0),e.addMany(n(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(n(48,60),4,8,4),e.addMany(n(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(n(32,64),6,0,6),e.add(127,6,0,6),e.addMany(n(64,127),6,0,0),e.addMany(n(32,48),3,9,5),e.addMany(n(32,48),5,9,5),e.addMany(n(48,64),5,0,6),e.addMany(n(64,127),5,7,0),e.addMany(n(32,48),4,9,5),e.addMany(n(32,48),1,9,2),e.addMany(n(32,48),2,9,2),e.addMany(n(48,127),2,10,0),e.addMany(n(48,80),1,10,0),e.addMany(n(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(n(96,127),1,10,0),e.add(80,1,11,9),e.addMany(i,9,0,9),e.add(127,9,0,9),e.addMany(n(28,32),9,0,9),e.addMany(n(32,48),9,9,12),e.addMany(n(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(i,11,0,11),e.addMany(n(32,128),11,0,11),e.addMany(n(28,32),11,0,11),e.addMany(i,10,0,10),e.add(127,10,0,10),e.addMany(n(28,32),10,0,10),e.addMany(n(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(n(32,48),10,9,12),e.addMany(i,12,0,12),e.add(127,12,0,12),e.addMany(n(28,32),12,0,12),e.addMany(n(32,48),12,9,12),e.addMany(n(48,64),12,0,11),e.addMany(n(64,127),12,12,13),e.addMany(n(64,127),10,12,13),e.addMany(n(64,127),9,12,13),e.addMany(i,13,13,13),e.addMany(r,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(l,0,2,0),e.add(l,8,5,8),e.add(l,6,0,6),e.add(l,11,0,11),e.add(l,13,13,13),e}();class c extends r.Disposable{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t.VT500_TRANSITION_TABLE;super(),this._transitions=e,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new i.Params,this._params.addParam(0),this._collect=0,this.precedingCodepoint=0,this._printHandlerFb=(e,t,n)=>{},this._executeHandlerFb=e=>{},this._csiHandlerFb=(e,t)=>{},this._escHandlerFb=e=>{},this._errorHandlerFb=e=>e,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,r.toDisposable)(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this.register(new o.OscParser),this._dcsParser=this.register(new s.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[64,126],n=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(n=e.prefix.charCodeAt(0),n&&60>n||n>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(e.intermediates){if(e.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let t=0;t<e.intermediates.length;++t){const r=e.intermediates.charCodeAt(t);if(32>r||r>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");n<<=8,n|=r}}if(1!==e.final.length)throw new Error("final must be a single byte");const r=e.final.charCodeAt(0);if(t[0]>r||r>t[1])throw new Error("final must be in range ".concat(t[0]," .. ").concat(t[1]));return n<<=8,n|=r,n}identToString(e){const t=[];for(;e;)t.push(String.fromCharCode(255&e)),e>>=8;return t.reverse().join("")}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){const n=this._identifier(e,[48,126]);void 0===this._escHandlers[n]&&(this._escHandlers[n]=[]);const r=this._escHandlers[n];return r.push(t),{dispose:()=>{const e=r.indexOf(t);-1!==e&&r.splice(e,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,t){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){const n=this._identifier(e);void 0===this._csiHandlers[n]&&(this._csiHandlers[n]=[]);const r=this._csiHandlers[n];return r.push(t),{dispose:()=>{const e=r.indexOf(t);-1!==e&&r.splice(e,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingCodepoint=0,0!==this._parseStack.state&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,t,n,r,i){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=n,this._parseStack.transition=r,this._parseStack.chunkPos=i}parse(e,t,n){let r,i=0,o=0,s=0;if(this._parseStack.state)if(2===this._parseStack.state)this._parseStack.state=0,s=this._parseStack.chunkPos+1;else{if(void 0===n||1===this._parseStack.state)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");const t=this._parseStack.handlers;let o=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(!1===n&&o>-1)for(;o>=0&&(r=t[o](this._params),!0!==r);o--)if(r instanceof Promise)return this._parseStack.handlerPos=o,r;this._parseStack.handlers=[];break;case 4:if(!1===n&&o>-1)for(;o>=0&&(r=t[o](),!0!==r);o--)if(r instanceof Promise)return this._parseStack.handlerPos=o,r;this._parseStack.handlers=[];break;case 6:if(i=e[this._parseStack.chunkPos],r=this._dcsParser.unhook(24!==i&&26!==i,n),r)return r;27===i&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(i=e[this._parseStack.chunkPos],r=this._oscParser.end(24!==i&&26!==i,n),r)return r;27===i&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,s=this._parseStack.chunkPos+1,this.precedingCodepoint=0,this.currentState=15&this._parseStack.transition}for(let a=s;a<t;++a){switch(i=e[a],o=this._transitions.table[this.currentState<<8|(i<160?i:l)],o>>4){case 2:for(let r=a+1;;++r){if(r>=t||(i=e[r])<32||i>126&&i<l){this._printHandler(e,a,r),a=r-1;break}if(++r>=t||(i=e[r])<32||i>126&&i<l){this._printHandler(e,a,r),a=r-1;break}if(++r>=t||(i=e[r])<32||i>126&&i<l){this._printHandler(e,a,r),a=r-1;break}if(++r>=t||(i=e[r])<32||i>126&&i<l){this._printHandler(e,a,r),a=r-1;break}}break;case 3:this._executeHandlers[i]?this._executeHandlers[i]():this._executeHandlerFb(i),this.precedingCodepoint=0;break;case 0:break;case 1:if(this._errorHandler({position:a,code:i,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:const n=this._csiHandlers[this._collect<<8|i];let s=n?n.length-1:-1;for(;s>=0&&(r=n[s](this._params),!0!==r);s--)if(r instanceof Promise)return this._preserveStack(3,n,s,o,a),r;s<0&&this._csiHandlerFb(this._collect<<8|i,this._params),this.precedingCodepoint=0;break;case 8:do{switch(i){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(i-48)}}while(++a<t&&(i=e[a])>47&&i<60);a--;break;case 9:this._collect<<=8,this._collect|=i;break;case 10:const c=this._escHandlers[this._collect<<8|i];let u=c?c.length-1:-1;for(;u>=0&&(r=c[u](),!0!==r);u--)if(r instanceof Promise)return this._preserveStack(4,c,u,o,a),r;u<0&&this._escHandlerFb(this._collect<<8|i),this.precedingCodepoint=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|i,this._params);break;case 13:for(let r=a+1;;++r)if(r>=t||24===(i=e[r])||26===i||27===i||i>127&&i<l){this._dcsParser.put(e,a,r),a=r-1;break}break;case 14:if(r=this._dcsParser.unhook(24!==i&&26!==i),r)return this._preserveStack(6,[],0,o,a),r;27===i&&(o|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingCodepoint=0;break;case 4:this._oscParser.start();break;case 5:for(let r=a+1;;r++)if(r>=t||(i=e[r])<32||i>127&&i<l){this._oscParser.put(e,a,r),a=r-1;break}break;case 6:if(r=this._oscParser.end(24!==i&&26!==i),r)return this._preserveStack(5,[],0,o,a),r;27===i&&(o|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingCodepoint=0}this.currentState=15&o}}}t.EscapeSequenceParser=c},6242:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.OscHandler=t.OscParser=void 0;const r=n(5770),i=n(482),o=[];t.OscParser=class{constructor(){this._state=0,this._active=o,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){void 0===this._handlers[e]&&(this._handlers[e]=[]);const n=this._handlers[e];return n.push(t),{dispose:()=>{const e=n.indexOf(t);-1!==e&&n.splice(e,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=o}reset(){if(2===this._state)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].end(!1);this._stack.paused=!1,this._active=o,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||o,this._active.length)for(let e=this._active.length-1;e>=0;e--)this._active[e].start();else this._handlerFb(this._id,"START")}_put(e,t,n){if(this._active.length)for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n);else this._handlerFb(this._id,"PUT",(0,i.utf32ToString)(e,t,n))}start(){this.reset(),this._state=1}put(e,t,n){if(3!==this._state){if(1===this._state)for(;t<n;){const n=e[t++];if(59===n){this._state=2,this._start();break}if(n<48||57<n)return void(this._state=3);-1===this._id&&(this._id=0),this._id=10*this._id+n-48}2===this._state&&n-t>0&&this._put(e,t,n)}}end(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(0!==this._state){if(3!==this._state)if(1===this._state&&this._start(),this._active.length){let n=!1,r=this._active.length-1,i=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&!1===n){for(;r>=0&&(n=this._active[r].end(e),!0!==n);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].end(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}else this._handlerFb(this._id,"END",e);this._active=o,this._id=-1,this._state=0}}},t.OscHandler=class{constructor(e){this._handler=e,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=(0,i.utf32ToString)(e,t,n),this._data.length>r.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data),t instanceof Promise))return t.then(e=>(this._data="",this._hitLimit=!1,e));return this._data="",this._hitLimit=!1,t}}},8742:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Params=void 0;const n=2147483647;class r{static fromArray(e){const t=new r;if(!e.length)return t;for(let n=Array.isArray(e[0])?1:0;n<e.length;++n){const r=e[n];if(Array.isArray(r))for(let e=0;e<r.length;++e)t.addSubParam(r[e]);else t.addParam(r)}return t}constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:32,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:32;if(this.maxLength=e,this.maxSubParamsLength=t,t>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(e),this.length=0,this._subParams=new Int32Array(t),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(e),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const e=new r(this.maxLength,this.maxSubParamsLength);return e.params.set(this.params),e.length=this.length,e._subParams.set(this._subParams),e._subParamsLength=this._subParamsLength,e._subParamsIdx.set(this._subParamsIdx),e._rejectDigits=this._rejectDigits,e._rejectSubDigits=this._rejectSubDigits,e._digitIsSub=this._digitIsSub,e}toArray(){const e=[];for(let t=0;t<this.length;++t){e.push(this.params[t]);const n=this._subParamsIdx[t]>>8,r=255&this._subParamsIdx[t];r-n>0&&e.push(Array.prototype.slice.call(this._subParams,n,r))}return e}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(e){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(e<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=e>n?n:e}}addSubParam(e){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(e<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=e>n?n:e,this._subParamsIdx[this.length-1]++}}hasSubParams(e){return(255&this._subParamsIdx[e])-(this._subParamsIdx[e]>>8)>0}getSubParams(e){const t=this._subParamsIdx[e]>>8,n=255&this._subParamsIdx[e];return n-t>0?this._subParams.subarray(t,n):null}getSubParamsAll(){const e={};for(let t=0;t<this.length;++t){const n=this._subParamsIdx[t]>>8,r=255&this._subParamsIdx[t];r-n>0&&(e[t]=this._subParams.slice(n,r))}return e}addDigit(e){let t;if(this._rejectDigits||!(t=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const r=this._digitIsSub?this._subParams:this.params,i=r[t-1];r[t-1]=~i?Math.min(10*i+e,n):e}}t.Params=r},5741:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AddonManager=void 0,t.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){const n={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(n),t.dispose=()=>this._wrappedAddonDispose(n),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let n=0;n<this._addons.length;n++)if(this._addons[n]===e){t=n;break}if(-1===t)throw new Error("Could not dispose an addon that has not been loaded");e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(t,1)}}},8771:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferApiView=void 0;const r=n(3785),i=n(511);t.BufferApiView=class{constructor(e,t){this._buffer=e,this.type=t}init(e){return this._buffer=e,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(e){const t=this._buffer.lines.get(e);if(t)return new r.BufferLineApiView(t)}getNullCell(){return new i.CellData}}},3785:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferLineApiView=void 0;const r=n(511);t.BufferLineApiView=class{constructor(e){this._line=e}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(e,t){if(!(e<0||e>=this._line.length))return t?(this._line.loadCell(e,t),t):this._line.loadCell(e,new r.CellData)}translateToString(e,t,n){return this._line.translateToString(e,t,n)}}},8285:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferNamespaceApi=void 0;const r=n(8771),i=n(8460),o=n(844);class s extends o.Disposable{constructor(e){super(),this._core=e,this._onBufferChange=this.register(new i.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new r.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new r.BufferApiView(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate(()=>this._onBufferChange.fire(this.active))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}}t.BufferNamespaceApi=s},7975:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ParserApi=void 0,t.ParserApi=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,e=>t(e.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(e,n)=>t(e,n.toArray()))}addDcsHandler(e,t){return this.registerDcsHandler(e,t)}registerEscHandler(e,t){return this._core.registerEscHandler(e,t)}addEscHandler(e,t){return this.registerEscHandler(e,t)}registerOscHandler(e,t){return this._core.registerOscHandler(e,t)}addOscHandler(e,t){return this.registerOscHandler(e,t)}}},7090:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeApi=void 0,t.UnicodeApi=class{constructor(e){this._core=e}register(e){this._core.unicodeService.register(e)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(e){this._core.unicodeService.activeVersion=e}}},744:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,o=arguments.length,s=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,n,s):i(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.BufferService=t.MINIMUM_ROWS=t.MINIMUM_COLS=void 0;const o=n(8460),s=n(844),a=n(5295),l=n(2585);t.MINIMUM_COLS=2,t.MINIMUM_ROWS=1;let c=t.BufferService=class extends s.Disposable{get buffer(){return this.buffers.active}constructor(e){super(),this.isUserScrolling=!1,this._onResize=this.register(new o.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new o.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,t.MINIMUM_COLS),this.rows=Math.max(e.rawOptions.rows||0,t.MINIMUM_ROWS),this.buffers=this.register(new a.BufferSet(e,this))}resize(e,t){this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const n=this.buffer;let r;r=this._cachedBlankLine,r&&r.length===this.cols&&r.getFg(0)===e.fg&&r.getBg(0)===e.bg||(r=n.getBlankLine(e,t),this._cachedBlankLine=r),r.isWrapped=t;const i=n.ybase+n.scrollTop,o=n.ybase+n.scrollBottom;if(0===n.scrollTop){const e=n.lines.isFull;o===n.lines.length-1?e?n.lines.recycle().copyFrom(r):n.lines.push(r.clone()):n.lines.splice(o+1,0,r.clone()),e?this.isUserScrolling&&(n.ydisp=Math.max(n.ydisp-1,0)):(n.ybase++,this.isUserScrolling||n.ydisp++)}else{const e=o-i+1;n.lines.shiftElements(i+1,e-1,-1),n.lines.set(o,r.clone())}this.isUserScrolling||(n.ydisp=n.ybase),this._onScroll.fire(n.ydisp)}scrollLines(e,t,n){const r=this.buffer;if(e<0){if(0===r.ydisp)return;this.isUserScrolling=!0}else e+r.ydisp>=r.ybase&&(this.isUserScrolling=!1);const i=r.ydisp;r.ydisp=Math.max(Math.min(r.ydisp+e,r.ybase),0),i!==r.ydisp&&(t||this._onScroll.fire(r.ydisp))}};t.BufferService=c=r([i(0,l.IOptionsService)],c)},7994:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CharsetService=void 0,t.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(e){this.glevel=e,this.charset=this._charsets[e]}setgCharset(e,t){this._charsets[e]=t,this.glevel===e&&(this.charset=t)}}},1753:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,o=arguments.length,s=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,n,s):i(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreMouseService=void 0;const o=n(2585),s=n(8460),a=n(844),l={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>4!==e.button&&1===e.action&&(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:e=>32!==e.action},DRAG:{events:23,restrict:e=>32!==e.action||3!==e.button},ANY:{events:31,restrict:e=>!0}};function c(e,t){let n=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return 4===e.button?(n|=64,n|=e.action):(n|=3&e.button,4&e.button&&(n|=64),8&e.button&&(n|=128),32===e.action?n|=32:0!==e.action||t||(n|=3)),n}const u=String.fromCharCode,d={DEFAULT:e=>{const t=[c(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":"\x1b[M".concat(u(t[0])).concat(u(t[1])).concat(u(t[2]))},SGR:e=>{const t=0===e.action&&4!==e.button?"m":"M";return"\x1b[<".concat(c(e,!0),";").concat(e.col,";").concat(e.row).concat(t)},SGR_PIXELS:e=>{const t=0===e.action&&4!==e.button?"m":"M";return"\x1b[<".concat(c(e,!0),";").concat(e.x,";").concat(e.y).concat(t)}};let h=t.CoreMouseService=class extends a.Disposable{constructor(e,t){super(),this._bufferService=e,this._coreService=t,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new s.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const n of Object.keys(l))this.addProtocol(n,l[n]);for(const n of Object.keys(d))this.addEncoding(n,d[n]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return 0!==this._protocols[this._activeProtocol].events}set activeProtocol(e){if(!this._protocols[e])throw new Error('unknown protocol "'.concat(e,'"'));this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw new Error('unknown encoding "'.concat(e,'"'));this._activeEncoding=e}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows)return!1;if(4===e.button&&32===e.action)return!1;if(3===e.button&&32!==e.action)return!1;if(4!==e.button&&(2===e.action||3===e.action))return!1;if(e.col++,e.row++,32===e.action&&this._lastEvent&&this._equalEvents(this._lastEvent,e,"SGR_PIXELS"===this._activeEncoding))return!1;if(!this._protocols[this._activeProtocol].restrict(e))return!1;const t=this._encodings[this._activeEncoding](e);return t&&("DEFAULT"===this._activeEncoding?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(1&e),up:!!(2&e),drag:!!(4&e),move:!!(8&e),wheel:!!(16&e)}}_equalEvents(e,t,n){if(n){if(e.x!==t.x)return!1;if(e.y!==t.y)return!1}else{if(e.col!==t.col)return!1;if(e.row!==t.row)return!1}return e.button===t.button&&e.action===t.action&&e.ctrl===t.ctrl&&e.alt===t.alt&&e.shift===t.shift}};t.CoreMouseService=h=r([i(0,o.IBufferService),i(1,o.ICoreService)],h)},6975:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,o=arguments.length,s=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,n,s):i(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreService=void 0;const o=n(1439),s=n(8460),a=n(844),l=n(2585),c=Object.freeze({insertMode:!1}),u=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let d=t.CoreService=class extends a.Disposable{constructor(e,t,n){super(),this._bufferService=e,this._logService=t,this._optionsService=n,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new s.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new s.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new s.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new s.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,o.clone)(c),this.decPrivateModes=(0,o.clone)(u)}reset(){this.modes=(0,o.clone)(c),this.decPrivateModes=(0,o.clone)(u)}triggerDataEvent(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(this._optionsService.rawOptions.disableStdin)return;const n=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&n.ybase!==n.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug('sending data "'.concat(e,'"'),()=>e.split("").map(e=>e.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug('sending binary "'.concat(e,'"'),()=>e.split("").map(e=>e.charCodeAt(0))),this._onBinary.fire(e))}};t.CoreService=d=r([i(0,l.IBufferService),i(1,l.ILogService),i(2,l.IOptionsService)],d)},9074:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DecorationService=void 0;const r=n(8055),i=n(8460),o=n(844),s=n(6106);let a=0,l=0;class c extends o.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new s.SortedList(e=>null==e?void 0:e.marker.line),this._onDecorationRegistered=this.register(new i.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new i.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,o.toDisposable)(()=>this.reset()))}registerDecoration(e){if(e.marker.isDisposed)return;const t=new u(e);if(t){const e=t.marker.onDispose(()=>t.dispose());t.onDispose(()=>{t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),e.dispose())}),this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(const e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,t,n){var r,i,o;let s=0,a=0;for(const l of this._decorations.getKeyIterator(t))s=null!==(r=l.options.x)&&void 0!==r?r:0,a=s+(null!==(i=l.options.width)&&void 0!==i?i:1),e>=s&&e<a&&(!n||(null!==(o=l.options.layer)&&void 0!==o?o:"bottom")===n)&&(yield l)}forEachDecorationAtCell(e,t,n,r){this._decorations.forEachByKey(t,t=>{var i,o,s;a=null!==(i=t.options.x)&&void 0!==i?i:0,l=a+(null!==(o=t.options.width)&&void 0!==o?o:1),e>=a&&e<l&&(!n||(null!==(s=t.options.layer)&&void 0!==s?s:"bottom")===n)&&r(t)})}}t.DecorationService=c;class u extends o.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return null===this._cachedBg&&(this.options.backgroundColor?this._cachedBg=r.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return null===this._cachedFg&&(this.options.foregroundColor?this._cachedFg=r.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(e){super(),this.options=e,this.onRenderEmitter=this.register(new i.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new i.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.InstantiationService=t.ServiceCollection=void 0;const r=n(2585),i=n(8343);class o{constructor(){this._entries=new Map;for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];for(const[r,i]of t)this.set(r,i)}set(e,t){const n=this._entries.get(e);return this._entries.set(e,t),n}forEach(e){for(const[t,n]of this._entries.entries())e(t,n)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}}t.ServiceCollection=o,t.InstantiationService=class{constructor(){this._services=new o,this._services.set(r.IInstantiationService,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e){const t=(0,i.getServiceDependencies)(e).sort((e,t)=>e.index-t.index),n=[];for(const i of t){const t=this._services.get(i.id);if(!t)throw new Error("[createInstance] ".concat(e.name," depends on UNKNOWN service ").concat(i.id,"."));n.push(t)}for(var r=arguments.length,o=new Array(r>1?r-1:0),s=1;s<r;s++)o[s-1]=arguments[s];const a=t.length>0?t[0].index:o.length;if(o.length!==a)throw new Error("[createInstance] First service dependency of ".concat(e.name," at position ").concat(a+1," conflicts with ").concat(o.length," static arguments"));return new e(...[...o,...n])}}},7866:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,o=arguments.length,s=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,n,s):i(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.traceCall=t.setTraceLogger=t.LogService=void 0;const o=n(844),s=n(2585),a={trace:s.LogLevelEnum.TRACE,debug:s.LogLevelEnum.DEBUG,info:s.LogLevelEnum.INFO,warn:s.LogLevelEnum.WARN,error:s.LogLevelEnum.ERROR,off:s.LogLevelEnum.OFF};let l,c=t.LogService=class extends o.Disposable{get logLevel(){return this._logLevel}constructor(e){super(),this._optionsService=e,this._logLevel=s.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel())),l=this}_updateLogLevel(){this._logLevel=a[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)"function"==typeof e[t]&&(e[t]=e[t]())}_log(e,t,n){this._evalLazyOptionalParams(n),e.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+t,...n)}trace(e){for(var t,n,r=arguments.length,i=new Array(r>1?r-1:0),o=1;o<r;o++)i[o-1]=arguments[o];this._logLevel<=s.LogLevelEnum.TRACE&&this._log(null!==(n=null===(t=this._optionsService.options.logger)||void 0===t?void 0:t.trace.bind(this._optionsService.options.logger))&&void 0!==n?n:console.log,e,i)}debug(e){for(var t,n,r=arguments.length,i=new Array(r>1?r-1:0),o=1;o<r;o++)i[o-1]=arguments[o];this._logLevel<=s.LogLevelEnum.DEBUG&&this._log(null!==(n=null===(t=this._optionsService.options.logger)||void 0===t?void 0:t.debug.bind(this._optionsService.options.logger))&&void 0!==n?n:console.log,e,i)}info(e){for(var t,n,r=arguments.length,i=new Array(r>1?r-1:0),o=1;o<r;o++)i[o-1]=arguments[o];this._logLevel<=s.LogLevelEnum.INFO&&this._log(null!==(n=null===(t=this._optionsService.options.logger)||void 0===t?void 0:t.info.bind(this._optionsService.options.logger))&&void 0!==n?n:console.info,e,i)}warn(e){for(var t,n,r=arguments.length,i=new Array(r>1?r-1:0),o=1;o<r;o++)i[o-1]=arguments[o];this._logLevel<=s.LogLevelEnum.WARN&&this._log(null!==(n=null===(t=this._optionsService.options.logger)||void 0===t?void 0:t.warn.bind(this._optionsService.options.logger))&&void 0!==n?n:console.warn,e,i)}error(e){for(var t,n,r=arguments.length,i=new Array(r>1?r-1:0),o=1;o<r;o++)i[o-1]=arguments[o];this._logLevel<=s.LogLevelEnum.ERROR&&this._log(null!==(n=null===(t=this._optionsService.options.logger)||void 0===t?void 0:t.error.bind(this._optionsService.options.logger))&&void 0!==n?n:console.error,e,i)}};t.LogService=c=r([i(0,s.IOptionsService)],c),t.setTraceLogger=function(e){l=e},t.traceCall=function(e,t,n){if("function"!=typeof n.value)throw new Error("not supported");const r=n.value;n.value=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];if(l.logLevel!==s.LogLevelEnum.TRACE)return r.apply(this,t);l.trace("GlyphRenderer#".concat(r.name,"(").concat(t.map(e=>JSON.stringify(e)).join(", "),")"));const i=r.apply(this,t);return l.trace("GlyphRenderer#".concat(r.name," return"),i),i}}},7302:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.OptionsService=t.DEFAULT_OPTIONS=void 0;const r=n(8460),i=n(844),o=n(6114);t.DEFAULT_OPTIONS={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"courier-new, courier, monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},rightClickSelectsWord:o.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};const s=["normal","bold","100","200","300","400","500","600","700","800","900"];class a extends i.Disposable{constructor(e){super(),this._onOptionChange=this.register(new r.EventEmitter),this.onOptionChange=this._onOptionChange.event;const n=Object.assign({},t.DEFAULT_OPTIONS);for(const t in e)if(t in n)try{const r=e[t];n[t]=this._sanitizeAndValidateOption(t,r)}catch(e){console.error(e)}this.rawOptions=n,this.options=Object.assign({},n),this._setupOptions()}onSpecificOptionChange(e,t){return this.onOptionChange(n=>{n===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(n=>{-1!==e.indexOf(n)&&t()})}_setupOptions(){const e=e=>{if(!(e in t.DEFAULT_OPTIONS))throw new Error('No option with key "'.concat(e,'"'));return this.rawOptions[e]},n=(e,n)=>{if(!(e in t.DEFAULT_OPTIONS))throw new Error('No option with key "'.concat(e,'"'));n=this._sanitizeAndValidateOption(e,n),this.rawOptions[e]!==n&&(this.rawOptions[e]=n,this._onOptionChange.fire(e))};for(const t in this.rawOptions){const r={get:e.bind(this,t),set:n.bind(this,t)};Object.defineProperty(this.options,t,r)}}_sanitizeAndValidateOption(e,n){switch(e){case"cursorStyle":if(n||(n=t.DEFAULT_OPTIONS[e]),!function(e){return"block"===e||"underline"===e||"bar"===e}(n))throw new Error('"'.concat(n,'" is not a valid value for ').concat(e));break;case"wordSeparator":n||(n=t.DEFAULT_OPTIONS[e]);break;case"fontWeight":case"fontWeightBold":if("number"==typeof n&&1<=n&&n<=1e3)break;n=s.includes(n)?n:t.DEFAULT_OPTIONS[e];break;case"cursorWidth":n=Math.floor(n);case"lineHeight":case"tabStopWidth":if(n<1)throw new Error("".concat(e," cannot be less than 1, value: ").concat(n));break;case"minimumContrastRatio":n=Math.max(1,Math.min(21,Math.round(10*n)/10));break;case"scrollback":if((n=Math.min(n,4294967295))<0)throw new Error("".concat(e," cannot be less than 0, value: ").concat(n));break;case"fastScrollSensitivity":case"scrollSensitivity":if(n<=0)throw new Error("".concat(e," cannot be less than or equal to 0, value: ").concat(n));break;case"rows":case"cols":if(!n&&0!==n)throw new Error("".concat(e," must be numeric, value: ").concat(n));break;case"windowsPty":n=null!=n?n:{}}return n}}t.OptionsService=a},2660:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,o=arguments.length,s=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,n,s):i(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OscLinkService=void 0;const o=n(2585);let s=t.OscLinkService=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){const t=this._bufferService.buffer;if(void 0===e.id){const n=t.addMarker(t.ybase+t.y),r={data:e,id:this._nextId++,lines:[n]};return n.onDispose(()=>this._removeMarkerFromLink(r,n)),this._dataByLinkId.set(r.id,r),r.id}const n=e,r=this._getEntryIdKey(n),i=this._entriesWithId.get(r);if(i)return this.addLineToLink(i.id,t.ybase+t.y),i.id;const o=t.addMarker(t.ybase+t.y),s={id:this._nextId++,key:this._getEntryIdKey(n),data:n,lines:[o]};return o.onDispose(()=>this._removeMarkerFromLink(s,o)),this._entriesWithId.set(s.key,s),this._dataByLinkId.set(s.id,s),s.id}addLineToLink(e,t){const n=this._dataByLinkId.get(e);if(n&&n.lines.every(e=>e.line!==t)){const e=this._bufferService.buffer.addMarker(t);n.lines.push(e),e.onDispose(()=>this._removeMarkerFromLink(n,e))}}getLinkData(e){var t;return null===(t=this._dataByLinkId.get(e))||void 0===t?void 0:t.data}_getEntryIdKey(e){return"".concat(e.id,";;").concat(e.uri)}_removeMarkerFromLink(e,t){const n=e.lines.indexOf(t);-1!==n&&(e.lines.splice(n,1),0===e.lines.length&&(void 0!==e.data.id&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};t.OscLinkService=s=r([i(0,o.IBufferService)],s)},8343:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createDecorator=t.getServiceDependencies=t.serviceRegistry=void 0;const n="di$target",r="di$dependencies";t.serviceRegistry=new Map,t.getServiceDependencies=function(e){return e[r]||[]},t.createDecorator=function(e){if(t.serviceRegistry.has(e))return t.serviceRegistry.get(e);const i=function(e,t,o){if(3!==arguments.length)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");!function(e,t,i){t[n]===t?t[r].push({id:e,index:i}):(t[r]=[{id:e,index:i}],t[n]=t)}(i,e,o)};return i.toString=()=>e,t.serviceRegistry.set(e,i),i}},2585:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.IDecorationService=t.IUnicodeService=t.IOscLinkService=t.IOptionsService=t.ILogService=t.LogLevelEnum=t.IInstantiationService=t.ICharsetService=t.ICoreService=t.ICoreMouseService=t.IBufferService=void 0;const r=n(8343);var i;t.IBufferService=(0,r.createDecorator)("BufferService"),t.ICoreMouseService=(0,r.createDecorator)("CoreMouseService"),t.ICoreService=(0,r.createDecorator)("CoreService"),t.ICharsetService=(0,r.createDecorator)("CharsetService"),t.IInstantiationService=(0,r.createDecorator)("InstantiationService"),function(e){e[e.TRACE=0]="TRACE",e[e.DEBUG=1]="DEBUG",e[e.INFO=2]="INFO",e[e.WARN=3]="WARN",e[e.ERROR=4]="ERROR",e[e.OFF=5]="OFF"}(i||(t.LogLevelEnum=i={})),t.ILogService=(0,r.createDecorator)("LogService"),t.IOptionsService=(0,r.createDecorator)("OptionsService"),t.IOscLinkService=(0,r.createDecorator)("OscLinkService"),t.IUnicodeService=(0,r.createDecorator)("UnicodeService"),t.IDecorationService=(0,r.createDecorator)("DecorationService")},1480:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeService=void 0;const r=n(8460),i=n(225);t.UnicodeService=class{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new r.EventEmitter,this.onChange=this._onChange.event;const e=new i.UnicodeV6;this.register(e),this._active=e.version,this._activeProvider=e}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(e){if(!this._providers[e])throw new Error('unknown Unicode version "'.concat(e,'"'));this._active=e,this._activeProvider=this._providers[e],this._onChange.fire(e)}register(e){this._providers[e.version]=e}wcwidth(e){return this._activeProvider.wcwidth(e)}getStringCellWidth(e){let t=0;const n=e.length;for(let r=0;r<n;++r){let i=e.charCodeAt(r);if(55296<=i&&i<=56319){if(++r>=n)return t+this.wcwidth(i);const o=e.charCodeAt(r);56320<=o&&o<=57343?i=1024*(i-55296)+o-56320+65536:t+=this.wcwidth(o)}t+=this.wcwidth(i)}return t}}}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={exports:{}};return e[r].call(o.exports,o,o.exports,n),o.exports}var r={};return(()=>{var e=r;Object.defineProperty(e,"__esModule",{value:!0}),e.Terminal=void 0;const t=n(9042),i=n(3236),o=n(844),s=n(5741),a=n(8285),l=n(7975),c=n(7090),u=["cols","rows"];class d extends o.Disposable{constructor(e){super(),this._core=this.register(new i.Terminal(e)),this._addonManager=this.register(new s.AddonManager),this._publicOptions=Object.assign({},this._core.options);const t=e=>this._core.options[e],n=(e,t)=>{this._checkReadonlyOptions(e),this._core.options[e]=t};for(const r in this._core.options){const e={get:t.bind(this,r),set:n.bind(this,r)};Object.defineProperty(this._publicOptions,r,e)}}_checkReadonlyOptions(e){if(u.includes(e))throw new Error('Option "'.concat(e,'" can only be set in the constructor'))}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new l.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new c.UnicodeApi(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this.register(new a.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const e=this._core.coreService.decPrivateModes;let t="none";switch(this._core.coreMouseService.activeProtocol){case"X10":t="x10";break;case"VT200":t="vt200";break;case"DRAG":t="drag";break;case"ANY":t="any"}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(const t in e)this._publicOptions[t]=e[t]}blur(){this._core.blur()}focus(){this._core.focus()}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){var t,n,r;return this._checkProposedApi(),this._verifyPositiveIntegers(null!==(t=e.x)&&void 0!==t?t:0,null!==(n=e.width)&&void 0!==n?n:0,null!==(r=e.height)&&void 0!==r?r:0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,t,n){this._verifyIntegers(e,t,n),this._core.select(e,t,n)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,t){this._verifyIntegers(e,t),this._core.selectLines(e,t)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,t){this._core.write(e,t)}writeln(e,t){this._core.write(e),this._core.write("\r\n",t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return t}_verifyIntegers(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];for(const r of t)if(r===1/0||isNaN(r)||r%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];for(const r of t)if(r&&(r===1/0||isNaN(r)||r%1!=0||r<0))throw new Error("This API only accepts positive integers")}}e.Terminal=d})(),r})(),e.exports=t()},132:e=>{var t;self,t=()=>(()=>{"use strict";var e={};return(()=>{var t=e;Object.defineProperty(t,"__esModule",{value:!0}),t.FitAddon=void 0,t.FitAddon=class{activate(e){this._terminal=e}dispose(){}fit(){const e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;const t=this._terminal._core;this._terminal.rows===e.rows&&this._terminal.cols===e.cols||(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal)return;if(!this._terminal.element||!this._terminal.element.parentElement)return;const e=this._terminal._core,t=e._renderService.dimensions;if(0===t.css.cell.width||0===t.css.cell.height)return;const n=0===this._terminal.options.scrollback?0:e.viewport.scrollBarWidth,r=window.getComputedStyle(this._terminal.element.parentElement),i=parseInt(r.getPropertyValue("height")),o=Math.max(0,parseInt(r.getPropertyValue("width"))),s=window.getComputedStyle(this._terminal.element),a=i-(parseInt(s.getPropertyValue("padding-top"))+parseInt(s.getPropertyValue("padding-bottom"))),l=o-(parseInt(s.getPropertyValue("padding-right"))+parseInt(s.getPropertyValue("padding-left")))-n;return{cols:Math.max(2,Math.floor(l/t.css.cell.width)),rows:Math.max(1,Math.floor(a/t.css.cell.height))}}}})(),e})(),e.exports=t()},153:(e,t,n)=>{"use strict";var r=n(43),i=Symbol.for("react.element"),o=Symbol.for("react.fragment"),s=Object.prototype.hasOwnProperty,a=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function c(e,t,n){var r,o={},c=null,u=null;for(r in void 0!==n&&(c=""+n),void 0!==t.key&&(c=""+t.key),void 0!==t.ref&&(u=t.ref),t)s.call(t,r)&&!l.hasOwnProperty(r)&&(o[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps)void 0===o[r]&&(o[r]=t[r]);return{$$typeof:i,type:e,key:c,ref:u,props:o,_owner:a.current}}t.Fragment=o,t.jsx=c,t.jsxs=c},202:(e,t)=>{"use strict";var n=Symbol.for("react.element"),r=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),l=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),f=Symbol.iterator;var p={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,v={};function m(e,t,n){this.props=e,this.context=t,this.refs=v,this.updater=n||p}function _(){}function y(e,t,n){this.props=e,this.context=t,this.refs=v,this.updater=n||p}m.prototype.isReactComponent={},m.prototype.setState=function(e,t){if("object"!==typeof e&&"function"!==typeof e&&null!=e)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")},m.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},_.prototype=m.prototype;var b=y.prototype=new _;b.constructor=y,g(b,m.prototype),b.isPureReactComponent=!0;var x=Array.isArray,w=Object.prototype.hasOwnProperty,S={current:null},C={key:!0,ref:!0,__self:!0,__source:!0};function k(e,t,r){var i,o={},s=null,a=null;if(null!=t)for(i in void 0!==t.ref&&(a=t.ref),void 0!==t.key&&(s=""+t.key),t)w.call(t,i)&&!C.hasOwnProperty(i)&&(o[i]=t[i]);var l=arguments.length-2;if(1===l)o.children=r;else if(1<l){for(var c=Array(l),u=0;u<l;u++)c[u]=arguments[u+2];o.children=c}if(e&&e.defaultProps)for(i in l=e.defaultProps)void 0===o[i]&&(o[i]=l[i]);return{$$typeof:n,type:e,key:s,ref:a,props:o,_owner:S.current}}function E(e){return"object"===typeof e&&null!==e&&e.$$typeof===n}var R=/\/+/g;function M(e,t){return"object"===typeof e&&null!==e&&null!=e.key?function(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(e){return t[e]})}(""+e.key):t.toString(36)}function L(e,t,i,o,s){var a=typeof e;"undefined"!==a&&"boolean"!==a||(e=null);var l=!1;if(null===e)l=!0;else switch(a){case"string":case"number":l=!0;break;case"object":switch(e.$$typeof){case n:case r:l=!0}}if(l)return s=s(l=e),e=""===o?"."+M(l,0):o,x(s)?(i="",null!=e&&(i=e.replace(R,"$&/")+"/"),L(s,t,i,"",function(e){return e})):null!=s&&(E(s)&&(s=function(e,t){return{$$typeof:n,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}(s,i+(!s.key||l&&l.key===s.key?"":(""+s.key).replace(R,"$&/")+"/")+e)),t.push(s)),1;if(l=0,o=""===o?".":o+":",x(e))for(var c=0;c<e.length;c++){var u=o+M(a=e[c],c);l+=L(a,t,i,u,s)}else if(u=function(e){return null===e||"object"!==typeof e?null:"function"===typeof(e=f&&e[f]||e["@@iterator"])?e:null}(e),"function"===typeof u)for(e=u.call(e),c=0;!(a=e.next()).done;)l+=L(a=a.value,t,i,u=o+M(a,c++),s);else if("object"===a)throw t=String(e),Error("Objects are not valid as a React child (found: "+("[object Object]"===t?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return l}function P(e,t,n){if(null==e)return e;var r=[],i=0;return L(e,r,"","",function(e){return t.call(n,e,i++)}),r}function T(e){if(-1===e._status){var t=e._result;(t=t()).then(function(t){0!==e._status&&-1!==e._status||(e._status=1,e._result=t)},function(t){0!==e._status&&-1!==e._status||(e._status=2,e._result=t)}),-1===e._status&&(e._status=0,e._result=t)}if(1===e._status)return e._result.default;throw e._result}var D={current:null},O={transition:null},I={ReactCurrentDispatcher:D,ReactCurrentBatchConfig:O,ReactCurrentOwner:S};function A(){throw Error("act(...) is not supported in production builds of React.")}t.Children={map:P,forEach:function(e,t,n){P(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return P(e,function(){t++}),t},toArray:function(e){return P(e,function(e){return e})||[]},only:function(e){if(!E(e))throw Error("React.Children.only expected to receive a single React element child.");return e}},t.Component=m,t.Fragment=i,t.Profiler=s,t.PureComponent=y,t.StrictMode=o,t.Suspense=u,t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=I,t.act=A,t.cloneElement=function(e,t,r){if(null===e||void 0===e)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var i=g({},e.props),o=e.key,s=e.ref,a=e._owner;if(null!=t){if(void 0!==t.ref&&(s=t.ref,a=S.current),void 0!==t.key&&(o=""+t.key),e.type&&e.type.defaultProps)var l=e.type.defaultProps;for(c in t)w.call(t,c)&&!C.hasOwnProperty(c)&&(i[c]=void 0===t[c]&&void 0!==l?l[c]:t[c])}var c=arguments.length-2;if(1===c)i.children=r;else if(1<c){l=Array(c);for(var u=0;u<c;u++)l[u]=arguments[u+2];i.children=l}return{$$typeof:n,type:e.type,key:o,ref:s,props:i,_owner:a}},t.createContext=function(e){return(e={$$typeof:l,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null}).Provider={$$typeof:a,_context:e},e.Consumer=e},t.createElement=k,t.createFactory=function(e){var t=k.bind(null,e);return t.type=e,t},t.createRef=function(){return{current:null}},t.forwardRef=function(e){return{$$typeof:c,render:e}},t.isValidElement=E,t.lazy=function(e){return{$$typeof:h,_payload:{_status:-1,_result:e},_init:T}},t.memo=function(e,t){return{$$typeof:d,type:e,compare:void 0===t?null:t}},t.startTransition=function(e){var t=O.transition;O.transition={};try{e()}finally{O.transition=t}},t.unstable_act=A,t.useCallback=function(e,t){return D.current.useCallback(e,t)},t.useContext=function(e){return D.current.useContext(e)},t.useDebugValue=function(){},t.useDeferredValue=function(e){return D.current.useDeferredValue(e)},t.useEffect=function(e,t){return D.current.useEffect(e,t)},t.useId=function(){return D.current.useId()},t.useImperativeHandle=function(e,t,n){return D.current.useImperativeHandle(e,t,n)},t.useInsertionEffect=function(e,t){return D.current.useInsertionEffect(e,t)},t.useLayoutEffect=function(e,t){return D.current.useLayoutEffect(e,t)},t.useMemo=function(e,t){return D.current.useMemo(e,t)},t.useReducer=function(e,t,n){return D.current.useReducer(e,t,n)},t.useRef=function(e){return D.current.useRef(e)},t.useState=function(e){return D.current.useState(e)},t.useSyncExternalStore=function(e,t,n){return D.current.useSyncExternalStore(e,t,n)},t.useTransition=function(){return D.current.useTransition()},t.version="18.3.1"},234:(e,t)=>{"use strict";function n(e,t){var n=e.length;e.push(t);e:for(;0<n;){var r=n-1>>>1,i=e[r];if(!(0<o(i,t)))break e;e[r]=t,e[n]=i,n=r}}function r(e){return 0===e.length?null:e[0]}function i(e){if(0===e.length)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;e:for(var r=0,i=e.length,s=i>>>1;r<s;){var a=2*(r+1)-1,l=e[a],c=a+1,u=e[c];if(0>o(l,n))c<i&&0>o(u,l)?(e[r]=u,e[c]=n,r=c):(e[r]=l,e[a]=n,r=a);else{if(!(c<i&&0>o(u,n)))break e;e[r]=u,e[c]=n,r=c}}}return t}function o(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}if("object"===typeof performance&&"function"===typeof performance.now){var s=performance;t.unstable_now=function(){return s.now()}}else{var a=Date,l=a.now();t.unstable_now=function(){return a.now()-l}}var c=[],u=[],d=1,h=null,f=3,p=!1,g=!1,v=!1,m="function"===typeof setTimeout?setTimeout:null,_="function"===typeof clearTimeout?clearTimeout:null,y="undefined"!==typeof setImmediate?setImmediate:null;function b(e){for(var t=r(u);null!==t;){if(null===t.callback)i(u);else{if(!(t.startTime<=e))break;i(u),t.sortIndex=t.expirationTime,n(c,t)}t=r(u)}}function x(e){if(v=!1,b(e),!g)if(null!==r(c))g=!0,O(w);else{var t=r(u);null!==t&&I(x,t.startTime-e)}}function w(e,n){g=!1,v&&(v=!1,_(E),E=-1),p=!0;var o=f;try{for(b(n),h=r(c);null!==h&&(!(h.expirationTime>n)||e&&!L());){var s=h.callback;if("function"===typeof s){h.callback=null,f=h.priorityLevel;var a=s(h.expirationTime<=n);n=t.unstable_now(),"function"===typeof a?h.callback=a:h===r(c)&&i(c),b(n)}else i(c);h=r(c)}if(null!==h)var l=!0;else{var d=r(u);null!==d&&I(x,d.startTime-n),l=!1}return l}finally{h=null,f=o,p=!1}}"undefined"!==typeof navigator&&void 0!==navigator.scheduling&&void 0!==navigator.scheduling.isInputPending&&navigator.scheduling.isInputPending.bind(navigator.scheduling);var S,C=!1,k=null,E=-1,R=5,M=-1;function L(){return!(t.unstable_now()-M<R)}function P(){if(null!==k){var e=t.unstable_now();M=e;var n=!0;try{n=k(!0,e)}finally{n?S():(C=!1,k=null)}}else C=!1}if("function"===typeof y)S=function(){y(P)};else if("undefined"!==typeof MessageChannel){var T=new MessageChannel,D=T.port2;T.port1.onmessage=P,S=function(){D.postMessage(null)}}else S=function(){m(P,0)};function O(e){k=e,C||(C=!0,S())}function I(e,n){E=m(function(){e(t.unstable_now())},n)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(e){e.callback=null},t.unstable_continueExecution=function(){g||p||(g=!0,O(w))},t.unstable_forceFrameRate=function(e){0>e||125<e?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):R=0<e?Math.floor(1e3/e):5},t.unstable_getCurrentPriorityLevel=function(){return f},t.unstable_getFirstCallbackNode=function(){return r(c)},t.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},t.unstable_scheduleCallback=function(e,i,o){var s=t.unstable_now();switch("object"===typeof o&&null!==o?o="number"===typeof(o=o.delay)&&0<o?s+o:s:o=s,e){case 1:var a=-1;break;case 2:a=250;break;case 5:a=1073741823;break;case 4:a=1e4;break;default:a=5e3}return e={id:d++,callback:i,priorityLevel:e,startTime:o,expirationTime:a=o+a,sortIndex:-1},o>s?(e.sortIndex=o,n(u,e),null===r(c)&&e===r(u)&&(v?(_(E),E=-1):v=!0,I(x,o-s))):(e.sortIndex=a,n(c,e),g||p||(g=!0,O(w))),e},t.unstable_shouldYield=L,t.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}},330:(e,t,n)=>{"use strict";var r=n(43);var i="function"===typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e===1/t)||e!==e&&t!==t},o=r.useState,s=r.useEffect,a=r.useLayoutEffect,l=r.useDebugValue;function c(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!i(e,n)}catch(r){return!0}}var u="undefined"===typeof window||"undefined"===typeof window.document||"undefined"===typeof window.document.createElement?function(e,t){return t()}:function(e,t){var n=t(),r=o({inst:{value:n,getSnapshot:t}}),i=r[0].inst,u=r[1];return a(function(){i.value=n,i.getSnapshot=t,c(i)&&u({inst:i})},[e,n,t]),s(function(){return c(i)&&u({inst:i}),e(function(){c(i)&&u({inst:i})})},[e]),l(n),n};t.useSyncExternalStore=void 0!==r.useSyncExternalStore?r.useSyncExternalStore:u},391:(e,t,n)=>{"use strict";var r=n(950);t.createRoot=r.createRoot,t.hydrateRoot=r.hydrateRoot},443:(e,t,n)=>{"use strict";e.exports=n(717)},461:(e,t,n)=>{"use strict";e.exports=n(330)},579:(e,t,n)=>{"use strict";e.exports=n(153)},717:(e,t,n)=>{"use strict";var r=n(43),i=n(461);var o="function"===typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e===1/t)||e!==e&&t!==t},s=i.useSyncExternalStore,a=r.useRef,l=r.useEffect,c=r.useMemo,u=r.useDebugValue;t.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var d=a(null);if(null===d.current){var h={hasValue:!1,value:null};d.current=h}else h=d.current;d=c(function(){function e(e){if(!l){if(l=!0,s=e,e=r(e),void 0!==i&&h.hasValue){var t=h.value;if(i(t,e))return a=t}return a=e}if(t=a,o(s,e))return t;var n=r(e);return void 0!==i&&i(t,n)?(s=e,t):(s=e,a=n)}var s,a,l=!1,c=void 0===n?null:n;return[function(){return e(t())},null===c?void 0:function(){return e(c())}]},[t,n,r,i]);var f=s(e,d[0],d[1]);return l(function(){h.hasValue=!0,h.value=f},[f]),u(f),f}},730:(e,t,n)=>{"use strict";var r=n(43),i=n(853);function o(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var s=new Set,a={};function l(e,t){c(e,t),c(e+"Capture",t)}function c(e,t){for(a[e]=t,e=0;e<t.length;e++)s.add(t[e])}var u=!("undefined"===typeof window||"undefined"===typeof window.document||"undefined"===typeof window.document.createElement),d=Object.prototype.hasOwnProperty,h=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,f={},p={};function g(e,t,n,r,i,o,s){this.acceptsBooleans=2===t||3===t||4===t,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=o,this.removeEmptyString=s}var v={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){v[e]=new g(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];v[t]=new g(t,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){v[e]=new g(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){v[e]=new g(e,2,!1,e,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){v[e]=new g(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){v[e]=new g(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){v[e]=new g(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){v[e]=new g(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){v[e]=new g(e,5,!1,e.toLowerCase(),null,!1,!1)});var m=/[\-:]([a-z])/g;function _(e){return e[1].toUpperCase()}function y(e,t,n,r){var i=v.hasOwnProperty(t)?v[t]:null;(null!==i?0!==i.type:r||!(2<t.length)||"o"!==t[0]&&"O"!==t[0]||"n"!==t[1]&&"N"!==t[1])&&(function(e,t,n,r){if(null===t||"undefined"===typeof t||function(e,t,n,r){if(null!==n&&0===n.type)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return!r&&(null!==n?!n.acceptsBooleans:"data-"!==(e=e.toLowerCase().slice(0,5))&&"aria-"!==e);default:return!1}}(e,t,n,r))return!0;if(r)return!1;if(null!==n)switch(n.type){case 3:return!t;case 4:return!1===t;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}(t,n,i,r)&&(n=null),r||null===i?function(e){return!!d.call(p,e)||!d.call(f,e)&&(h.test(e)?p[e]=!0:(f[e]=!0,!1))}(t)&&(null===n?e.removeAttribute(t):e.setAttribute(t,""+n)):i.mustUseProperty?e[i.propertyName]=null===n?3!==i.type&&"":n:(t=i.attributeName,r=i.attributeNamespace,null===n?e.removeAttribute(t):(n=3===(i=i.type)||4===i&&!0===n?"":""+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(m,_);v[t]=new g(t,1,!1,e,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(m,_);v[t]=new g(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(m,_);v[t]=new g(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){v[e]=new g(e,1,!1,e.toLowerCase(),null,!1,!1)}),v.xlinkHref=new g("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){v[e]=new g(e,1,!1,e.toLowerCase(),null,!0,!0)});var b=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,x=Symbol.for("react.element"),w=Symbol.for("react.portal"),S=Symbol.for("react.fragment"),C=Symbol.for("react.strict_mode"),k=Symbol.for("react.profiler"),E=Symbol.for("react.provider"),R=Symbol.for("react.context"),M=Symbol.for("react.forward_ref"),L=Symbol.for("react.suspense"),P=Symbol.for("react.suspense_list"),T=Symbol.for("react.memo"),D=Symbol.for("react.lazy");Symbol.for("react.scope"),Symbol.for("react.debug_trace_mode");var O=Symbol.for("react.offscreen");Symbol.for("react.legacy_hidden"),Symbol.for("react.cache"),Symbol.for("react.tracing_marker");var I=Symbol.iterator;function A(e){return null===e||"object"!==typeof e?null:"function"===typeof(e=I&&e[I]||e["@@iterator"])?e:null}var j,B=Object.assign;function N(e){if(void 0===j)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);j=t&&t[1]||""}return"\n"+j+e}var F=!1;function z(e,t){if(!e||F)return"";F=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),"object"===typeof Reflect&&Reflect.construct){try{Reflect.construct(t,[])}catch(c){var r=c}Reflect.construct(e,[],t)}else{try{t.call()}catch(c){r=c}e.call(t.prototype)}else{try{throw Error()}catch(c){r=c}e()}}catch(c){if(c&&r&&"string"===typeof c.stack){for(var i=c.stack.split("\n"),o=r.stack.split("\n"),s=i.length-1,a=o.length-1;1<=s&&0<=a&&i[s]!==o[a];)a--;for(;1<=s&&0<=a;s--,a--)if(i[s]!==o[a]){if(1!==s||1!==a)do{if(s--,0>--a||i[s]!==o[a]){var l="\n"+i[s].replace(" at new "," at ");return e.displayName&&l.includes("<anonymous>")&&(l=l.replace("<anonymous>",e.displayName)),l}}while(1<=s&&0<=a);break}}}finally{F=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?N(e):""}function H(e){switch(e.tag){case 5:return N(e.type);case 16:return N("Lazy");case 13:return N("Suspense");case 19:return N("SuspenseList");case 0:case 2:case 15:return e=z(e.type,!1);case 11:return e=z(e.type.render,!1);case 1:return e=z(e.type,!0);default:return""}}function W(e){if(null==e)return null;if("function"===typeof e)return e.displayName||e.name||null;if("string"===typeof e)return e;switch(e){case S:return"Fragment";case w:return"Portal";case k:return"Profiler";case C:return"StrictMode";case L:return"Suspense";case P:return"SuspenseList"}if("object"===typeof e)switch(e.$$typeof){case R:return(e.displayName||"Context")+".Consumer";case E:return(e._context.displayName||"Context")+".Provider";case M:var t=e.render;return(e=e.displayName)||(e=""!==(e=t.displayName||t.name||"")?"ForwardRef("+e+")":"ForwardRef"),e;case T:return null!==(t=e.displayName||null)?t:W(e.type)||"Memo";case D:t=e._payload,e=e._init;try{return W(e(t))}catch(n){}}return null}function U(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=(e=t.render).displayName||e.name||"",t.displayName||(""!==e?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return W(t);case 8:return t===C?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if("function"===typeof t)return t.displayName||t.name||null;if("string"===typeof t)return t}return null}function V(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":case"object":return e;default:return""}}function $(e){var t=e.type;return(e=e.nodeName)&&"input"===e.toLowerCase()&&("checkbox"===t||"radio"===t)}function q(e){e._valueTracker||(e._valueTracker=function(e){var t=$(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&"undefined"!==typeof n&&"function"===typeof n.get&&"function"===typeof n.set){var i=n.get,o=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){r=""+e,o.call(this,e)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(e){r=""+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}(e))}function K(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=$(e)?e.checked?"true":"false":e.value),(e=r)!==n&&(t.setValue(e),!0)}function Y(e){if("undefined"===typeof(e=e||("undefined"!==typeof document?document:void 0)))return null;try{return e.activeElement||e.body}catch(t){return e.body}}function X(e,t){var n=t.checked;return B({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:null!=n?n:e._wrapperState.initialChecked})}function G(e,t){var n=null==t.defaultValue?"":t.defaultValue,r=null!=t.checked?t.checked:t.defaultChecked;n=V(null!=t.value?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:"checkbox"===t.type||"radio"===t.type?null!=t.checked:null!=t.value}}function Z(e,t){null!=(t=t.checked)&&y(e,"checked",t,!1)}function J(e,t){Z(e,t);var n=V(t.value),r=t.type;if(null!=n)"number"===r?(0===n&&""===e.value||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if("submit"===r||"reset"===r)return void e.removeAttribute("value");t.hasOwnProperty("value")?ee(e,t.type,n):t.hasOwnProperty("defaultValue")&&ee(e,t.type,V(t.defaultValue)),null==t.checked&&null!=t.defaultChecked&&(e.defaultChecked=!!t.defaultChecked)}function Q(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!("submit"!==r&&"reset"!==r||void 0!==t.value&&null!==t.value))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}""!==(n=e.name)&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,""!==n&&(e.name=n)}function ee(e,t,n){"number"===t&&Y(e.ownerDocument)===e||(null==n?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var te=Array.isArray;function ne(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t["$"+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty("$"+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=""+V(n),t=null,i=0;i<e.length;i++){if(e[i].value===n)return e[i].selected=!0,void(r&&(e[i].defaultSelected=!0));null!==t||e[i].disabled||(t=e[i])}null!==t&&(t.selected=!0)}}function re(e,t){if(null!=t.dangerouslySetInnerHTML)throw Error(o(91));return B({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function ie(e,t){var n=t.value;if(null==n){if(n=t.children,t=t.defaultValue,null!=n){if(null!=t)throw Error(o(92));if(te(n)){if(1<n.length)throw Error(o(93));n=n[0]}t=n}null==t&&(t=""),n=t}e._wrapperState={initialValue:V(n)}}function oe(e,t){var n=V(t.value),r=V(t.defaultValue);null!=n&&((n=""+n)!==e.value&&(e.value=n),null==t.defaultValue&&e.defaultValue!==n&&(e.defaultValue=n)),null!=r&&(e.defaultValue=""+r)}function se(e){var t=e.textContent;t===e._wrapperState.initialValue&&""!==t&&null!==t&&(e.value=t)}function ae(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function le(e,t){return null==e||"http://www.w3.org/1999/xhtml"===e?ae(t):"http://www.w3.org/2000/svg"===e&&"foreignObject"===t?"http://www.w3.org/1999/xhtml":e}var ce,ue,de=(ue=function(e,t){if("http://www.w3.org/2000/svg"!==e.namespaceURI||"innerHTML"in e)e.innerHTML=t;else{for((ce=ce||document.createElement("div")).innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=ce.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}},"undefined"!==typeof MSApp&&MSApp.execUnsafeLocalFunction?function(e,t,n,r){MSApp.execUnsafeLocalFunction(function(){return ue(e,t)})}:ue);function he(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&3===n.nodeType)return void(n.nodeValue=t)}e.textContent=t}var fe={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},pe=["Webkit","ms","Moz","O"];function ge(e,t,n){return null==t||"boolean"===typeof t||""===t?"":n||"number"!==typeof t||0===t||fe.hasOwnProperty(e)&&fe[e]?(""+t).trim():t+"px"}function ve(e,t){for(var n in e=e.style,t)if(t.hasOwnProperty(n)){var r=0===n.indexOf("--"),i=ge(n,t[n],r);"float"===n&&(n="cssFloat"),r?e.setProperty(n,i):e[n]=i}}Object.keys(fe).forEach(function(e){pe.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),fe[t]=fe[e]})});var me=B({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function _e(e,t){if(t){if(me[e]&&(null!=t.children||null!=t.dangerouslySetInnerHTML))throw Error(o(137,e));if(null!=t.dangerouslySetInnerHTML){if(null!=t.children)throw Error(o(60));if("object"!==typeof t.dangerouslySetInnerHTML||!("__html"in t.dangerouslySetInnerHTML))throw Error(o(61))}if(null!=t.style&&"object"!==typeof t.style)throw Error(o(62))}}function ye(e,t){if(-1===e.indexOf("-"))return"string"===typeof t.is;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var be=null;function xe(e){return(e=e.target||e.srcElement||window).correspondingUseElement&&(e=e.correspondingUseElement),3===e.nodeType?e.parentNode:e}var we=null,Se=null,Ce=null;function ke(e){if(e=yi(e)){if("function"!==typeof we)throw Error(o(280));var t=e.stateNode;t&&(t=xi(t),we(e.stateNode,e.type,t))}}function Ee(e){Se?Ce?Ce.push(e):Ce=[e]:Se=e}function Re(){if(Se){var e=Se,t=Ce;if(Ce=Se=null,ke(e),t)for(e=0;e<t.length;e++)ke(t[e])}}function Me(e,t){return e(t)}function Le(){}var Pe=!1;function Te(e,t,n){if(Pe)return e(t,n);Pe=!0;try{return Me(e,t,n)}finally{Pe=!1,(null!==Se||null!==Ce)&&(Le(),Re())}}function De(e,t){var n=e.stateNode;if(null===n)return null;var r=xi(n);if(null===r)return null;n=r[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(r=!("button"===(e=e.type)||"input"===e||"select"===e||"textarea"===e)),e=!r;break e;default:e=!1}if(e)return null;if(n&&"function"!==typeof n)throw Error(o(231,t,typeof n));return n}var Oe=!1;if(u)try{var Ie={};Object.defineProperty(Ie,"passive",{get:function(){Oe=!0}}),window.addEventListener("test",Ie,Ie),window.removeEventListener("test",Ie,Ie)}catch(ue){Oe=!1}function Ae(e,t,n,r,i,o,s,a,l){var c=Array.prototype.slice.call(arguments,3);try{t.apply(n,c)}catch(u){this.onError(u)}}var je=!1,Be=null,Ne=!1,Fe=null,ze={onError:function(e){je=!0,Be=e}};function He(e,t,n,r,i,o,s,a,l){je=!1,Be=null,Ae.apply(ze,arguments)}function We(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do{0!==(4098&(t=e).flags)&&(n=t.return),e=t.return}while(e)}return 3===t.tag?n:null}function Ue(e){if(13===e.tag){var t=e.memoizedState;if(null===t&&(null!==(e=e.alternate)&&(t=e.memoizedState)),null!==t)return t.dehydrated}return null}function Ve(e){if(We(e)!==e)throw Error(o(188))}function $e(e){return null!==(e=function(e){var t=e.alternate;if(!t){if(null===(t=We(e)))throw Error(o(188));return t!==e?null:e}for(var n=e,r=t;;){var i=n.return;if(null===i)break;var s=i.alternate;if(null===s){if(null!==(r=i.return)){n=r;continue}break}if(i.child===s.child){for(s=i.child;s;){if(s===n)return Ve(i),e;if(s===r)return Ve(i),t;s=s.sibling}throw Error(o(188))}if(n.return!==r.return)n=i,r=s;else{for(var a=!1,l=i.child;l;){if(l===n){a=!0,n=i,r=s;break}if(l===r){a=!0,r=i,n=s;break}l=l.sibling}if(!a){for(l=s.child;l;){if(l===n){a=!0,n=s,r=i;break}if(l===r){a=!0,r=s,n=i;break}l=l.sibling}if(!a)throw Error(o(189))}}if(n.alternate!==r)throw Error(o(190))}if(3!==n.tag)throw Error(o(188));return n.stateNode.current===n?e:t}(e))?qe(e):null}function qe(e){if(5===e.tag||6===e.tag)return e;for(e=e.child;null!==e;){var t=qe(e);if(null!==t)return t;e=e.sibling}return null}var Ke=i.unstable_scheduleCallback,Ye=i.unstable_cancelCallback,Xe=i.unstable_shouldYield,Ge=i.unstable_requestPaint,Ze=i.unstable_now,Je=i.unstable_getCurrentPriorityLevel,Qe=i.unstable_ImmediatePriority,et=i.unstable_UserBlockingPriority,tt=i.unstable_NormalPriority,nt=i.unstable_LowPriority,rt=i.unstable_IdlePriority,it=null,ot=null;var st=Math.clz32?Math.clz32:function(e){return e>>>=0,0===e?32:31-(at(e)/lt|0)|0},at=Math.log,lt=Math.LN2;var ct=64,ut=4194304;function dt(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return 4194240&e;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return 130023424&e;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function ht(e,t){var n=e.pendingLanes;if(0===n)return 0;var r=0,i=e.suspendedLanes,o=e.pingedLanes,s=268435455&n;if(0!==s){var a=s&~i;0!==a?r=dt(a):0!==(o&=s)&&(r=dt(o))}else 0!==(s=n&~i)?r=dt(s):0!==o&&(r=dt(o));if(0===r)return 0;if(0!==t&&t!==r&&0===(t&i)&&((i=r&-r)>=(o=t&-t)||16===i&&0!==(4194240&o)))return t;if(0!==(4&r)&&(r|=16&n),0!==(t=e.entangledLanes))for(e=e.entanglements,t&=r;0<t;)i=1<<(n=31-st(t)),r|=e[n],t&=~i;return r}function ft(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;default:return-1}}function pt(e){return 0!==(e=-1073741825&e.pendingLanes)?e:1073741824&e?1073741824:0}function gt(){var e=ct;return 0===(4194240&(ct<<=1))&&(ct=64),e}function vt(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function mt(e,t,n){e.pendingLanes|=t,536870912!==t&&(e.suspendedLanes=0,e.pingedLanes=0),(e=e.eventTimes)[t=31-st(t)]=n}function _t(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-st(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}var yt=0;function bt(e){return 1<(e&=-e)?4<e?0!==(268435455&e)?16:536870912:4:1}var xt,wt,St,Ct,kt,Et=!1,Rt=[],Mt=null,Lt=null,Pt=null,Tt=new Map,Dt=new Map,Ot=[],It="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function At(e,t){switch(e){case"focusin":case"focusout":Mt=null;break;case"dragenter":case"dragleave":Lt=null;break;case"mouseover":case"mouseout":Pt=null;break;case"pointerover":case"pointerout":Tt.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Dt.delete(t.pointerId)}}function jt(e,t,n,r,i,o){return null===e||e.nativeEvent!==o?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:o,targetContainers:[i]},null!==t&&(null!==(t=yi(t))&&wt(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,null!==i&&-1===t.indexOf(i)&&t.push(i),e)}function Bt(e){var t=_i(e.target);if(null!==t){var n=We(t);if(null!==n)if(13===(t=n.tag)){if(null!==(t=Ue(n)))return e.blockedOn=t,void kt(e.priority,function(){St(n)})}else if(3===t&&n.stateNode.current.memoizedState.isDehydrated)return void(e.blockedOn=3===n.tag?n.stateNode.containerInfo:null)}e.blockedOn=null}function Nt(e){if(null!==e.blockedOn)return!1;for(var t=e.targetContainers;0<t.length;){var n=Xt(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(null!==n)return null!==(t=yi(n))&&wt(t),e.blockedOn=n,!1;var r=new(n=e.nativeEvent).constructor(n.type,n);be=r,n.target.dispatchEvent(r),be=null,t.shift()}return!0}function Ft(e,t,n){Nt(e)&&n.delete(t)}function zt(){Et=!1,null!==Mt&&Nt(Mt)&&(Mt=null),null!==Lt&&Nt(Lt)&&(Lt=null),null!==Pt&&Nt(Pt)&&(Pt=null),Tt.forEach(Ft),Dt.forEach(Ft)}function Ht(e,t){e.blockedOn===t&&(e.blockedOn=null,Et||(Et=!0,i.unstable_scheduleCallback(i.unstable_NormalPriority,zt)))}function Wt(e){function t(t){return Ht(t,e)}if(0<Rt.length){Ht(Rt[0],e);for(var n=1;n<Rt.length;n++){var r=Rt[n];r.blockedOn===e&&(r.blockedOn=null)}}for(null!==Mt&&Ht(Mt,e),null!==Lt&&Ht(Lt,e),null!==Pt&&Ht(Pt,e),Tt.forEach(t),Dt.forEach(t),n=0;n<Ot.length;n++)(r=Ot[n]).blockedOn===e&&(r.blockedOn=null);for(;0<Ot.length&&null===(n=Ot[0]).blockedOn;)Bt(n),null===n.blockedOn&&Ot.shift()}var Ut=b.ReactCurrentBatchConfig,Vt=!0;function $t(e,t,n,r){var i=yt,o=Ut.transition;Ut.transition=null;try{yt=1,Kt(e,t,n,r)}finally{yt=i,Ut.transition=o}}function qt(e,t,n,r){var i=yt,o=Ut.transition;Ut.transition=null;try{yt=4,Kt(e,t,n,r)}finally{yt=i,Ut.transition=o}}function Kt(e,t,n,r){if(Vt){var i=Xt(e,t,n,r);if(null===i)Vr(e,t,r,Yt,n),At(e,r);else if(function(e,t,n,r,i){switch(t){case"focusin":return Mt=jt(Mt,e,t,n,r,i),!0;case"dragenter":return Lt=jt(Lt,e,t,n,r,i),!0;case"mouseover":return Pt=jt(Pt,e,t,n,r,i),!0;case"pointerover":var o=i.pointerId;return Tt.set(o,jt(Tt.get(o)||null,e,t,n,r,i)),!0;case"gotpointercapture":return o=i.pointerId,Dt.set(o,jt(Dt.get(o)||null,e,t,n,r,i)),!0}return!1}(i,e,t,n,r))r.stopPropagation();else if(At(e,r),4&t&&-1<It.indexOf(e)){for(;null!==i;){var o=yi(i);if(null!==o&&xt(o),null===(o=Xt(e,t,n,r))&&Vr(e,t,r,Yt,n),o===i)break;i=o}null!==i&&r.stopPropagation()}else Vr(e,t,r,null,n)}}var Yt=null;function Xt(e,t,n,r){if(Yt=null,null!==(e=_i(e=xe(r))))if(null===(t=We(e)))e=null;else if(13===(n=t.tag)){if(null!==(e=Ue(t)))return e;e=null}else if(3===n){if(t.stateNode.current.memoizedState.isDehydrated)return 3===t.tag?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return Yt=e,null}function Gt(e){switch(e){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(Je()){case Qe:return 1;case et:return 4;case tt:case nt:return 16;case rt:return 536870912;default:return 16}default:return 16}}var Zt=null,Jt=null,Qt=null;function en(){if(Qt)return Qt;var e,t,n=Jt,r=n.length,i="value"in Zt?Zt.value:Zt.textContent,o=i.length;for(e=0;e<r&&n[e]===i[e];e++);var s=r-e;for(t=1;t<=s&&n[r-t]===i[o-t];t++);return Qt=i.slice(e,1<t?1-t:void 0)}function tn(e){var t=e.keyCode;return"charCode"in e?0===(e=e.charCode)&&13===t&&(e=13):e=t,10===e&&(e=13),32<=e||13===e?e:0}function nn(){return!0}function rn(){return!1}function on(e){function t(t,n,r,i,o){for(var s in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=i,this.target=o,this.currentTarget=null,e)e.hasOwnProperty(s)&&(t=e[s],this[s]=t?t(i):i[s]);return this.isDefaultPrevented=(null!=i.defaultPrevented?i.defaultPrevented:!1===i.returnValue)?nn:rn,this.isPropagationStopped=rn,this}return B(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():"unknown"!==typeof e.returnValue&&(e.returnValue=!1),this.isDefaultPrevented=nn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():"unknown"!==typeof e.cancelBubble&&(e.cancelBubble=!0),this.isPropagationStopped=nn)},persist:function(){},isPersistent:nn}),t}var sn,an,ln,cn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},un=on(cn),dn=B({},cn,{view:0,detail:0}),hn=on(dn),fn=B({},dn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:kn,button:0,buttons:0,relatedTarget:function(e){return void 0===e.relatedTarget?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==ln&&(ln&&"mousemove"===e.type?(sn=e.screenX-ln.screenX,an=e.screenY-ln.screenY):an=sn=0,ln=e),sn)},movementY:function(e){return"movementY"in e?e.movementY:an}}),pn=on(fn),gn=on(B({},fn,{dataTransfer:0})),vn=on(B({},dn,{relatedTarget:0})),mn=on(B({},cn,{animationName:0,elapsedTime:0,pseudoElement:0})),_n=B({},cn,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),yn=on(_n),bn=on(B({},cn,{data:0})),xn={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},wn={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},Sn={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Cn(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):!!(e=Sn[e])&&!!t[e]}function kn(){return Cn}var En=B({},dn,{key:function(e){if(e.key){var t=xn[e.key]||e.key;if("Unidentified"!==t)return t}return"keypress"===e.type?13===(e=tn(e))?"Enter":String.fromCharCode(e):"keydown"===e.type||"keyup"===e.type?wn[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:kn,charCode:function(e){return"keypress"===e.type?tn(e):0},keyCode:function(e){return"keydown"===e.type||"keyup"===e.type?e.keyCode:0},which:function(e){return"keypress"===e.type?tn(e):"keydown"===e.type||"keyup"===e.type?e.keyCode:0}}),Rn=on(En),Mn=on(B({},fn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Ln=on(B({},dn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:kn})),Pn=on(B({},cn,{propertyName:0,elapsedTime:0,pseudoElement:0})),Tn=B({},fn,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),Dn=on(Tn),On=[9,13,27,32],In=u&&"CompositionEvent"in window,An=null;u&&"documentMode"in document&&(An=document.documentMode);var jn=u&&"TextEvent"in window&&!An,Bn=u&&(!In||An&&8<An&&11>=An),Nn=String.fromCharCode(32),Fn=!1;function zn(e,t){switch(e){case"keyup":return-1!==On.indexOf(t.keyCode);case"keydown":return 229!==t.keyCode;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Hn(e){return"object"===typeof(e=e.detail)&&"data"in e?e.data:null}var Wn=!1;var Un={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Vn(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return"input"===t?!!Un[e.type]:"textarea"===t}function $n(e,t,n,r){Ee(r),0<(t=qr(t,"onChange")).length&&(n=new un("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var qn=null,Kn=null;function Yn(e){Nr(e,0)}function Xn(e){if(K(bi(e)))return e}function Gn(e,t){if("change"===e)return t}var Zn=!1;if(u){var Jn;if(u){var Qn="oninput"in document;if(!Qn){var er=document.createElement("div");er.setAttribute("oninput","return;"),Qn="function"===typeof er.oninput}Jn=Qn}else Jn=!1;Zn=Jn&&(!document.documentMode||9<document.documentMode)}function tr(){qn&&(qn.detachEvent("onpropertychange",nr),Kn=qn=null)}function nr(e){if("value"===e.propertyName&&Xn(Kn)){var t=[];$n(t,Kn,e,xe(e)),Te(Yn,t)}}function rr(e,t,n){"focusin"===e?(tr(),Kn=n,(qn=t).attachEvent("onpropertychange",nr)):"focusout"===e&&tr()}function ir(e){if("selectionchange"===e||"keyup"===e||"keydown"===e)return Xn(Kn)}function or(e,t){if("click"===e)return Xn(t)}function sr(e,t){if("input"===e||"change"===e)return Xn(t)}var ar="function"===typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e===1/t)||e!==e&&t!==t};function lr(e,t){if(ar(e,t))return!0;if("object"!==typeof e||null===e||"object"!==typeof t||null===t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!d.call(t,i)||!ar(e[i],t[i]))return!1}return!0}function cr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function ur(e,t){var n,r=cr(e);for(e=0;r;){if(3===r.nodeType){if(n=e+r.textContent.length,e<=t&&n>=t)return{node:r,offset:t-e};e=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=cr(r)}}function dr(e,t){return!(!e||!t)&&(e===t||(!e||3!==e.nodeType)&&(t&&3===t.nodeType?dr(e,t.parentNode):"contains"in e?e.contains(t):!!e.compareDocumentPosition&&!!(16&e.compareDocumentPosition(t))))}function hr(){for(var e=window,t=Y();t instanceof e.HTMLIFrameElement;){try{var n="string"===typeof t.contentWindow.location.href}catch(r){n=!1}if(!n)break;t=Y((e=t.contentWindow).document)}return t}function fr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&("input"===t&&("text"===e.type||"search"===e.type||"tel"===e.type||"url"===e.type||"password"===e.type)||"textarea"===t||"true"===e.contentEditable)}function pr(e){var t=hr(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&dr(n.ownerDocument.documentElement,n)){if(null!==r&&fr(n))if(t=r.start,void 0===(e=r.end)&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if((e=(t=n.ownerDocument||document)&&t.defaultView||window).getSelection){e=e.getSelection();var i=n.textContent.length,o=Math.min(r.start,i);r=void 0===r.end?o:Math.min(r.end,i),!e.extend&&o>r&&(i=r,r=o,o=i),i=ur(n,o);var s=ur(n,r);i&&s&&(1!==e.rangeCount||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==s.node||e.focusOffset!==s.offset)&&((t=t.createRange()).setStart(i.node,i.offset),e.removeAllRanges(),o>r?(e.addRange(t),e.extend(s.node,s.offset)):(t.setEnd(s.node,s.offset),e.addRange(t)))}for(t=[],e=n;e=e.parentNode;)1===e.nodeType&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for("function"===typeof n.focus&&n.focus(),n=0;n<t.length;n++)(e=t[n]).element.scrollLeft=e.left,e.element.scrollTop=e.top}}var gr=u&&"documentMode"in document&&11>=document.documentMode,vr=null,mr=null,_r=null,yr=!1;function br(e,t,n){var r=n.window===n?n.document:9===n.nodeType?n:n.ownerDocument;yr||null==vr||vr!==Y(r)||("selectionStart"in(r=vr)&&fr(r)?r={start:r.selectionStart,end:r.selectionEnd}:r={anchorNode:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection()).anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset},_r&&lr(_r,r)||(_r=r,0<(r=qr(mr,"onSelect")).length&&(t=new un("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=vr)))}function xr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var wr={animationend:xr("Animation","AnimationEnd"),animationiteration:xr("Animation","AnimationIteration"),animationstart:xr("Animation","AnimationStart"),transitionend:xr("Transition","TransitionEnd")},Sr={},Cr={};function kr(e){if(Sr[e])return Sr[e];if(!wr[e])return e;var t,n=wr[e];for(t in n)if(n.hasOwnProperty(t)&&t in Cr)return Sr[e]=n[t];return e}u&&(Cr=document.createElement("div").style,"AnimationEvent"in window||(delete wr.animationend.animation,delete wr.animationiteration.animation,delete wr.animationstart.animation),"TransitionEvent"in window||delete wr.transitionend.transition);var Er=kr("animationend"),Rr=kr("animationiteration"),Mr=kr("animationstart"),Lr=kr("transitionend"),Pr=new Map,Tr="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function Dr(e,t){Pr.set(e,t),l(t,[e])}for(var Or=0;Or<Tr.length;Or++){var Ir=Tr[Or];Dr(Ir.toLowerCase(),"on"+(Ir[0].toUpperCase()+Ir.slice(1)))}Dr(Er,"onAnimationEnd"),Dr(Rr,"onAnimationIteration"),Dr(Mr,"onAnimationStart"),Dr("dblclick","onDoubleClick"),Dr("focusin","onFocus"),Dr("focusout","onBlur"),Dr(Lr,"onTransitionEnd"),c("onMouseEnter",["mouseout","mouseover"]),c("onMouseLeave",["mouseout","mouseover"]),c("onPointerEnter",["pointerout","pointerover"]),c("onPointerLeave",["pointerout","pointerover"]),l("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),l("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),l("onBeforeInput",["compositionend","keypress","textInput","paste"]),l("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),l("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),l("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ar="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),jr=new Set("cancel close invalid load scroll toggle".split(" ").concat(Ar));function Br(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,function(e,t,n,r,i,s,a,l,c){if(He.apply(this,arguments),je){if(!je)throw Error(o(198));var u=Be;je=!1,Be=null,Ne||(Ne=!0,Fe=u)}}(r,t,void 0,e),e.currentTarget=null}function Nr(e,t){t=0!==(4&t);for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;e:{var o=void 0;if(t)for(var s=r.length-1;0<=s;s--){var a=r[s],l=a.instance,c=a.currentTarget;if(a=a.listener,l!==o&&i.isPropagationStopped())break e;Br(i,a,c),o=l}else for(s=0;s<r.length;s++){if(l=(a=r[s]).instance,c=a.currentTarget,a=a.listener,l!==o&&i.isPropagationStopped())break e;Br(i,a,c),o=l}}}if(Ne)throw e=Fe,Ne=!1,Fe=null,e}function Fr(e,t){var n=t[gi];void 0===n&&(n=t[gi]=new Set);var r=e+"__bubble";n.has(r)||(Ur(t,e,2,!1),n.add(r))}function zr(e,t,n){var r=0;t&&(r|=4),Ur(n,e,r,t)}var Hr="_reactListening"+Math.random().toString(36).slice(2);function Wr(e){if(!e[Hr]){e[Hr]=!0,s.forEach(function(t){"selectionchange"!==t&&(jr.has(t)||zr(t,!1,e),zr(t,!0,e))});var t=9===e.nodeType?e:e.ownerDocument;null===t||t[Hr]||(t[Hr]=!0,zr("selectionchange",!1,t))}}function Ur(e,t,n,r){switch(Gt(t)){case 1:var i=$t;break;case 4:i=qt;break;default:i=Kt}n=i.bind(null,t,n,e),i=void 0,!Oe||"touchstart"!==t&&"touchmove"!==t&&"wheel"!==t||(i=!0),r?void 0!==i?e.addEventListener(t,n,{capture:!0,passive:i}):e.addEventListener(t,n,!0):void 0!==i?e.addEventListener(t,n,{passive:i}):e.addEventListener(t,n,!1)}function Vr(e,t,n,r,i){var o=r;if(0===(1&t)&&0===(2&t)&&null!==r)e:for(;;){if(null===r)return;var s=r.tag;if(3===s||4===s){var a=r.stateNode.containerInfo;if(a===i||8===a.nodeType&&a.parentNode===i)break;if(4===s)for(s=r.return;null!==s;){var l=s.tag;if((3===l||4===l)&&((l=s.stateNode.containerInfo)===i||8===l.nodeType&&l.parentNode===i))return;s=s.return}for(;null!==a;){if(null===(s=_i(a)))return;if(5===(l=s.tag)||6===l){r=o=s;continue e}a=a.parentNode}}r=r.return}Te(function(){var r=o,i=xe(n),s=[];e:{var a=Pr.get(e);if(void 0!==a){var l=un,c=e;switch(e){case"keypress":if(0===tn(n))break e;case"keydown":case"keyup":l=Rn;break;case"focusin":c="focus",l=vn;break;case"focusout":c="blur",l=vn;break;case"beforeblur":case"afterblur":l=vn;break;case"click":if(2===n.button)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":l=pn;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":l=gn;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":l=Ln;break;case Er:case Rr:case Mr:l=mn;break;case Lr:l=Pn;break;case"scroll":l=hn;break;case"wheel":l=Dn;break;case"copy":case"cut":case"paste":l=yn;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":l=Mn}var u=0!==(4&t),d=!u&&"scroll"===e,h=u?null!==a?a+"Capture":null:a;u=[];for(var f,p=r;null!==p;){var g=(f=p).stateNode;if(5===f.tag&&null!==g&&(f=g,null!==h&&(null!=(g=De(p,h))&&u.push($r(p,g,f)))),d)break;p=p.return}0<u.length&&(a=new l(a,c,null,n,i),s.push({event:a,listeners:u}))}}if(0===(7&t)){if(l="mouseout"===e||"pointerout"===e,(!(a="mouseover"===e||"pointerover"===e)||n===be||!(c=n.relatedTarget||n.fromElement)||!_i(c)&&!c[pi])&&(l||a)&&(a=i.window===i?i:(a=i.ownerDocument)?a.defaultView||a.parentWindow:window,l?(l=r,null!==(c=(c=n.relatedTarget||n.toElement)?_i(c):null)&&(c!==(d=We(c))||5!==c.tag&&6!==c.tag)&&(c=null)):(l=null,c=r),l!==c)){if(u=pn,g="onMouseLeave",h="onMouseEnter",p="mouse","pointerout"!==e&&"pointerover"!==e||(u=Mn,g="onPointerLeave",h="onPointerEnter",p="pointer"),d=null==l?a:bi(l),f=null==c?a:bi(c),(a=new u(g,p+"leave",l,n,i)).target=d,a.relatedTarget=f,g=null,_i(i)===r&&((u=new u(h,p+"enter",c,n,i)).target=f,u.relatedTarget=d,g=u),d=g,l&&c)e:{for(h=c,p=0,f=u=l;f;f=Kr(f))p++;for(f=0,g=h;g;g=Kr(g))f++;for(;0<p-f;)u=Kr(u),p--;for(;0<f-p;)h=Kr(h),f--;for(;p--;){if(u===h||null!==h&&u===h.alternate)break e;u=Kr(u),h=Kr(h)}u=null}else u=null;null!==l&&Yr(s,a,l,u,!1),null!==c&&null!==d&&Yr(s,d,c,u,!0)}if("select"===(l=(a=r?bi(r):window).nodeName&&a.nodeName.toLowerCase())||"input"===l&&"file"===a.type)var v=Gn;else if(Vn(a))if(Zn)v=sr;else{v=ir;var m=rr}else(l=a.nodeName)&&"input"===l.toLowerCase()&&("checkbox"===a.type||"radio"===a.type)&&(v=or);switch(v&&(v=v(e,r))?$n(s,v,n,i):(m&&m(e,a,r),"focusout"===e&&(m=a._wrapperState)&&m.controlled&&"number"===a.type&&ee(a,"number",a.value)),m=r?bi(r):window,e){case"focusin":(Vn(m)||"true"===m.contentEditable)&&(vr=m,mr=r,_r=null);break;case"focusout":_r=mr=vr=null;break;case"mousedown":yr=!0;break;case"contextmenu":case"mouseup":case"dragend":yr=!1,br(s,n,i);break;case"selectionchange":if(gr)break;case"keydown":case"keyup":br(s,n,i)}var _;if(In)e:{switch(e){case"compositionstart":var y="onCompositionStart";break e;case"compositionend":y="onCompositionEnd";break e;case"compositionupdate":y="onCompositionUpdate";break e}y=void 0}else Wn?zn(e,n)&&(y="onCompositionEnd"):"keydown"===e&&229===n.keyCode&&(y="onCompositionStart");y&&(Bn&&"ko"!==n.locale&&(Wn||"onCompositionStart"!==y?"onCompositionEnd"===y&&Wn&&(_=en()):(Jt="value"in(Zt=i)?Zt.value:Zt.textContent,Wn=!0)),0<(m=qr(r,y)).length&&(y=new bn(y,e,null,n,i),s.push({event:y,listeners:m}),_?y.data=_:null!==(_=Hn(n))&&(y.data=_))),(_=jn?function(e,t){switch(e){case"compositionend":return Hn(t);case"keypress":return 32!==t.which?null:(Fn=!0,Nn);case"textInput":return(e=t.data)===Nn&&Fn?null:e;default:return null}}(e,n):function(e,t){if(Wn)return"compositionend"===e||!In&&zn(e,t)?(e=en(),Qt=Jt=Zt=null,Wn=!1,e):null;switch(e){case"paste":default:return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return Bn&&"ko"!==t.locale?null:t.data}}(e,n))&&(0<(r=qr(r,"onBeforeInput")).length&&(i=new bn("onBeforeInput","beforeinput",null,n,i),s.push({event:i,listeners:r}),i.data=_))}Nr(s,t)})}function $r(e,t,n){return{instance:e,listener:t,currentTarget:n}}function qr(e,t){for(var n=t+"Capture",r=[];null!==e;){var i=e,o=i.stateNode;5===i.tag&&null!==o&&(i=o,null!=(o=De(e,n))&&r.unshift($r(e,o,i)),null!=(o=De(e,t))&&r.push($r(e,o,i))),e=e.return}return r}function Kr(e){if(null===e)return null;do{e=e.return}while(e&&5!==e.tag);return e||null}function Yr(e,t,n,r,i){for(var o=t._reactName,s=[];null!==n&&n!==r;){var a=n,l=a.alternate,c=a.stateNode;if(null!==l&&l===r)break;5===a.tag&&null!==c&&(a=c,i?null!=(l=De(n,o))&&s.unshift($r(n,l,a)):i||null!=(l=De(n,o))&&s.push($r(n,l,a))),n=n.return}0!==s.length&&e.push({event:t,listeners:s})}var Xr=/\r\n?/g,Gr=/\u0000|\uFFFD/g;function Zr(e){return("string"===typeof e?e:""+e).replace(Xr,"\n").replace(Gr,"")}function Jr(e,t,n){if(t=Zr(t),Zr(e)!==t&&n)throw Error(o(425))}function Qr(){}var ei=null,ti=null;function ni(e,t){return"textarea"===e||"noscript"===e||"string"===typeof t.children||"number"===typeof t.children||"object"===typeof t.dangerouslySetInnerHTML&&null!==t.dangerouslySetInnerHTML&&null!=t.dangerouslySetInnerHTML.__html}var ri="function"===typeof setTimeout?setTimeout:void 0,ii="function"===typeof clearTimeout?clearTimeout:void 0,oi="function"===typeof Promise?Promise:void 0,si="function"===typeof queueMicrotask?queueMicrotask:"undefined"!==typeof oi?function(e){return oi.resolve(null).then(e).catch(ai)}:ri;function ai(e){setTimeout(function(){throw e})}function li(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&8===i.nodeType)if("/$"===(n=i.data)){if(0===r)return e.removeChild(i),void Wt(t);r--}else"$"!==n&&"$?"!==n&&"$!"!==n||r++;n=i}while(n);Wt(t)}function ci(e){for(;null!=e;e=e.nextSibling){var t=e.nodeType;if(1===t||3===t)break;if(8===t){if("$"===(t=e.data)||"$!"===t||"$?"===t)break;if("/$"===t)return null}}return e}function ui(e){e=e.previousSibling;for(var t=0;e;){if(8===e.nodeType){var n=e.data;if("$"===n||"$!"===n||"$?"===n){if(0===t)return e;t--}else"/$"===n&&t++}e=e.previousSibling}return null}var di=Math.random().toString(36).slice(2),hi="__reactFiber$"+di,fi="__reactProps$"+di,pi="__reactContainer$"+di,gi="__reactEvents$"+di,vi="__reactListeners$"+di,mi="__reactHandles$"+di;function _i(e){var t=e[hi];if(t)return t;for(var n=e.parentNode;n;){if(t=n[pi]||n[hi]){if(n=t.alternate,null!==t.child||null!==n&&null!==n.child)for(e=ui(e);null!==e;){if(n=e[hi])return n;e=ui(e)}return t}n=(e=n).parentNode}return null}function yi(e){return!(e=e[hi]||e[pi])||5!==e.tag&&6!==e.tag&&13!==e.tag&&3!==e.tag?null:e}function bi(e){if(5===e.tag||6===e.tag)return e.stateNode;throw Error(o(33))}function xi(e){return e[fi]||null}var wi=[],Si=-1;function Ci(e){return{current:e}}function ki(e){0>Si||(e.current=wi[Si],wi[Si]=null,Si--)}function Ei(e,t){Si++,wi[Si]=e.current,e.current=t}var Ri={},Mi=Ci(Ri),Li=Ci(!1),Pi=Ri;function Ti(e,t){var n=e.type.contextTypes;if(!n)return Ri;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i,o={};for(i in n)o[i]=t[i];return r&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=o),o}function Di(e){return null!==(e=e.childContextTypes)&&void 0!==e}function Oi(){ki(Li),ki(Mi)}function Ii(e,t,n){if(Mi.current!==Ri)throw Error(o(168));Ei(Mi,t),Ei(Li,n)}function Ai(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,"function"!==typeof r.getChildContext)return n;for(var i in r=r.getChildContext())if(!(i in t))throw Error(o(108,U(e)||"Unknown",i));return B({},n,r)}function ji(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Ri,Pi=Mi.current,Ei(Mi,e),Ei(Li,Li.current),!0}function Bi(e,t,n){var r=e.stateNode;if(!r)throw Error(o(169));n?(e=Ai(e,t,Pi),r.__reactInternalMemoizedMergedChildContext=e,ki(Li),ki(Mi),Ei(Mi,e)):ki(Li),Ei(Li,n)}var Ni=null,Fi=!1,zi=!1;function Hi(e){null===Ni?Ni=[e]:Ni.push(e)}function Wi(){if(!zi&&null!==Ni){zi=!0;var e=0,t=yt;try{var n=Ni;for(yt=1;e<n.length;e++){var r=n[e];do{r=r(!0)}while(null!==r)}Ni=null,Fi=!1}catch(i){throw null!==Ni&&(Ni=Ni.slice(e+1)),Ke(Qe,Wi),i}finally{yt=t,zi=!1}}return null}var Ui=[],Vi=0,$i=null,qi=0,Ki=[],Yi=0,Xi=null,Gi=1,Zi="";function Ji(e,t){Ui[Vi++]=qi,Ui[Vi++]=$i,$i=e,qi=t}function Qi(e,t,n){Ki[Yi++]=Gi,Ki[Yi++]=Zi,Ki[Yi++]=Xi,Xi=e;var r=Gi;e=Zi;var i=32-st(r)-1;r&=~(1<<i),n+=1;var o=32-st(t)+i;if(30<o){var s=i-i%5;o=(r&(1<<s)-1).toString(32),r>>=s,i-=s,Gi=1<<32-st(t)+i|n<<i|r,Zi=o+e}else Gi=1<<o|n<<i|r,Zi=e}function eo(e){null!==e.return&&(Ji(e,1),Qi(e,1,0))}function to(e){for(;e===$i;)$i=Ui[--Vi],Ui[Vi]=null,qi=Ui[--Vi],Ui[Vi]=null;for(;e===Xi;)Xi=Ki[--Yi],Ki[Yi]=null,Zi=Ki[--Yi],Ki[Yi]=null,Gi=Ki[--Yi],Ki[Yi]=null}var no=null,ro=null,io=!1,oo=null;function so(e,t){var n=Tc(5,null,null,0);n.elementType="DELETED",n.stateNode=t,n.return=e,null===(t=e.deletions)?(e.deletions=[n],e.flags|=16):t.push(n)}function ao(e,t){switch(e.tag){case 5:var n=e.type;return null!==(t=1!==t.nodeType||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t)&&(e.stateNode=t,no=e,ro=ci(t.firstChild),!0);case 6:return null!==(t=""===e.pendingProps||3!==t.nodeType?null:t)&&(e.stateNode=t,no=e,ro=null,!0);case 13:return null!==(t=8!==t.nodeType?null:t)&&(n=null!==Xi?{id:Gi,overflow:Zi}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},(n=Tc(18,null,null,0)).stateNode=t,n.return=e,e.child=n,no=e,ro=null,!0);default:return!1}}function lo(e){return 0!==(1&e.mode)&&0===(128&e.flags)}function co(e){if(io){var t=ro;if(t){var n=t;if(!ao(e,t)){if(lo(e))throw Error(o(418));t=ci(n.nextSibling);var r=no;t&&ao(e,t)?so(r,n):(e.flags=-4097&e.flags|2,io=!1,no=e)}}else{if(lo(e))throw Error(o(418));e.flags=-4097&e.flags|2,io=!1,no=e}}}function uo(e){for(e=e.return;null!==e&&5!==e.tag&&3!==e.tag&&13!==e.tag;)e=e.return;no=e}function ho(e){if(e!==no)return!1;if(!io)return uo(e),io=!0,!1;var t;if((t=3!==e.tag)&&!(t=5!==e.tag)&&(t="head"!==(t=e.type)&&"body"!==t&&!ni(e.type,e.memoizedProps)),t&&(t=ro)){if(lo(e))throw fo(),Error(o(418));for(;t;)so(e,t),t=ci(t.nextSibling)}if(uo(e),13===e.tag){if(!(e=null!==(e=e.memoizedState)?e.dehydrated:null))throw Error(o(317));e:{for(e=e.nextSibling,t=0;e;){if(8===e.nodeType){var n=e.data;if("/$"===n){if(0===t){ro=ci(e.nextSibling);break e}t--}else"$"!==n&&"$!"!==n&&"$?"!==n||t++}e=e.nextSibling}ro=null}}else ro=no?ci(e.stateNode.nextSibling):null;return!0}function fo(){for(var e=ro;e;)e=ci(e.nextSibling)}function po(){ro=no=null,io=!1}function go(e){null===oo?oo=[e]:oo.push(e)}var vo=b.ReactCurrentBatchConfig;function mo(e,t,n){if(null!==(e=n.ref)&&"function"!==typeof e&&"object"!==typeof e){if(n._owner){if(n=n._owner){if(1!==n.tag)throw Error(o(309));var r=n.stateNode}if(!r)throw Error(o(147,e));var i=r,s=""+e;return null!==t&&null!==t.ref&&"function"===typeof t.ref&&t.ref._stringRef===s?t.ref:(t=function(e){var t=i.refs;null===e?delete t[s]:t[s]=e},t._stringRef=s,t)}if("string"!==typeof e)throw Error(o(284));if(!n._owner)throw Error(o(290,e))}return e}function _o(e,t){throw e=Object.prototype.toString.call(t),Error(o(31,"[object Object]"===e?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function yo(e){return(0,e._init)(e._payload)}function bo(e){function t(t,n){if(e){var r=t.deletions;null===r?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;null!==r;)t(n,r),r=r.sibling;return null}function r(e,t){for(e=new Map;null!==t;)null!==t.key?e.set(t.key,t):e.set(t.index,t),t=t.sibling;return e}function i(e,t){return(e=Oc(e,t)).index=0,e.sibling=null,e}function s(t,n,r){return t.index=r,e?null!==(r=t.alternate)?(r=r.index)<n?(t.flags|=2,n):r:(t.flags|=2,n):(t.flags|=1048576,n)}function a(t){return e&&null===t.alternate&&(t.flags|=2),t}function l(e,t,n,r){return null===t||6!==t.tag?((t=Bc(n,e.mode,r)).return=e,t):((t=i(t,n)).return=e,t)}function c(e,t,n,r){var o=n.type;return o===S?d(e,t,n.props.children,r,n.key):null!==t&&(t.elementType===o||"object"===typeof o&&null!==o&&o.$$typeof===D&&yo(o)===t.type)?((r=i(t,n.props)).ref=mo(e,t,n),r.return=e,r):((r=Ic(n.type,n.key,n.props,null,e.mode,r)).ref=mo(e,t,n),r.return=e,r)}function u(e,t,n,r){return null===t||4!==t.tag||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?((t=Nc(n,e.mode,r)).return=e,t):((t=i(t,n.children||[])).return=e,t)}function d(e,t,n,r,o){return null===t||7!==t.tag?((t=Ac(n,e.mode,r,o)).return=e,t):((t=i(t,n)).return=e,t)}function h(e,t,n){if("string"===typeof t&&""!==t||"number"===typeof t)return(t=Bc(""+t,e.mode,n)).return=e,t;if("object"===typeof t&&null!==t){switch(t.$$typeof){case x:return(n=Ic(t.type,t.key,t.props,null,e.mode,n)).ref=mo(e,null,t),n.return=e,n;case w:return(t=Nc(t,e.mode,n)).return=e,t;case D:return h(e,(0,t._init)(t._payload),n)}if(te(t)||A(t))return(t=Ac(t,e.mode,n,null)).return=e,t;_o(e,t)}return null}function f(e,t,n,r){var i=null!==t?t.key:null;if("string"===typeof n&&""!==n||"number"===typeof n)return null!==i?null:l(e,t,""+n,r);if("object"===typeof n&&null!==n){switch(n.$$typeof){case x:return n.key===i?c(e,t,n,r):null;case w:return n.key===i?u(e,t,n,r):null;case D:return f(e,t,(i=n._init)(n._payload),r)}if(te(n)||A(n))return null!==i?null:d(e,t,n,r,null);_o(e,n)}return null}function p(e,t,n,r,i){if("string"===typeof r&&""!==r||"number"===typeof r)return l(t,e=e.get(n)||null,""+r,i);if("object"===typeof r&&null!==r){switch(r.$$typeof){case x:return c(t,e=e.get(null===r.key?n:r.key)||null,r,i);case w:return u(t,e=e.get(null===r.key?n:r.key)||null,r,i);case D:return p(e,t,n,(0,r._init)(r._payload),i)}if(te(r)||A(r))return d(t,e=e.get(n)||null,r,i,null);_o(t,r)}return null}function g(i,o,a,l){for(var c=null,u=null,d=o,g=o=0,v=null;null!==d&&g<a.length;g++){d.index>g?(v=d,d=null):v=d.sibling;var m=f(i,d,a[g],l);if(null===m){null===d&&(d=v);break}e&&d&&null===m.alternate&&t(i,d),o=s(m,o,g),null===u?c=m:u.sibling=m,u=m,d=v}if(g===a.length)return n(i,d),io&&Ji(i,g),c;if(null===d){for(;g<a.length;g++)null!==(d=h(i,a[g],l))&&(o=s(d,o,g),null===u?c=d:u.sibling=d,u=d);return io&&Ji(i,g),c}for(d=r(i,d);g<a.length;g++)null!==(v=p(d,i,g,a[g],l))&&(e&&null!==v.alternate&&d.delete(null===v.key?g:v.key),o=s(v,o,g),null===u?c=v:u.sibling=v,u=v);return e&&d.forEach(function(e){return t(i,e)}),io&&Ji(i,g),c}function v(i,a,l,c){var u=A(l);if("function"!==typeof u)throw Error(o(150));if(null==(l=u.call(l)))throw Error(o(151));for(var d=u=null,g=a,v=a=0,m=null,_=l.next();null!==g&&!_.done;v++,_=l.next()){g.index>v?(m=g,g=null):m=g.sibling;var y=f(i,g,_.value,c);if(null===y){null===g&&(g=m);break}e&&g&&null===y.alternate&&t(i,g),a=s(y,a,v),null===d?u=y:d.sibling=y,d=y,g=m}if(_.done)return n(i,g),io&&Ji(i,v),u;if(null===g){for(;!_.done;v++,_=l.next())null!==(_=h(i,_.value,c))&&(a=s(_,a,v),null===d?u=_:d.sibling=_,d=_);return io&&Ji(i,v),u}for(g=r(i,g);!_.done;v++,_=l.next())null!==(_=p(g,i,v,_.value,c))&&(e&&null!==_.alternate&&g.delete(null===_.key?v:_.key),a=s(_,a,v),null===d?u=_:d.sibling=_,d=_);return e&&g.forEach(function(e){return t(i,e)}),io&&Ji(i,v),u}return function e(r,o,s,l){if("object"===typeof s&&null!==s&&s.type===S&&null===s.key&&(s=s.props.children),"object"===typeof s&&null!==s){switch(s.$$typeof){case x:e:{for(var c=s.key,u=o;null!==u;){if(u.key===c){if((c=s.type)===S){if(7===u.tag){n(r,u.sibling),(o=i(u,s.props.children)).return=r,r=o;break e}}else if(u.elementType===c||"object"===typeof c&&null!==c&&c.$$typeof===D&&yo(c)===u.type){n(r,u.sibling),(o=i(u,s.props)).ref=mo(r,u,s),o.return=r,r=o;break e}n(r,u);break}t(r,u),u=u.sibling}s.type===S?((o=Ac(s.props.children,r.mode,l,s.key)).return=r,r=o):((l=Ic(s.type,s.key,s.props,null,r.mode,l)).ref=mo(r,o,s),l.return=r,r=l)}return a(r);case w:e:{for(u=s.key;null!==o;){if(o.key===u){if(4===o.tag&&o.stateNode.containerInfo===s.containerInfo&&o.stateNode.implementation===s.implementation){n(r,o.sibling),(o=i(o,s.children||[])).return=r,r=o;break e}n(r,o);break}t(r,o),o=o.sibling}(o=Nc(s,r.mode,l)).return=r,r=o}return a(r);case D:return e(r,o,(u=s._init)(s._payload),l)}if(te(s))return g(r,o,s,l);if(A(s))return v(r,o,s,l);_o(r,s)}return"string"===typeof s&&""!==s||"number"===typeof s?(s=""+s,null!==o&&6===o.tag?(n(r,o.sibling),(o=i(o,s)).return=r,r=o):(n(r,o),(o=Bc(s,r.mode,l)).return=r,r=o),a(r)):n(r,o)}}var xo=bo(!0),wo=bo(!1),So=Ci(null),Co=null,ko=null,Eo=null;function Ro(){Eo=ko=Co=null}function Mo(e){var t=So.current;ki(So),e._currentValue=t}function Lo(e,t,n){for(;null!==e;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,null!==r&&(r.childLanes|=t)):null!==r&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function Po(e,t){Co=e,Eo=ko=null,null!==(e=e.dependencies)&&null!==e.firstContext&&(0!==(e.lanes&t)&&(ya=!0),e.firstContext=null)}function To(e){var t=e._currentValue;if(Eo!==e)if(e={context:e,memoizedValue:t,next:null},null===ko){if(null===Co)throw Error(o(308));ko=e,Co.dependencies={lanes:0,firstContext:e}}else ko=ko.next=e;return t}var Do=null;function Oo(e){null===Do?Do=[e]:Do.push(e)}function Io(e,t,n,r){var i=t.interleaved;return null===i?(n.next=n,Oo(t)):(n.next=i.next,i.next=n),t.interleaved=n,Ao(e,r)}function Ao(e,t){e.lanes|=t;var n=e.alternate;for(null!==n&&(n.lanes|=t),n=e,e=e.return;null!==e;)e.childLanes|=t,null!==(n=e.alternate)&&(n.childLanes|=t),n=e,e=e.return;return 3===n.tag?n.stateNode:null}var jo=!1;function Bo(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function No(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Fo(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function zo(e,t,n){var r=e.updateQueue;if(null===r)return null;if(r=r.shared,0!==(2&Ml)){var i=r.pending;return null===i?t.next=t:(t.next=i.next,i.next=t),r.pending=t,Ao(e,n)}return null===(i=r.interleaved)?(t.next=t,Oo(r)):(t.next=i.next,i.next=t),r.interleaved=t,Ao(e,n)}function Ho(e,t,n){if(null!==(t=t.updateQueue)&&(t=t.shared,0!==(4194240&n))){var r=t.lanes;n|=r&=e.pendingLanes,t.lanes=n,_t(e,n)}}function Wo(e,t){var n=e.updateQueue,r=e.alternate;if(null!==r&&n===(r=r.updateQueue)){var i=null,o=null;if(null!==(n=n.firstBaseUpdate)){do{var s={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};null===o?i=o=s:o=o.next=s,n=n.next}while(null!==n);null===o?i=o=t:o=o.next=t}else i=o=t;return n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:o,shared:r.shared,effects:r.effects},void(e.updateQueue=n)}null===(e=n.lastBaseUpdate)?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function Uo(e,t,n,r){var i=e.updateQueue;jo=!1;var o=i.firstBaseUpdate,s=i.lastBaseUpdate,a=i.shared.pending;if(null!==a){i.shared.pending=null;var l=a,c=l.next;l.next=null,null===s?o=c:s.next=c,s=l;var u=e.alternate;null!==u&&((a=(u=u.updateQueue).lastBaseUpdate)!==s&&(null===a?u.firstBaseUpdate=c:a.next=c,u.lastBaseUpdate=l))}if(null!==o){var d=i.baseState;for(s=0,u=c=l=null,a=o;;){var h=a.lane,f=a.eventTime;if((r&h)===h){null!==u&&(u=u.next={eventTime:f,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var p=e,g=a;switch(h=t,f=n,g.tag){case 1:if("function"===typeof(p=g.payload)){d=p.call(f,d,h);break e}d=p;break e;case 3:p.flags=-65537&p.flags|128;case 0:if(null===(h="function"===typeof(p=g.payload)?p.call(f,d,h):p)||void 0===h)break e;d=B({},d,h);break e;case 2:jo=!0}}null!==a.callback&&0!==a.lane&&(e.flags|=64,null===(h=i.effects)?i.effects=[a]:h.push(a))}else f={eventTime:f,lane:h,tag:a.tag,payload:a.payload,callback:a.callback,next:null},null===u?(c=u=f,l=d):u=u.next=f,s|=h;if(null===(a=a.next)){if(null===(a=i.shared.pending))break;a=(h=a).next,h.next=null,i.lastBaseUpdate=h,i.shared.pending=null}}if(null===u&&(l=d),i.baseState=l,i.firstBaseUpdate=c,i.lastBaseUpdate=u,null!==(t=i.shared.interleaved)){i=t;do{s|=i.lane,i=i.next}while(i!==t)}else null===o&&(i.shared.lanes=0);jl|=s,e.lanes=s,e.memoizedState=d}}function Vo(e,t,n){if(e=t.effects,t.effects=null,null!==e)for(t=0;t<e.length;t++){var r=e[t],i=r.callback;if(null!==i){if(r.callback=null,r=n,"function"!==typeof i)throw Error(o(191,i));i.call(r)}}}var $o={},qo=Ci($o),Ko=Ci($o),Yo=Ci($o);function Xo(e){if(e===$o)throw Error(o(174));return e}function Go(e,t){switch(Ei(Yo,t),Ei(Ko,e),Ei(qo,$o),e=t.nodeType){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:le(null,"");break;default:t=le(t=(e=8===e?t.parentNode:t).namespaceURI||null,e=e.tagName)}ki(qo),Ei(qo,t)}function Zo(){ki(qo),ki(Ko),ki(Yo)}function Jo(e){Xo(Yo.current);var t=Xo(qo.current),n=le(t,e.type);t!==n&&(Ei(Ko,e),Ei(qo,n))}function Qo(e){Ko.current===e&&(ki(qo),ki(Ko))}var es=Ci(0);function ts(e){for(var t=e;null!==t;){if(13===t.tag){var n=t.memoizedState;if(null!==n&&(null===(n=n.dehydrated)||"$?"===n.data||"$!"===n.data))return t}else if(19===t.tag&&void 0!==t.memoizedProps.revealOrder){if(0!==(128&t.flags))return t}else if(null!==t.child){t.child.return=t,t=t.child;continue}if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var ns=[];function rs(){for(var e=0;e<ns.length;e++)ns[e]._workInProgressVersionPrimary=null;ns.length=0}var is=b.ReactCurrentDispatcher,os=b.ReactCurrentBatchConfig,ss=0,as=null,ls=null,cs=null,us=!1,ds=!1,hs=0,fs=0;function ps(){throw Error(o(321))}function gs(e,t){if(null===t)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!ar(e[n],t[n]))return!1;return!0}function vs(e,t,n,r,i,s){if(ss=s,as=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,is.current=null===e||null===e.memoizedState?Qs:ea,e=n(r,i),ds){s=0;do{if(ds=!1,hs=0,25<=s)throw Error(o(301));s+=1,cs=ls=null,t.updateQueue=null,is.current=ta,e=n(r,i)}while(ds)}if(is.current=Js,t=null!==ls&&null!==ls.next,ss=0,cs=ls=as=null,us=!1,t)throw Error(o(300));return e}function ms(){var e=0!==hs;return hs=0,e}function _s(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return null===cs?as.memoizedState=cs=e:cs=cs.next=e,cs}function ys(){if(null===ls){var e=as.alternate;e=null!==e?e.memoizedState:null}else e=ls.next;var t=null===cs?as.memoizedState:cs.next;if(null!==t)cs=t,ls=e;else{if(null===e)throw Error(o(310));e={memoizedState:(ls=e).memoizedState,baseState:ls.baseState,baseQueue:ls.baseQueue,queue:ls.queue,next:null},null===cs?as.memoizedState=cs=e:cs=cs.next=e}return cs}function bs(e,t){return"function"===typeof t?t(e):t}function xs(e){var t=ys(),n=t.queue;if(null===n)throw Error(o(311));n.lastRenderedReducer=e;var r=ls,i=r.baseQueue,s=n.pending;if(null!==s){if(null!==i){var a=i.next;i.next=s.next,s.next=a}r.baseQueue=i=s,n.pending=null}if(null!==i){s=i.next,r=r.baseState;var l=a=null,c=null,u=s;do{var d=u.lane;if((ss&d)===d)null!==c&&(c=c.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),r=u.hasEagerState?u.eagerState:e(r,u.action);else{var h={lane:d,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};null===c?(l=c=h,a=r):c=c.next=h,as.lanes|=d,jl|=d}u=u.next}while(null!==u&&u!==s);null===c?a=r:c.next=l,ar(r,t.memoizedState)||(ya=!0),t.memoizedState=r,t.baseState=a,t.baseQueue=c,n.lastRenderedState=r}if(null!==(e=n.interleaved)){i=e;do{s=i.lane,as.lanes|=s,jl|=s,i=i.next}while(i!==e)}else null===i&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function ws(e){var t=ys(),n=t.queue;if(null===n)throw Error(o(311));n.lastRenderedReducer=e;var r=n.dispatch,i=n.pending,s=t.memoizedState;if(null!==i){n.pending=null;var a=i=i.next;do{s=e(s,a.action),a=a.next}while(a!==i);ar(s,t.memoizedState)||(ya=!0),t.memoizedState=s,null===t.baseQueue&&(t.baseState=s),n.lastRenderedState=s}return[s,r]}function Ss(){}function Cs(e,t){var n=as,r=ys(),i=t(),s=!ar(r.memoizedState,i);if(s&&(r.memoizedState=i,ya=!0),r=r.queue,js(Rs.bind(null,n,r,e),[e]),r.getSnapshot!==t||s||null!==cs&&1&cs.memoizedState.tag){if(n.flags|=2048,Ts(9,Es.bind(null,n,r,i,t),void 0,null),null===Ll)throw Error(o(349));0!==(30&ss)||ks(n,t,i)}return i}function ks(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},null===(t=as.updateQueue)?(t={lastEffect:null,stores:null},as.updateQueue=t,t.stores=[e]):null===(n=t.stores)?t.stores=[e]:n.push(e)}function Es(e,t,n,r){t.value=n,t.getSnapshot=r,Ms(t)&&Ls(e)}function Rs(e,t,n){return n(function(){Ms(t)&&Ls(e)})}function Ms(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!ar(e,n)}catch(r){return!0}}function Ls(e){var t=Ao(e,1);null!==t&&nc(t,e,1,-1)}function Ps(e){var t=_s();return"function"===typeof e&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:bs,lastRenderedState:e},t.queue=e,e=e.dispatch=Ys.bind(null,as,e),[t.memoizedState,e]}function Ts(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},null===(t=as.updateQueue)?(t={lastEffect:null,stores:null},as.updateQueue=t,t.lastEffect=e.next=e):null===(n=t.lastEffect)?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function Ds(){return ys().memoizedState}function Os(e,t,n,r){var i=_s();as.flags|=e,i.memoizedState=Ts(1|t,n,void 0,void 0===r?null:r)}function Is(e,t,n,r){var i=ys();r=void 0===r?null:r;var o=void 0;if(null!==ls){var s=ls.memoizedState;if(o=s.destroy,null!==r&&gs(r,s.deps))return void(i.memoizedState=Ts(t,n,o,r))}as.flags|=e,i.memoizedState=Ts(1|t,n,o,r)}function As(e,t){return Os(8390656,8,e,t)}function js(e,t){return Is(2048,8,e,t)}function Bs(e,t){return Is(4,2,e,t)}function Ns(e,t){return Is(4,4,e,t)}function Fs(e,t){return"function"===typeof t?(e=e(),t(e),function(){t(null)}):null!==t&&void 0!==t?(e=e(),t.current=e,function(){t.current=null}):void 0}function zs(e,t,n){return n=null!==n&&void 0!==n?n.concat([e]):null,Is(4,4,Fs.bind(null,t,e),n)}function Hs(){}function Ws(e,t){var n=ys();t=void 0===t?null:t;var r=n.memoizedState;return null!==r&&null!==t&&gs(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function Us(e,t){var n=ys();t=void 0===t?null:t;var r=n.memoizedState;return null!==r&&null!==t&&gs(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function Vs(e,t,n){return 0===(21&ss)?(e.baseState&&(e.baseState=!1,ya=!0),e.memoizedState=n):(ar(n,t)||(n=gt(),as.lanes|=n,jl|=n,e.baseState=!0),t)}function $s(e,t){var n=yt;yt=0!==n&&4>n?n:4,e(!0);var r=os.transition;os.transition={};try{e(!1),t()}finally{yt=n,os.transition=r}}function qs(){return ys().memoizedState}function Ks(e,t,n){var r=tc(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Xs(e))Gs(t,n);else if(null!==(n=Io(e,t,n,r))){nc(n,e,r,ec()),Zs(n,t,r)}}function Ys(e,t,n){var r=tc(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Xs(e))Gs(t,i);else{var o=e.alternate;if(0===e.lanes&&(null===o||0===o.lanes)&&null!==(o=t.lastRenderedReducer))try{var s=t.lastRenderedState,a=o(s,n);if(i.hasEagerState=!0,i.eagerState=a,ar(a,s)){var l=t.interleaved;return null===l?(i.next=i,Oo(t)):(i.next=l.next,l.next=i),void(t.interleaved=i)}}catch(c){}null!==(n=Io(e,t,i,r))&&(nc(n,e,r,i=ec()),Zs(n,t,r))}}function Xs(e){var t=e.alternate;return e===as||null!==t&&t===as}function Gs(e,t){ds=us=!0;var n=e.pending;null===n?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Zs(e,t,n){if(0!==(4194240&n)){var r=t.lanes;n|=r&=e.pendingLanes,t.lanes=n,_t(e,n)}}var Js={readContext:To,useCallback:ps,useContext:ps,useEffect:ps,useImperativeHandle:ps,useInsertionEffect:ps,useLayoutEffect:ps,useMemo:ps,useReducer:ps,useRef:ps,useState:ps,useDebugValue:ps,useDeferredValue:ps,useTransition:ps,useMutableSource:ps,useSyncExternalStore:ps,useId:ps,unstable_isNewReconciler:!1},Qs={readContext:To,useCallback:function(e,t){return _s().memoizedState=[e,void 0===t?null:t],e},useContext:To,useEffect:As,useImperativeHandle:function(e,t,n){return n=null!==n&&void 0!==n?n.concat([e]):null,Os(4194308,4,Fs.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Os(4194308,4,e,t)},useInsertionEffect:function(e,t){return Os(4,2,e,t)},useMemo:function(e,t){var n=_s();return t=void 0===t?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=_s();return t=void 0!==n?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=Ks.bind(null,as,e),[r.memoizedState,e]},useRef:function(e){return e={current:e},_s().memoizedState=e},useState:Ps,useDebugValue:Hs,useDeferredValue:function(e){return _s().memoizedState=e},useTransition:function(){var e=Ps(!1),t=e[0];return e=$s.bind(null,e[1]),_s().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=as,i=_s();if(io){if(void 0===n)throw Error(o(407));n=n()}else{if(n=t(),null===Ll)throw Error(o(349));0!==(30&ss)||ks(r,t,n)}i.memoizedState=n;var s={value:n,getSnapshot:t};return i.queue=s,As(Rs.bind(null,r,s,e),[e]),r.flags|=2048,Ts(9,Es.bind(null,r,s,n,t),void 0,null),n},useId:function(){var e=_s(),t=Ll.identifierPrefix;if(io){var n=Zi;t=":"+t+"R"+(n=(Gi&~(1<<32-st(Gi)-1)).toString(32)+n),0<(n=hs++)&&(t+="H"+n.toString(32)),t+=":"}else t=":"+t+"r"+(n=fs++).toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},ea={readContext:To,useCallback:Ws,useContext:To,useEffect:js,useImperativeHandle:zs,useInsertionEffect:Bs,useLayoutEffect:Ns,useMemo:Us,useReducer:xs,useRef:Ds,useState:function(){return xs(bs)},useDebugValue:Hs,useDeferredValue:function(e){return Vs(ys(),ls.memoizedState,e)},useTransition:function(){return[xs(bs)[0],ys().memoizedState]},useMutableSource:Ss,useSyncExternalStore:Cs,useId:qs,unstable_isNewReconciler:!1},ta={readContext:To,useCallback:Ws,useContext:To,useEffect:js,useImperativeHandle:zs,useInsertionEffect:Bs,useLayoutEffect:Ns,useMemo:Us,useReducer:ws,useRef:Ds,useState:function(){return ws(bs)},useDebugValue:Hs,useDeferredValue:function(e){var t=ys();return null===ls?t.memoizedState=e:Vs(t,ls.memoizedState,e)},useTransition:function(){return[ws(bs)[0],ys().memoizedState]},useMutableSource:Ss,useSyncExternalStore:Cs,useId:qs,unstable_isNewReconciler:!1};function na(e,t){if(e&&e.defaultProps){for(var n in t=B({},t),e=e.defaultProps)void 0===t[n]&&(t[n]=e[n]);return t}return t}function ra(e,t,n,r){n=null===(n=n(r,t=e.memoizedState))||void 0===n?t:B({},t,n),e.memoizedState=n,0===e.lanes&&(e.updateQueue.baseState=n)}var ia={isMounted:function(e){return!!(e=e._reactInternals)&&We(e)===e},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=ec(),i=tc(e),o=Fo(r,i);o.payload=t,void 0!==n&&null!==n&&(o.callback=n),null!==(t=zo(e,o,i))&&(nc(t,e,i,r),Ho(t,e,i))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=ec(),i=tc(e),o=Fo(r,i);o.tag=1,o.payload=t,void 0!==n&&null!==n&&(o.callback=n),null!==(t=zo(e,o,i))&&(nc(t,e,i,r),Ho(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=ec(),r=tc(e),i=Fo(n,r);i.tag=2,void 0!==t&&null!==t&&(i.callback=t),null!==(t=zo(e,i,r))&&(nc(t,e,r,n),Ho(t,e,r))}};function oa(e,t,n,r,i,o,s){return"function"===typeof(e=e.stateNode).shouldComponentUpdate?e.shouldComponentUpdate(r,o,s):!t.prototype||!t.prototype.isPureReactComponent||(!lr(n,r)||!lr(i,o))}function sa(e,t,n){var r=!1,i=Ri,o=t.contextType;return"object"===typeof o&&null!==o?o=To(o):(i=Di(t)?Pi:Mi.current,o=(r=null!==(r=t.contextTypes)&&void 0!==r)?Ti(e,i):Ri),t=new t(n,o),e.memoizedState=null!==t.state&&void 0!==t.state?t.state:null,t.updater=ia,e.stateNode=t,t._reactInternals=e,r&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=i,e.__reactInternalMemoizedMaskedChildContext=o),t}function aa(e,t,n,r){e=t.state,"function"===typeof t.componentWillReceiveProps&&t.componentWillReceiveProps(n,r),"function"===typeof t.UNSAFE_componentWillReceiveProps&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&ia.enqueueReplaceState(t,t.state,null)}function la(e,t,n,r){var i=e.stateNode;i.props=n,i.state=e.memoizedState,i.refs={},Bo(e);var o=t.contextType;"object"===typeof o&&null!==o?i.context=To(o):(o=Di(t)?Pi:Mi.current,i.context=Ti(e,o)),i.state=e.memoizedState,"function"===typeof(o=t.getDerivedStateFromProps)&&(ra(e,t,o,n),i.state=e.memoizedState),"function"===typeof t.getDerivedStateFromProps||"function"===typeof i.getSnapshotBeforeUpdate||"function"!==typeof i.UNSAFE_componentWillMount&&"function"!==typeof i.componentWillMount||(t=i.state,"function"===typeof i.componentWillMount&&i.componentWillMount(),"function"===typeof i.UNSAFE_componentWillMount&&i.UNSAFE_componentWillMount(),t!==i.state&&ia.enqueueReplaceState(i,i.state,null),Uo(e,n,i,r),i.state=e.memoizedState),"function"===typeof i.componentDidMount&&(e.flags|=4194308)}function ca(e,t){try{var n="",r=t;do{n+=H(r),r=r.return}while(r);var i=n}catch(o){i="\nError generating stack: "+o.message+"\n"+o.stack}return{value:e,source:t,stack:i,digest:null}}function ua(e,t,n){return{value:e,source:null,stack:null!=n?n:null,digest:null!=t?t:null}}function da(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var ha="function"===typeof WeakMap?WeakMap:Map;function fa(e,t,n){(n=Fo(-1,n)).tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){Vl||(Vl=!0,$l=r),da(0,t)},n}function pa(e,t,n){(n=Fo(-1,n)).tag=3;var r=e.type.getDerivedStateFromError;if("function"===typeof r){var i=t.value;n.payload=function(){return r(i)},n.callback=function(){da(0,t)}}var o=e.stateNode;return null!==o&&"function"===typeof o.componentDidCatch&&(n.callback=function(){da(0,t),"function"!==typeof r&&(null===ql?ql=new Set([this]):ql.add(this));var e=t.stack;this.componentDidCatch(t.value,{componentStack:null!==e?e:""})}),n}function ga(e,t,n){var r=e.pingCache;if(null===r){r=e.pingCache=new ha;var i=new Set;r.set(t,i)}else void 0===(i=r.get(t))&&(i=new Set,r.set(t,i));i.has(n)||(i.add(n),e=kc.bind(null,e,t,n),t.then(e,e))}function va(e){do{var t;if((t=13===e.tag)&&(t=null===(t=e.memoizedState)||null!==t.dehydrated),t)return e;e=e.return}while(null!==e);return null}function ma(e,t,n,r,i){return 0===(1&e.mode)?(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,1===n.tag&&(null===n.alternate?n.tag=17:((t=Fo(-1,1)).tag=2,zo(n,t,1))),n.lanes|=1),e):(e.flags|=65536,e.lanes=i,e)}var _a=b.ReactCurrentOwner,ya=!1;function ba(e,t,n,r){t.child=null===e?wo(t,null,n,r):xo(t,e.child,n,r)}function xa(e,t,n,r,i){n=n.render;var o=t.ref;return Po(t,i),r=vs(e,t,n,r,o,i),n=ms(),null===e||ya?(io&&n&&eo(t),t.flags|=1,ba(e,t,r,i),t.child):(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,Va(e,t,i))}function wa(e,t,n,r,i){if(null===e){var o=n.type;return"function"!==typeof o||Dc(o)||void 0!==o.defaultProps||null!==n.compare||void 0!==n.defaultProps?((e=Ic(n.type,null,r,t,t.mode,i)).ref=t.ref,e.return=t,t.child=e):(t.tag=15,t.type=o,Sa(e,t,o,r,i))}if(o=e.child,0===(e.lanes&i)){var s=o.memoizedProps;if((n=null!==(n=n.compare)?n:lr)(s,r)&&e.ref===t.ref)return Va(e,t,i)}return t.flags|=1,(e=Oc(o,r)).ref=t.ref,e.return=t,t.child=e}function Sa(e,t,n,r,i){if(null!==e){var o=e.memoizedProps;if(lr(o,r)&&e.ref===t.ref){if(ya=!1,t.pendingProps=r=o,0===(e.lanes&i))return t.lanes=e.lanes,Va(e,t,i);0!==(131072&e.flags)&&(ya=!0)}}return Ea(e,t,n,r,i)}function Ca(e,t,n){var r=t.pendingProps,i=r.children,o=null!==e?e.memoizedState:null;if("hidden"===r.mode)if(0===(1&t.mode))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},Ei(Ol,Dl),Dl|=n;else{if(0===(1073741824&n))return e=null!==o?o.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,Ei(Ol,Dl),Dl|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=null!==o?o.baseLanes:n,Ei(Ol,Dl),Dl|=r}else null!==o?(r=o.baseLanes|n,t.memoizedState=null):r=n,Ei(Ol,Dl),Dl|=r;return ba(e,t,i,n),t.child}function ka(e,t){var n=t.ref;(null===e&&null!==n||null!==e&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Ea(e,t,n,r,i){var o=Di(n)?Pi:Mi.current;return o=Ti(t,o),Po(t,i),n=vs(e,t,n,r,o,i),r=ms(),null===e||ya?(io&&r&&eo(t),t.flags|=1,ba(e,t,n,i),t.child):(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,Va(e,t,i))}function Ra(e,t,n,r,i){if(Di(n)){var o=!0;ji(t)}else o=!1;if(Po(t,i),null===t.stateNode)Ua(e,t),sa(t,n,r),la(t,n,r,i),r=!0;else if(null===e){var s=t.stateNode,a=t.memoizedProps;s.props=a;var l=s.context,c=n.contextType;"object"===typeof c&&null!==c?c=To(c):c=Ti(t,c=Di(n)?Pi:Mi.current);var u=n.getDerivedStateFromProps,d="function"===typeof u||"function"===typeof s.getSnapshotBeforeUpdate;d||"function"!==typeof s.UNSAFE_componentWillReceiveProps&&"function"!==typeof s.componentWillReceiveProps||(a!==r||l!==c)&&aa(t,s,r,c),jo=!1;var h=t.memoizedState;s.state=h,Uo(t,r,s,i),l=t.memoizedState,a!==r||h!==l||Li.current||jo?("function"===typeof u&&(ra(t,n,u,r),l=t.memoizedState),(a=jo||oa(t,n,a,r,h,l,c))?(d||"function"!==typeof s.UNSAFE_componentWillMount&&"function"!==typeof s.componentWillMount||("function"===typeof s.componentWillMount&&s.componentWillMount(),"function"===typeof s.UNSAFE_componentWillMount&&s.UNSAFE_componentWillMount()),"function"===typeof s.componentDidMount&&(t.flags|=4194308)):("function"===typeof s.componentDidMount&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),s.props=r,s.state=l,s.context=c,r=a):("function"===typeof s.componentDidMount&&(t.flags|=4194308),r=!1)}else{s=t.stateNode,No(e,t),a=t.memoizedProps,c=t.type===t.elementType?a:na(t.type,a),s.props=c,d=t.pendingProps,h=s.context,"object"===typeof(l=n.contextType)&&null!==l?l=To(l):l=Ti(t,l=Di(n)?Pi:Mi.current);var f=n.getDerivedStateFromProps;(u="function"===typeof f||"function"===typeof s.getSnapshotBeforeUpdate)||"function"!==typeof s.UNSAFE_componentWillReceiveProps&&"function"!==typeof s.componentWillReceiveProps||(a!==d||h!==l)&&aa(t,s,r,l),jo=!1,h=t.memoizedState,s.state=h,Uo(t,r,s,i);var p=t.memoizedState;a!==d||h!==p||Li.current||jo?("function"===typeof f&&(ra(t,n,f,r),p=t.memoizedState),(c=jo||oa(t,n,c,r,h,p,l)||!1)?(u||"function"!==typeof s.UNSAFE_componentWillUpdate&&"function"!==typeof s.componentWillUpdate||("function"===typeof s.componentWillUpdate&&s.componentWillUpdate(r,p,l),"function"===typeof s.UNSAFE_componentWillUpdate&&s.UNSAFE_componentWillUpdate(r,p,l)),"function"===typeof s.componentDidUpdate&&(t.flags|=4),"function"===typeof s.getSnapshotBeforeUpdate&&(t.flags|=1024)):("function"!==typeof s.componentDidUpdate||a===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),"function"!==typeof s.getSnapshotBeforeUpdate||a===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),s.props=r,s.state=p,s.context=l,r=c):("function"!==typeof s.componentDidUpdate||a===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),"function"!==typeof s.getSnapshotBeforeUpdate||a===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),r=!1)}return Ma(e,t,n,r,o,i)}function Ma(e,t,n,r,i,o){ka(e,t);var s=0!==(128&t.flags);if(!r&&!s)return i&&Bi(t,n,!1),Va(e,t,o);r=t.stateNode,_a.current=t;var a=s&&"function"!==typeof n.getDerivedStateFromError?null:r.render();return t.flags|=1,null!==e&&s?(t.child=xo(t,e.child,null,o),t.child=xo(t,null,a,o)):ba(e,t,a,o),t.memoizedState=r.state,i&&Bi(t,n,!0),t.child}function La(e){var t=e.stateNode;t.pendingContext?Ii(0,t.pendingContext,t.pendingContext!==t.context):t.context&&Ii(0,t.context,!1),Go(e,t.containerInfo)}function Pa(e,t,n,r,i){return po(),go(i),t.flags|=256,ba(e,t,n,r),t.child}var Ta,Da,Oa,Ia,Aa={dehydrated:null,treeContext:null,retryLane:0};function ja(e){return{baseLanes:e,cachePool:null,transitions:null}}function Ba(e,t,n){var r,i=t.pendingProps,s=es.current,a=!1,l=0!==(128&t.flags);if((r=l)||(r=(null===e||null!==e.memoizedState)&&0!==(2&s)),r?(a=!0,t.flags&=-129):null!==e&&null===e.memoizedState||(s|=1),Ei(es,1&s),null===e)return co(t),null!==(e=t.memoizedState)&&null!==(e=e.dehydrated)?(0===(1&t.mode)?t.lanes=1:"$!"===e.data?t.lanes=8:t.lanes=1073741824,null):(l=i.children,e=i.fallback,a?(i=t.mode,a=t.child,l={mode:"hidden",children:l},0===(1&i)&&null!==a?(a.childLanes=0,a.pendingProps=l):a=jc(l,i,0,null),e=Ac(e,i,n,null),a.return=t,e.return=t,a.sibling=e,t.child=a,t.child.memoizedState=ja(n),t.memoizedState=Aa,e):Na(t,l));if(null!==(s=e.memoizedState)&&null!==(r=s.dehydrated))return function(e,t,n,r,i,s,a){if(n)return 256&t.flags?(t.flags&=-257,Fa(e,t,a,r=ua(Error(o(422))))):null!==t.memoizedState?(t.child=e.child,t.flags|=128,null):(s=r.fallback,i=t.mode,r=jc({mode:"visible",children:r.children},i,0,null),(s=Ac(s,i,a,null)).flags|=2,r.return=t,s.return=t,r.sibling=s,t.child=r,0!==(1&t.mode)&&xo(t,e.child,null,a),t.child.memoizedState=ja(a),t.memoizedState=Aa,s);if(0===(1&t.mode))return Fa(e,t,a,null);if("$!"===i.data){if(r=i.nextSibling&&i.nextSibling.dataset)var l=r.dgst;return r=l,Fa(e,t,a,r=ua(s=Error(o(419)),r,void 0))}if(l=0!==(a&e.childLanes),ya||l){if(null!==(r=Ll)){switch(a&-a){case 4:i=2;break;case 16:i=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:i=32;break;case 536870912:i=268435456;break;default:i=0}0!==(i=0!==(i&(r.suspendedLanes|a))?0:i)&&i!==s.retryLane&&(s.retryLane=i,Ao(e,i),nc(r,e,i,-1))}return gc(),Fa(e,t,a,r=ua(Error(o(421))))}return"$?"===i.data?(t.flags|=128,t.child=e.child,t=Rc.bind(null,e),i._reactRetry=t,null):(e=s.treeContext,ro=ci(i.nextSibling),no=t,io=!0,oo=null,null!==e&&(Ki[Yi++]=Gi,Ki[Yi++]=Zi,Ki[Yi++]=Xi,Gi=e.id,Zi=e.overflow,Xi=t),t=Na(t,r.children),t.flags|=4096,t)}(e,t,l,i,r,s,n);if(a){a=i.fallback,l=t.mode,r=(s=e.child).sibling;var c={mode:"hidden",children:i.children};return 0===(1&l)&&t.child!==s?((i=t.child).childLanes=0,i.pendingProps=c,t.deletions=null):(i=Oc(s,c)).subtreeFlags=14680064&s.subtreeFlags,null!==r?a=Oc(r,a):(a=Ac(a,l,n,null)).flags|=2,a.return=t,i.return=t,i.sibling=a,t.child=i,i=a,a=t.child,l=null===(l=e.child.memoizedState)?ja(n):{baseLanes:l.baseLanes|n,cachePool:null,transitions:l.transitions},a.memoizedState=l,a.childLanes=e.childLanes&~n,t.memoizedState=Aa,i}return e=(a=e.child).sibling,i=Oc(a,{mode:"visible",children:i.children}),0===(1&t.mode)&&(i.lanes=n),i.return=t,i.sibling=null,null!==e&&(null===(n=t.deletions)?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=i,t.memoizedState=null,i}function Na(e,t){return(t=jc({mode:"visible",children:t},e.mode,0,null)).return=e,e.child=t}function Fa(e,t,n,r){return null!==r&&go(r),xo(t,e.child,null,n),(e=Na(t,t.pendingProps.children)).flags|=2,t.memoizedState=null,e}function za(e,t,n){e.lanes|=t;var r=e.alternate;null!==r&&(r.lanes|=t),Lo(e.return,t,n)}function Ha(e,t,n,r,i){var o=e.memoizedState;null===o?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i)}function Wa(e,t,n){var r=t.pendingProps,i=r.revealOrder,o=r.tail;if(ba(e,t,r.children,n),0!==(2&(r=es.current)))r=1&r|2,t.flags|=128;else{if(null!==e&&0!==(128&e.flags))e:for(e=t.child;null!==e;){if(13===e.tag)null!==e.memoizedState&&za(e,n,t);else if(19===e.tag)za(e,n,t);else if(null!==e.child){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;null===e.sibling;){if(null===e.return||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(Ei(es,r),0===(1&t.mode))t.memoizedState=null;else switch(i){case"forwards":for(n=t.child,i=null;null!==n;)null!==(e=n.alternate)&&null===ts(e)&&(i=n),n=n.sibling;null===(n=i)?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),Ha(t,!1,i,n,o);break;case"backwards":for(n=null,i=t.child,t.child=null;null!==i;){if(null!==(e=i.alternate)&&null===ts(e)){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}Ha(t,!0,n,null,o);break;case"together":Ha(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Ua(e,t){0===(1&t.mode)&&null!==e&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Va(e,t,n){if(null!==e&&(t.dependencies=e.dependencies),jl|=t.lanes,0===(n&t.childLanes))return null;if(null!==e&&t.child!==e.child)throw Error(o(153));if(null!==t.child){for(n=Oc(e=t.child,e.pendingProps),t.child=n,n.return=t;null!==e.sibling;)e=e.sibling,(n=n.sibling=Oc(e,e.pendingProps)).return=t;n.sibling=null}return t.child}function $a(e,t){if(!io)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;null!==t;)null!==t.alternate&&(n=t),t=t.sibling;null===n?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;null!==n;)null!==n.alternate&&(r=n),n=n.sibling;null===r?t||null===e.tail?e.tail=null:e.tail.sibling=null:r.sibling=null}}function qa(e){var t=null!==e.alternate&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;null!==i;)n|=i.lanes|i.childLanes,r|=14680064&i.subtreeFlags,r|=14680064&i.flags,i.return=e,i=i.sibling;else for(i=e.child;null!==i;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function Ka(e,t,n){var r=t.pendingProps;switch(to(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return qa(t),null;case 1:case 17:return Di(t.type)&&Oi(),qa(t),null;case 3:return r=t.stateNode,Zo(),ki(Li),ki(Mi),rs(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),null!==e&&null!==e.child||(ho(t)?t.flags|=4:null===e||e.memoizedState.isDehydrated&&0===(256&t.flags)||(t.flags|=1024,null!==oo&&(sc(oo),oo=null))),Da(e,t),qa(t),null;case 5:Qo(t);var i=Xo(Yo.current);if(n=t.type,null!==e&&null!=t.stateNode)Oa(e,t,n,r,i),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(null===t.stateNode)throw Error(o(166));return qa(t),null}if(e=Xo(qo.current),ho(t)){r=t.stateNode,n=t.type;var s=t.memoizedProps;switch(r[hi]=t,r[fi]=s,e=0!==(1&t.mode),n){case"dialog":Fr("cancel",r),Fr("close",r);break;case"iframe":case"object":case"embed":Fr("load",r);break;case"video":case"audio":for(i=0;i<Ar.length;i++)Fr(Ar[i],r);break;case"source":Fr("error",r);break;case"img":case"image":case"link":Fr("error",r),Fr("load",r);break;case"details":Fr("toggle",r);break;case"input":G(r,s),Fr("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!s.multiple},Fr("invalid",r);break;case"textarea":ie(r,s),Fr("invalid",r)}for(var l in _e(n,s),i=null,s)if(s.hasOwnProperty(l)){var c=s[l];"children"===l?"string"===typeof c?r.textContent!==c&&(!0!==s.suppressHydrationWarning&&Jr(r.textContent,c,e),i=["children",c]):"number"===typeof c&&r.textContent!==""+c&&(!0!==s.suppressHydrationWarning&&Jr(r.textContent,c,e),i=["children",""+c]):a.hasOwnProperty(l)&&null!=c&&"onScroll"===l&&Fr("scroll",r)}switch(n){case"input":q(r),Q(r,s,!0);break;case"textarea":q(r),se(r);break;case"select":case"option":break;default:"function"===typeof s.onClick&&(r.onclick=Qr)}r=i,t.updateQueue=r,null!==r&&(t.flags|=4)}else{l=9===i.nodeType?i:i.ownerDocument,"http://www.w3.org/1999/xhtml"===e&&(e=ae(n)),"http://www.w3.org/1999/xhtml"===e?"script"===n?((e=l.createElement("div")).innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):"string"===typeof r.is?e=l.createElement(n,{is:r.is}):(e=l.createElement(n),"select"===n&&(l=e,r.multiple?l.multiple=!0:r.size&&(l.size=r.size))):e=l.createElementNS(e,n),e[hi]=t,e[fi]=r,Ta(e,t,!1,!1),t.stateNode=e;e:{switch(l=ye(n,r),n){case"dialog":Fr("cancel",e),Fr("close",e),i=r;break;case"iframe":case"object":case"embed":Fr("load",e),i=r;break;case"video":case"audio":for(i=0;i<Ar.length;i++)Fr(Ar[i],e);i=r;break;case"source":Fr("error",e),i=r;break;case"img":case"image":case"link":Fr("error",e),Fr("load",e),i=r;break;case"details":Fr("toggle",e),i=r;break;case"input":G(e,r),i=X(e,r),Fr("invalid",e);break;case"option":default:i=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},i=B({},r,{value:void 0}),Fr("invalid",e);break;case"textarea":ie(e,r),i=re(e,r),Fr("invalid",e)}for(s in _e(n,i),c=i)if(c.hasOwnProperty(s)){var u=c[s];"style"===s?ve(e,u):"dangerouslySetInnerHTML"===s?null!=(u=u?u.__html:void 0)&&de(e,u):"children"===s?"string"===typeof u?("textarea"!==n||""!==u)&&he(e,u):"number"===typeof u&&he(e,""+u):"suppressContentEditableWarning"!==s&&"suppressHydrationWarning"!==s&&"autoFocus"!==s&&(a.hasOwnProperty(s)?null!=u&&"onScroll"===s&&Fr("scroll",e):null!=u&&y(e,s,u,l))}switch(n){case"input":q(e),Q(e,r,!1);break;case"textarea":q(e),se(e);break;case"option":null!=r.value&&e.setAttribute("value",""+V(r.value));break;case"select":e.multiple=!!r.multiple,null!=(s=r.value)?ne(e,!!r.multiple,s,!1):null!=r.defaultValue&&ne(e,!!r.multiple,r.defaultValue,!0);break;default:"function"===typeof i.onClick&&(e.onclick=Qr)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(t.flags|=4)}null!==t.ref&&(t.flags|=512,t.flags|=2097152)}return qa(t),null;case 6:if(e&&null!=t.stateNode)Ia(e,t,e.memoizedProps,r);else{if("string"!==typeof r&&null===t.stateNode)throw Error(o(166));if(n=Xo(Yo.current),Xo(qo.current),ho(t)){if(r=t.stateNode,n=t.memoizedProps,r[hi]=t,(s=r.nodeValue!==n)&&null!==(e=no))switch(e.tag){case 3:Jr(r.nodeValue,n,0!==(1&e.mode));break;case 5:!0!==e.memoizedProps.suppressHydrationWarning&&Jr(r.nodeValue,n,0!==(1&e.mode))}s&&(t.flags|=4)}else(r=(9===n.nodeType?n:n.ownerDocument).createTextNode(r))[hi]=t,t.stateNode=r}return qa(t),null;case 13:if(ki(es),r=t.memoizedState,null===e||null!==e.memoizedState&&null!==e.memoizedState.dehydrated){if(io&&null!==ro&&0!==(1&t.mode)&&0===(128&t.flags))fo(),po(),t.flags|=98560,s=!1;else if(s=ho(t),null!==r&&null!==r.dehydrated){if(null===e){if(!s)throw Error(o(318));if(!(s=null!==(s=t.memoizedState)?s.dehydrated:null))throw Error(o(317));s[hi]=t}else po(),0===(128&t.flags)&&(t.memoizedState=null),t.flags|=4;qa(t),s=!1}else null!==oo&&(sc(oo),oo=null),s=!0;if(!s)return 65536&t.flags?t:null}return 0!==(128&t.flags)?(t.lanes=n,t):((r=null!==r)!==(null!==e&&null!==e.memoizedState)&&r&&(t.child.flags|=8192,0!==(1&t.mode)&&(null===e||0!==(1&es.current)?0===Il&&(Il=3):gc())),null!==t.updateQueue&&(t.flags|=4),qa(t),null);case 4:return Zo(),Da(e,t),null===e&&Wr(t.stateNode.containerInfo),qa(t),null;case 10:return Mo(t.type._context),qa(t),null;case 19:if(ki(es),null===(s=t.memoizedState))return qa(t),null;if(r=0!==(128&t.flags),null===(l=s.rendering))if(r)$a(s,!1);else{if(0!==Il||null!==e&&0!==(128&e.flags))for(e=t.child;null!==e;){if(null!==(l=ts(e))){for(t.flags|=128,$a(s,!1),null!==(r=l.updateQueue)&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=n,n=t.child;null!==n;)e=r,(s=n).flags&=14680066,null===(l=s.alternate)?(s.childLanes=0,s.lanes=e,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=l.childLanes,s.lanes=l.lanes,s.child=l.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=l.memoizedProps,s.memoizedState=l.memoizedState,s.updateQueue=l.updateQueue,s.type=l.type,e=l.dependencies,s.dependencies=null===e?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return Ei(es,1&es.current|2),t.child}e=e.sibling}null!==s.tail&&Ze()>Wl&&(t.flags|=128,r=!0,$a(s,!1),t.lanes=4194304)}else{if(!r)if(null!==(e=ts(l))){if(t.flags|=128,r=!0,null!==(n=e.updateQueue)&&(t.updateQueue=n,t.flags|=4),$a(s,!0),null===s.tail&&"hidden"===s.tailMode&&!l.alternate&&!io)return qa(t),null}else 2*Ze()-s.renderingStartTime>Wl&&1073741824!==n&&(t.flags|=128,r=!0,$a(s,!1),t.lanes=4194304);s.isBackwards?(l.sibling=t.child,t.child=l):(null!==(n=s.last)?n.sibling=l:t.child=l,s.last=l)}return null!==s.tail?(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=Ze(),t.sibling=null,n=es.current,Ei(es,r?1&n|2:1&n),t):(qa(t),null);case 22:case 23:return dc(),r=null!==t.memoizedState,null!==e&&null!==e.memoizedState!==r&&(t.flags|=8192),r&&0!==(1&t.mode)?0!==(1073741824&Dl)&&(qa(t),6&t.subtreeFlags&&(t.flags|=8192)):qa(t),null;case 24:case 25:return null}throw Error(o(156,t.tag))}function Ya(e,t){switch(to(t),t.tag){case 1:return Di(t.type)&&Oi(),65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 3:return Zo(),ki(Li),ki(Mi),rs(),0!==(65536&(e=t.flags))&&0===(128&e)?(t.flags=-65537&e|128,t):null;case 5:return Qo(t),null;case 13:if(ki(es),null!==(e=t.memoizedState)&&null!==e.dehydrated){if(null===t.alternate)throw Error(o(340));po()}return 65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 19:return ki(es),null;case 4:return Zo(),null;case 10:return Mo(t.type._context),null;case 22:case 23:return dc(),null;default:return null}}Ta=function(e,t){for(var n=t.child;null!==n;){if(5===n.tag||6===n.tag)e.appendChild(n.stateNode);else if(4!==n.tag&&null!==n.child){n.child.return=n,n=n.child;continue}if(n===t)break;for(;null===n.sibling;){if(null===n.return||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}},Da=function(){},Oa=function(e,t,n,r){var i=e.memoizedProps;if(i!==r){e=t.stateNode,Xo(qo.current);var o,s=null;switch(n){case"input":i=X(e,i),r=X(e,r),s=[];break;case"select":i=B({},i,{value:void 0}),r=B({},r,{value:void 0}),s=[];break;case"textarea":i=re(e,i),r=re(e,r),s=[];break;default:"function"!==typeof i.onClick&&"function"===typeof r.onClick&&(e.onclick=Qr)}for(u in _e(n,r),n=null,i)if(!r.hasOwnProperty(u)&&i.hasOwnProperty(u)&&null!=i[u])if("style"===u){var l=i[u];for(o in l)l.hasOwnProperty(o)&&(n||(n={}),n[o]="")}else"dangerouslySetInnerHTML"!==u&&"children"!==u&&"suppressContentEditableWarning"!==u&&"suppressHydrationWarning"!==u&&"autoFocus"!==u&&(a.hasOwnProperty(u)?s||(s=[]):(s=s||[]).push(u,null));for(u in r){var c=r[u];if(l=null!=i?i[u]:void 0,r.hasOwnProperty(u)&&c!==l&&(null!=c||null!=l))if("style"===u)if(l){for(o in l)!l.hasOwnProperty(o)||c&&c.hasOwnProperty(o)||(n||(n={}),n[o]="");for(o in c)c.hasOwnProperty(o)&&l[o]!==c[o]&&(n||(n={}),n[o]=c[o])}else n||(s||(s=[]),s.push(u,n)),n=c;else"dangerouslySetInnerHTML"===u?(c=c?c.__html:void 0,l=l?l.__html:void 0,null!=c&&l!==c&&(s=s||[]).push(u,c)):"children"===u?"string"!==typeof c&&"number"!==typeof c||(s=s||[]).push(u,""+c):"suppressContentEditableWarning"!==u&&"suppressHydrationWarning"!==u&&(a.hasOwnProperty(u)?(null!=c&&"onScroll"===u&&Fr("scroll",e),s||l===c||(s=[])):(s=s||[]).push(u,c))}n&&(s=s||[]).push("style",n);var u=s;(t.updateQueue=u)&&(t.flags|=4)}},Ia=function(e,t,n,r){n!==r&&(t.flags|=4)};var Xa=!1,Ga=!1,Za="function"===typeof WeakSet?WeakSet:Set,Ja=null;function Qa(e,t){var n=e.ref;if(null!==n)if("function"===typeof n)try{n(null)}catch(r){Cc(e,t,r)}else n.current=null}function el(e,t,n){try{n()}catch(r){Cc(e,t,r)}}var tl=!1;function nl(e,t,n){var r=t.updateQueue;if(null!==(r=null!==r?r.lastEffect:null)){var i=r=r.next;do{if((i.tag&e)===e){var o=i.destroy;i.destroy=void 0,void 0!==o&&el(t,n,o)}i=i.next}while(i!==r)}}function rl(e,t){if(null!==(t=null!==(t=t.updateQueue)?t.lastEffect:null)){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function il(e){var t=e.ref;if(null!==t){var n=e.stateNode;e.tag,e=n,"function"===typeof t?t(e):t.current=e}}function ol(e){var t=e.alternate;null!==t&&(e.alternate=null,ol(t)),e.child=null,e.deletions=null,e.sibling=null,5===e.tag&&(null!==(t=e.stateNode)&&(delete t[hi],delete t[fi],delete t[gi],delete t[vi],delete t[mi])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function sl(e){return 5===e.tag||3===e.tag||4===e.tag}function al(e){e:for(;;){for(;null===e.sibling;){if(null===e.return||sl(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;5!==e.tag&&6!==e.tag&&18!==e.tag;){if(2&e.flags)continue e;if(null===e.child||4===e.tag)continue e;e.child.return=e,e=e.child}if(!(2&e.flags))return e.stateNode}}function ll(e,t,n){var r=e.tag;if(5===r||6===r)e=e.stateNode,t?8===n.nodeType?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(8===n.nodeType?(t=n.parentNode).insertBefore(e,n):(t=n).appendChild(e),null!==(n=n._reactRootContainer)&&void 0!==n||null!==t.onclick||(t.onclick=Qr));else if(4!==r&&null!==(e=e.child))for(ll(e,t,n),e=e.sibling;null!==e;)ll(e,t,n),e=e.sibling}function cl(e,t,n){var r=e.tag;if(5===r||6===r)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(4!==r&&null!==(e=e.child))for(cl(e,t,n),e=e.sibling;null!==e;)cl(e,t,n),e=e.sibling}var ul=null,dl=!1;function hl(e,t,n){for(n=n.child;null!==n;)fl(e,t,n),n=n.sibling}function fl(e,t,n){if(ot&&"function"===typeof ot.onCommitFiberUnmount)try{ot.onCommitFiberUnmount(it,n)}catch(a){}switch(n.tag){case 5:Ga||Qa(n,t);case 6:var r=ul,i=dl;ul=null,hl(e,t,n),dl=i,null!==(ul=r)&&(dl?(e=ul,n=n.stateNode,8===e.nodeType?e.parentNode.removeChild(n):e.removeChild(n)):ul.removeChild(n.stateNode));break;case 18:null!==ul&&(dl?(e=ul,n=n.stateNode,8===e.nodeType?li(e.parentNode,n):1===e.nodeType&&li(e,n),Wt(e)):li(ul,n.stateNode));break;case 4:r=ul,i=dl,ul=n.stateNode.containerInfo,dl=!0,hl(e,t,n),ul=r,dl=i;break;case 0:case 11:case 14:case 15:if(!Ga&&(null!==(r=n.updateQueue)&&null!==(r=r.lastEffect))){i=r=r.next;do{var o=i,s=o.destroy;o=o.tag,void 0!==s&&(0!==(2&o)||0!==(4&o))&&el(n,t,s),i=i.next}while(i!==r)}hl(e,t,n);break;case 1:if(!Ga&&(Qa(n,t),"function"===typeof(r=n.stateNode).componentWillUnmount))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){Cc(n,t,a)}hl(e,t,n);break;case 21:hl(e,t,n);break;case 22:1&n.mode?(Ga=(r=Ga)||null!==n.memoizedState,hl(e,t,n),Ga=r):hl(e,t,n);break;default:hl(e,t,n)}}function pl(e){var t=e.updateQueue;if(null!==t){e.updateQueue=null;var n=e.stateNode;null===n&&(n=e.stateNode=new Za),t.forEach(function(t){var r=Mc.bind(null,e,t);n.has(t)||(n.add(t),t.then(r,r))})}}function gl(e,t){var n=t.deletions;if(null!==n)for(var r=0;r<n.length;r++){var i=n[r];try{var s=e,a=t,l=a;e:for(;null!==l;){switch(l.tag){case 5:ul=l.stateNode,dl=!1;break e;case 3:case 4:ul=l.stateNode.containerInfo,dl=!0;break e}l=l.return}if(null===ul)throw Error(o(160));fl(s,a,i),ul=null,dl=!1;var c=i.alternate;null!==c&&(c.return=null),i.return=null}catch(u){Cc(i,t,u)}}if(12854&t.subtreeFlags)for(t=t.child;null!==t;)vl(t,e),t=t.sibling}function vl(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(gl(t,e),ml(e),4&r){try{nl(3,e,e.return),rl(3,e)}catch(v){Cc(e,e.return,v)}try{nl(5,e,e.return)}catch(v){Cc(e,e.return,v)}}break;case 1:gl(t,e),ml(e),512&r&&null!==n&&Qa(n,n.return);break;case 5:if(gl(t,e),ml(e),512&r&&null!==n&&Qa(n,n.return),32&e.flags){var i=e.stateNode;try{he(i,"")}catch(v){Cc(e,e.return,v)}}if(4&r&&null!=(i=e.stateNode)){var s=e.memoizedProps,a=null!==n?n.memoizedProps:s,l=e.type,c=e.updateQueue;if(e.updateQueue=null,null!==c)try{"input"===l&&"radio"===s.type&&null!=s.name&&Z(i,s),ye(l,a);var u=ye(l,s);for(a=0;a<c.length;a+=2){var d=c[a],h=c[a+1];"style"===d?ve(i,h):"dangerouslySetInnerHTML"===d?de(i,h):"children"===d?he(i,h):y(i,d,h,u)}switch(l){case"input":J(i,s);break;case"textarea":oe(i,s);break;case"select":var f=i._wrapperState.wasMultiple;i._wrapperState.wasMultiple=!!s.multiple;var p=s.value;null!=p?ne(i,!!s.multiple,p,!1):f!==!!s.multiple&&(null!=s.defaultValue?ne(i,!!s.multiple,s.defaultValue,!0):ne(i,!!s.multiple,s.multiple?[]:"",!1))}i[fi]=s}catch(v){Cc(e,e.return,v)}}break;case 6:if(gl(t,e),ml(e),4&r){if(null===e.stateNode)throw Error(o(162));i=e.stateNode,s=e.memoizedProps;try{i.nodeValue=s}catch(v){Cc(e,e.return,v)}}break;case 3:if(gl(t,e),ml(e),4&r&&null!==n&&n.memoizedState.isDehydrated)try{Wt(t.containerInfo)}catch(v){Cc(e,e.return,v)}break;case 4:default:gl(t,e),ml(e);break;case 13:gl(t,e),ml(e),8192&(i=e.child).flags&&(s=null!==i.memoizedState,i.stateNode.isHidden=s,!s||null!==i.alternate&&null!==i.alternate.memoizedState||(Hl=Ze())),4&r&&pl(e);break;case 22:if(d=null!==n&&null!==n.memoizedState,1&e.mode?(Ga=(u=Ga)||d,gl(t,e),Ga=u):gl(t,e),ml(e),8192&r){if(u=null!==e.memoizedState,(e.stateNode.isHidden=u)&&!d&&0!==(1&e.mode))for(Ja=e,d=e.child;null!==d;){for(h=Ja=d;null!==Ja;){switch(p=(f=Ja).child,f.tag){case 0:case 11:case 14:case 15:nl(4,f,f.return);break;case 1:Qa(f,f.return);var g=f.stateNode;if("function"===typeof g.componentWillUnmount){r=f,n=f.return;try{t=r,g.props=t.memoizedProps,g.state=t.memoizedState,g.componentWillUnmount()}catch(v){Cc(r,n,v)}}break;case 5:Qa(f,f.return);break;case 22:if(null!==f.memoizedState){xl(h);continue}}null!==p?(p.return=f,Ja=p):xl(h)}d=d.sibling}e:for(d=null,h=e;;){if(5===h.tag){if(null===d){d=h;try{i=h.stateNode,u?"function"===typeof(s=i.style).setProperty?s.setProperty("display","none","important"):s.display="none":(l=h.stateNode,a=void 0!==(c=h.memoizedProps.style)&&null!==c&&c.hasOwnProperty("display")?c.display:null,l.style.display=ge("display",a))}catch(v){Cc(e,e.return,v)}}}else if(6===h.tag){if(null===d)try{h.stateNode.nodeValue=u?"":h.memoizedProps}catch(v){Cc(e,e.return,v)}}else if((22!==h.tag&&23!==h.tag||null===h.memoizedState||h===e)&&null!==h.child){h.child.return=h,h=h.child;continue}if(h===e)break e;for(;null===h.sibling;){if(null===h.return||h.return===e)break e;d===h&&(d=null),h=h.return}d===h&&(d=null),h.sibling.return=h.return,h=h.sibling}}break;case 19:gl(t,e),ml(e),4&r&&pl(e);case 21:}}function ml(e){var t=e.flags;if(2&t){try{e:{for(var n=e.return;null!==n;){if(sl(n)){var r=n;break e}n=n.return}throw Error(o(160))}switch(r.tag){case 5:var i=r.stateNode;32&r.flags&&(he(i,""),r.flags&=-33),cl(e,al(e),i);break;case 3:case 4:var s=r.stateNode.containerInfo;ll(e,al(e),s);break;default:throw Error(o(161))}}catch(a){Cc(e,e.return,a)}e.flags&=-3}4096&t&&(e.flags&=-4097)}function _l(e,t,n){Ja=e,yl(e,t,n)}function yl(e,t,n){for(var r=0!==(1&e.mode);null!==Ja;){var i=Ja,o=i.child;if(22===i.tag&&r){var s=null!==i.memoizedState||Xa;if(!s){var a=i.alternate,l=null!==a&&null!==a.memoizedState||Ga;a=Xa;var c=Ga;if(Xa=s,(Ga=l)&&!c)for(Ja=i;null!==Ja;)l=(s=Ja).child,22===s.tag&&null!==s.memoizedState?wl(i):null!==l?(l.return=s,Ja=l):wl(i);for(;null!==o;)Ja=o,yl(o,t,n),o=o.sibling;Ja=i,Xa=a,Ga=c}bl(e)}else 0!==(8772&i.subtreeFlags)&&null!==o?(o.return=i,Ja=o):bl(e)}}function bl(e){for(;null!==Ja;){var t=Ja;if(0!==(8772&t.flags)){var n=t.alternate;try{if(0!==(8772&t.flags))switch(t.tag){case 0:case 11:case 15:Ga||rl(5,t);break;case 1:var r=t.stateNode;if(4&t.flags&&!Ga)if(null===n)r.componentDidMount();else{var i=t.elementType===t.type?n.memoizedProps:na(t.type,n.memoizedProps);r.componentDidUpdate(i,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var s=t.updateQueue;null!==s&&Vo(t,s,r);break;case 3:var a=t.updateQueue;if(null!==a){if(n=null,null!==t.child)switch(t.child.tag){case 5:case 1:n=t.child.stateNode}Vo(t,a,n)}break;case 5:var l=t.stateNode;if(null===n&&4&t.flags){n=l;var c=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":c.autoFocus&&n.focus();break;case"img":c.src&&(n.src=c.src)}}break;case 6:case 4:case 12:case 19:case 17:case 21:case 22:case 23:case 25:break;case 13:if(null===t.memoizedState){var u=t.alternate;if(null!==u){var d=u.memoizedState;if(null!==d){var h=d.dehydrated;null!==h&&Wt(h)}}}break;default:throw Error(o(163))}Ga||512&t.flags&&il(t)}catch(f){Cc(t,t.return,f)}}if(t===e){Ja=null;break}if(null!==(n=t.sibling)){n.return=t.return,Ja=n;break}Ja=t.return}}function xl(e){for(;null!==Ja;){var t=Ja;if(t===e){Ja=null;break}var n=t.sibling;if(null!==n){n.return=t.return,Ja=n;break}Ja=t.return}}function wl(e){for(;null!==Ja;){var t=Ja;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{rl(4,t)}catch(l){Cc(t,n,l)}break;case 1:var r=t.stateNode;if("function"===typeof r.componentDidMount){var i=t.return;try{r.componentDidMount()}catch(l){Cc(t,i,l)}}var o=t.return;try{il(t)}catch(l){Cc(t,o,l)}break;case 5:var s=t.return;try{il(t)}catch(l){Cc(t,s,l)}}}catch(l){Cc(t,t.return,l)}if(t===e){Ja=null;break}var a=t.sibling;if(null!==a){a.return=t.return,Ja=a;break}Ja=t.return}}var Sl,Cl=Math.ceil,kl=b.ReactCurrentDispatcher,El=b.ReactCurrentOwner,Rl=b.ReactCurrentBatchConfig,Ml=0,Ll=null,Pl=null,Tl=0,Dl=0,Ol=Ci(0),Il=0,Al=null,jl=0,Bl=0,Nl=0,Fl=null,zl=null,Hl=0,Wl=1/0,Ul=null,Vl=!1,$l=null,ql=null,Kl=!1,Yl=null,Xl=0,Gl=0,Zl=null,Jl=-1,Ql=0;function ec(){return 0!==(6&Ml)?Ze():-1!==Jl?Jl:Jl=Ze()}function tc(e){return 0===(1&e.mode)?1:0!==(2&Ml)&&0!==Tl?Tl&-Tl:null!==vo.transition?(0===Ql&&(Ql=gt()),Ql):0!==(e=yt)?e:e=void 0===(e=window.event)?16:Gt(e.type)}function nc(e,t,n,r){if(50<Gl)throw Gl=0,Zl=null,Error(o(185));mt(e,n,r),0!==(2&Ml)&&e===Ll||(e===Ll&&(0===(2&Ml)&&(Bl|=n),4===Il&&ac(e,Tl)),rc(e,r),1===n&&0===Ml&&0===(1&t.mode)&&(Wl=Ze()+500,Fi&&Wi()))}function rc(e,t){var n=e.callbackNode;!function(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,o=e.pendingLanes;0<o;){var s=31-st(o),a=1<<s,l=i[s];-1===l?0!==(a&n)&&0===(a&r)||(i[s]=ft(a,t)):l<=t&&(e.expiredLanes|=a),o&=~a}}(e,t);var r=ht(e,e===Ll?Tl:0);if(0===r)null!==n&&Ye(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(null!=n&&Ye(n),1===t)0===e.tag?function(e){Fi=!0,Hi(e)}(lc.bind(null,e)):Hi(lc.bind(null,e)),si(function(){0===(6&Ml)&&Wi()}),n=null;else{switch(bt(r)){case 1:n=Qe;break;case 4:n=et;break;case 16:default:n=tt;break;case 536870912:n=rt}n=Lc(n,ic.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function ic(e,t){if(Jl=-1,Ql=0,0!==(6&Ml))throw Error(o(327));var n=e.callbackNode;if(wc()&&e.callbackNode!==n)return null;var r=ht(e,e===Ll?Tl:0);if(0===r)return null;if(0!==(30&r)||0!==(r&e.expiredLanes)||t)t=vc(e,r);else{t=r;var i=Ml;Ml|=2;var s=pc();for(Ll===e&&Tl===t||(Ul=null,Wl=Ze()+500,hc(e,t));;)try{_c();break}catch(l){fc(e,l)}Ro(),kl.current=s,Ml=i,null!==Pl?t=0:(Ll=null,Tl=0,t=Il)}if(0!==t){if(2===t&&(0!==(i=pt(e))&&(r=i,t=oc(e,i))),1===t)throw n=Al,hc(e,0),ac(e,r),rc(e,Ze()),n;if(6===t)ac(e,r);else{if(i=e.current.alternate,0===(30&r)&&!function(e){for(var t=e;;){if(16384&t.flags){var n=t.updateQueue;if(null!==n&&null!==(n=n.stores))for(var r=0;r<n.length;r++){var i=n[r],o=i.getSnapshot;i=i.value;try{if(!ar(o(),i))return!1}catch(a){return!1}}}if(n=t.child,16384&t.subtreeFlags&&null!==n)n.return=t,t=n;else{if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}(i)&&(2===(t=vc(e,r))&&(0!==(s=pt(e))&&(r=s,t=oc(e,s))),1===t))throw n=Al,hc(e,0),ac(e,r),rc(e,Ze()),n;switch(e.finishedWork=i,e.finishedLanes=r,t){case 0:case 1:throw Error(o(345));case 2:case 5:xc(e,zl,Ul);break;case 3:if(ac(e,r),(130023424&r)===r&&10<(t=Hl+500-Ze())){if(0!==ht(e,0))break;if(((i=e.suspendedLanes)&r)!==r){ec(),e.pingedLanes|=e.suspendedLanes&i;break}e.timeoutHandle=ri(xc.bind(null,e,zl,Ul),t);break}xc(e,zl,Ul);break;case 4:if(ac(e,r),(4194240&r)===r)break;for(t=e.eventTimes,i=-1;0<r;){var a=31-st(r);s=1<<a,(a=t[a])>i&&(i=a),r&=~s}if(r=i,10<(r=(120>(r=Ze()-r)?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Cl(r/1960))-r)){e.timeoutHandle=ri(xc.bind(null,e,zl,Ul),r);break}xc(e,zl,Ul);break;default:throw Error(o(329))}}}return rc(e,Ze()),e.callbackNode===n?ic.bind(null,e):null}function oc(e,t){var n=Fl;return e.current.memoizedState.isDehydrated&&(hc(e,t).flags|=256),2!==(e=vc(e,t))&&(t=zl,zl=n,null!==t&&sc(t)),e}function sc(e){null===zl?zl=e:zl.push.apply(zl,e)}function ac(e,t){for(t&=~Nl,t&=~Bl,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-st(t),r=1<<n;e[n]=-1,t&=~r}}function lc(e){if(0!==(6&Ml))throw Error(o(327));wc();var t=ht(e,0);if(0===(1&t))return rc(e,Ze()),null;var n=vc(e,t);if(0!==e.tag&&2===n){var r=pt(e);0!==r&&(t=r,n=oc(e,r))}if(1===n)throw n=Al,hc(e,0),ac(e,t),rc(e,Ze()),n;if(6===n)throw Error(o(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,xc(e,zl,Ul),rc(e,Ze()),null}function cc(e,t){var n=Ml;Ml|=1;try{return e(t)}finally{0===(Ml=n)&&(Wl=Ze()+500,Fi&&Wi())}}function uc(e){null!==Yl&&0===Yl.tag&&0===(6&Ml)&&wc();var t=Ml;Ml|=1;var n=Rl.transition,r=yt;try{if(Rl.transition=null,yt=1,e)return e()}finally{yt=r,Rl.transition=n,0===(6&(Ml=t))&&Wi()}}function dc(){Dl=Ol.current,ki(Ol)}function hc(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(-1!==n&&(e.timeoutHandle=-1,ii(n)),null!==Pl)for(n=Pl.return;null!==n;){var r=n;switch(to(r),r.tag){case 1:null!==(r=r.type.childContextTypes)&&void 0!==r&&Oi();break;case 3:Zo(),ki(Li),ki(Mi),rs();break;case 5:Qo(r);break;case 4:Zo();break;case 13:case 19:ki(es);break;case 10:Mo(r.type._context);break;case 22:case 23:dc()}n=n.return}if(Ll=e,Pl=e=Oc(e.current,null),Tl=Dl=t,Il=0,Al=null,Nl=Bl=jl=0,zl=Fl=null,null!==Do){for(t=0;t<Do.length;t++)if(null!==(r=(n=Do[t]).interleaved)){n.interleaved=null;var i=r.next,o=n.pending;if(null!==o){var s=o.next;o.next=i,r.next=s}n.pending=r}Do=null}return e}function fc(e,t){for(;;){var n=Pl;try{if(Ro(),is.current=Js,us){for(var r=as.memoizedState;null!==r;){var i=r.queue;null!==i&&(i.pending=null),r=r.next}us=!1}if(ss=0,cs=ls=as=null,ds=!1,hs=0,El.current=null,null===n||null===n.return){Il=1,Al=t,Pl=null;break}e:{var s=e,a=n.return,l=n,c=t;if(t=Tl,l.flags|=32768,null!==c&&"object"===typeof c&&"function"===typeof c.then){var u=c,d=l,h=d.tag;if(0===(1&d.mode)&&(0===h||11===h||15===h)){var f=d.alternate;f?(d.updateQueue=f.updateQueue,d.memoizedState=f.memoizedState,d.lanes=f.lanes):(d.updateQueue=null,d.memoizedState=null)}var p=va(a);if(null!==p){p.flags&=-257,ma(p,a,l,0,t),1&p.mode&&ga(s,u,t),c=u;var g=(t=p).updateQueue;if(null===g){var v=new Set;v.add(c),t.updateQueue=v}else g.add(c);break e}if(0===(1&t)){ga(s,u,t),gc();break e}c=Error(o(426))}else if(io&&1&l.mode){var m=va(a);if(null!==m){0===(65536&m.flags)&&(m.flags|=256),ma(m,a,l,0,t),go(ca(c,l));break e}}s=c=ca(c,l),4!==Il&&(Il=2),null===Fl?Fl=[s]:Fl.push(s),s=a;do{switch(s.tag){case 3:s.flags|=65536,t&=-t,s.lanes|=t,Wo(s,fa(0,c,t));break e;case 1:l=c;var _=s.type,y=s.stateNode;if(0===(128&s.flags)&&("function"===typeof _.getDerivedStateFromError||null!==y&&"function"===typeof y.componentDidCatch&&(null===ql||!ql.has(y)))){s.flags|=65536,t&=-t,s.lanes|=t,Wo(s,pa(s,l,t));break e}}s=s.return}while(null!==s)}bc(n)}catch(b){t=b,Pl===n&&null!==n&&(Pl=n=n.return);continue}break}}function pc(){var e=kl.current;return kl.current=Js,null===e?Js:e}function gc(){0!==Il&&3!==Il&&2!==Il||(Il=4),null===Ll||0===(268435455&jl)&&0===(268435455&Bl)||ac(Ll,Tl)}function vc(e,t){var n=Ml;Ml|=2;var r=pc();for(Ll===e&&Tl===t||(Ul=null,hc(e,t));;)try{mc();break}catch(i){fc(e,i)}if(Ro(),Ml=n,kl.current=r,null!==Pl)throw Error(o(261));return Ll=null,Tl=0,Il}function mc(){for(;null!==Pl;)yc(Pl)}function _c(){for(;null!==Pl&&!Xe();)yc(Pl)}function yc(e){var t=Sl(e.alternate,e,Dl);e.memoizedProps=e.pendingProps,null===t?bc(e):Pl=t,El.current=null}function bc(e){var t=e;do{var n=t.alternate;if(e=t.return,0===(32768&t.flags)){if(null!==(n=Ka(n,t,Dl)))return void(Pl=n)}else{if(null!==(n=Ya(n,t)))return n.flags&=32767,void(Pl=n);if(null===e)return Il=6,void(Pl=null);e.flags|=32768,e.subtreeFlags=0,e.deletions=null}if(null!==(t=t.sibling))return void(Pl=t);Pl=t=e}while(null!==t);0===Il&&(Il=5)}function xc(e,t,n){var r=yt,i=Rl.transition;try{Rl.transition=null,yt=1,function(e,t,n,r){do{wc()}while(null!==Yl);if(0!==(6&Ml))throw Error(o(327));n=e.finishedWork;var i=e.finishedLanes;if(null===n)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(o(177));e.callbackNode=null,e.callbackPriority=0;var s=n.lanes|n.childLanes;if(function(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0<n;){var i=31-st(n),o=1<<i;t[i]=0,r[i]=-1,e[i]=-1,n&=~o}}(e,s),e===Ll&&(Pl=Ll=null,Tl=0),0===(2064&n.subtreeFlags)&&0===(2064&n.flags)||Kl||(Kl=!0,Lc(tt,function(){return wc(),null})),s=0!==(15990&n.flags),0!==(15990&n.subtreeFlags)||s){s=Rl.transition,Rl.transition=null;var a=yt;yt=1;var l=Ml;Ml|=4,El.current=null,function(e,t){if(ei=Vt,fr(e=hr())){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{var r=(n=(n=e.ownerDocument)&&n.defaultView||window).getSelection&&n.getSelection();if(r&&0!==r.rangeCount){n=r.anchorNode;var i=r.anchorOffset,s=r.focusNode;r=r.focusOffset;try{n.nodeType,s.nodeType}catch(x){n=null;break e}var a=0,l=-1,c=-1,u=0,d=0,h=e,f=null;t:for(;;){for(var p;h!==n||0!==i&&3!==h.nodeType||(l=a+i),h!==s||0!==r&&3!==h.nodeType||(c=a+r),3===h.nodeType&&(a+=h.nodeValue.length),null!==(p=h.firstChild);)f=h,h=p;for(;;){if(h===e)break t;if(f===n&&++u===i&&(l=a),f===s&&++d===r&&(c=a),null!==(p=h.nextSibling))break;f=(h=f).parentNode}h=p}n=-1===l||-1===c?null:{start:l,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(ti={focusedElem:e,selectionRange:n},Vt=!1,Ja=t;null!==Ja;)if(e=(t=Ja).child,0!==(1028&t.subtreeFlags)&&null!==e)e.return=t,Ja=e;else for(;null!==Ja;){t=Ja;try{var g=t.alternate;if(0!==(1024&t.flags))switch(t.tag){case 0:case 11:case 15:case 5:case 6:case 4:case 17:break;case 1:if(null!==g){var v=g.memoizedProps,m=g.memoizedState,_=t.stateNode,y=_.getSnapshotBeforeUpdate(t.elementType===t.type?v:na(t.type,v),m);_.__reactInternalSnapshotBeforeUpdate=y}break;case 3:var b=t.stateNode.containerInfo;1===b.nodeType?b.textContent="":9===b.nodeType&&b.documentElement&&b.removeChild(b.documentElement);break;default:throw Error(o(163))}}catch(x){Cc(t,t.return,x)}if(null!==(e=t.sibling)){e.return=t.return,Ja=e;break}Ja=t.return}g=tl,tl=!1}(e,n),vl(n,e),pr(ti),Vt=!!ei,ti=ei=null,e.current=n,_l(n,e,i),Ge(),Ml=l,yt=a,Rl.transition=s}else e.current=n;if(Kl&&(Kl=!1,Yl=e,Xl=i),s=e.pendingLanes,0===s&&(ql=null),function(e){if(ot&&"function"===typeof ot.onCommitFiberRoot)try{ot.onCommitFiberRoot(it,e,void 0,128===(128&e.current.flags))}catch(t){}}(n.stateNode),rc(e,Ze()),null!==t)for(r=e.onRecoverableError,n=0;n<t.length;n++)i=t[n],r(i.value,{componentStack:i.stack,digest:i.digest});if(Vl)throw Vl=!1,e=$l,$l=null,e;0!==(1&Xl)&&0!==e.tag&&wc(),s=e.pendingLanes,0!==(1&s)?e===Zl?Gl++:(Gl=0,Zl=e):Gl=0,Wi()}(e,t,n,r)}finally{Rl.transition=i,yt=r}return null}function wc(){if(null!==Yl){var e=bt(Xl),t=Rl.transition,n=yt;try{if(Rl.transition=null,yt=16>e?16:e,null===Yl)var r=!1;else{if(e=Yl,Yl=null,Xl=0,0!==(6&Ml))throw Error(o(331));var i=Ml;for(Ml|=4,Ja=e.current;null!==Ja;){var s=Ja,a=s.child;if(0!==(16&Ja.flags)){var l=s.deletions;if(null!==l){for(var c=0;c<l.length;c++){var u=l[c];for(Ja=u;null!==Ja;){var d=Ja;switch(d.tag){case 0:case 11:case 15:nl(8,d,s)}var h=d.child;if(null!==h)h.return=d,Ja=h;else for(;null!==Ja;){var f=(d=Ja).sibling,p=d.return;if(ol(d),d===u){Ja=null;break}if(null!==f){f.return=p,Ja=f;break}Ja=p}}}var g=s.alternate;if(null!==g){var v=g.child;if(null!==v){g.child=null;do{var m=v.sibling;v.sibling=null,v=m}while(null!==v)}}Ja=s}}if(0!==(2064&s.subtreeFlags)&&null!==a)a.return=s,Ja=a;else e:for(;null!==Ja;){if(0!==(2048&(s=Ja).flags))switch(s.tag){case 0:case 11:case 15:nl(9,s,s.return)}var _=s.sibling;if(null!==_){_.return=s.return,Ja=_;break e}Ja=s.return}}var y=e.current;for(Ja=y;null!==Ja;){var b=(a=Ja).child;if(0!==(2064&a.subtreeFlags)&&null!==b)b.return=a,Ja=b;else e:for(a=y;null!==Ja;){if(0!==(2048&(l=Ja).flags))try{switch(l.tag){case 0:case 11:case 15:rl(9,l)}}catch(w){Cc(l,l.return,w)}if(l===a){Ja=null;break e}var x=l.sibling;if(null!==x){x.return=l.return,Ja=x;break e}Ja=l.return}}if(Ml=i,Wi(),ot&&"function"===typeof ot.onPostCommitFiberRoot)try{ot.onPostCommitFiberRoot(it,e)}catch(w){}r=!0}return r}finally{yt=n,Rl.transition=t}}return!1}function Sc(e,t,n){e=zo(e,t=fa(0,t=ca(n,t),1),1),t=ec(),null!==e&&(mt(e,1,t),rc(e,t))}function Cc(e,t,n){if(3===e.tag)Sc(e,e,n);else for(;null!==t;){if(3===t.tag){Sc(t,e,n);break}if(1===t.tag){var r=t.stateNode;if("function"===typeof t.type.getDerivedStateFromError||"function"===typeof r.componentDidCatch&&(null===ql||!ql.has(r))){t=zo(t,e=pa(t,e=ca(n,e),1),1),e=ec(),null!==t&&(mt(t,1,e),rc(t,e));break}}t=t.return}}function kc(e,t,n){var r=e.pingCache;null!==r&&r.delete(t),t=ec(),e.pingedLanes|=e.suspendedLanes&n,Ll===e&&(Tl&n)===n&&(4===Il||3===Il&&(130023424&Tl)===Tl&&500>Ze()-Hl?hc(e,0):Nl|=n),rc(e,t)}function Ec(e,t){0===t&&(0===(1&e.mode)?t=1:(t=ut,0===(130023424&(ut<<=1))&&(ut=4194304)));var n=ec();null!==(e=Ao(e,t))&&(mt(e,t,n),rc(e,n))}function Rc(e){var t=e.memoizedState,n=0;null!==t&&(n=t.retryLane),Ec(e,n)}function Mc(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,i=e.memoizedState;null!==i&&(n=i.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(o(314))}null!==r&&r.delete(t),Ec(e,n)}function Lc(e,t){return Ke(e,t)}function Pc(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Tc(e,t,n,r){return new Pc(e,t,n,r)}function Dc(e){return!(!(e=e.prototype)||!e.isReactComponent)}function Oc(e,t){var n=e.alternate;return null===n?((n=Tc(e.tag,t,e.key,e.mode)).elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=14680064&e.flags,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=null===t?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Ic(e,t,n,r,i,s){var a=2;if(r=e,"function"===typeof e)Dc(e)&&(a=1);else if("string"===typeof e)a=5;else e:switch(e){case S:return Ac(n.children,i,s,t);case C:a=8,i|=8;break;case k:return(e=Tc(12,n,t,2|i)).elementType=k,e.lanes=s,e;case L:return(e=Tc(13,n,t,i)).elementType=L,e.lanes=s,e;case P:return(e=Tc(19,n,t,i)).elementType=P,e.lanes=s,e;case O:return jc(n,i,s,t);default:if("object"===typeof e&&null!==e)switch(e.$$typeof){case E:a=10;break e;case R:a=9;break e;case M:a=11;break e;case T:a=14;break e;case D:a=16,r=null;break e}throw Error(o(130,null==e?e:typeof e,""))}return(t=Tc(a,n,t,i)).elementType=e,t.type=r,t.lanes=s,t}function Ac(e,t,n,r){return(e=Tc(7,e,r,t)).lanes=n,e}function jc(e,t,n,r){return(e=Tc(22,e,r,t)).elementType=O,e.lanes=n,e.stateNode={isHidden:!1},e}function Bc(e,t,n){return(e=Tc(6,e,null,t)).lanes=n,e}function Nc(e,t,n){return(t=Tc(4,null!==e.children?e.children:[],e.key,t)).lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Fc(e,t,n,r,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=vt(0),this.expirationTimes=vt(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=vt(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function zc(e,t,n,r,i,o,s,a,l){return e=new Fc(e,t,n,a,l),1===t?(t=1,!0===o&&(t|=8)):t=0,o=Tc(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Bo(o),e}function Hc(e){if(!e)return Ri;e:{if(We(e=e._reactInternals)!==e||1!==e.tag)throw Error(o(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(Di(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(null!==t);throw Error(o(171))}if(1===e.tag){var n=e.type;if(Di(n))return Ai(e,n,t)}return t}function Wc(e,t,n,r,i,o,s,a,l){return(e=zc(n,r,!0,e,0,o,0,a,l)).context=Hc(null),n=e.current,(o=Fo(r=ec(),i=tc(n))).callback=void 0!==t&&null!==t?t:null,zo(n,o,i),e.current.lanes=i,mt(e,i,r),rc(e,r),e}function Uc(e,t,n,r){var i=t.current,o=ec(),s=tc(i);return n=Hc(n),null===t.context?t.context=n:t.pendingContext=n,(t=Fo(o,s)).payload={element:e},null!==(r=void 0===r?null:r)&&(t.callback=r),null!==(e=zo(i,t,s))&&(nc(e,i,s,o),Ho(e,i,s)),s}function Vc(e){return(e=e.current).child?(e.child.tag,e.child.stateNode):null}function $c(e,t){if(null!==(e=e.memoizedState)&&null!==e.dehydrated){var n=e.retryLane;e.retryLane=0!==n&&n<t?n:t}}function qc(e,t){$c(e,t),(e=e.alternate)&&$c(e,t)}Sl=function(e,t,n){if(null!==e)if(e.memoizedProps!==t.pendingProps||Li.current)ya=!0;else{if(0===(e.lanes&n)&&0===(128&t.flags))return ya=!1,function(e,t,n){switch(t.tag){case 3:La(t),po();break;case 5:Jo(t);break;case 1:Di(t.type)&&ji(t);break;case 4:Go(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,i=t.memoizedProps.value;Ei(So,r._currentValue),r._currentValue=i;break;case 13:if(null!==(r=t.memoizedState))return null!==r.dehydrated?(Ei(es,1&es.current),t.flags|=128,null):0!==(n&t.child.childLanes)?Ba(e,t,n):(Ei(es,1&es.current),null!==(e=Va(e,t,n))?e.sibling:null);Ei(es,1&es.current);break;case 19:if(r=0!==(n&t.childLanes),0!==(128&e.flags)){if(r)return Wa(e,t,n);t.flags|=128}if(null!==(i=t.memoizedState)&&(i.rendering=null,i.tail=null,i.lastEffect=null),Ei(es,es.current),r)break;return null;case 22:case 23:return t.lanes=0,Ca(e,t,n)}return Va(e,t,n)}(e,t,n);ya=0!==(131072&e.flags)}else ya=!1,io&&0!==(1048576&t.flags)&&Qi(t,qi,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Ua(e,t),e=t.pendingProps;var i=Ti(t,Mi.current);Po(t,n),i=vs(null,t,r,e,i,n);var s=ms();return t.flags|=1,"object"===typeof i&&null!==i&&"function"===typeof i.render&&void 0===i.$$typeof?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Di(r)?(s=!0,ji(t)):s=!1,t.memoizedState=null!==i.state&&void 0!==i.state?i.state:null,Bo(t),i.updater=ia,t.stateNode=i,i._reactInternals=t,la(t,r,e,n),t=Ma(null,t,r,!0,s,n)):(t.tag=0,io&&s&&eo(t),ba(null,t,i,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Ua(e,t),e=t.pendingProps,r=(i=r._init)(r._payload),t.type=r,i=t.tag=function(e){if("function"===typeof e)return Dc(e)?1:0;if(void 0!==e&&null!==e){if((e=e.$$typeof)===M)return 11;if(e===T)return 14}return 2}(r),e=na(r,e),i){case 0:t=Ea(null,t,r,e,n);break e;case 1:t=Ra(null,t,r,e,n);break e;case 11:t=xa(null,t,r,e,n);break e;case 14:t=wa(null,t,r,na(r.type,e),n);break e}throw Error(o(306,r,""))}return t;case 0:return r=t.type,i=t.pendingProps,Ea(e,t,r,i=t.elementType===r?i:na(r,i),n);case 1:return r=t.type,i=t.pendingProps,Ra(e,t,r,i=t.elementType===r?i:na(r,i),n);case 3:e:{if(La(t),null===e)throw Error(o(387));r=t.pendingProps,i=(s=t.memoizedState).element,No(e,t),Uo(t,r,null,n);var a=t.memoizedState;if(r=a.element,s.isDehydrated){if(s={element:r,isDehydrated:!1,cache:a.cache,pendingSuspenseBoundaries:a.pendingSuspenseBoundaries,transitions:a.transitions},t.updateQueue.baseState=s,t.memoizedState=s,256&t.flags){t=Pa(e,t,r,n,i=ca(Error(o(423)),t));break e}if(r!==i){t=Pa(e,t,r,n,i=ca(Error(o(424)),t));break e}for(ro=ci(t.stateNode.containerInfo.firstChild),no=t,io=!0,oo=null,n=wo(t,null,r,n),t.child=n;n;)n.flags=-3&n.flags|4096,n=n.sibling}else{if(po(),r===i){t=Va(e,t,n);break e}ba(e,t,r,n)}t=t.child}return t;case 5:return Jo(t),null===e&&co(t),r=t.type,i=t.pendingProps,s=null!==e?e.memoizedProps:null,a=i.children,ni(r,i)?a=null:null!==s&&ni(r,s)&&(t.flags|=32),ka(e,t),ba(e,t,a,n),t.child;case 6:return null===e&&co(t),null;case 13:return Ba(e,t,n);case 4:return Go(t,t.stateNode.containerInfo),r=t.pendingProps,null===e?t.child=xo(t,null,r,n):ba(e,t,r,n),t.child;case 11:return r=t.type,i=t.pendingProps,xa(e,t,r,i=t.elementType===r?i:na(r,i),n);case 7:return ba(e,t,t.pendingProps,n),t.child;case 8:case 12:return ba(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,i=t.pendingProps,s=t.memoizedProps,a=i.value,Ei(So,r._currentValue),r._currentValue=a,null!==s)if(ar(s.value,a)){if(s.children===i.children&&!Li.current){t=Va(e,t,n);break e}}else for(null!==(s=t.child)&&(s.return=t);null!==s;){var l=s.dependencies;if(null!==l){a=s.child;for(var c=l.firstContext;null!==c;){if(c.context===r){if(1===s.tag){(c=Fo(-1,n&-n)).tag=2;var u=s.updateQueue;if(null!==u){var d=(u=u.shared).pending;null===d?c.next=c:(c.next=d.next,d.next=c),u.pending=c}}s.lanes|=n,null!==(c=s.alternate)&&(c.lanes|=n),Lo(s.return,n,t),l.lanes|=n;break}c=c.next}}else if(10===s.tag)a=s.type===t.type?null:s.child;else if(18===s.tag){if(null===(a=s.return))throw Error(o(341));a.lanes|=n,null!==(l=a.alternate)&&(l.lanes|=n),Lo(a,n,t),a=s.sibling}else a=s.child;if(null!==a)a.return=s;else for(a=s;null!==a;){if(a===t){a=null;break}if(null!==(s=a.sibling)){s.return=a.return,a=s;break}a=a.return}s=a}ba(e,t,i.children,n),t=t.child}return t;case 9:return i=t.type,r=t.pendingProps.children,Po(t,n),r=r(i=To(i)),t.flags|=1,ba(e,t,r,n),t.child;case 14:return i=na(r=t.type,t.pendingProps),wa(e,t,r,i=na(r.type,i),n);case 15:return Sa(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:na(r,i),Ua(e,t),t.tag=1,Di(r)?(e=!0,ji(t)):e=!1,Po(t,n),sa(t,r,i),la(t,r,i,n),Ma(null,t,r,!0,e,n);case 19:return Wa(e,t,n);case 22:return Ca(e,t,n)}throw Error(o(156,t.tag))};var Kc="function"===typeof reportError?reportError:function(e){console.error(e)};function Yc(e){this._internalRoot=e}function Xc(e){this._internalRoot=e}function Gc(e){return!(!e||1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType)}function Zc(e){return!(!e||1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType&&(8!==e.nodeType||" react-mount-point-unstable "!==e.nodeValue))}function Jc(){}function Qc(e,t,n,r,i){var o=n._reactRootContainer;if(o){var s=o;if("function"===typeof i){var a=i;i=function(){var e=Vc(s);a.call(e)}}Uc(t,s,e,i)}else s=function(e,t,n,r,i){if(i){if("function"===typeof r){var o=r;r=function(){var e=Vc(s);o.call(e)}}var s=Wc(t,r,e,0,null,!1,0,"",Jc);return e._reactRootContainer=s,e[pi]=s.current,Wr(8===e.nodeType?e.parentNode:e),uc(),s}for(;i=e.lastChild;)e.removeChild(i);if("function"===typeof r){var a=r;r=function(){var e=Vc(l);a.call(e)}}var l=zc(e,0,!1,null,0,!1,0,"",Jc);return e._reactRootContainer=l,e[pi]=l.current,Wr(8===e.nodeType?e.parentNode:e),uc(function(){Uc(t,l,n,r)}),l}(n,t,e,i,r);return Vc(s)}Xc.prototype.render=Yc.prototype.render=function(e){var t=this._internalRoot;if(null===t)throw Error(o(409));Uc(e,t,null,null)},Xc.prototype.unmount=Yc.prototype.unmount=function(){var e=this._internalRoot;if(null!==e){this._internalRoot=null;var t=e.containerInfo;uc(function(){Uc(null,e,null,null)}),t[pi]=null}},Xc.prototype.unstable_scheduleHydration=function(e){if(e){var t=Ct();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Ot.length&&0!==t&&t<Ot[n].priority;n++);Ot.splice(n,0,e),0===n&&Bt(e)}},xt=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=dt(t.pendingLanes);0!==n&&(_t(t,1|n),rc(t,Ze()),0===(6&Ml)&&(Wl=Ze()+500,Wi()))}break;case 13:uc(function(){var t=Ao(e,1);if(null!==t){var n=ec();nc(t,e,1,n)}}),qc(e,1)}},wt=function(e){if(13===e.tag){var t=Ao(e,134217728);if(null!==t)nc(t,e,134217728,ec());qc(e,134217728)}},St=function(e){if(13===e.tag){var t=tc(e),n=Ao(e,t);if(null!==n)nc(n,e,t,ec());qc(e,t)}},Ct=function(){return yt},kt=function(e,t){var n=yt;try{return yt=e,t()}finally{yt=n}},we=function(e,t,n){switch(t){case"input":if(J(e,n),t=n.name,"radio"===n.type&&null!=t){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var i=xi(r);if(!i)throw Error(o(90));K(r),J(r,i)}}}break;case"textarea":oe(e,n);break;case"select":null!=(t=n.value)&&ne(e,!!n.multiple,t,!1)}},Me=cc,Le=uc;var eu={usingClientEntryPoint:!1,Events:[yi,bi,xi,Ee,Re,cc]},tu={findFiberByHostInstance:_i,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},nu={bundleType:tu.bundleType,version:tu.version,rendererPackageName:tu.rendererPackageName,rendererConfig:tu.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:b.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return null===(e=$e(e))?null:e.stateNode},findFiberByHostInstance:tu.findFiberByHostInstance||function(){return null},findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if("undefined"!==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__){var ru=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ru.isDisabled&&ru.supportsFiber)try{it=ru.inject(nu),ot=ru}catch(ue){}}t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=eu,t.createPortal=function(e,t){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null;if(!Gc(t))throw Error(o(200));return function(e,t,n){var r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null;return{$$typeof:w,key:null==r?null:""+r,children:e,containerInfo:t,implementation:n}}(e,t,null,n)},t.createRoot=function(e,t){if(!Gc(e))throw Error(o(299));var n=!1,r="",i=Kc;return null!==t&&void 0!==t&&(!0===t.unstable_strictMode&&(n=!0),void 0!==t.identifierPrefix&&(r=t.identifierPrefix),void 0!==t.onRecoverableError&&(i=t.onRecoverableError)),t=zc(e,1,!1,null,0,n,0,r,i),e[pi]=t.current,Wr(8===e.nodeType?e.parentNode:e),new Yc(t)},t.findDOMNode=function(e){if(null==e)return null;if(1===e.nodeType)return e;var t=e._reactInternals;if(void 0===t){if("function"===typeof e.render)throw Error(o(188));throw e=Object.keys(e).join(","),Error(o(268,e))}return e=null===(e=$e(t))?null:e.stateNode},t.flushSync=function(e){return uc(e)},t.hydrate=function(e,t,n){if(!Zc(t))throw Error(o(200));return Qc(null,e,t,!0,n)},t.hydrateRoot=function(e,t,n){if(!Gc(e))throw Error(o(405));var r=null!=n&&n.hydratedSources||null,i=!1,s="",a=Kc;if(null!==n&&void 0!==n&&(!0===n.unstable_strictMode&&(i=!0),void 0!==n.identifierPrefix&&(s=n.identifierPrefix),void 0!==n.onRecoverableError&&(a=n.onRecoverableError)),t=Wc(t,null,e,1,null!=n?n:null,i,0,s,a),e[pi]=t.current,Wr(e),r)for(e=0;e<r.length;e++)i=(i=(n=r[e])._getVersion)(n._source),null==t.mutableSourceEagerHydrationData?t.mutableSourceEagerHydrationData=[n,i]:t.mutableSourceEagerHydrationData.push(n,i);return new Xc(t)},t.render=function(e,t,n){if(!Zc(t))throw Error(o(200));return Qc(null,e,t,!1,n)},t.unmountComponentAtNode=function(e){if(!Zc(e))throw Error(o(40));return!!e._reactRootContainer&&(uc(function(){Qc(null,null,e,!1,function(){e._reactRootContainer=null,e[pi]=null})}),!0)},t.unstable_batchedUpdates=cc,t.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!Zc(n))throw Error(o(200));if(null==e||void 0===e._reactInternals)throw Error(o(38));return Qc(e,t,n,!1,r)},t.version="18.3.1-next-f1338f8080-20240426"},853:(e,t,n)=>{"use strict";e.exports=n(234)},950:(e,t,n)=>{"use strict";!function e(){if("undefined"!==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"===typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}(),e.exports=n(730)}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={exports:{}};return e[r](o,o.exports,n),o.exports}(()=>{var e,t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__;n.t=function(r,i){if(1&i&&(r=this(r)),8&i)return r;if("object"===typeof r&&r){if(4&i&&r.__esModule)return r;if(16&i&&"function"===typeof r.then)return r}var o=Object.create(null);n.r(o);var s={};e=e||[null,t({}),t([]),t(t)];for(var a=2&i&&r;("object"==typeof a||"function"==typeof a)&&!~e.indexOf(a);a=t(a))Object.getOwnPropertyNames(a).forEach(e=>s[e]=()=>r[e]);return s.default=()=>r,n.d(o,s),o}})(),n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{"use strict";var e=n(43),t=n.t(e,2),r=n(391),i="undefined"!=typeof window?window:void 0,o="undefined"!=typeof globalThis?globalThis:i;"undefined"==typeof self&&(o.self=o),"undefined"==typeof File&&(o.File=function(){});var s=Array.prototype,a=s.forEach,l=s.indexOf,c=null==o?void 0:o.navigator,u=null==o?void 0:o.document,d=null==o?void 0:o.location,h=null==o?void 0:o.fetch,f=null!=o&&o.XMLHttpRequest&&"withCredentials"in new o.XMLHttpRequest?o.XMLHttpRequest:void 0,p=null==o?void 0:o.AbortController,g=null==c?void 0:c.userAgent,v=null!=i?i:{},m={DEBUG:!1,LIB_VERSION:"1.335.5"};function _(e,t,n,r,i,o,s){try{var a=e[o](s),l=a.value}catch(e){return void n(e)}a.done?t(l):Promise.resolve(l).then(r,i)}function y(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function s(e){_(o,r,i,s,a,"next",e)}function a(e){_(o,r,i,s,a,"throw",e)}s(void 0)})}}function b(){return b=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},b.apply(null,arguments)}function x(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}var w=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],S=function(e,t){if(void 0===t&&(t=[]),!e)return!1;var n=e.toLowerCase();return w.concat(t).some(e=>{var t=e.toLowerCase();return-1!==n.indexOf(t)})},C=["$snapshot","$pageview","$pageleave","$set","survey dismissed","survey sent","survey shown","$identify","$groupidentify","$create_alias","$$client_ingestion_warning","$web_experiment_applied","$feature_enrollment_update","$feature_flag_called"];function k(e,t){return-1!==e.indexOf(t)}var E=function(e){return e.trim()},R=function(e){return e.replace(/^\$/,"")},M=Array.isArray,L=Object.prototype,P=L.hasOwnProperty,T=L.toString,D=M||function(e){return"[object Array]"===T.call(e)},O=e=>"function"==typeof e,I=e=>e===Object(e)&&!D(e),A=e=>{if(I(e)){for(var t in e)if(P.call(e,t))return!1;return!0}return!1},j=e=>void 0===e,B=e=>"[object String]"==T.call(e),N=e=>B(e)&&0===e.trim().length,F=e=>null===e,z=e=>j(e)||F(e),H=e=>"[object Number]"==T.call(e)&&e==e,W=e=>H(e)&&e>0,U=e=>"[object Boolean]"===T.call(e),V=e=>k(C,e);function $(e){return null===e||"object"!=typeof e}function q(e,t){return Object.prototype.toString.call(e)==="[object "+t+"]"}function K(e){return!j(Event)&&function(e,t){try{return e instanceof t}catch(e){return!1}}(e,Event)}var Y=[!0,"true",1,"1","yes"],X=e=>k(Y,e),G=[!1,"false",0,"0","no"];function Z(e,t,n,r,i){return t>n&&(r.warn("min cannot be greater than max."),t=n),H(e)?e>n?(r.warn(" cannot be greater than max: "+n+". Using max value instead."),n):e<t?(r.warn(" cannot be less than min: "+t+". Using min value instead."),t):e:(r.warn(" must be a number. using max or fallback. max: "+n+", fallback: "+i),Z(i||n,t,n,r))}class J{constructor(e){this.t={},this.i=e.i,this.o=Z(e.bucketSize,0,100,e.h),this.m=Z(e.refillRate,0,this.o,e.h),this.$=Z(e.refillInterval,0,864e5,e.h)}S(e,t){var n=t-e.lastAccess,r=Math.floor(n/this.$);if(r>0){var i=r*this.m;e.tokens=Math.min(e.tokens+i,this.o),e.lastAccess=e.lastAccess+r*this.$}}consumeRateLimit(e){var t,n=Date.now(),r=String(e),i=this.t[r];return i?this.S(i,n):(i={tokens:this.o,lastAccess:n},this.t[r]=i),0===i.tokens||(i.tokens--,0===i.tokens&&(null==(t=this.i)||t.call(this,e)),0===i.tokens)}stop(){this.t={}}}var Q,ee,te,ne="Mobile",re="iOS",ie="Android",oe="Tablet",se=ie+" "+oe,ae="iPad",le="Apple",ce=le+" Watch",ue="Safari",de="BlackBerry",he="Samsung",fe=he+"Browser",pe=he+" Internet",ge="Chrome",ve=ge+" OS",me=ge+" "+re,_e="Internet Explorer",ye=_e+" "+ne,be="Opera",xe=be+" Mini",we="Edge",Se="Microsoft "+we,Ce="Firefox",ke=Ce+" "+re,Ee="Nintendo",Re="PlayStation",Me="Xbox",Le=ie+" "+ne,Pe=ne+" "+ue,Te="Windows",De=Te+" Phone",Oe="Nokia",Ie="Ouya",Ae="Generic",je=Ae+" "+ne.toLowerCase(),Be=Ae+" "+oe.toLowerCase(),Ne="Konqueror",Fe="(\\d+(\\.\\d+)?)",ze=new RegExp("Version/"+Fe),He=new RegExp(Me,"i"),We=new RegExp(Re+" \\w+","i"),Ue=new RegExp(Ee+" \\w+","i"),Ve=new RegExp(de+"|PlayBook|BB10","i"),$e={"NT3.51":"NT 3.11","NT4.0":"NT 4.0","5.0":"2000",5.1:"XP",5.2:"XP","6.0":"Vista",6.1:"7",6.2:"8",6.3:"8.1",6.4:"10","10.0":"10"},qe=function(e,t){return t=t||"",k(e," OPR/")&&k(e,"Mini")?xe:k(e," OPR/")?be:Ve.test(e)?de:k(e,"IE"+ne)||k(e,"WPDesktop")?ye:k(e,fe)?pe:k(e,we)||k(e,"Edg/")?Se:k(e,"FBIOS")?"Facebook "+ne:k(e,"UCWEB")||k(e,"UCBrowser")?"UC Browser":k(e,"CriOS")?me:k(e,"CrMo")||k(e,ge)?ge:k(e,ie)&&k(e,ue)?Le:k(e,"FxiOS")?ke:k(e.toLowerCase(),Ne.toLowerCase())?Ne:((e,t)=>t&&k(t,le)||function(e){return k(e,ue)&&!k(e,ge)&&!k(e,ie)}(e))(e,t)?k(e,ne)?Pe:ue:k(e,Ce)?Ce:k(e,"MSIE")||k(e,"Trident/")?_e:k(e,"Gecko")?Ce:""},Ke={[ye]:[new RegExp("rv:"+Fe)],[Se]:[new RegExp(we+"?\\/"+Fe)],[ge]:[new RegExp("("+ge+"|CrMo)\\/"+Fe)],[me]:[new RegExp("CriOS\\/"+Fe)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Fe)],[ue]:[ze],[Pe]:[ze],[be]:[new RegExp("(Opera|OPR)\\/"+Fe)],[Ce]:[new RegExp(Ce+"\\/"+Fe)],[ke]:[new RegExp("FxiOS\\/"+Fe)],[Ne]:[new RegExp("Konqueror[:/]?"+Fe,"i")],[de]:[new RegExp(de+" "+Fe),ze],[Le]:[new RegExp("android\\s"+Fe,"i")],[pe]:[new RegExp(fe+"\\/"+Fe)],[_e]:[new RegExp("(rv:|MSIE )"+Fe)],Mozilla:[new RegExp("rv:"+Fe)]},Ye=function(e,t){var n=qe(e,t),r=Ke[n];if(j(r))return null;for(var i=0;i<r.length;i++){var o=r[i],s=e.match(o);if(s)return parseFloat(s[s.length-2])}return null},Xe=[[new RegExp(Me+"; "+Me+" (.*?)[);]","i"),e=>[Me,e&&e[1]||""]],[new RegExp(Ee,"i"),[Ee,""]],[new RegExp(Re,"i"),[Re,""]],[Ve,[de,""]],[new RegExp(Te,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[De,""];if(new RegExp(ne).test(t)&&!/IEMobile\b/.test(t))return[Te+" "+ne,""];var n=/Windows NT ([0-9.]+)/i.exec(t);if(n&&n[1]){var r=n[1],i=$e[r]||"";return/arm/i.test(t)&&(i="RT"),[Te,i]}return[Te,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>{if(e&&e[3]){var t=[e[3],e[4],e[5]||"0"];return[re,t.join(".")]}return[re,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=j(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("("+ie+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+ie+")","i"),e=>{if(e&&e[2]){var t=[e[2],e[3],e[4]||"0"];return[ie,t.join(".")]}return[ie,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{var t=["Mac OS X",""];if(e&&e[1]){var n=[e[1],e[2],e[3]||"0"];t[1]=n.join(".")}return t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[ve,""]],[/Linux|debian/i,["Linux",""]]],Ge=function(e){return Ue.test(e)?Ee:We.test(e)?Re:He.test(e)?Me:new RegExp(Ie,"i").test(e)?Ie:new RegExp("("+De+"|WPDesktop)","i").test(e)?De:/iPad/.test(e)?ae:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?ce:Ve.test(e)?de:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(Oe,"i").test(e)?Oe:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(e)||/(kf[a-z]+)( bui|\)).+silk\//i.test(e)?"Kindle Fire":/(Android|ZTE)/i.test(e)?new RegExp(ne).test(e)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(e)||/pixel[\daxl ]{1,6}/i.test(e)&&!/pixel c/i.test(e)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(e)||/lmy47v/i.test(e)&&!/QTAQZ3/i.test(e)?ie:se:new RegExp("(pda|"+ne+")","i").test(e)?je:new RegExp(oe,"i").test(e)&&!new RegExp(oe+" pc","i").test(e)?Be:""},Ze=e=>e instanceof Error;function Je(e){var t=globalThis._posthogChunkIds;if(t){var n=Object.keys(t);return te&&n.length===ee||(ee=n.length,te=n.reduce((n,r)=>{Q||(Q={});var i=Q[r];if(i)n[i[0]]=i[1];else for(var o=e(r),s=o.length-1;s>=0;s--){var a=o[s],l=null==a?void 0:a.filename,c=t[r];if(l&&c){n[l]=c,Q[r]=[l,c];break}}return n},{})),te}}class Qe{constructor(e,t,n){void 0===n&&(n=[]),this.coercers=e,this.stackParser=t,this.modifiers=n}buildFromUnknown(e,t){void 0===t&&(t={});var n=t&&t.mechanism||{handled:!0,type:"generic"},r=this.buildCoercingContext(n,t,0).apply(e),i=this.buildParsingContext(),o=this.parseStacktrace(r,i);return{$exception_list:this.convertToExceptionList(o,n),$exception_level:"error"}}modifyFrames(e){var t=this;return y(function*(){for(var n of e)n.stacktrace&&n.stacktrace.frames&&D(n.stacktrace.frames)&&(n.stacktrace.frames=yield t.applyModifiers(n.stacktrace.frames));return e})()}coerceFallback(e){var t;return{type:"Error",value:"Unknown error",stack:null==(t=e.syntheticException)?void 0:t.stack,synthetic:!0}}parseStacktrace(e,t){var n,r;return null!=e.cause&&(n=this.parseStacktrace(e.cause,t)),""!=e.stack&&null!=e.stack&&(r=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?1:0),t.chunkIdMap)),b({},e,{cause:n,stack:r})}applyChunkIds(e,t){return e.map(e=>(e.filename&&t&&(e.chunk_id=t[e.filename]),e))}applyCoercers(e,t){for(var n of this.coercers)if(n.match(e))return n.coerce(e,t);return this.coerceFallback(t)}applyModifiers(e){var t=this;return y(function*(){var n=e;for(var r of t.modifiers)n=yield r(n);return n})()}convertToExceptionList(e,t){var n,r,i,o={type:e.type,value:e.value,mechanism:{type:null!==(n=t.type)&&void 0!==n?n:"generic",handled:null===(r=t.handled)||void 0===r||r,synthetic:null!==(i=e.synthetic)&&void 0!==i&&i}};e.stack&&(o.stacktrace={type:"raw",frames:e.stack});var s=[o];return null!=e.cause&&s.push(...this.convertToExceptionList(e.cause,b({},t,{handled:!0}))),s}buildParsingContext(){return{chunkIdMap:Je(this.stackParser)}}buildCoercingContext(e,t,n){void 0===n&&(n=0);var r=(n,r)=>{if(r<=4){var i=this.buildCoercingContext(e,t,r);return this.applyCoercers(n,i)}};return b({},t,{syntheticException:0==n?t.syntheticException:void 0,mechanism:e,apply:e=>r(e,n),next:e=>r(e,n+1)})}}var et="?";function tt(e,t,n,r,i){var o={platform:e,filename:t,function:"<anonymous>"===n?et:n,in_app:!0};return j(r)||(o.lineno=r),j(i)||(o.colno=i),o}var nt=(e,t)=>{var n=-1!==e.indexOf("safari-extension"),r=-1!==e.indexOf("safari-web-extension");return n||r?[-1!==e.indexOf("@")?e.split("@")[0]:et,n?"safari-extension:"+t:"safari-web-extension:"+t]:[e,t]},rt=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,it=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,ot=/\((\S*)(?::(\d+))(?::(\d+))\)/,st=(e,t)=>{var n=rt.exec(e);if(n){var[,r,i,o]=n;return tt(t,r,et,+i,+o)}var s=it.exec(e);if(s){if(s[2]&&0===s[2].indexOf("eval")){var a=ot.exec(s[2]);a&&(s[2]=a[1],s[3]=a[2],s[4]=a[3])}var[l,c]=nt(s[1]||et,s[2]);return tt(t,c,l,s[3]?+s[3]:void 0,s[4]?+s[4]:void 0)}},at=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,lt=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,ct=(e,t)=>{var n=at.exec(e);if(n){if(n[3]&&n[3].indexOf(" > eval")>-1){var r=lt.exec(n[3]);r&&(n[1]=n[1]||"eval",n[3]=r[1],n[4]=r[2],n[5]="")}var i=n[3],o=n[1]||et;return[o,i]=nt(o,i),tt(t,i,o,n[4]?+n[4]:void 0,n[5]?+n[5]:void 0)}},ut=/\(error: (.*)\)/;class dt{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){var n=B(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:n?e.stack:void 0,cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return this.isDOMError(e)?"DOMError":"DOMException"}getValue(e){var t=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?t+": "+e.message:t}isDOMException(e){return q(e,"DOMException")}isDOMError(e){return q(e,"DOMError")}}class ht{match(e){return(e=>e instanceof Error)(e)}coerce(e,t){return{type:this.getType(e),value:this.getMessage(e,t),stack:this.getStack(e),cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return e.name||e.constructor.name}getMessage(e,t){var n=e.message;return n.error&&"string"==typeof n.error.message?String(n.error.message):String(n)}getStack(e){return e.stacktrace||e.stack||void 0}}class ft{constructor(){}match(e){return q(e,"ErrorEvent")&&null!=e.error}coerce(e,t){var n;return t.apply(e.error)||{type:"ErrorEvent",value:e.message,stack:null==(n=t.syntheticException)?void 0:n.stack,synthetic:!0}}}var pt=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class gt{match(e){return"string"==typeof e}coerce(e,t){var n,[r,i]=this.getInfos(e);return{type:null!=r?r:"Error",value:null!=i?i:e,stack:null==(n=t.syntheticException)?void 0:n.stack,synthetic:!0}}getInfos(e){var t="Error",n=e,r=e.match(pt);return r&&(t=r[1],n=r[2]),[t,n]}}var vt=["fatal","error","warning","log","info","debug"];function mt(e,t){void 0===t&&(t=40);var n=Object.keys(e);if(n.sort(),!n.length)return"[object has no keys]";for(var r=n.length;r>0;r--){var i=n.slice(0,r).join(", ");if(!(i.length>t))return r===n.length||i.length<=t?i:i.slice(0,t)+"..."}return""}class _t{match(e){return"object"==typeof e&&null!==e}coerce(e,t){var n,r=this.getErrorPropertyFromObject(e);return r?t.apply(r):{type:this.getType(e),value:this.getValue(e),stack:null==(n=t.syntheticException)?void 0:n.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){return K(e)?e.constructor.name:"Error"}getValue(e){if("name"in e&&"string"==typeof e.name){var t="'"+e.name+"' captured as exception";return"message"in e&&"string"==typeof e.message&&(t+=" with message: '"+e.message+"'"),t}if("message"in e&&"string"==typeof e.message)return e.message;var n=this.getObjectClassName(e);return(n&&"Object"!==n?"'"+n+"'":"Object")+" captured as exception with keys: "+mt(e)}isSeverityLevel(e){return B(e)&&!N(e)&&vt.indexOf(e)>=0}getErrorPropertyFromObject(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t)){var n=e[t];if(Ze(n))return n}}getObjectClassName(e){try{var t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch(e){return}}}class yt{match(e){return K(e)}coerce(e,t){var n,r=e.constructor.name;return{type:r,value:r+" captured as exception with keys: "+mt(e),stack:null==(n=t.syntheticException)?void 0:n.stack,synthetic:!0}}}class bt{match(e){return $(e)}coerce(e,t){var n;return{type:"Error",value:"Primitive value captured as exception: "+String(e),stack:null==(n=t.syntheticException)?void 0:n.stack,synthetic:!0}}}class xt{match(e){return q(e,"PromiseRejectionEvent")}coerce(e,t){var n,r=this.getUnhandledRejectionReason(e);return $(r)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(r),stack:null==(n=t.syntheticException)?void 0:n.stack,synthetic:!0}:t.apply(r)}getUnhandledRejectionReason(e){if($(e))return e;try{if("reason"in e)return e.reason;if("detail"in e&&"reason"in e.detail)return e.detail.reason}catch(e){}return e}}var wt=function(e,t){var{debugEnabled:n}=void 0===t?{}:t,r={k:function(t){if(i&&(m.DEBUG||v.POSTHOG_DEBUG||n)&&!j(i.console)&&i.console){for(var r=("__rrweb_original__"in i.console[t]?i.console[t].__rrweb_original__:i.console[t]),o=arguments.length,s=new Array(o>1?o-1:0),a=1;a<o;a++)s[a-1]=arguments[a];r(e,...s)}},info:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];r.k("log",...t)},warn:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];r.k("warn",...t)},error:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];r.k("error",...t)},critical:function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];console.error(e,...n)},uninitializedWarning:e=>{r.error("You must initialize PostHog before calling "+e)},createLogger:(t,n)=>wt(e+" "+t,n)};return r},St=wt("[PostHog.js]"),Ct=St.createLogger,kt=Ct("[ExternalScriptsLoader]"),Et=(e,t,n)=>{if(e.config.disable_external_dependency_loading)return kt.warn(t+" was requested but loading of external scripts is disabled."),n("Loading of external scripts is disabled");var r=null==u?void 0:u.querySelectorAll("script");if(r)for(var i,o=function(){if(r[s].src===t){var e=r[s];return e.__posthog_loading_callback_fired?{v:n()}:(e.addEventListener("load",t=>{e.__posthog_loading_callback_fired=!0,n(void 0,t)}),e.onerror=e=>n(e),{v:void 0})}},s=0;s<r.length;s++)if(i=o())return i.v;var a=()=>{if(!u)return n("document not found");var r=u.createElement("script");if(r.type="text/javascript",r.crossOrigin="anonymous",r.src=t,r.onload=e=>{r.__posthog_loading_callback_fired=!0,n(void 0,e)},r.onerror=e=>n(e),e.config.prepare_external_dependency_script&&(r=e.config.prepare_external_dependency_script(r)),!r)return n("prepare_external_dependency_script returned null");if("head"===e.config.external_scripts_inject_target)u.head.appendChild(r);else{var i,o=u.querySelectorAll("body > script");o.length>0?null==(i=o[0].parentNode)||i.insertBefore(r,o[0]):u.body.appendChild(r)}};null!=u&&u.body?a():null==u||u.addEventListener("DOMContentLoaded",a)};v.__PosthogExtensions__=v.__PosthogExtensions__||{},v.__PosthogExtensions__.loadExternalDependency=(e,t,n)=>{var r="/static/"+t+".js?v="+e.version;if("remote-config"===t&&(r="/array/"+e.config.token+"/config.js"),"toolbar"===t){var i=3e5;r=r+"&t="+Math.floor(Date.now()/i)*i}var o=e.requestRouter.endpointFor("assets",r);Et(e,o,n)},v.__PosthogExtensions__.loadSiteApp=(e,t,n)=>{var r=e.requestRouter.endpointFor("api",t);Et(e,r,n)};var Rt={};function Mt(e,t,n){if(D(e))if(a&&e.forEach===a)e.forEach(t,n);else if("length"in e&&e.length===+e.length)for(var r=0,i=e.length;r<i;r++)if(r in e&&t.call(n,e[r],r)===Rt)return}function Lt(e,t,n){if(!z(e)){if(D(e))return Mt(e,t,n);if((e=>e instanceof FormData)(e)){for(var r of e.entries())if(t.call(n,r[1],r[0])===Rt)return}else for(var i in e)if(P.call(e,i)&&t.call(n,e[i],i)===Rt)return}}var Pt=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return Mt(n,function(t){for(var n in t)void 0!==t[n]&&(e[n]=t[n])}),e},Tt=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return Mt(n,function(t){Mt(t,function(t){e.push(t)})}),e};function Dt(e){for(var t=Object.keys(e),n=t.length,r=new Array(n);n--;)r[n]=[t[n],e[t[n]]];return r}var Ot=function(e){try{return e()}catch(e){return}},It=function(e){return function(){try{for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return e.apply(this,n)}catch(e){St.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),St.critical(e)}}},At=function(e){var t={};return Lt(e,function(e,n){(B(e)&&e.length>0||H(e))&&(t[n]=e)}),t};var jt=["herokuapp.com","vercel.app","netlify.app"];function Bt(e){var t=null==e?void 0:e.hostname;if(!B(t))return!1;var n=t.split(".").slice(-2).join(".");for(var r of jt)if(n===r)return!1;return!0}function Nt(e,t){for(var n=0;n<e.length;n++)if(t(e[n]))return e[n]}function Ft(e,t,n,r){var{capture:i=!1,passive:o=!0}=null!=r?r:{};null==e||e.addEventListener(t,n,{capture:i,passive:o})}var zt="$people_distinct_id",Ht="__alias",Wt="__timers",Ut="$autocapture_disabled_server_side",Vt="$heatmaps_enabled_server_side",$t="$exception_capture_enabled_server_side",qt="$error_tracking_suppression_rules",Kt="$error_tracking_capture_extension_exceptions",Yt="$web_vitals_enabled_server_side",Xt="$dead_clicks_enabled_server_side",Gt="$product_tours_enabled_server_side",Zt="$web_vitals_allowed_metrics",Jt="$session_recording_remote_config",Qt="$sesid",en="$session_is_sampled",tn="$enabled_feature_flags",nn="$early_access_features",rn="$feature_flag_details",on="$stored_person_properties",sn="$stored_group_properties",an="$surveys",ln="$flag_call_reported",cn="$user_state",un="$client_session_props",dn="$capture_rate_limit",hn="$initial_campaign_params",fn="$initial_referrer_info",pn="$initial_person_info",gn="$epp",vn="__POSTHOG_TOOLBAR__",mn="$posthog_cookieless",_n=[zt,Ht,"__cmpns",Wt,"$session_recording_enabled_server_side",Vt,Qt,tn,qt,cn,nn,rn,sn,on,an,ln,un,dn,hn,fn,gn,pn,"$conversations_widget_session_id","$conversations_ticket_id","$conversations_widget_state","$conversations_user_traits"];function yn(e){return e instanceof Element&&(e.id===vn||!(null==e.closest||!e.closest(".toolbar-global-fade-container")))}function bn(e){return!!e&&1===e.nodeType}function xn(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function wn(e){return!!e&&3===e.nodeType}function Sn(e){return!!e&&11===e.nodeType}function Cn(e){return e?E(e).split(/\s+/):[]}function kn(e){var t=null==i?void 0:i.location.href;return!!(t&&e&&e.some(e=>t.match(e)))}function En(e){var t="";switch(typeof e.className){case"string":t=e.className;break;case"object":t=(e.className&&"baseVal"in e.className?e.className.baseVal:null)||e.getAttribute("class")||"";break;default:t=""}return Cn(t)}function Rn(e){return z(e)?null:E(e).split(/(\s+)/).filter(e=>$n(e)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Mn(e){var t="";return Bn(e)&&!Nn(e)&&e.childNodes&&e.childNodes.length&&Lt(e.childNodes,function(e){var n;wn(e)&&e.textContent&&(t+=null!==(n=Rn(e.textContent))&&void 0!==n?n:"")}),E(t)}function Ln(e){return j(e.target)?e.srcElement||null:null!=(t=e.target)&&t.shadowRoot?e.composedPath()[0]||null:e.target||null;var t}var Pn=["a","button","form","input","select","textarea","label"];function Tn(e,t){if(j(t))return!0;var n,r=function(e){if(t.some(t=>e.matches(t)))return{v:!0}};for(var i of e)if(n=r(i))return n.v;return!1}function Dn(e){var t=e.parentNode;return!(!t||!bn(t))&&t}var On=["next","previous","prev",">","<"],In=[".ph-no-rageclick",".ph-no-capture"];var An=e=>!e||xn(e,"html")||!bn(e),jn=(e,t)=>{if(!i||An(e))return{parentIsUsefulElement:!1,targetElementList:[]};for(var n=!1,r=[e],o=e;o.parentNode&&!xn(o,"body");)if(Sn(o.parentNode))r.push(o.parentNode.host),o=o.parentNode.host;else{var s=Dn(o);if(!s)break;if(t||Pn.indexOf(s.tagName.toLowerCase())>-1)n=!0;else{var a=i.getComputedStyle(s);a&&"pointer"===a.getPropertyValue("cursor")&&(n=!0)}r.push(s),o=s}return{parentIsUsefulElement:n,targetElementList:r}};function Bn(e){for(var t=e;t.parentNode&&!xn(t,"body");t=t.parentNode){var n=En(t);if(k(n,"ph-sensitive")||k(n,"ph-no-capture"))return!1}if(k(En(e),"ph-include"))return!0;var r=e.type||"";if(B(r))switch(r.toLowerCase()){case"hidden":case"password":return!1}var i=e.name||e.id||"";return!B(i)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(i.replace(/[^a-zA-Z0-9]/g,""))}function Nn(e){return!!(xn(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||xn(e,"select")||xn(e,"textarea")||"true"===e.getAttribute("contenteditable"))}var Fn="(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11})",zn=new RegExp("^(?:"+Fn+")$"),Hn=new RegExp(Fn),Wn="\\d{3}-?\\d{2}-?\\d{4}",Un=new RegExp("^("+Wn+")$"),Vn=new RegExp("("+Wn+")");function $n(e,t){if(void 0===t&&(t=!0),z(e))return!1;if(B(e)){if(e=E(e),(t?zn:Hn).test((e||"").replace(/[- ]/g,"")))return!1;if((t?Un:Vn).test(e))return!1}return!0}function qn(e){var t=Mn(e);return $n(t=(t+" "+Kn(e)).trim())?t:""}function Kn(e){var t="";return e&&e.childNodes&&e.childNodes.length&&Lt(e.childNodes,function(e){var n;if(e&&"span"===(null==(n=e.tagName)?void 0:n.toLowerCase()))try{var r=Mn(e);t=(t+" "+r).trim(),e.childNodes&&e.childNodes.length&&(t=(t+" "+Kn(e)).trim())}catch(e){St.error("[AutoCapture]",e)}}),t}function Yn(e){return function(e){var t=e.map(e=>{var t,n,r="";if(e.tag_name&&(r+=e.tag_name),e.attr_class)for(var i of(e.attr_class.sort(),e.attr_class))r+="."+i.replace(/"/g,"");var o=b({},e.text?{text:e.text}:{},{"nth-child":null!==(t=e.nth_child)&&void 0!==t?t:0,"nth-of-type":null!==(n=e.nth_of_type)&&void 0!==n?n:0},e.href?{href:e.href}:{},e.attr_id?{attr_id:e.attr_id}:{},e.attributes),s={};return Dt(o).sort((e,t)=>{var[n]=e,[r]=t;return n.localeCompare(r)}).forEach(e=>{var[t,n]=e;return s[Xn(t.toString())]=Xn(n.toString())}),(r+=":")+Dt(s).map(e=>{var[t,n]=e;return t+'="'+n+'"'}).join("")});return t.join(";")}(function(e){return e.map(e=>{var t,n,r={text:null==(t=e.$el_text)?void 0:t.slice(0,400),tag_name:e.tag_name,href:null==(n=e.attr__href)?void 0:n.slice(0,2048),attr_class:Gn(e),attr_id:e.attr__id,nth_child:e.nth_child,nth_of_type:e.nth_of_type,attributes:{}};return Dt(e).filter(e=>{var[t]=e;return 0===t.indexOf("attr__")}).forEach(e=>{var[t,n]=e;return r.attributes[t]=n}),r})}(e))}function Xn(e){return e.replace(/"|\\"/g,'\\"')}function Gn(e){var t=e.attr__class;return t?D(t)?t:Cn(t):void 0}class Zn{constructor(e){this.disabled=!1===e;var t=I(e)?e:{};this.thresholdPx=t.threshold_px||30,this.timeoutMs=t.timeout_ms||1e3,this.clickCount=t.click_count||3,this.clicks=[]}isRageClick(e,t,n){if(this.disabled)return!1;var r=this.clicks[this.clicks.length-1];if(r&&Math.abs(e-r.x)+Math.abs(t-r.y)<this.thresholdPx&&n-r.timestamp<this.timeoutMs){if(this.clicks.push({x:e,y:t,timestamp:n}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:t,timestamp:n}];return!1}}var Jn=e=>{var t=null==u?void 0:u.createElement("a");return j(t)?null:(t.href=e,t)},Qn=function(e,t){for(var n,r=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),i=0;i<r.length;i++){var o=r[i].split("=");if(o[0]===t){n=o;break}}if(!D(n)||n.length<2)return"";var s=n[1];try{s=decodeURIComponent(s)}catch(e){St.error("Skipping decoding for malformed query param: "+s)}return s.replace(/\+/g," ")},er=function(e,t,n){if(!e||!t||!t.length)return e;for(var r=e.split("#"),i=r[0]||"",o=r[1],s=i.split("?"),a=s[1],l=s[0],c=(a||"").split("&"),u=[],d=0;d<c.length;d++){var h=c[d].split("=");D(h)&&(t.includes(h[0])?u.push(h[0]+"="+n):u.push(c[d]))}var f=l;return null!=a&&(f+="?"+u.join("&")),null!=o&&(f+="#"+o),f},tr=function(e,t){var n=e.match(new RegExp(t+"=([^&]*)"));return n?n[1]:null},nr="$copy_autocapture",rr=Ct("[AutoCapture]");function ir(e,t){return t.length>e?t.slice(0,e)+"...":t}function or(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do{t=t.previousSibling}while(t&&!bn(t));return t}function sr(e,t){for(var n,r,{e:o,maskAllElementAttributes:s,maskAllText:a,elementAttributeIgnoreList:l,elementsChainAsString:c}=t,u=[e],d=e;d.parentNode&&!xn(d,"body");)Sn(d.parentNode)?(u.push(d.parentNode.host),d=d.parentNode.host):(u.push(d.parentNode),d=d.parentNode);var h,f=[],p={},g=!1,v=!1;if(Lt(u,e=>{var t=Bn(e);"a"===e.tagName.toLowerCase()&&(g=e.getAttribute("href"),g=t&&g&&$n(g)&&g),k(En(e),"ph-no-capture")&&(v=!0),f.push(function(e,t,n,r){var i=e.tagName.toLowerCase(),o={tag_name:i};Pn.indexOf(i)>-1&&!n&&("a"===i.toLowerCase()||"button"===i.toLowerCase()?o.$el_text=ir(1024,qn(e)):o.$el_text=ir(1024,Mn(e)));var s=En(e);s.length>0&&(o.classes=s.filter(function(e){return""!==e})),Lt(e.attributes,function(n){var i;if((!Nn(e)||-1!==["name","id","class","aria-label"].indexOf(n.name))&&(null==r||!r.includes(n.name))&&!t&&$n(n.value)&&(i=n.name,!B(i)||"_ngcontent"!==i.substring(0,10)&&"_nghost"!==i.substring(0,7))){var s=n.value;"class"===n.name&&(s=Cn(s).join(" ")),o["attr__"+n.name]=ir(1024,s)}});for(var a=1,l=1,c=e;c=or(c);)a++,c.tagName===e.tagName&&l++;return o.nth_child=a,o.nth_of_type=l,o}(e,s,a,l));var n=function(e){if(!Bn(e))return{};var t={};return Lt(e.attributes,function(e){if(e.name&&0===e.name.indexOf("data-ph-capture-attribute")){var n=e.name.replace("data-ph-capture-attribute-",""),r=e.value;n&&r&&$n(r)&&(t[n]=r)}}),t}(e);Pt(p,n)}),v)return{props:{},explicitNoCapture:v};if(a||("a"===e.tagName.toLowerCase()||"button"===e.tagName.toLowerCase()?f[0].$el_text=qn(e):f[0].$el_text=Mn(e)),g){var m,_;f[0].attr__href=g;var y=null==(m=Jn(g))?void 0:m.host,b=null==i||null==(_=i.location)?void 0:_.host;y&&b&&y!==b&&(h=g)}return{props:Pt({$event_type:o.type,$ce_version:1},c?{}:{$elements:f},{$elements_chain:Yn(f)},null!=(n=f[0])&&n.$el_text?{$el_text:null==(r=f[0])?void 0:r.$el_text}:{},h&&"click"===o.type?{$external_click_url:h}:{},p)}}class ar{constructor(e){this.P=!1,this.T=null,this.I=!1,this.instance=e,this.rageclicks=new Zn(e.config.rageclick),this.C=null}get R(){var e,t,n=I(this.instance.config.autocapture)?this.instance.config.autocapture:{};return n.url_allowlist=null==(e=n.url_allowlist)?void 0:e.map(e=>new RegExp(e)),n.url_ignorelist=null==(t=n.url_ignorelist)?void 0:t.map(e=>new RegExp(e)),n}F(){if(this.isBrowserSupported()){if(i&&u){var e=e=>{e=e||(null==i?void 0:i.event);try{this.M(e)}catch(i){rr.error("Failed to capture event",i)}};if(Ft(u,"submit",e,{capture:!0}),Ft(u,"change",e,{capture:!0}),Ft(u,"click",e,{capture:!0}),this.R.capture_copied_text){var t=e=>{e=e||(null==i?void 0:i.event),this.M(e,nr)};Ft(u,"copy",t,{capture:!0}),Ft(u,"cut",t,{capture:!0})}}}else rr.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.P&&(this.F(),this.P=!0)}onRemoteConfig(e){e.elementsChainAsString&&(this.I=e.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[Ut]:!!e.autocapture_opt_out}),this.T=!!e.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(e){this.C=e}getElementSelectors(e){var t,n=[];return null==(t=this.C)||t.forEach(t=>{var r=null==u?void 0:u.querySelectorAll(t);null==r||r.forEach(r=>{e===r&&n.push(t)})}),n}get isEnabled(){var e,t,n=null==(e=this.instance.persistence)?void 0:e.props[Ut],r=this.T;if(F(r)&&!U(n)&&!this.instance.O())return!1;var i=null!==(t=this.T)&&void 0!==t?t:!!n;return!!this.instance.config.autocapture&&!i}M(e,t){if(void 0===t&&(t="$autocapture"),this.isEnabled){var n,r=Ln(e);wn(r)&&(r=r.parentNode||null),"$autocapture"===t&&"click"===e.type&&e instanceof MouseEvent&&this.instance.config.rageclick&&null!=(n=this.rageclicks)&&n.isRageClick(e.clientX,e.clientY,e.timeStamp||(new Date).getTime())&&function(e,t){if(!i||An(e))return!1;var n,r,o;if(U(t)?(n=!!t&&In,r=void 0):(n=null!==(o=null==t?void 0:t.css_selector_ignorelist)&&void 0!==o?o:In,r=null==t?void 0:t.content_ignorelist),!1===n)return!1;var{targetElementList:s}=jn(e,!1);return!function(e,t){if(!1===e||j(e))return!1;var n;if(!0===e)n=On;else{if(!D(e))return!1;if(e.length>10)return St.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;n=e.map(e=>e.toLowerCase())}return t.some(e=>{var{safeText:t,ariaLabel:r}=e;return n.some(e=>t.includes(e)||r.includes(e))})}(r,s.map(e=>{var t;return{safeText:Mn(e).toLowerCase(),ariaLabel:(null==(t=e.getAttribute("aria-label"))?void 0:t.toLowerCase().trim())||""}}))&&!Tn(s,n)}(r,this.instance.config.rageclick)&&this.M(e,"$rageclick");var o=t===nr;if(r&&function(e,t,n,r,o){var s,a,l,c;if(void 0===n&&(n=void 0),!i||An(e))return!1;if(null!=(s=n)&&s.url_allowlist&&!kn(n.url_allowlist))return!1;if(null!=(a=n)&&a.url_ignorelist&&kn(n.url_ignorelist))return!1;if(null!=(l=n)&&l.dom_event_allowlist){var u=n.dom_event_allowlist;if(u&&!u.some(e=>t.type===e))return!1}var{parentIsUsefulElement:d,targetElementList:h}=jn(e,r);if(!function(e,t){var n=null==t?void 0:t.element_allowlist;if(j(n))return!0;var r,i=function(e){if(n.some(t=>e.tagName.toLowerCase()===t))return{v:!0}};for(var o of e)if(r=i(o))return r.v;return!1}(h,n))return!1;if(!Tn(h,null==(c=n)?void 0:c.css_selector_allowlist))return!1;var f=i.getComputedStyle(e);if(f&&"pointer"===f.getPropertyValue("cursor")&&"click"===t.type)return!0;var p=e.tagName.toLowerCase();switch(p){case"html":return!1;case"form":return(o||["submit"]).indexOf(t.type)>=0;case"input":case"select":case"textarea":return(o||["change","click"]).indexOf(t.type)>=0;default:return d?(o||["click"]).indexOf(t.type)>=0:(o||["click"]).indexOf(t.type)>=0&&(Pn.indexOf(p)>-1||"true"===e.getAttribute("contenteditable"))}}(r,e,this.R,o,o?["copy","cut"]:void 0)){var{props:s,explicitNoCapture:a}=sr(r,{e:e,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.R.element_attribute_ignorelist,elementsChainAsString:this.I});if(a)return!1;var l=this.getElementSelectors(r);if(l&&l.length>0&&(s.$element_selectors=l),t===nr){var c,u=Rn(null==i||null==(c=i.getSelection())?void 0:c.toString()),d=e.type||"clipboard";if(!u)return!1;s.$selected_content=u,s.$copy_type=d}return this.instance.capture(t,s),!0}}}isBrowserSupported(){return O(null==u?void 0:u.querySelectorAll)}}Math.trunc||(Math.trunc=function(e){return e<0?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return H(e)&&isFinite(e)&&Math.floor(e)===e});var lr="0123456789abcdef";class cr{constructor(e){if(this.bytes=e,16!==e.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,t,n,r){if(!Number.isInteger(e)||!Number.isInteger(t)||!Number.isInteger(n)||!Number.isInteger(r)||e<0||t<0||n<0||r<0||e>0xffffffffffff||t>4095||n>1073741823||r>4294967295)throw new RangeError("invalid field value");var i=new Uint8Array(16);return i[0]=e/Math.pow(2,40),i[1]=e/Math.pow(2,32),i[2]=e/Math.pow(2,24),i[3]=e/Math.pow(2,16),i[4]=e/Math.pow(2,8),i[5]=e,i[6]=112|t>>>8,i[7]=t,i[8]=128|n>>>24,i[9]=n>>>16,i[10]=n>>>8,i[11]=n,i[12]=r>>>24,i[13]=r>>>16,i[14]=r>>>8,i[15]=r,new cr(i)}toString(){for(var e="",t=0;t<this.bytes.length;t++)e=e+lr.charAt(this.bytes[t]>>>4)+lr.charAt(15&this.bytes[t]),3!==t&&5!==t&&7!==t&&9!==t||(e+="-");if(36!==e.length)throw new Error("Invalid UUIDv7 was generated");return e}clone(){return new cr(this.bytes.slice(0))}equals(e){return 0===this.compareTo(e)}compareTo(e){for(var t=0;t<16;t++){var n=this.bytes[t]-e.bytes[t];if(0!==n)return Math.sign(n)}return 0}}class ur{constructor(){this.A=0,this.D=0,this.j=new fr}generate(){var e=this.generateOrAbort();if(j(e)){this.A=0;var t=this.generateOrAbort();if(j(t))throw new Error("Could not generate UUID after timestamp reset");return t}return e}generateOrAbort(){var e=Date.now();if(e>this.A)this.A=e,this.L();else{if(!(e+1e4>this.A))return;this.D++,this.D>4398046511103&&(this.A++,this.L())}return cr.fromFieldsV7(this.A,Math.trunc(this.D/Math.pow(2,30)),this.D&Math.pow(2,30)-1,this.j.nextUint32())}L(){this.D=1024*this.j.nextUint32()+(1023&this.j.nextUint32())}}var dr,hr=e=>{if("undefined"!=typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var t=0;t<e.length;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};i&&!j(i.crypto)&&crypto.getRandomValues&&(hr=e=>crypto.getRandomValues(e));class fr{constructor(){this.N=new Uint32Array(8),this.U=1/0}nextUint32(){return this.U>=this.N.length&&(hr(this.N),this.U=0),this.N[this.U++]}}var pr=()=>gr().toString(),gr=()=>(dr||(dr=new ur)).generate(),vr="",mr=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;var _r={H:()=>!!u,B:function(e){St.error("cookieStore error: "+e)},q:function(e){if(u){try{for(var t=e+"=",n=u.cookie.split(";").filter(e=>e.length),r=0;r<n.length;r++){for(var i=n[r];" "==i.charAt(0);)i=i.substring(1,i.length);if(0===i.indexOf(t))return decodeURIComponent(i.substring(t.length,i.length))}}catch(e){}return null}},W:function(e){var t;try{t=JSON.parse(_r.q(e))||{}}catch(e){}return t},G:function(e,t,n,r,i){if(u)try{var o="",s="",a=function(e,t){if(t){var n=function(e,t){if(void 0===t&&(t=u),vr)return vr;if(!t)return"";if(["localhost","127.0.0.1"].includes(e))return"";for(var n=e.split("."),r=Math.min(n.length,8),i="dmn_chk_"+pr();!vr&&r--;){var o=n.slice(r).join("."),s=i+"=1;domain=."+o+";path=/";t.cookie=s+";max-age=3",t.cookie.includes(i)&&(t.cookie=s+";max-age=0",vr=o)}return vr}(e);if(!n){var r=(e=>{var t=e.match(mr);return t?t[0]:""})(e);r!==n&&St.info("Warning: cookie subdomain discovery mismatch",r,n),n=r}return n?"; domain=."+n:""}return""}(u.location.hostname,r);if(n){var l=new Date;l.setTime(l.getTime()+24*n*60*60*1e3),o="; expires="+l.toUTCString()}i&&(s="; secure");var c=e+"="+encodeURIComponent(JSON.stringify(t))+o+"; SameSite=Lax; path=/"+a+s;return c.length>3686.4&&St.warn("cookieStore warning: large cookie, len="+c.length),u.cookie=c,c}catch(e){return}},V:function(e,t){if(null!=u&&u.cookie)try{_r.G(e,"",-1,t)}catch(e){return}}},yr=null,br={H:function(){if(!F(yr))return yr;var e=!0;if(j(i))e=!1;else try{var t="__mplssupport__";br.G(t,"xyz"),'"xyz"'!==br.q(t)&&(e=!1),br.V(t)}catch(i){e=!1}return e||St.error("localStorage unsupported; falling back to cookie store"),yr=e,e},B:function(e){St.error("localStorage error: "+e)},q:function(e){try{return null==i?void 0:i.localStorage.getItem(e)}catch(i){br.B(i)}return null},W:function(e){try{return JSON.parse(br.q(e))||{}}catch(e){}return null},G:function(e,t){try{null==i||i.localStorage.setItem(e,JSON.stringify(t))}catch(i){br.B(i)}},V:function(e){try{null==i||i.localStorage.removeItem(e)}catch(i){br.B(i)}}},xr=["$device_id","distinct_id",Qt,en,gn,pn],wr={},Sr={H:function(){return!0},B:function(e){St.error("memoryStorage error: "+e)},q:function(e){return wr[e]||null},W:function(e){return wr[e]||null},G:function(e,t){wr[e]=t},V:function(e){delete wr[e]}},Cr=null,kr={H:function(){if(!F(Cr))return Cr;if(Cr=!0,j(i))Cr=!1;else try{var e="__support__";kr.G(e,"xyz"),'"xyz"'!==kr.q(e)&&(Cr=!1),kr.V(e)}catch(i){Cr=!1}return Cr},B:function(e){St.error("sessionStorage error: ",e)},q:function(e){try{return null==i?void 0:i.sessionStorage.getItem(e)}catch(i){kr.B(i)}return null},W:function(e){try{return JSON.parse(kr.q(e))||null}catch(e){}return null},G:function(e,t){try{null==i||i.sessionStorage.setItem(e,JSON.stringify(t))}catch(i){kr.B(i)}},V:function(e){try{null==i||i.sessionStorage.removeItem(e)}catch(i){kr.B(i)}}},Er=function(e){return e[e.PENDING=-1]="PENDING",e[e.DENIED=0]="DENIED",e[e.GRANTED=1]="GRANTED",e}({});class Rr{constructor(e){this._instance=e}get R(){return this._instance.config}get consent(){return this.J()?Er.DENIED:this.K}isOptedOut(){return"always"===this.R.cookieless_mode||this.consent===Er.DENIED||this.consent===Er.PENDING&&(this.R.opt_out_capturing_by_default||"on_reject"===this.R.cookieless_mode)}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===Er.DENIED}optInOut(e){this.Y.G(this.X,e?1:0,this.R.cookie_expiration,this.R.cross_subdomain_cookie,this.R.secure_cookie)}reset(){this.Y.V(this.X,this.R.cross_subdomain_cookie)}get X(){var{token:e,opt_out_capturing_cookie_prefix:t,consent_persistence_name:n}=this._instance.config;return n||(t?t+e:"__ph_opt_in_out_"+e)}get K(){var e=this.Y.q(this.X);return X(e)?Er.GRANTED:k(G,e)?Er.DENIED:Er.PENDING}get Y(){if(!this.Z){var e=this.R.opt_out_capturing_persistence_type;this.Z="localStorage"===e?br:_r;var t="localStorage"===e?_r:br;t.q(this.X)&&(this.Z.q(this.X)||this.optInOut(X(t.q(this.X))),t.V(this.X,this.R.cross_subdomain_cookie))}return this.Z}J(){return!!this.R.respect_dnt&&!!Nt([null==c?void 0:c.doNotTrack,null==c?void 0:c.msDoNotTrack,v.doNotTrack],e=>X(e))}}var Mr=Ct("[Dead Clicks]"),Lr=()=>!0,Pr=e=>{var t,n=!(null==(t=e.instance.persistence)||!t.get_property(Xt)),r=e.instance.config.capture_dead_clicks;return U(r)?r:!!I(r)||n};class Tr{get lazyLoadedDeadClicksAutocapture(){return this.tt}constructor(e,t,n){this.instance=e,this.isEnabled=t,this.onCapture=n,this.startIfEnabled()}onRemoteConfig(e){this.instance.persistence&&this.instance.persistence.register({[Xt]:null==e?void 0:e.captureDeadClicks}),this.startIfEnabled()}startIfEnabled(){this.isEnabled(this)&&this.it(()=>{this.et()})}it(e){var t,n;null!=(t=v.__PosthogExtensions__)&&t.initDeadClicksAutocapture&&e(),null==(n=v.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this.instance,"dead-clicks-autocapture",t=>{t?Mr.error("failed to load script",t):e()})}et(){var e;if(u){if(!this.tt&&null!=(e=v.__PosthogExtensions__)&&e.initDeadClicksAutocapture){var t=I(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};t.__onCapture=this.onCapture,this.tt=v.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.tt.start(u),Mr.info("starting...")}}else Mr.error("`document` not found. Cannot start.")}stop(){this.tt&&(this.tt.stop(),this.tt=void 0,Mr.info("stopping..."))}}var Dr=Ct("[ExceptionAutocapture]");class Or{constructor(e){var t,n,r;this.rt=()=>{var e;if(i&&this.isEnabled&&null!=(e=v.__PosthogExtensions__)&&e.errorWrappingFunctions){var t=v.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,n=v.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,r=v.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.st&&this.R.capture_unhandled_errors&&(this.st=t(this.captureException.bind(this))),!this.nt&&this.R.capture_unhandled_rejections&&(this.nt=n(this.captureException.bind(this))),!this.ot&&this.R.capture_console_errors&&(this.ot=r(this.captureException.bind(this)))}catch(i){Dr.error("failed to start",i),this.ut()}}},this._instance=e,this.ht=!(null==(t=this._instance.persistence)||!t.props[$t]),this.dt=new J({refillRate:null!==(n=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)&&void 0!==n?n:1,bucketSize:null!==(r=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)&&void 0!==r?r:10,refillInterval:1e4,h:Dr}),this.R=this.vt(),this.startIfEnabledOrStop()}vt(){var e=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return I(e)?t=b({},t,e):(j(e)?this.ht:e)&&(t=b({},t,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this.R.capture_console_errors||this.R.capture_unhandled_errors||this.R.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(Dr.info("enabled"),this.ut(),this.it(this.rt)):this.ut()}it(e){var t,n;null!=(t=v.__PosthogExtensions__)&&t.errorWrappingFunctions&&e(),null==(n=v.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this._instance,"exception-autocapture",t=>{if(t)return Dr.error("failed to load script",t);e()})}ut(){var e,t,n;null==(e=this.st)||e.call(this),this.st=void 0,null==(t=this.nt)||t.call(this),this.nt=void 0,null==(n=this.ot)||n.call(this),this.ot=void 0}onRemoteConfig(e){var t=e.autocaptureExceptions;this.ht=!!t||!1,this._instance.persistence&&this._instance.persistence.register({[$t]:this.ht}),this.R=this.vt(),this.startIfEnabledOrStop()}onConfigChange(){this.R=this.vt()}captureException(e){var t,n,r=null!==(t=null==e||null==(n=e.$exception_list)||null==(n=n[0])?void 0:n.type)&&void 0!==t?t:"Exception";this.dt.consumeRateLimit(r)?Dr.info("Skipping exception capture because of client rate limiting.",{exception:r}):this._instance.exceptions.sendExceptionEvent(e)}}function Ir(e,t,n){try{if(!(t in e))return()=>{};var r=e[t],i=n(r);return O(i)&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__posthog_wrapped__:{enumerable:!1,value:!0}})),e[t]=i,()=>{e[t]=r}}catch(e){return()=>{}}}class Ar{constructor(e){var t;this._instance=e,this.ct=(null==i||null==(t=i.location)?void 0:t.pathname)||""}get isEnabled(){return"history_change"===this._instance.config.capture_pageview}startIfEnabled(){this.isEnabled&&(St.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.ft&&this.ft(),this.ft=void 0,St.info("History API monitoring stopped")}monitorHistoryChanges(){var e,t;if(i&&i.history){var n=this;null!=(e=i.history.pushState)&&e.__posthog_wrapped__||Ir(i.history,"pushState",e=>function(t,r,i){e.call(this,t,r,i),n._t("pushState")}),null!=(t=i.history.replaceState)&&t.__posthog_wrapped__||Ir(i.history,"replaceState",e=>function(t,r,i){e.call(this,t,r,i),n._t("replaceState")}),this.yt()}}_t(e){try{var t,n=null==i||null==(t=i.location)?void 0:t.pathname;if(!n)return;n!==this.ct&&this.isEnabled&&this._instance.capture("$pageview",{navigation_type:e}),this.ct=n}catch(i){St.error("Error capturing "+e+" pageview",i)}}yt(){if(!this.ft){var e=()=>{this._t("popstate")};Ft(i,"popstate",e),this.ft=()=>{i&&i.removeEventListener("popstate",e)}}}}var jr=Ct("[SegmentIntegration]");var Br="posthog-js";function Nr(e,t){var{organization:n,projectId:r,prefix:i,severityAllowList:o=["error"],sendExceptionsToPostHog:s=!0}=void 0===t?{}:t;return t=>{var a,l,c,u,d;if("*"!==o&&!o.includes(t.level)||!e.__loaded)return t;t.tags||(t.tags={});var h=e.requestRouter.endpointFor("ui","/project/"+e.config.token+"/person/"+e.get_distinct_id());t.tags["PostHog Person URL"]=h,e.sessionRecordingStarted()&&(t.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));var f=(null==(a=t.exception)?void 0:a.values)||[],p=f.map(e=>b({},e,{stacktrace:e.stacktrace?b({},e.stacktrace,{type:"raw",frames:(e.stacktrace.frames||[]).map(e=>b({},e,{platform:"web:javascript"}))}):void 0})),g={$exception_message:(null==(l=f[0])?void 0:l.value)||t.message,$exception_type:null==(c=f[0])?void 0:c.type,$exception_level:t.level,$exception_list:p,$sentry_event_id:t.event_id,$sentry_exception:t.exception,$sentry_exception_message:(null==(u=f[0])?void 0:u.value)||t.message,$sentry_exception_type:null==(d=f[0])?void 0:d.type,$sentry_tags:t.tags};return n&&r&&(g.$sentry_url=(i||"https://sentry.io/organizations/")+n+"/issues/?project="+r+"&query="+t.event_id),s&&e.exceptions.sendExceptionEvent(g),t}}class Fr{constructor(e,t,n,r,i,o){this.name=Br,this.setupOnce=function(s){s(Nr(e,{organization:t,projectId:n,prefix:r,severityAllowList:i,sendExceptionsToPostHog:null==o||o}))}}}var zr=null!=i&&i.location?tr(i.location.hash,"__posthog")||tr(location.hash,"state"):null,Hr="_postHogToolbarParams",Wr=Ct("[Toolbar]"),Ur=function(e){return e[e.UNINITIALIZED=0]="UNINITIALIZED",e[e.LOADING=1]="LOADING",e[e.LOADED=2]="LOADED",e}(Ur||{});class Vr{constructor(e){this.instance=e}bt(e){v.ph_toolbar_state=e}wt(){var e;return null!==(e=v.ph_toolbar_state)&&void 0!==e?e:Ur.UNINITIALIZED}maybeLoadToolbar(e,t,n){if(void 0===e&&(e=void 0),void 0===t&&(t=void 0),void 0===n&&(n=void 0),!i||!u)return!1;e=null!=e?e:i.location,n=null!=n?n:i.history;try{if(!t){try{i.localStorage.setItem("test","test"),i.localStorage.removeItem("test")}catch(i){return!1}t=null==i?void 0:i.localStorage}var r,o=zr||tr(e.hash,"__posthog")||tr(e.hash,"state"),s=o?Ot(()=>JSON.parse(atob(decodeURIComponent(o))))||Ot(()=>JSON.parse(decodeURIComponent(o))):null;return s&&"ph_authorize"===s.action?((r=s).source="url",r&&Object.keys(r).length>0&&(s.desiredHash?e.hash=s.desiredHash:n?n.replaceState(n.state,"",e.pathname+e.search):e.hash="")):((r=JSON.parse(t.getItem(Hr)||"{}")).source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token)&&(this.loadToolbar(r),!0)}catch(i){return!1}}xt(e){var t=v.ph_load_toolbar||v.ph_load_editor;!z(t)&&O(t)?t(e,this.instance):Wr.warn("No toolbar load function found")}loadToolbar(e){var t=!(null==u||!u.getElementById(vn));if(!i||t)return!1;var n="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,r=b({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},n?{instrument:!1}:{});if(i.localStorage.setItem(Hr,JSON.stringify(b({},r,{source:void 0}))),this.wt()===Ur.LOADED)this.xt(r);else if(this.wt()===Ur.UNINITIALIZED){var o;this.bt(Ur.LOADING),null==(o=v.__PosthogExtensions__)||null==o.loadExternalDependency||o.loadExternalDependency(this.instance,"toolbar",e=>{if(e)return Wr.error("[Toolbar] Failed to load",e),void this.bt(Ur.UNINITIALIZED);this.bt(Ur.LOADED),this.xt(r)}),Ft(i,"turbolinks:load",()=>{this.bt(Ur.UNINITIALIZED),this.loadToolbar(r)})}return!0}Et(e){return this.loadToolbar(e)}maybeLoadEditor(e,t,n){return void 0===e&&(e=void 0),void 0===t&&(t=void 0),void 0===n&&(n=void 0),this.maybeLoadToolbar(e,t,n)}}var $r=Ct("[TracingHeaders]");class qr{constructor(e){this.$t=void 0,this.St=void 0,this.rt=()=>{var e,t;j(this.$t)&&(null==(e=v.__PosthogExtensions__)||null==(e=e.tracingHeadersPatchFns)||e._patchXHR(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager)),j(this.St)&&(null==(t=v.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)||t._patchFetch(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager))},this._instance=e}it(e){var t,n;null!=(t=v.__PosthogExtensions__)&&t.tracingHeadersPatchFns&&e(),null==(n=v.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this._instance,"tracing-headers",t=>{if(t)return $r.error("failed to load script",t);e()})}startIfEnabledOrStop(){var e,t;this._instance.config.__add_tracing_headers?this.it(this.rt):(null==(e=this.$t)||e.call(this),null==(t=this.St)||t.call(this),this.$t=void 0,this.St=void 0)}}var Kr="https?://(.*)",Yr=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Xr=Tt(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],Yr),Gr="<masked>",Zr=["li_fat_id"];function Jr(e,t,n){if(!u)return{};var r,i=t?Tt([],Yr,n||[]):[],o=Qr(er(u.URL,i,Gr),e),s=(r={},Lt(Zr,function(e){var t=_r.q(e);r[e]=t||null}),r);return Pt(s,o)}function Qr(e,t){var n=Xr.concat(t||[]),r={};return Lt(n,function(t){var n=Qn(e,t);r[t]=n||null}),r}function ei(e){var t=function(e){return e?0===e.search(Kr+"google.([^/?]*)")?"google":0===e.search(Kr+"bing.com")?"bing":0===e.search(Kr+"yahoo.com")?"yahoo":0===e.search(Kr+"duckduckgo.com")?"duckduckgo":null:null}(e),n="yahoo"!=t?"q":"p",r={};if(!F(t)){r.$search_engine=t;var i=u?Qn(u.referrer,n):"";i.length&&(r.ph_keyword=i)}return r}function ti(){return navigator.language||navigator.userLanguage}function ni(){return(null==u?void 0:u.referrer)||"$direct"}function ri(e,t){var n=e?Tt([],Yr,t||[]):[],r=null==d?void 0:d.href.substring(0,1e3);return{r:ni().substring(0,1e3),u:r?er(r,n,Gr):void 0}}function ii(e){var t,{r:n,u:r}=e,i={$referrer:n,$referring_domain:null==n?void 0:"$direct"==n?"$direct":null==(t=Jn(n))?void 0:t.host};if(r){i.$current_url=r;var o=Jn(r);i.$host=null==o?void 0:o.host,i.$pathname=null==o?void 0:o.pathname;var s=Qr(r);Pt(i,s)}if(n){var a=ei(n);Pt(i,a)}return i}function oi(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(i){return}}function si(){try{return(new Date).getTimezoneOffset()}catch(i){return}}function ai(e,t){if(!g)return{};var n,r,o,s=e?Tt([],Yr,t||[]):[],[a,l]=function(e){for(var t=0;t<Xe.length;t++){var[n,r]=Xe[t],i=n.exec(e),o=i&&(O(r)?r(i,e):r);if(o)return o}return["",""]}(g);return Pt(At({$os:a,$os_version:l,$browser:qe(g,navigator.vendor),$device:Ge(g),$device_type:(r=g,o=Ge(r),o===ae||o===se||"Kobo"===o||"Kindle Fire"===o||o===Be?oe:o===Ee||o===Me||o===Re||o===Ie?"Console":o===ce?"Wearable":o?ne:"Desktop"),$timezone:oi(),$timezone_offset:si()}),{$current_url:er(null==d?void 0:d.href,s,Gr),$host:null==d?void 0:d.host,$pathname:null==d?void 0:d.pathname,$raw_user_agent:g.length>1e3?g.substring(0,997)+"...":g,$browser_version:Ye(g,navigator.vendor),$browser_language:ti(),$browser_language_prefix:(n=ti(),"string"==typeof n?n.split("-")[0]:void 0),$screen_height:null==i?void 0:i.screen.height,$screen_width:null==i?void 0:i.screen.width,$viewport_height:null==i?void 0:i.innerHeight,$viewport_width:null==i?void 0:i.innerWidth,$lib:"web",$lib_version:m.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}var li=Ct("[Web Vitals]"),ci=9e5;class ui{constructor(e){var t;this.kt=!1,this.P=!1,this.N={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Pt=()=>{clearTimeout(this.Tt),0!==this.N.metrics.length&&(this._instance.capture("$web_vitals",this.N.metrics.reduce((e,t)=>b({},e,{["$web_vitals_"+t.name+"_event"]:b({},t),["$web_vitals_"+t.name+"_value"]:t.value}),{})),this.N={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.It=e=>{var t,n=null==(t=this._instance.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0);if(j(n))li.error("Could not read session ID. Dropping metrics!");else{this.N=this.N||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var r=this.Ct();j(r)||(z(null==e?void 0:e.name)||z(null==e?void 0:e.value)?li.error("Invalid metric received",e):this.Rt&&e.value>=this.Rt?li.error("Ignoring metric with value >= "+this.Rt,e):(this.N.url!==r&&(this.Pt(),this.Tt=setTimeout(this.Pt,this.flushToCaptureTimeoutMs)),j(this.N.url)&&(this.N.url=r),this.N.firstMetricTimestamp=j(this.N.firstMetricTimestamp)?Date.now():this.N.firstMetricTimestamp,e.attribution&&e.attribution.interactionTargetElement&&(e.attribution.interactionTargetElement=void 0),this.N.metrics.push(b({},e,{$current_url:r,$session_id:n.sessionId,$window_id:n.windowId,timestamp:Date.now()})),this.N.metrics.length===this.allowedMetrics.length&&this.Pt()))}},this.rt=()=>{if(!this.P){var e,t,n,r,i=v.__PosthogExtensions__;j(i)||j(i.postHogWebVitalsCallbacks)||({onLCP:e,onCLS:t,onFCP:n,onINP:r}=i.postHogWebVitalsCallbacks),e&&t&&n&&r?(this.allowedMetrics.indexOf("LCP")>-1&&e(this.It.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&t(this.It.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&n(this.It.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&r(this.It.bind(this)),this.P=!0):li.error("web vitals callbacks not loaded - not starting")}},this._instance=e,this.kt=!(null==(t=this._instance.persistence)||!t.props[Yt]),this.startIfEnabled()}get allowedMetrics(){var e,t,n=I(this._instance.config.capture_performance)?null==(e=this._instance.config.capture_performance)?void 0:e.web_vitals_allowed_metrics:void 0;return j(n)?(null==(t=this._instance.persistence)?void 0:t.props[Zt])||["CLS","FCP","INP","LCP"]:n}get flushToCaptureTimeoutMs(){return(I(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var e=I(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals_attribution:void 0;return null==e||e}get Rt(){var e=I(this._instance.config.capture_performance)&&H(this._instance.config.capture_performance.__web_vitals_max_value)?this._instance.config.capture_performance.__web_vitals_max_value:ci;return 0<e&&e<=6e4?ci:e}get isEnabled(){var e=null==d?void 0:d.protocol;if("http:"!==e&&"https:"!==e)return li.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=I(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals:U(this._instance.config.capture_performance)?this._instance.config.capture_performance:void 0;return U(t)?t:this.kt}startIfEnabled(){this.isEnabled&&!this.P&&(li.info("enabled, starting..."),this.it(this.rt))}onRemoteConfig(e){var t=I(e.capturePerformance)&&!!e.capturePerformance.web_vitals,n=I(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[Yt]:t}),this._instance.persistence.register({[Zt]:n})),this.kt=t,this.startIfEnabled()}it(e){var t,n;null!=(t=v.__PosthogExtensions__)&&t.postHogWebVitalsCallbacks?e():null==(n=v.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this._instance,"web-vitals",t=>{var n;if(t)li.error("failed to load script",t);else{var r=null==(n=v.__PosthogExtensions__)?void 0:n.loadWebVitalsCallbacks;r?(r(this.useAttribution),e()):e()}})}Ct(){var e=i?i.location.href:void 0;if(e){var t=this._instance.config.mask_personal_data_properties,n=this._instance.config.custom_personal_data_properties,r=t?Tt([],Yr,n||[]):[];return er(e,r,Gr)}li.error("Could not determine current URL")}}var di=Ct("[Heatmaps]");function hi(e){return I(e)&&"clientX"in e&&"clientY"in e&&H(e.clientX)&&H(e.clientY)}class fi{constructor(e){var t;this.kt=!1,this.P=!1,this.Ft=null,this.instance=e,this.kt=!(null==(t=this.instance.persistence)||!t.props[Vt]),this.rageclicks=new Zn(e.config.rageclick)}get flushIntervalMilliseconds(){var e=5e3;return I(this.instance.config.capture_heatmaps)&&this.instance.config.capture_heatmaps.flush_interval_milliseconds&&(e=this.instance.config.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return j(this.instance.config.capture_heatmaps)?j(this.instance.config.enable_heatmaps)?this.kt:this.instance.config.enable_heatmaps:!1!==this.instance.config.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.P)return;di.info("starting..."),this.Mt(),this.Ot()}else{var e;clearInterval(null!==(e=this.Ft)&&void 0!==e?e:void 0),this.At(),this.getAndClearBuffer()}}onRemoteConfig(e){var t=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[Vt]:t}),this.kt=t,this.startIfEnabled()}getAndClearBuffer(){var e=this.N;return this.N=void 0,e}Dt(e){this.jt(e.originalEvent,"deadclick")}Ot(){this.Ft&&clearInterval(this.Ft),this.Ft=function(e){return"visible"===(null==e?void 0:e.visibilityState)}(u)?setInterval(this.Lt.bind(this),this.flushIntervalMilliseconds):null}Mt(){i&&u&&(this.Nt=this.Lt.bind(this),Ft(i,"beforeunload",this.Nt),this.Ut=e=>this.jt(e||(null==i?void 0:i.event)),Ft(u,"click",this.Ut,{capture:!0}),this.zt=e=>this.Ht(e||(null==i?void 0:i.event)),Ft(u,"mousemove",this.zt,{capture:!0}),this.Bt=new Tr(this.instance,Lr,this.Dt.bind(this)),this.Bt.startIfEnabled(),this.qt=this.Ot.bind(this),Ft(u,"visibilitychange",this.qt),this.P=!0)}At(){var e;i&&u&&(this.Nt&&i.removeEventListener("beforeunload",this.Nt),this.Ut&&u.removeEventListener("click",this.Ut,{capture:!0}),this.zt&&u.removeEventListener("mousemove",this.zt,{capture:!0}),this.qt&&u.removeEventListener("visibilitychange",this.qt),clearTimeout(this.Wt),null==(e=this.Bt)||e.stop(),this.P=!1)}Gt(e,t){var n=this.instance.scrollManager.scrollY(),r=this.instance.scrollManager.scrollX(),o=this.instance.scrollManager.scrollElement(),s=function(e,t,n){for(var r=e;r&&bn(r)&&!xn(r,"body");){if(r===n)return!1;if(k(t,null==i?void 0:i.getComputedStyle(r).position))return!0;r=Dn(r)}return!1}(Ln(e),["fixed","sticky"],o);return{x:e.clientX+(s?0:r),y:e.clientY+(s?0:n),target_fixed:s,type:t}}jt(e,t){var n;if(void 0===t&&(t="click"),!yn(e.target)&&hi(e)){var r=this.Gt(e,t);null!=(n=this.rageclicks)&&n.isRageClick(e.clientX,e.clientY,(new Date).getTime())&&this.Vt(b({},r,{type:"rageclick"})),this.Vt(r)}}Ht(e){!yn(e.target)&&hi(e)&&(clearTimeout(this.Wt),this.Wt=setTimeout(()=>{this.Vt(this.Gt(e,"mousemove"))},500))}Vt(e){if(i){var t=i.location.href,n=this.instance.config.mask_personal_data_properties,r=this.instance.config.custom_personal_data_properties,o=n?Tt([],Yr,r||[]):[],s=er(t,o,Gr);this.N=this.N||{},this.N[s]||(this.N[s]=[]),this.N[s].push(e)}}Lt(){this.N&&!A(this.N)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}}class pi{constructor(e){this.Jt=(e,t,n)=>{n&&(n.noSessionId||n.activityTimeout||n.sessionPastMaximumLength)&&(St.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:e,changeReason:n}),this.Kt=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this.Yt()}Yt(){var e;this.Xt=null==(e=this._instance.sessionManager)?void 0:e.onSessionId(this.Jt)}destroy(){var e;null==(e=this.Xt)||e.call(this),this.Xt=void 0}doPageView(e,t){var n,r=this.Qt(e,t);return this.Kt={pathname:null!==(n=null==i?void 0:i.location.pathname)&&void 0!==n?n:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),r}doPageLeave(e){var t;return this.Qt(e,null==(t=this.Kt)?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:null==(e=this.Kt)?void 0:e.pageViewId}}Qt(e,t){var n=this.Kt;if(!n)return{$pageview_id:t};var r={$pageview_id:t,$prev_pageview_id:n.pageViewId},i=this._instance.scrollManager.getContext();if(i&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:o,lastScrollY:s,maxScrollY:a,maxContentHeight:l,lastContentY:c,maxContentY:u}=i;if(!(j(o)||j(s)||j(a)||j(l)||j(c)||j(u))){o=Math.ceil(o),s=Math.ceil(s),a=Math.ceil(a),l=Math.ceil(l),c=Math.ceil(c),u=Math.ceil(u);var d=o<=1?1:Z(s/o,0,1,St),h=o<=1?1:Z(a/o,0,1,St),f=l<=1?1:Z(c/l,0,1,St),p=l<=1?1:Z(u/l,0,1,St);r=Pt(r,{$prev_pageview_last_scroll:s,$prev_pageview_last_scroll_percentage:d,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:h,$prev_pageview_last_content:c,$prev_pageview_last_content_percentage:f,$prev_pageview_max_content:u,$prev_pageview_max_content_percentage:p})}}return n.pathname&&(r.$prev_pageview_pathname=n.pathname),n.timestamp&&(r.$prev_pageview_duration=(e.getTime()-n.timestamp.getTime())/1e3),r}}var gi=function(e){return e.GZipJS="gzip-js",e.Base64="base64",e}({}),vi=Uint8Array,mi=Uint16Array,_i=Uint32Array,yi=new vi([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),bi=new vi([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),xi=new vi([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),wi=function(e,t){for(var n=new mi(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];var i=new _i(n[30]);for(r=1;r<30;++r)for(var o=n[r];o<n[r+1];++o)i[o]=o-n[r]<<5|r;return[n,i]},Si=wi(yi,2),Ci=Si[0],ki=Si[1];Ci[28]=258,ki[258]=28;for(var Ei=wi(bi,0)[1],Ri=new mi(32768),Mi=0;Mi<32768;++Mi){var Li=(43690&Mi)>>>1|(21845&Mi)<<1;Li=(61680&(Li=(52428&Li)>>>2|(13107&Li)<<2))>>>4|(3855&Li)<<4,Ri[Mi]=((65280&Li)>>>8|(255&Li)<<8)>>>1}var Pi=function(e,t,n){for(var r=e.length,i=0,o=new mi(t);i<r;++i)++o[e[i]-1];var s,a=new mi(t);for(i=0;i<t;++i)a[i]=a[i-1]+o[i-1]<<1;if(n){s=new mi(1<<t);var l=15-t;for(i=0;i<r;++i)if(e[i])for(var c=i<<4|e[i],u=t-e[i],d=a[e[i]-1]++<<u,h=d|(1<<u)-1;d<=h;++d)s[Ri[d]>>>l]=c}else for(s=new mi(r),i=0;i<r;++i)s[i]=Ri[a[e[i]-1]++]>>>15-e[i];return s},Ti=new vi(288);for(Mi=0;Mi<144;++Mi)Ti[Mi]=8;for(Mi=144;Mi<256;++Mi)Ti[Mi]=9;for(Mi=256;Mi<280;++Mi)Ti[Mi]=7;for(Mi=280;Mi<288;++Mi)Ti[Mi]=8;var Di=new vi(32);for(Mi=0;Mi<32;++Mi)Di[Mi]=5;var Oi=Pi(Ti,9,0),Ii=Pi(Di,5,0),Ai=function(e){return(e/8|0)+(7&e&&1)},ji=function(e,t,n){(null==n||n>e.length)&&(n=e.length);var r=new(e instanceof mi?mi:e instanceof _i?_i:vi)(n-t);return r.set(e.subarray(t,n)),r},Bi=function(e,t,n){n<<=7&t;var r=t/8|0;e[r]|=n,e[r+1]|=n>>>8},Ni=function(e,t,n){n<<=7&t;var r=t/8|0;e[r]|=n,e[r+1]|=n>>>8,e[r+2]|=n>>>16},Fi=function(e,t){for(var n=[],r=0;r<e.length;++r)e[r]&&n.push({s:r,f:e[r]});var i=n.length,o=n.slice();if(!i)return[new vi(0),0];if(1==i){var s=new vi(n[0].s+1);return s[n[0].s]=1,[s,1]}n.sort(function(e,t){return e.f-t.f}),n.push({s:-1,f:25001});var a=n[0],l=n[1],c=0,u=1,d=2;for(n[0]={s:-1,f:a.f+l.f,l:a,r:l};u!=i-1;)a=n[n[c].f<n[d].f?c++:d++],l=n[c!=u&&n[c].f<n[d].f?c++:d++],n[u++]={s:-1,f:a.f+l.f,l:a,r:l};var h=o[0].s;for(r=1;r<i;++r)o[r].s>h&&(h=o[r].s);var f=new mi(h+1),p=zi(n[u-1],f,0);if(p>t){r=0;var g=0,v=p-t,m=1<<v;for(o.sort(function(e,t){return f[t.s]-f[e.s]||e.f-t.f});r<i;++r){var _=o[r].s;if(!(f[_]>t))break;g+=m-(1<<p-f[_]),f[_]=t}for(g>>>=v;g>0;){var y=o[r].s;f[y]<t?g-=1<<t-f[y]++-1:++r}for(;r>=0&&g;--r){var b=o[r].s;f[b]==t&&(--f[b],++g)}p=t}return[new vi(f),p]},zi=function(e,t,n){return-1==e.s?Math.max(zi(e.l,t,n+1),zi(e.r,t,n+1)):t[e.s]=n},Hi=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new mi(++t),r=0,i=e[0],o=1,s=function(e){n[r++]=e},a=1;a<=t;++a)if(e[a]==i&&a!=t)++o;else{if(!i&&o>2){for(;o>138;o-=138)s(32754);o>2&&(s(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(s(i),--o;o>6;o-=6)s(8304);o>2&&(s(o-3<<5|8208),o=0)}for(;o--;)s(i);o=1,i=e[a]}return[n.subarray(0,r),t]},Wi=function(e,t){for(var n=0,r=0;r<t.length;++r)n+=e[r]*t[r];return n},Ui=function(e,t,n){var r=n.length,i=Ai(t+2);e[i]=255&r,e[i+1]=r>>>8,e[i+2]=255^e[i],e[i+3]=255^e[i+1];for(var o=0;o<r;++o)e[i+o+4]=n[o];return 8*(i+4+r)},Vi=function(e,t,n,r,i,o,s,a,l,c,u){Bi(t,u++,n),++i[256];for(var d=Fi(i,15),h=d[0],f=d[1],p=Fi(o,15),g=p[0],v=p[1],m=Hi(h),_=m[0],y=m[1],b=Hi(g),x=b[0],w=b[1],S=new mi(19),C=0;C<_.length;++C)S[31&_[C]]++;for(C=0;C<x.length;++C)S[31&x[C]]++;for(var k=Fi(S,7),E=k[0],R=k[1],M=19;M>4&&!E[xi[M-1]];--M);var L,P,T,D,O=c+5<<3,I=Wi(i,Ti)+Wi(o,Di)+s,A=Wi(i,h)+Wi(o,g)+s+14+3*M+Wi(S,E)+(2*S[16]+3*S[17]+7*S[18]);if(O<=I&&O<=A)return Ui(t,u,e.subarray(l,l+c));if(Bi(t,u,1+(A<I)),u+=2,A<I){L=Pi(h,f,0),P=h,T=Pi(g,v,0),D=g;var j=Pi(E,R,0);for(Bi(t,u,y-257),Bi(t,u+5,w-1),Bi(t,u+10,M-4),u+=14,C=0;C<M;++C)Bi(t,u+3*C,E[xi[C]]);u+=3*M;for(var B=[_,x],N=0;N<2;++N){var F=B[N];for(C=0;C<F.length;++C){var z=31&F[C];Bi(t,u,j[z]),u+=E[z],z>15&&(Bi(t,u,F[C]>>>5&127),u+=F[C]>>>12)}}}else L=Oi,P=Ti,T=Ii,D=Di;for(C=0;C<a;++C)if(r[C]>255){z=r[C]>>>18&31,Ni(t,u,L[z+257]),u+=P[z+257],z>7&&(Bi(t,u,r[C]>>>23&31),u+=yi[z]);var H=31&r[C];Ni(t,u,T[H]),u+=D[H],H>3&&(Ni(t,u,r[C]>>>5&8191),u+=bi[H])}else Ni(t,u,L[r[C]]),u+=P[r[C]];return Ni(t,u,L[256]),u+P[256]},$i=new _i([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),qi=function(){for(var e=new _i(256),t=0;t<256;++t){for(var n=t,r=9;--r;)n=(1&n&&3988292384)^n>>>1;e[t]=n}return e}(),Ki=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8};function Yi(e,t){void 0===t&&(t={});var n=function(){var e=4294967295;return{p:function(t){for(var n=e,r=0;r<t.length;++r)n=qi[255&n^t[r]]^n>>>8;e=n},d:function(){return 4294967295^e}}}(),r=e.length;n.p(e);var i,o=function(e,t,n,r){return function(e,t,n,r,i,o){var s=e.length,a=new vi(r+s+5*(1+Math.floor(s/7e3))+i),l=a.subarray(r,a.length-i),c=0;if(!t||s<8)for(var u=0;u<=s;u+=65535){var d=u+65535;d<s?c=Ui(l,c,e.subarray(u,d)):(l[u]=o,c=Ui(l,c,e.subarray(u,s)))}else{for(var h=$i[t-1],f=h>>>13,p=8191&h,g=(1<<n)-1,v=new mi(32768),m=new mi(g+1),_=Math.ceil(n/3),y=2*_,b=function(t){return(e[t]^e[t+1]<<_^e[t+2]<<y)&g},x=new _i(25e3),w=new mi(288),S=new mi(32),C=0,k=0,E=(u=0,0),R=0,M=0;u<s;++u){var L=b(u),P=32767&u,T=m[L];if(v[P]=T,m[L]=P,R<=u){var D=s-u;if((C>7e3||E>24576)&&D>423){c=Vi(e,l,0,x,w,S,k,E,M,u-M,c),E=C=k=0,M=u;for(var O=0;O<286;++O)w[O]=0;for(O=0;O<30;++O)S[O]=0}var I=2,A=0,j=p,B=P-T&32767;if(D>2&&L==b(u-B))for(var N=Math.min(f,D)-1,F=Math.min(32767,u),z=Math.min(258,D);B<=F&&--j&&P!=T;){if(e[u+I]==e[u+I-B]){for(var H=0;H<z&&e[u+H]==e[u+H-B];++H);if(H>I){if(I=H,A=B,H>N)break;var W=Math.min(B,H-2),U=0;for(O=0;O<W;++O){var V=u-B+O+32768&32767,$=V-v[V]+32768&32767;$>U&&(U=$,T=V)}}}B+=(P=T)-(T=v[P])+32768&32767}if(A){x[E++]=268435456|ki[I]<<18|Ei[A];var q=31&ki[I],K=31&Ei[A];k+=yi[q]+bi[K],++w[257+q],++S[K],R=u+I,++C}else x[E++]=e[u],++w[e[u]]}}c=Vi(e,l,o,x,w,S,k,E,M,u-M,c)}return ji(a,0,r+Ai(c)+i)}(e,null==t.level?6:t.level,null==t.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):12+t.mem,n,r,!0)}(e,t,10+((i=t).filename&&i.filename.length+1||0),8),s=o.length;return function(e,t){var n=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=t.level<2?4:9==t.level?2:0,e[9]=3,0!=t.mtime&&Ki(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),n){e[3]=8;for(var r=0;r<=n.length;++r)e[r+10]=n.charCodeAt(r)}}(o,t),Ki(o,s-8,n.d()),Ki(o,s-4,r),o}var Xi=!!f||!!h,Gi="text/plain",Zi=function(e,t,n){var r;void 0===n&&(n=!0);var[i,o]=e.split("?"),s=b({},t),a=null!==(r=null==o?void 0:o.split("&").map(e=>{var t,[r,i]=e.split("="),o=n&&null!==(t=s[r])&&void 0!==t?t:i;return delete s[r],r+"="+o}))&&void 0!==r?r:[],l=function(e,t){var n,r;void 0===t&&(t="&");var i=[];return Lt(e,function(e,t){j(e)||j(t)||"undefined"===t||(n=encodeURIComponent((e=>e instanceof File)(e)?e.name:e.toString()),r=encodeURIComponent(t),i[i.length]=r+"="+n)}),i.join(t)}(s);return l&&a.push(l),i+"?"+a.join("&")},Ji=(e,t)=>JSON.stringify(e,(e,t)=>"bigint"==typeof t?t.toString():t,t),Qi=e=>{var{data:t,compression:n}=e;if(t){if(n===gi.GZipJS){var r=Yi(function(e){var t=e.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var n=new vi(e.length+(e.length>>>1)),r=0,i=function(e){n[r++]=e},o=0;o<t;++o){if(r+5>n.length){var s=new vi(r+8+(t-o<<1));s.set(n),n=s}var a=e.charCodeAt(o);a<128?i(a):a<2048?(i(192|a>>>6),i(128|63&a)):a>55295&&a<57344?(i(240|(a=65536+(1047552&a)|1023&e.charCodeAt(++o))>>>18),i(128|a>>>12&63),i(128|a>>>6&63),i(128|63&a)):(i(224|a>>>12),i(128|a>>>6&63),i(128|63&a))}return ji(n,0,r)}(Ji(t)),{mtime:0}),i=new Blob([r],{type:Gi});return{contentType:Gi,body:i,estimatedSize:i.size}}if(n===gi.Base64){var o=function(e){var t,n,r,i,o,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",a=0,l=0,c="",u=[];if(!e)return e;e=function(e){var t,n,r,i,o="";for(t=n=0,r=(e=(e+"").replace(/\r\n/g,"\n").replace(/\r/g,"\n")).length,i=0;i<r;i++){var s=e.charCodeAt(i),a=null;s<128?n++:a=s>127&&s<2048?String.fromCharCode(s>>6|192,63&s|128):String.fromCharCode(s>>12|224,s>>6&63|128,63&s|128),F(a)||(n>t&&(o+=e.substring(t,n)),o+=a,t=n=i+1)}return n>t&&(o+=e.substring(t,e.length)),o}(e);do{t=(o=e.charCodeAt(a++)<<16|e.charCodeAt(a++)<<8|e.charCodeAt(a++))>>18&63,n=o>>12&63,r=o>>6&63,i=63&o,u[l++]=s.charAt(t)+s.charAt(n)+s.charAt(r)+s.charAt(i)}while(a<e.length);switch(c=u.join(""),e.length%3){case 1:c=c.slice(0,-2)+"==";break;case 2:c=c.slice(0,-1)+"="}return c}(Ji(t)),s=(e=>"data="+encodeURIComponent("string"==typeof e?e:Ji(e)))(o);return{contentType:"application/x-www-form-urlencoded",body:s,estimatedSize:new Blob([s]).size}}var a=Ji(t);return{contentType:"application/json",body:a,estimatedSize:new Blob([a]).size}}},eo=[];h&&eo.push({transport:"fetch",method:e=>{var t,n,{contentType:r,body:i,estimatedSize:o}=null!==(t=Qi(e))&&void 0!==t?t:{},s=new Headers;Lt(e.headers,function(e,t){s.append(t,e)}),r&&s.append("Content-Type",r);var a=e.url,l=null;if(p){var c=new p;l={signal:c.signal,timeout:setTimeout(()=>c.abort(),e.timeout)}}h(a,b({method:(null==e?void 0:e.method)||"GET",headers:s,keepalive:"POST"===e.method&&(o||0)<52428.8,body:i,signal:null==(n=l)?void 0:n.signal},e.fetchOptions)).then(t=>t.text().then(n=>{var r={statusCode:t.status,text:n};if(200===t.status)try{r.json=JSON.parse(n)}catch(e){St.error(e)}null==e.callback||e.callback(r)})).catch(t=>{St.error(t),null==e.callback||e.callback({statusCode:0,text:t})}).finally(()=>l?clearTimeout(l.timeout):null)}}),f&&eo.push({transport:"XHR",method:e=>{var t,n=new f;n.open(e.method||"GET",e.url,!0);var{contentType:r,body:i}=null!==(t=Qi(e))&&void 0!==t?t:{};Lt(e.headers,function(e,t){n.setRequestHeader(t,e)}),r&&n.setRequestHeader("Content-Type",r),e.timeout&&(n.timeout=e.timeout),e.disableXHRCredentials||(n.withCredentials=!0),n.onreadystatechange=()=>{if(4===n.readyState){var t={statusCode:n.status,text:n.responseText};if(200===n.status)try{t.json=JSON.parse(n.responseText)}catch(e){}null==e.callback||e.callback(t)}},n.send(i)}}),null!=c&&c.sendBeacon&&eo.push({transport:"sendBeacon",method:e=>{var t=Zi(e.url,{beacon:"1"});try{var n,{contentType:r,body:i}=null!==(n=Qi(e))&&void 0!==n?n:{},o="string"==typeof i?new Blob([i],{type:r}):i;c.sendBeacon(t,o)}catch(e){}}});var to=function(e,t){if(!function(e){try{new RegExp(e)}catch(e){return!1}return!0}(t))return!1;try{return new RegExp(t).test(e)}catch(e){return!1}};function no(e,t,n){return Ji({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:n})}var ro={exact:(e,t)=>t.some(t=>e.some(e=>t===e)),is_not:(e,t)=>t.every(t=>e.every(e=>t!==e)),regex:(e,t)=>t.some(t=>e.some(e=>to(t,e))),not_regex:(e,t)=>t.every(t=>e.every(e=>!to(t,e))),icontains:(e,t)=>t.map(io).some(t=>e.map(io).some(e=>t.includes(e))),not_icontains:(e,t)=>t.map(io).every(t=>e.map(io).every(e=>!t.includes(e))),gt:(e,t)=>t.some(t=>{var n=parseFloat(t);return!isNaN(n)&&e.some(e=>n>parseFloat(e))}),lt:(e,t)=>t.some(t=>{var n=parseFloat(t);return!isNaN(n)&&e.some(e=>n<parseFloat(e))})},io=e=>e.toLowerCase();function oo(e,t){return!e||Object.entries(e).every(e=>{var[n,r]=e,i=null==t?void 0:t[n];if(j(i)||F(i))return!1;var o=[String(i)],s=ro[r.operator];return!!s&&s(r.values,o)})}var so=Ct("[Error tracking]");class ao{constructor(e){var t,n;this.Zt=[],this.ti=new Qe([new dt,new xt,new ft,new ht,new yt,new _t,new gt,new bt],function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return function(t,r){void 0===r&&(r=0);for(var i=[],o=t.split("\n"),s=r;s<o.length;s++){var a=o[s];if(!(a.length>1024)){var l=ut.test(a)?a.replace(ut,"$1"):a;if(!l.match(/\S*Error: /)){for(var c of n){var u=c(l,e);if(u){i.push(u);break}}if(i.length>=50)break}}}return function(e){if(!e.length)return[];var t=Array.from(e);return t.reverse(),t.slice(0,50).map(e=>{return b({},e,{filename:e.filename||(n=t,n[n.length-1]||{}).filename,function:e.function||et});var n})}(i)}}("web:javascript",st,ct)),this._instance=e,this.Zt=null!==(t=null==(n=this._instance.persistence)?void 0:n.get_property(qt))&&void 0!==t?t:[]}onRemoteConfig(e){var t,n,r,i=null!==(t=null==(n=e.errorTracking)?void 0:n.suppressionRules)&&void 0!==t?t:[],o=null==(r=e.errorTracking)?void 0:r.captureExtensionExceptions;this.Zt=i,this._instance.persistence&&this._instance.persistence.register({[qt]:this.Zt,[Kt]:o})}get ii(){var e,t=!!this._instance.get_property(Kt),n=this._instance.config.error_tracking.captureExtensionExceptions;return null!==(e=null!=n?n:t)&&void 0!==e&&e}buildProperties(e,t){return this.ti.buildFromUnknown(e,{syntheticException:null==t?void 0:t.syntheticException,mechanism:{handled:null==t?void 0:t.handled}})}sendExceptionEvent(e){var t=e.$exception_list;if(this.ei(t)){if(this.ri(t))return void so.info("Skipping exception capture because a suppression rule matched");if(!this.ii&&this.si(t))return void so.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.ni(t))return void so.info("Skipping exception capture because it was thrown by the PostHog SDK")}return this._instance.capture("$exception",e,{_noTruncate:!0,_batchKey:"exceptionEvent"})}ri(e){if(0===e.length)return!1;var t=e.reduce((e,t)=>{var{type:n,value:r}=t;return B(n)&&n.length>0&&e.$exception_types.push(n),B(r)&&r.length>0&&e.$exception_values.push(r),e},{$exception_types:[],$exception_values:[]});return this.Zt.some(e=>{var n=e.values.map(e=>{var n,r=ro[e.operator],i=D(e.value)?e.value:[e.value],o=null!==(n=t[e.key])&&void 0!==n?n:[];return i.length>0&&r(i,o)});return"OR"===e.type?n.some(Boolean):n.every(Boolean)})}si(e){return e.flatMap(e=>{var t,n;return null!==(t=null==(n=e.stacktrace)?void 0:n.frames)&&void 0!==t?t:[]}).some(e=>e.filename&&e.filename.startsWith("chrome-extension://"))}ni(e){if(e.length>0){var t,n,r,i,o=null!==(t=null==(n=e[0].stacktrace)?void 0:n.frames)&&void 0!==t?t:[],s=o[o.length-1];return null!==(r=null==s||null==(i=s.filename)?void 0:i.includes("posthog.com/static"))&&void 0!==r&&r}return!1}ei(e){return!z(e)&&D(e)}}var lo=Ct("[FeatureFlags]"),co=Ct("[FeatureFlags]",{debugEnabled:!0}),uo="$active_feature_flags",ho="$override_feature_flags",fo="$feature_flag_payloads",po="$override_feature_flag_payloads",go="$feature_flag_request_id",vo="$feature_flag_evaluated_at",mo=e=>{var t={};for(var[n,r]of Dt(e||{}))r&&(t[n]=r);return t},_o=function(e){return e.FeatureFlags="feature_flags",e.Recordings="recordings",e}({});class yo{constructor(e){this.oi=!1,this.ai=!1,this.li=!1,this.ui=!1,this.hi=!1,this.di=!1,this.vi=!1,this.ci=!1,this._instance=e,this.featureFlagEventHandlers=[]}fi(){var e,t=null!==(e=this._instance.config.evaluation_contexts)&&void 0!==e?e:this._instance.config.evaluation_environments;return!this._instance.config.evaluation_environments||this._instance.config.evaluation_contexts||this.ci||(lo.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.ci=!0),null!=t&&t.length?t.filter(e=>{var t=e&&"string"==typeof e&&e.trim().length>0;return t||lo.error("Invalid evaluation context found:",e,"Expected non-empty string"),t}):[]}pi(){return this.fi().length>0}flags(){if(this._instance.config.__preview_remote_config)this.di=!0;else{var e=!this.gi&&(this._instance.config.advanced_disable_feature_flags||this._instance.config.advanced_disable_feature_flags_on_first_load);this.mi({disableFlags:e})}}get hasLoadedFlags(){return this.ai}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this._instance.get_property(rn),t=this._instance.get_property(ho),n=this._instance.get_property(po);if(!n&&!t)return e||{};var r=Pt({},e||{}),i=[...new Set([...Object.keys(n||{}),...Object.keys(t||{})])];for(var o of i){var s,a,l=r[o],c=null==t?void 0:t[o],u=j(c)?null!==(s=null==l?void 0:l.enabled)&&void 0!==s&&s:!!c,d=j(c)?l.variant:"string"==typeof c?c:void 0,h=null==n?void 0:n[o],f=b({},l,{enabled:u,variant:u?null!=d?d:null==l?void 0:l.variant:void 0});u!==(null==l?void 0:l.enabled)&&(f.original_enabled=null==l?void 0:l.enabled),d!==(null==l?void 0:l.variant)&&(f.original_variant=null==l?void 0:l.variant),h&&(f.metadata=b({},null==l?void 0:l.metadata,{payload:h,original_payload:null==l||null==(a=l.metadata)?void 0:a.payload})),r[o]=f}return this.oi||(lo.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:n,finalDetails:r}),this.oi=!0),r}getFlagVariants(){var e=this._instance.get_property(tn),t=this._instance.get_property(ho);if(!t)return e||{};for(var n=Pt({},e),r=Object.keys(t),i=0;i<r.length;i++)n[r[i]]=t[r[i]];return this.oi||(lo.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:n}),this.oi=!0),n}getFlagPayloads(){var e=this._instance.get_property(fo),t=this._instance.get_property(po);if(!t)return e||{};for(var n=Pt({},e||{}),r=Object.keys(t),i=0;i<r.length;i++)n[r[i]]=t[r[i]];return this.oi||(lo.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:n}),this.oi=!0),n}reloadFeatureFlags(){this.ui||this._instance.config.advanced_disable_feature_flags||this.gi||(this.gi=setTimeout(()=>{this.mi()},5))}yi(){clearTimeout(this.gi),this.gi=void 0}ensureFlagsLoaded(){this.ai||this.li||this.gi||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.ui=e}mi(e){var t;if(this.yi(),!this._instance.O())if(this.li)this.hi=!0;else{var n=this._instance.config.token,r=this._instance.get_property("$device_id"),i={token:n,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:b({},(null==(t=this._instance.persistence)?void 0:t.get_initial_props())||{},this._instance.get_property(on)||{}),group_properties:this._instance.get_property(sn)};F(r)||j(r)||(i.$device_id=r),(null!=e&&e.disableFlags||this._instance.config.advanced_disable_feature_flags)&&(i.disable_flags=!0),this.pi()&&(i.evaluation_contexts=this.fi());var o=this._instance.config.__preview_remote_config,s=o?"/flags/?v=2":"/flags/?v=2&config=true",a=this._instance.config.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":"",l=this._instance.requestRouter.endpointFor("flags",s+a);o&&(i.timezone=oi()),this.li=!0,this._instance._send_request({method:"POST",url:l,data:i,compression:this._instance.config.disable_compression?void 0:gi.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:e=>{var t,n,r=!0;if(200===e.statusCode&&(this.hi||(this.$anon_distinct_id=void 0),r=!1),this.li=!1,this.di||(this.di=!0,this._instance.bi(null!==(n=e.json)&&void 0!==n?n:{})),!i.disable_flags||this.hi)if(this.vi=!r,e.json&&null!=(t=e.json.quotaLimited)&&t.includes(_o.FeatureFlags))lo.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more.");else{var o;i.disable_flags||this.receivedFeatureFlags(null!==(o=e.json)&&void 0!==o?o:{},r),this.hi&&(this.hi=!1,this.mi())}}})}}getFeatureFlag(e,t){if(void 0===t&&(t={}),this.ai||this.getFlags()&&this.getFlags().length>0){var n=this.getFlagVariants()[e],r=""+n,i=this._instance.get_property(go)||void 0,o=this._instance.get_property(vo)||void 0,s=this._instance.get_property(ln)||{};if((t.send_event||!("send_event"in t))&&(!(e in s)||!s[e].includes(r))){var a,l,c,u,d,h,f,p,g;D(s[e])?s[e].push(r):s[e]=[r],null==(a=this._instance.persistence)||a.register({[ln]:s});var v=this.getFeatureFlagDetails(e),m={$feature_flag:e,$feature_flag_response:n,$feature_flag_payload:this.getFeatureFlagPayload(e)||null,$feature_flag_request_id:i,$feature_flag_evaluated_at:o,$feature_flag_bootstrapped_response:(null==(l=this._instance.config.bootstrap)||null==(l=l.featureFlags)?void 0:l[e])||null,$feature_flag_bootstrapped_payload:(null==(c=this._instance.config.bootstrap)||null==(c=c.featureFlagPayloads)?void 0:c[e])||null,$used_bootstrap_value:!this.vi};j(null==v||null==(u=v.metadata)?void 0:u.version)||(m.$feature_flag_version=v.metadata.version);var _,y=null!==(d=null==v||null==(h=v.reason)?void 0:h.description)&&void 0!==d?d:null==v||null==(f=v.reason)?void 0:f.code;y&&(m.$feature_flag_reason=y),null!=v&&null!=(p=v.metadata)&&p.id&&(m.$feature_flag_id=v.metadata.id),j(null==v?void 0:v.original_variant)&&j(null==v?void 0:v.original_enabled)||(m.$feature_flag_original_response=j(v.original_variant)?v.original_enabled:v.original_variant),null!=v&&null!=(g=v.metadata)&&g.original_payload&&(m.$feature_flag_original_payload=null==v||null==(_=v.metadata)?void 0:_.original_payload),this._instance.capture("$feature_flag_called",m)}return n}lo.warn('getFeatureFlag for key "'+e+"\" failed. Feature flags didn't load in time.")}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){return this.getFlagPayloads()[e]}getRemoteConfigPayload(e,t){var n=this._instance.config.token,r={distinct_id:this._instance.get_distinct_id(),token:n};this.pi()&&(r.evaluation_contexts=this.fi()),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2&config=true"),data:r,compression:this._instance.config.disable_compression?void 0:gi.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:n=>{var r,i=null==(r=n.json)?void 0:r.featureFlagPayloads;t((null==i?void 0:i[e])||void 0)}})}isFeatureEnabled(e,t){if(void 0===t&&(t={}),this.ai||this.getFlags()&&this.getFlags().length>0){var n=this.getFeatureFlag(e,t);return j(n)?void 0:!!n}lo.warn('isFeatureEnabled for key "'+e+"\" failed. Feature flags didn't load in time.")}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(t=>t!==e)}receivedFeatureFlags(e,t){if(this._instance.persistence){this.ai=!0;var n=this.getFlagVariants(),r=this.getFlagPayloads(),i=this.getFlagsWithDetails();!function(e,t,n,r,i){void 0===n&&(n={}),void 0===r&&(r={}),void 0===i&&(i={});var o=(e=>{var t=e.flags;return t?(e.featureFlags=Object.fromEntries(Object.keys(t).map(e=>{var n;return[e,null!==(n=t[e].variant)&&void 0!==n?n:t[e].enabled]})),e.featureFlagPayloads=Object.fromEntries(Object.keys(t).filter(e=>t[e].enabled).filter(e=>{var n;return null==(n=t[e].metadata)?void 0:n.payload}).map(e=>{var n;return[e,null==(n=t[e].metadata)?void 0:n.payload]}))):lo.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),e})(e),s=o.flags,a=o.featureFlags,l=o.featureFlagPayloads;if(a){var c=e.requestId,u=e.evaluatedAt;if(D(a)){lo.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var d={};if(a)for(var h=0;h<a.length;h++)d[a[h]]=!0;t&&t.register({[uo]:a,[tn]:d})}else{var f=a,p=l,g=s;e.errorsWhileComputingFlags&&(f=b({},n,f),p=b({},r,p),g=b({},i,g)),t&&t.register(b({[uo]:Object.keys(mo(f)),[tn]:f||{},[fo]:p||{},[rn]:g||{}},c?{[go]:c}:{},u?{[vo]:u}:{}))}}}(e,this._instance.persistence,n,r,i),this.wi(t)}}override(e,t){void 0===t&&(t=!1),lo.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this._instance.persistence)return lo.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(!1===e)return this._instance.persistence.unregister(ho),this._instance.persistence.unregister(po),this.wi(),co.info("All overrides cleared");if(e&&"object"==typeof e&&("flags"in e||"payloads"in e)){var t,n=e;if(this.oi=Boolean(null!==(t=n.suppressWarning)&&void 0!==t&&t),"flags"in n)if(!1===n.flags)this._instance.persistence.unregister(ho),co.info("Flag overrides cleared");else if(n.flags){if(D(n.flags)){for(var r={},i=0;i<n.flags.length;i++)r[n.flags[i]]=!0;this._instance.persistence.register({[ho]:r})}else this._instance.persistence.register({[ho]:n.flags});co.info("Flag overrides set",{flags:n.flags})}return"payloads"in n&&(!1===n.payloads?(this._instance.persistence.unregister(po),co.info("Payload overrides cleared")):n.payloads&&(this._instance.persistence.register({[po]:n.payloads}),co.info("Payload overrides set",{payloads:n.payloads}))),void this.wi()}this.wi()}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.ai){var{flags:t,flagVariants:n}=this.xi();e(t,n)}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,n){var r,i=(this._instance.get_property(nn)||[]).find(t=>t.flagKey===e),o={["$feature_enrollment/"+e]:t},s={$feature_flag:e,$feature_enrollment:t,$set:o};i&&(s.$early_access_feature_name=i.name),n&&(s.$feature_enrollment_stage=n),this._instance.capture("$feature_enrollment_update",s),this.setPersonPropertiesForFlags(o,!1);var a=b({},this.getFlagVariants(),{[e]:t});null==(r=this._instance.persistence)||r.register({[uo]:Object.keys(mo(a)),[tn]:a}),this.wi()}getEarlyAccessFeatures(e,t,n){void 0===t&&(t=!1);var r=this._instance.get_property(nn),i=n?"&"+n.map(e=>"stage="+e).join("&"):"";if(r&&!t)return e(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this._instance.config.token+i),method:"GET",callback:t=>{var n,r;if(t.json){var i=t.json.earlyAccessFeatures;return null==(n=this._instance.persistence)||n.unregister(nn),null==(r=this._instance.persistence)||r.register({[nn]:i}),e(i)}}})}xi(){var e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter(e=>t[e]),flagVariants:Object.keys(t).filter(e=>t[e]).reduce((e,n)=>(e[n]=t[n],e),{})}}wi(e){var{flags:t,flagVariants:n}=this.xi();this.featureFlagEventHandlers.forEach(r=>r(t,n,{errorsLoading:e}))}setPersonPropertiesForFlags(e,t){void 0===t&&(t=!0);var n=this._instance.get_property(on)||{};this._instance.register({[on]:b({},n,e)}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(on)}setGroupPropertiesForFlags(e,t){void 0===t&&(t=!0);var n=this._instance.get_property(sn)||{};0!==Object.keys(n).length&&Object.keys(n).forEach(t=>{n[t]=b({},n[t],e[t]),delete e[t]}),this._instance.register({[sn]:b({},n,e)}),t&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this._instance.get_property(sn)||{};this._instance.register({[sn]:b({},t,{[e]:{}})})}else this._instance.unregister(sn)}reset(){this.ai=!1,this.li=!1,this.ui=!1,this.hi=!1,this.di=!1,this.vi=!1,this.$anon_distinct_id=void 0,this.yi(),this.oi=!1}}var bo=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class xo{constructor(e,t){this.R=e,this.props={},this.Ei=!1,this.$i=(e=>{var t="";return e.token&&(t=e.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),e.persistence_name?"ph_"+e.persistence_name:"ph_"+t+"_posthog"})(e),this.Y=this.Si(e),this.load(),e.debug&&St.info("Persistence loaded",e.persistence,b({},this.props)),this.update_config(e,e,t),this.save()}isDisabled(){return!!this.ki}Si(e){-1===bo.indexOf(e.persistence.toLowerCase())&&(St.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t=function(e){void 0===e&&(e=[]);var t=[...xr,...e];return b({},br,{W:function(e){try{var t={};try{t=_r.W(e)||{}}catch(e){}var n=Pt(t,JSON.parse(br.q(e)||"{}"));return br.G(e,n),n}catch(e){}return null},G:function(e,n,r,i,o,s){try{br.G(e,n,void 0,void 0,s);var a={};t.forEach(e=>{n[e]&&(a[e]=n[e])}),Object.keys(a).length&&_r.G(e,a,r,i,o,s)}catch(e){br.B(e)}},V:function(e,t){try{null==i||i.localStorage.removeItem(e),_r.V(e,t)}catch(i){br.B(i)}}})}(e.cookie_persisted_properties||[]),n=e.persistence.toLowerCase();return"localstorage"===n&&br.H()?br:"localstorage+cookie"===n&&t.H()?t:"sessionstorage"===n&&kr.H()?kr:"memory"===n?Sr:"cookie"===n?_r:t.H()?t:_r}properties(){var e={};return Lt(this.props,function(t,n){if(n===tn&&I(t))for(var r=Object.keys(t),i=0;i<r.length;i++)e["$feature/"+r[i]]=t[r[i]];else s=n,a=!1,(F(o=_n)?a:l&&o.indexOf===l?-1!=o.indexOf(s):(Lt(o,function(e){if(a||(a=e===s))return Rt}),a))||(e[n]=t);var o,s,a}),e}load(){if(!this.ki){var e=this.Y.W(this.$i);e&&(this.props=Pt({},e))}}save(){this.ki||this.Y.G(this.$i,this.props,this.Pi,this.Ti,this.Ii,this.R.debug)}remove(){this.Y.V(this.$i,!1),this.Y.V(this.$i,!0)}clear(){this.remove(),this.props={}}register_once(e,t,n){if(I(e)){j(t)&&(t="None"),this.Pi=j(n)?this.Ci:n;var r=!1;if(Lt(e,(e,n)=>{this.props.hasOwnProperty(n)&&this.props[n]!==t||(this.props[n]=e,r=!0)}),r)return this.save(),!0}return!1}register(e,t){if(I(e)){this.Pi=j(t)?this.Ci:t;var n=!1;if(Lt(e,(t,r)=>{e.hasOwnProperty(r)&&this.props[r]!==t&&(this.props[r]=t,n=!0)}),n)return this.save(),!0}return!1}unregister(e){e in this.props&&(delete this.props[e],this.save())}update_campaign_params(){if(!this.Ei){var e=Jr(this.R.custom_campaign_params,this.R.mask_personal_data_properties,this.R.custom_personal_data_properties);A(At(e))||this.register(e),this.Ei=!0}}update_search_keyword(){var e;this.register((e=null==u?void 0:u.referrer)?ei(e):{})}update_referrer_info(){var e;this.register_once({$referrer:ni(),$referring_domain:null!=u&&u.referrer&&(null==(e=Jn(u.referrer))?void 0:e.host)||"$direct"},void 0)}set_initial_person_info(){this.props[hn]||this.props[fn]||this.register_once({[pn]:ri(this.R.mask_personal_data_properties,this.R.custom_personal_data_properties)},void 0)}get_initial_props(){var e={};Lt([fn,hn],t=>{var n=this.props[t];n&&Lt(n,function(t,n){e["$initial_"+R(n)]=t})});var t,n,r=this.props[pn];if(r){var i=(t=ii(r),n={},Lt(t,function(e,t){n["$initial_"+R(t)]=e}),n);Pt(e,i)}return e}safe_merge(e){return Lt(this.props,function(t,n){n in e||(e[n]=t)}),e}update_config(e,t,n){if(this.Ci=this.Pi=e.cookie_expiration,this.set_disabled(e.disable_persistence||!!n),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),e.persistence!==t.persistence||!((e,t)=>{if(e.length!==t.length)return!1;var n=[...e].sort(),r=[...t].sort();return n.every((e,t)=>e===r[t])})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[])){var r=this.Si(e),i=this.props;this.clear(),this.Y=r,this.props=i,this.save()}}set_disabled(e){this.ki=e,this.ki?this.remove():this.save()}set_cross_subdomain(e){e!==this.Ti&&(this.Ti=e,this.remove(),this.save())}set_secure(e){e!==this.Ii&&(this.Ii=e,this.remove(),this.save())}set_event_timer(e,t){var n=this.props[Wt]||{};n[e]=t,this.props[Wt]=n,this.save()}remove_event_timer(e){var t=(this.props[Wt]||{})[e];return j(t)||(delete this.props[Wt][e],this.save()),t}get_property(e){return this.props[e]}set_property(e,t){this.props[e]=t,this.save()}}var wo=Ct("[Product Tours]"),So="ph_product_tours";class Co{constructor(e){this.Ri=null,this.Fi=null,this._instance=e}onRemoteConfig(e){this._instance.persistence&&this._instance.persistence.register({[Gt]:!(null==e||!e.productTours)}),this.loadIfEnabled()}loadIfEnabled(){var e,t;this.Ri||(e=this._instance).config.disable_product_tours||null==(t=e.persistence)||!t.get_property(Gt)||this.it(()=>this.Mi())}it(e){var t,n;null!=(t=v.__PosthogExtensions__)&&t.generateProductTours?e():null==(n=v.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this._instance,"product-tours",t=>{t?wo.error("Could not load product tours script",t):e()})}Mi(){var e;!this.Ri&&null!=(e=v.__PosthogExtensions__)&&e.generateProductTours&&(this.Ri=v.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t){if(void 0===t&&(t=!1),!D(this.Fi)||t){var n=this._instance.persistence;if(n){var r=n.props[So];if(D(r)&&!t)return this.Fi=r,void e(r,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",callback:t=>{var r=t.statusCode;if(200!==r||!t.json){var i="Product Tours API could not be loaded, status: "+r;return wo.error(i),void e([],{isLoaded:!1,error:i})}var o=D(t.json.product_tours)?t.json.product_tours:[];this.Fi=o,n&&n.register({[So]:o}),e(o,{isLoaded:!0})}})}else e(this.Fi,{isLoaded:!0})}getActiveProductTours(e){z(this.Ri)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this.Ri.getActiveProductTours(e)}showProductTour(e){var t;null==(t=this.Ri)||t.showTourById(e)}previewTour(e){this.Ri?this.Ri.previewTour(e):this.it(()=>{var t;this.Mi(),null==(t=this.Ri)||t.previewTour(e)})}dismissProductTour(){var e;null==(e=this.Ri)||e.dismissTour("user_clicked_skip")}nextStep(){var e;null==(e=this.Ri)||e.nextStep()}previousStep(){var e;null==(e=this.Ri)||e.previousStep()}clearCache(){var e;this.Fi=null,null==(e=this._instance.persistence)||e.unregister(So)}resetTour(e){var t;null==(t=this.Ri)||t.resetTour(e)}resetAllTours(){var e;null==(e=this.Ri)||e.resetAllTours()}cancelPendingTour(e){var t;null==(t=this.Ri)||t.cancelPendingTour(e)}}var ko=function(e){return e.Activation="events",e.Cancellation="cancelEvents",e}({}),Eo=(function(e){e.Button="button",e.Tab="tab",e.Selector="selector"}({}),function(e){e.TopLeft="top_left",e.TopRight="top_right",e.TopCenter="top_center",e.MiddleLeft="middle_left",e.MiddleRight="middle_right",e.MiddleCenter="middle_center",e.Left="left",e.Center="center",e.Right="right",e.NextToTrigger="next_to_trigger"}({}),function(e){e.Top="top",e.Left="left",e.Right="right",e.Bottom="bottom"}({}),function(e){return e.Popover="popover",e.API="api",e.Widget="widget",e.ExternalSurvey="external_survey",e}({})),Ro=(function(e){e.Open="open",e.MultipleChoice="multiple_choice",e.SingleChoice="single_choice",e.Rating="rating",e.Link="link"}({}),function(e){e.NextQuestion="next_question",e.End="end",e.ResponseBased="response_based",e.SpecificQuestion="specific_question"}({}),function(e){e.Once="once",e.Recurring="recurring",e.Always="always"}({}),function(e){return e.SHOWN="survey shown",e.DISMISSED="survey dismissed",e.SENT="survey sent",e.ABANDONED="survey abandoned",e}({})),Mo=function(e){return e.SURVEY_ID="$survey_id",e.SURVEY_NAME="$survey_name",e.SURVEY_RESPONSE="$survey_response",e.SURVEY_ITERATION="$survey_iteration",e.SURVEY_ITERATION_START_DATE="$survey_iteration_start_date",e.SURVEY_PARTIALLY_COMPLETED="$survey_partially_completed",e.SURVEY_SUBMISSION_ID="$survey_submission_id",e.SURVEY_QUESTIONS="$survey_questions",e.SURVEY_COMPLETED="$survey_completed",e.PRODUCT_TOUR_ID="$product_tour_id",e.SURVEY_LAST_SEEN_DATE="$survey_last_seen_date",e}({}),Lo=function(e){return e.Popover="popover",e.Inline="inline",e}({}),Po=Ct("[Surveys]"),To="seenSurvey_",Do=(e,t)=>{var n="$survey_"+t+"/"+e.id;return e.current_iteration&&e.current_iteration>0&&(n="$survey_"+t+"/"+e.id+"/"+e.current_iteration),n},Oo=e=>((e,t)=>{var n=""+e+t.id;return t.current_iteration&&t.current_iteration>0&&(n=""+e+t.id+"_"+t.current_iteration),n})(To,e),Io=[Eo.Popover,Eo.Widget,Eo.API],Ao={ignoreConditions:!1,ignoreDelay:!1,displayType:Lo.Popover};class jo{constructor(){this.Oi={},this.Oi={}}on(e,t){return this.Oi[e]||(this.Oi[e]=[]),this.Oi[e].push(t),()=>{this.Oi[e]=this.Oi[e].filter(e=>e!==t)}}emit(e,t){for(var n of this.Oi[e]||[])n(t);for(var r of this.Oi["*"]||[])r(e,t)}}function Bo(e,t,n){if(z(e))return!1;switch(n){case"exact":return e===t;case"contains":var r=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(r,"i").test(e);case"regex":try{return new RegExp(t).test(e)}catch(e){return!1}default:return!1}}class No{constructor(e){this.Ai=new jo,this.Di=(e,t)=>this.ji(e,t)&&this.Li(e,t)&&this.Ni(e,t)&&this.Ui(e,t),this.ji=(e,t)=>null==t||!t.event||(null==e?void 0:e.event)===(null==t?void 0:t.event),this._instance=e,this.zi=new Set,this.Hi=new Set}init(){var e,t;j(null==(e=this._instance)?void 0:e._addCaptureHook)||(null==(t=this._instance)||t._addCaptureHook((e,t)=>{this.on(e,t)}))}register(e){var t,n;if(!j(null==(t=this._instance)?void 0:t._addCaptureHook)&&(e.forEach(e=>{var t,n;null==(t=this.Hi)||t.add(e),null==(n=e.steps)||n.forEach(e=>{var t;null==(t=this.zi)||t.add((null==e?void 0:e.event)||"")})}),null!=(n=this._instance)&&n.autocapture)){var r,i=new Set;e.forEach(e=>{var t;null==(t=e.steps)||t.forEach(e=>{null!=e&&e.selector&&i.add(null==e?void 0:e.selector)})}),null==(r=this._instance)||r.autocapture.setElementSelectors(i)}}on(e,t){var n;null!=t&&0!=e.length&&(this.zi.has(e)||this.zi.has(null==t?void 0:t.event))&&this.Hi&&(null==(n=this.Hi)?void 0:n.size)>0&&this.Hi.forEach(e=>{this.Bi(t,e)&&this.Ai.emit("actionCaptured",e.name)})}qi(e){this.onAction("actionCaptured",t=>e(t))}Bi(e,t){if(null==(null==t?void 0:t.steps))return!1;for(var n of t.steps)if(this.Di(e,n))return!0;return!1}onAction(e,t){return this.Ai.on(e,t)}Li(e,t){if(null!=t&&t.url){var n,r=null==e||null==(n=e.properties)?void 0:n.$current_url;if(!r||"string"!=typeof r)return!1;if(!Bo(r,t.url,t.url_matching||"contains"))return!1}return!0}Ni(e,t){return!!this.Wi(e,t)&&!!this.Gi(e,t)&&!!this.Vi(e,t)}Wi(e,t){var n;if(null==t||!t.href)return!0;var r=this.Ji(e);if(r.length>0)return r.some(e=>Bo(e.href,t.href,t.href_matching||"exact"));var i,o=(null==e||null==(n=e.properties)?void 0:n.$elements_chain)||"";return!!o&&Bo((i=o.match(/(?::|")href="(.*?)"/))?i[1]:"",t.href,t.href_matching||"exact")}Gi(e,t){var n;if(null==t||!t.text)return!0;var r=this.Ji(e);if(r.length>0)return r.some(e=>Bo(e.text,t.text,t.text_matching||"exact")||Bo(e.$el_text,t.text,t.text_matching||"exact"));var i,o,s,a=(null==e||null==(n=e.properties)?void 0:n.$elements_chain)||"";return!!a&&(i=function(e){for(var t,n=[],r=/(?::|")text="(.*?)"/g;!z(t=r.exec(e));)n.includes(t[1])||n.push(t[1]);return n}(a),o=t.text,s=t.text_matching||"exact",i.some(e=>Bo(e,o,s)))}Vi(e,t){var n,r;if(null==t||!t.selector)return!0;var i=null==e||null==(n=e.properties)?void 0:n.$element_selectors;if(null!=i&&i.includes(t.selector))return!0;var o=(null==e||null==(r=e.properties)?void 0:r.$elements_chain)||"";if(t.selector_regex&&o)try{return new RegExp(t.selector_regex).test(o)}catch(e){return!1}return!1}Ji(e){var t;return null==(null==e||null==(t=e.properties)?void 0:t.$elements)?[]:null==e?void 0:e.properties.$elements}Ui(e,t){return null==t||!t.properties||0===t.properties.length||oo(t.properties.reduce((e,t)=>{var n=D(t.value)?t.value.map(String):null!=t.value?[String(t.value)]:[];return e[t.key]={values:n,operator:t.operator||"exact"},e},{}),null==e?void 0:e.properties)}}class Fo{constructor(e){this._instance=e,this.Ki=new Map,this.Yi=new Map,this.Xi=new Map}Qi(e,t){return!!e&&oo(e.propertyFilters,null==t?void 0:t.properties)}Zi(e,t){var n=new Map;return e.forEach(e=>{var r;null==(r=e.conditions)||null==(r=r[t])||null==(r=r.values)||r.forEach(t=>{if(null!=t&&t.name){var r=n.get(t.name)||[];r.push(e.id),n.set(t.name,r)}})}),n}te(e,t,n){var r=(n===ko.Activation?this.Ki:this.Yi).get(e),i=[];return this.ie(e=>{i=e.filter(e=>null==r?void 0:r.includes(e.id))}),i.filter(r=>{var i,o=null==(i=r.conditions)||null==(i=i[n])||null==(i=i.values)?void 0:i.find(t=>t.name===e);return this.Qi(o,t)})}register(e){var t;j(null==(t=this._instance)?void 0:t._addCaptureHook)||(this.ee(e),this.re(e))}re(e){var t=e.filter(e=>{var t,n;return(null==(t=e.conditions)?void 0:t.actions)&&(null==(n=e.conditions)||null==(n=n.actions)||null==(n=n.values)?void 0:n.length)>0});0!==t.length&&(null==this.se&&(this.se=new No(this._instance),this.se.init(),this.se.qi(e=>{this.onAction(e)})),t.forEach(e=>{var t,n,r,i,o;e.conditions&&null!=(t=e.conditions)&&t.actions&&null!=(n=e.conditions)&&null!=(n=n.actions)&&n.values&&(null==(r=e.conditions)||null==(r=r.actions)||null==(r=r.values)?void 0:r.length)>0&&(null==(i=this.se)||i.register(e.conditions.actions.values),null==(o=e.conditions)||null==(o=o.actions)||null==(o=o.values)||o.forEach(t=>{if(t&&t.name){var n=this.Xi.get(t.name);n&&n.push(e.id),this.Xi.set(t.name,n||[e.id])}}))}))}ee(e){var t,n=e.filter(e=>{var t,n;return(null==(t=e.conditions)?void 0:t.events)&&(null==(n=e.conditions)||null==(n=n.events)||null==(n=n.values)?void 0:n.length)>0}),r=e.filter(e=>{var t,n;return(null==(t=e.conditions)?void 0:t.cancelEvents)&&(null==(n=e.conditions)||null==(n=n.cancelEvents)||null==(n=n.values)?void 0:n.length)>0});0===n.length&&0===r.length||(null==(t=this._instance)||t._addCaptureHook((e,t)=>{this.onEvent(e,t)}),this.Ki=this.Zi(e,ko.Activation),this.Yi=this.Zi(e,ko.Cancellation))}onEvent(e,t){var n,r=this.ne(),i=this.oe(),o=this.ae(),s=(null==(n=this._instance)||null==(n=n.persistence)?void 0:n.props[i])||[];if(o===e&&t&&s.length>0){var a,l;r.info("event matched, removing item from activated items",{event:e,eventPayload:t,existingActivatedItems:s});var c=(null==t||null==(a=t.properties)?void 0:a.$survey_id)||(null==t||null==(l=t.properties)?void 0:l.$product_tour_id);if(c){var u=s.indexOf(c);u>=0&&(s.splice(u,1),this.le(s))}}else{if(this.Yi.has(e)){var d=this.te(e,t,ko.Cancellation);d.length>0&&(r.info("cancel event matched, cancelling items",{event:e,itemsToCancel:d.map(e=>e.id)}),d.forEach(e=>{var t=s.indexOf(e.id);t>=0&&s.splice(t,1),this.ue(e.id)}),this.le(s))}if(this.Ki.has(e)){r.info("event name matched",{event:e,eventPayload:t,items:this.Ki.get(e)});var h=this.te(e,t,ko.Activation);this.le(s.concat(h.map(e=>e.id)||[]))}}}onAction(e){var t,n=this.oe(),r=(null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[n])||[];this.Xi.has(e)&&this.le(r.concat(this.Xi.get(e)||[]))}le(e){var t,n=this.ne(),r=this.oe(),i=[...new Set(e)].filter(e=>!this.he(e));n.info("updating activated items",{activatedItems:i}),null==(t=this._instance)||null==(t=t.persistence)||t.register({[r]:i})}getActivatedIds(){var e,t=this.oe();return(null==(e=this._instance)||null==(e=e.persistence)?void 0:e.props[t])||[]}getEventToItemsMap(){return this.Ki}de(){return this.se}}class zo extends Fo{constructor(e){super(e)}oe(){return"$surveys_activated"}ae(){return Ro.SHOWN}ie(e){var t;null==(t=this._instance)||t.getSurveys(e)}ue(e){var t;null==(t=this._instance)||t.cancelPendingSurvey(e)}ne(){return Po}he(){return!1}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}class Ho{constructor(e){this.ve=void 0,this._surveyManager=null,this.ce=!1,this.fe=[],this.pe=null,this._instance=e,this._surveyEventReceiver=null}onRemoteConfig(e){if(!this._instance.config.disable_surveys){var t=e.surveys;if(z(t))return Po.warn("Flags not loaded yet. Not loading surveys.");var n=D(t);this.ve=n?t.length>0:t,Po.info("flags response received, isSurveysEnabled: "+this.ve),this.loadIfEnabled()}}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var e=[],t=0;t<localStorage.length;t++){var n=localStorage.key(t);(null!=n&&n.startsWith(To)||null!=n&&n.startsWith("inProgressSurvey_"))&&e.push(n)}e.forEach(e=>localStorage.removeItem(e))}loadIfEnabled(){if(!this._surveyManager)if(this.ce)Po.info("Already initializing surveys, skipping...");else if(this._instance.config.disable_surveys)Po.info("Disabled. Not loading surveys.");else if(this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())Po.info("Not loading surveys in cookieless mode without consent.");else{var e=null==v?void 0:v.__PosthogExtensions__;if(e){if(!j(this.ve)||this._instance.config.advanced_enable_surveys){var t=this.ve||this._instance.config.advanced_enable_surveys;this.ce=!0;try{var n=e.generateSurveys;if(n)return void this.ge(n,t);var r=e.loadExternalDependency;if(!r)return void this._e("PostHog loadExternalDependency extension not found.");r(this._instance,"surveys",n=>{n||!e.generateSurveys?this._e("Could not load surveys script",n):this.ge(e.generateSurveys,t)})}catch(e){throw this._e("Error initializing surveys",e),e}finally{this.ce=!1}}}else Po.error("PostHog Extensions not found.")}}ge(e,t){this._surveyManager=e(this._instance,t),this._surveyEventReceiver=new zo(this._instance),Po.info("Surveys loaded successfully"),this.me({isLoaded:!0})}_e(e,t){Po.error(e,t),this.me({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.fe.push(e),this._surveyManager&&this.me({isLoaded:!0}),()=>{this.fe=this.fe.filter(t=>t!==e)}}getSurveys(e,t){if(void 0===t&&(t=!1),this._instance.config.disable_surveys)return Po.info("Disabled. Not loading surveys."),e([]);var n,r=this._instance.get_property(an);if(r&&!t)return e(r,{isLoaded:!0});"undefined"!=typeof Promise&&this.pe?this.pe.then(t=>{var{surveys:n,context:r}=t;return e(n,r)}):("undefined"!=typeof Promise&&(this.pe=new Promise(e=>{n=e})),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this._instance.config.token),method:"GET",timeout:this._instance.config.surveys_request_timeout_ms,callback:t=>{var r;this.pe=null;var i=t.statusCode;if(200!==i||!t.json){var o="Surveys API could not be loaded, status: "+i;Po.error(o);var s={isLoaded:!1,error:o};return e([],s),void(null==n||n({surveys:[],context:s}))}var a,l=t.json.surveys||[],c=l.filter(e=>function(e){return!(!e.start_date||e.end_date)}(e)&&(function(e){var t;return!(null==(t=e.conditions)||null==(t=t.events)||null==(t=t.values)||!t.length)}(e)||function(e){var t;return!(null==(t=e.conditions)||null==(t=t.actions)||null==(t=t.values)||!t.length)}(e)));c.length>0&&(null==(a=this._surveyEventReceiver)||a.register(c)),null==(r=this._instance.persistence)||r.register({[an]:l});var u={isLoaded:!0};e(l,u),null==n||n({surveys:l,context:u})}}))}me(e){for(var t of this.fe)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(e){Po.error("Error in survey callback",e)}}getActiveMatchingSurveys(e,t){if(void 0===t&&(t=!1),!z(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);Po.warn("init was not called")}ye(e){var t=null;return this.getSurveys(n=>{var r;t=null!==(r=n.find(t=>t.id===e))&&void 0!==r?r:null}),t}be(e){if(z(this._surveyManager))return{eligible:!1,reason:"SDK is not enabled or survey functionality is not yet loaded"};var t="string"==typeof e?this.ye(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(z(this._surveyManager))return Po.warn("init was not called"),{visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"};var t=this.be(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return z(this._surveyManager)?(Po.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"})):new Promise(n=>{this.getSurveys(t=>{var r,i=null!==(r=t.find(t=>t.id===e))&&void 0!==r?r:null;if(i){var o=this.be(i);n({visible:o.eligible,disabledReason:o.reason})}else n({visible:!1,disabledReason:"Survey not found"})},t)})}renderSurvey(e,t,n){var r;if(z(this._surveyManager))Po.warn("init was not called");else{var i="string"==typeof e?this.ye(e):e;if(null!=i&&i.id)if(Io.includes(i.type)){var o=null==u?void 0:u.querySelector(t);if(o)return null!=(r=i.appearance)&&r.surveyPopupDelaySeconds?(Po.info("Rendering survey "+i.id+" with delay of "+i.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout(()=>{var e,t;Po.info("Rendering survey "+i.id+" with delay of "+(null==(e=i.appearance)?void 0:e.surveyPopupDelaySeconds)+" seconds"),null==(t=this._surveyManager)||t.renderSurvey(i,o,n),Po.info("Survey "+i.id+" rendered")},1e3*i.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(i,o,n);Po.warn("Survey element not found")}else Po.warn("Surveys of type "+i.type+" cannot be rendered in the app");else Po.warn("Survey not found")}}displaySurvey(e,t){var n;if(z(this._surveyManager))Po.warn("init was not called");else{var r=this.ye(e);if(r){var i=r;if(null!=(n=r.appearance)&&n.surveyPopupDelaySeconds&&t.ignoreDelay&&(i=b({},r,{appearance:b({},r.appearance,{surveyPopupDelaySeconds:0})})),t.displayType!==Lo.Popover&&t.initialResponses&&Po.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===t.ignoreConditions){var o=this.canRenderSurvey(r);if(!o.visible)return void Po.warn("Survey is not eligible to be displayed: ",o.disabledReason)}t.displayType!==Lo.Inline?this._surveyManager.handlePopoverSurvey(i,t):this.renderSurvey(i,t.selector,t.properties)}else Po.warn("Survey not found")}}cancelPendingSurvey(e){z(this._surveyManager)?Po.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e;null==(e=this._surveyManager)||e.handlePageUnload()}}var Wo=Ct("[Conversations]");class Uo{constructor(e){this.we=void 0,this._conversationsManager=null,this.xe=!1,this.Ee=null,this._instance=e}onRemoteConfig(e){if(!this._instance.config.disable_conversations){var t=e.conversations;z(t)||(U(t)?this.we=t:(this.we=t.enabled,this.Ee=t),this.loadIfEnabled())}}reset(){var e;null==(e=this._conversationsManager)||e.reset(),this._conversationsManager=null,this.we=void 0,this.Ee=null}loadIfEnabled(){if(!this._conversationsManager&&!this.xe&&!(this._instance.config.disable_conversations||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var e=null==v?void 0:v.__PosthogExtensions__;if(e&&!j(this.we)&&this.we)if(this.Ee&&this.Ee.token){this.xe=!0;try{var t=e.initConversations;if(t)return this.$e(t),void(this.xe=!1);var n=e.loadExternalDependency;if(!n)return void this.Se("PostHog loadExternalDependency extension not found.");n(this._instance,"conversations",t=>{t||!e.initConversations?this.Se("Could not load conversations script",t):this.$e(e.initConversations),this.xe=!1})}catch(e){this.Se("Error initializing conversations",e),this.xe=!1}}else Wo.error("Conversations enabled but missing token in remote config.")}}$e(e){if(this.Ee)try{this._conversationsManager=e(this.Ee,this._instance),Wo.info("Conversations loaded successfully")}catch(e){this.Se("Error completing conversations initialization",e)}else Wo.error("Cannot complete initialization: remote config is null")}Se(e,t){Wo.error(e,t),this._conversationsManager=null,this.xe=!1}show(){this._conversationsManager?this._conversationsManager.show():Wo.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this.we&&!F(this._conversationsManager)}isVisible(){var e,t;return null!==(e=null==(t=this._conversationsManager)?void 0:t.isVisible())&&void 0!==e&&e}sendMessage(e,t,n){var r=this;return y(function*(){return r._conversationsManager?r._conversationsManager.sendMessage(e,t,n):(Wo.warn("Conversations not available yet."),null)})()}getMessages(e,t){var n=this;return y(function*(){return n._conversationsManager?n._conversationsManager.getMessages(e,t):(Wo.warn("Conversations not available yet."),null)})()}markAsRead(e){var t=this;return y(function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(Wo.warn("Conversations not available yet."),null)})()}getTickets(e){var t=this;return y(function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(Wo.warn("Conversations not available yet."),null)})()}getCurrentTicketId(){var e,t;return null!==(e=null==(t=this._conversationsManager)?void 0:t.getCurrentTicketId())&&void 0!==e?e:null}getWidgetSessionId(){var e,t;return null!==(e=null==(t=this._conversationsManager)?void 0:t.getWidgetSessionId())&&void 0!==e?e:null}}class Vo{constructor(e){var t;this.ke=!1,this.Pe=!1,this._instance=e,this._instance&&null!=(t=this._instance.config.logs)&&t.captureConsoleLogs&&(this.ke=!0)}onRemoteConfig(e){var t,n=null==(t=e.logs)?void 0:t.captureConsoleLogs;!z(n)&&n&&(this.ke=!0,this.loadIfEnabled())}reset(){}loadIfEnabled(){if(this.ke&&!this.Pe){var e=Ct("[logs]"),t=null==v?void 0:v.__PosthogExtensions__;if(t){var n=t.loadExternalDependency;n?n(this._instance,"logs",n=>{var r;n||null==(r=t.logs)||!r.initializeLogs?e.error("Could not load logs script",n):(t.logs.initializeLogs(this._instance),this.Pe=!0)}):e.error("PostHog loadExternalDependency extension not found.")}else e.error("PostHog Extensions not found.")}}}var $o=Ct("[RateLimiter]");class qo{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=e=>{var t=e.text;if(t&&t.length)try{(JSON.parse(t).quota_limited||[]).forEach(e=>{$o.info((e||"events")+" is quota limited."),this.serverLimits[e]=(new Date).getTime()+6e4})}catch(e){return void $o.warn('could not rate limit - continuing. Error: "'+(null==e?void 0:e.message)+'"',{text:t})}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var e;return(null==(e=this.instance.config.rate_limiting)?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max((null==(e=this.instance.config.rate_limiting)?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e){var t,n,r;void 0===e&&(e=!1);var{captureEventsBurstLimit:i,captureEventsPerSecond:o}=this,s=(new Date).getTime(),a=null!==(t=null==(n=this.instance.persistence)?void 0:n.get_property(dn))&&void 0!==t?t:{tokens:i,last:s};a.tokens+=(s-a.last)/1e3*o,a.last=s,a.tokens>i&&(a.tokens=i);var l=a.tokens<1;return l||e||(a.tokens=Math.max(0,a.tokens-1)),!l||this.lastEventRateLimited||e||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+o+" events per second and "+i+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=l,null==(r=this.instance.persistence)||r.set_property(dn,a),{isRateLimited:l,remainingTokens:a.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return!1!==t&&(new Date).getTime()<t}}var Ko=Ct("[RemoteConfig]");class Yo{constructor(e){this._instance=e}get remoteConfig(){var e;return null==(e=v._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.config}Te(e){var t,n;null!=(t=v.__PosthogExtensions__)&&t.loadExternalDependency?null==(n=v.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this._instance,"remote-config",()=>e(this.remoteConfig)):(Ko.error("PostHog Extensions not found. Cannot load remote config."),e())}Ie(e){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback:t=>{e(t.json)}})}load(){try{if(this.remoteConfig)return Ko.info("Using preloaded remote config",this.remoteConfig),void this.bi(this.remoteConfig);if(this._instance.O())return void Ko.warn("Remote config is disabled. Falling back to local config.");this.Te(e=>{if(!e)return Ko.info("No config found after loading remote JS config. Falling back to JSON."),void this.Ie(e=>{this.bi(e)});this.bi(e)})}catch(i){Ko.error("Error loading remote config",i)}}bi(e){e?this._instance.config.__preview_remote_config?(this._instance.bi(e),!1!==e.hasFeatureFlags&&this._instance.featureFlags.ensureFlagsLoaded()):Ko.info("__preview_remote_config is disabled. Logging config instead",e):Ko.error("Failed to fetch remote config from PostHog.")}}var Xo=3e3;class Go{constructor(e,t){this.Ce=!0,this.Re=[],this.Fe=Z((null==t?void 0:t.flush_interval_ms)||Xo,250,5e3,St.createLogger("flush interval"),Xo),this.Me=e}enqueue(e){this.Re.push(e),this.Oe||this.Ae()}unload(){this.De();var e=this.Re.length>0?this.je():{},t=Object.values(e);[...t.filter(e=>0===e.url.indexOf("/e")),...t.filter(e=>0!==e.url.indexOf("/e"))].map(e=>{this.Me(b({},e,{transport:"sendBeacon"}))})}enable(){this.Ce=!1,this.Ae()}Ae(){var e=this;this.Ce||(this.Oe=setTimeout(()=>{if(this.De(),this.Re.length>0){var t=this.je(),n=function(){var n=t[r],i=(new Date).getTime();n.data&&D(n.data)&&Lt(n.data,e=>{e.offset=Math.abs(e.timestamp-i),delete e.timestamp}),e.Me(n)};for(var r in t)n()}},this.Fe))}De(){clearTimeout(this.Oe),this.Oe=void 0}je(){var e={};return Lt(this.Re,t=>{var n,r=t,i=(r?r.batchKey:null)||r.url;j(e[i])&&(e[i]=b({},r,{data:[]})),null==(n=e[i].data)||n.push(r.data)}),this.Re=[],e}}var Zo=["retriesPerformedSoFar"];class Jo{constructor(e){this.Le=!1,this.Ne=3e3,this.Re=[],this._instance=e,this.Re=[],this.Ue=!0,!j(i)&&"onLine"in i.navigator&&(this.Ue=i.navigator.onLine,this.ze=()=>{this.Ue=!0,this.Lt()},this.He=()=>{this.Ue=!1},Ft(i,"online",this.ze),Ft(i,"offline",this.He))}get length(){return this.Re.length}retriableRequest(e){var{retriesPerformedSoFar:t}=e,n=x(e,Zo);W(t)&&(n.url=Zi(n.url,{retry_count:t})),this._instance._send_request(b({},n,{callback:e=>{200!==e.statusCode&&(e.statusCode<400||e.statusCode>=500)&&(null!=t?t:0)<10?this.Be(b({retriesPerformedSoFar:t},n)):null==n.callback||n.callback(e)}}))}Be(e){var t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;var n=function(e){var t=3e3*Math.pow(2,e),n=t/2,r=Math.min(18e5,t),i=(Math.random()-.5)*(r-n);return Math.ceil(r+i)}(t),r=Date.now()+n;this.Re.push({retryAt:r,requestOptions:e});var i="Enqueued failed request for retry in "+n;navigator.onLine||(i+=" (Browser is offline)"),St.warn(i),this.Le||(this.Le=!0,this.qe())}qe(){if(this.We&&clearTimeout(this.We),0===this.Re.length)return this.Le=!1,void(this.We=void 0);this.We=setTimeout(()=>{this.Ue&&this.Re.length>0&&this.Lt(),this.qe()},this.Ne)}Lt(){var e=Date.now(),t=[],n=this.Re.filter(n=>n.retryAt<e||(t.push(n),!1));if(this.Re=t,n.length>0)for(var{requestOptions:r}of n)this.retriableRequest(r)}unload(){for(var{requestOptions:e}of(this.We&&(clearTimeout(this.We),this.We=void 0),this.Le=!1,j(i)||(this.ze&&(i.removeEventListener("online",this.ze),this.ze=void 0),this.He&&(i.removeEventListener("offline",this.He),this.He=void 0)),this.Re))try{this._instance._send_request(b({},e,{transport:"sendBeacon"}))}catch(i){St.error(i)}this.Re=[]}}class Qo{constructor(e){this.Ge=()=>{var e,t,n,r;this.Ve||(this.Ve={});var i=this.scrollElement(),o=this.scrollY(),s=i?Math.max(0,i.scrollHeight-i.clientHeight):0,a=o+((null==i?void 0:i.clientHeight)||0),l=(null==i?void 0:i.scrollHeight)||0;this.Ve.lastScrollY=Math.ceil(o),this.Ve.maxScrollY=Math.max(o,null!==(e=this.Ve.maxScrollY)&&void 0!==e?e:0),this.Ve.maxScrollHeight=Math.max(s,null!==(t=this.Ve.maxScrollHeight)&&void 0!==t?t:0),this.Ve.lastContentY=a,this.Ve.maxContentY=Math.max(a,null!==(n=this.Ve.maxContentY)&&void 0!==n?n:0),this.Ve.maxContentHeight=Math.max(l,null!==(r=this.Ve.maxContentHeight)&&void 0!==r?r:0)},this._instance=e}getContext(){return this.Ve}resetContext(){var e=this.Ve;return setTimeout(this.Ge,0),e}startMeasuringScrollPosition(){Ft(i,"scroll",this.Ge,{capture:!0}),Ft(i,"scrollend",this.Ge,{capture:!0}),Ft(i,"resize",this.Ge)}scrollElement(){if(!this._instance.config.scroll_root_selector)return null==i?void 0:i.document.documentElement;var e=D(this._instance.config.scroll_root_selector)?this._instance.config.scroll_root_selector:[this._instance.config.scroll_root_selector];for(var t of e){var n=null==i?void 0:i.document.querySelector(t);if(n)return n}}scrollY(){if(this._instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollTop||0}return i&&(i.scrollY||i.pageYOffset||i.document.documentElement.scrollTop)||0}scrollX(){if(this._instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollLeft||0}return i&&(i.scrollX||i.pageXOffset||i.document.documentElement.scrollLeft)||0}}var es=e=>ri(null==e?void 0:e.config.mask_personal_data_properties,null==e?void 0:e.config.custom_personal_data_properties);class ts{constructor(e,t,n,r){this.Je=e=>{var t=this.Ke();if(!t||t.sessionId!==e){var n={sessionId:e,props:this.Ye(this._instance)};this.Xe.register({[un]:n})}},this._instance=e,this.Qe=t,this.Xe=n,this.Ye=r||es,this.Qe.onSessionId(this.Je)}Ke(){return this.Xe.props[un]}getSetOnceProps(){var e,t=null==(e=this.Ke())?void 0:e.props;return t?"r"in t?ii(t):{$referring_domain:t.referringDomain,$pathname:t.initialPathName,utm_source:t.utm_source,utm_campaign:t.utm_campaign,utm_medium:t.utm_medium,utm_content:t.utm_content,utm_term:t.utm_term}:{}}getSessionProps(){var e={};return Lt(At(this.getSetOnceProps()),(t,n)=>{"$current_url"===n&&(n="url"),e["$session_entry_"+R(n)]=t}),e}}var ns=Ct("[SessionId]");class rs{on(e,t){return this.Ze.on(e,t)}constructor(e,t,n){var r;if(this.tr=[],this.ir=void 0,this.Ze=new jo,this.er=(e,t)=>!(!W(e)||!W(t))&&Math.abs(e-t)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if("always"===e.config.cookieless_mode)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.R=e.config,this.Xe=e.persistence,this.rr=void 0,this.sr=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.nr=t||pr,this.ar=n||pr;var i=this.R.persistence_name||this.R.token,o=this.R.session_idle_timeout_seconds||1800;if(this._sessionTimeoutMs=1e3*Z(o,60,36e3,ns.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.lr(),this.ur="ph_"+i+"_window_id",this.hr="ph_"+i+"_primary_window_exists",this.dr()){var s=kr.W(this.ur),a=kr.W(this.hr);s&&!a?this.rr=s:kr.V(this.ur),kr.G(this.hr,!0)}if(null!=(r=this.R.bootstrap)&&r.sessionID)try{var l=(()=>{var e=this.R.bootstrap.sessionID.replace(/-/g,"");if(32!==e.length)throw new Error("Not a valid UUID");if("7"!==e[12])throw new Error("Not a UUIDv7");return parseInt(e.substring(0,12),16)})();this.vr(this.R.bootstrap.sessionID,(new Date).getTime(),l)}catch(e){ns.error("Invalid sessionID in bootstrap",e)}this.cr()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return j(this.tr)&&(this.tr=[]),this.tr.push(e),this.sr&&e(this.sr,this.rr),()=>{this.tr=this.tr.filter(t=>t!==e)}}dr(){return"memory"!==this.R.persistence&&!this.Xe.ki&&kr.H()}pr(e){e!==this.rr&&(this.rr=e,this.dr()&&kr.G(this.ur,e))}gr(){return this.rr?this.rr:this.dr()?kr.W(this.ur):null}vr(e,t,n){e===this.sr&&t===this._sessionActivityTimestamp&&n===this._sessionStartTimestamp||(this._sessionStartTimestamp=n,this._sessionActivityTimestamp=t,this.sr=e,this.Xe.register({[Qt]:[t,e,n]}))}_r(){var e=this.Xe.props[Qt];return D(e)&&2===e.length&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.vr(null,null,null)}destroy(){clearTimeout(this.mr),this.mr=void 0,this.ir&&i&&(i.removeEventListener("beforeunload",this.ir,{capture:!1}),this.ir=void 0),this.tr=[]}cr(){this.ir=()=>{this.dr()&&kr.V(this.hr)},Ft(i,"beforeunload",this.ir,{capture:!1})}checkAndGetSessionAndWindowId(e,t){if(void 0===e&&(e=!1),void 0===t&&(t=null),"always"===this.R.cookieless_mode)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var n=t||(new Date).getTime(),[r,i,o]=this._r(),s=this.gr(),a=W(o)&&Math.abs(n-o)>864e5,l=!1,c=!i,u=!c&&!e&&this.er(n,r);c||u||a?(i=this.nr(),s=this.ar(),ns.info("new session ID generated",{sessionId:i,windowId:s,changeReason:{noSessionId:c,activityTimeout:u,sessionPastMaximumLength:a}}),o=n,l=!0):s||(s=this.ar(),l=!0);var d=W(r)&&e&&!a?r:n,h=W(o)?o:(new Date).getTime();return this.pr(s),this.vr(i,d,h),e||this.lr(),l&&this.tr.forEach(e=>e(i,s,l?{noSessionId:c,activityTimeout:u,sessionPastMaximumLength:a}:void 0)),{sessionId:i,windowId:s,sessionStartTimestamp:h,changeReason:l?{noSessionId:c,activityTimeout:u,sessionPastMaximumLength:a}:void 0,lastActivityTimestamp:r}}lr(){clearTimeout(this.mr),this.mr=setTimeout(()=>{var[e]=this._r();if(this.er((new Date).getTime(),e)){var t=this.sr;this.resetSessionId(),this.Ze.emit("forcedIdleReset",{idleSessionId:t})}},1.1*this.sessionTimeoutMs)}}var is=["$set_once","$set"],os=Ct("[SiteApps]");class ss{constructor(e){this._instance=e,this.yr=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}br(e,t){if(t){var n=this.globalsForEvent(t);this.yr.push(n),this.yr.length>1e3&&(this.yr=this.yr.slice(10))}}get siteAppLoaders(){var e;return null==(e=v._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.siteApps}init(){if(this.isEnabled){var e=this._instance._addCaptureHook(this.br.bind(this));this.wr=()=>{e(),this.yr=[],this.wr=void 0}}}globalsForEvent(e){var t,n,r,i,o,s,a;if(!e)throw new Error("Event payload is required");var l={},c=this._instance.get_property("$groups")||[],u=this._instance.get_property("$stored_group_properties")||{};for(var[d,h]of Object.entries(u))l[d]={id:c[d],type:d,properties:h};var{$set_once:f,$set:p}=e;return{event:b({},x(e,is),{properties:b({},e.properties,p?{$set:b({},null!==(t=null==(n=e.properties)?void 0:n.$set)&&void 0!==t?t:{},p)}:{},f?{$set_once:b({},null!==(r=null==(i=e.properties)?void 0:i.$set_once)&&void 0!==r?r:{},f)}:{}),elements_chain:null!==(o=null==(s=e.properties)?void 0:s.$elements_chain)&&void 0!==o?o:"",distinct_id:null==(a=e.properties)?void 0:a.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:l}}setupSiteApp(e){var t=this.apps[e.id],n=()=>{var n;!t.errored&&this.yr.length&&(os.info("Processing "+this.yr.length+" events for site app with id "+e.id),this.yr.forEach(e=>null==t.processEvent?void 0:t.processEvent(e)),t.processedBuffer=!0),Object.values(this.apps).every(e=>e.processedBuffer||e.errored)&&(null==(n=this.wr)||n.call(this))},r=!1,i=i=>{t.errored=!i,t.loaded=!0,os.info("Site app with id "+e.id+" "+(i?"loaded":"errored")),r&&n()};try{var{processEvent:o}=e.init({posthog:this._instance,callback:e=>{i(e)}});o&&(t.processEvent=o),r=!0}catch(t){os.error("Error while initializing PostHog app with config id "+e.id,t),i(!1)}if(r&&t.loaded)try{n()}catch(n){os.error("Error while processing buffered events PostHog app with config id "+e.id,n),t.errored=!0}}Er(){var e=this.siteAppLoaders||[];for(var t of e)this.apps[t.id]={id:t.id,loaded:!1,errored:!1,processedBuffer:!1};for(var n of e)this.setupSiteApp(n)}$r(e){if(0!==Object.keys(this.apps).length){var t=this.globalsForEvent(e);for(var n of Object.values(this.apps))try{null==n.processEvent||n.processEvent(t)}catch(t){os.error("Error while processing event "+e.event+" for site app "+n.id,t)}}}onRemoteConfig(e){var t,n,r,i=this;if(null!=(t=this.siteAppLoaders)&&t.length)return this.isEnabled?(this.Er(),void this._instance.on("eventCaptured",e=>this.$r(e))):void os.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(n=this.wr)||n.call(this),null!=(r=e.siteApps)&&r.length)if(this.isEnabled){var o=function(e){var t;v["__$$ph_site_app_"+e]=i._instance,null==(t=v.__PosthogExtensions__)||null==t.loadSiteApp||t.loadSiteApp(i._instance,a,t=>{if(t)return os.error("Error while initializing PostHog app with config id "+e,t)})};for(var{id:s,url:a}of e.siteApps)o(s)}else os.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}var as=function(e,t){if(!e)return!1;var n=e.userAgent;if(n&&S(n,t))return!0;try{var r=null==e?void 0:e.userAgentData;if(null!=r&&r.brands&&r.brands.some(e=>S(null==e?void 0:e.brand,t)))return!0}catch(e){}return!!e.webdriver},ls=function(e){return e.US="us",e.EU="eu",e.CUSTOM="custom",e}({}),cs="i.posthog.com";class us{constructor(e){this.Sr={},this.instance=e}get apiHost(){var e=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===e?"https://us.i.posthog.com":e}get flagsApiHost(){var e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var e,t=null==(e=this.instance.config.ui_host)?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace("."+cs,".posthog.com")),"https://app.posthog.com"===t?"https://us.posthog.com":t}get region(){return this.Sr[this.apiHost]||(/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.Sr[this.apiHost]=ls.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.Sr[this.apiHost]=ls.EU:this.Sr[this.apiHost]=ls.CUSTOM),this.Sr[this.apiHost]}endpointFor(e,t){if(void 0===t&&(t=""),t&&(t="/"===t[0]?t:"/"+t),"ui"===e)return this.uiHost+t;if("flags"===e)return this.flagsApiHost+t;if(this.region===ls.CUSTOM)return this.apiHost+t;var n=cs+t;switch(e){case"assets":return"https://"+this.region+"-assets."+n;case"api":return"https://"+this.region+"."+n}}}var ds={icontains:(e,t)=>!!i&&t.href.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>!!i&&-1===t.href.toLowerCase().indexOf(e.toLowerCase()),regex:(e,t)=>!!i&&to(t.href,e),not_regex:(e,t)=>!!i&&!to(t.href,e),exact:(e,t)=>t.href===e,is_not:(e,t)=>t.href!==e};class hs{constructor(e){var t=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(e){void 0===e&&(e=!1),t.getWebExperiments(e=>{hs.kr("retrieved web experiments from the server"),t.Pr=new Map,e.forEach(e=>{if(e.feature_flag_key){var n;t.Pr&&(hs.kr("setting flag key ",e.feature_flag_key," to web experiment ",e),null==(n=t.Pr)||n.set(e.feature_flag_key,e));var r=t._instance.getFeatureFlag(e.feature_flag_key);B(r)&&e.variants[r]&&t.Tr(e.name,r,e.variants[r].transforms)}else if(e.variants)for(var i in e.variants){var o=e.variants[i];hs.Ir(o)&&t.Tr(e.name,i,o.transforms)}})},e)},this._instance=e,this._instance.onFeatureFlags(e=>{this.onFeatureFlags(e)})}onFeatureFlags(e){if(this._is_bot())hs.kr("Refusing to render web experiment since the viewer is a likely bot");else if(!this._instance.config.disable_web_experiments){if(z(this.Pr))return this.Pr=new Map,this.loadIfEnabled(),void this.previewWebExperiment();hs.kr("applying feature flags",e),e.forEach(e=>{var t;if(this.Pr&&null!=(t=this.Pr)&&t.has(e)){var n,r=this._instance.getFeatureFlag(e),i=null==(n=this.Pr)?void 0:n.get(e);r&&null!=i&&i.variants[r]&&this.Tr(i.name,r,i.variants[r].transforms)}})}}previewWebExperiment(){var e=hs.getWindowLocation();if(null!=e&&e.search){var t=Qn(null==e?void 0:e.search,"__experiment_id"),n=Qn(null==e?void 0:e.search,"__experiment_variant");t&&n&&(hs.kr("previewing web experiments "+t+" && "+n),this.getWebExperiments(e=>{this.Cr(parseInt(t),n,e)},!1,!0))}}loadIfEnabled(){this._instance.config.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,t,n){if(this._instance.config.disable_web_experiments&&!n)return e([]);var r=this._instance.get_property("$web_experiments");if(r&&!t)return e(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this._instance.config.token),method:"GET",callback:t=>{if(200!==t.statusCode||!t.json)return e([]);var n=t.json.experiments||[];return e(n)}})}Cr(e,t,n){var r=n.filter(t=>t.id===e);r&&r.length>0&&(hs.kr("Previewing web experiment ["+r[0].name+"] with variant ["+t+"]"),this.Tr(r[0].name,t,r[0].variants[t].transforms))}static Ir(e){return!z(e.conditions)&&hs.Rr(e)&&hs.Fr(e)}static Rr(e){var t;if(z(e.conditions)||z(null==(t=e.conditions)?void 0:t.url))return!0;var n,r,i,o=hs.getWindowLocation();return!!o&&(null==(n=e.conditions)||!n.url||ds[null!==(r=null==(i=e.conditions)?void 0:i.urlMatchType)&&void 0!==r?r:"icontains"](e.conditions.url,o))}static getWindowLocation(){return null==i?void 0:i.location}static Fr(e){var t;if(z(e.conditions)||z(null==(t=e.conditions)?void 0:t.utm))return!0;var n=Jr();if(n.utm_source){var r,i,o,s,a,l,c,u,d=null==(r=e.conditions)||null==(r=r.utm)||!r.utm_campaign||(null==(i=e.conditions)||null==(i=i.utm)?void 0:i.utm_campaign)==n.utm_campaign,h=null==(o=e.conditions)||null==(o=o.utm)||!o.utm_source||(null==(s=e.conditions)||null==(s=s.utm)?void 0:s.utm_source)==n.utm_source,f=null==(a=e.conditions)||null==(a=a.utm)||!a.utm_medium||(null==(l=e.conditions)||null==(l=l.utm)?void 0:l.utm_medium)==n.utm_medium,p=null==(c=e.conditions)||null==(c=c.utm)||!c.utm_term||(null==(u=e.conditions)||null==(u=u.utm)?void 0:u.utm_term)==n.utm_term;return d&&f&&p&&h}return!1}static kr(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];St.info("[WebExperiments] "+e,n)}Tr(e,t,n){this._is_bot()?hs.kr("Refusing to render web experiment since the viewer is a likely bot"):"control"!==t?n.forEach(n=>{if(n.selector){var r;hs.kr("applying transform of variant "+t+" for experiment "+e+" ",n);var i=null==(r=document)?void 0:r.querySelectorAll(n.selector);null==i||i.forEach(e=>{var t=e;n.html&&(t.innerHTML=n.html),n.css&&t.setAttribute("style",n.css)})}}):hs.kr("Control variants leave the page unmodified.")}_is_bot(){return c&&this._instance?as(c,this._instance.config.custom_blocked_useragents):void 0}}var fs=Ct("[PostHog ExternalIntegrations]"),ps={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class gs{constructor(e){this._instance=e}it(e,t){var n;null==(n=v.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this._instance,e,e=>{if(e)return fs.error("failed to load script",e);t()})}startIfEnabledOrStop(){var e=this,t=function(t){var n,i,o;!r||null!=(n=v.__PosthogExtensions__)&&null!=(n=n.integrations)&&n[t]||e.it(ps[t],()=>{var n;null==(n=v.__PosthogExtensions__)||null==(n=n.integrations)||null==(n=n[t])||n.start(e._instance)}),!r&&null!=(i=v.__PosthogExtensions__)&&null!=(i=i.integrations)&&i[t]&&(null==(o=v.__PosthogExtensions__)||null==(o=o.integrations)||null==(o=o[t])||o.stop())};for(var[n,r]of Object.entries(null!==(i=this._instance.config.integrations)&&void 0!==i?i:{})){var i;t(n)}}}var vs="[SessionRecording]",ms=Ct(vs);class _s{get started(){var e;return!(null==(e=this.Mr)||!e.isStarted)}get status(){return this.Mr?this.Mr.status:this.Or&&!this.Ar?"disabled":"lazy_loading"}constructor(e){if(this._forceAllowLocalhostNetworkCapture=!1,this.Or=!1,this.Dr=void 0,this._instance=e,!this._instance.sessionManager)throw ms.error("started without valid sessionManager"),new Error(vs+" started without valid sessionManager. This is a bug.");if("always"===this._instance.config.cookieless_mode)throw new Error(vs+' cannot be used with cookieless_mode="always"')}get Ar(){var e,t=!(null==(e=this._instance.get_property(Jt))||!e.enabled),n=!this._instance.config.disable_session_recording,r=this._instance.config.disable_session_recording||this._instance.consent.isOptedOut();return i&&t&&n&&!r}startIfEnabledOrStop(e){var t;if(!this.Ar||null==(t=this.Mr)||!t.isStarted){var n=!j(Object.assign)&&!j(Array.from);this.Ar&&n?(this.jr(e),ms.info("starting")):this.stopRecording()}}jr(e){var t,n,r;this.Ar&&(null!=v&&null!=(t=v.__PosthogExtensions__)&&null!=(t=t.rrweb)&&t.record&&null!=(n=v.__PosthogExtensions__)&&n.initSessionRecording?this.Lr(e):null==(r=v.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,this.Nr,t=>{if(t)return ms.error("could not load recorder",t);this.Lr(e)}))}stopRecording(){var e,t;null==(e=this.Dr)||e.call(this),this.Dr=void 0,null==(t=this.Mr)||t.stop()}Ur(){var e;null==(e=this._instance.persistence)||e.unregister(en)}zr(e){if(this._instance.persistence){var t,n,r=this._instance.persistence,i=()=>{var t=!1===e.sessionRecording?void 0:e.sessionRecording,n=null==t?void 0:t.sampleRate,i=z(n)?null:parseFloat(n);z(i)&&this.Ur();var o=null==t?void 0:t.minimumDurationMilliseconds;r.register({[Jt]:b({enabled:!!t},t,{networkPayloadCapture:b({capturePerformance:e.capturePerformance},null==t?void 0:t.networkPayloadCapture),canvasRecording:{enabled:null==t?void 0:t.recordCanvas,fps:null==t?void 0:t.canvasFps,quality:null==t?void 0:t.canvasQuality},sampleRate:i,minimumDurationMilliseconds:j(o)?null:o,endpoint:null==t?void 0:t.endpoint,triggerMatchType:null==t?void 0:t.triggerMatchType,masking:null==t?void 0:t.masking,urlTriggers:null==t?void 0:t.urlTriggers})})};i(),null==(t=this.Dr)||t.call(this),this.Dr=null==(n=this._instance.sessionManager)?void 0:n.onSessionId(i)}}onRemoteConfig(e){"sessionRecording"in e?!1!==e.sessionRecording?(this.zr(e),this.Or=!0,this.startIfEnabledOrStop()):this.Or=!0:ms.info("skipping remote config with no sessionRecording",e)}log(e,t){var n;void 0===t&&(t="log"),null!=(n=this.Mr)&&n.log?this.Mr.log(e,t):ms.warn("log called before recorder was ready")}get Nr(){var e,t,n=null==(e=this._instance)||null==(e=e.persistence)?void 0:e.get_property(Jt);return(null==n||null==(t=n.scriptConfig)?void 0:t.script)||"lazy-recorder"}Lr(e){var t,n;if(null==(t=v.__PosthogExtensions__)||!t.initSessionRecording)throw Error("Called on script loaded before session recording is available");this.Mr||(this.Mr=null==(n=v.__PosthogExtensions__)?void 0:n.initSessionRecording(this._instance),this.Mr._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),this.Mr.start(e)}onRRwebEmit(e){var t;null==(t=this.Mr)||null==t.onRRwebEmit||t.onRRwebEmit(e)}overrideLinkedFlag(){var e,t;this.Mr||null==(t=this._instance.persistence)||t.register({$replay_override_linked_flag:!0}),null==(e=this.Mr)||e.overrideLinkedFlag()}overrideSampling(){var e,t;this.Mr||null==(t=this._instance.persistence)||t.register({$replay_override_sampling:!0}),null==(e=this.Mr)||e.overrideSampling()}overrideTrigger(e){var t,n;this.Mr||null==(n=this._instance.persistence)||n.register({["url"===e?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),null==(t=this.Mr)||t.overrideTrigger(e)}get sdkDebugProperties(){var e;return(null==(e=this.Mr)?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,t){var n;return!(null==(n=this.Mr)||!n.tryAddCustomEvent(e,t))}}var ys={},bs=()=>{},xs="posthog",ws=!Xi&&-1===(null==g?void 0:g.indexOf("MSIE"))&&-1===(null==g?void 0:g.indexOf("Mozilla")),Ss=e=>{var t;return b({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,token:"",autocapture:!0,cross_subdomain_cookie:Bt(null==u?void 0:u.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:bs,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=e?e:"unset",__preview_deferred_init_extensions:!1,debug:d&&B(null==d?void 0:d.search)&&-1!==d.search.indexOf("__posthog_debug=true")||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!0,disable_external_dependency_loading:!1,enable_recording_console_log:void 0,secure_cookie:"https:"===(null==i||null==(t=i.location)?void 0:t.protocol),ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error:e=>{var t="Bad HTTP status: "+e.statusCode+" "+e.text;St.error(t)},get_device_id:e=>e,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:"identified_only",before_send:void 0,request_queue_config:{flush_interval_ms:Xo},error_tracking:{},_onCapture:bs,__preview_eager_load_replay:!1},(e=>({rageclick:!(e&&e>="2025-11-30")||{content_ignorelist:!0},capture_pageview:!(e&&e>="2025-05-24")||"history_change",session_recording:e&&e>="2025-11-30"?{strictMinimumDuration:!0}:{},external_scripts_inject_target:e&&e>="2026-01-30"?"head":"body"}))(e))},Cs=e=>{var t={};j(e.process_person)||(t.person_profiles=e.process_person),j(e.xhr_headers)||(t.request_headers=e.xhr_headers),j(e.cookie_name)||(t.persistence_name=e.cookie_name),j(e.disable_cookie)||(t.disable_persistence=e.disable_cookie),j(e.store_google)||(t.save_campaign_params=e.store_google),j(e.verbose)||(t.debug=e.verbose);var n=Pt({},t,e);return D(e.property_blacklist)&&(j(e.property_denylist)?n.property_denylist=e.property_blacklist:D(e.property_denylist)?n.property_denylist=[...e.property_blacklist,...e.property_denylist]:St.error("Invalid value for property_denylist config: "+e.property_denylist)),n};class ks{constructor(){this.__forceAllowLocalhost=!1}get Hr(){return this.__forceAllowLocalhost}set Hr(e){St.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class Es{get decideEndpointWasHit(){var e,t;return null!==(e=null==(t=this.featureFlags)?void 0:t.hasLoadedFlags)&&void 0!==e&&e}get flagsEndpointWasHit(){var e,t;return null!==(e=null==(t=this.featureFlags)?void 0:t.hasLoadedFlags)&&void 0!==e&&e}constructor(){this.webPerformance=new ks,this.Br=!1,this.version=m.LIB_VERSION,this.qr=new jo,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Ss(),this.SentryIntegration=Fr,this.sentryIntegration=e=>function(e,t){var n=Nr(e,t);return{name:Br,processEvent:e=>n(e)}}(this,e),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Wr=!1,this.Gr=null,this.Vr=null,this.Jr=null,this.featureFlags=new yo(this),this.toolbar=new Vr(this),this.scrollManager=new Qo(this),this.pageViewManager=new pi(this),this.surveys=new Ho(this),this.conversations=new Uo(this),this.logs=new Vo(this),this.experiments=new hs(this),this.exceptions=new ao(this),this.rateLimiter=new qo(this),this.requestRouter=new us(this),this.consent=new Rr(this),this.externalIntegrations=new gs(this),this.people={set:(e,t,n)=>{var r=B(e)?{[e]:t}:e;this.setPersonProperties(r),null==n||n({})},set_once:(e,t,n)=>{var r=B(e)?{[e]:t}:e;this.setPersonProperties(void 0,r),null==n||n({})}},this.on("eventCaptured",e=>St.info('send "'+(null==e?void 0:e.event)+'"',e))}init(e,t,n){if(n&&n!==xs){var r,i=null!==(r=ys[n])&&void 0!==r?r:new Es;return i._init(e,t,n),ys[n]=i,ys[xs][n]=i,i}return this._init(e,t,n)}_init(e,t,n){var r;if(void 0===t&&(t={}),j(e)||N(e))return St.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},t.debug=this.Kr(t.debug),this.Yr=t,this.Xr=[],t.person_profiles&&(this.Vr=t.person_profiles),this.set_config(Pt({},Ss(t.defaults),Cs(t),{name:n,token:e})),this.config.on_xhr_error&&St.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:gi.GZipJS;var o=this.Qr();this.persistence=new xo(this.config,o),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new xo(b({},this.config,{persistence:"sessionStorage"}),o);var s=b({},this.persistence.props),a=b({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.Zr=new Go(e=>this.ts(e),this.config.request_queue_config),this.es=new Jo(this),this.__request_queue=[];var l="always"===this.config.cookieless_mode||"on_reject"===this.config.cookieless_mode&&this.consent.isExplicitlyOptedOut();if(l||(this.sessionManager=new rs(this),this.sessionPropsManager=new ts(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(St.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this.rs(l)},0)):(St.info("Initializing extensions synchronously"),this.rs(l)),m.DEBUG=m.DEBUG||this.config.debug,m.DEBUG&&St.info("Starting in debug mode",{this:this,config:t,thisC:b({},this.config),p:s,s:a}),void 0!==(null==(r=t.bootstrap)?void 0:r.distinctID)){var c,u,d=this.config.get_device_id(pr()),h=null!=(c=t.bootstrap)&&c.isIdentifiedID?d:t.bootstrap.distinctID;this.persistence.set_property(cn,null!=(u=t.bootstrap)&&u.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:t.bootstrap.distinctID,$device_id:h})}if(this.ss()){var f,p,g=Object.keys((null==(f=t.bootstrap)?void 0:f.featureFlags)||{}).filter(e=>{var n;return!(null==(n=t.bootstrap)||null==(n=n.featureFlags)||!n[e])}).reduce((e,n)=>{var r;return e[n]=(null==(r=t.bootstrap)||null==(r=r.featureFlags)?void 0:r[n])||!1,e},{}),v=Object.keys((null==(p=t.bootstrap)?void 0:p.featureFlagPayloads)||{}).filter(e=>g[e]).reduce((e,n)=>{var r,i;return null!=(r=t.bootstrap)&&null!=(r=r.featureFlagPayloads)&&r[n]&&(e[n]=null==(i=t.bootstrap)||null==(i=i.featureFlagPayloads)?void 0:i[n]),e},{});this.featureFlags.receivedFeatureFlags({featureFlags:g,featureFlagPayloads:v})}if(l)this.register_once({distinct_id:mn,$device_id:null},"");else if(!this.get_distinct_id()){var _=this.config.get_device_id(pr());this.register_once({distinct_id:_,$device_id:_},""),this.persistence.set_property(cn,"anonymous")}return Ft(i,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),this.toolbar.maybeLoadToolbar(),t.segment?function(e,t){var n=e.config.segment;if(!n)return t();!function(e,t){var n=e.config.segment;if(!n)return t();var r=n=>{var r=()=>n.anonymousId()||pr();e.config.get_device_id=r,n.id()&&(e.register({distinct_id:n.id(),$device_id:r()}),e.persistence.set_property(cn,"identified")),t()},i=n.user();"then"in i&&O(i.then)?i.then(r):r(i)}(e,()=>{n.register((e=>{Promise&&Promise.resolve||jr.warn("This browser does not have Promise support, and can not use the segment integration");var t=(t,n)=>{if(!n)return t;t.event.userId||t.event.anonymousId===e.get_distinct_id()||(jr.info("No userId set, resetting PostHog"),e.reset()),t.event.userId&&t.event.userId!==e.get_distinct_id()&&(jr.info("UserId set, identifying with PostHog"),e.identify(t.event.userId));var r=e.calculateEventProperties(n,t.event.properties);return t.event.properties=Object.assign({},r,t.event.properties),t};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:e=>t(e,e.event.event),page:e=>t(e,"$pageview"),identify:e=>t(e,"$identify"),screen:e=>t(e,"$screen")}})(e)).then(()=>{t()})})}(this,()=>this.ns()):this.ns(),O(this.config._onCapture)&&this.config._onCapture!==bs&&(St.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",e=>this.config._onCapture(e.event,e))),this.config.ip&&St.warn('The `ip` config option has NO EFFECT AT ALL and has been deprecated. Use a custom transformation or "Discard IP data" project setting instead. See https://posthog.com/tutorials/web-redact-properties#hiding-customer-ip-address for more information.'),this}rs(e){var t=performance.now();this.historyAutocapture=new Ar(this),this.historyAutocapture.startIfEnabled();var n=[];n.push(()=>{new qr(this).startIfEnabledOrStop()}),n.push(()=>{var e;this.siteApps=new ss(this),null==(e=this.siteApps)||e.init()}),e||n.push(()=>{this.sessionRecording=new _s(this),this.sessionRecording.startIfEnabledOrStop()}),this.config.disable_scroll_properties||n.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),n.push(()=>{this.autocapture=new ar(this),this.autocapture.startIfEnabled()}),n.push(()=>{this.surveys.loadIfEnabled()}),n.push(()=>{this.logs.loadIfEnabled()}),n.push(()=>{this.conversations.loadIfEnabled()}),n.push(()=>{this.productTours=new Co(this),this.productTours.loadIfEnabled()}),n.push(()=>{this.heatmaps=new fi(this),this.heatmaps.startIfEnabled()}),n.push(()=>{this.webVitalsAutocapture=new ui(this)}),n.push(()=>{this.exceptionObserver=new Or(this),this.exceptionObserver.startIfEnabledOrStop()}),n.push(()=>{this.deadClicksAutocapture=new Tr(this,Pr),this.deadClicksAutocapture.startIfEnabled()}),n.push(()=>{if(this.os){var e=this.os;this.os=void 0,this.bi(e)}}),this.ls(n,t)}ls(e,t){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-t>=30&&e.length>0)return void setTimeout(()=>{this.ls(e,t)},0);var n=e.shift();if(n)try{n()}catch(e){St.error("Error initializing extension:",e)}}var r=Math.round(performance.now()-t);this.register_for_session({$sdk_debug_extensions_init_method:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",$sdk_debug_extensions_init_time_ms:r}),this.config.__preview_deferred_init_extensions&&St.info("PostHog extensions initialized ("+r+"ms)")}bi(e){var t,n,r,i,o,s,a,l,c;if(!u||!u.body)return St.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.bi(e)},500);this.config.__preview_deferred_init_extensions&&(this.os=e),this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=k(e.supportedCompression,gi.GZipJS)?gi.GZipJS:k(e.supportedCompression,gi.Base64)?gi.Base64:void 0),null!=(t=e.analytics)&&t.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this.Vr?this.Vr:"identified_only"}),null==(n=this.siteApps)||n.onRemoteConfig(e),null==(r=this.sessionRecording)||r.onRemoteConfig(e),null==(i=this.autocapture)||i.onRemoteConfig(e),null==(o=this.heatmaps)||o.onRemoteConfig(e),this.surveys.onRemoteConfig(e),this.logs.onRemoteConfig(e),this.conversations.onRemoteConfig(e),null==(s=this.productTours)||s.onRemoteConfig(e),null==(a=this.webVitalsAutocapture)||a.onRemoteConfig(e),null==(l=this.exceptionObserver)||l.onRemoteConfig(e),this.exceptions.onRemoteConfig(e),null==(c=this.deadClicksAutocapture)||c.onRemoteConfig(e)}ns(){try{this.config.loaded(this)}catch(i){St.critical("`loaded` function failed",i)}this.us(),this.config.capture_pageview&&setTimeout(()=>{(this.consent.isOptedIn()||"always"===this.config.cookieless_mode)&&this.hs()},1),new Yo(this).load(),this.featureFlags.flags()}us(){var e;this.is_capturing()&&this.config.request_batching&&(null==(e=this.Zr)||e.enable())}_dom_loaded(){this.is_capturing()&&Mt(this.__request_queue,e=>this.ts(e)),this.__request_queue=[],this.us()}_handle_unload(){var e,t;this.surveys.handlePageUnload(),this.config.request_batching?(this.ds()&&this.capture("$pageleave"),null==(e=this.Zr)||e.unload(),null==(t=this.es)||t.unload()):this.ds()&&this.capture("$pageleave",null,{transport:"sendBeacon"})}_send_request(e){this.__loaded&&(ws?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=Zi(e.url,{ip:this.config.ip?1:0}),e.headers=b({},this.config.request_headers,e.headers),e.compression="best-available"===e.compression?this.compression:e.compression,e.disableXHRCredentials=this.config.__preview_disable_xhr_credentials,this.config.__preview_disable_beacon&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||this.config.fetch_options,(e=>{var t,n,r,i=b({},e);i.timeout=i.timeout||6e4,i.url=Zi(i.url,{_:(new Date).getTime().toString(),ver:m.LIB_VERSION,compression:i.compression});var o=null!==(t=i.transport)&&void 0!==t?t:"fetch",s=eo.filter(e=>!i.disableTransport||!e.transport||!i.disableTransport.includes(e.transport)),a=null!==(n=null==(r=Nt(s,e=>e.transport===o))?void 0:r.method)&&void 0!==n?n:s[0].method;if(!a)throw new Error("No available transport method");a(i)})(b({},e,{callback:t=>{var n,r;this.rateLimiter.checkForLimiting(t),t.statusCode>=400&&(null==(n=(r=this.config).on_request_error)||n.call(r,t)),null==e.callback||e.callback(t)}}))))}ts(e){this.es?this.es.retriableRequest(e):this._send_request(e)}_execute_array(e){var t,n=[],r=[],i=[];Mt(e,e=>{e&&(t=e[0],D(t)?i.push(e):O(e)?e.call(this):D(e)&&"alias"===t?n.push(e):D(e)&&-1!==t.indexOf("capture")&&O(this[t])?i.push(e):r.push(e))});var o=function(e,t){Mt(e,function(e){if(D(e[0])){var n=t;Lt(e,function(e){n=n[e[0]].apply(n,e.slice(1))})}else this[e[0]].apply(this,e.slice(1))},t)};o(n,this),o(r,this),o(i,this)}ss(){var e,t;return(null==(e=this.config.bootstrap)?void 0:e.featureFlags)&&Object.keys(null==(t=this.config.bootstrap)?void 0:t.featureFlags).length>0||!1}push(e){this._execute_array([e])}capture(e,t,n){var r;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Zr){if(this.is_capturing())if(!j(e)&&B(e)){var i=!this.config.opt_out_useragent_filter&&this._is_bot();if(!i||this.config.__preview_capture_bot_pageviews){var o=null!=n&&n.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==o||!o.isRateLimited){null!=t&&t.$current_url&&!B(null==t?void 0:t.$current_url)&&(St.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==t||delete t.$current_url),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var s=new Date,a=(null==n?void 0:n.timestamp)||s,l=pr(),c={uuid:l,event:e,properties:this.calculateEventProperties(e,t||{},a,l)};"$pageview"===e&&this.config.__preview_capture_bot_pageviews&&i&&(c.event="$bot_pageview",c.properties.$browser_type="bot"),o&&(c.properties.$lib_rate_limit_remaining_tokens=o.remainingTokens),(null==n?void 0:n.$set)&&(c.$set=null==n?void 0:n.$set);var u,d="$groupidentify"!==e,h=this.vs(null==n?void 0:n.$set_once,d);if(h&&(c.$set_once=h),(c=function(e,t){return n=e,r=e=>B(e)&&!F(t)?e.slice(0,t):e,i=new Set,function e(t,n){return t!==Object(t)?r?r(t):t:i.has(t)?void 0:(i.add(t),D(t)?(o=[],Mt(t,t=>{o.push(e(t))})):(o={},Lt(t,(t,n)=>{i.has(t)||(o[n]=e(t,n))})),o);var o}(n);var n,r,i}(c,null!=n&&n._noTruncate?null:this.config.properties_string_max_length)).timestamp=a,j(null==n?void 0:n.timestamp)||(c.properties.$event_time_override_provided=!0,c.properties.$event_time_override_system_time=s),e===Ro.DISMISSED||e===Ro.SENT){var f=null==t?void 0:t[Mo.SURVEY_ID],p=null==t?void 0:t[Mo.SURVEY_ITERATION];u={id:f,current_iteration:p},localStorage.getItem(Oo(u))||localStorage.setItem(Oo(u),"true"),c.$set=b({},c.$set,{[Do({id:f,current_iteration:p},e===Ro.SENT?"responded":"dismissed")]:!0})}else e===Ro.SHOWN&&(c.$set=b({},c.$set,{[Mo.SURVEY_LAST_SEEN_DATE]:(new Date).toISOString()}));var g=b({},c.properties.$set,c.$set);if(A(g)||this.setPersonPropertiesForFlags(g),!z(this.config.before_send)){var v=this.cs(c);if(!v)return;c=v}this.qr.emit("eventCaptured",c);var m={method:"POST",url:null!==(r=null==n?void 0:n._url)&&void 0!==r?r:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:c,compression:"best-available",batchKey:null==n?void 0:n._batchKey};return!this.config.request_batching||n&&(null==n||!n._batchKey)||null!=n&&n.send_instantly?this.ts(m):this.Zr.enqueue(m),c}St.critical("This capture call is ignored due to client rate limiting.")}}else St.error("No event name provided to posthog.capture")}else St.uninitializedWarning("posthog.capture")}_addCaptureHook(e){return this.on("eventCaptured",t=>e(t.event,t))}calculateEventProperties(e,t,n,r,i){if(n=n||new Date,!this.persistence||!this.sessionPersistence)return t;var o=i?void 0:this.persistence.remove_event_timer(e),s=b({},t);if(s.token=this.config.token,s.$config_defaults=this.config.defaults,("always"==this.config.cookieless_mode||"on_reject"==this.config.cookieless_mode&&this.consent.isExplicitlyOptedOut())&&(s.$cookieless_mode=!0),"$snapshot"===e){var a=b({},this.persistence.properties(),this.sessionPersistence.properties());return s.distinct_id=a.distinct_id,(!B(s.distinct_id)&&!H(s.distinct_id)||N(s.distinct_id))&&St.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),s}var l,c=ai(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties);if(this.sessionManager){var{sessionId:d,windowId:h}=this.sessionManager.checkAndGetSessionAndWindowId(i,n.getTime());s.$session_id=d,s.$window_id=h}this.sessionPropsManager&&Pt(s,this.sessionPropsManager.getSessionProps());try{var f;this.sessionRecording&&Pt(s,this.sessionRecording.sdkDebugProperties),s.$sdk_debug_retry_queue_size=null==(f=this.es)?void 0:f.length}catch(e){s.$sdk_debug_error_capturing_properties=String(e)}if(this.requestRouter.region===ls.CUSTOM&&(s.$lib_custom_api_host=this.config.api_host),l="$pageview"!==e||i?"$pageleave"!==e||i?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(n):this.pageViewManager.doPageView(n,r),s=Pt(s,l),"$pageview"===e&&u&&(s.title=u.title),!j(o)){var p=n.getTime()-o;s.$duration=parseFloat((p/1e3).toFixed(3))}g&&this.config.opt_out_useragent_filter&&(s.$browser_type=this._is_bot()?"bot":"browser"),(s=Pt({},c,this.persistence.properties(),this.sessionPersistence.properties(),s)).$is_identified=this._isIdentified(),D(this.config.property_denylist)?Lt(this.config.property_denylist,function(e){delete s[e]}):St.error("Invalid value for property_denylist config: "+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var v=this.config.sanitize_properties;v&&(St.error("sanitize_properties is deprecated. Use before_send instead"),s=v(s,e));var m=this.fs();return s.$process_person_profile=m,m&&!i&&this.ps("_calculate_event_properties"),s}vs(e,t){var n;if(void 0===t&&(t=!0),!this.persistence||!this.fs())return e;if(this.Br)return e;var r=this.persistence.get_initial_props(),i=null==(n=this.sessionPropsManager)?void 0:n.getSetOnceProps(),o=Pt({},r,i||{},e||{}),s=this.config.sanitize_properties;return s&&(St.error("sanitize_properties is deprecated. Use before_send instead"),o=s(o,"$set_once")),t&&(this.Br=!0),A(o)?void 0:o}register(e,t){var n;null==(n=this.persistence)||n.register(e,t)}register_once(e,t,n){var r;null==(r=this.persistence)||r.register_once(e,t,n)}register_for_session(e){var t;null==(t=this.sessionPersistence)||t.register(e)}unregister(e){var t;null==(t=this.persistence)||t.unregister(e)}unregister_for_session(e){var t;null==(t=this.sessionPersistence)||t.unregister(e)}gs(e,t){this.register({[e]:t})}getFeatureFlag(e,t){return this.featureFlags.getFeatureFlag(e,t)}getFeatureFlagPayload(e){var t=this.featureFlags.getFeatureFlagPayload(e);try{return JSON.parse(t)}catch(e){return t}}isFeatureEnabled(e,t){return this.featureFlags.isFeatureEnabled(e,t)}reloadFeatureFlags(){this.featureFlags.reloadFeatureFlags()}updateFlags(e,t,n){var r=null!=n&&n.merge?this.featureFlags.getFlagVariants():{},i=null!=n&&n.merge?this.featureFlags.getFlagPayloads():{},o=b({},r,e),s=b({},i,t),a={};for(var[l,c]of Object.entries(o)){var u="string"==typeof c;a[l]={key:l,enabled:!!u||Boolean(c),variant:u?c:void 0,reason:void 0,metadata:j(null==s?void 0:s[l])?void 0:{id:0,version:void 0,description:void 0,payload:s[l]}}}this.featureFlags.receivedFeatureFlags({flags:a})}updateEarlyAccessFeatureEnrollment(e,t,n){this.featureFlags.updateEarlyAccessFeatureEnrollment(e,t,n)}getEarlyAccessFeatures(e,t,n){return void 0===t&&(t=!1),this.featureFlags.getEarlyAccessFeatures(e,t,n)}on(e,t){return this.qr.on(e,t)}onFeatureFlags(e){return this.featureFlags.onFeatureFlags(e)}onSurveysLoaded(e){return this.surveys.onSurveysLoaded(e)}onSessionId(e){var t,n;return null!==(t=null==(n=this.sessionManager)?void 0:n.onSessionId(e))&&void 0!==t?t:()=>{}}getSurveys(e,t){void 0===t&&(t=!1),this.surveys.getSurveys(e,t)}getActiveMatchingSurveys(e,t){void 0===t&&(t=!1),this.surveys.getActiveMatchingSurveys(e,t)}renderSurvey(e,t){this.surveys.renderSurvey(e,t)}displaySurvey(e,t){void 0===t&&(t=Ao),this.surveys.displaySurvey(e,t)}cancelPendingSurvey(e){this.surveys.cancelPendingSurvey(e)}canRenderSurvey(e){return this.surveys.canRenderSurvey(e)}canRenderSurveyAsync(e,t){return void 0===t&&(t=!1),this.surveys.canRenderSurveyAsync(e,t)}identify(e,t,n){if(!this.__loaded||!this.persistence)return St.uninitializedWarning("posthog.identify");if(H(e)&&(e=e.toString(),St.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),e)if(["distinct_id","distinctid"].includes(e.toLowerCase()))St.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.');else if(e!==mn){if(this.ps("posthog.identify")){var r=this.get_distinct_id();if(this.register({$user_id:e}),!this.get_property("$device_id")){var i=r;this.register_once({$had_persisted_distinct_id:!0,$device_id:i},"")}e!==r&&e!==this.get_property(Ht)&&(this.unregister(Ht),this.register({distinct_id:e}));var o="anonymous"===(this.persistence.get_property(cn)||"anonymous");e!==r&&o?(this.persistence.set_property(cn,"identified"),this.setPersonPropertiesForFlags(b({},n||{},t||{}),!1),this.capture("$identify",{distinct_id:e,$anon_distinct_id:r},{$set:t||{},$set_once:n||{}}),this.Jr=no(e,t,n),this.featureFlags.setAnonymousDistinctId(r)):(t||n)&&this.setPersonProperties(t,n),e!==r&&(this.reloadFeatureFlags(),this.unregister(ln))}}else St.critical('The string "'+mn+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.');else St.error("Unique user id has not been set in posthog.identify")}setPersonProperties(e,t){if((e||t)&&this.ps("posthog.setPersonProperties")){var n=no(this.get_distinct_id(),e,t);this.Jr!==n?(this.setPersonPropertiesForFlags(b({},t||{},e||{})),this.capture("$set",{$set:e||{},$set_once:t||{}}),this.Jr=n):St.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(e,t,n){if(e&&t){var r=this.getGroups();r[e]!==t&&this.resetGroupPropertiesForFlags(e),this.register({$groups:b({},r,{[e]:t})}),n&&(this.capture("$groupidentify",{$group_type:e,$group_key:t,$group_set:n}),this.setGroupPropertiesForFlags({[e]:n})),r[e]===t||n||this.reloadFeatureFlags()}else St.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,t){void 0===t&&(t=!0),this.featureFlags.setPersonPropertiesForFlags(e,t)}resetPersonPropertiesForFlags(){this.featureFlags.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(e,t){void 0===t&&(t=!0),this.ps("posthog.setGroupPropertiesForFlags")&&this.featureFlags.setGroupPropertiesForFlags(e,t)}resetGroupPropertiesForFlags(e){this.featureFlags.resetGroupPropertiesForFlags(e)}reset(e){var t,n,r,i;if(St.info("reset"),!this.__loaded)return St.uninitializedWarning("posthog.reset");var o=this.get_property("$device_id");if(this.consent.reset(),null==(t=this.persistence)||t.clear(),null==(n=this.sessionPersistence)||n.clear(),this.surveys.reset(),this.featureFlags.reset(),null==(r=this.persistence)||r.set_property(cn,"anonymous"),null==(i=this.sessionManager)||i.resetSessionId(),this.Jr=null,"always"===this.config.cookieless_mode)this.register_once({distinct_id:mn,$device_id:null},"");else{var s=this.config.get_device_id(pr());this.register_once({distinct_id:s,$device_id:e?s:o},"")}this.register({$last_posthog_reset:(new Date).toISOString()},1)}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,t;return null!==(e=null==(t=this.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==e?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";var{sessionId:t,sessionStartTimestamp:n}=this.sessionManager.checkAndGetSessionAndWindowId(!0),r=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+t);if(null!=e&&e.withTimestamp&&n){var i,o=null!==(i=e.timestampLookBack)&&void 0!==i?i:10;if(!n)return r;r+="?t="+Math.max(Math.floor(((new Date).getTime()-n)/1e3)-o,0)}return r}alias(e,t){return e===this.get_property(zt)?(St.critical("Attempting to create alias for existing People user - aborting."),-2):this.ps("posthog.alias")?(j(t)&&(t=this.get_distinct_id()),e!==t?(this.gs(Ht,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(St.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t=b({},this.config);if(I(e)){var n,r,i,o,s,a,l;Pt(this.config,Cs(e));var c=this.Qr();null==(n=this.persistence)||n.update_config(this.config,t,c),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new xo(b({},this.config,{persistence:"sessionStorage"}),c);var u=this.Kr(this.config.debug);U(u)&&(this.config.debug=u),U(this.config.debug)&&(this.config.debug?(m.DEBUG=!0,br.H()&&br.G("ph_debug","true"),St.info("set_config",{config:e,oldConfig:t,newConfig:b({},this.config)})):(m.DEBUG=!1,br.H()&&br.V("ph_debug"))),null==(r=this.exceptionObserver)||r.onConfigChange(),null==(i=this.sessionRecording)||i.startIfEnabledOrStop(),null==(o=this.autocapture)||o.startIfEnabled(),null==(s=this.heatmaps)||s.startIfEnabled(),null==(a=this.exceptionObserver)||a.startIfEnabledOrStop(),this.surveys.loadIfEnabled(),this._s(),null==(l=this.externalIntegrations)||l.startIfEnabledOrStop()}}startSessionRecording(e){var t,n,r,i,o,s=!0===e,a={sampling:s||!(null==e||!e.sampling),linked_flag:s||!(null==e||!e.linked_flag),url_trigger:s||!(null==e||!e.url_trigger),event_trigger:s||!(null==e||!e.event_trigger)};Object.values(a).some(Boolean)&&(null==(t=this.sessionManager)||t.checkAndGetSessionAndWindowId(),a.sampling&&(null==(n=this.sessionRecording)||n.overrideSampling()),a.linked_flag&&(null==(r=this.sessionRecording)||r.overrideLinkedFlag()),a.url_trigger&&(null==(i=this.sessionRecording)||i.overrideTrigger("url")),a.event_trigger&&(null==(o=this.sessionRecording)||o.overrideTrigger("event")));this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var e;return!(null==(e=this.sessionRecording)||!e.started)}captureException(e,t){var n=new Error("PostHog syntheticException"),r=this.exceptions.buildProperties(e,{handled:!0,syntheticException:n});return this.exceptions.sendExceptionEvent(b({},r,t))}startExceptionAutocapture(e){this.set_config({capture_exceptions:null==e||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){return this.toolbar.loadToolbar(e)}get_property(e){var t;return null==(t=this.persistence)?void 0:t.props[e]}getSessionProperty(e){var t;return null==(t=this.sessionPersistence)?void 0:t.props[e]}toString(){var e,t=null!==(e=this.config.name)&&void 0!==e?e:xs;return t!==xs&&(t=xs+"."+t),t}_isIdentified(){var e,t;return"identified"===(null==(e=this.persistence)?void 0:e.get_property(cn))||"identified"===(null==(t=this.sessionPersistence)?void 0:t.get_property(cn))}fs(){var e,t;return!("never"===this.config.person_profiles||"identified_only"===this.config.person_profiles&&!this._isIdentified()&&A(this.getGroups())&&(null==(e=this.persistence)||null==(e=e.props)||!e[Ht])&&(null==(t=this.persistence)||null==(t=t.props)||!t[gn]))}ds(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&(!0===this.config.capture_pageview||"history_change"===this.config.capture_pageview)}createPersonProfile(){this.fs()||this.ps("posthog.createPersonProfile")&&this.setPersonProperties({},{})}ps(e){return"never"===this.config.person_profiles?(St.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.gs(gn,!0),!0)}Qr(){if("always"===this.config.cookieless_mode)return!0;var e=this.consent.isOptedOut(),t=this.config.opt_out_persistence_by_default||"on_reject"===this.config.cookieless_mode;return this.config.disable_persistence||e&&!!t}_s(){var e,t,n,r,i=this.Qr();return(null==(e=this.persistence)?void 0:e.ki)!==i&&(null==(n=this.persistence)||n.set_disabled(i)),(null==(t=this.sessionPersistence)?void 0:t.ki)!==i&&(null==(r=this.sessionPersistence)||r.set_disabled(i)),i}opt_in_capturing(e){var t,n,r,i;"always"!==this.config.cookieless_mode?("on_reject"===this.config.cookieless_mode&&this.consent.isExplicitlyOptedOut()&&(this.reset(!0),null==(n=this.sessionManager)||n.destroy(),null==(r=this.pageViewManager)||r.destroy(),this.sessionManager=new rs(this),this.pageViewManager=new pi(this),this.persistence&&(this.sessionPropsManager=new ts(this,this.sessionManager,this.persistence)),this.sessionRecording=new _s(this),this.sessionRecording.startIfEnabledOrStop()),this.consent.optInOut(!0),this._s(),this.us(),null==(t=this.sessionRecording)||t.startIfEnabledOrStop(),"on_reject"==this.config.cookieless_mode&&this.surveys.loadIfEnabled(),(j(null==e?void 0:e.captureEventName)||null!=e&&e.captureEventName)&&this.capture(null!==(i=null==e?void 0:e.captureEventName)&&void 0!==i?i:"$opt_in",null==e?void 0:e.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.hs()):St.warn('Consent opt in/out is not valid with cookieless_mode="always" and will be ignored')}opt_out_capturing(){var e,t,n;"always"!==this.config.cookieless_mode?("on_reject"===this.config.cookieless_mode&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this._s(),"on_reject"===this.config.cookieless_mode&&(this.register({distinct_id:mn,$device_id:null}),null==(e=this.sessionManager)||e.destroy(),null==(t=this.pageViewManager)||t.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,null==(n=this.sessionRecording)||n.stopRecording(),this.sessionRecording=void 0,this.hs())):St.warn('Consent opt in/out is not valid with cookieless_mode="always" and will be ignored')}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var e=this.consent.consent;return e===Er.GRANTED?"granted":e===Er.DENIED?"denied":"pending"}is_capturing(){return"always"===this.config.cookieless_mode||("on_reject"===this.config.cookieless_mode?this.consent.isExplicitlyOptedOut()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this._s()}_is_bot(){return c?as(c,this.config.custom_blocked_useragents):void 0}hs(){u&&("visible"===u.visibilityState?this.Wr||(this.Wr=!0,this.capture("$pageview",{title:u.title},{send_instantly:!0}),this.Gr&&(u.removeEventListener("visibilitychange",this.Gr),this.Gr=null)):this.Gr||(this.Gr=this.hs.bind(this),Ft(u,"visibilitychange",this.Gr)))}debug(e){!1===e?(null==i||i.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==i||i.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),this.set_config({debug:!0}))}O(){var e,t,n,r,i,o,s=this.Yr||{};return"advanced_disable_flags"in s?!!s.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?(St.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):(n="advanced_disable_decide",r=St,i=(t="advanced_disable_flags")in(e=s)&&!j(e[t]),o=n in e&&!j(e[n]),i?e[t]:!!o&&(r&&r.warn("Config field '"+n+"' is deprecated. Please use '"+t+"' instead. The old field will be removed in a future major version."),e[n]))}cs(e){if(z(this.config.before_send))return e;var t=D(this.config.before_send)?this.config.before_send:[this.config.before_send],n=e;for(var r of t){if(n=r(n),z(n)){var i="Event '"+e.event+"' was rejected in beforeSend function";return V(e.event)?St.warn(i+". This can cause unexpected behavior."):St.info(i),null}n.properties&&!A(n.properties)||St.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}return n}getPageViewId(){var e;return null==(e=this.pageViewManager.Kt)?void 0:e.pageViewId}captureTraceFeedback(e,t){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:t})}captureTraceMetric(e,t,n){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:t,$ai_metric_value:String(n)})}Kr(e){var t=U(e)&&!e,n=br.H()&&"true"===br.q("ph_debug");return!t&&(!!n||e)}}!function(e,t){for(var n=0;n<t.length;n++)e.prototype[t[n]]=It(e.prototype[t[n]])}(Es,["identify"]);var Rs,Ms=(Rs=ys[xs]=new Es,function(){function e(){e.done||(e.done=!0,ws=!1,Lt(ys,function(e){e._dom_loaded()}))}null!=u&&u.addEventListener?"complete"===u.readyState?e():Ft(u,"DOMContentLoaded",e,{capture:!1}):i&&St.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),Rs);function Ls(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function Ps(e){return Ps="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ps(e)}function Ts(e){var t=function(e,t){if("object"!=Ps(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=Ps(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==Ps(t)?t:t+""}function Ds(e,t,n){return(t=Ts(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Os(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Is(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Os(Object(n),!0).forEach(function(t){Ds(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Os(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}const As=["sri"],js=["page"],Bs=["page","matches"],Ns=["onClick","discover","prefetch","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition","unstable_defaultShouldRevalidate"],Fs=["aria-current","caseSensitive","className","end","style","to","viewTransition","children"],zs=["discover","fetcherKey","navigate","reloadDocument","replace","state","method","action","onSubmit","relative","preventScrollReset","viewTransition","unstable_defaultShouldRevalidate"];var Hs="popstate";function Ws(){return Xs(function(e,t){let{pathname:n,search:r,hash:i}=e.location;return qs("",{pathname:n,search:r,hash:i},t.state&&t.state.usr||null,t.state&&t.state.key||"default")},function(e,t){return"string"===typeof t?t:Ks(t)},null,arguments.length>0&&void 0!==arguments[0]?arguments[0]:{})}function Us(e,t){if(!1===e||null===e||"undefined"===typeof e)throw new Error(t)}function Vs(e,t){if(!e){"undefined"!==typeof console&&console.warn(t);try{throw new Error(t)}catch(s){}}}function $s(e,t){return{usr:e.state,key:e.key,idx:t}}function qs(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3?arguments[3]:void 0;return Is(Is({pathname:"string"===typeof e?e:e.pathname,search:"",hash:""},"string"===typeof t?Ys(t):t),{},{state:n,key:t&&t.key||r||Math.random().toString(36).substring(2,10)})}function Ks(e){let{pathname:t="/",search:n="",hash:r=""}=e;return n&&"?"!==n&&(t+="?"===n.charAt(0)?n:"?"+n),r&&"#"!==r&&(t+="#"===r.charAt(0)?r:"#"+r),t}function Ys(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function Xs(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},{window:i=document.defaultView,v5Compat:o=!1}=r,s=i.history,a="POP",l=null,c=u();function u(){return(s.state||{idx:null}).idx}function d(){a="POP";let e=u(),t=null==e?null:e-c;c=e,l&&l({action:a,location:f.location,delta:t})}function h(e){return Gs(e)}null==c&&(c=0,s.replaceState(Is(Is({},s.state),{},{idx:c}),""));let f={get action(){return a},get location(){return e(i,s)},listen(e){if(l)throw new Error("A history only accepts one active listener");return i.addEventListener(Hs,d),l=e,()=>{i.removeEventListener(Hs,d),l=null}},createHref:e=>t(i,e),createURL:h,encodeLocation(e){let t=h(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:function(e,t){a="PUSH";let r=qs(f.location,e,t);n&&n(r,e),c=u()+1;let d=$s(r,c),h=f.createHref(r);try{s.pushState(d,"",h)}catch(p){if(p instanceof DOMException&&"DataCloneError"===p.name)throw p;i.location.assign(h)}o&&l&&l({action:a,location:f.location,delta:1})},replace:function(e,t){a="REPLACE";let r=qs(f.location,e,t);n&&n(r,e),c=u();let i=$s(r,c),d=f.createHref(r);s.replaceState(i,"",d),o&&l&&l({action:a,location:f.location,delta:0})},go:e=>s.go(e)};return f}function Gs(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n="http://localhost";"undefined"!==typeof window&&(n="null"!==window.location.origin?window.location.origin:window.location.href),Us(n,"No window.location.(origin|href) available to create URL");let r="string"===typeof e?e:Ks(e);return r=r.replace(/ $/,"%20"),!t&&r.startsWith("//")&&(r=n+r),new URL(r,n)}new WeakMap;function Zs(e,t){return Js(e,t,arguments.length>2&&void 0!==arguments[2]?arguments[2]:"/",!1)}function Js(e,t,n,r){let i=fa(("string"===typeof t?Ys(t):t).pathname||"/",n);if(null==i)return null;let o=Qs(e);!function(e){e.sort((e,t)=>e.score!==t.score?t.score-e.score:function(e,t){let n=e.length===t.length&&e.slice(0,-1).every((e,n)=>e===t[n]);return n?e[e.length-1]-t[t.length-1]:0}(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)))}(o);let s=null;for(let a=0;null==s&&a<o.length;++a){let e=ha(i);s=ca(o[a],e,r)}return s}function Qs(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",i=arguments.length>4&&void 0!==arguments[4]&&arguments[4],o=function(e,o){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:i,a=arguments.length>3?arguments[3]:void 0,l={relativePath:void 0===a?e.path||"":a,caseSensitive:!0===e.caseSensitive,childrenIndex:o,route:e};if(l.relativePath.startsWith("/")){if(!l.relativePath.startsWith(r)&&s)return;Us(l.relativePath.startsWith(r),'Absolute route path "'.concat(l.relativePath,'" nested under path "').concat(r,'" is not valid. An absolute child route path must start with the combined path of all its parent routes.')),l.relativePath=l.relativePath.slice(r.length)}let c=ba([r,l.relativePath]),u=n.concat(l);e.children&&e.children.length>0&&(Us(!0!==e.index,'Index routes must not have child routes. Please remove all child routes from route path "'.concat(c,'".')),Qs(e.children,t,u,c,s)),(null!=e.path||e.index)&&t.push({path:c,score:la(c,e.index),routesMeta:u})};return e.forEach((e,t)=>{var n;if(""!==e.path&&null!==(n=e.path)&&void 0!==n&&n.includes("?"))for(let r of ea(e.path))o(e,t,!0,r);else o(e,t)}),t}function ea(e){let t=e.split("/");if(0===t.length)return[];let[n,...r]=t,i=n.endsWith("?"),o=n.replace(/\?$/,"");if(0===r.length)return i?[o,""]:[o];let s=ea(r.join("/")),a=[];return a.push(...s.map(e=>""===e?o:[o,e].join("/"))),i&&a.push(...s),a.map(t=>e.startsWith("/")&&""===t?"/":t)}var ta=/^:[\w-]+$/,na=3,ra=2,ia=1,oa=10,sa=-2,aa=e=>"*"===e;function la(e,t){let n=e.split("/"),r=n.length;return n.some(aa)&&(r+=sa),t&&(r+=ra),n.filter(e=>!aa(e)).reduce((e,t)=>e+(ta.test(t)?na:""===t?ia:oa),r)}function ca(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],{routesMeta:r}=e,i={},o="/",s=[];for(let a=0;a<r.length;++a){let e=r[a],l=a===r.length-1,c="/"===o?t:t.slice(o.length)||"/",u=ua({path:e.relativePath,caseSensitive:e.caseSensitive,end:l},c),d=e.route;if(!u&&l&&n&&!r[r.length-1].route.index&&(u=ua({path:e.relativePath,caseSensitive:e.caseSensitive,end:!1},c)),!u)return null;Object.assign(i,u.params),s.push({params:i,pathname:ba([o,u.pathname]),pathnameBase:xa(ba([o,u.pathnameBase])),route:d}),"/"!==u.pathnameBase&&(o=ba([o,u.pathnameBase]))}return s}function ua(e,t){"string"===typeof e&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=da(e.path,e.caseSensitive,e.end),i=t.match(n);if(!i)return null;let o=i[0],s=o.replace(/(.)\/+$/,"$1"),a=i.slice(1),l=r.reduce((e,t,n)=>{let{paramName:r,isOptional:i}=t;if("*"===r){let e=a[n]||"";s=o.slice(0,o.length-e.length).replace(/(.)\/+$/,"$1")}const l=a[n];return e[r]=i&&!l?void 0:(l||"").replace(/%2F/g,"/"),e},{});return{params:l,pathname:o,pathnameBase:s,pattern:e}}function da(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];Vs("*"===e||!e.endsWith("*")||e.endsWith("/*"),'Route path "'.concat(e,'" will be treated as if it were "').concat(e.replace(/\*$/,"/*"),'" because the `*` character must always follow a `/` in the pattern. To get rid of this warning, please change the route path to "').concat(e.replace(/\*$/,"/*"),'".'));let r=[],i="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(e,t,n)=>(r.push({paramName:t,isOptional:null!=n}),n?"/?([^\\/]+)?":"/([^\\/]+)")).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(r.push({paramName:"*"}),i+="*"===e||"/*"===e?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?i+="\\/*$":""!==e&&"/"!==e&&(i+="(?:(?=\\/|$))"),[new RegExp(i,t?void 0:"i"),r]}function ha(e){try{return e.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(t){return Vs(!1,'The URL path "'.concat(e,'" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (').concat(t,").")),e}}function fa(e,t){if("/"===t)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&"/"!==r?null:e.slice(n)||"/"}var pa=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function ga(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(e=>{".."===e?n.length>1&&n.pop():"."!==e&&n.push(e)}),n.length>1?n.join("/"):"/"}function va(e,t,n,r){return"Cannot include a '".concat(e,"' character in a manually specified `to.").concat(t,"` field [").concat(JSON.stringify(r),"]. Please separate it out to the `to.").concat(n,'` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.')}function ma(e){return e.filter((e,t)=>0===t||e.route.path&&e.route.path.length>0)}function _a(e){let t=ma(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function ya(e,t,n){let r,i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];"string"===typeof e?r=Ys(e):(r=Is({},e),Us(!r.pathname||!r.pathname.includes("?"),va("?","pathname","search",r)),Us(!r.pathname||!r.pathname.includes("#"),va("#","pathname","hash",r)),Us(!r.search||!r.search.includes("#"),va("#","search","hash",r)));let o,s=""===e||""===r.pathname,a=s?"/":r.pathname;if(null==a)o=n;else{let e=t.length-1;if(!i&&a.startsWith("..")){let t=a.split("/");for(;".."===t[0];)t.shift(),e-=1;r.pathname=t.join("/")}o=e>=0?t[e]:"/"}let l=function(e){let t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"/",{pathname:r,search:i="",hash:o=""}="string"===typeof e?Ys(e):e;return r?(r=r.replace(/\/\/+/g,"/"),t=r.startsWith("/")?ga(r.substring(1),"/"):ga(r,n)):t=n,{pathname:t,search:wa(i),hash:Sa(o)}}(r,o),c=a&&"/"!==a&&a.endsWith("/"),u=(s||"."===a)&&n.endsWith("/");return l.pathname.endsWith("/")||!c&&!u||(l.pathname+="/"),l}var ba=e=>e.join("/").replace(/\/\/+/g,"/"),xa=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),wa=e=>e&&"?"!==e?e.startsWith("?")?e:"?"+e:"",Sa=e=>e&&"#"!==e?e.startsWith("#")?e:"#"+e:"";var Ca=class{constructor(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];this.status=e,this.statusText=t||"",this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function ka(e){return null!=e&&"number"===typeof e.status&&"string"===typeof e.statusText&&"boolean"===typeof e.internal&&"data"in e}function Ea(e){return e.map(e=>e.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var Ra="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement;function Ma(e,t){let n=e;if("string"!==typeof n||!pa.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(Ra)try{let e=new URL(window.location.href),r=n.startsWith("//")?new URL(e.protocol+n):new URL(n),o=fa(r.pathname,t);r.origin===e.origin&&null!=o?n=o+r.search+r.hash:i=!0}catch(s){Vs(!1,'<Link to="'.concat(n,'"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.'))}return{absoluteURL:r,isExternal:i,to:n}}Symbol("Uninstrumented");Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var La=["POST","PUT","PATCH","DELETE"],Pa=(new Set(La),["GET",...La]);new Set(Pa),Symbol("ResetLoaderData");var Ta=e.createContext(null);Ta.displayName="DataRouter";var Da=e.createContext(null);Da.displayName="DataRouterState";var Oa=e.createContext(!1);function Ia(){return e.useContext(Oa)}var Aa=e.createContext({isTransitioning:!1});Aa.displayName="ViewTransition";var ja=e.createContext(new Map);ja.displayName="Fetchers";var Ba=e.createContext(null);Ba.displayName="Await";var Na=e.createContext(null);Na.displayName="Navigation";var Fa=e.createContext(null);Fa.displayName="Location";var za=e.createContext({outlet:null,matches:[],isDataRoute:!1});za.displayName="Route";var Ha=e.createContext(null);Ha.displayName="RouteError";var Wa="REACT_ROUTER_ERROR";function Ua(){return null!=e.useContext(Fa)}function Va(){return Us(Ua(),"useLocation() may be used only in the context of a <Router> component."),e.useContext(Fa).location}var $a="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function qa(t){e.useContext(Na).static||e.useLayoutEffect(t)}function Ka(){let{isDataRoute:t}=e.useContext(za);return t?function(){let{router:t}=il("useNavigate"),n=sl("useNavigate"),r=e.useRef(!1);qa(()=>{r.current=!0});let i=e.useCallback(async function(e){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Vs(r.current,$a),r.current&&("number"===typeof e?await t.navigate(e):await t.navigate(e,Is({fromRouteId:n},i)))},[t,n]);return i}():function(){Us(Ua(),"useNavigate() may be used only in the context of a <Router> component.");let t=e.useContext(Ta),{basename:n,navigator:r}=e.useContext(Na),{matches:i}=e.useContext(za),{pathname:o}=Va(),s=JSON.stringify(_a(i)),a=e.useRef(!1);qa(()=>{a.current=!0});let l=e.useCallback(function(e){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(Vs(a.current,$a),!a.current)return;if("number"===typeof e)return void r.go(e);let l=ya(e,JSON.parse(s),o,"path"===i.relative);null==t&&"/"!==n&&(l.pathname="/"===l.pathname?n:ba([n,l.pathname])),(i.replace?r.replace:r.push)(l,i.state,i)},[n,r,s,o,t]);return l}()}e.createContext(null);function Ya(t){let{relative:n}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{matches:r}=e.useContext(za),{pathname:i}=Va(),o=JSON.stringify(_a(r));return e.useMemo(()=>ya(t,JSON.parse(o),i,"path"===n),[t,o,i,n])}function Xa(t,n,r,i,o){Us(Ua(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:s}=e.useContext(Na),{matches:a}=e.useContext(za),l=a[a.length-1],c=l?l.params:{},u=l?l.pathname:"/",d=l?l.pathnameBase:"/",h=l&&l.route;{let e=h&&h.path||"";cl(u,!h||e.endsWith("*")||e.endsWith("*?"),'You rendered descendant <Routes> (or called `useRoutes()`) at "'.concat(u,'" (under <Route path="').concat(e,'">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won\'t match anymore and therefore the child routes will never render.\n\nPlease change the parent <Route path="').concat(e,'"> to <Route path="').concat("/"===e?"*":"".concat(e,"/*"),'">.'))}let f,p=Va();if(n){var g;let e="string"===typeof n?Ys(n):n;Us("/"===d||(null===(g=e.pathname)||void 0===g?void 0:g.startsWith(d)),'When overriding the location using `<Routes location>` or `useRoutes(routes, location)`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "'.concat(d,'" but pathname "').concat(e.pathname,'" was given in the `location` prop.')),f=e}else f=p;let v=f.pathname||"/",m=v;if("/"!==d){let e=d.replace(/^\//,"").split("/");m="/"+v.replace(/^\//,"").split("/").slice(e.length).join("/")}let _=Zs(t,{pathname:m});Vs(h||null!=_,'No routes matched location "'.concat(f.pathname).concat(f.search).concat(f.hash,'" ')),Vs(null==_||void 0!==_[_.length-1].route.element||void 0!==_[_.length-1].route.Component||void 0!==_[_.length-1].route.lazy,'Matched leaf route at location "'.concat(f.pathname).concat(f.search).concat(f.hash,'" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.'));let y=nl(_&&_.map(e=>Object.assign({},e,{params:Object.assign({},c,e.params),pathname:ba([d,s.encodeLocation?s.encodeLocation(e.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:e.pathname]),pathnameBase:"/"===e.pathnameBase?d:ba([d,s.encodeLocation?s.encodeLocation(e.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:e.pathnameBase])})),a,r,i,o);return n&&y?e.createElement(Fa.Provider,{value:{location:Is({pathname:"/",search:"",hash:"",state:null,key:"default"},f),navigationType:"POP"}},y):y}function Ga(){let t=al(),n=ka(t)?"".concat(t.status," ").concat(t.statusText):t instanceof Error?t.message:JSON.stringify(t),r=t instanceof Error?t.stack:null,i="rgba(200,200,200, 0.5)",o={padding:"0.5rem",backgroundColor:i},s={padding:"2px 4px",backgroundColor:i},a=null;return console.error("Error handled by React Router default ErrorBoundary:",t),a=e.createElement(e.Fragment,null,e.createElement("p",null,"\ud83d\udcbf Hey developer \ud83d\udc4b"),e.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",e.createElement("code",{style:s},"ErrorBoundary")," or"," ",e.createElement("code",{style:s},"errorElement")," prop on your route.")),e.createElement(e.Fragment,null,e.createElement("h2",null,"Unexpected Application Error!"),e.createElement("h3",{style:{fontStyle:"italic"}},n),r?e.createElement("pre",{style:o},r):null,a)}var Za=e.createElement(Ga,null),Ja=class extends e.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||"idle"!==t.revalidation&&"idle"===e.revalidation?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:void 0!==e.error?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){let t=this.state.error;if(this.context&&"object"===typeof t&&t&&"digest"in t&&"string"===typeof t.digest){const e=function(e){if(e.startsWith("".concat(Wa,":").concat("ROUTE_ERROR_RESPONSE",":{")))try{let t=JSON.parse(e.slice(40));if("object"===typeof t&&t&&"number"===typeof t.status&&"string"===typeof t.statusText)return new Ca(t.status,t.statusText,t.data)}catch(t){}}(t.digest);e&&(t=e)}let n=void 0!==t?e.createElement(za.Provider,{value:this.props.routeContext},e.createElement(Ha.Provider,{value:t,children:this.props.component})):this.props.children;return this.context?e.createElement(el,{error:t},n):n}};Ja.contextType=Oa;var Qa=new WeakMap;function el(t){let{children:n,error:r}=t,{basename:i}=e.useContext(Na);if("object"===typeof r&&r&&"digest"in r&&"string"===typeof r.digest){let t=function(e){if(e.startsWith("".concat(Wa,":").concat("REDIRECT",":{")))try{let t=JSON.parse(e.slice(28));if("object"===typeof t&&t&&"number"===typeof t.status&&"string"===typeof t.statusText&&"string"===typeof t.location&&"boolean"===typeof t.reloadDocument&&"boolean"===typeof t.replace)return t}catch(t){}}(r.digest);if(t){let n=Qa.get(r);if(n)throw n;let o=Ma(t.location,i);if(Ra&&!Qa.get(r)){if(!o.isExternal&&!t.reloadDocument){const e=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(o.to,{replace:t.replace}));throw Qa.set(r,e),e}window.location.href=o.absoluteURL||o.to}return e.createElement("meta",{httpEquiv:"refresh",content:"0;url=".concat(o.absoluteURL||o.to)})}}return n}function tl(t){let{routeContext:n,match:r,children:i}=t,o=e.useContext(Ta);return o&&o.static&&o.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(o.staticContext._deepestRenderedBoundaryId=r.route.id),e.createElement(za.Provider,{value:n},i)}function nl(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;if(null==t){if(!r)return null;if(r.errors)t=r.matches;else{if(0!==n.length||r.initialized||!(r.matches.length>0))return null;t=r.matches}}let o=t,s=null===r||void 0===r?void 0:r.errors;if(null!=s){let e=o.findIndex(e=>e.route.id&&void 0!==(null===s||void 0===s?void 0:s[e.route.id]));Us(e>=0,"Could not find a matching route for errors on route IDs: ".concat(Object.keys(s).join(","))),o=o.slice(0,Math.min(o.length,e+1))}let a=!1,l=-1;if(r)for(let e=0;e<o.length;e++){let t=o[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(l=e),t.route.id){let{loaderData:e,errors:n}=r,i=t.route.loader&&!e.hasOwnProperty(t.route.id)&&(!n||void 0===n[t.route.id]);if(t.route.lazy||i){a=!0,o=l>=0?o.slice(0,l+1):[o[0]];break}}}let c=r&&i?(e,t)=>{var n,o;i(e,{location:r.location,params:null!==(n=null===(o=r.matches)||void 0===o||null===(o=o[0])||void 0===o?void 0:o.params)&&void 0!==n?n:{},unstable_pattern:Ea(r.matches),errorInfo:t})}:void 0;return o.reduceRight((t,i,u)=>{let d,h=!1,f=null,p=null;r&&(d=s&&i.route.id?s[i.route.id]:void 0,f=i.route.errorElement||Za,a&&(l<0&&0===u?(cl("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),h=!0,p=null):l===u&&(h=!0,p=i.route.hydrateFallbackElement||null)));let g=n.concat(o.slice(0,u+1)),v=()=>{let n;return n=d?f:h?p:i.route.Component?e.createElement(i.route.Component,null):i.route.element?i.route.element:t,e.createElement(tl,{match:i,routeContext:{outlet:t,matches:g,isDataRoute:null!=r},children:n})};return r&&(i.route.ErrorBoundary||i.route.errorElement||0===u)?e.createElement(Ja,{location:r.location,revalidation:r.revalidation,component:f,error:d,children:v(),routeContext:{outlet:null,matches:g,isDataRoute:!0},onError:c}):v()},null)}function rl(e){return"".concat(e," must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.")}function il(t){let n=e.useContext(Ta);return Us(n,rl(t)),n}function ol(t){let n=e.useContext(Da);return Us(n,rl(t)),n}function sl(t){let n=function(t){let n=e.useContext(za);return Us(n,rl(t)),n}(t),r=n.matches[n.matches.length-1];return Us(r.route.id,"".concat(t,' can only be used on routes that contain a unique "id"')),r.route.id}function al(){var t;let n=e.useContext(Ha),r=ol("useRouteError"),i=sl("useRouteError");return void 0!==n?n:null===(t=r.errors)||void 0===t?void 0:t[i]}var ll={};function cl(e,t,n){t||ll[e]||(ll[e]=!0,Vs(!1,n))}var ul={};function dl(e,t){e||ul[t]||(ul[t]=!0,console.warn(t))}t.useOptimistic;e.memo(function(e){let{routes:t,future:n,state:r,onError:i}=e;return Xa(t,void 0,r,i,n)});function hl(e){Us(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function fl(t){let{basename:n="/",children:r=null,location:i,navigationType:o="POP",navigator:s,static:a=!1,unstable_useTransitions:l}=t;Us(!Ua(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let c=n.replace(/^\/*/,"/"),u=e.useMemo(()=>({basename:c,navigator:s,static:a,unstable_useTransitions:l,future:{}}),[c,s,a,l]);"string"===typeof i&&(i=Ys(i));let{pathname:d="/",search:h="",hash:f="",state:p=null,key:g="default"}=i,v=e.useMemo(()=>{let e=fa(d,c);return null==e?null:{location:{pathname:e,search:h,hash:f,state:p,key:g},navigationType:o}},[c,d,h,f,p,g,o]);return Vs(null!=v,'<Router basename="'.concat(c,'"> is not able to match the URL "').concat(d).concat(h).concat(f,"\" because it does not start with the basename, so the <Router> won't render anything.")),null==v?null:e.createElement(Na.Provider,{value:u},e.createElement(Fa.Provider,{children:r,value:v}))}function pl(e){let{children:t,location:n}=e;return Xa(gl(t),n)}e.Component;function gl(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=[];return e.Children.forEach(t,(t,i)=>{if(!e.isValidElement(t))return;let o=[...n,i];if(t.type===e.Fragment)return void r.push.apply(r,gl(t.props.children,o));Us(t.type===hl,"[".concat("string"===typeof t.type?t.type:t.type.name,"] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>")),Us(!t.props.index||!t.props.children,"An index route cannot have child routes.");let s={id:t.props.id||o.join("-"),caseSensitive:t.props.caseSensitive,element:t.props.element,Component:t.props.Component,index:t.props.index,path:t.props.path,middleware:t.props.middleware,loader:t.props.loader,action:t.props.action,hydrateFallbackElement:t.props.hydrateFallbackElement,HydrateFallback:t.props.HydrateFallback,errorElement:t.props.errorElement,ErrorBoundary:t.props.ErrorBoundary,hasErrorBoundary:!0===t.props.hasErrorBoundary||null!=t.props.ErrorBoundary||null!=t.props.errorElement,shouldRevalidate:t.props.shouldRevalidate,handle:t.props.handle,lazy:t.props.lazy};t.props.children&&(s.children=gl(t.props.children,o)),r.push(s)}),r}var vl="get",ml="application/x-www-form-urlencoded";function _l(e){return"undefined"!==typeof HTMLElement&&e instanceof HTMLElement}var yl=null;var bl=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function xl(e){return null==e||bl.has(e)?e:(Vs(!1,'"'.concat(e,'" is not a valid `encType` for `<Form>`/`<fetcher.Form>` and will default to "').concat(ml,'"')),null)}function wl(e,t){let n,r,i,o,a;if(function(e){return _l(e)&&"form"===e.tagName.toLowerCase()}(e)){let s=e.getAttribute("action");r=s?fa(s,t):null,n=e.getAttribute("method")||vl,i=xl(e.getAttribute("enctype"))||ml,o=new FormData(e)}else if(function(e){return _l(e)&&"button"===e.tagName.toLowerCase()}(e)||function(e){return _l(e)&&"input"===e.tagName.toLowerCase()}(e)&&("submit"===e.type||"image"===e.type)){let a=e.form;if(null==a)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let l=e.getAttribute("formaction")||a.getAttribute("action");if(r=l?fa(l,t):null,n=e.getAttribute("formmethod")||a.getAttribute("method")||vl,i=xl(e.getAttribute("formenctype"))||xl(a.getAttribute("enctype"))||ml,o=new FormData(a,e),!function(){if(null===yl)try{new FormData(document.createElement("form"),0),yl=!1}catch(s){yl=!0}return yl}()){let{name:t,type:n,value:r}=e;if("image"===n){let e=t?"".concat(t,"."):"";o.append("".concat(e,"x"),"0"),o.append("".concat(e,"y"),"0")}else t&&o.append(t,r)}}else{if(_l(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=vl,r=null,i=ml,a=e}return o&&"text/plain"===i&&(a=o,o=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:o,body:a}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");"undefined"!==typeof window?window:"undefined"!==typeof globalThis&&globalThis;function Sl(e,t){if(!1===e||null===e||"undefined"===typeof e)throw new Error(t)}Symbol("SingleFetchRedirect");function Cl(e,t,n,r){let i="string"===typeof e?new URL(e,"undefined"===typeof window?"server://singlefetch/":window.location.origin):e;return n?i.pathname.endsWith("/")?i.pathname="".concat(i.pathname,"_.").concat(r):i.pathname="".concat(i.pathname,".").concat(r):"/"===i.pathname?i.pathname="_root.".concat(r):t&&"/"===fa(i.pathname,t)?i.pathname="".concat(t.replace(/\/$/,""),"/_root.").concat(r):i.pathname="".concat(i.pathname.replace(/\/$/,""),".").concat(r),i}async function kl(e,t){if(e.id in t)return t[e.id];try{let n=await import(e.module);return t[e.id]=n,n}catch(n){return console.error("Error loading route module `".concat(e.module,"`, reloading page...")),console.error(n),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function El(e){return null!=e&&"string"===typeof e.page}function Rl(e){return null!=e&&(null==e.href?"preload"===e.rel&&"string"===typeof e.imageSrcSet&&"string"===typeof e.imageSizes:"string"===typeof e.rel&&"string"===typeof e.href)}function Ml(e,t,n,r,i,o){let s=(e,t)=>!n[t]||e.route.id!==n[t].route.id,a=(e,t)=>{var r;return n[t].pathname!==e.pathname||(null===(r=n[t].route.path)||void 0===r?void 0:r.endsWith("*"))&&n[t].params["*"]!==e.params["*"]};return"assets"===o?t.filter((e,t)=>s(e,t)||a(e,t)):"data"===o?t.filter((t,o)=>{let l=r.routes[t.route.id];if(!l||!l.hasLoader)return!1;if(s(t,o)||a(t,o))return!0;if(t.route.shouldRevalidate){var c;let r=t.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:(null===(c=n[0])||void 0===c?void 0:c.params)||{},nextUrl:new URL(e,window.origin),nextParams:t.params,defaultShouldRevalidate:!0});if("boolean"===typeof r)return r}return!0}):[]}function Ll(e,t){let{includeHydrateFallback:n}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return r=e.map(e=>{let r=t.routes[e.route.id];if(!r)return[];let i=[r.module];return r.clientActionModule&&(i=i.concat(r.clientActionModule)),r.clientLoaderModule&&(i=i.concat(r.clientLoaderModule)),n&&r.hydrateFallbackModule&&(i=i.concat(r.hydrateFallbackModule)),r.imports&&(i=i.concat(r.imports)),i}).flat(1),[...new Set(r)];var r}function Pl(e,t){let n=new Set,r=new Set(t);return e.reduce((e,i)=>{if(t&&!El(i)&&"script"===i.as&&i.href&&r.has(i.href))return e;let o=JSON.stringify(function(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}(i));return n.has(o)||(n.add(o),e.push({key:o,link:i})),e},[])}function Tl(e,t){return"lazy"===e.mode&&!0===t}function Dl(){let t=e.useContext(Ta);return Sl(t,"You must render this element inside a <DataRouterContext.Provider> element"),t}function Ol(){let t=e.useContext(Da);return Sl(t,"You must render this element inside a <DataRouterStateContext.Provider> element"),t}var Il=e.createContext(void 0);function Al(){let t=e.useContext(Il);return Sl(t,"You must render this element inside a <HydratedRouter> element"),t}function jl(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function Bl(e,t,n){if(n&&!Hl)return[e[0]];if(t){let n=e.findIndex(e=>void 0!==t[e.route.id]);return e.slice(0,n+1)}return e}Il.displayName="FrameworkContext";function Nl(t){let{page:n}=t,r=Ls(t,js),{router:i}=Dl(),o=e.useMemo(()=>Zs(i.routes,n,i.basename),[i.routes,n,i.basename]);return o?e.createElement(zl,Is({page:n,matches:o},r)):null}function Fl(t){let{manifest:n,routeModules:r}=Al(),[i,o]=e.useState([]);return e.useEffect(()=>{let e=!1;return async function(e,t,n){return Pl((await Promise.all(e.map(async e=>{let r=t.routes[e.route.id];if(r){let e=await kl(r,n);return e.links?e.links():[]}return[]}))).flat(1).filter(Rl).filter(e=>"stylesheet"===e.rel||"preload"===e.rel).map(e=>"stylesheet"===e.rel?Is(Is({},e),{},{rel:"prefetch",as:"style"}):Is(Is({},e),{},{rel:"prefetch"})))}(t,n,r).then(t=>{e||o(t)}),()=>{e=!0}},[t,n,r]),i}function zl(t){let{page:n,matches:r}=t,i=Ls(t,Bs),o=Va(),{future:s,manifest:a,routeModules:l}=Al(),{basename:c}=Dl(),{loaderData:u,matches:d}=Ol(),h=e.useMemo(()=>Ml(n,r,d,a,o,"data"),[n,r,d,a,o]),f=e.useMemo(()=>Ml(n,r,d,a,o,"assets"),[n,r,d,a,o]),p=e.useMemo(()=>{if(n===o.pathname+o.search+o.hash)return[];let e=new Set,t=!1;if(r.forEach(n=>{var r;let i=a.routes[n.route.id];i&&i.hasLoader&&(!h.some(e=>e.route.id===n.route.id)&&n.route.id in u&&null!==(r=l[n.route.id])&&void 0!==r&&r.shouldRevalidate||i.hasClientLoader?t=!0:e.add(n.route.id))}),0===e.size)return[];let i=Cl(n,c,s.unstable_trailingSlashAwareDataRequests,"data");return t&&e.size>0&&i.searchParams.set("_routes",r.filter(t=>e.has(t.route.id)).map(e=>e.route.id).join(",")),[i.pathname+i.search]},[c,s.unstable_trailingSlashAwareDataRequests,u,o,a,h,r,n,l]),g=e.useMemo(()=>Ll(f,a),[f,a]),v=Fl(f);return e.createElement(e.Fragment,null,p.map(t=>e.createElement("link",Is({key:t,rel:"prefetch",as:"fetch",href:t},i))),g.map(t=>e.createElement("link",Is({key:t,rel:"modulepreload",href:t},i))),v.map(t=>{var n;let{key:r,link:o}=t;return e.createElement("link",Is(Is({key:r,nonce:i.nonce},o),{},{crossOrigin:null!==(n=o.crossOrigin)&&void 0!==n?n:i.crossOrigin}))}))}var Hl=!1;function Wl(t){let{manifest:n,serverHandoffString:r,isSpaMode:i,renderMeta:o,routeDiscovery:s,ssr:a}=Al(),{router:l,static:c,staticContext:u}=Dl(),{matches:d}=Ol(),h=Ia(),f=Tl(s,a);o&&(o.didRenderScripts=!0);let p=Bl(d,null,i);e.useEffect(()=>{0},[]);let g=e.useMemo(()=>{var i;if(h)return null;let o=u?"window.__reactRouterContext = ".concat(r,";").concat("window.__reactRouterContext.stream = new ReadableStream({start(controller){window.__reactRouterContext.streamController = controller;}}).pipeThrough(new TextEncoderStream());"):" ",s=c?"".concat(null!==n.hmr&&void 0!==i&&i.runtime?"import ".concat(JSON.stringify(n.hmr.runtime),";"):"").concat(f?"":"import ".concat(JSON.stringify(n.url)),";\n").concat(p.map((e,t)=>{let r="route".concat(t),i=n.routes[e.route.id];Sl(i,"Route ".concat(e.route.id," not found in manifest"));let{clientActionModule:o,clientLoaderModule:s,clientMiddlewareModule:a,hydrateFallbackModule:l,module:c}=i,u=[...o?[{module:o,varName:"".concat(r,"_clientAction")}]:[],...s?[{module:s,varName:"".concat(r,"_clientLoader")}]:[],...a?[{module:a,varName:"".concat(r,"_clientMiddleware")}]:[],...l?[{module:l,varName:"".concat(r,"_HydrateFallback")}]:[],{module:c,varName:"".concat(r,"_main")}];return 1===u.length?"import * as ".concat(r," from ").concat(JSON.stringify(c),";"):[u.map(e=>"import * as ".concat(e.varName,' from "').concat(e.module,'";')).join("\n"),"const ".concat(r," = {").concat(u.map(e=>"...".concat(e.varName)).join(","),"};")].join("\n")}).join("\n"),"\n ").concat(f?"window.__reactRouterManifest = ".concat(JSON.stringify(function(e,t){let{sri:n}=e,r=Ls(e,As),i=new Set(t.state.matches.map(e=>e.route.id)),o=t.state.location.pathname.split("/").filter(Boolean),s=["/"];for(o.pop();o.length>0;)s.push("/".concat(o.join("/"))),o.pop();s.forEach(e=>{let n=Zs(t.routes,e,t.basename);n&&n.forEach(e=>i.add(e.route.id))});let a=[...i].reduce((e,t)=>Object.assign(e,{[t]:r.routes[t]}),{});return Is(Is({},r),{},{routes:a,sri:!!n||void 0})}(n,l),null,2),";"):"","\n window.__reactRouterRouteModules = {").concat(p.map((e,t)=>"".concat(JSON.stringify(e.route.id),":route").concat(t)).join(","),"};\n\nimport(").concat(JSON.stringify(n.entry.module),");"):" ";return e.createElement(e.Fragment,null,e.createElement("script",Is(Is({},t),{},{suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:o},type:void 0})),e.createElement("script",Is(Is({},t),{},{suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:s},type:"module",async:!0})))},[]),v=Hl||h?[]:function(e){return[...new Set(e)]}(n.entry.imports.concat(Ll(p,n,{includeHydrateFallback:!0}))),m="object"===typeof n.sri?n.sri:{};return dl(!h,"The <Scripts /> element is a no-op when using RSC and can be safely removed."),Hl||h?null:e.createElement(e.Fragment,null,"object"===typeof n.sri?e.createElement("script",Is(Is({},t),{},{"rr-importmap":"",type:"importmap",suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:JSON.stringify({integrity:m})}})):null,f?null:e.createElement("link",{rel:"modulepreload",href:n.url,crossOrigin:t.crossOrigin,integrity:m[n.url],suppressHydrationWarning:!0}),e.createElement("link",{rel:"modulepreload",href:n.entry.module,crossOrigin:t.crossOrigin,integrity:m[n.entry.module],suppressHydrationWarning:!0}),v.map(n=>e.createElement("link",{key:n,rel:"modulepreload",href:n,crossOrigin:t.crossOrigin,integrity:m[n],suppressHydrationWarning:!0})),g)}function Ul(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return e=>{t.forEach(t=>{"function"===typeof t?t(e):null!=t&&(t.current=e)})}}e.Component;function Vl(t){let{error:n,isOutsideRemixApp:r}=t;console.error(n);let i,o=e.createElement("script",{dangerouslySetInnerHTML:{__html:'\n console.log(\n "\ud83d\udcbf Hey developer \ud83d\udc4b. You can provide a way better UX than this when your app throws errors. Check out https://reactrouter.com/how-to/error-boundary for more information."\n );\n '}});if(ka(n))return e.createElement($l,{title:"Unhandled Thrown Response!"},e.createElement("h1",{style:{fontSize:"24px"}},n.status," ",n.statusText),o);if(n instanceof Error)0;else{let e=null==n?"Unknown Error":"object"===typeof n&&"toString"in n?n.toString():JSON.stringify(n);new Error(e)}return e.createElement($l,{title:"Application Error!",isOutsideRemixApp:r},e.createElement("h1",{style:{fontSize:"24px"}},"Application Error"),e.createElement("pre",{style:{padding:"2rem",background:"hsla(10, 50%, 50%, 0.1)",color:"red",overflow:"auto"}},i.stack),o)}function $l(t){var n;let{title:r,renderScripts:i,isOutsideRemixApp:o,children:s}=t,{routeModules:a}=Al();return null!==a.root&&void 0!==n&&n.Layout&&!o?s:e.createElement("html",{lang:"en"},e.createElement("head",null,e.createElement("meta",{charSet:"utf-8"}),e.createElement("meta",{name:"viewport",content:"width=device-width,initial-scale=1,viewport-fit=cover"}),e.createElement("title",null,r)),e.createElement("body",null,e.createElement("main",{style:{fontFamily:"system-ui, sans-serif",padding:"2rem"}},s,i?e.createElement(Wl,null):null)))}var ql="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement;try{ql&&(window.__reactRouterVersion="7.13.0")}catch(s){}function Kl(t){let{basename:n,children:r,unstable_useTransitions:i,window:o}=t,s=e.useRef();null==s.current&&(s.current=Ws({window:o,v5Compat:!0}));let a=s.current,[l,c]=e.useState({action:a.action,location:a.location}),u=e.useCallback(t=>{!1===i?c(t):e.startTransition(()=>c(t))},[i]);return e.useLayoutEffect(()=>a.listen(u),[a,u]),e.createElement(fl,{basename:n,children:r,location:l.location,navigationType:l.action,navigator:a,unstable_useTransitions:i})}var Yl=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Xl=e.forwardRef(function(t,n){let{onClick:r,discover:i="render",prefetch:o="none",relative:s,reloadDocument:a,replace:l,state:c,target:u,to:d,preventScrollReset:h,viewTransition:f,unstable_defaultShouldRevalidate:p}=t,g=Ls(t,Ns),{basename:v,unstable_useTransitions:m}=e.useContext(Na),_="string"===typeof d&&Yl.test(d),y=Ma(d,v);d=y.to;let b=function(t){let{relative:n}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Us(Ua(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:i}=e.useContext(Na),{hash:o,pathname:s,search:a}=Ya(t,{relative:n}),l=s;return"/"!==r&&(l="/"===s?r:ba([r,s])),i.createHref({pathname:l,search:a,hash:o})}(d,{relative:s}),[x,w,S]=function(t,n){let r=e.useContext(Il),[i,o]=e.useState(!1),[s,a]=e.useState(!1),{onFocus:l,onBlur:c,onMouseEnter:u,onMouseLeave:d,onTouchStart:h}=n,f=e.useRef(null);e.useEffect(()=>{if("render"===t&&a(!0),"viewport"===t){let e=new IntersectionObserver(e=>{e.forEach(e=>{a(e.isIntersecting)})},{threshold:.5});return f.current&&e.observe(f.current),()=>{e.disconnect()}}},[t]),e.useEffect(()=>{if(i){let e=setTimeout(()=>{a(!0)},100);return()=>{clearTimeout(e)}}},[i]);let p=()=>{o(!0)},g=()=>{o(!1),a(!1)};return r?"intent"!==t?[s,f,{}]:[s,f,{onFocus:jl(l,p),onBlur:jl(c,g),onMouseEnter:jl(u,p),onMouseLeave:jl(d,g),onTouchStart:jl(h,p)}]:[!1,f,{}]}(o,g),C=function(t){let{target:n,replace:r,state:i,preventScrollReset:o,relative:s,viewTransition:a,unstable_defaultShouldRevalidate:l,unstable_useTransitions:c}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},u=Ka(),d=Va(),h=Ya(t,{relative:s});return e.useCallback(f=>{if(function(e,t){return 0===e.button&&(!t||"_self"===t)&&!function(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}(e)}(f,n)){f.preventDefault();let n=void 0!==r?r:Ks(d)===Ks(h),p=()=>u(t,{replace:n,state:i,preventScrollReset:o,relative:s,viewTransition:a,unstable_defaultShouldRevalidate:l});c?e.startTransition(()=>p()):p()}},[d,u,h,r,i,n,t,o,s,a,l,c])}(d,{replace:l,state:c,target:u,preventScrollReset:h,relative:s,viewTransition:f,unstable_defaultShouldRevalidate:p,unstable_useTransitions:m});let k=e.createElement("a",Is(Is(Is({},g),S),{},{href:y.absoluteURL||b,onClick:y.isExternal||a?r:function(e){r&&r(e),e.defaultPrevented||C(e)},ref:Ul(n,w),target:u,"data-discover":_||"render"!==i?void 0:"true"}));return x&&!_?e.createElement(e.Fragment,null,k,e.createElement(Nl,{page:b})):k});Xl.displayName="Link";var Gl=e.forwardRef(function(t,n){let{"aria-current":r="page",caseSensitive:i=!1,className:o="",end:s=!1,style:a,to:l,viewTransition:c,children:u}=t,d=Ls(t,Fs),h=Ya(l,{relative:d.relative}),f=Va(),p=e.useContext(Da),{navigator:g,basename:v}=e.useContext(Na),m=null!=p&&function(t){let{relative:n}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.useContext(Aa);Us(null!=r,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:i}=Ql("useViewTransitionState"),o=Ya(t,{relative:n});if(!r.isTransitioning)return!1;let s=fa(r.currentLocation.pathname,i)||r.currentLocation.pathname,a=fa(r.nextLocation.pathname,i)||r.nextLocation.pathname;return null!=ua(o.pathname,a)||null!=ua(o.pathname,s)}(h)&&!0===c,_=g.encodeLocation?g.encodeLocation(h).pathname:h.pathname,y=f.pathname,b=p&&p.navigation&&p.navigation.location?p.navigation.location.pathname:null;i||(y=y.toLowerCase(),b=b?b.toLowerCase():null,_=_.toLowerCase()),b&&v&&(b=fa(b,v)||b);const x="/"!==_&&_.endsWith("/")?_.length-1:_.length;let w,S=y===_||!s&&y.startsWith(_)&&"/"===y.charAt(x),C=null!=b&&(b===_||!s&&b.startsWith(_)&&"/"===b.charAt(_.length)),k={isActive:S,isPending:C,isTransitioning:m},E=S?r:void 0;w="function"===typeof o?o(k):[o,S?"active":null,C?"pending":null,m?"transitioning":null].filter(Boolean).join(" ");let R="function"===typeof a?a(k):a;return e.createElement(Xl,Is(Is({},d),{},{"aria-current":E,className:w,ref:n,style:R,to:l,viewTransition:c}),"function"===typeof u?u(k):u)});Gl.displayName="NavLink";var Zl=e.forwardRef((t,n)=>{let{discover:r="render",fetcherKey:i,navigate:o,reloadDocument:s,replace:a,state:l,method:c=vl,action:u,onSubmit:d,relative:h,preventScrollReset:f,viewTransition:p,unstable_defaultShouldRevalidate:g}=t,v=Ls(t,zs),{unstable_useTransitions:m}=e.useContext(Na),_=nc(),y=function(t){let{relative:n}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{basename:r}=e.useContext(Na),i=e.useContext(za);Us(i,"useFormAction must be used inside a RouteContext");let[o]=i.matches.slice(-1),s=Is({},Ya(t||".",{relative:n})),a=Va();if(null==t){s.search=a.search;let e=new URLSearchParams(s.search),t=e.getAll("index"),n=t.some(e=>""===e);if(n){e.delete("index"),t.filter(e=>e).forEach(t=>e.append("index",t));let n=e.toString();s.search=n?"?".concat(n):""}}t&&"."!==t||!o.route.index||(s.search=s.search?s.search.replace(/^\?/,"?index&"):"?index");"/"!==r&&(s.pathname="/"===s.pathname?r:ba([r,s.pathname]));return Ks(s)}(u,{relative:h}),b="get"===c.toLowerCase()?"get":"post",x="string"===typeof u&&Yl.test(u);return e.createElement("form",Is(Is({ref:n,method:b,action:y,onSubmit:s?d:t=>{if(d&&d(t),t.defaultPrevented)return;t.preventDefault();let n=t.nativeEvent.submitter,r=(null===n||void 0===n?void 0:n.getAttribute("formmethod"))||c,s=()=>_(n||t.currentTarget,{fetcherKey:i,method:r,navigate:o,replace:a,state:l,relative:h,preventScrollReset:f,viewTransition:p,unstable_defaultShouldRevalidate:g});m&&!1!==o?e.startTransition(()=>s()):s()}},v),{},{"data-discover":x||"render"!==r?void 0:"true"}))});function Jl(e){return"".concat(e," must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.")}function Ql(t){let n=e.useContext(Ta);return Us(n,Jl(t)),n}Zl.displayName="Form";var ec=0,tc=()=>"__".concat(String(++ec),"__");function nc(){let{router:t}=Ql("useSubmit"),{basename:n}=e.useContext(Na),r=sl("useRouteId"),i=t.fetch,o=t.navigate;return e.useCallback(async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{action:s,method:a,encType:l,formData:c,body:u}=wl(e,n);if(!1===t.navigate){let e=t.fetcherKey||tc();await i(e,r,t.action||s,{unstable_defaultShouldRevalidate:t.unstable_defaultShouldRevalidate,preventScrollReset:t.preventScrollReset,formData:c,body:u,formMethod:t.method||a,formEncType:t.encType||l,flushSync:t.flushSync})}else await o(t.action||s,{unstable_defaultShouldRevalidate:t.unstable_defaultShouldRevalidate,preventScrollReset:t.preventScrollReset,formData:c,body:u,formMethod:t.method||a,formEncType:t.encType||l,replace:t.replace,state:t.state,fromRouteId:r,flushSync:t.flushSync,viewTransition:t.viewTransition})},[i,o,n,r])}var rc=n(579);const ic="MVC (Model-View-Controller):\n- Controllers should only handle HTTP requests and responses\n- Business logic belongs in models or services\n- Views should be presentational only, no logic\n- Database queries only in models\n- No direct database access from controllers or views\n\nClean Architecture:\n- Business logic must be independent of frameworks\n- Use cases should not depend on UI or database\n- Dependencies point inward (toward business logic)\n- External concerns (DB, UI) in outer layers only\n- No circular dependencies between layers\n\nLayered Architecture:\n- Presentation layer handles UI only\n- Business layer contains core logic\n- Data layer handles persistence only\n- Each layer only depends on layer below\n- No skipping layers in dependencies\n\nFeature-Based Organization:\n- Related functionality grouped by feature, not type\n- Each feature folder is self-contained\n- Shared utilities in /shared or /common only\n- No cross-feature dependencies except through interfaces\n- Feature folders should be relocatable\n\nReact Best Practices:\n- Components should be presentational or container, not both\n- Business logic in hooks or services, not components\n- No data fetching in components (use hooks)\n- Props drilling max 2 levels, use context beyond that\n- No large component files (>200 lines)\n\nAPI Architecture:\n- Controllers handle routing only\n- Business logic in services\n- Data access in repositories\n- Validation at controller level\n- Error handling centralized in middleware";const oc=function(t){var n,r,i,o;let{isOpen:a,onClose:l,issues:c=[],standardsViolations:u=[],isLoadingStandards:d=!1,onScanStandards:h}=t;const[f,p]=(0,e.useState)("health"),[g,v]=(0,e.useState)([]),[m,_]=(0,e.useState)(!1),[y,b]=(0,e.useState)("Copied to clipboard!"),[x,w]=(0,e.useState)({largeFiles:!1,crowdedFolders:!1,unusedVariables:!1}),S=(0,e.useRef)(l),C=(0,e.useRef)(a),k=g.length>0?g:c;(0,e.useEffect)(()=>{a&&!C.current&&(p("health"),c.length>0&&0===g.length&&v(c)),C.current=a},[a,c,g.length]),(0,e.useEffect)(()=>{S.current=l},[l]);const E=k.filter(e=>"large_file"===e.type),R=k.filter(e=>"crowded_folder"===e.type),M=k.filter(e=>"unused_variable"===e.type),L=M.reduce((e,t)=>(e[t.file]||(e[t.file]=[]),e[t.file].push(t),e),{}),P=k.length,T=(null===u||void 0===u?void 0:u.length)||0,D=P+T;(0,e.useEffect)(()=>{console.log("\ud83d\udd0d [StatusChecklistModal] standardsViolations prop updated:",u),console.log("\ud83d\udd0d [StatusChecklistModal] standardsViolationsCount:",T),console.log("\ud83d\udd0d [StatusChecklistModal] isLoadingStandards:",d)},[u,T,d]);const O=e=>{w(t=>Is(Is({},t),{},{[e]:!t[e]}))},[I,A]=(0,e.useState)({hasRun:!1,issues:[],lastScanTime:null}),[j,B]=(0,e.useState)(()=>{const e={quickWins:{filesExceedingLines:{enabled:!0,threshold:500},foldersExceedingFiles:{enabled:!0,threshold:20},unusedCode:{enabled:!0},circularDependencies:{enabled:!1}},architecture:ic};try{const t=localStorage.getItem("codeQualityRules");if(t){const n=JSON.parse(t);return n.architecture||(n.architecture=ic),Is(Is({},e),n)}}catch(s){console.error("Error loading rules from localStorage:",s)}return e});if((0,e.useEffect)(()=>{try{localStorage.setItem("codeQualityRules",JSON.stringify(j))}catch(s){console.error("Error saving rules to localStorage:",s)}},[j]),(0,e.useEffect)(()=>{if(!a)return;const e=e=>{"Escape"===e.key&&S.current()};return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)}},[a]),!a)return null;const N=(e,t)=>{B(n=>Is(Is({},n),{},{[e]:Is(Is({},n[e]),{},{[t]:Is(Is({},n[e][t]),{},{enabled:!n[e][t].enabled})})}))},F=(e,t,n)=>{const r=parseInt(n)||0;B(n=>Is(Is({},n),{},{[e]:Is(Is({},n[e]),{},{[t]:Is(Is({},n[e][t]),{},{threshold:r})})}))},z=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Copied to clipboard!";try{await navigator.clipboard.writeText(e),b(t),_(!0),setTimeout(()=>_(!1),2e3)}catch(n){console.error("Failed to copy:",n)}};return(0,rc.jsxs)("div",{onClick:e=>{e.target===e.currentTarget&&l()},style:{position:"fixed",top:0,left:0,right:0,bottom:0,background:"rgba(0, 0, 0, 0.4)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:2e3,animation:"fadeIn 0.15s ease-in"},children:[(0,rc.jsx)("div",{style:{background:"#fff",borderRadius:"12px",boxShadow:"0 8px 24px rgba(0, 0, 0, 0.2)",width:"90%",maxWidth:"500px",maxHeight:"80vh",overflow:"hidden",display:"flex",flexDirection:"column",animation:"slideUp 0.2s ease-out"},onClick:e=>e.stopPropagation(),children:"health"===f?(0,rc.jsx)(rc.Fragment,{children:(0,rc.jsxs)("div",{style:{padding:"20px",overflowY:"auto",flex:1},children:[(0,rc.jsxs)("div",{style:{fontSize:"14px",fontWeight:"600",color:"#dc2626",marginBottom:"20px",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif'},children:["\ud83d\udd34 ",D," ISSUES DETECTED"]}),(0,rc.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"12px"},children:[(0,rc.jsxs)("div",{style:{fontSize:"13px",fontWeight:"600",color:"#111827",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif'},children:["CODE QUALITY (",P,"):"]}),(0,rc.jsx)("button",{onClick:()=>((e,t,n)=>{const r=[];if(e.length>0){var i;const t=(null===(i=e[0])||void 0===i?void 0:i.limit)||500,n=e.map(e=>"".concat(e.file," (").concat(e.lines," lines)")).join("\n");r.push("Current architecture smell: components mixing presentation, state management, and domain logic.\n\nFiles to refactor (each file must be ".concat(t," lines or fewer after refactoring):\n").concat(n,"\n\nDesign a module structure that: \n1. Separates concerns: /ui, /domain, /state\n2. Makes dependencies flow one direction\n3. Enables testing each layer independently\n4. Keeps related code colocated\n5. Ensures no single file exceeds ").concat(t," lines\n\nOnce you have the dependency graph, identify the specific files that need to be refactored and execute the refactoring."))}if(t.length>0){var o;const e=(null===(o=t[0])||void 0===o?void 0:o.limit)||20,n=t.map(e=>"".concat(e.folder," (").concat(e.count," files)")).join("\n");r.push("Create subfolders to better organize the following crowded directories. Each folder should have no more than ".concat(e," files after reorganization:\n\n").concat(n))}if(n.length>0){const e=n.reduce((e,t)=>(e[t.file]||(e[t.file]=[]),e[t.file].push(" - ".concat(t.variable," (line ").concat(t.line,")")),e),{}),t=Object.entries(e).map(e=>{let[t,n]=e;return"".concat(t,":\n").concat(n.join("\n"))}).join("\n\n");r.push("Remove or fix the following unused variables:\n\n".concat(t))}z(r.join("\n\n---\n\n"),"Copied all to clipboard!")})(E,R,M),title:"Copy all issues",style:{padding:"4px",background:"transparent",border:"none",borderRadius:"4px",cursor:"pointer",transition:"all 0.15s ease",display:"flex",alignItems:"center",justifyContent:"center"},onMouseEnter:e=>{e.currentTarget.style.background="#f0f0f0"},onMouseLeave:e=>{e.currentTarget.style.background="transparent"},children:(0,rc.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"#6b7280",style:{width:"18px",height:"18px"},children:(0,rc.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.666 3.888A2.25 2.25 0 0 0 13.5 2.25h-3c-1.03 0-1.9.693-2.166 1.638m7.332 0c.055.194.084.4.084.612v0a.75.75 0 0 1-.75.75H9a.75.75 0 0 1-.75-.75v0c0-.212.03-.418.084-.612m7.332 0c.646.049 1.288.11 1.927.184 1.1.128 1.907 1.077 1.907 2.185V19.5a2.25 2.25 0 0 1-2.25 2.25H6.75A2.25 2.25 0 0 1 4.5 19.5V6.257c0-1.108.806-2.057 1.907-2.185a48.208 48.208 0 0 1 1.927-.184"})})})]}),k.length>0&&(0,rc.jsxs)("div",{style:{marginBottom:"24px"},children:[E.length>0&&(0,rc.jsxs)("div",{style:{marginBottom:"12px",border:"1px solid #e5e7eb",borderRadius:"6px",overflow:"hidden"},children:[(0,rc.jsxs)("div",{style:{padding:"12px 16px",background:"#f9fafb",display:"flex",justifyContent:"space-between",alignItems:"center",transition:"background-color 0.15s ease"},children:[(0,rc.jsxs)("div",{onClick:()=>O("largeFiles"),style:{fontSize:"13px",fontWeight:"600",color:"#111827",cursor:"pointer",flex:1},children:["Found ",E.length," file",1!==E.length?"s":""," exceeding ",(null===(n=E[0])||void 0===n?void 0:n.limit)||500," line length"]}),(0,rc.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[(0,rc.jsx)("button",{onClick:e=>{e.stopPropagation(),(e=>{var t;const n=(null===(t=e[0])||void 0===t?void 0:t.limit)||500,r=e.map(e=>"".concat(e.file," (").concat(e.lines," lines)")).join("\n"),i="Current architecture smell: components mixing presentation, state management, and domain logic.\n\nFiles to refactor (each file must be ".concat(n," lines or fewer after refactoring):\n").concat(r,"\n\nDesign a module structure that:\n1. Separates concerns: /ui, /domain, /state\n2. Makes dependencies flow one direction\n3. Enables testing each layer independently\n4. Keeps related code colocated\n5. Ensures no single file exceeds ").concat(n," lines\n\nOnce you have the dependency graph, identify the specific files that need to be refactored and execute the refactoring.");z(i)})(E)},title:"Copy large files",style:{padding:"4px",background:"transparent",border:"none",borderRadius:"4px",cursor:"pointer",transition:"all 0.15s ease",display:"flex",alignItems:"center",justifyContent:"center"},onMouseEnter:e=>{e.currentTarget.style.background="#e5e7eb"},onMouseLeave:e=>{e.currentTarget.style.background="transparent"},children:(0,rc.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"#6b7280",style:{width:"16px",height:"16px"},children:(0,rc.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.666 3.888A2.25 2.25 0 0 0 13.5 2.25h-3c-1.03 0-1.9.693-2.166 1.638m7.332 0c.055.194.084.4.084.612v0a.75.75 0 0 1-.75.75H9a.75.75 0 0 1-.75-.75v0c0-.212.03-.418.084-.612m7.332 0c.646.049 1.288.11 1.927.184 1.1.128 1.907 1.077 1.907 2.185V19.5a2.25 2.25 0 0 1-2.25 2.25H6.75A2.25 2.25 0 0 1 4.5 19.5V6.257c0-1.108.806-2.057 1.907-2.185a48.208 48.208 0 0 1 1.927-.184"})})}),(0,rc.jsx)("div",{onClick:()=>O("largeFiles"),style:{fontSize:"12px",color:"#6b7280",transition:"transform 0.2s ease",transform:x.largeFiles?"rotate(180deg)":"rotate(0deg)",cursor:"pointer",padding:"4px"},children:"\u25bc"})]})]}),x.largeFiles&&(0,rc.jsx)("div",{style:{padding:"8px 16px",background:"#fff",maxHeight:"300px",overflowY:"auto"},children:E.map((e,t)=>(0,rc.jsxs)("div",{style:{padding:"8px 0",borderBottom:t<E.length-1?"1px solid #f3f4f6":"none",fontSize:"13px",color:"#111827"},children:[(0,rc.jsx)("code",{style:{background:"#f3f4f6",padding:"2px 6px",borderRadius:"3px",fontFamily:"monospace",fontSize:"12px"},children:e.file})," has ",(0,rc.jsx)("strong",{children:e.lines})," lines"]},t))})]}),R.length>0&&(0,rc.jsxs)("div",{style:{border:"1px solid #e5e7eb",borderRadius:"6px",overflow:"hidden"},children:[(0,rc.jsxs)("div",{style:{padding:"12px 16px",background:"#f9fafb",display:"flex",justifyContent:"space-between",alignItems:"center",transition:"background-color 0.15s ease"},children:[(0,rc.jsxs)("div",{onClick:()=>O("crowdedFolders"),style:{fontSize:"13px",fontWeight:"600",color:"#111827",cursor:"pointer",flex:1},children:["Found ",R.length," folder",1!==R.length?"s":""," exceeding ",(null===(r=R[0])||void 0===r?void 0:r.limit)||20," file count"]}),(0,rc.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[(0,rc.jsx)("button",{onClick:e=>{e.stopPropagation(),(e=>{var t;const n=(null===(t=e[0])||void 0===t?void 0:t.limit)||20,r=e.map(e=>"".concat(e.folder," (").concat(e.count," files)")).join("\n"),i="Create subfolders to better organize the following crowded directories. Each folder should have no more than ".concat(n," files after reorganization:\n\n").concat(r);z(i)})(R)},title:"Copy crowded folders",style:{padding:"4px",background:"transparent",border:"none",borderRadius:"4px",cursor:"pointer",transition:"all 0.15s ease",display:"flex",alignItems:"center",justifyContent:"center"},onMouseEnter:e=>{e.currentTarget.style.background="#e5e7eb"},onMouseLeave:e=>{e.currentTarget.style.background="transparent"},children:(0,rc.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"#6b7280",style:{width:"16px",height:"16px"},children:(0,rc.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.666 3.888A2.25 2.25 0 0 0 13.5 2.25h-3c-1.03 0-1.9.693-2.166 1.638m7.332 0c.055.194.084.4.084.612v0a.75.75 0 0 1-.75.75H9a.75.75 0 0 1-.75-.75v0c0-.212.03-.418.084-.612m7.332 0c.646.049 1.288.11 1.927.184 1.1.128 1.907 1.077 1.907 2.185V19.5a2.25 2.25 0 0 1-2.25 2.25H6.75A2.25 2.25 0 0 1 4.5 19.5V6.257c0-1.108.806-2.057 1.907-2.185a48.208 48.208 0 0 1 1.927-.184"})})}),(0,rc.jsx)("div",{onClick:()=>O("crowdedFolders"),style:{fontSize:"12px",color:"#6b7280",transition:"transform 0.2s ease",transform:x.crowdedFolders?"rotate(180deg)":"rotate(0deg)",cursor:"pointer",padding:"4px"},children:"\u25bc"})]})]}),x.crowdedFolders&&(0,rc.jsx)("div",{style:{padding:"8px 16px",background:"#fff",maxHeight:"300px",overflowY:"auto"},children:R.map((e,t)=>(0,rc.jsxs)("div",{style:{padding:"8px 0",borderBottom:t<R.length-1?"1px solid #f3f4f6":"none",fontSize:"13px",color:"#111827"},children:[(0,rc.jsx)("code",{style:{background:"#f3f4f6",padding:"2px 6px",borderRadius:"3px",fontFamily:"monospace",fontSize:"12px"},children:e.folder})," has ",(0,rc.jsx)("strong",{children:e.count})," files"]},t))})]}),M.length>0&&(0,rc.jsxs)("div",{style:{marginTop:"12px",border:"1px solid #e5e7eb",borderRadius:"6px",overflow:"hidden"},children:[(0,rc.jsxs)("div",{style:{padding:"12px 16px",background:"#f9fafb",display:"flex",justifyContent:"space-between",alignItems:"center",transition:"background-color 0.15s ease"},children:[(0,rc.jsxs)("div",{onClick:()=>O("unusedVariables"),style:{fontSize:"13px",fontWeight:"600",color:"#111827",cursor:"pointer",flex:1},children:["Found ",M.length," unused variable",1!==M.length?"s":""," across ",Object.keys(L).length," file",1!==Object.keys(L).length?"s":""]}),(0,rc.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[(0,rc.jsx)("button",{onClick:e=>{e.stopPropagation(),(e=>{const t=e.reduce((e,t)=>(e[t.file]||(e[t.file]=[]),e[t.file].push(" - ".concat(t.variable," (line ").concat(t.line,")")),e),{}),n=Object.entries(t).map(e=>{let[t,n]=e;return"".concat(t,":\n").concat(n.join("\n"))}).join("\n\n"),r="Remove or fix the following unused variables:\n\n".concat(n);z(r)})(M)},title:"Copy unused variables",style:{padding:"4px",background:"transparent",border:"none",borderRadius:"4px",cursor:"pointer",transition:"all 0.15s ease",display:"flex",alignItems:"center",justifyContent:"center"},onMouseEnter:e=>{e.currentTarget.style.background="#e5e7eb"},onMouseLeave:e=>{e.currentTarget.style.background="transparent"},children:(0,rc.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"#6b7280",style:{width:"16px",height:"16px"},children:(0,rc.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.666 3.888A2.25 2.25 0 0 0 13.5 2.25h-3c-1.03 0-1.9.693-2.166 1.638m7.332 0c.055.194.084.4.084.612v0a.75.75 0 0 1-.75.75H9a.75.75 0 0 1-.75-.75v0c0-.212.03-.418.084-.612m7.332 0c.646.049 1.288.11 1.927.184 1.1.128 1.907 1.077 1.907 2.185V19.5a2.25 2.25 0 0 1-2.25 2.25H6.75A2.25 2.25 0 0 1 4.5 19.5V6.257c0-1.108.806-2.057 1.907-2.185a48.208 48.208 0 0 1 1.927-.184"})})}),(0,rc.jsx)("div",{onClick:()=>O("unusedVariables"),style:{fontSize:"12px",color:"#6b7280",transition:"transform 0.2s ease",transform:x.unusedVariables?"rotate(180deg)":"rotate(0deg)",cursor:"pointer",padding:"4px"},children:"\u25bc"})]})]}),x.unusedVariables&&(0,rc.jsx)("div",{style:{padding:"8px 16px",background:"#fff",maxHeight:"300px",overflowY:"auto"},children:Object.entries(L).map((e,t)=>{let[n,r]=e;return(0,rc.jsxs)("div",{style:{padding:"8px 0",borderBottom:t<Object.keys(L).length-1?"1px solid #f3f4f6":"none"},children:[(0,rc.jsx)("code",{style:{background:"#f3f4f6",padding:"2px 6px",borderRadius:"3px",fontFamily:"monospace",fontSize:"12px",display:"inline-block",marginBottom:"6px"},children:n}),(0,rc.jsx)("div",{style:{paddingLeft:"12px"},children:r.map((e,t)=>(0,rc.jsxs)("div",{style:{fontSize:"12px",color:"#6b7280",padding:"2px 0",display:"flex",alignItems:"flex-start",gap:"6px"},children:[(0,rc.jsxs)("span",{style:{color:"#9ca3af",fontFamily:"monospace",fontSize:"11px",flexShrink:0},children:["L",e.line]}),(0,rc.jsxs)("span",{style:{color:"#111827"},children:[(0,rc.jsx)("strong",{children:e.variable}),e.message&&!e.message.includes("Definition for rule")&&(0,rc.jsxs)("span",{style:{color:"#6b7280"},children:[" \u2014 ",e.message]})]})]},t))})]},n)})})]})]}),(0,rc.jsx)("div",{style:{display:"flex",justifyContent:"flex-end",marginTop:"20px"},children:(0,rc.jsxs)("button",{onClick:()=>p("rules"),style:{padding:"6px 12px",fontSize:"12px",fontWeight:"600",background:"transparent",color:"#6b7280",border:"1px solid #e5e7eb",borderRadius:"6px",cursor:"pointer",transition:"all 0.15s ease",display:"flex",alignItems:"center",gap:"6px"},onMouseEnter:e=>{e.target.style.background="#f9fafb",e.target.style.borderColor="#d1d5db",e.target.style.color="#111827"},onMouseLeave:e=>{e.target.style.background="transparent",e.target.style.borderColor="#e5e7eb",e.target.style.color="#6b7280"},children:[(0,rc.jsx)("span",{children:"\u2699\ufe0f"}),"edit rules"]})})]})}):(0,rc.jsx)(rc.Fragment,{children:(0,rc.jsxs)("div",{style:{padding:"20px",overflowY:"auto",flex:1},children:[(0,rc.jsxs)("div",{style:{marginBottom:"24px"},children:[(0,rc.jsx)("div",{style:{fontSize:"13px",fontWeight:"600",color:"#111827",marginBottom:"12px",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif'},children:"Code Quality:"}),(0,rc.jsxs)("label",{style:{display:"flex",alignItems:"center",gap:"10px",padding:"8px 0",cursor:"pointer"},children:[(0,rc.jsx)("input",{type:"checkbox",checked:j.quickWins.filesExceedingLines.enabled,onChange:()=>N("quickWins","filesExceedingLines"),style:{width:"18px",height:"18px",cursor:"pointer",accentColor:"#3B82F6"}}),(0,rc.jsx)("span",{style:{fontSize:"13px",color:"#111827"},children:"Flag Files exceeding"}),(0,rc.jsx)("input",{type:"number",value:j.quickWins.filesExceedingLines.threshold,onChange:e=>F("quickWins","filesExceedingLines",e.target.value),style:{width:"60px",padding:"4px 8px",fontSize:"13px",border:"1px solid #d1d5db",borderRadius:"4px",textAlign:"center"}}),(0,rc.jsx)("span",{style:{fontSize:"13px",color:"#111827"},children:"lines"})]}),(0,rc.jsxs)("label",{style:{display:"flex",alignItems:"center",gap:"10px",padding:"8px 0",cursor:"pointer"},children:[(0,rc.jsx)("input",{type:"checkbox",checked:j.quickWins.foldersExceedingFiles.enabled,onChange:()=>N("quickWins","foldersExceedingFiles"),style:{width:"18px",height:"18px",cursor:"pointer",accentColor:"#3B82F6"}}),(0,rc.jsx)("span",{style:{fontSize:"13px",color:"#111827"},children:"Flag Folders exceeding"}),(0,rc.jsx)("input",{type:"number",value:j.quickWins.foldersExceedingFiles.threshold,onChange:e=>F("quickWins","foldersExceedingFiles",e.target.value),style:{width:"60px",padding:"4px 8px",fontSize:"13px",border:"1px solid #d1d5db",borderRadius:"4px",textAlign:"center"}}),(0,rc.jsx)("span",{style:{fontSize:"13px",color:"#111827"},children:"files"})]}),(0,rc.jsxs)("label",{style:{display:"flex",alignItems:"center",gap:"10px",padding:"8px 0",cursor:"pointer"},children:[(0,rc.jsx)("input",{type:"checkbox",checked:null===(i=null===(o=j.quickWins.unusedCode)||void 0===o?void 0:o.enabled)||void 0===i||i,onChange:()=>N("quickWins","unusedCode"),style:{width:"18px",height:"18px",cursor:"pointer",accentColor:"#3B82F6"}}),(0,rc.jsx)("span",{style:{fontSize:"13px",color:"#111827"},children:"Flag Unused imports & dead code"})]}),(0,rc.jsxs)("label",{style:{display:"flex",alignItems:"center",gap:"10px",padding:"8px 0",cursor:"pointer"},children:[(0,rc.jsx)("input",{type:"checkbox",checked:j.quickWins.circularDependencies.enabled,onChange:()=>N("quickWins","circularDependencies"),style:{width:"18px",height:"18px",cursor:"pointer",accentColor:"#3B82F6"}}),(0,rc.jsx)("span",{style:{fontSize:"13px",color:"#111827"},children:"Flag Circular dependencies"})]})]}),(0,rc.jsx)("div",{style:{display:"flex",justifyContent:"flex-end",marginTop:"20px"},children:(0,rc.jsx)("button",{onClick:()=>p("health"),style:{padding:"8px 16px",fontSize:"13px",fontWeight:"600",background:"#3B82F6",color:"white",border:"none",borderRadius:"6px",cursor:"pointer",transition:"all 0.15s ease"},onMouseEnter:e=>{e.target.style.background="#2563eb"},onMouseLeave:e=>{e.target.style.background="#3B82F6"},children:"Save"})})]})})}),(0,rc.jsx)("style",{children:"\n @keyframes fadeIn {\n from { opacity: 0; }\n to { opacity: 1; }\n }\n @keyframes slideUp {\n from {\n opacity: 0;\n transform: translateY(20px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n }\n @keyframes spin {\n from { transform: rotate(0deg); }\n to { transform: rotate(360deg); }\n }\n "}),m&&(0,rc.jsx)("div",{style:{position:"fixed",bottom:"24px",right:"24px",background:"#333",color:"#fff",padding:"12px 20px",borderRadius:"8px",fontSize:"14px",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",zIndex:10001,animation:"slideUp 0.2s ease-out"},children:y})]})},sc=window.BONZAI_API||"http://localhost:3001",ac="/read",lc="/write",cc="/scan_standards",uc="bonzai/config.json";const dc=function(t){let{isOpen:n,onClose:r,fullScreen:i=!1}=t;const[o,a]=(0,e.useState)({customChecks:{requirements:""},autoBurn:{enabled:!1},eslint:{enabled:!0,rules:["no-unused-vars"]},typescript:{enabled:!0},lineLimit:{enabled:!0,limit:300,prompt:"Split any file with over {{ linelimit }} lines into smaller files."},folderLimit:{enabled:!0,limit:15,prompt:"Split any folder with over {{ folderlimit }} items into smaller, compartmentalized folders."},testCheck:{enabled:!1,patterns:{".vue":".test.js",".jsx":".test.jsx",".tsx":".test.tsx"},prompt:"Create test files for components that are missing them."}}),[l,c]=(0,e.useState)(!1),[u,d]=(0,e.useState)(!1),[h,f]=(0,e.useState)(!1),[p,g]=(0,e.useState)(null),[v,m]=(0,e.useState)(null),[_,y]=(0,e.useState)(null),[b,x]=(0,e.useState)(!1),w=(0,e.useRef)(r),S=(0,e.useRef)(!1),C=(0,e.useRef)(null);(0,e.useEffect)(()=>{w.current=r},[r]),(0,e.useEffect)(()=>{(n||i)&&k()},[n,i]),(0,e.useEffect)(()=>{if(!n)return;const e=e=>{"Escape"===e.key&&w.current()};return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)}},[n]);const k=async()=>{c(!0),g(null);try{const e=await fetch("".concat(sc).concat(ac,"?path=").concat(encodeURIComponent(uc)),{method:"GET",mode:"cors"});if(e.ok){const t=e.headers.get("content-type");let n;if(t&&t.includes("application/json")){const t=await e.json();n=t.content||t}else{const t=await e.text();try{const e=JSON.parse(t);n=e.content||e}catch(s){n=t}}const r=(e,t)=>{var n,r;return Is(Is({},e),{},{customChecks:Is(Is({},e.customChecks),t.customChecks),autoBurn:Is(Is({},e.autoBurn),t.autoBurn),eslint:Is(Is({},e.eslint),t.eslint),typescript:Is(Is({},e.typescript),t.typescript),lineLimit:Is(Is({},e.lineLimit),t.lineLimit),folderLimit:Is(Is({},e.folderLimit),t.folderLimit),testCheck:Is(Is(Is({},e.testCheck),t.testCheck),{},{patterns:Is(Is({},null===(n=e.testCheck)||void 0===n?void 0:n.patterns),null===(r=t.testCheck)||void 0===r?void 0:r.patterns)})})};if("string"===typeof n)try{const e=JSON.parse(n);a(t=>r(t,e))}catch(s){console.error("Failed to parse config JSON:",s)}else"object"===typeof n&&a(e=>r(e,n));x(!0)}}catch(e){console.error("Failed to load config:",e),x(!1)}finally{c(!1),setTimeout(()=>{S.current=!0},100)}};(0,e.useEffect)(()=>{if(S.current)return C.current&&clearTimeout(C.current),C.current=setTimeout(()=>{E()},500),()=>{C.current&&clearTimeout(C.current)}},[o]);const E=async()=>{try{var e,t,n,r,i,s,a,l,c,u,d,h,f,p,g,v,m,_,y,b;const x={customChecks:{requirements:(null===(e=o.customChecks)||void 0===e?void 0:e.requirements)||""},autoBurn:{enabled:null!==(t=null===(n=o.autoBurn)||void 0===n?void 0:n.enabled)&&void 0!==t&&t},eslint:{enabled:null===(r=null===(i=o.eslint)||void 0===i?void 0:i.enabled)||void 0===r||r,rules:(null===(s=o.eslint)||void 0===s?void 0:s.rules)||["no-unused-vars"]},typescript:{enabled:null===(a=null===(l=o.typescript)||void 0===l?void 0:l.enabled)||void 0===a||a},lineLimit:{enabled:null===(c=null===(u=o.lineLimit)||void 0===u?void 0:u.enabled)||void 0===c||c,limit:(null===(d=o.lineLimit)||void 0===d?void 0:d.limit)||300,prompt:(null===(h=o.lineLimit)||void 0===h?void 0:h.prompt)||"Split any file with over {{ linelimit }} lines into smaller files."},folderLimit:{enabled:null===(f=null===(p=o.folderLimit)||void 0===p?void 0:p.enabled)||void 0===f||f,limit:(null===(g=o.folderLimit)||void 0===g?void 0:g.limit)||15,prompt:(null===(v=o.folderLimit)||void 0===v?void 0:v.prompt)||"Split any folder with over {{ folderlimit }} items into smaller, compartmentalized folders."},testCheck:{enabled:null!==(m=null===(_=o.testCheck)||void 0===_?void 0:_.enabled)&&void 0!==m&&m,patterns:(null===(y=o.testCheck)||void 0===y?void 0:y.patterns)||{".vue":".test.js",".jsx":".test.jsx",".tsx":".test.tsx"},prompt:(null===(b=o.testCheck)||void 0===b?void 0:b.prompt)||"Create test files for components that are missing them."}};await fetch("".concat(sc).concat(lc),{method:"POST",mode:"cors",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:uc,content:JSON.stringify(x,null,2)})})}catch(x){console.error("Auto-save failed:",x)}},R=async()=>{d(!0),g(null),m(null),y(null);try{await E(),m("Settings saved, return to your terminal"),y(5),d(!1);let e=5;const t=setInterval(()=>{e--,e>0?y(e):(clearInterval(t),y(null),m(null),x(!1),(async()=>{f(!0);try{await fetch("http://localhost:3001/shutdown",{method:"POST",mode:"cors"})}catch(e){console.error("Error disconnecting:",e)}finally{f(!1)}})())},1e3)}catch(e){console.error("Failed to save and disconnect:",e),g("Failed to save configuration"),d(!1)}},M=()=>b?(0,rc.jsxs)(rc.Fragment,{children:[v&&(0,rc.jsxs)("div",{style:{padding:"12px",background:"#f0fdf4",color:"#16a34a",borderRadius:"6px",fontSize:"13px",marginBottom:"16px",fontWeight:"500",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,rc.jsx)("span",{children:v}),_&&(0,rc.jsxs)("span",{style:{opacity:.8},children:["disconnecting in ",_,"..."]})]}),(0,rc.jsxs)("div",{style:{marginBottom:"20px"},children:[(0,rc.jsx)("label",{style:{display:"block",fontSize:"13px",fontWeight:"600",color:"#111827",marginBottom:"8px"},children:"Custom Requirements"}),(0,rc.jsx)("textarea",{value:o.customChecks.requirements,onChange:e=>a(t=>Is(Is({},t),{},{customChecks:Is(Is({},t.customChecks),{},{requirements:e.target.value})})),placeholder:"e.g., Remove unused imports and variables. Remove all console log statements.",style:{width:"100%",padding:"10px 12px",fontSize:"13px",border:"1px solid #d1d5db",borderRadius:"6px",background:"#fff",color:"#111827",outline:"none",resize:"vertical",minHeight:"60px",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif'}}),(0,rc.jsx)("div",{style:{fontSize:"11px",color:"#9ca3af",marginTop:"4px"},children:"Custom cleanup rules to apply during burns"})]}),(0,rc.jsxs)("label",{style:{display:"flex",alignItems:"center",gap:"10px",padding:"10px 0",cursor:"pointer",borderBottom:"1px solid #f3f4f6"},children:[(0,rc.jsx)("input",{type:"checkbox",checked:o.eslint.enabled,onChange:e=>a(t=>Is(Is({},t),{},{eslint:Is(Is({},t.eslint),{},{enabled:e.target.checked})})),style:{width:"18px",height:"18px",cursor:"pointer",accentColor:"#3B82F6"}}),(0,rc.jsxs)("div",{style:{flex:1},children:[(0,rc.jsx)("div",{style:{fontSize:"14px",color:"#111827",fontWeight:"500"},children:"ESLint"}),(0,rc.jsx)("div",{style:{fontSize:"12px",color:"#6b7280"},children:"Run ESLint checks (no-unused-vars)"})]})]}),(0,rc.jsxs)("label",{style:{display:"flex",alignItems:"center",gap:"10px",padding:"10px 0",cursor:"pointer",borderBottom:"1px solid #f3f4f6"},children:[(0,rc.jsx)("input",{type:"checkbox",checked:o.typescript.enabled,onChange:e=>a(t=>Is(Is({},t),{},{typescript:Is(Is({},t.typescript),{},{enabled:e.target.checked})})),style:{width:"18px",height:"18px",cursor:"pointer",accentColor:"#3B82F6"}}),(0,rc.jsxs)("div",{style:{flex:1},children:[(0,rc.jsx)("div",{style:{fontSize:"14px",color:"#111827",fontWeight:"500"},children:"TypeScript"}),(0,rc.jsx)("div",{style:{fontSize:"12px",color:"#6b7280"},children:"Run TypeScript type checking"})]})]}),(0,rc.jsx)("div",{style:{padding:"10px 0",borderBottom:"1px solid #f3f4f6"},children:(0,rc.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"8px"},children:[(0,rc.jsxs)("label",{style:{display:"flex",alignItems:"center",gap:"10px",cursor:"pointer"},children:[(0,rc.jsx)("input",{type:"checkbox",checked:o.lineLimit.enabled,onChange:e=>a(t=>Is(Is({},t),{},{lineLimit:Is(Is({},t.lineLimit),{},{enabled:e.target.checked})})),style:{width:"18px",height:"18px",cursor:"pointer",accentColor:"#3B82F6"}}),(0,rc.jsx)("div",{style:{fontSize:"14px",color:"#111827",fontWeight:"500"},children:"Line Limit"})]}),(0,rc.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"8px",opacity:o.lineLimit.enabled?1:.5},children:[(0,rc.jsx)("span",{style:{fontSize:"13px",color:"#6b7280"},children:"Max"}),(0,rc.jsx)("input",{type:"number",value:o.lineLimit.limit,onChange:e=>a(t=>Is(Is({},t),{},{lineLimit:Is(Is({},t.lineLimit),{},{limit:parseInt(e.target.value)||0})})),disabled:!o.lineLimit.enabled,style:{width:"70px",padding:"6px 10px",fontSize:"13px",border:"1px solid #d1d5db",borderRadius:"4px",textAlign:"center",background:o.lineLimit.enabled?"#fff":"#f9fafb"}}),(0,rc.jsx)("span",{style:{fontSize:"13px",color:"#6b7280"},children:"lines"})]})]})}),(0,rc.jsx)("div",{style:{padding:"10px 0",borderBottom:"1px solid #f3f4f6"},children:(0,rc.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"8px"},children:[(0,rc.jsxs)("label",{style:{display:"flex",alignItems:"center",gap:"10px",cursor:"pointer"},children:[(0,rc.jsx)("input",{type:"checkbox",checked:o.folderLimit.enabled,onChange:e=>a(t=>Is(Is({},t),{},{folderLimit:Is(Is({},t.folderLimit),{},{enabled:e.target.checked})})),style:{width:"18px",height:"18px",cursor:"pointer",accentColor:"#3B82F6"}}),(0,rc.jsx)("div",{style:{fontSize:"14px",color:"#111827",fontWeight:"500"},children:"Folder Limit"})]}),(0,rc.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"8px",opacity:o.folderLimit.enabled?1:.5},children:[(0,rc.jsx)("span",{style:{fontSize:"13px",color:"#6b7280"},children:"Max"}),(0,rc.jsx)("input",{type:"number",value:o.folderLimit.limit,onChange:e=>a(t=>Is(Is({},t),{},{folderLimit:Is(Is({},t.folderLimit),{},{limit:parseInt(e.target.value)||0})})),disabled:!o.folderLimit.enabled,style:{width:"70px",padding:"6px 10px",fontSize:"13px",border:"1px solid #d1d5db",borderRadius:"4px",textAlign:"center",background:o.folderLimit.enabled?"#fff":"#f9fafb"}}),(0,rc.jsx)("span",{style:{fontSize:"13px",color:"#6b7280"},children:"items"})]})]})}),(0,rc.jsx)("div",{style:{padding:"10px 0"},children:(0,rc.jsxs)("label",{style:{display:"flex",alignItems:"center",gap:"10px",cursor:"pointer"},children:[(0,rc.jsx)("input",{type:"checkbox",checked:o.testCheck.enabled,onChange:e=>a(t=>Is(Is({},t),{},{testCheck:Is(Is({},t.testCheck),{},{enabled:e.target.checked})})),style:{width:"18px",height:"18px",cursor:"pointer",accentColor:"#3B82F6"}}),(0,rc.jsxs)("div",{style:{flex:1},children:[(0,rc.jsx)("div",{style:{fontSize:"14px",color:"#111827",fontWeight:"500"},children:"Test Coverage Check"}),(0,rc.jsx)("div",{style:{fontSize:"12px",color:"#6b7280"},children:"Flag components missing test files"})]})]})})]}):(0,rc.jsxs)("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"40px 20px"},children:[(0,rc.jsx)("div",{style:{fontSize:"16px",color:"#111827",marginBottom:"12px",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',width:"100%",maxWidth:"400px",textAlign:"left"},children:"Configure Bonzai settings with:"}),(0,rc.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%",maxWidth:"400px",padding:"16px 20px",background:"#f5f5f5",borderRadius:"12px",border:"1px solid #e5e5e5"},children:[(0,rc.jsx)("code",{style:{fontSize:"15px",color:"#333",fontFamily:"monospace",fontWeight:"500"},children:"npx bonzai-burn -g"}),(0,rc.jsx)("button",{onClick:()=>{return e="npx bonzai-burn -g",void navigator.clipboard.writeText(e);var e},style:{background:"transparent",border:"none",cursor:"pointer",padding:"4px",display:"flex",alignItems:"center",justifyContent:"center",opacity:.5,transition:"opacity 0.15s ease"},onMouseEnter:e=>e.currentTarget.style.opacity="1",onMouseLeave:e=>e.currentTarget.style.opacity="0.5",title:"Copy to clipboard",children:(0,rc.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"#666",style:{width:"20px",height:"20px"},children:(0,rc.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 17.25v3.375c0 .621-.504 1.125-1.125 1.125h-9.75a1.125 1.125 0 0 1-1.125-1.125V7.875c0-.621.504-1.125 1.125-1.125H6.75a9.06 9.06 0 0 1 1.5.124m7.5 10.376h3.375c.621 0 1.125-.504 1.125-1.125V11.25c0-4.46-3.243-8.161-7.5-8.876a9.06 9.06 0 0 0-1.5-.124H9.375c-.621 0-1.125.504-1.125 1.125v3.5m7.5 10.375H9.375a1.125 1.125 0 0 1-1.125-1.125v-9.25m12 6.625v-1.875a3.375 3.375 0 0 0-3.375-3.375h-1.5a1.125 1.125 0 0 1-1.125-1.125v-1.5a3.375 3.375 0 0 0-3.375-3.375H9.75"})})})]})]});return n||i?i?(0,rc.jsxs)("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,background:"#f9fafb",display:"flex",alignItems:"center",justifyContent:"center",zIndex:2e3},children:[(0,rc.jsxs)("div",{style:{background:"#fff",borderRadius:"12px",boxShadow:"0 8px 24px rgba(0, 0, 0, 0.15)",width:"90%",maxWidth:"600px",maxHeight:"80vh",overflow:"hidden",display:"flex",flexDirection:"column"},children:[(0,rc.jsxs)("div",{style:{padding:"16px 20px",borderBottom:"1px solid #e5e7eb",display:"flex",alignItems:"center",justifyContent:"space-between"},children:[(0,rc.jsxs)("div",{style:{fontSize:"16px",fontWeight:"600",color:"#111827",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',display:"flex",alignItems:"center",gap:"8px"},children:[(0,rc.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",style:{width:"20px",height:"20px"},children:[(0,rc.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.594 3.94c.09-.542.56-.94 1.11-.94h2.593c.55 0 1.02.398 1.11.94l.213 1.281c.063.374.313.686.645.87.074.04.147.083.22.127.325.196.72.257 1.075.124l1.217-.456a1.125 1.125 0 0 1 1.37.49l1.296 2.247a1.125 1.125 0 0 1-.26 1.431l-1.003.827c-.293.241-.438.613-.43.992a7.723 7.723 0 0 1 0 .255c-.008.378.137.75.43.991l1.004.827c.424.35.534.955.26 1.43l-1.298 2.247a1.125 1.125 0 0 1-1.369.491l-1.217-.456c-.355-.133-.75-.072-1.076.124a6.47 6.47 0 0 1-.22.128c-.331.183-.581.495-.644.869l-.213 1.281c-.09.543-.56.94-1.11.94h-2.594c-.55 0-1.019-.398-1.11-.94l-.213-1.281c-.062-.374-.312-.686-.644-.87a6.52 6.52 0 0 1-.22-.127c-.325-.196-.72-.257-1.076-.124l-1.217.456a1.125 1.125 0 0 1-1.369-.49l-1.297-2.247a1.125 1.125 0 0 1 .26-1.431l1.004-.827c.292-.24.437-.613.43-.991a6.932 6.932 0 0 1 0-.255c.007-.38-.138-.751-.43-.992l-1.004-.827a1.125 1.125 0 0 1-.26-1.43l1.297-2.247a1.125 1.125 0 0 1 1.37-.491l1.216.456c.356.133.751.072 1.076-.124.072-.044.146-.086.22-.128.332-.183.582-.495.644-.869l.214-1.28Z"}),(0,rc.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"})]}),"Configuration"]}),(0,rc.jsx)("div",{style:{fontSize:"12px",color:"#6b7280"},children:"Set up your preferences to get started"})]}),(0,rc.jsx)("div",{style:{padding:"20px",overflowY:"auto",flex:1},children:l?(0,rc.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"40px",color:"#6b7280",fontSize:"14px"},children:[(0,rc.jsx)("div",{style:{width:"20px",height:"20px",border:"2px solid #e5e7eb",borderTopColor:"#3B82F6",borderRadius:"50%",marginRight:"12px",animation:"spin 0.8s linear infinite"}}),"Loading configuration..."]}):M()}),!l&&b&&(0,rc.jsx)("div",{style:{padding:"16px 20px",borderTop:"1px solid #e5e7eb",display:"flex",justifyContent:"flex-end",gap:"12px"},children:(0,rc.jsxs)("button",{onClick:R,disabled:u||v,style:{padding:"10px 24px",fontSize:"14px",fontWeight:"600",background:v?"#16a34a":u?"#9ca3af":"#3B82F6",color:"white",border:"none",borderRadius:"6px",cursor:u||v?"not-allowed":"pointer",transition:"all 0.15s ease",display:"flex",alignItems:"center",gap:"8px"},onMouseEnter:e=>{u||v||(e.currentTarget.style.background="#2563eb")},onMouseLeave:e=>{u||v||(e.currentTarget.style.background="#3B82F6")},children:[u&&(0,rc.jsx)("div",{style:{width:"14px",height:"14px",border:"2px solid rgba(255,255,255,0.3)",borderTopColor:"white",borderRadius:"50%",animation:"spin 0.8s linear infinite"}}),v?"Done!":u?"Saving...":"Get Started"]})})]}),(0,rc.jsx)("style",{children:"\n @keyframes spin {\n from { transform: rotate(0deg); }\n to { transform: rotate(360deg); }\n }\n "})]}):(0,rc.jsxs)("div",{onClick:e=>{e.target===e.currentTarget&&r()},style:{position:"fixed",top:0,left:0,right:0,bottom:0,background:"rgba(0, 0, 0, 0.4)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:2e3,animation:"fadeIn 0.15s ease-in"},children:[(0,rc.jsxs)("div",{style:{background:"#fff",borderRadius:"12px",boxShadow:"0 8px 24px rgba(0, 0, 0, 0.2)",width:"90%",maxWidth:"600px",maxHeight:"80vh",overflow:"hidden",display:"flex",flexDirection:"column",animation:"slideUp 0.2s ease-out"},onClick:e=>e.stopPropagation(),children:[(0,rc.jsxs)("div",{style:{padding:"16px 20px",borderBottom:"1px solid #e5e7eb",display:"flex",alignItems:"center",justifyContent:"space-between"},children:[(0,rc.jsxs)("div",{style:{fontSize:"16px",fontWeight:"600",color:"#111827",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',display:"flex",alignItems:"center",gap:"8px"},children:[(0,rc.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",style:{width:"20px",height:"20px"},children:[(0,rc.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.594 3.94c.09-.542.56-.94 1.11-.94h2.593c.55 0 1.02.398 1.11.94l.213 1.281c.063.374.313.686.645.87.074.04.147.083.22.127.325.196.72.257 1.075.124l1.217-.456a1.125 1.125 0 0 1 1.37.49l1.296 2.247a1.125 1.125 0 0 1-.26 1.431l-1.003.827c-.293.241-.438.613-.43.992a7.723 7.723 0 0 1 0 .255c-.008.378.137.75.43.991l1.004.827c.424.35.534.955.26 1.43l-1.298 2.247a1.125 1.125 0 0 1-1.369.491l-1.217-.456c-.355-.133-.75-.072-1.076.124a6.47 6.47 0 0 1-.22.128c-.331.183-.581.495-.644.869l-.213 1.281c-.09.543-.56.94-1.11.94h-2.594c-.55 0-1.019-.398-1.11-.94l-.213-1.281c-.062-.374-.312-.686-.644-.87a6.52 6.52 0 0 1-.22-.127c-.325-.196-.72-.257-1.076-.124l-1.217.456a1.125 1.125 0 0 1-1.369-.49l-1.297-2.247a1.125 1.125 0 0 1 .26-1.431l1.004-.827c.292-.24.437-.613.43-.991a6.932 6.932 0 0 1 0-.255c.007-.38-.138-.751-.43-.992l-1.004-.827a1.125 1.125 0 0 1-.26-1.43l1.297-2.247a1.125 1.125 0 0 1 1.37-.491l1.216.456c.356.133.751.072 1.076-.124.072-.044.146-.086.22-.128.332-.183.582-.495.644-.869l.214-1.28Z"}),(0,rc.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"})]}),"Configuration"]}),(0,rc.jsx)("button",{onClick:r,style:{background:"transparent",border:"none",cursor:"pointer",padding:"4px",color:"#6b7280",fontSize:"20px",lineHeight:"1",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"4px",transition:"all 0.15s ease"},onMouseEnter:e=>{e.currentTarget.style.background="#f3f4f6",e.currentTarget.style.color="#111827"},onMouseLeave:e=>{e.currentTarget.style.background="transparent",e.currentTarget.style.color="#6b7280"},children:"\xd7"})]}),(0,rc.jsx)("div",{style:{padding:"20px",overflowY:"auto",flex:1},children:l?(0,rc.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"40px",color:"#6b7280",fontSize:"14px"},children:[(0,rc.jsx)("div",{style:{width:"20px",height:"20px",border:"2px solid #e5e7eb",borderTopColor:"#3B82F6",borderRadius:"50%",marginRight:"12px",animation:"spin 0.8s linear infinite"}}),"Loading configuration..."]}):M()}),!l&&(0,rc.jsxs)("div",{style:{padding:"16px 20px",borderTop:"1px solid #e5e7eb",display:"flex",justifyContent:"flex-end",gap:"12px"},children:[(0,rc.jsx)("button",{onClick:r,style:{padding:"8px 16px",fontSize:"13px",fontWeight:"500",background:"transparent",color:"#6b7280",border:"1px solid #d1d5db",borderRadius:"6px",cursor:"pointer",transition:"all 0.15s ease"},onMouseEnter:e=>{e.currentTarget.style.background="#f9fafb",e.currentTarget.style.borderColor="#9ca3af"},onMouseLeave:e=>{e.currentTarget.style.background="transparent",e.currentTarget.style.borderColor="#d1d5db"},children:"Cancel"}),(0,rc.jsxs)("button",{onClick:async()=>{console.log("saveConfig called, config:",o),d(!0),g(null);try{var e,t,n,i,s,a,l,c,u,h,f,p,v,m,_,y,b,x,w,S;const d={customChecks:{requirements:(null===(e=o.customChecks)||void 0===e?void 0:e.requirements)||""},autoBurn:{enabled:null!==(t=null===(n=o.autoBurn)||void 0===n?void 0:n.enabled)&&void 0!==t&&t},eslint:{enabled:null===(i=null===(s=o.eslint)||void 0===s?void 0:s.enabled)||void 0===i||i,rules:(null===(a=o.eslint)||void 0===a?void 0:a.rules)||["no-unused-vars"]},typescript:{enabled:null===(l=null===(c=o.typescript)||void 0===c?void 0:c.enabled)||void 0===l||l},lineLimit:{enabled:null===(u=null===(h=o.lineLimit)||void 0===h?void 0:h.enabled)||void 0===u||u,limit:(null===(f=o.lineLimit)||void 0===f?void 0:f.limit)||300,prompt:(null===(p=o.lineLimit)||void 0===p?void 0:p.prompt)||"Split any file with over {{ linelimit }} lines into smaller files."},folderLimit:{enabled:null===(v=null===(m=o.folderLimit)||void 0===m?void 0:m.enabled)||void 0===v||v,limit:(null===(_=o.folderLimit)||void 0===_?void 0:_.limit)||15,prompt:(null===(y=o.folderLimit)||void 0===y?void 0:y.prompt)||"Split any folder with over {{ folderlimit }} items into smaller, compartmentalized folders."},testCheck:{enabled:null!==(b=null===(x=o.testCheck)||void 0===x?void 0:x.enabled)&&void 0!==b&&b,patterns:(null===(w=o.testCheck)||void 0===w?void 0:w.patterns)||{".vue":".test.js",".jsx":".test.jsx",".tsx":".test.tsx"},prompt:(null===(S=o.testCheck)||void 0===S?void 0:S.prompt)||"Create test files for components that are missing them."}};console.log("Saving config:",d),console.log("Fetch URL:","".concat(sc).concat(lc));const g=await fetch("".concat(sc).concat(lc),{method:"POST",mode:"cors",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:uc,content:JSON.stringify(d,null,2)})});if(console.log("Response:",g.status,g.ok),!g.ok)throw new Error("Failed to save configuration");console.log("Save successful, calling onClose"),r()}catch(C){console.error("Failed to save config:",C),console.error("Error details:",C.message,C.stack),g("Failed to save configuration")}finally{d(!1)}},disabled:u,style:{padding:"8px 16px",fontSize:"13px",fontWeight:"600",background:u?"#9ca3af":"#3B82F6",color:"white",border:"none",borderRadius:"6px",cursor:u?"not-allowed":"pointer",transition:"all 0.15s ease",display:"flex",alignItems:"center",gap:"8px"},onMouseEnter:e=>{u||(e.currentTarget.style.background="#2563eb")},onMouseLeave:e=>{u||(e.currentTarget.style.background="#3B82F6")},children:[u&&(0,rc.jsx)("div",{style:{width:"14px",height:"14px",border:"2px solid rgba(255,255,255,0.3)",borderTopColor:"white",borderRadius:"50%",animation:"spin 0.8s linear infinite"}}),u?"Saving...":"Save"]})]})]}),(0,rc.jsx)("style",{children:"\n @keyframes fadeIn {\n from { opacity: 0; }\n to { opacity: 1; }\n }\n @keyframes slideUp {\n from {\n opacity: 0;\n transform: translateY(20px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n }\n @keyframes spin {\n from { transform: rotate(0deg); }\n to { transform: rotate(360deg); }\n }\n "})]}):null},hc={showV3:!0,showConfigonly:!1,openInCursor:!1};const fc=function(t){let{onStatusChange:n,codeQualityIssues:r=[],isLoadingCodeQuality:i=!1,standardsViolations:o=[],isLoadingStandards:a=!1,onScanStandards:l,onAddressChange:c,isCodeViewActive:u=!1,isDevViewActive:d=!1,isChartActive:h=!0,onToggleCodeView:f,onToggleDevView:p,onToggleChart:g,previewServerActive:v=!1,terminalOpen:m=!1,onToggleTerminal:_}=t;const[y,b]=(0,e.useState)(!1),[x,w]=(0,e.useState)(!1),[S,C]=(0,e.useState)("checking"),[k,E]=(0,e.useState)(!1),[R,M]=(0,e.useState)(!1),[L,P]=(0,e.useState)(!1),[T,D]=(0,e.useState)(!1),[O,I]=(0,e.useState)(""),A="http://localhost:3001",[j,B]=(0,e.useState)(()=>localStorage.getItem("previewAddress")||"http://localhost:3000"),[N,F]=(0,e.useState)(!1),[z,H]=(0,e.useState)(()=>localStorage.getItem("previewAddress")||"http://localhost:3000"),W=(0,e.useRef)(null);(0,e.useEffect)(()=>{N&&W.current&&(W.current.focus(),W.current.select())},[N]);const U=()=>{H(j),F(!0)},V=()=>{const e=z.trim();e&&e!==j&&(B(e),localStorage.setItem("previewAddress",e),c&&c(e)),F(!1)},$=e=>{"Enter"===e.key?V():"Escape"===e.key&&(H(j),F(!1))},q=async()=>{try{const e=await fetch("".concat(A,"/"),{method:"GET",mode:"cors"});if(!e.ok)throw new Error("Server not responding");try{const t=await e.json();t.repoName&&I(t.repoName)}catch(s){}try{const e=await fetch("".concat(A,"/list")),t=await e.json();console.log("File list:",t)}catch(s){}C("active"),E(!0),n&&n("active")}catch(e){C("inactive"),E(!1),n&&n("inactive")}},K=async()=>{M(!0);try{await fetch("".concat(A,"/shutdown"),{method:"POST",mode:"cors"});setTimeout(()=>{C("inactive"),E(!1),M(!1),n&&n("inactive")},1e3)}catch(e){console.error("Error killing server:",e),M(!1),setTimeout(()=>{q()},500)}};if((0,e.useEffect)(()=>{q();const e=setInterval(q,5e3);return()=>clearInterval(e)},[]),(0,e.useEffect)(()=>{const e=e=>{(e.metaKey||e.ctrlKey)&&"i"===e.key&&(e.preventDefault(),P(e=>!e))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[]),(0,e.useEffect)(()=>{n&&n(S)},[S,n]),"active"===S){const e=((null===r||void 0===r?void 0:r.length)||0)+((null===o||void 0===o?void 0:o.length)||0),t=i||a?{text:"Scanning for issues...",color:"#3B82F6",isLoading:!0}:0===e?null:{text:"".concat(e," issue").concat(1!==e?"s":""," found"),color:"#f59e0b"};return(0,rc.jsxs)(rc.Fragment,{children:[(0,rc.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 16px",background:"#ffffff",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif',position:"relative",zIndex:1001},children:[hc.showV3?(0,rc.jsxs)(rc.Fragment,{children:[(0,rc.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"8px",fontSize:"14px",color:"#333"},children:[(0,rc.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",style:{width:"18px",height:"18px",color:"#28a745"},children:(0,rc.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12.75 11.25 15 15 9.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"})}),(0,rc.jsxs)("span",{children:['connected to repo "',(0,rc.jsx)("strong",{children:O||"..."}),'"']}),(0,rc.jsx)("button",{onClick:e=>{e.preventDefault(),e.stopPropagation(),K()},disabled:R,title:"Disconnect",onMouseEnter:e=>{R||(e.currentTarget.style.background="#fee2e2")},onMouseLeave:e=>{R||(e.currentTarget.style.background="transparent")},style:{background:"transparent",color:"#e74c3c",border:"none",padding:"4px",borderRadius:"4px",cursor:R?"not-allowed":"pointer",display:"flex",alignItems:"center",justifyContent:"center",opacity:R?.6:1,transition:"all 0.15s ease"},children:(0,rc.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",style:{width:"16px",height:"16px"},children:(0,rc.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),(0,rc.jsxs)("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"2px",position:"absolute",left:"50%",transform:"translateX(-50%)"},onMouseEnter:()=>b(!0),onMouseLeave:()=>b(!1),children:[(0,rc.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[(0,rc.jsxs)("button",{onClick:g,style:{background:h?"#e8f4ff":"transparent",border:h?"1px solid #3B82F6":"1px solid #e0e0e0",borderRadius:"6px",padding:"5px 10px",cursor:"pointer",display:"flex",alignItems:"center",gap:"5px",fontSize:"12px",color:h?"#3B82F6":"#666",fontWeight:h?"500":"400",transition:"all 0.15s ease"},onMouseEnter:e=>{h||(e.currentTarget.style.background="#f5f5f5",e.currentTarget.style.borderColor="#d0d0d0")},onMouseLeave:e=>{h||(e.currentTarget.style.background="transparent",e.currentTarget.style.borderColor="#e0e0e0")},title:"Toggle Chart View",children:[(0,rc.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",style:{width:"14px",height:"14px"},children:(0,rc.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M7.5 14.25v2.25m3-4.5v4.5m3-6.75v6.75m3-9v9M6 20.25h12A2.25 2.25 0 0 0 20.25 18V6A2.25 2.25 0 0 0 18 3.75H6A2.25 2.25 0 0 0 3.75 6v12A2.25 2.25 0 0 0 6 20.25Z"})}),"Chart"]}),(0,rc.jsxs)("button",{onClick:p,style:{background:d?"#e8f4ff":"transparent",border:d?"1px solid #3B82F6":"1px solid #e0e0e0",borderRadius:"6px",padding:"5px 10px",cursor:"pointer",display:"flex",alignItems:"center",gap:"5px",fontSize:"12px",color:d?"#3B82F6":v?"#666":"#bbb",fontWeight:d?"500":"400",transition:"all 0.15s ease",opacity:v||d?1:.6},onMouseEnter:e=>{d||(e.currentTarget.style.background="#f5f5f5",e.currentTarget.style.borderColor="#d0d0d0")},onMouseLeave:e=>{d||(e.currentTarget.style.background="transparent",e.currentTarget.style.borderColor="#e0e0e0")},title:v?"Toggle Preview":"Preview (no server connected)",children:[(0,rc.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",style:{width:"14px",height:"14px"},children:[(0,rc.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.036 12.322a1.012 1.012 0 0 1 0-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178Z"}),(0,rc.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"})]}),"Preview"]})]}),(0,rc.jsxs)("span",{style:{position:"absolute",left:"100%",top:"50%",transform:"translateY(-50%)",marginLeft:"8px",fontSize:"11px",color:"#e74c3c",fontFamily:"monospace",opacity:y?1:0,pointerEvents:"none",transition:"opacity 0.15s ease",whiteSpace:"nowrap"},children:[(0,rc.jsx)("code",{style:{background:"#fee2e2",padding:"1px 4px",borderRadius:"3px",fontSize:"10px"},children:"\u2318G"})," to switch views"]})]}),(0,rc.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[(0,rc.jsxs)("span",{style:{fontSize:"11px",color:"#e74c3c",fontFamily:"monospace",opacity:x?1:0,transition:"opacity 0.15s ease",whiteSpace:"nowrap"},children:[(0,rc.jsx)("code",{style:{background:"#fee2e2",padding:"1px 4px",borderRadius:"3px",fontSize:"10px"},children:"\u2318B"})," to ",m?"hide":"show"," terminal"]}),(0,rc.jsx)("button",{onClick:_,style:{background:m?"#e8f4ff":"transparent",border:m?"1px solid #3B82F6":"1px solid #e0e0e0",borderRadius:"6px",padding:"6px 8px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",color:m?"#3B82F6":"#666",transition:"all 0.15s ease"},onMouseEnter:e=>{w(!0),m||(e.currentTarget.style.background="#f5f5f5",e.currentTarget.style.borderColor="#d0d0d0")},onMouseLeave:e=>{w(!1),m||(e.currentTarget.style.background="transparent",e.currentTarget.style.borderColor="#e0e0e0")},children:(0,rc.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",style:{width:"18px",height:"18px"},children:(0,rc.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6.75 7.5l3 2.25-3 2.25m4.5 0h3m-9 8.25h13.5A2.25 2.25 0 0021 18V6a2.25 2.25 0 00-2.25-2.25H5.25A2.25 2.25 0 003 6v12a2.25 2.25 0 002.25 2.25z"})})})]})]}):(0,rc.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"8px",fontSize:"14px",color:"#333",flex:1},children:[(0,rc.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",style:{width:"18px",height:"18px",color:"#28a745"},children:(0,rc.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12.75 11.25 15 15 9.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"})}),(0,rc.jsx)("span",{children:"previewing"}),N?(0,rc.jsx)("input",{ref:W,type:"text",value:z,onChange:e=>H(e.target.value),onBlur:V,onKeyDown:$,style:{padding:"2px 6px",fontSize:"14px",fontWeight:"600",color:"#333",border:"1px solid #3B82F6",borderRadius:"4px",outline:"none",minWidth:"180px",fontFamily:"inherit"}}):(0,rc.jsx)("strong",{onClick:U,style:{color:"#333",cursor:"pointer",padding:"2px 6px",borderRadius:"4px",transition:"background 0.15s ease"},onMouseEnter:e=>{e.currentTarget.style.background="#f0f0f0"},onMouseLeave:e=>{e.currentTarget.style.background="transparent"},title:"Click to edit preview address",children:j}),(0,rc.jsx)("button",{onClick:()=>{const e="http://localhost:";B(e),H(e),localStorage.setItem("previewAddress",e),c&&c(e)},style:{background:"transparent",border:"none",cursor:"pointer",padding:"2px 4px",marginLeft:"4px",color:"#999",fontSize:"14px",lineHeight:"1",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"3px"},onMouseEnter:e=>{e.currentTarget.style.color="#666",e.currentTarget.style.background="#f0f0f0"},onMouseLeave:e=>{e.currentTarget.style.color="#999",e.currentTarget.style.background="transparent"},title:"Clear port",children:"\xd7"})]}),t&&(0,rc.jsxs)("button",{onClick:()=>P(!0),style:{position:"absolute",left:"50%",transform:"translateX(-50%)",background:"#f5f5f5",border:"1px solid #e0e0e0",cursor:"pointer",color:"#333",fontSize:"13px",fontWeight:"400",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif',padding:"6px 12px",borderRadius:"6px",transition:"all 0.15s ease",display:"flex",alignItems:"center",gap:"8px",boxShadow:"none",zIndex:1002},onMouseEnter:e=>{e.currentTarget.style.background="#eeeeee",e.currentTarget.style.borderColor="#d0d0d0"},onMouseLeave:e=>{e.currentTarget.style.background="#f5f5f5",e.currentTarget.style.borderColor="#e0e0e0"},children:[t.isLoading?(0,rc.jsx)("div",{style:{width:"12px",height:"12px",border:"2px solid #e0e0e0",borderTopColor:"#3B82F6",borderRadius:"50%",flexShrink:0,animation:"spin 0.8s linear infinite"}}):(0,rc.jsx)("div",{style:{width:"8px",height:"8px",borderRadius:"50%",background:t.color,flexShrink:0}}),(0,rc.jsx)("span",{children:t.text}),(0,rc.jsx)("style",{children:"\n @keyframes spin {\n to { transform: rotate(360deg); }\n }\n "})]}),k&&!hc.showV3&&(0,rc.jsxs)("div",{style:{flex:1,display:"flex",justifyContent:"flex-end",alignItems:"center",gap:"16px"},children:[(0,rc.jsxs)("button",{onClick:()=>D(!0),title:"Configuration",style:{background:"transparent",border:"1px solid #e0e0e0",borderRadius:"6px",padding:"6px 10px",cursor:"pointer",display:"flex",alignItems:"center",gap:"6px",fontSize:"12px",color:"#666",transition:"all 0.15s ease"},onMouseEnter:e=>{e.currentTarget.style.background="#f5f5f5",e.currentTarget.style.borderColor="#d0d0d0",e.currentTarget.style.color="#333"},onMouseLeave:e=>{e.currentTarget.style.background="transparent",e.currentTarget.style.borderColor="#e0e0e0",e.currentTarget.style.color="#666"},children:[(0,rc.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",style:{width:"16px",height:"16px"},children:[(0,rc.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.594 3.94c.09-.542.56-.94 1.11-.94h2.593c.55 0 1.02.398 1.11.94l.213 1.281c.063.374.313.686.645.87.074.04.147.083.22.127.325.196.72.257 1.075.124l1.217-.456a1.125 1.125 0 0 1 1.37.49l1.296 2.247a1.125 1.125 0 0 1-.26 1.431l-1.003.827c-.293.241-.438.613-.43.992a7.723 7.723 0 0 1 0 .255c-.008.378.137.75.43.991l1.004.827c.424.35.534.955.26 1.43l-1.298 2.247a1.125 1.125 0 0 1-1.369.491l-1.217-.456c-.355-.133-.75-.072-1.076.124a6.47 6.47 0 0 1-.22.128c-.331.183-.581.495-.644.869l-.213 1.281c-.09.543-.56.94-1.11.94h-2.594c-.55 0-1.019-.398-1.11-.94l-.213-1.281c-.062-.374-.312-.686-.644-.87a6.52 6.52 0 0 1-.22-.127c-.325-.196-.72-.257-1.076-.124l-1.217.456a1.125 1.125 0 0 1-1.369-.49l-1.297-2.247a1.125 1.125 0 0 1 .26-1.431l1.004-.827c.292-.24.437-.613.43-.991a6.932 6.932 0 0 1 0-.255c.007-.38-.138-.751-.43-.992l-1.004-.827a1.125 1.125 0 0 1-.26-1.43l1.297-2.247a1.125 1.125 0 0 1 1.37-.491l1.216.456c.356.133.751.072 1.076-.124.072-.044.146-.086.22-.128.332-.183.582-.495.644-.869l.214-1.28Z"}),(0,rc.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"})]}),"Config"]}),(0,rc.jsx)("button",{onClick:e=>{e.preventDefault(),e.stopPropagation(),K()},disabled:R,onMouseEnter:e=>{R||(e.target.style.background="#c0392b")},onMouseLeave:e=>{R||(e.target.style.background="#e74c3c")},style:{background:"#e74c3c",color:"white",border:"none",padding:"6px 12px",borderRadius:"4px",cursor:R?"not-allowed":"pointer",fontSize:"12px",whiteSpace:"nowrap",opacity:R?.6:1,fontWeight:"500",position:"relative",zIndex:1002,transition:"background-color 0.15s ease",pointerEvents:R?"none":"auto"},children:R?"Disconnecting...":"Disconnect"})]})]}),(0,rc.jsx)(oc,{isOpen:L,onClose:()=>P(!1),issues:r,standardsViolations:o,isLoadingStandards:a,onScanStandards:l}),(0,rc.jsx)(dc,{isOpen:T,onClose:()=>D(!1)})]})}return null};const pc=function(){const[t,n]=(0,e.useState)(!1),[r,i]=(0,e.useState)(!1),o=Ka();return(0,e.useEffect)(()=>{const e=async()=>{try{const e=await fetch("http://localhost:3001/",{method:"GET",mode:"cors"});i(e.ok)}catch(e){i(!1)}};e();const t=setInterval(e,3e3);return()=>clearInterval(t)},[]),(0,rc.jsxs)("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:"100vh",width:"100%",padding:"40px",boxSizing:"border-box",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif',position:"relative",zIndex:1},children:[(0,rc.jsxs)("div",{style:{position:"absolute",top:"24px",left:"24px",right:"24px",display:"flex",alignItems:"center",justifyContent:"space-between"},children:[(0,rc.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"10px"},children:[(0,rc.jsx)("img",{src:"/favicon.jpg",alt:"Bonzai",style:{width:"32px",height:"32px",borderRadius:"6px"}}),(0,rc.jsx)("span",{style:{fontSize:"20px",fontWeight:"600",color:"#333"},children:"bonzai"})]}),r&&(0,rc.jsx)("span",{onClick:()=>o("/visualize"),style:{fontSize:"16px",fontWeight:"500",color:"#333",cursor:"pointer"},onMouseEnter:e=>{e.currentTarget.style.color="#666"},onMouseLeave:e=>{e.currentTarget.style.color="#333"},children:"Visualize"})]}),(0,rc.jsxs)("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-start",maxWidth:"900px",width:"100%",textAlign:"left"},children:[(0,rc.jsx)("h1",{style:{fontSize:"56px",fontWeight:"700",margin:"0 0 32px 0",color:"#333",lineHeight:"1.2"},children:"AI coding without getting lost."}),(0,rc.jsx)("p",{style:{fontSize:"20px",fontWeight:"400",margin:"0 0 24px 0",color:"#555",lineHeight:"1.6",maxWidth:"550px"},children:"AI writes so much it's tough to keep up. If we're going to go 10x, we'll need a better way to drive."}),(0,rc.jsx)("p",{style:{fontSize:"22px",fontWeight:"600",margin:"0 0 24px 0",color:"#333",lineHeight:"1.6",maxWidth:"550px"},children:"Run the below in a local project to visualize your code."}),(0,rc.jsxs)("div",{style:{position:"relative",margin:"0 0 16px 0",width:"100%",maxWidth:"500px"},children:[(0,rc.jsx)("pre",{style:{margin:"0",background:"#f5f5f5",padding:"24px 60px 24px 32px",borderRadius:"12px",fontSize:"20px",fontFamily:"monospace",border:"2px solid #ddd",color:"#333",position:"relative",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.1)"},children:"npx bonzai-tools -g"}),(0,rc.jsx)("button",{onClick:async()=>{try{await navigator.clipboard.writeText("npx bonzai-burn -g"),n(!0),setTimeout(()=>n(!1),2e3)}catch(e){console.error("Failed to copy:",e)}},style:{position:"absolute",right:"16px",top:"50%",transform:"translateY(-50%)",background:"transparent",border:"none",cursor:"pointer",padding:"10px",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"6px",transition:"background-color 0.2s"},onMouseEnter:e=>{e.currentTarget.style.backgroundColor="#e0e0e0"},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="transparent"},"aria-label":"Copy to clipboard",children:(0,rc.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",style:{width:"22px",height:"22px",color:"#666"},children:(0,rc.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.666 3.888A2.25 2.25 0 0 0 13.5 2.25h-3c-1.03 0-1.9.693-2.166 1.638m7.332 0c.055.194.084.4.084.612v0a.75.75 0 0 1-.75.75H9a.75.75 0 0 1-.75-.75v0c0-.212.03-.418.084-.612m7.332 0c.646.049 1.288.11 1.927.184 1.1.128 1.907 1.077 1.907 2.185V19.5a2.25 2.25 0 0 1-2.25 2.25H6.75A2.25 2.25 0 0 1 4.5 19.5V6.257c0-1.108.806-2.057 1.907-2.185a48.208 48.208 0 0 1 1.927-.184"})})})]}),(0,rc.jsxs)("a",{href:"mailto:sanjog@bonzai.dev",style:{fontSize:"14px",color:"#333",textDecoration:"none",marginTop:"24px",display:"inline-flex",alignItems:"center",gap:"6px"},children:["Need help getting set up?"," ",(0,rc.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:"4px",color:"#0066cc",fontWeight:"600"},children:[(0,rc.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",style:{width:"16px",height:"16px"},children:(0,rc.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21.75 6.75v10.5a2.25 2.25 0 0 1-2.25 2.25h-15a2.25 2.25 0 0 1-2.25-2.25V6.75m19.5 0A2.25 2.25 0 0 0 19.5 4.5h-15a2.25 2.25 0 0 0-2.25 2.25m19.5 0v.243a2.25 2.25 0 0 1-1.07 1.916l-7.5 4.615a2.25 2.25 0 0 1-2.36 0L3.32 8.91a2.25 2.25 0 0 1-1.07-1.916V6.75"})}),"Email us"]})]})]}),t&&(0,rc.jsxs)("div",{style:{position:"fixed",bottom:"24px",right:"24px",background:"#333",color:"#fff",padding:"12px 20px",borderRadius:"8px",fontSize:"14px",fontWeight:"500",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",zIndex:1e3,display:"flex",alignItems:"center",gap:"8px"},children:[(0,rc.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",style:{width:"16px",height:"16px",color:"#22c55e"},children:(0,rc.jsx)("path",{fillRule:"evenodd",d:"M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z",clipRule:"evenodd"})}),"Copied! Run it in your terminal."]})]})};const gc=function(t){let{children:n,serverStatus:r}=t;const[i,o]=(0,e.useState)(!1),[s,a]=(0,e.useState)(!1),[l,c]=(0,e.useState)({step1:!0,step2:!1,step3:!1}),[u,d]=(0,e.useState)(!1),h=e=>{c(t=>Is(Is({},t),{},{[e]:!t[e]}))},f=(0,e.useCallback)(async()=>{try{if((await fetch("http://localhost:3001/",{method:"GET",mode:"cors",cache:"no-store"})).ok)return o(!0),void a(!0)}catch(n){}const e=new AbortController,t=setTimeout(()=>e.abort(),2e3);try{const n=await fetch("http://localhost:3001/",{mode:"no-cors",cache:"no-store",signal:e.signal});clearTimeout(t),"opaque"===n.type?(o(!0),a(!1)):(o(!1),a(!1))}catch(r){clearTimeout(t),o(!1),a(!1)}},[]);(0,e.useEffect)(()=>{f();const e=setInterval(f,2e3);return()=>clearInterval(e)},[f]);const p=(0,e.useMemo)(()=>{const e=navigator.userAgent;return navigator.brave?"Brave":e.includes("Arc")?"Arc":e.includes("Edg")?"Edge":e.includes("Firefox")?"Firefox":e.includes("Safari")&&!e.includes("Chrome")?"Safari":e.includes("Chrome")?"Chrome":"browser"},[]);return"active"===r?n:(0,rc.jsxs)("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:"100vh",width:"100%",padding:"40px",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif'},children:[(0,rc.jsxs)(Xl,{to:"/",style:{position:"absolute",top:"24px",left:"24px",display:"flex",alignItems:"center",gap:"10px",textDecoration:"none"},children:[(0,rc.jsx)("img",{src:"/favicon.jpg",alt:"Bonzai",style:{width:"32px",height:"32px",borderRadius:"6px"}}),(0,rc.jsx)("span",{style:{fontSize:"20px",fontWeight:"600",color:"#333"},children:"bonzai"})]}),(0,rc.jsxs)("div",{style:{background:"#fff",padding:"40px",borderRadius:"16px",boxShadow:"0 4px 24px rgba(0, 0, 0, 0.1)",maxWidth:"450px",width:"100%"},children:[(0,rc.jsx)("h2",{style:{margin:"0 0 8px",fontSize:"24px",fontWeight:"600",color:"#333"},children:"Almost there!"}),(0,rc.jsx)("p",{style:{margin:"0 0 24px",fontSize:"15px",color:"#666"},children:"Complete these steps to see your visualization."}),(0,rc.jsxs)("div",{style:{marginBottom:"24px"},children:[(0,rc.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",gap:"12px",marginBottom:"16px",fontSize:"15px",color:l.step1?"#999":"#555",lineHeight:"1.5",cursor:"pointer"},onClick:()=>h("step1"),children:[(0,rc.jsx)("div",{style:{width:"20px",height:"20px",borderRadius:"4px",border:"2px solid ".concat(l.step1?"#22c55e":"#d1d5db"),background:l.step1?"#22c55e":"transparent",flexShrink:0,marginTop:"1px",display:"flex",alignItems:"center",justifyContent:"center"},children:l.step1&&(0,rc.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"white",style:{width:"14px",height:"14px"},children:(0,rc.jsx)("path",{fillRule:"evenodd",d:"M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z",clipRule:"evenodd"})})}),(0,rc.jsxs)("span",{style:{textDecoration:l.step1?"line-through":"none"},children:["Run ",(0,rc.jsx)("code",{style:{background:"#f3f4f6",padding:"2px 6px",borderRadius:"4px",fontSize:"13px"},children:"npx bonzai-burn -g"})," in your repo"]})]}),(0,rc.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",gap:"12px",fontSize:"15px",color:l.step2?"#999":"#555",lineHeight:"1.5"},children:[(0,rc.jsx)("div",{onClick:()=>h("step2"),style:{width:"20px",height:"20px",borderRadius:"4px",border:"2px solid ".concat(l.step2||s?"#22c55e":"#d1d5db"),background:l.step2||s?"#22c55e":"transparent",flexShrink:0,marginTop:"1px",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer"},children:(l.step2||s)&&(0,rc.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"white",style:{width:"14px",height:"14px"},children:(0,rc.jsx)("path",{fillRule:"evenodd",d:"M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z",clipRule:"evenodd"})})}),(0,rc.jsxs)("span",{style:{display:"flex",justifyContent:"space-between",width:"100%",textDecoration:l.step2||s?"line-through":"none"},children:[(0,rc.jsxs)("span",{children:["Allow in ",(0,rc.jsx)("b",{children:"Chrome"===p?u?"Arc":"Chrome":p})]}),"Chrome"===p&&(0,rc.jsx)("span",{onClick:()=>d(!u),style:{color:"#0066cc",cursor:"pointer",textDecoration:"underline",fontSize:"13px"},children:u?"Using Chrome?":"Using Arc?"})]})]}),"Brave"===p&&(0,rc.jsxs)("video",{autoPlay:!0,loop:!0,muted:!0,playsInline:!0,style:{width:"100%",borderRadius:"8px",marginTop:"12px",marginBottom:"16px",border:"1px solid #eee"},children:[(0,rc.jsx)("source",{src:"/brave_guide.mov",type:"video/quicktime"}),(0,rc.jsx)("source",{src:"/brave_guide.mov",type:"video/mp4"})]}),"Chrome"===p&&(0,rc.jsxs)("video",{autoPlay:!0,loop:!0,muted:!0,playsInline:!0,style:{width:"100%",borderRadius:"8px",marginTop:"12px",marginBottom:"16px",border:"1px solid #eee"},children:[(0,rc.jsx)("source",{src:u?"/arc_guide.mov":"/chrome_guide.mov",type:"video/quicktime"}),(0,rc.jsx)("source",{src:u?"/arc_guide.mov":"/chrome_guide.mov",type:"video/mp4"})]},u?"arc":"chrome"),"Arc"===p&&(0,rc.jsxs)("video",{autoPlay:!0,loop:!0,muted:!0,playsInline:!0,style:{width:"100%",borderRadius:"8px",marginTop:"12px",marginBottom:"16px",border:"1px solid #eee"},children:[(0,rc.jsx)("source",{src:"/arc_guide.mov",type:"video/quicktime"}),(0,rc.jsx)("source",{src:"/arc_guide.mov",type:"video/mp4"})]}),"Safari"===p&&(0,rc.jsx)("div",{style:{background:"#fef2f2",border:"1px solid #ef4444",borderRadius:"8px",padding:"12px 16px",marginTop:"12px",marginBottom:"16px",fontSize:"14px",color:"#dc2626"},children:"Safari has strict security settings. For the smoothest experience, use Chrome or Brave."}),(0,rc.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",gap:"12px",fontSize:"15px",color:l.step3?"#999":"#555",lineHeight:"1.5",cursor:"pointer"},onClick:()=>h("step3"),children:[(0,rc.jsx)("div",{style:{width:"20px",height:"20px",borderRadius:"4px",border:"2px solid ".concat(l.step3?"#22c55e":"#d1d5db"),background:l.step3?"#22c55e":"transparent",flexShrink:0,marginTop:"1px",display:"flex",alignItems:"center",justifyContent:"center"},children:l.step3&&(0,rc.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"white",style:{width:"14px",height:"14px"},children:(0,rc.jsx)("path",{fillRule:"evenodd",d:"M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z",clipRule:"evenodd"})})}),(0,rc.jsx)("span",{style:{textDecoration:l.step3?"line-through":"none"},children:"Refresh the page to see real-time repo visualization"})]})]}),(0,rc.jsxs)("a",{href:"mailto:sanjog@bonzai.dev",style:{fontSize:"14px",color:"#333",textDecoration:"none",display:"inline-flex",alignItems:"center",gap:"6px"},children:["Need help?"," ",(0,rc.jsx)("span",{style:{color:"#0066cc",fontWeight:"600"},children:"Email us"})]})]}),(0,rc.jsx)("style",{children:"\n @keyframes pulse {\n 0%, 100% { opacity: 1; }\n 50% { opacity: 0.4; }\n }\n "})]})};function vc(e){const t={},n=e=>e.endsWith(".py")||e.endsWith(".js")||e.endsWith(".ts")||e.endsWith(".tsx")||e.endsWith(".jsx")||e.endsWith(".vue"),r=new Set,i=new Set,o=new Set;return e.forEach(e=>{if(e.endsWith(".function")){const t=e.lastIndexOf("/");if(-1!==t){const i=e.substring(0,t);n(i)&&r.add(i)}}if(e.endsWith(".class")){const t=e.lastIndexOf("/");if(-1!==t){const r=e.substring(0,t);n(r)&&i.add(r)}}if(e.endsWith(".method")){const t=e.lastIndexOf("/");if(-1!==t){const n=e.substring(0,t);n.endsWith(".class")&&o.add(n)}}}),e.forEach(e=>{const s=e.endsWith("/"),a=e.endsWith(".function"),l=e.endsWith(".method"),c=(s?e.slice(0,-1):e).split("/").filter(e=>""!==e);let u=t;c.forEach((e,t)=>{const d=t===c.length-1,h=c.slice(0,t+1).join("/"),f=r.has(h),p=i.has(h),g=f||p,v=n(h),m=h.endsWith(".class");m&&o.has(h);if(u[e]){(g||"file"===u[e].type&&!d&&v&&i.has(h))&&"file"===u[e].type&&null===u[e].children&&(u[e].children={}),m&&"class"!==u[e].type&&(u[e].type="class",null===u[e].children&&(u[e].children={}))}else{let t;t=l&&d?"method":a&&d?"function":m?"class":g||d&&!s||!d&&v?"file":"folder";const n="folder"===t||"class"===t||g||"file"===t&&!d&&v&&i.has(h);u[e]={id:h,name:e,type:t,path:h,children:n?{}:null}}("folder"===u[e].type||"class"===u[e].type||"file"===u[e].type&&null!==u[e].children)&&(u=u[e].children)})}),function e(t){return Object.values(t).map(t=>(t.children&&("folder"===t.type||"class"===t.type||"file"===t.type&&null!==t.children)&&(t.children=e(t.children)),t)).sort((e,t)=>{if(("function"===e.type||"method"===e.type)&&"function"!==t.type&&"method"!==t.type)return 1;if(("function"===t.type||"method"===t.type)&&"function"!==e.type&&"method"!==e.type)return-1;if("folder"===e.type&&"folder"!==t.type)return-1;if("folder"===t.type&&"folder"!==e.type)return 1;if("class"===e.type&&"class"!==t.type&&"folder"!==t.type)return-1;if("class"===t.type&&"class"!==e.type&&"folder"!==e.type)return 1;const n=e.children&&(Array.isArray(e.children)?e.children.length>0:Object.keys(e.children).length>0),r=t.children&&(Array.isArray(t.children)?t.children.length>0:Object.keys(t.children).length>0);return n&&!r&&"file"===e.type&&"file"===t.type?-1:!n&&r&&"file"===e.type&&"file"===t.type?1:e.name.localeCompare(t.name)})}(t)}function mc(t){let{item:n,level:r=0,onFileClick:i,onFolderClick:o}=t;const[a,l]=(0,e.useState)(r<2),[c,u]=(0,e.useState)(null),d="folder"===n.type,h=d&&n.children&&n.children.length>0,f=16*r;return(0,e.useEffect)(()=>{if(d||!n.path)return;(async()=>{try{const e=n.path.split("/"),t=e.length>1?e.slice(1).join("/"):n.path,r=encodeURIComponent(t),i=await fetch("http://localhost:3001/read?path=".concat(r),{method:"GET",mode:"cors"});if(!i.ok)return;const o=i.headers.get("content-type");let a="";if(o&&o.includes("application/json")){const e=await i.json();a=e.content||e||""}else{const e=await i.text();try{const t=JSON.parse(e);a=t.content||t||""}catch(s){a=e}}const l=0===a.length?0:a.split("\n").length;u(l)}catch(e){console.error("Error fetching line count:",e)}})()},[d,n.path]),(0,rc.jsxs)("div",{children:[(0,rc.jsxs)("div",{onClick:()=>{d?(h&&l(!a),o&&o(n)):!d&&i&&i(n)},style:{padding:"4px 8px",paddingLeft:"".concat(8+f,"px"),cursor:"pointer",display:"flex",alignItems:"center",fontSize:"13px",color:"#333",userSelect:"none",transition:"background-color 0.15s",borderRadius:"3px",margin:"1px 4px"},onMouseEnter:e=>{e.currentTarget.style.backgroundColor="#e8e8e8"},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="transparent"},children:[d?(0,rc.jsx)("span",{style:{marginRight:"4px",fontSize:"10px",width:"12px",display:"inline-block"},children:h?a?"\u25bc":"\u25b6":"\ud83d\udcc1"}):(0,rc.jsx)("span",{style:{marginRight:"4px",fontSize:"10px",width:"12px",display:"inline-block"},children:"\ud83d\udcc4"}),(0,rc.jsx)("span",{style:{flex:1},children:n.name}),!d&&null!==c&&(0,rc.jsxs)("span",{style:{fontSize:"10px",color:"#666",background:"#e8e8e8",padding:"2px 6px",borderRadius:"10px",fontFamily:"monospace",whiteSpace:"nowrap",marginLeft:"8px",flexShrink:0},children:[c," lines"]})]}),d&&h&&a&&(0,rc.jsx)("div",{children:n.children.map((e,t)=>(0,rc.jsx)(mc,{item:e,level:r+1,onFileClick:i,onFolderClick:o},"".concat(e.path,"-").concat(t)))})]})}const _c=function(e){let{files:t,onFileClick:n,onFolderClick:r}=e;if(!t||0===t.length)return(0,rc.jsx)("div",{style:{padding:"20px",color:"#666",fontSize:"14px"},children:"No files found"});const i=t.length>0&&"object"===typeof t[0]&&t[0].type?t:vc(t);return(0,rc.jsx)("div",{style:{height:"100%",overflowY:"auto",fontFamily:"monospace"},children:i.map((e,t)=>(0,rc.jsx)(mc,{item:e,level:0,onFileClick:n,onFolderClick:r},"".concat(e.path,"-").concat(t)))})},yc=["__pycache__",".venv","node_modules",".git","codeflow","bonzai"],bc=["package.json","package-lock.json",".gitignore",".DS_Store"];const xc=function(t){let{onFileClick:n,onFolderClick:r,onTreeUpdate:i,refreshTrigger:o}=t;const[a,l]=(0,e.useState)([]),[c,u]=(0,e.useState)(!0),[d,h]=(0,e.useState)(null),[f,p]=(0,e.useState)(!1),g=async function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];try{e&&u(!0);const t=await fetch("http://localhost:3001/list",{method:"GET",mode:"cors"});if(!t.ok)throw new Error("Server responded with ".concat(t.status,": ").concat(t.statusText));let n=[];const r=t.headers.get("content-type");if(r&&r.includes("application/json")){const e=await t.json();n=e.files||e||[]}else{const e=await t.text();try{const t=JSON.parse(e);n=t.files||t||[]}catch(s){n=e.trim().split("\n").filter(e=>e.trim())}}const o=n.filter(e=>!function(e){const t=e.split("/"),n=t[t.length-1];return!!t.slice(1).some(e=>yc.includes(e))||!!bc.includes(n)}(e));if(l(o),h(null),i&&o.length>0){const e=vc(o);i(e)}}catch(t){console.error("Error fetching file list:",t),h(t.message),l([])}finally{e&&u(!1)}};return(0,e.useEffect)(()=>{g(!0);const e=setInterval(()=>g(!1),5e3);return()=>clearInterval(e)},[]),(0,e.useEffect)(()=>{void 0!==o&&o>0&&g(!1)},[o]),(0,rc.jsxs)("div",{style:{position:"absolute",top:"40px",left:"10px",width:"280px",height:f?"40px":"calc(100vh - 220px)",minHeight:f?"40px":"600px",background:"#fafafa",border:"1px solid #ddd",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",display:"none",flexDirection:"column",zIndex:1e3,transition:"height 0.3s ease",overflow:"hidden"},children:[(0,rc.jsx)("div",{style:{padding:"12px 16px",borderBottom:f?"none":"1px solid #ddd",background:"#fff",fontSize:"14px",fontWeight:"600",color:"#333",display:"flex",justifyContent:"space-between",alignItems:"center",cursor:"pointer",flexShrink:0},onClick:()=>p(!f),children:(0,rc.jsxs)("span",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[(0,rc.jsx)("span",{children:f?"\u25bc":"\u25b2"}),(0,rc.jsx)("span",{children:"File Browser"})]})}),!f&&(0,rc.jsxs)("div",{style:{flex:1,overflow:"auto",padding:"8px 0"},children:[c&&(0,rc.jsx)("div",{style:{padding:"20px",textAlign:"center",color:"#666",fontSize:"13px"},children:"Loading files..."}),d&&(0,rc.jsxs)("div",{style:{padding:"15px",margin:"8px",background:"#f8d7da",border:"1px solid #dc3545",borderRadius:"4px",color:"#721c24",fontSize:"12px"},children:["\u274c Error: ",d]}),!c&&!d&&(0,rc.jsx)(_c,{files:a,onFileClick:e=>{n&&n(e)},onFolderClick:r})]})]})};function wc(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Sc(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t);if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Cc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function kc(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Cc(Object(n),!0).forEach(function(t){Sc(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Cc(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Ec(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Rc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Mc(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Rc(Object(n),!0).forEach(function(t){Ec(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Rc(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Lc(e){return function t(){for(var n=this,r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];return i.length>=e.length?e.apply(this,i):function(){for(var e=arguments.length,r=new Array(e),o=0;o<e;o++)r[o]=arguments[o];return t.apply(n,[].concat(i,r))}}}function Pc(e){return{}.toString.call(e).includes("Object")}function Tc(e){return"function"===typeof e}var Dc=Lc(function(e,t){throw new Error(e[t]||e.default)})({initialIsRequired:"initial state is required",initialType:"initial state should be an object",initialContent:"initial state shouldn't be an empty object",handlerType:"handler should be an object or a function",handlersType:"all handlers should be a functions",selectorType:"selector should be a function",changeType:"provided value of changes should be an object",changeField:'it seams you want to change a field in the state which is not specified in the "initial" state',default:"an unknown error accured in `state-local` package"}),Oc={changes:function(e,t){return Pc(t)||Dc("changeType"),Object.keys(t).some(function(t){return!function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}(e,t)})&&Dc("changeField"),t},selector:function(e){Tc(e)||Dc("selectorType")},handler:function(e){Tc(e)||Pc(e)||Dc("handlerType"),Pc(e)&&Object.values(e).some(function(e){return!Tc(e)})&&Dc("handlersType")},initial:function(e){var t;e||Dc("initialIsRequired"),Pc(e)||Dc("initialType"),t=e,Object.keys(t).length||Dc("initialContent")}};function Ic(e,t){return Tc(t)?t(e.current):t}function Ac(e,t){return e.current=Mc(Mc({},e.current),t),t}function jc(e,t,n){return Tc(t)?t(e.current):Object.keys(n).forEach(function(n){var r;return null===(r=t[n])||void 0===r?void 0:r.call(t,e.current[n])}),n}var Bc={create:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Oc.initial(e),Oc.handler(t);var n={current:e},r=Lc(jc)(n,t),i=Lc(Ac)(n),o=Lc(Oc.changes)(e),s=Lc(Ic)(n);return[function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(e){return e};return Oc.selector(e),e(n.current)},function(e){!function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){return t.reduceRight(function(e,t){return t(e)},e)}}(r,i,o,s)(e)}]}};const Nc=Bc;var Fc={configIsRequired:"the configuration object is required",configType:"the configuration object should be an object",default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:"Deprecation warning!\n You are using deprecated way of configuration.\n\n Instead of using\n monaco.config({ urls: { monacoBase: '...' } })\n use\n monaco.config({ paths: { vs: '...' } })\n\n For more please check the link https://github.com/suren-atoyan/monaco-loader#config\n "},zc=function(e){return function t(){for(var n=this,r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];return i.length>=e.length?e.apply(this,i):function(){for(var e=arguments.length,r=new Array(e),o=0;o<e;o++)r[o]=arguments[o];return t.apply(n,[].concat(i,r))}}}(function(e,t){throw new Error(e[t]||e.default)})(Fc),Hc={config:function(e){return e||zc("configIsRequired"),function(e){return{}.toString.call(e).includes("Object")}(e)||zc("configType"),e.urls?(console.warn(Fc.deprecation),{paths:{vs:e.urls.monacoBase}}):e}};function Wc(e,t){return Object.keys(t).forEach(function(n){t[n]instanceof Object&&e[n]&&Object.assign(t[n],Wc(e[n],t[n]))}),kc(kc({},e),t)}var Uc={type:"cancelation",msg:"operation is manually canceled"};function Vc(e){var t=!1,n=new Promise(function(n,r){e.then(function(e){return t?r(Uc):n(e)}),e.catch(r)});return n.cancel=function(){return t=!0},n}var $c=["monaco"],qc=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,s,a=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t);else for(;!(l=(r=o.call(n)).done)&&(a.push(r.value),a.length!==t);l=!0);}catch(e){c=!0,i=e}finally{try{if(!l&&null!=n.return&&(s=n.return(),Object(s)!==s))return}finally{if(c)throw i}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return wc(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?wc(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(Nc.create({config:{paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.55.1/min/vs"}},isInitialized:!1,resolve:null,reject:null,monaco:null}),2),Kc=qc[0],Yc=qc[1];function Xc(e){return document.body.appendChild(e)}function Gc(e){var t=Kc(function(e){return{config:e.config,reject:e.reject}}),n=function(e){var t=document.createElement("script");return e&&(t.src=e),t}("".concat(t.config.paths.vs,"/loader.js"));return n.onload=function(){return e()},n.onerror=t.reject,n}function Zc(){var e=Kc(function(e){return{config:e.config,resolve:e.resolve,reject:e.reject}}),t=window.require;t.config(e.config),t(["vs/editor/editor.main"],function(t){var n=t.m||t;Jc(n),e.resolve(n)},function(t){e.reject(t)})}function Jc(e){Kc().monaco||Yc({monaco:e})}var Qc=new Promise(function(e,t){return Yc({resolve:e,reject:t})}),eu={config:function(e){var t=Hc.config(e),n=t.monaco,r=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(t,$c);Yc(function(e){return{config:Wc(e.config,r),monaco:n}})},init:function(){var e=Kc(function(e){return{monaco:e.monaco,isInitialized:e.isInitialized,resolve:e.resolve}});if(!e.isInitialized){if(Yc({isInitialized:!0}),e.monaco)return e.resolve(e.monaco),Vc(Qc);if(window.monaco&&window.monaco.editor)return Jc(window.monaco),e.resolve(window.monaco),Vc(Qc);!function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){return t.reduceRight(function(e,t){return t(e)},e)}}(Xc,Gc)(Zc)}return Vc(Qc)},__getMonacoInstance:function(){return Kc(function(e){return e.monaco})}},tu={wrapper:{display:"flex",position:"relative",textAlign:"initial"},fullWidth:{width:"100%"},hide:{display:"none"}},nu={container:{display:"flex",height:"100%",width:"100%",justifyContent:"center",alignItems:"center"}};var ru=function(t){let{children:n}=t;return e.createElement("div",{style:nu.container},n)},iu=ru;var ou=function(t){let{width:n,height:r,isEditorReady:i,loading:o,_ref:s,className:a,wrapperProps:l}=t;return e.createElement("section",Is({style:Is(Is({},tu.wrapper),{},{width:n,height:r})},l),!i&&e.createElement(iu,null,o),e.createElement("div",{ref:s,style:Is(Is({},tu.fullWidth),!i&&tu.hide),className:a}))},su=(0,e.memo)(ou);var au=function(t){(0,e.useEffect)(t,[])};var lu=function(t,n){let r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=(0,e.useRef)(!0);(0,e.useEffect)(i.current||!r?()=>{i.current=!1}:t,n)};function cu(){}function uu(e,t,n,r){return function(e,t){return e.editor.getModel(du(e,t))}(e,r)||function(e,t,n,r){return e.editor.createModel(t,n,r?du(e,r):void 0)}(e,t,n,r)}function du(e,t){return e.Uri.parse(t)}var hu=function(t){let{original:n,modified:r,language:i,originalLanguage:o,modifiedLanguage:s,originalModelPath:a,modifiedModelPath:l,keepCurrentOriginalModel:c=!1,keepCurrentModifiedModel:u=!1,theme:d="light",loading:h="Loading...",options:f={},height:p="100%",width:g="100%",className:v,wrapperProps:m={},beforeMount:_=cu,onMount:y=cu}=t,[b,x]=(0,e.useState)(!1),[w,S]=(0,e.useState)(!0),C=(0,e.useRef)(null),k=(0,e.useRef)(null),E=(0,e.useRef)(null),R=(0,e.useRef)(y),M=(0,e.useRef)(_),L=(0,e.useRef)(!1);au(()=>{let e=eu.init();return e.then(e=>(k.current=e)&&S(!1)).catch(e=>"cancelation"!==(null===e||void 0===e?void 0:e.type)&&console.error("Monaco initialization: error:",e)),()=>C.current?function(){var e,t,n,r;let i=null===(e=C.current)||void 0===e?void 0:e.getModel();c||null!==i&&void 0!==i&&null!==(t=i.original)&&void 0!==t&&t.dispose(),u||null!==i&&void 0!==i&&null!==(n=i.modified)&&void 0!==n&&n.dispose(),null===(r=C.current)||void 0===r||r.dispose()}():e.cancel()}),lu(()=>{if(C.current&&k.current){let e=C.current.getOriginalEditor(),t=uu(k.current,n||"",o||i||"text",a||"");t!==e.getModel()&&e.setModel(t)}},[a],b),lu(()=>{if(C.current&&k.current){let e=C.current.getModifiedEditor(),t=uu(k.current,r||"",s||i||"text",l||"");t!==e.getModel()&&e.setModel(t)}},[l],b),lu(()=>{let e=C.current.getModifiedEditor();e.getOption(k.current.editor.EditorOption.readOnly)?e.setValue(r||""):r!==e.getValue()&&(e.executeEdits("",[{range:e.getModel().getFullModelRange(),text:r||"",forceMoveMarkers:!0}]),e.pushUndoStop())},[r],b),lu(()=>{var e;null===(e=C.current)||void 0===e||null===(e=e.getModel())||void 0===e||e.original.setValue(n||"")},[n],b),lu(()=>{let{original:e,modified:t}=C.current.getModel();k.current.editor.setModelLanguage(e,o||i||"text"),k.current.editor.setModelLanguage(t,s||i||"text")},[i,o,s],b),lu(()=>{var e;null===(e=k.current)||void 0===e||e.editor.setTheme(d)},[d],b),lu(()=>{var e;null===(e=C.current)||void 0===e||e.updateOptions(f)},[f],b);let P=(0,e.useCallback)(()=>{var e;if(!k.current)return;M.current(k.current);let t=uu(k.current,n||"",o||i||"text",a||""),c=uu(k.current,r||"",s||i||"text",l||"");null===(e=C.current)||void 0===e||e.setModel({original:t,modified:c})},[i,r,s,n,o,a,l]),T=(0,e.useCallback)(()=>{var e;!L.current&&E.current&&(C.current=k.current.editor.createDiffEditor(E.current,Is({automaticLayout:!0},f)),P(),null!==(e=k.current)&&void 0!==e&&e.editor.setTheme(d),x(!0),L.current=!0)},[f,d,P]);return(0,e.useEffect)(()=>{b&&R.current(C.current,k.current)},[b]),(0,e.useEffect)(()=>{!w&&!b&&T()},[w,b,T]),e.createElement(su,{width:g,height:p,isEditorReady:b,loading:h,_ref:E,className:v,wrapperProps:m})};(0,e.memo)(hu);var fu=function(t){let n=(0,e.useRef)();return(0,e.useEffect)(()=>{n.current=t},[t]),n.current},pu=new Map;var gu=function(t){let{defaultValue:n,defaultLanguage:r,defaultPath:i,value:o,language:s,path:a,theme:l="light",line:c,loading:u="Loading...",options:d={},overrideServices:h={},saveViewState:f=!0,keepCurrentModel:p=!1,width:g="100%",height:v="100%",className:m,wrapperProps:_={},beforeMount:y=cu,onMount:b=cu,onChange:x,onValidate:w=cu}=t,[S,C]=(0,e.useState)(!1),[k,E]=(0,e.useState)(!0),R=(0,e.useRef)(null),M=(0,e.useRef)(null),L=(0,e.useRef)(null),P=(0,e.useRef)(b),T=(0,e.useRef)(y),D=(0,e.useRef)(),O=(0,e.useRef)(o),I=fu(a),A=(0,e.useRef)(!1),j=(0,e.useRef)(!1);au(()=>{let e=eu.init();return e.then(e=>(R.current=e)&&E(!1)).catch(e=>"cancelation"!==(null===e||void 0===e?void 0:e.type)&&console.error("Monaco initialization: error:",e)),()=>M.current?function(){var e,t;null!==(e=D.current)&&void 0!==e&&e.dispose(),p?f&&pu.set(a,M.current.saveViewState()):null===(t=M.current.getModel())||void 0===t||t.dispose(),M.current.dispose()}():e.cancel()}),lu(()=>{var e,t,l,c;let u=uu(R.current,n||o||"",r||s||"",a||i||"");u!==(null===(e=M.current)||void 0===e?void 0:e.getModel())&&(f&&pu.set(I,null===(t=M.current)||void 0===t?void 0:t.saveViewState()),null!==(l=M.current)&&void 0!==l&&l.setModel(u),f&&(null===(c=M.current)||void 0===c||c.restoreViewState(pu.get(a))))},[a],S),lu(()=>{var e;null===(e=M.current)||void 0===e||e.updateOptions(d)},[d],S),lu(()=>{!M.current||void 0===o||(M.current.getOption(R.current.editor.EditorOption.readOnly)?M.current.setValue(o):o!==M.current.getValue()&&(j.current=!0,M.current.executeEdits("",[{range:M.current.getModel().getFullModelRange(),text:o,forceMoveMarkers:!0}]),M.current.pushUndoStop(),j.current=!1))},[o],S),lu(()=>{var e,t;let n=null===(e=M.current)||void 0===e?void 0:e.getModel();n&&s&&(null===(t=R.current)||void 0===t||t.editor.setModelLanguage(n,s))},[s],S),lu(()=>{var e;void 0!==c&&(null===(e=M.current)||void 0===e||e.revealLine(c))},[c],S),lu(()=>{var e;null===(e=R.current)||void 0===e||e.editor.setTheme(l)},[l],S);let B=(0,e.useCallback)(()=>{if(L.current&&R.current&&!A.current){var e;T.current(R.current);let t=a||i,u=uu(R.current,o||n||"",r||s||"",t||"");M.current=null===(e=R.current)||void 0===e?void 0:e.editor.create(L.current,Is({model:u,automaticLayout:!0},d),h),f&&M.current.restoreViewState(pu.get(t)),R.current.editor.setTheme(l),void 0!==c&&M.current.revealLine(c),C(!0),A.current=!0}},[n,r,i,o,s,a,d,h,f,l,c]);return(0,e.useEffect)(()=>{S&&P.current(M.current,R.current)},[S]),(0,e.useEffect)(()=>{!k&&!S&&B()},[k,S,B]),O.current=o,(0,e.useEffect)(()=>{var e,t;S&&x&&(null!==(e=D.current)&&void 0!==e&&e.dispose(),D.current=null===(t=M.current)||void 0===t?void 0:t.onDidChangeModelContent(e=>{j.current||x(M.current.getValue(),e)}))},[S,x]),(0,e.useEffect)(()=>{if(S){let e=R.current.editor.onDidChangeMarkers(e=>{var t;let n=null===(t=M.current.getModel())||void 0===t?void 0:t.uri;if(n&&e.find(e=>e.path===n.path)){let e=R.current.editor.getModelMarkers({resource:n});null===w||void 0===w||w(e)}});return()=>{null===e||void 0===e||e.dispose()}}return()=>{}},[S,w]),e.createElement(su,{width:g,height:v,isEditorReady:S,loading:u,_ref:L,className:m,wrapperProps:_})},vu=(0,e.memo)(gu);const mu=function(t){let{rootTree:n,initialFile:r,onClose:i}=t;const[o,a]=(0,e.useState)([]),[l,c]=(0,e.useState)(null),[u,d]=(0,e.useState)(!1),[h,f]=(0,e.useState)(null),[p,g]=(0,e.useState)(250),[v,m]=(0,e.useState)(!1),_=(0,e.useRef)(null);(0,e.useEffect)(()=>{r&&x(r)},[r]);const y=o.find(e=>e.path===l),b=y&&y.content!==y.originalContent,x=async e=>{const t="string"===typeof e?e:e.path,n=o.find(e=>e.path===t);if(n)c(t);else{a(e=>[...e,{path:t,content:"",originalContent:"",loading:!0,error:null}]),c(t);try{const e=await(async e=>{try{const t=e.split("/"),n=t.length>1?t.slice(1).join("/"):e,r=encodeURIComponent(n),i=await fetch("http://localhost:3001/read?path=".concat(r),{method:"GET",mode:"cors"});if(!i.ok)throw new Error("Failed to read file: ".concat(i.status," ").concat(i.statusText));const o=i.headers.get("content-type");let a="";if(o&&o.includes("application/json")){const e=await i.json();a=e.content||e||""}else{const e=await i.text();try{const t=JSON.parse(e);a=t.content||t||""}catch(s){a=e}}return a}catch(t){throw t}})(t);a(n=>n.map(n=>n.path===t?Is(Is({},n),{},{content:e,originalContent:e,loading:!1}):n))}catch(r){a(e=>e.map(e=>e.path===t?Is(Is({},e),{},{loading:!1,error:r.message}):e))}}},w=async()=>{if(y&&b){d(!0),f(null);try{const e=y.path.split("/"),t=e.length>1?e.slice(1).join("/"):y.path,n=await fetch("http://localhost:3001/write",{method:"POST",headers:{"Content-Type":"application/json"},mode:"cors",body:JSON.stringify({path:t,content:y.content})});if(!n.ok)throw new Error("Failed to save file: ".concat(n.status," ").concat(n.statusText));a(e=>e.map(e=>e.path===y.path?Is(Is({},e),{},{originalContent:e.content}):e)),f({type:"success",message:"Saved!"}),setTimeout(()=>f(null),2e3)}catch(e){f({type:"error",message:e.message})}finally{d(!1)}}};(0,e.useEffect)(()=>{const e=e=>{(e.metaKey||e.ctrlKey)&&"s"===e.key&&(e.preventDefault(),b&&!u&&w())};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[b,u,y]),(0,e.useEffect)(()=>{if(!v)return;const e=e=>{const t=Math.max(150,Math.min(400,e.clientX));g(t)},t=()=>{m(!1)};return document.addEventListener("mousemove",e),document.addEventListener("mouseup",t),()=>{document.removeEventListener("mousemove",e),document.removeEventListener("mouseup",t)}},[v]),l&&l.split("/").pop();const S=(e=>{var t;return e&&{js:"javascript",jsx:"javascript",ts:"typescript",tsx:"typescript",py:"python",java:"java",cpp:"cpp",c:"c",h:"c",html:"html",htm:"html",css:"css",scss:"scss",less:"less",json:"json",xml:"xml",md:"markdown",sh:"shell",bash:"shell",yaml:"yaml",yml:"yaml",sql:"sql",go:"go",rs:"rust",rb:"ruby",php:"php",swift:"swift",kt:"kotlin",scala:"scala",r:"r"}[(null===(t=e.split(".").pop())||void 0===t?void 0:t.toLowerCase())||""]||"plaintext"})(l);return(0,rc.jsx)("div",{style:{width:"100%",height:"100%",display:"flex",background:"#1e1e1e",position:"relative"},children:(0,rc.jsxs)("div",{style:{flex:1,display:"flex",flexDirection:"column",minWidth:0},children:[(0,rc.jsxs)("div",{style:{height:"35px",background:"#252526",borderBottom:"1px solid #3c3c3c",display:"flex",alignItems:"center",overflow:"hidden"},children:[(0,rc.jsx)("button",{onClick:i,style:{background:"transparent",border:"none",cursor:"pointer",padding:"6px 10px",color:"#bbbbbb",display:"flex",alignItems:"center",gap:"4px",fontSize:"12px",borderRight:"1px solid #3c3c3c",height:"100%"},onMouseEnter:e=>e.currentTarget.style.background="#3c3c3c",onMouseLeave:e=>e.currentTarget.style.background="transparent",title:"Back to Graph",children:(0,rc.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",style:{width:"14px",height:"14px"},children:(0,rc.jsx)("path",{fillRule:"evenodd",d:"M17 10a.75.75 0 0 1-.75.75H5.612l4.158 3.96a.75.75 0 1 1-1.04 1.08l-5.5-5.25a.75.75 0 0 1 0-1.08l5.5-5.25a.75.75 0 1 1 1.04 1.08L5.612 9.25H16.25A.75.75 0 0 1 17 10Z",clipRule:"evenodd"})})}),(0,rc.jsx)("div",{style:{display:"flex",flex:1,overflow:"auto",height:"100%"},children:o.map(e=>{const t=e.path===l,n=e.content!==e.originalContent,r=e.path.split("/").pop();return(0,rc.jsxs)("div",{onClick:()=>c(e.path),style:{padding:"0 12px",height:"100%",display:"flex",alignItems:"center",gap:"6px",cursor:"pointer",background:t?"#1e1e1e":"transparent",borderRight:"1px solid #3c3c3c",borderTop:t?"1px solid #007acc":"1px solid transparent",fontSize:"13px",color:t?"#ffffff":"#969696",whiteSpace:"nowrap",position:"relative"},onMouseEnter:e=>{t||(e.currentTarget.style.background="#2d2d2d")},onMouseLeave:e=>{t||(e.currentTarget.style.background="transparent")},children:[(0,rc.jsxs)("span",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[r,n&&(0,rc.jsx)("span",{style:{width:"8px",height:"8px",borderRadius:"50%",background:"#f59e0b",flexShrink:0}})]}),(0,rc.jsx)("button",{onClick:t=>((e,t)=>{t&&t.stopPropagation();const n=o.find(t=>t.path===e);if(n&&n.content!==n.originalContent&&!window.confirm("You have unsaved changes. Are you sure you want to close?"))return;const r=o.filter(t=>t.path!==e);if(a(r),l===e)if(r.length>0){const t=o.findIndex(t=>t.path===e),n=Math.min(t,r.length-1);c(r[n].path)}else c(null)})(e.path,t),style:{background:"transparent",border:"none",cursor:"pointer",padding:"2px",color:"#969696",fontSize:"14px",lineHeight:1,borderRadius:"3px",display:"flex",alignItems:"center",justifyContent:"center"},onMouseEnter:e=>{e.currentTarget.style.background="#4a4a4a",e.currentTarget.style.color="#ffffff"},onMouseLeave:e=>{e.currentTarget.style.background="transparent",e.currentTarget.style.color="#969696"},children:"\xd7"})]},e.path)})}),y&&(0,rc.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"8px",padding:"0 12px",borderLeft:"1px solid #3c3c3c",height:"100%"},children:[u?(0,rc.jsx)("span",{style:{fontSize:"11px",color:"#9ca3af"},children:"Saving..."}):h?(0,rc.jsx)("span",{style:{fontSize:"11px",color:"success"===h.type?"#22c55e":"#ef4444"},children:h.message}):null,(0,rc.jsx)("button",{onClick:w,disabled:!b||u,style:{background:b?"#22c55e":"#4a4a4a",color:b?"#fff":"#888",border:"none",padding:"4px 10px",borderRadius:"4px",fontSize:"11px",fontWeight:"500",cursor:b&&!u?"pointer":"default",opacity:b?1:.6},children:"Save"})]})]}),(0,rc.jsx)("div",{style:{flex:1,overflow:"hidden"},children:y?y.loading?(0,rc.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%",color:"#9ca3af",fontSize:"14px"},children:"Loading file..."}):y.error?(0,rc.jsxs)("div",{style:{padding:"20px",background:"#3c1f1f",color:"#ef4444",borderRadius:"6px",fontSize:"13px",margin:"20px"},children:["Error: ",y.error]}):(0,rc.jsx)(vu,{height:"100%",language:S,value:y.content,theme:"vs-dark",onMount:(e,t)=>{_.current=e,e.addCommand(t.KeyMod.CtrlCmd|t.KeyCode.KeyS,()=>{w()}),e.focus()},onChange:e=>{l&&a(t=>t.map(t=>t.path===l?Is(Is({},t),{},{content:e||""}):t))},options:{minimap:{enabled:!1},fontSize:13,lineNumbers:"on",scrollBeyondLastLine:!1,wordWrap:"off",automaticLayout:!0,tabSize:2,folding:!0,lineNumbersMinChars:4,padding:{top:16}}}):(0,rc.jsxs)("div",{style:{width:"100%",height:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",color:"#6b6b6b"},children:[(0,rc.jsx)("div",{style:{fontSize:"48px",marginBottom:"16px",opacity:.3},children:"\ud83d\udcc4"}),(0,rc.jsx)("div",{style:{fontSize:"14px"},children:"Select a file to view"})]})}),y&&!y.loading&&!y.error&&(0,rc.jsxs)("div",{style:{height:"22px",background:"#007acc",display:"flex",alignItems:"center",justifyContent:"space-between",padding:"0 12px",fontSize:"12px",color:"#ffffff"},children:[(0,rc.jsx)("span",{style:{fontFamily:"monospace"},children:y.path}),(0,rc.jsxs)("span",{children:[y.content.split("\n").length," lines \u2022 ",S]})]})]})})};function _u(e){if("string"===typeof e||"number"===typeof e)return""+e;let t="";if(Array.isArray(e))for(let n,r=0;r<e.length;r++)""!==(n=_u(e[r]))&&(t+=(t&&" ")+n);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var yu={value:()=>{}};function bu(){for(var e,t=0,n=arguments.length,r={};t<n;++t){if(!(e=arguments[t]+"")||e in r||/[\s.]/.test(e))throw new Error("illegal type: "+e);r[e]=[]}return new xu(r)}function xu(e){this._=e}function wu(e,t){for(var n,r=0,i=e.length;r<i;++r)if((n=e[r]).name===t)return n.value}function Su(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=yu,e=e.slice(0,r).concat(e.slice(r+1));break}return null!=n&&e.push({name:t,value:n}),e}xu.prototype=bu.prototype={constructor:xu,on:function(e,t){var n,r,i=this._,o=(r=i,(e+"").trim().split(/^|\s+/).map(function(e){var t="",n=e.indexOf(".");if(n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),e&&!r.hasOwnProperty(e))throw new Error("unknown type: "+e);return{type:e,name:t}})),s=-1,a=o.length;if(!(arguments.length<2)){if(null!=t&&"function"!==typeof t)throw new Error("invalid callback: "+t);for(;++s<a;)if(n=(e=o[s]).type)i[n]=Su(i[n],e.name,t);else if(null==t)for(n in i)i[n]=Su(i[n],e.name,null);return this}for(;++s<a;)if((n=(e=o[s]).type)&&(n=wu(i[n],e.name)))return n},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new xu(e)},call:function(e,t){if((n=arguments.length-2)>0)for(var n,r,i=new Array(n),o=0;o<n;++o)i[o]=arguments[o+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(o=0,n=(r=this._[e]).length;o<n;++o)r[o].value.apply(t,i)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],i=0,o=r.length;i<o;++i)r[i].value.apply(t,n)}};const Cu=bu;function ku(){}function Eu(e){return null==e?ku:function(){return this.querySelector(e)}}function Ru(){return[]}function Mu(e){return null==e?Ru:function(){return this.querySelectorAll(e)}}function Lu(e){return function(){return function(e){return null==e?[]:Array.isArray(e)?e:Array.from(e)}(e.apply(this,arguments))}}function Pu(e){return function(){return this.matches(e)}}function Tu(e){return function(t){return t.matches(e)}}var Du=Array.prototype.find;function Ou(){return this.firstElementChild}var Iu=Array.prototype.filter;function Au(){return Array.from(this.children)}function ju(e){return new Array(e.length)}function Bu(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}function Nu(e,t,n,r,i,o){for(var s,a=0,l=t.length,c=o.length;a<c;++a)(s=t[a])?(s.__data__=o[a],r[a]=s):n[a]=new Bu(e,o[a]);for(;a<l;++a)(s=t[a])&&(i[a]=s)}function Fu(e,t,n,r,i,o,s){var a,l,c,u=new Map,d=t.length,h=o.length,f=new Array(d);for(a=0;a<d;++a)(l=t[a])&&(f[a]=c=s.call(l,l.__data__,a,t)+"",u.has(c)?i[a]=l:u.set(c,l));for(a=0;a<h;++a)c=s.call(e,o[a],a,o)+"",(l=u.get(c))?(r[a]=l,l.__data__=o[a],u.delete(c)):n[a]=new Bu(e,o[a]);for(a=0;a<d;++a)(l=t[a])&&u.get(f[a])===l&&(i[a]=l)}function zu(e){return e.__data__}function Hu(e){return"object"===typeof e&&"length"in e?e:Array.from(e)}function Wu(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}Bu.prototype={constructor:Bu,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};var Uu="http://www.w3.org/1999/xhtml";const Vu={svg:"http://www.w3.org/2000/svg",xhtml:Uu,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function $u(e){var t=e+="",n=t.indexOf(":");return n>=0&&"xmlns"!==(t=e.slice(0,n))&&(e=e.slice(n+1)),Vu.hasOwnProperty(t)?{space:Vu[t],local:e}:e}function qu(e){return function(){this.removeAttribute(e)}}function Ku(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Yu(e,t){return function(){this.setAttribute(e,t)}}function Xu(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Gu(e,t){return function(){var n=t.apply(this,arguments);null==n?this.removeAttribute(e):this.setAttribute(e,n)}}function Zu(e,t){return function(){var n=t.apply(this,arguments);null==n?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function Ju(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Qu(e){return function(){this.style.removeProperty(e)}}function ed(e,t,n){return function(){this.style.setProperty(e,t,n)}}function td(e,t,n){return function(){var r=t.apply(this,arguments);null==r?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function nd(e,t){return e.style.getPropertyValue(t)||Ju(e).getComputedStyle(e,null).getPropertyValue(t)}function rd(e){return function(){delete this[e]}}function id(e,t){return function(){this[e]=t}}function od(e,t){return function(){var n=t.apply(this,arguments);null==n?delete this[e]:this[e]=n}}function sd(e){return e.trim().split(/^|\s+/)}function ad(e){return e.classList||new ld(e)}function ld(e){this._node=e,this._names=sd(e.getAttribute("class")||"")}function cd(e,t){for(var n=ad(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function ud(e,t){for(var n=ad(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function dd(e){return function(){cd(this,e)}}function hd(e){return function(){ud(this,e)}}function fd(e,t){return function(){(t.apply(this,arguments)?cd:ud)(this,e)}}function pd(){this.textContent=""}function gd(e){return function(){this.textContent=e}}function vd(e){return function(){var t=e.apply(this,arguments);this.textContent=null==t?"":t}}function md(){this.innerHTML=""}function _d(e){return function(){this.innerHTML=e}}function yd(e){return function(){var t=e.apply(this,arguments);this.innerHTML=null==t?"":t}}function bd(){this.nextSibling&&this.parentNode.appendChild(this)}function xd(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function wd(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Uu&&t.documentElement.namespaceURI===Uu?t.createElement(e):t.createElementNS(n,e)}}function Sd(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Cd(e){var t=$u(e);return(t.local?Sd:wd)(t)}function kd(){return null}function Ed(){var e=this.parentNode;e&&e.removeChild(this)}function Rd(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Md(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Ld(e){return function(){var t=this.__on;if(t){for(var n,r=0,i=-1,o=t.length;r<o;++r)n=t[r],e.type&&n.type!==e.type||n.name!==e.name?t[++i]=n:this.removeEventListener(n.type,n.listener,n.options);++i?t.length=i:delete this.__on}}}function Pd(e,t,n){return function(){var r,i=this.__on,o=function(e){return function(t){e.call(this,t,this.__data__)}}(t);if(i)for(var s=0,a=i.length;s<a;++s)if((r=i[s]).type===e.type&&r.name===e.name)return this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=o,r.options=n),void(r.value=t);this.addEventListener(e.type,o,n),r={type:e.type,name:e.name,value:t,listener:o,options:n},i?i.push(r):this.__on=[r]}}function Td(e,t,n){var r=Ju(e),i=r.CustomEvent;"function"===typeof i?i=new i(t,n):(i=r.document.createEvent("Event"),n?(i.initEvent(t,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function Dd(e,t){return function(){return Td(this,e,t)}}function Od(e,t){return function(){return Td(this,e,t.apply(this,arguments))}}ld.prototype={add:function(e){this._names.indexOf(e)<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};var Id=[null];function Ad(e,t){this._groups=e,this._parents=t}function jd(){return new Ad([[document.documentElement]],Id)}Ad.prototype=jd.prototype={constructor:Ad,select:function(e){"function"!==typeof e&&(e=Eu(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i<n;++i)for(var o,s,a=t[i],l=a.length,c=r[i]=new Array(l),u=0;u<l;++u)(o=a[u])&&(s=e.call(o,o.__data__,u,a))&&("__data__"in o&&(s.__data__=o.__data__),c[u]=s);return new Ad(r,this._parents)},selectAll:function(e){e="function"===typeof e?Lu(e):Mu(e);for(var t=this._groups,n=t.length,r=[],i=[],o=0;o<n;++o)for(var s,a=t[o],l=a.length,c=0;c<l;++c)(s=a[c])&&(r.push(e.call(s,s.__data__,c,a)),i.push(s));return new Ad(r,i)},selectChild:function(e){return this.select(null==e?Ou:function(e){return function(){return Du.call(this.children,e)}}("function"===typeof e?e:Tu(e)))},selectChildren:function(e){return this.selectAll(null==e?Au:function(e){return function(){return Iu.call(this.children,e)}}("function"===typeof e?e:Tu(e)))},filter:function(e){"function"!==typeof e&&(e=Pu(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i<n;++i)for(var o,s=t[i],a=s.length,l=r[i]=[],c=0;c<a;++c)(o=s[c])&&e.call(o,o.__data__,c,s)&&l.push(o);return new Ad(r,this._parents)},data:function(e,t){if(!arguments.length)return Array.from(this,zu);var n=t?Fu:Nu,r=this._parents,i=this._groups;"function"!==typeof e&&(e=function(e){return function(){return e}}(e));for(var o=i.length,s=new Array(o),a=new Array(o),l=new Array(o),c=0;c<o;++c){var u=r[c],d=i[c],h=d.length,f=Hu(e.call(u,u&&u.__data__,c,r)),p=f.length,g=a[c]=new Array(p),v=s[c]=new Array(p);n(u,d,g,v,l[c]=new Array(h),f,t);for(var m,_,y=0,b=0;y<p;++y)if(m=g[y]){for(y>=b&&(b=y+1);!(_=v[b])&&++b<p;);m._next=_||null}}return(s=new Ad(s,r))._enter=a,s._exit=l,s},enter:function(){return new Ad(this._enter||this._groups.map(ju),this._parents)},exit:function(){return new Ad(this._exit||this._groups.map(ju),this._parents)},join:function(e,t,n){var r=this.enter(),i=this,o=this.exit();return"function"===typeof e?(r=e(r))&&(r=r.selection()):r=r.append(e+""),null!=t&&(i=t(i))&&(i=i.selection()),null==n?o.remove():n(o),r&&i?r.merge(i).order():i},merge:function(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,i=n.length,o=r.length,s=Math.min(i,o),a=new Array(i),l=0;l<s;++l)for(var c,u=n[l],d=r[l],h=u.length,f=a[l]=new Array(h),p=0;p<h;++p)(c=u[p]||d[p])&&(f[p]=c);for(;l<i;++l)a[l]=n[l];return new Ad(a,this._parents)},selection:function(){return this},order:function(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r,i=e[t],o=i.length-1,s=i[o];--o>=0;)(r=i[o])&&(s&&4^r.compareDocumentPosition(s)&&s.parentNode.insertBefore(r,s),s=r);return this},sort:function(e){function t(t,n){return t&&n?e(t.__data__,n.__data__):!t-!n}e||(e=Wu);for(var n=this._groups,r=n.length,i=new Array(r),o=0;o<r;++o){for(var s,a=n[o],l=a.length,c=i[o]=new Array(l),u=0;u<l;++u)(s=a[u])&&(c[u]=s);c.sort(t)}return new Ad(i,this._parents).order()},call:function(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this},nodes:function(){return Array.from(this)},node:function(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,o=r.length;i<o;++i){var s=r[i];if(s)return s}return null},size:function(){let e=0;for(const t of this)++e;return e},empty:function(){return!this.node()},each:function(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var i,o=t[n],s=0,a=o.length;s<a;++s)(i=o[s])&&e.call(i,i.__data__,s,o);return this},attr:function(e,t){var n=$u(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((null==t?n.local?Ku:qu:"function"===typeof t?n.local?Zu:Gu:n.local?Xu:Yu)(n,t))},style:function(e,t,n){return arguments.length>1?this.each((null==t?Qu:"function"===typeof t?td:ed)(e,t,null==n?"":n)):nd(this.node(),e)},property:function(e,t){return arguments.length>1?this.each((null==t?rd:"function"===typeof t?od:id)(e,t)):this.node()[e]},classed:function(e,t){var n=sd(e+"");if(arguments.length<2){for(var r=ad(this.node()),i=-1,o=n.length;++i<o;)if(!r.contains(n[i]))return!1;return!0}return this.each(("function"===typeof t?fd:t?dd:hd)(n,t))},text:function(e){return arguments.length?this.each(null==e?pd:("function"===typeof e?vd:gd)(e)):this.node().textContent},html:function(e){return arguments.length?this.each(null==e?md:("function"===typeof e?yd:_d)(e)):this.node().innerHTML},raise:function(){return this.each(bd)},lower:function(){return this.each(xd)},append:function(e){var t="function"===typeof e?e:Cd(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})},insert:function(e,t){var n="function"===typeof e?e:Cd(e),r=null==t?kd:"function"===typeof t?t:Eu(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})},remove:function(){return this.each(Ed)},clone:function(e){return this.select(e?Md:Rd)},datum:function(e){return arguments.length?this.property("__data__",e):this.node().__data__},on:function(e,t,n){var r,i,o=function(e){return e.trim().split(/^|\s+/).map(function(e){var t="",n=e.indexOf(".");return n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}})}(e+""),s=o.length;if(!(arguments.length<2)){for(a=t?Pd:Ld,r=0;r<s;++r)this.each(a(o[r],t,n));return this}var a=this.node().__on;if(a)for(var l,c=0,u=a.length;c<u;++c)for(r=0,l=a[c];r<s;++r)if((i=o[r]).type===l.type&&i.name===l.name)return l.value},dispatch:function(e,t){return this.each(("function"===typeof t?Od:Dd)(e,t))},[Symbol.iterator]:function*(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r,i=e[t],o=0,s=i.length;o<s;++o)(r=i[o])&&(yield r)}};const Bd=jd;function Nd(e){return"string"===typeof e?new Ad([[document.querySelector(e)]],[document.documentElement]):new Ad([[e]],Id)}function Fd(e,t){if(e=function(e){let t;for(;t=e.sourceEvent;)e=t;return e}(e),void 0===t&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,[(r=r.matrixTransform(t.getScreenCTM().inverse())).x,r.y]}if(t.getBoundingClientRect){var i=t.getBoundingClientRect();return[e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop]}}return[e.pageX,e.pageY]}const zd={passive:!1},Hd={capture:!0,passive:!1};function Wd(e){e.stopImmediatePropagation()}function Ud(e){e.preventDefault(),e.stopImmediatePropagation()}function Vd(e){var t=e.document.documentElement,n=Nd(e).on("dragstart.drag",Ud,Hd);"onselectstart"in t?n.on("selectstart.drag",Ud,Hd):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function $d(e,t){var n=e.document.documentElement,r=Nd(e).on("dragstart.drag",null);t&&(r.on("click.drag",Ud,Hd),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const qd=e=>()=>e;function Kd(e,t){let{sourceEvent:n,subject:r,target:i,identifier:o,active:s,x:a,y:l,dx:c,dy:u,dispatch:d}=t;Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},subject:{value:r,enumerable:!0,configurable:!0},target:{value:i,enumerable:!0,configurable:!0},identifier:{value:o,enumerable:!0,configurable:!0},active:{value:s,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:l,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:u,enumerable:!0,configurable:!0},_:{value:d}})}function Yd(e){return!e.ctrlKey&&!e.button}function Xd(){return this.parentNode}function Gd(e,t){return null==t?{x:e.x,y:e.y}:t}function Zd(){return navigator.maxTouchPoints||"ontouchstart"in this}function Jd(){var e,t,n,r,i=Yd,o=Xd,s=Gd,a=Zd,l={},c=Cu("start","drag","end"),u=0,d=0;function h(e){e.on("mousedown.drag",f).filter(a).on("touchstart.drag",v).on("touchmove.drag",m,zd).on("touchend.drag touchcancel.drag",_).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function f(s,a){if(!r&&i.call(this,s,a)){var l=y(this,o.call(this,s,a),s,a,"mouse");l&&(Nd(s.view).on("mousemove.drag",p,Hd).on("mouseup.drag",g,Hd),Vd(s.view),Wd(s),n=!1,e=s.clientX,t=s.clientY,l("start",s))}}function p(r){if(Ud(r),!n){var i=r.clientX-e,o=r.clientY-t;n=i*i+o*o>d}l.mouse("drag",r)}function g(e){Nd(e.view).on("mousemove.drag mouseup.drag",null),$d(e.view,n),Ud(e),l.mouse("end",e)}function v(e,t){if(i.call(this,e,t)){var n,r,s=e.changedTouches,a=o.call(this,e,t),l=s.length;for(n=0;n<l;++n)(r=y(this,a,e,t,s[n].identifier,s[n]))&&(Wd(e),r("start",e,s[n]))}}function m(e){var t,n,r=e.changedTouches,i=r.length;for(t=0;t<i;++t)(n=l[r[t].identifier])&&(Ud(e),n("drag",e,r[t]))}function _(e){var t,n,i=e.changedTouches,o=i.length;for(r&&clearTimeout(r),r=setTimeout(function(){r=null},500),t=0;t<o;++t)(n=l[i[t].identifier])&&(Wd(e),n("end",e,i[t]))}function y(e,t,n,r,i,o){var a,d,f,p=c.copy(),g=Fd(o||n,t);if(null!=(f=s.call(e,new Kd("beforestart",{sourceEvent:n,target:h,identifier:i,active:u,x:g[0],y:g[1],dx:0,dy:0,dispatch:p}),r)))return a=f.x-g[0]||0,d=f.y-g[1]||0,function n(o,s,c){var v,m=g;switch(o){case"start":l[i]=n,v=u++;break;case"end":delete l[i],--u;case"drag":g=Fd(c||s,t),v=u}p.call(o,e,new Kd(o,{sourceEvent:s,subject:f,target:h,identifier:i,active:v,x:g[0]+a,y:g[1]+d,dx:g[0]-m[0],dy:g[1]-m[1],dispatch:p}),r)}}return h.filter=function(e){return arguments.length?(i="function"===typeof e?e:qd(!!e),h):i},h.container=function(e){return arguments.length?(o="function"===typeof e?e:qd(e),h):o},h.subject=function(e){return arguments.length?(s="function"===typeof e?e:qd(e),h):s},h.touchable=function(e){return arguments.length?(a="function"===typeof e?e:qd(!!e),h):a},h.on=function(){var e=c.on.apply(c,arguments);return e===c?h:e},h.clickDistance=function(e){return arguments.length?(d=(e=+e)*e,h):Math.sqrt(d)},h}Kd.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Qd(e){return((e=Math.exp(e))+1/e)/2}const eh=function e(t,n,r){function i(e,i){var o,s,a=e[0],l=e[1],c=e[2],u=i[0],d=i[1],h=i[2],f=u-a,p=d-l,g=f*f+p*p;if(g<1e-12)s=Math.log(h/c)/t,o=function(e){return[a+e*f,l+e*p,c*Math.exp(t*e*s)]};else{var v=Math.sqrt(g),m=(h*h-c*c+r*g)/(2*c*n*v),_=(h*h-c*c-r*g)/(2*h*n*v),y=Math.log(Math.sqrt(m*m+1)-m),b=Math.log(Math.sqrt(_*_+1)-_);s=(b-y)/t,o=function(e){var r=e*s,i=Qd(y),o=c/(n*v)*(i*function(e){return((e=Math.exp(2*e))-1)/(e+1)}(t*r+y)-function(e){return((e=Math.exp(e))-1/e)/2}(y));return[a+o*f,l+o*p,c*i/Qd(t*r+y)]}}return o.duration=1e3*s*t/Math.SQRT2,o}return i.rho=function(t){var n=Math.max(.001,+t),r=n*n;return e(n,r,r*r)},i}(Math.SQRT2,2,4);var th,nh,rh=0,ih=0,oh=0,sh=0,ah=0,lh=0,ch="object"===typeof performance&&performance.now?performance:Date,uh="object"===typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function dh(){return ah||(uh(hh),ah=ch.now()+lh)}function hh(){ah=0}function fh(){this._call=this._time=this._next=null}function ph(e,t,n){var r=new fh;return r.restart(e,t,n),r}function gh(){ah=(sh=ch.now())+lh,rh=ih=0;try{!function(){dh(),++rh;for(var e,t=th;t;)(e=ah-t._time)>=0&&t._call.call(void 0,e),t=t._next;--rh}()}finally{rh=0,function(){var e,t,n=th,r=1/0;for(;n;)n._call?(r>n._time&&(r=n._time),e=n,n=n._next):(t=n._next,n._next=null,n=e?e._next=t:th=t);nh=e,mh(r)}(),ah=0}}function vh(){var e=ch.now(),t=e-sh;t>1e3&&(lh-=t,sh=e)}function mh(e){rh||(ih&&(ih=clearTimeout(ih)),e-ah>24?(e<1/0&&(ih=setTimeout(gh,e-ch.now()-lh)),oh&&(oh=clearInterval(oh))):(oh||(sh=ch.now(),oh=setInterval(vh,1e3)),rh=1,uh(gh)))}function _h(e,t,n){var r=new fh;return t=null==t?0:+t,r.restart(n=>{r.stop(),e(n+t)},t,n),r}fh.prototype=ph.prototype={constructor:fh,restart:function(e,t,n){if("function"!==typeof e)throw new TypeError("callback is not a function");n=(null==n?dh():+n)+(null==t?0:+t),this._next||nh===this||(nh?nh._next=this:th=this,nh=this),this._call=e,this._time=n,mh()},stop:function(){this._call&&(this._call=null,this._time=1/0,mh())}};var yh=Cu("start","end","cancel","interrupt"),bh=[];function xh(e,t,n,r,i,o){var s=e.__transition;if(s){if(n in s)return}else e.__transition={};!function(e,t,n){var r,i=e.__transition;function o(e){n.state=1,n.timer.restart(s,n.delay,n.time),n.delay<=e&&s(e-n.delay)}function s(o){var c,u,d,h;if(1!==n.state)return l();for(c in i)if((h=i[c]).name===n.name){if(3===h.state)return _h(s);4===h.state?(h.state=6,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete i[c]):+c<t&&(h.state=6,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete i[c])}if(_h(function(){3===n.state&&(n.state=4,n.timer.restart(a,n.delay,n.time),a(o))}),n.state=2,n.on.call("start",e,e.__data__,n.index,n.group),2===n.state){for(n.state=3,r=new Array(d=n.tween.length),c=0,u=-1;c<d;++c)(h=n.tween[c].value.call(e,e.__data__,n.index,n.group))&&(r[++u]=h);r.length=u+1}}function a(t){for(var i=t<n.duration?n.ease.call(null,t/n.duration):(n.timer.restart(l),n.state=5,1),o=-1,s=r.length;++o<s;)r[o].call(e,i);5===n.state&&(n.on.call("end",e,e.__data__,n.index,n.group),l())}function l(){for(var r in n.state=6,n.timer.stop(),delete i[t],i)return;delete e.__transition}i[t]=n,n.timer=ph(o,0,n.time)}(e,n,{name:t,index:r,group:i,on:yh,tween:bh,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:0})}function wh(e,t){var n=Ch(e,t);if(n.state>0)throw new Error("too late; already scheduled");return n}function Sh(e,t){var n=Ch(e,t);if(n.state>3)throw new Error("too late; already running");return n}function Ch(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function kh(e,t){var n,r,i,o=e.__transition,s=!0;if(o){for(i in t=null==t?null:t+"",o)(n=o[i]).name===t?(r=n.state>2&&n.state<5,n.state=6,n.timer.stop(),n.on.call(r?"interrupt":"cancel",e,e.__data__,n.index,n.group),delete o[i]):s=!1;s&&delete e.__transition}}function Eh(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var Rh,Mh=180/Math.PI,Lh={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Ph(e,t,n,r,i,o){var s,a,l;return(s=Math.sqrt(e*e+t*t))&&(e/=s,t/=s),(l=e*n+t*r)&&(n-=e*l,r-=t*l),(a=Math.sqrt(n*n+r*r))&&(n/=a,r/=a,l/=a),e*r<t*n&&(e=-e,t=-t,l=-l,s=-s),{translateX:i,translateY:o,rotate:Math.atan2(t,e)*Mh,skewX:Math.atan(l)*Mh,scaleX:s,scaleY:a}}function Th(e,t,n,r){function i(e){return e.length?e.pop()+" ":""}return function(o,s){var a=[],l=[];return o=e(o),s=e(s),function(e,r,i,o,s,a){if(e!==i||r!==o){var l=s.push("translate(",null,t,null,n);a.push({i:l-4,x:Eh(e,i)},{i:l-2,x:Eh(r,o)})}else(i||o)&&s.push("translate("+i+t+o+n)}(o.translateX,o.translateY,s.translateX,s.translateY,a,l),function(e,t,n,o){e!==t?(e-t>180?t+=360:t-e>180&&(e+=360),o.push({i:n.push(i(n)+"rotate(",null,r)-2,x:Eh(e,t)})):t&&n.push(i(n)+"rotate("+t+r)}(o.rotate,s.rotate,a,l),function(e,t,n,o){e!==t?o.push({i:n.push(i(n)+"skewX(",null,r)-2,x:Eh(e,t)}):t&&n.push(i(n)+"skewX("+t+r)}(o.skewX,s.skewX,a,l),function(e,t,n,r,o,s){if(e!==n||t!==r){var a=o.push(i(o)+"scale(",null,",",null,")");s.push({i:a-4,x:Eh(e,n)},{i:a-2,x:Eh(t,r)})}else 1===n&&1===r||o.push(i(o)+"scale("+n+","+r+")")}(o.scaleX,o.scaleY,s.scaleX,s.scaleY,a,l),o=s=null,function(e){for(var t,n=-1,r=l.length;++n<r;)a[(t=l[n]).i]=t.x(e);return a.join("")}}}var Dh=Th(function(e){const t=new("function"===typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Lh:Ph(t.a,t.b,t.c,t.d,t.e,t.f)},"px, ","px)","deg)"),Oh=Th(function(e){return null==e?Lh:(Rh||(Rh=document.createElementNS("http://www.w3.org/2000/svg","g")),Rh.setAttribute("transform",e),(e=Rh.transform.baseVal.consolidate())?Ph((e=e.matrix).a,e.b,e.c,e.d,e.e,e.f):Lh)},", ",")",")");function Ih(e,t){var n,r;return function(){var i=Sh(this,e),o=i.tween;if(o!==n)for(var s=0,a=(r=n=o).length;s<a;++s)if(r[s].name===t){(r=r.slice()).splice(s,1);break}i.tween=r}}function Ah(e,t,n){var r,i;if("function"!==typeof n)throw new Error;return function(){var o=Sh(this,e),s=o.tween;if(s!==r){i=(r=s).slice();for(var a={name:t,value:n},l=0,c=i.length;l<c;++l)if(i[l].name===t){i[l]=a;break}l===c&&i.push(a)}o.tween=i}}function jh(e,t,n){var r=e._id;return e.each(function(){var e=Sh(this,r);(e.value||(e.value={}))[t]=n.apply(this,arguments)}),function(e){return Ch(e,r).value[t]}}function Bh(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function Nh(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function Fh(){}var zh=.7,Hh=1/zh,Wh="\\s*([+-]?\\d+)\\s*",Uh="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Vh="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",$h=/^#([0-9a-f]{3,8})$/,qh=new RegExp("^rgb\\(".concat(Wh,",").concat(Wh,",").concat(Wh,"\\)$")),Kh=new RegExp("^rgb\\(".concat(Vh,",").concat(Vh,",").concat(Vh,"\\)$")),Yh=new RegExp("^rgba\\(".concat(Wh,",").concat(Wh,",").concat(Wh,",").concat(Uh,"\\)$")),Xh=new RegExp("^rgba\\(".concat(Vh,",").concat(Vh,",").concat(Vh,",").concat(Uh,"\\)$")),Gh=new RegExp("^hsl\\(".concat(Uh,",").concat(Vh,",").concat(Vh,"\\)$")),Zh=new RegExp("^hsla\\(".concat(Uh,",").concat(Vh,",").concat(Vh,",").concat(Uh,"\\)$")),Jh={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function Qh(){return this.rgb().formatHex()}function ef(){return this.rgb().formatRgb()}function tf(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=$h.exec(e))?(n=t[1].length,t=parseInt(t[1],16),6===n?nf(t):3===n?new sf(t>>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):8===n?rf(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):4===n?rf(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|240&t,((15&t)<<4|15&t)/255):null):(t=qh.exec(e))?new sf(t[1],t[2],t[3],1):(t=Kh.exec(e))?new sf(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=Yh.exec(e))?rf(t[1],t[2],t[3],t[4]):(t=Xh.exec(e))?rf(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=Gh.exec(e))?hf(t[1],t[2]/100,t[3]/100,1):(t=Zh.exec(e))?hf(t[1],t[2]/100,t[3]/100,t[4]):Jh.hasOwnProperty(e)?nf(Jh[e]):"transparent"===e?new sf(NaN,NaN,NaN,0):null}function nf(e){return new sf(e>>16&255,e>>8&255,255&e,1)}function rf(e,t,n,r){return r<=0&&(e=t=n=NaN),new sf(e,t,n,r)}function of(e,t,n,r){return 1===arguments.length?function(e){return e instanceof Fh||(e=tf(e)),e?new sf((e=e.rgb()).r,e.g,e.b,e.opacity):new sf}(e):new sf(e,t,n,null==r?1:r)}function sf(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}function af(){return"#".concat(df(this.r)).concat(df(this.g)).concat(df(this.b))}function lf(){const e=cf(this.opacity);return"".concat(1===e?"rgb(":"rgba(").concat(uf(this.r),", ").concat(uf(this.g),", ").concat(uf(this.b)).concat(1===e?")":", ".concat(e,")"))}function cf(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function uf(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function df(e){return((e=uf(e))<16?"0":"")+e.toString(16)}function hf(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new pf(e,t,n,r)}function ff(e){if(e instanceof pf)return new pf(e.h,e.s,e.l,e.opacity);if(e instanceof Fh||(e=tf(e)),!e)return new pf;if(e instanceof pf)return e;var t=(e=e.rgb()).r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),o=Math.max(t,n,r),s=NaN,a=o-i,l=(o+i)/2;return a?(s=t===o?(n-r)/a+6*(n<r):n===o?(r-t)/a+2:(t-n)/a+4,a/=l<.5?o+i:2-o-i,s*=60):a=l>0&&l<1?0:s,new pf(s,a,l,e.opacity)}function pf(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}function gf(e){return(e=(e||0)%360)<0?e+360:e}function vf(e){return Math.max(0,Math.min(1,e||0))}function mf(e,t,n){return 255*(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)}function _f(e,t,n,r,i){var o=e*e,s=o*e;return((1-3*e+3*o-s)*t+(4-6*o+3*s)*n+(1+3*e+3*o-3*s)*r+s*i)/6}Bh(Fh,tf,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Qh,formatHex:Qh,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return ff(this).formatHsl()},formatRgb:ef,toString:ef}),Bh(sf,of,Nh(Fh,{brighter(e){return e=null==e?Hh:Math.pow(Hh,e),new sf(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=null==e?zh:Math.pow(zh,e),new sf(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new sf(uf(this.r),uf(this.g),uf(this.b),cf(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:af,formatHex:af,formatHex8:function(){return"#".concat(df(this.r)).concat(df(this.g)).concat(df(this.b)).concat(df(255*(isNaN(this.opacity)?1:this.opacity)))},formatRgb:lf,toString:lf})),Bh(pf,function(e,t,n,r){return 1===arguments.length?ff(e):new pf(e,t,n,null==r?1:r)},Nh(Fh,{brighter(e){return e=null==e?Hh:Math.pow(Hh,e),new pf(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=null==e?zh:Math.pow(zh,e),new pf(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+360*(this.h<0),t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new sf(mf(e>=240?e-240:e+120,i,r),mf(e,i,r),mf(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new pf(gf(this.h),vf(this.s),vf(this.l),cf(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=cf(this.opacity);return"".concat(1===e?"hsl(":"hsla(").concat(gf(this.h),", ").concat(100*vf(this.s),"%, ").concat(100*vf(this.l),"%").concat(1===e?")":", ".concat(e,")"))}}));const yf=e=>()=>e;function bf(e,t){return function(n){return e+n*t}}function xf(e){return 1===(e=+e)?wf:function(t,n){return n-t?function(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}(t,n,e):yf(isNaN(t)?n:t)}}function wf(e,t){var n=t-e;return n?bf(e,n):yf(isNaN(e)?t:e)}const Sf=function e(t){var n=xf(t);function r(e,t){var r=n((e=of(e)).r,(t=of(t)).r),i=n(e.g,t.g),o=n(e.b,t.b),s=wf(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=i(t),e.b=o(t),e.opacity=s(t),e+""}}return r.gamma=e,r}(1);function Cf(e){return function(t){var n,r,i=t.length,o=new Array(i),s=new Array(i),a=new Array(i);for(n=0;n<i;++n)r=of(t[n]),o[n]=r.r||0,s[n]=r.g||0,a[n]=r.b||0;return o=e(o),s=e(s),a=e(a),r.opacity=1,function(e){return r.r=o(e),r.g=s(e),r.b=a(e),r+""}}}Cf(function(e){var t=e.length-1;return function(n){var r=n<=0?n=0:n>=1?(n=1,t-1):Math.floor(n*t),i=e[r],o=e[r+1],s=r>0?e[r-1]:2*i-o,a=r<t-1?e[r+2]:2*o-i;return _f((n-r/t)*t,s,i,o,a)}}),Cf(function(e){var t=e.length;return function(n){var r=Math.floor(((n%=1)<0?++n:n)*t),i=e[(r+t-1)%t],o=e[r%t],s=e[(r+1)%t],a=e[(r+2)%t];return _f((n-r/t)*t,i,o,s,a)}});var kf=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Ef=new RegExp(kf.source,"g");function Rf(e,t){var n,r,i,o=kf.lastIndex=Ef.lastIndex=0,s=-1,a=[],l=[];for(e+="",t+="";(n=kf.exec(e))&&(r=Ef.exec(t));)(i=r.index)>o&&(i=t.slice(o,i),a[s]?a[s]+=i:a[++s]=i),(n=n[0])===(r=r[0])?a[s]?a[s]+=r:a[++s]=r:(a[++s]=null,l.push({i:s,x:Eh(n,r)})),o=Ef.lastIndex;return o<t.length&&(i=t.slice(o),a[s]?a[s]+=i:a[++s]=i),a.length<2?l[0]?function(e){return function(t){return e(t)+""}}(l[0].x):function(e){return function(){return e}}(t):(t=l.length,function(e){for(var n,r=0;r<t;++r)a[(n=l[r]).i]=n.x(e);return a.join("")})}function Mf(e,t){var n;return("number"===typeof t?Eh:t instanceof tf?Sf:(n=tf(t))?(t=n,Sf):Rf)(e,t)}function Lf(e){return function(){this.removeAttribute(e)}}function Pf(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Tf(e,t,n){var r,i,o=n+"";return function(){var s=this.getAttribute(e);return s===o?null:s===r?i:i=t(r=s,n)}}function Df(e,t,n){var r,i,o=n+"";return function(){var s=this.getAttributeNS(e.space,e.local);return s===o?null:s===r?i:i=t(r=s,n)}}function Of(e,t,n){var r,i,o;return function(){var s,a,l=n(this);if(null!=l)return(s=this.getAttribute(e))===(a=l+"")?null:s===r&&a===i?o:(i=a,o=t(r=s,l));this.removeAttribute(e)}}function If(e,t,n){var r,i,o;return function(){var s,a,l=n(this);if(null!=l)return(s=this.getAttributeNS(e.space,e.local))===(a=l+"")?null:s===r&&a===i?o:(i=a,o=t(r=s,l));this.removeAttributeNS(e.space,e.local)}}function Af(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&function(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}(e,i)),n}return i._value=t,i}function jf(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&function(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}(e,i)),n}return i._value=t,i}function Bf(e,t){return function(){wh(this,e).delay=+t.apply(this,arguments)}}function Nf(e,t){return t=+t,function(){wh(this,e).delay=t}}function Ff(e,t){return function(){Sh(this,e).duration=+t.apply(this,arguments)}}function zf(e,t){return t=+t,function(){Sh(this,e).duration=t}}var Hf=Bd.prototype.constructor;function Wf(e){return function(){this.style.removeProperty(e)}}var Uf=0;function Vf(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function $f(){return++Uf}var qf=Bd.prototype;Vf.prototype=function(e){return Bd().transition(e)}.prototype={constructor:Vf,select:function(e){var t=this._name,n=this._id;"function"!==typeof e&&(e=Eu(e));for(var r=this._groups,i=r.length,o=new Array(i),s=0;s<i;++s)for(var a,l,c=r[s],u=c.length,d=o[s]=new Array(u),h=0;h<u;++h)(a=c[h])&&(l=e.call(a,a.__data__,h,c))&&("__data__"in a&&(l.__data__=a.__data__),d[h]=l,xh(d[h],t,n,h,d,Ch(a,n)));return new Vf(o,this._parents,t,n)},selectAll:function(e){var t=this._name,n=this._id;"function"!==typeof e&&(e=Mu(e));for(var r=this._groups,i=r.length,o=[],s=[],a=0;a<i;++a)for(var l,c=r[a],u=c.length,d=0;d<u;++d)if(l=c[d]){for(var h,f=e.call(l,l.__data__,d,c),p=Ch(l,n),g=0,v=f.length;g<v;++g)(h=f[g])&&xh(h,t,n,g,f,p);o.push(f),s.push(l)}return new Vf(o,s,t,n)},selectChild:qf.selectChild,selectChildren:qf.selectChildren,filter:function(e){"function"!==typeof e&&(e=Pu(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i<n;++i)for(var o,s=t[i],a=s.length,l=r[i]=[],c=0;c<a;++c)(o=s[c])&&e.call(o,o.__data__,c,s)&&l.push(o);return new Vf(r,this._parents,this._name,this._id)},merge:function(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,r=t.length,i=n.length,o=Math.min(r,i),s=new Array(r),a=0;a<o;++a)for(var l,c=t[a],u=n[a],d=c.length,h=s[a]=new Array(d),f=0;f<d;++f)(l=c[f]||u[f])&&(h[f]=l);for(;a<r;++a)s[a]=t[a];return new Vf(s,this._parents,this._name,this._id)},selection:function(){return new Hf(this._groups,this._parents)},transition:function(){for(var e=this._name,t=this._id,n=$f(),r=this._groups,i=r.length,o=0;o<i;++o)for(var s,a=r[o],l=a.length,c=0;c<l;++c)if(s=a[c]){var u=Ch(s,t);xh(s,e,n,c,a,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Vf(r,this._parents,e,n)},call:qf.call,nodes:qf.nodes,node:qf.node,size:qf.size,empty:qf.empty,each:qf.each,on:function(e,t){var n=this._id;return arguments.length<2?Ch(this.node(),n).on.on(e):this.each(function(e,t,n){var r,i,o=function(e){return(e+"").trim().split(/^|\s+/).every(function(e){var t=e.indexOf(".");return t>=0&&(e=e.slice(0,t)),!e||"start"===e})}(t)?wh:Sh;return function(){var s=o(this,e),a=s.on;a!==r&&(i=(r=a).copy()).on(t,n),s.on=i}}(n,e,t))},attr:function(e,t){var n=$u(e),r="transform"===n?Oh:Mf;return this.attrTween(e,"function"===typeof t?(n.local?If:Of)(n,r,jh(this,"attr."+e,t)):null==t?(n.local?Pf:Lf)(n):(n.local?Df:Tf)(n,r,t))},attrTween:function(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(null==t)return this.tween(n,null);if("function"!==typeof t)throw new Error;var r=$u(e);return this.tween(n,(r.local?Af:jf)(r,t))},style:function(e,t,n){var r="transform"===(e+="")?Dh:Mf;return null==t?this.styleTween(e,function(e,t){var n,r,i;return function(){var o=nd(this,e),s=(this.style.removeProperty(e),nd(this,e));return o===s?null:o===n&&s===r?i:i=t(n=o,r=s)}}(e,r)).on("end.style."+e,Wf(e)):"function"===typeof t?this.styleTween(e,function(e,t,n){var r,i,o;return function(){var s=nd(this,e),a=n(this),l=a+"";return null==a&&(this.style.removeProperty(e),l=a=nd(this,e)),s===l?null:s===r&&l===i?o:(i=l,o=t(r=s,a))}}(e,r,jh(this,"style."+e,t))).each(function(e,t){var n,r,i,o,s="style."+t,a="end."+s;return function(){var l=Sh(this,e),c=l.on,u=null==l.value[s]?o||(o=Wf(t)):void 0;c===n&&i===u||(r=(n=c).copy()).on(a,i=u),l.on=r}}(this._id,e)):this.styleTween(e,function(e,t,n){var r,i,o=n+"";return function(){var s=nd(this,e);return s===o?null:s===r?i:i=t(r=s,n)}}(e,r,t),n).on("end.style."+e,null)},styleTween:function(e,t,n){var r="style."+(e+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==t)return this.tween(r,null);if("function"!==typeof t)throw new Error;return this.tween(r,function(e,t,n){var r,i;function o(){var o=t.apply(this,arguments);return o!==i&&(r=(i=o)&&function(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}(e,o,n)),r}return o._value=t,o}(e,t,null==n?"":n))},text:function(e){return this.tween("text","function"===typeof e?function(e){return function(){var t=e(this);this.textContent=null==t?"":t}}(jh(this,"text",e)):function(e){return function(){this.textContent=e}}(null==e?"":e+""))},textTween:function(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(null==e)return this.tween(t,null);if("function"!==typeof e)throw new Error;return this.tween(t,function(e){var t,n;function r(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&function(e){return function(t){this.textContent=e.call(this,t)}}(r)),t}return r._value=e,r}(e))},remove:function(){return this.on("end.remove",function(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}(this._id))},tween:function(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r,i=Ch(this.node(),n).tween,o=0,s=i.length;o<s;++o)if((r=i[o]).name===e)return r.value;return null}return this.each((null==t?Ih:Ah)(n,e,t))},delay:function(e){var t=this._id;return arguments.length?this.each(("function"===typeof e?Bf:Nf)(t,e)):Ch(this.node(),t).delay},duration:function(e){var t=this._id;return arguments.length?this.each(("function"===typeof e?Ff:zf)(t,e)):Ch(this.node(),t).duration},ease:function(e){var t=this._id;return arguments.length?this.each(function(e,t){if("function"!==typeof t)throw new Error;return function(){Sh(this,e).ease=t}}(t,e)):Ch(this.node(),t).ease},easeVarying:function(e){if("function"!==typeof e)throw new Error;return this.each(function(e,t){return function(){var n=t.apply(this,arguments);if("function"!==typeof n)throw new Error;Sh(this,e).ease=n}}(this._id,e))},end:function(){var e,t,n=this,r=n._id,i=n.size();return new Promise(function(o,s){var a={value:s},l={value:function(){0===--i&&o()}};n.each(function(){var n=Sh(this,r),i=n.on;i!==e&&((t=(e=i).copy())._.cancel.push(a),t._.interrupt.push(a),t._.end.push(l)),n.on=t}),0===i&&o()})},[Symbol.iterator]:qf[Symbol.iterator]};var Kf={time:null,delay:0,duration:250,ease:function(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}};function Yf(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error("transition ".concat(t," not found"));return n}Bd.prototype.interrupt=function(e){return this.each(function(){kh(this,e)})},Bd.prototype.transition=function(e){var t,n;e instanceof Vf?(t=e._id,e=e._name):(t=$f(),(n=Kf).time=dh(),e=null==e?null:e+"");for(var r=this._groups,i=r.length,o=0;o<i;++o)for(var s,a=r[o],l=a.length,c=0;c<l;++c)(s=a[c])&&xh(s,e,t,c,a,n||Yf(s,t));return new Vf(r,this._parents,e,t)};const Xf=e=>()=>e;function Gf(e,t){let{sourceEvent:n,target:r,transform:i,dispatch:o}=t;Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},transform:{value:i,enumerable:!0,configurable:!0},_:{value:o}})}function Zf(e,t,n){this.k=e,this.x=t,this.y=n}Zf.prototype={constructor:Zf,scale:function(e){return 1===e?this:new Zf(this.k*e,this.x,this.y)},translate:function(e,t){return 0===e&0===t?this:new Zf(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Jf=new Zf(1,0,0);function Qf(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Jf;return e.__zoom}function ep(e){e.stopImmediatePropagation()}function tp(e){e.preventDefault(),e.stopImmediatePropagation()}function np(e){return(!e.ctrlKey||"wheel"===e.type)&&!e.button}function rp(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e).hasAttribute("viewBox")?[[(e=e.viewBox.baseVal).x,e.y],[e.x+e.width,e.y+e.height]]:[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]:[[0,0],[e.clientWidth,e.clientHeight]]}function ip(){return this.__zoom||Jf}function op(e){return-e.deltaY*(1===e.deltaMode?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function sp(){return navigator.maxTouchPoints||"ontouchstart"in this}function ap(e,t,n){var r=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],o=e.invertY(t[0][1])-n[0][1],s=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),s>o?(o+s)/2:Math.min(0,o)||Math.max(0,s))}function lp(){var e,t,n,r=np,i=rp,o=ap,s=op,a=sp,l=[0,1/0],c=[[-1/0,-1/0],[1/0,1/0]],u=250,d=eh,h=Cu("start","zoom","end"),f=0,p=10;function g(e){e.property("__zoom",ip).on("wheel.zoom",w,{passive:!1}).on("mousedown.zoom",S).on("dblclick.zoom",C).filter(a).on("touchstart.zoom",k).on("touchmove.zoom",E).on("touchend.zoom touchcancel.zoom",R).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function v(e,t){return(t=Math.max(l[0],Math.min(l[1],t)))===e.k?e:new Zf(t,e.x,e.y)}function m(e,t,n){var r=t[0]-n[0]*e.k,i=t[1]-n[1]*e.k;return r===e.x&&i===e.y?e:new Zf(e.k,r,i)}function _(e){return[(+e[0][0]+ +e[1][0])/2,(+e[0][1]+ +e[1][1])/2]}function y(e,t,n,r){e.on("start.zoom",function(){b(this,arguments).event(r).start()}).on("interrupt.zoom end.zoom",function(){b(this,arguments).event(r).end()}).tween("zoom",function(){var e=this,o=arguments,s=b(e,o).event(r),a=i.apply(e,o),l=null==n?_(a):"function"===typeof n?n.apply(e,o):n,c=Math.max(a[1][0]-a[0][0],a[1][1]-a[0][1]),u=e.__zoom,h="function"===typeof t?t.apply(e,o):t,f=d(u.invert(l).concat(c/u.k),h.invert(l).concat(c/h.k));return function(e){if(1===e)e=h;else{var t=f(e),n=c/t[2];e=new Zf(n,l[0]-t[0]*n,l[1]-t[1]*n)}s.zoom(null,e)}})}function b(e,t,n){return!n&&e.__zooming||new x(e,t)}function x(e,t){this.that=e,this.args=t,this.active=0,this.sourceEvent=null,this.extent=i.apply(e,t),this.taps=0}function w(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];if(r.apply(this,arguments)){var a=b(this,n).event(e),u=this.__zoom,d=Math.max(l[0],Math.min(l[1],u.k*Math.pow(2,s.apply(this,arguments)))),h=Fd(e);if(a.wheel)a.mouse[0][0]===h[0]&&a.mouse[0][1]===h[1]||(a.mouse[1]=u.invert(a.mouse[0]=h)),clearTimeout(a.wheel);else{if(u.k===d)return;a.mouse=[h,u.invert(h)],kh(this),a.start()}tp(e),a.wheel=setTimeout(function(){a.wheel=null,a.end()},150),a.zoom("mouse",o(m(v(u,d),a.mouse[0],a.mouse[1]),a.extent,c))}}function S(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),s=1;s<t;s++)i[s-1]=arguments[s];if(!n&&r.apply(this,arguments)){var a=e.currentTarget,l=b(this,i,!0).event(e),u=Nd(e.view).on("mousemove.zoom",function(e){if(tp(e),!l.moved){var t=e.clientX-h,n=e.clientY-p;l.moved=t*t+n*n>f}l.event(e).zoom("mouse",o(m(l.that.__zoom,l.mouse[0]=Fd(e,a),l.mouse[1]),l.extent,c))},!0).on("mouseup.zoom",function(e){u.on("mousemove.zoom mouseup.zoom",null),$d(e.view,l.moved),tp(e),l.event(e).end()},!0),d=Fd(e,a),h=e.clientX,p=e.clientY;Vd(e.view),ep(e),l.mouse=[d,this.__zoom.invert(d)],kh(this),l.start()}}function C(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),s=1;s<t;s++)n[s-1]=arguments[s];if(r.apply(this,arguments)){var a=this.__zoom,l=Fd(e.changedTouches?e.changedTouches[0]:e,this),d=a.invert(l),h=a.k*(e.shiftKey?.5:2),f=o(m(v(a,h),l,d),i.apply(this,n),c);tp(e),u>0?Nd(this).transition().duration(u).call(y,f,l,e):Nd(this).call(g.transform,f,l,e)}}function k(n){for(var i=arguments.length,o=new Array(i>1?i-1:0),s=1;s<i;s++)o[s-1]=arguments[s];if(r.apply(this,arguments)){var a,l,c,u,d=n.touches,h=d.length,f=b(this,o,n.changedTouches.length===h).event(n);for(ep(n),l=0;l<h;++l)u=[u=Fd(c=d[l],this),this.__zoom.invert(u),c.identifier],f.touch0?f.touch1||f.touch0[2]===u[2]||(f.touch1=u,f.taps=0):(f.touch0=u,a=!0,f.taps=1+!!e);e&&(e=clearTimeout(e)),a&&(f.taps<2&&(t=u[0],e=setTimeout(function(){e=null},500)),kh(this),f.start())}}function E(e){if(this.__zooming){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];var i,s,a,l,u=b(this,n).event(e),d=e.changedTouches,h=d.length;for(tp(e),i=0;i<h;++i)a=Fd(s=d[i],this),u.touch0&&u.touch0[2]===s.identifier?u.touch0[0]=a:u.touch1&&u.touch1[2]===s.identifier&&(u.touch1[0]=a);if(s=u.that.__zoom,u.touch1){var f=u.touch0[0],p=u.touch0[1],g=u.touch1[0],_=u.touch1[1],y=(y=g[0]-f[0])*y+(y=g[1]-f[1])*y,x=(x=_[0]-p[0])*x+(x=_[1]-p[1])*x;s=v(s,Math.sqrt(y/x)),a=[(f[0]+g[0])/2,(f[1]+g[1])/2],l=[(p[0]+_[0])/2,(p[1]+_[1])/2]}else{if(!u.touch0)return;a=u.touch0[0],l=u.touch0[1]}u.zoom("touch",o(m(s,a,l),u.extent,c))}}function R(e){for(var r=arguments.length,i=new Array(r>1?r-1:0),o=1;o<r;o++)i[o-1]=arguments[o];if(this.__zooming){var s,a,l=b(this,i).event(e),c=e.changedTouches,u=c.length;for(ep(e),n&&clearTimeout(n),n=setTimeout(function(){n=null},500),s=0;s<u;++s)a=c[s],l.touch0&&l.touch0[2]===a.identifier?delete l.touch0:l.touch1&&l.touch1[2]===a.identifier&&delete l.touch1;if(l.touch1&&!l.touch0&&(l.touch0=l.touch1,delete l.touch1),l.touch0)l.touch0[1]=this.__zoom.invert(l.touch0[0]);else if(l.end(),2===l.taps&&(a=Fd(a,this),Math.hypot(t[0]-a[0],t[1]-a[1])<p)){var d=Nd(this).on("dblclick.zoom");d&&d.apply(this,arguments)}}}return g.transform=function(e,t,n,r){var i=e.selection?e.selection():e;i.property("__zoom",ip),e!==i?y(e,t,n,r):i.interrupt().each(function(){b(this,arguments).event(r).start().zoom(null,"function"===typeof t?t.apply(this,arguments):t).end()})},g.scaleBy=function(e,t,n,r){g.scaleTo(e,function(){return this.__zoom.k*("function"===typeof t?t.apply(this,arguments):t)},n,r)},g.scaleTo=function(e,t,n,r){g.transform(e,function(){var e=i.apply(this,arguments),r=this.__zoom,s=null==n?_(e):"function"===typeof n?n.apply(this,arguments):n,a=r.invert(s),l="function"===typeof t?t.apply(this,arguments):t;return o(m(v(r,l),s,a),e,c)},n,r)},g.translateBy=function(e,t,n,r){g.transform(e,function(){return o(this.__zoom.translate("function"===typeof t?t.apply(this,arguments):t,"function"===typeof n?n.apply(this,arguments):n),i.apply(this,arguments),c)},null,r)},g.translateTo=function(e,t,n,r,s){g.transform(e,function(){var e=i.apply(this,arguments),s=this.__zoom,a=null==r?_(e):"function"===typeof r?r.apply(this,arguments):r;return o(Jf.translate(a[0],a[1]).scale(s.k).translate("function"===typeof t?-t.apply(this,arguments):-t,"function"===typeof n?-n.apply(this,arguments):-n),e,c)},r,s)},x.prototype={event:function(e){return e&&(this.sourceEvent=e),this},start:function(){return 1===++this.active&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(e,t){return this.mouse&&"mouse"!==e&&(this.mouse[1]=t.invert(this.mouse[0])),this.touch0&&"touch"!==e&&(this.touch0[1]=t.invert(this.touch0[0])),this.touch1&&"touch"!==e&&(this.touch1[1]=t.invert(this.touch1[0])),this.that.__zoom=t,this.emit("zoom"),this},end:function(){return 0===--this.active&&(delete this.that.__zooming,this.emit("end")),this},emit:function(e){var t=Nd(this.that).datum();h.call(e,this.that,new Gf(e,{sourceEvent:this.sourceEvent,target:g,type:e,transform:this.that.__zoom,dispatch:h}),t)}},g.wheelDelta=function(e){return arguments.length?(s="function"===typeof e?e:Xf(+e),g):s},g.filter=function(e){return arguments.length?(r="function"===typeof e?e:Xf(!!e),g):r},g.touchable=function(e){return arguments.length?(a="function"===typeof e?e:Xf(!!e),g):a},g.extent=function(e){return arguments.length?(i="function"===typeof e?e:Xf([[+e[0][0],+e[0][1]],[+e[1][0],+e[1][1]]]),g):i},g.scaleExtent=function(e){return arguments.length?(l[0]=+e[0],l[1]=+e[1],g):[l[0],l[1]]},g.translateExtent=function(e){return arguments.length?(c[0][0]=+e[0][0],c[1][0]=+e[1][0],c[0][1]=+e[0][1],c[1][1]=+e[1][1],g):[[c[0][0],c[0][1]],[c[1][0],c[1][1]]]},g.constrain=function(e){return arguments.length?(o=e,g):o},g.duration=function(e){return arguments.length?(u=+e,g):u},g.interpolate=function(e){return arguments.length?(d=e,g):d},g.on=function(){var e=h.on.apply(h,arguments);return e===h?g:e},g.clickDistance=function(e){return arguments.length?(f=(e=+e)*e,g):Math.sqrt(f)},g.tapDistance=function(e){return arguments.length?(p=+e,g):p},g}function cp(e,t){var n,r=t?t.length:0,i=e?Math.min(r,e.length):0,o=new Array(i),s=new Array(r);for(n=0;n<i;++n)o[n]=fp(e[n],t[n]);for(;n<r;++n)s[n]=t[n];return function(e){for(n=0;n<i;++n)s[n]=o[n](e);return s}}function up(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function dp(e,t){var n,r={},i={};for(n in null!==e&&"object"===typeof e||(e={}),null!==t&&"object"===typeof t||(t={}),t)n in e?r[n]=fp(e[n],t[n]):i[n]=t[n];return function(e){for(n in r)i[n]=r[n](e);return i}}function hp(e,t){t||(t=[]);var n,r=e?Math.min(t.length,e.length):0,i=t.slice();return function(o){for(n=0;n<r;++n)i[n]=e[n]*(1-o)+t[n]*o;return i}}function fp(e,t){var n,r=typeof t;return null==t||"boolean"===r?yf(t):("number"===r?Eh:"string"===r?(n=tf(t))?(t=n,Sf):Rf:t instanceof tf?Sf:t instanceof Date?up:function(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}(t)?hp:Array.isArray(t)?cp:"function"!==typeof t.valueOf&&"function"!==typeof t.toString||isNaN(t)?dp:Eh)(e,t)}Qf.prototype=Zf.prototype;const pp=["inProgress"],gp=()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",vp=e=>'Node type "'.concat(e,'" not found. Using fallback type "default".'),mp=()=>"The React Flow parent container needs a width and a height to render the graph.",_p=()=>"Only child nodes can use a parent extent.",yp=()=>"Can't create edge. An edge needs a source and a target.",bp=e=>'Marker type "'.concat(e,"\" doesn't exist."),xp=(e,t)=>{let{id:n,sourceHandle:r,targetHandle:i}=t;return"Couldn't create edge for ".concat(e,' handle id: "').concat("source"===e?r:i,'", edge id: ').concat(n,".")},wp=()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",Sp=e=>'Edge type "'.concat(e,'" not found. Using fallback type "default".'),Cp=e=>'Node with id "'.concat(e,'" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.'),kp=()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",Ep=()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs.",Rp=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Mp=["Enter"," ","Escape"],Lp={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":e=>{let{direction:t,x:n,y:r}=e;return"Moved selected node ".concat(t,". New position, x: ").concat(n,", y: ").concat(r)},"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var Pp,Tp,Dp;!function(e){e.Strict="strict",e.Loose="loose"}(Pp||(Pp={})),function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"}(Tp||(Tp={})),function(e){e.Partial="partial",e.Full="full"}(Dp||(Dp={}));const Op={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Ip,Ap,jp;!function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"}(Ip||(Ip={})),function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"}(Ap||(Ap={})),function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"}(jp||(jp={}));const Bp={[jp.Left]:jp.Right,[jp.Right]:jp.Left,[jp.Top]:jp.Bottom,[jp.Bottom]:jp.Top};function Np(e){return null===e?null:e?"valid":"invalid"}const Fp=e=>"id"in e&&"source"in e&&"target"in e,zp=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),Hp=function(e){var t;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0];const{width:r,height:i}=gg(e),o=null!==(t=e.origin)&&void 0!==t?t:n,s=r*o[0],a=i*o[1];return{x:e.position.x-s,y:e.position.y-a}},Wp=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(e=>{(void 0===t.filter||t.filter(e))&&(n=Jp(n,ng(e)),r=!0)}),r?eg(n):{x:0,y:0,width:0,height:0}},Up=function(e,t){let[n,r,i]=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[0,0,1],o=arguments.length>3&&void 0!==arguments[3]&&arguments[3],s=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const a=Is(Is({},cg(t,[n,r,i])),{},{width:t.width/i,height:t.height/i}),l=[];for(const g of e.values()){var c,u,d,h,f,p;const{measured:e,selectable:t=!0,hidden:n=!1}=g;if(s&&!t||n)continue;const r=null!==(c=null!==(u=null!==(d=e.width)&&void 0!==d?d:g.width)&&void 0!==u?u:g.initialWidth)&&void 0!==c?c:null,i=null!==(h=null!==(f=null!==(p=e.height)&&void 0!==p?p:g.height)&&void 0!==f?f:g.initialHeight)&&void 0!==h?h:null,v=ig(a,tg(g)),m=(null!==r&&void 0!==r?r:0)*(null!==i&&void 0!==i?i:0),_=o&&v>0;(!g.internals.handleBounds||_||v>=m||g.dragging)&&l.push(g)}return l};async function Vp(e,t){var n,r,i;let{nodes:o,width:s,height:a,panZoom:l,minZoom:c,maxZoom:u}=e;if(0===o.size)return Promise.resolve(!0);const d=function(e,t){const n=new Map,r=null!==t&&void 0!==t&&t.nodes?new Set(t.nodes.map(e=>e.id)):null;return e.forEach(e=>{!e.measured.width||!e.measured.height||!(null===t||void 0===t?void 0:t.includeHiddenNodes)&&e.hidden||r&&!r.has(e.id)||n.set(e.id,e)}),n}(o,t),h=Wp(d),f=hg(h,s,a,null!==(n=null===t||void 0===t?void 0:t.minZoom)&&void 0!==n?n:c,null!==(r=null===t||void 0===t?void 0:t.maxZoom)&&void 0!==r?r:u,null!==(i=null===t||void 0===t?void 0:t.padding)&&void 0!==i?i:.1);return await l.setViewport(f,{duration:null===t||void 0===t?void 0:t.duration,ease:null===t||void 0===t?void 0:t.ease,interpolate:null===t||void 0===t?void 0:t.interpolate}),Promise.resolve(!0)}function $p(e){var t,n,r;let{nodeId:i,nextPosition:o,nodeLookup:s,nodeOrigin:a=[0,0],nodeExtent:l,onError:c}=e;const u=s.get(i),d=u.parentId?s.get(u.parentId):void 0,{x:h,y:f}=d?d.internals.positionAbsolute:{x:0,y:0},p=null!==(t=u.origin)&&void 0!==t?t:a;let g=u.extent||l;if("parent"!==u.extent||u.expandParent)d&&pg(u.extent)&&(g=[[u.extent[0][0]+h,u.extent[0][1]+f],[u.extent[1][0]+h,u.extent[1][1]+f]]);else if(d){const e=d.measured.width,t=d.measured.height;e&&t&&(g=[[h,f],[h+e,f+t]])}else null===c||void 0===c||c("005",_p());const v=pg(g)?Yp(o,g,u.measured):o;return void 0!==u.measured.width&&void 0!==u.measured.height||null===c||void 0===c||c("015",Ep()),{position:{x:v.x-h+(null!==(n=u.measured.width)&&void 0!==n?n:0)*p[0],y:v.y-f+(null!==(r=u.measured.height)&&void 0!==r?r:0)*p[1]},positionAbsolute:v}}async function qp(e){let{nodesToRemove:t=[],edgesToRemove:n=[],nodes:r,edges:i,onBeforeDelete:o}=e;const s=new Set(t.map(e=>e.id)),a=[];for(const f of r){if(!1===f.deletable)continue;const e=s.has(f.id),t=!e&&f.parentId&&a.find(e=>e.id===f.parentId);(e||t)&&a.push(f)}const l=new Set(n.map(e=>e.id)),c=i.filter(e=>!1!==e.deletable),u=((e,t)=>{const n=new Set;return e.forEach(e=>{n.add(e.id)}),t.filter(e=>n.has(e.source)||n.has(e.target))})(a,c),d=u;for(const f of c){l.has(f.id)&&!d.find(e=>e.id===f.id)&&d.push(f)}if(!o)return{edges:d,nodes:a};const h=await o({nodes:a,edges:d});return"boolean"===typeof h?h?{edges:d,nodes:a}:{edges:[],nodes:[]}:h}const Kp=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;return Math.min(Math.max(e,t),n)},Yp=function(){var e,t;let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{x:0,y:0},r=arguments.length>1?arguments[1]:void 0,i=arguments.length>2?arguments[2]:void 0;return{x:Kp(n.x,r[0][0],r[1][0]-(null!==(e=null===i||void 0===i?void 0:i.width)&&void 0!==e?e:0)),y:Kp(n.y,r[0][1],r[1][1]-(null!==(t=null===i||void 0===i?void 0:i.height)&&void 0!==t?t:0))}};function Xp(e,t,n){const{width:r,height:i}=gg(n),{x:o,y:s}=n.internals.positionAbsolute;return Yp(e,[[o,s],[o+r,s+i]],t)}const Gp=(e,t,n)=>e<t?Kp(Math.abs(e-t),1,t)/t:e>n?-Kp(Math.abs(e-n),1,t)/t:0,Zp=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:15,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:40;return[Gp(e.x,r,t.width-r)*n,Gp(e.y,r,t.height-r)*n]},Jp=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),Qp=e=>{let{x:t,y:n,width:r,height:i}=e;return{x:t,y:n,x2:t+r,y2:n+i}},eg=e=>{let{x:t,y:n,x2:r,y2:i}=e;return{x:t,y:n,width:r-t,height:i-n}},tg=function(e){var t,n,r,i,o,s,a,l;let c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0];const{x:u,y:d}=zp(e)?e.internals.positionAbsolute:Hp(e,c);return{x:u,y:d,width:null!==(t=null!==(n=null!==(r=null===(i=e.measured)||void 0===i?void 0:i.width)&&void 0!==r?r:e.width)&&void 0!==n?n:e.initialWidth)&&void 0!==t?t:0,height:null!==(o=null!==(s=null!==(a=null===(l=e.measured)||void 0===l?void 0:l.height)&&void 0!==a?a:e.height)&&void 0!==s?s:e.initialHeight)&&void 0!==o?o:0}},ng=function(e){var t,n,r,i,o,s,a,l;let c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0];const{x:u,y:d}=zp(e)?e.internals.positionAbsolute:Hp(e,c);return{x:u,y:d,x2:u+(null!==(t=null!==(n=null!==(r=null===(i=e.measured)||void 0===i?void 0:i.width)&&void 0!==r?r:e.width)&&void 0!==n?n:e.initialWidth)&&void 0!==t?t:0),y2:d+(null!==(o=null!==(s=null!==(a=null===(l=e.measured)||void 0===l?void 0:l.height)&&void 0!==a?a:e.height)&&void 0!==s?s:e.initialHeight)&&void 0!==o?o:0)}},rg=(e,t)=>eg(Jp(Qp(e),Qp(t))),ig=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),r=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*r)},og=e=>sg(e.width)&&sg(e.height)&&sg(e.x)&&sg(e.y),sg=e=>!isNaN(e)&&isFinite(e),ag=(e,t)=>{0},lg=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[1,1];return{x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}},cg=function(e,t){let{x:n,y:r}=e,[i,o,s]=t;const a={x:(n-i)/s,y:(r-o)/s};return arguments.length>2&&void 0!==arguments[2]&&arguments[2]?lg(a,arguments.length>3&&void 0!==arguments[3]?arguments[3]:[1,1]):a},ug=(e,t)=>{let{x:n,y:r}=e,[i,o,s]=t;return{x:n*s+i,y:r*s+o}};function dg(e,t){if("number"===typeof e)return Math.floor(.5*(t-t/(1+e)));if("string"===typeof e&&e.endsWith("px")){const t=parseFloat(e);if(!Number.isNaN(t))return Math.floor(t)}if("string"===typeof e&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error('[React Flow] The padding value "'.concat(e,'" is invalid. Please provide a number or a string with a valid unit (px or %).')),0}const hg=(e,t,n,r,i,o)=>{const s=function(e,t,n){if("string"===typeof e||"number"===typeof e){const r=dg(e,n),i=dg(e,t);return{top:r,right:i,bottom:r,left:i,x:2*i,y:2*r}}if("object"===typeof e){var r,i,o,s,a,l,c,u;const d=dg(null!==(r=null!==(i=e.top)&&void 0!==i?i:e.y)&&void 0!==r?r:0,n),h=dg(null!==(o=null!==(s=e.bottom)&&void 0!==s?s:e.y)&&void 0!==o?o:0,n),f=dg(null!==(a=null!==(l=e.left)&&void 0!==l?l:e.x)&&void 0!==a?a:0,t),p=dg(null!==(c=null!==(u=e.right)&&void 0!==u?u:e.x)&&void 0!==c?c:0,t);return{top:d,right:p,bottom:h,left:f,x:f+p,y:d+h}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}(o,t,n),a=(t-s.x)/e.width,l=(n-s.y)/e.height,c=Math.min(a,l),u=Kp(c,r,i),d=t/2-(e.x+e.width/2)*u,h=n/2-(e.y+e.height/2)*u,f=function(e,t,n,r,i,o){const{x:s,y:a}=ug(e,[t,n,r]),{x:l,y:c}=ug({x:e.x+e.width,y:e.y+e.height},[t,n,r]),u=i-l,d=o-c;return{left:Math.floor(s),top:Math.floor(a),right:Math.floor(u),bottom:Math.floor(d)}}(e,d,h,u,t,n),p=Math.min(f.left-s.left,0),g=Math.min(f.top-s.top,0);return{x:d-p+Math.min(f.right-s.right,0),y:h-g+Math.min(f.bottom-s.bottom,0),zoom:u}},fg=()=>{var e;return"undefined"!==typeof navigator&&(null===(e=navigator)||void 0===e||null===(e=e.userAgent)||void 0===e?void 0:e.indexOf("Mac"))>=0};function pg(e){return void 0!==e&&null!==e&&"parent"!==e}function gg(e){var t,n,r,i,o,s,a,l;return{width:null!==(t=null!==(n=null!==(r=null===(i=e.measured)||void 0===i?void 0:i.width)&&void 0!==r?r:e.width)&&void 0!==n?n:e.initialWidth)&&void 0!==t?t:0,height:null!==(o=null!==(s=null!==(a=null===(l=e.measured)||void 0===l?void 0:l.height)&&void 0!==a?a:e.height)&&void 0!==s?s:e.initialHeight)&&void 0!==o?o:0}}function vg(e){var t,n,r,i,o,s;return void 0!==(null!==(t=null!==(n=null===(r=e.measured)||void 0===r?void 0:r.width)&&void 0!==n?n:e.width)&&void 0!==t?t:e.initialWidth)&&void 0!==(null!==(i=null!==(o=null===(s=e.measured)||void 0===s?void 0:s.height)&&void 0!==o?o:e.height)&&void 0!==i?i:e.initialHeight)}function mg(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{width:0,height:0},n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0,i=arguments.length>4?arguments[4]:void 0;const o=Is({},e),s=r.get(n);if(s){var a,l;const e=s.origin||i;o.x+=s.internals.positionAbsolute.x-(null!==(a=t.width)&&void 0!==a?a:0)*e[0],o.y+=s.internals.positionAbsolute.y-(null!==(l=t.height)&&void 0!==l?l:0)*e[1]}return o}function _g(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function yg(e){return Is(Is({},Lp),e||{})}function bg(e,t){var n,r;let{snapGrid:i=[0,0],snapToGrid:o=!1,transform:s,containerBounds:a}=t;const{x:l,y:c}=Eg(e),u=cg({x:l-(null!==(n=null===a||void 0===a?void 0:a.left)&&void 0!==n?n:0),y:c-(null!==(r=null===a||void 0===a?void 0:a.top)&&void 0!==r?r:0)},s),{x:d,y:h}=o?lg(u,i):u;return Is({xSnapped:d,ySnapped:h},u)}const xg=e=>({width:e.offsetWidth,height:e.offsetHeight}),wg=e=>{var t,n;return(null===e||void 0===e||null===(t=e.getRootNode)||void 0===t?void 0:t.call(e))||(null===(n=window)||void 0===n?void 0:n.document)},Sg=["INPUT","SELECT","TEXTAREA"];function Cg(e){var t;const n=(null===(t=e.composedPath)||void 0===t||null===(t=t.call(e))||void 0===t?void 0:t[0])||e.target;if(1!==(null===n||void 0===n?void 0:n.nodeType))return!1;return Sg.includes(n.nodeName)||n.hasAttribute("contenteditable")||!!n.closest(".nokey")}const kg=e=>"clientX"in e,Eg=(e,t)=>{var n,r,i,o;const s=kg(e),a=s?e.clientX:null===(n=e.touches)||void 0===n?void 0:n[0].clientX,l=s?e.clientY:null===(r=e.touches)||void 0===r?void 0:r[0].clientY;return{x:a-(null!==(i=null===t||void 0===t?void 0:t.left)&&void 0!==i?i:0),y:l-(null!==(o=null===t||void 0===t?void 0:t.top)&&void 0!==o?o:0)}},Rg=(e,t,n,r,i)=>{const o=t.querySelectorAll(".".concat(e));return o&&o.length?Array.from(o).map(t=>{const o=t.getBoundingClientRect();return Is({id:t.getAttribute("data-handleid"),type:e,nodeId:i,position:t.getAttribute("data-handlepos"),x:(o.left-n.left)/r,y:(o.top-n.top)/r},xg(t))}):null};function Mg(e){let{sourceX:t,sourceY:n,targetX:r,targetY:i,sourceControlX:o,sourceControlY:s,targetControlX:a,targetControlY:l}=e;const c=.125*t+.375*o+.375*a+.125*r,u=.125*n+.375*s+.375*l+.125*i;return[c,u,Math.abs(c-t),Math.abs(u-n)]}function Lg(e,t){return e>=0?.5*e:25*t*Math.sqrt(-e)}function Pg(e){let{pos:t,x1:n,y1:r,x2:i,y2:o,c:s}=e;switch(t){case jp.Left:return[n-Lg(n-i,s),r];case jp.Right:return[n+Lg(i-n,s),r];case jp.Top:return[n,r-Lg(r-o,s)];case jp.Bottom:return[n,r+Lg(o-r,s)]}}function Tg(e){let{sourceX:t,sourceY:n,sourcePosition:r=jp.Bottom,targetX:i,targetY:o,targetPosition:s=jp.Top,curvature:a=.25}=e;const[l,c]=Pg({pos:r,x1:t,y1:n,x2:i,y2:o,c:a}),[u,d]=Pg({pos:s,x1:i,y1:o,x2:t,y2:n,c:a}),[h,f,p,g]=Mg({sourceX:t,sourceY:n,targetX:i,targetY:o,sourceControlX:l,sourceControlY:c,targetControlX:u,targetControlY:d});return["M".concat(t,",").concat(n," C").concat(l,",").concat(c," ").concat(u,",").concat(d," ").concat(i,",").concat(o),h,f,p,g]}function Dg(e){let{sourceX:t,sourceY:n,targetX:r,targetY:i}=e;const o=Math.abs(r-t)/2,s=r<t?r+o:r-o,a=Math.abs(i-n)/2;return[s,i<n?i+a:i-a,o,a]}function Og(e){let{sourceNode:t,targetNode:n,width:r,height:i,transform:o}=e;const s=Jp(ng(t),ng(n));s.x===s.x2&&(s.x2+=1),s.y===s.y2&&(s.y2+=1);const a={x:-o[0]/o[2],y:-o[1]/o[2],width:r/o[2],height:i/o[2]};return ig(a,eg(s))>0}const Ig=e=>{let{source:t,sourceHandle:n,target:r,targetHandle:i}=e;return"xy-edge__".concat(t).concat(n||"","-").concat(r).concat(i||"")},Ag=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!e.source||!e.target)return ag(0,yp()),t;const r=n.getEdgeId||Ig;let i;return i=Fp(e)?Is({},e):Is(Is({},e),{},{id:r(e)}),((e,t)=>t.some(t=>t.source===e.source&&t.target===e.target&&(t.sourceHandle===e.sourceHandle||!t.sourceHandle&&!e.sourceHandle)&&(t.targetHandle===e.targetHandle||!t.targetHandle&&!e.targetHandle)))(i,t)?t:(null===i.sourceHandle&&delete i.sourceHandle,null===i.targetHandle&&delete i.targetHandle,t.concat(i))};function jg(e){let{sourceX:t,sourceY:n,targetX:r,targetY:i}=e;const[o,s,a,l]=Dg({sourceX:t,sourceY:n,targetX:r,targetY:i});return["M ".concat(t,",").concat(n,"L ").concat(r,",").concat(i),o,s,a,l]}const Bg={[jp.Left]:{x:-1,y:0},[jp.Right]:{x:1,y:0},[jp.Top]:{x:0,y:-1},[jp.Bottom]:{x:0,y:1}},Ng=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function Fg(e){let{source:t,sourcePosition:n=jp.Bottom,target:r,targetPosition:i=jp.Top,center:o,offset:s,stepPosition:a}=e;const l=Bg[n],c=Bg[i],u={x:t.x+l.x*s,y:t.y+l.y*s},d={x:r.x+c.x*s,y:r.y+c.y*s},h=(e=>{let{source:t,sourcePosition:n=jp.Bottom,target:r}=e;return n===jp.Left||n===jp.Right?t.x<r.x?{x:1,y:0}:{x:-1,y:0}:t.y<r.y?{x:0,y:1}:{x:0,y:-1}})({source:u,sourcePosition:n,target:d}),f=0!==h.x?"x":"y",p=h[f];let g,v,m=[];const _={x:0,y:0},y={x:0,y:0},[,,b,x]=Dg({sourceX:t.x,sourceY:t.y,targetX:r.x,targetY:r.y});if(l[f]*c[f]===-1){var w,S,C,k;if("x"===f)g=null!==(w=o.x)&&void 0!==w?w:u.x+(d.x-u.x)*a,v=null!==(S=o.y)&&void 0!==S?S:(u.y+d.y)/2;else g=null!==(C=o.x)&&void 0!==C?C:(u.x+d.x)/2,v=null!==(k=o.y)&&void 0!==k?k:u.y+(d.y-u.y)*a;const e=[{x:g,y:u.y},{x:g,y:d.y}],t=[{x:u.x,y:v},{x:d.x,y:v}];m=l[f]===p?"x"===f?e:t:"x"===f?t:e}else{const e=[{x:u.x,y:d.y}],o=[{x:d.x,y:u.y}];if(m="x"===f?l.x===p?o:e:l.y===p?e:o,n===i){const e=Math.abs(t[f]-r[f]);if(e<=s){const n=Math.min(s-1,s-e);l[f]===p?_[f]=(u[f]>t[f]?-1:1)*n:y[f]=(d[f]>r[f]?-1:1)*n}}if(n!==i){const t="x"===f?"y":"x",n=l[f]===c[t],r=u[t]>d[t],i=u[t]<d[t];(1===l[f]&&(!n&&r||n&&i)||1!==l[f]&&(!n&&i||n&&r))&&(m="x"===f?e:o)}const a={x:u.x+_.x,y:u.y+_.y},h={x:d.x+y.x,y:d.y+y.y};Math.max(Math.abs(a.x-m[0].x),Math.abs(h.x-m[0].x))>=Math.max(Math.abs(a.y-m[0].y),Math.abs(h.y-m[0].y))?(g=(a.x+h.x)/2,v=m[0].y):(g=m[0].x,v=(a.y+h.y)/2)}return[[t,{x:u.x+_.x,y:u.y+_.y},...m,{x:d.x+y.x,y:d.y+y.y},r],g,v,b,x]}function zg(e){let{sourceX:t,sourceY:n,sourcePosition:r=jp.Bottom,targetX:i,targetY:o,targetPosition:s=jp.Top,borderRadius:a=5,centerX:l,centerY:c,offset:u=20,stepPosition:d=.5}=e;const[h,f,p,g,v]=Fg({source:{x:t,y:n},sourcePosition:r,target:{x:i,y:o},targetPosition:s,center:{x:l,y:c},offset:u,stepPosition:d}),m=h.reduce((e,t,n)=>{let r="";return r=n>0&&n<h.length-1?function(e,t,n,r){const i=Math.min(Ng(e,t)/2,Ng(t,n)/2,r),{x:o,y:s}=t;if(e.x===o&&o===n.x||e.y===s&&s===n.y)return"L".concat(o," ").concat(s);if(e.y===s){const t=e.x<n.x?-1:1,r=e.y<n.y?1:-1;return"L ".concat(o+i*t,",").concat(s,"Q ").concat(o,",").concat(s," ").concat(o,",").concat(s+i*r)}const a=e.x<n.x?1:-1,l=e.y<n.y?-1:1;return"L ".concat(o,",").concat(s+i*l,"Q ").concat(o,",").concat(s," ").concat(o+i*a,",").concat(s)}(h[n-1],t,h[n+1],a):"".concat(0===n?"M":"L").concat(t.x," ").concat(t.y),e+=r},"");return[m,f,p,g,v]}function Hg(e){var t;return e&&!!(e.internals.handleBounds||null!==(t=e.handles)&&void 0!==t&&t.length)&&!!(e.measured.width||e.width||e.initialWidth)}function Wg(e){if(!e)return null;const t=[],n=[];for(const o of e){var r,i;o.width=null!==(r=o.width)&&void 0!==r?r:1,o.height=null!==(i=o.height)&&void 0!==i?i:1,"source"===o.type?t.push(o):"target"===o.type&&n.push(o)}return{source:t,target:n}}function Ug(e,t){var n,r,i;let o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:jp.Left,s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const a=(null!==(n=null===t||void 0===t?void 0:t.x)&&void 0!==n?n:0)+e.internals.positionAbsolute.x,l=(null!==(r=null===t||void 0===t?void 0:t.y)&&void 0!==r?r:0)+e.internals.positionAbsolute.y,{width:c,height:u}=null!==t&&void 0!==t?t:gg(e);if(s)return{x:a+c/2,y:l+u/2};switch(null!==(i=null===t||void 0===t?void 0:t.position)&&void 0!==i?i:o){case jp.Top:return{x:a+c/2,y:l};case jp.Right:return{x:a+c,y:l+u/2};case jp.Bottom:return{x:a+c/2,y:l+u};case jp.Left:return{x:a,y:l+u/2}}}function Vg(e,t){return e&&(t?e.find(e=>e.id===t):e[0])||null}function $g(e,t){if(!e)return"";if("string"===typeof e)return e;const n=t?"".concat(t,"__"):"";return"".concat(n).concat(Object.keys(e).sort().map(t=>"".concat(t,"=").concat(e[t])).join("&"))}const qg={nodeOrigin:[0,0],nodeExtent:Rp,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},Kg=Is(Is({},qg),{},{checkEquality:!0});function Yg(e,t){const n=Is({},e);for(const r in t)void 0!==t[r]&&(n[r]=t[r]);return n}function Xg(e,t){if(!e.handles)return e.measured?null===t||void 0===t?void 0:t.internals.handleBounds:void 0;const n=[],r=[];for(const s of e.handles){var i,o;const t={id:s.id,width:null!==(i=s.width)&&void 0!==i?i:1,height:null!==(o=s.height)&&void 0!==o?o:1,nodeId:e.id,x:s.x,y:s.y,position:s.position,type:s.type};"source"===s.type?n.push(t):"target"===s.type&&r.push(t)}return{source:n,target:r}}function Gg(e){return"manual"===e}function Zg(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const i=Yg(Kg,r),o={i:0},s=new Map(t),a=null!==i&&void 0!==i&&i.elevateNodesOnSelect&&!Gg(i.zIndexMode)?1e3:0;let l=e.length>0;t.clear(),n.clear();for(const h of e){var c;let e=s.get(h.id);if(i.checkEquality&&h===(null===(c=e)||void 0===c?void 0:c.internals.userNode))t.set(h.id,e);else{var u,d;const n=Hp(h,i.nodeOrigin),r=pg(h.extent)?h.extent:i.nodeExtent,o=Yp(n,r,gg(h));e=Is(Is(Is({},i.defaults),h),{},{measured:{width:null===(u=h.measured)||void 0===u?void 0:u.width,height:null===(d=h.measured)||void 0===d?void 0:d.height},internals:{positionAbsolute:o,handleBounds:Xg(h,e),z:Qg(h,a,i.zIndexMode),userNode:h}}),t.set(h.id,e)}void 0!==e.measured&&void 0!==e.measured.width&&void 0!==e.measured.height||e.hidden||(l=!1),h.parentId&&Jg(e,t,n,r,o)}return l}function Jg(e,t,n,r,i){const{elevateNodesOnSelect:o,nodeOrigin:s,nodeExtent:a,zIndexMode:l}=Yg(qg,r),c=e.parentId,u=t.get(c);if(!u)return void console.warn("Parent node ".concat(c," not found. Please make sure that parent nodes are in front of their child nodes in the nodes array."));!function(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}(e,n),i&&!u.parentId&&void 0===u.internals.rootParentIndex&&"auto"===l&&(u.internals.rootParentIndex=++i.i,u.internals.z=u.internals.z+10*i.i),i&&void 0!==u.internals.rootParentIndex&&(i.i=u.internals.rootParentIndex);const d=o&&!Gg(l)?1e3:0,{x:h,y:f,z:p}=function(e,t,n,r,i,o){var s;const{x:a,y:l}=t.internals.positionAbsolute,c=gg(e),u=Hp(e,n),d=pg(e.extent)?Yp(u,e.extent,c):u;let h=Yp({x:a+d.x,y:l+d.y},r,c);"parent"===e.extent&&(h=Xp(h,c,t));const f=Qg(e,i,o),p=null!==(s=t.internals.z)&&void 0!==s?s:0;return{x:h.x,y:h.y,z:p>=f?p+1:f}}(e,u,s,a,d,l),{positionAbsolute:g}=e.internals,v=h!==g.x||f!==g.y;(v||p!==e.internals.z)&&t.set(e.id,Is(Is({},e),{},{internals:Is(Is({},e.internals),{},{positionAbsolute:v?{x:h,y:f}:g,z:p})}))}function Qg(e,t,n){const r=sg(e.zIndex)?e.zIndex:0;return Gg(n)?r:r+(e.selected?t:0)}function ev(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[0,0];const i=[],o=new Map;for(const l of e){var s,a;const e=t.get(l.parentId);if(!e)continue;const n=null!==(s=null===(a=o.get(l.parentId))||void 0===a?void 0:a.expandedRect)&&void 0!==s?s:tg(e),r=rg(n,l.rect);o.set(l.parentId,{expandedRect:r,parent:e})}return o.size>0&&o.forEach((t,o)=>{var s;let{expandedRect:a,parent:l}=t;const c=l.internals.positionAbsolute,u=gg(l),d=null!==(s=l.origin)&&void 0!==s?s:r,h=a.x<c.x?Math.round(Math.abs(c.x-a.x)):0,f=a.y<c.y?Math.round(Math.abs(c.y-a.y)):0,p=Math.max(u.width,Math.round(a.width)),g=Math.max(u.height,Math.round(a.height)),v=(p-u.width)*d[0],m=(g-u.height)*d[1];var _;(h>0||f>0||v||m)&&(i.push({id:o,type:"position",position:{x:l.position.x-h+v,y:l.position.y-f+m}}),null===(_=n.get(o))||void 0===_||_.forEach(t=>{e.some(e=>e.id===t.id)||i.push({id:t.id,type:"position",position:{x:t.position.x+h,y:t.position.y+f}})}));(u.width<a.width||u.height<a.height||h||f)&&i.push({id:o,type:"dimensions",setAttributes:!0,dimensions:{width:p+(h?d[0]*h-v:0),height:g+(f?d[1]*f-m:0)}})}),i}function tv(e,t,n,r,i,o){let s=i;const a=r.get(s)||new Map;r.set(s,a.set(n,t)),s="".concat(i,"-").concat(e);const l=r.get(s)||new Map;if(r.set(s,l.set(n,t)),o){s="".concat(i,"-").concat(e,"-").concat(o);const a=r.get(s)||new Map;r.set(s,a.set(n,t))}}function nv(e,t,n){e.clear(),t.clear();for(const r of n){const{source:n,target:i,sourceHandle:o=null,targetHandle:s=null}=r,a={edgeId:r.id,source:n,target:i,sourceHandle:o,targetHandle:s},l="".concat(n,"-").concat(o,"--").concat(i,"-").concat(s);tv("source",a,"".concat(i,"-").concat(s,"--").concat(n,"-").concat(o),e,n,o),tv("target",a,l,e,i,s),t.set(r.id,r)}}function rv(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return!!n&&(!!n.selected||rv(n,t))}function iv(e,t,n){let r=e;do{var i,o,s;if(null!==(i=r)&&void 0!==i&&null!==(o=i.matches)&&void 0!==o&&o.call(i,t))return!0;if(r===n)return!1;r=null===(s=r)||void 0===s?void 0:s.parentElement}while(r);return!1}function ov(e){var t,n;let{nodeId:r,dragItems:i,nodeLookup:o,dragging:s=!0}=e;const a=[];for(const[u,d]of i){var l;const e=null===(l=o.get(u))||void 0===l?void 0:l.internals.userNode;e&&a.push(Is(Is({},e),{},{position:d.position,dragging:s}))}if(!r)return[a[0],a];const c=null===(t=o.get(r))||void 0===t?void 0:t.internals.userNode;return[c?Is(Is({},c),{},{position:(null===(n=i.get(r))||void 0===n?void 0:n.position)||c.position,dragging:s}):a[0],a]}function sv(e){let{onNodeMouseDown:t,getStoreItems:n,onDragStart:r,onDrag:i,onDragStop:o}=e,s={x:null,y:null},a=0,l=new Map,c=!1,u={x:0,y:0},d=null,h=!1,f=null,p=!1,g=!1,v=null;return{update:function(e){let{noDragClassName:m,handleSelector:_,domNode:y,isSelectable:b,nodeId:x,nodeClickDistance:w=0}=e;function S(e){let{x:t,y:r}=e;const{nodeLookup:o,nodeExtent:a,snapGrid:c,snapToGrid:u,nodeOrigin:d,onNodeDrag:h,onSelectionDrag:f,onError:p,updateNodePositions:m}=n();s={x:t,y:r};let _=!1;const y=l.size>1,b=y&&a?Qp(Wp(l)):null,w=y&&u?function(e){let{dragItems:t,snapGrid:n,x:r,y:i}=e;const o=t.values().next().value;if(!o)return null;const s={x:r-o.distance.x,y:i-o.distance.y},a=lg(s,n);return{x:a.x-s.x,y:a.y-s.y}}({dragItems:l,snapGrid:c,x:t,y:r}):null;for(const[n,i]of l){if(!o.has(n))continue;let e={x:t-i.distance.x,y:r-i.distance.y};u&&(e=w?{x:Math.round(e.x+w.x),y:Math.round(e.y+w.y)}:lg(e,c));let s=null;if(y&&a&&!i.extent&&b){const{positionAbsolute:e}=i.internals,t=e.x-b.x+a[0][0],n=e.x+i.measured.width-b.x2+a[1][0];s=[[t,e.y-b.y+a[0][1]],[n,e.y+i.measured.height-b.y2+a[1][1]]]}const{position:l,positionAbsolute:h}=$p({nodeId:n,nextPosition:e,nodeLookup:o,nodeExtent:s||a,nodeOrigin:d,onError:p});_=_||i.position.x!==l.x||i.position.y!==l.y,i.position=l,i.internals.positionAbsolute=h}if(g=g||_,_&&(m(l,!0),v&&(i||h||!x&&f))){const[e,t]=ov({nodeId:x,dragItems:l,nodeLookup:o});null===i||void 0===i||i(v,l,e,t),null===h||void 0===h||h(v,e,t),x||null===f||void 0===f||f(v,t)}}async function C(){if(!d)return;const{transform:e,panBy:t,autoPanSpeed:r,autoPanOnNodeDrag:i}=n();if(!i)return c=!1,void cancelAnimationFrame(a);const[o,l]=Zp(u,d,r);var h,f;0===o&&0===l||(s.x=(null!==(h=s.x)&&void 0!==h?h:0)-o/e[2],s.y=(null!==(f=s.y)&&void 0!==f?f:0)-l/e[2],await t({x:o,y:l})&&S(s));a=requestAnimationFrame(C)}function k(e){const{nodeLookup:i,multiSelectionActive:o,nodesDraggable:a,transform:c,snapGrid:u,snapToGrid:f,selectNodesOnDrag:p,onNodeDragStart:g,onSelectionDragStart:v,unselectNodesAndEdges:m}=n();var _;(h=!0,p&&b||o||!x)||(null!==(_=i.get(x))&&void 0!==_&&_.selected||m());b&&p&&x&&(null===t||void 0===t||t(x));const y=bg(e.sourceEvent,{transform:c,snapGrid:u,snapToGrid:f,containerBounds:d});if(s=y,l=function(e,t,n,r){const i=new Map;for(const[a,l]of e)if((l.selected||l.id===r)&&(!l.parentId||!rv(l,e))&&(l.draggable||t&&"undefined"===typeof l.draggable)){const t=e.get(a);var o,s;t&&i.set(a,{id:a,position:t.position||{x:0,y:0},distance:{x:n.x-t.internals.positionAbsolute.x,y:n.y-t.internals.positionAbsolute.y},extent:t.extent,parentId:t.parentId,origin:t.origin,expandParent:t.expandParent,internals:{positionAbsolute:t.internals.positionAbsolute||{x:0,y:0}},measured:{width:null!==(o=t.measured.width)&&void 0!==o?o:0,height:null!==(s=t.measured.height)&&void 0!==s?s:0}})}return i}(i,a,y,x),l.size>0&&(r||g||!x&&v)){const[t,n]=ov({nodeId:x,dragItems:l,nodeLookup:i});null===r||void 0===r||r(e.sourceEvent,l,t,n),null===g||void 0===g||g(e.sourceEvent,t,n),x||null===v||void 0===v||v(e.sourceEvent,n)}}f=Nd(y);const E=Jd().clickDistance(w).on("start",e=>{const{domNode:t,nodeDragThreshold:r,transform:i,snapGrid:o,snapToGrid:a}=n();d=(null===t||void 0===t?void 0:t.getBoundingClientRect())||null,p=!1,g=!1,v=e.sourceEvent,0===r&&k(e);const l=bg(e.sourceEvent,{transform:i,snapGrid:o,snapToGrid:a,containerBounds:d});s=l,u=Eg(e.sourceEvent,d)}).on("drag",e=>{const{autoPanOnNodeDrag:t,transform:r,snapGrid:i,snapToGrid:o,nodeDragThreshold:a,nodeLookup:f}=n(),g=bg(e.sourceEvent,{transform:r,snapGrid:i,snapToGrid:o,containerBounds:d});if(v=e.sourceEvent,("touchmove"===e.sourceEvent.type&&e.sourceEvent.touches.length>1||x&&!f.has(x))&&(p=!0),!p){if(!c&&t&&h&&(c=!0,C()),!h){const t=Eg(e.sourceEvent,d),n=t.x-u.x,r=t.y-u.y;Math.sqrt(n*n+r*r)>a&&k(e)}(s.x!==g.xSnapped||s.y!==g.ySnapped)&&l&&h&&(u=Eg(e.sourceEvent,d),S(g))}}).on("end",e=>{if(h&&!p&&(c=!1,h=!1,cancelAnimationFrame(a),l.size>0)){const{nodeLookup:t,updateNodePositions:r,onNodeDragStop:i,onSelectionDragStop:s}=n();if(g&&(r(l,!1),g=!1),o||i||!x&&s){const[n,r]=ov({nodeId:x,dragItems:l,nodeLookup:t,dragging:!1});null===o||void 0===o||o(e.sourceEvent,l,n,r),null===i||void 0===i||i(e.sourceEvent,n,r),x||null===s||void 0===s||s(e.sourceEvent,r)}}}).filter(e=>{const t=e.target;return!e.button&&(!m||!iv(t,".".concat(m),y))&&(!_||iv(t,_,y))});f.call(E)},destroy:function(){var e;null===(e=f)||void 0===e||e.on(".drag",null)}}}function av(e,t,n,r){let i=[],o=1/0;const s=function(e,t,n){const r=[],i={x:e.x-n,y:e.y-n,width:2*n,height:2*n};for(const o of t.values())ig(i,tg(o))>0&&r.push(o);return r}(e,n,t+250);for(const h of s){var a,l,c,u;const n=[...null!==(a=null===(l=h.internals.handleBounds)||void 0===l?void 0:l.source)&&void 0!==a?a:[],...null!==(c=null===(u=h.internals.handleBounds)||void 0===u?void 0:u.target)&&void 0!==c?c:[]];for(const s of n){if(r.nodeId===s.nodeId&&r.type===s.type&&r.id===s.id)continue;const{x:n,y:a}=Ug(h,s,s.position,!0),l=Math.sqrt(Math.pow(n-e.x,2)+Math.pow(a-e.y,2));l>t||(l<o?(i=[Is(Is({},s),{},{x:n,y:a})],o=l):l===o&&i.push(Is(Is({},s),{},{x:n,y:a})))}}if(!i.length)return null;if(i.length>1){var d;const e="source"===r.type?"target":"source";return null!==(d=i.find(t=>t.type===e))&&void 0!==d?d:i[0]}return i[0]}function lv(e,t,n,r,i){var o,s,a,l,c,u;let d=arguments.length>5&&void 0!==arguments[5]&&arguments[5];const h=r.get(e);if(!h)return null;const f="strict"===i?null===(o=h.internals.handleBounds)||void 0===o?void 0:o[t]:[...null!==(s=null===(a=h.internals.handleBounds)||void 0===a?void 0:a.source)&&void 0!==s?s:[],...null!==(l=null===(c=h.internals.handleBounds)||void 0===c?void 0:c.target)&&void 0!==l?l:[]],p=null!==(u=n?null===f||void 0===f?void 0:f.find(e=>e.id===n):null===f||void 0===f?void 0:f[0])&&void 0!==u?u:null;return p&&d?Is(Is({},p),Ug(h,p,p.position,!0)):p}function cv(e,t){return e||(null!==t&&void 0!==t&&t.classList.contains("target")?"target":null!==t&&void 0!==t&&t.classList.contains("source")?"source":null)}const uv=()=>!0;function dv(e,t){let{handle:n,connectionMode:r,fromNodeId:i,fromHandleId:o,fromType:s,doc:a,lib:l,flowId:c,isValidConnection:u=uv,nodeLookup:d}=t;const h="target"===s,f=n?a.querySelector(".".concat(l,'-flow__handle[data-id="').concat(c,"-").concat(null===n||void 0===n?void 0:n.nodeId,"-").concat(null===n||void 0===n?void 0:n.id,"-").concat(null===n||void 0===n?void 0:n.type,'"]')):null,{x:p,y:g}=Eg(e),v=a.elementFromPoint(p,g),m=null!==v&&void 0!==v&&v.classList.contains("".concat(l,"-flow__handle"))?v:f,_={handleDomNode:m,isValid:!1,connection:null,toHandle:null};if(m){const e=cv(void 0,m),t=m.getAttribute("data-nodeid"),n=m.getAttribute("data-handleid"),s=m.classList.contains("connectable"),a=m.classList.contains("connectableend");if(!t||!e)return _;const l={source:h?t:i,sourceHandle:h?n:o,target:h?i:t,targetHandle:h?o:n};_.connection=l;const c=s&&a&&(r===Pp.Strict?h&&"source"===e||!h&&"target"===e:t!==i||n!==o);_.isValid=c&&u(l),_.toHandle=lv(t,e,n,d,r,!0)}return _}const hv={onPointerDown:function(e,t){let{connectionMode:n,connectionRadius:r,handleId:i,nodeId:o,edgeUpdaterType:s,isTarget:a,domNode:l,nodeLookup:c,lib:u,autoPanOnConnect:d,flowId:h,panBy:f,cancelConnection:p,onConnectStart:g,onConnect:v,onConnectEnd:m,isValidConnection:_=uv,onReconnectEnd:y,updateConnection:b,getTransform:x,getFromHandle:w,autoPanSpeed:S,dragThreshold:C=1,handleDomNode:k}=t;const E=wg(e.target);let R,M=0;const{x:L,y:P}=Eg(e),T=cv(s,k),D=null===l||void 0===l?void 0:l.getBoundingClientRect();let O=!1;if(!D||!T)return;const I=lv(o,T,i,c,n);if(!I)return;let A=Eg(e,D),j=!1,B=null,N=!1,F=null;function z(){if(!d||!D)return;const[e,t]=Zp(A,D,S);f({x:e,y:t}),M=requestAnimationFrame(z)}const H=Is(Is({},I),{},{nodeId:o,type:T,position:I.position}),W=c.get(o);let U={inProgress:!0,isValid:null,from:Ug(W,H,jp.Left,!0),fromHandle:H,fromPosition:H.position,fromNode:W,to:A,toHandle:null,toPosition:Bp[H.position],toNode:null,pointer:A};function V(){O=!0,b(U),null===g||void 0===g||g(e,{nodeId:o,handleId:i,handleType:T})}function $(e){if(!O){const{x:t,y:n}=Eg(e),r=t-L,i=n-P;if(!(r*r+i*i>C*C))return;V()}if(!w()||!H)return void q(e);const t=x();A=Eg(e,D),R=av(cg(A,t,!1,[1,1]),r,c,H),j||(z(),j=!0);const s=dv(e,{handle:R,connectionMode:n,fromNodeId:o,fromHandleId:i,fromType:a?"target":"source",isValidConnection:_,doc:E,lib:u,flowId:h,nodeLookup:c});F=s.handleDomNode,B=s.connection,N=function(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}(!!R,s.isValid);const l=c.get(o),d=l?Ug(l,H,jp.Left,!0):U.from,f=Is(Is({},U),{},{from:d,isValid:N,to:s.toHandle&&N?ug({x:s.toHandle.x,y:s.toHandle.y},t):A,toHandle:s.toHandle,toPosition:N&&s.toHandle?s.toHandle.position:Bp[H.position],toNode:s.toHandle?c.get(s.toHandle.nodeId):null,pointer:A});b(f),U=f}function q(e){if(!("touches"in e&&e.touches.length>0)){if(O){(R||F)&&B&&N&&(null===v||void 0===v||v(B));const{inProgress:t}=U,n=Is(Is({},Ls(U,pp)),{},{toPosition:U.toHandle?U.toPosition:null});null===m||void 0===m||m(e,n),s&&(null===y||void 0===y||y(e,n))}p(),cancelAnimationFrame(M),j=!1,N=!1,B=null,F=null,E.removeEventListener("mousemove",$),E.removeEventListener("mouseup",q),E.removeEventListener("touchmove",$),E.removeEventListener("touchend",q)}}0===C&&V(),E.addEventListener("mousemove",$),E.addEventListener("mouseup",q),E.addEventListener("touchmove",$),E.addEventListener("touchend",q)},isValid:dv};const fv=e=>({x:e.x,y:e.y,zoom:e.k}),pv=e=>{let{x:t,y:n,zoom:r}=e;return Jf.translate(t,n).scale(r)},gv=(e,t)=>e.target.closest(".".concat(t)),vv=(e,t)=>2===t&&Array.isArray(e)&&e.includes(2),mv=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,_v=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:mv,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:()=>{};const i="number"===typeof t&&t>0;return i||r(),i?e.transition().duration(t).ease(n).on("end",r):e},yv=e=>{const t=e.ctrlKey&&fg()?10:1;return-e.deltaY*(1===e.deltaMode?.05:e.deltaMode?1:.002)*t};function bv(e){let{domNode:t,minZoom:n,maxZoom:r,translateExtent:i,viewport:o,onPanZoom:s,onPanZoomStart:a,onPanZoomEnd:l,onDraggingChange:c}=e;const u={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{x:0,y:0,zoom:0},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},d=t.getBoundingClientRect(),h=lp().scaleExtent([n,r]).translateExtent(i),f=Nd(t).call(h);_({x:o.x,y:o.y,zoom:Kp(o.zoom,n,r)},[[0,0],[d.width,d.height]],i);const p=f.on("wheel.zoom"),g=f.on("dblclick.zoom");function v(e,t){return f?new Promise(n=>{null===h||void 0===h||h.interpolate("linear"===(null===t||void 0===t?void 0:t.interpolate)?fp:eh).transform(_v(f,null===t||void 0===t?void 0:t.duration,null===t||void 0===t?void 0:t.ease,()=>n(!0)),e)}):Promise.resolve(!1)}function m(){h.on("zoom",null)}async function _(e,t,n){const r=pv(e),i=null===h||void 0===h?void 0:h.constrain()(r,t,n);return i&&await v(i),new Promise(e=>e(i))}return h.wheelDelta(yv),{update:function(e){let{noWheelClassName:t,noPanClassName:n,onPaneContextMenu:r,userSelectionActive:i,panOnScroll:o,panOnDrag:d,panOnScrollMode:v,panOnScrollSpeed:_,preventScrolling:y,zoomOnPinch:b,zoomOnScroll:x,zoomOnDoubleClick:w,zoomActivationKeyPressed:S,lib:C,onTransformChange:k,connectionInProgress:E,paneClickDistance:R,selectionOnDrag:M}=e;i&&!u.isZoomingOrPanning&&m();const L=o&&!S&&!i;h.clickDistance(M?1/0:!sg(R)||R<0?0:R);const P=L?function(e){let{zoomPanValues:t,noWheelClassName:n,d3Selection:r,d3Zoom:i,panOnScrollMode:o,panOnScrollSpeed:s,zoomOnPinch:a,onPanZoomStart:l,onPanZoom:c,onPanZoomEnd:u}=e;return e=>{if(gv(e,n))return e.ctrlKey&&e.preventDefault(),!1;e.preventDefault(),e.stopImmediatePropagation();const d=r.property("__zoom").k||1;if(e.ctrlKey&&a){const t=Fd(e),n=yv(e),o=d*Math.pow(2,n);return void i.scaleTo(r,o,t,e)}const h=1===e.deltaMode?20:1;let f=o===Tp.Vertical?0:e.deltaX*h,p=o===Tp.Horizontal?0:e.deltaY*h;!fg()&&e.shiftKey&&o!==Tp.Vertical&&(f=e.deltaY*h,p=0),i.translateBy(r,-f/d*s,-p/d*s,{internal:!0});const g=fv(r.property("__zoom"));clearTimeout(t.panScrollTimeout),t.isPanScrolling?(null===c||void 0===c||c(e,g),t.panScrollTimeout=setTimeout(()=>{null===u||void 0===u||u(e,g),t.isPanScrolling=!1},150)):(t.isPanScrolling=!0,null===l||void 0===l||l(e,g))}}({zoomPanValues:u,noWheelClassName:t,d3Selection:f,d3Zoom:h,panOnScrollMode:v,panOnScrollSpeed:_,zoomOnPinch:b,onPanZoomStart:a,onPanZoom:s,onPanZoomEnd:l}):function(e){let{noWheelClassName:t,preventScrolling:n,d3ZoomHandler:r}=e;return function(e,i){const o="wheel"===e.type,s=!n&&o&&!e.ctrlKey,a=gv(e,t);if(e.ctrlKey&&o&&a&&e.preventDefault(),s||a)return null;e.preventDefault(),r.call(this,e,i)}}({noWheelClassName:t,preventScrolling:y,d3ZoomHandler:p});if(f.on("wheel.zoom",P,{passive:!1}),!i){const e=function(e){let{zoomPanValues:t,onDraggingChange:n,onPanZoomStart:r}=e;return e=>{var i,o,s;if(null!==(i=e.sourceEvent)&&void 0!==i&&i.internal)return;const a=fv(e.transform);t.mouseButton=(null===(o=e.sourceEvent)||void 0===o?void 0:o.button)||0,t.isZoomingOrPanning=!0,t.prevViewport=a,"mousedown"===(null===(s=e.sourceEvent)||void 0===s?void 0:s.type)&&n(!0),r&&(null===r||void 0===r||r(e.sourceEvent,a))}}({zoomPanValues:u,onDraggingChange:c,onPanZoomStart:a});h.on("start",e);const t=function(e){let{zoomPanValues:t,panOnDrag:n,onPaneContextMenu:r,onTransformChange:i,onPanZoom:o}=e;return e=>{var s,a,l;t.usedRightMouseButton=!(!r||!vv(n,null!==(s=t.mouseButton)&&void 0!==s?s:0)),null!==(a=e.sourceEvent)&&void 0!==a&&a.sync||i([e.transform.x,e.transform.y,e.transform.k]),!o||null!==(l=e.sourceEvent)&&void 0!==l&&l.internal||null===o||void 0===o||o(e.sourceEvent,fv(e.transform))}}({zoomPanValues:u,panOnDrag:d,onPaneContextMenu:!!r,onPanZoom:s,onTransformChange:k});h.on("zoom",t);const n=function(e){let{zoomPanValues:t,panOnDrag:n,panOnScroll:r,onDraggingChange:i,onPanZoomEnd:o,onPaneContextMenu:s}=e;return e=>{var a,l;if((null===(a=e.sourceEvent)||void 0===a||!a.internal)&&(t.isZoomingOrPanning=!1,s&&vv(n,null!==(l=t.mouseButton)&&void 0!==l?l:0)&&!t.usedRightMouseButton&&e.sourceEvent&&s(e.sourceEvent),t.usedRightMouseButton=!1,i(!1),o)){const n=fv(e.transform);t.prevViewport=n,clearTimeout(t.timerId),t.timerId=setTimeout(()=>{null===o||void 0===o||o(e.sourceEvent,n)},r?150:0)}}}({zoomPanValues:u,panOnDrag:d,panOnScroll:o,onPaneContextMenu:r,onPanZoomEnd:l,onDraggingChange:c});h.on("end",n)}const T=function(e){let{zoomActivationKeyPressed:t,zoomOnScroll:n,zoomOnPinch:r,panOnDrag:i,panOnScroll:o,zoomOnDoubleClick:s,userSelectionActive:a,noWheelClassName:l,noPanClassName:c,lib:u,connectionInProgress:d}=e;return e=>{var h;const f=t||n,p=r&&e.ctrlKey,g="wheel"===e.type;if(1===e.button&&"mousedown"===e.type&&(gv(e,"".concat(u,"-flow__node"))||gv(e,"".concat(u,"-flow__edge"))))return!0;if(!i&&!f&&!o&&!s&&!r)return!1;if(a)return!1;if(d&&!g)return!1;if(gv(e,l)&&g)return!1;if(gv(e,c)&&(!g||o&&g&&!t))return!1;if(!r&&e.ctrlKey&&g)return!1;if(!r&&"touchstart"===e.type&&(null===(h=e.touches)||void 0===h?void 0:h.length)>1)return e.preventDefault(),!1;if(!f&&!o&&!p&&g)return!1;if(!i&&("mousedown"===e.type||"touchstart"===e.type))return!1;if(Array.isArray(i)&&!i.includes(e.button)&&"mousedown"===e.type)return!1;const v=Array.isArray(i)&&i.includes(e.button)||!e.button||e.button<=1;return(!e.ctrlKey||g)&&v}}({zoomActivationKeyPressed:S,panOnDrag:d,zoomOnScroll:x,panOnScroll:o,zoomOnDoubleClick:w,zoomOnPinch:b,userSelectionActive:i,noPanClassName:n,noWheelClassName:t,lib:C,connectionInProgress:E});h.filter(T),w?f.on("dblclick.zoom",g):f.on("dblclick.zoom",null)},destroy:m,setViewport:async function(e,t){const n=pv(e);return await v(n,t),new Promise(e=>e(n))},setViewportConstrained:_,getViewport:function(){const e=f?Qf(f.node()):{x:0,y:0,k:1};return{x:e.x,y:e.y,zoom:e.k}},scaleTo:function(e,t){return f?new Promise(n=>{null===h||void 0===h||h.interpolate("linear"===(null===t||void 0===t?void 0:t.interpolate)?fp:eh).scaleTo(_v(f,null===t||void 0===t?void 0:t.duration,null===t||void 0===t?void 0:t.ease,()=>n(!0)),e)}):Promise.resolve(!1)},scaleBy:function(e,t){return f?new Promise(n=>{null===h||void 0===h||h.interpolate("linear"===(null===t||void 0===t?void 0:t.interpolate)?fp:eh).scaleBy(_v(f,null===t||void 0===t?void 0:t.duration,null===t||void 0===t?void 0:t.ease,()=>n(!0)),e)}):Promise.resolve(!1)},setScaleExtent:function(e){null===h||void 0===h||h.scaleExtent(e)},setTranslateExtent:function(e){null===h||void 0===h||h.translateExtent(e)},syncViewport:function(e){if(f){const t=pv(e),n=f.property("__zoom");n.k===e.zoom&&n.x===e.x&&n.y===e.y||null===h||void 0===h||h.transform(f,t,null,{sync:!0})}},setClickDistance:function(e){const t=!sg(e)||e<0?0:e;null===h||void 0===h||h.clickDistance(t)}}}var xv;!function(e){e.Line="line",e.Handle="handle"}(xv||(xv={}));function wv(e){return{isHorizontal:e.includes("right")||e.includes("left"),isVertical:e.includes("bottom")||e.includes("top"),affectsX:e.includes("left"),affectsY:e.includes("top")}}function Sv(e,t){return Math.max(0,t-e)}function Cv(e,t){return Math.max(0,e-t)}function kv(e,t,n){return Math.max(0,t-e,e-n)}function Ev(e,t){return e?!t:t}const Rv={width:0,height:0,x:0,y:0},Mv=Is(Is({},Rv),{},{pointerX:0,pointerY:0,aspectRatio:1});function Lv(e,t,n){var r,i;const o=t.position.x+e.position.x,s=t.position.y+e.position.y,a=null!==(r=e.measured.width)&&void 0!==r?r:0,l=null!==(i=e.measured.height)&&void 0!==i?i:0,c=n[0]*a,u=n[1]*l;return[[o-c,s-u],[o+a-c,s+l-u]]}function Pv(e){let{domNode:t,nodeId:n,getStoreItems:r,onChange:i,onEnd:o}=e;const s=Nd(t);let a={controlDirection:wv("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};return{update:function(e){let t,{controlPosition:l,boundaries:c,keepAspectRatio:u,resizeDirection:d,onResizeStart:h,onResize:f,onResizeEnd:p,shouldResize:g}=e,v=Is({},Rv),m=Is({},Mv);a={boundaries:c,resizeDirection:d,keepAspectRatio:u,controlDirection:wv(l)};let _,y,b,x=null,w=[],S=!1;const C=Jd().on("start",e=>{var i,o,s,a,l;const{nodeLookup:c,transform:u,snapGrid:d,snapToGrid:f,nodeOrigin:p,paneDomNode:g}=r();if(t=c.get(n),!t)return;x=null!==(i=null===g||void 0===g?void 0:g.getBoundingClientRect())&&void 0!==i?i:null;const{xSnapped:S,ySnapped:C}=bg(e.sourceEvent,{transform:u,snapGrid:d,snapToGrid:f,containerBounds:x});v={width:null!==(o=t.measured.width)&&void 0!==o?o:0,height:null!==(s=t.measured.height)&&void 0!==s?s:0,x:null!==(a=t.position.x)&&void 0!==a?a:0,y:null!==(l=t.position.y)&&void 0!==l?l:0},m=Is(Is({},v),{},{pointerX:S,pointerY:C,aspectRatio:v.width/v.height}),_=void 0,t.parentId&&("parent"===t.extent||t.expandParent)&&(_=c.get(t.parentId),y=_&&"parent"===t.extent?function(e){return[[0,0],[e.measured.width,e.measured.height]]}(_):void 0),w=[],b=void 0;for(const[r,h]of c)if(h.parentId===n&&(w.push({id:r,position:Is({},h.position),extent:h.extent}),"parent"===h.extent||h.expandParent)){var k;const e=Lv(h,t,null!==(k=h.origin)&&void 0!==k?k:p);b=b?[[Math.min(e[0][0],b[0][0]),Math.min(e[0][1],b[0][1])],[Math.max(e[1][0],b[1][0]),Math.max(e[1][1],b[1][1])]]:e}null===h||void 0===h||h(e,Is({},v))}).on("drag",e=>{var n;const{transform:o,snapGrid:s,snapToGrid:l,nodeOrigin:c}=r(),u=bg(e.sourceEvent,{transform:o,snapGrid:s,snapToGrid:l,containerBounds:x}),d=[];if(!t)return;const{x:h,y:p,width:C,height:k}=v,E={},R=null!==(n=t.origin)&&void 0!==n?n:c,{width:M,height:L,x:P,y:T}=function(e,t,n,r,i,o,s,a){let{affectsX:l,affectsY:c}=t;const{isHorizontal:u,isVertical:d}=t,h=u&&d,{xSnapped:f,ySnapped:p}=n,{minWidth:g,maxWidth:v,minHeight:m,maxHeight:_}=r,{x:y,y:b,width:x,height:w,aspectRatio:S}=e;let C=Math.floor(u?f-e.pointerX:0),k=Math.floor(d?p-e.pointerY:0);const E=x+(l?-C:C),R=w+(c?-k:k),M=-o[0]*x,L=-o[1]*w;let P=kv(E,g,v),T=kv(R,m,_);if(s){let e=0,t=0;l&&C<0?e=Sv(y+C+M,s[0][0]):!l&&C>0&&(e=Cv(y+E+M,s[1][0])),c&&k<0?t=Sv(b+k+L,s[0][1]):!c&&k>0&&(t=Cv(b+R+L,s[1][1])),P=Math.max(P,e),T=Math.max(T,t)}if(a){let e=0,t=0;l&&C>0?e=Cv(y+C,a[0][0]):!l&&C<0&&(e=Sv(y+E,a[1][0])),c&&k>0?t=Cv(b+k,a[0][1]):!c&&k<0&&(t=Sv(b+R,a[1][1])),P=Math.max(P,e),T=Math.max(T,t)}if(i){if(u){const e=kv(E/S,m,_)*S;if(P=Math.max(P,e),s){let e=0;e=!l&&!c||l&&!c&&h?Cv(b+L+E/S,s[1][1])*S:Sv(b+L+(l?C:-C)/S,s[0][1])*S,P=Math.max(P,e)}if(a){let e=0;e=!l&&!c||l&&!c&&h?Sv(b+E/S,a[1][1])*S:Cv(b+(l?C:-C)/S,a[0][1])*S,P=Math.max(P,e)}}if(d){const e=kv(R*S,g,v)/S;if(T=Math.max(T,e),s){let e=0;e=!l&&!c||c&&!l&&h?Cv(y+R*S+M,s[1][0])/S:Sv(y+(c?k:-k)*S+M,s[0][0])/S,T=Math.max(T,e)}if(a){let e=0;e=!l&&!c||c&&!l&&h?Sv(y+R*S,a[1][0])/S:Cv(y+(c?k:-k)*S,a[0][0])/S,T=Math.max(T,e)}}}k+=k<0?T:-T,C+=C<0?P:-P,i&&(h?E>R*S?k=(Ev(l,c)?-C:C)/S:C=(Ev(l,c)?-k:k)*S:u?(k=C/S,c=l):(C=k*S,l=c));const D=l?y+C:y,O=c?b+k:b;return{width:x+(l?-C:C),height:w+(c?-k:k),x:o[0]*C*(l?-1:1)+D,y:o[1]*k*(c?-1:1)+O}}(m,a.controlDirection,u,a.boundaries,a.keepAspectRatio,R,y,b),D=M!==C,O=L!==k,I=P!==h&&D,A=T!==p&&O;if(!I&&!A&&!D&&!O)return;if((I||A||1===R[0]||1===R[1])&&(E.x=I?P:v.x,E.y=A?T:v.y,v.x=E.x,v.y=E.y,w.length>0)){const e=P-h,t=T-p;for(const n of w)n.position={x:n.position.x-e+R[0]*(M-C),y:n.position.y-t+R[1]*(L-k)},d.push(n)}if((D||O)&&(E.width=!D||a.resizeDirection&&"horizontal"!==a.resizeDirection?v.width:M,E.height=!O||a.resizeDirection&&"vertical"!==a.resizeDirection?v.height:L,v.width=E.width,v.height=E.height),_&&t.expandParent){var j,B;const e=R[0]*(null!==(j=E.width)&&void 0!==j?j:0);E.x&&E.x<e&&(v.x=e,m.x=m.x-(E.x-e));const t=R[1]*(null!==(B=E.height)&&void 0!==B?B:0);E.y&&E.y<t&&(v.y=t,m.y=m.y-(E.y-t))}const N=function(e){let{width:t,prevWidth:n,height:r,prevHeight:i,affectsX:o,affectsY:s}=e;const a=t-n,l=r-i,c=[a>0?1:a<0?-1:0,l>0?1:l<0?-1:0];return a&&o&&(c[0]=-1*c[0]),l&&s&&(c[1]=-1*c[1]),c}({width:v.width,prevWidth:C,height:v.height,prevHeight:k,affectsX:a.controlDirection.affectsX,affectsY:a.controlDirection.affectsY}),F=Is(Is({},v),{},{direction:N});!1!==(null===g||void 0===g?void 0:g(e,F))&&(S=!0,null===f||void 0===f||f(e,F),i(E,d))}).on("end",e=>{S&&(null===p||void 0===p||p(e,Is({},v)),null===o||void 0===o||o(Is({},v)),S=!1)});s.call(C)},destroy:function(){s.on(".drag",null)}}}var Tv=n(443);const Dv=e=>{let t;const n=new Set,r=(e,r)=>{const i="function"===typeof e?e(t):e;if(!Object.is(i,t)){const e=t;t=(null!=r?r:"object"!==typeof i||null===i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,o={setState:r,getState:i,getInitialState:()=>s,subscribe:e=>(n.add(e),()=>n.delete(e)),destroy:()=>{console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},s=t=e(r,i,o);return o},Ov=e=>e?Dv(e):Dv;const{useDebugValue:Iv}=e,{useSyncExternalStoreWithSelector:Av}=Tv,jv=e=>e;function Bv(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:jv,n=arguments.length>2?arguments[2]:void 0;const r=Av(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return Iv(r),r}const Nv=(e,t)=>{const n=Ov(e),r=function(e){return Bv(n,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:t)};return Object.assign(r,n),r};function Fv(e,t){if(Object.is(e,t))return!0;if("object"!==typeof e||null===e||"object"!==typeof t||null===t)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[n,r]of e)if(!Object.is(r,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}var zv=n(950);const Hv=["position","children","className","style"],Wv=["type","position","isValidConnection","isConnectable","isConnectableStart","isConnectableEnd","id","onConnect","children","className","onMouseDown","onTouchStart"],Uv=["x","y","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","children","className"],Vv=["path","labelX","labelY","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","interactionWidth"],$v=["id"],qv=["nodes","edges","defaultNodes","defaultEdges","className","nodeTypes","edgeTypes","onNodeClick","onEdgeClick","onInit","onMove","onMoveStart","onMoveEnd","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","onNodeMouseEnter","onNodeMouseMove","onNodeMouseLeave","onNodeContextMenu","onNodeDoubleClick","onNodeDragStart","onNodeDrag","onNodeDragStop","onNodesDelete","onEdgesDelete","onDelete","onSelectionChange","onSelectionDragStart","onSelectionDrag","onSelectionDragStop","onSelectionContextMenu","onSelectionStart","onSelectionEnd","onBeforeDelete","connectionMode","connectionLineType","connectionLineStyle","connectionLineComponent","connectionLineContainerStyle","deleteKeyCode","selectionKeyCode","selectionOnDrag","selectionMode","panActivationKeyCode","multiSelectionKeyCode","zoomActivationKeyCode","snapToGrid","snapGrid","onlyRenderVisibleElements","selectNodesOnDrag","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","nodeOrigin","edgesFocusable","edgesReconnectable","elementsSelectable","defaultViewport","minZoom","maxZoom","translateExtent","preventScrolling","nodeExtent","defaultMarkerColor","zoomOnScroll","zoomOnPinch","panOnScroll","panOnScrollSpeed","panOnScrollMode","zoomOnDoubleClick","panOnDrag","onPaneClick","onPaneMouseEnter","onPaneMouseMove","onPaneMouseLeave","onPaneScroll","onPaneContextMenu","paneClickDistance","nodeClickDistance","children","onReconnect","onReconnectStart","onReconnectEnd","onEdgeContextMenu","onEdgeDoubleClick","onEdgeMouseEnter","onEdgeMouseMove","onEdgeMouseLeave","reconnectRadius","onNodesChange","onEdgesChange","noDragClassName","noWheelClassName","noPanClassName","fitView","fitViewOptions","connectOnClick","attributionPosition","proOptions","defaultEdgeOptions","elevateNodesOnSelect","elevateEdgesOnSelect","disableKeyboardA11y","autoPanOnConnect","autoPanOnNodeDrag","autoPanSpeed","connectionRadius","isValidConnection","onError","style","id","nodeDragThreshold","connectionDragThreshold","viewport","onViewportChange","width","height","colorMode","debug","onScroll","ariaLabelConfig","zIndexMode"],Kv=["children","className"],Yv=(0,e.createContext)(null),Xv=Yv.Provider,Gv=gp();function Zv(t,n){const r=(0,e.useContext)(Yv);if(null===r)throw new Error(Gv);return Bv(r,t,n)}function Jv(){const t=(0,e.useContext)(Yv);if(null===t)throw new Error(Gv);return(0,e.useMemo)(()=>({getState:t.getState,setState:t.setState,subscribe:t.subscribe}),[t])}const Qv={display:"none"},em={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},tm="react-flow__node-desc",nm="react-flow__edge-desc",rm=e=>e.ariaLiveMessage,im=e=>e.ariaLabelConfig;function om(e){let{rfId:t}=e;const n=Zv(rm);return(0,rc.jsx)("div",{id:"".concat("react-flow__aria-live","-").concat(t),"aria-live":"assertive","aria-atomic":"true",style:em,children:n})}function sm(e){let{rfId:t,disableKeyboardA11y:n}=e;const r=Zv(im);return(0,rc.jsxs)(rc.Fragment,{children:[(0,rc.jsx)("div",{id:"".concat(tm,"-").concat(t),style:Qv,children:n?r["node.a11yDescription.default"]:r["node.a11yDescription.keyboardDisabled"]}),(0,rc.jsx)("div",{id:"".concat(nm,"-").concat(t),style:Qv,children:r["edge.a11yDescription.default"]}),!n&&(0,rc.jsx)(om,{rfId:t})]})}const am=(0,e.forwardRef)((e,t)=>{let{position:n="top-left",children:r,className:i,style:o}=e,s=Ls(e,Hv);const a="".concat(n).split("-");return(0,rc.jsx)("div",Is(Is({className:_u(["react-flow__panel",i,...a]),style:o,ref:t},s),{},{children:r}))});function lm(e){let{proOptions:t,position:n="bottom-right"}=e;return null!==t&&void 0!==t&&t.hideAttribution?null:(0,rc.jsx)(am,{position:n,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:(0,rc.jsx)("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}am.displayName="Panel";const cm=e=>{const t=[],n=[];for(const[,r]of e.nodeLookup)r.selected&&t.push(r.internals.userNode);for(const[,r]of e.edgeLookup)r.selected&&n.push(r);return{selectedNodes:t,selectedEdges:n}},um=e=>e.id;function dm(e,t){return Fv(e.selectedNodes.map(um),t.selectedNodes.map(um))&&Fv(e.selectedEdges.map(um),t.selectedEdges.map(um))}function hm(t){let{onSelectionChange:n}=t;const r=Jv(),{selectedNodes:i,selectedEdges:o}=Zv(cm,dm);return(0,e.useEffect)(()=>{const e={nodes:i,edges:o};null===n||void 0===n||n(e),r.getState().onSelectionChangeHandlers.forEach(t=>t(e))},[i,o,n]),null}const fm=e=>!!e.onSelectionChangeHandlers;function pm(e){let{onSelectionChange:t}=e;const n=Zv(fm);return t||n?(0,rc.jsx)(hm,{onSelectionChange:t}):null}const gm=[0,0],vm={x:0,y:0,zoom:1},mm=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode","rfId"],_m=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),ym={translateExtent:Rp,nodeOrigin:gm,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function bm(t){const{setNodes:n,setEdges:r,setMinZoom:i,setMaxZoom:o,setTranslateExtent:s,setNodeExtent:a,reset:l,setDefaultNodesAndEdges:c}=Zv(_m,Fv),u=Jv();(0,e.useEffect)(()=>(c(t.defaultNodes,t.defaultEdges),()=>{d.current=ym,l()}),[]);const d=(0,e.useRef)(ym);return(0,e.useEffect)(()=>{for(const e of mm){const l=t[e];l!==d.current[e]&&("undefined"!==typeof t[e]&&("nodes"===e?n(l):"edges"===e?r(l):"minZoom"===e?i(l):"maxZoom"===e?o(l):"translateExtent"===e?s(l):"nodeExtent"===e?a(l):"ariaLabelConfig"===e?u.setState({ariaLabelConfig:yg(l)}):"fitView"===e?u.setState({fitViewQueued:l}):"fitViewOptions"===e?u.setState({fitViewOptions:l}):u.setState({[e]:l})))}d.current=t},mm.map(e=>t[e])),null}function xm(){return"undefined"!==typeof window&&window.matchMedia?window.matchMedia("(prefers-color-scheme: dark)"):null}const wm="undefined"!==typeof document?document:null;function Sm(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{target:wm,actInsideInputWithModifier:!0};const[r,i]=(0,e.useState)(!1),o=(0,e.useRef)(!1),s=(0,e.useRef)(new Set([])),[a,l]=(0,e.useMemo)(()=>{if(null!==t){const e=(Array.isArray(t)?t:[t]).filter(e=>"string"===typeof e).map(e=>e.replace("+","\n").replace("\n\n","\n+").split("\n")),n=e.reduce((e,t)=>e.concat(...t),[]);return[e,n]}return[[],[]]},[t]);return(0,e.useEffect)(()=>{var e,r;const c=null!==(e=null===n||void 0===n?void 0:n.target)&&void 0!==e?e:wm,u=null===(r=null===n||void 0===n?void 0:n.actInsideInputWithModifier)||void 0===r||r;if(null!==t){const e=e=>{o.current=e.ctrlKey||e.metaKey||e.shiftKey||e.altKey;if((!o.current||o.current&&!u)&&Cg(e))return!1;const t=km(e.code,l);if(s.current.add(e[t]),Cm(a,s.current,!1)){var r;const t=(null===(r=e.composedPath)||void 0===r||null===(r=r.call(e))||void 0===r?void 0:r[0])||e.target,s="BUTTON"===(null===t||void 0===t?void 0:t.nodeName)||"A"===(null===t||void 0===t?void 0:t.nodeName);!1===n.preventDefault||!o.current&&s||e.preventDefault(),i(!0)}},t=e=>{const t=km(e.code,l);Cm(a,s.current,!0)?(i(!1),s.current.clear()):s.current.delete(e[t]),"Meta"===e.key&&s.current.clear(),o.current=!1},r=()=>{s.current.clear(),i(!1)};return null===c||void 0===c||c.addEventListener("keydown",e),null===c||void 0===c||c.addEventListener("keyup",t),window.addEventListener("blur",r),window.addEventListener("contextmenu",r),()=>{null===c||void 0===c||c.removeEventListener("keydown",e),null===c||void 0===c||c.removeEventListener("keyup",t),window.removeEventListener("blur",r),window.removeEventListener("contextmenu",r)}}},[t,i]),r}function Cm(e,t,n){return e.filter(e=>n||e.length===t.size).some(e=>e.every(e=>t.has(e)))}function km(e,t){return t.includes(e)?"code":"key"}function Em(e,t){const n=[],r=new Map,i=[];for(const o of e)if("add"!==o.type)if("remove"===o.type||"replace"===o.type)r.set(o.id,[o]);else{const e=r.get(o.id);e?e.push(o):r.set(o.id,[o])}else i.push(o);for(const o of t){const e=r.get(o.id);if(!e){n.push(o);continue}if("remove"===e[0].type)continue;if("replace"===e[0].type){n.push(Is({},e[0].item));continue}const t=Is({},o);for(const n of e)Rm(n,t);n.push(t)}return i.length&&i.forEach(e=>{void 0!==e.index?n.splice(e.index,0,Is({},e.item)):n.push(Is({},e.item))}),n}function Rm(e,t){switch(e.type){case"select":t.selected=e.selected;break;case"position":"undefined"!==typeof e.position&&(t.position=e.position),"undefined"!==typeof e.dragging&&(t.dragging=e.dragging);break;case"dimensions":"undefined"!==typeof e.dimensions&&(t.measured=Is({},e.dimensions),e.setAttributes&&(!0!==e.setAttributes&&"width"!==e.setAttributes||(t.width=e.dimensions.width),!0!==e.setAttributes&&"height"!==e.setAttributes||(t.height=e.dimensions.height))),"boolean"===typeof e.resizing&&(t.resizing=e.resizing)}}function Mm(e,t){return Em(e,t)}function Lm(e,t){return Em(e,t)}function Pm(e,t){return{id:e,type:"select",selected:t}}function Tm(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Set,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const r=[];for(const[i,o]of e){const e=t.has(i);void 0===o.selected&&!e||o.selected===e||(n&&(o.selected=e),r.push(Pm(o.id,e)))}return r}function Dm(e){let{items:t=[],lookup:n}=e;const r=[],i=new Map(t.map(e=>[e.id,e]));for(const[a,l]of t.entries()){var o,s;const e=n.get(l.id),t=null!==(o=null===e||void 0===e||null===(s=e.internals)||void 0===s?void 0:s.userNode)&&void 0!==o?o:e;void 0!==t&&t!==l&&r.push({id:l.id,item:l,type:"replace"}),void 0===t&&r.push({item:l,type:"add",index:a})}for(const[a]of n){void 0===i.get(a)&&r.push({id:a,type:"remove"})}return r}function Om(e){return{id:e.id,type:"remove"}}const Im=e=>(e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e))(e);function Am(t){return(0,e.forwardRef)(t)}const jm="undefined"!==typeof window?e.useLayoutEffect:e.useEffect;function Bm(t){const[n,r]=(0,e.useState)(BigInt(0)),[i]=(0,e.useState)(()=>function(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}(()=>r(e=>e+BigInt(1))));return jm(()=>{const e=i.get();e.length&&(t(e),i.reset())},[n]),i}const Nm=(0,e.createContext)(null);function Fm(t){let{children:n}=t;const r=Jv(),i=(0,e.useCallback)(e=>{const{nodes:t=[],setNodes:n,hasDefaultNodes:i,onNodesChange:o,nodeLookup:s,fitViewQueued:a,onNodesChangeMiddlewareMap:l}=r.getState();let c=t;for(const r of e)c="function"===typeof r?r(c):r;let u=Dm({items:c,lookup:s});for(const r of l.values())u=r(u);i&&n(c),u.length>0?null===o||void 0===o||o(u):a&&window.requestAnimationFrame(()=>{const{fitViewQueued:e,nodes:t,setNodes:n}=r.getState();e&&n(t)})},[]),o=Bm(i),s=Bm((0,e.useCallback)(e=>{const{edges:t=[],setEdges:n,hasDefaultEdges:i,onEdgesChange:o,edgeLookup:s}=r.getState();let a=t;for(const r of e)a="function"===typeof r?r(a):r;i?n(a):o&&o(Dm({items:a,lookup:s}))},[])),a=(0,e.useMemo)(()=>({nodeQueue:o,edgeQueue:s}),[]);return(0,rc.jsx)(Nm.Provider,{value:a,children:n})}const zm=e=>!!e.panZoom;function Hm(){const t=(()=>{const t=Jv();return(0,e.useMemo)(()=>({zoomIn:e=>{const{panZoom:n}=t.getState();return n?n.scaleBy(1.2,{duration:null===e||void 0===e?void 0:e.duration}):Promise.resolve(!1)},zoomOut:e=>{const{panZoom:n}=t.getState();return n?n.scaleBy(1/1.2,{duration:null===e||void 0===e?void 0:e.duration}):Promise.resolve(!1)},zoomTo:(e,n)=>{const{panZoom:r}=t.getState();return r?r.scaleTo(e,{duration:null===n||void 0===n?void 0:n.duration}):Promise.resolve(!1)},getZoom:()=>t.getState().transform[2],setViewport:async(e,n)=>{var r,i,o;const{transform:[s,a,l],panZoom:c}=t.getState();return c?(await c.setViewport({x:null!==(r=e.x)&&void 0!==r?r:s,y:null!==(i=e.y)&&void 0!==i?i:a,zoom:null!==(o=e.zoom)&&void 0!==o?o:l},n),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{const[e,n,r]=t.getState().transform;return{x:e,y:n,zoom:r}},setCenter:async(e,n,r)=>t.getState().setCenter(e,n,r),fitBounds:async(e,n)=>{var r;const{width:i,height:o,minZoom:s,maxZoom:a,panZoom:l}=t.getState(),c=hg(e,i,o,s,a,null!==(r=null===n||void 0===n?void 0:n.padding)&&void 0!==r?r:.1);return l?(await l.setViewport(c,{duration:null===n||void 0===n?void 0:n.duration,ease:null===n||void 0===n?void 0:n.ease,interpolate:null===n||void 0===n?void 0:n.interpolate}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:function(e){var n,r;let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{transform:o,snapGrid:s,snapToGrid:a,domNode:l}=t.getState();if(!l)return e;const{x:c,y:u}=l.getBoundingClientRect(),d={x:e.x-c,y:e.y-u},h=null!==(n=i.snapGrid)&&void 0!==n?n:s,f=null!==(r=i.snapToGrid)&&void 0!==r?r:a;return cg(d,o,f,h)},flowToScreenPosition:e=>{const{transform:n,domNode:r}=t.getState();if(!r)return e;const{x:i,y:o}=r.getBoundingClientRect(),s=ug(e,n);return{x:s.x+i,y:s.y+o}}}),[])})(),n=Jv(),r=function(){const t=(0,e.useContext)(Nm);if(!t)throw new Error("useBatchContext must be used within a BatchProvider");return t}(),i=Zv(zm),o=(0,e.useMemo)(()=>{const e=e=>n.getState().nodeLookup.get(e),t=e=>{r.nodeQueue.push(e)},i=e=>{r.edgeQueue.push(e)},o=e=>{var t,r,i,o;const{nodeLookup:s,nodeOrigin:a}=n.getState(),l=Im(e)?e:s.get(e.id),c=l.parentId?mg(l.position,l.measured,l.parentId,s,a):l.position,u=Is(Is({},l),{},{position:c,width:null!==(t=null===(r=l.measured)||void 0===r?void 0:r.width)&&void 0!==t?t:l.width,height:null!==(i=null===(o=l.measured)||void 0===o?void 0:o.height)&&void 0!==i?i:l.height});return tg(u)},s=function(e,n){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{replace:!1};t(t=>t.map(t=>{if(t.id===e){const e="function"===typeof n?n(t):n;return r.replace&&Im(e)?e:Is(Is({},t),e)}return t}))},a=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{replace:!1};i(r=>r.map(r=>{if(r.id===e){const e="function"===typeof t?t(r):t;return n.replace&&Fp(e)?e:Is(Is({},r),e)}return r}))};return{getNodes:()=>n.getState().nodes.map(e=>Is({},e)),getNode:t=>{var n;return null===(n=e(t))||void 0===n?void 0:n.internals.userNode},getInternalNode:e,getEdges:()=>{const{edges:e=[]}=n.getState();return e.map(e=>Is({},e))},getEdge:e=>n.getState().edgeLookup.get(e),setNodes:t,setEdges:i,addNodes:e=>{const t=Array.isArray(e)?e:[e];r.nodeQueue.push(e=>[...e,...t])},addEdges:e=>{const t=Array.isArray(e)?e:[e];r.edgeQueue.push(e=>[...e,...t])},toObject:()=>{const{nodes:e=[],edges:t=[],transform:r}=n.getState(),[i,o,s]=r;return{nodes:e.map(e=>Is({},e)),edges:t.map(e=>Is({},e)),viewport:{x:i,y:o,zoom:s}}},deleteElements:async e=>{let{nodes:t=[],edges:r=[]}=e;const{nodes:i,edges:o,onNodesDelete:s,onEdgesDelete:a,triggerNodeChanges:l,triggerEdgeChanges:c,onDelete:u,onBeforeDelete:d}=n.getState(),{nodes:h,edges:f}=await qp({nodesToRemove:t,edgesToRemove:r,nodes:i,edges:o,onBeforeDelete:d}),p=f.length>0,g=h.length>0;if(p){const e=f.map(Om);null===a||void 0===a||a(f),c(e)}if(g){const e=h.map(Om);null===s||void 0===s||s(h),l(e)}return(g||p)&&(null===u||void 0===u||u({nodes:h,edges:f})),{deletedNodes:h,deletedEdges:f}},getIntersectingNodes:function(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=arguments.length>2?arguments[2]:void 0;const i=og(e),s=i?e:o(e),a=void 0!==r;return s?(r||n.getState().nodes).filter(r=>{const o=n.getState().nodeLookup.get(r.id);if(o&&!i&&(r.id===e.id||!o.internals.positionAbsolute))return!1;const l=tg(a?r:o),c=ig(l,s);return t&&c>0||c>=l.width*l.height||c>=s.width*s.height}):[]},isNodeIntersecting:function(e,t){let n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const r=og(e)?e:o(e);if(!r)return!1;const i=ig(r,t);return n&&i>0||i>=t.width*t.height||i>=r.width*r.height},updateNode:s,updateNodeData:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{replace:!1};s(e,e=>{const r="function"===typeof t?t(e):t;return n.replace?Is(Is({},e),{},{data:r}):Is(Is({},e),{},{data:Is(Is({},e.data),r)})},n)},updateEdge:a,updateEdgeData:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{replace:!1};a(e,e=>{const r="function"===typeof t?t(e):t;return n.replace?Is(Is({},e),{},{data:r}):Is(Is({},e),{},{data:Is(Is({},e.data),r)})},n)},getNodesBounds:e=>{const{nodeLookup:t,nodeOrigin:r}=n.getState();return function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{nodeOrigin:[0,0]};if(0===e.length)return{x:0,y:0,width:0,height:0};const n=e.reduce((e,n)=>{const r="string"===typeof n;let i=t.nodeLookup||r?void 0:n;t.nodeLookup&&(i=r?t.nodeLookup.get(n):zp(n)?n:t.nodeLookup.get(n.id));const o=i?ng(i,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return Jp(e,o)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return eg(n)}(e,{nodeLookup:t,nodeOrigin:r})},getHandleConnections:e=>{var t,r;let{type:i,id:o,nodeId:s}=e;return Array.from(null!==(t=null===(r=n.getState().connectionLookup.get("".concat(s,"-").concat(i).concat(o?"-".concat(o):"")))||void 0===r?void 0:r.values())&&void 0!==t?t:[])},getNodeConnections:e=>{var t,r;let{type:i,handleId:o,nodeId:s}=e;return Array.from(null!==(t=null===(r=n.getState().connectionLookup.get("".concat(s).concat(i?o?"-".concat(i,"-").concat(o):"-".concat(i):"")))||void 0===r?void 0:r.values())&&void 0!==t?t:[])},fitView:async e=>{var t;const i=null!==(t=n.getState().fitViewResolver)&&void 0!==t?t:function(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}();return n.setState({fitViewQueued:!0,fitViewOptions:e,fitViewResolver:i}),r.nodeQueue.push(e=>[...e]),i.promise}}},[]);return(0,e.useMemo)(()=>Is(Is(Is({},o),t),{},{viewportInitialized:i}),[i])}const Wm=e=>e.selected,Um="undefined"!==typeof window?window:void 0;const Vm={position:"absolute",width:"100%",height:"100%",top:0,left:0},$m=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function qm(t){let{onPaneContextMenu:n,zoomOnScroll:r=!0,zoomOnPinch:i=!0,panOnScroll:o=!1,panOnScrollSpeed:s=.5,panOnScrollMode:a=Tp.Free,zoomOnDoubleClick:l=!0,panOnDrag:c=!0,defaultViewport:u,translateExtent:d,minZoom:h,maxZoom:f,zoomActivationKeyCode:p,preventScrolling:g=!0,children:v,noWheelClassName:m,noPanClassName:_,onViewportChange:y,isControlledViewport:b,paneClickDistance:x,selectionOnDrag:w}=t;const S=Jv(),C=(0,e.useRef)(null),{userSelectionActive:k,lib:E,connectionInProgress:R}=Zv($m,Fv),M=Sm(p),L=(0,e.useRef)();!function(t){const n=Jv();(0,e.useEffect)(()=>{const e=()=>{var e,r,i;if(!t.current||null!==(e=null===(r=(i=t.current).checkVisibility)||void 0===r?void 0:r.call(i))&&void 0!==e&&!e)return!1;const o=xg(t.current);var s,a;0!==o.height&&0!==o.width||null===(s=(a=n.getState()).onError)||void 0===s||s.call(a,"004",mp()),n.setState({width:o.width||500,height:o.height||500})};if(t.current){e(),window.addEventListener("resize",e);const n=new ResizeObserver(()=>e());return n.observe(t.current),()=>{window.removeEventListener("resize",e),n&&t.current&&n.unobserve(t.current)}}},[])}(C);const P=(0,e.useCallback)(e=>{null===y||void 0===y||y({x:e[0],y:e[1],zoom:e[2]}),b||S.setState({transform:e})},[y,b]);return(0,e.useEffect)(()=>{if(C.current){L.current=bv({domNode:C.current,minZoom:h,maxZoom:f,translateExtent:d,viewport:u,onDraggingChange:e=>S.setState({paneDragging:e}),onPanZoomStart:(e,t)=>{const{onViewportChangeStart:n,onMoveStart:r}=S.getState();null===r||void 0===r||r(e,t),null===n||void 0===n||n(t)},onPanZoom:(e,t)=>{const{onViewportChange:n,onMove:r}=S.getState();null===r||void 0===r||r(e,t),null===n||void 0===n||n(t)},onPanZoomEnd:(e,t)=>{const{onViewportChangeEnd:n,onMoveEnd:r}=S.getState();null===r||void 0===r||r(e,t),null===n||void 0===n||n(t)}});const{x:e,y:t,zoom:n}=L.current.getViewport();return S.setState({panZoom:L.current,transform:[e,t,n],domNode:C.current.closest(".react-flow")}),()=>{var e;null===(e=L.current)||void 0===e||e.destroy()}}},[]),(0,e.useEffect)(()=>{var e;null===(e=L.current)||void 0===e||e.update({onPaneContextMenu:n,zoomOnScroll:r,zoomOnPinch:i,panOnScroll:o,panOnScrollSpeed:s,panOnScrollMode:a,zoomOnDoubleClick:l,panOnDrag:c,zoomActivationKeyPressed:M,preventScrolling:g,noPanClassName:_,userSelectionActive:k,noWheelClassName:m,lib:E,onTransformChange:P,connectionInProgress:R,selectionOnDrag:w,paneClickDistance:x})},[n,r,i,o,s,a,l,c,M,g,_,k,m,E,P,R,w,x]),(0,rc.jsx)("div",{className:"react-flow__renderer",ref:C,style:Vm,children:v})}const Km=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function Ym(){const{userSelectionActive:e,userSelectionRect:t}=Zv(Km,Fv);return e&&t?(0,rc.jsx)("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:"translate(".concat(t.x,"px, ").concat(t.y,"px)")}}):null}const Xm=(e,t)=>n=>{n.target===t.current&&(null===e||void 0===e||e(n))},Gm=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function Zm(t){let{isSelecting:n,selectionKeyPressed:r,selectionMode:i=Dp.Full,panOnDrag:o,paneClickDistance:s,selectionOnDrag:a,onSelectionStart:l,onSelectionEnd:c,onPaneClick:u,onPaneContextMenu:d,onPaneScroll:h,onPaneMouseEnter:f,onPaneMouseMove:p,onPaneMouseLeave:g,children:v}=t;const m=Jv(),{userSelectionActive:_,elementsSelectable:y,dragging:b,connectionInProgress:x}=Zv(Gm,Fv),w=y&&(n||_),S=(0,e.useRef)(null),C=(0,e.useRef)(),k=(0,e.useRef)(new Set),E=(0,e.useRef)(new Set),R=(0,e.useRef)(!1),M=e=>{R.current||x?R.current=!1:(null===u||void 0===u||u(e),m.getState().resetSelectedElements(),m.setState({nodesSelectionActive:!1}))},L=h?e=>h(e):void 0,P=!0===o||Array.isArray(o)&&o.includes(0);return(0,rc.jsxs)("div",{className:_u(["react-flow__pane",{draggable:P,dragging:b,selection:n}]),onClick:w?void 0:Xm(M,S),onContextMenu:Xm(e=>{Array.isArray(o)&&null!==o&&void 0!==o&&o.includes(2)?e.preventDefault():null===d||void 0===d||d(e)},S),onWheel:Xm(L,S),onPointerEnter:w?void 0:f,onPointerMove:w?e=>{var t;const{userSelectionRect:n,transform:o,nodeLookup:a,edgeLookup:c,connectionLookup:u,triggerNodeChanges:d,triggerEdgeChanges:h,defaultEdgeOptions:f,resetSelectedElements:p}=m.getState();if(!C.current||!n)return;const{x:g,y:v}=Eg(e.nativeEvent,C.current),{startX:_,startY:y}=n;if(!R.current){const t=r?0:s;if(Math.hypot(g-_,v-y)<=t)return;p(),null===l||void 0===l||l(e)}R.current=!0;const b={startX:_,startY:y,x:g<_?g:_,y:v<y?v:y,width:Math.abs(g-_),height:Math.abs(v-y)},x=k.current,w=E.current;k.current=new Set(Up(a,b,o,i===Dp.Partial,!0).map(e=>e.id)),E.current=new Set;const S=null===(t=null===f||void 0===f?void 0:f.selectable)||void 0===t||t;for(const r of k.current){const e=u.get(r);if(e)for(const{edgeId:t}of e.values()){var M;const e=c.get(t);e&&(null!==(M=e.selectable)&&void 0!==M?M:S)&&E.current.add(t)}}if(!_g(x,k.current)){d(Tm(a,k.current,!0))}if(!_g(w,E.current)){h(Tm(c,E.current))}m.setState({userSelectionRect:b,userSelectionActive:!0,nodesSelectionActive:!1})}:p,onPointerUp:w?e=>{var t,n;0===e.button&&(null===(t=e.target)||void 0===t||null===(n=t.releasePointerCapture)||void 0===n||n.call(t,e.pointerId),!_&&e.target===S.current&&m.getState().userSelectionRect&&(null===M||void 0===M||M(e)),m.setState({userSelectionActive:!1,userSelectionRect:null}),R.current&&(null===c||void 0===c||c(e),m.setState({nodesSelectionActive:k.current.size>0})))}:void 0,onPointerDownCapture:w?e=>{var t,i;const{domNode:o}=m.getState();if(C.current=null===o||void 0===o?void 0:o.getBoundingClientRect(),!C.current)return;const s=e.target===S.current;if(!s&&!!e.target.closest(".nokey")||!n||!(a&&s||r)||0!==e.button||!e.isPrimary)return;null===(t=e.target)||void 0===t||null===(i=t.setPointerCapture)||void 0===i||i.call(t,e.pointerId),R.current=!1;const{x:l,y:c}=Eg(e.nativeEvent,C.current);m.setState({userSelectionRect:{width:0,height:0,startX:l,startY:c,x:l,y:c}}),s||(e.stopPropagation(),e.preventDefault())}:void 0,onClickCapture:w?e=>{R.current&&(e.stopPropagation(),R.current=!1)}:void 0,onPointerLeave:g,ref:S,style:Vm,children:[v,(0,rc.jsx)(Ym,{})]})}function Jm(e){let{id:t,store:n,unselect:r=!1,nodeRef:i}=e;const{addSelectedNodes:o,unselectNodesAndEdges:s,multiSelectionActive:a,nodeLookup:l,onError:c}=n.getState(),u=l.get(t);u?(n.setState({nodesSelectionActive:!1}),u.selected?(r||u.selected&&a)&&(s({nodes:[u],edges:[]}),requestAnimationFrame(()=>{var e;return null===i||void 0===i||null===(e=i.current)||void 0===e?void 0:e.blur()})):o([t])):null===c||void 0===c||c("012",Cp(t))}function Qm(t){let{nodeRef:n,disabled:r=!1,noDragClassName:i,handleSelector:o,nodeId:s,isSelectable:a,nodeClickDistance:l}=t;const c=Jv(),[u,d]=(0,e.useState)(!1),h=(0,e.useRef)();return(0,e.useEffect)(()=>{h.current=sv({getStoreItems:()=>c.getState(),onNodeMouseDown:e=>{Jm({id:e,store:c,nodeRef:n})},onDragStart:()=>{d(!0)},onDragStop:()=>{d(!1)}})},[]),(0,e.useEffect)(()=>{var e;if(r)null===(e=h.current)||void 0===e||e.destroy();else if(n.current){var t;return null===(t=h.current)||void 0===t||t.update({noDragClassName:i,handleSelector:o,domNode:n.current,isSelectable:a,nodeId:s,nodeClickDistance:l}),()=>{var e;null===(e=h.current)||void 0===e||e.destroy()}}},[i,o,r,a,n,s]),u}function e_(){const t=Jv(),n=(0,e.useCallback)(e=>{const{nodeExtent:n,snapToGrid:r,snapGrid:i,nodesDraggable:o,onError:s,updateNodePositions:a,nodeLookup:l,nodeOrigin:c}=t.getState(),u=new Map,d=(e=>t=>t.selected&&(t.draggable||e&&"undefined"===typeof t.draggable))(o),h=r?i[0]:5,f=r?i[1]:5,p=e.direction.x*h*e.factor,g=e.direction.y*f*e.factor;for(const[,t]of l){if(!d(t))continue;let e={x:t.internals.positionAbsolute.x+p,y:t.internals.positionAbsolute.y+g};r&&(e=lg(e,i));const{position:o,positionAbsolute:a}=$p({nodeId:t.id,nextPosition:e,nodeLookup:l,nodeExtent:n,nodeOrigin:c,onError:s});t.position=o,t.internals.positionAbsolute=a,u.set(t.id,t)}a(u)},[]);return n}const t_=(0,e.createContext)(null),n_=t_.Provider;t_.Consumer;const r_=()=>(0,e.useContext)(t_),i_=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId});const o_=(0,e.memo)(Am(function(e,t){let{type:n="source",position:r=jp.Top,isValidConnection:i,isConnectable:o=!0,isConnectableStart:s=!0,isConnectableEnd:a=!0,id:l,onConnect:c,children:u,className:d,onMouseDown:h,onTouchStart:f}=e,p=Ls(e,Wv);const g=l||null,v="target"===n,m=Jv(),_=r_(),{connectOnClick:y,noPanClassName:b,rfId:x}=Zv(i_,Fv),{connectingFrom:w,connectingTo:S,clickConnecting:C,isPossibleEndHandle:k,connectionInProcess:E,clickConnectionInProcess:R,valid:M}=Zv(((e,t,n)=>r=>{const{connectionClickStartHandle:i,connectionMode:o,connection:s}=r,{fromHandle:a,toHandle:l,isValid:c}=s,u=(null===l||void 0===l?void 0:l.nodeId)===e&&(null===l||void 0===l?void 0:l.id)===t&&(null===l||void 0===l?void 0:l.type)===n;return{connectingFrom:(null===a||void 0===a?void 0:a.nodeId)===e&&(null===a||void 0===a?void 0:a.id)===t&&(null===a||void 0===a?void 0:a.type)===n,connectingTo:u,clickConnecting:(null===i||void 0===i?void 0:i.nodeId)===e&&(null===i||void 0===i?void 0:i.id)===t&&(null===i||void 0===i?void 0:i.type)===n,isPossibleEndHandle:o===Pp.Strict?(null===a||void 0===a?void 0:a.type)!==n:e!==(null===a||void 0===a?void 0:a.nodeId)||t!==(null===a||void 0===a?void 0:a.id),connectionInProcess:!!a,clickConnectionInProcess:!!i,valid:u&&c}})(_,g,n),Fv);var L,P;_||null===(L=(P=m.getState()).onError)||void 0===L||L.call(P,"010",wp());const T=e=>{const{defaultEdgeOptions:t,onConnect:n,hasDefaultEdges:r}=m.getState(),i=Is(Is({},t),e);if(r){const{edges:e,setEdges:t}=m.getState();t(Ag(i,e))}null===n||void 0===n||n(i),null===c||void 0===c||c(i)},D=e=>{if(!_)return;const t=kg(e.nativeEvent);if(s&&(t&&0===e.button||!t)){const t=m.getState();hv.onPointerDown(e.nativeEvent,{handleDomNode:e.currentTarget,autoPanOnConnect:t.autoPanOnConnect,connectionMode:t.connectionMode,connectionRadius:t.connectionRadius,domNode:t.domNode,nodeLookup:t.nodeLookup,lib:t.lib,isTarget:v,handleId:g,nodeId:_,flowId:t.rfId,panBy:t.panBy,cancelConnection:t.cancelConnection,onConnectStart:t.onConnectStart,onConnectEnd:t.onConnectEnd,updateConnection:t.updateConnection,onConnect:T,isValidConnection:i||t.isValidConnection,getTransform:()=>m.getState().transform,getFromHandle:()=>m.getState().connection.fromHandle,autoPanSpeed:t.autoPanSpeed,dragThreshold:t.connectionDragThreshold})}t?null===h||void 0===h||h(e):null===f||void 0===f||f(e)};return(0,rc.jsx)("div",Is(Is({"data-handleid":g,"data-nodeid":_,"data-handlepos":r,"data-id":"".concat(x,"-").concat(_,"-").concat(g,"-").concat(n),className:_u(["react-flow__handle","react-flow__handle-".concat(r),"nodrag",b,d,{source:!v,target:v,connectable:o,connectablestart:s,connectableend:a,clickconnecting:C,connectingfrom:w,connectingto:S,valid:M,connectionindicator:o&&(!E||k)&&(E||R?a:s)}]),onMouseDown:D,onTouchStart:D,onClick:y?e=>{const{onClickConnectStart:t,onClickConnectEnd:r,connectionClickStartHandle:o,connectionMode:a,isValidConnection:l,lib:c,rfId:u,nodeLookup:d,connection:h}=m.getState();if(!_||!o&&!s)return;if(!o)return null===t||void 0===t||t(e.nativeEvent,{nodeId:_,handleId:g,handleType:n}),void m.setState({connectionClickStartHandle:{nodeId:_,type:n,id:g}});const f=wg(e.target),p=i||l,{connection:v,isValid:y}=hv.isValid(e.nativeEvent,{handle:{nodeId:_,id:g,type:n},connectionMode:a,fromNodeId:o.nodeId,fromHandleId:o.id||null,fromType:o.type,isValidConnection:p,flowId:u,doc:f,lib:c,nodeLookup:d});y&&v&&T(v);const b=structuredClone(h);delete b.inProgress,b.toPosition=b.toHandle?b.toHandle.position:null,null===r||void 0===r||r(e,b),m.setState({connectionClickStartHandle:null})}:void 0,ref:t},p),{},{children:u}))}));const s_={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},a_={input:function(e){let{data:t,isConnectable:n,sourcePosition:r=jp.Bottom}=e;return(0,rc.jsxs)(rc.Fragment,{children:[null===t||void 0===t?void 0:t.label,(0,rc.jsx)(o_,{type:"source",position:r,isConnectable:n})]})},default:function(e){let{data:t,isConnectable:n,targetPosition:r=jp.Top,sourcePosition:i=jp.Bottom}=e;return(0,rc.jsxs)(rc.Fragment,{children:[(0,rc.jsx)(o_,{type:"target",position:r,isConnectable:n}),null===t||void 0===t?void 0:t.label,(0,rc.jsx)(o_,{type:"source",position:i,isConnectable:n})]})},output:function(e){let{data:t,isConnectable:n,targetPosition:r=jp.Top}=e;return(0,rc.jsxs)(rc.Fragment,{children:[(0,rc.jsx)(o_,{type:"target",position:r,isConnectable:n}),null===t||void 0===t?void 0:t.label]})},group:function(){return null}};const l_=e=>{const{width:t,height:n,x:r,y:i}=Wp(e.nodeLookup,{filter:e=>!!e.selected});return{width:sg(t)?t:null,height:sg(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:"translate(".concat(e.transform[0],"px,").concat(e.transform[1],"px) scale(").concat(e.transform[2],") translate(").concat(r,"px,").concat(i,"px)")}};function c_(t){let{onSelectionContextMenu:n,noPanClassName:r,disableKeyboardA11y:i}=t;const o=Jv(),{width:s,height:a,transformString:l,userSelectionActive:c}=Zv(l_,Fv),u=e_(),d=(0,e.useRef)(null);if((0,e.useEffect)(()=>{var e;i||(null===(e=d.current)||void 0===e||e.focus({preventScroll:!0}))},[i]),Qm({nodeRef:d}),c||!s||!a)return null;const h=n?e=>{const t=o.getState().nodes.filter(e=>e.selected);n(e,t)}:void 0;return(0,rc.jsx)("div",{className:_u(["react-flow__nodesselection","react-flow__container",r]),style:{transform:l},children:(0,rc.jsx)("div",{ref:d,className:"react-flow__nodesselection-rect",onContextMenu:h,tabIndex:i?void 0:-1,onKeyDown:i?void 0:e=>{Object.prototype.hasOwnProperty.call(s_,e.key)&&(e.preventDefault(),u({direction:s_[e.key],factor:e.shiftKey?4:1}))},style:{width:s,height:a}})})}const u_="undefined"!==typeof window?window:void 0,d_=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function h_(t){let{children:n,onPaneClick:r,onPaneMouseEnter:i,onPaneMouseMove:o,onPaneMouseLeave:s,onPaneContextMenu:a,onPaneScroll:l,paneClickDistance:c,deleteKeyCode:u,selectionKeyCode:d,selectionOnDrag:h,selectionMode:f,onSelectionStart:p,onSelectionEnd:g,multiSelectionKeyCode:v,panActivationKeyCode:m,zoomActivationKeyCode:_,elementsSelectable:y,zoomOnScroll:b,zoomOnPinch:x,panOnScroll:w,panOnScrollSpeed:S,panOnScrollMode:C,zoomOnDoubleClick:k,panOnDrag:E,defaultViewport:R,translateExtent:M,minZoom:L,maxZoom:P,preventScrolling:T,onSelectionContextMenu:D,noWheelClassName:O,noPanClassName:I,disableKeyboardA11y:A,onViewportChange:j,isControlledViewport:B}=t;const{nodesSelectionActive:N,userSelectionActive:F}=Zv(d_,Fv),z=Sm(d,{target:u_}),H=Sm(m,{target:u_}),W=H||E,U=H||w,V=h&&!0!==W,$=z||F||V;return function(t){let{deleteKeyCode:n,multiSelectionKeyCode:r}=t;const i=Jv(),{deleteElements:o}=Hm(),s=Sm(n,{actInsideInputWithModifier:!1}),a=Sm(r,{target:Um});(0,e.useEffect)(()=>{if(s){const{edges:e,nodes:t}=i.getState();o({nodes:t.filter(Wm),edges:e.filter(Wm)}),i.setState({nodesSelectionActive:!1})}},[s]),(0,e.useEffect)(()=>{i.setState({multiSelectionActive:a})},[a])}({deleteKeyCode:u,multiSelectionKeyCode:v}),(0,rc.jsx)(qm,{onPaneContextMenu:a,elementsSelectable:y,zoomOnScroll:b,zoomOnPinch:x,panOnScroll:U,panOnScrollSpeed:S,panOnScrollMode:C,zoomOnDoubleClick:k,panOnDrag:!z&&W,defaultViewport:R,translateExtent:M,minZoom:L,maxZoom:P,zoomActivationKeyCode:_,preventScrolling:T,noWheelClassName:O,noPanClassName:I,onViewportChange:j,isControlledViewport:B,paneClickDistance:c,selectionOnDrag:V,children:(0,rc.jsxs)(Zm,{onSelectionStart:p,onSelectionEnd:g,onPaneClick:r,onPaneMouseEnter:i,onPaneMouseMove:o,onPaneMouseLeave:s,onPaneContextMenu:a,onPaneScroll:l,panOnDrag:W,isSelecting:!!$,selectionMode:f,selectionKeyPressed:z,paneClickDistance:c,selectionOnDrag:V,children:[n,N&&(0,rc.jsx)(c_,{onSelectionContextMenu:D,noPanClassName:I,disableKeyboardA11y:A})]})})}h_.displayName="FlowRenderer";const f_=(0,e.memo)(h_);function p_(t){const n=Zv((0,e.useCallback)((e=>t=>e?Up(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(e=>e.id):Array.from(t.nodeLookup.keys()))(t),[t]),Fv);return n}const g_=e=>e.updateNodeInternals;var v_=(0,e.memo)(function(t){var n,r,i;let{id:o,onClick:s,onMouseEnter:a,onMouseMove:l,onMouseLeave:c,onContextMenu:u,onDoubleClick:d,nodesDraggable:h,elementsSelectable:f,nodesConnectable:p,nodesFocusable:g,resizeObserver:v,noDragClassName:m,noPanClassName:_,disableKeyboardA11y:y,rfId:b,nodeTypes:x,nodeClickDistance:w,onError:S}=t;const{node:C,internals:k,isParent:E}=Zv(e=>{const t=e.nodeLookup.get(o),n=e.parentLookup.has(o);return{node:t,internals:t.internals,isParent:n}},Fv);let R=C.type||"default",M=(null===x||void 0===x?void 0:x[R])||a_[R];void 0===M&&(null===S||void 0===S||S("003",vp(R)),R="default",M=(null===x||void 0===x?void 0:x.default)||a_.default);const L=!!(C.draggable||h&&"undefined"===typeof C.draggable),P=!!(C.selectable||f&&"undefined"===typeof C.selectable),T=!!(C.connectable||p&&"undefined"===typeof C.connectable),D=!!(C.focusable||g&&"undefined"===typeof C.focusable),O=Jv(),I=vg(C),A=function(t){let{node:n,nodeType:r,hasDimensions:i,resizeObserver:o}=t;const s=Jv(),a=(0,e.useRef)(null),l=(0,e.useRef)(null),c=(0,e.useRef)(n.sourcePosition),u=(0,e.useRef)(n.targetPosition),d=(0,e.useRef)(r),h=i&&!!n.internals.handleBounds;return(0,e.useEffect)(()=>{!a.current||n.hidden||h&&l.current===a.current||(l.current&&(null===o||void 0===o||o.unobserve(l.current)),null===o||void 0===o||o.observe(a.current),l.current=a.current)},[h,n.hidden]),(0,e.useEffect)(()=>()=>{l.current&&(null===o||void 0===o||o.unobserve(l.current),l.current=null)},[]),(0,e.useEffect)(()=>{if(a.current){const e=d.current!==r,t=c.current!==n.sourcePosition,i=u.current!==n.targetPosition;(e||t||i)&&(d.current=r,c.current=n.sourcePosition,u.current=n.targetPosition,s.getState().updateNodeInternals(new Map([[n.id,{id:n.id,nodeElement:a.current,force:!0}]])))}},[n.id,r,n.sourcePosition,n.targetPosition]),a}({node:C,nodeType:R,hasDimensions:I,resizeObserver:v}),j=Qm({nodeRef:A,disabled:C.hidden||!L,noDragClassName:m,handleSelector:C.dragHandle,nodeId:o,isSelectable:P,nodeClickDistance:w}),B=e_();if(C.hidden)return null;const N=gg(C),F=function(e){var t,n,r,i,o,s,a,l,c,u;return void 0===e.internals.handleBounds?{width:null!==(o=null!==(s=e.width)&&void 0!==s?s:e.initialWidth)&&void 0!==o?o:null===(a=e.style)||void 0===a?void 0:a.width,height:null!==(l=null!==(c=e.height)&&void 0!==c?c:e.initialHeight)&&void 0!==l?l:null===(u=e.style)||void 0===u?void 0:u.height}:{width:null!==(t=e.width)&&void 0!==t?t:null===(n=e.style)||void 0===n?void 0:n.width,height:null!==(r=e.height)&&void 0!==r?r:null===(i=e.style)||void 0===i?void 0:i.height}}(C),z=P||L||s||a||l||c,H=a?e=>a(e,Is({},k.userNode)):void 0,W=l?e=>l(e,Is({},k.userNode)):void 0,U=c?e=>c(e,Is({},k.userNode)):void 0,V=u?e=>u(e,Is({},k.userNode)):void 0,$=d?e=>d(e,Is({},k.userNode)):void 0;return(0,rc.jsx)("div",Is(Is({className:_u(["react-flow__node","react-flow__node-".concat(R),{[_]:L},C.className,{selected:C.selected,selectable:P,parent:E,draggable:L,dragging:j}]),ref:A,style:Is(Is({zIndex:k.z,transform:"translate(".concat(k.positionAbsolute.x,"px,").concat(k.positionAbsolute.y,"px)"),pointerEvents:z?"all":"none",visibility:I?"visible":"hidden"},C.style),F),"data-id":o,"data-testid":"rf__node-".concat(o),onMouseEnter:H,onMouseMove:W,onMouseLeave:U,onContextMenu:V,onClick:e=>{const{selectNodesOnDrag:t,nodeDragThreshold:n}=O.getState();P&&(!t||!L||n>0)&&Jm({id:o,store:O,nodeRef:A}),s&&s(e,Is({},k.userNode))},onDoubleClick:$,onKeyDown:D?e=>{if(!Cg(e.nativeEvent)&&!y)if(Mp.includes(e.key)&&P){const t="Escape"===e.key;Jm({id:o,store:O,unselect:t,nodeRef:A})}else if(L&&C.selected&&Object.prototype.hasOwnProperty.call(s_,e.key)){e.preventDefault();const{ariaLabelConfig:t}=O.getState();O.setState({ariaLiveMessage:t["node.a11yDescription.ariaLiveMessage"]({direction:e.key.replace("Arrow","").toLowerCase(),x:~~k.positionAbsolute.x,y:~~k.positionAbsolute.y})}),B({direction:s_[e.key],factor:e.shiftKey?4:1})}}:void 0,tabIndex:D?0:void 0,onFocus:D?()=>{var e;if(y||null===(e=A.current)||void 0===e||!e.matches(":focus-visible"))return;const{transform:t,width:n,height:r,autoPanOnNodeFocus:i,setCenter:s}=O.getState();if(!i)return;Up(new Map([[o,C]]),{x:0,y:0,width:n,height:r},t,!0).length>0||s(C.position.x+N.width/2,C.position.y+N.height/2,{zoom:t[2]})}:void 0,role:null!==(n=C.ariaRole)&&void 0!==n?n:D?"group":void 0,"aria-roledescription":"node","aria-describedby":y?void 0:"".concat(tm,"-").concat(b),"aria-label":C.ariaLabel},C.domAttributes),{},{children:(0,rc.jsx)(n_,{value:o,children:(0,rc.jsx)(M,Is({id:o,data:C.data,type:R,positionAbsoluteX:k.positionAbsolute.x,positionAbsoluteY:k.positionAbsolute.y,selected:null!==(r=C.selected)&&void 0!==r&&r,selectable:P,draggable:L,deletable:null===(i=C.deletable)||void 0===i||i,isConnectable:T,sourcePosition:C.sourcePosition,targetPosition:C.targetPosition,dragging:j,dragHandle:C.dragHandle,zIndex:k.z,parentId:C.parentId},N))})}))});const m_=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function __(t){const{nodesDraggable:n,nodesConnectable:r,nodesFocusable:i,elementsSelectable:o,onError:s}=Zv(m_,Fv),a=p_(t.onlyRenderVisibleElements),l=function(){const t=Zv(g_),[n]=(0,e.useState)(()=>"undefined"===typeof ResizeObserver?null:new ResizeObserver(e=>{const n=new Map;e.forEach(e=>{const t=e.target.getAttribute("data-id");n.set(t,{id:t,nodeElement:e.target,force:!0})}),t(n)}));return(0,e.useEffect)(()=>()=>{null===n||void 0===n||n.disconnect()},[n]),n}();return(0,rc.jsx)("div",{className:"react-flow__nodes",style:Vm,children:a.map(e=>(0,rc.jsx)(v_,{id:e,nodeTypes:t.nodeTypes,nodeExtent:t.nodeExtent,onClick:t.onNodeClick,onMouseEnter:t.onNodeMouseEnter,onMouseMove:t.onNodeMouseMove,onMouseLeave:t.onNodeMouseLeave,onContextMenu:t.onNodeContextMenu,onDoubleClick:t.onNodeDoubleClick,noDragClassName:t.noDragClassName,noPanClassName:t.noPanClassName,rfId:t.rfId,disableKeyboardA11y:t.disableKeyboardA11y,resizeObserver:l,nodesDraggable:n,nodesConnectable:r,nodesFocusable:i,elementsSelectable:o,nodeClickDistance:t.nodeClickDistance,onError:s},e))})}__.displayName="NodeRenderer";const y_=(0,e.memo)(__);const b_={[Ap.Arrow]:e=>{let{color:t="none",strokeWidth:n=1}=e;const r=Is({strokeWidth:n},t&&{stroke:t});return(0,rc.jsx)("polyline",{className:"arrow",style:r,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},[Ap.ArrowClosed]:e=>{let{color:t="none",strokeWidth:n=1}=e;const r=Is({strokeWidth:n},t&&{stroke:t,fill:t});return(0,rc.jsx)("polyline",{className:"arrowclosed",style:r,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})}};const x_=t=>{let{id:n,type:r,color:i,width:o=12.5,height:s=12.5,markerUnits:a="strokeWidth",strokeWidth:l,orient:c="auto-start-reverse"}=t;const u=function(t){const n=Jv();return(0,e.useMemo)(()=>{var e,r;return Object.prototype.hasOwnProperty.call(b_,t)?b_[t]:(null===(e=(r=n.getState()).onError)||void 0===e||e.call(r,"009",bp(t)),null)},[t])}(r);return u?(0,rc.jsx)("marker",{className:"react-flow__arrowhead",id:n,markerWidth:"".concat(o),markerHeight:"".concat(s),viewBox:"-10 -10 20 20",markerUnits:a,orient:c,refX:"0",refY:"0",children:(0,rc.jsx)(u,{color:i,strokeWidth:l})}):null},w_=t=>{let{defaultColor:n,rfId:r}=t;const i=Zv(e=>e.edges),o=Zv(e=>e.defaultEdgeOptions),s=(0,e.useMemo)(()=>{const e=function(e,t){let{id:n,defaultColor:r,defaultMarkerStart:i,defaultMarkerEnd:o}=t;const s=new Set;return e.reduce((e,t)=>([t.markerStart||i,t.markerEnd||o].forEach(t=>{if(t&&"object"===typeof t){const i=$g(t,n);s.has(i)||(e.push(Is({id:i,color:t.color||r},t)),s.add(i))}}),e),[]).sort((e,t)=>e.id.localeCompare(t.id))}(i,{id:r,defaultColor:n,defaultMarkerStart:null===o||void 0===o?void 0:o.markerStart,defaultMarkerEnd:null===o||void 0===o?void 0:o.markerEnd});return e},[i,o,r,n]);return s.length?(0,rc.jsx)("svg",{className:"react-flow__marker","aria-hidden":"true",children:(0,rc.jsx)("defs",{children:s.map(e=>(0,rc.jsx)(x_,{id:e.id,type:e.type,color:e.color,width:e.width,height:e.height,markerUnits:e.markerUnits,strokeWidth:e.strokeWidth,orient:e.orient},e.id))})}):null};w_.displayName="MarkerDefinitions";var S_=(0,e.memo)(w_);function C_(t){let{x:n,y:r,label:i,labelStyle:o,labelShowBg:s=!0,labelBgStyle:a,labelBgPadding:l=[2,4],labelBgBorderRadius:c=2,children:u,className:d}=t,h=Ls(t,Uv);const[f,p]=(0,e.useState)({x:1,y:0,width:0,height:0}),g=_u(["react-flow__edge-textwrapper",d]),v=(0,e.useRef)(null);return(0,e.useEffect)(()=>{if(v.current){const e=v.current.getBBox();p({x:e.x,y:e.y,width:e.width,height:e.height})}},[i]),i?(0,rc.jsxs)("g",Is(Is({transform:"translate(".concat(n-f.width/2," ").concat(r-f.height/2,")"),className:g,visibility:f.width?"visible":"hidden"},h),{},{children:[s&&(0,rc.jsx)("rect",{width:f.width+2*l[0],x:-l[0],y:-l[1],height:f.height+2*l[1],className:"react-flow__edge-textbg",style:a,rx:c,ry:c}),(0,rc.jsx)("text",{className:"react-flow__edge-text",y:f.height/2,dy:"0.3em",ref:v,style:o,children:i}),u]})):null}C_.displayName="EdgeText";const k_=(0,e.memo)(C_);function E_(e){let{path:t,labelX:n,labelY:r,label:i,labelStyle:o,labelShowBg:s,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c,interactionWidth:u=20}=e,d=Ls(e,Vv);return(0,rc.jsxs)(rc.Fragment,{children:[(0,rc.jsx)("path",Is(Is({},d),{},{d:t,fill:"none",className:_u(["react-flow__edge-path",d.className])})),u?(0,rc.jsx)("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:u,className:"react-flow__edge-interaction"}):null,i&&sg(n)&&sg(r)?(0,rc.jsx)(k_,{x:n,y:r,label:i,labelStyle:o,labelShowBg:s,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c}):null]})}function R_(e){let{pos:t,x1:n,y1:r,x2:i,y2:o}=e;return t===jp.Left||t===jp.Right?[.5*(n+i),r]:[n,.5*(r+o)]}function M_(e){let{sourceX:t,sourceY:n,sourcePosition:r=jp.Bottom,targetX:i,targetY:o,targetPosition:s=jp.Top}=e;const[a,l]=R_({pos:r,x1:t,y1:n,x2:i,y2:o}),[c,u]=R_({pos:s,x1:i,y1:o,x2:t,y2:n}),[d,h,f,p]=Mg({sourceX:t,sourceY:n,targetX:i,targetY:o,sourceControlX:a,sourceControlY:l,targetControlX:c,targetControlY:u});return["M".concat(t,",").concat(n," C").concat(a,",").concat(l," ").concat(c,",").concat(u," ").concat(i,",").concat(o),d,h,f,p]}function L_(t){return(0,e.memo)(e=>{let{id:n,sourceX:r,sourceY:i,targetX:o,targetY:s,sourcePosition:a,targetPosition:l,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:h,labelBgPadding:f,labelBgBorderRadius:p,style:g,markerEnd:v,markerStart:m,interactionWidth:_}=e;const[y,b,x]=M_({sourceX:r,sourceY:i,sourcePosition:a,targetX:o,targetY:s,targetPosition:l}),w=t.isInternal?void 0:n;return(0,rc.jsx)(E_,{id:w,path:y,labelX:b,labelY:x,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:h,labelBgPadding:f,labelBgBorderRadius:p,style:g,markerEnd:v,markerStart:m,interactionWidth:_})})}const P_=L_({isInternal:!1}),T_=L_({isInternal:!0});function D_(t){return(0,e.memo)(e=>{let{id:n,sourceX:r,sourceY:i,targetX:o,targetY:s,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:h,style:f,sourcePosition:p=jp.Bottom,targetPosition:g=jp.Top,markerEnd:v,markerStart:m,pathOptions:_,interactionWidth:y}=e;const[b,x,w]=zg({sourceX:r,sourceY:i,sourcePosition:p,targetX:o,targetY:s,targetPosition:g,borderRadius:null===_||void 0===_?void 0:_.borderRadius,offset:null===_||void 0===_?void 0:_.offset,stepPosition:null===_||void 0===_?void 0:_.stepPosition}),S=t.isInternal?void 0:n;return(0,rc.jsx)(E_,{id:S,path:b,labelX:x,labelY:w,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:h,style:f,markerEnd:v,markerStart:m,interactionWidth:y})})}P_.displayName="SimpleBezierEdge",T_.displayName="SimpleBezierEdgeInternal";const O_=D_({isInternal:!1}),I_=D_({isInternal:!0});function A_(t){return(0,e.memo)(n=>{var r;let{id:i}=n,o=Ls(n,$v);const s=t.isInternal?void 0:i;return(0,rc.jsx)(O_,Is(Is({},o),{},{id:s,pathOptions:(0,e.useMemo)(()=>{var e;return{borderRadius:0,offset:null===(e=o.pathOptions)||void 0===e?void 0:e.offset}},[null===(r=o.pathOptions)||void 0===r?void 0:r.offset])}))})}O_.displayName="SmoothStepEdge",I_.displayName="SmoothStepEdgeInternal";const j_=A_({isInternal:!1}),B_=A_({isInternal:!0});function N_(t){return(0,e.memo)(e=>{let{id:n,sourceX:r,sourceY:i,targetX:o,targetY:s,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:h,style:f,markerEnd:p,markerStart:g,interactionWidth:v}=e;const[m,_,y]=jg({sourceX:r,sourceY:i,targetX:o,targetY:s}),b=t.isInternal?void 0:n;return(0,rc.jsx)(E_,{id:b,path:m,labelX:_,labelY:y,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:h,style:f,markerEnd:p,markerStart:g,interactionWidth:v})})}j_.displayName="StepEdge",B_.displayName="StepEdgeInternal";const F_=N_({isInternal:!1}),z_=N_({isInternal:!0});function H_(t){return(0,e.memo)(e=>{let{id:n,sourceX:r,sourceY:i,targetX:o,targetY:s,sourcePosition:a=jp.Bottom,targetPosition:l=jp.Top,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:h,labelBgPadding:f,labelBgBorderRadius:p,style:g,markerEnd:v,markerStart:m,pathOptions:_,interactionWidth:y}=e;const[b,x,w]=Tg({sourceX:r,sourceY:i,sourcePosition:a,targetX:o,targetY:s,targetPosition:l,curvature:null===_||void 0===_?void 0:_.curvature}),S=t.isInternal?void 0:n;return(0,rc.jsx)(E_,{id:S,path:b,labelX:x,labelY:w,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:h,labelBgPadding:f,labelBgBorderRadius:p,style:g,markerEnd:v,markerStart:m,interactionWidth:y})})}F_.displayName="StraightEdge",z_.displayName="StraightEdgeInternal";const W_=H_({isInternal:!1}),U_=H_({isInternal:!0});W_.displayName="BezierEdge",U_.displayName="BezierEdgeInternal";const V_={default:U_,straight:z_,step:B_,smoothstep:I_,simplebezier:T_},$_={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},q_=(e,t,n)=>n===jp.Left?e-t:n===jp.Right?e+t:e,K_=(e,t,n)=>n===jp.Top?e-t:n===jp.Bottom?e+t:e,Y_="react-flow__edgeupdater";function X_(e){let{position:t,centerX:n,centerY:r,radius:i=10,onMouseDown:o,onMouseEnter:s,onMouseOut:a,type:l}=e;return(0,rc.jsx)("circle",{onMouseDown:o,onMouseEnter:s,onMouseOut:a,className:_u([Y_,"".concat(Y_,"-").concat(l)]),cx:q_(n,i,t),cy:K_(r,i,t),r:i,stroke:"transparent",fill:"transparent"})}function G_(e){let{isReconnectable:t,reconnectRadius:n,edge:r,sourceX:i,sourceY:o,targetX:s,targetY:a,sourcePosition:l,targetPosition:c,onReconnect:u,onReconnectStart:d,onReconnectEnd:h,setReconnecting:f,setUpdateHover:p}=e;const g=Jv(),v=(e,t)=>{if(0!==e.button)return;const{autoPanOnConnect:n,domNode:i,isValidConnection:o,connectionMode:s,connectionRadius:a,lib:l,onConnectStart:c,onConnectEnd:p,cancelConnection:v,nodeLookup:m,rfId:_,panBy:y,updateConnection:b}=g.getState(),x="target"===t.type;hv.onPointerDown(e.nativeEvent,{autoPanOnConnect:n,connectionMode:s,connectionRadius:a,domNode:i,handleId:t.id,nodeId:t.nodeId,nodeLookup:m,isTarget:x,edgeUpdaterType:t.type,lib:l,flowId:_,cancelConnection:v,panBy:y,isValidConnection:o,onConnect:e=>null===u||void 0===u?void 0:u(r,e),onConnectStart:(n,i)=>{f(!0),null===d||void 0===d||d(e,r,t.type),null===c||void 0===c||c(n,i)},onConnectEnd:p,onReconnectEnd:(e,n)=>{f(!1),null===h||void 0===h||h(e,r,t.type,n)},updateConnection:b,getTransform:()=>g.getState().transform,getFromHandle:()=>g.getState().connection.fromHandle,dragThreshold:g.getState().connectionDragThreshold,handleDomNode:e.currentTarget})},m=()=>p(!0),_=()=>p(!1);return(0,rc.jsxs)(rc.Fragment,{children:[(!0===t||"source"===t)&&(0,rc.jsx)(X_,{position:l,centerX:i,centerY:o,radius:n,onMouseDown:e=>{var t;return v(e,{nodeId:r.target,id:null!==(t=r.targetHandle)&&void 0!==t?t:null,type:"target"})},onMouseEnter:m,onMouseOut:_,type:"source"}),(!0===t||"target"===t)&&(0,rc.jsx)(X_,{position:c,centerX:s,centerY:a,radius:n,onMouseDown:e=>{var t;return v(e,{nodeId:r.source,id:null!==(t=r.sourceHandle)&&void 0!==t?t:null,type:"source"})},onMouseEnter:m,onMouseOut:_,type:"target"})]})}var Z_=(0,e.memo)(function(t){var n,r;let{id:i,edgesFocusable:o,edgesReconnectable:s,elementsSelectable:a,onClick:l,onDoubleClick:c,onContextMenu:u,onMouseEnter:d,onMouseMove:h,onMouseLeave:f,reconnectRadius:p,onReconnect:g,onReconnectStart:v,onReconnectEnd:m,rfId:_,edgeTypes:y,noPanClassName:b,onError:x,disableKeyboardA11y:w}=t,S=Zv(e=>e.edgeLookup.get(i));const C=Zv(e=>e.defaultEdgeOptions);S=C?Is(Is({},C),S):S;let k=S.type||"default",E=(null===y||void 0===y?void 0:y[k])||V_[k];void 0===E&&(null===x||void 0===x||x("011",Sp(k)),k="default",E=(null===y||void 0===y?void 0:y.default)||V_.default);const R=!!(S.focusable||o&&"undefined"===typeof S.focusable),M="undefined"!==typeof g&&(S.reconnectable||s&&"undefined"===typeof S.reconnectable),L=!!(S.selectable||a&&"undefined"===typeof S.selectable),P=(0,e.useRef)(null),[T,D]=(0,e.useState)(!1),[O,I]=(0,e.useState)(!1),A=Jv(),{zIndex:j,sourceX:B,sourceY:N,targetX:F,targetY:z,sourcePosition:H,targetPosition:W}=Zv((0,e.useCallback)(e=>{const t=e.nodeLookup.get(S.source),n=e.nodeLookup.get(S.target);if(!t||!n)return Is({zIndex:S.zIndex},$_);const r=function(e){var t,n,r,i;const{sourceNode:o,targetNode:s}=e;if(!Hg(o)||!Hg(s))return null;const a=o.internals.handleBounds||Wg(o.handles),l=s.internals.handleBounds||Wg(s.handles),c=Vg(null!==(t=null===a||void 0===a?void 0:a.source)&&void 0!==t?t:[],e.sourceHandle),u=Vg(e.connectionMode===Pp.Strict?null!==(n=null===l||void 0===l?void 0:l.target)&&void 0!==n?n:[]:(null!==(r=null===l||void 0===l?void 0:l.target)&&void 0!==r?r:[]).concat(null!==(i=null===l||void 0===l?void 0:l.source)&&void 0!==i?i:[]),e.targetHandle);var d;if(!c||!u)return null===(d=e.onError)||void 0===d||d.call(e,"008",xp(c?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const h=(null===c||void 0===c?void 0:c.position)||jp.Bottom,f=(null===u||void 0===u?void 0:u.position)||jp.Top,p=Ug(o,c,h),g=Ug(s,u,f);return{sourceX:p.x,sourceY:p.y,targetX:g.x,targetY:g.y,sourcePosition:h,targetPosition:f}}({id:i,sourceNode:t,targetNode:n,sourceHandle:S.sourceHandle||null,targetHandle:S.targetHandle||null,connectionMode:e.connectionMode,onError:x}),o=function(e){let{sourceNode:t,targetNode:n,selected:r=!1,zIndex:i=0,elevateOnSelect:o=!1,zIndexMode:s="basic"}=e;return"manual"===s?i:(o&&r?i+1e3:i)+Math.max(t.parentId||o&&t.selected?t.internals.z:0,n.parentId||o&&n.selected?n.internals.z:0)}({selected:S.selected,zIndex:S.zIndex,sourceNode:t,targetNode:n,elevateOnSelect:e.elevateEdgesOnSelect,zIndexMode:e.zIndexMode});return Is({zIndex:o},r||$_)},[S.source,S.target,S.sourceHandle,S.targetHandle,S.selected,S.zIndex]),Fv),U=(0,e.useMemo)(()=>S.markerStart?"url('#".concat($g(S.markerStart,_),"')"):void 0,[S.markerStart,_]),V=(0,e.useMemo)(()=>S.markerEnd?"url('#".concat($g(S.markerEnd,_),"')"):void 0,[S.markerEnd,_]);if(S.hidden||null===B||null===N||null===F||null===z)return null;const $=c?e=>{c(e,Is({},S))}:void 0,q=u?e=>{u(e,Is({},S))}:void 0,K=d?e=>{d(e,Is({},S))}:void 0,Y=h?e=>{h(e,Is({},S))}:void 0,X=f?e=>{f(e,Is({},S))}:void 0;return(0,rc.jsx)("svg",{style:{zIndex:j},children:(0,rc.jsxs)("g",Is(Is({className:_u(["react-flow__edge","react-flow__edge-".concat(k),S.className,b,{selected:S.selected,animated:S.animated,inactive:!L&&!l,updating:T,selectable:L}]),onClick:e=>{const{addSelectedEdges:t,unselectNodesAndEdges:n,multiSelectionActive:r}=A.getState();var o;L&&(A.setState({nodesSelectionActive:!1}),S.selected&&r?(n({nodes:[],edges:[S]}),null===(o=P.current)||void 0===o||o.blur()):t([i]));l&&l(e,S)},onDoubleClick:$,onContextMenu:q,onMouseEnter:K,onMouseMove:Y,onMouseLeave:X,onKeyDown:R?e=>{if(!w&&Mp.includes(e.key)&&L){const{unselectNodesAndEdges:n,addSelectedEdges:r}=A.getState();var t;if("Escape"===e.key)null===(t=P.current)||void 0===t||t.blur(),n({edges:[S]});else r([i])}}:void 0,tabIndex:R?0:void 0,role:null!==(n=S.ariaRole)&&void 0!==n?n:R?"group":"img","aria-roledescription":"edge","data-id":i,"data-testid":"rf__edge-".concat(i),"aria-label":null===S.ariaLabel?void 0:S.ariaLabel||"Edge from ".concat(S.source," to ").concat(S.target),"aria-describedby":R?"".concat(nm,"-").concat(_):void 0,ref:P},S.domAttributes),{},{children:[!O&&(0,rc.jsx)(E,{id:i,source:S.source,target:S.target,type:S.type,selected:S.selected,animated:S.animated,selectable:L,deletable:null===(r=S.deletable)||void 0===r||r,label:S.label,labelStyle:S.labelStyle,labelShowBg:S.labelShowBg,labelBgStyle:S.labelBgStyle,labelBgPadding:S.labelBgPadding,labelBgBorderRadius:S.labelBgBorderRadius,sourceX:B,sourceY:N,targetX:F,targetY:z,sourcePosition:H,targetPosition:W,data:S.data,style:S.style,sourceHandleId:S.sourceHandle,targetHandleId:S.targetHandle,markerStart:U,markerEnd:V,pathOptions:"pathOptions"in S?S.pathOptions:void 0,interactionWidth:S.interactionWidth}),M&&(0,rc.jsx)(G_,{edge:S,isReconnectable:M,reconnectRadius:p,onReconnect:g,onReconnectStart:v,onReconnectEnd:m,sourceX:B,sourceY:N,targetX:F,targetY:z,sourcePosition:H,targetPosition:W,setUpdateHover:D,setReconnecting:I})]}))})});const J_=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function Q_(t){let{defaultMarkerColor:n,onlyRenderVisibleElements:r,rfId:i,edgeTypes:o,noPanClassName:s,onReconnect:a,onEdgeContextMenu:l,onEdgeMouseEnter:c,onEdgeMouseMove:u,onEdgeMouseLeave:d,onEdgeClick:h,reconnectRadius:f,onEdgeDoubleClick:p,onReconnectStart:g,onReconnectEnd:v,disableKeyboardA11y:m}=t;const{edgesFocusable:_,edgesReconnectable:y,elementsSelectable:b,onError:x}=Zv(J_,Fv),w=function(t){const n=Zv((0,e.useCallback)(e=>{if(!t)return e.edges.map(e=>e.id);const n=[];if(e.width&&e.height)for(const t of e.edges){const r=e.nodeLookup.get(t.source),i=e.nodeLookup.get(t.target);r&&i&&Og({sourceNode:r,targetNode:i,width:e.width,height:e.height,transform:e.transform})&&n.push(t.id)}return n},[t]),Fv);return n}(r);return(0,rc.jsxs)("div",{className:"react-flow__edges",children:[(0,rc.jsx)(S_,{defaultColor:n,rfId:i}),w.map(e=>(0,rc.jsx)(Z_,{id:e,edgesFocusable:_,edgesReconnectable:y,elementsSelectable:b,noPanClassName:s,onReconnect:a,onContextMenu:l,onMouseEnter:c,onMouseMove:u,onMouseLeave:d,onClick:h,reconnectRadius:f,onDoubleClick:p,onReconnectStart:g,onReconnectEnd:v,rfId:i,onError:x,edgeTypes:o,disableKeyboardA11y:m},e))]})}Q_.displayName="EdgeRenderer";const ey=(0,e.memo)(Q_),ty=e=>"translate(".concat(e.transform[0],"px,").concat(e.transform[1],"px) scale(").concat(e.transform[2],")");function ny(e){let{children:t}=e;const n=Zv(ty);return(0,rc.jsx)("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:n},children:t})}const ry=e=>{var t;return null===(t=e.panZoom)||void 0===t?void 0:t.syncViewport};function iy(e){return e.connection.inProgress?Is(Is({},e.connection),{},{to:cg(e.connection.to,e.transform)}):Is({},e.connection)}function oy(e){const t=function(e){if(e){const t=t=>{const n=iy(t);return e(n)};return t}return iy}(e);return Zv(t,Fv)}const sy=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function ay(e){let{containerStyle:t,style:n,type:r,component:i}=e;const{nodesConnectable:o,width:s,height:a,isValid:l,inProgress:c}=Zv(sy,Fv);return!!(s&&o&&c)?(0,rc.jsx)("svg",{style:t,width:s,height:a,className:"react-flow__connectionline react-flow__container",children:(0,rc.jsx)("g",{className:_u(["react-flow__connection",Np(l)]),children:(0,rc.jsx)(ly,{style:n,type:r,CustomComponent:i,isValid:l})})}):null}const ly=e=>{let{style:t,type:n=Ip.Bezier,CustomComponent:r,isValid:i}=e;const{inProgress:o,from:s,fromNode:a,fromHandle:l,fromPosition:c,to:u,toNode:d,toHandle:h,toPosition:f,pointer:p}=oy();if(!o)return;if(r)return(0,rc.jsx)(r,{connectionLineType:n,connectionLineStyle:t,fromNode:a,fromHandle:l,fromX:s.x,fromY:s.y,toX:u.x,toY:u.y,fromPosition:c,toPosition:f,connectionStatus:Np(i),toNode:d,toHandle:h,pointer:p});let g="";const v={sourceX:s.x,sourceY:s.y,sourcePosition:c,targetX:u.x,targetY:u.y,targetPosition:f};switch(n){case Ip.Bezier:[g]=Tg(v);break;case Ip.SimpleBezier:[g]=M_(v);break;case Ip.Step:[g]=zg(Is(Is({},v),{},{borderRadius:0}));break;case Ip.SmoothStep:[g]=zg(v);break;default:[g]=jg(v)}return(0,rc.jsx)("path",{d:g,fill:"none",className:"react-flow__connection-path",style:t})};ly.displayName="ConnectionLine";const cy={};function uy(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:cy;(0,e.useRef)(t),Jv();(0,e.useEffect)(()=>{},[t])}function dy(t){let{nodeTypes:n,edgeTypes:r,onInit:i,onNodeClick:o,onEdgeClick:s,onNodeDoubleClick:a,onEdgeDoubleClick:l,onNodeMouseEnter:c,onNodeMouseMove:u,onNodeMouseLeave:d,onNodeContextMenu:h,onSelectionContextMenu:f,onSelectionStart:p,onSelectionEnd:g,connectionLineType:v,connectionLineStyle:m,connectionLineComponent:_,connectionLineContainerStyle:y,selectionKeyCode:b,selectionOnDrag:x,selectionMode:w,multiSelectionKeyCode:S,panActivationKeyCode:C,zoomActivationKeyCode:k,deleteKeyCode:E,onlyRenderVisibleElements:R,elementsSelectable:M,defaultViewport:L,translateExtent:P,minZoom:T,maxZoom:D,preventScrolling:O,defaultMarkerColor:I,zoomOnScroll:A,zoomOnPinch:j,panOnScroll:B,panOnScrollSpeed:N,panOnScrollMode:F,zoomOnDoubleClick:z,panOnDrag:H,onPaneClick:W,onPaneMouseEnter:U,onPaneMouseMove:V,onPaneMouseLeave:$,onPaneScroll:q,onPaneContextMenu:K,paneClickDistance:Y,nodeClickDistance:X,onEdgeContextMenu:G,onEdgeMouseEnter:Z,onEdgeMouseMove:J,onEdgeMouseLeave:Q,reconnectRadius:ee,onReconnect:te,onReconnectStart:ne,onReconnectEnd:re,noDragClassName:ie,noWheelClassName:oe,noPanClassName:se,disableKeyboardA11y:ae,nodeExtent:le,rfId:ce,viewport:ue,onViewportChange:de}=t;return uy(n),uy(r),Jv(),(0,e.useRef)(!1),(0,e.useEffect)(()=>{},[]),function(t){const n=Hm(),r=(0,e.useRef)(!1);(0,e.useEffect)(()=>{!r.current&&n.viewportInitialized&&t&&(setTimeout(()=>t(n),1),r.current=!0)},[t,n.viewportInitialized])}(i),function(t){const n=Zv(ry),r=Jv();(0,e.useEffect)(()=>{t&&(null===n||void 0===n||n(t),r.setState({transform:[t.x,t.y,t.zoom]}))},[t,n])}(ue),(0,rc.jsx)(f_,{onPaneClick:W,onPaneMouseEnter:U,onPaneMouseMove:V,onPaneMouseLeave:$,onPaneContextMenu:K,onPaneScroll:q,paneClickDistance:Y,deleteKeyCode:E,selectionKeyCode:b,selectionOnDrag:x,selectionMode:w,onSelectionStart:p,onSelectionEnd:g,multiSelectionKeyCode:S,panActivationKeyCode:C,zoomActivationKeyCode:k,elementsSelectable:M,zoomOnScroll:A,zoomOnPinch:j,zoomOnDoubleClick:z,panOnScroll:B,panOnScrollSpeed:N,panOnScrollMode:F,panOnDrag:H,defaultViewport:L,translateExtent:P,minZoom:T,maxZoom:D,onSelectionContextMenu:f,preventScrolling:O,noDragClassName:ie,noWheelClassName:oe,noPanClassName:se,disableKeyboardA11y:ae,onViewportChange:de,isControlledViewport:!!ue,children:(0,rc.jsxs)(ny,{children:[(0,rc.jsx)(ey,{edgeTypes:r,onEdgeClick:s,onEdgeDoubleClick:l,onReconnect:te,onReconnectStart:ne,onReconnectEnd:re,onlyRenderVisibleElements:R,onEdgeContextMenu:G,onEdgeMouseEnter:Z,onEdgeMouseMove:J,onEdgeMouseLeave:Q,reconnectRadius:ee,defaultMarkerColor:I,noPanClassName:se,disableKeyboardA11y:ae,rfId:ce}),(0,rc.jsx)(ay,{style:m,type:v,component:_,containerStyle:y}),(0,rc.jsx)("div",{className:"react-flow__edgelabel-renderer"}),(0,rc.jsx)(y_,{nodeTypes:n,onNodeClick:o,onNodeDoubleClick:a,onNodeMouseEnter:c,onNodeMouseMove:u,onNodeMouseLeave:d,onNodeContextMenu:h,nodeClickDistance:X,onlyRenderVisibleElements:R,noPanClassName:se,noDragClassName:ie,disableKeyboardA11y:ae,nodeExtent:le,rfId:ce}),(0,rc.jsx)("div",{className:"react-flow__viewport-portal"})]})})}dy.displayName="GraphView";const hy=(0,e.memo)(dy),fy=function(){var e,t;let{nodes:n,edges:r,defaultNodes:i,defaultEdges:o,width:s,height:a,fitView:l,fitViewOptions:c,minZoom:u=.5,maxZoom:d=2,nodeOrigin:h,nodeExtent:f,zIndexMode:p="basic"}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const g=new Map,v=new Map,m=new Map,_=new Map,y=null!==(e=null!==o&&void 0!==o?o:r)&&void 0!==e?e:[],b=null!==(t=null!==i&&void 0!==i?i:n)&&void 0!==t?t:[],x=null!==h&&void 0!==h?h:[0,0],w=null!==f&&void 0!==f?f:Rp;nv(m,_,y);const S=Zg(b,g,v,{nodeOrigin:x,nodeExtent:w,zIndexMode:p});let C=[0,0,1];if(l&&s&&a){var k;const e=Wp(g,{filter:e=>!(!e.width&&!e.initialWidth||!e.height&&!e.initialHeight)}),{x:t,y:n,zoom:r}=hg(e,s,a,u,d,null!==(k=null===c||void 0===c?void 0:c.padding)&&void 0!==k?k:.1);C=[t,n,r]}return{rfId:"1",width:null!==s&&void 0!==s?s:0,height:null!==a&&void 0!==a?a:0,transform:C,nodes:b,nodesInitialized:S,nodeLookup:g,parentLookup:v,edges:y,edgeLookup:_,connectionLookup:m,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:void 0!==i,hasDefaultEdges:void 0!==o,panZoom:null,minZoom:u,maxZoom:d,translateExtent:Rp,nodeExtent:w,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:Pp.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:x,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:null!==l&&void 0!==l&&l,fitViewOptions:c,fitViewResolver:null,connection:Is({},Op),connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:ag,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:Lp,zIndexMode:p,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},py=e=>{let{nodes:t,edges:n,defaultNodes:r,defaultEdges:i,width:o,height:s,fitView:a,fitViewOptions:l,minZoom:c,maxZoom:u,nodeOrigin:d,nodeExtent:h,zIndexMode:f}=e;return p=(e,p)=>{async function g(){const{nodeLookup:t,panZoom:n,fitViewOptions:r,fitViewResolver:i,width:o,height:s,minZoom:a,maxZoom:l}=p();n&&(await Vp({nodes:t,width:o,height:s,panZoom:n,minZoom:a,maxZoom:l},r),null===i||void 0===i||i.resolve(!0),e({fitViewResolver:null}))}return Is(Is({},fy({nodes:t,edges:n,width:o,height:s,fitView:a,fitViewOptions:l,minZoom:c,maxZoom:u,nodeOrigin:d,nodeExtent:h,defaultNodes:r,defaultEdges:i,zIndexMode:f})),{},{setNodes:t=>{const{nodeLookup:n,parentLookup:r,nodeOrigin:i,elevateNodesOnSelect:o,fitViewQueued:s,zIndexMode:a}=p(),l=Zg(t,n,r,{nodeOrigin:i,nodeExtent:h,elevateNodesOnSelect:o,checkEquality:!0,zIndexMode:a});s&&l?(g(),e({nodes:t,nodesInitialized:l,fitViewQueued:!1,fitViewOptions:void 0})):e({nodes:t,nodesInitialized:l})},setEdges:t=>{const{connectionLookup:n,edgeLookup:r}=p();nv(n,r,t),e({edges:t})},setDefaultNodesAndEdges:(t,n)=>{if(t){const{setNodes:n}=p();n(t),e({hasDefaultNodes:!0})}if(n){const{setEdges:t}=p();t(n),e({hasDefaultEdges:!0})}},updateNodeInternals:t=>{const{triggerNodeChanges:n,nodeLookup:r,parentLookup:i,domNode:o,nodeOrigin:s,nodeExtent:a,debug:l,fitViewQueued:c,zIndexMode:u}=p(),{changes:d,updatedInternals:h}=function(e,t,n,r,i,o,s){const a=null===r||void 0===r?void 0:r.querySelector(".xyflow__viewport");let l=!1;if(!a)return{changes:[],updatedInternals:l};const c=[],u=window.getComputedStyle(a),{m22:d}=new window.DOMMatrixReadOnly(u.transform),h=[];for(const f of e.values()){const e=t.get(f.id);if(!e)continue;if(e.hidden){t.set(e.id,Is(Is({},e),{},{internals:Is(Is({},e.internals),{},{handleBounds:void 0})})),l=!0;continue}const r=xg(f.nodeElement),a=e.measured.width!==r.width||e.measured.height!==r.height;if(r.width&&r.height&&(a||!e.internals.handleBounds||f.force)){const u=f.nodeElement.getBoundingClientRect(),p=pg(e.extent)?e.extent:o;let{positionAbsolute:g}=e.internals;e.parentId&&"parent"===e.extent?g=Xp(g,r,t.get(e.parentId)):p&&(g=Yp(g,p,r));const v=Is(Is({},e),{},{measured:r,internals:Is(Is({},e.internals),{},{positionAbsolute:g,handleBounds:{source:Rg("source",f.nodeElement,u,d,e.id),target:Rg("target",f.nodeElement,u,d,e.id)}})});t.set(e.id,v),e.parentId&&Jg(v,t,n,{nodeOrigin:i,zIndexMode:s}),l=!0,a&&(c.push({id:e.id,type:"dimensions",dimensions:r}),e.expandParent&&e.parentId&&h.push({id:e.id,parentId:e.parentId,rect:tg(v,i)}))}}if(h.length>0){const e=ev(h,t,n,i);c.push(...e)}return{changes:c,updatedInternals:l}}(t,r,i,o,s,a,u);h&&(function(e,t,n){const r=Yg(qg,n);for(const i of e.values())if(i.parentId)Jg(i,e,t,r);else{const e=Hp(i,r.nodeOrigin),t=pg(i.extent)?i.extent:r.nodeExtent,n=Yp(e,t,gg(i));i.internals.positionAbsolute=n}}(r,i,{nodeOrigin:s,nodeExtent:a,zIndexMode:u}),c?(g(),e({fitViewQueued:!1,fitViewOptions:void 0})):e({}),(null===d||void 0===d?void 0:d.length)>0&&(l&&console.log("React Flow: trigger node changes",d),null===n||void 0===n||n(d)))},updateNodePositions:function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const n=[];let r=[];const{nodeLookup:i,triggerNodeChanges:o,connection:s,updateConnection:a,onNodesChangeMiddlewareMap:l}=p();for(const[d,h]of e){const e=i.get(d),o=!!(null!==e&&void 0!==e&&e.expandParent&&null!==e&&void 0!==e&&e.parentId&&null!==h&&void 0!==h&&h.position),l={id:d,type:"position",position:o?{x:Math.max(0,h.position.x),y:Math.max(0,h.position.y)}:h.position,dragging:t};if(e&&s.inProgress&&s.fromNode.id===e.id){const t=Ug(e,s.fromHandle,jp.Left,!0);a(Is(Is({},s),{},{from:t}))}var c,u;o&&e.parentId&&n.push({id:d,parentId:e.parentId,rect:Is(Is({},h.internals.positionAbsolute),{},{width:null!==(c=h.measured.width)&&void 0!==c?c:0,height:null!==(u=h.measured.height)&&void 0!==u?u:0})}),r.push(l)}if(n.length>0){const{parentLookup:e,nodeOrigin:t}=p(),o=ev(n,i,e,t);r.push(...o)}for(const d of l.values())r=d(r);o(r)},triggerNodeChanges:e=>{const{onNodesChange:t,setNodes:n,nodes:r,hasDefaultNodes:i,debug:o}=p();null!==e&&void 0!==e&&e.length&&(i&&n(Mm(e,r)),o&&console.log("React Flow: trigger node changes",e),null===t||void 0===t||t(e))},triggerEdgeChanges:e=>{const{onEdgesChange:t,setEdges:n,edges:r,hasDefaultEdges:i,debug:o}=p();null!==e&&void 0!==e&&e.length&&(i&&n(Lm(e,r)),o&&console.log("React Flow: trigger edge changes",e),null===t||void 0===t||t(e))},addSelectedNodes:e=>{const{multiSelectionActive:t,edgeLookup:n,nodeLookup:r,triggerNodeChanges:i,triggerEdgeChanges:o}=p();t?i(e.map(e=>Pm(e,!0))):(i(Tm(r,new Set([...e]),!0)),o(Tm(n)))},addSelectedEdges:e=>{const{multiSelectionActive:t,edgeLookup:n,nodeLookup:r,triggerNodeChanges:i,triggerEdgeChanges:o}=p();t?o(e.map(e=>Pm(e,!0))):(o(Tm(n,new Set([...e]))),i(Tm(r,new Set,!0)))},unselectNodesAndEdges:function(){let{nodes:e,edges:t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{edges:n,nodes:r,nodeLookup:i,triggerNodeChanges:o,triggerEdgeChanges:s}=p(),a=t||n,l=(e||r).map(e=>{const t=i.get(e.id);return t&&(t.selected=!1),Pm(e.id,!1)}),c=a.map(e=>Pm(e.id,!1));o(l),s(c)},setMinZoom:t=>{const{panZoom:n,maxZoom:r}=p();null===n||void 0===n||n.setScaleExtent([t,r]),e({minZoom:t})},setMaxZoom:t=>{const{panZoom:n,minZoom:r}=p();null===n||void 0===n||n.setScaleExtent([r,t]),e({maxZoom:t})},setTranslateExtent:t=>{var n;null===(n=p().panZoom)||void 0===n||n.setTranslateExtent(t),e({translateExtent:t})},resetSelectedElements:()=>{const{edges:e,nodes:t,triggerNodeChanges:n,triggerEdgeChanges:r,elementsSelectable:i}=p();if(!i)return;const o=t.reduce((e,t)=>t.selected?[...e,Pm(t.id,!1)]:e,[]),s=e.reduce((e,t)=>t.selected?[...e,Pm(t.id,!1)]:e,[]);n(o),r(s)},setNodeExtent:t=>{const{nodes:n,nodeLookup:r,parentLookup:i,nodeOrigin:o,elevateNodesOnSelect:s,nodeExtent:a,zIndexMode:l}=p();t[0][0]===a[0][0]&&t[0][1]===a[0][1]&&t[1][0]===a[1][0]&&t[1][1]===a[1][1]||(Zg(n,r,i,{nodeOrigin:o,nodeExtent:t,elevateNodesOnSelect:s,checkEquality:!1,zIndexMode:l}),e({nodeExtent:t}))},panBy:e=>{const{transform:t,width:n,height:r,panZoom:i,translateExtent:o}=p();return async function(e){let{delta:t,panZoom:n,transform:r,translateExtent:i,width:o,height:s}=e;if(!n||!t.x&&!t.y)return Promise.resolve(!1);const a=await n.setViewportConstrained({x:r[0]+t.x,y:r[1]+t.y,zoom:r[2]},[[0,0],[o,s]],i),l=!!a&&(a.x!==r[0]||a.y!==r[1]||a.k!==r[2]);return Promise.resolve(l)}({delta:e,panZoom:i,transform:t,translateExtent:o,width:n,height:r})},setCenter:async(e,t,n)=>{const{width:r,height:i,maxZoom:o,panZoom:s}=p();if(!s)return Promise.resolve(!1);const a="undefined"!==typeof(null===n||void 0===n?void 0:n.zoom)?n.zoom:o;return await s.setViewport({x:r/2-e*a,y:i/2-t*a,zoom:a},{duration:null===n||void 0===n?void 0:n.duration,ease:null===n||void 0===n?void 0:n.ease,interpolate:null===n||void 0===n?void 0:n.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{e({connection:Is({},Op)})},updateConnection:t=>{e({connection:t})},reset:()=>e(Is({},fy()))})},g=Object.is,p?Nv(p,g):Nv;var p,g};function gy(t){let{initialNodes:n,initialEdges:r,defaultNodes:i,defaultEdges:o,initialWidth:s,initialHeight:a,initialMinZoom:l,initialMaxZoom:c,initialFitViewOptions:u,fitView:d,nodeOrigin:h,nodeExtent:f,zIndexMode:p,children:g}=t;const[v]=(0,e.useState)(()=>py({nodes:n,edges:r,defaultNodes:i,defaultEdges:o,width:s,height:a,fitView:d,minZoom:l,maxZoom:c,fitViewOptions:u,nodeOrigin:h,nodeExtent:f,zIndexMode:p}));return(0,rc.jsx)(Xv,{value:v,children:(0,rc.jsx)(Fm,{children:g})})}function vy(t){let{children:n,nodes:r,edges:i,defaultNodes:o,defaultEdges:s,width:a,height:l,fitView:c,fitViewOptions:u,minZoom:d,maxZoom:h,nodeOrigin:f,nodeExtent:p,zIndexMode:g}=t;return(0,e.useContext)(Yv)?(0,rc.jsx)(rc.Fragment,{children:n}):(0,rc.jsx)(gy,{initialNodes:r,initialEdges:i,defaultNodes:o,defaultEdges:s,initialWidth:a,initialHeight:l,fitView:c,initialFitViewOptions:u,initialMinZoom:d,initialMaxZoom:h,nodeOrigin:f,nodeExtent:p,zIndexMode:g,children:n})}const my={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};var _y=Am(function(t,n){let{nodes:r,edges:i,defaultNodes:o,defaultEdges:s,className:a,nodeTypes:l,edgeTypes:c,onNodeClick:u,onEdgeClick:d,onInit:h,onMove:f,onMoveStart:p,onMoveEnd:g,onConnect:v,onConnectStart:m,onConnectEnd:_,onClickConnectStart:y,onClickConnectEnd:b,onNodeMouseEnter:x,onNodeMouseMove:w,onNodeMouseLeave:S,onNodeContextMenu:C,onNodeDoubleClick:k,onNodeDragStart:E,onNodeDrag:R,onNodeDragStop:M,onNodesDelete:L,onEdgesDelete:P,onDelete:T,onSelectionChange:D,onSelectionDragStart:O,onSelectionDrag:I,onSelectionDragStop:A,onSelectionContextMenu:j,onSelectionStart:B,onSelectionEnd:N,onBeforeDelete:F,connectionMode:z,connectionLineType:H=Ip.Bezier,connectionLineStyle:W,connectionLineComponent:U,connectionLineContainerStyle:V,deleteKeyCode:$="Backspace",selectionKeyCode:q="Shift",selectionOnDrag:K=!1,selectionMode:Y=Dp.Full,panActivationKeyCode:X="Space",multiSelectionKeyCode:G=(fg()?"Meta":"Control"),zoomActivationKeyCode:Z=(fg()?"Meta":"Control"),snapToGrid:J,snapGrid:Q,onlyRenderVisibleElements:ee=!1,selectNodesOnDrag:te,nodesDraggable:ne,autoPanOnNodeFocus:re,nodesConnectable:ie,nodesFocusable:oe,nodeOrigin:se=gm,edgesFocusable:ae,edgesReconnectable:le,elementsSelectable:ce=!0,defaultViewport:ue=vm,minZoom:de=.5,maxZoom:he=2,translateExtent:fe=Rp,preventScrolling:pe=!0,nodeExtent:ge,defaultMarkerColor:ve="#b1b1b7",zoomOnScroll:me=!0,zoomOnPinch:_e=!0,panOnScroll:ye=!1,panOnScrollSpeed:be=.5,panOnScrollMode:xe=Tp.Free,zoomOnDoubleClick:we=!0,panOnDrag:Se=!0,onPaneClick:Ce,onPaneMouseEnter:ke,onPaneMouseMove:Ee,onPaneMouseLeave:Re,onPaneScroll:Me,onPaneContextMenu:Le,paneClickDistance:Pe=1,nodeClickDistance:Te=0,children:De,onReconnect:Oe,onReconnectStart:Ie,onReconnectEnd:Ae,onEdgeContextMenu:je,onEdgeDoubleClick:Be,onEdgeMouseEnter:Ne,onEdgeMouseMove:Fe,onEdgeMouseLeave:ze,reconnectRadius:He=10,onNodesChange:We,onEdgesChange:Ue,noDragClassName:Ve="nodrag",noWheelClassName:$e="nowheel",noPanClassName:qe="nopan",fitView:Ke,fitViewOptions:Ye,connectOnClick:Xe,attributionPosition:Ge,proOptions:Ze,defaultEdgeOptions:Je,elevateNodesOnSelect:Qe=!0,elevateEdgesOnSelect:et=!1,disableKeyboardA11y:tt=!1,autoPanOnConnect:nt,autoPanOnNodeDrag:rt,autoPanSpeed:it,connectionRadius:ot,isValidConnection:st,onError:at,style:lt,id:ct,nodeDragThreshold:ut,connectionDragThreshold:dt,viewport:ht,onViewportChange:ft,width:pt,height:gt,colorMode:vt="light",debug:mt,onScroll:_t,ariaLabelConfig:yt,zIndexMode:bt="basic"}=t,xt=Ls(t,qv);const wt=ct||"1",St=function(t){var n;const[r,i]=(0,e.useState)("system"===t?null:t);return(0,e.useEffect)(()=>{if("system"!==t)return void i(t);const e=xm(),n=()=>i(null!==e&&void 0!==e&&e.matches?"dark":"light");return n(),null===e||void 0===e||e.addEventListener("change",n),()=>{null===e||void 0===e||e.removeEventListener("change",n)}},[t]),null!==r?r:null!==(n=xm())&&void 0!==n&&n.matches?"dark":"light"}(vt),Ct=(0,e.useCallback)(e=>{e.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),null===_t||void 0===_t||_t(e)},[_t]);return(0,rc.jsx)("div",Is(Is({"data-testid":"rf__wrapper"},xt),{},{onScroll:Ct,style:Is(Is({},lt),my),ref:n,className:_u(["react-flow",a,St]),id:ct,role:"application",children:(0,rc.jsxs)(vy,{nodes:r,edges:i,width:pt,height:gt,fitView:Ke,fitViewOptions:Ye,minZoom:de,maxZoom:he,nodeOrigin:se,nodeExtent:ge,zIndexMode:bt,children:[(0,rc.jsx)(hy,{onInit:h,onNodeClick:u,onEdgeClick:d,onNodeMouseEnter:x,onNodeMouseMove:w,onNodeMouseLeave:S,onNodeContextMenu:C,onNodeDoubleClick:k,nodeTypes:l,edgeTypes:c,connectionLineType:H,connectionLineStyle:W,connectionLineComponent:U,connectionLineContainerStyle:V,selectionKeyCode:q,selectionOnDrag:K,selectionMode:Y,deleteKeyCode:$,multiSelectionKeyCode:G,panActivationKeyCode:X,zoomActivationKeyCode:Z,onlyRenderVisibleElements:ee,defaultViewport:ue,translateExtent:fe,minZoom:de,maxZoom:he,preventScrolling:pe,zoomOnScroll:me,zoomOnPinch:_e,zoomOnDoubleClick:we,panOnScroll:ye,panOnScrollSpeed:be,panOnScrollMode:xe,panOnDrag:Se,onPaneClick:Ce,onPaneMouseEnter:ke,onPaneMouseMove:Ee,onPaneMouseLeave:Re,onPaneScroll:Me,onPaneContextMenu:Le,paneClickDistance:Pe,nodeClickDistance:Te,onSelectionContextMenu:j,onSelectionStart:B,onSelectionEnd:N,onReconnect:Oe,onReconnectStart:Ie,onReconnectEnd:Ae,onEdgeContextMenu:je,onEdgeDoubleClick:Be,onEdgeMouseEnter:Ne,onEdgeMouseMove:Fe,onEdgeMouseLeave:ze,reconnectRadius:He,defaultMarkerColor:ve,noDragClassName:Ve,noWheelClassName:$e,noPanClassName:qe,rfId:wt,disableKeyboardA11y:tt,nodeExtent:ge,viewport:ht,onViewportChange:ft}),(0,rc.jsx)(bm,{nodes:r,edges:i,defaultNodes:o,defaultEdges:s,onConnect:v,onConnectStart:m,onConnectEnd:_,onClickConnectStart:y,onClickConnectEnd:b,nodesDraggable:ne,autoPanOnNodeFocus:re,nodesConnectable:ie,nodesFocusable:oe,edgesFocusable:ae,edgesReconnectable:le,elementsSelectable:ce,elevateNodesOnSelect:Qe,elevateEdgesOnSelect:et,minZoom:de,maxZoom:he,nodeExtent:ge,onNodesChange:We,onEdgesChange:Ue,snapToGrid:J,snapGrid:Q,connectionMode:z,translateExtent:fe,connectOnClick:Xe,defaultEdgeOptions:Je,fitView:Ke,fitViewOptions:Ye,onNodesDelete:L,onEdgesDelete:P,onDelete:T,onNodeDragStart:E,onNodeDrag:R,onNodeDragStop:M,onSelectionDrag:I,onSelectionDragStart:O,onSelectionDragStop:A,onMove:f,onMoveStart:p,onMoveEnd:g,noPanClassName:qe,nodeOrigin:se,rfId:wt,autoPanOnConnect:nt,autoPanOnNodeDrag:rt,autoPanSpeed:it,onError:at,connectionRadius:ot,isValidConnection:st,selectNodesOnDrag:te,nodeDragThreshold:ut,connectionDragThreshold:dt,onBeforeDelete:F,debug:mt,ariaLabelConfig:yt,zIndexMode:bt}),(0,rc.jsx)(pm,{onSelectionChange:D}),De,(0,rc.jsx)(lm,{proOptions:Ze,position:Ge}),(0,rc.jsx)(sm,{rfId:wt,disableKeyboardA11y:tt})]})}))});kp();function yy(e){let{dimensions:t,lineWidth:n,variant:r,className:i}=e;return(0,rc.jsx)("path",{strokeWidth:n,d:"M".concat(t[0]/2," 0 V").concat(t[1]," M0 ").concat(t[1]/2," H").concat(t[0]),className:_u(["react-flow__background-pattern",r,i])})}function by(e){let{radius:t,className:n}=e;return(0,rc.jsx)("circle",{cx:t,cy:t,r:t,className:_u(["react-flow__background-pattern","dots",n])})}var xy;!function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"}(xy||(xy={}));const wy={[xy.Dots]:1,[xy.Lines]:1,[xy.Cross]:6},Sy=e=>({transform:e.transform,patternId:"pattern-".concat(e.rfId)});function Cy(t){let{id:n,variant:r=xy.Dots,gap:i=20,size:o,lineWidth:s=1,offset:a=0,color:l,bgColor:c,style:u,className:d,patternClassName:h}=t;const f=(0,e.useRef)(null),{transform:p,patternId:g}=Zv(Sy,Fv),v=o||wy[r],m=r===xy.Dots,_=r===xy.Cross,y=Array.isArray(i)?i:[i,i],b=[y[0]*p[2]||1,y[1]*p[2]||1],x=v*p[2],w=Array.isArray(a)?a:[a,a],S=_?[x,x]:b,C=[w[0]*p[2]||1+S[0]/2,w[1]*p[2]||1+S[1]/2],k="".concat(g).concat(n||"");return(0,rc.jsxs)("svg",{className:_u(["react-flow__background",d]),style:Is(Is(Is({},u),Vm),{},{"--xy-background-color-props":c,"--xy-background-pattern-color-props":l}),ref:f,"data-testid":"rf__background",children:[(0,rc.jsx)("pattern",{id:k,x:p[0]%b[0],y:p[1]%b[1],width:b[0],height:b[1],patternUnits:"userSpaceOnUse",patternTransform:"translate(-".concat(C[0],",-").concat(C[1],")"),children:m?(0,rc.jsx)(by,{radius:x/2,className:h}):(0,rc.jsx)(yy,{dimensions:S,lineWidth:s,variant:r,className:h})}),(0,rc.jsx)("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:"url(#".concat(k,")")})]})}Cy.displayName="Background";const ky=(0,e.memo)(Cy);function Ey(){return(0,rc.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:(0,rc.jsx)("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function Ry(){return(0,rc.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:(0,rc.jsx)("path",{d:"M0 0h32v4.2H0z"})})}function My(){return(0,rc.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:(0,rc.jsx)("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function Ly(){return(0,rc.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:(0,rc.jsx)("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function Py(){return(0,rc.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:(0,rc.jsx)("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function Ty(e){let{children:t,className:n}=e,r=Ls(e,Kv);return(0,rc.jsx)("button",Is(Is({type:"button",className:_u(["react-flow__controls-button",n])},r),{},{children:t}))}const Dy=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function Oy(e){let{style:t,showZoom:n=!0,showFitView:r=!0,showInteractive:i=!0,fitViewOptions:o,onZoomIn:s,onZoomOut:a,onFitView:l,onInteractiveChange:c,className:u,children:d,position:h="bottom-left",orientation:f="vertical","aria-label":p}=e;const g=Jv(),{isInteractive:v,minZoomReached:m,maxZoomReached:_,ariaLabelConfig:y}=Zv(Dy,Fv),{zoomIn:b,zoomOut:x,fitView:w}=Hm(),S="horizontal"===f?"horizontal":"vertical";return(0,rc.jsxs)(am,{className:_u(["react-flow__controls",S,u]),position:h,style:t,"data-testid":"rf__controls","aria-label":null!==p&&void 0!==p?p:y["controls.ariaLabel"],children:[n&&(0,rc.jsxs)(rc.Fragment,{children:[(0,rc.jsx)(Ty,{onClick:()=>{b(),null===s||void 0===s||s()},className:"react-flow__controls-zoomin",title:y["controls.zoomIn.ariaLabel"],"aria-label":y["controls.zoomIn.ariaLabel"],disabled:_,children:(0,rc.jsx)(Ey,{})}),(0,rc.jsx)(Ty,{onClick:()=>{x(),null===a||void 0===a||a()},className:"react-flow__controls-zoomout",title:y["controls.zoomOut.ariaLabel"],"aria-label":y["controls.zoomOut.ariaLabel"],disabled:m,children:(0,rc.jsx)(Ry,{})})]}),r&&(0,rc.jsx)(Ty,{className:"react-flow__controls-fitview",onClick:()=>{w(o),null===l||void 0===l||l()},title:y["controls.fitView.ariaLabel"],"aria-label":y["controls.fitView.ariaLabel"],children:(0,rc.jsx)(My,{})}),i&&(0,rc.jsx)(Ty,{className:"react-flow__controls-interactive",onClick:()=>{g.setState({nodesDraggable:!v,nodesConnectable:!v,elementsSelectable:!v}),null===c||void 0===c||c(!v)},title:y["controls.interactive.ariaLabel"],"aria-label":y["controls.interactive.ariaLabel"],children:v?(0,rc.jsx)(Py,{}):(0,rc.jsx)(Ly,{})}),d]})}Oy.displayName="Controls";(0,e.memo)(Oy);const Iy=(0,e.memo)(function(e){let{id:t,x:n,y:r,width:i,height:o,style:s,color:a,strokeColor:l,strokeWidth:c,className:u,borderRadius:d,shapeRendering:h,selected:f,onClick:p}=e;const{background:g,backgroundColor:v}=s||{},m=a||g||v;return(0,rc.jsx)("rect",{className:_u(["react-flow__minimap-node",{selected:f},u]),x:n,y:r,rx:d,ry:d,width:i,height:o,style:{fill:m,stroke:l,strokeWidth:c},shapeRendering:h,onClick:p?e=>p(e,t):void 0})}),Ay=e=>e.nodes.map(e=>e.id),jy=e=>e instanceof Function?e:()=>e;const By=(0,e.memo)(function(e){let{id:t,nodeColorFunc:n,nodeStrokeColorFunc:r,nodeClassNameFunc:i,nodeBorderRadius:o,nodeStrokeWidth:s,shapeRendering:a,NodeComponent:l,onClick:c}=e;const{node:u,x:d,y:h,width:f,height:p}=Zv(e=>{const{internals:n}=e.nodeLookup.get(t),r=n.userNode,{x:i,y:o}=n.positionAbsolute,{width:s,height:a}=gg(r);return{node:r,x:i,y:o,width:s,height:a}},Fv);return u&&!u.hidden&&vg(u)?(0,rc.jsx)(l,{x:d,y:h,width:f,height:p,style:u.style,selected:!!u.selected,className:i(u),color:n(u),borderRadius:o,strokeColor:r(u),strokeWidth:s,shapeRendering:a,onClick:c,id:u.id}):null});var Ny=(0,e.memo)(function(e){let{nodeStrokeColor:t,nodeColor:n,nodeClassName:r="",nodeBorderRadius:i=5,nodeStrokeWidth:o,nodeComponent:s=Iy,onClick:a}=e;const l=Zv(Ay,Fv),c=jy(n),u=jy(t),d=jy(r),h="undefined"===typeof window||window.chrome?"crispEdges":"geometricPrecision";return(0,rc.jsx)(rc.Fragment,{children:l.map(e=>(0,rc.jsx)(By,{id:e,nodeColorFunc:c,nodeStrokeColorFunc:u,nodeClassNameFunc:d,nodeBorderRadius:i,nodeStrokeWidth:o,NodeComponent:s,onClick:a,shapeRendering:h},e))})});const Fy=e=>!e.hidden,zy=e=>{const t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:t,boundingRect:e.nodeLookup.size>0?rg(Wp(e.nodeLookup,{filter:Fy}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}};function Hy(t){var n,r;let{style:i,className:o,nodeStrokeColor:s,nodeColor:a,nodeClassName:l="",nodeBorderRadius:c=5,nodeStrokeWidth:u,nodeComponent:d,bgColor:h,maskColor:f,maskStrokeColor:p,maskStrokeWidth:g,position:v="bottom-right",onClick:m,onNodeClick:_,pannable:y=!1,zoomable:b=!1,ariaLabel:x,inversePan:w,zoomStep:S=1,offsetScale:C=5}=t;const k=Jv(),E=(0,e.useRef)(null),{boundingRect:R,viewBB:M,rfId:L,panZoom:P,translateExtent:T,flowWidth:D,flowHeight:O,ariaLabelConfig:I}=Zv(zy,Fv),A=null!==(n=null===i||void 0===i?void 0:i.width)&&void 0!==n?n:200,j=null!==(r=null===i||void 0===i?void 0:i.height)&&void 0!==r?r:150,B=R.width/A,N=R.height/j,F=Math.max(B,N),z=F*A,H=F*j,W=C*F,U=R.x-(z-R.width)/2-W,V=R.y-(H-R.height)/2-W,$=z+2*W,q=H+2*W,K="".concat("react-flow__minimap-desc","-").concat(L),Y=(0,e.useRef)(0),X=(0,e.useRef)();Y.current=F,(0,e.useEffect)(()=>{if(E.current&&P)return X.current=function(e){let{domNode:t,panZoom:n,getTransform:r,getViewScale:i}=e;const o=Nd(t);return{update:function(e){let{translateExtent:t,width:s,height:a,zoomStep:l=1,pannable:c=!0,zoomable:u=!0,inversePan:d=!1}=e,h=[0,0];const f=lp().on("start",e=>{var t,n;"mousedown"!==e.sourceEvent.type&&"touchstart"!==e.sourceEvent.type||(h=[null!==(t=e.sourceEvent.clientX)&&void 0!==t?t:e.sourceEvent.touches[0].clientX,null!==(n=e.sourceEvent.clientY)&&void 0!==n?n:e.sourceEvent.touches[0].clientY])}).on("zoom",c?e=>{var o,l;const c=r();if("mousemove"!==e.sourceEvent.type&&"touchmove"!==e.sourceEvent.type||!n)return;const u=[null!==(o=e.sourceEvent.clientX)&&void 0!==o?o:e.sourceEvent.touches[0].clientX,null!==(l=e.sourceEvent.clientY)&&void 0!==l?l:e.sourceEvent.touches[0].clientY],f=[u[0]-h[0],u[1]-h[1]];h=u;const p=i()*Math.max(c[2],Math.log(c[2]))*(d?-1:1),g={x:c[0]-f[0]*p,y:c[1]-f[1]*p},v=[[0,0],[s,a]];n.setViewportConstrained({x:g.x,y:g.y,zoom:c[2]},v,t)}:null).on("zoom.wheel",u?e=>{if("wheel"!==e.sourceEvent.type||!n)return;const t=r(),i=e.sourceEvent.ctrlKey&&fg()?10:1,o=-e.sourceEvent.deltaY*(1===e.sourceEvent.deltaMode?.05:e.sourceEvent.deltaMode?1:.002)*l,s=t[2]*Math.pow(2,o*i);n.scaleTo(s)}:null);o.call(f,{})},destroy:function(){o.on("zoom",null)},pointer:Fd}}({domNode:E.current,panZoom:P,getTransform:()=>k.getState().transform,getViewScale:()=>Y.current}),()=>{var e;null===(e=X.current)||void 0===e||e.destroy()}},[P]),(0,e.useEffect)(()=>{var e;null===(e=X.current)||void 0===e||e.update({translateExtent:T,width:D,height:O,inversePan:w,pannable:y,zoomStep:S,zoomable:b})},[y,b,w,S,T,D,O]);const G=m?e=>{var t;const[n,r]=(null===(t=X.current)||void 0===t?void 0:t.pointer(e))||[0,0];m(e,{x:n,y:r})}:void 0,Z=_?(0,e.useCallback)((e,t)=>{const n=k.getState().nodeLookup.get(t).internals.userNode;_(e,n)},[]):void 0,J=null!==x&&void 0!==x?x:I["minimap.ariaLabel"];return(0,rc.jsx)(am,{position:v,style:Is(Is({},i),{},{"--xy-minimap-background-color-props":"string"===typeof h?h:void 0,"--xy-minimap-mask-background-color-props":"string"===typeof f?f:void 0,"--xy-minimap-mask-stroke-color-props":"string"===typeof p?p:void 0,"--xy-minimap-mask-stroke-width-props":"number"===typeof g?g*F:void 0,"--xy-minimap-node-background-color-props":"string"===typeof a?a:void 0,"--xy-minimap-node-stroke-color-props":"string"===typeof s?s:void 0,"--xy-minimap-node-stroke-width-props":"number"===typeof u?u:void 0}),className:_u(["react-flow__minimap",o]),"data-testid":"rf__minimap",children:(0,rc.jsxs)("svg",{width:A,height:j,viewBox:"".concat(U," ").concat(V," ").concat($," ").concat(q),className:"react-flow__minimap-svg",role:"img","aria-labelledby":K,ref:E,onClick:G,children:[J&&(0,rc.jsx)("title",{id:K,children:J}),(0,rc.jsx)(Ny,{onClick:Z,nodeColor:a,nodeStrokeColor:s,nodeBorderRadius:c,nodeClassName:l,nodeStrokeWidth:u,nodeComponent:d}),(0,rc.jsx)("path",{className:"react-flow__minimap-mask",d:"M".concat(U-W,",").concat(V-W,"h").concat($+2*W,"v").concat(q+2*W,"h").concat(-$-2*W,"z\n M").concat(M.x,",").concat(M.y,"h").concat(M.width,"v").concat(M.height,"h").concat(-M.width,"z"),fillRule:"evenodd",pointerEvents:"none"})]})})}Hy.displayName="MiniMap";(0,e.memo)(Hy);const Wy={[xv.Line]:"right",[xv.Handle]:"bottom-right"};(0,e.memo)(function(t){let{nodeId:n,position:r,variant:i=xv.Handle,className:o,style:s,children:a,color:l,minWidth:c=10,minHeight:u=10,maxWidth:d=Number.MAX_VALUE,maxHeight:h=Number.MAX_VALUE,keepAspectRatio:f=!1,resizeDirection:p,autoScale:g=!0,shouldResize:v,onResizeStart:m,onResize:_,onResizeEnd:y}=t;const b=r_(),x="string"===typeof n?n:b,w=Jv(),S=(0,e.useRef)(null),C=i===xv.Handle,k=Zv((0,e.useCallback)((E=C&&g,e=>E?"".concat(Math.max(1/e.transform[2],1)):void 0),[C,g]),Fv);var E;const R=(0,e.useRef)(null),M=null!==r&&void 0!==r?r:Wy[i];(0,e.useEffect)(()=>{if(S.current&&x)return R.current||(R.current=Pv({domNode:S.current,nodeId:x,getStoreItems:()=>{const{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:r,nodeOrigin:i,domNode:o}=w.getState();return{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:r,nodeOrigin:i,paneDomNode:o}},onChange:(e,t)=>{const{triggerNodeChanges:n,nodeLookup:r,parentLookup:i,nodeOrigin:o}=w.getState(),s=[],a={x:e.x,y:e.y},l=r.get(x);if(l&&l.expandParent&&l.parentId){var c,u,d,h,f,g,v;const t=null!==(c=l.origin)&&void 0!==c?c:o,n=null!==(u=null!==(d=e.width)&&void 0!==d?d:l.measured.width)&&void 0!==u?u:0,p=null!==(h=null!==(f=e.height)&&void 0!==f?f:l.measured.height)&&void 0!==h?h:0,m=ev([{id:l.id,parentId:l.parentId,rect:Is({width:n,height:p},mg({x:null!==(g=e.x)&&void 0!==g?g:l.position.x,y:null!==(v=e.y)&&void 0!==v?v:l.position.y},{width:n,height:p},l.parentId,r,t))}],r,i,o);s.push(...m),a.x=e.x?Math.max(t[0]*n,e.x):void 0,a.y=e.y?Math.max(t[1]*p,e.y):void 0}if(void 0!==a.x&&void 0!==a.y){const e={id:x,type:"position",position:Is({},a)};s.push(e)}if(void 0!==e.width&&void 0!==e.height){const t={id:x,type:"dimensions",resizing:!0,setAttributes:!p||("horizontal"===p?"width":"height"),dimensions:{width:e.width,height:e.height}};s.push(t)}for(const p of t){const e=Is(Is({},p),{},{type:"position"});s.push(e)}n(s)},onEnd:e=>{let{width:t,height:n}=e;const r={id:x,type:"dimensions",resizing:!1,dimensions:{width:t,height:n}};w.getState().triggerNodeChanges([r])}})),R.current.update({controlPosition:M,boundaries:{minWidth:c,minHeight:u,maxWidth:d,maxHeight:h},keepAspectRatio:f,resizeDirection:p,onResizeStart:m,onResize:_,onResizeEnd:y,shouldResize:v}),()=>{var e;null===(e=R.current)||void 0===e||e.destroy()}},[M,c,u,d,h,f,m,_,y,v]);const L=M.split("-");return(0,rc.jsx)("div",{className:_u(["react-flow__resize-control","nodrag",...L,i,o]),ref:S,style:Is(Is({},s),{},{scale:k},l&&{[C?"backgroundColor":"borderColor"]:l}),children:a})});const Uy=172,Vy=600,$y=(e,t)=>{const n=new Map,r=new Map,i=new Set(e.map(e=>e.id));e.forEach(e=>{n.set(e.id,[])}),t.forEach(e=>{if(i.has(e.source)&&i.has(e.target)){const t=n.get(e.source)||[];t.push(e.target),n.set(e.source,t),r.set(e.target,e.source)}});const o=e.filter(e=>!r.has(e.id)),s=new Map,a=new Map,l=e=>{if(a.has(e))return a.get(e);const t=(n.get(e)||[]).filter(e=>i.has(e));if(0===t.length)return a.set(e,36),36;let r=0;return t.forEach((e,t)=>{t>0&&(r+=10),r+=l(e)}),a.set(e,r),r},c=new Map,u=(e,t)=>{c.set(e,t);(n.get(e)||[]).filter(e=>i.has(e)).forEach(e=>{u(e,t+1)})};o.forEach(e=>{u(e.id,0)});const d=(e,t,r)=>{const o=(n.get(e)||[]).filter(e=>i.has(e));if(0===o.length)return s.set(e,{x:242*r,y:t}),t+36;let a=t;o.forEach(e=>{const t=l(e);d(e,a,r+1),a+=t+10});const c=(s.get(o[0]).y+s.get(o[o.length-1]).y)/2;return s.set(e,{x:242*r,y:c}),a-10};let h=0;if(o.forEach((e,t)=>{t>0&&(h+=10);const n=l(e.id);d(e.id,h,0),h+=n}),s.size>0){const e=Array.from(s.values()).map(e=>e.y),t=-(Math.min(...e)+Math.max(...e))/2;s.forEach((e,n)=>{s.set(n,{x:e.x,y:e.y+t})})}const f=e.map(e=>{const t=s.get(e.id)||{x:0,y:0};return Is(Is({},e),{},{targetPosition:"left",sourcePosition:"right",position:{x:t.x-86,y:t.y-18},style:Is(Is({},e.style),{},{transition:"transform ".concat(Vy,"ms ease-out, left ").concat(Vy,"ms ease-out, top ").concat(Vy,"ms ease-out")})})});return{nodes:f,edges:t.map(e=>Is(Is({},e),{},{type:"step"}))}};const qy=function(t){let{isOpen:n,onClose:r,filePath:i,inline:o=!1}=t;const[a,l]=(0,e.useState)(""),[c,u]=(0,e.useState)(""),[d,h]=(0,e.useState)(!1),[f,p]=(0,e.useState)(!1),[g,v]=(0,e.useState)(null),[m,_]=(0,e.useState)(null),y=(0,e.useRef)(r),b=(0,e.useRef)(null),x=a!==c;(0,e.useEffect)(()=>{y.current=r},[r]),(0,e.useEffect)(()=>{n&&i?w():(l(""),u(""),v(null),_(null))},[n,i]),(0,e.useEffect)(()=>{if(!n)return;const e=e=>{"Escape"===e.key&&C(),(e.metaKey||e.ctrlKey)&&"s"===e.key&&(e.preventDefault(),a===c||f||S())};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[n,x,a,c,f]);const w=async()=>{h(!0),v(null),_(null);try{const e=i.split("/"),t=e.length>1?e.slice(1).join("/"):i,n=encodeURIComponent(t),r=await fetch("http://localhost:3001/read?path=".concat(n),{method:"GET",mode:"cors"});if(!r.ok)throw new Error("Failed to read file: ".concat(r.status," ").concat(r.statusText));const o=r.headers.get("content-type");let a="";if(o&&o.includes("application/json")){const e=await r.json();a=e.content||e||""}else{const e=await r.text();try{const t=JSON.parse(e);a=t.content||t||""}catch(s){a=e}}l(a),u(a)}catch(e){console.error("Error fetching file content:",e),v(e.message),l(""),u("")}finally{h(!1)}},S=async()=>{p(!0),_(null);try{const e=i.split("/"),t=e.length>1?e.slice(1).join("/"):i,n=await fetch("http://localhost:3001/write",{method:"POST",headers:{"Content-Type":"application/json"},mode:"cors",body:JSON.stringify({path:t,content:a})});if(!n.ok)throw new Error("Failed to save file: ".concat(n.status," ").concat(n.statusText));u(a),_({type:"success",message:"Saved!"}),setTimeout(()=>_(null),2e3)}catch(e){console.error("Error saving file:",e),_({type:"error",message:e.message})}finally{p(!1)}},C=()=>{x?window.confirm("You have unsaved changes. Are you sure you want to close?")&&r():r()};if(!n)return null;const k=i.split("/").pop(),E=(e=>{var t;return e&&{js:"javascript",jsx:"javascript",ts:"typescript",tsx:"typescript",py:"python",java:"java",cpp:"cpp",c:"c",h:"c",html:"html",htm:"html",css:"css",scss:"scss",less:"less",json:"json",xml:"xml",md:"markdown",sh:"shell",bash:"shell",yaml:"yaml",yml:"yaml",sql:"sql",go:"go",rs:"rust",rb:"ruby",php:"php",swift:"swift",kt:"kotlin",scala:"scala",r:"r"}[(null===(t=e.split(".").pop())||void 0===t?void 0:t.toLowerCase())||""]||"plaintext"})(i),R=(0,rc.jsxs)("div",{style:{background:"#1e1e1e",borderRadius:o?"0":"12px",boxShadow:o?"none":"0 8px 32px rgba(0, 0, 0, 0.4)",width:o?"100%":"90%",maxWidth:o?"none":"1200px",height:o?"100%":"85vh",overflow:"hidden",display:"flex",flexDirection:"column"},onClick:e=>e.stopPropagation(),children:[!o&&(0,rc.jsxs)("div",{style:{padding:"12px 20px",borderBottom:"1px solid #3c3c3c",display:"flex",alignItems:"center",justifyContent:"space-between",background:"#252526"},children:[(0,rc.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"8px",fontSize:"14px",fontWeight:"500",color:"#e1e1e1",fontFamily:'Monaco, Menlo, "Courier New", monospace'},children:[(0,rc.jsx)("span",{children:"\ud83d\udcc4"}),(0,rc.jsx)("span",{children:k}),x&&(0,rc.jsx)("span",{style:{width:"8px",height:"8px",borderRadius:"50%",background:"#f59e0b"},title:"Unsaved changes"})]}),(0,rc.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"16px"},children:[f?(0,rc.jsx)("span",{style:{fontSize:"12px",color:"#9ca3af",fontFamily:"monospace"},children:"Saving..."}):m?(0,rc.jsx)("span",{style:{fontSize:"12px",color:"success"===m.type?"#22c55e":"#ef4444",fontFamily:"monospace"},children:m.message}):x?(0,rc.jsxs)("span",{style:{fontSize:"12px",color:"#9ca3af",fontFamily:"monospace"},children:[(0,rc.jsx)("kbd",{style:{background:"#3c3c3c",padding:"2px 6px",borderRadius:"4px",fontSize:"11px",border:"1px solid #4a4a4a"},children:"\u2318S"})," to save"]}):null,(0,rc.jsx)("button",{onClick:C,style:{background:"transparent",border:"none",cursor:"pointer",padding:"4px 8px",color:"#9ca3af",fontSize:"18px",borderRadius:"4px"},onMouseEnter:e=>{e.currentTarget.style.background="#3c3c3c",e.currentTarget.style.color="#e1e1e1"},onMouseLeave:e=>{e.currentTarget.style.background="transparent",e.currentTarget.style.color="#9ca3af"},children:"\xd7"})]})]}),(0,rc.jsx)("div",{style:{flex:1,overflow:"hidden"},children:d?(0,rc.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%",color:"#9ca3af",fontSize:"14px"},children:"Loading file..."}):g?(0,rc.jsxs)("div",{style:{padding:"20px",background:"#3c1f1f",color:"#ef4444",borderRadius:"6px",fontSize:"13px",margin:"20px"},children:["Error: ",g]}):(0,rc.jsx)(vu,{height:"100%",language:E,value:a,theme:"vs-dark",onMount:(e,t)=>{b.current=e,e.addCommand(t.KeyMod.CtrlCmd|t.KeyCode.KeyS,()=>{a===c||f||S()}),e.focus()},onChange:e=>{l(e||"")},options:{minimap:{enabled:!1},fontSize:13,lineNumbers:"on",scrollBeyondLastLine:!1,wordWrap:"off",automaticLayout:!0,tabSize:2,folding:!0,lineNumbersMinChars:4,padding:{top:o?48:16}}})}),!o&&(0,rc.jsxs)("div",{style:{padding:"10px 20px",borderTop:"1px solid #3c3c3c",background:"#252526",display:"flex",alignItems:"center",justifyContent:"space-between",fontSize:"12px",color:"#858585",fontFamily:'Monaco, Menlo, "Courier New", monospace'},children:[(0,rc.jsx)("span",{children:i}),(0,rc.jsxs)("span",{children:[a.split("\n").length," lines \u2022 ",E]})]})]});return o?R:(0,zv.createPortal)((0,rc.jsx)("div",{onClick:e=>{e.target===e.currentTarget&&C()},style:{position:"fixed",top:0,left:0,right:0,bottom:0,background:"rgba(0, 0, 0, 0.6)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:2e3},children:R}),document.body)},Ky=e=>{const t=e.lastIndexOf(".");return-1===t||t===e.length-1?{baseName:e,extension:""}:{baseName:e.substring(0,t),extension:e.substring(t)}},Yy=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:16;return!e||e.length<=t?e:e.substring(0,t-1)+"\u2026"},Xy=t=>{var n;let{id:r,data:i,selected:o}=t;const a=i.hasIncoming||!1,[l,c]=(i.hasOutgoing,(0,e.useState)(!1)),[u,d]=(0,e.useState)(null),[h,f]=(0,e.useState)(!1),p=i.children||[],g=!!Array.isArray(p)&&p.length>0,v=null===(n=i.originalNode)||void 0===n?void 0:n.type,m=i.path&&i.path.endsWith(".class"),_=r&&"string"===typeof r&&r.includes(".class"),y="class"===v||m||_,b=i.path&&i.path.endsWith(".method"),x=r&&"string"===typeof r&&r.includes(".method"),w="method"===v||b||x,S=i.path&&i.path.endsWith(".function"),C=r&&"string"===typeof r&&r.includes(".function"),k="function"===v||S||C,E=((e,t)=>{const n=e||t||"",r=n.lastIndexOf(".");return-1===r||r===n.length-1?"":n.substring(r+1).toLowerCase()})(i.path,i.label),R=""!==E,M=g&&p.every(e=>{const t=e.type||e.originalNode&&e.originalNode.type;return"function"===t||"method"===t||"class"===t}),L=(!R||g&&!M)&&!y,P=void 0===i.isCollapsed||i.isCollapsed,T=L||y||w||k?null:E,D=L||y||w||k?null:(e=>"py"===e?"/icons/Python-logo-notext.svg":null)(T);let O=i.label,{baseName:I,extension:A}=Ky(i.label);if(y&&i.label.endsWith(".class"))O=i.label.substring(0,i.label.length-6),I=O;else if(w&&i.label.endsWith(".method")){const e=i.label.substring(0,i.label.length-7),t=e.lastIndexOf(".");O=-1!==t?e.substring(t+1):e,I=O}const j=L||y||w?null:A?(e=>{const t={js:"#f7df1e",jsx:"#61dafb",ts:"#3178c6",tsx:"#3178c6",html:"#e34c26",css:"#264de4",scss:"#cc6699",sass:"#cc6699",py:"#3776ab",pyw:"#3776ab",java:"#ed8b00",c:"#00599c",cpp:"#00599c",h:"#00599c",hpp:"#00599c",json:"#22c55e",xml:"#ff6600",yaml:"#cb171e",yml:"#cb171e",md:"#083fa1",markdown:"#083fa1",sh:"#89e051",bash:"#89e051",zsh:"#89e051",sql:"#336791",go:"#00add8",rs:"#000000",php:"#777bb4",rb:"#cc342d",swift:"#fa7343",kt:"#7f52ff",default:"#666666"};return t[e]||t.default})(T):null,B=e=>{e.stopPropagation(),g&&(i.onToggle?i.onToggle(r):i.onExpand&&i.onExpand(r))};(0,e.useEffect)(()=>{if(L||y||w||k||!i.path)return void d(null);(async()=>{try{const e=i.path.split("/"),t=e.length>1?e.slice(1).join("/"):i.path,n=encodeURIComponent(t),r=await fetch("http://localhost:3001/read?path=".concat(n),{method:"GET",mode:"cors"});if(!r.ok)return;const o=r.headers.get("content-type");let a="";if(o&&o.includes("application/json")){const e=await r.json();a=e.content||e||""}else{const e=await r.text();try{const t=JSON.parse(e);a=t.content||t||""}catch(s){a=e}}const l=0===a.length?0:a.split("\n").length;d(l)}catch(e){console.error("Error fetching line count:",e)}})()},[L,y,w,k,i.path]);const N=g?"pointer":"default";if(L){const e=i.fileCount||0;return(0,rc.jsxs)("div",{style:{cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"flex-start",gap:"8px",minWidth:"".concat(Uy,"px"),width:"100%",height:"100%",userSelect:"none",backgroundColor:"#e6f3ff",borderRadius:"8px",padding:"8px 12px",position:"relative",boxSizing:"border-box",transition:"opacity 0.2s ease, filter 0.2s ease"},onClick:B,onMouseDown:e=>e.stopPropagation(),onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),children:[(0,rc.jsx)("span",{style:{fontSize:"16px",userSelect:"none",flexShrink:0},children:P?"\ud83d\udcc1":"\ud83d\udcc2"}),a&&(0,rc.jsx)(o_,{type:"target",position:jp.Left}),(0,rc.jsx)("span",{style:{fontSize:"16px",userSelect:"none",flex:1,fontWeight:P?"bold":"normal"},title:i.label,children:Yy(i.label)}),e>0&&(0,rc.jsxs)("span",{style:{fontSize:"14px",userSelect:"none",color:"#666",flexShrink:0,marginRight:"4px"},children:["(",e,")"]}),(0,rc.jsx)(o_,{type:"source",position:jp.Right})]})}return(0,rc.jsxs)("div",{onClick:g?B:void 0,onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),style:{cursor:N,display:"flex",flexDirection:"row",alignItems:"center",gap:"8px",position:"relative",transition:"opacity 0.2s ease, filter 0.2s ease"},children:[(0,rc.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"8px",minWidth:"".concat(Uy,"px"),cursor:N,borderRadius:"8px",boxSizing:"border-box",width:"100%",backgroundColor:"transparent",padding:"0",transition:"opacity 0.2s ease, filter 0.2s ease"},children:[(0,rc.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"4px",flexShrink:0},children:[a&&(0,rc.jsx)(o_,{type:"target",position:jp.Left}),A&&(0,rc.jsx)("span",{style:{color:j,fontWeight:"600"},children:A})]}),(0,rc.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"8px",flex:1,minWidth:0},children:["json"===T&&(0,rc.jsx)("span",{style:{color:"#22c55e",fontWeight:"bold",fontSize:"16px",flexShrink:0},children:"{}"}),"csv"===T&&(0,rc.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",style:{width:"16px",height:"16px",flexShrink:0,color:"#22c55e"},children:(0,rc.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.375 19.5h17.25m-17.25 0a1.125 1.125 0 0 1-1.125-1.125M3.375 19.5h7.5c.621 0 1.125-.504 1.125-1.125m-9.75 0V5.625m0 12.75v-1.5c0-.621.504-1.125 1.125-1.125m18.375 2.625V5.625m0 12.75c0 .621-.504 1.125-1.125 1.125m1.125-1.125v-1.5c0-.621-.504-1.125-1.125-1.125m0 3.75h-7.5A1.125 1.125 0 0 1 12 18.375m9.75-12.75c0-.621-.504-1.125-1.125-1.125H3.375c-.621 0-1.125.504-1.125 1.125m19.5 0v1.5c0 .621-.504 1.125-1.125 1.125M2.25 5.625v1.5c0 .621.504 1.125 1.125 1.125m0 0h17.25m-17.25 0h7.5c.621 0 1.125.504 1.125 1.125M3.375 8.25c-.621 0-1.125.504-1.125 1.125v1.5c0 .621.504 1.125 1.125 1.125m17.25-3.75h-7.5c-.621 0-1.125.504-1.125 1.125m8.625-1.125c.621 0 1.125.504 1.125 1.125v1.5c0 .621-.504 1.125-1.125 1.125m-17.25 0h7.5m-7.5 0c-.621 0-1.125.504-1.125 1.125v1.5c0 .621.504 1.125 1.125 1.125M12 10.875v-1.5m0 1.5c0 .621-.504 1.125-1.125 1.125M12 10.875c0 .621.504 1.125 1.125 1.125m-2.25 0c.621 0 1.125.504 1.125 1.125M13.125 12h7.5m-7.5 0c-.621 0-1.125.504-1.125 1.125M20.625 12c.621 0 1.125.504 1.125 1.125v1.5c0 .621-.504 1.125-1.125 1.125m-17.25 0h7.5M12 14.625v-1.5m0 1.5c0 .621-.504 1.125-1.125 1.125M12 14.625c0 .621.504 1.125 1.125 1.125m-2.25 0c.621 0 1.125.504 1.125 1.125m0 1.5v-1.5m0 0c0-.621.504-1.125 1.125-1.125m0 0h7.5"})}),D&&(0,rc.jsx)("img",{src:D,alt:"".concat(T," icon"),style:{width:"16px",height:"16px",flexShrink:0}}),(0,rc.jsx)("span",{style:{fontSize:"16px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontWeight:g&&P||y&&P||w&&P?"bold":"normal",userSelect:"none",flex:1},title:y||w?O:I,children:Yy(y||w?O:I)})]}),(0,rc.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"4px",flexShrink:0},children:[null!==u&&!k&&(()=>{const e=function(e){return e<50?{fontSize:"10px",color:"#666",background:"transparent",fontWeight:"normal",icon:null,padding:"2px 6px",borderRadius:"10px",fontFamily:"monospace",whiteSpace:"nowrap",flexShrink:0}:e<200?{fontSize:"11px",color:"#666",background:"transparent",fontWeight:"normal",icon:null,padding:"2px 6px",borderRadius:"10px",fontFamily:"monospace",whiteSpace:"nowrap",flexShrink:0}:e<500?{fontSize:"12px",color:"#666",background:"transparent",fontWeight:"normal",icon:null,padding:"2px 6px",borderRadius:"10px",fontFamily:"monospace",whiteSpace:"nowrap",flexShrink:0}:e<1e3?{fontSize:"12px",color:"#666",background:"transparent",fontWeight:"bold",icon:null,padding:"2px 6px",borderRadius:"10px",fontFamily:"monospace",whiteSpace:"nowrap",flexShrink:0}:{fontSize:"13px",color:"#666",background:"transparent",fontWeight:"bold",icon:null,padding:"2px 6px",borderRadius:"10px",fontFamily:"monospace",whiteSpace:"nowrap",flexShrink:0}}(u);return(0,rc.jsx)("span",{style:e,children:e.icon&&(0,rc.jsx)("span",{style:{marginRight:"2px"},children:e.icon})})})(),l&&i.path&&!y&&!w&&!k&&(0,rc.jsx)("button",{onClick:async e=>{if(e.stopPropagation(),i.path)if(hc.openInCursor)try{const e=await fetch("http://localhost:3001/open-cursor",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:i.path,line:1})});if(!e.ok){const t=await e.json();throw new Error(t.error||"Failed to open Cursor")}}catch(t){console.error("Failed to open in Cursor:",t)}else i.onOpenCodeView?i.onOpenCodeView(i.path):f(!0)},style:{padding:"2px",backgroundColor:"transparent",border:"none",borderRadius:"4px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center"},title:hc.openInCursor?"Open in Cursor":"View File",children:(0,rc.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",style:{width:"16px",height:"16px"},children:(0,rc.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13.5 6H5.25A2.25 2.25 0 0 0 3 8.25v10.5A2.25 2.25 0 0 0 5.25 21h10.5A2.25 2.25 0 0 0 18 18.75V10.5m-10.5 6L21 3m0 0h-5.25M21 3v5.25"})})})]}),(0,rc.jsx)(o_,{type:"source",position:jp.Right})]}),i.path&&(0,rc.jsx)(qy,{isOpen:h,onClose:()=>f(!1),filePath:i.path})]})},Gy=t=>{let{nodes:n,edges:r,isReady:i}=t;const{fitView:o}=Hm(),s=(0,e.useRef)(!1);return(0,e.useEffect)(()=>{if(s.current)return;if(!i)return;const e=setTimeout(()=>{o({padding:.1,duration:Vy}),s.current=!0},0);return()=>clearTimeout(e)},[n,r,o,i]),null},Zy={universal:Xy};function Jy(t){let{rootTree:n,onTreeRefresh:r,onOpenCodeView:i}=t;const o=(0,e.useCallback)((e,t)=>{for(const n of e){if(n.id===t)return n;if(n.children){const e=o(n.children,t);if(e)return e}}return null},[]),a=(0,e.useCallback)(e=>{if(!e||!e.children)return 0;let t=0;return e.children.forEach(e=>{"file"===e.type||"function"===e.type?t++:"folder"===e.type&&(t+=a(e))}),t},[]),{initialNodes:l,initialEdges:c}=(0,e.useMemo)(()=>{if(!n||0===n.length)return{initialNodes:[],initialEdges:[]};try{const{nodes:e,edges:t}=function(e){const t=[],n=[];return function e(r){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;r&&Array.isArray(r)&&r.forEach(r=>{const o=r.children&&(Array.isArray(r.children)?r.children.length>0:Object.keys(r.children).length>0),s=Array.isArray(r.children)?r.children:r.children?Object.values(r.children):[];let a;"function"===r.type?a="function-node":"method"===r.type?a="method-node":"class"===r.type?a="class-node":"folder"===r.type&&(a="folder-node");const l={id:r.id,type:"universal",className:a,data:{label:r.name,path:r.path,hasChildren:o,children:s,originalNode:r}};if(t.push(l),null!==i){let e=null;"class"===r.type?e="class-edge":"method"===r.type&&(e="method-edge"),n.push({id:"e".concat(i,"-").concat(r.id),source:i,target:r.id,type:"step",className:e})}o&&("folder"===r.type||"class"===r.type||"file"===r.type&&r.children)&&e(r.children,r.id)})}(e),{nodes:t,edges:n}}(n);return{initialNodes:e,initialEdges:t}}catch(e){return console.error("Error generating elements:",e),{initialNodes:[],initialEdges:[]}}},[n]);(0,e.useEffect)(()=>{if(l.length>0){const e=l.map(e=>{var t,n;return{id:e.id,label:null===(t=e.data)||void 0===t?void 0:t.label,path:null===(n=e.data)||void 0===n?void 0:n.path,type:e.type}});localStorage.setItem("availableFiles",JSON.stringify(e)),window.dispatchEvent(new Event("availableFilesUpdated"))}},[l]);const[u,d]=(0,e.useState)({}),h=(0,e.useRef)(!1),{nodes:f,edges:p}=(0,e.useMemo)(()=>0===l.length?{nodes:[],edges:[]}:$y(l,c),[l,c]),[g,v,m]=function(t){const[n,r]=(0,e.useState)(t),i=(0,e.useCallback)(e=>r(t=>Mm(e,t)),[]);return[n,r,i]}(f),[_,y,b]=function(t){const[n,r]=(0,e.useState)(t),i=(0,e.useCallback)(e=>r(t=>Lm(e,t)),[]);return[n,r,i]}(p),x=(0,e.useRef)(null),w=Jv(),{screenToFlowPosition:S,getInternalNode:C,fitView:k}=Hm(),E=(0,e.useCallback)(e=>{d(t=>Is(Is({},t),{},{[e]:!t[e]}))},[]),R=(0,e.useCallback)(function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Set;if(n.has(e))return new Set;n.add(e);const r=new Set;return t.filter(t=>t.source===e).forEach(e=>{const i=e.target;r.add(i);R(i,t,n).forEach(e=>r.add(e))}),r},[]),M=(0,e.useCallback)(e=>{var t,n;if((null===e||void 0===e||null===(t=e.data)||void 0===t?void 0:t.hasChildren)||(null===e||void 0===e||null===(n=e.data)||void 0===n?void 0:n.children)&&e.data.children.length>0)return null;const{nodeLookup:r}=w.getState(),i=C(e.id);if(!i)return null;const o=Array.from(r.values()).reduce((e,t)=>{var n,r;const o=(null===(n=t.data)||void 0===n?void 0:n.hasChildren)||(null===(r=t.data)||void 0===r?void 0:r.children)&&t.data.children.length>0;if(t.id!==i.id&&o){const n=C(t.id);if(!n)return e;const r=n.internals.positionAbsolute.x-i.internals.positionAbsolute.x,o=n.internals.positionAbsolute.y-i.internals.positionAbsolute.y,s=Math.sqrt(r*r+o*o);s<e.distance&&s<150&&(e.distance=s,e.node=t)}return e},{distance:Number.MAX_VALUE,node:null});return o.node?{id:"".concat(e.id,"-").concat(o.node.id),source:e.id,target:o.node.id}:null},[w,C]),L=(0,e.useCallback)(async e=>{if(!e)return console.error("Missing path for deletion"),!1;try{const t=e.split("/"),n=t.length>1?t.slice(1).join("/"):e,i=await fetch("http://localhost:3001/delete",{method:"POST",headers:{"Content-Type":"application/json"},mode:"cors",body:JSON.stringify({path:n})});if(!i.ok){const e=await i.json().catch(()=>({error:"Unknown error"}));throw new Error(e.error||"Failed to delete: ".concat(i.status))}return r&&r(),!0}catch(t){return console.error("Error deleting node:",t),alert("Failed to delete: ".concat(t.message)),!1}},[r]),P=(0,e.useCallback)(async(e,t)=>{if(!e||!t)return console.error("Missing path or new filename for rename"),!1;try{const n=e.split("/"),i=(n.pop(),n.join("/")),o=i?"".concat(i,"/").concat(t):t,s=e.split("/"),a=s.length>1?s.slice(1).join("/"):e,l=o.split("/"),c=l.length>1?l.slice(1).join("/"):o,u=await fetch("http://localhost:3001/move",{method:"POST",headers:{"Content-Type":"application/json"},mode:"cors",body:JSON.stringify({source:a,destination:c})});if(!u.ok){const e=await u.json().catch(()=>({error:"Unknown error"}));throw new Error(e.error||"Failed to rename: ".concat(u.status))}return r&&r(),!0}catch(n){return console.error("Error renaming node:",n),alert("Failed to rename: ".concat(n.message)),!1}},[r]),T=(0,e.useCallback)(async(e,t)=>{var n,i;if(null===(n=e.data)||void 0===n||!n.path||null===(i=t.data)||void 0===i||!i.path)return console.error("Missing path data for file or folder"),!1;const o=e.data.path,a=t.data.path,l=o.split("/").pop(),c="".concat(a,"/").concat(l),u=o.split("/"),d=u.length>1?u.slice(1).join("/"):o,h=c.split("/"),f=h.length>1?h.slice(1).join("/"):c;try{const e=await fetch("http://localhost:3001/move",{method:"POST",headers:{"Content-Type":"application/json"},mode:"cors",body:JSON.stringify({source:d,destination:f})});if(!e.ok){const t=await e.json().catch(()=>({error:"Unknown error"}));throw new Error(t.error||"Failed to move file: ".concat(e.status))}if(r)r();else{const e=await fetch("http://localhost:3001/list",{method:"GET",mode:"cors"});if(e.ok){const t=e.headers.get("content-type");let n=[];if(t&&t.includes("application/json")){const t=await e.json();n=t.files||t||[]}else{const t=await e.text();try{const e=JSON.parse(t);n=e.files||e||[]}catch(s){n=t.trim().split("\n").filter(e=>e.trim())}}vc(n.filter(e=>!e.includes("node_modules")&&!e.includes(".git")&&!e.includes(".DS_Store")))}}return!0}catch(p){return console.error("Error moving file:",p),alert("Failed to move file: ".concat(p.message)),!1}},[r]);(0,e.useEffect)(()=>{if(0===l.length)return;const{nodeLookup:e,edgeLookup:t}=w.getState(),r=Array.from(e.values()),s=Array.from(t.values()),d=r.filter(e=>"new"===e.type),h=new Set(d.map(e=>e.id)),f=s.filter(e=>h.has(e.source)||h.has(e.target));let p=l.map(e=>Is({},e)),g=c.map(e=>Is({},e));p=p.map(e=>{var t;const n=e.data.hasChildren||e.data.children&&e.data.children.length>0,r=e.data.children||[],i=(n&&Array.isArray(r)&&r.every(e=>{const t=e.type||e.originalNode&&e.originalNode.type;return"function"===t||"method"===t||"class"===t}),null===(t=e.data.originalNode)||void 0===t||t.type,"string"===typeof e.className&&e.className.includes("class-node"),void 0!==u[e.id]?u[e.id]:!!n);return Is(Is({},e),{},{type:"universal",className:e.className,selectable:!0,data:Is(Is({},e.data),{},{isCollapsed:i,onToggle:n?E:void 0})})});const m=Object.keys(u).filter(e=>!0===u[e]),_=new Set;m.forEach(e=>{R(e,g).forEach(e=>_.add(e))}),_.size>0&&(p=p.filter(e=>!_.has(e.id)),g=g.filter(e=>!_.has(e.source)&&!_.has(e.target)));const b=$y(p,g),x={};b.nodes.forEach(e=>{x[e.id]={hasIncoming:b.edges.some(t=>t.target===e.id),hasOutgoing:b.edges.some(t=>t.source===e.id)}});const S=b.nodes.map(e=>{var t,r;const s=o(n,e.id),l=(e.data.hasChildren||e.data.children&&e.data.children.length>0)&&s?a(s):0;return Is(Is({},e),{},{data:Is(Is({},e.data),{},{hasIncoming:(null===(t=x[e.id])||void 0===t?void 0:t.hasIncoming)||!1,hasOutgoing:(null===(r=x[e.id])||void 0===r?void 0:r.hasOutgoing)||!1,originalNode:s,fileCount:l,onDelete:L,onRename:P,onOpenCodeView:i})})}),C=[...S,...d],k=[...b.edges,...f];v(C),y(k)},[u,E,R,v,y,l,c,n,o,a,w,L,P,i]);const D=(0,e.useCallback)(async e=>{var t,n,r,i;const{source:o,target:s}=e,a=g.find(e=>e.id===o),l=g.find(e=>e.id===s),c=a&&((null===(t=a.data)||void 0===t?void 0:t.hasChildren)||(null===(n=a.data)||void 0===n?void 0:n.children)&&a.data.children.length>0),u=l&&((null===(r=l.data)||void 0===r?void 0:r.hasChildren)||(null===(i=l.data)||void 0===i?void 0:i.children)&&l.data.children.length>0);if(c&&!u&&a&&l){if(!await T(l,a))return}y(t=>Ag(Is(Is({},e),{},{type:Ip.Step,animated:!0}),t))},[y,g,T]),O=(0,e.useCallback)((e,t)=>{let{nodeId:n}=t;x.current=n},[]),I=(0,e.useCallback)(e=>{if(!S)return null;return S({x:e.clientX,y:e.clientY})},[S]),A=((0,e.useCallback)(async e=>{try{const t=await fetch("http://localhost:3001/write",{method:"POST",headers:{"Content-Type":"application/json"},mode:"cors",body:JSON.stringify({path:e,content:""})});if(!t.ok)throw new Error("Failed to create folder: ".concat(t.status," ").concat(t.statusText));return!0}catch(t){throw console.error("Error creating folder:",t),t}},[]),(0,e.useCallback)(async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";console.log("Creating Python file on filesystem:",e,t);try{const n=await fetch("http://localhost:3001/write",{method:"POST",headers:{"Content-Type":"application/json"},mode:"cors",body:JSON.stringify({path:e,content:t})});if(!n.ok)throw new Error("Failed to create Python file: ".concat(n.status," ").concat(n.statusText));return!0}catch(n){throw console.error("Error creating Python file:",n),n}},[])),j=(0,e.useCallback)(async e=>{try{const t=await fetch("http://localhost:3001/write_dir",{method:"POST",headers:{"Content-Type":"application/json"},mode:"cors",body:JSON.stringify({path:e})});if(!t.ok)throw new Error("Failed to create directory: ".concat(t.status," ").concat(t.statusText));return!0}catch(t){throw console.error("Error creating directory:",t),t}},[]),B=(0,e.useCallback)(e=>{const t=e.lastIndexOf(".");return-1!==t&&t!==e.length-1&&t>0},[]),N=(0,e.useCallback)(async(e,t,n,i)=>{var o;if(null===(o=n.data)||void 0===o||!o.path)return void console.error("Parent node missing path data");const s=n.data.path,a=!B(t),l=s?"".concat(s,"/").concat(t):t,c=s.split("/"),u=c.length>1?c.slice(1).join("/"):s,d=u?"".concat(u,"/").concat(t):t;try{if(a){await j(d);const r=l;v(t=>t.filter(t=>t.id!==e)),y(t=>t.filter(t=>t.target!==e));const o={id:r,type:"folder",data:{label:t,isFolder:!0,path:l,isCollapsed:!1,onToggle:E,hasIncoming:!0,hasOutgoing:!1,fileCount:0,onDelete:L},position:i||{x:0,y:0}},s={id:"e".concat(n.id,"-").concat(r),source:n.id,target:r,type:"step"};v(e=>[...e,o]),y(e=>[...e,s])}else{await A(d,"");const r=l;v(t=>t.filter(t=>t.id!==e)),y(t=>t.filter(t=>t.target!==e));const o={id:r,type:"file",data:{label:t,isFolder:!1,path:l,hasIncoming:!0,hasOutgoing:!1,onDelete:L},position:i||{x:0,y:0}},s={id:"e".concat(n.id,"-").concat(r),source:n.id,target:r,type:"step"};v(e=>[...e,o]),y(e=>[...e,s])}r&&r()}catch(h){console.error("Error creating file/folder:",h),alert("Failed to create ".concat(a?"folder":"file",": ").concat(h.message))}},[A,j,E,v,y,r,B,L]),F=(0,e.useCallback)((e,t)=>{var n;if(null===(n=e.data)||void 0===n||!n.path)return void console.error("Parent node missing path data");const r="new-".concat(Date.now()),i={id:r,type:"new",data:{label:"",isFolder:!1,hasIncoming:!0,hasOutgoing:!1,onCreateFile:n=>{N(r,n,e,t)},onCreateFolder:n=>{N(r,n,e,t)},onCancel:()=>{v(e=>e.filter(e=>e.id!==r)),y(e=>e.filter(e=>e.target!==r))}},position:t},o={id:"e".concat(e.id,"-").concat(r),source:e.id,target:r,type:"step"};v(e=>[...e,i]),y(e=>[...e,o])},[v,y,N]),z=(0,e.useCallback)((e,t)=>{const n=M(t);y(e=>{const t=e.filter(e=>"temp"!==e.className);return n&&!t.find(e=>e.source===n.source&&e.target===n.target)&&(n.className="temp",n.type="step",t.push(n)),t})},[M,y]),H=(0,e.useCallback)(async(e,t)=>{const n=M(t);if(y(e=>e.filter(e=>"temp"!==e.className)),n){var r,i,o,s;const e=g.find(e=>e.id===n.target),a=(null===(r=t.data)||void 0===r?void 0:r.hasChildren)||(null===(i=t.data)||void 0===i?void 0:i.children)&&t.data.children.length>0,l=(null===(o=e.data)||void 0===o?void 0:o.hasChildren)||(null===(s=e.data)||void 0===s?void 0:s.children)&&e.data.children.length>0;e&&!a&&l&&await T(t,e)}},[M,y,g,T]),W=(0,e.useCallback)(e=>{const{nodeLookup:t}=w.getState();if(e.target&&e.target.classList&&e.target.classList.contains("react-flow__pane")&&x.current){var n,r;const i=t.get(x.current),o=(null===i||void 0===i||null===(n=i.data)||void 0===n?void 0:n.hasChildren)||(null===i||void 0===i||null===(r=i.data)||void 0===r?void 0:r.children)&&i.data.children.length>0;if(i&&o){const t=I(e);t&&F(i,t)}}x.current=null},[w,I,F]),U=(0,e.useCallback)((e,t)=>{if(!t.data)return;(t.data.hasChildren||t.data.children&&t.data.children.length>0)&&t.data.onToggle&&t.data.onToggle(t.id)},[]),[V,$]=(0,e.useState)(!1),q=(0,e.useCallback)(()=>{k({padding:.1,duration:Vy})},[k]);return(0,e.useEffect)(()=>{if(!h.current&&l.length>0){const e={};l.forEach(t=>{(t.data.hasChildren||t.data.children&&t.data.children.length>0)&&(e[t.id]=!0)}),Object.keys(e).length>0?(d(e),h.current=!0,setTimeout(()=>$(!0),50)):$(!0)}},[l]),(0,rc.jsxs)("div",{style:{display:"flex",flexDirection:"column",width:"100%",height:"100%",background:"#fafafa",position:"relative"},children:[(0,rc.jsx)("button",{onClick:q,style:{position:"absolute",top:"12px",right:"12px",zIndex:10,background:"rgba(255, 255, 255, 0.4)",backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)",border:"1px solid rgba(255, 255, 255, 0.5)",borderRadius:"8px",padding:"8px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 2px 8px rgba(0,0,0,0.08)"},onMouseEnter:e=>{e.currentTarget.style.background="rgba(255, 255, 255, 0.6)"},onMouseLeave:e=>{e.currentTarget.style.background="rgba(255, 255, 255, 0.4)"},title:"Recenter view",children:(0,rc.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"rgba(0,0,0,0.5)",style:{width:"18px",height:"18px"},children:(0,rc.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 9V4.5M9 9H4.5M9 9 3.75 3.75M9 15v4.5M9 15H4.5M9 15l-5.25 5.25M15 9h4.5M15 9V4.5M15 9l5.25-5.25M15 15h4.5M15 15v4.5m0-4.5 5.25 5.25"})})}),(0,rc.jsxs)(_y,{nodes:g,edges:_,onNodesChange:m,onEdgesChange:b,onConnect:D,onConnectStart:O,onConnectEnd:W,onNodeClick:U,onNodeDrag:z,onNodeDragStop:H,connectionLineType:Ip.Step,nodeTypes:Zy,proOptions:{hideAttribution:!0},children:[(0,rc.jsx)(ky,{}),(0,rc.jsx)(Gy,{nodes:g,edges:_,isReady:V})]})]})}const Qy=function(e){let{rootTree:t,onTreeRefresh:n,onOpenCodeView:r}=e;return t&&0!==t.length?(0,rc.jsx)(gy,{children:(0,rc.jsx)(Jy,{rootTree:t,onTreeRefresh:n,onOpenCodeView:r})}):(0,rc.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%",color:"#999",fontSize:"14px",fontFamily:"monospace",background:"#fafafa",border:"1px solid #ddd",borderRadius:"4px"},children:"No file tree available. Please load files first."})};var eb=n(104),tb=n(132);function nb(t){let{isActive:n,sessionId:r,onStatusChange:i}=t;const o=(0,e.useRef)(null),a=(0,e.useRef)(null),l=(0,e.useRef)(null),c=(0,e.useRef)(null),[u,d]=(0,e.useState)("disconnected");(0,e.useEffect)(()=>{null===i||void 0===i||i(r,u)},[u,r,i]);const h=(0,e.useCallback)(()=>{var e;if((null===(e=c.current)||void 0===e?void 0:e.readyState)===WebSocket.OPEN)return;d("connecting");const t=new WebSocket("ws://localhost:3001/terminal");c.current=t,t.onopen=()=>{d("connected"),setTimeout(()=>{if(a.current){const e=a.current.cols||80,n=a.current.rows||24;t.send(JSON.stringify({type:"resize",cols:e,rows:n}))}},50)},t.onmessage=e=>{var t,n,r;try{const i=JSON.parse(e.data);switch(i.type){case"output":null===(t=a.current)||void 0===t||t.write(i.data);break;case"exit":null===(n=a.current)||void 0===n||n.write("\r\n[Process exited]\r\n"),d("disconnected");break;case"error":null===(r=a.current)||void 0===r||r.write("\r\n[Error: ".concat(i.message,"]\r\n")),d("error")}}catch(s){console.error("Failed to parse terminal message:",s)}},t.onclose=()=>{d("disconnected")},t.onerror=e=>{d("error"),console.error("Terminal WebSocket error:",e)}},[]),f=(0,e.useCallback)(()=>{if(!l.current||!a.current||!o.current)return;const e=o.current;if(e&&0!==e.clientWidth&&0!==e.clientHeight&&a.current.element)try{var t;l.current.fit();const e=a.current.cols,n=a.current.rows;e&&n&&(null===(t=c.current)||void 0===t?void 0:t.readyState)===WebSocket.OPEN&&c.current.send(JSON.stringify({type:"resize",cols:e,rows:n}))}catch(s){console.debug("Terminal resize error:",s.message)}},[]);(0,e.useEffect)(()=>{if(!o.current||a.current)return;const e=new eb.Terminal({cursorBlink:!0,fontSize:12,fontFamily:'Menlo, Monaco, "Courier New", monospace',theme:{background:"#1e1e1e",foreground:"#d4d4d4",cursor:"#d4d4d4",cursorAccent:"#1e1e1e",selection:"rgba(255, 255, 255, 0.3)",black:"#000000",red:"#cd3131",green:"#0dbc79",yellow:"#e5e510",blue:"#2472c8",magenta:"#bc3fbc",cyan:"#11a8cd",white:"#e5e5e5",brightBlack:"#666666",brightRed:"#f14c4c",brightGreen:"#23d18b",brightYellow:"#f5f543",brightBlue:"#3b8eea",brightMagenta:"#d670d6",brightCyan:"#29b8db",brightWhite:"#ffffff"},scrollback:5e3,allowProposedApi:!0});a.current=e;const t=new tb.FitAddon;l.current=t,e.loadAddon(t);const n=()=>{const t=o.current;if(t)if(t.clientWidth>0&&t.clientHeight>0)try{e.open(t),f()}catch(s){console.debug("Terminal open error:",s.message)}else requestAnimationFrame(n)},r=setTimeout(()=>{requestAnimationFrame(n)},50);e.onData(e=>{var t;(null===(t=c.current)||void 0===t?void 0:t.readyState)===WebSocket.OPEN&&c.current.send(JSON.stringify({type:"input",data:e}))});const i=setTimeout(()=>{h()},100);return window.addEventListener("resize",f),()=>{var t;clearTimeout(r),clearTimeout(i),window.removeEventListener("resize",f),null===(t=c.current)||void 0===t||t.close(),e.dispose(),a.current=null,l.current=null}},[h,f]),(0,e.useEffect)(()=>{if(n&&o.current){const e=new ResizeObserver(()=>{var e;o.current&&o.current.clientWidth>0&&o.current.clientHeight>0&&null!==(e=a.current)&&void 0!==e&&e.element&&f()});e.observe(o.current);const t=setTimeout(()=>{var e,t;o.current&&o.current.clientWidth>0&&null!==(e=a.current)&&void 0!==e&&e.element&&(f(),null===(t=a.current)||void 0===t||t.focus())},350);return()=>{clearTimeout(t),e.disconnect()}}},[n,f]);return(0,rc.jsxs)("div",{style:{display:n?"flex":"none",flexDirection:"column",width:"100%",height:"100%",background:"#1e1e1e"},children:["connected"!==u&&(0,rc.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"4px 12px",background:"#252526",borderBottom:"1px solid #3c3c3c"},children:[(0,rc.jsx)("span",{style:{fontSize:"11px",padding:"2px 6px",borderRadius:"4px",background:"connecting"===u?"#e5e510":"error"===u?"#cd3131":"#666",color:"connecting"===u?"#000":"#fff"},children:u}),(0,rc.jsx)("button",{onClick:()=>{var e,t;null===(e=c.current)||void 0===e||e.close(),null===(t=a.current)||void 0===t||t.clear(),h()},style:{padding:"4px 8px",fontSize:"12px",background:"#0e639c",color:"#fff",border:"none",borderRadius:"4px",cursor:"pointer",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif'},children:"Reconnect"})]}),(0,rc.jsx)("div",{ref:o,style:{flex:1,padding:"4px 8px",overflow:"hidden",boxSizing:"border-box"},onClick:()=>{var e;return null===(e=a.current)||void 0===e?void 0:e.focus()}})]})}const rb=function(t){let{isVisible:n=!0}=t;const[r,i]=(0,e.useState)([{id:1,name:"bash"}]),[o,s]=(0,e.useState)(1),[a,l]=(0,e.useState)({}),[c,u]=(0,e.useState)(null),[d,h]=(0,e.useState)(""),f=(0,e.useRef)(null),p=(0,e.useRef)(2),g=(0,e.useCallback)((e,t)=>{l(n=>Is(Is({},n),{},{[e]:t}))},[]),v=()=>{c&&d.trim()&&i(e=>e.map(e=>e.id===c?Is(Is({},e),{},{name:d.trim()}):e)),u(null),h("")},m=e=>{"Enter"===e.key?v():"Escape"===e.key&&(u(null),h(""))};return(0,rc.jsxs)("div",{style:{display:"flex",flexDirection:"column",width:"100%",height:"100%",background:"#1e1e1e"},children:[(0,rc.jsx)("div",{style:{display:"flex",alignItems:"center",background:"#252526",borderBottom:"1px solid #3c3c3c",height:"35px",flexShrink:0},children:(0,rc.jsxs)("div",{style:{display:"flex",overflow:"auto",height:"100%"},children:[r.map((e,t)=>{const n=e.id===o,p=a[e.id];return(0,rc.jsxs)("div",{onClick:()=>s(e.id),style:{display:"flex",alignItems:"center",gap:"6px",padding:"0 12px",height:"100%",cursor:"pointer",background:n?"#1e1e1e":"transparent",borderRight:"1px solid #3c3c3c",borderTop:n?"1px solid #007acc":"1px solid transparent",color:n?"#fff":"#969696",fontSize:"12px",whiteSpace:"nowrap",transition:"background 0.1s"},onMouseEnter:e=>{n||(e.currentTarget.style.background="#2d2d2d")},onMouseLeave:e=>{n||(e.currentTarget.style.background="transparent")},children:[(0,rc.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",fill:"currentColor",style:{width:"14px",height:"14px",opacity:.8},children:(0,rc.jsx)("path",{d:"M3.5 2A1.5 1.5 0 0 0 2 3.5v9A1.5 1.5 0 0 0 3.5 14h9a1.5 1.5 0 0 0 1.5-1.5v-9A1.5 1.5 0 0 0 12.5 2h-9ZM5 6.5a.5.5 0 0 1 .146-.354l2-2a.5.5 0 1 1 .708.708L6.207 6.5l1.647 1.646a.5.5 0 0 1-.708.708l-2-2A.5.5 0 0 1 5 6.5Zm3.5 3a.5.5 0 0 1 .5-.5h2a.5.5 0 0 1 0 1H9a.5.5 0 0 1-.5-.5Z"})}),c===e.id?(0,rc.jsx)("input",{ref:f,type:"text",value:d,onChange:e=>h(e.target.value),onBlur:v,onKeyDown:m,onClick:e=>e.stopPropagation(),style:{background:"#3c3c3c",border:"1px solid #007acc",borderRadius:"2px",color:"#fff",fontSize:"12px",padding:"1px 4px",width:"80px",outline:"none"},autoFocus:!0}):(0,rc.jsx)("span",{onClick:t=>((e,t,n)=>{n.stopPropagation(),u(e),h(t),setTimeout(()=>{var e;return null===(e=f.current)||void 0===e?void 0:e.select()},0)})(e.id,e.name,t),style:{cursor:"text"},children:e.name}),p&&"connected"!==p&&(0,rc.jsx)("span",{style:{width:"6px",height:"6px",borderRadius:"50%",background:"connecting"===p?"#e5e510":"error"===p?"#cd3131":"#666",flexShrink:0}}),(0,rc.jsx)("button",{onClick:t=>((e,t)=>{if(t.stopPropagation(),1===r.length)return;const n=r.findIndex(t=>t.id===e),a=r.filter(t=>t.id!==e);if(i(a),o===e){const e=Math.min(n,a.length-1);s(a[e].id)}l(t=>{const{[e]:n}=t;return Ls(t,[e].map(Ts))})})(e.id,t),style:{background:"transparent",border:"none",cursor:"pointer",padding:"2px",color:"#969696",fontSize:"14px",lineHeight:1,borderRadius:"3px",display:"flex",alignItems:"center",justifyContent:"center",opacity:1===r.length?.3:1},onMouseEnter:e=>{r.length>1&&(e.currentTarget.style.background="#4a4a4a",e.currentTarget.style.color="#fff")},onMouseLeave:e=>{e.currentTarget.style.background="transparent",e.currentTarget.style.color="#969696"},children:"\xd7"})]},e.id)}),(0,rc.jsx)("button",{onClick:()=>{const e=p.current++;i(t=>[...t,{id:e,name:"bash"}]),s(e)},style:{background:"transparent",border:"none",cursor:"pointer",padding:"0 10px",height:"100%",color:"#969696",fontSize:"18px",display:"flex",alignItems:"center",justifyContent:"center"},onMouseEnter:e=>{e.currentTarget.style.background="#3c3c3c",e.currentTarget.style.color="#fff"},onMouseLeave:e=>{e.currentTarget.style.background="transparent",e.currentTarget.style.color="#969696"},title:"New Terminal",children:"+"})]})}),(0,rc.jsx)("div",{style:{flex:1,overflow:"hidden"},children:r.map(e=>(0,rc.jsx)(nb,{sessionId:e.id,isActive:n&&e.id===o,onStatusChange:g},e.id))})]})};const ib=class{openFile(e,t,n){if("file"!==e.type)return{openFiles:t,activeFile:n};const r=t.findIndex(t=>t.path===e.path);if(r>=0)return{openFiles:t,activeFile:e.path};const i={path:e.path,lineCount:null};return{openFiles:[...t,i],activeFile:e.path}}closeFile(e,t,n){const r=t.filter(t=>t.path!==e);let i=n;return n===e&&(i=r.length>0?r[r.length-1].path:null),{openFiles:r,activeFile:i}}updateLineCount(e,t,n){return n.map(n=>n.path===e?Is(Is({},n),{},{lineCount:t}):n)}};const ob=class{findNodeById(e,t){for(const n of e){if(n.id===t)return n;if(n.children){const e=this.findNodeById(n.children,t);if(e)return e}}return null}handleTreeUpdate(e,t){return{rootTree:e,shouldInitializeFolder:e.length>0&&""===t}}};const sb=class{onFolderClick(e){return"folder"!==e.type?null:e.id}getVisibleNodes(e,t,n){var r;const i=t?n(e,t):null;return null!==(r=null===i||void 0===i?void 0:i.children)&&void 0!==r?r:""===t?e:[]}getCurrentFolder(e,t,n){return t?n(e,t):null}};function ab(t){let{previewAddress:n,setPreviewAddress:r,previewServerActive:i}=t;const[o,s]=(0,e.useState)(!1),[a,l]=(0,e.useState)(n),c=(0,e.useRef)(null);(0,e.useEffect)(()=>{o&&c.current&&(c.current.focus(),c.current.select())},[o]);const u=()=>{const e=a.trim();e&&e!==n&&(r(e),localStorage.setItem("previewAddress",e)),s(!1)};return(0,rc.jsxs)("div",{style:{width:"100%",height:"100%",display:"flex",flexDirection:"column"},children:[(0,rc.jsx)("div",{style:{padding:"12px 16px",borderBottom:"1px solid #e0e0e0",background:"#f5f5f5",display:"flex",alignItems:"center",flexShrink:0},children:(0,rc.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"8px",fontSize:"14px",color:"#333"},children:[(0,rc.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",style:{width:"18px",height:"18px",color:"#28a745"},children:(0,rc.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12.75 11.25 15 15 9.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"})}),(0,rc.jsx)("span",{children:"previewing"}),o?(0,rc.jsx)("input",{ref:c,type:"text",value:a,onChange:e=>l(e.target.value),onBlur:u,onKeyDown:e=>{"Enter"===e.key?u():"Escape"===e.key&&(l(n),s(!1))},style:{padding:"2px 6px",fontSize:"14px",fontWeight:"600",color:"#333",border:"1px solid #3B82F6",borderRadius:"4px",outline:"none",minWidth:"180px",fontFamily:"inherit"}}):(0,rc.jsx)("strong",{onClick:()=>{l(n),s(!0)},style:{color:"#333",cursor:"pointer",padding:"2px 6px",borderRadius:"4px",transition:"background 0.15s ease"},onMouseEnter:e=>e.currentTarget.style.background="#f0f0f0",onMouseLeave:e=>e.currentTarget.style.background="transparent",title:"Click to edit preview address",children:n}),(0,rc.jsx)("button",{onClick:()=>{const e="http://localhost:";r(e),l(e),localStorage.setItem("previewAddress",e)},style:{background:"transparent",border:"none",cursor:"pointer",padding:"2px 4px",marginLeft:"4px",color:"#999",fontSize:"14px",lineHeight:"1",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"3px"},onMouseEnter:e=>{e.currentTarget.style.color="#666",e.currentTarget.style.background="#f0f0f0"},onMouseLeave:e=>{e.currentTarget.style.color="#999",e.currentTarget.style.background="transparent"},title:"Clear port",children:"\xd7"})]})}),(0,rc.jsx)("div",{style:{flex:1,overflow:"hidden"},children:i?(0,rc.jsx)("iframe",{src:n,style:{width:"100%",height:"100%",border:"none",background:"#fff"},title:"Preview"}):(0,rc.jsxs)("div",{style:{width:"100%",height:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",background:"#fafafa",color:"#666",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif'},children:[(0,rc.jsx)("div",{style:{fontSize:"48px",marginBottom:"16px",opacity:.4},children:"\ud83d\udda5\ufe0f"}),(0,rc.jsx)("div",{style:{fontSize:"16px",fontWeight:"500",marginBottom:"8px"},children:"No preview available"}),(0,rc.jsxs)("div",{style:{fontSize:"14px",color:"#666",display:"flex",alignItems:"center",gap:"6px"},children:[(0,rc.jsx)("span",{children:"Start your dev server at"}),(0,rc.jsx)("input",{type:"text",value:n,onChange:e=>{r(e.target.value),localStorage.setItem("previewAddress",e.target.value)},style:{padding:"4px 8px",fontSize:"14px",border:"1px solid #ddd",borderRadius:"4px",fontFamily:"monospace",width:"180px",textAlign:"center"},placeholder:"http://localhost:3000"}),(0,rc.jsx)("span",{children:"to see live preview"})]})]})})]})}const lb=function(){const[t,n]=(0,e.useState)([]),[r,i]=(0,e.useState)(""),[o,a]=(0,e.useState)([]),[l,c]=(0,e.useState)(null),[u,d]=(0,e.useState)("checking"),[h,f]=(0,e.useState)(0),[p,g]=(0,e.useState)(!1),[v,m]=(0,e.useState)(!1),[_,y]=(0,e.useState)(!1),[b,x]=(0,e.useState)(!1),[w,S]=(0,e.useState)([]),[C,k]=(0,e.useState)(!1),[E,R]=(0,e.useState)([]),[M,L]=(0,e.useState)(!1),[P,T]=(0,e.useState)(()=>localStorage.getItem("previewAddress")||"http://localhost:3000"),[D,O]=(0,e.useState)(!1),[I,A]=(0,e.useState)(!0),[j,B]=(0,e.useState)(100),[N,F]=(0,e.useState)(!1),[z,H]=(0,e.useState)(!1),[W,U]=(0,e.useState)(null),[V,$]=(0,e.useState)(!1),[q,K]=(0,e.useState)(!1),Y=(0,e.useRef)(null),X=((0,e.useRef)(null),(0,e.useRef)(!1));(0,e.useEffect)(()=>{if("active"===u&&!hc.showV3){localStorage.getItem("bonzai_has_visited")||(H(!0),localStorage.setItem("bonzai_has_visited","true"))}},[u]),(0,e.useEffect)(()=>{if(hc.showV3){if(!localStorage.getItem("bonzai_drawer_peek_seen")){const e=setTimeout(()=>{y(!0)},800);return()=>clearTimeout(e)}}},[]),(0,e.useEffect)(()=>{if(hc.showV3){if(!localStorage.getItem("bonzai_terminal_hint_seen")){const e=setTimeout(()=>{x(!0)},800);return()=>clearTimeout(e)}}},[]);const G=(0,e.useMemo)(()=>new ib,[]),Z=(0,e.useMemo)(()=>new ob,[]),J=(0,e.useMemo)(()=>new sb,[]),Q=(0,e.useCallback)(e=>{const t=J.onFolderClick(e);null!==t&&i(t)},[J]),ee=(0,e.useCallback)(e=>{const t=G.openFile(e,o,l);a(t.openFiles),c(t.activeFile)},[G,o,l]),te=((0,e.useCallback)((e,t)=>{t.stopPropagation();const n=G.closeFile(e,o,l);a(n.openFiles),c(n.activeFile)},[G,o,l]),(0,e.useCallback)((e,t)=>{const n=G.updateLineCount(e,t,o);a(n)},[G,o]),(0,e.useCallback)(e=>{const t=Z.handleTreeUpdate(e,r);n(t.rootTree),t.shouldInitializeFolder&&i("")},[Z,r])),ne=(0,e.useCallback)(e=>{d(e)},[]),re=((0,e.useCallback)(e=>{console.log("\ud83d\udd0d [App] handleCodeQualityIssuesChange called with:",e),console.log("\ud83d\udd0d [App] Issues count:",(null===e||void 0===e?void 0:e.length)||0),S(e)},[]),(0,e.useCallback)(async()=>{let e="";try{const t=localStorage.getItem("codeQualityRules");if(t){const n=JSON.parse(t);e=(null===n||void 0===n?void 0:n.architecture)||""}}catch(s){console.error("Error loading standards from localStorage:",s)}if(e){console.log("\ud83d\udd0d [App] Starting standards scan..."),L(!0);try{const t=await async function(e,t){var n;const r=await fetch("".concat(sc).concat(cc),{method:"POST",mode:"cors",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectPath:e,standards:t})});if(!r.ok)throw new Error("Standards scan failed: ".concat(r.status," ").concat(r.statusText));const i=await r.json();return console.log("\ud83d\udd0d [scanStandards] API Response:",i),console.log("\ud83d\udd0d [scanStandards] Violations count:",(null===i||void 0===i||null===(n=i.violations)||void 0===n?void 0:n.length)||0),i}("/Users/nicbenedetto/Documents/codemaps",e);console.log("\ud83d\udd0d [App] Standards scan result:",t),console.log("\ud83d\udd0d [App] Full response object:",JSON.stringify(t,null,2));const n=(null===t||void 0===t?void 0:t.violations)||[];console.log("\ud83d\udd0d [App] Setting standardsViolations to:",n.length,"violations"),console.log("\ud83d\udd0d [App] Violations array:",n),R(n)}catch(t){console.error("\ud83d\udd0d [App] Standards scan failed:",t)}finally{L(!1)}}else console.log("\ud83d\udd0d [App] No standards configured, skipping scan")},[]));(0,e.useEffect)(()=>{console.log("\ud83d\udd0d [App] serverStatus changed to:",u)},[u]);const ie=(0,e.useCallback)(()=>{f(e=>e+1)},[]);(0,e.useEffect)(()=>{const e=async()=>{try{await fetch(P,{method:"HEAD",mode:"no-cors"});O(!0)}catch(e){O(!1)}};e();const t=setInterval(e,3e3);return()=>clearInterval(t)},[P]);const oe=(0,e.useCallback)(()=>{m(!0),setTimeout(()=>{g(!1),m(!1)},300)},[]),se=(0,e.useCallback)(()=>{_&&(y(!1),localStorage.setItem("bonzai_drawer_peek_seen","true")),p?oe():g(!0)},[p,oe,_]);if((0,e.useEffect)(()=>{const e=e=>{(e.metaKey||e.ctrlKey)&&"g"===e.key&&(e.preventDefault(),_&&(y(!1),localStorage.setItem("bonzai_drawer_peek_seen","true")),p?oe():g(!0)),(e.metaKey||e.ctrlKey)&&"b"===e.key&&(e.preventDefault(),b&&(x(!1),localStorage.setItem("bonzai_terminal_hint_seen","true")),A(e=>!e))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[p,oe,_,b]),(0,e.useEffect)(()=>{if(!N)return;document.body.style.userSelect="none",document.body.style.cursor="ns-resize",X.current=!1;const e=e=>{X.current=!0;const t=window.innerHeight,n=t-e.clientY,r=Math.max(100,Math.min(n,.8*t));B(r)},t=()=>{F(!1),document.body.style.userSelect="",document.body.style.cursor="",setTimeout(()=>{X.current=!1},50)};return document.addEventListener("mousemove",e),document.addEventListener("mouseup",t),()=>{document.removeEventListener("mousemove",e),document.removeEventListener("mouseup",t),document.body.style.userSelect="",document.body.style.cursor=""}},[N]),hc.showConfigonly)return(0,rc.jsx)("div",{className:"App",children:(0,rc.jsx)(dc,{isOpen:!0,onClose:()=>{},fullScreen:!0})});const ae=(0,rc.jsx)(rc.Fragment,{children:(0,rc.jsxs)("div",{style:{display:"flex",flexDirection:"column",width:"100%",height:"calc(100vh - 50px)",position:"relative",zIndex:1},children:[(0,rc.jsx)("div",{style:{display:"flex",flex:1,minHeight:0,height:"100%"},children:(0,rc.jsxs)("div",{className:"graph-container",style:{flex:1,height:"100%",position:"relative",overflow:"hidden"},children:[(0,rc.jsx)(xc,{onFileClick:ee,onFolderClick:Q,onTreeUpdate:te,refreshTrigger:h}),(0,rc.jsx)("div",{style:{width:"100%",height:"100%",display:"flex",flexDirection:"column"},children:(0,rc.jsx)("div",{style:{flex:1,height:"100%",display:"flex",flexDirection:"column",position:"relative"},children:(0,rc.jsx)("div",{style:{flex:1,position:"relative",overflow:"hidden",display:"flex",flexDirection:"column"},children:hc.showV3?(0,rc.jsxs)(rc.Fragment,{children:[(0,rc.jsx)("div",{style:{width:"100%",height:"100%",display:V?"none":"block"},children:(0,rc.jsx)(Qy,{rootTree:t,onTreeRefresh:ie,onOpenCodeView:e=>{U(e),$(!0)}})}),(0,rc.jsx)("div",{style:{width:"100%",height:"100%",display:V?"block":"none"},children:(0,rc.jsx)(mu,{rootTree:t,initialFile:W,onClose:()=>{$(!1),U(null)}})}),(0,rc.jsx)("div",{onClick:se,style:{position:"absolute",right:p&&!v?"95%":_?"23.75%":"0",top:"50%",transform:"translateY(-50%)",width:"20px",height:"80px",background:"#e0e0e0",borderTopLeftRadius:"8px",borderBottomLeftRadius:"8px",borderTopRightRadius:"0",borderBottomRightRadius:"0",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1001,transition:"right 0.3s ease-out, background 0.2s ease, box-shadow 0.3s ease-out",boxShadow:p&&!v||_?"-2px 0 4px rgba(0, 0, 0, 0.1)":"2px 0 4px rgba(0, 0, 0, 0.1)"},onMouseEnter:e=>{e.currentTarget.style.background="#d0d0d0"},onMouseLeave:e=>{e.currentTarget.style.background="#e0e0e0"},children:(0,rc.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:"4px",opacity:.6},children:[(0,rc.jsx)("div",{style:{width:"3px",height:"3px",background:"#666",borderRadius:"50%"}}),(0,rc.jsx)("div",{style:{width:"3px",height:"3px",background:"#666",borderRadius:"50%"}}),(0,rc.jsx)("div",{style:{width:"3px",height:"3px",background:"#666",borderRadius:"50%"}})]})}),(0,rc.jsxs)("div",{ref:Y,style:{position:"absolute",top:0,right:0,width:"95%",height:"100%",background:"#fff",boxShadow:p&&!v||_?"-4px 0 12px rgba(0, 0, 0, 0.15)":"none",zIndex:p||v||_?1e3:-1,display:"flex",flexDirection:"column",transform:p&&!v?"translateX(0)":_?"translateX(75%)":"translateX(100%)",transition:"transform 0.3s ease-out",pointerEvents:p||v||_?"auto":"none",visibility:p||v||_?"visible":"hidden"},children:[p&&!v&&(0,rc.jsx)("div",{style:{position:"absolute",right:"16px",top:"12px",zIndex:1002},children:(0,rc.jsx)("div",{onClick:oe,style:{cursor:"pointer",padding:"4px",display:"flex",alignItems:"center",justifyContent:"center",opacity:.5,transition:"opacity 0.2s ease"},onMouseEnter:e=>{e.currentTarget.style.opacity="1"},onMouseLeave:e=>{e.currentTarget.style.opacity="0.5"},children:(0,rc.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"#666",style:{width:"20px",height:"20px"},children:(0,rc.jsx)("path",{d:"M3.288 4.818A1.5 1.5 0 0 0 1 6.095v7.81a1.5 1.5 0 0 0 2.288 1.276l6.323-3.905c.155-.096.285-.213.389-.344v2.973a1.5 1.5 0 0 0 2.288 1.276l6.323-3.905a1.5 1.5 0 0 0 0-2.552l-6.323-3.906A1.5 1.5 0 0 0 10 6.095v2.972a1.506 1.506 0 0 0-.389-.343L3.288 4.818Z"})})})}),_&&(0,rc.jsxs)("div",{style:{position:"absolute",left:0,top:0,width:"25%",height:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"8px",pointerEvents:"none",zIndex:1003},children:[(0,rc.jsx)("span",{style:{color:"#666",fontSize:"14px",fontWeight:500},children:"Press"}),(0,rc.jsxs)("div",{style:{display:"inline-flex",alignItems:"center",gap:"4px",padding:"8px 12px",background:"#f5f5f5",border:"1px solid #d0d0d0",borderRadius:"6px",boxShadow:"0 2px 0 #c0c0c0",fontFamily:"system-ui, -apple-system, sans-serif",fontSize:"16px",fontWeight:600,color:"#333"},children:[(0,rc.jsx)("span",{children:"\u2318"}),(0,rc.jsx)("span",{children:"G"})]}),(0,rc.jsx)("span",{style:{color:"#666",fontSize:"14px",fontWeight:500},children:"to preview"})]}),(0,rc.jsx)("div",{style:{flex:1,overflow:"hidden"},children:(0,rc.jsx)(ab,{previewAddress:P,setPreviewAddress:T,previewServerActive:D})})]})]}):D?(0,rc.jsx)("iframe",{src:P,style:{width:"100%",height:"100%",border:"none",background:"#fff"},title:"Preview"}):(0,rc.jsxs)("div",{style:{width:"100%",height:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",background:"#fafafa",color:"#666",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif'},children:[(0,rc.jsx)("div",{style:{fontSize:"48px",marginBottom:"16px",opacity:.4},children:"\ud83d\udda5\ufe0f"}),(0,rc.jsx)("div",{style:{fontSize:"16px",fontWeight:"500",marginBottom:"8px"},children:"No preview available"}),(0,rc.jsxs)("div",{style:{fontSize:"13px",color:"#888",marginBottom:"12px"},children:[(0,rc.jsx)("code",{style:{background:"#e8e8e8",padding:"2px 6px",borderRadius:"4px"},children:"npx bonzai-burn -g"})," has started architecture view from ",(0,rc.jsx)("code",{style:{background:"#e8e8e8",padding:"2px 6px",borderRadius:"4px"},children:"http://localhost:3001"})]}),(0,rc.jsxs)("div",{style:{fontSize:"14px",color:"#3B82F6"},children:["Start your dev server at ",(0,rc.jsx)("code",{style:{background:"#e8e8e8",padding:"2px 6px",borderRadius:"4px"},children:P})," to see live preview"]})]})})})})]})}),hc.showV3&&(0,rc.jsx)("div",{onMouseDown:e=>{I&&(e.preventDefault(),F(!0))},onClick:()=>{X.current||(b&&(x(!1),localStorage.setItem("bonzai_terminal_hint_seen","true")),A(e=>!e))},style:{height:"28px",background:"#252526",borderTop:"1px solid #3c3c3c",cursor:I?"ns-resize":"pointer",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,transition:"background 0.2s ease"},onMouseEnter:e=>{e.currentTarget.style.background="#2d2d2d"},onMouseLeave:e=>{e.currentTarget.style.background="#252526"},children:(0,rc.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[(0,rc.jsxs)("div",{style:{display:"flex",gap:"4px",opacity:.5},children:[(0,rc.jsx)("div",{style:{width:"3px",height:"3px",background:"#888",borderRadius:"50%"}}),(0,rc.jsx)("div",{style:{width:"3px",height:"3px",background:"#888",borderRadius:"50%"}}),(0,rc.jsx)("div",{style:{width:"3px",height:"3px",background:"#888",borderRadius:"50%"}})]}),(0,rc.jsx)("span",{style:{fontSize:"11px",color:"#888",fontFamily:"monospace"},children:"\u2318B to toggle"}),(0,rc.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"#888",style:{width:"14px",height:"14px",transform:I?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.2s ease"},children:(0,rc.jsx)("path",{fillRule:"evenodd",d:"M9.47 6.47a.75.75 0 0 1 1.06 0l4.25 4.25a.75.75 0 1 1-1.06 1.06L10 8.06l-3.72 3.72a.75.75 0 0 1-1.06-1.06l4.25-4.25Z",clipRule:"evenodd"})})]})}),hc.showV3&&(0,rc.jsxs)("div",{style:{position:"relative",height:I?"".concat(j,"px"):"0px",background:"#1e1e1e",display:"flex",flexDirection:"column",overflow:"hidden",transition:N?"none":"height 0.3s ease-out",flexShrink:0},children:[b&&I&&(0,rc.jsxs)("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center",gap:"12px",background:"rgba(30, 30, 30, 0.85)",zIndex:10,pointerEvents:"none"},children:[(0,rc.jsx)("span",{style:{color:"#aaa",fontSize:"14px",fontWeight:500},children:"Press"}),(0,rc.jsxs)("div",{style:{display:"inline-flex",alignItems:"center",gap:"4px",padding:"8px 12px",background:"#3c3c3c",border:"1px solid #555",borderRadius:"6px",boxShadow:"0 2px 0 #2a2a2a",fontFamily:"system-ui, -apple-system, sans-serif",fontSize:"16px",fontWeight:600,color:"#e0e0e0"},children:[(0,rc.jsx)("span",{children:"\u2318"}),(0,rc.jsx)("span",{children:"B"})]}),(0,rc.jsx)("span",{style:{color:"#aaa",fontSize:"14px",fontWeight:500},children:"to toggle terminal"})]}),(0,rc.jsx)("div",{style:{flex:1,overflow:"hidden",display:I?"block":"none"},children:(0,rc.jsx)(rb,{isVisible:I})})]})]})});return(0,rc.jsx)(Kl,{children:(0,rc.jsxs)(pl,{children:[(0,rc.jsx)(hl,{path:"/",element:(0,rc.jsx)("div",{className:"App",children:(0,rc.jsx)(pc,{})})}),(0,rc.jsx)(hl,{path:"/visualize",element:(0,rc.jsxs)("div",{className:"App",children:[(0,rc.jsx)("div",{style:{display:"inactive"===u?"none":"block"},children:(0,rc.jsx)(fc,{onStatusChange:ne,codeQualityIssues:w,isLoadingCodeQuality:C,standardsViolations:E,isLoadingStandards:M,onScanStandards:re,onAddressChange:T,isCodeViewActive:V,isDevViewActive:p,isChartActive:!V&&!p,onToggleCodeView:()=>{$(!0),oe()},onToggleDevView:()=>{g(!0),$(!1),U(null)},onToggleChart:()=>{$(!1),U(null),oe()},previewServerActive:D,terminalOpen:I,onToggleTerminal:()=>A(e=>!e)})}),(0,rc.jsx)(gc,{serverStatus:u,children:ae}),(0,rc.jsx)(dc,{isOpen:z,onClose:()=>H(!1)})]})})]})})};Ms.init("phc_6fij8bVxFivf4oyyeaFQTLFbbz3rOkTQeo7fUbZpmVU",{api_host:"https://us.i.posthog.com",person_profiles:"always"});r.createRoot(document.getElementById("root")).render((0,rc.jsx)(e.StrictMode,{children:(0,rc.jsx)(lb,{})}))})()})();
3
- //# sourceMappingURL=main.601eb044.js.map