@monotykamary/localterm 1.15.1 → 1.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -72,9 +72,9 @@ WARNING: This link could potentially be dangerous`)){let e=window.open();if(e){t
|
|
|
72
72
|
`,()=>this.lineFeed()),this._parser.setExecuteHandler(`\v`,()=>this.lineFeed()),this._parser.setExecuteHandler(`\f`,()=>this.lineFeed()),this._parser.setExecuteHandler(`\r`,()=>this.carriageReturn()),this._parser.setExecuteHandler(`\b`,()=>this.backspace()),this._parser.setExecuteHandler(` `,()=>this.tab()),this._parser.setExecuteHandler(``,()=>this.shiftOut()),this._parser.setExecuteHandler(``,()=>this.shiftIn()),this._parser.setExecuteHandler(``,()=>this.index()),this._parser.setExecuteHandler(`
`,()=>this.nextLine()),this._parser.setExecuteHandler(``,()=>this.tabSet()),this._parser.registerOscHandler(0,new eu(e=>(this.setTitle(e),this.setIconName(e),!0))),this._parser.registerOscHandler(1,new eu(e=>this.setIconName(e))),this._parser.registerOscHandler(2,new eu(e=>this.setTitle(e))),this._parser.registerOscHandler(4,new eu(e=>this.setOrReportIndexedColor(e))),this._parser.registerOscHandler(8,new eu(e=>this.setHyperlink(e))),this._parser.registerOscHandler(10,new eu(e=>this.setOrReportFgColor(e))),this._parser.registerOscHandler(11,new eu(e=>this.setOrReportBgColor(e))),this._parser.registerOscHandler(12,new eu(e=>this.setOrReportCursorColor(e))),this._parser.registerOscHandler(104,new eu(e=>this.restoreIndexedColor(e))),this._parser.registerOscHandler(110,new eu(e=>this.restoreFgColor(e))),this._parser.registerOscHandler(111,new eu(e=>this.restoreBgColor(e))),this._parser.registerOscHandler(112,new eu(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(let e in Cl)this._parser.registerEscHandler({intermediates:`(`,final:e},()=>this.selectCharset(`(`+e)),this._parser.registerEscHandler({intermediates:`)`,final:e},()=>this.selectCharset(`)`+e)),this._parser.registerEscHandler({intermediates:`*`,final:e},()=>this.selectCharset(`*`+e)),this._parser.registerEscHandler({intermediates:`+`,final:e},()=>this.selectCharset(`+`+e)),this._parser.registerEscHandler({intermediates:`-`,final:e},()=>this.selectCharset(`-`+e)),this._parser.registerEscHandler({intermediates:`.`,final:e},()=>this.selectCharset(`.`+e)),this._parser.registerEscHandler({intermediates:`/`,final:e},()=>this.selectCharset(`/`+e));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 au((e,t)=>this.requestStatusString(e,t)))}getAttrData(){return this._curAttrData}_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){if(this._logService.logLevel<=3){let t,n=new Promise((e,n)=>{t=setTimeout(()=>n(`#SLOW_TIMEOUT`),5e3)});Promise.race([e,n]).then(()=>{t!==void 0&&clearTimeout(t)},e=>{if(t!==void 0&&clearTimeout(t),e!==`#SLOW_TIMEOUT`)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,a=0,o=this._parseStack.paused;if(o){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>131072&&(a=this._parseStack.position+131072)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e==`string`?` "${e}"`:` "${Array.prototype.map.call(e,e=>String.fromCharCode(e)).join(``)}"`}`),this._logService.logLevel===0&&this._logService.trace(`parsing data (codes)`,typeof e==`string`?e.split(``).map(e=>e.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<131072&&(this._parseBuffer=new Uint32Array(Math.min(e.length,131072))),o||this._dirtyRowTracker.clearRange(),e.length>131072)for(let t=a;t<e.length;t+=131072){let a=t+131072<e.length?t+131072:e.length,o=typeof e==`string`?this._stringDecoder.decode(e.substring(t,a),this._parseBuffer):this._utf8Decoder.decode(e.subarray(t,a),this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,o))return this._preserveStack(r,i,o,t),this._logSlowResolvingAsync(n),n}else if(!o){let t=typeof e==`string`?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();let s=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),c=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);c<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(c,this._bufferService.rows-1),end:Math.min(s,this._bufferService.rows-1)})}print(e,t,n){let r,i,a=this._charsetService.charset,o=this._optionsService.rawOptions.screenReaderMode,s=this._bufferService.cols,c=this._coreService.decPrivateModes.wraparound,l=this._coreService.modes.insertMode,u=this._curAttrData,d=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);if(!d)return;this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&n-t>0&&d.getWidth(this._activeBuffer.x-1)===2&&d.setCellFromCodepoint(this._activeBuffer.x-1,0,1,u);let f=this._parser.precedingJoinState;for(let p=t;p<n;++p){if(r=e[p],r===173)continue;if(r<127&&a){let e=a[String.fromCharCode(r)];e&&(r=e.charCodeAt(0))}let t=this._unicodeService.charProperties(r,f);i=Hl.extractWidth(t);let n=Hl.extractShouldJoin(t),m=n?Hl.extractWidth(f):0;f=t,o&&this._onA11yChar.fire(ba(r));let h=this._getCurrentLinkId();if(h&&this._oscLinkService.addLineToLink(h,this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+i-m>s){if(c){let e=d,t=this._activeBuffer.x-m;if(this._activeBuffer.x=m,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),d=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),!d)return;for(m>0&&d instanceof ml&&d.copyCellsFrom(e,t,0,m,!1);t<s;)e.setCellFromCodepoint(t++,0,1,u)}else if(this._activeBuffer.x=s-1,i===2)continue}if(n&&this._activeBuffer.x){let e=d.getWidth(this._activeBuffer.x-1)?1:2;d.addCodepointToCell(this._activeBuffer.x-e,r,i);for(let e=i-m;--e>=0;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,u);continue}if(l&&(d.insertCells(this._activeBuffer.x,i-m,this._activeBuffer.getNullCell(u)),d.getWidth(s-1)===2&&d.setCellFromCodepoint(s-1,0,1,u)),d.setCellFromCodepoint(this._activeBuffer.x++,r,i,u),i>0)for(;--i;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,u)}this._parser.precedingJoinState=f,this._activeBuffer.x<s&&n-t>0&&d.getWidth(this._activeBuffer.x)===0&&!d.hasContent(this._activeBuffer.x)&&d.setCellFromCodepoint(this._activeBuffer.x,0,1,u),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final===`t`&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,e=>xu(e.params[0],this._optionsService.rawOptions.windowOptions)?t(e):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new au(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new eu(t))}registerApcHandler(e,t){return this._parser.registerApcHandler(e,new lu(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(){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(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let 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;let 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(e=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){let 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){let 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){let t=e.params[0];return t===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:t===3&&(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){let t=e.params[0];return t===1&&(this._curAttrData.bg|=536870912),(t===2||t===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,n,r=!1,i=!1){let a=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);a&&(a.replaceCells(t,n,this._activeBuffer.getNullCell(this._eraseAttrData()),i),r&&(a.isWrapped=!1))}_resetBufferLine(e,t=!1){let 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,t=!1){this._restrictCursor(this._bufferService.cols);let n;switch(e.params[0]){case 0:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);n<this._bufferService.rows;n++)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(n);break;case 1:if(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols){let e=this._activeBuffer.lines.get(n+1);e&&(e.isWrapped=!1)}for(;n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(n=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,n-1);n--&&!this._activeBuffer.lines.get(this._activeBuffer.ybase+n)?.getTrimmedLength(););for(;n>=0;n--)this._bufferService.scroll(this._eraseAttrData())}else{for(n=this._bufferService.rows,this._dirtyRowTracker.markDirty(n-1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let 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));break}return!0}eraseInLine(e,t=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,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);break}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;let 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;let n=this._activeBuffer.ybase+this._activeBuffer.y,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();let 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._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(e){this._restrictCursor();let 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._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(ul));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;let t=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.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;let t=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.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;let t=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.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;let t=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();let 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._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(e){let t=this._parser.precedingJoinState;if(!t)return!0;let n=e.params[0]||1,r=Hl.extractWidth(t),i=this._activeBuffer.x-r,a=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(i),o=new Uint32Array(a.length*n),s=0;for(let e=0;e<a.length;){let t=a.codePointAt(e)||0;o[s++]=t,e+=t>65535?2:1}let c=s;for(let e=1;e<n;++e)o.copyWithin(c,0,s),c+=s;return this.print(o,0,c),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is(`xterm`)||this._is(`rxvt-unicode`)||this._is(`screen`)?this._coreService.triggerDataEvent(`\x1B[?1;2c`):this._is(`linux`)&&this._coreService.triggerDataEvent(`\x1B[?6c`)),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is(`xterm`)?this._coreService.triggerDataEvent(`\x1B[>0;276;0c`):this._is(`rxvt-unicode`)?this._coreService.triggerDataEvent(`\x1B[>85;95;0c`):this._is(`linux`)?this._coreService.triggerDataEvent(e.params[0]+`c`):this._is(`screen`)&&this._coreService.triggerDataEvent(`\x1B[>83;40003;0c`)),!0}sendXtVersion(e){return e.params[0]>0||this._coreService.triggerDataEvent(`\x1BP>|xterm.js(${yu})\x1B\\`),!0}_is(e){return(this._optionsService.rawOptions.termName+``).startsWith(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;break}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,wl),this._charsetService.setgCharset(1,wl),this._charsetService.setgCharset(2,wl),this._charsetService.setgCharset(3,wl);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.rawOptions.quirks?.allowSetCursorBlink&&(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._mouseStateService.activeProtocol=`X10`;break;case 1e3:this._mouseStateService.activeProtocol=`VT200`;break;case 1002:this._mouseStateService.activeProtocol=`DRAG`;break;case 1003:this._mouseStateService.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._mouseStateService.activeEncoding=`SGR`;break;case 1015:this._logService.debug(`DECSET 1015 not supported (see #2507)`);break;case 1016:this._mouseStateService.activeEncoding=`SGR_PIXELS`;break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:if(this._optionsService.rawOptions.vtExtensions?.kittyKeyboard){let e=this._coreService.kittyKeyboard;e.mainFlags=e.flags,e.flags=e.altFlags}this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0;break;case 2031:(this._optionsService.rawOptions.vtExtensions?.colorSchemeQuery??!0)&&(this._coreService.decPrivateModes.colorSchemeUpdates=!0);break;case 9001:this._optionsService.rawOptions.vtExtensions?.win32InputMode&&(this._coreService.decPrivateModes.win32InputMode=!0);break}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;break}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.rawOptions.quirks?.allowSetCursorBlink&&(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._mouseStateService.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:this._mouseStateService.activeEncoding=`DEFAULT`;break;case 1015:this._logService.debug(`DECRST 1015 not supported (see #2507)`);break;case 1016:this._mouseStateService.activeEncoding=`DEFAULT`;break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:if(this._optionsService.rawOptions.vtExtensions?.kittyKeyboard){let e=this._coreService.kittyKeyboard;e.altFlags=e.flags,e.flags=e.mainFlags}this._bufferService.buffers.activateNormalBuffer(),e.params[t]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0);break;case 2031:(this._optionsService.rawOptions.vtExtensions?.colorSchemeQuery??!0)&&(this._coreService.decPrivateModes.colorSchemeUpdates=!1);break;case 9001:this._optionsService.rawOptions.vtExtensions?.win32InputMode&&(this._coreService.decPrivateModes.win32InputMode=!1);break}return!0}requestMode(e,t){let n;(e=>(e[e.NOT_RECOGNIZED=0]=`NOT_RECOGNIZED`,e[e.SET=1]=`SET`,e[e.RESET=2]=`RESET`,e[e.PERMANENTLY_SET=3]=`PERMANENTLY_SET`,e[e.PERMANENTLY_RESET=4]=`PERMANENTLY_RESET`))(n||={});let r=this._coreService.decPrivateModes,{activeProtocol:i,activeEncoding:a}=this._mouseStateService,o=this._coreService,{buffers:s,cols:c}=this._bufferService,{active:l,alt:u}=s,d=this._optionsService.rawOptions,f=(e,n)=>(o.triggerDataEvent(`\x1B[${t?``:`?`}${e};${n}$y`),!0),p=e=>e?1:2,m=e.params[0];return t?m===2?f(m,4):m===4?f(m,p(o.modes.insertMode)):m===12?f(m,3):m===20?f(m,p(d.convertEol)):f(m,0):m===1?f(m,p(r.applicationCursorKeys)):m===3?f(m,d.windowOptions.setWinLines?c===80?2:+(c===132):0):m===6?f(m,p(r.origin)):m===7?f(m,p(r.wraparound)):m===8?f(m,3):m===9?f(m,p(i===`X10`)):m===12?f(m,p(d.cursorBlink)):m===25?f(m,p(!o.isCursorHidden)):m===45?f(m,p(r.reverseWraparound)):m===66?f(m,p(r.applicationKeypad)):m===67?f(m,4):m===1e3?f(m,p(i===`VT200`)):m===1002?f(m,p(i===`DRAG`)):m===1003?f(m,p(i===`ANY`)):m===1004?f(m,p(r.sendFocus)):m===1005?f(m,4):m===1006?f(m,p(a===`SGR`)):m===1015?f(m,4):m===1016?f(m,p(a===`SGR_PIXELS`)):m===1048?f(m,1):m===47||m===1047||m===1049?f(m,p(l===u)):m===2004?f(m,p(r.bracketedPasteMode)):m===2026?f(m,p(r.synchronizedOutput)):m===9001&&this._optionsService.rawOptions.vtExtensions?.win32InputMode?f(m,p(r.win32InputMode)):f(m,0)}_updateAttrColor(e,t,n,r,i){return t===2?(e|=50331648,e&=-16777216,e|=wa.fromColorRGB([n,r,i])):t===5&&(e&=-67108864,e|=33554432|n&255),e}_extractColor(e,t,n){let r=[0,0,-1,0,0,0],i=0,a=0;do{if(r[a+i]=e.params[t+a],e.hasSubParams(t+a)){let n=e.getSubParams(t+a),o=0;do r[1]===5&&(i=1),r[a+o+1+i]=n[o];while(++o<n.length&&o+a+1+i<r.length);break}if(r[1]===5&&a+i>=2||r[1]===2&&a+i>=5)break;r[1]&&(i=1)}while(++a+t<e.length&&a+i<r.length);for(let e=2;e<r.length;++e)r[e]===-1&&(r[e]=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 a}_processUnderline(e,t){t.extended=t.extended.clone(),(!~e||e>5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,e===0&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=ul.fg,e.bg=ul.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(e.length===1&&e.params[0]===0)return this._processSGR0(this._curAttrData),!0;let t=e.length,n,r=this._curAttrData;for(let i=0;i<t;i++)n=e.params[i],n>=30&&n<=37?(r.fg&=-67108864,r.fg|=16777216|n-30):n>=40&&n<=47?(r.bg&=-67108864,r.bg|=16777216|n-40):n>=90&&n<=97?(r.fg&=-67108864,r.fg|=n-90|16777224):n>=100&&n<=107?(r.bg&=-67108864,r.bg|=n-100|16777224):n===0?this._processSGR0(r):n===1?r.fg|=134217728:n===3?r.bg|=67108864:n===4?(r.fg|=268435456,this._processUnderline(e.hasSubParams(i)?e.getSubParams(i)[0]:1,r)):n===5?r.fg|=536870912:n===7?r.fg|=67108864:n===8?r.fg|=1073741824:n===9?r.fg|=2147483648:n===2?r.bg|=134217728:n===21?this._processUnderline(2,r):n===22?(r.fg&=-134217729,r.bg&=-134217729):n===23?r.bg&=-67108865:n===24?(r.fg&=-268435457,this._processUnderline(0,r)):n===25?r.fg&=-536870913:n===27?r.fg&=-67108865:n===28?r.fg&=-1073741825:n===29?r.fg&=2147483647:n===39?(r.fg&=-67108864,r.fg|=ul.fg&16777215):n===49?(r.bg&=-67108864,r.bg|=ul.bg&16777215):n===38||n===48||n===58?i+=this._extractColor(e,i,r):n===53?r.bg|=1073741824:n===55?r.bg&=-1073741825:n===221&&(this._optionsService.rawOptions.vtExtensions?.kittySgrBoldFaintControl??!0)?r.fg&=-134217729:n===222&&(this._optionsService.rawOptions.vtExtensions?.kittySgrBoldFaintControl??!0)?r.bg&=-134217729:n===59?(r.extended=r.extended.clone(),r.extended.underlineColor=-1,r.updateExtended()):this._logService.debug(`Unknown SGR attribute: %d.`,n);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`\x1B[0n`);break;case 6:let e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`\x1B[${e};${t}R`);break}return!0}deviceStatusPrivate(e){switch(e.params[0]){case 6:let e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`\x1B[?${e};${t}R`);break;case 15:break;case 25:break;case 26:break;case 53:break;case 996:(this._optionsService.rawOptions.vtExtensions?.colorSchemeQuery??!0)&&this._onRequestColorSchemeQuery.fire();break}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=ul.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){let t=e.length===0?1:e.params[0];if(t===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(t){case 1:case 2:this._coreService.decPrivateModes.cursorStyle=`block`;break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle=`underline`;break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle=`bar`;break}let e=t%2==1;this._coreService.decPrivateModes.cursorBlink=e}return!0}setScrollRegion(e){let t=e.params[0]||1,n;return(e.length<2||(n=e.params[1])>this._bufferService.rows||n===0)&&(n=this._bufferService.rows),n>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=n-1,this._setCursor(0,0)),!0}windowOptions(e){if(!xu(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:t!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`\x1B[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:(t===0||t===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(t===0||t===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop());break}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,this._activeBuffer.savedCharsets=this._charsetService.charsets.slice(),this._activeBuffer.savedGlevel=this._charsetService.glevel,this._activeBuffer.savedOriginMode=this._coreService.decPrivateModes.origin,this._activeBuffer.savedWraparoundMode=this._coreService.decPrivateModes.wraparound,!0}restoreCursor(e){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;for(let e=0;e<this._activeBuffer.savedCharsets.length;e++)this._charsetService.setgCharset(e,this._activeBuffer.savedCharsets[e]);return this._charsetService.setgLevel(this._activeBuffer.savedGlevel),this._coreService.decPrivateModes.origin=this._activeBuffer.savedOriginMode,this._coreService.decPrivateModes.wraparound=this._activeBuffer.savedWraparoundMode,this._restrictCursor(),!0}setTitle(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){let t=[],n=e.split(`;`);for(;n.length>1;){let e=n.shift(),r=n.shift();if(/^\d+$/.exec(e)){let n=parseInt(e,10);if(Tu(n))if(r===`?`)t.push({type:0,index:n});else{let e=gu(r);e&&t.push({type:1,index:n,color:e})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(`;`);if(t===-1)return!0;let n=e.slice(0,t).trim(),r=e.slice(t+1);return r?this._createHyperlink(n,r):n.trim()?!1:this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let n=e.split(`:`),r,i=n.findIndex(e=>e.startsWith(`id=`));return i!==-1&&(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){let n=e.split(`;`);for(let e=0;e<n.length&&!(t>=this._specialColors.length);++e,++t)if(n[e]===`?`)this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let r=gu(n[e]);r&&this._onColor.fire([{type:1,index:this._specialColors[t],color:r}])}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;let t=[],n=e.split(`;`);for(let e=0;e<n.length;++e)if(/^\d+$/.exec(n[e])){let r=parseInt(n[e],10);Tu(r)&&t.push({type:2,index:r})}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,wl),!0}selectCharset(e){return e.length===2?(e[0]===`/`||this._charsetService.setgCharset(bu[e[0]],Cl[e[1]]??wl),!0):(this.selectDefaultCharset(),!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){let 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=ul.clone(),this._eraseAttrDataInternal=ul.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new Ea;e.content=4194373,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t<this._bufferService.rows;++t){let 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){let n=e=>(this._coreService.triggerDataEvent(`\x1B${e}\x1B\\`),!0),r=this._bufferService.buffer,i=this._optionsService.rawOptions;return n(e===`"q`?`P1$r${+!!this._curAttrData.isProtected()}"q`:e===`"p`?`P1$r61;1"p`:e===`r`?`P1$r${r.scrollTop+1};${r.scrollBottom+1}r`:e===`m`?`P1$r0m`:e===` q`?`P1$r${{block:2,underline:4,bar:6}[i.cursorStyle]-+!!i.cursorBlink} q`:`P0$r`)}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}kittyKeyboardSet(e){if(!this._optionsService.rawOptions.vtExtensions?.kittyKeyboard)return!0;let t=e.params[0]||0,n=e.length>1&&e.params[1]||1,r=this._coreService.kittyKeyboard;switch(n){case 1:r.flags=t;break;case 2:r.flags|=t;break;case 3:r.flags&=~t;break}return!0}kittyKeyboardQuery(e){if(!this._optionsService.rawOptions.vtExtensions?.kittyKeyboard)return!0;let t=this._coreService.kittyKeyboard.flags;return this._coreService.triggerDataEvent(`\x1B[?${t}u`),!0}kittyKeyboardPush(e){if(!this._optionsService.rawOptions.vtExtensions?.kittyKeyboard)return!0;let t=e.params[0]||0,n=this._coreService.kittyKeyboard,r=this._bufferService.buffer===this._bufferService.buffers.alt?n.altStack:n.mainStack;return r.length>=16&&r.shift(),r.push(n.flags),n.flags=t,!0}kittyKeyboardPop(e){if(!this._optionsService.rawOptions.vtExtensions?.kittyKeyboard)return!0;let t=Math.max(1,e.params[0]||1),n=this._coreService.kittyKeyboard,r=this._bufferService.buffer===this._bufferService.buffers.alt?n.altStack:n.mainStack;for(let e=0;e<t&&r.length>0;e++)n.flags=r.pop();return r.length===0&&t>0&&(n.flags=0),!0}},wu=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&&(Su=e,e=t,t=Su),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};wu=ca([K(0,ja)],wu);function Tu(e){return 0<=e&&e<256}var Eu=class extends no{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._innerWriteTimer=this._register(new ao),this._onWriteParsed=this._register(new q),this.onWriteParsed=this._onWriteParsed.event,this._register($a(()=>{this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0}))}handleUserInput(){this._didUserInput=!0}flushSync(){if(this._store.isDisposed||this._isSyncWriting)return;this._isSyncWriting=!0;let e,t=!1;for(;e=this._writeBuffer.shift();){t=!0,this._action(e);let n=this._callbacks.shift();n&&n()}this._pendingData=0,this._bufferOffset=2147483647,this._writeBuffer.length=0,this._callbacks.length=0,this._isSyncWriting=!1,t&&this._onWriteParsed.fire()}writeSync(e,t){if(this._store.isDisposed)return;if(t!==void 0&&this._syncCalls>t){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let n;for(;n=this._writeBuffer.shift();){this._action(n);let e=this._callbacks.shift();e&&e()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(!this._store.isDisposed){if(this._pendingData>5e7)throw Error(`write data discarded, use flow control to avoid losing data`);if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),this._innerWrite();return}this._scheduleInnerWrite()}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}}_scheduleInnerWrite(e=0,t=!0){this._store.isDisposed||this._innerWriteTimer.cancelAndSet(()=>this._innerWrite(e,t),0)}_innerWrite(e=0,t=!0){if(this._store.isDisposed)return;let n=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let e=this._writeBuffer[this._bufferOffset],r=this._action(e,t);if(r){r.catch(e=>(queueMicrotask(()=>{throw e}),Promise.resolve(!1))).then(e=>{this._store.isDisposed||(performance.now()-n>=12?this._scheduleInnerWrite(0,e):this._innerWrite(n,e))});return}let i=this._callbacks[this._bufferOffset];if(i&&i(),this._bufferOffset++,this._pendingData-=e.length,performance.now()-n>=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),this._scheduleInnerWrite()):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}},Du=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let t=this._bufferService.buffer;if(e.id===void 0){let 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}let n=e,r=this._getEntryIdKey(n),i=this._entriesWithId.get(r);if(i)return this.addLineToLink(i.id,t.ybase+t.y),i.id;let a=t.addMarker(t.ybase+t.y),o={id:this._nextId++,key:this._getEntryIdKey(n),data:n,lines:[a]};return a.onDispose(()=>this._removeMarkerFromLink(o,a)),this._entriesWithId.set(o.key,o),this._dataByLinkId.set(o.id,o),o.id}addLineToLink(e,t){let n=this._dataByLinkId.get(e);if(n&&n.lines.every(e=>e.line!==t)){let e=this._bufferService.buffer.addMarker(t);n.lines.push(e),e.onDispose(()=>this._removeMarkerFromLink(n,e))}}getLinkData(e){return this._dataByLinkId.get(e)?.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let n=e.lines.indexOf(t);n!==-1&&(e.lines.splice(n,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};Du=ca([K(0,ja)],Du);var Ou=!1,ku=class extends no{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new ro),this._onBinary=this._register(new q),this.onBinary=this._onBinary.event,this._onData=this._register(new q),this.onData=this._onData.event,this._onLineFeed=this._register(new q),this.onLineFeed=this._onLineFeed.event,this._onRender=this._register(new q),this.onRender=this._onRender.event,this._onResize=this._register(new q),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new q),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new q),this._instantiationService=new rl,this.optionsService=this._register(new jl(e)),this._instantiationService.setService(La,this.optionsService),this._logService=this._register(this._instantiationService.createInstance(ol)),this._instantiationService.setService(Ia,this._logService),this._bufferService=this._register(this._instantiationService.createInstance(Ol)),this._instantiationService.setService(ja,this._bufferService),this.coreService=this._register(this._instantiationService.createInstance(Il)),this._instantiationService.setService(Na,this.coreService),this.mouseStateService=this._register(this._instantiationService.createInstance(Vl)),this._instantiationService.setService(Ma,this.mouseStateService),this.unicodeService=this._register(this._instantiationService.createInstance(Hl)),this.unicodeService.register(new ql),this._instantiationService.setService(za,this.unicodeService),this._charsetService=this._instantiationService.createInstance(Jl),this._instantiationService.setService(Pa,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(Du),this._instantiationService.setService(Ra,this._oscLinkService),this._inputHandler=this._register(new Cu(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.mouseStateService,this.unicodeService)),this._register(Go.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(Go.forward(this._bufferService.onResize,this._onResize)),this._register(Go.forward(this.coreService.onData,this._onData)),this._register(Go.forward(this.coreService.onBinary,this._onBinary)),this._register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom(!0))),this._register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this._register(this.optionsService.onMultipleOptionChange([`windowsPty`],()=>this._handleWindowsPtyOptionChange())),this._register(this._bufferService.onScroll(()=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this._register(new Eu((e,t)=>this._inputHandler.parse(e,t))),this._register(Go.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new q),this._onScroll.event(e=>{this._onScrollApi?.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(let t in e)this.optionsService.options[t]=e[t]}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=3&&!Ou&&(this._logService.warn(`writeSync is unreliable and will be removed soon.`),Ou=!0),this._writeBuffer.writeSync(e,t)}input(e,t=!0){this.coreService.triggerDataEvent(e,t)}resize(e,t){isNaN(e)||isNaN(t)||(e=Math.max(e,2),t=Math.max(t,1),this._writeBuffer.flushSync(),this._bufferService.resize(e,t))}scroll(e,t=!1){this._bufferService.scroll(e,t)}scrollLines(e,t){this._bufferService.scrollLines(e,t)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&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)}registerApcHandler(e,t){return this._inputHandler.registerApcHandler(e,t)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.mouseStateService.reset()}_handleWindowsPtyOptionChange(){let e=!1,t=this.optionsService.rawOptions.windowsPty;t&&t.backend!==void 0&&t.buildNumber!==void 0&&(e=t.backend===`conpty`&&t.buildNumber<21376),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let e=[];e.push(this.onLineFeed(Yl.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:`H`},()=>(Yl(this._bufferService),!1))),this._windowsWrappingHeuristics.value=$a(()=>{for(let t of e)t.dispose()})}}},Au=0,ju=class{constructor(e,t){this._getKey=e,this._array=[],this._insertedValues=[],this._isFlushingInserted=!1,this._deletedIndices=[],this._isFlushingDeleted=!1,this._flushInsertedTask=new yc(t),this._flushDeletedTask=new yc(t)}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(e){this._flushCleanupDeleted(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((e,t)=>this._getKey(e)-this._getKey(t)),t=0,n=0,r=Array(this._array.length+this._insertedValues.length);for(let i=0;i<r.length;i++)n>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[n])?(r[i]=e[t],t++):r[i]=this._array[n++];this._array=r,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),this._array.length===0)return!1;let t=this._getKey(e);if(t===void 0||(Au=this._search(t),Au===-1)||this._getKey(this._array[Au])!==t)return!1;do if(this._array[Au]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(Au),!0;while(++Au<this._array.length&&this._getKey(this._array[Au])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((e,t)=>e-t),t=0,n=Array(this._array.length-e.length),r=0;for(let i=0;i<this._array.length;i++)e[t]===i?t++:n[r++]=this._array[i];this._array=n,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(Au=this._search(e),!(Au<0||Au>=this._array.length)&&this._getKey(this._array[Au])===e))do yield this._array[Au];while(++Au<this._array.length&&this._getKey(this._array[Au])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(Au=this._search(e),!(Au<0||Au>=this._array.length)&&this._getKey(this._array[Au])===e))do t(this._array[Au]);while(++Au<this._array.length&&this._getKey(this._array[Au])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,n=this._array.length-1;for(;n>=t;){let r=t+n>>1,i=this._getKey(this._array[r]);if(i>e)n=r-1;else if(i<e)t=r+1;else{for(;r>0&&this._getKey(this._array[r-1])===e;)r--;return r}}return t}},Mu=0,Nu=0,Pu=class extends no{constructor(e,t){super(),this._logService=e,this._bufferService=t,this._lineCache=this._register(new Fu),this._onDecorationRegistered=this._register(new q),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new q),this.onDecorationRemoved=this._onDecorationRemoved.event,this._decorations=new ju(e=>e?.marker.line,this._logService),this._register($a(()=>this.reset())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._lineCache.attachToBufferLines(this._bufferService.buffer.lines)})),this._lineCache.attachToBufferLines(this._bufferService.buffer.lines)}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new Iu(e);if(t){let e=t.marker.onDispose(()=>t.dispose()),n=t.onDispose(()=>{n.dispose(),t&&(this._decorations.delete(t)&&(this._lineCache.remove(t),this._onDecorationRemoved.fire(t)),e.dispose())});this._decorations.insert(t),this._lineCache.add(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear(),this._lineCache.clear()}*getDecorationsAtCell(e,t,n){let r=this._lineCache.getDecorationsOnLine(t);if(r)for(let t of r)Mu=t.options.x??0,Nu=Mu+(t.options.width??1),e>=Mu&&e<Nu&&(!n||(t.options.layer??`bottom`)===n)&&(yield t)}forEachDecorationAtCell(e,t,n,r){let i=this._lineCache.getDecorationsOnLine(t);if(i)for(let t of i)Mu=t.options.x??0,Nu=Mu+(t.options.width??1),e>=Mu&&e<Nu&&(!n||(t.options.layer??`bottom`)===n)&&r(t)}};Pu=ca([K(0,Ia),K(1,ja)],Pu);var Fu=class extends no{constructor(){super(...arguments),this._decorationsByLine=new Map,this._decorations=new Set,this._bufferLineListeners=this._register(new ro),this._lineIndexSyncTimer=this._register(new oo),this._lineIndexSyncCallbacks=[]}clear(){this._lineIndexSyncCallbacks.length=0,this._lineIndexSyncTimer.cancel(),this._decorationsByLine.clear(),this._decorations.clear()}add(e){this._decorations.add(e),this._addToLineBuckets(e)}remove(e){this._decorations.delete(e),this._removeFromLineBuckets(e)}getDecorationsOnLine(e){return this._decorationsByLine.get(e)}attachToBufferLines(e){let t=new to;this._bufferLineListeners.value=t,t.add(e.onTrim(e=>this._handleBufferLinesTrim(e))),t.add(e.onInsert(e=>this._handleBufferLinesInsert(e))),t.add(e.onDelete(e=>this._handleBufferLinesDelete(e)))}_getDecorationHeight(e){return e.options.height??1}_addToLineBuckets(e){let t=e.marker.line;if(t<0)return;e._indexedStartLine=t;let n=this._getDecorationHeight(e);for(let r=t;r<t+n;r++){let t=this._decorationsByLine.get(r);t||(t=[],this._decorationsByLine.set(r,t)),t.push(e)}}_removeFromLineBuckets(e){let t=e._indexedStartLine,n=this._getDecorationHeight(e);for(let r=t;r<t+n;r++){let t=this._decorationsByLine.get(r);if(!t)continue;let n=t.indexOf(e);n!==-1&&t.splice(n,1),t.length===0&&this._decorationsByLine.delete(r)}}_reindexDecoration(e){this._removeFromLineBuckets(e),!e.marker.isDisposed&&e.marker.line>=0&&this._addToLineBuckets(e)}_scheduleLineIndexSync(e){this._lineIndexSyncCallbacks.push(e),this._lineIndexSyncTimer.set(()=>{let e=this._lineIndexSyncCallbacks;this._lineIndexSyncCallbacks=[];for(let t of e)t()})}_handleBufferLinesTrim(e){if(e<=0)return;let t=new Map;for(let[n,r]of this._decorationsByLine){let i=n-e;i<0||this._mergeLineBucket(t,i,r)}this._decorationsByLine.clear();for(let[e,n]of t)this._decorationsByLine.set(e,n);for(let t of this._decorations)t.marker.isDisposed||(t._indexedStartLine-=e)}_handleBufferLinesInsert(e){this._scheduleLineIndexSync(()=>this._applyBufferLinesInsert(e))}_handleBufferLinesDelete(e){this._scheduleLineIndexSync(()=>this._applyBufferLinesDelete(e))}_mergeLineBucket(e,t,n){let r=e.get(t);if(r)for(let e=0,t=n.length;e<t;e++)r.push(n[e]);else e.set(t,n.slice())}_applyBufferLinesInsert(e){let{index:t,amount:n}=e,r=[];for(let e of this._decorations){if(e.marker.isDisposed)continue;let n=e._indexedStartLine;n<t&&n+this._getDecorationHeight(e)>t&&(r.push(e),this._removeFromLineBuckets(e))}let i=new Map;for(let[e,r]of this._decorationsByLine){let a=e>=t?e+n:e;this._mergeLineBucket(i,a,r)}this._decorationsByLine.clear();for(let[e,t]of i)this._decorationsByLine.set(e,t);for(let e of this._decorations)e.marker.isDisposed||e._indexedStartLine>=t&&(e._indexedStartLine=e.marker.line);for(let e of r)this._addToLineBuckets(e)}_applyBufferLinesDelete(e){let t=e.index+e.amount,n=new Map;for(let[r,i]of this._decorationsByLine){if(r>=e.index&&r<t)continue;let a=r>=t?r-e.amount:r;this._mergeLineBucket(n,a,i)}this._decorationsByLine.clear();for(let[e,t]of n)this._decorationsByLine.set(e,t);let r=[];for(let n of this._decorations){if(n.marker.isDisposed)continue;let i=n._indexedStartLine,a=this._getDecorationHeight(n);i>=t?n._indexedStartLine=n.marker.line:i<e.index&&i+a>t&&r.push(n)}for(let e of r)this._reindexDecoration(e)}},Iu=class extends to{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new q),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new q),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this._indexedStartLine=e.marker.line,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position=`full`)}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=Es.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=Es.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},Lu=1e3,Ru=class{constructor(e,t=Lu){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&=(clearTimeout(this._refreshTimeoutID),void 0),this._additionalRefreshRequested=!1}refresh(e,t,n){this._rowCount=n,e??=0,t??=this._rowCount-1,this._rowStart=this._rowStart===void 0?e:Math.min(this._rowStart,e),this._rowEnd=this._rowEnd===void 0?t:Math.max(this._rowEnd,t);let r=performance.now();if(r-this._lastRefreshMs>=this._debounceThresholdMS)this._refreshTimeoutID!==void 0&&(clearTimeout(this._refreshTimeoutID),this._refreshTimeoutID=void 0,this._additionalRefreshRequested=!1),this._lastRefreshMs=r,this._innerRefresh();else if(!this._additionalRefreshRequested){let e=r-this._lastRefreshMs,t=this._debounceThresholdMS-e;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},t)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let 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)}},zu=!1,Bu=class extends no{constructor(e,t,n,r){super(),this._terminal=e,this._coreBrowserService=n,this._renderService=r,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce=``;let i=this._coreBrowserService.mainDocument;this._accessibilityContainer=i.createElement(`div`),this._accessibilityContainer.classList.add(`xterm-accessibility`),this._rowContainer=i.createElement(`div`),this._rowContainer.setAttribute(`role`,`list`),this._rowContainer.classList.add(`xterm-accessibility-tree`),this._rowElements=[];for(let e=0;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);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._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=i.createElement(`div`),this._liveRegion.classList.add(`live-region`),this._liveRegion.setAttribute(`aria-live`,`assertive`),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new Ru(this._renderRows.bind(this))),!this._terminal.element)throw Error(`Cannot enable accessibility before Terminal.open`);zu?(this._accessibilityContainer.classList.add(`debug`),this._rowContainer.classList.add(`debug`),this._debugRootContainer=i.createElement(`div`),this._debugRootContainer.classList.add(`xterm`),this._debugRootContainer.appendChild(i.createTextNode(`------start a11y------`)),this._debugRootContainer.appendChild(this._accessibilityContainer),this._debugRootContainer.appendChild(i.createTextNode(`------end a11y------`)),this._terminal.element.insertAdjacentElement(`afterend`,this._debugRootContainer)):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(`
|
|
73
73
|
`))),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._register(uo(i,`selectionchange`,()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register($a(()=>{zu?this._debugRootContainer.remove():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,e===`
|
|
74
74
|
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent=fa.get())))}_clearLiveRegion(){this._liveRegion.textContent=``,this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),/\p{Control}/u.test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let n=this._terminal.buffer,r=n.lines.length.toString();for(let i=e;i<=t;i++){let e=n.lines.get(n.ydisp+i),t=[],a=e?.translateToString(!0,void 0,void 0,t)||``,o=(n.ydisp+i+1).toString(),s=this._rowElements[i];s&&(a.length===0?(s.textContent=`\xA0`,this._rowColumns.set(s,[0,1])):(s.textContent=a,this._rowColumns.set(s,t)),s.setAttribute(`aria-posinset`,o),s.setAttribute(`aria-setsize`,r),this._alignRowWidth(s))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent===fa.get()&&this._clearLiveRegion(),this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce=``)}_handleBoundaryFocus(e,t){let n=e.target,r=this._rowElements[t===0?1:this._rowElements.length-2];if(n.getAttribute(`aria-posinset`)===(t===0?`1`:`${this._terminal.buffer.lines.length}`)||e.relatedTarget!==r)return;let i,a;if(t===0?(i=n,a=this._rowElements.pop(),this._rowContainer.removeChild(a)):(i=this._rowElements.shift(),a=n,this._rowContainer.removeChild(i)),i.removeEventListener(`focus`,this._topBoundaryFocusListener),a.removeEventListener(`focus`,this._bottomBoundaryFocusListener),t===0){let e=this._createAccessibilityTreeNode();this._rowElements.unshift(e),this._rowContainer.insertAdjacentElement(`afterbegin`,e)}else{let 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(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error(`anchorNode and/or focusNode are null`);return}let t={node:e.anchorNode,offset:e.anchorOffset},n={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(n.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===n.node&&t.offset>n.offset)&&([t,n]=[n,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let r=this._rowElements.slice(-1)[0];if(n.node.compareDocumentPosition(r)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(n={node:r,offset:r.textContent?.length??0}),!this._rowContainer.contains(n.node))return;let i=({node:e,offset:t})=>{let n=e instanceof Text?e.parentNode:e,r=parseInt(n?.getAttribute(`aria-posinset`),10)-1;if(isNaN(r))return console.warn(`row is invalid. Race condition?`),null;let i=this._rowColumns.get(n);if(!i)return console.warn(`columns is null. Race condition?`),null;let a=t<i.length?i[t]:i.slice(-1)[0]+1;return a>=this._terminal.cols&&(++r,a=0),{row:r,column:a}},a=i(t),o=i(n);if(!(!a||!o)){if(a.row>o.row||a.row===o.row&&a.column>=o.column)throw Error(`invalid range`);this._terminal.select(a.column,a.row,(o.row-a.row)*this._terminal.cols-a.column+o.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener(`focus`,this._bottomBoundaryFocusListener);for(let e=this._rowContainer.children.length;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement(`div`);return e.setAttribute(`role`,`listitem`),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}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]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){e.style.transform=``;let t=e.getBoundingClientRect().width,n=this._rowColumns.get(e)?.slice(-1)?.[0];if(!n)return;let r=n*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${r/t})`}};Bu=ca([K(1,Fa),K(2,Wa),K(3,qa)],Bu);var Vu=class extends no{constructor(e,t,n,r,i){super(),this._element=e,this._mouseCoordsService=t,this._renderService=n,this._bufferService=r,this._linkProviderService=i,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new q),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new q),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register($a(()=>{eo(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(uo(this._element,`mouseleave`,()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(uo(this._element,`mousemove`,this._handleMouseMove.bind(this))),this._register(uo(this._element,`mousedown`,this._handleMouseDown.bind(this))),this._register(uo(this._element,`mouseup`,this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let t=this._positionFromMouseEvent(e,this._element);if(!t)return;this._isMouseOut=!1;let n=e.composedPath();for(let e=0;e<n.length;e++){let t=n[e];if(t.classList.contains(`xterm`))break;if(t.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){this._clearCurrentLink(),this._askForLink(e,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,t){(!this._activeProviderReplies||!t)&&(this._activeProviderReplies?.forEach(e=>{e?.forEach(e=>{e.link.dispose&&e.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let n=!1;for(let[r,i]of this._linkProviderService.linkProviders.entries())t?this._activeProviderReplies?.get(r)&&(n=this._checkLinkProviderResult(r,e,n)):i.provideLinks(e.y,t=>{if(this._isMouseOut)return;let i=t?.map(e=>({link:e}));this._activeProviderReplies?.set(r,i),n=this._checkLinkProviderResult(r,e,n),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let n=new Set;for(let r=0;r<t.size;r++){let i=t.get(r);if(i)for(let t=0;t<i.length;t++){let r=i[t],a=r.link.range.start.y<e?0:r.link.range.start.x,o=r.link.range.end.y>e?this._bufferService.cols:r.link.range.end.x;for(let e=a;e<=o;e++){if(n.has(e)){i.splice(t--,1);break}n.add(e)}}}}_checkLinkProviderResult(e,t,n){if(!this._activeProviderReplies)return n;let r=this._activeProviderReplies.get(e),i=!1;for(let t=0;t<e;t++)(!this._activeProviderReplies.has(t)||this._activeProviderReplies.get(t))&&(i=!0);if(!i&&r){let e=r.find(e=>this._linkAtPosition(e.link,t));e&&(n=!0,this._handleNewLink(e))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!n)for(let e=0;e<this._activeProviderReplies.size;e++){let r=this._activeProviderReplies.get(e)?.find(e=>this._linkAtPosition(e.link,t));if(r){n=!0,this._handleNewLink(r);break}}return n}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element);t&&this._mouseDownLink&&Hu(this._mouseDownLink.link,this._currentLink.link)&&this._linkAtPosition(this._currentLink.link,t)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,t){!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,eo(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;let t=this._positionFromMouseEvent(this._lastMouseEvent,this._element);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0?!0:e.link.decorations.underline,pointerCursor:e.link.decorations===void 0?!0:e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:e=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==e&&(this._currentLink.state.decorations.pointerCursor=e,this._currentLink.state.isHovered&&this._element.classList.toggle(`xterm-cursor-pointer`,e))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:t=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==t&&(this._currentLink.state.decorations.underline=t,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,t))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(e=>{if(!this._currentLink)return;let t=e.start===0?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)){let e=this._positionFromMouseEvent(this._lastMouseEvent,this._element);e&&this._askForLink(e,!1)}})))}_linkHover(e,t,n){this._currentLink?.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){let 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){this._currentLink?.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){let 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){let n=this._mouseCoordsService.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(n)return{x:n[0],y:n[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}}};Vu=ca([K(1,Ga),K(2,qa),K(3,ja),K(4,Za)],Vu);function Hu(e,t){return e.text===t.text&&e.range.start.x===t.range.start.x&&e.range.start.y===t.range.start.y&&e.range.end.x===t.range.end.x&&e.range.end.y===t.range.end.y}var Uu=class extends ku{constructor(e={}){super(e),this._linkifier=this._register(new ro),this.browser=Co,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new ro),this._onCursorMove=this._register(new q),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new q),this.onKey=this._onKey.event,this._onSelectionChange=this._register(new q),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new q),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new q),this.onBell=this._onBell.event,this._onFocus=this._register(new q),this._onBlur=this._register(new q),this._onA11yCharEmitter=this._register(new q),this._onA11yTabEmitter=this._register(new q),this._onWillOpen=this._register(new q),this._onDimensionsChange=this._register(new q),this.onDimensionsChange=this._onDimensionsChange.event,this._setup(),this._decorationService=this._instantiationService.createInstance(Pu),this._instantiationService.setService(Ba,this._decorationService),this._keyboardService=this._instantiationService.createInstance(tl),this._instantiationService.setService(Qa,this._keyboardService),this._linkProviderService=this._instantiationService.createInstance(ec),this._instantiationService.setService(Za,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(Va)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(e=>this.refresh(e?.start??0,e?.end??this.rows-1))),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(Go.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(Go.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(Go.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(Go.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(e=>this._afterResize(e.cols,e.rows))),this._register($a(()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)}))}get linkifier(){return this._linkifier.value}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}get dimensions(){if(!this._renderService)return;let e=this._renderService.dimensions;return{css:{canvas:{...e.css.canvas},cell:{...e.css.cell}},device:{canvas:{...e.device.canvas},cell:{...e.device.cell},char:{...e.device.char}}}}_handleColorEvent(e){if(this._themeService)for(let 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:let r=Ts.toColorRGB(e===`ansi`?this._themeService.colors.ansi[t.index]:this._themeService.colors[e]);this.coreService.triggerDataEvent(`\x1B]${n};${vu(r)}\x1B\\`);break;case 1:if(e===`ansi`)this._themeService.modifyColors(e=>e.ansi[t.index]=ws.toColor(...t.color));else{let n=e;this._themeService.modifyColors(e=>e[n]=ws.toColor(...t.color))}break;case 2:this._themeService.restoreColor(t.index);break}}}_reportColorScheme(){if(!this._themeService)return;let e=Ds.relativeLuminance(this._themeService.colors.background.rgba>>8)<Ds.relativeLuminance(this._themeService.colors.foreground.rgba>>8)?1:2;this.coreService.triggerDataEvent(`\x1B[?997;${e}n`)}_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(Bu,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(`\x1B[I`),this.element.classList.add(`focus`),this._showCursor(),this._onFocus.fire()}blur(){return this.textarea?.blur()}_handleTextAreaBlur(){this.textarea.value=``,this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(`\x1B[O`),this.element.classList.remove(`focus`),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;let n=Math.min(this.buffer.x,this.cols-1),r=this._renderService.dimensions.css.cell.height,i=t.getWidth(n),a=this._renderService.dimensions.css.cell.width*i,o=this.buffer.y*this._renderService.dimensions.css.cell.height,s=n*this._renderService.dimensions.css.cell.width;this.textarea.style.left=s+`px`,this.textarea.style.top=o+`px`,this.textarea.style.width=a+`px`,this.textarea.style.height=r+`px`,this.textarea.style.lineHeight=r+`px`,this.textarea.style.zIndex=`-5`}_initGlobal(){this._bindKeys(),this._register(uo(this.element,`copy`,e=>{this.hasSelection()&&ha(e,this._selectionService)}));let e=e=>ga(e,this.textarea,this.coreService,this.optionsService);this._register(uo(this.textarea,`paste`,e)),this._register(uo(this.element,`paste`,e)),Do?this._register(uo(this.element,`mousedown`,e=>{e.button===2&&ya(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(uo(this.element,`contextmenu`,e=>{ya(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),Fo&&this._register(uo(this.element,`auxclick`,e=>{e.button===1&&va(e,this.textarea,this.screenElement)}))}_bindKeys(){this._register(uo(this.textarea,`keyup`,e=>this._keyUp(e),!0)),this._register(uo(this.textarea,`keydown`,e=>this._keyDown(e),!0)),this._register(uo(this.textarea,`keypress`,e=>this._keyPress(e),!0)),this._register(uo(this.textarea,`compositionstart`,()=>{this._syncTextArea(),this._compositionHelper.compositionstart(),this._compositionHelper.updateCompositionElements()})),this._register(uo(this.textarea,`compositionupdate`,e=>this._compositionHelper.compositionupdate(e))),this._register(uo(this.textarea,`compositionend`,()=>this._compositionHelper.compositionend())),this._register(uo(this.textarea,`input`,e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){if(!e)throw Error(`Terminal requires a parent element.`);if(e.isConnected||this._logService.debug(`Terminal.open was called on an element that was not attached to the DOM`),this.element?.ownerDocument.defaultView&&this._coreBrowserService){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}this._document=e.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement(`div`),this.element.dir=`ltr`,this.element.classList.add(`terminal`),this.element.classList.add(`xterm`),this.element.classList.toggle(`allow-transparency`,this.options.allowTransparency),this._register(this.optionsService.onSpecificOptionChange(`allowTransparency`,e=>this.element.classList.toggle(`allow-transparency`,e))),e.appendChild(this.element);let t=this._document.createDocumentFragment();this._viewportElement=this._document.createElement(`div`),this._viewportElement.classList.add(`xterm-viewport`),t.appendChild(this._viewportElement),this.screenElement=this._document.createElement(`div`),this.screenElement.classList.add(`xterm-screen`),this._register(uo(this.screenElement,`mousemove`,e=>this.updateCursorStyle(e))),this._helperContainer=this._document.createElement(`div`),this._helperContainer.classList.add(`xterm-helpers`),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let n=this.textarea=this._document.createElement(`textarea`);this.textarea.classList.add(`xterm-helper-textarea`),this.textarea.setAttribute(`aria-label`,ua.get()),Io||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._register(this.optionsService.onSpecificOptionChange(`disableStdin`,()=>n.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(Qs,this.textarea,e.ownerDocument.defaultView??window,this._document??(typeof window<`u`?window.document:null))),this._instantiationService.setService(Wa,this._coreBrowserService),this._register(uo(this.textarea,`focus`,e=>this._handleTextAreaFocus(e))),this._register(uo(this.textarea,`blur`,()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(Js,this._document,this._helperContainer),this._instantiationService.setService(Ua,this._charSizeService),this._themeService=this._instantiationService.createInstance(Yc),this._instantiationService.setService(Xa,this._themeService),this._register(this._inputHandler.onRequestColorSchemeQuery(()=>this._reportColorScheme())),this._register(this._themeService.onChangeColors(()=>{this.coreService.decPrivateModes.colorSchemeUpdates&&this._reportColorScheme()})),this._characterJoinerService=this._instantiationService.createInstance(Ms),this._instantiationService.setService(Ya,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(xc,this.rows,this.screenElement)),this._instantiationService.setService(qa,this._renderService),this._register(this._renderService.onRenderedViewportChange(e=>this._onRender.fire(e))),this._register(this._renderService.onDimensionsChange(e=>this._onDimensionsChange.fire({css:{canvas:{...e.css.canvas},cell:{...e.css.cell}},device:{canvas:{...e.device.canvas},cell:{...e.device.cell},char:{...e.device.char}}}))),this.onResize(e=>this._renderService.resize(e.cols,e.rows)),this._compositionView=this._document.createElement(`div`),this._compositionView.classList.add(`composition-view`),this._compositionHelper=this._instantiationService.createInstance(vs,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseCoordsService=this._instantiationService.createInstance(rc),this._instantiationService.setService(Ga,this._mouseCoordsService);let r=this._linkifier.value=this._register(this._instantiationService.createInstance(Vu,this.screenElement));this.element.appendChild(t);try{this._onWillOpen.fire(this.element)}catch(e){this._logService.error(`onWillOpen handler threw an exception`,e)}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this._register(this.onResize(()=>{this._renderService.handleResize(this.cols,this.rows),this._syncTextArea()})),this._register(this.onBlur(()=>this._renderService.handleBlur())),this._register(this.onFocus(()=>this._renderService.handleFocus())),this._viewport=this._register(this._instantiationService.createInstance(ds,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(e=>{super.scrollLines(e,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(zc,this.element,this.screenElement,r)),this._instantiationService.setService(Ja,this._selectionService),this._mouseService=this._instantiationService.createInstance(pc),this._instantiationService.setService(Ka,this._mouseService),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(Go.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance(fs,this.screenElement)),this._register(uo(this.element,`mousedown`,e=>this._selectionService.handleMouseDown(e))),this.mouseStateService.areMouseEventsActive&&!this.options.mouseEventsRequireAlt?(this._selectionService.disable(),this.element.classList.add(`enable-mouse-events`)):(this._selectionService.enable(),this.element.classList.remove(`enable-mouse-events`)),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(Bu,this)),this._register(this.optionsService.onSpecificOptionChange(`screenReaderMode`,e=>this._handleScreenReaderModeOptionChange(e)));let i=this.options.scrollbar?.showScrollbar??!0,a=this.options.scrollbar?.width;i&&a&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(_s,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange(`scrollbar`,e=>{let t=(e?.showScrollbar??!0)&&!!e?.width;!this._overviewRulerRenderer&&t&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(_s,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this._mouseService.bindMouse({element:this.element,screenElement:this.screenElement,document:this._document,handleTouchScroll:e=>this._viewport?.handleTouchScroll(e)},e=>this._register(e),()=>this.focus())}_createRenderer(){return this._instantiationService.createInstance(Ks,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}refresh(e,t,n=!1){this._renderService?.refreshRows(e,t,n)}updateCursorStyle(e){this._selectionService?.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){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,t),this.refresh(0,this.rows-1)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){e&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}paste(e){_a(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this.mouseStateService.setCustomWheelEventHandler(e)}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw Error(`Terminal must be opened first`);let t=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),t}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw 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:!1}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(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(e,t){this._selectionService?.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;let 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(!0),!1;!t&&(e.key===`Dead`||e.key===`AltGraph`)&&(this._unprocessedDeadKey=!0);let n=this._keyboardService.evaluateKeyDown(e);if(this.updateCursorStyle(e),n.type===3||n.type===2){let t=this.rows-1;return this.scrollLines(n.type===2?-t:t),e.preventDefault(),e.stopPropagation(),!1}if(n.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(n.cancel&&(e.preventDefault(),e.stopPropagation()),!n.key)||!this._keyboardService.useKitty&&!this._keyboardService.useWin32InputMode&&e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;(n.key===``||n.key===`\r`)&&(this.textarea.value=``);let r=this._keyboardService.useWin32InputMode&&Wu(e);if(this._onKey.fire({key:n.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(n.key,!r),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return e.preventDefault(),e.stopPropagation(),!1;this._keyDownHandled=!0}_isThirdLevelShift(e,t){let 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 t.type===`keypress`?n:n&&(!t.keyCode||t.keyCode>47)}_keyUp(e){if(this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return;Wu(e)||this.focus();let t=this._keyboardService.evaluateKeyUp(e);if(t?.key){let n=this._keyboardService.useWin32InputMode&&Wu(e);this.coreService.triggerDataEvent(t.key,!n)}this.updateCursorStyle(e),this._keyPressHandled=!1}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;if(e.charCode)t=e.charCode;else if(e.which===null||e.which===void 0)t=e.keyCode;else if(e.which!==0&&e.charCode!==0)t=e.which;else return!1;return!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)?!1:(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&&e.inputType===`insertText`&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let t=e.data;return this.coreService.triggerDataEvent(t,!0),!0}return!1}resize(e,t){if(e===this.cols&&t===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,t)}_afterResize(e,t){this._charSizeService?.measure()}clear(){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(ul));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}reset(){this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),this._mouseService?.reset(),this._selectionService?.reset(),this._decorationService.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1,!0)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains(`focus`)?this.coreService.triggerDataEvent(`\x1B[I`):this.coreService.triggerDataEvent(`\x1B[O`)}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let e=this._renderService.dimensions.css.canvas.width.toFixed(0),t=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`\x1B[4;${t};${e}t`);break;case 1:let n=this._renderService.dimensions.css.cell.width.toFixed(0),r=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`\x1B[6;${r};${n}t`);break}}};function Wu(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18||e.keyCode===91||e.keyCode===92||e.keyCode===93||e.keyCode===224||e.key===`Meta`}var Gu=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let 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(t===-1)throw Error(`Could not dispose an addon that has not been loaded`);e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(t,1)}},Ku=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 Ea)}translateToString(e,t,n){return this._line.translateToString(e,t,n)}},qu=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){let t=this._buffer.lines.get(e);if(t)return new Ku(t)}getNullCell(){return new Ea}},Ju=class extends no{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new q),this.onBufferChange=this._onBufferChange.event,this._normal=new qu(this._core.buffers.normal,`normal`),this._alternate=new qu(this._core.buffers.alt,`alternate`),this._register(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 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)}},Yu=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)}registerApcHandler(e,t){return this._core.registerApcHandler(e,t)}},Xu=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}},Zu=[`cols`,`rows`],Qu=0,$u=class extends no{constructor(e){super(),this._core=this._register(new Uu(e)),this._addonManager=this._register(new Gu),this._publicOptions={...this._core.options};let t=e=>this._core.options[e],n=(e,t)=>{this._checkReadonlyOptions(e),this._core.options[e]=t};for(let e in this._core.options){let r={get:t.bind(this,e),set:n.bind(this,e)};Object.defineProperty(this._publicOptions,e,r)}}_checkReadonlyOptions(e){if(Zu.includes(e))throw Error(`Option "${e}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw 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 onDimensionsChange(){return this._core.onDimensionsChange}get element(){return this._core.element}get screenElement(){return this._core.screenElement}get parser(){return this._parser??=new Yu(this._core)}get unicode(){return this._checkProposedApi(),new Xu(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._register(new Ju(this._core))}get markers(){return this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,t=`none`;switch(this._core.mouseStateService.activeProtocol){case`X10`:t=`x10`;break;case`VT200`:t=`vt200`;break;case`DRAG`:t=`drag`;break;case`ANY`:t=`any`;break}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,showCursor:!this._core.coreService.isCursorHidden,synchronizedOutputMode:e.synchronizedOutput,win32InputMode:e.win32InputMode,wraparoundMode:e.wraparound}}get dimensions(){return this._core.dimensions}get options(){return this._publicOptions}set options(e){for(let t in e)this._publicOptions[t]=e[t]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,t=!0){this._core.input(e,t)}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??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
|
|
75
|
-
`,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{get promptLabel(){return ua.get()},set promptLabel(e){ua.set(e)},get tooMuchOutput(){return fa.get()},set tooMuchOutput(e){fa.set(e)}}}_verifyIntegers(...e){for(Qu of e)if(Qu===1/0||isNaN(Qu)||Qu%1!=0)throw Error(`This API only accepts integers`)}_verifyPositiveIntegers(...e){for(Qu of e)if(Qu&&(Qu===1/0||isNaN(Qu)||Qu%1!=0||Qu<0))throw Error(`This API only accepts positive integers`)}},ed=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),td=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),nd=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),rd=e=>{let t=nd(e);return t.charAt(0).toUpperCase()+t.slice(1)},id={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},ad=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},od=(0,b.createContext)({}),sd=()=>(0,b.useContext)(od),cd=(0,b.forwardRef)(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>{let{size:l=24,strokeWidth:u=2,absoluteStrokeWidth:d=!1,color:f=`currentColor`,className:p=``}=sd()??{},m=r??d?Number(n??u)*24/Number(t??l):n??u;return(0,b.createElement)(`svg`,{ref:c,...id,width:t??l??id.width,height:t??l??id.height,stroke:e??f,strokeWidth:m,className:ed(`lucide`,p,i),...!a&&!ad(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,b.createElement)(e,t)),...Array.isArray(a)?a:[a]])}),ld=(e,t)=>{let n=(0,b.forwardRef)(({className:n,...r},i)=>(0,b.createElement)(cd,{ref:i,iconNode:t,className:ed(`lucide-${td(rd(e))}`,`lucide-${e}`,n),...r}));return n.displayName=rd(e),n},ud=ld(`binary`,[[`rect`,{x:`14`,y:`14`,width:`4`,height:`6`,rx:`2`,key:`p02svl`}],[`rect`,{x:`6`,y:`4`,width:`4`,height:`6`,rx:`2`,key:`xm4xkj`}],[`path`,{d:`M6 20h4`,key:`1i6q5t`}],[`path`,{d:`M14 10h4`,key:`ru81e7`}],[`path`,{d:`M6 14h2v6`,key:`16z9wg`}],[`path`,{d:`M14 4h2v6`,key:`1idq9u`}]]),dd=ld(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),fd=ld(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),pd=ld(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),md=ld(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),hd=ld(`file-diff`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M9 10h6`,key:`9gxzsh`}],[`path`,{d:`M12 13V7`,key:`h0r20n`}],[`path`,{d:`M9 17h6`,key:`r8uit2`}]]),gd=ld(`file-exclamation-point`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),_d=ld(`loader`,[[`path`,{d:`M12 2v4`,key:`3427ic`}],[`path`,{d:`m16.2 7.8 2.9-2.9`,key:`r700ao`}],[`path`,{d:`M18 12h4`,key:`wj9ykh`}],[`path`,{d:`m16.2 16.2 2.9 2.9`,key:`1bxg5t`}],[`path`,{d:`M12 18v4`,key:`jadmvz`}],[`path`,{d:`m4.9 19.1 2.9-2.9`,key:`bwix9q`}],[`path`,{d:`M2 12h4`,key:`j09sii`}],[`path`,{d:`m4.9 4.9 2.9 2.9`,key:`giyufr`}]]),vd=ld(`message-square-plus`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M12 8v6`,key:`1ib9pf`}],[`path`,{d:`M9 11h6`,key:`1fldmi`}]]),yd=ld(`message-square`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]),bd=ld(`minus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),xd=ld(`monitor-cog`,[[`path`,{d:`M12 17v4`,key:`1riwvh`}],[`path`,{d:`m14.305 7.53.923-.382`,key:`1mlnsw`}],[`path`,{d:`m15.228 4.852-.923-.383`,key:`82mpwg`}],[`path`,{d:`m16.852 3.228-.383-.924`,key:`ln4sir`}],[`path`,{d:`m16.852 8.772-.383.923`,key:`1dejw0`}],[`path`,{d:`m19.148 3.228.383-.924`,key:`192kgf`}],[`path`,{d:`m19.53 9.696-.382-.924`,key:`fiavlr`}],[`path`,{d:`m20.772 4.852.924-.383`,key:`1j8mgp`}],[`path`,{d:`m20.772 7.148.924.383`,key:`zix9be`}],[`path`,{d:`M22 13v2a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7`,key:`1tnzv8`}],[`path`,{d:`M8 21h8`,key:`1ev6f3`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}]]),Sd=ld(`pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),Cd=ld(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),wd=ld(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),Td=ld(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),Ed=ld(`send`,[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]),Dd=ld(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),Od=ld(`trash-2`,[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]),kd=ld(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]);function Ad(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=Ad(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function jd(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=Ad(e))&&(r&&(r+=` `),r+=t);return r}var Md=(e,t)=>{let n=Array(e.length+t.length);for(let t=0;t<e.length;t++)n[t]=e[t];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},Nd=(e,t)=>({classGroupId:e,validator:t}),Pd=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),Fd=`-`,Id=[],Ld=`arbitrary..`,Rd=e=>{let t=Vd(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return Bd(e);let n=e.split(Fd);return zd(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?Md(i,t):t:i||Id}return n[e]||Id}}},zd=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=zd(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(Fd):e.slice(t).join(Fd),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},Bd=e=>e.slice(1,-1).indexOf(`:`)===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(`:`),r=t.slice(0,n);return r?Ld+r:void 0})(),Vd=e=>{let{theme:t,classGroups:n}=e;return Hd(n,t)},Hd=(e,t)=>{let n=Pd();for(let r in e){let i=e[r];Ud(i,n,r,t)}return n},Ud=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];Wd(i,t,n,r)}},Wd=(e,t,n,r)=>{if(typeof e==`string`){Gd(e,t,n);return}if(typeof e==`function`){Kd(e,t,n,r);return}qd(e,t,n,r)},Gd=(e,t,n)=>{let r=e===``?t:Jd(t,e);r.classGroupId=n},Kd=(e,t,n,r)=>{if(Yd(e)){Ud(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(Nd(n,e))},qd=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];Ud(o,Jd(t,a),n,r)}},Jd=(e,t)=>{let n=e,r=t.split(Fd),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=Pd(),n.nextPart.set(t,i)),n=i}return n},Yd=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,Xd=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),i=(i,a)=>{n[i]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];if(t!==void 0)return t;if((t=r[e])!==void 0)return i(e,t),t},set(e,t){e in n?n[e]=t:i(e,t)}}},Zd=`!`,Qd=`:`,$d=[],ef=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),tf=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t=[],n=0,r=0,i=0,a,o=e.length;for(let s=0;s<o;s++){let o=e[s];if(n===0&&r===0){if(o===Qd){t.push(e.slice(i,s)),i=s+1;continue}if(o===`/`){a=s;continue}}o===`[`?n++:o===`]`?n--:o===`(`?r++:o===`)`&&r--}let s=t.length===0?e:e.slice(i),c=s,l=!1;s.endsWith(Zd)?(c=s.slice(0,-1),l=!0):s.startsWith(Zd)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return ef(t,l,c,u)};if(t){let e=t+Qd,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):ef($d,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},nf=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{let n=[],r=[];for(let i=0;i<e.length;i++){let a=e[i],o=a[0]===`[`,s=t.has(a);o||s?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(a)):r.push(a)}return r.length>0&&(r.sort(),n.push(...r)),n}},rf=e=>({cache:Xd(e.cacheSize),parseClassName:tf(e),sortModifiers:nf(e),...Rd(e)}),af=/\s+/,of=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a}=t,o=[],s=e.trim().split(af),c=``;for(let e=s.length-1;e>=0;--e){let t=s[e],{isExternal:l,modifiers:u,hasImportantModifier:d,baseClassName:f,maybePostfixModifierPosition:p}=n(t);if(l){c=t+(c.length>0?` `+c:c);continue}let m=!!p,h=r(m?f.substring(0,p):f);if(!h){if(!m){c=t+(c.length>0?` `+c:c);continue}if(h=r(f),!h){c=t+(c.length>0?` `+c:c);continue}m=!1}let g=u.length===0?``:u.length===1?u[0]:a(u).join(`:`),_=d?g+Zd:g,v=_+h;if(o.indexOf(v)>-1)continue;o.push(v);let y=i(h,m);for(let e=0;e<y.length;++e){let t=y[e];o.push(_+t)}c=t+(c.length>0?` `+c:c)}return c},sf=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=cf(n))&&(i&&(i+=` `),i+=r);return i},cf=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=cf(e[r]))&&(n&&(n+=` `),n+=t);return n},lf=(e,...t)=>{let n,r,i,a,o=o=>(n=rf(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)),s=e=>{let t=r(e);if(t)return t;let a=of(e,n);return i(e,a),a};return a=o,(...e)=>a(sf(...e))},uf=[],df=e=>{let t=t=>t[e]||uf;return t.isThemeGetter=!0,t},ff=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,pf=/^\((?:(\w[\w-]*):)?(.+)\)$/i,mf=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,hf=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,gf=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,_f=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,vf=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,yf=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,bf=e=>mf.test(e),xf=e=>!!e&&!Number.isNaN(Number(e)),Sf=e=>!!e&&Number.isInteger(Number(e)),Cf=e=>e.endsWith(`%`)&&xf(e.slice(0,-1)),wf=e=>hf.test(e),Tf=()=>!0,Ef=e=>gf.test(e)&&!_f.test(e),Df=()=>!1,Of=e=>vf.test(e),kf=e=>yf.test(e),Af=e=>!J(e)&&!Y(e),jf=e=>Kf(e,Xf,Df),J=e=>ff.test(e),Mf=e=>Kf(e,Zf,Ef),Nf=e=>Kf(e,Qf,xf),Pf=e=>Kf(e,ep,Tf),Ff=e=>Kf(e,$f,Df),If=e=>Kf(e,Jf,Df),Lf=e=>Kf(e,Yf,kf),Rf=e=>Kf(e,tp,Of),Y=e=>pf.test(e),zf=e=>qf(e,Zf),Bf=e=>qf(e,$f),Vf=e=>qf(e,Jf),Hf=e=>qf(e,Xf),Uf=e=>qf(e,Yf),Wf=e=>qf(e,tp,!0),Gf=e=>qf(e,ep,!0),Kf=(e,t,n)=>{let r=ff.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},qf=(e,t,n=!1)=>{let r=pf.exec(e);return r?r[1]?t(r[1]):n:!1},Jf=e=>e===`position`||e===`percentage`,Yf=e=>e===`image`||e===`url`,Xf=e=>e===`length`||e===`size`||e===`bg-size`,Zf=e=>e===`length`,Qf=e=>e===`number`,$f=e=>e===`family-name`,ep=e=>e===`number`||e===`weight`,tp=e=>e===`shadow`,np=lf(()=>{let e=df(`color`),t=df(`font`),n=df(`text`),r=df(`font-weight`),i=df(`tracking`),a=df(`leading`),o=df(`breakpoint`),s=df(`container`),c=df(`spacing`),l=df(`radius`),u=df(`shadow`),d=df(`inset-shadow`),f=df(`text-shadow`),p=df(`drop-shadow`),m=df(`blur`),h=df(`perspective`),g=df(`aspect`),_=df(`ease`),v=df(`animate`),y=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],b=()=>[`center`,`top`,`bottom`,`left`,`right`,`top-left`,`left-top`,`top-right`,`right-top`,`bottom-right`,`right-bottom`,`bottom-left`,`left-bottom`],x=()=>[...b(),Y,J],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[Y,J,c],T=()=>[bf,`full`,`auto`,...w()],E=()=>[Sf,`none`,`subgrid`,Y,J],D=()=>[`auto`,{span:[`full`,Sf,Y,J]},Sf,Y,J],O=()=>[Sf,`auto`,Y,J],k=()=>[`auto`,`min`,`max`,`fr`,Y,J],A=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],j=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],M=()=>[`auto`,...w()],N=()=>[bf,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],P=()=>[bf,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],F=()=>[bf,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],I=()=>[e,Y,J],L=()=>[...b(),Vf,If,{position:[Y,J]}],R=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],z=()=>[`auto`,`cover`,`contain`,Hf,jf,{size:[Y,J]}],ee=()=>[Cf,zf,Mf],B=()=>[``,`none`,`full`,l,Y,J],te=()=>[``,xf,zf,Mf],V=()=>[`solid`,`dashed`,`dotted`,`double`],H=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],ne=()=>[xf,Cf,Vf,If],U=()=>[``,`none`,m,Y,J],re=()=>[`none`,xf,Y,J],W=()=>[`none`,xf,Y,J],ie=()=>[xf,Y,J],ae=()=>[bf,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[wf],breakpoint:[wf],color:[Tf],container:[wf],"drop-shadow":[wf],ease:[`in`,`out`,`in-out`],font:[Af],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[wf],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[wf],shadow:[wf],spacing:[`px`,xf],text:[wf],"text-shadow":[wf],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,bf,J,Y,g]}],container:[`container`],columns:[{columns:[xf,J,Y,s]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"break-inside":[{"break-inside":[`auto`,`avoid`,`avoid-page`,`avoid-column`]}],"box-decoration":[{"box-decoration":[`slice`,`clone`]}],box:[{box:[`border`,`content`]}],display:[`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`table`,`inline-table`,`table-caption`,`table-cell`,`table-column`,`table-column-group`,`table-footer-group`,`table-header-group`,`table-row-group`,`table-row`,`flow-root`,`grid`,`inline-grid`,`contents`,`list-item`,`hidden`],sr:[`sr-only`,`not-sr-only`],float:[{float:[`right`,`left`,`none`,`start`,`end`]}],clear:[{clear:[`left`,`right`,`both`,`none`,`start`,`end`]}],isolation:[`isolate`,`isolation-auto`],"object-fit":[{object:[`contain`,`cover`,`fill`,`none`,`scale-down`]}],"object-position":[{object:x()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{"inset-s":T(),start:T()}],end:[{"inset-e":T(),end:T()}],"inset-bs":[{"inset-bs":T()}],"inset-be":[{"inset-be":T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[Sf,`auto`,Y,J]}],basis:[{basis:[bf,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[xf,bf,`auto`,`initial`,`none`,J]}],grow:[{grow:[``,xf,Y,J]}],shrink:[{shrink:[``,xf,Y,J]}],order:[{order:[Sf,`first`,`last`,`none`,Y,J]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":k()}],"auto-rows":[{"auto-rows":k()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...A(),`normal`]}],"justify-items":[{"justify-items":[...j(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...j()]}],"align-content":[{content:[`normal`,...A()]}],"align-items":[{items:[...j(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...j(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":A()}],"place-items":[{"place-items":[...j(),`baseline`]}],"place-self":[{"place-self":[`auto`,...j()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pbs:[{pbs:w()}],pbe:[{pbe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:M()}],mx:[{mx:M()}],my:[{my:M()}],ms:[{ms:M()}],me:[{me:M()}],mbs:[{mbs:M()}],mbe:[{mbe:M()}],mt:[{mt:M()}],mr:[{mr:M()}],mb:[{mb:M()}],ml:[{ml:M()}],"space-x":[{"space-x":w()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":w()}],"space-y-reverse":[`space-y-reverse`],size:[{size:N()}],"inline-size":[{inline:[`auto`,...P()]}],"min-inline-size":[{"min-inline":[`auto`,...P()]}],"max-inline-size":[{"max-inline":[`none`,...P()]}],"block-size":[{block:[`auto`,...F()]}],"min-block-size":[{"min-block":[`auto`,...F()]}],"max-block-size":[{"max-block":[`none`,...F()]}],w:[{w:[s,`screen`,...N()]}],"min-w":[{"min-w":[s,`screen`,`none`,...N()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...N()]}],h:[{h:[`screen`,`lh`,...N()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...N()]}],"max-h":[{"max-h":[`screen`,`lh`,...N()]}],"font-size":[{text:[`base`,n,zf,Mf]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,Gf,Pf]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,Cf,J]}],"font-family":[{font:[Bf,Ff,t]}],"font-features":[{"font-features":[J]}],"fvn-normal":[`normal-nums`],"fvn-ordinal":[`ordinal`],"fvn-slashed-zero":[`slashed-zero`],"fvn-figure":[`lining-nums`,`oldstyle-nums`],"fvn-spacing":[`proportional-nums`,`tabular-nums`],"fvn-fraction":[`diagonal-fractions`,`stacked-fractions`],tracking:[{tracking:[i,Y,J]}],"line-clamp":[{"line-clamp":[xf,`none`,Y,Nf]}],leading:[{leading:[a,...w()]}],"list-image":[{"list-image":[`none`,Y,J]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,Y,J]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:I()}],"text-color":[{text:I()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...V(),`wavy`]}],"text-decoration-thickness":[{decoration:[xf,`from-font`,`auto`,Y,Mf]}],"text-decoration-color":[{decoration:I()}],"underline-offset":[{"underline-offset":[xf,`auto`,Y,J]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:w()}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,Y,J]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],wrap:[{wrap:[`break-word`,`anywhere`,`normal`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,Y,J]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:L()}],"bg-repeat":[{bg:R()}],"bg-size":[{bg:z()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},Sf,Y,J],radial:[``,Y,J],conic:[Sf,Y,J]},Uf,Lf]}],"bg-color":[{bg:I()}],"gradient-from-pos":[{from:ee()}],"gradient-via-pos":[{via:ee()}],"gradient-to-pos":[{to:ee()}],"gradient-from":[{from:I()}],"gradient-via":[{via:I()}],"gradient-to":[{to:I()}],rounded:[{rounded:B()}],"rounded-s":[{"rounded-s":B()}],"rounded-e":[{"rounded-e":B()}],"rounded-t":[{"rounded-t":B()}],"rounded-r":[{"rounded-r":B()}],"rounded-b":[{"rounded-b":B()}],"rounded-l":[{"rounded-l":B()}],"rounded-ss":[{"rounded-ss":B()}],"rounded-se":[{"rounded-se":B()}],"rounded-ee":[{"rounded-ee":B()}],"rounded-es":[{"rounded-es":B()}],"rounded-tl":[{"rounded-tl":B()}],"rounded-tr":[{"rounded-tr":B()}],"rounded-br":[{"rounded-br":B()}],"rounded-bl":[{"rounded-bl":B()}],"border-w":[{border:te()}],"border-w-x":[{"border-x":te()}],"border-w-y":[{"border-y":te()}],"border-w-s":[{"border-s":te()}],"border-w-e":[{"border-e":te()}],"border-w-bs":[{"border-bs":te()}],"border-w-be":[{"border-be":te()}],"border-w-t":[{"border-t":te()}],"border-w-r":[{"border-r":te()}],"border-w-b":[{"border-b":te()}],"border-w-l":[{"border-l":te()}],"divide-x":[{"divide-x":te()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":te()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...V(),`hidden`,`none`]}],"divide-style":[{divide:[...V(),`hidden`,`none`]}],"border-color":[{border:I()}],"border-color-x":[{"border-x":I()}],"border-color-y":[{"border-y":I()}],"border-color-s":[{"border-s":I()}],"border-color-e":[{"border-e":I()}],"border-color-bs":[{"border-bs":I()}],"border-color-be":[{"border-be":I()}],"border-color-t":[{"border-t":I()}],"border-color-r":[{"border-r":I()}],"border-color-b":[{"border-b":I()}],"border-color-l":[{"border-l":I()}],"divide-color":[{divide:I()}],"outline-style":[{outline:[...V(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[xf,Y,J]}],"outline-w":[{outline:[``,xf,zf,Mf]}],"outline-color":[{outline:I()}],shadow:[{shadow:[``,`none`,u,Wf,Rf]}],"shadow-color":[{shadow:I()}],"inset-shadow":[{"inset-shadow":[`none`,d,Wf,Rf]}],"inset-shadow-color":[{"inset-shadow":I()}],"ring-w":[{ring:te()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:I()}],"ring-offset-w":[{"ring-offset":[xf,Mf]}],"ring-offset-color":[{"ring-offset":I()}],"inset-ring-w":[{"inset-ring":te()}],"inset-ring-color":[{"inset-ring":I()}],"text-shadow":[{"text-shadow":[`none`,f,Wf,Rf]}],"text-shadow-color":[{"text-shadow":I()}],opacity:[{opacity:[xf,Y,J]}],"mix-blend":[{"mix-blend":[...H(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":H()}],"mask-clip":[{"mask-clip":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]},`mask-no-clip`],"mask-composite":[{mask:[`add`,`subtract`,`intersect`,`exclude`]}],"mask-image-linear-pos":[{"mask-linear":[xf]}],"mask-image-linear-from-pos":[{"mask-linear-from":ne()}],"mask-image-linear-to-pos":[{"mask-linear-to":ne()}],"mask-image-linear-from-color":[{"mask-linear-from":I()}],"mask-image-linear-to-color":[{"mask-linear-to":I()}],"mask-image-t-from-pos":[{"mask-t-from":ne()}],"mask-image-t-to-pos":[{"mask-t-to":ne()}],"mask-image-t-from-color":[{"mask-t-from":I()}],"mask-image-t-to-color":[{"mask-t-to":I()}],"mask-image-r-from-pos":[{"mask-r-from":ne()}],"mask-image-r-to-pos":[{"mask-r-to":ne()}],"mask-image-r-from-color":[{"mask-r-from":I()}],"mask-image-r-to-color":[{"mask-r-to":I()}],"mask-image-b-from-pos":[{"mask-b-from":ne()}],"mask-image-b-to-pos":[{"mask-b-to":ne()}],"mask-image-b-from-color":[{"mask-b-from":I()}],"mask-image-b-to-color":[{"mask-b-to":I()}],"mask-image-l-from-pos":[{"mask-l-from":ne()}],"mask-image-l-to-pos":[{"mask-l-to":ne()}],"mask-image-l-from-color":[{"mask-l-from":I()}],"mask-image-l-to-color":[{"mask-l-to":I()}],"mask-image-x-from-pos":[{"mask-x-from":ne()}],"mask-image-x-to-pos":[{"mask-x-to":ne()}],"mask-image-x-from-color":[{"mask-x-from":I()}],"mask-image-x-to-color":[{"mask-x-to":I()}],"mask-image-y-from-pos":[{"mask-y-from":ne()}],"mask-image-y-to-pos":[{"mask-y-to":ne()}],"mask-image-y-from-color":[{"mask-y-from":I()}],"mask-image-y-to-color":[{"mask-y-to":I()}],"mask-image-radial":[{"mask-radial":[Y,J]}],"mask-image-radial-from-pos":[{"mask-radial-from":ne()}],"mask-image-radial-to-pos":[{"mask-radial-to":ne()}],"mask-image-radial-from-color":[{"mask-radial-from":I()}],"mask-image-radial-to-color":[{"mask-radial-to":I()}],"mask-image-radial-shape":[{"mask-radial":[`circle`,`ellipse`]}],"mask-image-radial-size":[{"mask-radial":[{closest:[`side`,`corner`],farthest:[`side`,`corner`]}]}],"mask-image-radial-pos":[{"mask-radial-at":b()}],"mask-image-conic-pos":[{"mask-conic":[xf]}],"mask-image-conic-from-pos":[{"mask-conic-from":ne()}],"mask-image-conic-to-pos":[{"mask-conic-to":ne()}],"mask-image-conic-from-color":[{"mask-conic-from":I()}],"mask-image-conic-to-color":[{"mask-conic-to":I()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:L()}],"mask-repeat":[{mask:R()}],"mask-size":[{mask:z()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,Y,J]}],filter:[{filter:[``,`none`,Y,J]}],blur:[{blur:U()}],brightness:[{brightness:[xf,Y,J]}],contrast:[{contrast:[xf,Y,J]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,Wf,Rf]}],"drop-shadow-color":[{"drop-shadow":I()}],grayscale:[{grayscale:[``,xf,Y,J]}],"hue-rotate":[{"hue-rotate":[xf,Y,J]}],invert:[{invert:[``,xf,Y,J]}],saturate:[{saturate:[xf,Y,J]}],sepia:[{sepia:[``,xf,Y,J]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,Y,J]}],"backdrop-blur":[{"backdrop-blur":U()}],"backdrop-brightness":[{"backdrop-brightness":[xf,Y,J]}],"backdrop-contrast":[{"backdrop-contrast":[xf,Y,J]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,xf,Y,J]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[xf,Y,J]}],"backdrop-invert":[{"backdrop-invert":[``,xf,Y,J]}],"backdrop-opacity":[{"backdrop-opacity":[xf,Y,J]}],"backdrop-saturate":[{"backdrop-saturate":[xf,Y,J]}],"backdrop-sepia":[{"backdrop-sepia":[``,xf,Y,J]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[``,`all`,`colors`,`opacity`,`shadow`,`transform`,`none`,Y,J]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[xf,`initial`,Y,J]}],ease:[{ease:[`linear`,`initial`,_,Y,J]}],delay:[{delay:[xf,Y,J]}],animate:[{animate:[`none`,v,Y,J]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,Y,J]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:re()}],"rotate-x":[{"rotate-x":re()}],"rotate-y":[{"rotate-y":re()}],"rotate-z":[{"rotate-z":re()}],scale:[{scale:W()}],"scale-x":[{"scale-x":W()}],"scale-y":[{"scale-y":W()}],"scale-z":[{"scale-z":W()}],"scale-3d":[`scale-3d`],skew:[{skew:ie()}],"skew-x":[{"skew-x":ie()}],"skew-y":[{"skew-y":ie()}],transform:[{transform:[Y,J,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:ae()}],"translate-x":[{"translate-x":ae()}],"translate-y":[{"translate-y":ae()}],"translate-z":[{"translate-z":ae()}],"translate-none":[`translate-none`],accent:[{accent:I()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:I()}],"color-scheme":[{scheme:[`normal`,`dark`,`light`,`light-dark`,`only-dark`,`only-light`]}],cursor:[{cursor:[`auto`,`default`,`pointer`,`wait`,`text`,`move`,`help`,`not-allowed`,`none`,`context-menu`,`progress`,`cell`,`crosshair`,`vertical-text`,`alias`,`copy`,`no-drop`,`grab`,`grabbing`,`all-scroll`,`col-resize`,`row-resize`,`n-resize`,`e-resize`,`s-resize`,`w-resize`,`ne-resize`,`nw-resize`,`se-resize`,`sw-resize`,`ew-resize`,`ns-resize`,`nesw-resize`,`nwse-resize`,`zoom-in`,`zoom-out`,Y,J]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mbs":[{"scroll-mbs":w()}],"scroll-mbe":[{"scroll-mbe":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pbs":[{"scroll-pbs":w()}],"scroll-pbe":[{"scroll-pbe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:[`start`,`end`,`center`,`align-none`]}],"snap-stop":[{snap:[`normal`,`always`]}],"snap-type":[{snap:[`none`,`x`,`y`,`both`]}],"snap-strictness":[{snap:[`mandatory`,`proximity`]}],touch:[{touch:[`auto`,`none`,`manipulation`]}],"touch-x":[{"touch-pan":[`x`,`left`,`right`]}],"touch-y":[{"touch-pan":[`y`,`up`,`down`]}],"touch-pz":[`touch-pinch-zoom`],select:[{select:[`none`,`text`,`all`,`auto`]}],"will-change":[{"will-change":[`auto`,`scroll`,`contents`,`transform`,Y,J]}],fill:[{fill:[`none`,...I()]}],"stroke-w":[{stroke:[xf,zf,Mf,Nf]}],stroke:[{stroke:[`none`,...I()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`inset-bs`,`inset-be`,`start`,`end`,`top`,`right`,`bottom`,`left`],"inset-x":[`right`,`left`],"inset-y":[`top`,`bottom`],flex:[`basis`,`grow`,`shrink`],gap:[`gap-x`,`gap-y`],p:[`px`,`py`,`ps`,`pe`,`pbs`,`pbe`,`pt`,`pr`,`pb`,`pl`],px:[`pr`,`pl`],py:[`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mbs`,`mbe`,`mt`,`mr`,`mb`,`ml`],mx:[`mr`,`ml`],my:[`mt`,`mb`],size:[`w`,`h`],"font-size":[`leading`],"fvn-normal":[`fvn-ordinal`,`fvn-slashed-zero`,`fvn-figure`,`fvn-spacing`,`fvn-fraction`],"fvn-ordinal":[`fvn-normal`],"fvn-slashed-zero":[`fvn-normal`],"fvn-figure":[`fvn-normal`],"fvn-spacing":[`fvn-normal`],"fvn-fraction":[`fvn-normal`],"line-clamp":[`display`,`overflow`],rounded:[`rounded-s`,`rounded-e`,`rounded-t`,`rounded-r`,`rounded-b`,`rounded-l`,`rounded-ss`,`rounded-se`,`rounded-ee`,`rounded-es`,`rounded-tl`,`rounded-tr`,`rounded-br`,`rounded-bl`],"rounded-s":[`rounded-ss`,`rounded-es`],"rounded-e":[`rounded-se`,`rounded-ee`],"rounded-t":[`rounded-tl`,`rounded-tr`],"rounded-r":[`rounded-tr`,`rounded-br`],"rounded-b":[`rounded-br`,`rounded-bl`],"rounded-l":[`rounded-tl`,`rounded-bl`],"border-spacing":[`border-spacing-x`,`border-spacing-y`],"border-w":[`border-w-x`,`border-w-y`,`border-w-s`,`border-w-e`,`border-w-bs`,`border-w-be`,`border-w-t`,`border-w-r`,`border-w-b`,`border-w-l`],"border-w-x":[`border-w-r`,`border-w-l`],"border-w-y":[`border-w-t`,`border-w-b`],"border-color":[`border-color-x`,`border-color-y`,`border-color-s`,`border-color-e`,`border-color-bs`,`border-color-be`,`border-color-t`,`border-color-r`,`border-color-b`,`border-color-l`],"border-color-x":[`border-color-r`,`border-color-l`],"border-color-y":[`border-color-t`,`border-color-b`],translate:[`translate-x`,`translate-y`,`translate-none`],"translate-none":[`translate`,`translate-x`,`translate-y`,`translate-z`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`scroll-mbs`,`scroll-mbe`,`scroll-mt`,`scroll-mr`,`scroll-mb`,`scroll-ml`],"scroll-mx":[`scroll-mr`,`scroll-ml`],"scroll-my":[`scroll-mt`,`scroll-mb`],"scroll-p":[`scroll-px`,`scroll-py`,`scroll-ps`,`scroll-pe`,`scroll-pbs`,`scroll-pbe`,`scroll-pt`,`scroll-pr`,`scroll-pb`,`scroll-pl`],"scroll-px":[`scroll-pr`,`scroll-pl`],"scroll-py":[`scroll-pt`,`scroll-pb`],touch:[`touch-x`,`touch-y`,`touch-pz`],"touch-x":[`touch`],"touch-y":[`touch`],"touch-pz":[`touch`]},conflictingClassGroupModifiers:{"font-size":[`leading`]},orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}});function rp(...e){return np(jd(e))}function ip(e){let t=b.useRef(!0);t.current&&(t.current=!1,e())}function ap(){return typeof window<`u`}function op(e){return lp(e)?(e.nodeName||``).toLowerCase():`#document`}function sp(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function cp(e){return((lp(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function lp(e){return ap()?e instanceof Node||e instanceof sp(e).Node:!1}function up(e){return ap()?e instanceof Element||e instanceof sp(e).Element:!1}function dp(e){return ap()?e instanceof HTMLElement||e instanceof sp(e).HTMLElement:!1}function fp(e){return!ap()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof sp(e).ShadowRoot}function pp(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=wp(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function mp(e){return/^(table|td|th)$/.test(op(e))}function hp(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var gp=/transform|translate|scale|rotate|perspective|filter/,_p=/paint|layout|strict|content/,vp=e=>!!e&&e!==`none`,yp;function bp(e){let t=up(e)?wp(e):e;return vp(t.transform)||vp(t.translate)||vp(t.scale)||vp(t.rotate)||vp(t.perspective)||!Sp()&&(vp(t.backdropFilter)||vp(t.filter))||gp.test(t.willChange||``)||_p.test(t.contain||``)}function xp(e){let t=Ep(e);for(;dp(t)&&!Cp(t);){if(bp(t))return t;if(hp(t))return null;t=Ep(t)}return null}function Sp(){return yp??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),yp}function Cp(e){return/^(html|body|#document)$/.test(op(e))}function wp(e){return sp(e).getComputedStyle(e)}function Tp(e){return up(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Ep(e){if(op(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||fp(e)&&e.host||cp(e);return fp(t)?t.host:t}function Dp(e){let t=Ep(e);return Cp(t)?e.ownerDocument?e.ownerDocument.body:e.body:dp(t)&&pp(t)?t:Dp(t)}function Op(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Dp(e),i=r===e.ownerDocument?.body,a=sp(r);if(i){let e=kp(a);return t.concat(a,a.visualViewport||[],pp(r)?r:[],e&&n?Op(e):[])}else return t.concat(r,Op(r,[],n))}function kp(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Ap(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}var jp=typeof navigator<`u`,Mp=Vp(),Np=Up(),Pp=Hp(),Fp=typeof CSS>`u`||!CSS.supports?!1:CSS.supports(`-webkit-backdrop-filter:none`),Ip=Mp.platform===`MacIntel`&&Mp.maxTouchPoints>1?!0:/iP(hone|ad|od)|iOS/.test(Mp.platform);jp&&/firefox/i.test(Pp);var Lp=jp&&/apple/i.test(navigator.vendor);jp&&/Edg/i.test(Pp);var Rp=jp&&/android/i.test(Np)||/android/i.test(Pp),zp=jp&&Np.toLowerCase().startsWith(`mac`)&&!navigator.maxTouchPoints,Bp=Pp.includes(`jsdom/`);function Vp(){if(!jp)return{platform:``,maxTouchPoints:-1};let e=navigator.userAgentData;return e?.platform?{platform:e.platform,maxTouchPoints:navigator.maxTouchPoints}:{platform:navigator.platform??``,maxTouchPoints:navigator.maxTouchPoints??-1}}function Hp(){if(!jp)return``;let e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(({brand:e,version:t})=>`${e}/${t}`).join(` `):navigator.userAgent}function Up(){if(!jp)return``;let e=navigator.userAgentData;return e?.platform?e.platform:navigator.platform??``}function Wp(e){return e?.ownerDocument||document}var X=typeof document<`u`?b.useLayoutEffect:()=>{},Gp={};function Kp(e,t){let n=b.useRef(Gp);return n.current===Gp&&(n.current=e(t)),n}var qp=[];function Jp(e){b.useEffect(e,qp)}var Yp=0,Xp=class e{static create(){return new e}currentId=Yp;start(e,t){this.clear(),this.currentId=setTimeout(()=>{this.currentId=Yp,t()},e)}isStarted(){return this.currentId!==Yp}clear=()=>{this.currentId!==Yp&&(clearTimeout(this.currentId),this.currentId=Yp)};disposeEffect=()=>this.clear};function Zp(){let e=Kp(Xp.create).current;return Jp(e.disposeEffect),e}var Qp=null;globalThis.requestAnimationFrame;var $p=new class{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=e=>{this.isScheduled=!1;let t=this.callbacks,n=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,n>0)for(let n=0;n<t.length;n+=1)t[n]?.(e)};request(e){let t=this.nextId;return this.nextId+=1,this.callbacks.push(e),this.callbacksCount+=1,this.isScheduled||=(requestAnimationFrame(this.tick),!0),t}cancel(e){let t=e-this.startId;t<0||t>=this.callbacks.length||(this.callbacks[t]=null,--this.callbacksCount)}},em=class e{static create(){return new e}static request(e){return $p.request(e)}static cancel(e){return $p.cancel(e)}currentId=Qp;request(e){this.cancel(),this.currentId=$p.request(()=>{this.currentId=Qp,e()})}cancel=()=>{this.currentId!==Qp&&($p.cancel(this.currentId),this.currentId=Qp)};disposeEffect=()=>this.cancel};function tm(){let e=Kp(em.create).current;return Jp(e.disposeEffect),e}function nm(){}var rm=Object.freeze([]),im=Object.freeze({}),am={},om={},sm=``;function cm(e){if(typeof document>`u`)return!1;let t=Wp(e);return sp(t).innerWidth-t.documentElement.clientWidth>0}function lm(e){if(!(typeof CSS<`u`&&CSS.supports&&CSS.supports(`scrollbar-gutter`,`stable`))||typeof document>`u`)return!1;let t=Wp(e),n=t.documentElement,r=t.body,i=pp(n)?n:r,a=i.style.overflowY,o=n.style.scrollbarGutter;n.style.scrollbarGutter=`stable`,i.style.overflowY=`scroll`;let s=i.offsetWidth;i.style.overflowY=`hidden`;let c=i.offsetWidth;return i.style.overflowY=a,n.style.scrollbarGutter=o,s===c}function um(e){let t=Wp(e),n=t.documentElement,r=t.body,i=pp(n)?n:r,a={overflowY:i.style.overflowY,overflowX:i.style.overflowX};return Object.assign(i.style,{overflowY:`hidden`,overflowX:`hidden`}),()=>{Object.assign(i.style,a)}}function dm(e){let t=Wp(e),n=t.documentElement,r=t.body,i=sp(n),a=0,o=0,s=!1,c=em.create();if(Fp&&(i.visualViewport?.scale??1)!==1)return()=>{};function l(){let t=i.getComputedStyle(n),c=i.getComputedStyle(r),l=(t.scrollbarGutter||``).includes(`both-edges`)?`stable both-edges`:`stable`;a=n.scrollTop,o=n.scrollLeft,am={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},sm=n.style.scrollBehavior,om={position:r.style.position,height:r.style.height,width:r.style.width,boxSizing:r.style.boxSizing,overflowY:r.style.overflowY,overflowX:r.style.overflowX,scrollBehavior:r.style.scrollBehavior};let u=n.scrollHeight>n.clientHeight,d=n.scrollWidth>n.clientWidth,f=t.overflowY===`scroll`||c.overflowY===`scroll`,p=t.overflowX===`scroll`||c.overflowX===`scroll`,m=Math.max(0,i.innerWidth-r.clientWidth),h=Math.max(0,i.innerHeight-r.clientHeight),g=parseFloat(c.marginTop)+parseFloat(c.marginBottom),_=parseFloat(c.marginLeft)+parseFloat(c.marginRight),v=pp(n)?n:r;if(s=lm(e),s){n.style.scrollbarGutter=l,v.style.overflowY=`hidden`,v.style.overflowX=`hidden`;return}Object.assign(n.style,{scrollbarGutter:l,overflowY:`hidden`,overflowX:`hidden`}),(u||f)&&(n.style.overflowY=`scroll`),(d||p)&&(n.style.overflowX=`scroll`),Object.assign(r.style,{position:`relative`,height:g||h?`calc(100dvh - ${g+h}px)`:`100dvh`,width:_||m?`calc(100vw - ${_+m}px)`:`100vw`,boxSizing:`border-box`,overflow:`hidden`,scrollBehavior:`unset`}),r.scrollTop=a,r.scrollLeft=o,n.setAttribute(`data-base-ui-scroll-locked`,``),n.style.scrollBehavior=`unset`}function u(){Object.assign(n.style,am),Object.assign(r.style,om),s||(n.scrollTop=a,n.scrollLeft=o,n.removeAttribute(`data-base-ui-scroll-locked`),n.style.scrollBehavior=sm)}function d(){u(),c.request(l)}l();let f=Ap(i,`resize`,d);return()=>{c.cancel(),u(),typeof i.removeEventListener==`function`&&f()}}var fm=new class{lockCount=0;restore=null;timeoutLock=Xp.create();timeoutUnlock=Xp.create();acquire(e){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(e)),this.release}release=()=>{--this.lockCount,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)};lock(e){if(this.lockCount===0||this.restore!==null)return;let t=Wp(e).documentElement,n=sp(t).getComputedStyle(t).overflowY;if(n===`hidden`||n===`clip`){this.restore=nm;return}let r=Ip||!cm(e);this.restore=r?um(e):dm(e)}};function pm(e=!0,t=null){X(()=>{if(e)return fm.acquire(t)},[e,t])}function mm(e){e.preventDefault(),e.stopPropagation()}function hm(e){return`nativeEvent`in e}function gm(e){return e.pointerType===``&&e.isTrusted?!0:Rp&&e.pointerType?e.type===`click`&&e.buttons===1:e.detail===0&&!e.pointerType}function _m(e){return Bp?!1:!Rp&&e.width===0&&e.height===0||Rp&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType===`mouse`||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType===`touch`}function vm(e,t){let n=[`mouse`,`pen`];return t||n.push(``,void 0),n.includes(e)}function ym(e){let t=e.type;return t===`click`||t===`mousedown`||t===`keydown`||t===`keyup`}function bm(e,t){return t!=null&&!vm(t)?0:typeof e==`function`?e():e}function xm(e,t,n){let r=bm(e,n);return typeof r==`number`?r:r?.[t]}function Sm(e){return typeof e==`function`?e():e}function Cm(e,t){return t||e===`click`||e===`mousedown`}var wm=`none`,Tm=`trigger-press`,Em=`trigger-hover`,Dm=`trigger-focus`,Om=`outside-press`,km=`item-press`,Am=`focus-out`,jm=`escape-key`,Mm=`list-navigation`,Nm=`cancel-open`,Pm=`disabled`,Fm=`imperative-action`,Im=`window-resize`;function Lm(e,t,n,r){let i=!1,a=!1,o=r??im;return{reason:e,event:t??new Event(`base-ui`),cancel(){i=!0},allowPropagation(){a=!0},get isCanceled(){return i},get isPropagationAllowed(){return a},trigger:n,...o}}var Rm=b.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new Xp,currentIdRef:{current:null},currentContextRef:{current:null}});function zm(e){let{children:t,delay:n,timeoutMs:r=0}=e,i=b.useRef(n),a=b.useRef(n),o=b.useRef(null),s=b.useRef(null),c=Zp();return(0,y.jsx)(Rm.Provider,{value:b.useMemo(()=>({hasProvider:!0,delayRef:i,initialDelayRef:a,currentIdRef:o,timeoutMs:r,currentContextRef:s,timeout:c}),[r,c]),children:t})}function Bm(e,t={open:!1}){let n=`rootStore`in e?e.rootStore:e,r=n.useState(`floatingId`),{open:i}=t,{currentIdRef:a,delayRef:o,timeoutMs:s,initialDelayRef:c,currentContextRef:l,hasProvider:u,timeout:d}=b.useContext(Rm),[f,p]=b.useState(!1);return X(()=>{function e(){p(!1),l.current?.setIsInstantPhase(!1),a.current=null,l.current=null,o.current=c.current}if(a.current&&!i&&a.current===r){if(p(!1),s){let t=r;return d.start(s,()=>{n.select(`open`)||a.current&&a.current!==t||e()}),()=>{d.clear()}}e()}},[i,r,a,o,s,c,l,d,n]),X(()=>{if(!i)return;let e=l.current,t=a.current;d.clear(),l.current={onOpenChange:n.setOpen,setIsInstantPhase:p},a.current=r,o.current={open:0,close:xm(c.current,`close`)},t!==null&&t!==r?(p(!0),e?.setIsInstantPhase(!0),e?.onOpenChange(!1,Lm(wm))):(p(!1),e?.setIsInstantPhase(!1))},[i,r,n,a,o,s,c,l,d]),X(()=>()=>{l.current=null},[l]),b.useMemo(()=>({hasProvider:u,delayRef:o,isInstantPhase:f}),[u,o,f])}function Vm(...e){return()=>{for(let t=0;t<e.length;t+=1){let n=e[t];n&&n()}}}function Hm(e,t,n,r){let i=Kp(Wm).current;return Gm(i,e,t,n,r)&&qm(i,[e,t,n,r]),i.callback}function Um(e){let t=Kp(Wm).current;return Km(t,e)&&qm(t,e),t.callback}function Wm(){return{callback:null,cleanup:null,refs:[]}}function Gm(e,t,n,r,i){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==r||e.refs[3]!==i}function Km(e,t){return e.refs.length!==t.length||e.refs.some((e,n)=>e!==t[n])}function qm(e,t){if(e.refs=t,t.every(e=>e==null)){e.callback=null;return}e.callback=n=>{if(e.cleanup&&=(e.cleanup(),null),n!=null){let r=Array(t.length).fill(null);for(let e=0;e<t.length;e+=1){let i=t[e];if(i!=null)switch(typeof i){case`function`:{let t=i(n);typeof t==`function`&&(r[e]=t);break}case`object`:i.current=n;break;default:}}e.cleanup=()=>{for(let e=0;e<t.length;e+=1){let n=t[e];if(n!=null)switch(typeof n){case`function`:{let t=r[e];typeof t==`function`?t():n(null);break}case`object`:n.current=null;break;default:}}}}}}function Jm(e){let t=Kp(Ym,e).current;return t.next=e,X(t.effect),t}function Ym(e){let t={current:e,next:e,effect:()=>{t.current=t.next}};return t}var Xm=b[`useInsertionEffect${Math.random().toFixed(1)}`.slice(0,-3)],Zm=Xm&&Xm!==b.useLayoutEffect?Xm:e=>e();function Z(e){let t=Kp(Qm).current;return t.next=e,Zm(t.effect),t.trampoline}function Qm(){let e={next:void 0,callback:$m,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function $m(){}var eh={clipPath:`inset(50%)`,overflow:`hidden`,whiteSpace:`nowrap`,border:0,padding:0,width:1,height:1,margin:-1},th={...eh,position:`fixed`,top:0,left:0},nh={...eh,position:`absolute`},rh=b.forwardRef(function(e,t){let[n,r]=b.useState();X(()=>{Lp&&r(`button`)},[]);let i={tabIndex:0,role:n};return(0,y.jsx)(`span`,{...e,ref:t,style:th,"aria-hidden":n?void 0:!0,...i,"data-base-ui-focus-guard":``})}),ih=`data-base-ui-focusable`,ah=`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`,oh=`ArrowLeft`,sh=`ArrowRight`,ch=`ArrowUp`,lh=`ArrowDown`;function uh(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function dh(e,t){if(!e||!t)return!1;let n=t.getRootNode?.();if(e.contains(t))return!0;if(n&&fp(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function fh(e){return`composedPath`in e?e.composedPath()[0]:e.target}function ph(e,t){if(!up(e))return!1;let n=e;if(t.hasElement(n))return!n.hasAttribute(`data-trigger-disabled`);for(let[,e]of t.entries())if(dh(e,n))return!e.hasAttribute(`data-trigger-disabled`);return!1}function mh(e,t){if(t==null)return!1;if(`composedPath`in e)return e.composedPath().includes(t);let n=e;return n.target!=null&&t.contains(n.target)}function hh(e){return e.matches(`html,body`)}function gh(e){return dp(e)&&e.matches(`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`)}function _h(e){return e?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${ah}`)!=null}function vh(e){return e?e.getAttribute(`role`)===`combobox`&&gh(e):!1}function yh(e){if(!e||Bp)return!0;try{return e.matches(`:focus-visible`)}catch{return!0}}function bh(e){return e?e.hasAttribute(`data-base-ui-focusable`)?e:e.querySelector(`[data-base-ui-focusable]`)||e:null}var xh=[`top`,`right`,`bottom`,`left`],Sh=Math.min,Ch=Math.max,wh=Math.round,Th=Math.floor,Eh=e=>({x:e,y:e}),Dh={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function Oh(e,t,n){return Ch(e,Sh(t,n))}function kh(e,t){return typeof e==`function`?e(t):e}function Ah(e){return e.split(`-`)[0]}function jh(e){return e.split(`-`)[1]}function Mh(e){return e===`x`?`y`:`x`}function Nh(e){return e===`y`?`height`:`width`}function Ph(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function Fh(e){return Mh(Ph(e))}function Ih(e,t,n){n===void 0&&(n=!1);let r=jh(e),i=Fh(e),a=Nh(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=Gh(o)),[o,Gh(o)]}function Lh(e){let t=Gh(e);return[Rh(e),t,Rh(t)]}function Rh(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var zh=[`left`,`right`],Bh=[`right`,`left`],Vh=[`top`,`bottom`],Hh=[`bottom`,`top`];function Uh(e,t,n){switch(e){case`top`:case`bottom`:return n?t?Bh:zh:t?zh:Bh;case`left`:case`right`:return t?Vh:Hh;default:return[]}}function Wh(e,t,n,r){let i=jh(e),a=Uh(Ah(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(Rh)))),a}function Gh(e){let t=Ah(e);return Dh[t]+e.slice(t.length)}function Kh(e){return{top:0,right:0,bottom:0,left:0,...e}}function qh(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Kh(e)}function Jh(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function Yh(e,t,n){return Math.floor(e/t)!==n}function Xh(e,t){return t<0||t>=e.length}function Zh(e,t){return $h(e.current,{disabledIndices:t})}function Qh(e,t){return $h(e.current,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function $h(e,{startingIndex:t=-1,decrement:n=!1,disabledIndices:r,amount:i=1}={}){let a=t;do a+=n?-i:i;while(a>=0&&a<=e.length-1&&ig(e,a,r));return a}function eg(e,{event:t,orientation:n,loopFocus:r,onLoop:i,rtl:a,cols:o,disabledIndices:s,minIndex:c,maxIndex:l,prevIndex:u,stopEvent:d=!1}){let f=u,p;if(t.key===`ArrowUp`?p=`up`:t.key===`ArrowDown`&&(p=`down`),p){let n=[],a=[],m=!1,h=0;{let t=null,r=-1;e.forEach((e,i)=>{if(e==null)return;h+=1;let o=e.closest(`[role="row"]`);o&&(m=!0),(o!==t||r===-1)&&(t=o,r+=1,n[r]=[]),n[r].push(i),a[i]=r})}let g=!1,_=0;if(m)for(let e of n){let t=e.length;t>_&&(_=t),t!==o&&(g=!0)}let v=g&&h<e.length,y=_||o,b=o=>{if(!g||u===-1)return;let c=a[u];if(c==null)return;let l=n[c].indexOf(u),d=o===`up`?-1:1;for(let o=c+d,f=0;f<n.length;f+=1,o+=d){if(o<0||o>=n.length){if(!r||v)return;if(o=o<0?n.length-1:0,i){let e=Math.min(l,n[o].length-1);o=a[i(t,u,n[o][e]??n[o][0])]??o}}let c=n[o];for(let t=Math.min(l,c.length-1);t>=0;--t){let n=c[t];if(!ig(e,n,s))return n}}},x=t=>{if(!v||u===-1)return;let n=u%y,i=t===`up`?-y:y,a=l-l%y,o=Th(l/y)+1;for(let t=u-n+i,c=0;c<o;c+=1,t+=i){if(t<0||t>l){if(!r)return;t=t<0?a:0}let i=Math.min(t+y-1,l);for(let r=Math.min(t+n,i);r>=t;--r)if(!ig(e,r,s))return r}};d&&mm(t);let S=b(p)??x(p);if(S!==void 0)f=S;else if(u===-1)f=p===`up`?l:c;else if(f=$h(e,{startingIndex:u,amount:y,decrement:p===`up`,disabledIndices:s}),r){if(p===`up`&&(u-y<c||f<0)){let e=u%y,n=l%y,r=l-(n-e);f=n===e?l:n>e?r:r-y,i&&(f=i(t,u,f))}p===`down`&&u+y>l&&(f=$h(e,{startingIndex:u%y-y,amount:y,disabledIndices:s}),i&&(f=i(t,u,f)))}Xh(e,f)&&(f=u)}if(n===`both`){let n=Th(u/o);t.key===(a?`ArrowLeft`:`ArrowRight`)&&(d&&mm(t),u%o===o-1?r&&(f=$h(e,{startingIndex:u-u%o-1,disabledIndices:s}),i&&(f=i(t,u,f))):(f=$h(e,{startingIndex:u,disabledIndices:s}),r&&Yh(f,o,n)&&(f=$h(e,{startingIndex:u-u%o-1,disabledIndices:s}),i&&(f=i(t,u,f)))),Yh(f,o,n)&&(f=u)),t.key===(a?`ArrowRight`:`ArrowLeft`)&&(d&&mm(t),u%o===0?r&&(f=$h(e,{startingIndex:u+(o-u%o),decrement:!0,disabledIndices:s}),i&&(f=i(t,u,f))):(f=$h(e,{startingIndex:u,decrement:!0,disabledIndices:s}),r&&Yh(f,o,n)&&(f=$h(e,{startingIndex:u+(o-u%o),decrement:!0,disabledIndices:s}),i&&(f=i(t,u,f)))),Yh(f,o,n)&&(f=u));let c=Th(l/o)===n;Xh(e,f)&&(r&&c?(f=t.key===(a?`ArrowRight`:`ArrowLeft`)?l:$h(e,{startingIndex:u-u%o-1,disabledIndices:s}),i&&(f=i(t,u,f))):f=u)}return f}function tg(e,t,n){let r=[],i=0;return e.forEach(({width:e,height:a},o)=>{let s=!1;for(n&&(i=0);!s;){let n=[];for(let r=0;r<e;r+=1)for(let e=0;e<a;e+=1)n.push(i+r+e*t);i%t+e<=t&&n.every(e=>r[e]==null)?(n.forEach(e=>{r[e]=o}),s=!0):i+=1}}),[...r]}function ng(e,t,n,r,i){if(e===-1)return-1;let a=n.indexOf(e),o=t[e];switch(i){case`tl`:return a;case`tr`:return o?a+o.width-1:a;case`bl`:return o?a+(o.height-1)*r:a;case`br`:return n.lastIndexOf(e);default:return-1}}function rg(e,t){return t.flatMap((t,n)=>e.includes(t)?[n]:[])}function ig(e,t,n){if(typeof n==`function`?n(t):n?.includes(t)??!1)return!0;let r=e[t];return r?og(r)?!n&&(r.hasAttribute(`disabled`)||r.getAttribute(`aria-disabled`)===`true`):!0:!1}function ag(e){return e.visibility===`hidden`||e.visibility===`collapse`}function og(e,t=e?wp(e):null){return!e||!e.isConnected||!t||ag(t)?!1:typeof e.checkVisibility==`function`?e.checkVisibility():t.display!==`none`&&t.display!==`contents`}var sg=`a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]`;function cg(e){let t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;let n=e.getRootNode();return fp(n)?n.host:null}function lg(e){for(let t of Array.from(e.children))if(op(t)===`summary`)return t;return null}function ug(e,t){let n=lg(t);return!!n&&(e===n||dh(n,e))}function dg(e){let t=e?op(e):``;return e!=null&&e.matches(sg)&&(t!==`summary`||e.parentElement!=null&&op(e.parentElement)===`details`&&lg(e.parentElement)===e)&&(t!==`details`||lg(e)==null)&&(t!==`input`||e.type!==`hidden`)}function fg(e){if(!dg(e)||!e.isConnected||e.matches(`:disabled`))return!1;for(let t=e;t;t=cg(t)){let n=t!==e,r=op(t)===`slot`;if(t.hasAttribute(`inert`)||n&&op(t)===`details`&&!t.open&&!ug(e,t)||t.hasAttribute(`hidden`)||!r&&!pg(t,n))return!1}return!0}function pg(e,t){let n=wp(e);return t?n.display!==`none`:og(e,n)}function mg(e){let t=e.tabIndex;if(t<0){let t=op(e);if(t===`details`||t===`audio`||t===`video`||dp(e)&&e.isContentEditable)return 0}return t}function hg(e){if(op(e)!==`input`)return null;let t=e;return t.type===`radio`&&t.name!==``?t:null}function gg(e,t){let n=hg(e);if(!n)return!0;let r=t.find(e=>{let t=hg(e);return t?.name===n.name&&t.form===n.form&&t.checked});return r?r===n:t.find(e=>{let t=hg(e);return t?.name===n.name&&t.form===n.form})===n}function _g(e){if(dp(e)&&op(e)===`slot`){let t=e.assignedElements({flatten:!0});if(t.length>0)return t}return dp(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function vg(e,t){_g(e).forEach(e=>{dg(e)&&t.push(e),vg(e,t)})}function yg(e,t,n){_g(e).forEach(e=>{dp(e)&&e.matches(t)&&n.push(e),yg(e,t,n)})}function bg(e){return fg(e)&&mg(e)>=0}function xg(e){let t=[];return vg(e,t),t.filter(fg)}function Sg(e){let t=xg(e);return t.filter(e=>mg(e)>=0&&gg(e,t))}function Cg(e,t){let n=Sg(e),r=n.length;if(r===0)return;let i=uh(Wp(e)),a=n.indexOf(i);return n[a===-1?t===1?0:r-1:a+t]}function wg(e){return Cg(Wp(e).body,1)||e}function Tg(e){return Cg(Wp(e).body,-1)||e}function Eg(e,t){if(!e)return null;let n=Sg(Wp(e).body),r=n.length;if(r===0)return null;let i=n.indexOf(e);return i===-1?null:n[(i+t+r)%r]}function Dg(e){return Eg(e,1)}function Og(e){return Eg(e,-1)}function kg(e,t){let n=t||e.currentTarget,r=e.relatedTarget;return!r||!dh(n,r)}function Ag(e){Sg(e).forEach(e=>{e.dataset.tabindex=e.getAttribute(`tabindex`)||``,e.setAttribute(`tabindex`,`-1`)})}function jg(e){let t=[];yg(e,`[data-tabindex]`,t),t.forEach(e=>{let t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute(`tabindex`,t):e.removeAttribute(`tabindex`)})}function Mg(e,t,n=!0){return e.filter(e=>e.parentId===t).flatMap(t=>[...!n||t.context?.open?[t]:[],...Mg(e,t.id,n)])}function Ng(e,t){let n=[],r=e.find(e=>e.id===t)?.parentId;for(;r;){let t=e.find(e=>e.id===r);r=t?.parentId,t&&(n=n.concat(t))}return n}function Pg(e){return`data-base-ui-${e}`}var Fg=0;function Ig(e,t={}){let{preventScroll:n=!1,cancelPrevious:r=!0,sync:i=!1}=t;r&&cancelAnimationFrame(Fg);let a=()=>e?.focus({preventScroll:n});if(i)return a(),nm;let o=requestAnimationFrame(a);return Fg=o,()=>{Fg===o&&(cancelAnimationFrame(o),Fg=0)}}var Lg={inert:new WeakMap,"aria-hidden":new WeakMap},Rg=`data-base-ui-inert`,zg={inert:new WeakSet,"aria-hidden":new WeakSet},Bg=new WeakMap,Vg=0;function Hg(e){return zg[e]}function Ug(e){return e?fp(e)?e.host:Ug(e.parentNode):null}var Wg=(e,t)=>t.map(t=>{if(e.contains(t))return t;let n=Ug(t);return e.contains(n)?n:null}).filter(e=>e!=null),Gg=e=>{let t=new Set;return e.forEach(e=>{let n=e;for(;n&&!t.has(n);)t.add(n),n=n.parentNode}),t},Kg=(e,t,n)=>{let r=[],i=e=>{!e||n.has(e)||Array.from(e.children).forEach(e=>{op(e)!==`script`&&(t.has(e)?i(e):r.push(e))})};return i(e),r};function qg(e,t,n,r,{mark:i=!0,markerIgnoreElements:a=[]}){let o=r?`inert`:n?`aria-hidden`:null,s=null,c=null,l=Wg(t,e),u=i?Wg(t,a):[],d=new Set(u),f=i?Kg(t,Gg(l),new Set(l)).filter(e=>!d.has(e)):[],p=[],m=[];if(o){let e=Lg[o],n=Hg(o);c=n,s=e;let r=Wg(t,Array.from(t.querySelectorAll(`[aria-live]`))),i=l.concat(r);Kg(t,Gg(i),new Set(i)).forEach(t=>{let r=t.getAttribute(o),i=r!==null&&r!==`false`,a=(e.get(t)||0)+1;e.set(t,a),p.push(t),a===1&&i&&n.add(t),i||t.setAttribute(o,o===`inert`?``:`true`)})}return i&&f.forEach(e=>{let t=(Bg.get(e)||0)+1;Bg.set(e,t),m.push(e),t===1&&e.setAttribute(Rg,``)}),Vg+=1,()=>{s&&p.forEach(e=>{let t=(s.get(e)||0)-1;s.set(e,t),t||(!c?.has(e)&&o&&e.removeAttribute(o),c?.delete(e))}),i&&m.forEach(e=>{let t=(Bg.get(e)||0)-1;Bg.set(e,t),t||e.removeAttribute(Rg)}),--Vg,Vg||(Lg.inert=new WeakMap,Lg[`aria-hidden`]=new WeakMap,zg.inert=new WeakSet,zg[`aria-hidden`]=new WeakSet,Bg=new WeakMap)}}function Jg(e,t={}){let{ariaHidden:n=!1,inert:r=!1,mark:i=!0,markerIgnoreElements:a=[]}=t,o=Wp(e[0]).body;return qg(e,o,n,r,{mark:i,markerIgnoreElements:a})}var Yg={...b},Xg=0;function Zg(e,t=`mui`){let[n,r]=b.useState(e),i=e||n;return b.useEffect(()=>{n??(Xg+=1,r(`${t}-${Xg}`))},[n,t]),i}var Qg=Yg.useId;function $g(e,t){if(Qg!==void 0){let n=Qg();return e??(t?`${t}-${n}`:n)}return Zg(e,t)}function e_(e,t){return function(n,...r){let i=new URL(e);return i.searchParams.set(`code`,n.toString()),r.forEach(e=>i.searchParams.append(`args[]`,e)),`${t} error #${n}; visit ${i} for the full message.`}}var t_=e_(`https://base-ui.com/production-error`,`Base UI`),n_=19;function r_(e){return n_>=e}function i_(e){if(!b.isValidElement(e))return null;let t=e,n=t.props;return(r_(19)?n?.ref:t.ref)??null}function a_(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}function o_(e,t){let n={};for(let r in e){let i=e[r];if(t?.hasOwnProperty(r)){let e=t[r](i);e!=null&&Object.assign(n,e);continue}i===!0?n[`data-${r.toLowerCase()}`]=``:i&&(n[`data-${r.toLowerCase()}`]=i.toString())}return n}function s_(e,t){return typeof e==`function`?e(t):e}function c_(e,t){return typeof e==`function`?e(t):e}var l_={};function u_(e,t,n,r,i){if(!n&&!r&&!i&&!e)return f_(t);let a=f_(e);return t&&(a=p_(a,t)),n&&(a=p_(a,n)),r&&(a=p_(a,r)),i&&(a=p_(a,i)),a}function d_(e){if(e.length===0)return l_;if(e.length===1)return f_(e[0]);let t=f_(e[0]);for(let n=1;n<e.length;n+=1)t=p_(t,e[n]);return t}function f_(e){return __(e)?{...v_(e,l_)}:m_(e)}function p_(e,t){return __(t)?v_(t,e):h_(e,t)}function m_(e){let t={...e};for(let e in t){let n=t[e];g_(e,n)&&(t[e]=b_(n))}return t}function h_(e,t){if(!t)return e;for(let n in t){let r=t[n];switch(n){case`style`:e[n]=a_(e.style,r);break;case`className`:e[n]=S_(e.className,r);break;default:g_(n,r)?e[n]=y_(e[n],r):e[n]=r}}return e}function g_(e,t){let n=e.charCodeAt(0),r=e.charCodeAt(1),i=e.charCodeAt(2);return n===111&&r===110&&i>=65&&i<=90&&(typeof t==`function`||t===void 0)}function __(e){return typeof e==`function`}function v_(e,t){return __(e)?e(t):e??l_}function y_(e,t){return t?e?(...n)=>{let r=n[0];if(C_(r)){let i=r;x_(i);let a=t(...n);return i.baseUIHandlerPrevented||e?.(...n),a}let i=t(...n);return e?.(...n),i}:b_(t):e}function b_(e){return e&&((...t)=>{let n=t[0];return C_(n)&&x_(n),e(...t)})}function x_(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function S_(e,t){return t?e?t+` `+e:t:e}function C_(e){return typeof e==`object`&&!!e&&`nativeEvent`in e}function w_(e,t,n={}){let r=t.render,i=T_(t,n);return n.enabled===!1?null:O_(e,r,i,n.state??im)}function T_(e,t={}){let{className:n,style:r,render:i}=e,{state:a=im,ref:o,props:s,stateAttributesMapping:c,enabled:l=!0}=t,u=l?s_(n,a):void 0,d=l?c_(r,a):void 0,f=l?o_(a,c):im,p=l&&s?E_(s):void 0,m=l?a_(f,p)??{}:im;return typeof document<`u`&&(l?Array.isArray(o)?m.ref=Um([m.ref,i_(i),...o]):m.ref=Hm(m.ref,i_(i),o):Hm(null,null)),l?(u!==void 0&&(m.className=S_(m.className,u)),d!==void 0&&(m.style=a_(m.style,d)),m):im}function E_(e){return Array.isArray(e)?d_(e):u_(void 0,e)}var D_=Symbol.for(`react.lazy`);function O_(e,t,n,r){if(t){if(typeof t==`function`)return t(n,r);let e=u_(n,t.props);e.ref=n.ref;let i=t;return i?.$$typeof===D_&&(i=b.Children.toArray(t)[0]),b.cloneElement(i,e)}if(e&&typeof e==`string`)return k_(e,n);throw Error(t_(8))}function k_(e,t){return e===`button`?(0,b.createElement)(`button`,{type:`button`,...t,key:t.key}):e===`img`?(0,b.createElement)(`img`,{alt:``,...t,key:t.key}):b.createElement(e,t)}var A_={style:{transition:`none`}},j_=`data-base-ui-click-trigger`,M_={fallbackAxisSide:`none`},N_={fallbackAxisSide:`end`},P_={clipPath:`inset(50%)`,position:`fixed`,top:0,left:0},F_=c(g()),I_=b.createContext(null),L_=()=>b.useContext(I_),R_=Pg(`portal`);function z_(e={}){let{ref:t,container:n,componentProps:r=im,elementProps:i}=e,a=$g(),o=L_()?.portalNode,[s,c]=b.useState(null),[l,u]=b.useState(null),d=Z(e=>{e!==null&&u(e)}),f=b.useRef(null);X(()=>{if(n===null){f.current&&(f.current=null,u(null),c(null));return}if(a==null)return;let e=(n&&(lp(n)?n:n.current))??o??document.body;if(e==null){f.current&&(f.current=null,u(null),c(null));return}f.current!==e&&(f.current=e,u(null),c(e))},[n,o,a]);let p=w_(`div`,r,{ref:[t,d],props:[{id:a,[R_]:``},i]});return{portalNode:l,portalSubtree:s&&p?F_.createPortal(p,s):null}}var B_=b.forwardRef(function(e,t){let{children:n,container:r,className:i,render:a,renderGuards:o,style:s,...c}=e,{portalNode:l,portalSubtree:u}=z_({container:r,ref:t,componentProps:e,elementProps:c}),d=b.useRef(null),f=b.useRef(null),p=b.useRef(null),m=b.useRef(null),[h,g]=b.useState(null),_=b.useRef(!1),v=h?.modal,x=h?.open,S=typeof o==`boolean`?o:!!h&&!h.modal&&h.open&&!!l;b.useEffect(()=>{if(!l||v)return;function e(e){l&&e.relatedTarget&&kg(e)&&(e.type===`focusin`?_.current&&=(jg(l),!1):(Ag(l),_.current=!0))}return Vm(Ap(l,`focusin`,e,!0),Ap(l,`focusout`,e,!0))},[l,v]),b.useEffect(()=>{!l||x!==!1||(jg(l),_.current=!1)},[x,l]);let C=b.useMemo(()=>({beforeOutsideRef:d,afterOutsideRef:f,beforeInsideRef:p,afterInsideRef:m,portalNode:l,setFocusManagerState:g}),[l]);return(0,y.jsxs)(b.Fragment,{children:[u,(0,y.jsxs)(I_.Provider,{value:C,children:[S&&l&&(0,y.jsx)(rh,{"data-type":`outside`,ref:d,onFocus:e=>{kg(e,l)?p.current?.focus():Tg(h?h.domReference:null)?.focus()}}),S&&l&&(0,y.jsx)(`span`,{"aria-owns":l.id,style:P_}),l&&F_.createPortal(n,l),S&&l&&(0,y.jsx)(rh,{"data-type":`outside`,ref:f,onFocus:e=>{kg(e,l)?m.current?.focus():(wg(h?h.domReference:null)?.focus(),h?.closeOnFocusOut&&h?.onOpenChange(!1,Lm(`focus-out`,e.nativeEvent)))}})]})]})});function V_(){let e=new Map;return{emit(t,n){e.get(t)?.forEach(e=>e(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){e.get(t)?.delete(n)}}}var H_=class{nodesRef={current:[]};events=V_();addNode(e){this.nodesRef.current.push(e)}removeNode(e){let t=this.nodesRef.current.findIndex(t=>t===e);t!==-1&&this.nodesRef.current.splice(t,1)}},U_=b.createContext(null),W_=b.createContext(null),G_=()=>b.useContext(U_)?.id||null,K_=e=>{let t=b.useContext(W_);return e??t};function q_(e){let t=$g(),n=K_(e),r=G_();return X(()=>{if(!t)return;let e={id:t,parentId:r};return n?.addNode(e),()=>{n?.removeNode(e)}},[n,t,r]),t}function J_(e){let{children:t,id:n}=e,r=G_();return(0,y.jsx)(U_.Provider,{value:b.useMemo(()=>({id:n,parentId:r}),[n,r]),children:t})}function Y_(e){let{children:t,externalTree:n}=e,r=Kp(()=>n??new H_).current;return(0,y.jsx)(W_.Provider,{value:r,children:t})}function X_(e){return e==null?e:`current`in e?e.current:e}function Z_(e,t){let n=sp(fh(e));return e instanceof n.KeyboardEvent?`keyboard`:e instanceof n.FocusEvent?t||`keyboard`:`pointerType`in e?e.pointerType||`keyboard`:`touches`in e?`touch`:e instanceof n.MouseEvent?t||(e.detail===0?`keyboard`:`mouse`):``}var Q_=20,$_=[];function ev(){$_=$_.filter(e=>e.deref()?.isConnected)}function tv(e){ev(),e&&op(e)!==`body`&&($_.push(new WeakRef(e)),$_.length>Q_&&($_=$_.slice(-Q_)))}function nv(){return ev(),$_[$_.length-1]?.deref()}function rv(e){return e?bg(e)?e:Sg(e)[0]||e:null}function iv(e,t){if(e.hasAttribute(`tabindex`)&&!e.hasAttribute(`data-tabindex`)||!t.current.includes(`floating`)&&!e.getAttribute(`role`)?.includes(`dialog`))return;let n=xg(e).filter(e=>{let t=e.getAttribute(`data-tabindex`)||``;return bg(e)||e.hasAttribute(`data-tabindex`)&&!t.startsWith(`-`)}),r=e.getAttribute(`tabindex`);t.current.includes(`floating`)||n.length===0?r!==`0`&&e.setAttribute(`tabindex`,`0`):(r!==`-1`||e.hasAttribute(`data-tabindex`)&&e.getAttribute(`data-tabindex`)!==`-1`)&&(e.setAttribute(`tabindex`,`-1`),e.setAttribute(`data-tabindex`,`-1`))}function av(e){let{context:t,children:n,disabled:r=!1,initialFocus:i=!0,returnFocus:a=!0,restoreFocus:o=!1,modal:s=!0,closeOnFocusOut:c=!0,openInteractionType:l=``,nextFocusableElement:u,previousFocusableElement:d,beforeContentFocusGuardRef:f,externalTree:p,getInsideElements:m}=e,h=`rootStore`in t?t.rootStore:t,g=h.useState(`open`),_=h.useState(`domReferenceElement`),v=h.useState(`floatingElement`),{events:x,dataRef:S}=h.context,C=Z(()=>S.current.floatingContext?.nodeId),w=i===!1,T=vh(_)&&w,E=b.useRef([`content`]),D=Jm(i),O=Jm(a),k=Jm(l),A=K_(p),j=L_(),M=b.useRef(!1),N=b.useRef(!1),P=b.useRef(!1),F=b.useRef(null),I=b.useRef(``),L=b.useRef(``),R=b.useRef(null),z=b.useRef(null),ee=Hm(R,f,j?.beforeInsideRef),B=Hm(z,j?.afterInsideRef),te=Zp(),V=Zp(),H=tm(),ne=j!=null,U=bh(v),re=Z((e=U)=>e?Sg(e):[]),W=Z(()=>m?.().filter(e=>e!=null)??[]);b.useEffect(()=>{if(r||!s)return;function e(e){e.key===`Tab`&&dh(U,uh(Wp(U)))&&re().length===0&&!T&&mm(e)}return Ap(Wp(U),`keydown`,e)},[r,_,U,s,E,T,re]),b.useEffect(()=>{if(r||!g)return;let e=Wp(U);function t(){P.current=!1}function n(e){let t=fh(e),n=W();P.current=!(dh(v,t)||dh(_,t)||dh(j?.portalNode,t)||n.some(e=>e===t||dh(e,t))),L.current=e.pointerType||`keyboard`,t?.closest(`[data-base-ui-click-trigger]`)&&(N.current=!0)}function i(){L.current=`keyboard`}return Vm(Ap(e,`pointerdown`,n,!0),Ap(e,`pointerup`,t,!0),Ap(e,`pointercancel`,t,!0),Ap(e,`keydown`,i,!0))},[r,v,_,U,g,j,W]),b.useEffect(()=>{if(r||!c)return;let e=Wp(U);function t(){N.current=!0,V.start(0,()=>{N.current=!1})}function n(e){let t=fh(e);bg(t)&&(F.current=t)}function i(t){let n=t.relatedTarget,r=t.currentTarget,i=fh(t);queueMicrotask(()=>{let a=C(),c=h.context.triggerElements,l=W(),f=n?.hasAttribute(Pg(`focus-guard`))&&[R.current,z.current,j?.beforeInsideRef.current,j?.afterInsideRef.current,j?.beforeOutsideRef.current,j?.afterOutsideRef.current,X_(d),X_(u)].includes(n),p=!(dh(_,n)||dh(v,n)||dh(n,v)||dh(j?.portalNode,n)||l.some(e=>e===n||dh(e,n))||n!=null&&c.hasElement(n)||c.hasMatchingElement(e=>dh(e,n))||f||A&&(Mg(A.nodesRef.current,a).find(e=>dh(e.context?.elements.floating,n)||dh(e.context?.elements.domReference,n))||Ng(A.nodesRef.current,a).find(e=>[e.context?.elements.floating,bh(e.context?.elements.floating)].includes(n)||e.context?.elements.domReference===n)));if(r===_&&U&&iv(U,E),o&&r!==_&&!og(i)&&uh(e)===e.body){if(dp(U)&&(U.focus(),o===`popup`)){H.request(()=>{U.focus()});return}let e=re(),t=F.current,n=(t&&e.includes(t)?t:null)||e[e.length-1]||U;dp(n)&&n.focus()}if(S.current.insideReactTree){S.current.insideReactTree=!1;return}(T||!s)&&n&&p&&!N.current&&(T||n!==nv())&&(M.current=!0,h.setOpen(!1,Lm(Am,t)))})}function a(){P.current||(S.current.insideReactTree=!0,te.start(0,()=>{S.current.insideReactTree=!1}))}let l=dp(_)?_:null;if(!(!v&&!l))return Vm(l&&Ap(l,`focusout`,i),l&&Ap(l,`pointerdown`,t),v&&Ap(v,`focusin`,n),v&&Ap(v,`focusout`,i),v&&j&&Ap(v,`focusout`,a,!0))},[r,_,v,U,s,A,j,h,c,o,re,T,C,E,S,te,V,H,u,d,W]),b.useEffect(()=>{if(r||!v||!g)return;let e=Array.from(j?.portalNode?.querySelectorAll(`[${Pg(`portal`)}]`)||[]),t=(A?Ng(A.nodesRef.current,C()):[]).find(e=>vh(e.context?.elements.domReference||null))?.context?.elements.domReference,n=Jg([...[v,...e,R.current,z.current,j?.beforeOutsideRef.current,j?.afterOutsideRef.current,...W()],t,X_(d),X_(u),T?_:null].filter(e=>e!=null),{ariaHidden:s||T,mark:!1}),i=Jg([v,...e].filter(e=>e!=null));return()=>{i(),n()}},[g,r,_,v,s,E,j,T,A,C,u,d,W]),X(()=>{if(!g||r||!dp(U))return;let e=uh(Wp(U));queueMicrotask(()=>{let t=D.current,n=typeof t==`function`?t(k.current||``):t;if(n===void 0||n===!1||dh(U,e))return;let r=null,i=()=>(r??=re(U),r[0]||U),a;a=n===!0||n===null?i():X_(n),a||=i(),Ig(a,{preventScroll:a===U})})},[r,g,U,w,re,D,k]),X(()=>{if(r||!U)return;let e=Wp(U);tv(uh(e));function t(e){if(e.open||(I.current=Z_(e.nativeEvent,L.current)),e.reason===`trigger-hover`&&e.nativeEvent.type===`mouseleave`&&(M.current=!0),e.reason===`outside-press`)if(e.nested)M.current=!1;else if(gm(e.nativeEvent)||_m(e.nativeEvent))M.current=!1;else{let e=!1;Wp(U).createElement(`div`).focus({get preventScroll(){return e=!0,!1}}),e?M.current=!1:M.current=!0}}x.on(`openchange`,t);function n(){let e=O.current,t=typeof e==`function`?e(I.current):e;if(t===void 0||t===!1)return null;if(t===null&&(t=!0),typeof t==`boolean`){let e=_||nv();return e&&e.isConnected?e:null}let n=_||nv();return X_(t)||n||null}return()=>{x.off(`openchange`,t);let r=uh(e),i=W(),a=dh(v,r)||i.some(e=>e===r||dh(e,r))||A&&Mg(A.nodesRef.current,C(),!1).some(e=>dh(e.context?.elements.floating,r)),o=O.current,s=n();queueMicrotask(()=>{let t=rv(s),n=typeof o!=`boolean`;o&&!M.current&&dp(t)&&(!(!n&&t!==r&&r!==e.body)||a)&&t.focus({preventScroll:!0}),M.current=!1})}},[r,v,U,O,S,x,A,_,C,W]),X(()=>{if(!Fp||g||!v)return;let e=uh(Wp(v));!dp(e)||!gh(e)||dh(v,e)&&e.blur()},[g,v]),X(()=>{if(!(r||!j))return j.setFocusManagerState({modal:s,closeOnFocusOut:c,open:g,onOpenChange:h.setOpen,domReference:_}),()=>{j.setFocusManagerState(null)}},[r,j,s,g,h,c,_]),X(()=>{if(!(r||!U))return iv(U,E),()=>{queueMicrotask(ev)}},[r,U,E]);let ie=!r&&(s?!T:!0)&&(ne||s);return(0,y.jsxs)(b.Fragment,{children:[ie&&(0,y.jsx)(rh,{"data-type":`inside`,ref:ee,onFocus:e=>{if(s){let e=re();Ig(e[e.length-1])}else j?.portalNode&&(M.current=!1,kg(e,j.portalNode)?wg(_)?.focus():X_(d??j.beforeOutsideRef)?.focus())}}),n,ie&&(0,y.jsx)(rh,{"data-type":`inside`,ref:B,onFocus:e=>{s?Ig(re()[0]):j?.portalNode&&(c&&(M.current=!0),kg(e,j.portalNode)?Tg(_)?.focus():X_(u??j.afterOutsideRef)?.focus())}})]})}function ov(e,t={}){let n=`rootStore`in e?e.rootStore:e,r=n.context.dataRef,{enabled:i=!0,event:a=`click`,toggle:o=!0,ignoreMouse:s=!1,stickIfOpen:c=!0,touchOpenDelay:l=0,reason:u=Tm}=t,d=b.useRef(void 0),f=tm(),p=Zp(),m=b.useMemo(()=>({onPointerDown(e){d.current=e.pointerType},onMouseDown(e){let t=d.current,i=e.nativeEvent,m=n.select(`open`);if(e.button!==0||a===`click`||vm(t,!0)&&s)return;let h=r.current.openEvent,g=h?.type,_=n.select(`domReferenceElement`)!==e.currentTarget,v=m&&_||!(m&&o&&(!(h&&c)||g===`click`||g===`mousedown`)),y=fh(i);if(gh(y)){let e=Lm(u,i,y);v&&t===`touch`&&l>0?p.start(l,()=>{n.setOpen(!0,e)}):n.setOpen(v,e);return}let b=e.currentTarget;f.request(()=>{let e=Lm(u,i,b);v&&t===`touch`&&l>0?p.start(l,()=>{n.setOpen(!0,e)}):n.setOpen(v,e)})},onClick(e){if(a===`mousedown-only`)return;let t=d.current;if(a===`mousedown`&&t){d.current=void 0;return}if(vm(t,!0)&&s)return;let i=n.select(`open`),f=r.current.openEvent,m=n.select(`domReferenceElement`)!==e.currentTarget,h=i&&m||!(i&&o&&(!(f&&c)||ym(f))),g=Lm(u,e.nativeEvent,e.currentTarget);h&&t===`touch`&&l>0?p.start(l,()=>{n.setOpen(!0,g)}):n.setOpen(h,g)},onKeyDown(){d.current=void 0}}),[r,a,s,n,c,o,f,p,l,u]);return b.useMemo(()=>i?{reference:m}:im,[i,m])}function sv(e,t){let n=null,r=null,i=!1;return{contextElement:e||void 0,getBoundingClientRect(){let a=e?.getBoundingClientRect()||{width:0,height:0,x:0,y:0},o=t.axis===`x`||t.axis===`both`,s=t.axis===`y`||t.axis===`both`,c=[`mouseenter`,`mousemove`].includes(t.dataRef.current.openEvent?.type||``)&&t.pointerType!==`touch`,l=a.width,u=a.height,d=a.x,f=a.y;return n==null&&t.x&&o&&(n=a.x-t.x),r==null&&t.y&&s&&(r=a.y-t.y),d-=n||0,f-=r||0,l=0,u=0,!i||c?(l=t.axis===`y`?a.width:0,u=t.axis===`x`?a.height:0,d=o&&t.x!=null?t.x:d,f=s&&t.y!=null?t.y:f):i&&!c&&(u=t.axis===`x`?a.height:u,l=t.axis===`y`?a.width:l),i=!0,{width:l,height:u,x:d,y:f,top:f,right:d+l,bottom:f+u,left:d}}}}function cv(e){return e!=null&&e.clientX!=null}function lv(e,t={}){let n=`rootStore`in e?e.rootStore:e,r=n.useState(`open`),i=n.useState(`floatingElement`),a=n.useState(`domReferenceElement`),o=n.context.dataRef,{enabled:s=!0,axis:c=`both`}=t,l=b.useRef(!1),u=b.useRef(null),[d,f]=b.useState(),[p,m]=b.useState([]),h=Z((e,t,r)=>{l.current||o.current.openEvent&&!cv(o.current.openEvent)||n.set(`positionReference`,sv(r??a,{x:e,y:t,axis:c,dataRef:o,pointerType:d}))}),g=Z(e=>{r?u.current||m([]):h(e.clientX,e.clientY,e.currentTarget)}),_=vm(d)?i:r,v=b.useCallback(()=>{if(!_||!s)return;let e=sp(i);function t(e){dh(i,fh(e))?(u.current?.(),u.current=null):h(e.clientX,e.clientY)}if(!o.current.openEvent||cv(o.current.openEvent))return u.current=Ap(e,`mousemove`,t),()=>{u.current?.(),u.current=null};n.set(`positionReference`,a)},[_,s,i,o,a,n,h]);b.useEffect(()=>v(),[v,p]),b.useEffect(()=>{s&&!i&&(l.current=!1)},[s,i]),b.useEffect(()=>{!s&&r&&(l.current=!0)},[s,r]);let y=b.useMemo(()=>{function e(e){f(e.pointerType)}return{onPointerDown:e,onPointerEnter:e,onMouseMove:g,onMouseEnter:g}},[g]);return b.useMemo(()=>s?{reference:y,trigger:y}:{},[s,y])}var uv={intentional:`onClick`,sloppy:`onPointerDown`};function dv(){return!1}function fv(e){return{escapeKey:typeof e==`boolean`?e:e?.escapeKey??!1,outsidePress:typeof e==`boolean`?e:e?.outsidePress??!0}}function pv(e,t={}){let n=`rootStore`in e?e.rootStore:e,r=n.useState(`open`),i=n.useState(`floatingElement`),{dataRef:a}=n.context,{enabled:o=!0,escapeKey:s=!0,outsidePress:c=!0,outsidePressEvent:l=`sloppy`,referencePress:u=dv,referencePressEvent:d=`sloppy`,bubbles:f,externalTree:p}=t,m=K_(p),h=Z(typeof c==`function`?c:()=>!1),g=typeof c==`function`?h:c,_=g!==!1,v=Z(()=>l),y=b.useRef(!1),x=b.useRef(!1),S=b.useRef(!1),{escapeKey:C,outsidePress:w}=fv(f),T=b.useRef(null),E=Zp(),D=Zp(),O=Z(()=>{D.clear(),a.current.insideReactTree=!1}),k=b.useRef(!1),A=b.useRef(``),j=Z(u),M=Z(e=>{if(!r||!o||!s||e.key!==`Escape`||k.current)return;let t=a.current.floatingContext?.nodeId,i=m?Mg(m.nodesRef.current,t):[];if(!C&&i.length>0){let e=!0;if(i.forEach(t=>{t.context?.open&&!t.context.dataRef.current.__escapeKeyBubbles&&(e=!1)}),!e)return}let c=Lm(jm,hm(e)?e.nativeEvent:e);n.setOpen(!1,c),!C&&!c.isPropagationAllowed&&e.stopPropagation()}),N=Z(()=>{a.current.insideReactTree=!0,D.start(0,O)});b.useEffect(()=>{if(!r||!o)return;a.current.__escapeKeyBubbles=C,a.current.__outsidePressBubbles=w;let e=new Xp,t=new Xp;function c(){e.clear(),k.current=!0}function l(){e.start(Sp()?5:0,()=>{k.current=!1})}function u(){S.current=!0,t.start(0,()=>{S.current=!1})}function d(){y.current=!1,x.current=!1}function f(){let e=A.current,t=e===`pen`||!e?`mouse`:e,n=v(),r=typeof n==`function`?n():n;return typeof r==`string`?r:r[t]}function p(e){let t=f();return t===`intentional`&&e.type!==`click`||t===`sloppy`&&e.type===`click`}function h(e){let t=a.current.floatingContext?.nodeId,r=m&&Mg(m.nodesRef.current,t).some(t=>mh(e,t.context?.elements.floating));return mh(e,n.select(`floatingElement`))||mh(e,n.select(`domReferenceElement`))||r}function b(e){if(p(e)){O();return}if(a.current.insideReactTree){O();return}let r=fh(e),i=`[${Pg(`inert`)}]`,o=up(r)?r.getRootNode():null,s=Array.from((fp(o)?o:Wp(n.select(`floatingElement`))).querySelectorAll(i)),c=n.context.triggerElements;if(r&&(c.hasElement(r)||c.hasMatchingElement(e=>dh(e,r))))return;let l=up(r)?r:null;for(;l&&!Cp(l);){let e=Ep(l);if(Cp(e)||!up(e))break;l=e}if(s.length&&up(r)&&!hh(r)&&!dh(r,n.select(`floatingElement`))&&s.every(e=>!dh(l,e)))return;if(dp(r)&&!(`touches`in e)){let t=Cp(r),n=wp(r),i=/auto|scroll/,a=t||i.test(n.overflowX),o=t||i.test(n.overflowY),s=a&&r.clientWidth>0&&r.scrollWidth>r.clientWidth,c=o&&r.clientHeight>0&&r.scrollHeight>r.clientHeight,l=n.direction===`rtl`,u=c&&(l?e.offsetX<=r.offsetWidth-r.clientWidth:e.offsetX>r.clientWidth),d=s&&e.offsetY>r.clientHeight;if(u||d)return}if(h(e))return;if(f()===`intentional`&&S.current){t.clear(),S.current=!1;return}if(typeof g==`function`&&!g(e))return;let u=a.current.floatingContext?.nodeId,d=m?Mg(m.nodesRef.current,u):[];if(d.length>0){let e=!0;if(d.forEach(t=>{t.context?.open&&!t.context.dataRef.current.__outsidePressBubbles&&(e=!1)}),!e)return}n.setOpen(!1,Lm(Om,e)),O()}function D(e){f()!==`sloppy`||e.pointerType===`touch`||!n.select(`open`)||!o||mh(e,n.select(`floatingElement`))||mh(e,n.select(`domReferenceElement`))||b(e)}function j(e){if(f()!==`sloppy`||!n.select(`open`)||!o||mh(e,n.select(`floatingElement`))||mh(e,n.select(`domReferenceElement`)))return;let t=e.touches[0];t&&(T.current={startTime:Date.now(),startX:t.clientX,startY:t.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},E.start(1e3,()=>{T.current&&(T.current.dismissOnTouchEnd=!1,T.current.dismissOnMouseDown=!1)}))}function N(e,t){let n=fh(e);if(!n)return;let r=Ap(n,e.type,()=>{t(e),r()})}function P(e){A.current=`touch`,N(e,j)}function F(e){E.clear(),e.type===`pointerdown`&&(A.current=e.pointerType),!(e.type===`mousedown`&&T.current&&!T.current.dismissOnMouseDown)&&N(e,e=>{e.type===`pointerdown`?D(e):b(e)})}function I(e){if(!y.current)return;let n=x.current;if(d(),f()===`intentional`){if(e.type===`pointercancel`){n&&u();return}if(!h(e)){if(n){u();return}typeof g==`function`&&!g(e)||(t.clear(),S.current=!0,O())}}}function L(e){if(f()!==`sloppy`||!T.current||mh(e,n.select(`floatingElement`))||mh(e,n.select(`domReferenceElement`)))return;let t=e.touches[0];if(!t)return;let r=Math.abs(t.clientX-T.current.startX),i=Math.abs(t.clientY-T.current.startY),a=Math.sqrt(r*r+i*i);a>5&&(T.current.dismissOnTouchEnd=!0),a>10&&(b(e),E.clear(),T.current=null)}function R(e){N(e,L)}function z(e){f()!==`sloppy`||!T.current||mh(e,n.select(`floatingElement`))||mh(e,n.select(`domReferenceElement`))||(T.current.dismissOnTouchEnd&&b(e),E.clear(),T.current=null)}function ee(e){N(e,z)}let B=Wp(i),te=Vm(s&&Vm(Ap(B,`keydown`,M),Ap(B,`compositionstart`,c),Ap(B,`compositionend`,l)),_&&Vm(Ap(B,`click`,F,!0),Ap(B,`pointerdown`,F,!0),Ap(B,`pointerup`,I,!0),Ap(B,`pointercancel`,I,!0),Ap(B,`mousedown`,F,!0),Ap(B,`mouseup`,I,!0),Ap(B,`touchstart`,P,!0),Ap(B,`touchmove`,R,!0),Ap(B,`touchend`,ee,!0)));return()=>{te(),e.clear(),t.clear(),d(),S.current=!1}},[a,i,s,_,g,r,o,C,w,M,O,v,m,n,E]),b.useEffect(O,[g,O]);let P=b.useMemo(()=>({onKeyDown:M,[uv[d]]:e=>{j()&&n.setOpen(!1,Lm(Tm,e.nativeEvent))},...d!==`intentional`&&{onClick(e){j()&&n.setOpen(!1,Lm(`trigger-press`,e.nativeEvent))}}}),[M,n,d,j]),F=Z(e=>{if(!r||!o||e.button!==0)return;let t=fh(e.nativeEvent);dh(n.select(`floatingElement`),t)&&(y.current||(y.current=!0,x.current=!1))}),I=Z(e=>{!r||!o||(e.defaultPrevented||e.nativeEvent.defaultPrevented)&&y.current&&(x.current=!0)}),L=b.useMemo(()=>({onKeyDown:M,onPointerDown:I,onMouseDown:I,onClickCapture:N,onMouseDownCapture(e){N(),F(e)},onPointerDownCapture(e){N(),F(e)},onMouseUpCapture:N,onTouchEndCapture:N,onTouchMoveCapture:N}),[M,N,F,I]);return b.useMemo(()=>o?{reference:P,floating:L,trigger:P}:{},[o,P,L])}function mv(e,t,n){let{reference:r,floating:i}=e,a=Ph(t),o=Fh(t),s=Nh(o),c=Ah(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(jh(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}async function hv(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=kh(t,e),p=qh(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=Jh(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=Jh(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var gv=50,_v=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:hv},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=mv(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<gv&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=mv(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},vv=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=kh(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=Ah(r),_=Ph(o),v=Ah(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[Gh(o)]:Lh(o)),x=p!==`none`;!d&&x&&b.push(...Wh(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=Ih(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==Ph(t))||T.every(e=>Ph(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=Ph(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function yv(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function bv(e){return xh.some(t=>e[t]>=0)}var xv=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=kh(e,t);switch(i){case`referenceHidden`:{let e=yv(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:bv(e)}}}case`escaped`:{let e=yv(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:bv(e)}}}default:return{}}}}},Sv=new Set([`left`,`top`]);async function Cv(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=Ah(n),s=jh(n),c=Ph(n)===`y`,l=Sv.has(o)?-1:1,u=a&&c?-1:1,d=kh(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var wv=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await Cv(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},Tv=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=kh(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=Ph(Ah(i)),p=Mh(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=Oh(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=Oh(n,h,r)}let g=c.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}}}}},Ev=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=kh(e,t),u={x:n,y:r},d=Ph(i),f=Mh(d),p=u[f],m=u[d],h=kh(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=Sv.has(Ah(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},Dv=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=kh(e,t),u=await o.detectOverflow(t,l),d=Ah(i),f=jh(i),p=Ph(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,b=Sh(h-u[g],v),x=Sh(m-u[_],y),S=!t.middlewareData.shift,C=b,w=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(w=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=v),S&&!f){let e=Ch(u.left,0),t=Ch(u.right,0),n=Ch(u.top,0),r=Ch(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:Ch(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:Ch(u.top,u.bottom))}await c({...t,availableWidth:w,availableHeight:C});let T=await o.getDimensions(s.floating);return m!==T.width||h!==T.height?{reset:{rects:!0}}:{}}}};function Ov(e){let t=wp(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=dp(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=wh(n)!==a||wh(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function kv(e){return up(e)?e:e.contextElement}function Av(e){let t=kv(e);if(!dp(t))return Eh(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=Ov(t),o=(a?wh(n.width):n.width)/r,s=(a?wh(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var jv=Eh(0);function Mv(e){let t=sp(e);return!Sp()||!t.visualViewport?jv:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Nv(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==sp(e)?!1:t}function Pv(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=kv(e),o=Eh(1);t&&(r?up(r)&&(o=Av(r)):o=Av(e));let s=Nv(a,n,r)?Mv(a):Eh(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=sp(a),t=r&&up(r)?sp(r):r,n=e,i=kp(n);for(;i&&r&&t!==n;){let e=Av(i),t=i.getBoundingClientRect(),r=wp(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=sp(i),i=kp(n)}}return Jh({width:u,height:d,x:c,y:l})}function Fv(e,t){let n=Tp(e).scrollLeft;return t?t.left+n:Pv(cp(e)).left+n}function Iv(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-Fv(e,n),y:n.top+t.scrollTop}}function Lv(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=cp(r),s=t?hp(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=Eh(1),u=Eh(0),d=dp(r);if((d||!d&&!a)&&((op(r)!==`body`||pp(o))&&(c=Tp(r)),d)){let e=Pv(r);l=Av(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?Iv(o,c):Eh(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function Rv(e){return Array.from(e.getClientRects())}function zv(e){let t=cp(e),n=Tp(e),r=e.ownerDocument.body,i=Ch(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=Ch(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+Fv(e),s=-n.scrollTop;return wp(r).direction===`rtl`&&(o+=Ch(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var Bv=25;function Vv(e,t){let n=sp(e),r=cp(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=Sp();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=Fv(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=Bv&&(a-=o)}else l<=Bv&&(a+=l);return{width:a,height:o,x:s,y:c}}function Hv(e,t){let n=Pv(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=dp(e)?Av(e):Eh(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Uv(e,t,n){let r;if(t===`viewport`)r=Vv(e,n);else if(t===`document`)r=zv(cp(e));else if(up(t))r=Hv(t,n);else{let n=Mv(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Jh(r)}function Wv(e,t){let n=Ep(e);return n===t||!up(n)||Cp(n)?!1:wp(n).position===`fixed`||Wv(n,t)}function Gv(e,t){let n=t.get(e);if(n)return n;let r=Op(e,[],!1).filter(e=>up(e)&&op(e)!==`body`),i=null,a=wp(e).position===`fixed`,o=a?Ep(e):e;for(;up(o)&&!Cp(o);){let t=wp(o),n=bp(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||pp(o)&&!n&&Wv(e,o))?r=r.filter(e=>e!==o):i=t,o=Ep(o)}return t.set(e,r),r}function Kv(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?hp(t)?[]:Gv(t,this._c):[].concat(n),r],o=Uv(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=Uv(t,a[e],i);s=Ch(n.top,s),c=Sh(n.right,c),l=Sh(n.bottom,l),u=Ch(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function qv(e){let{width:t,height:n}=Ov(e);return{width:t,height:n}}function Jv(e,t,n){let r=dp(t),i=cp(t),a=n===`fixed`,o=Pv(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=Eh(0);function l(){c.x=Fv(i)}if(r||!r&&!a)if((op(t)!==`body`||pp(i))&&(s=Tp(t)),r){let e=Pv(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l();a&&!r&&i&&l();let u=i&&!r&&!a?Iv(i,s):Eh(0);return{x:o.left+s.scrollLeft-c.x-u.x,y:o.top+s.scrollTop-c.y-u.y,width:o.width,height:o.height}}function Yv(e){return wp(e).position===`static`}function Xv(e,t){if(!dp(e)||wp(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return cp(e)===n&&(n=n.ownerDocument.body),n}function Zv(e,t){let n=sp(e);if(hp(e))return n;if(!dp(e)){let t=Ep(e);for(;t&&!Cp(t);){if(up(t)&&!Yv(t))return t;t=Ep(t)}return n}let r=Xv(e,t);for(;r&&mp(r)&&Yv(r);)r=Xv(r,t);return r&&Cp(r)&&Yv(r)&&!bp(r)?n:r||xp(e)||n}var Qv=async function(e){let t=this.getOffsetParent||Zv,n=this.getDimensions,r=await n(e.floating);return{reference:Jv(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function $v(e){return wp(e).direction===`rtl`}var ey={convertOffsetParentRelativeRectToViewportRelativeRect:Lv,getDocumentElement:cp,getClippingRect:Kv,getOffsetParent:Zv,getElementRects:Qv,getClientRects:Rv,getDimensions:qv,getScale:Av,isElement:up,isRTL:$v};function ty(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function ny(e,t){let n=null,r,i=cp(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(s||t(),!f||!p)return;let m=Th(d),h=Th(i.clientWidth-(u+f)),g=Th(i.clientHeight-(d+p)),_=Th(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:Ch(0,Sh(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(n!==c){if(!y)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!ty(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function ry(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=kv(e),u=i||a?[...l?Op(l):[],...t?Op(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?ny(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?Pv(e):null;c&&g();function g(){let t=Pv(e);h&&!ty(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var iy=wv,ay=Tv,oy=vv,sy=Dv,cy=xv,ly=Ev,uy=(e,t,n)=>{let r=new Map,i={platform:ey,...n},a={...i.platform,_c:r};return _v(e,t,{...i,platform:a})},dy=typeof document<`u`?b.useLayoutEffect:function(){};function fy(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!fy(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!fy(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function py(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function my(e,t){let n=py(e);return Math.round(t*n)/n}function hy(e){let t=b.useRef(e);return dy(()=>{t.current=e}),t}function gy(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=b.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=b.useState(r);fy(f,r)||p(r);let[m,h]=b.useState(null),[g,_]=b.useState(null),v=b.useCallback(e=>{e!==C.current&&(C.current=e,h(e))},[]),y=b.useCallback(e=>{e!==w.current&&(w.current=e,_(e))},[]),x=a||m,S=o||g,C=b.useRef(null),w=b.useRef(null),T=b.useRef(u),E=c!=null,D=hy(c),O=hy(i),k=hy(l),A=b.useCallback(()=>{if(!C.current||!w.current)return;let e={placement:t,strategy:n,middleware:f};O.current&&(e.platform=O.current),uy(C.current,w.current,e).then(e=>{let t={...e,isPositioned:k.current!==!1};j.current&&!fy(T.current,t)&&(T.current=t,F_.flushSync(()=>{d(t)}))})},[f,t,n,O,k]);dy(()=>{l===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let j=b.useRef(!1);dy(()=>(j.current=!0,()=>{j.current=!1}),[]),dy(()=>{if(x&&(C.current=x),S&&(w.current=S),x&&S){if(D.current)return D.current(x,S,A);A()}},[x,S,A,D,E]);let M=b.useMemo(()=>({reference:C,floating:w,setReference:v,setFloating:y}),[v,y]),N=b.useMemo(()=>({reference:x,floating:S}),[x,S]),P=b.useMemo(()=>{let e={position:n,left:0,top:0};if(!N.floating)return e;let t=my(N.floating,u.x),r=my(N.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...py(N.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,N.floating,u.x,u.y]);return b.useMemo(()=>({...u,update:A,refs:M,elements:N,floatingStyles:P}),[u,A,M,N,P])}var _y=(e,t)=>{let n=iy(e);return{name:n.name,fn:n.fn,options:[e,t]}},vy=(e,t)=>{let n=ay(e);return{name:n.name,fn:n.fn,options:[e,t]}},yy=(e,t)=>({fn:ly(e).fn,options:[e,t]}),by=(e,t)=>{let n=oy(e);return{name:n.name,fn:n.fn,options:[e,t]}},xy=(e,t)=>{let n=sy(e);return{name:n.name,fn:n.fn,options:[e,t]}},Sy=(e,t)=>{let n=cy(e);return{name:n.name,fn:n.fn,options:[e,t]}},Q=(e,t,n,r,i,a,...o)=>{if(o.length>0)throw Error(t_(1));let s;if(e&&t&&n&&r&&i&&a)s=(o,s,c,l)=>a(e(o,s,c,l),t(o,s,c,l),n(o,s,c,l),r(o,s,c,l),i(o,s,c,l),s,c,l);else if(e&&t&&n&&r&&i)s=(a,o,s,c)=>i(e(a,o,s,c),t(a,o,s,c),n(a,o,s,c),r(a,o,s,c),o,s,c);else if(e&&t&&n&&r)s=(i,a,o,s)=>r(e(i,a,o,s),t(i,a,o,s),n(i,a,o,s),a,o,s);else if(e&&t&&n)s=(r,i,a,o)=>n(e(r,i,a,o),t(r,i,a,o),i,a,o);else if(e&&t)s=(n,r,i,a)=>t(e(n,r,i,a),r,i,a);else if(e)s=e;else throw Error(`Missing arguments`);return s},Cy=o((e=>{var t=f();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var d=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?d:t.useSyncExternalStore})),wy=o(((e,t)=>{t.exports=Cy()})),Ty=o((e=>{var t=f(),n=wy();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),Ey=o(((e,t)=>{t.exports=Ty()})),Dy=[],Oy=void 0;function ky(){return Oy}function Ay(e){Dy.push(e)}function jy(e){let t=(t,n)=>{let r=Kp(Ny).current,i;try{Oy=r;for(let e of Dy)e.before(r);i=e(t,n);for(let e of Dy)e.after(r);r.didInitialize=!0}finally{Oy=void 0}return i};return t.displayName=e.displayName||e.name,t}function My(e){return b.forwardRef(jy(e))}function Ny(){return{didInitialize:!1}}var Py=wy(),Fy=Ey(),Iy=r_(19)?zy:By;function Ly(e,t,n,r,i){return Iy(e,t,n,r,i)}function Ry(e,t,n,r,i){let a=b.useCallback(()=>t(e.getSnapshot(),n,r,i),[e,t,n,r,i]);return(0,Py.useSyncExternalStore)(e.subscribe,a,a)}Ay({before(e){e.syncIndex=0,e.didInitialize||(e.syncTick=1,e.syncHooks=[],e.didChangeStore=!0,e.getSnapshot=()=>{let t=!1;for(let n=0;n<e.syncHooks.length;n+=1){let r=e.syncHooks[n],i=r.selector(r.store.state,r.a1,r.a2,r.a3);(r.didChange||!Object.is(r.value,i))&&(t=!0,r.value=i,r.didChange=!1)}return t&&(e.syncTick+=1),e.syncTick})},after(e){e.syncHooks.length>0&&(e.didChangeStore&&(e.didChangeStore=!1,e.subscribe=t=>{let n=new Set;for(let t of e.syncHooks)n.add(t.store);let r=[];for(let e of n)r.push(e.subscribe(t));return()=>{for(let e of r)e()}}),(0,Py.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot))}});function zy(e,t,n,r,i){let a=ky();if(!a)return Ry(e,t,n,r,i);let o=a.syncIndex;a.syncIndex+=1;let s;return a.didInitialize?(s=a.syncHooks[o],(s.store!==e||s.selector!==t||!Object.is(s.a1,n)||!Object.is(s.a2,r)||!Object.is(s.a3,i))&&(s.store!==e&&(a.didChangeStore=!0),s.store=e,s.selector=t,s.a1=n,s.a2=r,s.a3=i,s.didChange=!0)):(s={store:e,selector:t,a1:n,a2:r,a3:i,value:t(e.getSnapshot(),n,r,i),didChange:!1},a.syncHooks.push(s)),s.value}function By(e,t,n,r,i){return(0,Fy.useSyncExternalStoreWithSelector)(e.subscribe,e.getSnapshot,e.getSnapshot,e=>t(e,n,r,i))}var Vy=class{constructor(e){this.state=e,this.listeners=new Set,this.updateTick=0}subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});getSnapshot=()=>this.state;setState(e){if(this.state===e)return;this.state=e,this.updateTick+=1;let t=this.updateTick;for(let n of this.listeners){if(t!==this.updateTick)return;n(e)}}update(e){for(let t in e)if(!Object.is(this.state[t],e[t])){this.setState({...this.state,...e});return}}set(e,t){Object.is(this.state[e],t)||this.setState({...this.state,[e]:t})}notifyAll(){let e={...this.state};this.setState(e)}use(e,t,n,r){return Ly(this,e,t,n,r)}},Hy=class extends Vy{constructor(e,t={},n){super(e),this.context=t,this.selectors=n}useSyncedValue(e,t){b.useDebugValue(e),X(()=>{this.state[e]!==t&&this.set(e,t)},[e,t])}useSyncedValueWithCleanup(e,t){let n=this;X(()=>(n.state[e]!==t&&n.set(e,t),()=>{n.set(e,void 0)}),[n,e,t])}useSyncedValues(e){let t=this;X(()=>{t.update(e)},[t,...Object.values(e)])}useControlledProp(e,t){b.useDebugValue(e);let n=t!==void 0;X(()=>{n&&!Object.is(this.state[e],t)&&super.setState({...this.state,[e]:t})},[e,t,n])}select(e,t,n,r){let i=this.selectors[e];return i(this.state,t,n,r)}useState(e,t,n,r){return b.useDebugValue(e),Ly(this,this.selectors[e],t,n,r)}useContextCallback(e,t){b.useDebugValue(e);let n=Z(t??nm);this.context[e]=n}useStateSetter(e){let t=b.useRef(void 0);return t.current===void 0&&(t.current=t=>{this.set(e,t)}),t.current}observe(e,t){let n;n=typeof e==`function`?e:this.selectors[e];let r=n(this.state);return t(r,r,this),this.subscribe(e=>{let i=n(e);if(!Object.is(r,i)){let e=r;r=i,t(i,e,this)}})}},Uy={open:Q(e=>e.open),transitionStatus:Q(e=>e.transitionStatus),domReferenceElement:Q(e=>e.domReferenceElement),referenceElement:Q(e=>e.positionReference??e.referenceElement),floatingElement:Q(e=>e.floatingElement),floatingId:Q(e=>e.floatingId)},Wy=class extends Hy{constructor(e){let{syncOnly:t,nested:n,onOpenChange:r,triggerElements:i,...a}=e;super({...a,positionReference:a.referenceElement,domReferenceElement:a.referenceElement},{onOpenChange:r,dataRef:{current:{}},events:V_(),nested:n,triggerElements:i},Uy),this.syncOnly=t}syncOpenEvent=(e,t)=>{(!e||!this.state.open||t!=null&&ym(t))&&(this.context.dataRef.current.openEvent=e?t:void 0)};dispatchOpenChange=(e,t)=>{this.syncOpenEvent(e,t.event);let n={open:e,reason:t.reason,nativeEvent:t.event,nested:this.context.nested,triggerElement:t.trigger};this.context.events.emit(`openchange`,n)};setOpen=(e,t)=>{if(this.syncOnly){this.context.onOpenChange?.(e,t);return}this.dispatchOpenChange(e,t),this.context.onOpenChange?.(e,t)}};function Gy(e,t=!1,n=!1){let[r,i]=b.useState(e&&t?`idle`:void 0),[a,o]=b.useState(e);return e&&!a&&(o(!0),i(`starting`)),!e&&a&&r!==`ending`&&!n&&i(`ending`),!e&&!a&&r===`ending`&&i(void 0),X(()=>{if(!e&&a&&r!==`ending`&&n){let e=em.request(()=>{i(`ending`)});return()=>{em.cancel(e)}}},[e,a,r,n]),X(()=>{if(!e||t)return;let n=em.request(()=>{i(void 0)});return()=>{em.cancel(n)}},[t,e]),X(()=>{if(!e||!t)return;e&&a&&r!==`idle`&&i(`starting`);let n=em.request(()=>{i(`idle`)});return()=>{em.cancel(n)}},[t,e,a,r]),{mounted:a,setMounted:o,transitionStatus:r}}var Ky=function(e){return e.startingStyle=`data-starting-style`,e.endingStyle=`data-ending-style`,e}({}),qy={[Ky.startingStyle]:``},Jy={[Ky.endingStyle]:``},Yy={transitionStatus(e){return e===`starting`?qy:e===`ending`?Jy:null}};function Xy(e,t=!1,n=!0){let r=tm();return Z((i,a=null)=>{r.cancel();let o=X_(e);if(o==null)return;let s=o,c=()=>{F_.flushSync(i)};if(typeof s.getAnimations!=`function`||globalThis.BASE_UI_ANIMATIONS_DISABLED){i();return}function l(){Promise.all(s.getAnimations().map(e=>e.finished)).then(()=>{a?.aborted||c()}).catch(()=>{if(n){a?.aborted||c();return}let e=s.getAnimations();!a?.aborted&&e.length>0&&e.some(e=>e.pending||e.playState!==`finished`)&&l()})}if(t){let e=Ky.startingStyle;if(!s.hasAttribute(e)){r.request(l);return}let t=new MutationObserver(()=>{s.hasAttribute(e)||(t.disconnect(),l())});t.observe(s,{attributes:!0,attributeFilter:[e]}),a?.addEventListener(`abort`,()=>t.disconnect(),{once:!0});return}r.request(l)})}function Zy(e){let{enabled:t=!0,open:n,ref:r,onComplete:i}=e,a=Z(i),o=Xy(r,n,!1);b.useEffect(()=>{if(!t)return;let e=new AbortController;return o(a,e.signal),()=>{e.abort()}},[t,n,a,o])}function Qy(e,t){let n=b.useRef(null),r=b.useRef(null);return b.useCallback(i=>{if(e!==void 0){if(n.current!==null){let e=n.current,i=r.current,a=t.context.triggerElements.getById(e);i&&a===i&&t.context.triggerElements.delete(e),n.current=null,r.current=null}i!==null&&(n.current=e,r.current=i,t.context.triggerElements.add(e,i))}},[t,e])}function $y(e,t,n,r){let i=n.useState(`isMountedByTrigger`,e),a=Qy(e,n),o=Z(t=>{if(a(t),!t||!n.select(`open`))return;let i=n.select(`activeTriggerId`);if(i===e){n.update({activeTriggerElement:t,...r});return}i??n.update({activeTriggerId:e,activeTriggerElement:t,...r})});return X(()=>{i&&n.update({activeTriggerElement:t.current,...r})},[i,n,t,...Object.values(r)]),{registerTrigger:o,isMountedByThisTrigger:i}}function eb(e){let t=e.useState(`open`);X(()=>{if(t&&!e.select(`activeTriggerId`)&&e.context.triggerElements.size===1){let t=e.context.triggerElements.entries().next();if(!t.done){let[n,r]=t.value;e.update({activeTriggerId:n,activeTriggerElement:r})}}},[t,e])}function tb(e,t,n){let{mounted:r,setMounted:i,transitionStatus:a}=Gy(e);t.useSyncedValues({mounted:r,transitionStatus:a});let o=Z(()=>{i(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1}),n?.(),t.context.onOpenChangeComplete?.(!1)});return Zy({enabled:!t.useState(`preventUnmountingOnClose`),open:e,ref:t.context.popupRef,onComplete(){e||o()}}),{forceUnmount:o,transitionStatus:a}}var nb=class{constructor(){this.elementsSet=new Set,this.idMap=new Map}add(e,t){let n=this.idMap.get(e);n!==t&&(n!==void 0&&this.elementsSet.delete(n),this.elementsSet.add(t),this.idMap.set(e,t))}delete(e){let t=this.idMap.get(e);t&&(this.elementsSet.delete(t),this.idMap.delete(e))}hasElement(e){return this.elementsSet.has(e)}hasMatchingElement(e){for(let t of this.elementsSet)if(e(t))return!0;return!1}getById(e){return this.idMap.get(e)}entries(){return this.idMap.entries()}elements(){return this.elementsSet.values()}get size(){return this.idMap.size}};function rb(){return new Wy({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:new nb,floatingId:``,syncOnly:!1,nested:!1,onOpenChange:void 0})}function ib(){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:rb(),preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:im,inactiveTriggerProps:im,popupProps:im}}var ab=Q(e=>e.triggerIdProp??e.activeTriggerId),ob={open:Q(e=>e.openProp??e.open),mounted:Q(e=>e.mounted),transitionStatus:Q(e=>e.transitionStatus),floatingRootContext:Q(e=>e.floatingRootContext),preventUnmountingOnClose:Q(e=>e.preventUnmountingOnClose),payload:Q(e=>e.payload),activeTriggerId:ab,activeTriggerElement:Q(e=>e.mounted?e.activeTriggerElement:null),isTriggerActive:Q((e,t)=>t!==void 0&&ab(e)===t),isOpenedByTrigger:Q((e,t)=>t!==void 0&&ab(e)===t&&e.open),isMountedByTrigger:Q((e,t)=>t!==void 0&&ab(e)===t&&e.mounted),triggerProps:Q((e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps),popupProps:Q(e=>e.popupProps),popupElement:Q(e=>e.popupElement),positionerElement:Q(e=>e.positionerElement)};function sb(e){let{open:t=!1,onOpenChange:n,elements:r={}}=e,i=$g(),a=G_()!=null,o=Kp(()=>new Wy({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:new nb,floatingId:i,syncOnly:!1,nested:a})).current;return X(()=>{let e={open:t,floatingId:i};r.reference!==void 0&&(e.referenceElement=r.reference,e.domReferenceElement=up(r.reference)?r.reference:null),r.floating!==void 0&&(e.floatingElement=r.floating),o.update(e)},[t,i,r.reference,r.floating,o]),o.context.onOpenChange=n,o.context.nested=a,o}function cb(e={}){let{nodeId:t,externalTree:n}=e,r=sb(e),i=e.rootContext||r,a={reference:i.useState(`referenceElement`),floating:i.useState(`floatingElement`),domReference:i.useState(`domReferenceElement`)},[o,s]=b.useState(null),c=b.useRef(null),l=K_(n);X(()=>{a.domReference&&(c.current=a.domReference)},[a.domReference]);let u=gy({...e,elements:{...a,...o&&{reference:o}}}),d=b.useCallback(e=>{let t=up(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>e.getClientRects(),contextElement:e}:e;s(t),u.refs.setReference(t)},[u.refs]),[f,p]=b.useState(void 0),[m,h]=b.useState(null);i.useSyncedValue(`referenceElement`,f??null);let g=up(f)?f:null;i.useSyncedValue(`domReferenceElement`,f===void 0?a.domReference:g),i.useSyncedValue(`floatingElement`,m);let _=b.useCallback(e=>{(up(e)||e===null)&&(c.current=e,p(e)),(up(u.refs.reference.current)||u.refs.reference.current===null||e!==null&&!up(e))&&u.refs.setReference(e)},[u.refs,p]),v=b.useCallback(e=>{h(e),u.refs.setFloating(e)},[u.refs]),y=b.useMemo(()=>({...u.refs,setReference:_,setFloating:v,setPositionReference:d,domReference:c}),[u.refs,_,v,d]),x=b.useMemo(()=>({...u.elements,domReference:a.domReference}),[u.elements,a.domReference]),S=i.useState(`open`),C=i.useState(`floatingId`),w=b.useMemo(()=>({...u,dataRef:i.context.dataRef,open:S,onOpenChange:i.setOpen,events:i.context.events,floatingId:C,refs:y,elements:x,nodeId:t,rootStore:i}),[u,y,x,t,i,S,C]);return X(()=>{i.context.dataRef.current.floatingContext=w;let e=l?.nodesRef.current.find(e=>e.id===t);e&&(e.context=w)}),b.useMemo(()=>({...u,context:w,refs:y,elements:x,rootStore:i}),[u,y,x,w,i])}function lb(e){let{popupStore:t,treatPopupAsFloatingElement:n=!1,onOpenChange:r}=e,i=$g(),a=G_()!=null,o=t.useState(`open`),s=t.useState(`activeTriggerElement`),c=t.useState(n?`popupElement`:`positionerElement`),l=t.context.triggerElements,u=Kp(()=>new Wy({open:o,transitionStatus:void 0,referenceElement:s,floatingElement:c,triggerElements:l,onOpenChange:r,floatingId:i,syncOnly:!0,nested:a})).current;return X(()=>{let e={open:o,floatingId:i,referenceElement:s,floatingElement:c};up(s)&&(e.domReferenceElement=s),u.state.positionReference===u.state.referenceElement&&(e.positionReference=s),u.update(e)},[o,i,s,c,u]),u.context.onOpenChange=r,u.context.nested=a,u}var ub=zp&&Lp;function db(e,t={}){let n=`rootStore`in e?e.rootStore:e,{events:r,dataRef:i}=n.context,{enabled:a=!0,delay:o}=t,s=b.useRef(!1),c=b.useRef(null),l=Zp(),u=b.useRef(!0);b.useEffect(()=>{let e=n.select(`domReferenceElement`);if(!a)return;let t=sp(e);function r(){let e=n.select(`domReferenceElement`);!n.select(`open`)&&dp(e)&&e===uh(Wp(e))&&(s.current=!0)}function i(){u.current=!0}function o(){u.current=!1}return Vm(Ap(t,`blur`,r),ub&&Ap(t,`keydown`,i,!0),ub&&Ap(t,`pointerdown`,o,!0))},[n,a]),b.useEffect(()=>{if(!a)return;function e(e){if(e.reason===`trigger-press`||e.reason===`escape-key`){let e=n.select(`domReferenceElement`);up(e)&&(c.current=e,s.current=!0)}}return r.on(`openchange`,e),()=>{r.off(`openchange`,e)}},[r,a,n]);let d=b.useMemo(()=>({onMouseLeave(){s.current=!1,c.current=null},onFocus(e){let t=e.currentTarget;if(s.current){if(c.current===t)return;s.current=!1,c.current=null}let r=fh(e.nativeEvent);if(up(r)){if(ub&&!e.relatedTarget){if(!u.current&&!gh(r))return}else if(!yh(r))return}let i=ph(e.relatedTarget,n.context.triggerElements),{nativeEvent:a,currentTarget:d}=e,f=typeof o==`function`?o():o;if(n.select(`open`)&&i||f===0||f===void 0){n.setOpen(!0,Lm(Dm,a,d));return}l.start(f,()=>{s.current||n.setOpen(!0,Lm(Dm,a,d))})},onBlur(e){s.current=!1,c.current=null;let t=e.relatedTarget,r=e.nativeEvent,a=up(t)&&t.hasAttribute(Pg(`focus-guard`))&&t.getAttribute(`data-type`)===`outside`;l.start(0,()=>{let e=n.select(`domReferenceElement`),o=uh(Wp(e));!t&&o===e||dh(i.current.floatingContext?.refs.floating.current,o)||dh(e,o)||a||ph(t??o,n.context.triggerElements)||n.setOpen(!1,Lm(Dm,r))})}}),[i,n,l,o]);return b.useMemo(()=>a?{reference:d,trigger:d}:{},[a,d])}var fb=class e{constructor(){this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.pointerEventsScopeElement=null,this.pointerEventsReferenceElement=null,this.pointerEventsFloatingElement=null,this.restTimeoutPending=!1,this.openChangeTimeout=new Xp,this.restTimeout=new Xp,this.handleCloseOptions=void 0}static create(){return new e}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose},pb=new WeakMap;function mb(e){if(!e.performedPointerEventsMutation)return;let t=e.pointerEventsScopeElement;t&&pb.get(t)===e&&(e.pointerEventsScopeElement?.style.removeProperty(`pointer-events`),e.pointerEventsReferenceElement?.style.removeProperty(`pointer-events`),e.pointerEventsFloatingElement?.style.removeProperty(`pointer-events`),pb.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function hb(e,t){let{scopeElement:n,referenceElement:r,floatingElement:i}=t,a=pb.get(n);a&&a!==e&&mb(a),mb(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=n,e.pointerEventsReferenceElement=r,e.pointerEventsFloatingElement=i,pb.set(n,e),n.style.pointerEvents=`none`,r.style.pointerEvents=`auto`,i.style.pointerEvents=`auto`}function gb(e){let t=Kp(fb.create).current,n=e.context.dataRef.current;return n.hoverInteractionState||=t,Jp(n.hoverInteractionState.disposeEffect),n.hoverInteractionState}function _b(e,t={}){let n=`rootStore`in e?e.rootStore:e,r=n.useState(`open`),i=n.useState(`floatingElement`),a=n.useState(`domReferenceElement`),{dataRef:o}=n.context,{enabled:s=!0,closeDelay:c=0,nodeId:l}=t,u=gb(n),d=K_(),f=G_(),p=Z(()=>Cm(o.current.openEvent?.type,u.interactedInside)),m=Z(()=>{let e=o.current.openEvent?.type;return e?.includes(`mouse`)&&e!==`mousedown`}),h=Z(e=>ph(e,n.context.triggerElements)),g=b.useCallback(e=>{let t=xm(c,`close`,u.pointerType),r=()=>{n.setOpen(!1,Lm(Em,e)),d?.events.emit(`floating.closed`,e)};t?u.openChangeTimeout.start(t,r):(u.openChangeTimeout.clear(),r())},[c,n,u,d]),_=Z(()=>{mb(u)}),v=Z(e=>{let t=fh(e);if(!_h(t)){u.interactedInside=!1;return}u.interactedInside=t?.closest(`[aria-haspopup]`)!=null});X(()=>{r||(u.pointerType=void 0,u.restTimeoutPending=!1,u.interactedInside=!1,_())},[r,u,_]),b.useEffect(()=>_,[_]),X(()=>{if(s&&r&&u.handleCloseOptions?.blockPointerEvents&&m()&&up(a)&&i){let e=a,t=i,n=Wp(i),r=d?.nodesRef.current.find(e=>e.id===f)?.context?.elements.floating;return r&&(r.style.pointerEvents=``),hb(u,{scopeElement:u.handleCloseOptions?.getScope?.()??u.pointerEventsScopeElement??r??e.closest(`[data-rootownerid]`)??n.body,referenceElement:e,floatingElement:t}),()=>{_()}}},[s,r,a,i,u,m,d,f,_]);let y=Zp();b.useEffect(()=>{if(!s)return;function e(){u.openChangeTimeout.clear(),y.clear(),d?.events.off(`floating.closed`,r),_()}function t(e){if(d&&f&&Mg(d.nodesRef.current,f).length>0){d.events.on(`floating.closed`,r);return}if(h(e.relatedTarget))return;let t=o.current.floatingContext?.nodeId??l,n=e.relatedTarget;if(!(d&&t&&up(n)&&Mg(d.nodesRef.current,t,!1).some(e=>dh(e.context?.elements.floating,n)))){if(u.handler){u.handler(e);return}_(),p()||g(e)}}function r(e){!d||!f||Mg(d.nodesRef.current,f).length>0||y.start(0,()=>{d.events.off(`floating.closed`,r),n.setOpen(!1,Lm(Em,e)),d.events.emit(`floating.closed`,e)})}let a=i;return Vm(a&&Ap(a,`mouseenter`,e),a&&Ap(a,`mouseleave`,t),a&&Ap(a,`pointerdown`,v,!0),()=>{d?.events.off(`floating.closed`,r)})},[s,i,n,o,l,p,h,g,_,v,u,d,f,y])}var vb={current:null};function yb(e,t={}){let n=`rootStore`in e?e.rootStore:e,{dataRef:r,events:i}=n.context,{enabled:a=!0,delay:o=0,handleClose:s=null,mouseOnly:c=!1,restMs:l=0,move:u=!0,triggerElementRef:d=vb,externalTree:f,isActiveTrigger:p=!0,getHandleCloseContext:m,isClosing:h}=t,g=K_(f),_=gb(n),v=b.useRef(!1),y=Jm(s),x=Jm(o),S=Jm(l),C=Jm(a),w=Jm(h);p&&(_.handleCloseOptions=y.current?.__options);let T=Z(()=>Cm(r.current.openEvent?.type,_.interactedInside)),E=Z(e=>ph(e,n.context.triggerElements)),D=Z((e,t,r)=>{let i=n.context.triggerElements;if(i.hasElement(t))return!e||!dh(e,t);if(!up(r))return!1;let a=r;return i.hasMatchingElement(e=>dh(e,a))&&(!e||!dh(e,a))}),O=Z((e,t=!0)=>{let r=xm(x.current,`close`,_.pointerType);r?_.openChangeTimeout.start(r,()=>{n.setOpen(!1,Lm(Em,e)),g?.events.emit(`floating.closed`,e)}):t&&(_.openChangeTimeout.clear(),n.setOpen(!1,Lm(Em,e)),g?.events.emit(`floating.closed`,e))}),k=Z(()=>{_.handler&&=(Wp(n.select(`domReferenceElement`)).removeEventListener(`mousemove`,_.handler),void 0)}),A=Z(()=>{mb(_)});return b.useEffect(()=>k,[k]),b.useEffect(()=>{if(!a)return;function e(e){e.open?v.current=!1:(v.current=e.reason===Em,k(),_.openChangeTimeout.clear(),_.restTimeout.clear(),_.blockMouseMove=!0,_.restTimeoutPending=!1)}return i.on(`openchange`,e),()=>{i.off(`openchange`,e)}},[a,i,_,k]),b.useEffect(()=>{if(!a)return;let e=d.current??(p?n.select(`domReferenceElement`):null);if(!up(e))return;function t(e){if(_.openChangeTimeout.clear(),_.blockMouseMove=!1,c&&!vm(_.pointerType))return;let t=Sm(S.current),r=xm(x.current,`open`,_.pointerType),i=fh(e),a=e.currentTarget??null,o=n.select(`domReferenceElement`),s=a;if(up(i)&&!n.context.triggerElements.hasElement(i)){for(let e of n.context.triggerElements.elements())if(dh(e,i)){s=e;break}}up(a)&&up(o)&&!n.context.triggerElements.hasElement(a)&&dh(a,o)&&(s=o);let l=s==null?!1:D(o,s,i),u=n.select(`open`),d=w.current?.()??n.select(`transitionStatus`)===`ending`,f=!u&&d&&v.current,p=!l&&up(s)&&up(o)&&dh(o,s)&&f,m=t>0&&!r,h=l&&(u||f)||p,g=!u||l;if(h){n.setOpen(!0,Lm(Em,e,s));return}m||(r?_.openChangeTimeout.start(r,()=>{g&&n.setOpen(!0,Lm(Em,e,s))}):g&&n.setOpen(!0,Lm(Em,e,s)))}function i(e){if(T()){A();return}k();let t=Wp(n.select(`domReferenceElement`));_.restTimeout.clear(),_.restTimeoutPending=!1;let i=r.current.floatingContext??m?.();if(!E(e.relatedTarget)){if(y.current&&i){n.select(`open`)||_.openChangeTimeout.clear();let r=d.current;_.handler=y.current({...i,tree:g,x:e.clientX,y:e.clientY,onClose(){A(),k(),C.current&&!T()&&r===n.select(`domReferenceElement`)&&O(e,!0)}}),t.addEventListener(`mousemove`,_.handler),_.handler(e);return}(_.pointerType!==`touch`||!dh(n.select(`floatingElement`),e.relatedTarget))&&O(e)}}return u?Vm(Ap(e,`mousemove`,t,{once:!0}),Ap(e,`mouseenter`,t),Ap(e,`mouseleave`,i)):Vm(Ap(e,`mouseenter`,t),Ap(e,`mouseleave`,i))},[k,A,r,x,O,n,a,y,_,p,D,T,E,c,u,S,d,g,C,m,w]),b.useMemo(()=>{if(!a)return;function e(e){_.pointerType=e.pointerType}return{onPointerDown:e,onPointerEnter:e,onMouseMove(e){let{nativeEvent:t}=e,r=e.currentTarget,i=n.select(`domReferenceElement`),a=n.select(`open`),o=D(i,r,e.target);if(c&&!vm(_.pointerType))return;if(a&&o&&_.handleCloseOptions?.blockPointerEvents){let e=n.select(`floatingElement`);e&&hb(_,{scopeElement:_.handleCloseOptions?.getScope?.()??r.ownerDocument.body,referenceElement:r,floatingElement:e})}let s=Sm(S.current);if(a&&!o||s===0||!o&&_.restTimeoutPending&&e.movementX**2+e.movementY**2<2)return;_.restTimeout.clear();function l(){if(_.restTimeoutPending=!1,T())return;let e=n.select(`open`);!_.blockMouseMove&&(!e||o)&&n.setOpen(!0,Lm(Em,t,r))}_.pointerType===`touch`?F_.flushSync(()=>{l()}):o&&a?l():(_.restTimeoutPending=!0,_.restTimeout.start(s,l))}}},[a,_,T,D,c,n,S])}function bb(e=[]){let t=e.map(e=>e?.reference),n=e.map(e=>e?.floating),r=e.map(e=>e?.item),i=e.map(e=>e?.trigger),a=b.useCallback(t=>xb(t,e,`reference`),t),o=b.useCallback(t=>xb(t,e,`floating`),n),s=b.useCallback(t=>xb(t,e,`item`),r),c=b.useCallback(t=>xb(t,e,`trigger`),i);return b.useMemo(()=>({getReferenceProps:a,getFloatingProps:o,getItemProps:s,getTriggerProps:c}),[a,o,s,c])}function xb(e,t,n){let r=new Map,i=n===`item`,a={};n===`floating`&&(a.tabIndex=-1,a[ih]=``);for(let t in e)i&&e&&(t===`active`||t===`selected`)||(a[t]=e[t]);for(let o=0;o<t.length;o+=1){let s,c=t[o]?.[n];s=typeof c==`function`?e?c(e):null:c,s&&Sb(a,s,i,r)}return Sb(a,e,i,r),a}function Sb(e,t,n,r){for(let i in t){let a=t[i];n&&(i===`active`||i===`selected`)||(i.startsWith(`on`)?(r.has(i)||r.set(i,[]),typeof a==`function`&&(r.get(i)?.push(a),e[i]=(...e)=>r.get(i)?.map(t=>t(...e)).find(e=>e!==void 0))):e[i]=a)}}var Cb=`Escape`;function wb(e,t,n){switch(e){case`vertical`:return t;case`horizontal`:return n;default:return t||n}}function Tb(e,t){return wb(t,e===`ArrowUp`||e===`ArrowDown`,e===`ArrowLeft`||e===`ArrowRight`)}function Eb(e,t,n){return wb(t,e===`ArrowDown`,n?e===`ArrowLeft`:e===`ArrowRight`)||e===`Enter`||e===` `||e===``}function Db(e,t,n){return wb(t,n?e===oh:e===sh,e===lh)}function Ob(e,t,n,r){return t===`both`||t===`horizontal`&&r&&r>1?e===Cb:wb(t,n?e===sh:e===oh,e===ch)}function kb(e,t){let n=`rootStore`in e?e.rootStore:e,r=n.useState(`open`),i=n.useState(`floatingElement`),a=n.useState(`domReferenceElement`),o=n.context.dataRef,{listRef:s,activeIndex:c,onNavigate:l=()=>{},enabled:u=!0,selectedIndex:d=null,allowEscape:f=!1,loopFocus:p=!1,nested:m=!1,rtl:h=!1,virtual:g=!1,focusItemOnOpen:_=`auto`,focusItemOnHover:v=!0,openOnArrowKeyDown:y=!0,disabledIndices:x=void 0,orientation:S=`vertical`,parentOrientation:C,cols:w=1,id:T,resetOnPointerLeave:E=!0,externalTree:D}=t,O=Jm(bh(i)),k=G_(),A=K_(D);X(()=>{o.current.orientation=S},[o,S]);let j=vh(a),M=b.useRef(_),N=b.useRef(d??-1),P=b.useRef(null),F=b.useRef(!0),I=Z(e=>{l(N.current===-1?null:N.current,e)}),L=b.useRef(I),R=b.useRef(!!i),z=b.useRef(r),ee=b.useRef(!1),B=b.useRef(!1),te=b.useRef(null),V=Jm(x),H=Jm(r),ne=Jm(d),U=Jm(E),re=Z(()=>{function e(e){g?A?.events.emit(`virtualfocus`,e):te.current=Ig(e,{sync:ee.current,preventScroll:!0})}let t=s.current[N.current],n=B.current;t&&e(t),(ee.current?e=>e():requestAnimationFrame)(()=>{let r=s.current[N.current]||t;r&&(t||e(r),ae&&(n||!F.current)&&r.scrollIntoView?.({block:`nearest`,inline:`nearest`}))})});X(()=>{u&&(r&&i?(N.current=d??-1,M.current&&d!=null&&(B.current=!0,I())):R.current&&(N.current=-1,L.current()))},[u,r,i,d,I]),X(()=>{if(u){if(!r){ee.current=!1;return}if(i)if(c==null){if(ee.current=!1,ne.current!=null)return;if(R.current&&(N.current=-1,re()),(!z.current||!R.current)&&M.current&&(P.current!=null||M.current===!0&&P.current==null)){let e=0,t=()=>{s.current[0]==null?(e<2&&(e?requestAnimationFrame:queueMicrotask)(t),e+=1):(N.current=P.current==null||Eb(P.current,S,h)||m?Zh(s):Qh(s),P.current=null,I())};t()}}else Xh(s.current,c)||(N.current=c,re(),B.current=!1)}},[u,r,i,c,ne,m,s,S,h,I,re,V]),X(()=>{if(!u||i||!A||g||!R.current)return;let e=A.nodesRef.current,t=e.find(e=>e.id===k)?.context?.elements.floating,n=uh(Wp(i)),r=e.some(e=>e.context&&dh(e.context.elements.floating,n));t&&!r&&F.current&&t.focus({preventScroll:!0})},[u,i,A,k,g]),X(()=>{L.current=I,z.current=r,R.current=!!i}),X(()=>{r||(P.current=null,M.current=_)},[r,_]);let W=c!=null,ie=Z(e=>{if(!H.current)return;let t=s.current.indexOf(e.currentTarget);t!==-1&&(N.current!==t||c!==t)&&(N.current=t,I(e))}),ae=b.useMemo(()=>({onFocus(e){ee.current=!0,ie(e)},onClick:({currentTarget:e})=>e.focus({preventScroll:!0}),onMouseMove(e){ee.current=!0,B.current=!1,v&&ie(e)},onPointerLeave(e){if(!H.current||!F.current||e.pointerType===`touch`)return;ee.current=!0;let t=e.relatedTarget;if(!(!v||s.current.includes(t))&&U.current&&(te.current?.(),te.current=null,N.current=-1,I(e),!g)){let e=O.current,t=uh(Wp(e));e&&dh(e,t)&&e.focus({preventScroll:!0})}}}),[ie,H,O,v,s,I,U,g]),oe=b.useCallback(()=>C??A?.nodesRef.current.find(e=>e.id===k)?.context?.dataRef?.current.orientation,[k,A,C]),se=Z(e=>{if(F.current=!1,ee.current=!0,e.which===229||!H.current&&e.currentTarget===O.current)return;if(m&&Ob(e.key,S,h,w)){Tb(e.key,oe())||mm(e),n.setOpen(!1,Lm(Mm,e.nativeEvent)),dp(a)&&(g?A?.events.emit(`virtualfocus`,a):a.focus());return}let t=N.current,i=Zh(s,x),o=Qh(s,x);if(j||(e.key===`Home`&&(mm(e),N.current=i,I(e)),e.key===`End`&&(mm(e),N.current=o,I(e))),w>1){let t=Array.from({length:s.current.length},()=>({width:1,height:1})),n=tg(t,w,!1),r=n.findIndex(e=>e!=null&&!ig(s.current,e,x)),a=n.reduce((e,t,n)=>t!=null&&!ig(s.current,t,x)?n:e,-1),c=n[eg(n.map(e=>e==null?null:s.current[e]),{event:e,orientation:S,loopFocus:p,rtl:h,cols:w,disabledIndices:rg([...(typeof x==`function`?null:x)||s.current.map((e,t)=>ig(s.current,t,x)?t:void 0),void 0],n),minIndex:r,maxIndex:a,prevIndex:ng(N.current>o?i:N.current,t,n,w,e.key===`ArrowDown`?`bl`:e.key===(h?`ArrowLeft`:`ArrowRight`)?`tr`:`tl`),stopEvent:!0})];if(c!=null&&(N.current=c,I(e)),S===`both`)return}if(Tb(e.key,S)){if(mm(e),r&&!g&&uh(e.currentTarget.ownerDocument)===e.currentTarget){N.current=Eb(e.key,S,h)?i:o,I(e);return}Eb(e.key,S,h)?p?t>=o?f&&t!==s.current.length?N.current=-1:(ee.current=!1,N.current=i):N.current=$h(s.current,{startingIndex:t,disabledIndices:x}):N.current=Math.min(o,$h(s.current,{startingIndex:t,disabledIndices:x})):p?t<=i?f&&t!==-1?N.current=s.current.length:(ee.current=!1,N.current=o):N.current=$h(s.current,{startingIndex:t,decrement:!0,disabledIndices:x}):N.current=Math.max(i,$h(s.current,{startingIndex:t,decrement:!0,disabledIndices:x})),Xh(s.current,N.current)&&(N.current=-1),I(e)}}),ce=b.useMemo(()=>g&&r&&W&&{"aria-activedescendant":`${T}-${c}`},[g,r,W,T,c]),le=b.useMemo(()=>({"aria-orientation":S===`both`?void 0:S,...j?{}:ce,onKeyDown(e){if(e.key===`Tab`&&e.shiftKey&&r&&!g){let t=fh(e.nativeEvent);if(t&&!dh(O.current,t))return;mm(e),n.setOpen(!1,Lm(Am,e.nativeEvent)),dp(a)&&a.focus();return}se(e)},onPointerMove(){F.current=!0}}),[ce,se,O,S,j,n,r,g,a]),ue=b.useMemo(()=>{function e(e){_===`auto`&&gm(e.nativeEvent)&&(M.current=!g)}function t(e){M.current=_,_===`auto`&&_m(e.nativeEvent)&&(M.current=!0)}return{onKeyDown(e){let t=n.select(`open`);F.current=!1;let r=e.key.startsWith(`Arrow`),i=Db(e.key,oe(),h),a=Tb(e.key,S),o=(m?i:a)||e.key===`Enter`||e.key.trim()===``;if(g&&t)return se(e);if(!(!t&&!y&&r)){if(o){let t=Tb(e.key,oe());P.current=m&&t?null:e.key}if(m){i&&(mm(e),t?(N.current=Zh(s,V.current),I(e)):n.setOpen(!0,Lm(Mm,e.nativeEvent,e.currentTarget)));return}a&&(ne.current!=null&&(N.current=ne.current),mm(e),!t&&y?n.setOpen(!0,Lm(Mm,e.nativeEvent,e.currentTarget)):se(e),t&&I(e))}},onFocus(e){n.select(`open`)&&!g&&(N.current=-1,I(e))},onPointerDown:t,onPointerEnter:t,onMouseDown:e,onClick:e}},[se,V,_,s,m,I,n,y,S,oe,h,ne,g]),de=b.useMemo(()=>({...ce,...ue}),[ce,ue]);return b.useMemo(()=>u?{reference:de,floating:le,item:ae,trigger:ue}:{},[u,de,le,ue,ae])}var Ab=new Map([[`select`,`listbox`],[`combobox`,`listbox`],[`label`,!1]]);function jb(e,t={}){let n=`rootStore`in e?e.rootStore:e,r=n.useState(`open`),i=n.useState(`floatingId`),a=n.useState(`domReferenceElement`),o=n.useState(`floatingElement`),{role:s=`dialog`}=t,c=$g(),l=a?.id||c,u=b.useMemo(()=>bh(o)?.id||i,[o,i]),d=Ab.get(s)??s,f=G_()!=null,p=b.useMemo(()=>d===`tooltip`||s===`label`?im:{"aria-haspopup":d===`alertdialog`?`dialog`:d,"aria-expanded":`false`,...d===`listbox`&&{role:`combobox`},...d===`menu`&&f&&{role:`menuitem`},...s===`select`&&{"aria-autocomplete":`none`},...s===`combobox`&&{"aria-autocomplete":`list`}},[d,f,s]),m=b.useMemo(()=>d===`tooltip`||s===`label`?{[`aria-${s===`label`?`labelledby`:`describedby`}`]:r?u:void 0}:{...p,"aria-expanded":r?`true`:`false`,"aria-controls":r?u:void 0,...d===`menu`&&{id:l}},[d,u,r,l,s,p]),h=b.useMemo(()=>{let e={id:u,...d&&{role:d}};return d===`tooltip`||s===`label`?e:{...e,...d===`menu`&&{"aria-labelledby":l}}},[d,u,l,s]),g=b.useCallback(({active:e,selected:t})=>{let n={role:`option`,...e&&{id:`${u}-fui-option`}};switch(s){case`select`:case`combobox`:return{...n,"aria-selected":t};default:}return{}},[u,s]);return b.useMemo(()=>({reference:m,floating:h,item:g,trigger:p}),[m,h,p,g])}function Mb(e,t){let n=`rootStore`in e?e.rootStore:e,r=n.context.dataRef,i=n.useState(`open`),{listRef:a,elementsRef:o,activeIndex:s,onMatch:c,onTypingChange:l,enabled:u=!0,resetMs:d=750,selectedIndex:f=null}=t,p=Zp(),m=b.useRef(``),h=b.useRef(f??s??-1),g=b.useRef(null);X(()=>{!i&&f!==null||(p.clear(),g.current=null,m.current!==``&&(m.current=``))},[i,f,p]),X(()=>{i&&m.current===``&&(h.current=f??s??-1)},[i,f,s]);let _=Z(e=>{e?r.current.typing||(r.current.typing=e,l?.(e)):r.current.typing&&(r.current.typing=e,l?.(e))}),v=Z(e=>{function t(e){let t=o?.current[e];return!t||og(t)}function n(e,n,r=0){if(e.length===0)return-1;let i=(r%e.length+e.length)%e.length,a=n.toLocaleLowerCase();for(let n=0;n<e.length;n+=1){let r=(i+n)%e.length;if(!(!e[r]?.toLocaleLowerCase().startsWith(a)||!t(r)))return r}return-1}let r=a.current;if(m.current.length>0&&e.key===` `&&(mm(e),_(!0)),m.current.length>0&&m.current[0]!==` `&&n(r,m.current)===-1&&e.key!==` `&&_(!1),r==null||e.key.length!==1||e.ctrlKey||e.metaKey||e.altKey)return;i&&e.key!==` `&&(mm(e),_(!0));let l=m.current===``;l&&(h.current=f??s??-1),r.every(e=>e?e[0]?.toLocaleLowerCase()!==e[1]?.toLocaleLowerCase():!0)&&m.current===e.key&&(m.current=``,h.current=g.current),m.current+=e.key,p.start(d,()=>{m.current=``,h.current=g.current,_(!1)});let u=((l?f??s??-1:h.current)??0)+1,v=n(r,m.current,u);v===-1?e.key!==` `&&(m.current=``,_(!1)):(c?.(v),g.current=v)}),y=Z(e=>{let t=e.relatedTarget,r=n.select(`domReferenceElement`),i=n.select(`floatingElement`),a=dh(r,t),o=dh(i,t);a||o||(p.clear(),m.current=``,h.current=g.current,_(!1))}),x=b.useMemo(()=>({onKeyDown:v,onBlur:y}),[v,y]),S=b.useMemo(()=>({onKeyDown:v,onBlur:y}),[v,y]);return b.useMemo(()=>u?{reference:x,floating:S}:{},[u,x,S])}var Nb=.1,Pb=Nb*Nb,Fb=.5;function Ib(e,t,n,r,i,a){return r>=t!=a>=t&&e<=(i-n)*(t-r)/(a-r)+n}function Lb(e,t,n,r,i,a,o,s,c,l){let u=!1;return Ib(e,t,n,r,i,a)&&(u=!u),Ib(e,t,i,a,o,s)&&(u=!u),Ib(e,t,o,s,c,l)&&(u=!u),Ib(e,t,c,l,n,r)&&(u=!u),u}function Rb(e,t,n){return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function zb(e,t,n,r,i,a){return e>=Math.min(n,i)&&e<=Math.max(n,i)&&t>=Math.min(r,a)&&t<=Math.max(r,a)}function Bb(e={}){let{blockPointerEvents:t=!1}=e,n=new Xp,r=({x:e,y:t,placement:r,elements:i,onClose:a,nodeId:o,tree:s})=>{let c=r?.split(`-`)[0],l=!1,u=null,d=null,f=typeof performance<`u`?performance.now():0;function p(e,t){let n=performance.now(),r=n-f;if(u===null||d===null||r===0)return u=e,d=t,f=n,!1;let i=e-u,a=t-d,o=i*i+a*a,s=r*r*Pb;return u=e,d=t,f=n,o<s}function m(){n.clear(),a()}return function(r){n.clear();let a=i.domReference,u=i.floating;if(!a||!u||c==null||e==null||t==null)return;let{clientX:d,clientY:f}=r,h=fh(r),g=r.type===`mouseleave`,_=dh(u,h),v=dh(a,h);if(_&&(l=!0,!g))return;if(v&&(l=!1,!g)){l=!0;return}if(g&&up(r.relatedTarget)&&dh(u,r.relatedTarget))return;function y(){return!!(s&&Mg(s.nodesRef.current,o).length>0)}function b(){y()||m()}if(y())return;let x=a.getBoundingClientRect(),S=u.getBoundingClientRect(),C=e>S.right-S.width/2,w=t>S.bottom-S.height/2,T=S.width>x.width,E=S.height>x.height,D=(T?x:S).left,O=(T?x:S).right,k=(E?x:S).top,A=(E?x:S).bottom;if(c===`top`&&t>=x.bottom-1||c===`bottom`&&t<=x.top+1||c===`left`&&e>=x.right-1||c===`right`&&e<=x.left+1){b();return}let j=!1;switch(c){case`top`:j=zb(d,f,D,x.top+1,O,S.bottom-1);break;case`bottom`:j=zb(d,f,D,S.top+1,O,x.bottom-1);break;case`left`:j=zb(d,f,S.right-1,A,x.left+1,k);break;case`right`:j=zb(d,f,x.right-1,A,S.left+1,k);break;default:}if(j)return;if(l&&!Rb(d,f,x)){b();return}if(!g&&p(d,f)){b();return}let M=!1;switch(c){case`top`:{let n=T?Fb/2:Fb*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t+Fb+1,o=C||T?S.bottom-Fb:S.top,s=C?T?S.bottom-Fb:S.top:S.bottom-Fb;M=Lb(d,f,r,a,i,a,S.left,o,S.right,s);break}case`bottom`:{let n=T?Fb/2:Fb*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t-Fb,o=C||T?S.top+Fb:S.bottom,s=C?T?S.top+Fb:S.bottom:S.top+Fb;M=Lb(d,f,r,a,i,a,S.left,o,S.right,s);break}case`left`:{let n=E?Fb/2:Fb*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e+Fb+1,o=w||E?S.right-Fb:S.left,s=w?E?S.right-Fb:S.left:S.right-Fb;M=Lb(d,f,o,S.top,s,S.bottom,a,r,a,i);break}case`right`:{let n=E?Fb/2:Fb*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e-Fb,o=w||E?S.left+Fb:S.right,s=w?E?S.left+Fb:S.right:S.left+Fb;M=Lb(d,f,a,r,a,i,o,S.top,s,S.bottom);break}default:}M?l||n.start(40,b):b()}};return r.__options={...e,blockPointerEvents:t},r}function Vb(e){let t=b.useRef(``),n=b.useCallback(n=>{n.defaultPrevented||(t.current=n.pointerType,e(n,n.pointerType))},[e]);return{onClick:b.useCallback(n=>{if(n.detail===0){e(n,`keyboard`);return}`pointerType`in n?e(n,n.pointerType):e(n,t.current),t.current=``},[e]),onPointerDown:n}}function Hb(e,t){let n=b.useRef(e),r=Z(t);X(()=>{n.current!==e&&r(n.current)},[e,r]),X(()=>{n.current=e},[e])}function Ub(e){let[t,n]=b.useState(null),r=Z((t,r)=>{e||n(r||(Ip?`touch`:``))});Hb(e,t=>{t&&!e&&n(null)});let{onClick:i,onPointerDown:a}=Vb(r);return b.useMemo(()=>({openMethod:t,triggerProps:{onClick:i,onPointerDown:a}}),[t,i,a])}function Wb(e){let{store:t,parentContext:n,actionsRef:r,isDrawer:i}=e,a=t.useState(`open`),o=t.useState(`disablePointerDismissal`),s=t.useState(`modal`),c=t.useState(`popupElement`),{openMethod:l,triggerProps:u}=Ub(a);eb(t);let{forceUnmount:d}=tb(a,t),f=b.useCallback(()=>{t.setOpen(!1,Lm(Fm))},[t]);b.useImperativeHandle(r,()=>({unmount:d,close:f}),[d,f]);let p=lb({popupStore:t,onOpenChange:t.setOpen,treatPopupAsFloatingElement:!0}),[m,h]=b.useState(0),[g,_]=b.useState(0),v=m===0,y=jb(p),x=pv(p,{outsidePressEvent(){return t.context.internalBackdropRef.current||t.context.backdropRef.current?`intentional`:{mouse:s===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}},outsidePress(e){if(!t.context.outsidePressEnabledRef.current||`button`in e&&e.button!==0||`touches`in e&&e.touches.length!==1)return!1;let n=fh(e);if(v&&!o){let e=n;return s&&(t.context.internalBackdropRef.current||t.context.backdropRef.current)?t.context.internalBackdropRef.current===e||t.context.backdropRef.current===e||dh(e,c)&&!e?.hasAttribute(`data-base-ui-portal`):!0}return!1},escapeKey:v});pm(a&&s===!0,c);let{getReferenceProps:S,getFloatingProps:C,getTriggerProps:w}=bb([y,x]);t.useContextCallback(`onNestedDialogOpen`,(e,t)=>{h(e),_(t)}),t.useContextCallback(`onNestedDialogClose`,()=>{h(0),_(0)}),b.useEffect(()=>(n?.onNestedDialogOpen&&a&&n.onNestedDialogOpen(m+1,g+ +!!i),n?.onNestedDialogClose&&!a&&n.onNestedDialogClose(),()=>{n?.onNestedDialogClose&&a&&n.onNestedDialogClose()}),[i,a,m,g,n]);let T=b.useMemo(()=>S(u),[S,u]),E=b.useMemo(()=>w(u),[w,u]),D=b.useMemo(()=>C(),[C]);t.useSyncedValues({openMethod:l,activeTriggerProps:T,inactiveTriggerProps:E,popupProps:D,floatingRootContext:p,nestedOpenDialogCount:m,nestedOpenDrawerCount:g})}var Gb=b.createContext(void 0);function Kb(e){let t=b.useContext(Gb);if(e===!1&&t===void 0)throw Error(t_(27));return t}var qb={...ob,modal:Q(e=>e.modal),nested:Q(e=>e.nested),nestedOpenDialogCount:Q(e=>e.nestedOpenDialogCount),nestedOpenDrawerCount:Q(e=>e.nestedOpenDrawerCount),disablePointerDismissal:Q(e=>e.disablePointerDismissal),openMethod:Q(e=>e.openMethod),descriptionElementId:Q(e=>e.descriptionElementId),titleElementId:Q(e=>e.titleElementId),viewportElement:Q(e=>e.viewportElement),role:Q(e=>e.role)},Jb=class e extends Hy{constructor(e){super(Yb(e),{popupRef:b.createRef(),backdropRef:b.createRef(),internalBackdropRef:b.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:new nb,onOpenChange:void 0,onOpenChangeComplete:void 0},qb)}setOpen=(e,t)=>{if(t.preventUnmountOnClose=()=>{this.set(`preventUnmountingOnClose`,!0)},!e&&t.trigger==null&&this.state.activeTriggerId!=null&&(t.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(e,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(e,t);let n={open:e},r=t.trigger?.id??null;(r||e)&&(n.activeTriggerId=r,n.activeTriggerElement=t.trigger??null),this.update(n)};static useStore(t,n){let r=Kp(()=>new e(n)).current;return t??r}};function Yb(e={}){return{...ib(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:`dialog`,...e}}var Xb=b.createContext(!1);function Zb(e){let{children:t,open:n,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:a,actionsRef:o,handle:s,triggerId:c,defaultTriggerId:l=null}=e,u=Kb(!0),d=!!u,f=Jb.useStore(s?.store,{open:r,openProp:n,activeTriggerId:l,triggerIdProp:c,modal:!0,disablePointerDismissal:!0,nested:d,role:`alertdialog`});f.useControlledProp(`openProp`,n),f.useControlledProp(`triggerIdProp`,c),f.useSyncedValue(`nested`,d),f.useContextCallback(`onOpenChange`,i),f.useContextCallback(`onOpenChangeComplete`,a);let p=f.useState(`payload`);Wb({store:f,actionsRef:o,parentContext:u?.store.context,isDrawer:!1,onOpenChange:i,triggerIdProp:c});let m=b.useMemo(()=>({store:f}),[f]);return(0,y.jsx)(Xb.Provider,{value:!1,children:(0,y.jsx)(Gb.Provider,{value:m,children:typeof t==`function`?t({payload:p}):t})})}var Qb=function(e){return e.open=`data-open`,e.closed=`data-closed`,e[e.startingStyle=Ky.startingStyle]=`startingStyle`,e[e.endingStyle=Ky.endingStyle]=`endingStyle`,e.anchorHidden=`data-anchor-hidden`,e.side=`data-side`,e.align=`data-align`,e}({}),$b=function(e){return e.popupOpen=`data-popup-open`,e.pressed=`data-pressed`,e}({}),ex={[$b.popupOpen]:``},tx={[$b.popupOpen]:``,[$b.pressed]:``},nx={[Qb.open]:``},rx={[Qb.closed]:``},ix={[Qb.anchorHidden]:``},ax={open(e){return e?ex:null}},ox={open(e){return e?tx:null}},sx={open(e){return e?nx:rx},anchorHidden(e){return e?ix:null}},cx={...sx,...Yy},lx=b.forwardRef(function(e,t){let{render:n,className:r,style:i,forceRender:a=!1,...o}=e,{store:s}=Kb(),c=s.useState(`open`),l=s.useState(`nested`),u=s.useState(`mounted`);return w_(`div`,e,{state:{open:c,transitionStatus:s.useState(`transitionStatus`)},ref:[s.context.backdropRef,t],stateAttributesMapping:cx,props:[{role:`presentation`,hidden:!u,style:{userSelect:`none`,WebkitUserSelect:`none`}},o],enabled:a||!l})}),ux=b.createContext(void 0);function dx(e=!1){let t=b.useContext(ux);if(t===void 0&&!e)throw Error(t_(16));return t}function fx(e){let{focusableWhenDisabled:t,disabled:n,composite:r=!1,tabIndex:i=0,isNativeButton:a}=e,o=r&&t!==!1,s=r&&t===!1;return{props:b.useMemo(()=>{let e={onKeyDown(e){n&&t&&e.key!==`Tab`&&e.preventDefault()}};return r||(e.tabIndex=i,!a&&n&&(e.tabIndex=t?i:-1)),(a&&(t||o)||!a&&n)&&(e[`aria-disabled`]=n),a&&(!t||s)&&(e.disabled=n),e},[r,n,t,o,s,a,i])}}function px(e={}){let{disabled:t=!1,focusableWhenDisabled:n,tabIndex:r=0,native:i=!0,composite:a}=e,o=b.useRef(null),s=dx(!0),c=a??s!==void 0,{props:l}=fx({focusableWhenDisabled:n,disabled:t,composite:c,tabIndex:r,isNativeButton:i}),u=b.useCallback(()=>{let e=o.current;mx(e)&&c&&t&&l.disabled===void 0&&e.disabled&&(e.disabled=!1)},[t,l.disabled,c]);return X(u,[u]),{getButtonProps:b.useCallback((e={})=>{let{onClick:n,onMouseDown:r,onKeyUp:a,onKeyDown:o,onPointerDown:s,...u}=e;return u_({type:i?`button`:void 0,onClick(e){if(t){e.preventDefault();return}n?.(e)},onMouseDown(e){t||r?.(e)},onKeyDown(e){if(t||(x_(e),o?.(e),e.baseUIHandlerPrevented))return;let r=e.target===e.currentTarget,a=e.currentTarget,s=mx(a),l=!i&&hx(a),u=r&&(i?s:!l),d=e.key===`Enter`,f=e.key===` `,p=a.getAttribute(`role`),m=p?.startsWith(`menuitem`)||p===`option`||p===`gridcell`;if(r&&c&&f){if(e.defaultPrevented&&m)return;e.preventDefault(),l||i&&s?(a.click(),e.preventBaseUIHandler()):u&&(n?.(e),e.preventBaseUIHandler());return}u&&(!i&&(f||d)&&e.preventDefault(),!i&&d&&n?.(e))},onKeyUp(e){if(!t){if(x_(e),a?.(e),e.target===e.currentTarget&&i&&c&&mx(e.currentTarget)&&e.key===` `){e.preventDefault();return}e.baseUIHandlerPrevented||e.target===e.currentTarget&&!i&&!c&&e.key===` `&&n?.(e)}},onPointerDown(e){if(t){e.preventDefault();return}s?.(e)}},i?void 0:{role:`button`},l,u)},[t,l,c,i]),buttonRef:Z(e=>{o.current=e,u()})}}function mx(e){return dp(e)&&e.tagName===`BUTTON`}function hx(e){return!!(e?.tagName===`A`&&e?.href)}function gx(e){return $g(e,`base-ui`)}var _x=b.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,{store:s}=Kb(),c=gx(a);return s.useSyncedValueWithCleanup(`descriptionElementId`,c),w_(`p`,e,{ref:t,props:[{id:c},o]})}),vx=function(e){return e.nestedDialogs=`--nested-dialogs`,e}({}),yx=function(e){return e[e.open=Qb.open]=`open`,e[e.closed=Qb.closed]=`closed`,e[e.startingStyle=Qb.startingStyle]=`startingStyle`,e[e.endingStyle=Qb.endingStyle]=`endingStyle`,e.nested=`data-nested`,e.nestedDialogOpen=`data-nested-dialog-open`,e}({}),bx=b.createContext(void 0);function xx(){let e=b.useContext(bx);if(e===void 0)throw Error(t_(26));return e}var Sx=`ArrowUp`,Cx=`ArrowDown`,wx=`ArrowLeft`,Tx=`ArrowRight`,Ex=`Home`,Dx=new Set([wx,Tx]),Ox=new Set([Sx,Cx]),kx=new Set([...Dx,...Ox]);new Set([...kx,Ex,`End`]);var Ax=new Set([Sx,Cx,wx,Tx,Ex,`End`]),jx={...sx,...Yy,nestedDialogOpen(e){return e?{[yx.nestedDialogOpen]:``}:null}},Mx=b.forwardRef(function(e,t){let{className:n,finalFocus:r,initialFocus:i,render:a,style:o,...s}=e,{store:c}=Kb(),l=c.useState(`descriptionElementId`),u=c.useState(`disablePointerDismissal`),d=c.useState(`floatingRootContext`),f=c.useState(`popupProps`),p=c.useState(`modal`),m=c.useState(`mounted`),h=c.useState(`nested`),g=c.useState(`nestedOpenDialogCount`),_=c.useState(`open`),v=c.useState(`openMethod`),b=c.useState(`titleElementId`),x=c.useState(`transitionStatus`),S=c.useState(`role`);xx(),Zy({open:_,ref:c.context.popupRef,onComplete(){_&&c.context.onOpenChangeComplete?.(!0)}});function C(e){return e===`touch`?c.context.popupRef.current:!0}let w=i===void 0?C:i,T=w_(`div`,e,{state:{open:_,nested:h,transitionStatus:x,nestedDialogOpen:g>0},props:[f,{"aria-labelledby":b??void 0,"aria-describedby":l??void 0,role:S,tabIndex:-1,hidden:!m,onKeyDown(e){Ax.has(e.key)&&e.stopPropagation()},style:{[vx.nestedDialogs]:g}},s],ref:[t,c.context.popupRef,c.useStateSetter(`popupElement`)],stateAttributesMapping:jx});return(0,y.jsx)(av,{context:d,openInteractionType:v,disabled:!m,closeOnFocusOut:!u,initialFocus:w,returnFocus:r,modal:p!==!1,restoreFocus:`popup`,children:T})});function Nx(e){return r_(19)?e:e?`true`:void 0}var Px=b.forwardRef(function(e,t){let{cutout:n,...r}=e,i;if(n){let e=n.getBoundingClientRect();i=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${e.left}px ${e.top}px,${e.left}px ${e.bottom}px,${e.right}px ${e.bottom}px,${e.right}px ${e.top}px,${e.left}px ${e.top}px)`}return(0,y.jsx)(`div`,{ref:t,role:`presentation`,"data-base-ui-inert":``,...r,style:{position:`fixed`,inset:0,userSelect:`none`,WebkitUserSelect:`none`,clipPath:i}})}),Fx=b.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i}=Kb(),a=i.useState(`mounted`),o=i.useState(`modal`),s=i.useState(`open`);return a||n?(0,y.jsx)(bx.Provider,{value:n,children:(0,y.jsxs)(B_,{ref:t,...r,children:[a&&o===!0&&(0,y.jsx)(Px,{ref:i.context.internalBackdropRef,inert:Nx(!s)}),e.children]})}):null}),Ix=b.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,{store:s}=Kb(),c=gx(a);return s.useSyncedValueWithCleanup(`titleElementId`,c),w_(`h2`,e,{ref:t,props:[{id:c},o]})}),Lx=`border border-border/60 bg-background/70 text-muted-foreground shadow-xs ring-0 backdrop-blur-md`,Rx=`duration-150 ease-snappy data-closed:duration-100 data-closed:fade-out-0 data-closed:zoom-out-95 data-closed:blur-out-[5px] data-closed:slide-out-to-top-2 data-open:fade-in-0 data-open:zoom-in-95 data-open:blur-in-[5px] data-open:slide-in-from-top-2`,zx=`fixed inset-0 isolate z-50 bg-black/10 supports-backdrop-filter:backdrop-blur-xs`,Bx=`duration-150 ease-snappy data-closed:duration-100 data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,Vx=`border border-border/60 bg-background/90 text-foreground shadow-lg ring-0`,Hx=`duration-150 ease-snappy data-closed:duration-100 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,Ux=`absolute inset-0 bg-black/10 supports-backdrop-filter:backdrop-blur-xs transition-[opacity,backdrop-filter] duration-150 ease-snappy data-[closed]:opacity-0 data-[open]:opacity-100`,Wx=`transition-[opacity,transform] duration-150 ease-snappy data-[closed]:opacity-0 data-[closed]:scale-95 data-[open]:opacity-100 data-[open]:scale-100`,Gx=b.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,focusableWhenDisabled:a=!1,nativeButton:o=!0,style:s,...c}=e,{getButtonProps:l,buttonRef:u}=px({disabled:i,focusableWhenDisabled:a,native:o});return w_(`button`,e,{state:{disabled:i},ref:[t,u],props:[c,l]})}),Kx=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,qx=jd,Jx=(e,t)=>n=>{if(t?.variants==null)return qx(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=Kx(t)||Kx(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return qx(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},Yx=Jx(`group/button inline-flex shrink-0 items-center justify-center rounded-md border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`bg-primary text-primary-foreground hover:bg-primary/80`,outline:`border-border bg-background shadow-xs hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50`,secondary:`bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground`,ghost:`hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50`,destructive:`bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40`,link:`text-primary underline-offset-4 hover:underline`},size:{default:`h-9 gap-1.5 px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,xs:`h-6 gap-1 rounded-[min(var(--radius-md),8px)] px-2 text-xs in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3`,sm:`h-8 gap-1 rounded-[min(var(--radius-md),10px)] px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5`,lg:`h-10 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,icon:`size-9`,"icon-xs":`size-6 rounded-[min(var(--radius-md),8px)] in-data-[slot=button-group]:rounded-md [&_svg:not([class*='size-'])]:size-3`,"icon-sm":`size-8 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-md`,"icon-lg":`size-10`}},defaultVariants:{variant:`default`,size:`default`}});function Xx({className:e,variant:t=`default`,size:n=`default`,...r}){return(0,y.jsx)(Gx,{"data-slot":`button`,className:rp(Yx({variant:t,size:n,className:e})),...r})}function Zx({...e}){return(0,y.jsx)(Zb,{"data-slot":`alert-dialog`,...e})}function Qx({...e}){return(0,y.jsx)(Fx,{"data-slot":`alert-dialog-portal`,...e})}function $x({className:e,...t}){return(0,y.jsx)(lx,{"data-slot":`alert-dialog-overlay`,className:rp(zx,Bx,e),...t})}function eS({className:e,size:t=`default`,...n}){return(0,y.jsxs)(Qx,{children:[(0,y.jsx)($x,{}),(0,y.jsx)(Mx,{"data-slot":`alert-dialog-content`,"data-size":t,className:rp(`group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid w-full -translate-x-1/2 -translate-y-1/2 gap-6 rounded-xl p-6 text-popover-foreground outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-lg`,Vx,Hx,e),...n})]})}function tS({className:e,...t}){return(0,y.jsx)(`div`,{"data-slot":`alert-dialog-header`,className:rp(`grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-6 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]`,e),...t})}function nS({className:e,...t}){return(0,y.jsx)(`div`,{"data-slot":`alert-dialog-footer`,className:rp(`flex flex-col-reverse gap-2 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end`,e),...t})}function rS({className:e,...t}){return(0,y.jsx)(Ix,{"data-slot":`alert-dialog-title`,className:rp(`font-heading text-lg font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2`,e),...t})}function iS({className:e,...t}){return(0,y.jsx)(_x,{"data-slot":`alert-dialog-description`,className:rp(`text-sm text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground`,e),...t})}function aS({className:e,...t}){return(0,y.jsx)(Xx,{"data-slot":`alert-dialog-action`,className:rp(e),...t})}function oS(e){return w_(e.defaultTagName??`div`,e,e)}var sS=Jx(`group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!`,{variants:{variant:{default:`bg-primary text-primary-foreground [a]:hover:bg-primary/80`,secondary:`bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80`,destructive:`bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20`,outline:`border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground`,ghost:`hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50`,link:`text-primary underline-offset-4 hover:underline`}},defaultVariants:{variant:`default`}});function cS({className:e,variant:t=`default`,render:n,...r}){return oS({defaultTagName:`span`,props:u_({className:rp(sS({variant:t}),e)},r),render:n,state:{slot:`badge`,variant:t}})}var lS=function(e){return e.disabled=`data-disabled`,e.valid=`data-valid`,e.invalid=`data-invalid`,e.touched=`data-touched`,e.dirty=`data-dirty`,e.filled=`data-filled`,e.focused=`data-focused`,e}({}),uS={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},dS={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},fS={disabled:!1,...dS},pS={valid(e){return e===null?null:e?{[lS.valid]:``}:{[lS.invalid]:``}}},mS=b.createContext({invalid:void 0,name:void 0,validityData:{state:uS,errors:[],error:``,value:``,initialValue:null},setValidityData:nm,disabled:void 0,touched:dS.touched,setTouched:nm,dirty:dS.dirty,setDirty:nm,filled:dS.filled,setFilled:nm,focused:dS.focused,setFocused:nm,validate:()=>null,validationMode:`onSubmit`,validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:fS,markedDirtyRef:{current:!1},registerFieldControl:nm,validation:{getValidationProps:(e=im)=>e,getInputValidationProps:(e=im)=>e,inputRef:{current:null},commit:async()=>{}}});function hS(e=!0){let t=b.useContext(mS);if(t.setValidityData===nm&&!e)throw Error(t_(28));return t}var gS=b.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:nm,validationMode:`onSubmit`,submitAttemptedRef:{current:!1}});function _S(){return b.useContext(gS)}var vS=b.createContext({controlId:void 0,registerControlId:nm,labelId:void 0,setLabelId:nm,messageIds:[],setMessageIds:nm,getDescriptionProps:e=>e});function yS(){return b.useContext(vS)}function bS(e,t,n,r=!0,i){let[a,o]=b.useState(),s=gx(i?`${i}-label`:void 0),c=e??t??a;return X(()=>{let i=e||t||!r?void 0:xS(n.current,s);a!==i&&o(i)}),c}function xS(e,t){let n=SS(e);if(n)return!n.id&&t&&(n.id=t),n.id||void 0}function SS(e){if(!e)return;let t=e.parentElement;if(t&&t.tagName===`LABEL`)return t;let n=e.id;if(n){let t=e.nextElementSibling;if(t&&t.htmlFor===n)return t}let r=e.labels;return r&&r[0]}function CS(e={}){let{id:t,implicit:n=!1,controlRef:r}=e,{controlId:i,registerControlId:a}=yS(),o=gx(t),s=n?i:void 0,c=Kp(()=>Symbol(`labelable-control`)),l=b.useRef(!1),u=b.useRef(t!=null),d=Z(()=>{!l.current||a===nm||(l.current=!1,a(c.current,void 0))});return X(()=>{if(a===nm)return;let e;if(n){let n=r?.current;e=up(n)&&n.closest(`label`)!=null?t??null:s??o}else if(t!=null)u.current=!0,e=t;else if(u.current)e=o;else{d();return}if(e===void 0){d();return}l.current=!0,a(c.current,e)},[t,r,s,a,n,o,c,d]),b.useEffect(()=>d,[d]),i??o}function wS({controlled:e,default:t,name:n,state:r=`value`}){let{current:i}=b.useRef(e!==void 0),[a,o]=b.useState(t);return[i?e:a,b.useCallback(e=>{i||o(e)},[])]}function TS(e,t){let{enabled:n=!0,getValue:r,id:i,value:a}=t,{registerFieldControl:o}=hS(),s=b.useRef(null);s.current||=Symbol(),X(()=>{let t=s.current;if(!(!t||!n))return o(t,{controlRef:e,getValue:r,id:i,value:a}),()=>{o(t,void 0)}},[e,n,r,i,o,a])}var ES=b.forwardRef(function(e,t){let{render:n,className:r,id:i,name:a,value:o,disabled:s=!1,onValueChange:c,defaultValue:l,autoFocus:u=!1,style:d,...f}=e,{state:p,name:m,disabled:h,setTouched:g,setDirty:_,validityData:v,setFocused:y,setFilled:x,validationMode:S,validation:C}=hS(),w=h||s,T=m??a,E={...p,disabled:w},{labelId:D}=yS(),O=CS({id:i});X(()=>{let e=o!=null;C.inputRef.current?.value||e&&o!==``?x(!0):e&&o===``&&x(!1)},[C.inputRef,x,o]);let k=b.useRef(null);X(()=>{u&&k.current===uh(Wp(k.current))&&y(!0)},[u,y]);let[A]=wS({controlled:o,default:l,name:`FieldControl`,state:`value`}),j=o!==void 0,M=j?A:void 0,N=Z(()=>C.inputRef.current?.value);return TS(C.inputRef,{id:O,value:M,getValue:N}),w_(`input`,e,{ref:[t,k],state:E,props:[{id:O,disabled:w,name:T,ref:C.inputRef,"aria-labelledby":D,autoFocus:u,...j?{value:M}:{defaultValue:l},onChange(e){let t=e.currentTarget.value;c?.(t,Lm(wm,e.nativeEvent)),_(t!==v.initialValue),x(t!==``)},onFocus(){y(!0)},onBlur(e){g(!0),y(!1),S===`onBlur`&&C.commit(e.currentTarget.value)},onKeyDown(e){e.currentTarget.tagName===`INPUT`&&e.key===`Enter`&&(g(!0),C.commit(e.currentTarget.value))}},C.getInputValidationProps(),f],stateAttributesMapping:pS})}),DS=b.forwardRef(function(e,t){return(0,y.jsx)(ES,{ref:t,...e})});function OS({className:e,type:t,...n}){return(0,y.jsx)(DS,{type:t,"data-slot":`input`,className:rp(`h-9 w-full min-w-0 rounded-md border border-input bg-transparent px-2.5 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40`,e),...n})}function kS({className:e,...t}){return(0,y.jsx)(`textarea`,{"data-slot":`textarea`,className:rp(`flex field-sizing-content min-h-16 w-full rounded-md border border-input bg-transparent px-2.5 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40`,e),...t})}function AS({className:e,...t}){return(0,y.jsx)(`div`,{"data-slot":`input-group`,role:`group`,className:rp(`group/input-group relative flex h-9 w-full min-w-0 items-center rounded-md border border-input shadow-xs transition-[color,box-shadow] outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-3 has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-3 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto dark:bg-input/30 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5`,e),...t})}var jS=Jx(`flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4`,{variants:{align:{"inline-start":`order-first pl-2 has-[>button]:-ml-1 has-[>kbd]:ml-[-0.15rem]`,"inline-end":`order-last pr-2 has-[>button]:-mr-1 has-[>kbd]:mr-[-0.15rem]`,"block-start":`order-first w-full justify-start px-2.5 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2`,"block-end":`order-last w-full justify-start px-2.5 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2`}},defaultVariants:{align:`inline-start`}});function MS({className:e,align:t=`inline-start`,...n}){return(0,y.jsx)(`div`,{role:`group`,"data-slot":`input-group-addon`,"data-align":t,className:rp(jS({align:t}),e),onClick:e=>{e.target.closest(`button`)||e.currentTarget.parentElement?.querySelector(`input`)?.focus()},...n})}var NS=Jx(`flex items-center gap-2 text-sm shadow-none`,{variants:{size:{xs:`h-6 gap-1 rounded-[calc(var(--radius)-5px)] px-1.5 [&>svg:not([class*='size-'])]:size-3.5`,sm:``,"icon-xs":`size-6 rounded-[calc(var(--radius)-5px)] p-0 has-[>svg]:p-0`,"icon-sm":`size-8 p-0 has-[>svg]:p-0`}},defaultVariants:{size:`xs`}});function PS({className:e,type:t=`button`,variant:n=`ghost`,size:r=`xs`,...i}){return(0,y.jsx)(Xx,{type:t,"data-size":r,variant:n,className:rp(NS({size:r}),e),...i})}function FS({className:e,...t}){return(0,y.jsx)(`span`,{className:rp(`flex items-center gap-2 text-sm text-muted-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4`,e),...t})}function IS({className:e,...t}){return(0,y.jsx)(OS,{"data-slot":`input-group-control`,className:rp(`flex-1 rounded-none border-0 bg-transparent shadow-none ring-0 focus-visible:ring-0 aria-invalid:ring-0 dark:bg-transparent`,e),...t})}function LS({className:e,...t}){return(0,y.jsx)(_d,{role:`status`,"aria-label":`Loading`,className:rp(`spinner-line-fade size-4`,e),...t})}var RS=1e3,zS=1.2,BS=.1,VS=`localterm`,HS=`† `,US=`npx @monotykamary/localterm@latest start`,WS=1500,GS=5e3,KS=.35,qS=3e3,JS=2e3,YS=`localterm:diff-view-mode`,XS=1500,ZS=`#ffc79944`,QS=`#ffc799`,$S=`#ff8080`,eC=`localterm:terminal-theme-id`,tC=`localterm:terminal-font-id`,nC=`localterm:terminal-font-size`,rC=`localterm:terminal-line-height`,iC=`localterm:terminal-cursor-style`,aC=`localterm:terminal-cursor-blink`,oC=`localterm:terminal-scrollback`,sC=`localterm:terminal-scroll-on-user-input`,cC=`localterm:terminal-padding-x`,lC=`localterm:terminal-padding-y`,uC=`localterm-google-fonts`,dC=`localterm:nerd-font-enabled`,fC=`flex w-full items-center gap-2.5 rounded-sm px-2.5 py-2 text-sm text-muted-foreground outline-none transition-colors`,pC=10,mC=(e,t)=>{let n=e.toLowerCase(),r=t.toLowerCase(),i=r.indexOf(n);if(i!==-1){let e=Array.from({length:n.length},(e,t)=>i+t);return r===n?{score:1,indices:e}:i===0?{score:2,indices:e}:{score:3,indices:e}}let a=gC(n,r);return a?{score:4+(1-a.score/hC(n.length)),indices:a.indices}:null},hC=e=>{let t=e;return t+=(e-1)*.5,t+=e*.5,t},gC=(e,t)=>{let n=0,r=0,i=-1,a=[];for(let o=0;o<t.length&&n<e.length;o++)t[o]===e[n]&&(r+=1,i===o-1&&(r+=.5),(o===0||t[o-1]===` `||t[o-1]===`-`)&&(r+=.5),i=o,a.push(o),n++);return n===e.length?{score:r,indices:a}:null},_C=(e,t)=>t?e.flatMap(e=>{let n=mC(t,e.label);if(n)return[{cmd:e,score:n.score,indices:n.indices}];let r=mC(t,`${e.category} ${e.label}`);return r?[{cmd:e,score:pC+r.score,indices:null}]:[]}).sort((e,t)=>e.score-t.score).map(({cmd:e,indices:t})=>({cmd:e,indices:t})):e.map(e=>({cmd:e,indices:null})),vC=({label:e,indices:t})=>{if(!t||t.length===0)return(0,y.jsx)(y.Fragment,{children:e});let n=new Set(t),r=[];for(let t=0;t<e.length;t++){let i=n.has(t),a=r[r.length-1];a&&a.hit===i?a.text+=e[t]:r.push({text:e[t],hit:i})}return(0,y.jsx)(y.Fragment,{children:r.map((e,t)=>(0,y.jsx)(`span`,{className:e.hit?`font-semibold text-foreground`:void 0,children:e.text},t))})},yC=({keys:e,label:t})=>(0,y.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,y.jsx)(`kbd`,{className:`rounded border border-border/40 bg-muted/30 px-1 font-mono text-[10px]`,children:e}),t]}),bC=({open:e,onClose:t,commands:n,onActiveItemChange:r})=>{let[i,a]=(0,b.useState)(``),[o,s]=(0,b.useState)(0),[c,l]=(0,b.useState)(!1),[u,d]=(0,b.useState)(!1),f=(0,b.useRef)(null),p=(0,b.useId)(),m=(0,b.useMemo)(()=>_C(n,i),[n,i]),h=(0,b.useMemo)(()=>{let e=[];return m.forEach((t,n)=>{let r=e[e.length-1];r&&r.category===t.cmd.category?r.entries.push({entry:t,index:n}):e.push({category:t.cmd.category,entries:[{entry:t,index:n}]})}),e},[m]);(0,b.useEffect)(()=>{if(e){l(!0),a(``),s(0);let e=requestAnimationFrame(()=>{d(!0),f.current?.focus()});return()=>cancelAnimationFrame(e)}if(d(!1),c){let e=window.setTimeout(()=>l(!1),150);return()=>window.clearTimeout(e)}},[e]),(0,b.useEffect)(()=>{s(0)},[i]),(0,b.useEffect)(()=>{r&&r(e?m[o]?.cmd??null:null)},[e,m,o,r]),(0,b.useEffect)(()=>{let t=m[o]?.cmd;!e||!t||document.getElementById(`${p}-${t.id}`)?.scrollIntoView?.({block:`nearest`})},[o,m,e,p]),(0,b.useEffect)(()=>{if(!e||!c)return;let n=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),t())};return window.addEventListener(`keydown`,n,!0),()=>window.removeEventListener(`keydown`,n,!0)},[e,c,t]);let g=(0,b.useCallback)(()=>{let e=m[o]?.cmd;e&&(t(),e.action())},[o,m,t]),_=(0,b.useCallback)(e=>{let t=m.length,n=e.key===`ArrowDown`||e.ctrlKey&&e.key===`n`,r=e.key===`ArrowUp`||e.ctrlKey&&e.key===`p`;if(n||r){if(e.preventDefault(),t===0)return;s(e=>(e+(n?1:-1)+t)%t);return}if(e.key===`Enter`){e.preventDefault(),g();return}},[g,m.length]);if(!c)return null;let v=e&&u,x=(e,n,r)=>{let{cmd:i,indices:a}=e;return(0,y.jsxs)(`button`,{id:`${p}-${i.id}`,type:`button`,role:`option`,"aria-selected":n===o,className:rp(fC,n===o&&`bg-foreground/10 text-foreground`),onMouseMove:()=>{n!==o&&s(n)},onClick:()=>{t(),i.action()},children:[i.icon?(0,y.jsx)(`span`,{className:`shrink-0 text-muted-foreground/70`,children:i.icon}):(0,y.jsx)(`span`,{className:`w-4 shrink-0`}),(0,y.jsx)(`span`,{className:`flex-1 truncate text-left`,children:(0,y.jsx)(vC,{label:i.label,indices:a})}),r?(0,y.jsx)(`span`,{className:`shrink-0 text-[10px] uppercase tracking-wide text-muted-foreground/50`,children:i.category}):null,i.checked?(0,y.jsx)(dd,{"aria-label":`active`,className:`size-3.5 shrink-0`}):null,i.shortcut?(0,y.jsx)(`kbd`,{className:`shrink-0 rounded border border-border/40 bg-muted/30 px-1.5 py-0.5 font-mono text-[10px] text-muted-foreground/70`,children:i.shortcut}):null]},i.id)};return(0,y.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-start justify-center pt-[18vh]`,children:[(0,y.jsx)(`div`,{"data-open":v||void 0,"data-closed":!v||void 0,className:rp(Ux),onClick:t}),(0,y.jsxs)(`div`,{role:`dialog`,"aria-label":`command palette`,"aria-modal":!0,"data-open":v||void 0,"data-closed":!v||void 0,className:rp(`relative z-10 flex max-h-[400px] w-[520px] max-w-[calc(100vw-2rem)] flex-col overflow-hidden rounded-xl`,Vx,Wx),children:[(0,y.jsxs)(`div`,{className:`flex items-center border-b border-border/40 px-3`,children:[(0,y.jsx)(Td,{className:`size-4 shrink-0 text-muted-foreground/60`}),(0,y.jsx)(`input`,{ref:f,autoFocus:!0,type:`text`,value:i,onChange:e=>a(e.target.value),onKeyDown:_,placeholder:`Type a command…`,"aria-label":`search commands`,"aria-activedescendant":m[o]?`${p}-${m[o].cmd.id}`:void 0,"aria-controls":p,"aria-expanded":!0,"aria-haspopup":`listbox`,role:`combobox`,className:`h-10 w-full bg-transparent px-2.5 text-sm text-foreground outline-none placeholder:text-muted-foreground/70`})]}),(0,y.jsx)(`div`,{id:p,role:`listbox`,className:`flex-1 overflow-y-auto overscroll-contain p-1.5 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden`,children:m.length===0?(0,y.jsxs)(`div`,{className:`px-2.5 py-6 text-center text-sm text-muted-foreground/70`,children:[`No commands match “`,i,`”`]}):i?m.map((e,t)=>x(e,t,!0)):h.map(e=>(0,y.jsxs)(`div`,{role:`group`,"aria-label":e.category,children:[(0,y.jsx)(`div`,{className:`px-2.5 pb-1 pt-2 text-[10px] font-medium uppercase tracking-wide text-muted-foreground/50`,children:e.category}),e.entries.map(({entry:e,index:t})=>x(e,t,!1))]},e.category))}),(0,y.jsxs)(`div`,{className:`flex items-center gap-3 border-t border-border/40 px-3 py-1.5 text-[10px] text-muted-foreground/60`,children:[(0,y.jsx)(yC,{keys:`↑↓`,label:`navigate`}),(0,y.jsx)(yC,{keys:`↵`,label:`run`}),(0,y.jsx)(yC,{keys:`esc`,label:`close`}),(0,y.jsxs)(`span`,{className:`ml-auto`,children:[m.length,` `,m.length===1?`command`:`commands`]})]})]})]})},xC=e=>{let t=[],n=[],r=[],i=()=>{let e=Math.max(n.length,r.length);for(let i=0;i<e;i+=1)t.push({left:n[i]??null,right:r[i]??null});n=[],r=[]};for(let a of e.lines){if(a.type===`del`){n.push(a);continue}if(a.type===`add`){r.push(a);continue}i(),t.push({left:a,right:a})}return i(),t},SC=e=>e.type===`del`?e.oldLine===null?null:{side:`old`,lineNumber:e.oldLine}:e.newLine===null?null:{side:`new`,lineNumber:e.newLine},CC=e=>`${e.side}:${e.lineNumber}`,wC=e=>{let t=[],n=new Map;return e.forEach((e,r)=>{for(let i of e.lines){let e=SC(i);if(!e)continue;let a={target:e,hunkIndex:r,order:t.length};t.push(a),n.set(CC(e),a)}}),{ordered:t,byKey:n}},TC=(e,t)=>{let n=t;for(let r=t.order+1;r<e.ordered.length&&e.ordered[r].hunkIndex===t.hunkIndex;r+=1)n=e.ordered[r];return n},EC=(e,t)=>{let n=t;for(let r=t.order-1;r>=0&&e.ordered[r].hunkIndex===t.hunkIndex;--r)n=e.ordered[r];return n},DC=(e,t,n)=>{let r=e.byKey.get(CC(t)),i=e.byKey.get(CC(n));if(!r||!i)return null;let a=r.order<=i.order?r:i,o=r.order<=i.order?i:r;return a.hunkIndex!==o.hunkIndex&&(a===r?o=TC(e,r):a=EC(e,r)),{start:a.target,end:o.target}},OC=(e,t)=>{let n=new Set,r=e.byKey.get(CC(t.start)),i=e.byKey.get(CC(t.end));if(!r||!i||r.order>i.order)return n;for(let t=r.order;t<=i.order;t+=1)n.add(CC(e.ordered[t].target));return n},kC=64*1024,AC=1*1024*1024,jC=4*1024,MC=1024,NC=1e3,PC=1e3;Object.freeze({status:`aborted`});function $(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,`_zod`,{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,`name`,{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,`init`,{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,`name`,{value:e}),o}var FC=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},IC=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}},LC={};function RC(e){return e&&Object.assign(LC,e),LC}function zC(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function BC(e,t){return typeof t==`bigint`?t.toString():t}function VC(e){return{get value(){{let t=e();return Object.defineProperty(this,`value`,{value:t}),t}throw Error(`cached value already set`)}}}function HC(e){return e==null}function UC(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function WC(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=t.toString(),i=(r.split(`.`)[1]||``).length;if(i===0&&/\d?e-\d?/.test(r)){let e=r.match(/\d?e-(\d?)/);e?.[1]&&(i=Number.parseInt(e[1]))}let a=n>i?n:i;return Number.parseInt(e.toFixed(a).replace(`.`,``))%Number.parseInt(t.toFixed(a).replace(`.`,``))/10**a}var GC=Symbol(`evaluating`);function KC(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==GC)return r===void 0&&(r=GC,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function qC(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function JC(...e){let t={};for(let n of e)Object.assign(t,Object.getOwnPropertyDescriptors(n));return Object.defineProperties({},t)}function YC(e){return JSON.stringify(e)}function XC(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var ZC=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function QC(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var $C=VC(()=>{if(typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function ew(e){if(QC(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(QC(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function tw(e){return ew(e)?{...e}:Array.isArray(e)?[...e]:e}var nw=new Set([`string`,`number`,`symbol`]);function rw(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function iw(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function aw(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function ow(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}var sw={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function cw(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return iw(e,JC(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return qC(this,`shape`,e),e},checks:[]}))}function lw(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return iw(e,JC(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return qC(this,`shape`,r),r},checks:[]}))}function uw(e,t){if(!ew(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return iw(e,JC(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return qC(this,`shape`,n),n}}))}function dw(e,t){if(!ew(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return iw(e,JC(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return qC(this,`shape`,n),n}}))}function fw(e,t){return iw(e,JC(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return qC(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:[]}))}function pw(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return iw(t,JC(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return qC(this,`shape`,i),i},checks:[]}))}function mw(e,t,n){return iw(t,JC(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return qC(this,`shape`,i),i}}))}function hw(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function gw(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function _w(e){return typeof e==`string`?e:e?.message}function vw(e,t,n){let r={...e,path:e.path??[]};return e.message||(r.message=_w(e.inst?._zod.def?.error?.(e))??_w(t?.error?.(e))??_w(n.customError?.(e))??_w(n.localeError?.(e))??`Invalid input`),delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function yw(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function bw(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var xw=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,`_zod`,{value:e._zod,enumerable:!1}),Object.defineProperty(e,`issues`,{value:t,enumerable:!1}),e.message=JSON.stringify(t,BC,2),Object.defineProperty(e,`toString`,{value:()=>e.message,enumerable:!1})},Sw=$(`$ZodError`,xw),Cw=$(`$ZodError`,xw,{Parent:Error});function ww(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function Tw(e,t=e=>e.message){let n={_errors:[]},r=e=>{for(let i of e.issues)if(i.code===`invalid_union`&&i.errors.length)i.errors.map(e=>r({issues:e}));else if(i.code===`invalid_key`)r({issues:i.issues});else if(i.code===`invalid_element`)r({issues:i.issues});else if(i.path.length===0)n._errors.push(t(i));else{let e=n,r=0;for(;r<i.path.length;){let n=i.path[r];r===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(e),n}var Ew=e=>(t,n,r,i)=>{let a=r?Object.assign(r,{async:!1}):{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new FC;if(o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>vw(e,a,RC())));throw ZC(t,i?.callee),t}return o.value},Dw=e=>async(t,n,r,i)=>{let a=r?Object.assign(r,{async:!0}):{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>vw(e,a,RC())));throw ZC(t,i?.callee),t}return o.value},Ow=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new FC;return a.issues.length?{success:!1,error:new(e??Sw)(a.issues.map(e=>vw(e,i,RC())))}:{success:!0,data:a.value}},kw=Ow(Cw),Aw=e=>async(t,n,r)=>{let i=r?Object.assign(r,{async:!0}):{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>vw(e,i,RC())))}:{success:!0,data:a.value}},jw=Aw(Cw),Mw=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return Ew(e)(t,n,i)},Nw=e=>(t,n,r)=>Ew(e)(t,n,r),Pw=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return Dw(e)(t,n,i)},Fw=e=>async(t,n,r)=>Dw(e)(t,n,r),Iw=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return Ow(e)(t,n,i)},Lw=e=>(t,n,r)=>Ow(e)(t,n,r),Rw=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return Aw(e)(t,n,i)},zw=e=>async(t,n,r)=>Aw(e)(t,n,r),Bw=/^[cC][^\s-]{8,}$/,Vw=/^[0-9a-z]+$/,Hw=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Uw=/^[0-9a-vA-V]{20}$/,Ww=/^[A-Za-z0-9]{27}$/,Gw=/^[a-zA-Z0-9_-]{21}$/,Kw=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,qw=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Jw=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Yw=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Xw=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function Zw(){return new RegExp(Xw,`u`)}var Qw=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,$w=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,eT=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,tT=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,nT=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,rT=/^[A-Za-z0-9_-]*$/,iT=/^\+[1-9]\d{6,14}$/,aT=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`,oT=RegExp(`^${aT}$`);function sT(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function cT(e){return RegExp(`^${sT(e)}$`)}function lT(e){let t=sT({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${aT}T(?:${r})$`)}var uT=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},dT=/^-?\d+$/,fT=/^-?\d+(?:\.\d+)?$/,pT=/^(?:true|false)$/i,mT=/^[^A-Z]*$/,hT=/^[^a-z]*$/,gT=$(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),_T={number:`number`,bigint:`bigint`,object:`date`},vT=$(`$ZodCheckLessThan`,(e,t)=>{gT.init(e,t);let n=_T[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),yT=$(`$ZodCheckGreaterThan`,(e,t)=>{gT.init(e,t);let n=_T[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),bT=$(`$ZodCheckMultipleOf`,(e,t)=>{gT.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?n.value%t.value===BigInt(0):WC(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),xT=$(`$ZodCheckNumberFormat`,(e,t)=>{gT.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=sw[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=dT)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),ST=$(`$ZodCheckMaxLength`,(e,t)=>{var n;gT.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!HC(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=yw(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),CT=$(`$ZodCheckMinLength`,(e,t)=>{var n;gT.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!HC(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=yw(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),wT=$(`$ZodCheckLengthEquals`,(e,t)=>{var n;gT.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!HC(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=yw(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),TT=$(`$ZodCheckStringFormat`,(e,t)=>{var n,r;gT.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),ET=$(`$ZodCheckRegex`,(e,t)=>{TT.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),DT=$(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=mT,TT.init(e,t)}),OT=$(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=hT,TT.init(e,t)}),kT=$(`$ZodCheckIncludes`,(e,t)=>{gT.init(e,t);let n=rw(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),AT=$(`$ZodCheckStartsWith`,(e,t)=>{gT.init(e,t);let n=RegExp(`^${rw(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),jT=$(`$ZodCheckEndsWith`,(e,t)=>{gT.init(e,t);let n=RegExp(`.*${rw(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),MT=$(`$ZodCheckOverwrite`,(e,t)=>{gT.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),NT=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
|
|
75
|
+
`,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{get promptLabel(){return ua.get()},set promptLabel(e){ua.set(e)},get tooMuchOutput(){return fa.get()},set tooMuchOutput(e){fa.set(e)}}}_verifyIntegers(...e){for(Qu of e)if(Qu===1/0||isNaN(Qu)||Qu%1!=0)throw Error(`This API only accepts integers`)}_verifyPositiveIntegers(...e){for(Qu of e)if(Qu&&(Qu===1/0||isNaN(Qu)||Qu%1!=0||Qu<0))throw Error(`This API only accepts positive integers`)}},ed=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),td=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),nd=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),rd=e=>{let t=nd(e);return t.charAt(0).toUpperCase()+t.slice(1)},id={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},ad=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},od=(0,b.createContext)({}),sd=()=>(0,b.useContext)(od),cd=(0,b.forwardRef)(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>{let{size:l=24,strokeWidth:u=2,absoluteStrokeWidth:d=!1,color:f=`currentColor`,className:p=``}=sd()??{},m=r??d?Number(n??u)*24/Number(t??l):n??u;return(0,b.createElement)(`svg`,{ref:c,...id,width:t??l??id.width,height:t??l??id.height,stroke:e??f,strokeWidth:m,className:ed(`lucide`,p,i),...!a&&!ad(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,b.createElement)(e,t)),...Array.isArray(a)?a:[a]])}),ld=(e,t)=>{let n=(0,b.forwardRef)(({className:n,...r},i)=>(0,b.createElement)(cd,{ref:i,iconNode:t,className:ed(`lucide-${td(rd(e))}`,`lucide-${e}`,n),...r}));return n.displayName=rd(e),n},ud=ld(`binary`,[[`rect`,{x:`14`,y:`14`,width:`4`,height:`6`,rx:`2`,key:`p02svl`}],[`rect`,{x:`6`,y:`4`,width:`4`,height:`6`,rx:`2`,key:`xm4xkj`}],[`path`,{d:`M6 20h4`,key:`1i6q5t`}],[`path`,{d:`M14 10h4`,key:`ru81e7`}],[`path`,{d:`M6 14h2v6`,key:`16z9wg`}],[`path`,{d:`M14 4h2v6`,key:`1idq9u`}]]),dd=ld(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),fd=ld(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),pd=ld(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),md=ld(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),hd=ld(`file-diff`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M9 10h6`,key:`9gxzsh`}],[`path`,{d:`M12 13V7`,key:`h0r20n`}],[`path`,{d:`M9 17h6`,key:`r8uit2`}]]),gd=ld(`file-exclamation-point`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),_d=ld(`loader`,[[`path`,{d:`M12 2v4`,key:`3427ic`}],[`path`,{d:`m16.2 7.8 2.9-2.9`,key:`r700ao`}],[`path`,{d:`M18 12h4`,key:`wj9ykh`}],[`path`,{d:`m16.2 16.2 2.9 2.9`,key:`1bxg5t`}],[`path`,{d:`M12 18v4`,key:`jadmvz`}],[`path`,{d:`m4.9 19.1 2.9-2.9`,key:`bwix9q`}],[`path`,{d:`M2 12h4`,key:`j09sii`}],[`path`,{d:`m4.9 4.9 2.9 2.9`,key:`giyufr`}]]),vd=ld(`message-square-plus`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M12 8v6`,key:`1ib9pf`}],[`path`,{d:`M9 11h6`,key:`1fldmi`}]]),yd=ld(`message-square`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]),bd=ld(`minus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),xd=ld(`monitor-cog`,[[`path`,{d:`M12 17v4`,key:`1riwvh`}],[`path`,{d:`m14.305 7.53.923-.382`,key:`1mlnsw`}],[`path`,{d:`m15.228 4.852-.923-.383`,key:`82mpwg`}],[`path`,{d:`m16.852 3.228-.383-.924`,key:`ln4sir`}],[`path`,{d:`m16.852 8.772-.383.923`,key:`1dejw0`}],[`path`,{d:`m19.148 3.228.383-.924`,key:`192kgf`}],[`path`,{d:`m19.53 9.696-.382-.924`,key:`fiavlr`}],[`path`,{d:`m20.772 4.852.924-.383`,key:`1j8mgp`}],[`path`,{d:`m20.772 7.148.924.383`,key:`zix9be`}],[`path`,{d:`M22 13v2a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7`,key:`1tnzv8`}],[`path`,{d:`M8 21h8`,key:`1ev6f3`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}]]),Sd=ld(`pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),Cd=ld(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),wd=ld(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),Td=ld(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),Ed=ld(`send`,[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]),Dd=ld(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),Od=ld(`trash-2`,[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]),kd=ld(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]);function Ad(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=Ad(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function jd(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=Ad(e))&&(r&&(r+=` `),r+=t);return r}var Md=(e,t)=>{let n=Array(e.length+t.length);for(let t=0;t<e.length;t++)n[t]=e[t];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},Nd=(e,t)=>({classGroupId:e,validator:t}),Pd=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),Fd=`-`,Id=[],Ld=`arbitrary..`,Rd=e=>{let t=Vd(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return Bd(e);let n=e.split(Fd);return zd(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?Md(i,t):t:i||Id}return n[e]||Id}}},zd=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=zd(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(Fd):e.slice(t).join(Fd),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},Bd=e=>e.slice(1,-1).indexOf(`:`)===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(`:`),r=t.slice(0,n);return r?Ld+r:void 0})(),Vd=e=>{let{theme:t,classGroups:n}=e;return Hd(n,t)},Hd=(e,t)=>{let n=Pd();for(let r in e){let i=e[r];Ud(i,n,r,t)}return n},Ud=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];Wd(i,t,n,r)}},Wd=(e,t,n,r)=>{if(typeof e==`string`){Gd(e,t,n);return}if(typeof e==`function`){Kd(e,t,n,r);return}qd(e,t,n,r)},Gd=(e,t,n)=>{let r=e===``?t:Jd(t,e);r.classGroupId=n},Kd=(e,t,n,r)=>{if(Yd(e)){Ud(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(Nd(n,e))},qd=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];Ud(o,Jd(t,a),n,r)}},Jd=(e,t)=>{let n=e,r=t.split(Fd),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=Pd(),n.nextPart.set(t,i)),n=i}return n},Yd=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,Xd=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),i=(i,a)=>{n[i]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];if(t!==void 0)return t;if((t=r[e])!==void 0)return i(e,t),t},set(e,t){e in n?n[e]=t:i(e,t)}}},Zd=`!`,Qd=`:`,$d=[],ef=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),tf=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t=[],n=0,r=0,i=0,a,o=e.length;for(let s=0;s<o;s++){let o=e[s];if(n===0&&r===0){if(o===Qd){t.push(e.slice(i,s)),i=s+1;continue}if(o===`/`){a=s;continue}}o===`[`?n++:o===`]`?n--:o===`(`?r++:o===`)`&&r--}let s=t.length===0?e:e.slice(i),c=s,l=!1;s.endsWith(Zd)?(c=s.slice(0,-1),l=!0):s.startsWith(Zd)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return ef(t,l,c,u)};if(t){let e=t+Qd,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):ef($d,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},nf=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{let n=[],r=[];for(let i=0;i<e.length;i++){let a=e[i],o=a[0]===`[`,s=t.has(a);o||s?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(a)):r.push(a)}return r.length>0&&(r.sort(),n.push(...r)),n}},rf=e=>({cache:Xd(e.cacheSize),parseClassName:tf(e),sortModifiers:nf(e),...Rd(e)}),af=/\s+/,of=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a}=t,o=[],s=e.trim().split(af),c=``;for(let e=s.length-1;e>=0;--e){let t=s[e],{isExternal:l,modifiers:u,hasImportantModifier:d,baseClassName:f,maybePostfixModifierPosition:p}=n(t);if(l){c=t+(c.length>0?` `+c:c);continue}let m=!!p,h=r(m?f.substring(0,p):f);if(!h){if(!m){c=t+(c.length>0?` `+c:c);continue}if(h=r(f),!h){c=t+(c.length>0?` `+c:c);continue}m=!1}let g=u.length===0?``:u.length===1?u[0]:a(u).join(`:`),_=d?g+Zd:g,v=_+h;if(o.indexOf(v)>-1)continue;o.push(v);let y=i(h,m);for(let e=0;e<y.length;++e){let t=y[e];o.push(_+t)}c=t+(c.length>0?` `+c:c)}return c},sf=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=cf(n))&&(i&&(i+=` `),i+=r);return i},cf=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=cf(e[r]))&&(n&&(n+=` `),n+=t);return n},lf=(e,...t)=>{let n,r,i,a,o=o=>(n=rf(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)),s=e=>{let t=r(e);if(t)return t;let a=of(e,n);return i(e,a),a};return a=o,(...e)=>a(sf(...e))},uf=[],df=e=>{let t=t=>t[e]||uf;return t.isThemeGetter=!0,t},ff=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,pf=/^\((?:(\w[\w-]*):)?(.+)\)$/i,mf=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,hf=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,gf=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,_f=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,vf=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,yf=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,bf=e=>mf.test(e),xf=e=>!!e&&!Number.isNaN(Number(e)),Sf=e=>!!e&&Number.isInteger(Number(e)),Cf=e=>e.endsWith(`%`)&&xf(e.slice(0,-1)),wf=e=>hf.test(e),Tf=()=>!0,Ef=e=>gf.test(e)&&!_f.test(e),Df=()=>!1,Of=e=>vf.test(e),kf=e=>yf.test(e),Af=e=>!J(e)&&!Y(e),jf=e=>Kf(e,Xf,Df),J=e=>ff.test(e),Mf=e=>Kf(e,Zf,Ef),Nf=e=>Kf(e,Qf,xf),Pf=e=>Kf(e,ep,Tf),Ff=e=>Kf(e,$f,Df),If=e=>Kf(e,Jf,Df),Lf=e=>Kf(e,Yf,kf),Rf=e=>Kf(e,tp,Of),Y=e=>pf.test(e),zf=e=>qf(e,Zf),Bf=e=>qf(e,$f),Vf=e=>qf(e,Jf),Hf=e=>qf(e,Xf),Uf=e=>qf(e,Yf),Wf=e=>qf(e,tp,!0),Gf=e=>qf(e,ep,!0),Kf=(e,t,n)=>{let r=ff.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},qf=(e,t,n=!1)=>{let r=pf.exec(e);return r?r[1]?t(r[1]):n:!1},Jf=e=>e===`position`||e===`percentage`,Yf=e=>e===`image`||e===`url`,Xf=e=>e===`length`||e===`size`||e===`bg-size`,Zf=e=>e===`length`,Qf=e=>e===`number`,$f=e=>e===`family-name`,ep=e=>e===`number`||e===`weight`,tp=e=>e===`shadow`,np=lf(()=>{let e=df(`color`),t=df(`font`),n=df(`text`),r=df(`font-weight`),i=df(`tracking`),a=df(`leading`),o=df(`breakpoint`),s=df(`container`),c=df(`spacing`),l=df(`radius`),u=df(`shadow`),d=df(`inset-shadow`),f=df(`text-shadow`),p=df(`drop-shadow`),m=df(`blur`),h=df(`perspective`),g=df(`aspect`),_=df(`ease`),v=df(`animate`),y=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],b=()=>[`center`,`top`,`bottom`,`left`,`right`,`top-left`,`left-top`,`top-right`,`right-top`,`bottom-right`,`right-bottom`,`bottom-left`,`left-bottom`],x=()=>[...b(),Y,J],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[Y,J,c],T=()=>[bf,`full`,`auto`,...w()],E=()=>[Sf,`none`,`subgrid`,Y,J],D=()=>[`auto`,{span:[`full`,Sf,Y,J]},Sf,Y,J],O=()=>[Sf,`auto`,Y,J],k=()=>[`auto`,`min`,`max`,`fr`,Y,J],A=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],j=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],M=()=>[`auto`,...w()],N=()=>[bf,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],P=()=>[bf,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],F=()=>[bf,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],I=()=>[e,Y,J],L=()=>[...b(),Vf,If,{position:[Y,J]}],R=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],z=()=>[`auto`,`cover`,`contain`,Hf,jf,{size:[Y,J]}],ee=()=>[Cf,zf,Mf],B=()=>[``,`none`,`full`,l,Y,J],te=()=>[``,xf,zf,Mf],V=()=>[`solid`,`dashed`,`dotted`,`double`],H=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],ne=()=>[xf,Cf,Vf,If],U=()=>[``,`none`,m,Y,J],re=()=>[`none`,xf,Y,J],W=()=>[`none`,xf,Y,J],ie=()=>[xf,Y,J],ae=()=>[bf,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[wf],breakpoint:[wf],color:[Tf],container:[wf],"drop-shadow":[wf],ease:[`in`,`out`,`in-out`],font:[Af],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[wf],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[wf],shadow:[wf],spacing:[`px`,xf],text:[wf],"text-shadow":[wf],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,bf,J,Y,g]}],container:[`container`],columns:[{columns:[xf,J,Y,s]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"break-inside":[{"break-inside":[`auto`,`avoid`,`avoid-page`,`avoid-column`]}],"box-decoration":[{"box-decoration":[`slice`,`clone`]}],box:[{box:[`border`,`content`]}],display:[`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`table`,`inline-table`,`table-caption`,`table-cell`,`table-column`,`table-column-group`,`table-footer-group`,`table-header-group`,`table-row-group`,`table-row`,`flow-root`,`grid`,`inline-grid`,`contents`,`list-item`,`hidden`],sr:[`sr-only`,`not-sr-only`],float:[{float:[`right`,`left`,`none`,`start`,`end`]}],clear:[{clear:[`left`,`right`,`both`,`none`,`start`,`end`]}],isolation:[`isolate`,`isolation-auto`],"object-fit":[{object:[`contain`,`cover`,`fill`,`none`,`scale-down`]}],"object-position":[{object:x()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{"inset-s":T(),start:T()}],end:[{"inset-e":T(),end:T()}],"inset-bs":[{"inset-bs":T()}],"inset-be":[{"inset-be":T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[Sf,`auto`,Y,J]}],basis:[{basis:[bf,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[xf,bf,`auto`,`initial`,`none`,J]}],grow:[{grow:[``,xf,Y,J]}],shrink:[{shrink:[``,xf,Y,J]}],order:[{order:[Sf,`first`,`last`,`none`,Y,J]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":k()}],"auto-rows":[{"auto-rows":k()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...A(),`normal`]}],"justify-items":[{"justify-items":[...j(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...j()]}],"align-content":[{content:[`normal`,...A()]}],"align-items":[{items:[...j(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...j(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":A()}],"place-items":[{"place-items":[...j(),`baseline`]}],"place-self":[{"place-self":[`auto`,...j()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pbs:[{pbs:w()}],pbe:[{pbe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:M()}],mx:[{mx:M()}],my:[{my:M()}],ms:[{ms:M()}],me:[{me:M()}],mbs:[{mbs:M()}],mbe:[{mbe:M()}],mt:[{mt:M()}],mr:[{mr:M()}],mb:[{mb:M()}],ml:[{ml:M()}],"space-x":[{"space-x":w()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":w()}],"space-y-reverse":[`space-y-reverse`],size:[{size:N()}],"inline-size":[{inline:[`auto`,...P()]}],"min-inline-size":[{"min-inline":[`auto`,...P()]}],"max-inline-size":[{"max-inline":[`none`,...P()]}],"block-size":[{block:[`auto`,...F()]}],"min-block-size":[{"min-block":[`auto`,...F()]}],"max-block-size":[{"max-block":[`none`,...F()]}],w:[{w:[s,`screen`,...N()]}],"min-w":[{"min-w":[s,`screen`,`none`,...N()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...N()]}],h:[{h:[`screen`,`lh`,...N()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...N()]}],"max-h":[{"max-h":[`screen`,`lh`,...N()]}],"font-size":[{text:[`base`,n,zf,Mf]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,Gf,Pf]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,Cf,J]}],"font-family":[{font:[Bf,Ff,t]}],"font-features":[{"font-features":[J]}],"fvn-normal":[`normal-nums`],"fvn-ordinal":[`ordinal`],"fvn-slashed-zero":[`slashed-zero`],"fvn-figure":[`lining-nums`,`oldstyle-nums`],"fvn-spacing":[`proportional-nums`,`tabular-nums`],"fvn-fraction":[`diagonal-fractions`,`stacked-fractions`],tracking:[{tracking:[i,Y,J]}],"line-clamp":[{"line-clamp":[xf,`none`,Y,Nf]}],leading:[{leading:[a,...w()]}],"list-image":[{"list-image":[`none`,Y,J]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,Y,J]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:I()}],"text-color":[{text:I()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...V(),`wavy`]}],"text-decoration-thickness":[{decoration:[xf,`from-font`,`auto`,Y,Mf]}],"text-decoration-color":[{decoration:I()}],"underline-offset":[{"underline-offset":[xf,`auto`,Y,J]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:w()}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,Y,J]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],wrap:[{wrap:[`break-word`,`anywhere`,`normal`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,Y,J]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:L()}],"bg-repeat":[{bg:R()}],"bg-size":[{bg:z()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},Sf,Y,J],radial:[``,Y,J],conic:[Sf,Y,J]},Uf,Lf]}],"bg-color":[{bg:I()}],"gradient-from-pos":[{from:ee()}],"gradient-via-pos":[{via:ee()}],"gradient-to-pos":[{to:ee()}],"gradient-from":[{from:I()}],"gradient-via":[{via:I()}],"gradient-to":[{to:I()}],rounded:[{rounded:B()}],"rounded-s":[{"rounded-s":B()}],"rounded-e":[{"rounded-e":B()}],"rounded-t":[{"rounded-t":B()}],"rounded-r":[{"rounded-r":B()}],"rounded-b":[{"rounded-b":B()}],"rounded-l":[{"rounded-l":B()}],"rounded-ss":[{"rounded-ss":B()}],"rounded-se":[{"rounded-se":B()}],"rounded-ee":[{"rounded-ee":B()}],"rounded-es":[{"rounded-es":B()}],"rounded-tl":[{"rounded-tl":B()}],"rounded-tr":[{"rounded-tr":B()}],"rounded-br":[{"rounded-br":B()}],"rounded-bl":[{"rounded-bl":B()}],"border-w":[{border:te()}],"border-w-x":[{"border-x":te()}],"border-w-y":[{"border-y":te()}],"border-w-s":[{"border-s":te()}],"border-w-e":[{"border-e":te()}],"border-w-bs":[{"border-bs":te()}],"border-w-be":[{"border-be":te()}],"border-w-t":[{"border-t":te()}],"border-w-r":[{"border-r":te()}],"border-w-b":[{"border-b":te()}],"border-w-l":[{"border-l":te()}],"divide-x":[{"divide-x":te()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":te()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...V(),`hidden`,`none`]}],"divide-style":[{divide:[...V(),`hidden`,`none`]}],"border-color":[{border:I()}],"border-color-x":[{"border-x":I()}],"border-color-y":[{"border-y":I()}],"border-color-s":[{"border-s":I()}],"border-color-e":[{"border-e":I()}],"border-color-bs":[{"border-bs":I()}],"border-color-be":[{"border-be":I()}],"border-color-t":[{"border-t":I()}],"border-color-r":[{"border-r":I()}],"border-color-b":[{"border-b":I()}],"border-color-l":[{"border-l":I()}],"divide-color":[{divide:I()}],"outline-style":[{outline:[...V(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[xf,Y,J]}],"outline-w":[{outline:[``,xf,zf,Mf]}],"outline-color":[{outline:I()}],shadow:[{shadow:[``,`none`,u,Wf,Rf]}],"shadow-color":[{shadow:I()}],"inset-shadow":[{"inset-shadow":[`none`,d,Wf,Rf]}],"inset-shadow-color":[{"inset-shadow":I()}],"ring-w":[{ring:te()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:I()}],"ring-offset-w":[{"ring-offset":[xf,Mf]}],"ring-offset-color":[{"ring-offset":I()}],"inset-ring-w":[{"inset-ring":te()}],"inset-ring-color":[{"inset-ring":I()}],"text-shadow":[{"text-shadow":[`none`,f,Wf,Rf]}],"text-shadow-color":[{"text-shadow":I()}],opacity:[{opacity:[xf,Y,J]}],"mix-blend":[{"mix-blend":[...H(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":H()}],"mask-clip":[{"mask-clip":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]},`mask-no-clip`],"mask-composite":[{mask:[`add`,`subtract`,`intersect`,`exclude`]}],"mask-image-linear-pos":[{"mask-linear":[xf]}],"mask-image-linear-from-pos":[{"mask-linear-from":ne()}],"mask-image-linear-to-pos":[{"mask-linear-to":ne()}],"mask-image-linear-from-color":[{"mask-linear-from":I()}],"mask-image-linear-to-color":[{"mask-linear-to":I()}],"mask-image-t-from-pos":[{"mask-t-from":ne()}],"mask-image-t-to-pos":[{"mask-t-to":ne()}],"mask-image-t-from-color":[{"mask-t-from":I()}],"mask-image-t-to-color":[{"mask-t-to":I()}],"mask-image-r-from-pos":[{"mask-r-from":ne()}],"mask-image-r-to-pos":[{"mask-r-to":ne()}],"mask-image-r-from-color":[{"mask-r-from":I()}],"mask-image-r-to-color":[{"mask-r-to":I()}],"mask-image-b-from-pos":[{"mask-b-from":ne()}],"mask-image-b-to-pos":[{"mask-b-to":ne()}],"mask-image-b-from-color":[{"mask-b-from":I()}],"mask-image-b-to-color":[{"mask-b-to":I()}],"mask-image-l-from-pos":[{"mask-l-from":ne()}],"mask-image-l-to-pos":[{"mask-l-to":ne()}],"mask-image-l-from-color":[{"mask-l-from":I()}],"mask-image-l-to-color":[{"mask-l-to":I()}],"mask-image-x-from-pos":[{"mask-x-from":ne()}],"mask-image-x-to-pos":[{"mask-x-to":ne()}],"mask-image-x-from-color":[{"mask-x-from":I()}],"mask-image-x-to-color":[{"mask-x-to":I()}],"mask-image-y-from-pos":[{"mask-y-from":ne()}],"mask-image-y-to-pos":[{"mask-y-to":ne()}],"mask-image-y-from-color":[{"mask-y-from":I()}],"mask-image-y-to-color":[{"mask-y-to":I()}],"mask-image-radial":[{"mask-radial":[Y,J]}],"mask-image-radial-from-pos":[{"mask-radial-from":ne()}],"mask-image-radial-to-pos":[{"mask-radial-to":ne()}],"mask-image-radial-from-color":[{"mask-radial-from":I()}],"mask-image-radial-to-color":[{"mask-radial-to":I()}],"mask-image-radial-shape":[{"mask-radial":[`circle`,`ellipse`]}],"mask-image-radial-size":[{"mask-radial":[{closest:[`side`,`corner`],farthest:[`side`,`corner`]}]}],"mask-image-radial-pos":[{"mask-radial-at":b()}],"mask-image-conic-pos":[{"mask-conic":[xf]}],"mask-image-conic-from-pos":[{"mask-conic-from":ne()}],"mask-image-conic-to-pos":[{"mask-conic-to":ne()}],"mask-image-conic-from-color":[{"mask-conic-from":I()}],"mask-image-conic-to-color":[{"mask-conic-to":I()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:L()}],"mask-repeat":[{mask:R()}],"mask-size":[{mask:z()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,Y,J]}],filter:[{filter:[``,`none`,Y,J]}],blur:[{blur:U()}],brightness:[{brightness:[xf,Y,J]}],contrast:[{contrast:[xf,Y,J]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,Wf,Rf]}],"drop-shadow-color":[{"drop-shadow":I()}],grayscale:[{grayscale:[``,xf,Y,J]}],"hue-rotate":[{"hue-rotate":[xf,Y,J]}],invert:[{invert:[``,xf,Y,J]}],saturate:[{saturate:[xf,Y,J]}],sepia:[{sepia:[``,xf,Y,J]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,Y,J]}],"backdrop-blur":[{"backdrop-blur":U()}],"backdrop-brightness":[{"backdrop-brightness":[xf,Y,J]}],"backdrop-contrast":[{"backdrop-contrast":[xf,Y,J]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,xf,Y,J]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[xf,Y,J]}],"backdrop-invert":[{"backdrop-invert":[``,xf,Y,J]}],"backdrop-opacity":[{"backdrop-opacity":[xf,Y,J]}],"backdrop-saturate":[{"backdrop-saturate":[xf,Y,J]}],"backdrop-sepia":[{"backdrop-sepia":[``,xf,Y,J]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[``,`all`,`colors`,`opacity`,`shadow`,`transform`,`none`,Y,J]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[xf,`initial`,Y,J]}],ease:[{ease:[`linear`,`initial`,_,Y,J]}],delay:[{delay:[xf,Y,J]}],animate:[{animate:[`none`,v,Y,J]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,Y,J]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:re()}],"rotate-x":[{"rotate-x":re()}],"rotate-y":[{"rotate-y":re()}],"rotate-z":[{"rotate-z":re()}],scale:[{scale:W()}],"scale-x":[{"scale-x":W()}],"scale-y":[{"scale-y":W()}],"scale-z":[{"scale-z":W()}],"scale-3d":[`scale-3d`],skew:[{skew:ie()}],"skew-x":[{"skew-x":ie()}],"skew-y":[{"skew-y":ie()}],transform:[{transform:[Y,J,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:ae()}],"translate-x":[{"translate-x":ae()}],"translate-y":[{"translate-y":ae()}],"translate-z":[{"translate-z":ae()}],"translate-none":[`translate-none`],accent:[{accent:I()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:I()}],"color-scheme":[{scheme:[`normal`,`dark`,`light`,`light-dark`,`only-dark`,`only-light`]}],cursor:[{cursor:[`auto`,`default`,`pointer`,`wait`,`text`,`move`,`help`,`not-allowed`,`none`,`context-menu`,`progress`,`cell`,`crosshair`,`vertical-text`,`alias`,`copy`,`no-drop`,`grab`,`grabbing`,`all-scroll`,`col-resize`,`row-resize`,`n-resize`,`e-resize`,`s-resize`,`w-resize`,`ne-resize`,`nw-resize`,`se-resize`,`sw-resize`,`ew-resize`,`ns-resize`,`nesw-resize`,`nwse-resize`,`zoom-in`,`zoom-out`,Y,J]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mbs":[{"scroll-mbs":w()}],"scroll-mbe":[{"scroll-mbe":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pbs":[{"scroll-pbs":w()}],"scroll-pbe":[{"scroll-pbe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:[`start`,`end`,`center`,`align-none`]}],"snap-stop":[{snap:[`normal`,`always`]}],"snap-type":[{snap:[`none`,`x`,`y`,`both`]}],"snap-strictness":[{snap:[`mandatory`,`proximity`]}],touch:[{touch:[`auto`,`none`,`manipulation`]}],"touch-x":[{"touch-pan":[`x`,`left`,`right`]}],"touch-y":[{"touch-pan":[`y`,`up`,`down`]}],"touch-pz":[`touch-pinch-zoom`],select:[{select:[`none`,`text`,`all`,`auto`]}],"will-change":[{"will-change":[`auto`,`scroll`,`contents`,`transform`,Y,J]}],fill:[{fill:[`none`,...I()]}],"stroke-w":[{stroke:[xf,zf,Mf,Nf]}],stroke:[{stroke:[`none`,...I()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`inset-bs`,`inset-be`,`start`,`end`,`top`,`right`,`bottom`,`left`],"inset-x":[`right`,`left`],"inset-y":[`top`,`bottom`],flex:[`basis`,`grow`,`shrink`],gap:[`gap-x`,`gap-y`],p:[`px`,`py`,`ps`,`pe`,`pbs`,`pbe`,`pt`,`pr`,`pb`,`pl`],px:[`pr`,`pl`],py:[`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mbs`,`mbe`,`mt`,`mr`,`mb`,`ml`],mx:[`mr`,`ml`],my:[`mt`,`mb`],size:[`w`,`h`],"font-size":[`leading`],"fvn-normal":[`fvn-ordinal`,`fvn-slashed-zero`,`fvn-figure`,`fvn-spacing`,`fvn-fraction`],"fvn-ordinal":[`fvn-normal`],"fvn-slashed-zero":[`fvn-normal`],"fvn-figure":[`fvn-normal`],"fvn-spacing":[`fvn-normal`],"fvn-fraction":[`fvn-normal`],"line-clamp":[`display`,`overflow`],rounded:[`rounded-s`,`rounded-e`,`rounded-t`,`rounded-r`,`rounded-b`,`rounded-l`,`rounded-ss`,`rounded-se`,`rounded-ee`,`rounded-es`,`rounded-tl`,`rounded-tr`,`rounded-br`,`rounded-bl`],"rounded-s":[`rounded-ss`,`rounded-es`],"rounded-e":[`rounded-se`,`rounded-ee`],"rounded-t":[`rounded-tl`,`rounded-tr`],"rounded-r":[`rounded-tr`,`rounded-br`],"rounded-b":[`rounded-br`,`rounded-bl`],"rounded-l":[`rounded-tl`,`rounded-bl`],"border-spacing":[`border-spacing-x`,`border-spacing-y`],"border-w":[`border-w-x`,`border-w-y`,`border-w-s`,`border-w-e`,`border-w-bs`,`border-w-be`,`border-w-t`,`border-w-r`,`border-w-b`,`border-w-l`],"border-w-x":[`border-w-r`,`border-w-l`],"border-w-y":[`border-w-t`,`border-w-b`],"border-color":[`border-color-x`,`border-color-y`,`border-color-s`,`border-color-e`,`border-color-bs`,`border-color-be`,`border-color-t`,`border-color-r`,`border-color-b`,`border-color-l`],"border-color-x":[`border-color-r`,`border-color-l`],"border-color-y":[`border-color-t`,`border-color-b`],translate:[`translate-x`,`translate-y`,`translate-none`],"translate-none":[`translate`,`translate-x`,`translate-y`,`translate-z`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`scroll-mbs`,`scroll-mbe`,`scroll-mt`,`scroll-mr`,`scroll-mb`,`scroll-ml`],"scroll-mx":[`scroll-mr`,`scroll-ml`],"scroll-my":[`scroll-mt`,`scroll-mb`],"scroll-p":[`scroll-px`,`scroll-py`,`scroll-ps`,`scroll-pe`,`scroll-pbs`,`scroll-pbe`,`scroll-pt`,`scroll-pr`,`scroll-pb`,`scroll-pl`],"scroll-px":[`scroll-pr`,`scroll-pl`],"scroll-py":[`scroll-pt`,`scroll-pb`],touch:[`touch-x`,`touch-y`,`touch-pz`],"touch-x":[`touch`],"touch-y":[`touch`],"touch-pz":[`touch`]},conflictingClassGroupModifiers:{"font-size":[`leading`]},orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}});function rp(...e){return np(jd(e))}function ip(e){let t=b.useRef(!0);t.current&&(t.current=!1,e())}function ap(){return typeof window<`u`}function op(e){return lp(e)?(e.nodeName||``).toLowerCase():`#document`}function sp(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function cp(e){return((lp(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function lp(e){return ap()?e instanceof Node||e instanceof sp(e).Node:!1}function up(e){return ap()?e instanceof Element||e instanceof sp(e).Element:!1}function dp(e){return ap()?e instanceof HTMLElement||e instanceof sp(e).HTMLElement:!1}function fp(e){return!ap()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof sp(e).ShadowRoot}function pp(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=wp(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function mp(e){return/^(table|td|th)$/.test(op(e))}function hp(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var gp=/transform|translate|scale|rotate|perspective|filter/,_p=/paint|layout|strict|content/,vp=e=>!!e&&e!==`none`,yp;function bp(e){let t=up(e)?wp(e):e;return vp(t.transform)||vp(t.translate)||vp(t.scale)||vp(t.rotate)||vp(t.perspective)||!Sp()&&(vp(t.backdropFilter)||vp(t.filter))||gp.test(t.willChange||``)||_p.test(t.contain||``)}function xp(e){let t=Ep(e);for(;dp(t)&&!Cp(t);){if(bp(t))return t;if(hp(t))return null;t=Ep(t)}return null}function Sp(){return yp??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),yp}function Cp(e){return/^(html|body|#document)$/.test(op(e))}function wp(e){return sp(e).getComputedStyle(e)}function Tp(e){return up(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Ep(e){if(op(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||fp(e)&&e.host||cp(e);return fp(t)?t.host:t}function Dp(e){let t=Ep(e);return Cp(t)?e.ownerDocument?e.ownerDocument.body:e.body:dp(t)&&pp(t)?t:Dp(t)}function Op(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Dp(e),i=r===e.ownerDocument?.body,a=sp(r);if(i){let e=kp(a);return t.concat(a,a.visualViewport||[],pp(r)?r:[],e&&n?Op(e):[])}else return t.concat(r,Op(r,[],n))}function kp(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Ap(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}var jp=typeof navigator<`u`,Mp=Vp(),Np=Up(),Pp=Hp(),Fp=typeof CSS>`u`||!CSS.supports?!1:CSS.supports(`-webkit-backdrop-filter:none`),Ip=Mp.platform===`MacIntel`&&Mp.maxTouchPoints>1?!0:/iP(hone|ad|od)|iOS/.test(Mp.platform);jp&&/firefox/i.test(Pp);var Lp=jp&&/apple/i.test(navigator.vendor);jp&&/Edg/i.test(Pp);var Rp=jp&&/android/i.test(Np)||/android/i.test(Pp),zp=jp&&Np.toLowerCase().startsWith(`mac`)&&!navigator.maxTouchPoints,Bp=Pp.includes(`jsdom/`);function Vp(){if(!jp)return{platform:``,maxTouchPoints:-1};let e=navigator.userAgentData;return e?.platform?{platform:e.platform,maxTouchPoints:navigator.maxTouchPoints}:{platform:navigator.platform??``,maxTouchPoints:navigator.maxTouchPoints??-1}}function Hp(){if(!jp)return``;let e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(({brand:e,version:t})=>`${e}/${t}`).join(` `):navigator.userAgent}function Up(){if(!jp)return``;let e=navigator.userAgentData;return e?.platform?e.platform:navigator.platform??``}function Wp(e){return e?.ownerDocument||document}var X=typeof document<`u`?b.useLayoutEffect:()=>{},Gp={};function Kp(e,t){let n=b.useRef(Gp);return n.current===Gp&&(n.current=e(t)),n}var qp=[];function Jp(e){b.useEffect(e,qp)}var Yp=0,Xp=class e{static create(){return new e}currentId=Yp;start(e,t){this.clear(),this.currentId=setTimeout(()=>{this.currentId=Yp,t()},e)}isStarted(){return this.currentId!==Yp}clear=()=>{this.currentId!==Yp&&(clearTimeout(this.currentId),this.currentId=Yp)};disposeEffect=()=>this.clear};function Zp(){let e=Kp(Xp.create).current;return Jp(e.disposeEffect),e}var Qp=null;globalThis.requestAnimationFrame;var $p=new class{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=e=>{this.isScheduled=!1;let t=this.callbacks,n=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,n>0)for(let n=0;n<t.length;n+=1)t[n]?.(e)};request(e){let t=this.nextId;return this.nextId+=1,this.callbacks.push(e),this.callbacksCount+=1,this.isScheduled||=(requestAnimationFrame(this.tick),!0),t}cancel(e){let t=e-this.startId;t<0||t>=this.callbacks.length||(this.callbacks[t]=null,--this.callbacksCount)}},em=class e{static create(){return new e}static request(e){return $p.request(e)}static cancel(e){return $p.cancel(e)}currentId=Qp;request(e){this.cancel(),this.currentId=$p.request(()=>{this.currentId=Qp,e()})}cancel=()=>{this.currentId!==Qp&&($p.cancel(this.currentId),this.currentId=Qp)};disposeEffect=()=>this.cancel};function tm(){let e=Kp(em.create).current;return Jp(e.disposeEffect),e}function nm(){}var rm=Object.freeze([]),im=Object.freeze({}),am={},om={},sm=``;function cm(e){if(typeof document>`u`)return!1;let t=Wp(e);return sp(t).innerWidth-t.documentElement.clientWidth>0}function lm(e){if(!(typeof CSS<`u`&&CSS.supports&&CSS.supports(`scrollbar-gutter`,`stable`))||typeof document>`u`)return!1;let t=Wp(e),n=t.documentElement,r=t.body,i=pp(n)?n:r,a=i.style.overflowY,o=n.style.scrollbarGutter;n.style.scrollbarGutter=`stable`,i.style.overflowY=`scroll`;let s=i.offsetWidth;i.style.overflowY=`hidden`;let c=i.offsetWidth;return i.style.overflowY=a,n.style.scrollbarGutter=o,s===c}function um(e){let t=Wp(e),n=t.documentElement,r=t.body,i=pp(n)?n:r,a={overflowY:i.style.overflowY,overflowX:i.style.overflowX};return Object.assign(i.style,{overflowY:`hidden`,overflowX:`hidden`}),()=>{Object.assign(i.style,a)}}function dm(e){let t=Wp(e),n=t.documentElement,r=t.body,i=sp(n),a=0,o=0,s=!1,c=em.create();if(Fp&&(i.visualViewport?.scale??1)!==1)return()=>{};function l(){let t=i.getComputedStyle(n),c=i.getComputedStyle(r),l=(t.scrollbarGutter||``).includes(`both-edges`)?`stable both-edges`:`stable`;a=n.scrollTop,o=n.scrollLeft,am={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},sm=n.style.scrollBehavior,om={position:r.style.position,height:r.style.height,width:r.style.width,boxSizing:r.style.boxSizing,overflowY:r.style.overflowY,overflowX:r.style.overflowX,scrollBehavior:r.style.scrollBehavior};let u=n.scrollHeight>n.clientHeight,d=n.scrollWidth>n.clientWidth,f=t.overflowY===`scroll`||c.overflowY===`scroll`,p=t.overflowX===`scroll`||c.overflowX===`scroll`,m=Math.max(0,i.innerWidth-r.clientWidth),h=Math.max(0,i.innerHeight-r.clientHeight),g=parseFloat(c.marginTop)+parseFloat(c.marginBottom),_=parseFloat(c.marginLeft)+parseFloat(c.marginRight),v=pp(n)?n:r;if(s=lm(e),s){n.style.scrollbarGutter=l,v.style.overflowY=`hidden`,v.style.overflowX=`hidden`;return}Object.assign(n.style,{scrollbarGutter:l,overflowY:`hidden`,overflowX:`hidden`}),(u||f)&&(n.style.overflowY=`scroll`),(d||p)&&(n.style.overflowX=`scroll`),Object.assign(r.style,{position:`relative`,height:g||h?`calc(100dvh - ${g+h}px)`:`100dvh`,width:_||m?`calc(100vw - ${_+m}px)`:`100vw`,boxSizing:`border-box`,overflow:`hidden`,scrollBehavior:`unset`}),r.scrollTop=a,r.scrollLeft=o,n.setAttribute(`data-base-ui-scroll-locked`,``),n.style.scrollBehavior=`unset`}function u(){Object.assign(n.style,am),Object.assign(r.style,om),s||(n.scrollTop=a,n.scrollLeft=o,n.removeAttribute(`data-base-ui-scroll-locked`),n.style.scrollBehavior=sm)}function d(){u(),c.request(l)}l();let f=Ap(i,`resize`,d);return()=>{c.cancel(),u(),typeof i.removeEventListener==`function`&&f()}}var fm=new class{lockCount=0;restore=null;timeoutLock=Xp.create();timeoutUnlock=Xp.create();acquire(e){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(e)),this.release}release=()=>{--this.lockCount,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)};lock(e){if(this.lockCount===0||this.restore!==null)return;let t=Wp(e).documentElement,n=sp(t).getComputedStyle(t).overflowY;if(n===`hidden`||n===`clip`){this.restore=nm;return}let r=Ip||!cm(e);this.restore=r?um(e):dm(e)}};function pm(e=!0,t=null){X(()=>{if(e)return fm.acquire(t)},[e,t])}function mm(e){e.preventDefault(),e.stopPropagation()}function hm(e){return`nativeEvent`in e}function gm(e){return e.pointerType===``&&e.isTrusted?!0:Rp&&e.pointerType?e.type===`click`&&e.buttons===1:e.detail===0&&!e.pointerType}function _m(e){return Bp?!1:!Rp&&e.width===0&&e.height===0||Rp&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType===`mouse`||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType===`touch`}function vm(e,t){let n=[`mouse`,`pen`];return t||n.push(``,void 0),n.includes(e)}function ym(e){let t=e.type;return t===`click`||t===`mousedown`||t===`keydown`||t===`keyup`}function bm(e,t){return t!=null&&!vm(t)?0:typeof e==`function`?e():e}function xm(e,t,n){let r=bm(e,n);return typeof r==`number`?r:r?.[t]}function Sm(e){return typeof e==`function`?e():e}function Cm(e,t){return t||e===`click`||e===`mousedown`}var wm=`none`,Tm=`trigger-press`,Em=`trigger-hover`,Dm=`trigger-focus`,Om=`outside-press`,km=`item-press`,Am=`focus-out`,jm=`escape-key`,Mm=`list-navigation`,Nm=`cancel-open`,Pm=`disabled`,Fm=`imperative-action`,Im=`window-resize`;function Lm(e,t,n,r){let i=!1,a=!1,o=r??im;return{reason:e,event:t??new Event(`base-ui`),cancel(){i=!0},allowPropagation(){a=!0},get isCanceled(){return i},get isPropagationAllowed(){return a},trigger:n,...o}}var Rm=b.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new Xp,currentIdRef:{current:null},currentContextRef:{current:null}});function zm(e){let{children:t,delay:n,timeoutMs:r=0}=e,i=b.useRef(n),a=b.useRef(n),o=b.useRef(null),s=b.useRef(null),c=Zp();return(0,y.jsx)(Rm.Provider,{value:b.useMemo(()=>({hasProvider:!0,delayRef:i,initialDelayRef:a,currentIdRef:o,timeoutMs:r,currentContextRef:s,timeout:c}),[r,c]),children:t})}function Bm(e,t={open:!1}){let n=`rootStore`in e?e.rootStore:e,r=n.useState(`floatingId`),{open:i}=t,{currentIdRef:a,delayRef:o,timeoutMs:s,initialDelayRef:c,currentContextRef:l,hasProvider:u,timeout:d}=b.useContext(Rm),[f,p]=b.useState(!1);return X(()=>{function e(){p(!1),l.current?.setIsInstantPhase(!1),a.current=null,l.current=null,o.current=c.current}if(a.current&&!i&&a.current===r){if(p(!1),s){let t=r;return d.start(s,()=>{n.select(`open`)||a.current&&a.current!==t||e()}),()=>{d.clear()}}e()}},[i,r,a,o,s,c,l,d,n]),X(()=>{if(!i)return;let e=l.current,t=a.current;d.clear(),l.current={onOpenChange:n.setOpen,setIsInstantPhase:p},a.current=r,o.current={open:0,close:xm(c.current,`close`)},t!==null&&t!==r?(p(!0),e?.setIsInstantPhase(!0),e?.onOpenChange(!1,Lm(wm))):(p(!1),e?.setIsInstantPhase(!1))},[i,r,n,a,o,s,c,l,d]),X(()=>()=>{l.current=null},[l]),b.useMemo(()=>({hasProvider:u,delayRef:o,isInstantPhase:f}),[u,o,f])}function Vm(...e){return()=>{for(let t=0;t<e.length;t+=1){let n=e[t];n&&n()}}}function Hm(e,t,n,r){let i=Kp(Wm).current;return Gm(i,e,t,n,r)&&qm(i,[e,t,n,r]),i.callback}function Um(e){let t=Kp(Wm).current;return Km(t,e)&&qm(t,e),t.callback}function Wm(){return{callback:null,cleanup:null,refs:[]}}function Gm(e,t,n,r,i){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==r||e.refs[3]!==i}function Km(e,t){return e.refs.length!==t.length||e.refs.some((e,n)=>e!==t[n])}function qm(e,t){if(e.refs=t,t.every(e=>e==null)){e.callback=null;return}e.callback=n=>{if(e.cleanup&&=(e.cleanup(),null),n!=null){let r=Array(t.length).fill(null);for(let e=0;e<t.length;e+=1){let i=t[e];if(i!=null)switch(typeof i){case`function`:{let t=i(n);typeof t==`function`&&(r[e]=t);break}case`object`:i.current=n;break;default:}}e.cleanup=()=>{for(let e=0;e<t.length;e+=1){let n=t[e];if(n!=null)switch(typeof n){case`function`:{let t=r[e];typeof t==`function`?t():n(null);break}case`object`:n.current=null;break;default:}}}}}}function Jm(e){let t=Kp(Ym,e).current;return t.next=e,X(t.effect),t}function Ym(e){let t={current:e,next:e,effect:()=>{t.current=t.next}};return t}var Xm=b[`useInsertionEffect${Math.random().toFixed(1)}`.slice(0,-3)],Zm=Xm&&Xm!==b.useLayoutEffect?Xm:e=>e();function Z(e){let t=Kp(Qm).current;return t.next=e,Zm(t.effect),t.trampoline}function Qm(){let e={next:void 0,callback:$m,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function $m(){}var eh={clipPath:`inset(50%)`,overflow:`hidden`,whiteSpace:`nowrap`,border:0,padding:0,width:1,height:1,margin:-1},th={...eh,position:`fixed`,top:0,left:0},nh={...eh,position:`absolute`},rh=b.forwardRef(function(e,t){let[n,r]=b.useState();X(()=>{Lp&&r(`button`)},[]);let i={tabIndex:0,role:n};return(0,y.jsx)(`span`,{...e,ref:t,style:th,"aria-hidden":n?void 0:!0,...i,"data-base-ui-focus-guard":``})}),ih=`data-base-ui-focusable`,ah=`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`,oh=`ArrowLeft`,sh=`ArrowRight`,ch=`ArrowUp`,lh=`ArrowDown`;function uh(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function dh(e,t){if(!e||!t)return!1;let n=t.getRootNode?.();if(e.contains(t))return!0;if(n&&fp(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function fh(e){return`composedPath`in e?e.composedPath()[0]:e.target}function ph(e,t){if(!up(e))return!1;let n=e;if(t.hasElement(n))return!n.hasAttribute(`data-trigger-disabled`);for(let[,e]of t.entries())if(dh(e,n))return!e.hasAttribute(`data-trigger-disabled`);return!1}function mh(e,t){if(t==null)return!1;if(`composedPath`in e)return e.composedPath().includes(t);let n=e;return n.target!=null&&t.contains(n.target)}function hh(e){return e.matches(`html,body`)}function gh(e){return dp(e)&&e.matches(`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`)}function _h(e){return e?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${ah}`)!=null}function vh(e){return e?e.getAttribute(`role`)===`combobox`&&gh(e):!1}function yh(e){if(!e||Bp)return!0;try{return e.matches(`:focus-visible`)}catch{return!0}}function bh(e){return e?e.hasAttribute(`data-base-ui-focusable`)?e:e.querySelector(`[data-base-ui-focusable]`)||e:null}var xh=[`top`,`right`,`bottom`,`left`],Sh=Math.min,Ch=Math.max,wh=Math.round,Th=Math.floor,Eh=e=>({x:e,y:e}),Dh={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function Oh(e,t,n){return Ch(e,Sh(t,n))}function kh(e,t){return typeof e==`function`?e(t):e}function Ah(e){return e.split(`-`)[0]}function jh(e){return e.split(`-`)[1]}function Mh(e){return e===`x`?`y`:`x`}function Nh(e){return e===`y`?`height`:`width`}function Ph(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function Fh(e){return Mh(Ph(e))}function Ih(e,t,n){n===void 0&&(n=!1);let r=jh(e),i=Fh(e),a=Nh(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=Gh(o)),[o,Gh(o)]}function Lh(e){let t=Gh(e);return[Rh(e),t,Rh(t)]}function Rh(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var zh=[`left`,`right`],Bh=[`right`,`left`],Vh=[`top`,`bottom`],Hh=[`bottom`,`top`];function Uh(e,t,n){switch(e){case`top`:case`bottom`:return n?t?Bh:zh:t?zh:Bh;case`left`:case`right`:return t?Vh:Hh;default:return[]}}function Wh(e,t,n,r){let i=jh(e),a=Uh(Ah(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(Rh)))),a}function Gh(e){let t=Ah(e);return Dh[t]+e.slice(t.length)}function Kh(e){return{top:0,right:0,bottom:0,left:0,...e}}function qh(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Kh(e)}function Jh(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function Yh(e,t,n){return Math.floor(e/t)!==n}function Xh(e,t){return t<0||t>=e.length}function Zh(e,t){return $h(e.current,{disabledIndices:t})}function Qh(e,t){return $h(e.current,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function $h(e,{startingIndex:t=-1,decrement:n=!1,disabledIndices:r,amount:i=1}={}){let a=t;do a+=n?-i:i;while(a>=0&&a<=e.length-1&&ig(e,a,r));return a}function eg(e,{event:t,orientation:n,loopFocus:r,onLoop:i,rtl:a,cols:o,disabledIndices:s,minIndex:c,maxIndex:l,prevIndex:u,stopEvent:d=!1}){let f=u,p;if(t.key===`ArrowUp`?p=`up`:t.key===`ArrowDown`&&(p=`down`),p){let n=[],a=[],m=!1,h=0;{let t=null,r=-1;e.forEach((e,i)=>{if(e==null)return;h+=1;let o=e.closest(`[role="row"]`);o&&(m=!0),(o!==t||r===-1)&&(t=o,r+=1,n[r]=[]),n[r].push(i),a[i]=r})}let g=!1,_=0;if(m)for(let e of n){let t=e.length;t>_&&(_=t),t!==o&&(g=!0)}let v=g&&h<e.length,y=_||o,b=o=>{if(!g||u===-1)return;let c=a[u];if(c==null)return;let l=n[c].indexOf(u),d=o===`up`?-1:1;for(let o=c+d,f=0;f<n.length;f+=1,o+=d){if(o<0||o>=n.length){if(!r||v)return;if(o=o<0?n.length-1:0,i){let e=Math.min(l,n[o].length-1);o=a[i(t,u,n[o][e]??n[o][0])]??o}}let c=n[o];for(let t=Math.min(l,c.length-1);t>=0;--t){let n=c[t];if(!ig(e,n,s))return n}}},x=t=>{if(!v||u===-1)return;let n=u%y,i=t===`up`?-y:y,a=l-l%y,o=Th(l/y)+1;for(let t=u-n+i,c=0;c<o;c+=1,t+=i){if(t<0||t>l){if(!r)return;t=t<0?a:0}let i=Math.min(t+y-1,l);for(let r=Math.min(t+n,i);r>=t;--r)if(!ig(e,r,s))return r}};d&&mm(t);let S=b(p)??x(p);if(S!==void 0)f=S;else if(u===-1)f=p===`up`?l:c;else if(f=$h(e,{startingIndex:u,amount:y,decrement:p===`up`,disabledIndices:s}),r){if(p===`up`&&(u-y<c||f<0)){let e=u%y,n=l%y,r=l-(n-e);f=n===e?l:n>e?r:r-y,i&&(f=i(t,u,f))}p===`down`&&u+y>l&&(f=$h(e,{startingIndex:u%y-y,amount:y,disabledIndices:s}),i&&(f=i(t,u,f)))}Xh(e,f)&&(f=u)}if(n===`both`){let n=Th(u/o);t.key===(a?`ArrowLeft`:`ArrowRight`)&&(d&&mm(t),u%o===o-1?r&&(f=$h(e,{startingIndex:u-u%o-1,disabledIndices:s}),i&&(f=i(t,u,f))):(f=$h(e,{startingIndex:u,disabledIndices:s}),r&&Yh(f,o,n)&&(f=$h(e,{startingIndex:u-u%o-1,disabledIndices:s}),i&&(f=i(t,u,f)))),Yh(f,o,n)&&(f=u)),t.key===(a?`ArrowRight`:`ArrowLeft`)&&(d&&mm(t),u%o===0?r&&(f=$h(e,{startingIndex:u+(o-u%o),decrement:!0,disabledIndices:s}),i&&(f=i(t,u,f))):(f=$h(e,{startingIndex:u,decrement:!0,disabledIndices:s}),r&&Yh(f,o,n)&&(f=$h(e,{startingIndex:u+(o-u%o),decrement:!0,disabledIndices:s}),i&&(f=i(t,u,f)))),Yh(f,o,n)&&(f=u));let c=Th(l/o)===n;Xh(e,f)&&(r&&c?(f=t.key===(a?`ArrowRight`:`ArrowLeft`)?l:$h(e,{startingIndex:u-u%o-1,disabledIndices:s}),i&&(f=i(t,u,f))):f=u)}return f}function tg(e,t,n){let r=[],i=0;return e.forEach(({width:e,height:a},o)=>{let s=!1;for(n&&(i=0);!s;){let n=[];for(let r=0;r<e;r+=1)for(let e=0;e<a;e+=1)n.push(i+r+e*t);i%t+e<=t&&n.every(e=>r[e]==null)?(n.forEach(e=>{r[e]=o}),s=!0):i+=1}}),[...r]}function ng(e,t,n,r,i){if(e===-1)return-1;let a=n.indexOf(e),o=t[e];switch(i){case`tl`:return a;case`tr`:return o?a+o.width-1:a;case`bl`:return o?a+(o.height-1)*r:a;case`br`:return n.lastIndexOf(e);default:return-1}}function rg(e,t){return t.flatMap((t,n)=>e.includes(t)?[n]:[])}function ig(e,t,n){if(typeof n==`function`?n(t):n?.includes(t)??!1)return!0;let r=e[t];return r?og(r)?!n&&(r.hasAttribute(`disabled`)||r.getAttribute(`aria-disabled`)===`true`):!0:!1}function ag(e){return e.visibility===`hidden`||e.visibility===`collapse`}function og(e,t=e?wp(e):null){return!e||!e.isConnected||!t||ag(t)?!1:typeof e.checkVisibility==`function`?e.checkVisibility():t.display!==`none`&&t.display!==`contents`}var sg=`a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]`;function cg(e){let t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;let n=e.getRootNode();return fp(n)?n.host:null}function lg(e){for(let t of Array.from(e.children))if(op(t)===`summary`)return t;return null}function ug(e,t){let n=lg(t);return!!n&&(e===n||dh(n,e))}function dg(e){let t=e?op(e):``;return e!=null&&e.matches(sg)&&(t!==`summary`||e.parentElement!=null&&op(e.parentElement)===`details`&&lg(e.parentElement)===e)&&(t!==`details`||lg(e)==null)&&(t!==`input`||e.type!==`hidden`)}function fg(e){if(!dg(e)||!e.isConnected||e.matches(`:disabled`))return!1;for(let t=e;t;t=cg(t)){let n=t!==e,r=op(t)===`slot`;if(t.hasAttribute(`inert`)||n&&op(t)===`details`&&!t.open&&!ug(e,t)||t.hasAttribute(`hidden`)||!r&&!pg(t,n))return!1}return!0}function pg(e,t){let n=wp(e);return t?n.display!==`none`:og(e,n)}function mg(e){let t=e.tabIndex;if(t<0){let t=op(e);if(t===`details`||t===`audio`||t===`video`||dp(e)&&e.isContentEditable)return 0}return t}function hg(e){if(op(e)!==`input`)return null;let t=e;return t.type===`radio`&&t.name!==``?t:null}function gg(e,t){let n=hg(e);if(!n)return!0;let r=t.find(e=>{let t=hg(e);return t?.name===n.name&&t.form===n.form&&t.checked});return r?r===n:t.find(e=>{let t=hg(e);return t?.name===n.name&&t.form===n.form})===n}function _g(e){if(dp(e)&&op(e)===`slot`){let t=e.assignedElements({flatten:!0});if(t.length>0)return t}return dp(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function vg(e,t){_g(e).forEach(e=>{dg(e)&&t.push(e),vg(e,t)})}function yg(e,t,n){_g(e).forEach(e=>{dp(e)&&e.matches(t)&&n.push(e),yg(e,t,n)})}function bg(e){return fg(e)&&mg(e)>=0}function xg(e){let t=[];return vg(e,t),t.filter(fg)}function Sg(e){let t=xg(e);return t.filter(e=>mg(e)>=0&&gg(e,t))}function Cg(e,t){let n=Sg(e),r=n.length;if(r===0)return;let i=uh(Wp(e)),a=n.indexOf(i);return n[a===-1?t===1?0:r-1:a+t]}function wg(e){return Cg(Wp(e).body,1)||e}function Tg(e){return Cg(Wp(e).body,-1)||e}function Eg(e,t){if(!e)return null;let n=Sg(Wp(e).body),r=n.length;if(r===0)return null;let i=n.indexOf(e);return i===-1?null:n[(i+t+r)%r]}function Dg(e){return Eg(e,1)}function Og(e){return Eg(e,-1)}function kg(e,t){let n=t||e.currentTarget,r=e.relatedTarget;return!r||!dh(n,r)}function Ag(e){Sg(e).forEach(e=>{e.dataset.tabindex=e.getAttribute(`tabindex`)||``,e.setAttribute(`tabindex`,`-1`)})}function jg(e){let t=[];yg(e,`[data-tabindex]`,t),t.forEach(e=>{let t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute(`tabindex`,t):e.removeAttribute(`tabindex`)})}function Mg(e,t,n=!0){return e.filter(e=>e.parentId===t).flatMap(t=>[...!n||t.context?.open?[t]:[],...Mg(e,t.id,n)])}function Ng(e,t){let n=[],r=e.find(e=>e.id===t)?.parentId;for(;r;){let t=e.find(e=>e.id===r);r=t?.parentId,t&&(n=n.concat(t))}return n}function Pg(e){return`data-base-ui-${e}`}var Fg=0;function Ig(e,t={}){let{preventScroll:n=!1,cancelPrevious:r=!0,sync:i=!1}=t;r&&cancelAnimationFrame(Fg);let a=()=>e?.focus({preventScroll:n});if(i)return a(),nm;let o=requestAnimationFrame(a);return Fg=o,()=>{Fg===o&&(cancelAnimationFrame(o),Fg=0)}}var Lg={inert:new WeakMap,"aria-hidden":new WeakMap},Rg=`data-base-ui-inert`,zg={inert:new WeakSet,"aria-hidden":new WeakSet},Bg=new WeakMap,Vg=0;function Hg(e){return zg[e]}function Ug(e){return e?fp(e)?e.host:Ug(e.parentNode):null}var Wg=(e,t)=>t.map(t=>{if(e.contains(t))return t;let n=Ug(t);return e.contains(n)?n:null}).filter(e=>e!=null),Gg=e=>{let t=new Set;return e.forEach(e=>{let n=e;for(;n&&!t.has(n);)t.add(n),n=n.parentNode}),t},Kg=(e,t,n)=>{let r=[],i=e=>{!e||n.has(e)||Array.from(e.children).forEach(e=>{op(e)!==`script`&&(t.has(e)?i(e):r.push(e))})};return i(e),r};function qg(e,t,n,r,{mark:i=!0,markerIgnoreElements:a=[]}){let o=r?`inert`:n?`aria-hidden`:null,s=null,c=null,l=Wg(t,e),u=i?Wg(t,a):[],d=new Set(u),f=i?Kg(t,Gg(l),new Set(l)).filter(e=>!d.has(e)):[],p=[],m=[];if(o){let e=Lg[o],n=Hg(o);c=n,s=e;let r=Wg(t,Array.from(t.querySelectorAll(`[aria-live]`))),i=l.concat(r);Kg(t,Gg(i),new Set(i)).forEach(t=>{let r=t.getAttribute(o),i=r!==null&&r!==`false`,a=(e.get(t)||0)+1;e.set(t,a),p.push(t),a===1&&i&&n.add(t),i||t.setAttribute(o,o===`inert`?``:`true`)})}return i&&f.forEach(e=>{let t=(Bg.get(e)||0)+1;Bg.set(e,t),m.push(e),t===1&&e.setAttribute(Rg,``)}),Vg+=1,()=>{s&&p.forEach(e=>{let t=(s.get(e)||0)-1;s.set(e,t),t||(!c?.has(e)&&o&&e.removeAttribute(o),c?.delete(e))}),i&&m.forEach(e=>{let t=(Bg.get(e)||0)-1;Bg.set(e,t),t||e.removeAttribute(Rg)}),--Vg,Vg||(Lg.inert=new WeakMap,Lg[`aria-hidden`]=new WeakMap,zg.inert=new WeakSet,zg[`aria-hidden`]=new WeakSet,Bg=new WeakMap)}}function Jg(e,t={}){let{ariaHidden:n=!1,inert:r=!1,mark:i=!0,markerIgnoreElements:a=[]}=t,o=Wp(e[0]).body;return qg(e,o,n,r,{mark:i,markerIgnoreElements:a})}var Yg={...b},Xg=0;function Zg(e,t=`mui`){let[n,r]=b.useState(e),i=e||n;return b.useEffect(()=>{n??(Xg+=1,r(`${t}-${Xg}`))},[n,t]),i}var Qg=Yg.useId;function $g(e,t){if(Qg!==void 0){let n=Qg();return e??(t?`${t}-${n}`:n)}return Zg(e,t)}function e_(e,t){return function(n,...r){let i=new URL(e);return i.searchParams.set(`code`,n.toString()),r.forEach(e=>i.searchParams.append(`args[]`,e)),`${t} error #${n}; visit ${i} for the full message.`}}var t_=e_(`https://base-ui.com/production-error`,`Base UI`),n_=19;function r_(e){return n_>=e}function i_(e){if(!b.isValidElement(e))return null;let t=e,n=t.props;return(r_(19)?n?.ref:t.ref)??null}function a_(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}function o_(e,t){let n={};for(let r in e){let i=e[r];if(t?.hasOwnProperty(r)){let e=t[r](i);e!=null&&Object.assign(n,e);continue}i===!0?n[`data-${r.toLowerCase()}`]=``:i&&(n[`data-${r.toLowerCase()}`]=i.toString())}return n}function s_(e,t){return typeof e==`function`?e(t):e}function c_(e,t){return typeof e==`function`?e(t):e}var l_={};function u_(e,t,n,r,i){if(!n&&!r&&!i&&!e)return f_(t);let a=f_(e);return t&&(a=p_(a,t)),n&&(a=p_(a,n)),r&&(a=p_(a,r)),i&&(a=p_(a,i)),a}function d_(e){if(e.length===0)return l_;if(e.length===1)return f_(e[0]);let t=f_(e[0]);for(let n=1;n<e.length;n+=1)t=p_(t,e[n]);return t}function f_(e){return __(e)?{...v_(e,l_)}:m_(e)}function p_(e,t){return __(t)?v_(t,e):h_(e,t)}function m_(e){let t={...e};for(let e in t){let n=t[e];g_(e,n)&&(t[e]=b_(n))}return t}function h_(e,t){if(!t)return e;for(let n in t){let r=t[n];switch(n){case`style`:e[n]=a_(e.style,r);break;case`className`:e[n]=S_(e.className,r);break;default:g_(n,r)?e[n]=y_(e[n],r):e[n]=r}}return e}function g_(e,t){let n=e.charCodeAt(0),r=e.charCodeAt(1),i=e.charCodeAt(2);return n===111&&r===110&&i>=65&&i<=90&&(typeof t==`function`||t===void 0)}function __(e){return typeof e==`function`}function v_(e,t){return __(e)?e(t):e??l_}function y_(e,t){return t?e?(...n)=>{let r=n[0];if(C_(r)){let i=r;x_(i);let a=t(...n);return i.baseUIHandlerPrevented||e?.(...n),a}let i=t(...n);return e?.(...n),i}:b_(t):e}function b_(e){return e&&((...t)=>{let n=t[0];return C_(n)&&x_(n),e(...t)})}function x_(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function S_(e,t){return t?e?t+` `+e:t:e}function C_(e){return typeof e==`object`&&!!e&&`nativeEvent`in e}function w_(e,t,n={}){let r=t.render,i=T_(t,n);return n.enabled===!1?null:O_(e,r,i,n.state??im)}function T_(e,t={}){let{className:n,style:r,render:i}=e,{state:a=im,ref:o,props:s,stateAttributesMapping:c,enabled:l=!0}=t,u=l?s_(n,a):void 0,d=l?c_(r,a):void 0,f=l?o_(a,c):im,p=l&&s?E_(s):void 0,m=l?a_(f,p)??{}:im;return typeof document<`u`&&(l?Array.isArray(o)?m.ref=Um([m.ref,i_(i),...o]):m.ref=Hm(m.ref,i_(i),o):Hm(null,null)),l?(u!==void 0&&(m.className=S_(m.className,u)),d!==void 0&&(m.style=a_(m.style,d)),m):im}function E_(e){return Array.isArray(e)?d_(e):u_(void 0,e)}var D_=Symbol.for(`react.lazy`);function O_(e,t,n,r){if(t){if(typeof t==`function`)return t(n,r);let e=u_(n,t.props);e.ref=n.ref;let i=t;return i?.$$typeof===D_&&(i=b.Children.toArray(t)[0]),b.cloneElement(i,e)}if(e&&typeof e==`string`)return k_(e,n);throw Error(t_(8))}function k_(e,t){return e===`button`?(0,b.createElement)(`button`,{type:`button`,...t,key:t.key}):e===`img`?(0,b.createElement)(`img`,{alt:``,...t,key:t.key}):b.createElement(e,t)}var A_={style:{transition:`none`}},j_=`data-base-ui-click-trigger`,M_={fallbackAxisSide:`none`},N_={fallbackAxisSide:`end`},P_={clipPath:`inset(50%)`,position:`fixed`,top:0,left:0},F_=c(g()),I_=b.createContext(null),L_=()=>b.useContext(I_),R_=Pg(`portal`);function z_(e={}){let{ref:t,container:n,componentProps:r=im,elementProps:i}=e,a=$g(),o=L_()?.portalNode,[s,c]=b.useState(null),[l,u]=b.useState(null),d=Z(e=>{e!==null&&u(e)}),f=b.useRef(null);X(()=>{if(n===null){f.current&&(f.current=null,u(null),c(null));return}if(a==null)return;let e=(n&&(lp(n)?n:n.current))??o??document.body;if(e==null){f.current&&(f.current=null,u(null),c(null));return}f.current!==e&&(f.current=e,u(null),c(e))},[n,o,a]);let p=w_(`div`,r,{ref:[t,d],props:[{id:a,[R_]:``},i]});return{portalNode:l,portalSubtree:s&&p?F_.createPortal(p,s):null}}var B_=b.forwardRef(function(e,t){let{children:n,container:r,className:i,render:a,renderGuards:o,style:s,...c}=e,{portalNode:l,portalSubtree:u}=z_({container:r,ref:t,componentProps:e,elementProps:c}),d=b.useRef(null),f=b.useRef(null),p=b.useRef(null),m=b.useRef(null),[h,g]=b.useState(null),_=b.useRef(!1),v=h?.modal,x=h?.open,S=typeof o==`boolean`?o:!!h&&!h.modal&&h.open&&!!l;b.useEffect(()=>{if(!l||v)return;function e(e){l&&e.relatedTarget&&kg(e)&&(e.type===`focusin`?_.current&&=(jg(l),!1):(Ag(l),_.current=!0))}return Vm(Ap(l,`focusin`,e,!0),Ap(l,`focusout`,e,!0))},[l,v]),b.useEffect(()=>{!l||x!==!1||(jg(l),_.current=!1)},[x,l]);let C=b.useMemo(()=>({beforeOutsideRef:d,afterOutsideRef:f,beforeInsideRef:p,afterInsideRef:m,portalNode:l,setFocusManagerState:g}),[l]);return(0,y.jsxs)(b.Fragment,{children:[u,(0,y.jsxs)(I_.Provider,{value:C,children:[S&&l&&(0,y.jsx)(rh,{"data-type":`outside`,ref:d,onFocus:e=>{kg(e,l)?p.current?.focus():Tg(h?h.domReference:null)?.focus()}}),S&&l&&(0,y.jsx)(`span`,{"aria-owns":l.id,style:P_}),l&&F_.createPortal(n,l),S&&l&&(0,y.jsx)(rh,{"data-type":`outside`,ref:f,onFocus:e=>{kg(e,l)?m.current?.focus():(wg(h?h.domReference:null)?.focus(),h?.closeOnFocusOut&&h?.onOpenChange(!1,Lm(`focus-out`,e.nativeEvent)))}})]})]})});function V_(){let e=new Map;return{emit(t,n){e.get(t)?.forEach(e=>e(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){e.get(t)?.delete(n)}}}var H_=class{nodesRef={current:[]};events=V_();addNode(e){this.nodesRef.current.push(e)}removeNode(e){let t=this.nodesRef.current.findIndex(t=>t===e);t!==-1&&this.nodesRef.current.splice(t,1)}},U_=b.createContext(null),W_=b.createContext(null),G_=()=>b.useContext(U_)?.id||null,K_=e=>{let t=b.useContext(W_);return e??t};function q_(e){let t=$g(),n=K_(e),r=G_();return X(()=>{if(!t)return;let e={id:t,parentId:r};return n?.addNode(e),()=>{n?.removeNode(e)}},[n,t,r]),t}function J_(e){let{children:t,id:n}=e,r=G_();return(0,y.jsx)(U_.Provider,{value:b.useMemo(()=>({id:n,parentId:r}),[n,r]),children:t})}function Y_(e){let{children:t,externalTree:n}=e,r=Kp(()=>n??new H_).current;return(0,y.jsx)(W_.Provider,{value:r,children:t})}function X_(e){return e==null?e:`current`in e?e.current:e}function Z_(e,t){let n=sp(fh(e));return e instanceof n.KeyboardEvent?`keyboard`:e instanceof n.FocusEvent?t||`keyboard`:`pointerType`in e?e.pointerType||`keyboard`:`touches`in e?`touch`:e instanceof n.MouseEvent?t||(e.detail===0?`keyboard`:`mouse`):``}var Q_=20,$_=[];function ev(){$_=$_.filter(e=>e.deref()?.isConnected)}function tv(e){ev(),e&&op(e)!==`body`&&($_.push(new WeakRef(e)),$_.length>Q_&&($_=$_.slice(-Q_)))}function nv(){return ev(),$_[$_.length-1]?.deref()}function rv(e){return e?bg(e)?e:Sg(e)[0]||e:null}function iv(e,t){if(e.hasAttribute(`tabindex`)&&!e.hasAttribute(`data-tabindex`)||!t.current.includes(`floating`)&&!e.getAttribute(`role`)?.includes(`dialog`))return;let n=xg(e).filter(e=>{let t=e.getAttribute(`data-tabindex`)||``;return bg(e)||e.hasAttribute(`data-tabindex`)&&!t.startsWith(`-`)}),r=e.getAttribute(`tabindex`);t.current.includes(`floating`)||n.length===0?r!==`0`&&e.setAttribute(`tabindex`,`0`):(r!==`-1`||e.hasAttribute(`data-tabindex`)&&e.getAttribute(`data-tabindex`)!==`-1`)&&(e.setAttribute(`tabindex`,`-1`),e.setAttribute(`data-tabindex`,`-1`))}function av(e){let{context:t,children:n,disabled:r=!1,initialFocus:i=!0,returnFocus:a=!0,restoreFocus:o=!1,modal:s=!0,closeOnFocusOut:c=!0,openInteractionType:l=``,nextFocusableElement:u,previousFocusableElement:d,beforeContentFocusGuardRef:f,externalTree:p,getInsideElements:m}=e,h=`rootStore`in t?t.rootStore:t,g=h.useState(`open`),_=h.useState(`domReferenceElement`),v=h.useState(`floatingElement`),{events:x,dataRef:S}=h.context,C=Z(()=>S.current.floatingContext?.nodeId),w=i===!1,T=vh(_)&&w,E=b.useRef([`content`]),D=Jm(i),O=Jm(a),k=Jm(l),A=K_(p),j=L_(),M=b.useRef(!1),N=b.useRef(!1),P=b.useRef(!1),F=b.useRef(null),I=b.useRef(``),L=b.useRef(``),R=b.useRef(null),z=b.useRef(null),ee=Hm(R,f,j?.beforeInsideRef),B=Hm(z,j?.afterInsideRef),te=Zp(),V=Zp(),H=tm(),ne=j!=null,U=bh(v),re=Z((e=U)=>e?Sg(e):[]),W=Z(()=>m?.().filter(e=>e!=null)??[]);b.useEffect(()=>{if(r||!s)return;function e(e){e.key===`Tab`&&dh(U,uh(Wp(U)))&&re().length===0&&!T&&mm(e)}return Ap(Wp(U),`keydown`,e)},[r,_,U,s,E,T,re]),b.useEffect(()=>{if(r||!g)return;let e=Wp(U);function t(){P.current=!1}function n(e){let t=fh(e),n=W();P.current=!(dh(v,t)||dh(_,t)||dh(j?.portalNode,t)||n.some(e=>e===t||dh(e,t))),L.current=e.pointerType||`keyboard`,t?.closest(`[data-base-ui-click-trigger]`)&&(N.current=!0)}function i(){L.current=`keyboard`}return Vm(Ap(e,`pointerdown`,n,!0),Ap(e,`pointerup`,t,!0),Ap(e,`pointercancel`,t,!0),Ap(e,`keydown`,i,!0))},[r,v,_,U,g,j,W]),b.useEffect(()=>{if(r||!c)return;let e=Wp(U);function t(){N.current=!0,V.start(0,()=>{N.current=!1})}function n(e){let t=fh(e);bg(t)&&(F.current=t)}function i(t){let n=t.relatedTarget,r=t.currentTarget,i=fh(t);queueMicrotask(()=>{let a=C(),c=h.context.triggerElements,l=W(),f=n?.hasAttribute(Pg(`focus-guard`))&&[R.current,z.current,j?.beforeInsideRef.current,j?.afterInsideRef.current,j?.beforeOutsideRef.current,j?.afterOutsideRef.current,X_(d),X_(u)].includes(n),p=!(dh(_,n)||dh(v,n)||dh(n,v)||dh(j?.portalNode,n)||l.some(e=>e===n||dh(e,n))||n!=null&&c.hasElement(n)||c.hasMatchingElement(e=>dh(e,n))||f||A&&(Mg(A.nodesRef.current,a).find(e=>dh(e.context?.elements.floating,n)||dh(e.context?.elements.domReference,n))||Ng(A.nodesRef.current,a).find(e=>[e.context?.elements.floating,bh(e.context?.elements.floating)].includes(n)||e.context?.elements.domReference===n)));if(r===_&&U&&iv(U,E),o&&r!==_&&!og(i)&&uh(e)===e.body){if(dp(U)&&(U.focus(),o===`popup`)){H.request(()=>{U.focus()});return}let e=re(),t=F.current,n=(t&&e.includes(t)?t:null)||e[e.length-1]||U;dp(n)&&n.focus()}if(S.current.insideReactTree){S.current.insideReactTree=!1;return}(T||!s)&&n&&p&&!N.current&&(T||n!==nv())&&(M.current=!0,h.setOpen(!1,Lm(Am,t)))})}function a(){P.current||(S.current.insideReactTree=!0,te.start(0,()=>{S.current.insideReactTree=!1}))}let l=dp(_)?_:null;if(!(!v&&!l))return Vm(l&&Ap(l,`focusout`,i),l&&Ap(l,`pointerdown`,t),v&&Ap(v,`focusin`,n),v&&Ap(v,`focusout`,i),v&&j&&Ap(v,`focusout`,a,!0))},[r,_,v,U,s,A,j,h,c,o,re,T,C,E,S,te,V,H,u,d,W]),b.useEffect(()=>{if(r||!v||!g)return;let e=Array.from(j?.portalNode?.querySelectorAll(`[${Pg(`portal`)}]`)||[]),t=(A?Ng(A.nodesRef.current,C()):[]).find(e=>vh(e.context?.elements.domReference||null))?.context?.elements.domReference,n=Jg([...[v,...e,R.current,z.current,j?.beforeOutsideRef.current,j?.afterOutsideRef.current,...W()],t,X_(d),X_(u),T?_:null].filter(e=>e!=null),{ariaHidden:s||T,mark:!1}),i=Jg([v,...e].filter(e=>e!=null));return()=>{i(),n()}},[g,r,_,v,s,E,j,T,A,C,u,d,W]),X(()=>{if(!g||r||!dp(U))return;let e=uh(Wp(U));queueMicrotask(()=>{let t=D.current,n=typeof t==`function`?t(k.current||``):t;if(n===void 0||n===!1||dh(U,e))return;let r=null,i=()=>(r??=re(U),r[0]||U),a;a=n===!0||n===null?i():X_(n),a||=i(),Ig(a,{preventScroll:a===U})})},[r,g,U,w,re,D,k]),X(()=>{if(r||!U)return;let e=Wp(U);tv(uh(e));function t(e){if(e.open||(I.current=Z_(e.nativeEvent,L.current)),e.reason===`trigger-hover`&&e.nativeEvent.type===`mouseleave`&&(M.current=!0),e.reason===`outside-press`)if(e.nested)M.current=!1;else if(gm(e.nativeEvent)||_m(e.nativeEvent))M.current=!1;else{let e=!1;Wp(U).createElement(`div`).focus({get preventScroll(){return e=!0,!1}}),e?M.current=!1:M.current=!0}}x.on(`openchange`,t);function n(){let e=O.current,t=typeof e==`function`?e(I.current):e;if(t===void 0||t===!1)return null;if(t===null&&(t=!0),typeof t==`boolean`){let e=_||nv();return e&&e.isConnected?e:null}let n=_||nv();return X_(t)||n||null}return()=>{x.off(`openchange`,t);let r=uh(e),i=W(),a=dh(v,r)||i.some(e=>e===r||dh(e,r))||A&&Mg(A.nodesRef.current,C(),!1).some(e=>dh(e.context?.elements.floating,r)),o=O.current,s=n();queueMicrotask(()=>{let t=rv(s),n=typeof o!=`boolean`;o&&!M.current&&dp(t)&&(!(!n&&t!==r&&r!==e.body)||a)&&t.focus({preventScroll:!0}),M.current=!1})}},[r,v,U,O,S,x,A,_,C,W]),X(()=>{if(!Fp||g||!v)return;let e=uh(Wp(v));!dp(e)||!gh(e)||dh(v,e)&&e.blur()},[g,v]),X(()=>{if(!(r||!j))return j.setFocusManagerState({modal:s,closeOnFocusOut:c,open:g,onOpenChange:h.setOpen,domReference:_}),()=>{j.setFocusManagerState(null)}},[r,j,s,g,h,c,_]),X(()=>{if(!(r||!U))return iv(U,E),()=>{queueMicrotask(ev)}},[r,U,E]);let ie=!r&&(s?!T:!0)&&(ne||s);return(0,y.jsxs)(b.Fragment,{children:[ie&&(0,y.jsx)(rh,{"data-type":`inside`,ref:ee,onFocus:e=>{if(s){let e=re();Ig(e[e.length-1])}else j?.portalNode&&(M.current=!1,kg(e,j.portalNode)?wg(_)?.focus():X_(d??j.beforeOutsideRef)?.focus())}}),n,ie&&(0,y.jsx)(rh,{"data-type":`inside`,ref:B,onFocus:e=>{s?Ig(re()[0]):j?.portalNode&&(c&&(M.current=!0),kg(e,j.portalNode)?Tg(_)?.focus():X_(u??j.afterOutsideRef)?.focus())}})]})}function ov(e,t={}){let n=`rootStore`in e?e.rootStore:e,r=n.context.dataRef,{enabled:i=!0,event:a=`click`,toggle:o=!0,ignoreMouse:s=!1,stickIfOpen:c=!0,touchOpenDelay:l=0,reason:u=Tm}=t,d=b.useRef(void 0),f=tm(),p=Zp(),m=b.useMemo(()=>({onPointerDown(e){d.current=e.pointerType},onMouseDown(e){let t=d.current,i=e.nativeEvent,m=n.select(`open`);if(e.button!==0||a===`click`||vm(t,!0)&&s)return;let h=r.current.openEvent,g=h?.type,_=n.select(`domReferenceElement`)!==e.currentTarget,v=m&&_||!(m&&o&&(!(h&&c)||g===`click`||g===`mousedown`)),y=fh(i);if(gh(y)){let e=Lm(u,i,y);v&&t===`touch`&&l>0?p.start(l,()=>{n.setOpen(!0,e)}):n.setOpen(v,e);return}let b=e.currentTarget;f.request(()=>{let e=Lm(u,i,b);v&&t===`touch`&&l>0?p.start(l,()=>{n.setOpen(!0,e)}):n.setOpen(v,e)})},onClick(e){if(a===`mousedown-only`)return;let t=d.current;if(a===`mousedown`&&t){d.current=void 0;return}if(vm(t,!0)&&s)return;let i=n.select(`open`),f=r.current.openEvent,m=n.select(`domReferenceElement`)!==e.currentTarget,h=i&&m||!(i&&o&&(!(f&&c)||ym(f))),g=Lm(u,e.nativeEvent,e.currentTarget);h&&t===`touch`&&l>0?p.start(l,()=>{n.setOpen(!0,g)}):n.setOpen(h,g)},onKeyDown(){d.current=void 0}}),[r,a,s,n,c,o,f,p,l,u]);return b.useMemo(()=>i?{reference:m}:im,[i,m])}function sv(e,t){let n=null,r=null,i=!1;return{contextElement:e||void 0,getBoundingClientRect(){let a=e?.getBoundingClientRect()||{width:0,height:0,x:0,y:0},o=t.axis===`x`||t.axis===`both`,s=t.axis===`y`||t.axis===`both`,c=[`mouseenter`,`mousemove`].includes(t.dataRef.current.openEvent?.type||``)&&t.pointerType!==`touch`,l=a.width,u=a.height,d=a.x,f=a.y;return n==null&&t.x&&o&&(n=a.x-t.x),r==null&&t.y&&s&&(r=a.y-t.y),d-=n||0,f-=r||0,l=0,u=0,!i||c?(l=t.axis===`y`?a.width:0,u=t.axis===`x`?a.height:0,d=o&&t.x!=null?t.x:d,f=s&&t.y!=null?t.y:f):i&&!c&&(u=t.axis===`x`?a.height:u,l=t.axis===`y`?a.width:l),i=!0,{width:l,height:u,x:d,y:f,top:f,right:d+l,bottom:f+u,left:d}}}}function cv(e){return e!=null&&e.clientX!=null}function lv(e,t={}){let n=`rootStore`in e?e.rootStore:e,r=n.useState(`open`),i=n.useState(`floatingElement`),a=n.useState(`domReferenceElement`),o=n.context.dataRef,{enabled:s=!0,axis:c=`both`}=t,l=b.useRef(!1),u=b.useRef(null),[d,f]=b.useState(),[p,m]=b.useState([]),h=Z((e,t,r)=>{l.current||o.current.openEvent&&!cv(o.current.openEvent)||n.set(`positionReference`,sv(r??a,{x:e,y:t,axis:c,dataRef:o,pointerType:d}))}),g=Z(e=>{r?u.current||m([]):h(e.clientX,e.clientY,e.currentTarget)}),_=vm(d)?i:r,v=b.useCallback(()=>{if(!_||!s)return;let e=sp(i);function t(e){dh(i,fh(e))?(u.current?.(),u.current=null):h(e.clientX,e.clientY)}if(!o.current.openEvent||cv(o.current.openEvent))return u.current=Ap(e,`mousemove`,t),()=>{u.current?.(),u.current=null};n.set(`positionReference`,a)},[_,s,i,o,a,n,h]);b.useEffect(()=>v(),[v,p]),b.useEffect(()=>{s&&!i&&(l.current=!1)},[s,i]),b.useEffect(()=>{!s&&r&&(l.current=!0)},[s,r]);let y=b.useMemo(()=>{function e(e){f(e.pointerType)}return{onPointerDown:e,onPointerEnter:e,onMouseMove:g,onMouseEnter:g}},[g]);return b.useMemo(()=>s?{reference:y,trigger:y}:{},[s,y])}var uv={intentional:`onClick`,sloppy:`onPointerDown`};function dv(){return!1}function fv(e){return{escapeKey:typeof e==`boolean`?e:e?.escapeKey??!1,outsidePress:typeof e==`boolean`?e:e?.outsidePress??!0}}function pv(e,t={}){let n=`rootStore`in e?e.rootStore:e,r=n.useState(`open`),i=n.useState(`floatingElement`),{dataRef:a}=n.context,{enabled:o=!0,escapeKey:s=!0,outsidePress:c=!0,outsidePressEvent:l=`sloppy`,referencePress:u=dv,referencePressEvent:d=`sloppy`,bubbles:f,externalTree:p}=t,m=K_(p),h=Z(typeof c==`function`?c:()=>!1),g=typeof c==`function`?h:c,_=g!==!1,v=Z(()=>l),y=b.useRef(!1),x=b.useRef(!1),S=b.useRef(!1),{escapeKey:C,outsidePress:w}=fv(f),T=b.useRef(null),E=Zp(),D=Zp(),O=Z(()=>{D.clear(),a.current.insideReactTree=!1}),k=b.useRef(!1),A=b.useRef(``),j=Z(u),M=Z(e=>{if(!r||!o||!s||e.key!==`Escape`||k.current)return;let t=a.current.floatingContext?.nodeId,i=m?Mg(m.nodesRef.current,t):[];if(!C&&i.length>0){let e=!0;if(i.forEach(t=>{t.context?.open&&!t.context.dataRef.current.__escapeKeyBubbles&&(e=!1)}),!e)return}let c=Lm(jm,hm(e)?e.nativeEvent:e);n.setOpen(!1,c),!C&&!c.isPropagationAllowed&&e.stopPropagation()}),N=Z(()=>{a.current.insideReactTree=!0,D.start(0,O)});b.useEffect(()=>{if(!r||!o)return;a.current.__escapeKeyBubbles=C,a.current.__outsidePressBubbles=w;let e=new Xp,t=new Xp;function c(){e.clear(),k.current=!0}function l(){e.start(Sp()?5:0,()=>{k.current=!1})}function u(){S.current=!0,t.start(0,()=>{S.current=!1})}function d(){y.current=!1,x.current=!1}function f(){let e=A.current,t=e===`pen`||!e?`mouse`:e,n=v(),r=typeof n==`function`?n():n;return typeof r==`string`?r:r[t]}function p(e){let t=f();return t===`intentional`&&e.type!==`click`||t===`sloppy`&&e.type===`click`}function h(e){let t=a.current.floatingContext?.nodeId,r=m&&Mg(m.nodesRef.current,t).some(t=>mh(e,t.context?.elements.floating));return mh(e,n.select(`floatingElement`))||mh(e,n.select(`domReferenceElement`))||r}function b(e){if(p(e)){O();return}if(a.current.insideReactTree){O();return}let r=fh(e),i=`[${Pg(`inert`)}]`,o=up(r)?r.getRootNode():null,s=Array.from((fp(o)?o:Wp(n.select(`floatingElement`))).querySelectorAll(i)),c=n.context.triggerElements;if(r&&(c.hasElement(r)||c.hasMatchingElement(e=>dh(e,r))))return;let l=up(r)?r:null;for(;l&&!Cp(l);){let e=Ep(l);if(Cp(e)||!up(e))break;l=e}if(s.length&&up(r)&&!hh(r)&&!dh(r,n.select(`floatingElement`))&&s.every(e=>!dh(l,e)))return;if(dp(r)&&!(`touches`in e)){let t=Cp(r),n=wp(r),i=/auto|scroll/,a=t||i.test(n.overflowX),o=t||i.test(n.overflowY),s=a&&r.clientWidth>0&&r.scrollWidth>r.clientWidth,c=o&&r.clientHeight>0&&r.scrollHeight>r.clientHeight,l=n.direction===`rtl`,u=c&&(l?e.offsetX<=r.offsetWidth-r.clientWidth:e.offsetX>r.clientWidth),d=s&&e.offsetY>r.clientHeight;if(u||d)return}if(h(e))return;if(f()===`intentional`&&S.current){t.clear(),S.current=!1;return}if(typeof g==`function`&&!g(e))return;let u=a.current.floatingContext?.nodeId,d=m?Mg(m.nodesRef.current,u):[];if(d.length>0){let e=!0;if(d.forEach(t=>{t.context?.open&&!t.context.dataRef.current.__outsidePressBubbles&&(e=!1)}),!e)return}n.setOpen(!1,Lm(Om,e)),O()}function D(e){f()!==`sloppy`||e.pointerType===`touch`||!n.select(`open`)||!o||mh(e,n.select(`floatingElement`))||mh(e,n.select(`domReferenceElement`))||b(e)}function j(e){if(f()!==`sloppy`||!n.select(`open`)||!o||mh(e,n.select(`floatingElement`))||mh(e,n.select(`domReferenceElement`)))return;let t=e.touches[0];t&&(T.current={startTime:Date.now(),startX:t.clientX,startY:t.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},E.start(1e3,()=>{T.current&&(T.current.dismissOnTouchEnd=!1,T.current.dismissOnMouseDown=!1)}))}function N(e,t){let n=fh(e);if(!n)return;let r=Ap(n,e.type,()=>{t(e),r()})}function P(e){A.current=`touch`,N(e,j)}function F(e){E.clear(),e.type===`pointerdown`&&(A.current=e.pointerType),!(e.type===`mousedown`&&T.current&&!T.current.dismissOnMouseDown)&&N(e,e=>{e.type===`pointerdown`?D(e):b(e)})}function I(e){if(!y.current)return;let n=x.current;if(d(),f()===`intentional`){if(e.type===`pointercancel`){n&&u();return}if(!h(e)){if(n){u();return}typeof g==`function`&&!g(e)||(t.clear(),S.current=!0,O())}}}function L(e){if(f()!==`sloppy`||!T.current||mh(e,n.select(`floatingElement`))||mh(e,n.select(`domReferenceElement`)))return;let t=e.touches[0];if(!t)return;let r=Math.abs(t.clientX-T.current.startX),i=Math.abs(t.clientY-T.current.startY),a=Math.sqrt(r*r+i*i);a>5&&(T.current.dismissOnTouchEnd=!0),a>10&&(b(e),E.clear(),T.current=null)}function R(e){N(e,L)}function z(e){f()!==`sloppy`||!T.current||mh(e,n.select(`floatingElement`))||mh(e,n.select(`domReferenceElement`))||(T.current.dismissOnTouchEnd&&b(e),E.clear(),T.current=null)}function ee(e){N(e,z)}let B=Wp(i),te=Vm(s&&Vm(Ap(B,`keydown`,M),Ap(B,`compositionstart`,c),Ap(B,`compositionend`,l)),_&&Vm(Ap(B,`click`,F,!0),Ap(B,`pointerdown`,F,!0),Ap(B,`pointerup`,I,!0),Ap(B,`pointercancel`,I,!0),Ap(B,`mousedown`,F,!0),Ap(B,`mouseup`,I,!0),Ap(B,`touchstart`,P,!0),Ap(B,`touchmove`,R,!0),Ap(B,`touchend`,ee,!0)));return()=>{te(),e.clear(),t.clear(),d(),S.current=!1}},[a,i,s,_,g,r,o,C,w,M,O,v,m,n,E]),b.useEffect(O,[g,O]);let P=b.useMemo(()=>({onKeyDown:M,[uv[d]]:e=>{j()&&n.setOpen(!1,Lm(Tm,e.nativeEvent))},...d!==`intentional`&&{onClick(e){j()&&n.setOpen(!1,Lm(`trigger-press`,e.nativeEvent))}}}),[M,n,d,j]),F=Z(e=>{if(!r||!o||e.button!==0)return;let t=fh(e.nativeEvent);dh(n.select(`floatingElement`),t)&&(y.current||(y.current=!0,x.current=!1))}),I=Z(e=>{!r||!o||(e.defaultPrevented||e.nativeEvent.defaultPrevented)&&y.current&&(x.current=!0)}),L=b.useMemo(()=>({onKeyDown:M,onPointerDown:I,onMouseDown:I,onClickCapture:N,onMouseDownCapture(e){N(),F(e)},onPointerDownCapture(e){N(),F(e)},onMouseUpCapture:N,onTouchEndCapture:N,onTouchMoveCapture:N}),[M,N,F,I]);return b.useMemo(()=>o?{reference:P,floating:L,trigger:P}:{},[o,P,L])}function mv(e,t,n){let{reference:r,floating:i}=e,a=Ph(t),o=Fh(t),s=Nh(o),c=Ah(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(jh(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}async function hv(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=kh(t,e),p=qh(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=Jh(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=Jh(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var gv=50,_v=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:hv},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=mv(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<gv&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=mv(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},vv=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=kh(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=Ah(r),_=Ph(o),v=Ah(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[Gh(o)]:Lh(o)),x=p!==`none`;!d&&x&&b.push(...Wh(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=Ih(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==Ph(t))||T.every(e=>Ph(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=Ph(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function yv(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function bv(e){return xh.some(t=>e[t]>=0)}var xv=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=kh(e,t);switch(i){case`referenceHidden`:{let e=yv(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:bv(e)}}}case`escaped`:{let e=yv(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:bv(e)}}}default:return{}}}}},Sv=new Set([`left`,`top`]);async function Cv(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=Ah(n),s=jh(n),c=Ph(n)===`y`,l=Sv.has(o)?-1:1,u=a&&c?-1:1,d=kh(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var wv=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await Cv(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},Tv=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=kh(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=Ph(Ah(i)),p=Mh(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=Oh(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=Oh(n,h,r)}let g=c.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}}}}},Ev=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=kh(e,t),u={x:n,y:r},d=Ph(i),f=Mh(d),p=u[f],m=u[d],h=kh(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=Sv.has(Ah(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},Dv=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=kh(e,t),u=await o.detectOverflow(t,l),d=Ah(i),f=jh(i),p=Ph(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,b=Sh(h-u[g],v),x=Sh(m-u[_],y),S=!t.middlewareData.shift,C=b,w=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(w=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=v),S&&!f){let e=Ch(u.left,0),t=Ch(u.right,0),n=Ch(u.top,0),r=Ch(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:Ch(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:Ch(u.top,u.bottom))}await c({...t,availableWidth:w,availableHeight:C});let T=await o.getDimensions(s.floating);return m!==T.width||h!==T.height?{reset:{rects:!0}}:{}}}};function Ov(e){let t=wp(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=dp(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=wh(n)!==a||wh(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function kv(e){return up(e)?e:e.contextElement}function Av(e){let t=kv(e);if(!dp(t))return Eh(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=Ov(t),o=(a?wh(n.width):n.width)/r,s=(a?wh(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var jv=Eh(0);function Mv(e){let t=sp(e);return!Sp()||!t.visualViewport?jv:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Nv(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==sp(e)?!1:t}function Pv(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=kv(e),o=Eh(1);t&&(r?up(r)&&(o=Av(r)):o=Av(e));let s=Nv(a,n,r)?Mv(a):Eh(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=sp(a),t=r&&up(r)?sp(r):r,n=e,i=kp(n);for(;i&&r&&t!==n;){let e=Av(i),t=i.getBoundingClientRect(),r=wp(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=sp(i),i=kp(n)}}return Jh({width:u,height:d,x:c,y:l})}function Fv(e,t){let n=Tp(e).scrollLeft;return t?t.left+n:Pv(cp(e)).left+n}function Iv(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-Fv(e,n),y:n.top+t.scrollTop}}function Lv(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=cp(r),s=t?hp(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=Eh(1),u=Eh(0),d=dp(r);if((d||!d&&!a)&&((op(r)!==`body`||pp(o))&&(c=Tp(r)),d)){let e=Pv(r);l=Av(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?Iv(o,c):Eh(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function Rv(e){return Array.from(e.getClientRects())}function zv(e){let t=cp(e),n=Tp(e),r=e.ownerDocument.body,i=Ch(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=Ch(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+Fv(e),s=-n.scrollTop;return wp(r).direction===`rtl`&&(o+=Ch(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var Bv=25;function Vv(e,t){let n=sp(e),r=cp(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=Sp();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=Fv(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=Bv&&(a-=o)}else l<=Bv&&(a+=l);return{width:a,height:o,x:s,y:c}}function Hv(e,t){let n=Pv(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=dp(e)?Av(e):Eh(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Uv(e,t,n){let r;if(t===`viewport`)r=Vv(e,n);else if(t===`document`)r=zv(cp(e));else if(up(t))r=Hv(t,n);else{let n=Mv(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Jh(r)}function Wv(e,t){let n=Ep(e);return n===t||!up(n)||Cp(n)?!1:wp(n).position===`fixed`||Wv(n,t)}function Gv(e,t){let n=t.get(e);if(n)return n;let r=Op(e,[],!1).filter(e=>up(e)&&op(e)!==`body`),i=null,a=wp(e).position===`fixed`,o=a?Ep(e):e;for(;up(o)&&!Cp(o);){let t=wp(o),n=bp(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||pp(o)&&!n&&Wv(e,o))?r=r.filter(e=>e!==o):i=t,o=Ep(o)}return t.set(e,r),r}function Kv(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?hp(t)?[]:Gv(t,this._c):[].concat(n),r],o=Uv(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=Uv(t,a[e],i);s=Ch(n.top,s),c=Sh(n.right,c),l=Sh(n.bottom,l),u=Ch(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function qv(e){let{width:t,height:n}=Ov(e);return{width:t,height:n}}function Jv(e,t,n){let r=dp(t),i=cp(t),a=n===`fixed`,o=Pv(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=Eh(0);function l(){c.x=Fv(i)}if(r||!r&&!a)if((op(t)!==`body`||pp(i))&&(s=Tp(t)),r){let e=Pv(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l();a&&!r&&i&&l();let u=i&&!r&&!a?Iv(i,s):Eh(0);return{x:o.left+s.scrollLeft-c.x-u.x,y:o.top+s.scrollTop-c.y-u.y,width:o.width,height:o.height}}function Yv(e){return wp(e).position===`static`}function Xv(e,t){if(!dp(e)||wp(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return cp(e)===n&&(n=n.ownerDocument.body),n}function Zv(e,t){let n=sp(e);if(hp(e))return n;if(!dp(e)){let t=Ep(e);for(;t&&!Cp(t);){if(up(t)&&!Yv(t))return t;t=Ep(t)}return n}let r=Xv(e,t);for(;r&&mp(r)&&Yv(r);)r=Xv(r,t);return r&&Cp(r)&&Yv(r)&&!bp(r)?n:r||xp(e)||n}var Qv=async function(e){let t=this.getOffsetParent||Zv,n=this.getDimensions,r=await n(e.floating);return{reference:Jv(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function $v(e){return wp(e).direction===`rtl`}var ey={convertOffsetParentRelativeRectToViewportRelativeRect:Lv,getDocumentElement:cp,getClippingRect:Kv,getOffsetParent:Zv,getElementRects:Qv,getClientRects:Rv,getDimensions:qv,getScale:Av,isElement:up,isRTL:$v};function ty(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function ny(e,t){let n=null,r,i=cp(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(s||t(),!f||!p)return;let m=Th(d),h=Th(i.clientWidth-(u+f)),g=Th(i.clientHeight-(d+p)),_=Th(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:Ch(0,Sh(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(n!==c){if(!y)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!ty(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function ry(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=kv(e),u=i||a?[...l?Op(l):[],...t?Op(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?ny(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?Pv(e):null;c&&g();function g(){let t=Pv(e);h&&!ty(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var iy=wv,ay=Tv,oy=vv,sy=Dv,cy=xv,ly=Ev,uy=(e,t,n)=>{let r=new Map,i={platform:ey,...n},a={...i.platform,_c:r};return _v(e,t,{...i,platform:a})},dy=typeof document<`u`?b.useLayoutEffect:function(){};function fy(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!fy(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!fy(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function py(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function my(e,t){let n=py(e);return Math.round(t*n)/n}function hy(e){let t=b.useRef(e);return dy(()=>{t.current=e}),t}function gy(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=b.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=b.useState(r);fy(f,r)||p(r);let[m,h]=b.useState(null),[g,_]=b.useState(null),v=b.useCallback(e=>{e!==C.current&&(C.current=e,h(e))},[]),y=b.useCallback(e=>{e!==w.current&&(w.current=e,_(e))},[]),x=a||m,S=o||g,C=b.useRef(null),w=b.useRef(null),T=b.useRef(u),E=c!=null,D=hy(c),O=hy(i),k=hy(l),A=b.useCallback(()=>{if(!C.current||!w.current)return;let e={placement:t,strategy:n,middleware:f};O.current&&(e.platform=O.current),uy(C.current,w.current,e).then(e=>{let t={...e,isPositioned:k.current!==!1};j.current&&!fy(T.current,t)&&(T.current=t,F_.flushSync(()=>{d(t)}))})},[f,t,n,O,k]);dy(()=>{l===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let j=b.useRef(!1);dy(()=>(j.current=!0,()=>{j.current=!1}),[]),dy(()=>{if(x&&(C.current=x),S&&(w.current=S),x&&S){if(D.current)return D.current(x,S,A);A()}},[x,S,A,D,E]);let M=b.useMemo(()=>({reference:C,floating:w,setReference:v,setFloating:y}),[v,y]),N=b.useMemo(()=>({reference:x,floating:S}),[x,S]),P=b.useMemo(()=>{let e={position:n,left:0,top:0};if(!N.floating)return e;let t=my(N.floating,u.x),r=my(N.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...py(N.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,N.floating,u.x,u.y]);return b.useMemo(()=>({...u,update:A,refs:M,elements:N,floatingStyles:P}),[u,A,M,N,P])}var _y=(e,t)=>{let n=iy(e);return{name:n.name,fn:n.fn,options:[e,t]}},vy=(e,t)=>{let n=ay(e);return{name:n.name,fn:n.fn,options:[e,t]}},yy=(e,t)=>({fn:ly(e).fn,options:[e,t]}),by=(e,t)=>{let n=oy(e);return{name:n.name,fn:n.fn,options:[e,t]}},xy=(e,t)=>{let n=sy(e);return{name:n.name,fn:n.fn,options:[e,t]}},Sy=(e,t)=>{let n=cy(e);return{name:n.name,fn:n.fn,options:[e,t]}},Q=(e,t,n,r,i,a,...o)=>{if(o.length>0)throw Error(t_(1));let s;if(e&&t&&n&&r&&i&&a)s=(o,s,c,l)=>a(e(o,s,c,l),t(o,s,c,l),n(o,s,c,l),r(o,s,c,l),i(o,s,c,l),s,c,l);else if(e&&t&&n&&r&&i)s=(a,o,s,c)=>i(e(a,o,s,c),t(a,o,s,c),n(a,o,s,c),r(a,o,s,c),o,s,c);else if(e&&t&&n&&r)s=(i,a,o,s)=>r(e(i,a,o,s),t(i,a,o,s),n(i,a,o,s),a,o,s);else if(e&&t&&n)s=(r,i,a,o)=>n(e(r,i,a,o),t(r,i,a,o),i,a,o);else if(e&&t)s=(n,r,i,a)=>t(e(n,r,i,a),r,i,a);else if(e)s=e;else throw Error(`Missing arguments`);return s},Cy=o((e=>{var t=f();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var d=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?d:t.useSyncExternalStore})),wy=o(((e,t)=>{t.exports=Cy()})),Ty=o((e=>{var t=f(),n=wy();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),Ey=o(((e,t)=>{t.exports=Ty()})),Dy=[],Oy=void 0;function ky(){return Oy}function Ay(e){Dy.push(e)}function jy(e){let t=(t,n)=>{let r=Kp(Ny).current,i;try{Oy=r;for(let e of Dy)e.before(r);i=e(t,n);for(let e of Dy)e.after(r);r.didInitialize=!0}finally{Oy=void 0}return i};return t.displayName=e.displayName||e.name,t}function My(e){return b.forwardRef(jy(e))}function Ny(){return{didInitialize:!1}}var Py=wy(),Fy=Ey(),Iy=r_(19)?zy:By;function Ly(e,t,n,r,i){return Iy(e,t,n,r,i)}function Ry(e,t,n,r,i){let a=b.useCallback(()=>t(e.getSnapshot(),n,r,i),[e,t,n,r,i]);return(0,Py.useSyncExternalStore)(e.subscribe,a,a)}Ay({before(e){e.syncIndex=0,e.didInitialize||(e.syncTick=1,e.syncHooks=[],e.didChangeStore=!0,e.getSnapshot=()=>{let t=!1;for(let n=0;n<e.syncHooks.length;n+=1){let r=e.syncHooks[n],i=r.selector(r.store.state,r.a1,r.a2,r.a3);(r.didChange||!Object.is(r.value,i))&&(t=!0,r.value=i,r.didChange=!1)}return t&&(e.syncTick+=1),e.syncTick})},after(e){e.syncHooks.length>0&&(e.didChangeStore&&(e.didChangeStore=!1,e.subscribe=t=>{let n=new Set;for(let t of e.syncHooks)n.add(t.store);let r=[];for(let e of n)r.push(e.subscribe(t));return()=>{for(let e of r)e()}}),(0,Py.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot))}});function zy(e,t,n,r,i){let a=ky();if(!a)return Ry(e,t,n,r,i);let o=a.syncIndex;a.syncIndex+=1;let s;return a.didInitialize?(s=a.syncHooks[o],(s.store!==e||s.selector!==t||!Object.is(s.a1,n)||!Object.is(s.a2,r)||!Object.is(s.a3,i))&&(s.store!==e&&(a.didChangeStore=!0),s.store=e,s.selector=t,s.a1=n,s.a2=r,s.a3=i,s.didChange=!0)):(s={store:e,selector:t,a1:n,a2:r,a3:i,value:t(e.getSnapshot(),n,r,i),didChange:!1},a.syncHooks.push(s)),s.value}function By(e,t,n,r,i){return(0,Fy.useSyncExternalStoreWithSelector)(e.subscribe,e.getSnapshot,e.getSnapshot,e=>t(e,n,r,i))}var Vy=class{constructor(e){this.state=e,this.listeners=new Set,this.updateTick=0}subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});getSnapshot=()=>this.state;setState(e){if(this.state===e)return;this.state=e,this.updateTick+=1;let t=this.updateTick;for(let n of this.listeners){if(t!==this.updateTick)return;n(e)}}update(e){for(let t in e)if(!Object.is(this.state[t],e[t])){this.setState({...this.state,...e});return}}set(e,t){Object.is(this.state[e],t)||this.setState({...this.state,[e]:t})}notifyAll(){let e={...this.state};this.setState(e)}use(e,t,n,r){return Ly(this,e,t,n,r)}},Hy=class extends Vy{constructor(e,t={},n){super(e),this.context=t,this.selectors=n}useSyncedValue(e,t){b.useDebugValue(e),X(()=>{this.state[e]!==t&&this.set(e,t)},[e,t])}useSyncedValueWithCleanup(e,t){let n=this;X(()=>(n.state[e]!==t&&n.set(e,t),()=>{n.set(e,void 0)}),[n,e,t])}useSyncedValues(e){let t=this;X(()=>{t.update(e)},[t,...Object.values(e)])}useControlledProp(e,t){b.useDebugValue(e);let n=t!==void 0;X(()=>{n&&!Object.is(this.state[e],t)&&super.setState({...this.state,[e]:t})},[e,t,n])}select(e,t,n,r){let i=this.selectors[e];return i(this.state,t,n,r)}useState(e,t,n,r){return b.useDebugValue(e),Ly(this,this.selectors[e],t,n,r)}useContextCallback(e,t){b.useDebugValue(e);let n=Z(t??nm);this.context[e]=n}useStateSetter(e){let t=b.useRef(void 0);return t.current===void 0&&(t.current=t=>{this.set(e,t)}),t.current}observe(e,t){let n;n=typeof e==`function`?e:this.selectors[e];let r=n(this.state);return t(r,r,this),this.subscribe(e=>{let i=n(e);if(!Object.is(r,i)){let e=r;r=i,t(i,e,this)}})}},Uy={open:Q(e=>e.open),transitionStatus:Q(e=>e.transitionStatus),domReferenceElement:Q(e=>e.domReferenceElement),referenceElement:Q(e=>e.positionReference??e.referenceElement),floatingElement:Q(e=>e.floatingElement),floatingId:Q(e=>e.floatingId)},Wy=class extends Hy{constructor(e){let{syncOnly:t,nested:n,onOpenChange:r,triggerElements:i,...a}=e;super({...a,positionReference:a.referenceElement,domReferenceElement:a.referenceElement},{onOpenChange:r,dataRef:{current:{}},events:V_(),nested:n,triggerElements:i},Uy),this.syncOnly=t}syncOpenEvent=(e,t)=>{(!e||!this.state.open||t!=null&&ym(t))&&(this.context.dataRef.current.openEvent=e?t:void 0)};dispatchOpenChange=(e,t)=>{this.syncOpenEvent(e,t.event);let n={open:e,reason:t.reason,nativeEvent:t.event,nested:this.context.nested,triggerElement:t.trigger};this.context.events.emit(`openchange`,n)};setOpen=(e,t)=>{if(this.syncOnly){this.context.onOpenChange?.(e,t);return}this.dispatchOpenChange(e,t),this.context.onOpenChange?.(e,t)}};function Gy(e,t=!1,n=!1){let[r,i]=b.useState(e&&t?`idle`:void 0),[a,o]=b.useState(e);return e&&!a&&(o(!0),i(`starting`)),!e&&a&&r!==`ending`&&!n&&i(`ending`),!e&&!a&&r===`ending`&&i(void 0),X(()=>{if(!e&&a&&r!==`ending`&&n){let e=em.request(()=>{i(`ending`)});return()=>{em.cancel(e)}}},[e,a,r,n]),X(()=>{if(!e||t)return;let n=em.request(()=>{i(void 0)});return()=>{em.cancel(n)}},[t,e]),X(()=>{if(!e||!t)return;e&&a&&r!==`idle`&&i(`starting`);let n=em.request(()=>{i(`idle`)});return()=>{em.cancel(n)}},[t,e,a,r]),{mounted:a,setMounted:o,transitionStatus:r}}var Ky=function(e){return e.startingStyle=`data-starting-style`,e.endingStyle=`data-ending-style`,e}({}),qy={[Ky.startingStyle]:``},Jy={[Ky.endingStyle]:``},Yy={transitionStatus(e){return e===`starting`?qy:e===`ending`?Jy:null}};function Xy(e,t=!1,n=!0){let r=tm();return Z((i,a=null)=>{r.cancel();let o=X_(e);if(o==null)return;let s=o,c=()=>{F_.flushSync(i)};if(typeof s.getAnimations!=`function`||globalThis.BASE_UI_ANIMATIONS_DISABLED){i();return}function l(){Promise.all(s.getAnimations().map(e=>e.finished)).then(()=>{a?.aborted||c()}).catch(()=>{if(n){a?.aborted||c();return}let e=s.getAnimations();!a?.aborted&&e.length>0&&e.some(e=>e.pending||e.playState!==`finished`)&&l()})}if(t){let e=Ky.startingStyle;if(!s.hasAttribute(e)){r.request(l);return}let t=new MutationObserver(()=>{s.hasAttribute(e)||(t.disconnect(),l())});t.observe(s,{attributes:!0,attributeFilter:[e]}),a?.addEventListener(`abort`,()=>t.disconnect(),{once:!0});return}r.request(l)})}function Zy(e){let{enabled:t=!0,open:n,ref:r,onComplete:i}=e,a=Z(i),o=Xy(r,n,!1);b.useEffect(()=>{if(!t)return;let e=new AbortController;return o(a,e.signal),()=>{e.abort()}},[t,n,a,o])}function Qy(e,t){let n=b.useRef(null),r=b.useRef(null);return b.useCallback(i=>{if(e!==void 0){if(n.current!==null){let e=n.current,i=r.current,a=t.context.triggerElements.getById(e);i&&a===i&&t.context.triggerElements.delete(e),n.current=null,r.current=null}i!==null&&(n.current=e,r.current=i,t.context.triggerElements.add(e,i))}},[t,e])}function $y(e,t,n,r){let i=n.useState(`isMountedByTrigger`,e),a=Qy(e,n),o=Z(t=>{if(a(t),!t||!n.select(`open`))return;let i=n.select(`activeTriggerId`);if(i===e){n.update({activeTriggerElement:t,...r});return}i??n.update({activeTriggerId:e,activeTriggerElement:t,...r})});return X(()=>{i&&n.update({activeTriggerElement:t.current,...r})},[i,n,t,...Object.values(r)]),{registerTrigger:o,isMountedByThisTrigger:i}}function eb(e){let t=e.useState(`open`);X(()=>{if(t&&!e.select(`activeTriggerId`)&&e.context.triggerElements.size===1){let t=e.context.triggerElements.entries().next();if(!t.done){let[n,r]=t.value;e.update({activeTriggerId:n,activeTriggerElement:r})}}},[t,e])}function tb(e,t,n){let{mounted:r,setMounted:i,transitionStatus:a}=Gy(e);t.useSyncedValues({mounted:r,transitionStatus:a});let o=Z(()=>{i(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1}),n?.(),t.context.onOpenChangeComplete?.(!1)});return Zy({enabled:!t.useState(`preventUnmountingOnClose`),open:e,ref:t.context.popupRef,onComplete(){e||o()}}),{forceUnmount:o,transitionStatus:a}}var nb=class{constructor(){this.elementsSet=new Set,this.idMap=new Map}add(e,t){let n=this.idMap.get(e);n!==t&&(n!==void 0&&this.elementsSet.delete(n),this.elementsSet.add(t),this.idMap.set(e,t))}delete(e){let t=this.idMap.get(e);t&&(this.elementsSet.delete(t),this.idMap.delete(e))}hasElement(e){return this.elementsSet.has(e)}hasMatchingElement(e){for(let t of this.elementsSet)if(e(t))return!0;return!1}getById(e){return this.idMap.get(e)}entries(){return this.idMap.entries()}elements(){return this.elementsSet.values()}get size(){return this.idMap.size}};function rb(){return new Wy({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:new nb,floatingId:``,syncOnly:!1,nested:!1,onOpenChange:void 0})}function ib(){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:rb(),preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:im,inactiveTriggerProps:im,popupProps:im}}var ab=Q(e=>e.triggerIdProp??e.activeTriggerId),ob={open:Q(e=>e.openProp??e.open),mounted:Q(e=>e.mounted),transitionStatus:Q(e=>e.transitionStatus),floatingRootContext:Q(e=>e.floatingRootContext),preventUnmountingOnClose:Q(e=>e.preventUnmountingOnClose),payload:Q(e=>e.payload),activeTriggerId:ab,activeTriggerElement:Q(e=>e.mounted?e.activeTriggerElement:null),isTriggerActive:Q((e,t)=>t!==void 0&&ab(e)===t),isOpenedByTrigger:Q((e,t)=>t!==void 0&&ab(e)===t&&e.open),isMountedByTrigger:Q((e,t)=>t!==void 0&&ab(e)===t&&e.mounted),triggerProps:Q((e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps),popupProps:Q(e=>e.popupProps),popupElement:Q(e=>e.popupElement),positionerElement:Q(e=>e.positionerElement)};function sb(e){let{open:t=!1,onOpenChange:n,elements:r={}}=e,i=$g(),a=G_()!=null,o=Kp(()=>new Wy({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:new nb,floatingId:i,syncOnly:!1,nested:a})).current;return X(()=>{let e={open:t,floatingId:i};r.reference!==void 0&&(e.referenceElement=r.reference,e.domReferenceElement=up(r.reference)?r.reference:null),r.floating!==void 0&&(e.floatingElement=r.floating),o.update(e)},[t,i,r.reference,r.floating,o]),o.context.onOpenChange=n,o.context.nested=a,o}function cb(e={}){let{nodeId:t,externalTree:n}=e,r=sb(e),i=e.rootContext||r,a={reference:i.useState(`referenceElement`),floating:i.useState(`floatingElement`),domReference:i.useState(`domReferenceElement`)},[o,s]=b.useState(null),c=b.useRef(null),l=K_(n);X(()=>{a.domReference&&(c.current=a.domReference)},[a.domReference]);let u=gy({...e,elements:{...a,...o&&{reference:o}}}),d=b.useCallback(e=>{let t=up(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>e.getClientRects(),contextElement:e}:e;s(t),u.refs.setReference(t)},[u.refs]),[f,p]=b.useState(void 0),[m,h]=b.useState(null);i.useSyncedValue(`referenceElement`,f??null);let g=up(f)?f:null;i.useSyncedValue(`domReferenceElement`,f===void 0?a.domReference:g),i.useSyncedValue(`floatingElement`,m);let _=b.useCallback(e=>{(up(e)||e===null)&&(c.current=e,p(e)),(up(u.refs.reference.current)||u.refs.reference.current===null||e!==null&&!up(e))&&u.refs.setReference(e)},[u.refs,p]),v=b.useCallback(e=>{h(e),u.refs.setFloating(e)},[u.refs]),y=b.useMemo(()=>({...u.refs,setReference:_,setFloating:v,setPositionReference:d,domReference:c}),[u.refs,_,v,d]),x=b.useMemo(()=>({...u.elements,domReference:a.domReference}),[u.elements,a.domReference]),S=i.useState(`open`),C=i.useState(`floatingId`),w=b.useMemo(()=>({...u,dataRef:i.context.dataRef,open:S,onOpenChange:i.setOpen,events:i.context.events,floatingId:C,refs:y,elements:x,nodeId:t,rootStore:i}),[u,y,x,t,i,S,C]);return X(()=>{i.context.dataRef.current.floatingContext=w;let e=l?.nodesRef.current.find(e=>e.id===t);e&&(e.context=w)}),b.useMemo(()=>({...u,context:w,refs:y,elements:x,rootStore:i}),[u,y,x,w,i])}function lb(e){let{popupStore:t,treatPopupAsFloatingElement:n=!1,onOpenChange:r}=e,i=$g(),a=G_()!=null,o=t.useState(`open`),s=t.useState(`activeTriggerElement`),c=t.useState(n?`popupElement`:`positionerElement`),l=t.context.triggerElements,u=Kp(()=>new Wy({open:o,transitionStatus:void 0,referenceElement:s,floatingElement:c,triggerElements:l,onOpenChange:r,floatingId:i,syncOnly:!0,nested:a})).current;return X(()=>{let e={open:o,floatingId:i,referenceElement:s,floatingElement:c};up(s)&&(e.domReferenceElement=s),u.state.positionReference===u.state.referenceElement&&(e.positionReference=s),u.update(e)},[o,i,s,c,u]),u.context.onOpenChange=r,u.context.nested=a,u}var ub=zp&&Lp;function db(e,t={}){let n=`rootStore`in e?e.rootStore:e,{events:r,dataRef:i}=n.context,{enabled:a=!0,delay:o}=t,s=b.useRef(!1),c=b.useRef(null),l=Zp(),u=b.useRef(!0);b.useEffect(()=>{let e=n.select(`domReferenceElement`);if(!a)return;let t=sp(e);function r(){let e=n.select(`domReferenceElement`);!n.select(`open`)&&dp(e)&&e===uh(Wp(e))&&(s.current=!0)}function i(){u.current=!0}function o(){u.current=!1}return Vm(Ap(t,`blur`,r),ub&&Ap(t,`keydown`,i,!0),ub&&Ap(t,`pointerdown`,o,!0))},[n,a]),b.useEffect(()=>{if(!a)return;function e(e){if(e.reason===`trigger-press`||e.reason===`escape-key`){let e=n.select(`domReferenceElement`);up(e)&&(c.current=e,s.current=!0)}}return r.on(`openchange`,e),()=>{r.off(`openchange`,e)}},[r,a,n]);let d=b.useMemo(()=>({onMouseLeave(){s.current=!1,c.current=null},onFocus(e){let t=e.currentTarget;if(s.current){if(c.current===t)return;s.current=!1,c.current=null}let r=fh(e.nativeEvent);if(up(r)){if(ub&&!e.relatedTarget){if(!u.current&&!gh(r))return}else if(!yh(r))return}let i=ph(e.relatedTarget,n.context.triggerElements),{nativeEvent:a,currentTarget:d}=e,f=typeof o==`function`?o():o;if(n.select(`open`)&&i||f===0||f===void 0){n.setOpen(!0,Lm(Dm,a,d));return}l.start(f,()=>{s.current||n.setOpen(!0,Lm(Dm,a,d))})},onBlur(e){s.current=!1,c.current=null;let t=e.relatedTarget,r=e.nativeEvent,a=up(t)&&t.hasAttribute(Pg(`focus-guard`))&&t.getAttribute(`data-type`)===`outside`;l.start(0,()=>{let e=n.select(`domReferenceElement`),o=uh(Wp(e));!t&&o===e||dh(i.current.floatingContext?.refs.floating.current,o)||dh(e,o)||a||ph(t??o,n.context.triggerElements)||n.setOpen(!1,Lm(Dm,r))})}}),[i,n,l,o]);return b.useMemo(()=>a?{reference:d,trigger:d}:{},[a,d])}var fb=class e{constructor(){this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.pointerEventsScopeElement=null,this.pointerEventsReferenceElement=null,this.pointerEventsFloatingElement=null,this.restTimeoutPending=!1,this.openChangeTimeout=new Xp,this.restTimeout=new Xp,this.handleCloseOptions=void 0}static create(){return new e}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose},pb=new WeakMap;function mb(e){if(!e.performedPointerEventsMutation)return;let t=e.pointerEventsScopeElement;t&&pb.get(t)===e&&(e.pointerEventsScopeElement?.style.removeProperty(`pointer-events`),e.pointerEventsReferenceElement?.style.removeProperty(`pointer-events`),e.pointerEventsFloatingElement?.style.removeProperty(`pointer-events`),pb.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function hb(e,t){let{scopeElement:n,referenceElement:r,floatingElement:i}=t,a=pb.get(n);a&&a!==e&&mb(a),mb(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=n,e.pointerEventsReferenceElement=r,e.pointerEventsFloatingElement=i,pb.set(n,e),n.style.pointerEvents=`none`,r.style.pointerEvents=`auto`,i.style.pointerEvents=`auto`}function gb(e){let t=Kp(fb.create).current,n=e.context.dataRef.current;return n.hoverInteractionState||=t,Jp(n.hoverInteractionState.disposeEffect),n.hoverInteractionState}function _b(e,t={}){let n=`rootStore`in e?e.rootStore:e,r=n.useState(`open`),i=n.useState(`floatingElement`),a=n.useState(`domReferenceElement`),{dataRef:o}=n.context,{enabled:s=!0,closeDelay:c=0,nodeId:l}=t,u=gb(n),d=K_(),f=G_(),p=Z(()=>Cm(o.current.openEvent?.type,u.interactedInside)),m=Z(()=>{let e=o.current.openEvent?.type;return e?.includes(`mouse`)&&e!==`mousedown`}),h=Z(e=>ph(e,n.context.triggerElements)),g=b.useCallback(e=>{let t=xm(c,`close`,u.pointerType),r=()=>{n.setOpen(!1,Lm(Em,e)),d?.events.emit(`floating.closed`,e)};t?u.openChangeTimeout.start(t,r):(u.openChangeTimeout.clear(),r())},[c,n,u,d]),_=Z(()=>{mb(u)}),v=Z(e=>{let t=fh(e);if(!_h(t)){u.interactedInside=!1;return}u.interactedInside=t?.closest(`[aria-haspopup]`)!=null});X(()=>{r||(u.pointerType=void 0,u.restTimeoutPending=!1,u.interactedInside=!1,_())},[r,u,_]),b.useEffect(()=>_,[_]),X(()=>{if(s&&r&&u.handleCloseOptions?.blockPointerEvents&&m()&&up(a)&&i){let e=a,t=i,n=Wp(i),r=d?.nodesRef.current.find(e=>e.id===f)?.context?.elements.floating;return r&&(r.style.pointerEvents=``),hb(u,{scopeElement:u.handleCloseOptions?.getScope?.()??u.pointerEventsScopeElement??r??e.closest(`[data-rootownerid]`)??n.body,referenceElement:e,floatingElement:t}),()=>{_()}}},[s,r,a,i,u,m,d,f,_]);let y=Zp();b.useEffect(()=>{if(!s)return;function e(){u.openChangeTimeout.clear(),y.clear(),d?.events.off(`floating.closed`,r),_()}function t(e){if(d&&f&&Mg(d.nodesRef.current,f).length>0){d.events.on(`floating.closed`,r);return}if(h(e.relatedTarget))return;let t=o.current.floatingContext?.nodeId??l,n=e.relatedTarget;if(!(d&&t&&up(n)&&Mg(d.nodesRef.current,t,!1).some(e=>dh(e.context?.elements.floating,n)))){if(u.handler){u.handler(e);return}_(),p()||g(e)}}function r(e){!d||!f||Mg(d.nodesRef.current,f).length>0||y.start(0,()=>{d.events.off(`floating.closed`,r),n.setOpen(!1,Lm(Em,e)),d.events.emit(`floating.closed`,e)})}let a=i;return Vm(a&&Ap(a,`mouseenter`,e),a&&Ap(a,`mouseleave`,t),a&&Ap(a,`pointerdown`,v,!0),()=>{d?.events.off(`floating.closed`,r)})},[s,i,n,o,l,p,h,g,_,v,u,d,f,y])}var vb={current:null};function yb(e,t={}){let n=`rootStore`in e?e.rootStore:e,{dataRef:r,events:i}=n.context,{enabled:a=!0,delay:o=0,handleClose:s=null,mouseOnly:c=!1,restMs:l=0,move:u=!0,triggerElementRef:d=vb,externalTree:f,isActiveTrigger:p=!0,getHandleCloseContext:m,isClosing:h}=t,g=K_(f),_=gb(n),v=b.useRef(!1),y=Jm(s),x=Jm(o),S=Jm(l),C=Jm(a),w=Jm(h);p&&(_.handleCloseOptions=y.current?.__options);let T=Z(()=>Cm(r.current.openEvent?.type,_.interactedInside)),E=Z(e=>ph(e,n.context.triggerElements)),D=Z((e,t,r)=>{let i=n.context.triggerElements;if(i.hasElement(t))return!e||!dh(e,t);if(!up(r))return!1;let a=r;return i.hasMatchingElement(e=>dh(e,a))&&(!e||!dh(e,a))}),O=Z((e,t=!0)=>{let r=xm(x.current,`close`,_.pointerType);r?_.openChangeTimeout.start(r,()=>{n.setOpen(!1,Lm(Em,e)),g?.events.emit(`floating.closed`,e)}):t&&(_.openChangeTimeout.clear(),n.setOpen(!1,Lm(Em,e)),g?.events.emit(`floating.closed`,e))}),k=Z(()=>{_.handler&&=(Wp(n.select(`domReferenceElement`)).removeEventListener(`mousemove`,_.handler),void 0)}),A=Z(()=>{mb(_)});return b.useEffect(()=>k,[k]),b.useEffect(()=>{if(!a)return;function e(e){e.open?v.current=!1:(v.current=e.reason===Em,k(),_.openChangeTimeout.clear(),_.restTimeout.clear(),_.blockMouseMove=!0,_.restTimeoutPending=!1)}return i.on(`openchange`,e),()=>{i.off(`openchange`,e)}},[a,i,_,k]),b.useEffect(()=>{if(!a)return;let e=d.current??(p?n.select(`domReferenceElement`):null);if(!up(e))return;function t(e){if(_.openChangeTimeout.clear(),_.blockMouseMove=!1,c&&!vm(_.pointerType))return;let t=Sm(S.current),r=xm(x.current,`open`,_.pointerType),i=fh(e),a=e.currentTarget??null,o=n.select(`domReferenceElement`),s=a;if(up(i)&&!n.context.triggerElements.hasElement(i)){for(let e of n.context.triggerElements.elements())if(dh(e,i)){s=e;break}}up(a)&&up(o)&&!n.context.triggerElements.hasElement(a)&&dh(a,o)&&(s=o);let l=s==null?!1:D(o,s,i),u=n.select(`open`),d=w.current?.()??n.select(`transitionStatus`)===`ending`,f=!u&&d&&v.current,p=!l&&up(s)&&up(o)&&dh(o,s)&&f,m=t>0&&!r,h=l&&(u||f)||p,g=!u||l;if(h){n.setOpen(!0,Lm(Em,e,s));return}m||(r?_.openChangeTimeout.start(r,()=>{g&&n.setOpen(!0,Lm(Em,e,s))}):g&&n.setOpen(!0,Lm(Em,e,s)))}function i(e){if(T()){A();return}k();let t=Wp(n.select(`domReferenceElement`));_.restTimeout.clear(),_.restTimeoutPending=!1;let i=r.current.floatingContext??m?.();if(!E(e.relatedTarget)){if(y.current&&i){n.select(`open`)||_.openChangeTimeout.clear();let r=d.current;_.handler=y.current({...i,tree:g,x:e.clientX,y:e.clientY,onClose(){A(),k(),C.current&&!T()&&r===n.select(`domReferenceElement`)&&O(e,!0)}}),t.addEventListener(`mousemove`,_.handler),_.handler(e);return}(_.pointerType!==`touch`||!dh(n.select(`floatingElement`),e.relatedTarget))&&O(e)}}return u?Vm(Ap(e,`mousemove`,t,{once:!0}),Ap(e,`mouseenter`,t),Ap(e,`mouseleave`,i)):Vm(Ap(e,`mouseenter`,t),Ap(e,`mouseleave`,i))},[k,A,r,x,O,n,a,y,_,p,D,T,E,c,u,S,d,g,C,m,w]),b.useMemo(()=>{if(!a)return;function e(e){_.pointerType=e.pointerType}return{onPointerDown:e,onPointerEnter:e,onMouseMove(e){let{nativeEvent:t}=e,r=e.currentTarget,i=n.select(`domReferenceElement`),a=n.select(`open`),o=D(i,r,e.target);if(c&&!vm(_.pointerType))return;if(a&&o&&_.handleCloseOptions?.blockPointerEvents){let e=n.select(`floatingElement`);e&&hb(_,{scopeElement:_.handleCloseOptions?.getScope?.()??r.ownerDocument.body,referenceElement:r,floatingElement:e})}let s=Sm(S.current);if(a&&!o||s===0||!o&&_.restTimeoutPending&&e.movementX**2+e.movementY**2<2)return;_.restTimeout.clear();function l(){if(_.restTimeoutPending=!1,T())return;let e=n.select(`open`);!_.blockMouseMove&&(!e||o)&&n.setOpen(!0,Lm(Em,t,r))}_.pointerType===`touch`?F_.flushSync(()=>{l()}):o&&a?l():(_.restTimeoutPending=!0,_.restTimeout.start(s,l))}}},[a,_,T,D,c,n,S])}function bb(e=[]){let t=e.map(e=>e?.reference),n=e.map(e=>e?.floating),r=e.map(e=>e?.item),i=e.map(e=>e?.trigger),a=b.useCallback(t=>xb(t,e,`reference`),t),o=b.useCallback(t=>xb(t,e,`floating`),n),s=b.useCallback(t=>xb(t,e,`item`),r),c=b.useCallback(t=>xb(t,e,`trigger`),i);return b.useMemo(()=>({getReferenceProps:a,getFloatingProps:o,getItemProps:s,getTriggerProps:c}),[a,o,s,c])}function xb(e,t,n){let r=new Map,i=n===`item`,a={};n===`floating`&&(a.tabIndex=-1,a[ih]=``);for(let t in e)i&&e&&(t===`active`||t===`selected`)||(a[t]=e[t]);for(let o=0;o<t.length;o+=1){let s,c=t[o]?.[n];s=typeof c==`function`?e?c(e):null:c,s&&Sb(a,s,i,r)}return Sb(a,e,i,r),a}function Sb(e,t,n,r){for(let i in t){let a=t[i];n&&(i===`active`||i===`selected`)||(i.startsWith(`on`)?(r.has(i)||r.set(i,[]),typeof a==`function`&&(r.get(i)?.push(a),e[i]=(...e)=>r.get(i)?.map(t=>t(...e)).find(e=>e!==void 0))):e[i]=a)}}var Cb=`Escape`;function wb(e,t,n){switch(e){case`vertical`:return t;case`horizontal`:return n;default:return t||n}}function Tb(e,t){return wb(t,e===`ArrowUp`||e===`ArrowDown`,e===`ArrowLeft`||e===`ArrowRight`)}function Eb(e,t,n){return wb(t,e===`ArrowDown`,n?e===`ArrowLeft`:e===`ArrowRight`)||e===`Enter`||e===` `||e===``}function Db(e,t,n){return wb(t,n?e===oh:e===sh,e===lh)}function Ob(e,t,n,r){return t===`both`||t===`horizontal`&&r&&r>1?e===Cb:wb(t,n?e===sh:e===oh,e===ch)}function kb(e,t){let n=`rootStore`in e?e.rootStore:e,r=n.useState(`open`),i=n.useState(`floatingElement`),a=n.useState(`domReferenceElement`),o=n.context.dataRef,{listRef:s,activeIndex:c,onNavigate:l=()=>{},enabled:u=!0,selectedIndex:d=null,allowEscape:f=!1,loopFocus:p=!1,nested:m=!1,rtl:h=!1,virtual:g=!1,focusItemOnOpen:_=`auto`,focusItemOnHover:v=!0,openOnArrowKeyDown:y=!0,disabledIndices:x=void 0,orientation:S=`vertical`,parentOrientation:C,cols:w=1,id:T,resetOnPointerLeave:E=!0,externalTree:D}=t,O=Jm(bh(i)),k=G_(),A=K_(D);X(()=>{o.current.orientation=S},[o,S]);let j=vh(a),M=b.useRef(_),N=b.useRef(d??-1),P=b.useRef(null),F=b.useRef(!0),I=Z(e=>{l(N.current===-1?null:N.current,e)}),L=b.useRef(I),R=b.useRef(!!i),z=b.useRef(r),ee=b.useRef(!1),B=b.useRef(!1),te=b.useRef(null),V=Jm(x),H=Jm(r),ne=Jm(d),U=Jm(E),re=Z(()=>{function e(e){g?A?.events.emit(`virtualfocus`,e):te.current=Ig(e,{sync:ee.current,preventScroll:!0})}let t=s.current[N.current],n=B.current;t&&e(t),(ee.current?e=>e():requestAnimationFrame)(()=>{let r=s.current[N.current]||t;r&&(t||e(r),ae&&(n||!F.current)&&r.scrollIntoView?.({block:`nearest`,inline:`nearest`}))})});X(()=>{u&&(r&&i?(N.current=d??-1,M.current&&d!=null&&(B.current=!0,I())):R.current&&(N.current=-1,L.current()))},[u,r,i,d,I]),X(()=>{if(u){if(!r){ee.current=!1;return}if(i)if(c==null){if(ee.current=!1,ne.current!=null)return;if(R.current&&(N.current=-1,re()),(!z.current||!R.current)&&M.current&&(P.current!=null||M.current===!0&&P.current==null)){let e=0,t=()=>{s.current[0]==null?(e<2&&(e?requestAnimationFrame:queueMicrotask)(t),e+=1):(N.current=P.current==null||Eb(P.current,S,h)||m?Zh(s):Qh(s),P.current=null,I())};t()}}else Xh(s.current,c)||(N.current=c,re(),B.current=!1)}},[u,r,i,c,ne,m,s,S,h,I,re,V]),X(()=>{if(!u||i||!A||g||!R.current)return;let e=A.nodesRef.current,t=e.find(e=>e.id===k)?.context?.elements.floating,n=uh(Wp(i)),r=e.some(e=>e.context&&dh(e.context.elements.floating,n));t&&!r&&F.current&&t.focus({preventScroll:!0})},[u,i,A,k,g]),X(()=>{L.current=I,z.current=r,R.current=!!i}),X(()=>{r||(P.current=null,M.current=_)},[r,_]);let W=c!=null,ie=Z(e=>{if(!H.current)return;let t=s.current.indexOf(e.currentTarget);t!==-1&&(N.current!==t||c!==t)&&(N.current=t,I(e))}),ae=b.useMemo(()=>({onFocus(e){ee.current=!0,ie(e)},onClick:({currentTarget:e})=>e.focus({preventScroll:!0}),onMouseMove(e){ee.current=!0,B.current=!1,v&&ie(e)},onPointerLeave(e){if(!H.current||!F.current||e.pointerType===`touch`)return;ee.current=!0;let t=e.relatedTarget;if(!(!v||s.current.includes(t))&&U.current&&(te.current?.(),te.current=null,N.current=-1,I(e),!g)){let e=O.current,t=uh(Wp(e));e&&dh(e,t)&&e.focus({preventScroll:!0})}}}),[ie,H,O,v,s,I,U,g]),oe=b.useCallback(()=>C??A?.nodesRef.current.find(e=>e.id===k)?.context?.dataRef?.current.orientation,[k,A,C]),se=Z(e=>{if(F.current=!1,ee.current=!0,e.which===229||!H.current&&e.currentTarget===O.current)return;if(m&&Ob(e.key,S,h,w)){Tb(e.key,oe())||mm(e),n.setOpen(!1,Lm(Mm,e.nativeEvent)),dp(a)&&(g?A?.events.emit(`virtualfocus`,a):a.focus());return}let t=N.current,i=Zh(s,x),o=Qh(s,x);if(j||(e.key===`Home`&&(mm(e),N.current=i,I(e)),e.key===`End`&&(mm(e),N.current=o,I(e))),w>1){let t=Array.from({length:s.current.length},()=>({width:1,height:1})),n=tg(t,w,!1),r=n.findIndex(e=>e!=null&&!ig(s.current,e,x)),a=n.reduce((e,t,n)=>t!=null&&!ig(s.current,t,x)?n:e,-1),c=n[eg(n.map(e=>e==null?null:s.current[e]),{event:e,orientation:S,loopFocus:p,rtl:h,cols:w,disabledIndices:rg([...(typeof x==`function`?null:x)||s.current.map((e,t)=>ig(s.current,t,x)?t:void 0),void 0],n),minIndex:r,maxIndex:a,prevIndex:ng(N.current>o?i:N.current,t,n,w,e.key===`ArrowDown`?`bl`:e.key===(h?`ArrowLeft`:`ArrowRight`)?`tr`:`tl`),stopEvent:!0})];if(c!=null&&(N.current=c,I(e)),S===`both`)return}if(Tb(e.key,S)){if(mm(e),r&&!g&&uh(e.currentTarget.ownerDocument)===e.currentTarget){N.current=Eb(e.key,S,h)?i:o,I(e);return}Eb(e.key,S,h)?p?t>=o?f&&t!==s.current.length?N.current=-1:(ee.current=!1,N.current=i):N.current=$h(s.current,{startingIndex:t,disabledIndices:x}):N.current=Math.min(o,$h(s.current,{startingIndex:t,disabledIndices:x})):p?t<=i?f&&t!==-1?N.current=s.current.length:(ee.current=!1,N.current=o):N.current=$h(s.current,{startingIndex:t,decrement:!0,disabledIndices:x}):N.current=Math.max(i,$h(s.current,{startingIndex:t,decrement:!0,disabledIndices:x})),Xh(s.current,N.current)&&(N.current=-1),I(e)}}),ce=b.useMemo(()=>g&&r&&W&&{"aria-activedescendant":`${T}-${c}`},[g,r,W,T,c]),le=b.useMemo(()=>({"aria-orientation":S===`both`?void 0:S,...j?{}:ce,onKeyDown(e){if(e.key===`Tab`&&e.shiftKey&&r&&!g){let t=fh(e.nativeEvent);if(t&&!dh(O.current,t))return;mm(e),n.setOpen(!1,Lm(Am,e.nativeEvent)),dp(a)&&a.focus();return}se(e)},onPointerMove(){F.current=!0}}),[ce,se,O,S,j,n,r,g,a]),ue=b.useMemo(()=>{function e(e){_===`auto`&&gm(e.nativeEvent)&&(M.current=!g)}function t(e){M.current=_,_===`auto`&&_m(e.nativeEvent)&&(M.current=!0)}return{onKeyDown(e){let t=n.select(`open`);F.current=!1;let r=e.key.startsWith(`Arrow`),i=Db(e.key,oe(),h),a=Tb(e.key,S),o=(m?i:a)||e.key===`Enter`||e.key.trim()===``;if(g&&t)return se(e);if(!(!t&&!y&&r)){if(o){let t=Tb(e.key,oe());P.current=m&&t?null:e.key}if(m){i&&(mm(e),t?(N.current=Zh(s,V.current),I(e)):n.setOpen(!0,Lm(Mm,e.nativeEvent,e.currentTarget)));return}a&&(ne.current!=null&&(N.current=ne.current),mm(e),!t&&y?n.setOpen(!0,Lm(Mm,e.nativeEvent,e.currentTarget)):se(e),t&&I(e))}},onFocus(e){n.select(`open`)&&!g&&(N.current=-1,I(e))},onPointerDown:t,onPointerEnter:t,onMouseDown:e,onClick:e}},[se,V,_,s,m,I,n,y,S,oe,h,ne,g]),de=b.useMemo(()=>({...ce,...ue}),[ce,ue]);return b.useMemo(()=>u?{reference:de,floating:le,item:ae,trigger:ue}:{},[u,de,le,ue,ae])}var Ab=new Map([[`select`,`listbox`],[`combobox`,`listbox`],[`label`,!1]]);function jb(e,t={}){let n=`rootStore`in e?e.rootStore:e,r=n.useState(`open`),i=n.useState(`floatingId`),a=n.useState(`domReferenceElement`),o=n.useState(`floatingElement`),{role:s=`dialog`}=t,c=$g(),l=a?.id||c,u=b.useMemo(()=>bh(o)?.id||i,[o,i]),d=Ab.get(s)??s,f=G_()!=null,p=b.useMemo(()=>d===`tooltip`||s===`label`?im:{"aria-haspopup":d===`alertdialog`?`dialog`:d,"aria-expanded":`false`,...d===`listbox`&&{role:`combobox`},...d===`menu`&&f&&{role:`menuitem`},...s===`select`&&{"aria-autocomplete":`none`},...s===`combobox`&&{"aria-autocomplete":`list`}},[d,f,s]),m=b.useMemo(()=>d===`tooltip`||s===`label`?{[`aria-${s===`label`?`labelledby`:`describedby`}`]:r?u:void 0}:{...p,"aria-expanded":r?`true`:`false`,"aria-controls":r?u:void 0,...d===`menu`&&{id:l}},[d,u,r,l,s,p]),h=b.useMemo(()=>{let e={id:u,...d&&{role:d}};return d===`tooltip`||s===`label`?e:{...e,...d===`menu`&&{"aria-labelledby":l}}},[d,u,l,s]),g=b.useCallback(({active:e,selected:t})=>{let n={role:`option`,...e&&{id:`${u}-fui-option`}};switch(s){case`select`:case`combobox`:return{...n,"aria-selected":t};default:}return{}},[u,s]);return b.useMemo(()=>({reference:m,floating:h,item:g,trigger:p}),[m,h,p,g])}function Mb(e,t){let n=`rootStore`in e?e.rootStore:e,r=n.context.dataRef,i=n.useState(`open`),{listRef:a,elementsRef:o,activeIndex:s,onMatch:c,onTypingChange:l,enabled:u=!0,resetMs:d=750,selectedIndex:f=null}=t,p=Zp(),m=b.useRef(``),h=b.useRef(f??s??-1),g=b.useRef(null);X(()=>{!i&&f!==null||(p.clear(),g.current=null,m.current!==``&&(m.current=``))},[i,f,p]),X(()=>{i&&m.current===``&&(h.current=f??s??-1)},[i,f,s]);let _=Z(e=>{e?r.current.typing||(r.current.typing=e,l?.(e)):r.current.typing&&(r.current.typing=e,l?.(e))}),v=Z(e=>{function t(e){let t=o?.current[e];return!t||og(t)}function n(e,n,r=0){if(e.length===0)return-1;let i=(r%e.length+e.length)%e.length,a=n.toLocaleLowerCase();for(let n=0;n<e.length;n+=1){let r=(i+n)%e.length;if(!(!e[r]?.toLocaleLowerCase().startsWith(a)||!t(r)))return r}return-1}let r=a.current;if(m.current.length>0&&e.key===` `&&(mm(e),_(!0)),m.current.length>0&&m.current[0]!==` `&&n(r,m.current)===-1&&e.key!==` `&&_(!1),r==null||e.key.length!==1||e.ctrlKey||e.metaKey||e.altKey)return;i&&e.key!==` `&&(mm(e),_(!0));let l=m.current===``;l&&(h.current=f??s??-1),r.every(e=>e?e[0]?.toLocaleLowerCase()!==e[1]?.toLocaleLowerCase():!0)&&m.current===e.key&&(m.current=``,h.current=g.current),m.current+=e.key,p.start(d,()=>{m.current=``,h.current=g.current,_(!1)});let u=((l?f??s??-1:h.current)??0)+1,v=n(r,m.current,u);v===-1?e.key!==` `&&(m.current=``,_(!1)):(c?.(v),g.current=v)}),y=Z(e=>{let t=e.relatedTarget,r=n.select(`domReferenceElement`),i=n.select(`floatingElement`),a=dh(r,t),o=dh(i,t);a||o||(p.clear(),m.current=``,h.current=g.current,_(!1))}),x=b.useMemo(()=>({onKeyDown:v,onBlur:y}),[v,y]),S=b.useMemo(()=>({onKeyDown:v,onBlur:y}),[v,y]);return b.useMemo(()=>u?{reference:x,floating:S}:{},[u,x,S])}var Nb=.1,Pb=Nb*Nb,Fb=.5;function Ib(e,t,n,r,i,a){return r>=t!=a>=t&&e<=(i-n)*(t-r)/(a-r)+n}function Lb(e,t,n,r,i,a,o,s,c,l){let u=!1;return Ib(e,t,n,r,i,a)&&(u=!u),Ib(e,t,i,a,o,s)&&(u=!u),Ib(e,t,o,s,c,l)&&(u=!u),Ib(e,t,c,l,n,r)&&(u=!u),u}function Rb(e,t,n){return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function zb(e,t,n,r,i,a){return e>=Math.min(n,i)&&e<=Math.max(n,i)&&t>=Math.min(r,a)&&t<=Math.max(r,a)}function Bb(e={}){let{blockPointerEvents:t=!1}=e,n=new Xp,r=({x:e,y:t,placement:r,elements:i,onClose:a,nodeId:o,tree:s})=>{let c=r?.split(`-`)[0],l=!1,u=null,d=null,f=typeof performance<`u`?performance.now():0;function p(e,t){let n=performance.now(),r=n-f;if(u===null||d===null||r===0)return u=e,d=t,f=n,!1;let i=e-u,a=t-d,o=i*i+a*a,s=r*r*Pb;return u=e,d=t,f=n,o<s}function m(){n.clear(),a()}return function(r){n.clear();let a=i.domReference,u=i.floating;if(!a||!u||c==null||e==null||t==null)return;let{clientX:d,clientY:f}=r,h=fh(r),g=r.type===`mouseleave`,_=dh(u,h),v=dh(a,h);if(_&&(l=!0,!g))return;if(v&&(l=!1,!g)){l=!0;return}if(g&&up(r.relatedTarget)&&dh(u,r.relatedTarget))return;function y(){return!!(s&&Mg(s.nodesRef.current,o).length>0)}function b(){y()||m()}if(y())return;let x=a.getBoundingClientRect(),S=u.getBoundingClientRect(),C=e>S.right-S.width/2,w=t>S.bottom-S.height/2,T=S.width>x.width,E=S.height>x.height,D=(T?x:S).left,O=(T?x:S).right,k=(E?x:S).top,A=(E?x:S).bottom;if(c===`top`&&t>=x.bottom-1||c===`bottom`&&t<=x.top+1||c===`left`&&e>=x.right-1||c===`right`&&e<=x.left+1){b();return}let j=!1;switch(c){case`top`:j=zb(d,f,D,x.top+1,O,S.bottom-1);break;case`bottom`:j=zb(d,f,D,S.top+1,O,x.bottom-1);break;case`left`:j=zb(d,f,S.right-1,A,x.left+1,k);break;case`right`:j=zb(d,f,x.right-1,A,S.left+1,k);break;default:}if(j)return;if(l&&!Rb(d,f,x)){b();return}if(!g&&p(d,f)){b();return}let M=!1;switch(c){case`top`:{let n=T?Fb/2:Fb*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t+Fb+1,o=C||T?S.bottom-Fb:S.top,s=C?T?S.bottom-Fb:S.top:S.bottom-Fb;M=Lb(d,f,r,a,i,a,S.left,o,S.right,s);break}case`bottom`:{let n=T?Fb/2:Fb*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t-Fb,o=C||T?S.top+Fb:S.bottom,s=C?T?S.top+Fb:S.bottom:S.top+Fb;M=Lb(d,f,r,a,i,a,S.left,o,S.right,s);break}case`left`:{let n=E?Fb/2:Fb*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e+Fb+1,o=w||E?S.right-Fb:S.left,s=w?E?S.right-Fb:S.left:S.right-Fb;M=Lb(d,f,o,S.top,s,S.bottom,a,r,a,i);break}case`right`:{let n=E?Fb/2:Fb*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e-Fb,o=w||E?S.left+Fb:S.right,s=w?E?S.left+Fb:S.right:S.left+Fb;M=Lb(d,f,a,r,a,i,o,S.top,s,S.bottom);break}default:}M?l||n.start(40,b):b()}};return r.__options={...e,blockPointerEvents:t},r}function Vb(e){let t=b.useRef(``),n=b.useCallback(n=>{n.defaultPrevented||(t.current=n.pointerType,e(n,n.pointerType))},[e]);return{onClick:b.useCallback(n=>{if(n.detail===0){e(n,`keyboard`);return}`pointerType`in n?e(n,n.pointerType):e(n,t.current),t.current=``},[e]),onPointerDown:n}}function Hb(e,t){let n=b.useRef(e),r=Z(t);X(()=>{n.current!==e&&r(n.current)},[e,r]),X(()=>{n.current=e},[e])}function Ub(e){let[t,n]=b.useState(null),r=Z((t,r)=>{e||n(r||(Ip?`touch`:``))});Hb(e,t=>{t&&!e&&n(null)});let{onClick:i,onPointerDown:a}=Vb(r);return b.useMemo(()=>({openMethod:t,triggerProps:{onClick:i,onPointerDown:a}}),[t,i,a])}function Wb(e){let{store:t,parentContext:n,actionsRef:r,isDrawer:i}=e,a=t.useState(`open`),o=t.useState(`disablePointerDismissal`),s=t.useState(`modal`),c=t.useState(`popupElement`),{openMethod:l,triggerProps:u}=Ub(a);eb(t);let{forceUnmount:d}=tb(a,t),f=b.useCallback(()=>{t.setOpen(!1,Lm(Fm))},[t]);b.useImperativeHandle(r,()=>({unmount:d,close:f}),[d,f]);let p=lb({popupStore:t,onOpenChange:t.setOpen,treatPopupAsFloatingElement:!0}),[m,h]=b.useState(0),[g,_]=b.useState(0),v=m===0,y=jb(p),x=pv(p,{outsidePressEvent(){return t.context.internalBackdropRef.current||t.context.backdropRef.current?`intentional`:{mouse:s===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}},outsidePress(e){if(!t.context.outsidePressEnabledRef.current||`button`in e&&e.button!==0||`touches`in e&&e.touches.length!==1)return!1;let n=fh(e);if(v&&!o){let e=n;return s&&(t.context.internalBackdropRef.current||t.context.backdropRef.current)?t.context.internalBackdropRef.current===e||t.context.backdropRef.current===e||dh(e,c)&&!e?.hasAttribute(`data-base-ui-portal`):!0}return!1},escapeKey:v});pm(a&&s===!0,c);let{getReferenceProps:S,getFloatingProps:C,getTriggerProps:w}=bb([y,x]);t.useContextCallback(`onNestedDialogOpen`,(e,t)=>{h(e),_(t)}),t.useContextCallback(`onNestedDialogClose`,()=>{h(0),_(0)}),b.useEffect(()=>(n?.onNestedDialogOpen&&a&&n.onNestedDialogOpen(m+1,g+ +!!i),n?.onNestedDialogClose&&!a&&n.onNestedDialogClose(),()=>{n?.onNestedDialogClose&&a&&n.onNestedDialogClose()}),[i,a,m,g,n]);let T=b.useMemo(()=>S(u),[S,u]),E=b.useMemo(()=>w(u),[w,u]),D=b.useMemo(()=>C(),[C]);t.useSyncedValues({openMethod:l,activeTriggerProps:T,inactiveTriggerProps:E,popupProps:D,floatingRootContext:p,nestedOpenDialogCount:m,nestedOpenDrawerCount:g})}var Gb=b.createContext(void 0);function Kb(e){let t=b.useContext(Gb);if(e===!1&&t===void 0)throw Error(t_(27));return t}var qb={...ob,modal:Q(e=>e.modal),nested:Q(e=>e.nested),nestedOpenDialogCount:Q(e=>e.nestedOpenDialogCount),nestedOpenDrawerCount:Q(e=>e.nestedOpenDrawerCount),disablePointerDismissal:Q(e=>e.disablePointerDismissal),openMethod:Q(e=>e.openMethod),descriptionElementId:Q(e=>e.descriptionElementId),titleElementId:Q(e=>e.titleElementId),viewportElement:Q(e=>e.viewportElement),role:Q(e=>e.role)},Jb=class e extends Hy{constructor(e){super(Yb(e),{popupRef:b.createRef(),backdropRef:b.createRef(),internalBackdropRef:b.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:new nb,onOpenChange:void 0,onOpenChangeComplete:void 0},qb)}setOpen=(e,t)=>{if(t.preventUnmountOnClose=()=>{this.set(`preventUnmountingOnClose`,!0)},!e&&t.trigger==null&&this.state.activeTriggerId!=null&&(t.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(e,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(e,t);let n={open:e},r=t.trigger?.id??null;(r||e)&&(n.activeTriggerId=r,n.activeTriggerElement=t.trigger??null),this.update(n)};static useStore(t,n){let r=Kp(()=>new e(n)).current;return t??r}};function Yb(e={}){return{...ib(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:`dialog`,...e}}var Xb=b.createContext(!1);function Zb(e){let{children:t,open:n,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:a,actionsRef:o,handle:s,triggerId:c,defaultTriggerId:l=null}=e,u=Kb(!0),d=!!u,f=Jb.useStore(s?.store,{open:r,openProp:n,activeTriggerId:l,triggerIdProp:c,modal:!0,disablePointerDismissal:!0,nested:d,role:`alertdialog`});f.useControlledProp(`openProp`,n),f.useControlledProp(`triggerIdProp`,c),f.useSyncedValue(`nested`,d),f.useContextCallback(`onOpenChange`,i),f.useContextCallback(`onOpenChangeComplete`,a);let p=f.useState(`payload`);Wb({store:f,actionsRef:o,parentContext:u?.store.context,isDrawer:!1,onOpenChange:i,triggerIdProp:c});let m=b.useMemo(()=>({store:f}),[f]);return(0,y.jsx)(Xb.Provider,{value:!1,children:(0,y.jsx)(Gb.Provider,{value:m,children:typeof t==`function`?t({payload:p}):t})})}var Qb=function(e){return e.open=`data-open`,e.closed=`data-closed`,e[e.startingStyle=Ky.startingStyle]=`startingStyle`,e[e.endingStyle=Ky.endingStyle]=`endingStyle`,e.anchorHidden=`data-anchor-hidden`,e.side=`data-side`,e.align=`data-align`,e}({}),$b=function(e){return e.popupOpen=`data-popup-open`,e.pressed=`data-pressed`,e}({}),ex={[$b.popupOpen]:``},tx={[$b.popupOpen]:``,[$b.pressed]:``},nx={[Qb.open]:``},rx={[Qb.closed]:``},ix={[Qb.anchorHidden]:``},ax={open(e){return e?ex:null}},ox={open(e){return e?tx:null}},sx={open(e){return e?nx:rx},anchorHidden(e){return e?ix:null}},cx={...sx,...Yy},lx=b.forwardRef(function(e,t){let{render:n,className:r,style:i,forceRender:a=!1,...o}=e,{store:s}=Kb(),c=s.useState(`open`),l=s.useState(`nested`),u=s.useState(`mounted`);return w_(`div`,e,{state:{open:c,transitionStatus:s.useState(`transitionStatus`)},ref:[s.context.backdropRef,t],stateAttributesMapping:cx,props:[{role:`presentation`,hidden:!u,style:{userSelect:`none`,WebkitUserSelect:`none`}},o],enabled:a||!l})}),ux=b.createContext(void 0);function dx(e=!1){let t=b.useContext(ux);if(t===void 0&&!e)throw Error(t_(16));return t}function fx(e){let{focusableWhenDisabled:t,disabled:n,composite:r=!1,tabIndex:i=0,isNativeButton:a}=e,o=r&&t!==!1,s=r&&t===!1;return{props:b.useMemo(()=>{let e={onKeyDown(e){n&&t&&e.key!==`Tab`&&e.preventDefault()}};return r||(e.tabIndex=i,!a&&n&&(e.tabIndex=t?i:-1)),(a&&(t||o)||!a&&n)&&(e[`aria-disabled`]=n),a&&(!t||s)&&(e.disabled=n),e},[r,n,t,o,s,a,i])}}function px(e={}){let{disabled:t=!1,focusableWhenDisabled:n,tabIndex:r=0,native:i=!0,composite:a}=e,o=b.useRef(null),s=dx(!0),c=a??s!==void 0,{props:l}=fx({focusableWhenDisabled:n,disabled:t,composite:c,tabIndex:r,isNativeButton:i}),u=b.useCallback(()=>{let e=o.current;mx(e)&&c&&t&&l.disabled===void 0&&e.disabled&&(e.disabled=!1)},[t,l.disabled,c]);return X(u,[u]),{getButtonProps:b.useCallback((e={})=>{let{onClick:n,onMouseDown:r,onKeyUp:a,onKeyDown:o,onPointerDown:s,...u}=e;return u_({type:i?`button`:void 0,onClick(e){if(t){e.preventDefault();return}n?.(e)},onMouseDown(e){t||r?.(e)},onKeyDown(e){if(t||(x_(e),o?.(e),e.baseUIHandlerPrevented))return;let r=e.target===e.currentTarget,a=e.currentTarget,s=mx(a),l=!i&&hx(a),u=r&&(i?s:!l),d=e.key===`Enter`,f=e.key===` `,p=a.getAttribute(`role`),m=p?.startsWith(`menuitem`)||p===`option`||p===`gridcell`;if(r&&c&&f){if(e.defaultPrevented&&m)return;e.preventDefault(),l||i&&s?(a.click(),e.preventBaseUIHandler()):u&&(n?.(e),e.preventBaseUIHandler());return}u&&(!i&&(f||d)&&e.preventDefault(),!i&&d&&n?.(e))},onKeyUp(e){if(!t){if(x_(e),a?.(e),e.target===e.currentTarget&&i&&c&&mx(e.currentTarget)&&e.key===` `){e.preventDefault();return}e.baseUIHandlerPrevented||e.target===e.currentTarget&&!i&&!c&&e.key===` `&&n?.(e)}},onPointerDown(e){if(t){e.preventDefault();return}s?.(e)}},i?void 0:{role:`button`},l,u)},[t,l,c,i]),buttonRef:Z(e=>{o.current=e,u()})}}function mx(e){return dp(e)&&e.tagName===`BUTTON`}function hx(e){return!!(e?.tagName===`A`&&e?.href)}function gx(e){return $g(e,`base-ui`)}var _x=b.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,{store:s}=Kb(),c=gx(a);return s.useSyncedValueWithCleanup(`descriptionElementId`,c),w_(`p`,e,{ref:t,props:[{id:c},o]})}),vx=function(e){return e.nestedDialogs=`--nested-dialogs`,e}({}),yx=function(e){return e[e.open=Qb.open]=`open`,e[e.closed=Qb.closed]=`closed`,e[e.startingStyle=Qb.startingStyle]=`startingStyle`,e[e.endingStyle=Qb.endingStyle]=`endingStyle`,e.nested=`data-nested`,e.nestedDialogOpen=`data-nested-dialog-open`,e}({}),bx=b.createContext(void 0);function xx(){let e=b.useContext(bx);if(e===void 0)throw Error(t_(26));return e}var Sx=`ArrowUp`,Cx=`ArrowDown`,wx=`ArrowLeft`,Tx=`ArrowRight`,Ex=`Home`,Dx=new Set([wx,Tx]),Ox=new Set([Sx,Cx]),kx=new Set([...Dx,...Ox]);new Set([...kx,Ex,`End`]);var Ax=new Set([Sx,Cx,wx,Tx,Ex,`End`]),jx={...sx,...Yy,nestedDialogOpen(e){return e?{[yx.nestedDialogOpen]:``}:null}},Mx=b.forwardRef(function(e,t){let{className:n,finalFocus:r,initialFocus:i,render:a,style:o,...s}=e,{store:c}=Kb(),l=c.useState(`descriptionElementId`),u=c.useState(`disablePointerDismissal`),d=c.useState(`floatingRootContext`),f=c.useState(`popupProps`),p=c.useState(`modal`),m=c.useState(`mounted`),h=c.useState(`nested`),g=c.useState(`nestedOpenDialogCount`),_=c.useState(`open`),v=c.useState(`openMethod`),b=c.useState(`titleElementId`),x=c.useState(`transitionStatus`),S=c.useState(`role`);xx(),Zy({open:_,ref:c.context.popupRef,onComplete(){_&&c.context.onOpenChangeComplete?.(!0)}});function C(e){return e===`touch`?c.context.popupRef.current:!0}let w=i===void 0?C:i,T=w_(`div`,e,{state:{open:_,nested:h,transitionStatus:x,nestedDialogOpen:g>0},props:[f,{"aria-labelledby":b??void 0,"aria-describedby":l??void 0,role:S,tabIndex:-1,hidden:!m,onKeyDown(e){Ax.has(e.key)&&e.stopPropagation()},style:{[vx.nestedDialogs]:g}},s],ref:[t,c.context.popupRef,c.useStateSetter(`popupElement`)],stateAttributesMapping:jx});return(0,y.jsx)(av,{context:d,openInteractionType:v,disabled:!m,closeOnFocusOut:!u,initialFocus:w,returnFocus:r,modal:p!==!1,restoreFocus:`popup`,children:T})});function Nx(e){return r_(19)?e:e?`true`:void 0}var Px=b.forwardRef(function(e,t){let{cutout:n,...r}=e,i;if(n){let e=n.getBoundingClientRect();i=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${e.left}px ${e.top}px,${e.left}px ${e.bottom}px,${e.right}px ${e.bottom}px,${e.right}px ${e.top}px,${e.left}px ${e.top}px)`}return(0,y.jsx)(`div`,{ref:t,role:`presentation`,"data-base-ui-inert":``,...r,style:{position:`fixed`,inset:0,userSelect:`none`,WebkitUserSelect:`none`,clipPath:i}})}),Fx=b.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i}=Kb(),a=i.useState(`mounted`),o=i.useState(`modal`),s=i.useState(`open`);return a||n?(0,y.jsx)(bx.Provider,{value:n,children:(0,y.jsxs)(B_,{ref:t,...r,children:[a&&o===!0&&(0,y.jsx)(Px,{ref:i.context.internalBackdropRef,inert:Nx(!s)}),e.children]})}):null}),Ix=b.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,{store:s}=Kb(),c=gx(a);return s.useSyncedValueWithCleanup(`titleElementId`,c),w_(`h2`,e,{ref:t,props:[{id:c},o]})}),Lx=`border border-border/60 bg-background/70 text-muted-foreground shadow-xs ring-0 backdrop-blur-md`,Rx=`duration-150 ease-snappy data-closed:duration-100 data-closed:fade-out-0 data-closed:zoom-out-95 data-closed:blur-out-[5px] data-closed:slide-out-to-top-2 data-open:fade-in-0 data-open:zoom-in-95 data-open:blur-in-[5px] data-open:slide-in-from-top-2`,zx=`fixed inset-0 isolate z-50 bg-black/10 supports-backdrop-filter:backdrop-blur-xs`,Bx=`duration-150 ease-snappy data-closed:duration-100 data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,Vx=`border border-border/60 bg-background/90 text-foreground shadow-lg ring-0`,Hx=`duration-150 ease-snappy data-closed:duration-100 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,Ux=`absolute inset-0 bg-black/10 supports-backdrop-filter:backdrop-blur-xs transition-[opacity,backdrop-filter] duration-150 ease-snappy data-[closed]:opacity-0 data-[open]:opacity-100`,Wx=`transition-[opacity,transform] duration-150 ease-snappy data-[closed]:opacity-0 data-[closed]:scale-95 data-[open]:opacity-100 data-[open]:scale-100`,Gx=b.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,focusableWhenDisabled:a=!1,nativeButton:o=!0,style:s,...c}=e,{getButtonProps:l,buttonRef:u}=px({disabled:i,focusableWhenDisabled:a,native:o});return w_(`button`,e,{state:{disabled:i},ref:[t,u],props:[c,l]})}),Kx=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,qx=jd,Jx=(e,t)=>n=>{if(t?.variants==null)return qx(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=Kx(t)||Kx(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return qx(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},Yx=Jx(`group/button inline-flex shrink-0 items-center justify-center rounded-md border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`bg-primary text-primary-foreground hover:bg-primary/80`,outline:`border-border bg-background shadow-xs hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50`,secondary:`bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground`,ghost:`hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50`,destructive:`bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40`,link:`text-primary underline-offset-4 hover:underline`},size:{default:`h-9 gap-1.5 px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,xs:`h-6 gap-1 rounded-[min(var(--radius-md),8px)] px-2 text-xs in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3`,sm:`h-8 gap-1 rounded-[min(var(--radius-md),10px)] px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5`,lg:`h-10 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,icon:`size-9`,"icon-xs":`size-6 rounded-[min(var(--radius-md),8px)] in-data-[slot=button-group]:rounded-md [&_svg:not([class*='size-'])]:size-3`,"icon-sm":`size-8 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-md`,"icon-lg":`size-10`}},defaultVariants:{variant:`default`,size:`default`}});function Xx({className:e,variant:t=`default`,size:n=`default`,...r}){return(0,y.jsx)(Gx,{"data-slot":`button`,className:rp(Yx({variant:t,size:n,className:e})),...r})}function Zx({...e}){return(0,y.jsx)(Zb,{"data-slot":`alert-dialog`,...e})}function Qx({...e}){return(0,y.jsx)(Fx,{"data-slot":`alert-dialog-portal`,...e})}function $x({className:e,...t}){return(0,y.jsx)(lx,{"data-slot":`alert-dialog-overlay`,className:rp(zx,Bx,e),...t})}function eS({className:e,size:t=`default`,...n}){return(0,y.jsxs)(Qx,{children:[(0,y.jsx)($x,{}),(0,y.jsx)(Mx,{"data-slot":`alert-dialog-content`,"data-size":t,className:rp(`group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid w-full -translate-x-1/2 -translate-y-1/2 gap-6 rounded-xl p-6 text-popover-foreground outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-lg`,Vx,Hx,e),...n})]})}function tS({className:e,...t}){return(0,y.jsx)(`div`,{"data-slot":`alert-dialog-header`,className:rp(`grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-6 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]`,e),...t})}function nS({className:e,...t}){return(0,y.jsx)(`div`,{"data-slot":`alert-dialog-footer`,className:rp(`flex flex-col-reverse gap-2 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end`,e),...t})}function rS({className:e,...t}){return(0,y.jsx)(Ix,{"data-slot":`alert-dialog-title`,className:rp(`font-heading text-lg font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2`,e),...t})}function iS({className:e,...t}){return(0,y.jsx)(_x,{"data-slot":`alert-dialog-description`,className:rp(`text-sm text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground`,e),...t})}function aS({className:e,...t}){return(0,y.jsx)(Xx,{"data-slot":`alert-dialog-action`,className:rp(e),...t})}function oS(e){return w_(e.defaultTagName??`div`,e,e)}var sS=Jx(`group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!`,{variants:{variant:{default:`bg-primary text-primary-foreground [a]:hover:bg-primary/80`,secondary:`bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80`,destructive:`bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20`,outline:`border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground`,ghost:`hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50`,link:`text-primary underline-offset-4 hover:underline`}},defaultVariants:{variant:`default`}});function cS({className:e,variant:t=`default`,render:n,...r}){return oS({defaultTagName:`span`,props:u_({className:rp(sS({variant:t}),e)},r),render:n,state:{slot:`badge`,variant:t}})}var lS=function(e){return e.disabled=`data-disabled`,e.valid=`data-valid`,e.invalid=`data-invalid`,e.touched=`data-touched`,e.dirty=`data-dirty`,e.filled=`data-filled`,e.focused=`data-focused`,e}({}),uS={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},dS={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},fS={disabled:!1,...dS},pS={valid(e){return e===null?null:e?{[lS.valid]:``}:{[lS.invalid]:``}}},mS=b.createContext({invalid:void 0,name:void 0,validityData:{state:uS,errors:[],error:``,value:``,initialValue:null},setValidityData:nm,disabled:void 0,touched:dS.touched,setTouched:nm,dirty:dS.dirty,setDirty:nm,filled:dS.filled,setFilled:nm,focused:dS.focused,setFocused:nm,validate:()=>null,validationMode:`onSubmit`,validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:fS,markedDirtyRef:{current:!1},registerFieldControl:nm,validation:{getValidationProps:(e=im)=>e,getInputValidationProps:(e=im)=>e,inputRef:{current:null},commit:async()=>{}}});function hS(e=!0){let t=b.useContext(mS);if(t.setValidityData===nm&&!e)throw Error(t_(28));return t}var gS=b.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:nm,validationMode:`onSubmit`,submitAttemptedRef:{current:!1}});function _S(){return b.useContext(gS)}var vS=b.createContext({controlId:void 0,registerControlId:nm,labelId:void 0,setLabelId:nm,messageIds:[],setMessageIds:nm,getDescriptionProps:e=>e});function yS(){return b.useContext(vS)}function bS(e,t,n,r=!0,i){let[a,o]=b.useState(),s=gx(i?`${i}-label`:void 0),c=e??t??a;return X(()=>{let i=e||t||!r?void 0:xS(n.current,s);a!==i&&o(i)}),c}function xS(e,t){let n=SS(e);if(n)return!n.id&&t&&(n.id=t),n.id||void 0}function SS(e){if(!e)return;let t=e.parentElement;if(t&&t.tagName===`LABEL`)return t;let n=e.id;if(n){let t=e.nextElementSibling;if(t&&t.htmlFor===n)return t}let r=e.labels;return r&&r[0]}function CS(e={}){let{id:t,implicit:n=!1,controlRef:r}=e,{controlId:i,registerControlId:a}=yS(),o=gx(t),s=n?i:void 0,c=Kp(()=>Symbol(`labelable-control`)),l=b.useRef(!1),u=b.useRef(t!=null),d=Z(()=>{!l.current||a===nm||(l.current=!1,a(c.current,void 0))});return X(()=>{if(a===nm)return;let e;if(n){let n=r?.current;e=up(n)&&n.closest(`label`)!=null?t??null:s??o}else if(t!=null)u.current=!0,e=t;else if(u.current)e=o;else{d();return}if(e===void 0){d();return}l.current=!0,a(c.current,e)},[t,r,s,a,n,o,c,d]),b.useEffect(()=>d,[d]),i??o}function wS({controlled:e,default:t,name:n,state:r=`value`}){let{current:i}=b.useRef(e!==void 0),[a,o]=b.useState(t);return[i?e:a,b.useCallback(e=>{i||o(e)},[])]}function TS(e,t){let{enabled:n=!0,getValue:r,id:i,value:a}=t,{registerFieldControl:o}=hS(),s=b.useRef(null);s.current||=Symbol(),X(()=>{let t=s.current;if(!(!t||!n))return o(t,{controlRef:e,getValue:r,id:i,value:a}),()=>{o(t,void 0)}},[e,n,r,i,o,a])}var ES=b.forwardRef(function(e,t){let{render:n,className:r,id:i,name:a,value:o,disabled:s=!1,onValueChange:c,defaultValue:l,autoFocus:u=!1,style:d,...f}=e,{state:p,name:m,disabled:h,setTouched:g,setDirty:_,validityData:v,setFocused:y,setFilled:x,validationMode:S,validation:C}=hS(),w=h||s,T=m??a,E={...p,disabled:w},{labelId:D}=yS(),O=CS({id:i});X(()=>{let e=o!=null;C.inputRef.current?.value||e&&o!==``?x(!0):e&&o===``&&x(!1)},[C.inputRef,x,o]);let k=b.useRef(null);X(()=>{u&&k.current===uh(Wp(k.current))&&y(!0)},[u,y]);let[A]=wS({controlled:o,default:l,name:`FieldControl`,state:`value`}),j=o!==void 0,M=j?A:void 0,N=Z(()=>C.inputRef.current?.value);return TS(C.inputRef,{id:O,value:M,getValue:N}),w_(`input`,e,{ref:[t,k],state:E,props:[{id:O,disabled:w,name:T,ref:C.inputRef,"aria-labelledby":D,autoFocus:u,...j?{value:M}:{defaultValue:l},onChange(e){let t=e.currentTarget.value;c?.(t,Lm(wm,e.nativeEvent)),_(t!==v.initialValue),x(t!==``)},onFocus(){y(!0)},onBlur(e){g(!0),y(!1),S===`onBlur`&&C.commit(e.currentTarget.value)},onKeyDown(e){e.currentTarget.tagName===`INPUT`&&e.key===`Enter`&&(g(!0),C.commit(e.currentTarget.value))}},C.getInputValidationProps(),f],stateAttributesMapping:pS})}),DS=b.forwardRef(function(e,t){return(0,y.jsx)(ES,{ref:t,...e})});function OS({className:e,type:t,...n}){return(0,y.jsx)(DS,{type:t,"data-slot":`input`,className:rp(`h-9 w-full min-w-0 rounded-md border border-input bg-transparent px-2.5 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40`,e),...n})}function kS({className:e,...t}){return(0,y.jsx)(`textarea`,{"data-slot":`textarea`,className:rp(`flex field-sizing-content min-h-16 w-full rounded-md border border-input bg-transparent px-2.5 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40`,e),...t})}function AS({className:e,...t}){return(0,y.jsx)(`div`,{"data-slot":`input-group`,role:`group`,className:rp(`group/input-group relative flex h-9 w-full min-w-0 items-center rounded-md border border-input shadow-xs transition-[color,box-shadow] outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-3 has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-3 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto dark:bg-input/30 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5`,e),...t})}var jS=Jx(`flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4`,{variants:{align:{"inline-start":`order-first pl-2 has-[>button]:-ml-1 has-[>kbd]:ml-[-0.15rem]`,"inline-end":`order-last pr-2 has-[>button]:-mr-1 has-[>kbd]:mr-[-0.15rem]`,"block-start":`order-first w-full justify-start px-2.5 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2`,"block-end":`order-last w-full justify-start px-2.5 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2`}},defaultVariants:{align:`inline-start`}});function MS({className:e,align:t=`inline-start`,...n}){return(0,y.jsx)(`div`,{role:`group`,"data-slot":`input-group-addon`,"data-align":t,className:rp(jS({align:t}),e),onClick:e=>{e.target.closest(`button`)||e.currentTarget.parentElement?.querySelector(`input`)?.focus()},...n})}var NS=Jx(`flex items-center gap-2 text-sm shadow-none`,{variants:{size:{xs:`h-6 gap-1 rounded-[calc(var(--radius)-5px)] px-1.5 [&>svg:not([class*='size-'])]:size-3.5`,sm:``,"icon-xs":`size-6 rounded-[calc(var(--radius)-5px)] p-0 has-[>svg]:p-0`,"icon-sm":`size-8 p-0 has-[>svg]:p-0`}},defaultVariants:{size:`xs`}});function PS({className:e,type:t=`button`,variant:n=`ghost`,size:r=`xs`,...i}){return(0,y.jsx)(Xx,{type:t,"data-size":r,variant:n,className:rp(NS({size:r}),e),...i})}function FS({className:e,...t}){return(0,y.jsx)(`span`,{className:rp(`flex items-center gap-2 text-sm text-muted-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4`,e),...t})}function IS({className:e,...t}){return(0,y.jsx)(OS,{"data-slot":`input-group-control`,className:rp(`flex-1 rounded-none border-0 bg-transparent shadow-none ring-0 focus-visible:ring-0 aria-invalid:ring-0 dark:bg-transparent`,e),...t})}function LS({className:e,...t}){return(0,y.jsx)(_d,{role:`status`,"aria-label":`Loading`,className:rp(`spinner-line-fade size-4`,e),...t})}var RS=1e3,zS=1.2,BS=.1,VS=`localterm`,HS=`† `,US=`npx @monotykamary/localterm@latest start`,WS=1500,GS=5e3,KS=.35,qS=2e3,JS=`localterm:diff-view-mode`,YS=1500,XS=`#ffc79944`,ZS=`#ffc799`,QS=`#ff8080`,$S=`localterm:terminal-theme-id`,eC=`localterm:terminal-font-id`,tC=`localterm:terminal-font-size`,nC=`localterm:terminal-line-height`,rC=`localterm:terminal-cursor-style`,iC=`localterm:terminal-cursor-blink`,aC=`localterm:terminal-scrollback`,oC=`localterm:terminal-scroll-on-user-input`,sC=`localterm:terminal-padding-x`,cC=`localterm:terminal-padding-y`,lC=`localterm-google-fonts`,uC=`localterm:nerd-font-enabled`,dC=`flex w-full items-center gap-2.5 rounded-sm px-2.5 py-2 text-sm text-muted-foreground outline-none transition-colors`,fC=10,pC=(e,t)=>{let n=e.toLowerCase(),r=t.toLowerCase(),i=r.indexOf(n);if(i!==-1){let e=Array.from({length:n.length},(e,t)=>i+t);return r===n?{score:1,indices:e}:i===0?{score:2,indices:e}:{score:3,indices:e}}let a=hC(n,r);return a?{score:4+(1-a.score/mC(n.length)),indices:a.indices}:null},mC=e=>{let t=e;return t+=(e-1)*.5,t+=e*.5,t},hC=(e,t)=>{let n=0,r=0,i=-1,a=[];for(let o=0;o<t.length&&n<e.length;o++)t[o]===e[n]&&(r+=1,i===o-1&&(r+=.5),(o===0||t[o-1]===` `||t[o-1]===`-`)&&(r+=.5),i=o,a.push(o),n++);return n===e.length?{score:r,indices:a}:null},gC=(e,t)=>t?e.flatMap(e=>{let n=pC(t,e.label);if(n)return[{cmd:e,score:n.score,indices:n.indices}];let r=pC(t,`${e.category} ${e.label}`);return r?[{cmd:e,score:fC+r.score,indices:null}]:[]}).sort((e,t)=>e.score-t.score).map(({cmd:e,indices:t})=>({cmd:e,indices:t})):e.map(e=>({cmd:e,indices:null})),_C=({label:e,indices:t})=>{if(!t||t.length===0)return(0,y.jsx)(y.Fragment,{children:e});let n=new Set(t),r=[];for(let t=0;t<e.length;t++){let i=n.has(t),a=r[r.length-1];a&&a.hit===i?a.text+=e[t]:r.push({text:e[t],hit:i})}return(0,y.jsx)(y.Fragment,{children:r.map((e,t)=>(0,y.jsx)(`span`,{className:e.hit?`font-semibold text-foreground`:void 0,children:e.text},t))})},vC=({keys:e,label:t})=>(0,y.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,y.jsx)(`kbd`,{className:`rounded border border-border/40 bg-muted/30 px-1 font-mono text-[10px]`,children:e}),t]}),yC=({open:e,onClose:t,commands:n,onActiveItemChange:r})=>{let[i,a]=(0,b.useState)(``),[o,s]=(0,b.useState)(0),[c,l]=(0,b.useState)(!1),[u,d]=(0,b.useState)(!1),f=(0,b.useRef)(null),p=(0,b.useId)(),m=(0,b.useMemo)(()=>gC(n,i),[n,i]),h=(0,b.useMemo)(()=>{let e=[];return m.forEach((t,n)=>{let r=e[e.length-1];r&&r.category===t.cmd.category?r.entries.push({entry:t,index:n}):e.push({category:t.cmd.category,entries:[{entry:t,index:n}]})}),e},[m]);(0,b.useEffect)(()=>{if(e){l(!0),a(``),s(0);let e=requestAnimationFrame(()=>{d(!0),f.current?.focus()});return()=>cancelAnimationFrame(e)}if(d(!1),c){let e=window.setTimeout(()=>l(!1),150);return()=>window.clearTimeout(e)}},[e]),(0,b.useEffect)(()=>{s(0)},[i]),(0,b.useEffect)(()=>{r&&r(e?m[o]?.cmd??null:null)},[e,m,o,r]),(0,b.useEffect)(()=>{let t=m[o]?.cmd;!e||!t||document.getElementById(`${p}-${t.id}`)?.scrollIntoView?.({block:`nearest`})},[o,m,e,p]),(0,b.useEffect)(()=>{if(!e||!c)return;let n=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),t())};return window.addEventListener(`keydown`,n,!0),()=>window.removeEventListener(`keydown`,n,!0)},[e,c,t]);let g=(0,b.useCallback)(()=>{let e=m[o]?.cmd;e&&(t(),e.action())},[o,m,t]),_=(0,b.useCallback)(e=>{let t=m.length,n=e.key===`ArrowDown`||e.ctrlKey&&e.key===`n`,r=e.key===`ArrowUp`||e.ctrlKey&&e.key===`p`;if(n||r){if(e.preventDefault(),t===0)return;s(e=>(e+(n?1:-1)+t)%t);return}if(e.key===`Enter`){e.preventDefault(),g();return}},[g,m.length]);if(!c)return null;let v=e&&u,x=(e,n,r)=>{let{cmd:i,indices:a}=e;return(0,y.jsxs)(`button`,{id:`${p}-${i.id}`,type:`button`,role:`option`,"aria-selected":n===o,className:rp(dC,n===o&&`bg-foreground/10 text-foreground`),onMouseMove:()=>{n!==o&&s(n)},onClick:()=>{t(),i.action()},children:[i.icon?(0,y.jsx)(`span`,{className:`shrink-0 text-muted-foreground/70`,children:i.icon}):(0,y.jsx)(`span`,{className:`w-4 shrink-0`}),(0,y.jsx)(`span`,{className:`flex-1 truncate text-left`,children:(0,y.jsx)(_C,{label:i.label,indices:a})}),r?(0,y.jsx)(`span`,{className:`shrink-0 text-[10px] uppercase tracking-wide text-muted-foreground/50`,children:i.category}):null,i.checked?(0,y.jsx)(dd,{"aria-label":`active`,className:`size-3.5 shrink-0`}):null,i.shortcut?(0,y.jsx)(`kbd`,{className:`shrink-0 rounded border border-border/40 bg-muted/30 px-1.5 py-0.5 font-mono text-[10px] text-muted-foreground/70`,children:i.shortcut}):null]},i.id)};return(0,y.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-start justify-center pt-[18vh]`,children:[(0,y.jsx)(`div`,{"data-open":v||void 0,"data-closed":!v||void 0,className:rp(Ux),onClick:t}),(0,y.jsxs)(`div`,{role:`dialog`,"aria-label":`command palette`,"aria-modal":!0,"data-open":v||void 0,"data-closed":!v||void 0,className:rp(`relative z-10 flex max-h-[400px] w-[520px] max-w-[calc(100vw-2rem)] flex-col overflow-hidden rounded-xl`,Vx,Wx),children:[(0,y.jsxs)(`div`,{className:`flex items-center border-b border-border/40 px-3`,children:[(0,y.jsx)(Td,{className:`size-4 shrink-0 text-muted-foreground/60`}),(0,y.jsx)(`input`,{ref:f,autoFocus:!0,type:`text`,value:i,onChange:e=>a(e.target.value),onKeyDown:_,placeholder:`Type a command…`,"aria-label":`search commands`,"aria-activedescendant":m[o]?`${p}-${m[o].cmd.id}`:void 0,"aria-controls":p,"aria-expanded":!0,"aria-haspopup":`listbox`,role:`combobox`,className:`h-10 w-full bg-transparent px-2.5 text-sm text-foreground outline-none placeholder:text-muted-foreground/70`})]}),(0,y.jsx)(`div`,{id:p,role:`listbox`,className:`flex-1 overflow-y-auto overscroll-contain p-1.5 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden`,children:m.length===0?(0,y.jsxs)(`div`,{className:`px-2.5 py-6 text-center text-sm text-muted-foreground/70`,children:[`No commands match “`,i,`”`]}):i?m.map((e,t)=>x(e,t,!0)):h.map(e=>(0,y.jsxs)(`div`,{role:`group`,"aria-label":e.category,children:[(0,y.jsx)(`div`,{className:`px-2.5 pb-1 pt-2 text-[10px] font-medium uppercase tracking-wide text-muted-foreground/50`,children:e.category}),e.entries.map(({entry:e,index:t})=>x(e,t,!1))]},e.category))}),(0,y.jsxs)(`div`,{className:`flex items-center gap-3 border-t border-border/40 px-3 py-1.5 text-[10px] text-muted-foreground/60`,children:[(0,y.jsx)(vC,{keys:`↑↓`,label:`navigate`}),(0,y.jsx)(vC,{keys:`↵`,label:`run`}),(0,y.jsx)(vC,{keys:`esc`,label:`close`}),(0,y.jsxs)(`span`,{className:`ml-auto`,children:[m.length,` `,m.length===1?`command`:`commands`]})]})]})]})},bC=e=>{let t=[],n=[],r=[],i=()=>{let e=Math.max(n.length,r.length);for(let i=0;i<e;i+=1)t.push({left:n[i]??null,right:r[i]??null});n=[],r=[]};for(let a of e.lines){if(a.type===`del`){n.push(a);continue}if(a.type===`add`){r.push(a);continue}i(),t.push({left:a,right:a})}return i(),t},xC=e=>e.type===`del`?e.oldLine===null?null:{side:`old`,lineNumber:e.oldLine}:e.newLine===null?null:{side:`new`,lineNumber:e.newLine},SC=e=>`${e.side}:${e.lineNumber}`,CC=e=>{let t=[],n=new Map;return e.forEach((e,r)=>{for(let i of e.lines){let e=xC(i);if(!e)continue;let a={target:e,hunkIndex:r,order:t.length};t.push(a),n.set(SC(e),a)}}),{ordered:t,byKey:n}},wC=(e,t)=>{let n=t;for(let r=t.order+1;r<e.ordered.length&&e.ordered[r].hunkIndex===t.hunkIndex;r+=1)n=e.ordered[r];return n},TC=(e,t)=>{let n=t;for(let r=t.order-1;r>=0&&e.ordered[r].hunkIndex===t.hunkIndex;--r)n=e.ordered[r];return n},EC=(e,t,n)=>{let r=e.byKey.get(SC(t)),i=e.byKey.get(SC(n));if(!r||!i)return null;let a=r.order<=i.order?r:i,o=r.order<=i.order?i:r;return a.hunkIndex!==o.hunkIndex&&(a===r?o=wC(e,r):a=TC(e,r)),{start:a.target,end:o.target}},DC=(e,t)=>{let n=new Set,r=e.byKey.get(SC(t.start)),i=e.byKey.get(SC(t.end));if(!r||!i||r.order>i.order)return n;for(let t=r.order;t<=i.order;t+=1)n.add(SC(e.ordered[t].target));return n},OC=64*1024,kC=1*1024*1024,AC=4*1024,jC=1024,MC=1e3,NC=1e3;Object.freeze({status:`aborted`});function $(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,`_zod`,{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,`name`,{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,`init`,{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,`name`,{value:e}),o}var PC=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},FC=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}},IC={};function LC(e){return e&&Object.assign(IC,e),IC}function RC(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function zC(e,t){return typeof t==`bigint`?t.toString():t}function BC(e){return{get value(){{let t=e();return Object.defineProperty(this,`value`,{value:t}),t}throw Error(`cached value already set`)}}}function VC(e){return e==null}function HC(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function UC(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=t.toString(),i=(r.split(`.`)[1]||``).length;if(i===0&&/\d?e-\d?/.test(r)){let e=r.match(/\d?e-(\d?)/);e?.[1]&&(i=Number.parseInt(e[1]))}let a=n>i?n:i;return Number.parseInt(e.toFixed(a).replace(`.`,``))%Number.parseInt(t.toFixed(a).replace(`.`,``))/10**a}var WC=Symbol(`evaluating`);function GC(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==WC)return r===void 0&&(r=WC,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function KC(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function qC(...e){let t={};for(let n of e)Object.assign(t,Object.getOwnPropertyDescriptors(n));return Object.defineProperties({},t)}function JC(e){return JSON.stringify(e)}function YC(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var XC=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function ZC(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var QC=BC(()=>{if(typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function $C(e){if(ZC(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(ZC(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function ew(e){return $C(e)?{...e}:Array.isArray(e)?[...e]:e}var tw=new Set([`string`,`number`,`symbol`]);function nw(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function rw(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function iw(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function aw(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}var ow={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function sw(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return rw(e,qC(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return KC(this,`shape`,e),e},checks:[]}))}function cw(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return rw(e,qC(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return KC(this,`shape`,r),r},checks:[]}))}function lw(e,t){if(!$C(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return rw(e,qC(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return KC(this,`shape`,n),n}}))}function uw(e,t){if(!$C(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return rw(e,qC(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return KC(this,`shape`,n),n}}))}function dw(e,t){return rw(e,qC(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return KC(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:[]}))}function fw(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return rw(t,qC(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return KC(this,`shape`,i),i},checks:[]}))}function pw(e,t,n){return rw(t,qC(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return KC(this,`shape`,i),i}}))}function mw(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function hw(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function gw(e){return typeof e==`string`?e:e?.message}function _w(e,t,n){let r={...e,path:e.path??[]};return e.message||(r.message=gw(e.inst?._zod.def?.error?.(e))??gw(t?.error?.(e))??gw(n.customError?.(e))??gw(n.localeError?.(e))??`Invalid input`),delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function vw(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function yw(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var bw=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,`_zod`,{value:e._zod,enumerable:!1}),Object.defineProperty(e,`issues`,{value:t,enumerable:!1}),e.message=JSON.stringify(t,zC,2),Object.defineProperty(e,`toString`,{value:()=>e.message,enumerable:!1})},xw=$(`$ZodError`,bw),Sw=$(`$ZodError`,bw,{Parent:Error});function Cw(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function ww(e,t=e=>e.message){let n={_errors:[]},r=e=>{for(let i of e.issues)if(i.code===`invalid_union`&&i.errors.length)i.errors.map(e=>r({issues:e}));else if(i.code===`invalid_key`)r({issues:i.issues});else if(i.code===`invalid_element`)r({issues:i.issues});else if(i.path.length===0)n._errors.push(t(i));else{let e=n,r=0;for(;r<i.path.length;){let n=i.path[r];r===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(e),n}var Tw=e=>(t,n,r,i)=>{let a=r?Object.assign(r,{async:!1}):{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new PC;if(o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>_w(e,a,LC())));throw XC(t,i?.callee),t}return o.value},Ew=e=>async(t,n,r,i)=>{let a=r?Object.assign(r,{async:!0}):{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>_w(e,a,LC())));throw XC(t,i?.callee),t}return o.value},Dw=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new PC;return a.issues.length?{success:!1,error:new(e??xw)(a.issues.map(e=>_w(e,i,LC())))}:{success:!0,data:a.value}},Ow=Dw(Sw),kw=e=>async(t,n,r)=>{let i=r?Object.assign(r,{async:!0}):{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>_w(e,i,LC())))}:{success:!0,data:a.value}},Aw=kw(Sw),jw=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return Tw(e)(t,n,i)},Mw=e=>(t,n,r)=>Tw(e)(t,n,r),Nw=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return Ew(e)(t,n,i)},Pw=e=>async(t,n,r)=>Ew(e)(t,n,r),Fw=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return Dw(e)(t,n,i)},Iw=e=>(t,n,r)=>Dw(e)(t,n,r),Lw=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return kw(e)(t,n,i)},Rw=e=>async(t,n,r)=>kw(e)(t,n,r),zw=/^[cC][^\s-]{8,}$/,Bw=/^[0-9a-z]+$/,Vw=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Hw=/^[0-9a-vA-V]{20}$/,Uw=/^[A-Za-z0-9]{27}$/,Ww=/^[a-zA-Z0-9_-]{21}$/,Gw=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Kw=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,qw=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Jw=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Yw=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function Xw(){return new RegExp(Yw,`u`)}var Zw=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Qw=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,$w=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,eT=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,tT=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,nT=/^[A-Za-z0-9_-]*$/,rT=/^\+[1-9]\d{6,14}$/,iT=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`,aT=RegExp(`^${iT}$`);function oT(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function sT(e){return RegExp(`^${oT(e)}$`)}function cT(e){let t=oT({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${iT}T(?:${r})$`)}var lT=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},uT=/^-?\d+$/,dT=/^-?\d+(?:\.\d+)?$/,fT=/^(?:true|false)$/i,pT=/^[^A-Z]*$/,mT=/^[^a-z]*$/,hT=$(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),gT={number:`number`,bigint:`bigint`,object:`date`},_T=$(`$ZodCheckLessThan`,(e,t)=>{hT.init(e,t);let n=gT[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),vT=$(`$ZodCheckGreaterThan`,(e,t)=>{hT.init(e,t);let n=gT[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),yT=$(`$ZodCheckMultipleOf`,(e,t)=>{hT.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?n.value%t.value===BigInt(0):UC(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),bT=$(`$ZodCheckNumberFormat`,(e,t)=>{hT.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=ow[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=uT)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),xT=$(`$ZodCheckMaxLength`,(e,t)=>{var n;hT.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!VC(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=vw(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),ST=$(`$ZodCheckMinLength`,(e,t)=>{var n;hT.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!VC(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=vw(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),CT=$(`$ZodCheckLengthEquals`,(e,t)=>{var n;hT.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!VC(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=vw(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),wT=$(`$ZodCheckStringFormat`,(e,t)=>{var n,r;hT.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),TT=$(`$ZodCheckRegex`,(e,t)=>{wT.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),ET=$(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=pT,wT.init(e,t)}),DT=$(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=mT,wT.init(e,t)}),OT=$(`$ZodCheckIncludes`,(e,t)=>{hT.init(e,t);let n=nw(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),kT=$(`$ZodCheckStartsWith`,(e,t)=>{hT.init(e,t);let n=RegExp(`^${nw(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),AT=$(`$ZodCheckEndsWith`,(e,t)=>{hT.init(e,t);let n=RegExp(`.*${nw(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),jT=$(`$ZodCheckOverwrite`,(e,t)=>{hT.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),MT=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
|
|
76
76
|
`).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.args,n=[...(this?.content??[``]).map(e=>` ${e}`)];return new e(...t,n.join(`
|
|
77
|
-
`))}},
|
|
77
|
+
`))}},NT={major:4,minor:3,patch:6},PT=$(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=NT;let r=[...e._zod.def.checks??[]];e._zod.traits.has(`$ZodCheck`)&&r.unshift(e);for(let t of r)for(let n of t._zod.onattach)n(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,n)=>{let r=mw(e),i;for(let a of t){if(a._zod.def.when){if(!a._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&n?.async===!1)throw new PC;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(r||=mw(e,t))});else{if(e.issues.length===t)continue;r||=mw(e,t)}}return i?i.then(()=>e):e},n=(n,i,a)=>{if(mw(n))return n.aborted=!0,n;let o=t(i,r,a);if(o instanceof Promise){if(a.async===!1)throw new PC;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction===`backward`){let t=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,i,a)):n(t,i,a)}let o=e._zod.parse(i,a);if(o instanceof Promise){if(a.async===!1)throw new PC;return o.then(e=>t(e,r,a))}return t(o,r,a)}}GC(e,`~standard`,()=>({validate:t=>{try{let n=Ow(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return Aw(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),FT=$(`$ZodString`,(e,t)=>{PT.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??lT(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),IT=$(`$ZodStringFormat`,(e,t)=>{wT.init(e,t),FT.init(e,t)}),LT=$(`$ZodGUID`,(e,t)=>{t.pattern??=Kw,IT.init(e,t)}),RT=$(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=qw(e)}else t.pattern??=qw();IT.init(e,t)}),zT=$(`$ZodEmail`,(e,t)=>{t.pattern??=Jw,IT.init(e,t)}),BT=$(`$ZodURL`,(e,t)=>{IT.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(`:`)?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=i.href:n.value=r;return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),VT=$(`$ZodEmoji`,(e,t)=>{t.pattern??=Xw(),IT.init(e,t)}),HT=$(`$ZodNanoID`,(e,t)=>{t.pattern??=Ww,IT.init(e,t)}),UT=$(`$ZodCUID`,(e,t)=>{t.pattern??=zw,IT.init(e,t)}),WT=$(`$ZodCUID2`,(e,t)=>{t.pattern??=Bw,IT.init(e,t)}),GT=$(`$ZodULID`,(e,t)=>{t.pattern??=Vw,IT.init(e,t)}),KT=$(`$ZodXID`,(e,t)=>{t.pattern??=Hw,IT.init(e,t)}),qT=$(`$ZodKSUID`,(e,t)=>{t.pattern??=Uw,IT.init(e,t)}),JT=$(`$ZodISODateTime`,(e,t)=>{t.pattern??=cT(t),IT.init(e,t)}),YT=$(`$ZodISODate`,(e,t)=>{t.pattern??=aT,IT.init(e,t)}),XT=$(`$ZodISOTime`,(e,t)=>{t.pattern??=sT(t),IT.init(e,t)}),ZT=$(`$ZodISODuration`,(e,t)=>{t.pattern??=Gw,IT.init(e,t)}),QT=$(`$ZodIPv4`,(e,t)=>{t.pattern??=Zw,IT.init(e,t),e._zod.bag.format=`ipv4`}),$T=$(`$ZodIPv6`,(e,t)=>{t.pattern??=Qw,IT.init(e,t),e._zod.bag.format=`ipv6`,e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}}),eE=$(`$ZodCIDRv4`,(e,t)=>{t.pattern??=$w,IT.init(e,t)}),tE=$(`$ZodCIDRv6`,(e,t)=>{t.pattern??=eT,IT.init(e,t),e._zod.check=n=>{let r=n.value.split(`/`);try{if(r.length!==2)throw Error();let[e,t]=r;if(!t)throw Error();let n=Number(t);if(`${n}`!==t||n<0||n>128)throw Error();new URL(`http://[${e}]`)}catch{n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}}});function nE(e){if(e===``)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var rE=$(`$ZodBase64`,(e,t)=>{t.pattern??=tT,IT.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{nE(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function iE(e){if(!nT.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return nE(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var aE=$(`$ZodBase64URL`,(e,t)=>{t.pattern??=nT,IT.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{iE(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),oE=$(`$ZodE164`,(e,t)=>{t.pattern??=rT,IT.init(e,t)});function sE(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}var cE=$(`$ZodJWT`,(e,t)=>{IT.init(e,t),e._zod.check=n=>{sE(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),lE=$(`$ZodNumber`,(e,t)=>{PT.init(e,t),e._zod.pattern=e._zod.bag.pattern??dT,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:`Infinity`:void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),uE=$(`$ZodNumberFormat`,(e,t)=>{bT.init(e,t),lE.init(e,t)}),dE=$(`$ZodBoolean`,(e,t)=>{PT.init(e,t),e._zod.pattern=fT,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),fE=$(`$ZodUnknown`,(e,t)=>{PT.init(e,t),e._zod.parse=e=>e}),pE=$(`$ZodNever`,(e,t)=>{PT.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function mE(e,t,n){e.issues.length&&t.issues.push(...hw(n,e.issues)),t.value[n]=e.value}var hE=$(`$ZodArray`,(e,t)=>{PT.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:`array`,code:`invalid_type`,input:i,inst:e}),n;n.value=Array(i.length);let a=[];for(let e=0;e<i.length;e++){let o=i[e],s=t.element._zod.run({value:o,issues:[]},r);s instanceof Promise?a.push(s.then(t=>mE(t,n,e))):mE(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function gE(e,t,n,r,i){if(e.issues.length){if(i&&!(n in r))return;t.issues.push(...hw(n,e.issues))}e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function _E(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let n=aw(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function vE(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optout===`optional`;for(let i in t){if(s.has(i))continue;if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>gE(e,n,i,t,u))):gE(a,n,i,t,u)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}var yE=$(`$ZodObject`,(e,t)=>{if(PT.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;Object.defineProperty(t,`shape`,{get:()=>{let n={...e};return Object.defineProperty(t,`shape`,{value:n}),n}})}let n=BC(()=>_E(t));GC(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(let e of r.values)n[t].add(e)}}return n});let r=ZC,i=t.catchall,a;e._zod.parse=(t,o)=>{a??=n.value;let s=t.value;if(!r(s))return t.issues.push({expected:`object`,code:`invalid_type`,input:s,inst:e}),t;t.value={};let c=[],l=a.shape;for(let e of a.keys){let n=l[e],r=n._zod.optout===`optional`,i=n._zod.run({value:s[e],issues:[]},o);i instanceof Promise?c.push(i.then(n=>gE(n,t,e,s,r))):gE(i,t,e,s,r)}return i?vE(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),bE=$(`$ZodObjectJIT`,(e,t)=>{yE.init(e,t);let n=e._zod.parse,r=BC(()=>_E(t)),i=e=>{let t=new MT([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=JC(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write(`const input = payload.value;`);let a=Object.create(null),o=0;for(let e of n.keys)a[e]=`key_${o++}`;t.write(`const newResult = {};`);for(let r of n.keys){let n=a[r],o=JC(r),s=e[r]?._zod?.optout===`optional`;t.write(`const ${n} = ${i(r)};`),s?t.write(`
|
|
78
78
|
if (${n}.issues.length) {
|
|
79
79
|
if (${o} in input) {
|
|
80
80
|
payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
|
|
@@ -108,9 +108,9 @@ WARNING: This link could potentially be dangerous`)){let e=window.open();if(e){t
|
|
|
108
108
|
newResult[${o}] = ${n}.value;
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
-
`)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=QC,s=!LC.jitless,c=s&&$C.value,l=t.catchall,u;e._zod.parse=(d,f)=>{u??=r.value;let p=d.value;return o(p)?s&&c&&f?.async===!1&&f.jitless!==!0?(a||=i(t.shape),d=a(d,f),l?yE([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function SE(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!hw(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>vw(e,r,RC())))}),t)}var CE=$(`$ZodUnion`,(e,t)=>{FT.init(e,t),KC(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),KC(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),KC(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),KC(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>UC(e.source)).join(`|`)})$`)}});let n=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(i,a)=>{if(n)return r(i,a);let o=!1,s=[];for(let e of t.options){let t=e._zod.run({value:i.value,issues:[]},a);if(t instanceof Promise)s.push(t),o=!0;else{if(t.issues.length===0)return t;s.push(t)}}return o?Promise.all(s).then(t=>SE(t,i,e,a)):SE(s,i,e,a)}}),wE=$(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,CE.init(e,t);let n=e._zod.parse;KC(e._zod,`propValues`,()=>{let e={};for(let n of t.options){let r=n._zod.propValues;if(!r||Object.keys(r).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(let[t,n]of Object.entries(r)){e[t]||(e[t]=new Set);for(let r of n)e[t].add(r)}}return e});let r=VC(()=>{let e=t.options,n=new Map;for(let r of e){let e=r._zod.propValues?.[t.discriminator];if(!e||e.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(let t of e){if(n.has(t))throw Error(`Duplicate discriminator value "${String(t)}"`);n.set(t,r)}}return n});e._zod.parse=(i,a)=>{let o=i.value;if(!QC(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=r.value.get(o?.[t.discriminator]);return s?s._zod.run(i,a):t.unionFallback?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,input:o,path:[t.discriminator],inst:e}),i)}}),TE=$(`$ZodIntersection`,(e,t)=>{FT.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>DE(e,t,n)):DE(e,i,a)}});function EE(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(ew(e)&&ew(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=EE(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=EE(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function DE(e,t,n){let r=new Map,i;for(let n of t.issues)if(n.code===`unrecognized_keys`){i??=n;for(let e of n.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(n);for(let t of n.issues)if(t.code===`unrecognized_keys`)for(let e of t.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(t);let a=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length&&i&&e.issues.push({...i,keys:a}),hw(e))return e;let o=EE(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var OE=$(`$ZodEnum`,(e,t)=>{FT.init(e,t);let n=zC(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>nw.has(typeof e)).map(e=>typeof e==`string`?rw(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),kE=$(`$ZodLiteral`,(e,t)=>{if(FT.init(e,t),t.values.length===0)throw Error(`Cannot create literal schema with no valid values`);let n=new Set(t.values);e._zod.values=n,e._zod.pattern=RegExp(`^(${t.values.map(e=>typeof e==`string`?rw(e):e?rw(e.toString()):String(e)).join(`|`)})$`),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),AE=$(`$ZodTransform`,(e,t)=>{FT.init(e,t),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new IC(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new FC;return n.value=i,n}});function jE(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}var ME=$(`$ZodOptional`,(e,t)=>{FT.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,KC(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),KC(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${UC(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(t=>jE(t,e.value)):jE(r,e.value)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),NE=$(`$ZodExactOptional`,(e,t)=>{ME.init(e,t),KC(e._zod,`values`,()=>t.innerType._zod.values),KC(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),PE=$(`$ZodNullable`,(e,t)=>{FT.init(e,t),KC(e._zod,`optin`,()=>t.innerType._zod.optin),KC(e._zod,`optout`,()=>t.innerType._zod.optout),KC(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${UC(e.source)}|null)$`):void 0}),KC(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),FE=$(`$ZodDefault`,(e,t)=>{FT.init(e,t),e._zod.optin=`optional`,KC(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>IE(e,t)):IE(r,t)}});function IE(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var LE=$(`$ZodPrefault`,(e,t)=>{FT.init(e,t),e._zod.optin=`optional`,KC(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),RE=$(`$ZodNonOptional`,(e,t)=>{FT.init(e,t),KC(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>zE(t,e)):zE(i,e)}});function zE(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}var BE=$(`$ZodCatch`,(e,t)=>{FT.init(e,t),KC(e._zod,`optin`,()=>t.innerType._zod.optin),KC(e._zod,`optout`,()=>t.innerType._zod.optout),KC(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>vw(e,n,RC()))},input:e.value}),e.issues=[]),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>vw(e,n,RC()))},input:e.value}),e.issues=[]),e)}}),VE=$(`$ZodPipe`,(e,t)=>{FT.init(e,t),KC(e._zod,`values`,()=>t.in._zod.values),KC(e._zod,`optin`,()=>t.in._zod.optin),KC(e._zod,`optout`,()=>t.out._zod.optout),KC(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>HE(e,t.in,n)):HE(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>HE(e,t.out,n)):HE(r,t.out,n)}});function HE(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}var UE=$(`$ZodReadonly`,(e,t)=>{FT.init(e,t),KC(e._zod,`propValues`,()=>t.innerType._zod.propValues),KC(e._zod,`values`,()=>t.innerType._zod.values),KC(e._zod,`optin`,()=>t.innerType?._zod?.optin),KC(e._zod,`optout`,()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(WE):WE(r)}});function WE(e){return e.value=Object.freeze(e.value),e}var GE=$(`$ZodCustom`,(e,t)=>{gT.init(e,t),FT.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>KE(t,n,r,e));KE(i,n,r,e)}});function KE(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(bw(e))}}var qE,JE=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function YE(){return new JE}(qE=globalThis).__zod_globalRegistry??(qE.__zod_globalRegistry=YE());var XE=globalThis.__zod_globalRegistry;function ZE(e,t){return new e({type:`string`,...aw(t)})}function QE(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...aw(t)})}function $E(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...aw(t)})}function eD(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...aw(t)})}function tD(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...aw(t)})}function nD(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...aw(t)})}function rD(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...aw(t)})}function iD(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...aw(t)})}function aD(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...aw(t)})}function oD(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...aw(t)})}function sD(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...aw(t)})}function cD(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...aw(t)})}function lD(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...aw(t)})}function uD(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...aw(t)})}function dD(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...aw(t)})}function fD(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...aw(t)})}function pD(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...aw(t)})}function mD(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...aw(t)})}function hD(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...aw(t)})}function gD(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...aw(t)})}function _D(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...aw(t)})}function vD(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...aw(t)})}function yD(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...aw(t)})}function bD(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...aw(t)})}function xD(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...aw(t)})}function SD(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...aw(t)})}function CD(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...aw(t)})}function wD(e,t){return new e({type:`number`,checks:[],...aw(t)})}function TD(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...aw(t)})}function ED(e,t){return new e({type:`boolean`,...aw(t)})}function DD(e){return new e({type:`unknown`})}function OD(e,t){return new e({type:`never`,...aw(t)})}function kD(e,t){return new vT({check:`less_than`,...aw(t),value:e,inclusive:!1})}function AD(e,t){return new vT({check:`less_than`,...aw(t),value:e,inclusive:!0})}function jD(e,t){return new yT({check:`greater_than`,...aw(t),value:e,inclusive:!1})}function MD(e,t){return new yT({check:`greater_than`,...aw(t),value:e,inclusive:!0})}function ND(e,t){return new bT({check:`multiple_of`,...aw(t),value:e})}function PD(e,t){return new ST({check:`max_length`,...aw(t),maximum:e})}function FD(e,t){return new CT({check:`min_length`,...aw(t),minimum:e})}function ID(e,t){return new wT({check:`length_equals`,...aw(t),length:e})}function LD(e,t){return new ET({check:`string_format`,format:`regex`,...aw(t),pattern:e})}function RD(e){return new DT({check:`string_format`,format:`lowercase`,...aw(e)})}function zD(e){return new OT({check:`string_format`,format:`uppercase`,...aw(e)})}function BD(e,t){return new kT({check:`string_format`,format:`includes`,...aw(t),includes:e})}function VD(e,t){return new AT({check:`string_format`,format:`starts_with`,...aw(t),prefix:e})}function HD(e,t){return new jT({check:`string_format`,format:`ends_with`,...aw(t),suffix:e})}function UD(e){return new MT({check:`overwrite`,tx:e})}function WD(e){return UD(t=>t.normalize(e))}function GD(){return UD(e=>e.trim())}function KD(){return UD(e=>e.toLowerCase())}function qD(){return UD(e=>e.toUpperCase())}function JD(){return UD(e=>XC(e))}function YD(e,t,n){return new e({type:`array`,element:t,...aw(n)})}function XD(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...aw(n)})}function ZD(e){let t=QD(n=>(n.addIssue=e=>{if(typeof e==`string`)n.issues.push(bw(e,n.value,t._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=n.value,r.inst??=t,r.continue??=!t._zod.def.abort,n.issues.push(bw(r))}},e(n.value,n)));return t}function QD(e,t){let n=new gT({check:`custom`,...aw(t)});return n._zod.check=e,n}function $D(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??XE,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,external:e?.external??void 0}}function eO(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,eO(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),t.io===`input`&&rO(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&o.schema._prefault&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function tO(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${a}`}}if(t[1]===n)return{ref:`#`};let i=`#/${r}/`,a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+a}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
|
|
111
|
+
`)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=ZC,s=!IC.jitless,c=s&&QC.value,l=t.catchall,u;e._zod.parse=(d,f)=>{u??=r.value;let p=d.value;return o(p)?s&&c&&f?.async===!1&&f.jitless!==!0?(a||=i(t.shape),d=a(d,f),l?vE([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function xE(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!mw(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>_w(e,r,LC())))}),t)}var SE=$(`$ZodUnion`,(e,t)=>{PT.init(e,t),GC(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),GC(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),GC(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),GC(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>HC(e.source)).join(`|`)})$`)}});let n=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(i,a)=>{if(n)return r(i,a);let o=!1,s=[];for(let e of t.options){let t=e._zod.run({value:i.value,issues:[]},a);if(t instanceof Promise)s.push(t),o=!0;else{if(t.issues.length===0)return t;s.push(t)}}return o?Promise.all(s).then(t=>xE(t,i,e,a)):xE(s,i,e,a)}}),CE=$(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,SE.init(e,t);let n=e._zod.parse;GC(e._zod,`propValues`,()=>{let e={};for(let n of t.options){let r=n._zod.propValues;if(!r||Object.keys(r).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(let[t,n]of Object.entries(r)){e[t]||(e[t]=new Set);for(let r of n)e[t].add(r)}}return e});let r=BC(()=>{let e=t.options,n=new Map;for(let r of e){let e=r._zod.propValues?.[t.discriminator];if(!e||e.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(let t of e){if(n.has(t))throw Error(`Duplicate discriminator value "${String(t)}"`);n.set(t,r)}}return n});e._zod.parse=(i,a)=>{let o=i.value;if(!ZC(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=r.value.get(o?.[t.discriminator]);return s?s._zod.run(i,a):t.unionFallback?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,input:o,path:[t.discriminator],inst:e}),i)}}),wE=$(`$ZodIntersection`,(e,t)=>{PT.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>EE(e,t,n)):EE(e,i,a)}});function TE(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if($C(e)&&$C(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=TE(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=TE(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function EE(e,t,n){let r=new Map,i;for(let n of t.issues)if(n.code===`unrecognized_keys`){i??=n;for(let e of n.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(n);for(let t of n.issues)if(t.code===`unrecognized_keys`)for(let e of t.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(t);let a=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length&&i&&e.issues.push({...i,keys:a}),mw(e))return e;let o=TE(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var DE=$(`$ZodEnum`,(e,t)=>{PT.init(e,t);let n=RC(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>tw.has(typeof e)).map(e=>typeof e==`string`?nw(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),OE=$(`$ZodLiteral`,(e,t)=>{if(PT.init(e,t),t.values.length===0)throw Error(`Cannot create literal schema with no valid values`);let n=new Set(t.values);e._zod.values=n,e._zod.pattern=RegExp(`^(${t.values.map(e=>typeof e==`string`?nw(e):e?nw(e.toString()):String(e)).join(`|`)})$`),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),kE=$(`$ZodTransform`,(e,t)=>{PT.init(e,t),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new FC(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new PC;return n.value=i,n}});function AE(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}var jE=$(`$ZodOptional`,(e,t)=>{PT.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,GC(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),GC(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${HC(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(t=>AE(t,e.value)):AE(r,e.value)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),ME=$(`$ZodExactOptional`,(e,t)=>{jE.init(e,t),GC(e._zod,`values`,()=>t.innerType._zod.values),GC(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),NE=$(`$ZodNullable`,(e,t)=>{PT.init(e,t),GC(e._zod,`optin`,()=>t.innerType._zod.optin),GC(e._zod,`optout`,()=>t.innerType._zod.optout),GC(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${HC(e.source)}|null)$`):void 0}),GC(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),PE=$(`$ZodDefault`,(e,t)=>{PT.init(e,t),e._zod.optin=`optional`,GC(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>FE(e,t)):FE(r,t)}});function FE(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var IE=$(`$ZodPrefault`,(e,t)=>{PT.init(e,t),e._zod.optin=`optional`,GC(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),LE=$(`$ZodNonOptional`,(e,t)=>{PT.init(e,t),GC(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>RE(t,e)):RE(i,e)}});function RE(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}var zE=$(`$ZodCatch`,(e,t)=>{PT.init(e,t),GC(e._zod,`optin`,()=>t.innerType._zod.optin),GC(e._zod,`optout`,()=>t.innerType._zod.optout),GC(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>_w(e,n,LC()))},input:e.value}),e.issues=[]),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>_w(e,n,LC()))},input:e.value}),e.issues=[]),e)}}),BE=$(`$ZodPipe`,(e,t)=>{PT.init(e,t),GC(e._zod,`values`,()=>t.in._zod.values),GC(e._zod,`optin`,()=>t.in._zod.optin),GC(e._zod,`optout`,()=>t.out._zod.optout),GC(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>VE(e,t.in,n)):VE(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>VE(e,t.out,n)):VE(r,t.out,n)}});function VE(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}var HE=$(`$ZodReadonly`,(e,t)=>{PT.init(e,t),GC(e._zod,`propValues`,()=>t.innerType._zod.propValues),GC(e._zod,`values`,()=>t.innerType._zod.values),GC(e._zod,`optin`,()=>t.innerType?._zod?.optin),GC(e._zod,`optout`,()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(UE):UE(r)}});function UE(e){return e.value=Object.freeze(e.value),e}var WE=$(`$ZodCustom`,(e,t)=>{hT.init(e,t),PT.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>GE(t,n,r,e));GE(i,n,r,e)}});function GE(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(yw(e))}}var KE,qE=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function JE(){return new qE}(KE=globalThis).__zod_globalRegistry??(KE.__zod_globalRegistry=JE());var YE=globalThis.__zod_globalRegistry;function XE(e,t){return new e({type:`string`,...iw(t)})}function ZE(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...iw(t)})}function QE(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...iw(t)})}function $E(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...iw(t)})}function eD(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...iw(t)})}function tD(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...iw(t)})}function nD(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...iw(t)})}function rD(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...iw(t)})}function iD(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...iw(t)})}function aD(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...iw(t)})}function oD(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...iw(t)})}function sD(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...iw(t)})}function cD(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...iw(t)})}function lD(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...iw(t)})}function uD(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...iw(t)})}function dD(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...iw(t)})}function fD(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...iw(t)})}function pD(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...iw(t)})}function mD(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...iw(t)})}function hD(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...iw(t)})}function gD(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...iw(t)})}function _D(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...iw(t)})}function vD(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...iw(t)})}function yD(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...iw(t)})}function bD(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...iw(t)})}function xD(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...iw(t)})}function SD(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...iw(t)})}function CD(e,t){return new e({type:`number`,checks:[],...iw(t)})}function wD(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...iw(t)})}function TD(e,t){return new e({type:`boolean`,...iw(t)})}function ED(e){return new e({type:`unknown`})}function DD(e,t){return new e({type:`never`,...iw(t)})}function OD(e,t){return new _T({check:`less_than`,...iw(t),value:e,inclusive:!1})}function kD(e,t){return new _T({check:`less_than`,...iw(t),value:e,inclusive:!0})}function AD(e,t){return new vT({check:`greater_than`,...iw(t),value:e,inclusive:!1})}function jD(e,t){return new vT({check:`greater_than`,...iw(t),value:e,inclusive:!0})}function MD(e,t){return new yT({check:`multiple_of`,...iw(t),value:e})}function ND(e,t){return new xT({check:`max_length`,...iw(t),maximum:e})}function PD(e,t){return new ST({check:`min_length`,...iw(t),minimum:e})}function FD(e,t){return new CT({check:`length_equals`,...iw(t),length:e})}function ID(e,t){return new TT({check:`string_format`,format:`regex`,...iw(t),pattern:e})}function LD(e){return new ET({check:`string_format`,format:`lowercase`,...iw(e)})}function RD(e){return new DT({check:`string_format`,format:`uppercase`,...iw(e)})}function zD(e,t){return new OT({check:`string_format`,format:`includes`,...iw(t),includes:e})}function BD(e,t){return new kT({check:`string_format`,format:`starts_with`,...iw(t),prefix:e})}function VD(e,t){return new AT({check:`string_format`,format:`ends_with`,...iw(t),suffix:e})}function HD(e){return new jT({check:`overwrite`,tx:e})}function UD(e){return HD(t=>t.normalize(e))}function WD(){return HD(e=>e.trim())}function GD(){return HD(e=>e.toLowerCase())}function KD(){return HD(e=>e.toUpperCase())}function qD(){return HD(e=>YC(e))}function JD(e,t,n){return new e({type:`array`,element:t,...iw(n)})}function YD(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...iw(n)})}function XD(e){let t=ZD(n=>(n.addIssue=e=>{if(typeof e==`string`)n.issues.push(yw(e,n.value,t._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=n.value,r.inst??=t,r.continue??=!t._zod.def.abort,n.issues.push(yw(r))}},e(n.value,n)));return t}function ZD(e,t){let n=new hT({check:`custom`,...iw(t)});return n._zod.check=e,n}function QD(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??YE,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,external:e?.external??void 0}}function $D(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,$D(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),t.io===`input`&&nO(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&o.schema._prefault&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function eO(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${a}`}}if(t[1]===n)return{ref:`#`};let i=`#/${r}/`,a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+a}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
|
|
112
112
|
|
|
113
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function nO(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e===`$ref`||e===`allOf`||e in a||delete i[e];if(s.$ref&&n.def)for(let e in i)e===`$ref`||e===`allOf`||e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e===`$ref`||e===`allOf`||e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(a[e.defId]=e.def)}e.external||Object.keys(a).length>0&&(e.target===`draft-2020-12`?i.$defs=a:i.definitions=a);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,`~standard`,{value:{...t[`~standard`],jsonSchema:{input:aO(t,`input`,e.processors),output:aO(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function rO(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return rO(r.element,n);if(r.type===`set`)return rO(r.valueType,n);if(r.type===`lazy`)return rO(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type===`default`||r.type===`prefault`)return rO(r.innerType,n);if(r.type===`intersection`)return rO(r.left,n)||rO(r.right,n);if(r.type===`record`||r.type===`map`)return rO(r.keyType,n)||rO(r.valueType,n);if(r.type===`pipe`)return rO(r.in,n)||rO(r.out,n);if(r.type===`object`){for(let e in r.shape)if(rO(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(rO(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(rO(e,n))return!0;return!!(r.rest&&rO(r.rest,n))}return!1}var iO=(e,t={})=>n=>{let r=$D({...n,processors:t});return eO(e,r),tO(r,e),nO(r,e)},aO=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=$D({...i??{},target:a,io:t,processors:n});return eO(e,o),tO(o,e),nO(o,e)},oO={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},sO=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=oO[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},cO=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;typeof s==`string`&&s.includes(`int`)?i.type=`integer`:i.type=`number`,typeof u==`number`&&(t.target===`draft-04`||t.target===`openapi-3.0`?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u),typeof a==`number`&&(i.minimum=a,typeof u==`number`&&t.target!==`draft-04`&&(u>=a?delete i.minimum:delete i.exclusiveMinimum)),typeof l==`number`&&(t.target===`draft-04`||t.target===`openapi-3.0`?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l),typeof o==`number`&&(i.maximum=o,typeof l==`number`&&t.target!==`draft-04`&&(l<=o?delete i.maximum:delete i.exclusiveMaximum)),typeof c==`number`&&(i.multipleOf=c)},lO=(e,t,n,r)=>{n.type=`boolean`},uO=(e,t,n,r)=>{n.not={}},dO=(e,t,n,r)=>{let i=e._zod.def,a=zC(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},fO=(e,t,n,r)=>{let i=e._zod.def,a=[];for(let e of i.values)if(e===void 0){if(t.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof e==`bigint`){if(t.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);a.push(Number(e))}else a.push(e);if(a.length!==0)if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a},pO=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},mO=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},hO=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=eO(a.element,t,{...r,path:[...r.path,`items`]})},gO=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=eO(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=eO(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},_O=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>eO(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},vO=(e,t,n,r)=>{let i=e._zod.def,a=eO(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=eO(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},yO=(e,t,n,r)=>{let i=e._zod.def,a=eO(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},bO=(e,t,n,r)=>{let i=e._zod.def;eO(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},xO=(e,t,n,r)=>{let i=e._zod.def;eO(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},SO=(e,t,n,r)=>{let i=e._zod.def;eO(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},CO=(e,t,n,r)=>{let i=e._zod.def;eO(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},wO=(e,t,n,r)=>{let i=e._zod.def,a=t.io===`input`?i.in._zod.def.type===`transform`?i.out:i.in:i.out;eO(a,t,r);let o=t.seen.get(e);o.ref=a},TO=(e,t,n,r)=>{let i=e._zod.def;eO(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},EO=(e,t,n,r)=>{let i=e._zod.def;eO(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},DO=$(`ZodISODateTime`,(e,t)=>{YT.init(e,t),$O.init(e,t)});function OO(e){return bD(DO,e)}var kO=$(`ZodISODate`,(e,t)=>{XT.init(e,t),$O.init(e,t)});function AO(e){return xD(kO,e)}var jO=$(`ZodISOTime`,(e,t)=>{ZT.init(e,t),$O.init(e,t)});function MO(e){return SD(jO,e)}var NO=$(`ZodISODuration`,(e,t)=>{QT.init(e,t),$O.init(e,t)});function PO(e){return CD(NO,e)}var FO=(e,t)=>{Sw.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>Tw(e,t)},flatten:{value:t=>ww(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,BC,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,BC,2)}},isEmpty:{get(){return e.issues.length===0}}})};$(`ZodError`,FO);var IO=$(`ZodError`,FO,{Parent:Error}),LO=Ew(IO),RO=Dw(IO),zO=Ow(IO),BO=Aw(IO),VO=Mw(IO),HO=Nw(IO),UO=Pw(IO),WO=Fw(IO),GO=Iw(IO),KO=Lw(IO),qO=Rw(IO),JO=zw(IO),YO=$(`ZodType`,(e,t)=>(FT.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:aO(e,`input`),output:aO(e,`output`)}}),e.toJSONSchema=iO(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,`_def`,{value:t}),e.check=(...n)=>e.clone(JC(t,{checks:[...t.checks??[],...n.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0}),e.with=e.check,e.clone=(t,n)=>iw(e,t,n),e.brand=()=>e,e.register=((t,n)=>(t.add(e,n),e)),e.parse=(t,n)=>LO(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>zO(e,t,n),e.parseAsync=async(t,n)=>RO(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>BO(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>VO(e,t,n),e.decode=(t,n)=>HO(e,t,n),e.encodeAsync=async(t,n)=>UO(e,t,n),e.decodeAsync=async(t,n)=>WO(e,t,n),e.safeEncode=(t,n)=>GO(e,t,n),e.safeDecode=(t,n)=>KO(e,t,n),e.safeEncodeAsync=async(t,n)=>qO(e,t,n),e.safeDecodeAsync=async(t,n)=>JO(e,t,n),e.refine=(t,n)=>e.check(uA(t,n)),e.superRefine=t=>e.check(dA(t)),e.overwrite=t=>e.check(UD(t)),e.optional=()=>Kk(e),e.exactOptional=()=>Jk(e),e.nullable=()=>Xk(e),e.nullish=()=>Kk(Xk(e)),e.nonoptional=t=>nA(e,t),e.array=()=>Ak(e),e.or=t=>Pk([e,t]),e.and=t=>Rk(e,t),e.transform=t=>oA(e,Wk(t)),e.default=t=>Qk(e,t),e.prefault=t=>eA(e,t),e.catch=t=>iA(e,t),e.pipe=t=>oA(e,t),e.readonly=()=>cA(e),e.describe=t=>{let n=e.clone();return XE.add(n,{description:t}),n},Object.defineProperty(e,`description`,{get(){return XE.get(e)?.description},configurable:!0}),e.meta=(...t)=>{if(t.length===0)return XE.get(e);let n=e.clone();return XE.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=t=>t(e),e)),XO=$(`_ZodString`,(e,t)=>{IT.init(e,t),YO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>sO(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...t)=>e.check(LD(...t)),e.includes=(...t)=>e.check(BD(...t)),e.startsWith=(...t)=>e.check(VD(...t)),e.endsWith=(...t)=>e.check(HD(...t)),e.min=(...t)=>e.check(FD(...t)),e.max=(...t)=>e.check(PD(...t)),e.length=(...t)=>e.check(ID(...t)),e.nonempty=(...t)=>e.check(FD(1,...t)),e.lowercase=t=>e.check(RD(t)),e.uppercase=t=>e.check(zD(t)),e.trim=()=>e.check(GD()),e.normalize=(...t)=>e.check(WD(...t)),e.toLowerCase=()=>e.check(KD()),e.toUpperCase=()=>e.check(qD()),e.slugify=()=>e.check(JD())}),ZO=$(`ZodString`,(e,t)=>{IT.init(e,t),XO.init(e,t),e.email=t=>e.check(QE(ek,t)),e.url=t=>e.check(iD(rk,t)),e.jwt=t=>e.check(yD(vk,t)),e.emoji=t=>e.check(aD(ik,t)),e.guid=t=>e.check($E(tk,t)),e.uuid=t=>e.check(eD(nk,t)),e.uuidv4=t=>e.check(tD(nk,t)),e.uuidv6=t=>e.check(nD(nk,t)),e.uuidv7=t=>e.check(rD(nk,t)),e.nanoid=t=>e.check(oD(ak,t)),e.guid=t=>e.check($E(tk,t)),e.cuid=t=>e.check(sD(ok,t)),e.cuid2=t=>e.check(cD(sk,t)),e.ulid=t=>e.check(lD(ck,t)),e.base64=t=>e.check(gD(hk,t)),e.base64url=t=>e.check(_D(gk,t)),e.xid=t=>e.check(uD(lk,t)),e.ksuid=t=>e.check(dD(uk,t)),e.ipv4=t=>e.check(fD(dk,t)),e.ipv6=t=>e.check(pD(fk,t)),e.cidrv4=t=>e.check(mD(pk,t)),e.cidrv6=t=>e.check(hD(mk,t)),e.e164=t=>e.check(vD(_k,t)),e.datetime=t=>e.check(OO(t)),e.date=t=>e.check(AO(t)),e.time=t=>e.check(MO(t)),e.duration=t=>e.check(PO(t))});function QO(e){return ZE(ZO,e)}var $O=$(`ZodStringFormat`,(e,t)=>{LT.init(e,t),XO.init(e,t)}),ek=$(`ZodEmail`,(e,t)=>{BT.init(e,t),$O.init(e,t)}),tk=$(`ZodGUID`,(e,t)=>{RT.init(e,t),$O.init(e,t)}),nk=$(`ZodUUID`,(e,t)=>{zT.init(e,t),$O.init(e,t)}),rk=$(`ZodURL`,(e,t)=>{VT.init(e,t),$O.init(e,t)}),ik=$(`ZodEmoji`,(e,t)=>{HT.init(e,t),$O.init(e,t)}),ak=$(`ZodNanoID`,(e,t)=>{UT.init(e,t),$O.init(e,t)}),ok=$(`ZodCUID`,(e,t)=>{WT.init(e,t),$O.init(e,t)}),sk=$(`ZodCUID2`,(e,t)=>{GT.init(e,t),$O.init(e,t)}),ck=$(`ZodULID`,(e,t)=>{KT.init(e,t),$O.init(e,t)}),lk=$(`ZodXID`,(e,t)=>{qT.init(e,t),$O.init(e,t)}),uk=$(`ZodKSUID`,(e,t)=>{JT.init(e,t),$O.init(e,t)}),dk=$(`ZodIPv4`,(e,t)=>{$T.init(e,t),$O.init(e,t)}),fk=$(`ZodIPv6`,(e,t)=>{eE.init(e,t),$O.init(e,t)}),pk=$(`ZodCIDRv4`,(e,t)=>{tE.init(e,t),$O.init(e,t)}),mk=$(`ZodCIDRv6`,(e,t)=>{nE.init(e,t),$O.init(e,t)}),hk=$(`ZodBase64`,(e,t)=>{iE.init(e,t),$O.init(e,t)}),gk=$(`ZodBase64URL`,(e,t)=>{oE.init(e,t),$O.init(e,t)}),_k=$(`ZodE164`,(e,t)=>{sE.init(e,t),$O.init(e,t)}),vk=$(`ZodJWT`,(e,t)=>{lE.init(e,t),$O.init(e,t)}),yk=$(`ZodNumber`,(e,t)=>{uE.init(e,t),YO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>cO(e,t,n,r),e.gt=(t,n)=>e.check(jD(t,n)),e.gte=(t,n)=>e.check(MD(t,n)),e.min=(t,n)=>e.check(MD(t,n)),e.lt=(t,n)=>e.check(kD(t,n)),e.lte=(t,n)=>e.check(AD(t,n)),e.max=(t,n)=>e.check(AD(t,n)),e.int=t=>e.check(Sk(t)),e.safe=t=>e.check(Sk(t)),e.positive=t=>e.check(jD(0,t)),e.nonnegative=t=>e.check(MD(0,t)),e.negative=t=>e.check(kD(0,t)),e.nonpositive=t=>e.check(AD(0,t)),e.multipleOf=(t,n)=>e.check(ND(t,n)),e.step=(t,n)=>e.check(ND(t,n)),e.finite=()=>e;let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function bk(e){return wD(yk,e)}var xk=$(`ZodNumberFormat`,(e,t)=>{dE.init(e,t),yk.init(e,t)});function Sk(e){return TD(xk,e)}var Ck=$(`ZodBoolean`,(e,t)=>{fE.init(e,t),YO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>lO(e,t,n,r)});function wk(e){return ED(Ck,e)}var Tk=$(`ZodUnknown`,(e,t)=>{pE.init(e,t),YO.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Ek(){return DD(Tk)}var Dk=$(`ZodNever`,(e,t)=>{mE.init(e,t),YO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>uO(e,t,n,r)});function Ok(e){return OD(Dk,e)}var kk=$(`ZodArray`,(e,t)=>{gE.init(e,t),YO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>hO(e,t,n,r),e.element=t.element,e.min=(t,n)=>e.check(FD(t,n)),e.nonempty=t=>e.check(FD(1,t)),e.max=(t,n)=>e.check(PD(t,n)),e.length=(t,n)=>e.check(ID(t,n)),e.unwrap=()=>e.element});function Ak(e,t){return YD(kk,e,t)}var jk=$(`ZodObject`,(e,t)=>{xE.init(e,t),YO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>gO(e,t,n,r),KC(e,`shape`,()=>t.shape),e.keyof=()=>Bk(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Ek()}),e.loose=()=>e.clone({...e._zod.def,catchall:Ek()}),e.strict=()=>e.clone({...e._zod.def,catchall:Ok()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>uw(e,t),e.safeExtend=t=>dw(e,t),e.merge=t=>fw(e,t),e.pick=t=>cw(e,t),e.omit=t=>lw(e,t),e.partial=(...t)=>pw(Gk,e,t[0]),e.required=(...t)=>mw(tA,e,t[0])});function Mk(e,t){return new jk({type:`object`,shape:e??{},...aw(t)})}var Nk=$(`ZodUnion`,(e,t)=>{CE.init(e,t),YO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_O(e,t,n,r),e.options=t.options});function Pk(e,t){return new Nk({type:`union`,options:e,...aw(t)})}var Fk=$(`ZodDiscriminatedUnion`,(e,t)=>{Nk.init(e,t),wE.init(e,t)});function Ik(e,t,n){return new Fk({type:`union`,options:t,discriminator:e,...aw(n)})}var Lk=$(`ZodIntersection`,(e,t)=>{TE.init(e,t),YO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>vO(e,t,n,r)});function Rk(e,t){return new Lk({type:`intersection`,left:e,right:t})}var zk=$(`ZodEnum`,(e,t)=>{OE.init(e,t),YO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>dO(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new zk({...t,checks:[],...aw(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new zk({...t,checks:[],...aw(r),entries:i})}});function Bk(e,t){return new zk({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...aw(t)})}var Vk=$(`ZodLiteral`,(e,t)=>{kE.init(e,t),YO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>fO(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,`value`,{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function Hk(e,t){return new Vk({type:`literal`,values:Array.isArray(e)?e:[e],...aw(t)})}var Uk=$(`ZodTransform`,(e,t)=>{AE.init(e,t),YO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>mO(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new IC(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(bw(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(bw(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function Wk(e){return new Uk({type:`transform`,transform:e})}var Gk=$(`ZodOptional`,(e,t)=>{ME.init(e,t),YO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>EO(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Kk(e){return new Gk({type:`optional`,innerType:e})}var qk=$(`ZodExactOptional`,(e,t)=>{NE.init(e,t),YO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>EO(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Jk(e){return new qk({type:`optional`,innerType:e})}var Yk=$(`ZodNullable`,(e,t)=>{PE.init(e,t),YO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>yO(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Xk(e){return new Yk({type:`nullable`,innerType:e})}var Zk=$(`ZodDefault`,(e,t)=>{FE.init(e,t),YO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xO(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Qk(e,t){return new Zk({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():tw(t)}})}var $k=$(`ZodPrefault`,(e,t)=>{LE.init(e,t),YO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>SO(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function eA(e,t){return new $k({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():tw(t)}})}var tA=$(`ZodNonOptional`,(e,t)=>{RE.init(e,t),YO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>bO(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function nA(e,t){return new tA({type:`nonoptional`,innerType:e,...aw(t)})}var rA=$(`ZodCatch`,(e,t)=>{BE.init(e,t),YO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>CO(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function iA(e,t){return new rA({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var aA=$(`ZodPipe`,(e,t)=>{VE.init(e,t),YO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wO(e,t,n,r),e.in=t.in,e.out=t.out});function oA(e,t){return new aA({type:`pipe`,in:e,out:t})}var sA=$(`ZodReadonly`,(e,t)=>{UE.init(e,t),YO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>TO(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function cA(e){return new sA({type:`readonly`,innerType:e})}var lA=$(`ZodCustom`,(e,t)=>{GE.init(e,t),YO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>pO(e,t,n,r)});function uA(e,t={}){return XD(lA,e,t)}function dA(e){return ZD(e)}Mk({ok:wk(),sessions:bk().int().nonnegative()}).strict(),Ik(`type`,[Mk({type:Hk(`input`),data:QO().max(kC)}).strict(),Mk({type:Hk(`resize`),cols:bk().int().positive().max(NC),rows:bk().int().positive().max(PC),pixelWidth:bk().int().nonnegative().optional(),pixelHeight:bk().int().nonnegative().optional()}).strict()]);var fA=Ik(`type`,[Mk({type:Hk(`output`),data:QO().max(AC)}).strict(),Mk({type:Hk(`exit`),code:bk().int().nullable()}).strict(),Mk({type:Hk(`title`),title:QO().max(jC)}).strict(),Mk({type:Hk(`session`),shell:QO().min(1),shellName:QO().min(1),pid:bk().int().nonnegative(),cwd:QO().min(1),title:QO().max(jC)}).strict(),Mk({type:Hk(`cwd`),cwd:QO().min(1)}).strict(),Mk({type:Hk(`foreground`),process:QO().max(256).nullable()}).strict(),Mk({type:Hk(`notification`),body:QO().min(1).max(MC)}).strict()]),pA=Bk([`modified`,`added`,`deleted`,`renamed`,`untracked`]),mA=Mk({isRepo:wk(),files:bk().int().nonnegative(),additions:bk().int().nonnegative(),deletions:bk().int().nonnegative(),binaries:bk().int().nonnegative()}).strict(),hA=Mk({path:QO().min(1),oldPath:QO().min(1).nullable(),status:pA,additions:bk().int().nonnegative(),deletions:bk().int().nonnegative(),binary:wk(),patch:QO().nullable(),patchOmitted:wk()}).strict(),gA=Mk({isRepo:wk(),files:Ak(hA)}).strict(),_A=`/api/git/diff-summary`,vA=`/api/git/diff`,yA=(e,t)=>{let n=new URL(e,window.location.href);return n.searchParams.set(`cwd`,t),n.toString()},bA=async(e,t)=>{try{let n=await fetch(yA(_A,e),{signal:t});if(!n.ok)return null;let r=mA.safeParse(await n.json());return r.success?r.data:null}catch{return null}},xA=async(e,t)=>{try{let n=await fetch(yA(vA,e),{signal:t});if(!n.ok)return null;let r=gA.safeParse(await n.json());return r.success?r.data:null}catch{return null}},SA=e=>`${e.filePath}\u0000${e.side}:${e.lineNumber}`,CA=e=>{let{startSide:t,startLineNumber:n}=e;return t===void 0||n===void 0||t===e.side&&n===e.lineNumber?null:{side:t,lineNumber:n}},wA="Please address the following code review comments. Run `git diff` (or `git diff HEAD`) to see the full context of any changes, especially for deleted lines.\n",TA=e=>{let{filePath:t,side:n,lineNumber:r}=e,i=CA(e);if(!i)return n===`old`?`${t} (deleted, was L${r} — see \`git diff\`)`:`${t} L${r}`;if(i.side===`new`&&n===`new`)return`${t} L${i.lineNumber}-L${r}`;if(i.side===`old`&&n===`old`)return`${t} (deleted, was L${i.lineNumber}-L${r} — see \`git diff\`)`;let a=(e,t)=>e===`old`?`old L${t}`:`L${t}`;return`${t} ${a(i.side,i.lineNumber)} through ${a(n,r)} (range spans removed lines — see \`git diff\`)`},EA=e=>{let t=[...e].sort((e,t)=>e.filePath.localeCompare(t.filePath)||(e.startLineNumber??e.lineNumber)-(t.startLineNumber??t.lineNumber)||e.lineNumber-t.lineNumber),n=wA;for(let e of t)n+=`\n- ${TA(e)}: ${e.comment}`;return n},DA=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@(.*)$/,OA=e=>{let t=[],n=null,r=0,i=0,a=e.split(`
|
|
114
|
-
`);a.length>0&&a[a.length-1]===``&&a.pop();for(let e of a){let a=DA.exec(e);if(a){r=Number.parseInt(a[1],10),i=Number.parseInt(a[2],10),n={header:e,lines:[]},t.push(n);continue}if(!n)continue;let o=e[0];if(o===`\\`){let e=n.lines[n.lines.length-1];e&&(e.noNewline=!0);continue}if(o===`+`){n.lines.push({type:`add`,text:e.slice(1),oldLine:null,newLine:i,noNewline:!1}),i+=1;continue}if(o===`-`){n.lines.push({type:`del`,text:e.slice(1),oldLine:r,newLine:null,noNewline:!1}),r+=1;continue}n.lines.push({type:`context`,text:o===` `?e.slice(1):e,oldLine:r,newLine:i,noNewline:!1}),r+=1,i+=1}return t},kA=e=>e.reduce((e,t)=>e+t.lines.length,0),AA=e=>{if(typeof window>`u`)return null;try{let t=window.localStorage.getItem(e);return t===null||t.trim()===``?null:t}catch{return null}},jA=(e,t)=>{if(!(typeof window>`u`))try{window.localStorage.setItem(e,t)}catch{}},MA=(e,t,n)=>({load:()=>{let r=AA(e);if(r===null)return t;let i=Number(r);return Number.isFinite(i)?n(i):t},store:t=>jA(e,String(t))}),NA=(e,t)=>({load:()=>{let n=AA(e);return n===`true`?!0:n===`false`?!1:t},store:t=>jA(e,String(t))}),PA=(e,t,n)=>({load:()=>{let r=AA(e);return r!==null&&n(r)?r:t},store:t=>jA(e,t)}),FA=(e,t,n)=>({load:()=>t(AA(e)),store:t=>jA(e,n(t))}),IA=PA(YS,`unified`,e=>e===`unified`||e===`split`),LA=IA.load,RA=IA.store,zA=(e,t)=>{let n=e=>`${e.side===`old`?`old `:``}L${e.lineNumber}`;return e.side===t.side?`${e.side===`old`?`old `:``}L${e.lineNumber}–L${t.lineNumber}`:`${n(e)} – ${n(t)}`},BA=()=>(0,y.jsx)(`span`,{"aria-hidden":`true`,className:`pointer-events-none absolute inset-0 border-l-2 border-primary/60 bg-primary/10`}),VA={modified:{letter:`M`,className:`text-amber-400`},added:{letter:`A`,className:`text-emerald-400`},deleted:{letter:`D`,className:`text-red-400`},renamed:{letter:`R`,className:`text-sky-400`},untracked:{letter:`U`,className:`text-emerald-400`}},HA=`text-emerald-400`,UA=`text-red-400`,WA=`w-12 shrink-0 select-none px-2 text-right text-muted-foreground/50 tabular-nums`,GA=e=>{let t=e.lastIndexOf(`/`);return t===-1?{directory:``,basename:e}:{directory:e.slice(0,t+1),basename:e.slice(t+1)}},KA=e=>e===`add`?`bg-emerald-500/10`:e===`del`?`bg-red-500/10`:``,qA=e=>e===`context`?`text-muted-foreground`:`text-foreground/90`,JA=({onClick:e,onDragStart:t})=>(0,y.jsx)(`button`,{type:`button`,onClick:e,onPointerDown:e=>{e.button===0&&(e.preventDefault(),t())},"aria-label":`comment on line — drag to select multiple lines`,className:`absolute top-1/2 left-1 z-10 hidden size-4 -translate-y-1/2 items-center justify-center rounded-sm bg-primary text-primary-foreground transition-transform group-hover/line:flex hover:scale-110`,children:(0,y.jsx)(vd,{className:`size-3`,"aria-hidden":`true`})}),YA=({initialComment:e,onSave:t,onCancel:n})=>{let[r,i]=(0,b.useState)(e),a=r.trim(),o=()=>{a&&t(a)};return(0,y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,y.jsx)(kS,{autoFocus:!0,value:r,onChange:e=>i(e.target.value),onKeyDown:e=>{e.key===`Escape`?(e.preventDefault(),e.stopPropagation(),n()):e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),o())},placeholder:`Leave a comment on this line…`,"aria-label":`line comment`,className:`min-h-12 text-xs`}),(0,y.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,y.jsx)(Xx,{size:`xs`,onClick:o,disabled:!a,children:`Save comment`}),(0,y.jsx)(Xx,{size:`xs`,variant:`ghost`,onClick:n,children:`Cancel`})]})]})},XA=({annotation:e,isEditing:t,rangeLabel:n,onEdit:r,onSave:i,onCancel:a,onDelete:o})=>(0,y.jsx)(`div`,{className:`border-y border-border/40 bg-muted/20 py-2 pr-4 pl-3 font-sans`,children:(0,y.jsxs)(`div`,{className:`sticky left-3 max-w-xl`,children:[n?(0,y.jsx)(`div`,{className:`mb-1 font-mono text-[10px] tracking-wide text-muted-foreground/80`,children:n}):null,t?(0,y.jsx)(YA,{initialComment:e?.comment??``,onSave:i,onCancel:a}):e?(0,y.jsxs)(`div`,{className:`group/comment flex items-start gap-2`,children:[(0,y.jsx)(yd,{className:`mt-0.5 size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),(0,y.jsx)(`p`,{className:`min-w-0 flex-1 whitespace-pre-wrap text-foreground/90`,children:e.comment}),(0,y.jsxs)(`span`,{className:`flex shrink-0 items-center gap-0.5 opacity-0 transition-opacity group-hover/comment:opacity-100`,children:[(0,y.jsx)(Xx,{variant:`ghost`,size:`icon-xs`,onClick:r,"aria-label":`edit comment`,className:`hover:text-foreground`,children:(0,y.jsx)(Sd,{})}),(0,y.jsx)(Xx,{variant:`ghost`,size:`icon-xs`,onClick:o,"aria-label":`delete comment`,className:`hover:text-destructive`,children:(0,y.jsx)(Od,{})})]})]}):null]})}),ZA=({line:e,highlighted:t,onAnnotate:n,onDragStart:r,onDragEnter:i})=>(0,y.jsxs)(`div`,{className:rp(`group/line relative flex`,KA(e.type)),onPointerEnter:i,children:[n&&r?(0,y.jsx)(JA,{onClick:n,onDragStart:r}):null,(0,y.jsx)(`span`,{className:WA,children:e.oldLine??``}),(0,y.jsx)(`span`,{className:WA,children:e.newLine??``}),(0,y.jsx)(`span`,{className:rp(`w-5 shrink-0 select-none text-center`,e.type===`add`&&HA,e.type===`del`&&UA),children:e.type===`add`?`+`:e.type===`del`?`-`:``}),(0,y.jsxs)(`span`,{className:rp(`whitespace-pre pr-4`,qA(e.type)),children:[e.text,e.noNewline?(0,y.jsx)(`span`,{className:`select-none text-muted-foreground/50`,title:`No newline at end of file`,children:` ⊘`}):null]}),t?(0,y.jsx)(BA,{}):null]}),QA=({line:e,side:t,onAnnotate:n,onDragStart:r})=>{if(!e)return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(`span`,{className:WA}),(0,y.jsx)(`span`,{className:`min-w-0 flex-1 bg-muted/20`})]});let i=e.type===`context`?`context`:t===`left`?`del`:`add`;return(0,y.jsxs)(y.Fragment,{children:[n&&r?(0,y.jsx)(JA,{onClick:n,onDragStart:r}):null,(0,y.jsx)(`span`,{className:rp(WA,KA(i)),children:t===`left`?e.oldLine??``:e.newLine??``}),(0,y.jsx)(`span`,{className:rp(`min-w-0 flex-1 overflow-x-clip whitespace-pre pr-2`,KA(i),qA(e.type)),children:e.text})]})},$A=({hunk:e})=>(0,y.jsx)(`div`,{className:`select-none bg-muted/30 px-4 py-0.5 text-muted-foreground/60`,children:e.header}),ej=({file:e,viewMode:t,annotations:n,editingKey:r,pendingRange:i,dragCancelRef:a,onOpenEditor:o,onSaveAnnotation:s,onCancelEditor:c,onDeleteAnnotation:l})=>{let[u,d]=(0,b.useState)(!1),[f,p]=(0,b.useState)(null),m=(0,b.useMemo)(()=>e.patch?OA(e.patch):[],[e.patch]),h=(0,b.useMemo)(()=>kA(m),[m]),g=(0,b.useMemo)(()=>wC(m),[m]),_=f!==null,v=f?DC(g,f.anchor,f.focus):null,x=(0,b.useRef)(v);x.current=v;let S=e=>p({anchor:e,focus:e}),C=e=>p(t=>t&&{...t,focus:e});(0,b.useEffect)(()=>{d(!1),p(null)},[e.path]),(0,b.useEffect)(()=>{if(!_)return;let t=()=>p(null);a.current=t;let n=()=>{p(null);let t=x.current;t&&o(SA({filePath:e.path,...t.end}),CC(t.start)===CC(t.end)?void 0:{filePath:e.path,...t})};return window.addEventListener(`pointerup`,n),window.addEventListener(`pointercancel`,t),()=>{a.current=null,window.removeEventListener(`pointerup`,n),window.removeEventListener(`pointercancel`,t)}},[_,e.path,o,a]);let w=(0,b.useMemo)(()=>{let t=new Set,r=e=>{if(e)for(let n of OC(g,e))t.add(n)};r(v),i&&i.filePath===e.path&&r(i);for(let t of Object.values(n)){if(t.filePath!==e.path)continue;let n=CA(t);n&&r({start:n,end:{side:t.side,lineNumber:t.lineNumber}})}return t},[g,v,i,n,e.path]);if(e.binary)return(0,y.jsx)(tj,{icon:!0,children:`Binary file — no text diff to show.`});if(e.patchOmitted)return(0,y.jsx)(tj,{icon:!0,children:`Diff too large to display.`});if(m.length===0)return(0,y.jsx)(tj,{children:e.status===`renamed`?`Renamed without content changes.`:e.status===`untracked`&&e.additions===0?`Empty file.`:`No content changes.`});let T=u?1/0:JS,E=0,D=[];for(let e of m){if(E>=T)break;let t=T-E,n=e.lines.length<=t?e.lines:e.lines.slice(0,t);D.push(n===e.lines?e:{header:e.header,lines:n}),E+=n.length}let O=h-E,k=t=>{let a=SC(t);if(!a)return null;let o=SA({filePath:e.path,...a}),c=n[o],l=r===o,u=l&&i&&i.filePath===e.path?i.start:c?CA(c):null;return{key:o,target:a,saved:c,isEditing:l,rangeStart:u,save:t=>s({filePath:e.path,...a,...u?{startSide:u.side,startLineNumber:u.lineNumber}:{},comment:t})}},A=e=>e&&(e.saved||e.isEditing)?(0,y.jsx)(XA,{annotation:e.saved,isEditing:e.isEditing,rangeLabel:e.rangeStart?zA(e.rangeStart,e.target):null,onEdit:()=>o(e.key),onSave:e.save,onCancel:c,onDelete:()=>l(e.key)}):null;return(0,y.jsxs)(`div`,{className:rp(`pb-4 font-mono text-xs leading-5`,t===`unified`&&`min-w-max`,_&&`select-none`),children:[D.map(e=>(0,y.jsxs)(`div`,{children:[(0,y.jsx)($A,{hunk:e}),t===`unified`?e.lines.map((e,t)=>{let n=k(e);return(0,y.jsxs)(b.Fragment,{children:[(0,y.jsx)(ZA,{line:e,highlighted:n!==null&&w.has(CC(n.target)),onAnnotate:n?()=>o(n.key):void 0,onDragStart:n?()=>S(n.target):void 0,onDragEnter:_&&n?()=>C(n.target):void 0}),A(n)]},t)}):xC(e).map((e,t)=>{let n=e.left?k(e.left):null,r=e.right?k(e.right):null,i=n!==null&&n.key===r?.key;return(0,y.jsxs)(b.Fragment,{children:[(0,y.jsxs)(`div`,{className:`flex`,children:[(0,y.jsxs)(`div`,{className:`group/line relative flex w-1/2 min-w-0 border-r border-border/40`,onPointerEnter:_&&n?()=>C(n.target):void 0,children:[(0,y.jsx)(QA,{line:e.left,side:`left`,onAnnotate:n?()=>o(n.key):void 0,onDragStart:n?()=>S(n.target):void 0}),n&&w.has(CC(n.target))?(0,y.jsx)(BA,{}):null]}),(0,y.jsxs)(`div`,{className:`group/line relative flex w-1/2 min-w-0`,onPointerEnter:_&&r?()=>C(r.target):void 0,children:[(0,y.jsx)(QA,{line:e.right,side:`right`,onAnnotate:r?()=>o(r.key):void 0,onDragStart:r?()=>S(r.target):void 0}),r&&w.has(CC(r.target))?(0,y.jsx)(BA,{}):null]})]}),A(n),i?null:A(r)]},t)})]},e.header+String(e.lines[0]?.newLine??e.lines[0]?.oldLine??``))),O>0?(0,y.jsx)(`div`,{className:`px-4 py-2`,children:(0,y.jsxs)(Xx,{variant:`outline`,size:`xs`,onClick:()=>d(!0),children:[`Show `,O.toLocaleString(),` more lines`]})}):null]})},tj=({children:e,icon:t})=>(0,y.jsxs)(`div`,{className:`flex h-full min-h-32 items-center justify-center gap-2 text-sm text-muted-foreground`,children:[t?(0,y.jsx)(gd,{className:`size-4`,"aria-hidden":`true`}):null,e]}),nj=({open:e,cwd:t,onClose:n,onSendToTerminal:r})=>{let[i,a]=(0,b.useState)(!1),[o,s]=(0,b.useState)(!1),[c,l]=(0,b.useState)(null),[u,d]=(0,b.useState)(!1),[f,p]=(0,b.useState)(!1),[m,h]=(0,b.useState)(null),[g,_]=(0,b.useState)(()=>LA()),[v,x]=(0,b.useState)(0),[S,C]=(0,b.useState)({}),[w,T]=(0,b.useState)(null),[E,D]=(0,b.useState)(null),O=(0,b.useRef)(null),k=(0,b.useRef)(null),A=(0,b.useRef)(null);(0,b.useEffect)(()=>{if(e){a(!0);let e=requestAnimationFrame(()=>s(!0));return()=>cancelAnimationFrame(e)}if(s(!1),i){let e=window.setTimeout(()=>a(!1),150);return()=>window.clearTimeout(e)}},[e]),(0,b.useEffect)(()=>{if(!e||!t)return;let n=new AbortController;return d(!0),p(!1),xA(t,n.signal).then(e=>{if(!n.signal.aborted){if(d(!1),!e){p(!0);return}l(e)}}),()=>n.abort()},[e,t,v]);let j=c?.files??[];(0,b.useEffect)(()=>{c&&(m&&c.files.some(e=>e.path===m)||h(c.files[0]?.path??null))},[c,m]);let M=j.find(e=>e.path===m)??null,N=M?j.indexOf(M):-1,P=(0,b.useMemo)(()=>{let e=0,t=0,n=0;for(let r of j)e+=r.additions,t+=r.deletions,r.binary&&(n+=1);return{additions:e,deletions:t,binaries:n}},[j]),F=(0,b.useCallback)(e=>{if(j.length===0)return;let t=Math.min(j.length-1,Math.max(0,(N===-1?0:N)+e));h(j[t].path),(A.current?.children[t])?.scrollIntoView({block:`nearest`})},[j,N]);(0,b.useEffect)(()=>{if(!e||!i)return;let t=e=>{let t=e.target,r=t instanceof HTMLElement&&t.tagName===`TEXTAREA`;if(e.key===`Escape`){if(r)return;if(e.preventDefault(),e.stopPropagation(),O.current){O.current();return}n();return}r||t instanceof HTMLElement&&t.tagName===`INPUT`||(e.key===`ArrowDown`||e.key===`j`?(e.preventDefault(),F(1)):(e.key===`ArrowUp`||e.key===`k`)&&(e.preventDefault(),F(-1)))};return window.addEventListener(`keydown`,t,!0),()=>window.removeEventListener(`keydown`,t,!0)},[e,i,n,F]),(0,b.useEffect)(()=>{e&&o&&k.current?.focus()},[e,o]);let I=(0,b.useCallback)(e=>{_(e),RA(e)},[]),L=(0,b.useCallback)((e,t)=>{T(e),D(t??null)},[]),R=(0,b.useCallback)(()=>{T(null),D(null)},[]),z=(0,b.useCallback)(e=>{C(t=>({...t,[SA(e)]:e})),T(null),D(null)},[]),ee=(0,b.useCallback)(e=>{C(t=>{let{[e]:n,...r}=t;return r}),T(t=>t===e?null:t),D(t=>t&&SA({filePath:t.filePath,...t.end})===e?null:t)},[]),B=(0,b.useMemo)(()=>Object.values(S),[S]),te=(0,b.useMemo)(()=>{let e=new Map;for(let t of B)e.set(t.filePath,(e.get(t.filePath)??0)+1);return e},[B]),V=(0,b.useCallback)(()=>{C({}),T(null),D(null)},[]),H=(0,b.useCallback)(()=>{!r||B.length===0||(r(EA(B)),C({}),T(null),D(null),n())},[r,B,n]);if(!i)return null;let ne=e&&o,U=c?.isRepo??!0,re=c!==null&&U&&j.length===0;return(0,y.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center p-4 sm:p-6`,children:[(0,y.jsx)(`div`,{"data-open":ne||void 0,"data-closed":!ne||void 0,className:rp(Ux),onClick:n}),(0,y.jsxs)(`div`,{ref:k,role:`dialog`,"aria-label":`git diff viewer`,"aria-modal":!0,tabIndex:-1,"data-open":ne||void 0,"data-closed":!ne||void 0,className:rp(`relative z-10 flex h-full w-full max-w-7xl flex-col overflow-hidden rounded-xl outline-none`,Vx,Wx),children:[(0,y.jsxs)(`header`,{className:`flex shrink-0 items-center gap-3 border-b border-border/40 px-4 py-2.5`,children:[(0,y.jsx)(`h2`,{className:`text-sm font-medium text-foreground`,children:`Changes`}),(0,y.jsxs)(`span`,{className:`font-mono text-xs tabular-nums text-muted-foreground`,children:[(0,y.jsxs)(`span`,{className:HA,children:[`+`,P.additions.toLocaleString()]}),` `,(0,y.jsxs)(`span`,{className:UA,children:[`−`,P.deletions.toLocaleString()]}),P.binaries>0?(0,y.jsxs)(`span`,{className:`text-muted-foreground/70`,children:[` · `,P.binaries,` binary`]}):null]}),u?(0,y.jsx)(LS,{className:`size-3.5`,"aria-label":`loading diff`}):null,(0,y.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[(0,y.jsx)(`div`,{role:`radiogroup`,"aria-label":`diff layout`,className:`flex items-center rounded-md border border-border/60 p-0.5`,children:[`unified`,`split`].map(e=>(0,y.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":g===e,onClick:()=>I(e),className:rp(`rounded-sm px-2 py-0.5 text-xs capitalize transition-colors`,g===e?`bg-foreground/10 text-foreground`:`text-muted-foreground hover:text-foreground`),children:e},e))}),(0,y.jsx)(Xx,{variant:`ghost`,size:`icon-sm`,onClick:()=>x(e=>e+1),"aria-label":`refresh diff`,className:`hover:text-foreground`,children:(0,y.jsx)(wd,{})}),(0,y.jsx)(Xx,{variant:`ghost`,size:`icon-sm`,onClick:n,"aria-label":`close diff viewer`,className:`hover:text-foreground`,children:(0,y.jsx)(kd,{})})]})]}),f?(0,y.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 text-sm text-muted-foreground`,children:[`Couldn't load the diff from the localterm daemon.`,(0,y.jsx)(Xx,{variant:`outline`,size:`xs`,onClick:()=>x(e=>e+1),children:`Retry`})]}):U?re?(0,y.jsx)(`div`,{className:`flex flex-1 items-center justify-center text-sm text-muted-foreground`,children:`Working tree clean — nothing to diff.`}):c===null?(0,y.jsx)(`div`,{className:`flex flex-1 items-center justify-center`,children:(0,y.jsx)(LS,{"aria-label":`loading diff`})}):(0,y.jsxs)(`div`,{className:`flex min-h-0 flex-1`,children:[(0,y.jsx)(`div`,{ref:A,role:`listbox`,"aria-label":`changed files`,className:`w-72 shrink-0 overflow-y-auto overscroll-contain border-r border-border/40 p-1.5`,children:j.map(e=>{let t=VA[e.status],{directory:n,basename:r}=GA(e.path),i=e.path===m,a=te.get(e.path)??0;return(0,y.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":i,onClick:()=>h(e.path),className:rp(`flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-left text-xs outline-none transition-colors`,i?`bg-foreground/10 text-foreground`:`text-muted-foreground hover:bg-foreground/5`),children:[(0,y.jsx)(`span`,{className:rp(`w-3 shrink-0 font-mono font-semibold`,t.className),title:e.status,children:t.letter}),(0,y.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono`,dir:`rtl`,children:(0,y.jsxs)(`bdi`,{children:[(0,y.jsx)(`span`,{className:`text-muted-foreground/60`,children:n}),(0,y.jsx)(`span`,{className:i?`text-foreground`:``,children:r})]})}),a>0?(0,y.jsxs)(`span`,{className:`flex shrink-0 items-center gap-0.5 font-mono text-[10px] tabular-nums text-muted-foreground`,title:`${a} pending comment${a===1?``:`s`}`,children:[(0,y.jsx)(yd,{className:`size-2.5`,"aria-hidden":`true`}),a]}):null,e.binary?(0,y.jsx)(`span`,{className:`shrink-0 rounded border border-border/40 px-1 font-mono text-[10px] text-muted-foreground/70`,children:`BIN`}):(0,y.jsxs)(`span`,{className:`shrink-0 font-mono tabular-nums`,children:[(0,y.jsxs)(`span`,{className:HA,children:[`+`,e.additions]}),` `,(0,y.jsxs)(`span`,{className:UA,children:[`−`,e.deletions]})]})]},e.path)})}),(0,y.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:M?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 border-b border-border/40 px-4 py-1.5 font-mono text-xs text-muted-foreground`,children:[M.oldPath?(0,y.jsxs)(`span`,{className:`truncate`,children:[M.oldPath,(0,y.jsx)(`span`,{className:`text-muted-foreground/50`,children:` → `}),(0,y.jsx)(`span`,{className:`text-foreground`,children:M.path})]}):(0,y.jsx)(`span`,{className:`truncate text-foreground`,children:M.path}),M.binary?null:(0,y.jsxs)(`span`,{className:`ml-auto shrink-0 tabular-nums`,children:[(0,y.jsxs)(`span`,{className:HA,children:[`+`,M.additions]}),` `,(0,y.jsxs)(`span`,{className:UA,children:[`−`,M.deletions]})]})]}),(0,y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto overscroll-contain`,children:(0,y.jsx)(ej,{file:M,viewMode:g,annotations:S,editingKey:w,pendingRange:E,dragCancelRef:O,onOpenEditor:L,onSaveAnnotation:z,onCancelEditor:R,onDeleteAnnotation:ee})})]}):(0,y.jsx)(`div`,{className:`flex flex-1 items-center justify-center text-sm text-muted-foreground`,children:`Select a file to view its diff.`})})]}):(0,y.jsx)(`div`,{className:`flex flex-1 items-center justify-center text-sm text-muted-foreground`,children:`Not a git repository.`}),B.length>0?(0,y.jsxs)(`footer`,{className:`flex shrink-0 items-center gap-2 border-t border-border/40 px-4 py-2`,children:[(0,y.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[B.length,` pending comment`,B.length===1?``:`s`]}),(0,y.jsxs)(`div`,{className:`ml-auto flex items-center gap-1.5`,children:[(0,y.jsx)(Xx,{variant:`ghost`,size:`xs`,onClick:V,children:`Clear all`}),r?(0,y.jsxs)(Xx,{size:`xs`,onClick:H,children:[(0,y.jsx)(Ed,{"aria-hidden":`true`}),`Send to terminal`]}):null]})]}):null]})]})},rj=b.forwardRef(function(e,t){let{className:n,render:r,orientation:i=`horizontal`,style:a,...o}=e;return w_(`div`,e,{state:{orientation:i},ref:t,props:[{role:`separator`,"aria-orientation":i},o]})});function ij({className:e,orientation:t=`horizontal`,...n}){return(0,y.jsx)(rj,{"data-slot":`separator`,orientation:t,className:rp(`shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch`,e),...n})}var aj=Jx(`flex w-fit items-stretch *:focus-visible:relative *:focus-visible:z-10 has-[>[data-slot=button-group]]:gap-2 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-md [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1`,{variants:{orientation:{horizontal:`*:data-slot:rounded-r-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-r-md! [&>[data-slot]~[data-slot]]:rounded-l-none [&>[data-slot]~[data-slot]]:border-l-0`,vertical:`flex-col *:data-slot:rounded-b-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-b-md! [&>[data-slot]~[data-slot]]:rounded-t-none [&>[data-slot]~[data-slot]]:border-t-0`}},defaultVariants:{orientation:`horizontal`}});function oj({className:e,orientation:t,...n}){return(0,y.jsx)(`div`,{role:`group`,"data-slot":`button-group`,"data-orientation":t,className:rp(aj({orientation:t}),e),...n})}function sj({className:e,render:t,...n}){return oS({defaultTagName:`div`,props:u_({className:rp(`flex items-center gap-2 rounded-md border bg-muted px-2.5 text-sm font-medium shadow-xs [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4`,e)},n),render:t,state:{slot:`button-group-text`}})}var cj=e=>String(e),lj=`size-7 rounded-none border-0 bg-transparent text-foreground hover:bg-foreground/10 hover:text-foreground disabled:opacity-30 [&_svg]:size-3.5`,uj=`h-7 min-w-[3rem] cursor-ew-resize touch-none justify-center border-y-0 border-r border-l! border-border/60 bg-transparent px-1.5 text-xs font-medium tabular-nums text-foreground select-none hover:bg-foreground/5 focus-visible:outline-none focus-visible:bg-foreground/5`,dj={ArrowRight:1,ArrowUp:1,ArrowLeft:-1,ArrowDown:-1},fj=({value:e,min:t,max:n,step:r,ariaLabel:i,decrementAriaLabel:a,incrementAriaLabel:o,formatDisplay:s=cj,onValueChange:c})=>{let l=(0,b.useRef)(null),u=(0,b.useRef)(e),d=t=>{if(t.button===0){try{t.currentTarget.setPointerCapture(t.pointerId)}catch{}l.current=t.clientX,u.current=e}},f=e=>{let t=l.current;if(t===null)return;let n=e.clientX-t,i=Math.round(n/5);i!==0&&c(u.current+i*r)},p=e=>{if(l.current!==null){try{e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId)}catch{}l.current=null}};return(0,y.jsxs)(oj,{"aria-label":i,className:`h-7 overflow-hidden rounded-md border border-border/60`,children:[(0,y.jsx)(Xx,{variant:`ghost`,size:`icon-xs`,onClick:()=>c(e-r),disabled:e<=t,"aria-label":a,className:lj,children:(0,y.jsx)(bd,{})}),(0,y.jsx)(sj,{role:`slider`,tabIndex:0,"aria-label":i,"aria-valuemin":t,"aria-valuemax":n,"aria-valuenow":e,"aria-valuetext":s(e),"aria-orientation":`horizontal`,title:`Drag or use arrow keys to adjust`,className:uj,onPointerDown:d,onPointerMove:f,onPointerUp:p,onPointerCancel:p,onPointerLeave:e=>{if(l.current===null)return;let t=!1;try{t=e.currentTarget.hasPointerCapture(e.pointerId)}catch{}t||(l.current=null)},onKeyDown:i=>{if(i.key===`Home`){i.preventDefault(),c(t);return}if(i.key===`End`){i.preventDefault(),c(n);return}let a=dj[i.key];a!==void 0&&(i.preventDefault(),c(e+a*r))},children:s(e)}),(0,y.jsx)(Xx,{variant:`ghost`,size:`icon-xs`,onClick:()=>c(e+r),disabled:e>=n,"aria-label":o,className:lj,children:(0,y.jsx)(Cd,{})})]})};function pj(e){let[t,n]=b.useState({current:e,previous:null});return e!==t.current&&n({current:e,previous:t.current}),t.previous}var mj=b.createContext(null),hj=b.createContext(null);function gj(){let e=b.useContext(mj);if(e===null)throw Error(t_(60));return e}function _j(){let e=b.useContext(hj);if(e===null)throw Error(t_(61));return e}var vj=(e,t)=>Object.is(e,t);function yj(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function bj(e,t,n){return!e||e.length===0?!1:e.some(e=>e===void 0?!1:yj(t,e,n))}function xj(e,t,n){return!e||e.length===0?-1:e.findIndex(e=>e===void 0?!1:yj(e,t,n))}function Sj(e,t,n){return e.filter(e=>!yj(t,e,n))}function Cj(e){if(e==null)return``;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}function wj(e){return e!=null&&e.length>0&&typeof e[0]==`object`&&e[0]!=null&&`items`in e[0]}function Tj(e){if(!Array.isArray(e))return e!=null&&`null`in e;let t=e;if(wj(t)){for(let e of t)for(let t of e.items)if(t&&t.value==null&&t.label!=null)return!0;return!1}for(let e of t)if(e&&e.value==null&&e.label!=null)return!0;return!1}function Ej(e,t){if(t&&e!=null)return t(e)??``;if(e&&typeof e==`object`){if(`label`in e&&e.label!=null)return String(e.label);if(`value`in e)return String(e.value)}return Cj(e)}function Dj(e,t){return t&&e!=null?t(e)??``:e&&typeof e==`object`&&`value`in e&&`label`in e?Cj(e.value):Cj(e)}function Oj(e,t,n){function r(){return Ej(e,n)}if(n&&e!=null)return n(e);if(e&&typeof e==`object`&&`label`in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return t[e]??r();if(Array.isArray(t)){let n=t,i=wj(n)?n.flatMap(e=>e.items):n;if(typeof e!=`object`||!e){let t=i.find(t=>t.value===e);return t&&t.label!=null?t.label:r()}if(`value`in e){let t=i.find(t=>t&&t.value===e.value);if(t&&t.label!=null)return t.label}}return r()}function kj(e,t,n){return e.reduce((e,r,i)=>(i>0&&e.push(`, `),e.push((0,y.jsx)(b.Fragment,{children:Oj(r,t,n)},i)),e),[])}var Aj={id:Q(e=>e.id),labelId:Q(e=>e.labelId),modal:Q(e=>e.modal),multiple:Q(e=>e.multiple),items:Q(e=>e.items),itemToStringLabel:Q(e=>e.itemToStringLabel),itemToStringValue:Q(e=>e.itemToStringValue),isItemEqualToValue:Q(e=>e.isItemEqualToValue),value:Q(e=>e.value),hasSelectedValue:Q(e=>{let{value:t,multiple:n,itemToStringValue:r}=e;return t==null?!1:n&&Array.isArray(t)?t.length>0:Dj(t,r)!==``}),hasNullItemLabel:Q((e,t)=>t?Tj(e.items):!1),open:Q(e=>e.open),mounted:Q(e=>e.mounted),forceMount:Q(e=>e.forceMount),transitionStatus:Q(e=>e.transitionStatus),openMethod:Q(e=>e.openMethod),activeIndex:Q(e=>e.activeIndex),selectedIndex:Q(e=>e.selectedIndex),isActive:Q((e,t)=>e.activeIndex===t),isSelected:Q((e,t,n)=>{let r=e.isItemEqualToValue,i=e.value;return e.multiple?Array.isArray(i)&&i.some(e=>yj(n,e,r)):e.selectedIndex===t&&e.selectedIndex!==null?!0:yj(n,i,r)}),isSelectedByFocus:Q((e,t)=>e.selectedIndex===t),popupProps:Q(e=>e.popupProps),triggerProps:Q(e=>e.triggerProps),triggerElement:Q(e=>e.triggerElement),positionerElement:Q(e=>e.positionerElement),listElement:Q(e=>e.listElement),scrollUpArrowVisible:Q(e=>e.scrollUpArrowVisible),scrollDownArrowVisible:Q(e=>e.scrollDownArrowVisible),hasScrollArrows:Q(e=>e.hasScrollArrows)};function jj(e,t=-(2**53-1),n=2**53-1){return Math.max(t,Math.min(e,n))}function Mj(e,t){return Math.max(0,e-t)}function Nj(e,t){if(t<=0)return 0;let n=jj(e,0,t),r=n,i=t-n,a=r<=1,o=i<=1;return a&&o?r<=i?0:t:a?0:o?t:n}function Pj(e){let{id:t,value:n,defaultValue:r=null,onValueChange:i,open:a,defaultOpen:o=!1,onOpenChange:s,name:c,form:l,autoComplete:u,disabled:d=!1,readOnly:f=!1,required:p=!1,modal:m=!0,actionsRef:h,inputRef:g,onOpenChangeComplete:_,items:v,multiple:x=!1,itemToStringLabel:S,itemToStringValue:C,isItemEqualToValue:w=vj,highlightItemOnHover:T=!0,children:E}=e,{clearErrors:D}=_S(),{setDirty:O,setTouched:k,setFocused:A,shouldValidateOnChange:j,validityData:M,setFilled:N,name:P,disabled:F,validation:I,validationMode:L}=hS(),R=CS({id:t}),z=F||d,ee=P??c,[B,te]=wS({controlled:n,default:x?r??rm:r,name:`Select`,state:`value`}),[V,H]=wS({controlled:a,default:o,name:`Select`,state:`open`}),ne=b.useRef([]),U=b.useRef([]),re=b.useRef(null),W=b.useRef(null),ie=b.useRef(0),ae=b.useRef(null),oe=b.useRef([]),se=b.useRef(!1),ce=b.useRef(!1),le=b.useRef(null),ue=b.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}),de=b.useRef(!1),{mounted:fe,setMounted:pe,transitionStatus:me}=Gy(V),{openMethod:he,triggerProps:ge}=Ub(V),_e=Kp(()=>new Vy({id:R,labelId:void 0,modal:m,multiple:x,itemToStringLabel:S,itemToStringValue:C,isItemEqualToValue:w,value:B,open:V,mounted:fe,transitionStatus:me,items:v,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,ve=Ly(_e,Aj.activeIndex),ye=Ly(_e,Aj.selectedIndex),be=Ly(_e,Aj.triggerElement),xe=Ly(_e,Aj.positionerElement),Se=pj(he),Ce=he??Se,we=b.useMemo(()=>x&&Array.isArray(B)&&B.length===0?``:Dj(B,C),[x,B,C]),Te=b.useMemo(()=>x&&Array.isArray(B)?B.map(e=>Dj(e,C)):Dj(B,C),[x,B,C]);TS(Jm(_e.state.triggerElement),{id:R,value:B,getValue:Z(()=>Te)});let Ee=b.useRef(B);X(()=>{B!==Ee.current&&_e.set(`forceMount`,!0)},[_e,B]),X(()=>{N(x?Array.isArray(B)&&B.length>0:B!=null)},[x,B,N]),X(function(){if(V)return;let e=oe.current;if(x){let t=Array.isArray(B)?B:[];if(t.length===0){_e.set(`selectedIndex`,null);return}let n=t[t.length-1],r=xj(e,n,w);_e.set(`selectedIndex`,r===-1?null:r);return}let t=xj(e,B,w);_e.set(`selectedIndex`,t===-1?null:t)},[x,V,B,oe,w,_e]),Hb(B,()=>{D(ee),O(B!==M.initialValue),j()?I.commit(B):I.commit(B,!0)});let De=Z((e,t)=>{if(s?.(e,t),!t.isCanceled&&(H(e),!e&&(t.reason===`focus-out`||t.reason===`outside-press`)&&(k(!0),A(!1),L===`onBlur`&&I.commit(B)),!e&&_e.state.activeIndex!==null)){let e=ne.current[_e.state.activeIndex];queueMicrotask(()=>{e?.setAttribute(`tabindex`,`-1`)})}}),Oe=Z(()=>{pe(!1),_e.update({activeIndex:null,openMethod:null}),_?.(!1)});Zy({enabled:!h,open:V,ref:re,onComplete(){V||Oe()}}),b.useImperativeHandle(h,()=>({unmount:Oe}),[Oe]);let ke=Z((e,t)=>{i?.(e,t),!t.isCanceled&&te(e)}),Ae=Z(()=>{let e=_e.state.listElement||re.current;if(!e)return;let t=Mj(e.scrollHeight,e.clientHeight),n=Nj(e.scrollTop,t),r=n>0,i=n<t;_e.state.scrollUpArrowVisible!==r&&_e.set(`scrollUpArrowVisible`,r),_e.state.scrollDownArrowVisible!==i&&_e.set(`scrollDownArrowVisible`,i)}),je=sb({open:V,onOpenChange:De,elements:{reference:be,floating:xe}}),{getReferenceProps:Me,getFloatingProps:Ne,getItemProps:Pe}=bb([ov(je,{enabled:!f&&!z,event:`mousedown`}),pv(je,{bubbles:!1}),kb(je,{enabled:!f&&!z,listRef:ne,activeIndex:ve,selectedIndex:ye,disabledIndices:rm,onNavigate(e){e===null&&!V||_e.set(`activeIndex`,e)},focusItemOnHover:T}),Mb(je,{enabled:!f&&!z&&(V||!x),listRef:U,activeIndex:ve,selectedIndex:ye,onMatch(e){V?_e.set(`activeIndex`,e):ke(oe.current[e],Lm(`none`))},onTypingChange(e){se.current=e}})]),Fe=b.useMemo(()=>u_(Me(),ge,R?{id:R}:im),[Me,ge,R]);ip(()=>{_e.update({popupProps:Ne(),triggerProps:Fe})}),X(()=>{_e.update({id:R,modal:m,multiple:x,value:B,open:V,mounted:fe,transitionStatus:me,popupProps:Ne(),triggerProps:Fe,items:v,itemToStringLabel:S,itemToStringValue:C,isItemEqualToValue:w,openMethod:Ce})},[_e,R,m,x,B,V,fe,me,Ne,Fe,v,S,C,w,Ce]);let Ie=b.useMemo(()=>({store:_e,name:ee,required:p,disabled:z,readOnly:f,multiple:x,highlightItemOnHover:T,setValue:ke,setOpen:De,listRef:ne,popupRef:re,scrollHandlerRef:W,handleScrollArrowVisibility:Ae,scrollArrowsMountedCountRef:ie,getItemProps:Pe,events:je.context.events,valueRef:ae,valuesRef:oe,labelsRef:U,typingRef:se,selectionRef:ue,selectedItemTextRef:le,validation:I,onOpenChangeComplete:_,keyboardActiveRef:ce,alignItemWithTriggerActiveRef:de,initialValueRef:Ee}),[_e,ee,p,z,f,x,T,ke,De,Pe,je.context.events,I,_,Ae]),Le=Hm(g,I.inputRef),Re=x&&Array.isArray(B)&&B.length>0,ze=x?void 0:ee,Be=b.useMemo(()=>!x||!Array.isArray(B)||!ee?null:B.map(e=>{let t=Dj(e,C);return(0,y.jsx)(`input`,{type:`hidden`,form:l,name:ee,value:t},t)}),[x,B,l,ee,C]);return(0,y.jsx)(mj.Provider,{value:Ie,children:(0,y.jsxs)(hj.Provider,{value:je,children:[E,(0,y.jsx)(`input`,{...I.getInputValidationProps({onFocus(){_e.state.triggerElement?.focus({focusVisible:!0})},onChange(e){if(e.nativeEvent.defaultPrevented)return;let t=e.currentTarget.value,n=Lm(wm,e.nativeEvent);function r(){if(x)return;let e=oe.current.find(e=>Dj(e,C).toLowerCase()===t.toLowerCase()||Ej(e,S).toLowerCase()===t.toLowerCase());e!=null&&(O(e!==M.initialValue),ke(e,n),j()&&I.commit(e))}_e.set(`forceMount`,!0),queueMicrotask(r)}}),id:R&&ze==null?`${R}-hidden-input`:void 0,form:l,name:ze,autoComplete:u,value:we,disabled:z,required:p&&!Re,readOnly:f,ref:Le,style:ee?nh:th,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),Be]})})}function Fj(e,t){return e??t}function Ij(e){let t=e.getBoundingClientRect(),n=sp(e),r=n.getComputedStyle(e,`::before`),i=n.getComputedStyle(e,`::after`);if(!(r.content!==`none`||i.content!==`none`))return t;let a=parseFloat(r.width)||0,o=parseFloat(r.height)||0,s=parseFloat(i.width)||0,c=parseFloat(i.height)||0,l=Math.max(t.width,a,s),u=Math.max(t.height,o,c),d=l-t.width,f=u-t.height;return{left:t.left-d/2,right:t.right+d/2,top:t.top-f/2,bottom:t.bottom+f/2}}var Lj=2,Rj=400,zj=200,Bj={...ox,...pS,value:()=>null},Vj=b.forwardRef(function(e,t){let{render:n,className:r,id:i,disabled:a=!1,nativeButton:o=!0,style:s,...c}=e,{setTouched:l,setFocused:u,validationMode:d,state:f,disabled:p}=hS(),{labelId:m}=yS(),{store:h,setOpen:g,selectionRef:_,validation:v,readOnly:y,required:x,alignItemWithTriggerActiveRef:S,disabled:C,keyboardActiveRef:w}=gj(),T=p||C||a,E=Ly(h,Aj.open),D=Ly(h,Aj.value),O=Ly(h,Aj.triggerProps),k=Ly(h,Aj.positionerElement),A=Ly(h,Aj.listElement),j=Ly(h,Aj.id),M=Ly(h,Aj.labelId),N=Ly(h,Aj.hasSelectedValue),P=!N&&E,F=Ly(h,Aj.hasNullItemLabel,P),I=i??j,L=Fj(m,M);CS({id:I});let R=Jm(k),z=b.useRef(null),{getButtonProps:ee,buttonRef:B}=px({disabled:T,native:o}),te=Hm(t,z,B,Z(e=>{h.set(`triggerElement`,e)})),V=Zp(),H=Zp(),ne=Zp(),U=Zp();b.useEffect(()=>{if(E)return N||F?U.start(zj,()=>{_.current.allowUnselectedMouseUp=!0,ne.start(zj,()=>{_.current.allowSelectedMouseUp=!0})}):ne.start(Rj,()=>{_.current.allowUnselectedMouseUp=!0,_.current.allowSelectedMouseUp=!0}),()=>{ne.clear(),U.clear()};_.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1},H.clear()},[E,N,F,_,H,ne,U]);let re=b.useMemo(()=>A?.id??bh(k)?.id,[A,k]),W=u_(O,{id:I,role:`combobox`,"aria-expanded":E?`true`:`false`,"aria-haspopup":`listbox`,"aria-controls":E?re:void 0,"aria-labelledby":L,"aria-readonly":y||void 0,"aria-required":x||void 0,tabIndex:T?-1:0,ref:te,onFocus(e){u(!0),E&&S.current&&g(!1,Lm(wm,e.nativeEvent)),V.start(0,()=>{h.set(`forceMount`,!0)})},onBlur(e){dh(k,e.relatedTarget)||(l(!0),u(!1),d===`onBlur`&&v.commit(D))},onPointerMove(){w.current=!1},onKeyDown(){w.current=!0},onMouseDown(e){if(E)return;let t=Wp(e.currentTarget);function n(e){if(!z.current)return;let t=e.target;if(dh(z.current,t)||dh(R.current,t)||t===z.current)return;let n=Ij(z.current);e.clientX>=n.left-Lj&&e.clientX<=n.right+Lj&&e.clientY>=n.top-Lj&&e.clientY<=n.bottom+Lj||g(!1,Lm(Nm,e))}H.start(0,()=>{t.addEventListener(`mouseup`,n,{once:!0})})}},v.getValidationProps,c,ee);W.role=`combobox`;let ie={...f,open:E,disabled:T,value:D,readOnly:y,placeholder:!N};return w_(`button`,e,{ref:[t,z],state:ie,stateAttributesMapping:Bj,props:W})}),Hj={value:()=>null},Uj=b.forwardRef(function(e,t){let{className:n,render:r,children:i,placeholder:a,style:o,...s}=e,{store:c,valueRef:l}=gj(),u=Ly(c,Aj.value),d=Ly(c,Aj.items),f=Ly(c,Aj.itemToStringLabel),p=Ly(c,Aj.hasSelectedValue),m=!p&&a!=null&&i==null,h=Ly(c,Aj.hasNullItemLabel,m),g={value:u,placeholder:!p},_=null;return _=typeof i==`function`?i(u):i??(!p&&a!=null&&!h?a:Array.isArray(u)?kj(u,d,f):Oj(u,d,f)),w_(`span`,e,{state:g,ref:[t,l],props:[{children:_},s],stateAttributesMapping:Hj})}),Wj=b.forwardRef(function(e,t){let{className:n,render:r,style:i,...a}=e,{store:o}=gj();return w_(`span`,e,{state:{open:Ly(o,Aj.open)},ref:t,props:[{"aria-hidden":!0,children:`▼`},a],stateAttributesMapping:ax})}),Gj=b.createContext(void 0),Kj=b.forwardRef(function(e,t){let{store:n}=gj(),r=Ly(n,Aj.mounted),i=Ly(n,Aj.forceMount);return r||i?(0,y.jsx)(Gj.Provider,{value:!0,children:(0,y.jsx)(B_,{ref:t,...e})}):null}),qj=b.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});function Jj(){return b.useContext(qj)}function Yj(e){let{children:t,elementsRef:n,labelsRef:r,onMapChange:i}=e,a=Z(i),o=b.useRef(0),s=Kp(Zj).current,c=Kp(Xj).current,[l,u]=b.useState(0),d=b.useRef(l),f=Z((e,t)=>{c.set(e,t??null),d.current+=1,u(d.current)}),p=Z(e=>{c.delete(e),d.current+=1,u(d.current)}),m=b.useMemo(()=>{let e=new Map;return Array.from(c.keys()).filter(e=>e.isConnected).sort(Qj).forEach((t,n)=>{let r=c.get(t)??{};e.set(t,{...r,index:n})}),e},[c,l]);X(()=>{if(typeof MutationObserver!=`function`||m.size===0)return;let e=new MutationObserver(e=>{let t=new Set,n=e=>t.has(e)?t.delete(e):t.add(e);e.forEach(e=>{e.removedNodes.forEach(n),e.addedNodes.forEach(n)}),t.size===0&&(d.current+=1,u(d.current))});return m.forEach((t,n)=>{n.parentElement&&e.observe(n.parentElement,{childList:!0})}),()=>{e.disconnect()}},[m]),X(()=>{d.current===l&&(n.current.length!==m.size&&(n.current.length=m.size),r&&r.current.length!==m.size&&(r.current.length=m.size),o.current=m.size),a(m)},[a,m,n,r,l]),X(()=>()=>{n.current=[]},[n]),X(()=>()=>{r&&(r.current=[])},[r]);let h=Z(e=>(s.add(e),()=>{s.delete(e)}));X(()=>{s.forEach(e=>e(m))},[s,m]);let g=b.useMemo(()=>({register:f,unregister:p,subscribeMapChange:h,elementsRef:n,labelsRef:r,nextIndexRef:o}),[f,p,h,n,r,o]);return(0,y.jsx)(qj.Provider,{value:g,children:t})}function Xj(){return new Map}function Zj(){return new Set}function Qj(e,t){let n=e.compareDocumentPosition(t);return n&Node.DOCUMENT_POSITION_FOLLOWING||n&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:n&Node.DOCUMENT_POSITION_PRECEDING||n&Node.DOCUMENT_POSITION_CONTAINS?1:0}var $j=b.createContext(void 0);function eM(){return b.useContext($j)?.direction??`ltr`}var tM=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0,offsetParent:d=`real`}=kh(e,t)||{};if(l==null)return{};let f=qh(u),p={x:n,y:r},m=Fh(i),h=Nh(m),g=await o.getDimensions(l),_=m===`y`,v=_?`top`:`left`,y=_?`bottom`:`right`,b=_?`clientHeight`:`clientWidth`,x=a.reference[h]+a.reference[m]-p[m]-a.floating[h],S=p[m]-a.reference[m],C=d===`real`?await o.getOffsetParent?.(l):s.floating,w=s.floating[b]||a.floating[h];(!w||!await o.isElement?.(C))&&(w=s.floating[b]||a.floating[h]);let T=x/2-S/2,E=w/2-g[h]/2-1,D=Math.min(f[v],E),O=Math.min(f[y],E),k=D,A=w-g[h]-O,j=w/2-g[h]/2+T,M=Oh(k,j,A),N=!c.arrow&&jh(i)!=null&&j!==M&&a.reference[h]/2-(j<k?D:O)-g[h]/2<0,P=N?j<k?j-k:j-A:0;return{[m]:p[m]+P,data:{[m]:M,centerOffset:j-M-P,...N&&{alignmentOffset:P}},reset:N}}}),nM=(e,t)=>({...tM(e),options:[e,t]}),rM={name:`hide`,async fn(e){let{width:t,height:n,x:r,y:i}=e.rects.reference,a=t===0&&n===0&&r===0&&i===0;return{data:{referenceHidden:(await Sy().fn(e)).data?.referenceHidden||a}}}},iM={sideX:`left`,sideY:`top`},aM={name:`adaptiveOrigin`,async fn(e){let{x:t,y:n,rects:{floating:r},elements:{floating:i},platform:a,strategy:o,placement:s}=e,c=sp(i),l=c.getComputedStyle(i);if(!(l.transitionDuration!==`0s`&&l.transitionDuration!==``))return{x:t,y:n,data:iM};let u=await a.getOffsetParent?.(i),d={width:0,height:0};if(o===`fixed`&&c?.visualViewport)d={width:c.visualViewport.width,height:c.visualViewport.height};else if(u===c){let e=Wp(i);d={width:e.documentElement.clientWidth,height:e.documentElement.clientHeight}}else await a.isElement?.(u)&&(d=await a.getDimensions(u));let f=Ah(s),p=t,m=n;f===`left`&&(p=d.width-(t+r.width)),f===`top`&&(m=d.height-(n+r.height));let h=f===`left`?`right`:iM.sideX,g=f===`top`?`bottom`:iM.sideY;return{x:p,y:m,data:{sideX:h,sideY:g}}}};function oM(e,t,n){let r=e===`inline-start`||e===`inline-end`;return{top:`top`,right:r?n?`inline-start`:`inline-end`:`right`,bottom:`bottom`,left:r?n?`inline-end`:`inline-start`:`left`}[t]}function sM(e,t,n){let{rects:r,placement:i}=e;return{side:oM(t,Ah(i),n),align:jh(i)||`center`,anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function cM(e){let{anchor:t,positionMethod:n=`absolute`,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,collisionBoundary:s,collisionPadding:c=5,sticky:l=!1,arrowPadding:u=5,disableAnchorTracking:d=!1,keepMounted:f=!1,floatingRootContext:p,mounted:m,collisionAvoidance:h,shiftCrossAxis:g=!1,nodeId:_,adaptiveOrigin:v,lazyFlip:y=!1,externalTree:x}=e,[S,C]=b.useState(null);!m&&S!==null&&C(null);let w=h.side||`flip`,T=h.align||`flip`,E=h.fallbackAxisSide||`end`,D=typeof t==`function`?t:void 0,O=Z(D),k=D?O:t,A=Jm(t),j=Jm(m),M=eM()===`rtl`,N=S||{top:`top`,right:`right`,bottom:`bottom`,left:`left`,"inline-end":M?`left`:`right`,"inline-start":M?`right`:`left`}[r],P=a===`center`?N:`${N}-${a}`,F=c,I=+(r===`bottom`),L=+(r===`top`),R=+(r===`right`),z=+(r===`left`);typeof F==`number`?F={top:F+I,right:F+z,bottom:F+L,left:F+R}:F&&={top:(F.top||0)+I,right:(F.right||0)+z,bottom:(F.bottom||0)+L,left:(F.left||0)+R};let ee={boundary:s===`clipping-ancestors`?`clippingAncestors`:s,padding:F},B=b.useRef(null),te=Jm(i),V=Jm(o),H=[_y(e=>{let t=sM(e,r,M),n=typeof te.current==`function`?te.current(t):te.current,i=typeof V.current==`function`?V.current(t):V.current;return{mainAxis:n,crossAxis:i,alignmentAxis:i}},[typeof i==`function`?0:i,typeof o==`function`?0:o,M,r])],ne=T===`none`&&w!==`shift`,U=!ne&&(l||g||w===`shift`),re=w===`none`?null:by({...ee,padding:{top:F.top+1,right:F.right+1,bottom:F.bottom+1,left:F.left+1},mainAxis:!g&&w===`flip`,crossAxis:T===`flip`?`alignment`:!1,fallbackAxisSideDirection:E}),W=ne?null:vy(e=>{let t=Wp(e.elements.floating).documentElement;return{...ee,rootBoundary:g?{x:0,y:0,width:t.clientWidth,height:t.clientHeight}:void 0,mainAxis:T!==`none`,crossAxis:U,limiter:l||g?void 0:yy(e=>{if(!B.current)return{};let{width:t,height:n}=B.current.getBoundingClientRect(),r=Ph(Ah(e.placement)),i=r===`y`?t:n,a=r===`y`?F.left+F.right:F.top+F.bottom;return{offset:i/2+a/2}})}},[ee,l,g,F,T]);w===`shift`||T===`shift`||a===`center`?H.push(W,re):H.push(re,W),H.push(xy({...ee,apply({elements:{floating:e},availableWidth:t,availableHeight:n,rects:r}){if(!j.current)return;let i=e.style;i.setProperty(`--available-width`,`${t}px`),i.setProperty(`--available-height`,`${n}px`);let a=sp(e).devicePixelRatio||1,{x:o,y:s,width:c,height:l}=r.reference,u=(Math.round((o+c)*a)-Math.round(o*a))/a,d=(Math.round((s+l)*a)-Math.round(s*a))/a;i.setProperty(`--anchor-width`,`${u}px`),i.setProperty(`--anchor-height`,`${d}px`)}}),nM(()=>({element:B.current||Wp(B.current).createElement(`div`),padding:u,offsetParent:`floating`}),[u]),{name:`transformOrigin`,fn(e){let{elements:t,middlewareData:n,placement:a,rects:o,y:s}=e,c=Ah(a),l=Ph(c),u=B.current,d=n.arrow?.x||0,f=n.arrow?.y||0,p=u?.clientWidth||0,m=u?.clientHeight||0,h=d+p/2,g=f+m/2,_=Math.abs(n.shift?.y||0),v=o.reference.height/2,y=typeof i==`function`?i(sM(e,r,M)):i,b=_>y,x={top:`${h}px calc(100% + ${y}px)`,bottom:`${h}px ${-y}px`,left:`calc(100% + ${y}px) ${g}px`,right:`${-y}px ${g}px`}[c],S=`${h}px ${o.reference.y+v-s}px`;return t.floating.style.setProperty(`--transform-origin`,U&&l===`y`&&b?S:x),{}}},rM,v),X(()=>{!m&&p&&p.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[m,p]);let ie=b.useMemo(()=>({elementResize:!d&&typeof ResizeObserver<`u`,layoutShift:!d&&typeof IntersectionObserver<`u`}),[d]),{refs:ae,elements:oe,x:se,y:ce,middlewareData:le,update:ue,placement:de,context:fe,isPositioned:pe,floatingStyles:me}=cb({rootContext:p,open:f?m:void 0,placement:P,middleware:H,strategy:n,whileElementsMounted:f?void 0:(...e)=>ry(...e,ie),nodeId:_,externalTree:x}),{sideX:he,sideY:ge}=le.adaptiveOrigin||iM,_e=pe?n:`fixed`,ve=b.useMemo(()=>{let e=v?{position:_e,[he]:se,[ge]:ce}:{position:_e,...me};return pe||(e.opacity=0),e},[v,_e,he,se,ge,ce,me,pe]),ye=b.useRef(null);X(()=>{if(!m)return;let e=A.current,t=typeof e==`function`?e():e,n=(lM(t)?t.current:t)||null;n!==ye.current&&(ae.setPositionReference(n),ye.current=n)},[m,ae,k,A]),b.useEffect(()=>{if(!m)return;let e=A.current;typeof e!=`function`&&lM(e)&&e.current!==ye.current&&(ae.setPositionReference(e.current),ye.current=e.current)},[m,ae,k,A]),b.useEffect(()=>{if(f&&m&&oe.domReference&&oe.floating)return ry(oe.domReference,oe.floating,ue,ie)},[f,m,oe,ue,ie]);let be=Ah(de),xe=oM(r,be,M),Se=jh(de)||`center`,Ce=!!le.hide?.referenceHidden;X(()=>{y&&m&&pe&&C(be)},[y,m,pe,be]);let we=b.useMemo(()=>({position:`absolute`,top:le.arrow?.y,left:le.arrow?.x}),[le.arrow]),Te=le.arrow?.centerOffset!==0;return b.useMemo(()=>({positionerStyles:ve,arrowStyles:we,arrowRef:B,arrowUncentered:Te,side:xe,align:Se,physicalSide:be,anchorHidden:Ce,refs:ae,context:fe,isPositioned:pe,update:ue}),[ve,we,B,Te,xe,Se,be,Ce,ae,fe,pe,ue])}function lM(e){return e!=null&&`current`in e}var uM=b.createContext(void 0);function dM(){let e=b.useContext(uM);if(!e)throw Error(t_(59));return e}function fM(e,t){e&&Object.assign(e.style,t)}var pM={position:`relative`,maxHeight:`100%`,overflowX:`hidden`,overflowY:`auto`};function mM(e){return e===`starting`?A_:im}function hM(e,t,{styles:n,transitionStatus:r,props:i,refs:a,hidden:o,inert:s=!1}){let c={...n};return s&&(c.pointerEvents=`none`),w_(`div`,e,{state:t,ref:a,props:[{role:`presentation`,hidden:o,style:c},mM(r),i],stateAttributesMapping:sx})}var gM=20;function _M(e,t,n,r){let[i,a]=b.useState(!1);X(()=>{if(!e||!t||n==null){a(!1);return}let r=Wp(n).documentElement.clientWidth,i=n.offsetWidth;a(r>0&&i>0&&i>=r-gM)},[e,t,n]),pm(e&&(!t||i),r)}var vM={position:`fixed`},yM=b.forwardRef(function(e,t){let{anchor:n,positionMethod:r=`absolute`,className:i,render:a,side:o=`bottom`,align:s=`center`,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m,alignItemWithTrigger:h=!0,collisionAvoidance:g=M_,style:_,...v}=e,{store:x,listRef:S,labelsRef:C,alignItemWithTriggerActiveRef:w,selectedItemTextRef:T,valuesRef:E,initialValueRef:D,popupRef:O,setValue:k}=gj(),A=_j(),j=Ly(x,Aj.open),M=Ly(x,Aj.mounted),N=Ly(x,Aj.modal),P=Ly(x,Aj.value),F=Ly(x,Aj.openMethod),I=Ly(x,Aj.positionerElement),L=Ly(x,Aj.triggerElement),R=Ly(x,Aj.isItemEqualToValue),z=Ly(x,Aj.transitionStatus),ee=b.useRef(null),B=b.useRef(null),[te,V]=b.useState(h),H=M&&te&&F!==`touch`;!M&&te!==h&&V(h),X(()=>{M||(Aj.scrollUpArrowVisible(x.state)&&x.set(`scrollUpArrowVisible`,!1),Aj.scrollDownArrowVisible(x.state)&&x.set(`scrollDownArrowVisible`,!1))},[x,M]),b.useImperativeHandle(w,()=>H),_M((H||N)&&j,F===`touch`,I,L);let ne=cM({anchor:n,floatingRootContext:A,positionMethod:r,mounted:M,side:o,sideOffset:c,align:s,alignOffset:l,arrowPadding:f,collisionBoundary:u,collisionPadding:d,sticky:p,disableAnchorTracking:m??H,collisionAvoidance:g,keepMounted:!0}),U=H?`none`:ne.side,re=H?vM:ne.positionerStyles,W=hM(e,{open:j,side:U,align:ne.align,anchorHidden:ne.anchorHidden},{styles:re,transitionStatus:z,props:v,refs:[t,Z(e=>{x.set(`positionerElement`,e)})],hidden:!M,inert:!j}),ie=b.useRef(0),ae=Z(e=>{if(e.size===0&&ie.current===0||E.current.length===0)return;let t=ie.current;if(ie.current=e.size,e.size===t)return;let n=Lm(wm);if(t!==0&&!x.state.multiple&&P!==null&&xj(E.current,P,R)===-1){let e=D.current,t=e!=null&&xj(E.current,e,R)!==-1?e:null;k(t,n),t===null&&(x.set(`selectedIndex`,null),T.current=null)}if(t!==0&&x.state.multiple&&Array.isArray(P)){let e=e=>xj(E.current,e,R)!==-1,t=P.filter(t=>e(t));(t.length!==P.length||t.some(e=>!bj(P,e,R)))&&(k(t,n),t.length===0&&(x.set(`selectedIndex`,null),T.current=null))}if(j&&H){x.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});let e={height:``};fM(I,e),fM(O.current,e)}}),oe=b.useMemo(()=>({...ne,side:U,alignItemWithTriggerActive:H,setControlledAlignItemWithTrigger:V,scrollUpArrowRef:ee,scrollDownArrowRef:B}),[ne,U,H,V]);return(0,y.jsx)(Yj,{elementsRef:S,labelsRef:C,onMapChange:ae,children:(0,y.jsxs)(uM.Provider,{value:oe,children:[M&&N&&(0,y.jsx)(Px,{inert:Nx(!j),cutout:L}),W]})})}),bM=`base-ui-disable-scrollbar`,xM={className:bM,getElement(e){return(0,y.jsx)(`style`,{nonce:e,href:bM,precedence:`base-ui:low`,children:`.${bM}{scrollbar-width:none}.${bM}::-webkit-scrollbar{display:none}`})}},SM=b.createContext(void 0);function CM(e){let t=b.useContext(SM);if(t===void 0&&!e)throw Error(t_(69));return t}var wM=b.createContext(void 0),TM={disableStyleElements:!1};function EM(){return b.useContext(wM)??TM}var DM={...sx,...Yy},OM=b.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,...o}=e,{store:s,popupRef:c,onOpenChangeComplete:l,setOpen:u,valueRef:d,selectedItemTextRef:f,keyboardActiveRef:p,multiple:m,handleScrollArrowVisibility:h,scrollHandlerRef:g,listRef:_,highlightItemOnHover:v}=gj(),{side:x,align:S,alignItemWithTriggerActive:C,isPositioned:w,setControlledAlignItemWithTrigger:T,scrollDownArrowRef:E,scrollUpArrowRef:D}=dM(),O=CM(!0)!=null,k=_j(),A=eM(),{nonce:j,disableStyleElements:M}=EM(),N=Ly(s,Aj.id),P=Ly(s,Aj.open),F=Ly(s,Aj.mounted),I=Ly(s,Aj.popupProps),L=Ly(s,Aj.transitionStatus),R=Ly(s,Aj.triggerElement),z=Ly(s,Aj.positionerElement),ee=Ly(s,Aj.listElement),B=b.useRef(!1),te=b.useRef(!1),V=b.useRef({}),H=tm(),ne=Z(e=>{if(!z||!c.current||!te.current)return;if(B.current||!C){h();return}let t=z.style.top===`0px`,n=z.style.bottom===`0px`;if(!t&&!n){h();return}let r=jM(z),i=MM(z.getBoundingClientRect().height,`y`,r),a=Wp(z),o=getComputedStyle(z),s=parseFloat(o.marginTop),l=parseFloat(o.marginBottom),u=kM(getComputedStyle(c.current)),d=Math.min(a.documentElement.clientHeight-s-l,u),f=e.scrollTop,p=AM(e),m=0,g=null,_=!1,v=!1,y=e=>{z.style.height=`${e}px`},b=(t,n)=>{let r=jj(t,0,d-i);r>0&&y(i+r),e.scrollTop=n,d-(i+r)<=1&&(B.current=!0),h()},x=t?p-f:f,S=Math.min(i+x,d);if(m=S,x<=1){b(x,t?p:0);return}if(d-S>1?t?v=!0:g=0:(_=!0,n&&f<p&&(g=f-(x-(i+x-d)))),m=Math.ceil(m),m!==0&&y(m),v||g!=null){let t=AM(e),n=v?t:jj(g,0,t);Math.abs(e.scrollTop-n)>1&&(e.scrollTop=n)}(_||m>=d-1)&&(B.current=!0),h()});b.useImperativeHandle(g,()=>ne,[ne]),Zy({open:P,ref:c,onComplete(){P&&l?.(!0)}});let U={open:P,transitionStatus:L,side:x,align:S};X(()=>{!z||!c.current||Object.keys(V.current).length||(V.current={top:z.style.top||`0`,left:z.style.left||`0`,right:z.style.right,height:z.style.height,bottom:z.style.bottom,minHeight:z.style.minHeight,maxHeight:z.style.maxHeight,marginTop:z.style.marginTop,marginBottom:z.style.marginBottom})},[c,z]),X(()=>{P||C||(te.current=!1,B.current=!1,fM(z,V.current))},[P,C,z,c]),X(()=>{let e=c.current;if(!P||!R||!z||!e||C&&!w||s.state.transitionStatus===`ending`)return;if(!C){te.current=!0,H.request(h),e.style.removeProperty(`--transform-origin`);return}let t=FM(e);e.style.removeProperty(`--transform-origin`);try{let t=f.current,n=d.current,r=getComputedStyle(z),i=getComputedStyle(e),a=Wp(R),o=sp(z),c=jM(R),l=NM(R.getBoundingClientRect(),c),u=NM(z.getBoundingClientRect(),c),p=l.height,m=ee||e,g=m.scrollHeight,y=parseFloat(i.borderBottomWidth),b=parseFloat(r.marginTop)||10,x=parseFloat(r.marginBottom)||10,S=parseFloat(r.minHeight)||100,C=kM(i),w=a.documentElement.clientHeight-b-x,E=a.documentElement.clientWidth,D=w-l.bottom+p,O,k=A===`rtl`?l.right-u.width:l.left,j=0;if(t&&n){let e=NM(n.getBoundingClientRect(),c);O=NM(t.getBoundingClientRect(),c),k=u.left+(A===`rtl`?e.right-O.right:e.left-O.left);let r=e.top-l.top+e.height/2;j=O.top-u.top+O.height/2-r}let M=D+j+x+y,N=Math.min(w,M),P=w-b-x,F=M-N,I=E-5;z.style.left=`${jj(k,5,I-u.width)}px`,z.style.height=`${N}px`,z.style.maxHeight=`auto`,z.style.marginTop=`${b}px`,z.style.marginBottom=`${x}px`,e.style.height=`100%`;let L=AM(m),H=F>=L-1;H&&(N=Math.min(w,u.height)-(F-L));let ne=l.top<20||l.bottom>w-20||Math.ceil(N)+1<Math.min(g,S),U=(o.visualViewport?.scale??1)!==1&&Fp;if(ne||U){te.current=!0,fM(z,V.current),T(!1);return}let re=Math.max(S,N);if(H){let e=Math.max(0,w-M);z.style.top=u.height>=P?`0`:`${e}px`,z.style.height=`${N}px`,m.scrollTop=AM(m)}else z.style.bottom=`0`,m.scrollTop=F;if(O){let t=u.top,n=u.height,r=O.top+O.height/2,i=jj(n>0?(r-t)/n*100:50,0,100);e.style.setProperty(`--transform-origin`,`50% ${i}%`)}(re===w||N>=C)&&(B.current=!0),h(),v&&s.state.selectedIndex===null&&s.state.activeIndex===null&&_.current[0]!=null&&s.set(`activeIndex`,0),te.current=!0}finally{t()}},[s,P,z,R,d,f,c,h,C,T,H,E,D,ee,_,v,A,w]),b.useEffect(()=>{if(!C||!z||!P)return;let e=sp(z);function t(e){u(!1,Lm(Im,e))}return Ap(e,`resize`,t)},[u,C,z,P]);let re={...ee?{role:`presentation`,"aria-orientation":void 0}:{role:`listbox`,"aria-multiselectable":m||void 0,id:`${N}-list`},onKeyDown(e){p.current=!0,O&&Ax.has(e.key)&&e.stopPropagation()},onMouseMove(){p.current=!1},onScroll(e){ee||ne(e.currentTarget)},...C&&{style:ee?{height:`100%`}:pM}},W=w_(`div`,e,{ref:[t,c],state:U,stateAttributesMapping:DM,props:[I,re,mM(L),{className:!ee&&C?xM.className:void 0},o]});return(0,y.jsxs)(b.Fragment,{children:[!M&&xM.getElement(j),(0,y.jsx)(av,{context:k,modal:!1,disabled:!F,returnFocus:a,restoreFocus:!0,children:W})]})});function kM(e){let t=e.maxHeight||``;return t.endsWith(`px`)&&parseFloat(t)||1/0}function AM(e){return Mj(e.scrollHeight,e.clientHeight)}function jM(e){return ey.getScale(e)}function MM(e,t,n){return e/n[t]}function NM(e,t){return Jh({x:MM(e.x,`x`,t),y:MM(e.y,`y`,t),width:MM(e.width,`x`,t),height:MM(e.height,`y`,t)})}var PM=[[`transform`,`none`],[`scale`,`1`],[`translate`,`0 0`]];function FM(e){let{style:t}=e,n={};for(let[e,r]of PM)n[e]=t.getPropertyValue(e),t.setProperty(e,r,`important`);return()=>{for(let[e]of PM){let r=n[e];r?t.setProperty(e,r):t.removeProperty(e)}}}var IM=b.forwardRef(function(e,t){let{className:n,render:r,style:i,...a}=e,{store:o,scrollHandlerRef:s}=gj(),{alignItemWithTriggerActive:c}=dM(),l=Ly(o,Aj.hasScrollArrows),u=Ly(o,Aj.openMethod),d=Ly(o,Aj.multiple),f={id:`${Ly(o,Aj.id)}-list`,role:`listbox`,"aria-multiselectable":d||void 0,onScroll(e){s.current?.(e.currentTarget)},...c&&{style:pM},className:l&&u!==`touch`?xM.className:void 0};return w_(`div`,e,{ref:[t,Z(e=>{o.set(`listElement`,e)})],props:[f,a]})}),LM=function(e){return e[e.None=0]=`None`,e[e.GuessFromOrder=1]=`GuessFromOrder`,e}({});function RM(e={}){let{label:t,metadata:n,textRef:r,indexGuessBehavior:i,index:a}=e,{register:o,unregister:s,subscribeMapChange:c,elementsRef:l,labelsRef:u,nextIndexRef:d}=Jj(),f=b.useRef(-1),[p,m]=b.useState(a??(i===LM.GuessFromOrder?()=>{if(f.current===-1){let e=d.current;d.current+=1,f.current=e}return f.current}:-1)),h=b.useRef(null),g=b.useCallback(e=>{if(h.current=e,p!==-1&&e!==null&&(l.current[p]=e,u)){let n=t!==void 0;u.current[p]=n?t:r?.current?.textContent??e.textContent}},[p,l,u,t,r]);return X(()=>{if(a!=null)return;let e=h.current;if(e)return o(e,n),()=>{s(e)}},[a,o,s,n]),X(()=>{if(a==null)return c(e=>{let t=h.current?e.get(h.current)?.index:null;t!=null&&m(t)})},[a,c,m]),b.useMemo(()=>({ref:g,index:p}),[p,g])}var zM=b.createContext(void 0);function BM(){let e=b.useContext(zM);if(!e)throw Error(t_(57));return e}var VM=b.memo(b.forwardRef(function(e,t){let{render:n,className:r,value:i=null,label:a,disabled:o=!1,nativeButton:s=!1,style:c,...l}=e,u=b.useRef(null),d=RM({label:a,textRef:u,indexGuessBehavior:LM.GuessFromOrder}),{store:f,getItemProps:p,setOpen:m,setValue:h,selectionRef:g,typingRef:_,valuesRef:v,multiple:x,selectedItemTextRef:S}=gj(),C=Ly(f,Aj.isActive,d.index),w=Ly(f,Aj.isSelected,d.index,i),T=Ly(f,Aj.isSelectedByFocus,d.index),E=Ly(f,Aj.isItemEqualToValue),D=d.index,O=D!==-1,k=b.useRef(null),A=Jm(D);X(()=>{if(!O)return;let e=v.current;return e[D]=i,()=>{delete e[D]}},[O,D,i,v]),X(()=>{if(!O)return;let e=f.state.value,t=e;x&&Array.isArray(e)&&e.length>0&&(t=e[e.length-1]),t!==void 0&&yj(i,t,E)&&(f.set(`selectedIndex`,D),u.current&&(S.current=u.current))},[O,D,x,E,f,i,S]);let j={disabled:o,selected:w,highlighted:C},M=p({active:C,selected:w});M.id=void 0;let N=b.useRef(null),P=b.useRef(`mouse`),F=b.useRef(!1),{getButtonProps:I,buttonRef:L}=px({disabled:o,focusableWhenDisabled:!0,native:s,composite:!0});function R(e){let t=f.state.value;if(x){let n=Array.isArray(t)?t:[];h(w?Sj(n,i,E):[...n,i],Lm(km,e))}else h(i,Lm(km,e)),m(!1,Lm(km,e))}let z={role:`option`,"aria-selected":w,tabIndex:C?0:-1,onTouchStart(){g.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}},onKeyDown(e){N.current=e.key,f.set(`activeIndex`,D),e.key===` `&&_.current&&e.preventDefault()},onClick(e){F.current=!1,!(e.type===`keydown`&&N.current===null)&&(o||e.type===`keydown`&&N.current===` `&&_.current||P.current!==`touch`&&!C||(N.current=null,R(e.nativeEvent)))},onPointerEnter(e){P.current=e.pointerType},onPointerDown(e){P.current=e.pointerType,F.current=!0},onMouseUp(){if(o)return;if(F.current){F.current=!1;return}let e=!g.current.allowSelectedMouseUp&&w,t=!g.current.allowUnselectedMouseUp&&!w;e||t||P.current!==`touch`&&!C||k.current?.click()}},ee=w_(`div`,e,{ref:[L,t,d.ref,k],state:j,props:[M,z,l,I]}),B=b.useMemo(()=>({selected:w,indexRef:A,textRef:u,selectedByFocus:T,hasRegistered:O}),[w,A,u,T,O]);return(0,y.jsx)(zM.Provider,{value:B,children:ee})})),HM=b.forwardRef(function(e,t){let n=e.keepMounted??!1,{selected:r}=BM();return n||r?(0,y.jsx)(UM,{...e,ref:t}):null}),UM=b.memo(b.forwardRef((e,t)=>{let{render:n,className:r,style:i,keepMounted:a,...o}=e,{selected:s}=BM(),c=b.useRef(null),{transitionStatus:l,setMounted:u}=Gy(s),d=w_(`span`,e,{ref:[t,c],state:{selected:s,transitionStatus:l},props:[{"aria-hidden":!0,children:`✔️`},o],stateAttributesMapping:Yy});return Zy({open:s,ref:c,onComplete(){s||u(!1)}}),d})),WM=b.memo(b.forwardRef(function(e,t){let{indexRef:n,textRef:r,selectedByFocus:i,hasRegistered:a}=BM(),{selectedItemTextRef:o}=gj(),{className:s,render:c,style:l,...u}=e;return w_(`div`,e,{ref:[b.useCallback(e=>{if(!e||!a)return;let t=o.current===null||!o.current.isConnected;(i||t&&n.current===0)&&(o.current=e)},[o,n,i,a]),t,r],props:u})})),GM=b.forwardRef(function(e,t){let{render:n,className:r,style:i,direction:a,keepMounted:o=!1,...s}=e,c=a===`up`,{store:l,popupRef:u,listRef:d,handleScrollArrowVisibility:f,scrollArrowsMountedCountRef:p}=gj(),{side:m,scrollDownArrowRef:h,scrollUpArrowRef:g}=dM(),_=Ly(l,c?Aj.scrollUpArrowVisible:Aj.scrollDownArrowVisible),v=Ly(l,Aj.openMethod),y=_&&v!==`touch`,b=Zp(),x=c?g:h,{transitionStatus:S,setMounted:C}=Gy(y);X(()=>(p.current+=1,l.state.hasScrollArrows||l.set(`hasScrollArrows`,!0),()=>{p.current=Math.max(0,p.current-1),p.current===0&&l.state.hasScrollArrows&&l.set(`hasScrollArrows`,!1)}),[l,p]),Zy({open:y,ref:x,onComplete(){y||C(!1)}});let w=w_(`div`,e,{ref:[t,x],state:{direction:a,visible:y,side:m,transitionStatus:S},props:[{"aria-hidden":!0,children:c?`▲`:`▼`,style:{position:`absolute`},onMouseMove(e){if(e.movementX===0&&e.movementY===0||b.isStarted())return;l.set(`activeIndex`,null);function t(){let e=l.state.listElement??u.current;if(!e)return;l.set(`activeIndex`,null),f();let n=Mj(e.scrollHeight,e.clientHeight),r=Nj(e.scrollTop,n),i=r===(c?0:n),a=d.current;if(r!==e.scrollTop&&(e.scrollTop=r),a.length===0&&l.set(c?`scrollUpArrowVisible`:`scrollDownArrowVisible`,!i),i){b.clear();return}if(a.length>0){let t=x.current?.offsetHeight||0;e.scrollTop=KM(a,c,r,e.clientHeight,t,n)}b.start(40,t)}b.start(40,t)},onMouseLeave(){b.clear()}},s]});return y||o?w:null});function KM(e,t,n,r,i,a){if(t){let t=0,r=n+i-1;for(let n=0;n<e.length;n+=1){let i=e[n];if(i&&i.offsetTop>=r){t=n;break}}let o=Math.max(0,t-1),s=e[o];return o<t&&s?Nj(s.offsetTop-i,a):0}let o=e.length-1,s=n+r-i+1;for(let t=0;t<e.length;t+=1){let n=e[t];if(n&&n.offsetTop+n.offsetHeight>s){o=Math.max(0,t-1);break}}let c=Math.min(e.length-1,o+1),l=e[c];return c>o&&l?Nj(l.offsetTop+l.offsetHeight-r+i,a):a}var qM=b.forwardRef(function(e,t){return(0,y.jsx)(GM,{...e,ref:t,direction:`down`})}),JM=b.forwardRef(function(e,t){return(0,y.jsx)(GM,{...e,ref:t,direction:`up`})}),YM=Pj;function XM({className:e,...t}){return(0,y.jsx)(Uj,{"data-slot":`select-value`,className:rp(`flex flex-1 text-left`,e),...t})}function ZM({className:e,size:t=`default`,children:n,...r}){return(0,y.jsxs)(Vj,{"data-slot":`select-trigger`,"data-size":t,className:rp(`flex w-fit items-center justify-between gap-1.5 rounded-md border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...r,children:[n,(0,y.jsx)(Wj,{render:(0,y.jsx)(fd,{className:`pointer-events-none size-4 text-muted-foreground`})})]})}function QM({className:e,children:t,footer:n,side:r=`bottom`,sideOffset:i=4,align:a=`center`,alignOffset:o=0,alignItemWithTrigger:s=!0,...c}){return(0,y.jsx)(Kj,{children:(0,y.jsx)(yM,{side:r,sideOffset:i,align:a,alignOffset:o,alignItemWithTrigger:s,className:`isolate z-50`,children:(0,y.jsxs)(OM,{"data-slot":`select-content`,"data-align-trigger":s,className:rp(`relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-md bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...c,children:[(0,y.jsx)(eN,{}),(0,y.jsx)(IM,{children:t}),(0,y.jsx)(tN,{}),n]})})})}function $M({className:e,children:t,...n}){return(0,y.jsxs)(VM,{"data-slot":`select-item`,className:rp(`relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2`,e),...n,children:[(0,y.jsx)(WM,{className:`flex flex-1 shrink-0 gap-2 whitespace-nowrap`,children:t}),(0,y.jsx)(HM,{render:(0,y.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex size-4 items-center justify-center`}),children:(0,y.jsx)(dd,{className:`pointer-events-none`})})]})}function eN({className:e,...t}){return(0,y.jsx)(JM,{"data-slot":`select-scroll-up-button`,className:rp(`top-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4`,e),...t,children:(0,y.jsx)(pd,{})})}function tN({className:e,...t}){return(0,y.jsx)(qM,{"data-slot":`select-scroll-down-button`,className:rp(`bottom-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4`,e),...t,children:(0,y.jsx)(fd,{})})}var nN=`h-7 justify-between gap-1.5 rounded-md border-border/60 bg-transparent px-2 text-xs font-normal text-foreground shadow-none focus-visible:border-ring/40 focus-visible:ring-1 focus-visible:ring-ring/40 dark:bg-transparent`,rN=`max-h-72 w-(--anchor-width) origin-(--transform-origin) gap-0 overflow-x-hidden p-1 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden`,iN=`rounded-sm py-1.5 pr-7 pl-2 text-xs hover:bg-foreground/10 hover:text-foreground focus:bg-foreground/10 focus:text-foreground`,aN=({value:e,items:t,ariaLabel:n,placeholder:r,onValueChange:i,open:a,onOpenChange:o,onItemHover:s,triggerClassName:c,triggerStyle:l,footerSlot:u})=>{let d=t.find(t=>t.id===e),f=d?.itemStyle?{...d.itemStyle,...l}:l;return(0,y.jsxs)(YM,{value:e,onValueChange:i,open:a,onOpenChange:o,children:[(0,y.jsx)(ZM,{size:`sm`,"aria-label":n,className:rp(nN,`w-full`,c),style:f,children:(0,y.jsx)(XM,{placeholder:r,children:()=>d?.label||r})}),(0,y.jsx)(QM,{alignItemWithTrigger:!1,sideOffset:4,className:rp(rN,Lx,Rx),footer:u?(0,y.jsx)(`div`,{className:`border-t border-border/40 p-1`,children:u}):void 0,children:t.map(e=>(0,y.jsx)($M,{value:e.id,className:iN,style:e.itemStyle,onPointerEnter:s?()=>s(e.id):void 0,onFocus:s?()=>s(e.id):void 0,children:e.label},e.id))})]})};function oN(e){let{open:t,defaultOpen:n,onOpenChange:r,disabled:i}=e,a=t!==void 0,[o,s]=wS({controlled:t,default:n,name:`Collapsible`,state:`open`}),{mounted:c,setMounted:l,transitionStatus:u}=Gy(o,!0,!0),[d,f]=b.useState(o),[{height:p,width:m},h]=b.useState({height:void 0,width:void 0}),g=gx(),[_,v]=b.useState(),y=_??g,[x,S]=b.useState(!1),[C,w]=b.useState(!1),T=b.useRef(null),E=b.useRef(null),D=b.useRef(null),O=b.useRef(null),k=Xy(O,!1),A=Z(e=>{let t=!o,n=Lm(Tm,e.nativeEvent);if(r(t,n),n.isCanceled)return;let i=O.current;E.current===`css-animation`&&i!=null&&i.style.removeProperty(`animation-name`),!x&&!C&&(E.current!=null&&E.current!==`css-animation`&&!c&&t&&l(!0),E.current===`css-animation`&&(!d&&t&&f(!0),!c&&t&&l(!0))),s(t),E.current===`none`&&c&&!t&&l(!1)});return X(()=>{a&&E.current===`none`&&!o&&l(!1)},[a,o,t,l]),b.useMemo(()=>({abortControllerRef:T,animationTypeRef:E,disabled:i,handleTrigger:A,height:p,mounted:c,open:o,panelId:y,panelRef:O,runOnceAnimationsFinish:k,setDimensions:h,setHiddenUntilFound:S,setKeepMounted:w,setMounted:l,setOpen:s,setPanelIdState:v,setVisible:f,transitionDimensionRef:D,transitionStatus:u,visible:d,width:m}),[T,E,i,A,p,c,o,y,O,k,h,S,w,l,s,f,D,u,d,m])}var sN=b.createContext(void 0);function cN(){let e=b.useContext(sN);if(e===void 0)throw Error(t_(15));return e}var lN=function(e){return e.open=`data-open`,e.closed=`data-closed`,e[e.startingStyle=Ky.startingStyle]=`startingStyle`,e[e.endingStyle=Ky.endingStyle]=`endingStyle`,e}({}),uN=function(e){return e.panelOpen=`data-panel-open`,e}({}),dN={[lN.open]:``},fN={[lN.closed]:``},pN={open(e){return e?{[uN.panelOpen]:``}:null}},mN={open(e){return e?dN:fN},...Yy},hN=b.forwardRef(function(e,t){let{render:n,className:r,defaultOpen:i=!1,disabled:a=!1,onOpenChange:o,open:s,style:c,...l}=e,u=Z(o),d=oN({open:s,defaultOpen:i,onOpenChange:u,disabled:a}),f=b.useMemo(()=>({open:d.open,disabled:d.disabled,transitionStatus:d.transitionStatus}),[d.open,d.disabled,d.transitionStatus]),p=b.useMemo(()=>({...d,onOpenChange:u,state:f}),[d,u,f]),m=w_(`div`,e,{state:f,ref:t,props:l,stateAttributesMapping:mN});return(0,y.jsx)(sN.Provider,{value:p,children:m})}),gN={...pN,...Yy},_N=b.forwardRef(function(e,t){let{panelId:n,open:r,handleTrigger:i,state:a,disabled:o}=cN(),{className:s,disabled:c=o,id:l,render:u,nativeButton:d=!0,style:f,...p}=e,{getButtonProps:m,buttonRef:h}=px({disabled:c,focusableWhenDisabled:!0,native:d}),g=b.useMemo(()=>({"aria-controls":r?n:void 0,"aria-expanded":r,onClick:i}),[n,r,i]);return w_(`button`,e,{state:a,ref:[t,h],props:[g,p,m],stateAttributesMapping:gN})}),vN=function(e){return e.disabled=`data-disabled`,e.orientation=`data-orientation`,e}({});function yN(e){let{abortControllerRef:t,animationTypeRef:n,externalRef:r,height:i,hiddenUntilFound:a,keepMounted:o,id:s,mounted:c,onOpenChange:l,open:u,panelRef:d,runOnceAnimationsFinish:f,setDimensions:p,setMounted:m,setOpen:h,setVisible:g,transitionDimensionRef:_,visible:v,width:y}=e,x=b.useRef(!1),S=b.useRef(null),C=b.useRef(u),w=b.useRef(u),T=tm(),E=b.useMemo(()=>n.current===`css-animation`?!v:!u&&!c,[u,c,v,n]),D=Hm(r,d,Z(e=>{if(!e)return;if(n.current==null||_.current==null){let t=getComputedStyle(e),r=t.animationName!==`none`&&t.animationName!==``,i=t.transitionDuration!==`0s`&&t.transitionDuration!==``;r&&i||(t.animationName===`none`&&t.transitionDuration!==`0s`?n.current=`css-transition`:t.animationName!==`none`&&t.transitionDuration===`0s`?n.current=`css-animation`:n.current=`none`),e.getAttribute(vN.orientation)===`horizontal`||t.transitionProperty.indexOf(`width`)>-1?_.current=`width`:_.current=`height`}if(n.current!==`css-transition`)return;(i===void 0||y===void 0)&&(p({height:e.scrollHeight,width:e.scrollWidth}),w.current&&e.style.setProperty(`transition-duration`,`0s`));let t=-1,r=-1;return t=em.request(()=>{w.current=!1,r=em.request(()=>{setTimeout(()=>{e.style.removeProperty(`transition-duration`)})})}),()=>{em.cancel(t),em.cancel(r)}}));return X(()=>{if(n.current!==`css-transition`)return;let e=d.current;if(!e)return;let r=-1;if(t.current!=null&&(t.current.abort(),t.current=null),u){let t={"justify-content":e.style.justifyContent,"align-items":e.style.alignItems,"align-content":e.style.alignContent,"justify-items":e.style.justifyItems};Object.keys(t).forEach(t=>{e.style.setProperty(t,`initial`,`important`)}),!w.current&&!o&&e.setAttribute(lN.startingStyle,``),p({height:e.scrollHeight,width:e.scrollWidth}),r=em.request(()=>{Object.entries(t).forEach(([t,n])=>{n===``?e.style.removeProperty(t):e.style.setProperty(t,n)})})}else{if(e.scrollHeight===0&&e.scrollWidth===0)return;p({height:e.scrollHeight,width:e.scrollWidth});let n=new AbortController;t.current=n;let r=n.signal,i=null,a=lN.endingStyle;return i=new MutationObserver(o=>{o.some(e=>e.type===`attributes`&&e.attributeName===a)&&(i?.disconnect(),i=null,f(()=>{p({height:0,width:0}),e.style.removeProperty(`content-visibility`),m(!1),t.current===n&&(t.current=null)},r))}),i.observe(e,{attributes:!0,attributeFilter:[a]}),()=>{i?.disconnect(),T.cancel(),t.current===n&&(n.abort(),t.current=null)}}return()=>{em.cancel(r)}},[t,n,T,a,o,c,u,d,f,p,m]),X(()=>{if(n.current!==`css-animation`)return;let e=d.current;e&&(S.current=e.style.animationName||S.current,e.style.setProperty(`animation-name`,`none`),p({height:e.scrollHeight,width:e.scrollWidth}),!C.current&&!x.current&&e.style.removeProperty(`animation-name`),u?(t.current!=null&&(t.current.abort(),t.current=null),m(!0),g(!0)):(t.current=new AbortController,f(()=>{m(!1),g(!1),t.current=null},t.current.signal)))},[t,n,u,d,f,p,m,g,v]),Jp(()=>{let e=em.request(()=>{C.current=!1});return()=>em.cancel(e)}),X(()=>{if(!a)return;let e=d.current;if(!e)return;let t=-1,n=-1;return u&&x.current&&(e.style.transitionDuration=`0s`,p({height:e.scrollHeight,width:e.scrollWidth}),t=em.request(()=>{x.current=!1,n=em.request(()=>{setTimeout(()=>{e.style.removeProperty(`transition-duration`)})})})),()=>{em.cancel(t),em.cancel(n)}},[a,u,d,p]),X(()=>{let e=d.current;e&&a&&E&&(e.setAttribute(`hidden`,`until-found`),n.current===`css-transition`&&e.setAttribute(lN.startingStyle,``))},[a,E,n,d]),b.useEffect(function(){let e=d.current;if(!e)return;function t(e){x.current=!0,h(!0),l(!0,Lm(wm,e))}return Ap(e,`beforematch`,t)},[l,d,h]),b.useMemo(()=>({props:{hidden:E,id:s,ref:D}}),[E,s,D])}var bN=function(e){return e.collapsiblePanelHeight=`--collapsible-panel-height`,e.collapsiblePanelWidth=`--collapsible-panel-width`,e}({}),xN=b.forwardRef(function(e,t){let{className:n,hiddenUntilFound:r,keepMounted:i,render:a,id:o,style:s,...c}=e,{abortControllerRef:l,animationTypeRef:u,height:d,mounted:f,onOpenChange:p,open:m,panelId:h,panelRef:g,runOnceAnimationsFinish:_,setDimensions:v,setHiddenUntilFound:y,setKeepMounted:x,setMounted:S,setPanelIdState:C,setOpen:w,setVisible:T,state:E,transitionDimensionRef:D,visible:O,width:k,transitionStatus:A}=cN(),j=r??!1,M=i??!1;X(()=>{if(o)return C(o),()=>{C(void 0)}},[o,C]),X(()=>{y(j)},[y,j]),X(()=>{x(M)},[x,M]);let{props:N}=yN({abortControllerRef:l,animationTypeRef:u,externalRef:t,height:d,hiddenUntilFound:j,id:h,keepMounted:M,mounted:f,onOpenChange:p,open:m,panelRef:g,runOnceAnimationsFinish:_,setDimensions:v,setMounted:S,setOpen:w,setVisible:T,transitionDimensionRef:D,visible:O,width:k});Zy({open:m&&A===`idle`,ref:g,onComplete(){m&&v({height:void 0,width:void 0})}});let P=w_(`div`,e,{state:b.useMemo(()=>({...E,transitionStatus:A}),[E,A]),ref:[t,g],props:[N,{style:{[bN.collapsiblePanelHeight]:d===void 0?`auto`:`${d}px`,[bN.collapsiblePanelWidth]:k===void 0?`auto`:`${k}px`}},c],stateAttributesMapping:mN});return M||j||f?P:null});function SN({...e}){return(0,y.jsx)(hN,{"data-slot":`collapsible`,...e})}function CN({...e}){return(0,y.jsx)(_N,{"data-slot":`collapsible-trigger`,...e})}function wN({...e}){return(0,y.jsx)(xN,{"data-slot":`collapsible-content`,...e})}function TN({className:e,...t}){return(0,y.jsx)(`label`,{"data-slot":`label`,className:rp(`flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50`,e),...t})}function EN({className:e,...t}){return(0,y.jsx)(`div`,{"data-slot":`field-group`,className:rp(`group/field-group @container/field-group flex w-full flex-col gap-7 data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4`,e),...t})}var DN=Jx(`group/field flex w-full gap-3 data-[invalid=true]:text-destructive`,{variants:{orientation:{vertical:`flex-col *:w-full [&>.sr-only]:w-auto`,horizontal:`flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`,responsive:`flex-col *:w-full @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:*:data-[slot=field-label]:flex-auto [&>.sr-only]:w-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`}},defaultVariants:{orientation:`vertical`}});function ON({className:e,orientation:t=`vertical`,...n}){return(0,y.jsx)(`div`,{role:`group`,"data-slot":`field`,"data-orientation":t,className:rp(DN({orientation:t}),e),...n})}function kN({className:e,...t}){return(0,y.jsx)(TN,{"data-slot":`field-label`,className:rp(`group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50 has-data-checked:border-primary/30 has-data-checked:bg-primary/5 has-[>[data-slot=field]]:rounded-md has-[>[data-slot=field]]:border *:data-[slot=field]:p-3 dark:has-data-checked:border-primary/20 dark:has-data-checked:bg-primary/10`,`has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col`,e),...t})}var AN=b.createContext(void 0);function jN(e){let t=b.useContext(AN);if(t===void 0&&!e)throw Error(t_(47));return t}function MN(){return{...ib(),disabled:!1,modal:!1,focusManagerModal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,nested:!1,openOnHover:!1,closeDelay:0,hasViewport:!1}}var NN={...ob,disabled:Q(e=>e.disabled),instantType:Q(e=>e.instantType),openMethod:Q(e=>e.openMethod),openChangeReason:Q(e=>e.openChangeReason),modal:Q(e=>e.modal),focusManagerModal:Q(e=>e.focusManagerModal),stickIfOpen:Q(e=>e.stickIfOpen),titleElementId:Q(e=>e.titleElementId),descriptionElementId:Q(e=>e.descriptionElementId),openOnHover:Q(e=>e.openOnHover),closeDelay:Q(e=>e.closeDelay),hasViewport:Q(e=>e.hasViewport)},PN=class e extends Hy{constructor(e){let t={...MN(),...e};t.open&&e?.mounted===void 0&&(t.mounted=!0),super(t,{popupRef:b.createRef(),backdropRef:b.createRef(),internalBackdropRef:b.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:b.createRef(),beforeContentFocusGuardRef:b.createRef(),stickIfOpenTimeout:new Xp,triggerElements:new nb},NN)}setOpen=(e,t)=>{let n=t.reason===Em,r=t.reason===`trigger-press`&&t.event.detail===0,i=!e&&(t.reason===`escape-key`||t.reason==null);if(t.preventUnmountOnClose=()=>{this.set(`preventUnmountingOnClose`,!0)},this.context.onOpenChange?.(e,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(e,t);let a=()=>{let n={open:e,openChangeReason:t.reason},r=t.trigger?.id??null;(r||e)&&(n.activeTriggerId=r,n.activeTriggerElement=t.trigger??null),this.update(n)};n?(this.set(`stickIfOpen`,!0),this.context.stickIfOpenTimeout.start(500,()=>{this.set(`stickIfOpen`,!1)}),F_.flushSync(a)):a(),r||i?this.set(`instantType`,r?`click`:`dismiss`):t.reason===`focus-out`?this.set(`instantType`,`focus`):this.set(`instantType`,void 0)};static useStore(t,n){let r=Kp(()=>new e(n)).current,i=t??r;return Jp(r.disposeEffect),i}disposeEffect=()=>this.context.stickIfOpenTimeout.disposeEffect()};function FN({props:e}){let{children:t,open:n,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:a,modal:o=!1,handle:s,triggerId:c,defaultTriggerId:l=null}=e,u=PN.useStore(s?.store,{modal:o,open:r,openProp:n,activeTriggerId:l,triggerIdProp:c});ip(()=>{n===void 0&&u.state.open===!1&&r===!0&&u.update({open:!0,activeTriggerId:l})}),u.useControlledProp(`openProp`,n),u.useControlledProp(`triggerIdProp`,c);let d=u.useState(`open`),f=u.useState(`payload`);u.useContextCallback(`onOpenChange`,i),u.useContextCallback(`onOpenChangeComplete`,a);let{openMethod:p,triggerProps:m}=Ub(d);eb(u);let{forceUnmount:h}=tb(d,u,()=>{u.update({stickIfOpen:!0,openChangeReason:null})});b.useEffect(()=>{d||u.context.stickIfOpenTimeout.clear()},[u,d]);let g=b.useCallback(()=>{u.setOpen(!1,Lm(Fm))},[u]);b.useImperativeHandle(e.actionsRef,()=>({unmount:h,close:g}),[h,g]);let _=lb({popupStore:u,onOpenChange:u.setOpen}),{getReferenceProps:v,getFloatingProps:x,getTriggerProps:S}=bb([pv(_,{outsidePressEvent:{mouse:o===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}}),jb(_)]),C=b.useMemo(()=>v(m),[v,m]),w=b.useMemo(()=>S(m),[S,m]),T=b.useMemo(()=>x(),[x]);u.useSyncedValues({modal:o,openMethod:p,activeTriggerProps:C,inactiveTriggerProps:w,popupProps:T,floatingRootContext:_,nested:G_()!=null});let E=b.useMemo(()=>({store:u}),[u]);return(0,y.jsx)(AN.Provider,{value:E,children:typeof t==`function`?t({payload:f}):t})}function IN(e){return jN(!0)?(0,y.jsx)(FN,{props:e}):(0,y.jsx)(Y_,{children:(0,y.jsx)(FN,{props:e})})}function LN(e,t){let n=b.useRef(null);return{preFocusGuardRef:n,handlePreFocusGuardFocus:Z(t=>{F_.flushSync(()=>{e.setOpen(!1,Lm(Am,t.nativeEvent,t.currentTarget))}),Og(n.current)?.focus()}),handleFocusTargetFocus:Z(n=>{let r=e.select(`positionerElement`);if(r&&kg(n,r))e.context.beforeContentFocusGuardRef.current?.focus();else{F_.flushSync(()=>{e.setOpen(!1,Lm(Am,n.nativeEvent,n.currentTarget))});let i=Dg(e.context.triggerFocusTargetRef.current||t.current);for(;i!==null&&dh(r,i);){let e=i;if(i=wg(i),i===e)break}i?.focus()}})}}var RN=b.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,nativeButton:a=!0,handle:o,payload:s,openOnHover:c=!1,delay:l=300,closeDelay:u=0,id:d,style:f,...p}=e,m=jN(!0),h=o?.store??m?.store;if(!h)throw Error(t_(74));let g=gx(d),_=h.useState(`isTriggerActive`,g),v=h.useState(`floatingRootContext`),x=h.useState(`isOpenedByTrigger`,g),S=b.useRef(null),{registerTrigger:C,isMountedByThisTrigger:w}=$y(g,S,h,{payload:s,disabled:i,openOnHover:c,closeDelay:u}),T=h.useState(`openChangeReason`),E=h.useState(`stickIfOpen`),D=h.useState(`openMethod`),O=h.useState(`focusManagerModal`),k=yb(v,{enabled:v!=null&&c&&(D!==`touch`||T!==`trigger-press`),mouseOnly:!0,move:!1,handleClose:Bb(),restMs:l,delay:{close:u},triggerElementRef:S,isActiveTrigger:_,isClosing:()=>h.select(`transitionStatus`)===`ending`}),A=bb([ov(v,{enabled:v!=null,stickIfOpen:E})]),j=h.useState(`triggerProps`,w),M={disabled:i,open:x},{getButtonProps:N,buttonRef:P}=px({disabled:i,native:a}),F=b.useMemo(()=>({open(e){return e&&T===`trigger-press`?ox.open(e):ax.open(e)}}),[T]),I=w_(`button`,e,{state:M,ref:[P,t,C,S],props:[A.getReferenceProps(),k,j,{[j_]:``,id:g},p,N],stateAttributesMapping:F}),{preFocusGuardRef:L,handlePreFocusGuardFocus:R,handleFocusTargetFocus:z}=LN(h,S);return _&&!O?(0,y.jsxs)(b.Fragment,{children:[(0,y.jsx)(rh,{ref:L,onFocus:R}),(0,y.jsx)(b.Fragment,{children:I},g),(0,y.jsx)(rh,{ref:h.context.triggerFocusTargetRef,onFocus:z})]}):(0,y.jsx)(b.Fragment,{children:I},g)}),zN=b.createContext(void 0);function BN(){let e=b.useContext(zN);if(e===void 0)throw Error(t_(45));return e}var VN=b.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i}=jN();return i.useState(`mounted`)||n?(0,y.jsx)(zN.Provider,{value:n,children:(0,y.jsx)(B_,{ref:t,...r})}):null}),HN=b.createContext(void 0);function UN(){let e=b.useContext(HN);if(!e)throw Error(t_(46));return e}var WN=b.forwardRef(function(e,t){let{render:n,className:r,anchor:i,positionMethod:a=`absolute`,side:o=`bottom`,align:s=`center`,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d=5,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:h=N_,style:g,..._}=e,{store:v}=jN(),x=BN(),S=q_(),C=v.useState(`floatingRootContext`),w=v.useState(`mounted`),T=v.useState(`open`),E=v.useState(`openChangeReason`),D=v.useState(`activeTriggerElement`),O=v.useState(`modal`),k=v.useState(`openMethod`),A=v.useState(`positionerElement`),j=v.useState(`instantType`),M=v.useState(`transitionStatus`),N=v.useState(`hasViewport`),P=b.useRef(null),F=Xy(A,!1,!1),I=cM({anchor:i,floatingRootContext:C,positionMethod:a,mounted:w,side:o,sideOffset:c,align:s,alignOffset:l,arrowPadding:f,collisionBoundary:u,collisionPadding:d,sticky:p,disableAnchorTracking:m,keepMounted:x,nodeId:S,collisionAvoidance:h,adaptiveOrigin:N?aM:void 0}),L=C.useState(`domReferenceElement`);X(()=>{let e=L,t=P.current;if(e&&(P.current=e),t&&e&&e!==t){v.set(`instantType`,void 0);let e=new AbortController;return F(()=>{v.set(`instantType`,`trigger-change`)},e.signal),()=>{e.abort()}}},[L,F,v]);let R={open:T,side:I.side,align:I.align,anchorHidden:I.anchorHidden,instant:j};_M(T&&O===!0&&E!==`trigger-hover`,k===`touch`,A,D);let z=b.useCallback(e=>{v.set(`positionerElement`,e)},[v]),ee=hM(e,R,{styles:I.positionerStyles,transitionStatus:M,props:_,refs:[t,z],hidden:!w,inert:!T});return(0,y.jsxs)(HN.Provider,{value:I,children:[w&&O===!0&&E!==`trigger-hover`&&(0,y.jsx)(Px,{ref:v.context.internalBackdropRef,inert:Nx(!T),cutout:D}),(0,y.jsx)(J_,{id:S,children:ee})]})}),GN=b.createContext(void 0);function KN(){let[e,t]=b.useState(0),n=Z(()=>(t(e=>e+1),()=>{t(e=>Math.max(0,e-1))}));return{context:b.useMemo(()=>({register:n}),[n]),hasClosePart:e>0}}function qN(e){let{value:t,children:n}=e;return(0,y.jsx)(GN.Provider,{value:t,children:n})}var JN={...sx,...Yy},YN=b.forwardRef(function(e,t){let{className:n,render:r,initialFocus:i,finalFocus:a,style:o,...s}=e,{store:c}=jN(),l=UN(),u=CM(!0)!=null,{context:d,hasClosePart:f}=KN(),p=c.useState(`open`),m=c.useState(`openMethod`),h=c.useState(`instantType`),g=c.useState(`transitionStatus`),_=c.useState(`popupProps`),v=c.useState(`titleElementId`),x=c.useState(`descriptionElementId`),S=c.useState(`modal`),C=c.useState(`mounted`),w=c.useState(`openChangeReason`),T=c.useState(`activeTriggerElement`),E=c.useState(`floatingRootContext`);Zy({open:p,ref:c.context.popupRef,onComplete(){p&&c.context.onOpenChangeComplete?.(!0)}});let D=c.useState(`disabled`),O=c.useState(`openOnHover`),k=c.useState(`closeDelay`);_b(E,{enabled:O&&!D,closeDelay:k});function A(e){return e===`touch`?c.context.popupRef.current:!0}let j=i===void 0?A:i,M={open:p,side:l.side,align:l.align,instant:h,transitionStatus:g},N=S!==!1&&f;c.useSyncedValue(`focusManagerModal`,N);let P=b.useCallback(e=>{c.set(`popupElement`,e)},[c]),F=w_(`div`,e,{state:M,ref:[t,c.context.popupRef,P],props:[_,{"aria-labelledby":v,"aria-describedby":x,onKeyDown(e){u&&Ax.has(e.key)&&e.stopPropagation()}},mM(g),s],stateAttributesMapping:JN});return(0,y.jsx)(av,{context:E,openInteractionType:m,modal:N,disabled:!C||w===`trigger-hover`,initialFocus:j,returnFocus:a,restoreFocus:`popup`,previousFocusableElement:dp(T)?T:void 0,nextFocusableElement:c.context.triggerFocusTargetRef,beforeContentFocusGuardRef:c.context.beforeContentFocusGuardRef,children:(0,y.jsx)(qN,{value:d,children:F})})});function XN({...e}){return(0,y.jsx)(IN,{"data-slot":`popover`,...e})}function ZN({...e}){return(0,y.jsx)(RN,{"data-slot":`popover-trigger`,...e})}function QN({className:e,align:t=`center`,alignOffset:n=0,side:r=`bottom`,sideOffset:i=4,...a}){return(0,y.jsx)(VN,{children:(0,y.jsx)(WN,{align:t,alignOffset:n,side:r,sideOffset:i,className:`isolate z-50`,children:(0,y.jsx)(YN,{"data-slot":`popover-content`,className:rp(`z-50 flex w-72 origin-(--transform-origin) flex-col gap-4 rounded-md bg-popover p-4 text-sm text-popover-foreground shadow-md ring-1 ring-foreground/10 outline-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...a})})})}var $N=b.createContext(void 0);function eP(){let e=b.useContext($N);if(e===void 0)throw Error(t_(63));return e}var tP=function(e){return e.checked=`data-checked`,e.unchecked=`data-unchecked`,e.disabled=`data-disabled`,e.readonly=`data-readonly`,e.required=`data-required`,e.valid=`data-valid`,e.invalid=`data-invalid`,e.touched=`data-touched`,e.dirty=`data-dirty`,e.filled=`data-filled`,e.focused=`data-focused`,e}({}),nP={...pS,checked(e){return e?{[tP.checked]:``}:{[tP.unchecked]:``}}},rP=b.forwardRef(function(e,t){let{checked:n,className:r,defaultChecked:i,"aria-labelledby":a,form:o,id:s,inputRef:c,name:l,nativeButton:u=!1,onCheckedChange:d,readOnly:f=!1,required:p=!1,disabled:m=!1,render:h,uncheckedValue:g,value:_,style:v,...x}=e,{clearErrors:S}=_S(),{state:C,setTouched:w,setDirty:T,validityData:E,setFilled:D,setFocused:O,shouldValidateOnChange:k,validationMode:A,disabled:j,name:M,validation:N}=hS(),{labelId:P}=yS(),F=j||m,I=M??l,L=Z(d),R=b.useRef(null),z=Hm(R,c,N.inputRef),ee=b.useRef(null),B=gx(),te=CS({id:s,implicit:!1,controlRef:ee}),V=u?void 0:te,[H,ne]=wS({controlled:n,default:!!i,name:`Switch`,state:`checked`});TS(ee,{id:B,value:H}),X(()=>{R.current&&D(R.current.checked)},[R,D]),Hb(H,()=>{S(I),T(H!==E.initialValue),D(H),k()?N.commit(H):N.commit(H,!0)});let{getButtonProps:U,buttonRef:re}=px({disabled:F,native:u}),W=bS(a,P,R,!u,V),ie={id:u?te:B,role:`switch`,"aria-checked":H,"aria-readonly":f||void 0,"aria-required":p||void 0,"aria-labelledby":W,onFocus(){F||O(!0)},onBlur(){let e=R.current;!e||F||(w(!0),O(!1),A===`onBlur`&&N.commit(e.checked))},onClick(e){f||F||(e.preventDefault(),R.current?.dispatchEvent(new PointerEvent(`click`,{bubbles:!0,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey})))}},ae=b.useMemo(()=>u_({checked:H,disabled:F,form:o,id:V,name:I,required:p,style:I?nh:th,tabIndex:-1,type:`checkbox`,"aria-hidden":!0,ref:z,onChange(e){if(e.nativeEvent.defaultPrevented)return;if(f){e.preventDefault();return}let t=e.currentTarget.checked,n=Lm(wm,e.nativeEvent);L?.(t,n),!n.isCanceled&&ne(t)},onFocus(){ee.current?.focus()}},N.getInputValidationProps,_===void 0?im:{value:_}),[H,F,o,z,V,I,L,f,p,ne,N,_]),oe=b.useMemo(()=>({...C,checked:H,disabled:F,readOnly:f,required:p}),[C,H,F,f,p]),se=w_(`span`,e,{state:oe,ref:[t,ee,re],props:[ie,N.getValidationProps,x,U],stateAttributesMapping:nP});return(0,y.jsxs)($N.Provider,{value:oe,children:[se,!H&&I&&g!==void 0&&(0,y.jsx)(`input`,{type:`hidden`,form:o,name:I,value:g}),(0,y.jsx)(`input`,{...ae,suppressHydrationWarning:!0})]})}),iP=b.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{state:o}=hS(),s=eP();return w_(`span`,e,{state:{...o,...s},ref:t,stateAttributesMapping:nP,props:a})});function aP({className:e,size:t=`default`,...n}){return(0,y.jsx)(rP,{"data-slot":`switch`,"data-size":t,className:rp(`peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 data-disabled:cursor-not-allowed data-disabled:opacity-50`,e),...n,children:(0,y.jsx)(iP,{"data-slot":`switch-thumb`,className:`pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] dark:data-checked:bg-primary-foreground group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 dark:data-unchecked:bg-foreground`})})}var oP=b.createContext(void 0);function sP(e){let t=b.useContext(oP);if(t===void 0&&!e)throw Error(t_(72));return t}var cP={...ob,disabled:Q(e=>e.disabled),instantType:Q(e=>e.instantType),isInstantPhase:Q(e=>e.isInstantPhase),trackCursorAxis:Q(e=>e.trackCursorAxis),disableHoverablePopup:Q(e=>e.disableHoverablePopup),lastOpenChangeReason:Q(e=>e.openChangeReason),closeOnClick:Q(e=>e.closeOnClick),closeDelay:Q(e=>e.closeDelay),hasViewport:Q(e=>e.hasViewport)},lP=class e extends Hy{constructor(e){super({...uP(),...e},{popupRef:b.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:new nb},cP)}setOpen=(e,t)=>{let n=t.reason,r=n===Em,i=e&&n===`trigger-focus`,a=!e&&(n===`trigger-press`||n===`escape-key`);if(t.preventUnmountOnClose=()=>{this.set(`preventUnmountingOnClose`,!0)},this.context.onOpenChange?.(e,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(e,t);let o=()=>{let r={open:e,openChangeReason:n};i?r.instantType=`focus`:a?r.instantType=`dismiss`:n===`trigger-hover`&&(r.instantType=void 0);let o=t.trigger?.id??null;(o||e)&&(r.activeTriggerId=o,r.activeTriggerElement=t.trigger??null),this.update(r)};r?F_.flushSync(o):o()};static useStore(t,n){let r=Kp(()=>new e(n)).current,i=t??r,a=lb({popupStore:i,onOpenChange:i.setOpen});return i.state.floatingRootContext=a,i}};function uP(){return{...ib(),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:`none`,disableHoverablePopup:!1,openChangeReason:null,closeOnClick:!0,closeDelay:0,hasViewport:!1}}var dP=jy(function(e){let{disabled:t=!1,defaultOpen:n=!1,open:r,disableHoverablePopup:i=!1,trackCursorAxis:a=`none`,actionsRef:o,onOpenChange:s,onOpenChangeComplete:c,handle:l,triggerId:u,defaultTriggerId:d=null,children:f}=e,p=lP.useStore(l?.store,{open:n,openProp:r,activeTriggerId:d,triggerIdProp:u});ip(()=>{r===void 0&&p.state.open===!1&&n===!0&&p.update({open:!0,activeTriggerId:d})}),p.useControlledProp(`openProp`,r),p.useControlledProp(`triggerIdProp`,u),p.useContextCallback(`onOpenChange`,s),p.useContextCallback(`onOpenChangeComplete`,c);let m=p.useState(`open`),h=!t&&m,g=p.useState(`activeTriggerId`),_=p.useState(`payload`);p.useSyncedValues({trackCursorAxis:a,disableHoverablePopup:i}),X(()=>{m&&t&&p.setOpen(!1,Lm(Pm))},[m,t,p]),p.useSyncedValue(`disabled`,t),eb(p);let{forceUnmount:v,transitionStatus:x}=tb(h,p),S=p.select(`floatingRootContext`),C=p.useState(`isInstantPhase`),w=p.useState(`instantType`),T=p.useState(`lastOpenChangeReason`),E=b.useRef(null);X(()=>{x===`ending`&&T===`none`||x!==`ending`&&C?(w!==`delay`&&(E.current=w),p.set(`instantType`,`delay`)):E.current!==null&&(p.set(`instantType`,E.current),E.current=null)},[x,C,T,w,p]),X(()=>{h&&(g??p.set(`payload`,void 0))},[p,g,h]);let D=b.useCallback(()=>{p.setOpen(!1,Lm(Fm))},[p]);b.useImperativeHandle(o,()=>({unmount:v,close:D}),[v,D]);let{getReferenceProps:O,getFloatingProps:k,getTriggerProps:A}=bb([pv(S,{enabled:!t,referencePress:()=>p.select(`closeOnClick`)}),lv(S,{enabled:!t&&a!==`none`,axis:a===`none`?void 0:a})]),j=b.useMemo(()=>O(),[O]),M=b.useMemo(()=>A(),[A]),N=b.useMemo(()=>k(),[k]);return p.useSyncedValues({activeTriggerProps:j,inactiveTriggerProps:M,popupProps:N}),(0,y.jsx)(oP.Provider,{value:p,children:typeof f==`function`?f({payload:_}):f})}),fP=b.createContext(void 0);function pP(){return b.useContext(fP)}var mP=function(e){return e[e.popupOpen=$b.popupOpen]=`popupOpen`,e.triggerDisabled=`data-trigger-disabled`,e}({}),hP=My(function(e,t){let{className:n,render:r,handle:i,payload:a,disabled:o,delay:s,closeOnClick:c=!0,closeDelay:l,id:u,style:d,...f}=e,p=sP(!0),m=i?.store??p;if(!m)throw Error(t_(82));let h=gx(u),g=m.useState(`isTriggerActive`,h),_=m.useState(`isOpenedByTrigger`,h),v=m.useState(`floatingRootContext`),y=b.useRef(null),x=s??600,S=l??0,{registerTrigger:C,isMountedByThisTrigger:w}=$y(h,y,m,{payload:a,closeOnClick:c,closeDelay:S}),T=pP(),{delayRef:E,isInstantPhase:D,hasProvider:O}=Bm(v,{open:_});m.useSyncedValue(`isInstantPhase`,D);let k=m.useState(`disabled`),A=o??k,j=m.useState(`trackCursorAxis`),M=m.useState(`disableHoverablePopup`),N=yb(v,{enabled:!A,mouseOnly:!0,move:!1,handleClose:!M&&j!==`both`?Bb():null,restMs(){let e=T?.delay,t=typeof E.current==`object`?E.current.open:void 0,n=x;return O&&(n=t===0?0:s??e??x),n},delay(){let e=typeof E.current==`object`?E.current.close:void 0,t=S;return l==null&&O&&(t=e),{close:t}},triggerElementRef:y,isActiveTrigger:g,isClosing:()=>m.select(`transitionStatus`)===`ending`}),P=db(v,{enabled:!A}).reference,F={open:_},I=m.useState(`triggerProps`,w);return w_(`button`,e,{state:F,ref:[t,C,y],props:[N,P,I,{onPointerDown(){m.set(`closeOnClick`,c)},id:h,[mP.triggerDisabled]:A?``:void 0},f],stateAttributesMapping:ax})}),gP=b.createContext(void 0);function _P(){let e=b.useContext(gP);if(e===void 0)throw Error(t_(70));return e}var vP=b.forwardRef(function(e,t){let{children:n,container:r,className:i,render:a,style:o,...s}=e,{portalNode:c,portalSubtree:l}=z_({container:r,ref:t,componentProps:e,elementProps:s});return!l&&!c?null:(0,y.jsxs)(b.Fragment,{children:[l,c&&F_.createPortal(n,c)]})}),yP=b.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e;return sP().useState(`mounted`)||n?(0,y.jsx)(gP.Provider,{value:n,children:(0,y.jsx)(vP,{ref:t,...r})}):null}),bP=b.createContext(void 0);function xP(){let e=b.useContext(bP);if(e===void 0)throw Error(t_(71));return e}var SP=b.forwardRef(function(e,t){let{render:n,className:r,anchor:i,positionMethod:a=`absolute`,side:o=`top`,align:s=`center`,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d=5,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:h=N_,style:g,..._}=e,v=sP(),x=_P(),S=v.useState(`open`),C=v.useState(`mounted`),w=v.useState(`trackCursorAxis`),T=v.useState(`disableHoverablePopup`),E=v.useState(`floatingRootContext`),D=v.useState(`instantType`),O=v.useState(`transitionStatus`),k=cM({anchor:i,positionMethod:a,floatingRootContext:E,mounted:C,side:o,sideOffset:c,align:s,alignOffset:l,collisionBoundary:u,collisionPadding:d,sticky:p,arrowPadding:f,disableAnchorTracking:m,keepMounted:x,collisionAvoidance:h,adaptiveOrigin:v.useState(`hasViewport`)?aM:void 0}),A=hM(e,b.useMemo(()=>({open:S,side:k.side,align:k.align,anchorHidden:k.anchorHidden,instant:w===`none`?D:`tracking-cursor`}),[S,k.side,k.align,k.anchorHidden,w,D]),{styles:k.positionerStyles,transitionStatus:O,props:_,refs:[t,v.useStateSetter(`positionerElement`)],hidden:!C,inert:!S||w===`both`||T});return(0,y.jsx)(bP.Provider,{value:k,children:A})}),CP={...sx,...Yy},wP=b.forwardRef(function(e,t){let{className:n,render:r,style:i,...a}=e,o=sP(),{side:s,align:c}=xP(),l=o.useState(`open`),u=o.useState(`instantType`),d=o.useState(`transitionStatus`),f=o.useState(`popupProps`),p=o.useState(`floatingRootContext`);Zy({open:l,ref:o.context.popupRef,onComplete(){l&&o.context.onOpenChangeComplete?.(!0)}});let m=o.useState(`disabled`),h=o.useState(`closeDelay`);return _b(p,{enabled:!m,closeDelay:h}),w_(`div`,e,{state:{open:l,side:s,align:c,instant:u,transitionStatus:d},ref:[t,o.context.popupRef,o.useStateSetter(`popupElement`)],props:[f,mM(d),a],stateAttributesMapping:CP})}),TP=b.forwardRef(function(e,t){let{className:n,render:r,style:i,...a}=e,o=sP(),s=o.useState(`open`),c=o.useState(`instantType`),{arrowRef:l,side:u,align:d,arrowUncentered:f,arrowStyles:p}=xP();return w_(`div`,e,{state:{open:s,side:u,align:d,uncentered:f,instant:c},ref:[t,l],props:[{style:p,"aria-hidden":!0},a],stateAttributesMapping:sx})}),EP=function(e){let{delay:t,closeDelay:n,timeout:r=400}=e,i=b.useMemo(()=>({delay:t,closeDelay:n}),[t,n]),a=b.useMemo(()=>({open:t,close:n}),[t,n]);return(0,y.jsx)(fP.Provider,{value:i,children:(0,y.jsx)(zm,{delay:a,timeoutMs:r,children:e.children})})};function DP({delay:e=0,...t}){return(0,y.jsx)(EP,{"data-slot":`tooltip-provider`,delay:e,...t})}function OP({...e}){return(0,y.jsx)(dP,{"data-slot":`tooltip`,...e})}function kP({...e}){return(0,y.jsx)(hP,{"data-slot":`tooltip-trigger`,...e})}function AP({className:e,side:t=`top`,sideOffset:n=4,align:r=`center`,alignOffset:i=0,children:a,...o}){return(0,y.jsx)(yP,{children:(0,y.jsx)(SP,{align:r,alignOffset:i,side:t,sideOffset:n,className:`isolate z-50`,children:(0,y.jsxs)(wP,{"data-slot":`tooltip-content`,className:rp(`z-50 inline-flex w-fit max-w-xs origin-(--transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...o,children:[a,(0,y.jsx)(TP,{className:`z-50 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground data-[side=bottom]:top-1 data-[side=inline-end]:top-1/2! data-[side=inline-end]:-left-1 data-[side=inline-end]:-translate-y-1/2 data-[side=inline-start]:top-1/2! data-[side=inline-start]:-right-1 data-[side=inline-start]:-translate-y-1/2 data-[side=left]:top-1/2! data-[side=left]:-right-1 data-[side=left]:-translate-y-1/2 data-[side=right]:top-1/2! data-[side=right]:-left-1 data-[side=right]:-translate-y-1/2 data-[side=top]:-bottom-2.5`})]})})})}var jP=[{id:`block`,name:`Block`},{id:`bar`,name:`Bar`},{id:`underline`,name:`Underline`}],MP=`block`,NP=jP.map(e=>e.id),PP=e=>typeof e==`string`&&NP.includes(e),FP=e=>e.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`),IP=`ui-monospace, SFMono-Regular, Menlo, Consolas, monospace`,LP=`"Symbols Nerd Font"`,RP=(e,t)=>`"${FP(e)}"${t?`, ${LP}`:``}, ${IP}`,zP=(e,t,n)=>({id:e,name:t,family:RP(t,!0),source:n}),BP=zP(`geist-mono`,`Geist Mono`,`fontsource`),VP=zP(`jetbrains-mono`,`JetBrains Mono`,`google`),HP=zP(`fira-code`,`Fira Code`,`google`),UP=zP(`ibm-plex-mono`,`IBM Plex Mono`,`google`),WP=zP(`source-code-pro`,`Source Code Pro`,`google`),GP=zP(`roboto-mono`,`Roboto Mono`,`google`),KP=zP(`dm-mono`,`DM Mono`,`google`),qP=zP(`inconsolata`,`Inconsolata`,`google`),JP=zP(`space-mono`,`Space Mono`,`google`),YP=zP(`ubuntu-mono`,`Ubuntu Mono`,`google`),XP=[BP,zP(`anonymous-pro`,`Anonymous Pro`,`google`),KP,HP,UP,qP,VP,GP,WP,JP,YP];BP.id;var ZP=e=>e?XP.find(t=>t.id===e)??BP:BP,QP=(e,t)=>RP(e.name,t),$P=()=>{let e=XP.filter(e=>e.source===`google`);return e.length===0?``:`https://fonts.googleapis.com/css2?${e.map(e=>`family=${e.name.replace(/ /g,`+`)}:wght@400;700`).join(`&`)}&display=swap`},eF=[{value:1e3,label:`1k lines`},{value:1e4,label:`10k lines`},{value:5e4,label:`50k lines`},{value:1e5,label:`100k lines`}],tF=1e4,nF=eF.map(e=>e.value),rF=e=>nF.includes(e),iF={id:`vesper`,name:`Vesper`,source:`raunofreiberg/vesper`,colors:{background:`#101010`,foreground:`#ffffff`,cursor:`#ffc799`,cursorAccent:`#101010`,selectionBackground:`#2a2a2a`,selectionForeground:`#ffffff`,black:`#101010`,red:`#ff8080`,green:`#99ffe4`,yellow:`#ffc799`,blue:`#a0a0a0`,magenta:`#ffc799`,cyan:`#99ffe4`,white:`#ffffff`,brightBlack:`#505050`,brightRed:`#ff9999`,brightGreen:`#b3ffe4`,brightYellow:`#ffd1a8`,brightBlue:`#b0b0b0`,brightMagenta:`#ffc799`,brightCyan:`#66ddcc`,brightWhite:`#ffffff`}},aF=[iF,{id:`ayu-mirage`,name:`Ayu Mirage`,source:`ayu-theme/vscode-ayu`,colors:{background:`#1f2430`,foreground:`#cccac2`,cursor:`#ffcc66`,cursorAccent:`#1f2430`,selectionBackground:`#34455a`,selectionForeground:`#cccac2`,black:`#171b24`,red:`#f28273`,green:`#87d96c`,yellow:`#fcca60`,blue:`#6acdff`,magenta:`#ddbbff`,cyan:`#93e2c8`,white:`#c7c7c7`,brightBlack:`#686868`,brightRed:`#f28779`,brightGreen:`#d5ff80`,brightYellow:`#ffcd66`,brightBlue:`#73d0ff`,brightMagenta:`#dfbfff`,brightCyan:`#95e6cb`,brightWhite:`#ffffff`}},{id:`catppuccin-frappe`,name:`Catppuccin Frappé`,source:`catppuccin/wezterm + style-guide`,colors:{background:`#303446`,foreground:`#c6d0f5`,cursor:`#f2d5cf`,cursorAccent:`#232634`,selectionBackground:`#626880`,selectionForeground:`#c6d0f5`,black:`#51576d`,red:`#e78284`,green:`#a6d189`,yellow:`#e5c890`,blue:`#8caaee`,magenta:`#f4b8e4`,cyan:`#81c8be`,white:`#b5bfe2`,brightBlack:`#626880`,brightRed:`#e78284`,brightGreen:`#a6d189`,brightYellow:`#e5c890`,brightBlue:`#8caaee`,brightMagenta:`#f4b8e4`,brightCyan:`#81c8be`,brightWhite:`#a5adce`}},{id:`catppuccin-macchiato`,name:`Catppuccin Macchiato`,source:`catppuccin/wezterm + style-guide`,colors:{background:`#24273a`,foreground:`#cad3f5`,cursor:`#f4dbd6`,cursorAccent:`#181926`,selectionBackground:`#5b6078`,selectionForeground:`#cad3f5`,black:`#494d64`,red:`#ed8796`,green:`#a6da95`,yellow:`#eed49f`,blue:`#8aadf4`,magenta:`#f5bde6`,cyan:`#8bd5ca`,white:`#b8c0e0`,brightBlack:`#5b6078`,brightRed:`#ed8796`,brightGreen:`#a6da95`,brightYellow:`#eed49f`,brightBlue:`#8aadf4`,brightMagenta:`#f5bde6`,brightCyan:`#8bd5ca`,brightWhite:`#a5adcb`}},{id:`catppuccin-mocha`,name:`Catppuccin Mocha`,source:`catppuccin/wezterm + style-guide`,colors:{background:`#1e1e2e`,foreground:`#cdd6f4`,cursor:`#f5e0dc`,cursorAccent:`#11111b`,selectionBackground:`#585b70`,selectionForeground:`#cdd6f4`,black:`#45475a`,red:`#f38ba8`,green:`#a6e3a1`,yellow:`#f9e2af`,blue:`#89b4fa`,magenta:`#f5c2e7`,cyan:`#94e2d5`,white:`#bac2de`,brightBlack:`#585b70`,brightRed:`#f38ba8`,brightGreen:`#a6e3a1`,brightYellow:`#f9e2af`,brightBlue:`#89b4fa`,brightMagenta:`#f5c2e7`,brightCyan:`#94e2d5`,brightWhite:`#a6adc8`}},{id:`dracula`,name:`Dracula`,source:`dracula/visual-studio-code`,colors:{background:`#282a36`,foreground:`#f8f8f2`,cursor:`#f8f8f2`,cursorAccent:`#282a36`,selectionBackground:`#44475a`,selectionForeground:`#f8f8f2`,black:`#21222c`,red:`#ff5555`,green:`#50fa7b`,yellow:`#f1fa8c`,blue:`#bd93f9`,magenta:`#ff79c6`,cyan:`#8be9fd`,white:`#f8f8f2`,brightBlack:`#6272a4`,brightRed:`#ff6e6e`,brightGreen:`#69ff94`,brightYellow:`#ffffa5`,brightBlue:`#d6acff`,brightMagenta:`#ff92df`,brightCyan:`#a4ffff`,brightWhite:`#ffffff`}},{id:`github-dark`,name:`GitHub Dark Default`,source:`primer/github-vscode-theme + @primer/primitives`,colors:{background:`#0d1117`,foreground:`#e6edf3`,cursor:`#e6edf3`,cursorAccent:`#0d1117`,selectionBackground:`#264f78`,selectionForeground:`#e6edf3`,black:`#484f58`,red:`#ff7b72`,green:`#3fb950`,yellow:`#d29922`,blue:`#58a6ff`,magenta:`#bc8cff`,cyan:`#39c5cf`,white:`#b1bac4`,brightBlack:`#6e7681`,brightRed:`#ffa198`,brightGreen:`#56d364`,brightYellow:`#e3b341`,brightBlue:`#79c0ff`,brightMagenta:`#d2a8ff`,brightCyan:`#56d4dd`,brightWhite:`#ffffff`}},{id:`gruvbox-dark`,name:`Gruvbox Dark (Medium)`,source:`jdinhify/vscode-theme-gruvbox`,colors:{background:`#282828`,foreground:`#ebdbb2`,cursor:`#ebdbb2`,cursorAccent:`#282828`,selectionBackground:`#504945`,selectionForeground:`#ebdbb2`,black:`#3c3836`,red:`#cc241d`,green:`#98971a`,yellow:`#d79921`,blue:`#458588`,magenta:`#b16286`,cyan:`#689d6a`,white:`#a89984`,brightBlack:`#928374`,brightRed:`#fb4934`,brightGreen:`#b8bb26`,brightYellow:`#fabd2f`,brightBlue:`#83a598`,brightMagenta:`#d3869b`,brightCyan:`#8ec07c`,brightWhite:`#ebdbb2`}},{id:`monokai`,name:`Monokai`,source:`vscode/extensions/theme-monokai`,colors:{background:`#272822`,foreground:`#f8f8f2`,cursor:`#f8f8f0`,cursorAccent:`#272822`,selectionBackground:`#878b91`,selectionForeground:`#f8f8f2`,black:`#333333`,red:`#c4265e`,green:`#86b42b`,yellow:`#b3b42b`,blue:`#6a7ec8`,magenta:`#8c6bc8`,cyan:`#56adbc`,white:`#e3e3dd`,brightBlack:`#666666`,brightRed:`#f92672`,brightGreen:`#a6e22e`,brightYellow:`#e2e22e`,brightBlue:`#819aff`,brightMagenta:`#ae81ff`,brightCyan:`#66d9ef`,brightWhite:`#f8f8f2`}},{id:`night-owl`,name:`Night Owl`,source:`sdras/night-owl-vscode-theme`,colors:{background:`#011627`,foreground:`#d6deeb`,cursor:`#80a4c2`,cursorAccent:`#011627`,selectionBackground:`#1b90dd`,selectionForeground:`#d6deeb`,black:`#011627`,red:`#ef5350`,green:`#22da6e`,yellow:`#c5e478`,blue:`#82aaff`,magenta:`#c792ea`,cyan:`#21c7a8`,white:`#ffffff`,brightBlack:`#575656`,brightRed:`#ef5350`,brightGreen:`#22da6e`,brightYellow:`#ffeb95`,brightBlue:`#82aaff`,brightMagenta:`#c792ea`,brightCyan:`#7fdbca`,brightWhite:`#ffffff`}},{id:`nord`,name:`Nord`,source:`arcticicestudio/nord-visual-studio-code`,colors:{background:`#2e3440`,foreground:`#d8dee9`,cursor:`#d8dee9`,cursorAccent:`#2e3440`,selectionBackground:`#434c5e`,selectionForeground:`#eceff4`,black:`#3b4252`,red:`#bf616a`,green:`#a3be8c`,yellow:`#ebcb8b`,blue:`#81a1c1`,magenta:`#b48ead`,cyan:`#88c0d0`,white:`#e5e9f0`,brightBlack:`#4c566a`,brightRed:`#bf616a`,brightGreen:`#a3be8c`,brightYellow:`#ebcb8b`,brightBlue:`#81a1c1`,brightMagenta:`#b48ead`,brightCyan:`#8fbcbb`,brightWhite:`#eceff4`}},{id:`one-dark-pro`,name:`One Dark Pro`,source:`Binaryify/OneDark-Pro`,colors:{background:`#282c34`,foreground:`#abb2bf`,cursor:`#abb2bf`,cursorAccent:`#282c34`,selectionBackground:`#3e4452`,selectionForeground:`#abb2bf`,black:`#3f4451`,red:`#e05561`,green:`#8cc265`,yellow:`#d18f52`,blue:`#4aa5f0`,magenta:`#c162de`,cyan:`#42b3c2`,white:`#d7dae0`,brightBlack:`#4f5666`,brightRed:`#ff616e`,brightGreen:`#a5e075`,brightYellow:`#f0a45d`,brightBlue:`#4dc4ff`,brightMagenta:`#de73ff`,brightCyan:`#4cd1e0`,brightWhite:`#e6e6e6`}},{id:`solarized-dark`,name:`Solarized Dark`,source:`vscode/extensions/theme-solarized-dark`,colors:{background:`#002b36`,foreground:`#839496`,cursor:`#d30102`,cursorAccent:`#002b36`,selectionBackground:`#274642`,selectionForeground:`#93a1a1`,black:`#073642`,red:`#dc322f`,green:`#859900`,yellow:`#b58900`,blue:`#268bd2`,magenta:`#d33682`,cyan:`#2aa198`,white:`#eee8d5`,brightBlack:`#002b36`,brightRed:`#cb4b16`,brightGreen:`#586e75`,brightYellow:`#657b83`,brightBlue:`#839496`,brightMagenta:`#6c71c4`,brightCyan:`#93a1a1`,brightWhite:`#fdf6e3`}},{id:`synthwave-84`,name:`SynthWave '84`,source:`robb0wen/synthwave-vscode`,colors:{background:`#262335`,foreground:`#ffffff`,cursor:`#03edf9`,cursorAccent:`#262335`,selectionBackground:`#463465`,selectionForeground:`#ffffff`,black:`#2a2139`,red:`#fe4450`,green:`#72f1b8`,yellow:`#f3e70f`,blue:`#03edf9`,magenta:`#ff7edb`,cyan:`#03edf9`,white:`#ffffff`,brightBlack:`#495495`,brightRed:`#fe4450`,brightGreen:`#72f1b8`,brightYellow:`#fede5d`,brightBlue:`#03edf9`,brightMagenta:`#ff7edb`,brightCyan:`#03edf9`,brightWhite:`#ffffff`}},{id:`tokyo-night`,name:`Tokyo Night`,source:`enkia/tokyo-night-vscode-theme`,colors:{background:`#1a1b26`,foreground:`#a9b1d6`,cursor:`#c0caf5`,cursorAccent:`#1a1b26`,selectionBackground:`#515c7e`,selectionForeground:`#c0caf5`,black:`#363b54`,red:`#f7768e`,green:`#73daca`,yellow:`#e0af68`,blue:`#7aa2f7`,magenta:`#bb9af7`,cyan:`#7dcfff`,white:`#787c99`,brightBlack:`#363b54`,brightRed:`#f7768e`,brightGreen:`#73daca`,brightYellow:`#e0af68`,brightBlue:`#7aa2f7`,brightMagenta:`#bb9af7`,brightCyan:`#7dcfff`,brightWhite:`#acb0d0`}},{id:`tokyo-night-storm`,name:`Tokyo Night Storm`,source:`enkia/tokyo-night-vscode-theme`,colors:{background:`#24283b`,foreground:`#a9b1d6`,cursor:`#c0caf5`,cursorAccent:`#24283b`,selectionBackground:`#6f7bb6`,selectionForeground:`#c0caf5`,black:`#414868`,red:`#f7768e`,green:`#73daca`,yellow:`#e0af68`,blue:`#7aa2f7`,magenta:`#bb9af7`,cyan:`#7dcfff`,white:`#8089b3`,brightBlack:`#414868`,brightRed:`#f7768e`,brightGreen:`#73daca`,brightYellow:`#e0af68`,brightBlue:`#7aa2f7`,brightMagenta:`#bb9af7`,brightCyan:`#7dcfff`,brightWhite:`#a9b1d6`}}];iF.id;var oF=e=>e?aF.find(t=>t.id===e)??iF:iF,sF=`text-[10px] font-medium tracking-wide text-muted-foreground/70 uppercase`,cF=`text-xs font-normal text-muted-foreground`,lF=Object.fromEntries(XP.map(e=>[e.id,{fontFamily:e.family}])),uF=aF.map(e=>({id:e.id,label:e.name})),dF=XP.map(e=>({id:e.id,label:e.name,itemStyle:lF[e.id]})),fF=jP.map(e=>({id:e.id,label:e.name})),pF=eF.map(e=>({id:String(e.value),label:e.label})),mF=e=>e.toFixed(1),hF=({label:e,value:t,title:n,valueClassName:r})=>(0,y.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,y.jsx)(`dt`,{className:cF,children:e}),(0,y.jsx)(`dd`,{title:n??t,className:rp(`min-w-0 truncate text-right text-foreground/90`,r),children:t})]}),gF=({themeId:e,onThemeChange:t,onThemePreview:n,fontId:r,onFontChange:i,onFontPreview:a,nerdFontEnabled:o,onNerdFontEnabledChange:s,fontSize:c,onFontSizeChange:l,lineHeight:u,onLineHeightChange:d,paddingX:f,onPaddingXChange:p,paddingY:m,onPaddingYChange:h,cursorStyle:g,onCursorStyleChange:_,onCursorStylePreview:v,cursorBlink:x,onCursorBlinkChange:S,scrollback:C,onScrollbackChange:w,scrollOnUserInput:T,onScrollOnUserInputChange:E,notificationsPermission:D,onNotificationsPermissionRequest:O,sessionInfo:k,onPopoverOpenChange:A,onClose:j})=>{let[M,N]=(0,b.useState)(!1),[P,F]=(0,b.useState)(!1),I=(0,b.useRef)(null);return(0,y.jsxs)(XN,{open:M,onOpenChange:e=>{N(e),A?.(e),e||(F(!1),n?.(null),a?.(null),v?.(null),j?.())},children:[(0,y.jsx)(ZN,{render:(0,y.jsx)(Xx,{variant:`ghost`,size:`icon-sm`,"aria-label":`terminal settings`,className:`hover:text-foreground`}),children:(0,y.jsx)(Dd,{})}),(0,y.jsx)(QN,{ref:I,side:`bottom`,align:`end`,sideOffset:8,className:rp(`w-64 gap-0 overflow-hidden p-3`,Lx,Rx),children:(0,y.jsxs)(EN,{className:`gap-3`,children:[(0,y.jsxs)(ON,{orientation:`vertical`,className:`gap-1.5`,children:[(0,y.jsx)(kN,{className:sF,children:`Theme`}),(0,y.jsx)(aN,{value:e,items:uF,ariaLabel:`select theme`,placeholder:`Theme`,onValueChange:e=>{e&&t(e)},onOpenChange:e=>{e||n?.(null)},onItemHover:n?e=>n(e):void 0})]}),(0,y.jsx)(ij,{className:`bg-border/40`}),(0,y.jsxs)(ON,{orientation:`vertical`,className:`gap-1.5`,children:[(0,y.jsx)(kN,{className:sF,children:`Font`}),(0,y.jsx)(aN,{value:r,items:dF,ariaLabel:`select font`,placeholder:`Font`,open:P,onValueChange:e=>{e&&i(e)},onOpenChange:e=>{F(e),e||a?.(null)},onItemHover:a?e=>a(e):void 0}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,y.jsx)(`span`,{className:cF,children:`Size`}),(0,y.jsx)(fj,{value:c,min:9,max:24,step:1,ariaLabel:`terminal font size`,decrementAriaLabel:`decrease font size`,incrementAriaLabel:`increase font size`,onValueChange:l})]}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,y.jsx)(`span`,{className:cF,children:`Line height`}),(0,y.jsx)(fj,{value:u,min:1,max:2,step:BS,ariaLabel:`terminal line height`,decrementAriaLabel:`decrease line height`,incrementAriaLabel:`increase line height`,formatDisplay:mF,onValueChange:d})]}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,y.jsxs)(OP,{children:[(0,y.jsx)(kP,{render:(0,y.jsx)(`span`,{className:cF}),children:`Nerd Font icons`}),(0,y.jsx)(AP,{side:`bottom`,sideOffset:8,className:`max-w-xs`,children:`Appends a Symbols Only Nerd Font to the font stack. Icon glyphs (Private Use Area codepoints) are resolved by the symbols font while all other characters render from the primary font above.`})]}),(0,y.jsx)(aP,{"aria-label":`toggle nerd font icons`,checked:o,onCheckedChange:s})]})]}),(0,y.jsx)(ij,{className:`bg-border/40`}),(0,y.jsxs)(ON,{orientation:`vertical`,className:`gap-1.5`,children:[(0,y.jsx)(kN,{className:sF,children:`Window`}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,y.jsx)(`span`,{className:cF,children:`Pad X`}),(0,y.jsx)(fj,{value:f,min:0,max:48,step:1,ariaLabel:`terminal horizontal padding`,decrementAriaLabel:`decrease horizontal padding`,incrementAriaLabel:`increase horizontal padding`,onValueChange:p})]}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,y.jsx)(`span`,{className:cF,children:`Pad Y`}),(0,y.jsx)(fj,{value:m,min:0,max:48,step:1,ariaLabel:`terminal vertical padding`,decrementAriaLabel:`decrease vertical padding`,incrementAriaLabel:`increase vertical padding`,onValueChange:h})]})]}),(0,y.jsx)(ij,{className:`bg-border/40`}),(0,y.jsxs)(ON,{orientation:`vertical`,className:`gap-1.5`,children:[(0,y.jsx)(kN,{className:sF,children:`Notifications`}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,y.jsxs)(OP,{children:[(0,y.jsx)(kP,{render:(0,y.jsx)(`span`,{className:cF}),children:`Desktop alerts`}),(0,y.jsx)(AP,{side:`bottom`,sideOffset:8,className:`max-w-xs`,children:`When on, OSC 9 sequences from the shell trigger browser notifications. Enable to receive alerts when the tab is in the background. Blocked permissions must be changed in browser settings.`})]}),(0,y.jsx)(aP,{"aria-label":`toggle desktop notifications`,checked:D===`granted`,disabled:D===`unsupported`||D===`denied`,onCheckedChange:e=>{e&&O()}})]})]}),(0,y.jsx)(ij,{className:`bg-border/40`}),(0,y.jsxs)(ON,{orientation:`vertical`,className:`gap-1.5`,children:[(0,y.jsx)(kN,{className:sF,children:`Cursor`}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,y.jsx)(`span`,{className:cF,children:`Style`}),(0,y.jsx)(aN,{value:g,items:fF,ariaLabel:`select cursor style`,placeholder:`Cursor style`,triggerClassName:`w-fit min-w-[7rem]`,onValueChange:e=>{PP(e)&&_(e)},onOpenChange:e=>{e||v?.(null)},onItemHover:v?e=>{PP(e)&&v?.(e)}:void 0})]}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,y.jsx)(`span`,{className:cF,children:`Blink`}),(0,y.jsx)(aP,{"aria-label":`toggle cursor blink`,checked:x,onCheckedChange:S})]})]}),(0,y.jsx)(ij,{className:`bg-border/40`}),(0,y.jsxs)(ON,{orientation:`vertical`,className:`gap-1.5`,children:[(0,y.jsx)(kN,{className:sF,children:`Scrollback`}),(0,y.jsx)(aN,{value:String(C),items:pF,ariaLabel:`select scrollback`,placeholder:`Scrollback`,onValueChange:e=>{if(e===null)return;let t=Number(e);rF(t)&&w(t)}}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,y.jsxs)(OP,{children:[(0,y.jsx)(kP,{render:(0,y.jsx)(`span`,{className:cF}),children:`Pin to bottom on input`}),(0,y.jsx)(AP,{side:`bottom`,sideOffset:8,className:`max-w-xs`,children:`When on, typing scrolls the viewport back to the bottom. When off, the viewport stays where you scrolled — useful for reading history while typing.`})]}),(0,y.jsx)(aP,{"aria-label":`toggle pin to bottom on input`,checked:T,onCheckedChange:E})]})]}),k?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(ij,{className:`bg-border/40`}),(0,y.jsxs)(SN,{defaultOpen:!1,children:[(0,y.jsx)(CN,{render:(0,y.jsxs)(`button`,{type:`button`,className:`group/shell flex w-full items-center justify-between gap-2 rounded-sm py-1 text-left transition-colors outline-none hover:text-foreground/90 focus-visible:text-foreground/90`,children:[(0,y.jsx)(`span`,{className:sF,children:`Shell`}),(0,y.jsx)(fd,{className:`size-3 text-muted-foreground/60 transition-transform duration-200 ease-snappy will-change-transform group-aria-expanded/shell:rotate-180`})]})}),(0,y.jsx)(wN,{className:`h-(--collapsible-panel-height) overflow-hidden transition-[height] duration-200 ease-snappy data-closed:h-0`,children:(0,y.jsxs)(`dl`,{className:`flex flex-col gap-1 pt-2 text-xs`,children:[(0,y.jsx)(hF,{label:`Name`,value:k.shellName}),(0,y.jsx)(hF,{label:`Path`,value:k.shell,title:k.shell}),(0,y.jsx)(hF,{label:`PID`,value:String(k.pid),valueClassName:`tabular-nums`}),(0,y.jsx)(hF,{label:`Cwd`,value:k.cwd,title:k.cwd})]})})]})]}):null]})})]})},_F=e=>{let[t,n]=(0,b.useState)(null);return(0,b.useEffect)(()=>{if(n(null),!e)return;let t=!1,r=null,i=null,a=()=>{t||(r!==null&&window.clearTimeout(r),r=window.setTimeout(o,qS))},o=()=>{if(r!==null&&(window.clearTimeout(r),r=null),!t){if(document.hidden){a();return}i?.abort(),i=new AbortController,bA(e,i.signal).then(e=>{t||(e&&n(e),a())})}},s=()=>{document.hidden||o()};return document.addEventListener(`visibilitychange`,s),o(),()=>{t=!0,document.removeEventListener(`visibilitychange`,s),r!==null&&window.clearTimeout(r),i?.abort()}},[e]),t},vF=2.4,yF=.04045,bF=12.92,xF=.055,SF=1.055,CF=.0031308,wF=24389/27,TF=216/24389,EF=.95047,DF=1,OF=1.08883,kF=.008856,AF=7.787,jF=e=>{let t=e/255;return t<=yF?t/bF:((t+xF)/SF)**+vF},MF=e=>e<=0?0:e>=1?255:Math.round(e<=CF?bF*e*255:(SF*e**(1/vF)-xF)*255),NF=e=>e>kF?Math.cbrt(e):AF*e+16/116,PF=e=>{let t=jF(e.r),n=jF(e.g),r=jF(e.b);return{x:.4124564*t+.3575761*n+.1804375*r,y:.2126729*t+.7151522*n+.072175*r,z:.0193339*t+.119192*n+.9503041*r}},FF=e=>{let t=3.2404542*e.x-1.5371385*e.y-.4985314*e.z,n=-.969266*e.x+1.8760108*e.y+.041556*e.z,r=.0556434*e.x-.2040259*e.y+1.0572252*e.z;return{r:MF(t),g:MF(n),b:MF(r)}},IF=e=>{let t=e.x/EF,n=e.y/DF,r=e.z/OF,i=NF(t),a=NF(n),o=NF(r);return{l:116*a-16,a:500*(i-a),b:200*(a-o)}},LF=(e,t)=>{let n=e*e*e;return n>TF?t*n:t*((116*e-16)/wF)},RF=e=>{let t=(e.l+16)/116,n=e.a/500+t,r=t-e.b/200;return{x:LF(n,EF),y:LF(t,DF),z:LF(r,OF)}},zF=e=>IF(PF(e)),BF=e=>FF(RF(e)),VF=e=>{let t=e.replace(/^#/,``);return{r:parseInt(t.slice(0,2),16),g:parseInt(t.slice(2,4),16),b:parseInt(t.slice(4,6),16)}},HF=e=>{let t=Math.max(0,Math.min(255,Math.round(e.r))),n=Math.max(0,Math.min(255,Math.round(e.g))),r=Math.max(0,Math.min(255,Math.round(e.b)));return`#${t.toString(16).padStart(2,`0`)}${n.toString(16).padStart(2,`0`)}${r.toString(16).padStart(2,`0`)}`},UF=e=>zF(VF(e)),WF=e=>HF(BF(e)),GF=6,KF=5,qF=24,JF=25,YF=(e,t,n)=>({l:t.l+e*(n.l-t.l),a:t.a+e*(n.a-t.a),b:t.b+e*(n.b-t.b)}),XF=(e,t=!1)=>{let n=e.background??`#000000`,r=e.foreground??`#ffffff`,i=[UF(n),UF(e.red??`#ff0000`),UF(e.green??`#00ff00`),UF(e.yellow??`#ffff00`),UF(e.blue??`#0000ff`),UF(e.magenta??`#ff00ff`),UF(e.cyan??`#00ffff`),UF(r)];if(i[7].l<i[0].l&&!t){let e=i[0];i[0]=i[7],i[7]=e}let a=[];for(let e=0;e<GF;e++){let t=YF(e/KF,i[0],i[1]),n=YF(e/KF,i[2],i[3]),r=YF(e/KF,i[4],i[5]),o=YF(e/KF,i[6],i[7]);for(let e=0;e<GF;e++){let i=YF(e/KF,t,n),s=YF(e/KF,r,o);for(let e=0;e<GF;e++){let t=YF(e/KF,i,s);a.push(WF(t))}}}for(let e=0;e<qF;e++){let t=(e+1)/JF;a.push(WF(YF(t,i[0],i[7])))}return a},ZF=`Symbols Nerd Font`,QF=``,$F=async e=>{if(!(typeof document>`u`)&&e.name)try{await document.fonts.ready;let t=[document.fonts.load(`16px "${e.name}"`),document.fonts.load(`bold 16px "${e.name}"`),document.fonts.load(`16px "${ZF}"`,QF),document.fonts.load(`bold 16px "${ZF}"`,QF)];await Promise.all(t)}catch{}},eI=(e,t)=>`\x1b[${e};${t+1}u`,tI=e=>{let t=e.buffer.active,n=Math.max(0,t.baseY-t.viewportY);return{distanceFromBottom:n,wasAtBottom:n===0}},nI=[[127995,127999],[128732,128735],[129008,129008],[129401,129401],[129484,129484],[129653,129655],[129659,129660],[129671,129672],[129705,129711],[129719,129725],[129727,129727],[129731,129733],[129742,129743],[129751,129755],[129760,129768],[129776,129784]],rI=e=>{if(e<127995||e>129784)return!1;for(let[t,n]of nI)if(e>=t&&e<=n)return!0;return!1},iI=6,aI=4,oI=class{version=`15-graphemes-emoji`;base;constructor(e){this.base=e}wcwidth(e){return rI(e)?2:this.base.wcwidth(e)}charProperties(e,t){let n=this.base.charProperties(e,t);return rI(e)?n&~iI|aI:n}},sI=e=>!!e.shiftKey|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0),cI=(e,t)=>{let n=e.buffer.active,r=Math.max(0,n.baseY-n.viewportY),i=r===0;try{t.fit()}catch{return!1}try{if(i)return e.scrollToBottom(),!0;let t=e.buffer.active;if(r>t.baseY)return e.scrollToBottom(),!0;let n=t.baseY-r-t.viewportY;n!==0&&e.scrollLines(n)}catch{}return!0},lI=(e,t)=>`\r\n\r\n\x1b[2;31m[connection lost · code ${e}${t?` · ${t}`:``}]\x1b[0m\r\n`,uI={block:{blink:`\x1B[1 q`,steady:`\x1B[2 q`},underline:{blink:`\x1B[3 q`,steady:`\x1B[4 q`},bar:{blink:`\x1B[5 q`,steady:`\x1B[6 q`}},dI=(e,t)=>{let n=t?`blink`:`steady`;return`\x1b[?25h${uI[e][n]}`},fI=(e,t)=>`${dI(e,t)}\r\n\x1b[2;32m[reconnected]\x1b[0m\r\n\r\n`,pI=e=>`\r\n\x1b[2;31m[${e===null?`shell exited`:`shell exited with code ${e}`}]\x1b[0m\r\n`,mI=55296,hI=56319,gI=(e,t)=>{if(e.length<=t)return[e];let n=[],r=0;for(;r<e.length;){let i=Math.min(r+t,e.length);if(i<e.length){let t=e.charCodeAt(i-1);t>=mI&&t<=hI&&--i}i===r&&(i=r+t),n.push(e.slice(r,i)),r=i}return n},_I=(e,t)=>{if(t.wasAtBottom){e.scrollToBottom();return}let n=e.buffer.active;if(t.distanceFromBottom>n.baseY){e.scrollToBottom();return}let r=n.baseY-t.distanceFromBottom-n.viewportY;r!==0&&e.scrollLines(r)},vI=new class{terminal=null;chunks=[];scheduled=!1;afterFlush=null;attach(e){this.terminal=e}setAfterFlush(e){this.afterFlush=e}detach(){this.flush(),this.terminal=null,this.afterFlush=null}push(e){this.chunks.push(e),this.scheduled||(this.scheduled=!0,queueMicrotask(()=>this.flush()))}flush(){this.scheduled=!1;let e=this.chunks,t=this.terminal;this.chunks=[],!(!t||e.length===0)&&(e.length===1?t.write(e[0]):t.write(e.join(``)),this.afterFlush?.())}},yI=e=>e[0]===3,bI=e=>{if(!Number.isFinite(e))return 13;let t=Math.round(e);return t<9?9:t>24?24:t},xI=1/BS,SI=e=>Math.round(e*xI)/xI,CI=e=>{if(!Number.isFinite(e))return zS;let t=SI(e);return t<1?1:t>2?2:t},wI=1/1,TI=e=>Math.round(e*wI)/wI,EI=e=>{if(!Number.isFinite(e))return 0;let t=TI(e);return t<0?0:t>48?48:t},DI=e=>{if(!Number.isFinite(e))return 0;let t=TI(e);return t<0?0:t>48?48:t},OI=()=>{if(typeof navigator>`u`)return!1;let e=navigator.platform||navigator.userAgent||``;return/Mac|iPhone|iPad|iPod/i.test(e)},kI=e=>e<1e3?String(e):e<1e4?`${(e/1e3).toFixed(1).replace(/\.0$/,``)}k`:`${Math.round(e/1e3)}k`,AI=(e,t,n)=>e.key!==t&&e.key!==t.toUpperCase()?!1:n?e.metaKey&&!e.ctrlKey&&!e.altKey:e.ctrlKey&&!e.metaKey&&!e.altKey,jI=(e,t)=>AI(e,`k`,t),MI=(e,t)=>AI(e,`g`,t),NI=(e,t)=>AI(e,`f`,t),PI=(e,t)=>e.code===`Backslash`?e.altKey&&!e.metaKey&&!e.ctrlKey?!0:t?e.metaKey&&!e.ctrlKey&&!e.altKey:e.ctrlKey&&!e.metaKey&&!e.altKey:!1,FI=NA(aC,!0),II=FI.load,LI=FI.store,RI=PA(iC,MP,PP),zI=RI.load,BI=RI.store,VI=FA(tC,e=>ZP(e).id,e=>e),HI=VI.load,UI=VI.store,WI=MA(nC,13,bI),GI=WI.load,KI=WI.store,qI=MA(rC,zS,CI),JI=qI.load,YI=qI.store,XI=MA(oC,tF,e=>rF(e)?e:tF),ZI=XI.load,QI=XI.store,$I=NA(sC,!0),eL=$I.load,tL=$I.store,nL=FA(eC,e=>oF(e).id,e=>e),rL=nL.load,iL=nL.store,aL=MA(cC,0,EI),oL=aL.load,sL=aL.store,cL=MA(lC,0,DI),lL=cL.load,uL=cL.store,dL=NA(dC,!1),fL=dL.load,pL=dL.store,mL=`<path d='m6 8 4 4-4 4M12 16h6'/>`,hL=[`<circle cx='7' cy='12' r='1.5' fill='currentColor' stroke='none'/>`,`<circle cx='12' cy='12' r='1.5' fill='currentColor' stroke='none'/>`,`<circle cx='17' cy='12' r='1.5' fill='currentColor' stroke='none'/>`].join(``),gL={ready:`hsl(220 8% 46%)`,running:`hsl(142 72% 45%)`,"alive-quiet":`hsl(210 65% 50%)`,dead:`hsl(0 72% 50%)`},_L={ready:`hsl(220 10% 16%)`,running:`hsl(142 85% 12%)`,"alive-quiet":`hsl(210 70% 14%)`,dead:`hsl(0 80% 12%)`},vL={ready:mL,running:hL,"alive-quiet":mL,dead:mL},yL=`<circle cx='19' cy='7' r='3.5' fill='hsl(0 72% 50%)' stroke='white' stroke-width='1.5'/>`,bL=(e,t=!1)=>{let n=gL[e],r=_L[e],i=vL[e],a=t?yL:``;return[`<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' color='${r}' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' opacity='${e===`dead`?KS:1}'>`,`<rect x='2' y='4' width='20' height='16' rx='2' fill='${n}'/>`,i,a,`</svg>`].join(``)},xL=`ready`,SL=null,CL=!1,wL=(e,t)=>SL===null||e!==xL||t!==CL,TL=(e,t)=>{xL=e,SL=e,CL=t},EL=()=>{xL=`ready`,SL=null,CL=!1},DL=(e,t=!1)=>{if(typeof document>`u`||!wL(e,t))return;TL(e,t);let n=`data:image/svg+xml,${encodeURIComponent(bL(e,t))}`,r=document.querySelector(`link[rel="icon"]`);r||(r=document.createElement(`link`),r.rel=`icon`,document.head.appendChild(r)),r.type=`image/svg+xml`,r.href=n},OL=`/api/health`,kL=async()=>{try{return(await fetch(OL)).ok}catch{return!1}},AL=(e,t)=>t.buffer.active.type!==`alternate`||t.modes.mouseTrackingMode!==`none`?!1:e.deltaMode===WheelEvent.DOM_DELTA_PIXEL,jL=e=>e||`localterm`,ML=e=>`${HS}${e||`localterm`}`,NL={matchBackground:ZS,activeMatchBackground:QS,activeMatchBorder:$S,matchOverviewRuler:QS,activeMatchColorOverviewRuler:$S},PL=`cwd`,FL=e=>{let t=new URL(`/ws`,window.location.href);t.protocol=t.protocol===`https:`?`wss:`:`ws:`;let n=e??new URLSearchParams(window.location.search).get(PL);return n&&t.searchParams.set(PL,n),t.toString()},IL=e=>{let t=new URL(window.location.origin);return e&&t.searchParams.set(PL,e),t.toString()},LL=({onModalOpenChange:e,onForegroundProcessChange:t}={})=>{let n=(0,b.useRef)(null),r=(0,b.useRef)(null),i=(0,b.useRef)(!1),a=(0,b.useRef)(null),o=(0,b.useRef)(null),s=(0,b.useRef)(null),c=(0,b.useRef)(null),l=(0,b.useRef)(null),u=(0,b.useRef)(null),d=(0,b.useRef)(null),f=(0,b.useRef)(null),p=(0,b.useRef)(rL()),m=(0,b.useRef)(HI()),h=(0,b.useRef)(GI()),g=(0,b.useRef)(JI()),_=(0,b.useRef)(zI()),v=(0,b.useRef)(II()),x=(0,b.useRef)(ZI()),C=(0,b.useRef)(eL()),w=(0,b.useRef)(oL()),T=(0,b.useRef)(lL()),E=(0,b.useRef)(fL()),O=(0,b.useRef)(null),k=(0,b.useRef)(null),A=(0,b.useRef)(null),j=(0,b.useRef)(null),M=(0,b.useRef)(null),[N,P]=(0,b.useState)(null),[F,I]=(0,b.useState)(0),[L,R]=(0,b.useState)(!1),[z,ee]=(0,b.useState)(!1),[B,te]=(0,b.useState)(!1),[V,H]=(0,b.useState)(!1),ne=(0,b.useRef)(null),[U,re]=(0,b.useState)(0),[W,ie]=(0,b.useState)(!1),[ae,oe]=(0,b.useState)(!1),se=(0,b.useRef)(null),ce=(0,b.useRef)(!1),le=W||ae;ce.current=ae;let[ue,de]=(0,b.useState)(``),[fe,pe]=(0,b.useState)({resultIndex:-1,resultCount:0}),[me,he]=(0,b.useState)(p.current),[ge,_e]=(0,b.useState)(null),ve=ge??me,ye=(0,b.useMemo)(()=>oF(ve),[ve]),be=(0,b.useMemo)(()=>({...ye.colors,extendedAnsi:XF(ye.colors)}),[ye]),[xe,Se]=(0,b.useState)(m.current),[Ce,we]=(0,b.useState)(null),Te=Ce??xe,[Ee,De]=(0,b.useState)(E.current),Oe=(0,b.useMemo)(()=>ZP(Te),[Te]),[ke,Ae]=(0,b.useState)(h.current),[je,Me]=(0,b.useState)(g.current),[Ne,Pe]=(0,b.useState)(_.current),[Fe,Ie]=(0,b.useState)(null),Le=Fe??Ne,[Re,ze]=(0,b.useState)(v.current),[Be,Ve]=(0,b.useState)(x.current),[He,Ue]=(0,b.useState)(C.current),[We,Ge]=(0,b.useState)(w.current),[qe,Ye]=(0,b.useState)(T.current),[Xe,Ze]=(0,b.useState)(null),[Qe,$e]=(0,b.useState)(`Notification`in window?Notification.permission:`unsupported`),[et,tt]=(0,b.useState)(null),nt=(0,b.useRef)(null),rt=(0,b.useRef)(!1),it=(0,b.useMemo)(OI,[]),[at,ot]=(0,b.useState)(!1),st=_F(et),ct=st!==null&&st.isRepo&&st.files>0;(0,b.useEffect)(()=>{let e=n.current;if(!e)return;let l=!1,u=!1,d=!1,y=``,b=null,w=null,T=null,N=null,F=null,L=0,R=`ready`,z=!1,ee=!1,B=[0],te=()=>B[B.length-1]??0,V=()=>{let e=performance.now()-L;if(e<750){F=window.setTimeout(V,750-e);return}F=null,N!==null&&(window.clearTimeout(N),N=null),R===`running`&&(document.hidden&&(z=!0),ee?(R=`alive-quiet`,DL(`alive-quiet`,z)):(R=`ready`,DL(`ready`,z)))},H=()=>{R!==`running`&&N===null&&(N=window.setTimeout(()=>{N=null,!(l||u)&&(R=`running`,z=!1,DL(`running`))},250)),L=performance.now(),F===null&&(F=window.setTimeout(V,750))},U=()=>{N!==null&&(window.clearTimeout(N),N=null),F!==null&&(window.clearTimeout(F),F=null),(R!==`ready`||z)&&(R=`ready`,z=!1,DL(`ready`))},re=ZP(m.current);$F(re).then(()=>{if(l)return;let e=r.current;e&&e.clearTextureAtlas(),W._core._charSizeService.measure(),je()});let W=new $u({allowProposedApi:!0,cursorBlink:v.current,cursorStyle:_.current,fontFamily:QP(re,E.current),fontSize:h.current,lineHeight:g.current,scrollback:x.current,theme:{...oF(p.current).colors,extendedAnsi:XF(oF(p.current).colors)},macOptionIsMeta:!0,scrollOnUserInput:C.current,windowOptions:{getWinSizePixels:!0,getCellSizePixels:!0,getWinSizeChars:!0},scrollbar:{showScrollbar:!1}});r.current=W,vI.attach(W);let ie=new D;O.current=ie,W.loadAddon(ie),W.loadAddon(new Mn),W.loadAddon(new S),W.loadAddon(new Ke),W.loadAddon(new Je),W.loadAddon(new En);let ae=W._core.unicodeService._activeProvider;W.unicode.register(new oI(ae)),W.unicode.activeVersion=`15-graphemes-emoji`;let oe=new lt;W.loadAddon(oe),o.current=oe;let se=oe.onDidChangeResults(pe);W.open(e),ie.proposeDimensions&&=()=>{if(!W||!W.element||!W.element.parentElement)return;let e=W,t=e._core._renderService.dimensions.css.cell.width,n=e._core._renderService.dimensions.css.cell.height;if(t===0||n===0)return;let r=window.getComputedStyle(W.element.parentElement),i=window.getComputedStyle(W.element),a=Math.max(0,parseInt(r.getPropertyValue(`width`)))-(parseInt(i.getPropertyValue(`padding-right`))+parseInt(i.getPropertyValue(`padding-left`))),o=parseInt(r.getPropertyValue(`height`))-(parseInt(i.getPropertyValue(`padding-top`))+parseInt(i.getPropertyValue(`padding-bottom`)));return{cols:Math.max(2,Math.floor(a/t)),rows:Math.max(1,Math.floor(o/n))}};let ce=()=>{let e=W.buffer.active,t=e.length,n=W.rows,r=e.viewportY+n>=t,i=t>n,a=j.current,o=M.current;if(!(!a||!o)&&(a.classList.toggle(`xterm-scrollbar-visible`,!r&&i),i)){let r=n/t,i=e.viewportY/t;o.style.height=`${r*100}%`,o.style.top=`${i*100}%`}};ce();let le=W.onScroll(ce);vI.setAfterFlush(ce);let ue=!1,de=0,fe=0,me=e=>{if(e.button===0){ue=!0,de=e.clientY,fe=W.buffer.active.viewportY;try{e.target.setPointerCapture(e.pointerId)}catch{}e.preventDefault()}},he=e=>{if(!ue)return;let t=j.current;if(!t)return;let n=t.clientHeight,r=W.buffer.active.length-W.rows;if(r<=0||n<=0)return;let i=n/r,a=e.clientY-de,o=Math.max(0,Math.min(r,fe+Math.round(a/i)));o!==W.buffer.active.viewportY&&W.scrollLines(o-W.buffer.active.viewportY)},ge=()=>{ue=!1},_e=e=>{if(e.button!==0||e.target===M.current)return;let t=j.current;if(!t)return;let n=t.getBoundingClientRect(),r=(e.clientY-n.top)/n.height,i=W.buffer.active,a=i.length,o=Math.max(0,Math.min(a-W.rows,Math.round(r*a)-Math.floor(W.rows/2)));W.scrollLines(o-i.viewportY)},ve=M.current,ye=j.current;ve&&(ve.addEventListener(`pointerdown`,me),ve.addEventListener(`pointermove`,he),ve.addEventListener(`pointerup`,ge),ve.addEventListener(`pointercancel`,ge)),ye&&ye.addEventListener(`pointerdown`,_e);try{let e=new ia;e.onContextLoss(()=>e.dispose()),W.loadAddon(e)}catch{}let be=W.parser.registerCsiHandler({prefix:`>`,final:`u`},e=>{let t=e[0],n=typeof t==`number`?t:1;return B.push(n),!0}),xe=W.parser.registerCsiHandler({prefix:`<`,final:`u`},e=>{let t=e[0],n=typeof t==`number`&&t>0?t:1;for(let e=0;e<n&&B.length>1;e+=1)B.pop();return!0}),Se=W.parser.registerCsiHandler({prefix:`=`,final:`u`},e=>{let t=e[0],n=e[1];if(typeof t!=`number`)return!0;let r=t,i=typeof n==`number`&&n>0?n:1,a=B.length-1,o=B[a]??0;return i===1?B[a]=r:i===2?B[a]=o|r:i===3&&(B[a]=o&~r),!0}),Ce=W.parser.registerCsiHandler({final:`J`},yI),we=W.parser.registerCsiHandler({prefix:`?`,final:`J`},yI),Te=e=>{b?.readyState===WebSocket.OPEN&&b.send(JSON.stringify(e))},Ee=()=>{let e=f.current;e&&cancelAnimationFrame(e.frameId),f.current=null},De=()=>{let e=f.current;e&&_I(W,e.anchor)},Oe=e=>{Ee(),f.current={anchor:e,frameId:requestAnimationFrame(()=>{De(),f.current=null})}};W.attachCustomWheelEventHandler(e=>AL(e,W)?(e.preventDefault(),!1):!0),W.attachCustomKeyEventHandler(e=>{if(e.key===`Tab`&&(e.metaKey||e.ctrlKey))return!1;if(PI(e,it)){if(e.type===`keydown`){e.preventDefault();let t=document.getElementById(`new-shell-link`);t instanceof HTMLAnchorElement&&t.click()}return!1}if(jI(e,it))return e.type===`keydown`&&(e.preventDefault(),ne.current?.()),!1;if(MI(e,it))return e.type===`keydown`&&(e.preventDefault(),A.current?.()),!1;if(NI(e,it))return e.type===`keydown`&&(e.preventDefault(),k.current?.()),!1;if(e.type===`keydown`&&e.key===`Enter`){let t=sI(e),n=(te()&1)!=0;if(t!==0&&n)return e.preventDefault(),Te({type:`input`,data:eI(13,t)}),!1;if(t===1)return e.preventDefault(),Te({type:`input`,data:`
|
|
115
|
-
`}),!1}return!0});let ke=e=>{if(u)return;let t=e.trim();t&&(y=t,document.title=jL(t))};s.current=()=>W.focus(),c.current=e=>W.paste(e);let Ae=(e,t)=>{let n=W,r=n._core._renderService?.dimensions?.css?.canvas?.width,i=n._core._renderService?.dimensions?.css?.canvas?.height;Te({type:`resize`,cols:e,rows:t,...r!=null&&i!=null?{pixelWidth:Math.round(r),pixelHeight:Math.round(i)}:{}})},je=()=>{let e=tI(W);cI(W,ie)&&(Oe(e),Ae(W.cols,W.rows))},Me=()=>{T!==null&&window.clearTimeout(T),T=window.setTimeout(()=>{T=null,je()},80)};W.onData(e=>{for(let t of gI(e,kC))Te({type:`input`,data:t})}),W.onResize(({cols:e,rows:t})=>{Ae(e,t),ce()});let Ne=new ResizeObserver(Me),Pe=()=>{!document.hidden&&z&&(z=!1,DL(R))};document.addEventListener(`visibilitychange`,Pe),Ne.observe(e),je(),requestAnimationFrame(()=>W.focus());let Fe=e=>{if(!u){if(u=!0,e===null||e===0){window.close(),setTimeout(()=>{l||(U(),DL(`dead`),W.write(pI(e)),document.title=ML(y),P({reason:`shell-exited`,exitCode:e}),Ze(null))},100);return}U(),DL(`dead`),W.write(pI(e)),document.title=ML(y),P({reason:`shell-exited`,exitCode:e}),Ze(null)}},Ie=(e,t,n)=>{u||(u=!0,U(),DL(`dead`),W.write(lI(e,t)),document.title=ML(y),P({reason:`connection-lost`,closeCode:e,closeReason:t,wasClean:n}),Ze(null))},Le=()=>{if(l)return;let e=new WebSocket(FL(nt.current));b=e,e.addEventListener(`open`,()=>{l||b!==e||(d=!0,rt.current=!0,I(0),Ae(W.cols,W.rows))}),e.addEventListener(`message`,n=>{if(l||b!==e)return;let r;try{r=JSON.parse(typeof n.data==`string`?n.data:String(n.data))}catch{return}if(typeof r==`object`&&r&&r.type===`output`&&typeof r.data==`string`){let e=r.data;vI.push(e),H();return}let i=fA.safeParse(r);if(!i.success)return;let a=i.data;if(a.type===`title`)ke(a.title);else if(a.type===`session`)Ze({shell:a.shell,shellName:a.shellName,pid:a.pid,cwd:a.cwd,title:a.title}),tt(a.cwd),ke(a.title);else if(a.type===`cwd`)tt(a.cwd);else if(a.type===`foreground`){let e=a.process!==null;t?.(e),!e&&R===`alive-quiet`&&(R=`ready`,DL(`ready`,z)),ee=e}else a.type===`notification`?`Notification`in window&&Notification.permission===`granted`&&new Notification(a.body):a.type===`exit`&&(U(),Fe(a.code))}),e.addEventListener(`close`,t=>{if(b===e&&(b=null,rt.current=!1,!l&&!u)){if(d){console.warn(`[localterm] websocket closed: code=${t.code} reason=${JSON.stringify(t.reason)} wasClean=${t.wasClean}`),Ie(t.code,t.reason,t.wasClean);return}I(e=>e+1),w=window.setTimeout(Le,RS)}}),e.addEventListener(`error`,t=>{console.warn(`[localterm] websocket error`,t);try{e.close()}catch{}})};return a.current=()=>{if(!l){u=!1,d=!1,rt.current=!1,P(null),Ze(null),I(0),DL(`ready`),t?.(!1),w!==null&&(window.clearTimeout(w),w=null);try{b?.close()}catch{}b=null,Le()}},Le(),i.current=!0,()=>{l=!0,i.current=!1,ve&&(ve.removeEventListener(`pointerdown`,me),ve.removeEventListener(`pointermove`,he),ve.removeEventListener(`pointerup`,ge),ve.removeEventListener(`pointercancel`,ge)),ye&&ye.removeEventListener(`pointerdown`,_e),se.dispose(),le.dispose(),be.dispose(),xe.dispose(),Se.dispose(),Ce.dispose(),we.dispose(),w!==null&&window.clearTimeout(w),T!==null&&window.clearTimeout(T),Ee(),U(),document.removeEventListener(`visibilitychange`,Pe),Ne.disconnect();try{b?.close()}catch{}b=null,vI.detach(),W.dispose(),document.title=VS}},[]),(0,b.useEffect)(()=>{if(!i.current)return;let e=r.current;e&&(e.options.theme=be)},[be]),(0,b.useEffect)(()=>{if(!i.current||!r.current)return;let e=!1;return $F(Oe).then(()=>{if(e)return;let t=r.current;if(!t)return;t.options.fontFamily=QP(Oe,Ee),t.clearTextureAtlas();let n=O.current;n&&cI(t,n)}),()=>{e=!0}},[Oe,Ee]);let ut=(0,b.useCallback)(e=>{he(e),_e(null),iL(e)},[]),dt=(0,b.useCallback)(e=>{Se(e),we(null),UI(e)},[]),ft=(0,b.useCallback)(e=>{De(e),pL(e)},[]);(0,b.useEffect)(()=>{if(!i.current)return;let e=r.current;if(!e)return;e.options.fontSize=ke;let t=O.current;t&&cI(e,t)},[ke]);let pt=(0,b.useCallback)(e=>{let t=bI(e);Ae(t),KI(t)},[]);(0,b.useEffect)(()=>{if(!i.current)return;let e=r.current;if(!e)return;e.options.lineHeight=je;let t=O.current;t&&cI(e,t)},[je]);let mt=(0,b.useCallback)(e=>{let t=CI(e);Me(t),YI(t)},[]);(0,b.useEffect)(()=>{if(!i.current)return;let e=r.current;e&&(e.options.cursorStyle=Le)},[Le]);let ht=(0,b.useCallback)(e=>{Pe(e),Ie(null),BI(e)},[]);(0,b.useEffect)(()=>{if(!i.current)return;let e=r.current;e&&(e.options.cursorBlink=Re)},[Re]);let gt=(0,b.useCallback)(e=>{ze(e),LI(e)},[]);(0,b.useEffect)(()=>{if(!i.current)return;let e=r.current;e&&(e.options.scrollback=Be)},[Be]);let _t=(0,b.useCallback)(e=>{Ve(e),QI(e)},[]);(0,b.useEffect)(()=>{if(!i.current)return;let e=r.current;e&&(e.options.scrollOnUserInput=He)},[He]);let vt=(0,b.useCallback)(e=>{Ue(e),tL(e)},[]);(0,b.useEffect)(()=>{if(!i.current)return;let e=r.current;if(!e)return;let t=O.current;t&&cI(e,t)},[We,qe]);let yt=(0,b.useCallback)(e=>{let t=EI(e);Ge(t),sL(t)},[]),bt=(0,b.useCallback)(e=>{let t=DI(e);Ye(t),uL(t)},[]),xt=(0,b.useCallback)(()=>{`Notification`in window&&Notification.requestPermission().then(e=>{$e(e)})},[]);(0,b.useEffect)(()=>{if(!B)return;let e=l.current;e&&(e.focus(),e.select())},[B,U]);let St=(0,b.useCallback)(e=>{if(!e){o.current?.clearDecorations(),pe({resultIndex:-1,resultCount:0});return}o.current?.findNext(e,{decorations:NL})},[]),Ct=(0,b.useCallback)(e=>{e&&o.current?.findPrevious(e,{decorations:NL})},[]),wt=(0,b.useCallback)(()=>{te(!1),de(``),pe({resultIndex:-1,resultCount:0}),o.current?.clearDecorations(),s.current?.()},[]),Tt=(0,b.useCallback)(()=>{se.current!==null&&(window.clearTimeout(se.current),se.current=null),ie(!0)},[]),Et=(0,b.useCallback)(e=>{let t=e.clientY<=0||e.clientX>=window.innerWidth-1?XS:200;se.current=window.setTimeout(()=>{se.current=null,ce.current||ie(!1)},t)},[]),Dt=(0,b.useCallback)(e=>{oe(e),e||(se.current!==null&&window.clearTimeout(se.current),se.current=window.setTimeout(()=>{se.current=null,ie(!1)},200))},[]);ne.current=(0,b.useCallback)(()=>{H(e=>!e)},[]);let Ot=(0,b.useCallback)(()=>{H(!1),s.current?.()},[]),kt=(0,b.useCallback)(()=>{te(!0),H(!1),re(e=>e+1)},[]);k.current=kt;let At=(0,b.useCallback)(()=>{ot(!0),H(!1)},[]);A.current=At;let jt=(0,b.useCallback)(()=>{ot(!1),s.current?.()},[]),Mt=(0,b.useCallback)(e=>{c.current?.(e)},[]),Nt=(0,b.useCallback)(e=>{let t=e.target.value;de(t),St(t)},[St]),Pt=(0,b.useCallback)(e=>{if(NI(e.nativeEvent,it)){e.preventDefault(),e.currentTarget.select();return}if(e.key===`Escape`){e.preventDefault(),wt();return}e.key===`Enter`&&(e.preventDefault(),e.shiftKey?Ct(ue):St(ue))},[wt,St,Ct,it,ue]),Ft=(0,b.useCallback)(()=>{ee(!0),a.current?.(),u.current!==null&&window.clearTimeout(u.current),u.current=window.setTimeout(()=>{u.current=null,ee(!1)},800)},[]),It=(0,b.useCallback)(()=>{navigator.clipboard.writeText(US).then(()=>{R(!0),d.current!==null&&window.clearTimeout(d.current),d.current=window.setTimeout(()=>{d.current=null,R(!1)},WS)}).catch(()=>{})},[]);(0,b.useEffect)(()=>()=>{se.current!==null&&(window.clearTimeout(se.current),se.current=null),u.current!==null&&(window.clearTimeout(u.current),u.current=null),d.current!==null&&(window.clearTimeout(d.current),d.current=null)},[]),(0,b.useEffect)(()=>{if(nt.current=et,!et)return;let e=new URL(window.location.href);if(e.searchParams.get(PL)!==et){e.searchParams.set(PL,et);try{window.history.replaceState(null,``,e)}catch{}}},[et]);let Lt=IL(et),Rt=N!==null,zt=!Rt&&F>=2,Bt=Rt||zt,Vt=N!==null&&N.reason!==`shell-exited`||zt;(0,b.useEffect)(()=>{if(!Vt)return;let e=Date.now(),t=!1,n=null,i=i=>{if(t||rt.current)return;if(i){let e=r.current;e&&(e.write(fI(Le,Re)),e.refresh(0,e.rows-1),e.focus()),a.current?.();return}let s=Date.now()-e<5e3?250:GS;n=window.setTimeout(o,s)},o=()=>{kL().then(i)};return o(),()=>{t=!0,n!==null&&window.clearTimeout(n)}},[Vt,Le,Re]),(0,b.useEffect)(()=>{e?.(Bt),Bt&&(H(!1),ot(!1))},[Bt,e]);let Ht=fe.resultCount===0?`0/0`:`${fe.resultIndex+1}/${fe.resultCount}`,Ut=ye.colors.background??`#101010`,Wt=(0,b.useMemo)(()=>{let e=it?`⌘`:`Ctrl+`;return[{id:`find`,label:`Find in terminal`,category:`Actions`,shortcut:`${e}F`,icon:(0,y.jsx)(Td,{className:`size-3.5`}),action:kt},{id:`git-diff`,label:`View git diff`,category:`Actions`,shortcut:`${e}G`,icon:(0,y.jsx)(hd,{className:`size-3.5`}),action:At},{id:`new-shell`,label:`Open new shell`,category:`Actions`,shortcut:`Alt+T`,icon:(0,y.jsx)(Cd,{className:`size-3.5`}),action:()=>{let e=document.getElementById(`new-shell-link`);e instanceof HTMLAnchorElement&&e.click()}},{id:`font-size-up`,label:`Increase font size`,category:`Settings`,shortcut:`${e}+`,icon:(0,y.jsx)(xd,{className:`size-3.5`}),action:()=>pt(ke+1)},{id:`font-size-down`,label:`Decrease font size`,category:`Settings`,shortcut:`${e}-`,icon:(0,y.jsx)(xd,{className:`size-3.5`}),action:()=>pt(ke-1)},{id:`cursor-blink`,label:`Cursor blink`,category:`Settings`,checked:Re,action:()=>gt(!Re)},{id:`scroll-on-input`,label:`Pin to bottom on input`,category:`Settings`,checked:He,action:()=>vt(!He)},...jP.map(e=>({id:`cursor:${e.id}`,label:e.name,category:`Cursor`,checked:e.id===Ne,action:()=>ht(e.id)})),...XP.map(e=>({id:`font:${e.id}`,label:e.name,category:`Font`,checked:e.id===xe,action:()=>dt(e.id)})),...aF.map(e=>({id:`theme:${e.id}`,label:e.name,category:`Theme`,checked:e.id===me,action:()=>ut(e.id)}))]},[it,ut,dt,kt,At,ht,Re,gt,ke,pt,He,vt,me,xe,Ne]),Gt=(0,b.useCallback)(e=>{let t=e?.id??``;_e(t.startsWith(`theme:`)?t.slice(6):null),we(t.startsWith(`font:`)?t.slice(5):null);let n=t.startsWith(`cursor:`)?t.slice(7):null;Ie(PP(n)?n:null)},[]);return(0,y.jsxs)(`div`,{className:`h-dvh w-dvw`,style:{background:Ut},children:[(0,y.jsxs)(`div`,{className:`relative h-full w-full`,children:[(0,y.jsx)(`div`,{ref:n,"aria-label":`terminal session`,className:`absolute`,style:{top:qe,right:We,bottom:qe,left:We}}),(0,y.jsx)(`div`,{ref:j,className:`xterm-scrollbar-track`,style:{top:qe,right:We,bottom:qe},children:(0,y.jsx)(`div`,{ref:M,className:`xterm-scrollbar-thumb`})}),N===null?null:(0,y.jsx)(cS,{variant:`destructive`,role:`status`,"aria-live":`polite`,className:`absolute top-2 left-3 z-10`,children:N.reason===`shell-exited`?N.exitCode===null?`exited`:`exited · code ${N.exitCode}`:`disconnected · code ${N.closeCode}`}),(0,y.jsxs)(`div`,{className:rp(`absolute right-0 top-0 z-10 flex flex-col items-end pr-3 pt-1`,le||ct?`pointer-events-auto`:`pointer-events-none`),onMouseEnter:Tt,onMouseLeave:Et,children:[(0,y.jsx)(`div`,{"aria-hidden":`true`,className:rp(`pointer-events-auto mr-0.5 h-[2px] w-5 rounded-full bg-muted-foreground/25 transition-opacity duration-150`,le||B||ct?`opacity-0`:`opacity-100`)}),!B&&(0,y.jsxs)(`div`,{role:`toolbar`,"aria-label":`terminal actions`,className:rp(`mt-1 flex items-center gap-0.5 rounded-md border border-border/60 bg-background/70 p-0.5 text-muted-foreground shadow-xs backdrop-blur-md`,`transition-[opacity,transform] duration-200 ease-snappy`,le||ct?`translate-y-0 opacity-100`:`pointer-events-none -translate-y-1 opacity-0`),onMouseDown:e=>e.preventDefault(),onKeyDown:()=>s.current?.(),children:[(0,y.jsx)(`div`,{className:rp(`grid`,ct&&`transition-[grid-template-columns] duration-200 ease-snappy`,ct&&!le?`grid-cols-[0fr]`:`grid-cols-[1fr]`),children:(0,y.jsxs)(`div`,{className:rp(`flex min-w-0 items-center gap-0.5 overflow-hidden`,ct&&`transition-opacity duration-200 ease-snappy`,ct&&!le?`pointer-events-none opacity-0`:`opacity-100`),children:[(0,y.jsx)(gF,{themeId:me,onThemeChange:ut,onThemePreview:_e,fontId:xe,onFontChange:dt,onFontPreview:we,nerdFontEnabled:Ee,onNerdFontEnabledChange:ft,fontSize:ke,onFontSizeChange:pt,lineHeight:je,onLineHeightChange:mt,cursorStyle:Ne,onCursorStyleChange:ht,onCursorStylePreview:Ie,cursorBlink:Re,onCursorBlinkChange:gt,scrollback:Be,onScrollbackChange:_t,scrollOnUserInput:He,onScrollOnUserInputChange:vt,paddingX:We,onPaddingXChange:yt,paddingY:qe,onPaddingYChange:bt,notificationsPermission:Qe,onNotificationsPermissionRequest:xt,sessionInfo:Xe,onPopoverOpenChange:Dt,onClose:s.current??void 0}),(0,y.jsx)(Xx,{variant:`ghost`,size:`icon-sm`,onClick:kt,"aria-label":`find in terminal`,className:`hover:text-foreground`,children:(0,y.jsx)(Td,{})}),(0,y.jsx)(Xx,{variant:`ghost`,size:`icon-sm`,nativeButton:!1,"aria-label":`open a new shell in a new browser tab`,render:(0,y.jsx)(`a`,{id:`new-shell-link`,href:Lt,target:`_blank`,rel:`noopener noreferrer`}),className:`hover:text-foreground`,children:(0,y.jsx)(Cd,{})})]})}),ct&&st!==null?(0,y.jsxs)(`button`,{type:`button`,onClick:At,"aria-label":`view git diff: ${st.additions} additions, ${st.deletions} deletions${st.binaries>0?`, ${st.binaries} binary files changed`:``}`,title:`${it?`⌘`:`Ctrl+`}G`,className:`flex h-8 items-center gap-1 rounded-[min(var(--radius-md),10px)] px-2 font-mono text-xs tabular-nums outline-none transition-colors hover:bg-muted hover:text-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50`,children:[(0,y.jsxs)(`span`,{className:`text-emerald-400`,children:[`+`,kI(st.additions)]}),(0,y.jsxs)(`span`,{className:`text-red-400`,children:[`−`,kI(st.deletions)]}),st.binaries>0?(0,y.jsxs)(`span`,{className:`flex items-center gap-0.5 text-muted-foreground`,children:[(0,y.jsx)(ud,{className:`size-3`,"aria-hidden":`true`}),st.binaries]}):null]}):null]}),B&&(0,y.jsxs)(AS,{role:`search`,"aria-label":`find in terminal`,className:`mt-1 w-80 border-border/60 bg-background/70 text-muted-foreground shadow-xs backdrop-blur-md dark:bg-background/70`,children:[(0,y.jsx)(IS,{ref:l,type:`search`,value:ue,onChange:Nt,onKeyDown:Pt,placeholder:`Find`,"aria-label":`find query`,className:`text-xs`}),(0,y.jsxs)(MS,{align:`inline-end`,children:[(0,y.jsx)(FS,{role:`status`,"aria-label":`match count`,className:`text-xs tabular-nums`,children:Ht}),(0,y.jsx)(PS,{size:`icon-xs`,onClick:()=>Ct(ue),disabled:fe.resultCount===0,"aria-label":`previous match`,children:(0,y.jsx)(pd,{})}),(0,y.jsx)(PS,{size:`icon-xs`,onClick:()=>St(ue),disabled:fe.resultCount===0,"aria-label":`next match`,children:(0,y.jsx)(fd,{})})]})]})]})]}),(0,y.jsx)(bC,{open:V,onClose:Ot,commands:Wt,onActiveItemChange:Gt}),(0,y.jsx)(nj,{open:at,cwd:et,onClose:jt,onSendToTerminal:Mt}),(0,y.jsx)(Zx,{open:Bt,children:(0,y.jsx)(eS,{children:N===null?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(tS,{children:[(0,y.jsxs)(rS,{className:`flex items-center gap-2`,children:[(0,y.jsx)(LS,{"aria-hidden":`true`,role:`presentation`,"aria-label":void 0}),`Lost connection`]}),(0,y.jsx)(iS,{children:`The localterm server isn't responding. Start it again from your terminal, then retry.`})]}),(0,y.jsxs)(AS,{children:[(0,y.jsx)(IS,{readOnly:!0,value:US,"aria-label":`restart command`,className:`font-mono`}),(0,y.jsx)(MS,{align:`inline-end`,children:(0,y.jsx)(PS,{size:`icon-xs`,onClick:It,"aria-label":L?`Copied`:`Copy restart command`,children:L?(0,y.jsx)(dd,{}):(0,y.jsx)(md,{})})})]}),(0,y.jsx)(nS,{children:(0,y.jsxs)(aS,{onClick:Ft,disabled:z,children:[z?(0,y.jsx)(LS,{"data-icon":`inline-start`}):null,`Retry`]})})]}):N.reason===`shell-exited`?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(tS,{children:[(0,y.jsx)(rS,{children:`Shell ended`}),(0,y.jsx)(iS,{children:N.exitCode===null||N.exitCode===0?`Open a new shell to keep going, or close this tab.`:`Exit code ${N.exitCode}. Open a new shell to keep going.`})]}),(0,y.jsx)(nS,{children:(0,y.jsx)(aS,{onClick:()=>window.open(Lt,`_blank`,`noopener,noreferrer`),children:`New shell`})})]}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(tS,{children:[(0,y.jsxs)(rS,{className:`flex items-center gap-2`,children:[(0,y.jsx)(LS,{"aria-hidden":`true`,role:`presentation`,"aria-label":void 0}),`Connection lost`]}),(0,y.jsxs)(iS,{children:[`The browser lost its connection to the localterm daemon (close code`,` `,N.closeCode,N.closeReason?` · ${N.closeReason}`:``,`). Reconnecting spawns a fresh shell. The previous one can't be reattached.`]})]}),(0,y.jsx)(nS,{children:(0,y.jsxs)(aS,{onClick:Ft,disabled:z,children:[z?(0,y.jsx)(LS,{"data-icon":`inline-start`}):null,`Reconnect`]})})]})})})]})},RL=()=>{let e=(0,b.useRef)(!1),t=(0,b.useRef)(!1);return(0,b.useEffect)(()=>{let n=n=>{e.current||t.current&&n.preventDefault()},r=()=>window.addEventListener(`beforeunload`,n);return window.addEventListener(`keydown`,r,{once:!0}),()=>{window.removeEventListener(`keydown`,r),window.removeEventListener(`beforeunload`,n)}},[]),(0,y.jsx)(LL,{onModalOpenChange:(0,b.useCallback)(t=>{e.current=t},[]),onForegroundProcessChange:(0,b.useCallback)(e=>{t.current=e},[])})};EL(),DL(`ready`),(()=>{if(typeof document>`u`||document.getElementById(`localterm-google-fonts`))return;let e=$P();if(!e)return;let t=document.createElement(`link`);t.id=uC,t.rel=`stylesheet`,t.href=e,document.head.appendChild(t)})();var zL=document.getElementById(`root`);if(!zL)throw Error(`Root element not found`);(0,x.createRoot)(zL).render((0,y.jsx)(b.StrictMode,{children:(0,y.jsx)(DP,{delay:300,children:(0,y.jsx)(RL,{})})}));
|
|
116
|
-
//# sourceMappingURL=index-
|
|
113
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function tO(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e===`$ref`||e===`allOf`||e in a||delete i[e];if(s.$ref&&n.def)for(let e in i)e===`$ref`||e===`allOf`||e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e===`$ref`||e===`allOf`||e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(a[e.defId]=e.def)}e.external||Object.keys(a).length>0&&(e.target===`draft-2020-12`?i.$defs=a:i.definitions=a);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,`~standard`,{value:{...t[`~standard`],jsonSchema:{input:iO(t,`input`,e.processors),output:iO(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function nO(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return nO(r.element,n);if(r.type===`set`)return nO(r.valueType,n);if(r.type===`lazy`)return nO(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type===`default`||r.type===`prefault`)return nO(r.innerType,n);if(r.type===`intersection`)return nO(r.left,n)||nO(r.right,n);if(r.type===`record`||r.type===`map`)return nO(r.keyType,n)||nO(r.valueType,n);if(r.type===`pipe`)return nO(r.in,n)||nO(r.out,n);if(r.type===`object`){for(let e in r.shape)if(nO(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(nO(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(nO(e,n))return!0;return!!(r.rest&&nO(r.rest,n))}return!1}var rO=(e,t={})=>n=>{let r=QD({...n,processors:t});return $D(e,r),eO(r,e),tO(r,e)},iO=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=QD({...i??{},target:a,io:t,processors:n});return $D(e,o),eO(o,e),tO(o,e)},aO={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},oO=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=aO[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},sO=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;typeof s==`string`&&s.includes(`int`)?i.type=`integer`:i.type=`number`,typeof u==`number`&&(t.target===`draft-04`||t.target===`openapi-3.0`?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u),typeof a==`number`&&(i.minimum=a,typeof u==`number`&&t.target!==`draft-04`&&(u>=a?delete i.minimum:delete i.exclusiveMinimum)),typeof l==`number`&&(t.target===`draft-04`||t.target===`openapi-3.0`?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l),typeof o==`number`&&(i.maximum=o,typeof l==`number`&&t.target!==`draft-04`&&(l<=o?delete i.maximum:delete i.exclusiveMaximum)),typeof c==`number`&&(i.multipleOf=c)},cO=(e,t,n,r)=>{n.type=`boolean`},lO=(e,t,n,r)=>{n.not={}},uO=(e,t,n,r)=>{let i=e._zod.def,a=RC(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},dO=(e,t,n,r)=>{let i=e._zod.def,a=[];for(let e of i.values)if(e===void 0){if(t.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof e==`bigint`){if(t.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);a.push(Number(e))}else a.push(e);if(a.length!==0)if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a},fO=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},pO=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},mO=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=$D(a.element,t,{...r,path:[...r.path,`items`]})},hO=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=$D(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=$D(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},gO=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>$D(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},_O=(e,t,n,r)=>{let i=e._zod.def,a=$D(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=$D(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},vO=(e,t,n,r)=>{let i=e._zod.def,a=$D(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},yO=(e,t,n,r)=>{let i=e._zod.def;$D(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},bO=(e,t,n,r)=>{let i=e._zod.def;$D(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},xO=(e,t,n,r)=>{let i=e._zod.def;$D(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},SO=(e,t,n,r)=>{let i=e._zod.def;$D(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},CO=(e,t,n,r)=>{let i=e._zod.def,a=t.io===`input`?i.in._zod.def.type===`transform`?i.out:i.in:i.out;$D(a,t,r);let o=t.seen.get(e);o.ref=a},wO=(e,t,n,r)=>{let i=e._zod.def;$D(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},TO=(e,t,n,r)=>{let i=e._zod.def;$D(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},EO=$(`ZodISODateTime`,(e,t)=>{JT.init(e,t),QO.init(e,t)});function DO(e){return yD(EO,e)}var OO=$(`ZodISODate`,(e,t)=>{YT.init(e,t),QO.init(e,t)});function kO(e){return bD(OO,e)}var AO=$(`ZodISOTime`,(e,t)=>{XT.init(e,t),QO.init(e,t)});function jO(e){return xD(AO,e)}var MO=$(`ZodISODuration`,(e,t)=>{ZT.init(e,t),QO.init(e,t)});function NO(e){return SD(MO,e)}var PO=(e,t)=>{xw.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>ww(e,t)},flatten:{value:t=>Cw(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,zC,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,zC,2)}},isEmpty:{get(){return e.issues.length===0}}})};$(`ZodError`,PO);var FO=$(`ZodError`,PO,{Parent:Error}),IO=Tw(FO),LO=Ew(FO),RO=Dw(FO),zO=kw(FO),BO=jw(FO),VO=Mw(FO),HO=Nw(FO),UO=Pw(FO),WO=Fw(FO),GO=Iw(FO),KO=Lw(FO),qO=Rw(FO),JO=$(`ZodType`,(e,t)=>(PT.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:iO(e,`input`),output:iO(e,`output`)}}),e.toJSONSchema=rO(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,`_def`,{value:t}),e.check=(...n)=>e.clone(qC(t,{checks:[...t.checks??[],...n.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0}),e.with=e.check,e.clone=(t,n)=>rw(e,t,n),e.brand=()=>e,e.register=((t,n)=>(t.add(e,n),e)),e.parse=(t,n)=>IO(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>RO(e,t,n),e.parseAsync=async(t,n)=>LO(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>zO(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>BO(e,t,n),e.decode=(t,n)=>VO(e,t,n),e.encodeAsync=async(t,n)=>HO(e,t,n),e.decodeAsync=async(t,n)=>UO(e,t,n),e.safeEncode=(t,n)=>WO(e,t,n),e.safeDecode=(t,n)=>GO(e,t,n),e.safeEncodeAsync=async(t,n)=>KO(e,t,n),e.safeDecodeAsync=async(t,n)=>qO(e,t,n),e.refine=(t,n)=>e.check(lA(t,n)),e.superRefine=t=>e.check(uA(t)),e.overwrite=t=>e.check(HD(t)),e.optional=()=>Gk(e),e.exactOptional=()=>qk(e),e.nullable=()=>Yk(e),e.nullish=()=>Gk(Yk(e)),e.nonoptional=t=>tA(e,t),e.array=()=>kk(e),e.or=t=>Nk([e,t]),e.and=t=>Lk(e,t),e.transform=t=>aA(e,Uk(t)),e.default=t=>Zk(e,t),e.prefault=t=>$k(e,t),e.catch=t=>rA(e,t),e.pipe=t=>aA(e,t),e.readonly=()=>sA(e),e.describe=t=>{let n=e.clone();return YE.add(n,{description:t}),n},Object.defineProperty(e,`description`,{get(){return YE.get(e)?.description},configurable:!0}),e.meta=(...t)=>{if(t.length===0)return YE.get(e);let n=e.clone();return YE.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=t=>t(e),e)),YO=$(`_ZodString`,(e,t)=>{FT.init(e,t),JO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>oO(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...t)=>e.check(ID(...t)),e.includes=(...t)=>e.check(zD(...t)),e.startsWith=(...t)=>e.check(BD(...t)),e.endsWith=(...t)=>e.check(VD(...t)),e.min=(...t)=>e.check(PD(...t)),e.max=(...t)=>e.check(ND(...t)),e.length=(...t)=>e.check(FD(...t)),e.nonempty=(...t)=>e.check(PD(1,...t)),e.lowercase=t=>e.check(LD(t)),e.uppercase=t=>e.check(RD(t)),e.trim=()=>e.check(WD()),e.normalize=(...t)=>e.check(UD(...t)),e.toLowerCase=()=>e.check(GD()),e.toUpperCase=()=>e.check(KD()),e.slugify=()=>e.check(qD())}),XO=$(`ZodString`,(e,t)=>{FT.init(e,t),YO.init(e,t),e.email=t=>e.check(ZE($O,t)),e.url=t=>e.check(rD(nk,t)),e.jwt=t=>e.check(vD(_k,t)),e.emoji=t=>e.check(iD(rk,t)),e.guid=t=>e.check(QE(ek,t)),e.uuid=t=>e.check($E(tk,t)),e.uuidv4=t=>e.check(eD(tk,t)),e.uuidv6=t=>e.check(tD(tk,t)),e.uuidv7=t=>e.check(nD(tk,t)),e.nanoid=t=>e.check(aD(ik,t)),e.guid=t=>e.check(QE(ek,t)),e.cuid=t=>e.check(oD(ak,t)),e.cuid2=t=>e.check(sD(ok,t)),e.ulid=t=>e.check(cD(sk,t)),e.base64=t=>e.check(hD(mk,t)),e.base64url=t=>e.check(gD(hk,t)),e.xid=t=>e.check(lD(ck,t)),e.ksuid=t=>e.check(uD(lk,t)),e.ipv4=t=>e.check(dD(uk,t)),e.ipv6=t=>e.check(fD(dk,t)),e.cidrv4=t=>e.check(pD(fk,t)),e.cidrv6=t=>e.check(mD(pk,t)),e.e164=t=>e.check(_D(gk,t)),e.datetime=t=>e.check(DO(t)),e.date=t=>e.check(kO(t)),e.time=t=>e.check(jO(t)),e.duration=t=>e.check(NO(t))});function ZO(e){return XE(XO,e)}var QO=$(`ZodStringFormat`,(e,t)=>{IT.init(e,t),YO.init(e,t)}),$O=$(`ZodEmail`,(e,t)=>{zT.init(e,t),QO.init(e,t)}),ek=$(`ZodGUID`,(e,t)=>{LT.init(e,t),QO.init(e,t)}),tk=$(`ZodUUID`,(e,t)=>{RT.init(e,t),QO.init(e,t)}),nk=$(`ZodURL`,(e,t)=>{BT.init(e,t),QO.init(e,t)}),rk=$(`ZodEmoji`,(e,t)=>{VT.init(e,t),QO.init(e,t)}),ik=$(`ZodNanoID`,(e,t)=>{HT.init(e,t),QO.init(e,t)}),ak=$(`ZodCUID`,(e,t)=>{UT.init(e,t),QO.init(e,t)}),ok=$(`ZodCUID2`,(e,t)=>{WT.init(e,t),QO.init(e,t)}),sk=$(`ZodULID`,(e,t)=>{GT.init(e,t),QO.init(e,t)}),ck=$(`ZodXID`,(e,t)=>{KT.init(e,t),QO.init(e,t)}),lk=$(`ZodKSUID`,(e,t)=>{qT.init(e,t),QO.init(e,t)}),uk=$(`ZodIPv4`,(e,t)=>{QT.init(e,t),QO.init(e,t)}),dk=$(`ZodIPv6`,(e,t)=>{$T.init(e,t),QO.init(e,t)}),fk=$(`ZodCIDRv4`,(e,t)=>{eE.init(e,t),QO.init(e,t)}),pk=$(`ZodCIDRv6`,(e,t)=>{tE.init(e,t),QO.init(e,t)}),mk=$(`ZodBase64`,(e,t)=>{rE.init(e,t),QO.init(e,t)}),hk=$(`ZodBase64URL`,(e,t)=>{aE.init(e,t),QO.init(e,t)}),gk=$(`ZodE164`,(e,t)=>{oE.init(e,t),QO.init(e,t)}),_k=$(`ZodJWT`,(e,t)=>{cE.init(e,t),QO.init(e,t)}),vk=$(`ZodNumber`,(e,t)=>{lE.init(e,t),JO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>sO(e,t,n,r),e.gt=(t,n)=>e.check(AD(t,n)),e.gte=(t,n)=>e.check(jD(t,n)),e.min=(t,n)=>e.check(jD(t,n)),e.lt=(t,n)=>e.check(OD(t,n)),e.lte=(t,n)=>e.check(kD(t,n)),e.max=(t,n)=>e.check(kD(t,n)),e.int=t=>e.check(xk(t)),e.safe=t=>e.check(xk(t)),e.positive=t=>e.check(AD(0,t)),e.nonnegative=t=>e.check(jD(0,t)),e.negative=t=>e.check(OD(0,t)),e.nonpositive=t=>e.check(kD(0,t)),e.multipleOf=(t,n)=>e.check(MD(t,n)),e.step=(t,n)=>e.check(MD(t,n)),e.finite=()=>e;let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function yk(e){return CD(vk,e)}var bk=$(`ZodNumberFormat`,(e,t)=>{uE.init(e,t),vk.init(e,t)});function xk(e){return wD(bk,e)}var Sk=$(`ZodBoolean`,(e,t)=>{dE.init(e,t),JO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>cO(e,t,n,r)});function Ck(e){return TD(Sk,e)}var wk=$(`ZodUnknown`,(e,t)=>{fE.init(e,t),JO.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Tk(){return ED(wk)}var Ek=$(`ZodNever`,(e,t)=>{pE.init(e,t),JO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>lO(e,t,n,r)});function Dk(e){return DD(Ek,e)}var Ok=$(`ZodArray`,(e,t)=>{hE.init(e,t),JO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>mO(e,t,n,r),e.element=t.element,e.min=(t,n)=>e.check(PD(t,n)),e.nonempty=t=>e.check(PD(1,t)),e.max=(t,n)=>e.check(ND(t,n)),e.length=(t,n)=>e.check(FD(t,n)),e.unwrap=()=>e.element});function kk(e,t){return JD(Ok,e,t)}var Ak=$(`ZodObject`,(e,t)=>{bE.init(e,t),JO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>hO(e,t,n,r),GC(e,`shape`,()=>t.shape),e.keyof=()=>zk(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Tk()}),e.loose=()=>e.clone({...e._zod.def,catchall:Tk()}),e.strict=()=>e.clone({...e._zod.def,catchall:Dk()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>lw(e,t),e.safeExtend=t=>uw(e,t),e.merge=t=>dw(e,t),e.pick=t=>sw(e,t),e.omit=t=>cw(e,t),e.partial=(...t)=>fw(Wk,e,t[0]),e.required=(...t)=>pw(eA,e,t[0])});function jk(e,t){return new Ak({type:`object`,shape:e??{},...iw(t)})}var Mk=$(`ZodUnion`,(e,t)=>{SE.init(e,t),JO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>gO(e,t,n,r),e.options=t.options});function Nk(e,t){return new Mk({type:`union`,options:e,...iw(t)})}var Pk=$(`ZodDiscriminatedUnion`,(e,t)=>{Mk.init(e,t),CE.init(e,t)});function Fk(e,t,n){return new Pk({type:`union`,options:t,discriminator:e,...iw(n)})}var Ik=$(`ZodIntersection`,(e,t)=>{wE.init(e,t),JO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_O(e,t,n,r)});function Lk(e,t){return new Ik({type:`intersection`,left:e,right:t})}var Rk=$(`ZodEnum`,(e,t)=>{DE.init(e,t),JO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>uO(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new Rk({...t,checks:[],...iw(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new Rk({...t,checks:[],...iw(r),entries:i})}});function zk(e,t){return new Rk({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...iw(t)})}var Bk=$(`ZodLiteral`,(e,t)=>{OE.init(e,t),JO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>dO(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,`value`,{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function Vk(e,t){return new Bk({type:`literal`,values:Array.isArray(e)?e:[e],...iw(t)})}var Hk=$(`ZodTransform`,(e,t)=>{kE.init(e,t),JO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>pO(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new FC(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(yw(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(yw(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function Uk(e){return new Hk({type:`transform`,transform:e})}var Wk=$(`ZodOptional`,(e,t)=>{jE.init(e,t),JO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>TO(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Gk(e){return new Wk({type:`optional`,innerType:e})}var Kk=$(`ZodExactOptional`,(e,t)=>{ME.init(e,t),JO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>TO(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function qk(e){return new Kk({type:`optional`,innerType:e})}var Jk=$(`ZodNullable`,(e,t)=>{NE.init(e,t),JO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>vO(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Yk(e){return new Jk({type:`nullable`,innerType:e})}var Xk=$(`ZodDefault`,(e,t)=>{PE.init(e,t),JO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>bO(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Zk(e,t){return new Xk({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():ew(t)}})}var Qk=$(`ZodPrefault`,(e,t)=>{IE.init(e,t),JO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xO(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function $k(e,t){return new Qk({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():ew(t)}})}var eA=$(`ZodNonOptional`,(e,t)=>{LE.init(e,t),JO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>yO(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function tA(e,t){return new eA({type:`nonoptional`,innerType:e,...iw(t)})}var nA=$(`ZodCatch`,(e,t)=>{zE.init(e,t),JO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>SO(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function rA(e,t){return new nA({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var iA=$(`ZodPipe`,(e,t)=>{BE.init(e,t),JO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>CO(e,t,n,r),e.in=t.in,e.out=t.out});function aA(e,t){return new iA({type:`pipe`,in:e,out:t})}var oA=$(`ZodReadonly`,(e,t)=>{HE.init(e,t),JO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wO(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function sA(e){return new oA({type:`readonly`,innerType:e})}var cA=$(`ZodCustom`,(e,t)=>{WE.init(e,t),JO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>fO(e,t,n,r)});function lA(e,t={}){return YD(cA,e,t)}function uA(e){return XD(e)}jk({ok:Ck(),sessions:yk().int().nonnegative()}).strict(),Fk(`type`,[jk({type:Vk(`input`),data:ZO().max(OC)}).strict(),jk({type:Vk(`resize`),cols:yk().int().positive().max(MC),rows:yk().int().positive().max(NC),pixelWidth:yk().int().nonnegative().optional(),pixelHeight:yk().int().nonnegative().optional()}).strict()]);var dA=jk({type:Vk(`output`),data:ZO().max(kC)}).strict(),fA=jk({type:Vk(`exit`),code:yk().int().nullable()}).strict(),pA=jk({type:Vk(`title`),title:ZO().max(AC)}).strict(),mA=jk({type:Vk(`session`),shell:ZO().min(1),shellName:ZO().min(1),pid:yk().int().nonnegative(),cwd:ZO().min(1),title:ZO().max(AC)}).strict(),hA=jk({type:Vk(`cwd`),cwd:ZO().min(1)}).strict(),gA=jk({type:Vk(`foreground`),process:ZO().max(256).nullable()}).strict(),_A=jk({type:Vk(`notification`),body:ZO().min(1).max(jC)}).strict(),vA=zk([`modified`,`added`,`deleted`,`renamed`,`untracked`]),yA=jk({isRepo:Ck(),files:yk().int().nonnegative(),additions:yk().int().nonnegative(),deletions:yk().int().nonnegative(),binaries:yk().int().nonnegative()}).strict(),bA=Fk(`type`,[dA,fA,pA,mA,hA,gA,_A,jk({type:Vk(`git-diff-summary`),summary:yA}).strict()]),xA=jk({path:ZO().min(1),oldPath:ZO().min(1).nullable(),status:vA,additions:yk().int().nonnegative(),deletions:yk().int().nonnegative(),binary:Ck(),patch:ZO().nullable(),patchOmitted:Ck()}).strict(),SA=jk({isRepo:Ck(),files:kk(xA)}).strict(),CA=`/api/git/diff`,wA=(e,t)=>{let n=new URL(e,window.location.href);return n.searchParams.set(`cwd`,t),n.toString()},TA=async(e,t)=>{try{let n=await fetch(wA(CA,e),{signal:t});if(!n.ok)return null;let r=SA.safeParse(await n.json());return r.success?r.data:null}catch{return null}},EA=e=>`${e.filePath}\u0000${e.side}:${e.lineNumber}`,DA=e=>{let{startSide:t,startLineNumber:n}=e;return t===void 0||n===void 0||t===e.side&&n===e.lineNumber?null:{side:t,lineNumber:n}},OA="Please address the following code review comments. Run `git diff` (or `git diff HEAD`) to see the full context of any changes, especially for deleted lines.\n",kA=e=>{let{filePath:t,side:n,lineNumber:r}=e,i=DA(e);if(!i)return n===`old`?`${t} (deleted, was L${r} — see \`git diff\`)`:`${t} L${r}`;if(i.side===`new`&&n===`new`)return`${t} L${i.lineNumber}-L${r}`;if(i.side===`old`&&n===`old`)return`${t} (deleted, was L${i.lineNumber}-L${r} — see \`git diff\`)`;let a=(e,t)=>e===`old`?`old L${t}`:`L${t}`;return`${t} ${a(i.side,i.lineNumber)} through ${a(n,r)} (range spans removed lines — see \`git diff\`)`},AA=e=>{let t=[...e].sort((e,t)=>e.filePath.localeCompare(t.filePath)||(e.startLineNumber??e.lineNumber)-(t.startLineNumber??t.lineNumber)||e.lineNumber-t.lineNumber),n=OA;for(let e of t)n+=`\n- ${kA(e)}: ${e.comment}`;return n},jA=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@(.*)$/,MA=e=>{let t=[],n=null,r=0,i=0,a=e.split(`
|
|
114
|
+
`);a.length>0&&a[a.length-1]===``&&a.pop();for(let e of a){let a=jA.exec(e);if(a){r=Number.parseInt(a[1],10),i=Number.parseInt(a[2],10),n={header:e,lines:[]},t.push(n);continue}if(!n)continue;let o=e[0];if(o===`\\`){let e=n.lines[n.lines.length-1];e&&(e.noNewline=!0);continue}if(o===`+`){n.lines.push({type:`add`,text:e.slice(1),oldLine:null,newLine:i,noNewline:!1}),i+=1;continue}if(o===`-`){n.lines.push({type:`del`,text:e.slice(1),oldLine:r,newLine:null,noNewline:!1}),r+=1;continue}n.lines.push({type:`context`,text:o===` `?e.slice(1):e,oldLine:r,newLine:i,noNewline:!1}),r+=1,i+=1}return t},NA=e=>e.reduce((e,t)=>e+t.lines.length,0),PA=e=>{if(typeof window>`u`)return null;try{let t=window.localStorage.getItem(e);return t===null||t.trim()===``?null:t}catch{return null}},FA=(e,t)=>{if(!(typeof window>`u`))try{window.localStorage.setItem(e,t)}catch{}},IA=(e,t,n)=>({load:()=>{let r=PA(e);if(r===null)return t;let i=Number(r);return Number.isFinite(i)?n(i):t},store:t=>FA(e,String(t))}),LA=(e,t)=>({load:()=>{let n=PA(e);return n===`true`?!0:n===`false`?!1:t},store:t=>FA(e,String(t))}),RA=(e,t,n)=>({load:()=>{let r=PA(e);return r!==null&&n(r)?r:t},store:t=>FA(e,t)}),zA=(e,t,n)=>({load:()=>t(PA(e)),store:t=>FA(e,n(t))}),BA=RA(JS,`unified`,e=>e===`unified`||e===`split`),VA=BA.load,HA=BA.store,UA=(e,t)=>{let n=e=>`${e.side===`old`?`old `:``}L${e.lineNumber}`;return e.side===t.side?`${e.side===`old`?`old `:``}L${e.lineNumber}–L${t.lineNumber}`:`${n(e)} – ${n(t)}`},WA=()=>(0,y.jsx)(`span`,{"aria-hidden":`true`,className:`pointer-events-none absolute inset-0 border-l-2 border-primary/60 bg-primary/10`}),GA={modified:{letter:`M`,className:`text-amber-400`},added:{letter:`A`,className:`text-emerald-400`},deleted:{letter:`D`,className:`text-red-400`},renamed:{letter:`R`,className:`text-sky-400`},untracked:{letter:`U`,className:`text-emerald-400`}},KA=`text-emerald-400`,qA=`text-red-400`,JA=`w-12 shrink-0 select-none px-2 text-right text-muted-foreground/50 tabular-nums`,YA=e=>{let t=e.lastIndexOf(`/`);return t===-1?{directory:``,basename:e}:{directory:e.slice(0,t+1),basename:e.slice(t+1)}},XA=e=>e===`add`?`bg-emerald-500/10`:e===`del`?`bg-red-500/10`:``,ZA=e=>e===`context`?`text-muted-foreground`:`text-foreground/90`,QA=({onClick:e,onDragStart:t})=>(0,y.jsx)(`button`,{type:`button`,onClick:e,onPointerDown:e=>{e.button===0&&(e.preventDefault(),t())},"aria-label":`comment on line — drag to select multiple lines`,className:`absolute top-1/2 left-1 z-10 hidden size-4 -translate-y-1/2 items-center justify-center rounded-sm bg-primary text-primary-foreground transition-transform group-hover/line:flex hover:scale-110`,children:(0,y.jsx)(vd,{className:`size-3`,"aria-hidden":`true`})}),$A=({initialComment:e,onSave:t,onCancel:n})=>{let[r,i]=(0,b.useState)(e),a=r.trim(),o=()=>{a&&t(a)};return(0,y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,y.jsx)(kS,{autoFocus:!0,value:r,onChange:e=>i(e.target.value),onKeyDown:e=>{e.key===`Escape`?(e.preventDefault(),e.stopPropagation(),n()):e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),o())},placeholder:`Leave a comment on this line…`,"aria-label":`line comment`,className:`min-h-12 text-xs`}),(0,y.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,y.jsx)(Xx,{size:`xs`,onClick:o,disabled:!a,children:`Save comment`}),(0,y.jsx)(Xx,{size:`xs`,variant:`ghost`,onClick:n,children:`Cancel`})]})]})},ej=({annotation:e,isEditing:t,rangeLabel:n,onEdit:r,onSave:i,onCancel:a,onDelete:o})=>(0,y.jsx)(`div`,{className:`border-y border-border/40 bg-muted/20 py-2 pr-4 pl-3 font-sans`,children:(0,y.jsxs)(`div`,{className:`sticky left-3 max-w-xl`,children:[n?(0,y.jsx)(`div`,{className:`mb-1 font-mono text-[10px] tracking-wide text-muted-foreground/80`,children:n}):null,t?(0,y.jsx)($A,{initialComment:e?.comment??``,onSave:i,onCancel:a}):e?(0,y.jsxs)(`div`,{className:`group/comment flex items-start gap-2`,children:[(0,y.jsx)(yd,{className:`mt-0.5 size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),(0,y.jsx)(`p`,{className:`min-w-0 flex-1 whitespace-pre-wrap text-foreground/90`,children:e.comment}),(0,y.jsxs)(`span`,{className:`flex shrink-0 items-center gap-0.5 opacity-0 transition-opacity group-hover/comment:opacity-100`,children:[(0,y.jsx)(Xx,{variant:`ghost`,size:`icon-xs`,onClick:r,"aria-label":`edit comment`,className:`hover:text-foreground`,children:(0,y.jsx)(Sd,{})}),(0,y.jsx)(Xx,{variant:`ghost`,size:`icon-xs`,onClick:o,"aria-label":`delete comment`,className:`hover:text-destructive`,children:(0,y.jsx)(Od,{})})]})]}):null]})}),tj=({line:e,highlighted:t,onAnnotate:n,onDragStart:r,onDragEnter:i})=>(0,y.jsxs)(`div`,{className:rp(`group/line relative flex`,XA(e.type)),onPointerEnter:i,children:[n&&r?(0,y.jsx)(QA,{onClick:n,onDragStart:r}):null,(0,y.jsx)(`span`,{className:JA,children:e.oldLine??``}),(0,y.jsx)(`span`,{className:JA,children:e.newLine??``}),(0,y.jsx)(`span`,{className:rp(`w-5 shrink-0 select-none text-center`,e.type===`add`&&KA,e.type===`del`&&qA),children:e.type===`add`?`+`:e.type===`del`?`-`:``}),(0,y.jsxs)(`span`,{className:rp(`whitespace-pre pr-4`,ZA(e.type)),children:[e.text,e.noNewline?(0,y.jsx)(`span`,{className:`select-none text-muted-foreground/50`,title:`No newline at end of file`,children:` ⊘`}):null]}),t?(0,y.jsx)(WA,{}):null]}),nj=({line:e,side:t,onAnnotate:n,onDragStart:r})=>{if(!e)return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(`span`,{className:JA}),(0,y.jsx)(`span`,{className:`min-w-0 flex-1 bg-muted/20`})]});let i=e.type===`context`?`context`:t===`left`?`del`:`add`;return(0,y.jsxs)(y.Fragment,{children:[n&&r?(0,y.jsx)(QA,{onClick:n,onDragStart:r}):null,(0,y.jsx)(`span`,{className:rp(JA,XA(i)),children:t===`left`?e.oldLine??``:e.newLine??``}),(0,y.jsx)(`span`,{className:rp(`min-w-0 flex-1 overflow-x-clip whitespace-pre pr-2`,XA(i),ZA(e.type)),children:e.text})]})},rj=({hunk:e})=>(0,y.jsx)(`div`,{className:`select-none bg-muted/30 px-4 py-0.5 text-muted-foreground/60`,children:e.header}),ij=({file:e,viewMode:t,annotations:n,editingKey:r,pendingRange:i,dragCancelRef:a,onOpenEditor:o,onSaveAnnotation:s,onCancelEditor:c,onDeleteAnnotation:l})=>{let[u,d]=(0,b.useState)(!1),[f,p]=(0,b.useState)(null),m=(0,b.useMemo)(()=>e.patch?MA(e.patch):[],[e.patch]),h=(0,b.useMemo)(()=>NA(m),[m]),g=(0,b.useMemo)(()=>CC(m),[m]),_=f!==null,v=f?EC(g,f.anchor,f.focus):null,x=(0,b.useRef)(v);x.current=v;let S=e=>p({anchor:e,focus:e}),C=e=>p(t=>t&&{...t,focus:e});(0,b.useEffect)(()=>{d(!1),p(null)},[e.path]),(0,b.useEffect)(()=>{if(!_)return;let t=()=>p(null);a.current=t;let n=()=>{p(null);let t=x.current;t&&o(EA({filePath:e.path,...t.end}),SC(t.start)===SC(t.end)?void 0:{filePath:e.path,...t})};return window.addEventListener(`pointerup`,n),window.addEventListener(`pointercancel`,t),()=>{a.current=null,window.removeEventListener(`pointerup`,n),window.removeEventListener(`pointercancel`,t)}},[_,e.path,o,a]);let w=(0,b.useMemo)(()=>{let t=new Set,r=e=>{if(e)for(let n of DC(g,e))t.add(n)};r(v),i&&i.filePath===e.path&&r(i);for(let t of Object.values(n)){if(t.filePath!==e.path)continue;let n=DA(t);n&&r({start:n,end:{side:t.side,lineNumber:t.lineNumber}})}return t},[g,v,i,n,e.path]);if(e.binary)return(0,y.jsx)(aj,{icon:!0,children:`Binary file — no text diff to show.`});if(e.patchOmitted)return(0,y.jsx)(aj,{icon:!0,children:`Diff too large to display.`});if(m.length===0)return(0,y.jsx)(aj,{children:e.status===`renamed`?`Renamed without content changes.`:e.status===`untracked`&&e.additions===0?`Empty file.`:`No content changes.`});let T=u?1/0:qS,E=0,D=[];for(let e of m){if(E>=T)break;let t=T-E,n=e.lines.length<=t?e.lines:e.lines.slice(0,t);D.push(n===e.lines?e:{header:e.header,lines:n}),E+=n.length}let O=h-E,k=t=>{let a=xC(t);if(!a)return null;let o=EA({filePath:e.path,...a}),c=n[o],l=r===o,u=l&&i&&i.filePath===e.path?i.start:c?DA(c):null;return{key:o,target:a,saved:c,isEditing:l,rangeStart:u,save:t=>s({filePath:e.path,...a,...u?{startSide:u.side,startLineNumber:u.lineNumber}:{},comment:t})}},A=e=>e&&(e.saved||e.isEditing)?(0,y.jsx)(ej,{annotation:e.saved,isEditing:e.isEditing,rangeLabel:e.rangeStart?UA(e.rangeStart,e.target):null,onEdit:()=>o(e.key),onSave:e.save,onCancel:c,onDelete:()=>l(e.key)}):null;return(0,y.jsxs)(`div`,{className:rp(`pb-4 font-mono text-xs leading-5`,t===`unified`&&`min-w-max`,_&&`select-none`),children:[D.map(e=>(0,y.jsxs)(`div`,{children:[(0,y.jsx)(rj,{hunk:e}),t===`unified`?e.lines.map((e,t)=>{let n=k(e);return(0,y.jsxs)(b.Fragment,{children:[(0,y.jsx)(tj,{line:e,highlighted:n!==null&&w.has(SC(n.target)),onAnnotate:n?()=>o(n.key):void 0,onDragStart:n?()=>S(n.target):void 0,onDragEnter:_&&n?()=>C(n.target):void 0}),A(n)]},t)}):bC(e).map((e,t)=>{let n=e.left?k(e.left):null,r=e.right?k(e.right):null,i=n!==null&&n.key===r?.key;return(0,y.jsxs)(b.Fragment,{children:[(0,y.jsxs)(`div`,{className:`flex`,children:[(0,y.jsxs)(`div`,{className:`group/line relative flex w-1/2 min-w-0 border-r border-border/40`,onPointerEnter:_&&n?()=>C(n.target):void 0,children:[(0,y.jsx)(nj,{line:e.left,side:`left`,onAnnotate:n?()=>o(n.key):void 0,onDragStart:n?()=>S(n.target):void 0}),n&&w.has(SC(n.target))?(0,y.jsx)(WA,{}):null]}),(0,y.jsxs)(`div`,{className:`group/line relative flex w-1/2 min-w-0`,onPointerEnter:_&&r?()=>C(r.target):void 0,children:[(0,y.jsx)(nj,{line:e.right,side:`right`,onAnnotate:r?()=>o(r.key):void 0,onDragStart:r?()=>S(r.target):void 0}),r&&w.has(SC(r.target))?(0,y.jsx)(WA,{}):null]})]}),A(n),i?null:A(r)]},t)})]},e.header+String(e.lines[0]?.newLine??e.lines[0]?.oldLine??``))),O>0?(0,y.jsx)(`div`,{className:`px-4 py-2`,children:(0,y.jsxs)(Xx,{variant:`outline`,size:`xs`,onClick:()=>d(!0),children:[`Show `,O.toLocaleString(),` more lines`]})}):null]})},aj=({children:e,icon:t})=>(0,y.jsxs)(`div`,{className:`flex h-full min-h-32 items-center justify-center gap-2 text-sm text-muted-foreground`,children:[t?(0,y.jsx)(gd,{className:`size-4`,"aria-hidden":`true`}):null,e]}),oj=({open:e,cwd:t,onClose:n,onSendToTerminal:r})=>{let[i,a]=(0,b.useState)(!1),[o,s]=(0,b.useState)(!1),[c,l]=(0,b.useState)(null),[u,d]=(0,b.useState)(!1),[f,p]=(0,b.useState)(!1),[m,h]=(0,b.useState)(null),[g,_]=(0,b.useState)(()=>VA()),[v,x]=(0,b.useState)(0),[S,C]=(0,b.useState)({}),[w,T]=(0,b.useState)(null),[E,D]=(0,b.useState)(null),O=(0,b.useRef)(null),k=(0,b.useRef)(null),A=(0,b.useRef)(null);(0,b.useEffect)(()=>{if(e){a(!0);let e=requestAnimationFrame(()=>s(!0));return()=>cancelAnimationFrame(e)}if(s(!1),i){let e=window.setTimeout(()=>a(!1),150);return()=>window.clearTimeout(e)}},[e]),(0,b.useEffect)(()=>{if(!e||!t)return;let n=new AbortController;return d(!0),p(!1),TA(t,n.signal).then(e=>{if(!n.signal.aborted){if(d(!1),!e){p(!0);return}l(e)}}),()=>n.abort()},[e,t,v]);let j=c?.files??[];(0,b.useEffect)(()=>{c&&(m&&c.files.some(e=>e.path===m)||h(c.files[0]?.path??null))},[c,m]);let M=j.find(e=>e.path===m)??null,N=M?j.indexOf(M):-1,P=(0,b.useMemo)(()=>{let e=0,t=0,n=0;for(let r of j)e+=r.additions,t+=r.deletions,r.binary&&(n+=1);return{additions:e,deletions:t,binaries:n}},[j]),F=(0,b.useCallback)(e=>{if(j.length===0)return;let t=Math.min(j.length-1,Math.max(0,(N===-1?0:N)+e));h(j[t].path),(A.current?.children[t])?.scrollIntoView({block:`nearest`})},[j,N]);(0,b.useEffect)(()=>{if(!e||!i)return;let t=e=>{let t=e.target,r=t instanceof HTMLElement&&t.tagName===`TEXTAREA`;if(e.key===`Escape`){if(r)return;if(e.preventDefault(),e.stopPropagation(),O.current){O.current();return}n();return}r||t instanceof HTMLElement&&t.tagName===`INPUT`||(e.key===`ArrowDown`||e.key===`j`?(e.preventDefault(),F(1)):(e.key===`ArrowUp`||e.key===`k`)&&(e.preventDefault(),F(-1)))};return window.addEventListener(`keydown`,t,!0),()=>window.removeEventListener(`keydown`,t,!0)},[e,i,n,F]),(0,b.useEffect)(()=>{e&&o&&k.current?.focus()},[e,o]);let I=(0,b.useCallback)(e=>{_(e),HA(e)},[]),L=(0,b.useCallback)((e,t)=>{T(e),D(t??null)},[]),R=(0,b.useCallback)(()=>{T(null),D(null)},[]),z=(0,b.useCallback)(e=>{C(t=>({...t,[EA(e)]:e})),T(null),D(null)},[]),ee=(0,b.useCallback)(e=>{C(t=>{let{[e]:n,...r}=t;return r}),T(t=>t===e?null:t),D(t=>t&&EA({filePath:t.filePath,...t.end})===e?null:t)},[]),B=(0,b.useMemo)(()=>Object.values(S),[S]),te=(0,b.useMemo)(()=>{let e=new Map;for(let t of B)e.set(t.filePath,(e.get(t.filePath)??0)+1);return e},[B]),V=(0,b.useCallback)(()=>{C({}),T(null),D(null)},[]),H=(0,b.useCallback)(()=>{!r||B.length===0||(r(AA(B)),C({}),T(null),D(null),n())},[r,B,n]);if(!i)return null;let ne=e&&o,U=c?.isRepo??!0,re=c!==null&&U&&j.length===0;return(0,y.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center p-4 sm:p-6`,children:[(0,y.jsx)(`div`,{"data-open":ne||void 0,"data-closed":!ne||void 0,className:rp(Ux),onClick:n}),(0,y.jsxs)(`div`,{ref:k,role:`dialog`,"aria-label":`git diff viewer`,"aria-modal":!0,tabIndex:-1,"data-open":ne||void 0,"data-closed":!ne||void 0,className:rp(`relative z-10 flex h-full w-full max-w-7xl flex-col overflow-hidden rounded-xl outline-none`,Vx,Wx),children:[(0,y.jsxs)(`header`,{className:`flex shrink-0 items-center gap-3 border-b border-border/40 px-4 py-2.5`,children:[(0,y.jsx)(`h2`,{className:`text-sm font-medium text-foreground`,children:`Changes`}),(0,y.jsxs)(`span`,{className:`font-mono text-xs tabular-nums text-muted-foreground`,children:[(0,y.jsxs)(`span`,{className:KA,children:[`+`,P.additions.toLocaleString()]}),` `,(0,y.jsxs)(`span`,{className:qA,children:[`−`,P.deletions.toLocaleString()]}),P.binaries>0?(0,y.jsxs)(`span`,{className:`text-muted-foreground/70`,children:[` · `,P.binaries,` binary`]}):null]}),u?(0,y.jsx)(LS,{className:`size-3.5`,"aria-label":`loading diff`}):null,(0,y.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[(0,y.jsx)(`div`,{role:`radiogroup`,"aria-label":`diff layout`,className:`flex items-center rounded-md border border-border/60 p-0.5`,children:[`unified`,`split`].map(e=>(0,y.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":g===e,onClick:()=>I(e),className:rp(`rounded-sm px-2 py-0.5 text-xs capitalize transition-colors`,g===e?`bg-foreground/10 text-foreground`:`text-muted-foreground hover:text-foreground`),children:e},e))}),(0,y.jsx)(Xx,{variant:`ghost`,size:`icon-sm`,onClick:()=>x(e=>e+1),"aria-label":`refresh diff`,className:`hover:text-foreground`,children:(0,y.jsx)(wd,{})}),(0,y.jsx)(Xx,{variant:`ghost`,size:`icon-sm`,onClick:n,"aria-label":`close diff viewer`,className:`hover:text-foreground`,children:(0,y.jsx)(kd,{})})]})]}),f?(0,y.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 text-sm text-muted-foreground`,children:[`Couldn't load the diff from the localterm daemon.`,(0,y.jsx)(Xx,{variant:`outline`,size:`xs`,onClick:()=>x(e=>e+1),children:`Retry`})]}):U?re?(0,y.jsx)(`div`,{className:`flex flex-1 items-center justify-center text-sm text-muted-foreground`,children:`Working tree clean — nothing to diff.`}):c===null?(0,y.jsx)(`div`,{className:`flex flex-1 items-center justify-center`,children:(0,y.jsx)(LS,{"aria-label":`loading diff`})}):(0,y.jsxs)(`div`,{className:`flex min-h-0 flex-1`,children:[(0,y.jsx)(`div`,{ref:A,role:`listbox`,"aria-label":`changed files`,className:`w-72 shrink-0 overflow-y-auto overscroll-contain border-r border-border/40 p-1.5`,children:j.map(e=>{let t=GA[e.status],{directory:n,basename:r}=YA(e.path),i=e.path===m,a=te.get(e.path)??0;return(0,y.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":i,onClick:()=>h(e.path),className:rp(`flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-left text-xs outline-none transition-colors`,i?`bg-foreground/10 text-foreground`:`text-muted-foreground hover:bg-foreground/5`),children:[(0,y.jsx)(`span`,{className:rp(`w-3 shrink-0 font-mono font-semibold`,t.className),title:e.status,children:t.letter}),(0,y.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono`,dir:`rtl`,children:(0,y.jsxs)(`bdi`,{children:[(0,y.jsx)(`span`,{className:`text-muted-foreground/60`,children:n}),(0,y.jsx)(`span`,{className:i?`text-foreground`:``,children:r})]})}),a>0?(0,y.jsxs)(`span`,{className:`flex shrink-0 items-center gap-0.5 font-mono text-[10px] tabular-nums text-muted-foreground`,title:`${a} pending comment${a===1?``:`s`}`,children:[(0,y.jsx)(yd,{className:`size-2.5`,"aria-hidden":`true`}),a]}):null,e.binary?(0,y.jsx)(`span`,{className:`shrink-0 rounded border border-border/40 px-1 font-mono text-[10px] text-muted-foreground/70`,children:`BIN`}):(0,y.jsxs)(`span`,{className:`shrink-0 font-mono tabular-nums`,children:[(0,y.jsxs)(`span`,{className:KA,children:[`+`,e.additions]}),` `,(0,y.jsxs)(`span`,{className:qA,children:[`−`,e.deletions]})]})]},e.path)})}),(0,y.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:M?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 border-b border-border/40 px-4 py-1.5 font-mono text-xs text-muted-foreground`,children:[M.oldPath?(0,y.jsxs)(`span`,{className:`truncate`,children:[M.oldPath,(0,y.jsx)(`span`,{className:`text-muted-foreground/50`,children:` → `}),(0,y.jsx)(`span`,{className:`text-foreground`,children:M.path})]}):(0,y.jsx)(`span`,{className:`truncate text-foreground`,children:M.path}),M.binary?null:(0,y.jsxs)(`span`,{className:`ml-auto shrink-0 tabular-nums`,children:[(0,y.jsxs)(`span`,{className:KA,children:[`+`,M.additions]}),` `,(0,y.jsxs)(`span`,{className:qA,children:[`−`,M.deletions]})]})]}),(0,y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto overscroll-contain`,children:(0,y.jsx)(ij,{file:M,viewMode:g,annotations:S,editingKey:w,pendingRange:E,dragCancelRef:O,onOpenEditor:L,onSaveAnnotation:z,onCancelEditor:R,onDeleteAnnotation:ee})})]}):(0,y.jsx)(`div`,{className:`flex flex-1 items-center justify-center text-sm text-muted-foreground`,children:`Select a file to view its diff.`})})]}):(0,y.jsx)(`div`,{className:`flex flex-1 items-center justify-center text-sm text-muted-foreground`,children:`Not a git repository.`}),B.length>0?(0,y.jsxs)(`footer`,{className:`flex shrink-0 items-center gap-2 border-t border-border/40 px-4 py-2`,children:[(0,y.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[B.length,` pending comment`,B.length===1?``:`s`]}),(0,y.jsxs)(`div`,{className:`ml-auto flex items-center gap-1.5`,children:[(0,y.jsx)(Xx,{variant:`ghost`,size:`xs`,onClick:V,children:`Clear all`}),r?(0,y.jsxs)(Xx,{size:`xs`,onClick:H,children:[(0,y.jsx)(Ed,{"aria-hidden":`true`}),`Send to terminal`]}):null]})]}):null]})]})},sj=b.forwardRef(function(e,t){let{className:n,render:r,orientation:i=`horizontal`,style:a,...o}=e;return w_(`div`,e,{state:{orientation:i},ref:t,props:[{role:`separator`,"aria-orientation":i},o]})});function cj({className:e,orientation:t=`horizontal`,...n}){return(0,y.jsx)(sj,{"data-slot":`separator`,orientation:t,className:rp(`shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch`,e),...n})}var lj=Jx(`flex w-fit items-stretch *:focus-visible:relative *:focus-visible:z-10 has-[>[data-slot=button-group]]:gap-2 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-md [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1`,{variants:{orientation:{horizontal:`*:data-slot:rounded-r-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-r-md! [&>[data-slot]~[data-slot]]:rounded-l-none [&>[data-slot]~[data-slot]]:border-l-0`,vertical:`flex-col *:data-slot:rounded-b-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-b-md! [&>[data-slot]~[data-slot]]:rounded-t-none [&>[data-slot]~[data-slot]]:border-t-0`}},defaultVariants:{orientation:`horizontal`}});function uj({className:e,orientation:t,...n}){return(0,y.jsx)(`div`,{role:`group`,"data-slot":`button-group`,"data-orientation":t,className:rp(lj({orientation:t}),e),...n})}function dj({className:e,render:t,...n}){return oS({defaultTagName:`div`,props:u_({className:rp(`flex items-center gap-2 rounded-md border bg-muted px-2.5 text-sm font-medium shadow-xs [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4`,e)},n),render:t,state:{slot:`button-group-text`}})}var fj=e=>String(e),pj=`size-7 rounded-none border-0 bg-transparent text-foreground hover:bg-foreground/10 hover:text-foreground disabled:opacity-30 [&_svg]:size-3.5`,mj=`h-7 min-w-[3rem] cursor-ew-resize touch-none justify-center border-y-0 border-r border-l! border-border/60 bg-transparent px-1.5 text-xs font-medium tabular-nums text-foreground select-none hover:bg-foreground/5 focus-visible:outline-none focus-visible:bg-foreground/5`,hj={ArrowRight:1,ArrowUp:1,ArrowLeft:-1,ArrowDown:-1},gj=({value:e,min:t,max:n,step:r,ariaLabel:i,decrementAriaLabel:a,incrementAriaLabel:o,formatDisplay:s=fj,onValueChange:c})=>{let l=(0,b.useRef)(null),u=(0,b.useRef)(e),d=t=>{if(t.button===0){try{t.currentTarget.setPointerCapture(t.pointerId)}catch{}l.current=t.clientX,u.current=e}},f=e=>{let t=l.current;if(t===null)return;let n=e.clientX-t,i=Math.round(n/5);i!==0&&c(u.current+i*r)},p=e=>{if(l.current!==null){try{e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId)}catch{}l.current=null}};return(0,y.jsxs)(uj,{"aria-label":i,className:`h-7 overflow-hidden rounded-md border border-border/60`,children:[(0,y.jsx)(Xx,{variant:`ghost`,size:`icon-xs`,onClick:()=>c(e-r),disabled:e<=t,"aria-label":a,className:pj,children:(0,y.jsx)(bd,{})}),(0,y.jsx)(dj,{role:`slider`,tabIndex:0,"aria-label":i,"aria-valuemin":t,"aria-valuemax":n,"aria-valuenow":e,"aria-valuetext":s(e),"aria-orientation":`horizontal`,title:`Drag or use arrow keys to adjust`,className:mj,onPointerDown:d,onPointerMove:f,onPointerUp:p,onPointerCancel:p,onPointerLeave:e=>{if(l.current===null)return;let t=!1;try{t=e.currentTarget.hasPointerCapture(e.pointerId)}catch{}t||(l.current=null)},onKeyDown:i=>{if(i.key===`Home`){i.preventDefault(),c(t);return}if(i.key===`End`){i.preventDefault(),c(n);return}let a=hj[i.key];a!==void 0&&(i.preventDefault(),c(e+a*r))},children:s(e)}),(0,y.jsx)(Xx,{variant:`ghost`,size:`icon-xs`,onClick:()=>c(e+r),disabled:e>=n,"aria-label":o,className:pj,children:(0,y.jsx)(Cd,{})})]})};function _j(e){let[t,n]=b.useState({current:e,previous:null});return e!==t.current&&n({current:e,previous:t.current}),t.previous}var vj=b.createContext(null),yj=b.createContext(null);function bj(){let e=b.useContext(vj);if(e===null)throw Error(t_(60));return e}function xj(){let e=b.useContext(yj);if(e===null)throw Error(t_(61));return e}var Sj=(e,t)=>Object.is(e,t);function Cj(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function wj(e,t,n){return!e||e.length===0?!1:e.some(e=>e===void 0?!1:Cj(t,e,n))}function Tj(e,t,n){return!e||e.length===0?-1:e.findIndex(e=>e===void 0?!1:Cj(e,t,n))}function Ej(e,t,n){return e.filter(e=>!Cj(t,e,n))}function Dj(e){if(e==null)return``;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}function Oj(e){return e!=null&&e.length>0&&typeof e[0]==`object`&&e[0]!=null&&`items`in e[0]}function kj(e){if(!Array.isArray(e))return e!=null&&`null`in e;let t=e;if(Oj(t)){for(let e of t)for(let t of e.items)if(t&&t.value==null&&t.label!=null)return!0;return!1}for(let e of t)if(e&&e.value==null&&e.label!=null)return!0;return!1}function Aj(e,t){if(t&&e!=null)return t(e)??``;if(e&&typeof e==`object`){if(`label`in e&&e.label!=null)return String(e.label);if(`value`in e)return String(e.value)}return Dj(e)}function jj(e,t){return t&&e!=null?t(e)??``:e&&typeof e==`object`&&`value`in e&&`label`in e?Dj(e.value):Dj(e)}function Mj(e,t,n){function r(){return Aj(e,n)}if(n&&e!=null)return n(e);if(e&&typeof e==`object`&&`label`in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return t[e]??r();if(Array.isArray(t)){let n=t,i=Oj(n)?n.flatMap(e=>e.items):n;if(typeof e!=`object`||!e){let t=i.find(t=>t.value===e);return t&&t.label!=null?t.label:r()}if(`value`in e){let t=i.find(t=>t&&t.value===e.value);if(t&&t.label!=null)return t.label}}return r()}function Nj(e,t,n){return e.reduce((e,r,i)=>(i>0&&e.push(`, `),e.push((0,y.jsx)(b.Fragment,{children:Mj(r,t,n)},i)),e),[])}var Pj={id:Q(e=>e.id),labelId:Q(e=>e.labelId),modal:Q(e=>e.modal),multiple:Q(e=>e.multiple),items:Q(e=>e.items),itemToStringLabel:Q(e=>e.itemToStringLabel),itemToStringValue:Q(e=>e.itemToStringValue),isItemEqualToValue:Q(e=>e.isItemEqualToValue),value:Q(e=>e.value),hasSelectedValue:Q(e=>{let{value:t,multiple:n,itemToStringValue:r}=e;return t==null?!1:n&&Array.isArray(t)?t.length>0:jj(t,r)!==``}),hasNullItemLabel:Q((e,t)=>t?kj(e.items):!1),open:Q(e=>e.open),mounted:Q(e=>e.mounted),forceMount:Q(e=>e.forceMount),transitionStatus:Q(e=>e.transitionStatus),openMethod:Q(e=>e.openMethod),activeIndex:Q(e=>e.activeIndex),selectedIndex:Q(e=>e.selectedIndex),isActive:Q((e,t)=>e.activeIndex===t),isSelected:Q((e,t,n)=>{let r=e.isItemEqualToValue,i=e.value;return e.multiple?Array.isArray(i)&&i.some(e=>Cj(n,e,r)):e.selectedIndex===t&&e.selectedIndex!==null?!0:Cj(n,i,r)}),isSelectedByFocus:Q((e,t)=>e.selectedIndex===t),popupProps:Q(e=>e.popupProps),triggerProps:Q(e=>e.triggerProps),triggerElement:Q(e=>e.triggerElement),positionerElement:Q(e=>e.positionerElement),listElement:Q(e=>e.listElement),scrollUpArrowVisible:Q(e=>e.scrollUpArrowVisible),scrollDownArrowVisible:Q(e=>e.scrollDownArrowVisible),hasScrollArrows:Q(e=>e.hasScrollArrows)};function Fj(e,t=-(2**53-1),n=2**53-1){return Math.max(t,Math.min(e,n))}function Ij(e,t){return Math.max(0,e-t)}function Lj(e,t){if(t<=0)return 0;let n=Fj(e,0,t),r=n,i=t-n,a=r<=1,o=i<=1;return a&&o?r<=i?0:t:a?0:o?t:n}function Rj(e){let{id:t,value:n,defaultValue:r=null,onValueChange:i,open:a,defaultOpen:o=!1,onOpenChange:s,name:c,form:l,autoComplete:u,disabled:d=!1,readOnly:f=!1,required:p=!1,modal:m=!0,actionsRef:h,inputRef:g,onOpenChangeComplete:_,items:v,multiple:x=!1,itemToStringLabel:S,itemToStringValue:C,isItemEqualToValue:w=Sj,highlightItemOnHover:T=!0,children:E}=e,{clearErrors:D}=_S(),{setDirty:O,setTouched:k,setFocused:A,shouldValidateOnChange:j,validityData:M,setFilled:N,name:P,disabled:F,validation:I,validationMode:L}=hS(),R=CS({id:t}),z=F||d,ee=P??c,[B,te]=wS({controlled:n,default:x?r??rm:r,name:`Select`,state:`value`}),[V,H]=wS({controlled:a,default:o,name:`Select`,state:`open`}),ne=b.useRef([]),U=b.useRef([]),re=b.useRef(null),W=b.useRef(null),ie=b.useRef(0),ae=b.useRef(null),oe=b.useRef([]),se=b.useRef(!1),ce=b.useRef(!1),le=b.useRef(null),ue=b.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}),de=b.useRef(!1),{mounted:fe,setMounted:pe,transitionStatus:me}=Gy(V),{openMethod:he,triggerProps:ge}=Ub(V),_e=Kp(()=>new Vy({id:R,labelId:void 0,modal:m,multiple:x,itemToStringLabel:S,itemToStringValue:C,isItemEqualToValue:w,value:B,open:V,mounted:fe,transitionStatus:me,items:v,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,ve=Ly(_e,Pj.activeIndex),ye=Ly(_e,Pj.selectedIndex),be=Ly(_e,Pj.triggerElement),xe=Ly(_e,Pj.positionerElement),Se=_j(he),Ce=he??Se,we=b.useMemo(()=>x&&Array.isArray(B)&&B.length===0?``:jj(B,C),[x,B,C]),Te=b.useMemo(()=>x&&Array.isArray(B)?B.map(e=>jj(e,C)):jj(B,C),[x,B,C]);TS(Jm(_e.state.triggerElement),{id:R,value:B,getValue:Z(()=>Te)});let Ee=b.useRef(B);X(()=>{B!==Ee.current&&_e.set(`forceMount`,!0)},[_e,B]),X(()=>{N(x?Array.isArray(B)&&B.length>0:B!=null)},[x,B,N]),X(function(){if(V)return;let e=oe.current;if(x){let t=Array.isArray(B)?B:[];if(t.length===0){_e.set(`selectedIndex`,null);return}let n=t[t.length-1],r=Tj(e,n,w);_e.set(`selectedIndex`,r===-1?null:r);return}let t=Tj(e,B,w);_e.set(`selectedIndex`,t===-1?null:t)},[x,V,B,oe,w,_e]),Hb(B,()=>{D(ee),O(B!==M.initialValue),j()?I.commit(B):I.commit(B,!0)});let De=Z((e,t)=>{if(s?.(e,t),!t.isCanceled&&(H(e),!e&&(t.reason===`focus-out`||t.reason===`outside-press`)&&(k(!0),A(!1),L===`onBlur`&&I.commit(B)),!e&&_e.state.activeIndex!==null)){let e=ne.current[_e.state.activeIndex];queueMicrotask(()=>{e?.setAttribute(`tabindex`,`-1`)})}}),Oe=Z(()=>{pe(!1),_e.update({activeIndex:null,openMethod:null}),_?.(!1)});Zy({enabled:!h,open:V,ref:re,onComplete(){V||Oe()}}),b.useImperativeHandle(h,()=>({unmount:Oe}),[Oe]);let ke=Z((e,t)=>{i?.(e,t),!t.isCanceled&&te(e)}),Ae=Z(()=>{let e=_e.state.listElement||re.current;if(!e)return;let t=Ij(e.scrollHeight,e.clientHeight),n=Lj(e.scrollTop,t),r=n>0,i=n<t;_e.state.scrollUpArrowVisible!==r&&_e.set(`scrollUpArrowVisible`,r),_e.state.scrollDownArrowVisible!==i&&_e.set(`scrollDownArrowVisible`,i)}),je=sb({open:V,onOpenChange:De,elements:{reference:be,floating:xe}}),{getReferenceProps:Me,getFloatingProps:Ne,getItemProps:Pe}=bb([ov(je,{enabled:!f&&!z,event:`mousedown`}),pv(je,{bubbles:!1}),kb(je,{enabled:!f&&!z,listRef:ne,activeIndex:ve,selectedIndex:ye,disabledIndices:rm,onNavigate(e){e===null&&!V||_e.set(`activeIndex`,e)},focusItemOnHover:T}),Mb(je,{enabled:!f&&!z&&(V||!x),listRef:U,activeIndex:ve,selectedIndex:ye,onMatch(e){V?_e.set(`activeIndex`,e):ke(oe.current[e],Lm(`none`))},onTypingChange(e){se.current=e}})]),Fe=b.useMemo(()=>u_(Me(),ge,R?{id:R}:im),[Me,ge,R]);ip(()=>{_e.update({popupProps:Ne(),triggerProps:Fe})}),X(()=>{_e.update({id:R,modal:m,multiple:x,value:B,open:V,mounted:fe,transitionStatus:me,popupProps:Ne(),triggerProps:Fe,items:v,itemToStringLabel:S,itemToStringValue:C,isItemEqualToValue:w,openMethod:Ce})},[_e,R,m,x,B,V,fe,me,Ne,Fe,v,S,C,w,Ce]);let Ie=b.useMemo(()=>({store:_e,name:ee,required:p,disabled:z,readOnly:f,multiple:x,highlightItemOnHover:T,setValue:ke,setOpen:De,listRef:ne,popupRef:re,scrollHandlerRef:W,handleScrollArrowVisibility:Ae,scrollArrowsMountedCountRef:ie,getItemProps:Pe,events:je.context.events,valueRef:ae,valuesRef:oe,labelsRef:U,typingRef:se,selectionRef:ue,selectedItemTextRef:le,validation:I,onOpenChangeComplete:_,keyboardActiveRef:ce,alignItemWithTriggerActiveRef:de,initialValueRef:Ee}),[_e,ee,p,z,f,x,T,ke,De,Pe,je.context.events,I,_,Ae]),Le=Hm(g,I.inputRef),Re=x&&Array.isArray(B)&&B.length>0,ze=x?void 0:ee,Be=b.useMemo(()=>!x||!Array.isArray(B)||!ee?null:B.map(e=>{let t=jj(e,C);return(0,y.jsx)(`input`,{type:`hidden`,form:l,name:ee,value:t},t)}),[x,B,l,ee,C]);return(0,y.jsx)(vj.Provider,{value:Ie,children:(0,y.jsxs)(yj.Provider,{value:je,children:[E,(0,y.jsx)(`input`,{...I.getInputValidationProps({onFocus(){_e.state.triggerElement?.focus({focusVisible:!0})},onChange(e){if(e.nativeEvent.defaultPrevented)return;let t=e.currentTarget.value,n=Lm(wm,e.nativeEvent);function r(){if(x)return;let e=oe.current.find(e=>jj(e,C).toLowerCase()===t.toLowerCase()||Aj(e,S).toLowerCase()===t.toLowerCase());e!=null&&(O(e!==M.initialValue),ke(e,n),j()&&I.commit(e))}_e.set(`forceMount`,!0),queueMicrotask(r)}}),id:R&&ze==null?`${R}-hidden-input`:void 0,form:l,name:ze,autoComplete:u,value:we,disabled:z,required:p&&!Re,readOnly:f,ref:Le,style:ee?nh:th,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),Be]})})}function zj(e,t){return e??t}function Bj(e){let t=e.getBoundingClientRect(),n=sp(e),r=n.getComputedStyle(e,`::before`),i=n.getComputedStyle(e,`::after`);if(!(r.content!==`none`||i.content!==`none`))return t;let a=parseFloat(r.width)||0,o=parseFloat(r.height)||0,s=parseFloat(i.width)||0,c=parseFloat(i.height)||0,l=Math.max(t.width,a,s),u=Math.max(t.height,o,c),d=l-t.width,f=u-t.height;return{left:t.left-d/2,right:t.right+d/2,top:t.top-f/2,bottom:t.bottom+f/2}}var Vj=2,Hj=400,Uj=200,Wj={...ox,...pS,value:()=>null},Gj=b.forwardRef(function(e,t){let{render:n,className:r,id:i,disabled:a=!1,nativeButton:o=!0,style:s,...c}=e,{setTouched:l,setFocused:u,validationMode:d,state:f,disabled:p}=hS(),{labelId:m}=yS(),{store:h,setOpen:g,selectionRef:_,validation:v,readOnly:y,required:x,alignItemWithTriggerActiveRef:S,disabled:C,keyboardActiveRef:w}=bj(),T=p||C||a,E=Ly(h,Pj.open),D=Ly(h,Pj.value),O=Ly(h,Pj.triggerProps),k=Ly(h,Pj.positionerElement),A=Ly(h,Pj.listElement),j=Ly(h,Pj.id),M=Ly(h,Pj.labelId),N=Ly(h,Pj.hasSelectedValue),P=!N&&E,F=Ly(h,Pj.hasNullItemLabel,P),I=i??j,L=zj(m,M);CS({id:I});let R=Jm(k),z=b.useRef(null),{getButtonProps:ee,buttonRef:B}=px({disabled:T,native:o}),te=Hm(t,z,B,Z(e=>{h.set(`triggerElement`,e)})),V=Zp(),H=Zp(),ne=Zp(),U=Zp();b.useEffect(()=>{if(E)return N||F?U.start(Uj,()=>{_.current.allowUnselectedMouseUp=!0,ne.start(Uj,()=>{_.current.allowSelectedMouseUp=!0})}):ne.start(Hj,()=>{_.current.allowUnselectedMouseUp=!0,_.current.allowSelectedMouseUp=!0}),()=>{ne.clear(),U.clear()};_.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1},H.clear()},[E,N,F,_,H,ne,U]);let re=b.useMemo(()=>A?.id??bh(k)?.id,[A,k]),W=u_(O,{id:I,role:`combobox`,"aria-expanded":E?`true`:`false`,"aria-haspopup":`listbox`,"aria-controls":E?re:void 0,"aria-labelledby":L,"aria-readonly":y||void 0,"aria-required":x||void 0,tabIndex:T?-1:0,ref:te,onFocus(e){u(!0),E&&S.current&&g(!1,Lm(wm,e.nativeEvent)),V.start(0,()=>{h.set(`forceMount`,!0)})},onBlur(e){dh(k,e.relatedTarget)||(l(!0),u(!1),d===`onBlur`&&v.commit(D))},onPointerMove(){w.current=!1},onKeyDown(){w.current=!0},onMouseDown(e){if(E)return;let t=Wp(e.currentTarget);function n(e){if(!z.current)return;let t=e.target;if(dh(z.current,t)||dh(R.current,t)||t===z.current)return;let n=Bj(z.current);e.clientX>=n.left-Vj&&e.clientX<=n.right+Vj&&e.clientY>=n.top-Vj&&e.clientY<=n.bottom+Vj||g(!1,Lm(Nm,e))}H.start(0,()=>{t.addEventListener(`mouseup`,n,{once:!0})})}},v.getValidationProps,c,ee);W.role=`combobox`;let ie={...f,open:E,disabled:T,value:D,readOnly:y,placeholder:!N};return w_(`button`,e,{ref:[t,z],state:ie,stateAttributesMapping:Wj,props:W})}),Kj={value:()=>null},qj=b.forwardRef(function(e,t){let{className:n,render:r,children:i,placeholder:a,style:o,...s}=e,{store:c,valueRef:l}=bj(),u=Ly(c,Pj.value),d=Ly(c,Pj.items),f=Ly(c,Pj.itemToStringLabel),p=Ly(c,Pj.hasSelectedValue),m=!p&&a!=null&&i==null,h=Ly(c,Pj.hasNullItemLabel,m),g={value:u,placeholder:!p},_=null;return _=typeof i==`function`?i(u):i??(!p&&a!=null&&!h?a:Array.isArray(u)?Nj(u,d,f):Mj(u,d,f)),w_(`span`,e,{state:g,ref:[t,l],props:[{children:_},s],stateAttributesMapping:Kj})}),Jj=b.forwardRef(function(e,t){let{className:n,render:r,style:i,...a}=e,{store:o}=bj();return w_(`span`,e,{state:{open:Ly(o,Pj.open)},ref:t,props:[{"aria-hidden":!0,children:`▼`},a],stateAttributesMapping:ax})}),Yj=b.createContext(void 0),Xj=b.forwardRef(function(e,t){let{store:n}=bj(),r=Ly(n,Pj.mounted),i=Ly(n,Pj.forceMount);return r||i?(0,y.jsx)(Yj.Provider,{value:!0,children:(0,y.jsx)(B_,{ref:t,...e})}):null}),Zj=b.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});function Qj(){return b.useContext(Zj)}function $j(e){let{children:t,elementsRef:n,labelsRef:r,onMapChange:i}=e,a=Z(i),o=b.useRef(0),s=Kp(tM).current,c=Kp(eM).current,[l,u]=b.useState(0),d=b.useRef(l),f=Z((e,t)=>{c.set(e,t??null),d.current+=1,u(d.current)}),p=Z(e=>{c.delete(e),d.current+=1,u(d.current)}),m=b.useMemo(()=>{let e=new Map;return Array.from(c.keys()).filter(e=>e.isConnected).sort(nM).forEach((t,n)=>{let r=c.get(t)??{};e.set(t,{...r,index:n})}),e},[c,l]);X(()=>{if(typeof MutationObserver!=`function`||m.size===0)return;let e=new MutationObserver(e=>{let t=new Set,n=e=>t.has(e)?t.delete(e):t.add(e);e.forEach(e=>{e.removedNodes.forEach(n),e.addedNodes.forEach(n)}),t.size===0&&(d.current+=1,u(d.current))});return m.forEach((t,n)=>{n.parentElement&&e.observe(n.parentElement,{childList:!0})}),()=>{e.disconnect()}},[m]),X(()=>{d.current===l&&(n.current.length!==m.size&&(n.current.length=m.size),r&&r.current.length!==m.size&&(r.current.length=m.size),o.current=m.size),a(m)},[a,m,n,r,l]),X(()=>()=>{n.current=[]},[n]),X(()=>()=>{r&&(r.current=[])},[r]);let h=Z(e=>(s.add(e),()=>{s.delete(e)}));X(()=>{s.forEach(e=>e(m))},[s,m]);let g=b.useMemo(()=>({register:f,unregister:p,subscribeMapChange:h,elementsRef:n,labelsRef:r,nextIndexRef:o}),[f,p,h,n,r,o]);return(0,y.jsx)(Zj.Provider,{value:g,children:t})}function eM(){return new Map}function tM(){return new Set}function nM(e,t){let n=e.compareDocumentPosition(t);return n&Node.DOCUMENT_POSITION_FOLLOWING||n&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:n&Node.DOCUMENT_POSITION_PRECEDING||n&Node.DOCUMENT_POSITION_CONTAINS?1:0}var rM=b.createContext(void 0);function iM(){return b.useContext(rM)?.direction??`ltr`}var aM=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0,offsetParent:d=`real`}=kh(e,t)||{};if(l==null)return{};let f=qh(u),p={x:n,y:r},m=Fh(i),h=Nh(m),g=await o.getDimensions(l),_=m===`y`,v=_?`top`:`left`,y=_?`bottom`:`right`,b=_?`clientHeight`:`clientWidth`,x=a.reference[h]+a.reference[m]-p[m]-a.floating[h],S=p[m]-a.reference[m],C=d===`real`?await o.getOffsetParent?.(l):s.floating,w=s.floating[b]||a.floating[h];(!w||!await o.isElement?.(C))&&(w=s.floating[b]||a.floating[h]);let T=x/2-S/2,E=w/2-g[h]/2-1,D=Math.min(f[v],E),O=Math.min(f[y],E),k=D,A=w-g[h]-O,j=w/2-g[h]/2+T,M=Oh(k,j,A),N=!c.arrow&&jh(i)!=null&&j!==M&&a.reference[h]/2-(j<k?D:O)-g[h]/2<0,P=N?j<k?j-k:j-A:0;return{[m]:p[m]+P,data:{[m]:M,centerOffset:j-M-P,...N&&{alignmentOffset:P}},reset:N}}}),oM=(e,t)=>({...aM(e),options:[e,t]}),sM={name:`hide`,async fn(e){let{width:t,height:n,x:r,y:i}=e.rects.reference,a=t===0&&n===0&&r===0&&i===0;return{data:{referenceHidden:(await Sy().fn(e)).data?.referenceHidden||a}}}},cM={sideX:`left`,sideY:`top`},lM={name:`adaptiveOrigin`,async fn(e){let{x:t,y:n,rects:{floating:r},elements:{floating:i},platform:a,strategy:o,placement:s}=e,c=sp(i),l=c.getComputedStyle(i);if(!(l.transitionDuration!==`0s`&&l.transitionDuration!==``))return{x:t,y:n,data:cM};let u=await a.getOffsetParent?.(i),d={width:0,height:0};if(o===`fixed`&&c?.visualViewport)d={width:c.visualViewport.width,height:c.visualViewport.height};else if(u===c){let e=Wp(i);d={width:e.documentElement.clientWidth,height:e.documentElement.clientHeight}}else await a.isElement?.(u)&&(d=await a.getDimensions(u));let f=Ah(s),p=t,m=n;f===`left`&&(p=d.width-(t+r.width)),f===`top`&&(m=d.height-(n+r.height));let h=f===`left`?`right`:cM.sideX,g=f===`top`?`bottom`:cM.sideY;return{x:p,y:m,data:{sideX:h,sideY:g}}}};function uM(e,t,n){let r=e===`inline-start`||e===`inline-end`;return{top:`top`,right:r?n?`inline-start`:`inline-end`:`right`,bottom:`bottom`,left:r?n?`inline-end`:`inline-start`:`left`}[t]}function dM(e,t,n){let{rects:r,placement:i}=e;return{side:uM(t,Ah(i),n),align:jh(i)||`center`,anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function fM(e){let{anchor:t,positionMethod:n=`absolute`,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,collisionBoundary:s,collisionPadding:c=5,sticky:l=!1,arrowPadding:u=5,disableAnchorTracking:d=!1,keepMounted:f=!1,floatingRootContext:p,mounted:m,collisionAvoidance:h,shiftCrossAxis:g=!1,nodeId:_,adaptiveOrigin:v,lazyFlip:y=!1,externalTree:x}=e,[S,C]=b.useState(null);!m&&S!==null&&C(null);let w=h.side||`flip`,T=h.align||`flip`,E=h.fallbackAxisSide||`end`,D=typeof t==`function`?t:void 0,O=Z(D),k=D?O:t,A=Jm(t),j=Jm(m),M=iM()===`rtl`,N=S||{top:`top`,right:`right`,bottom:`bottom`,left:`left`,"inline-end":M?`left`:`right`,"inline-start":M?`right`:`left`}[r],P=a===`center`?N:`${N}-${a}`,F=c,I=+(r===`bottom`),L=+(r===`top`),R=+(r===`right`),z=+(r===`left`);typeof F==`number`?F={top:F+I,right:F+z,bottom:F+L,left:F+R}:F&&={top:(F.top||0)+I,right:(F.right||0)+z,bottom:(F.bottom||0)+L,left:(F.left||0)+R};let ee={boundary:s===`clipping-ancestors`?`clippingAncestors`:s,padding:F},B=b.useRef(null),te=Jm(i),V=Jm(o),H=[_y(e=>{let t=dM(e,r,M),n=typeof te.current==`function`?te.current(t):te.current,i=typeof V.current==`function`?V.current(t):V.current;return{mainAxis:n,crossAxis:i,alignmentAxis:i}},[typeof i==`function`?0:i,typeof o==`function`?0:o,M,r])],ne=T===`none`&&w!==`shift`,U=!ne&&(l||g||w===`shift`),re=w===`none`?null:by({...ee,padding:{top:F.top+1,right:F.right+1,bottom:F.bottom+1,left:F.left+1},mainAxis:!g&&w===`flip`,crossAxis:T===`flip`?`alignment`:!1,fallbackAxisSideDirection:E}),W=ne?null:vy(e=>{let t=Wp(e.elements.floating).documentElement;return{...ee,rootBoundary:g?{x:0,y:0,width:t.clientWidth,height:t.clientHeight}:void 0,mainAxis:T!==`none`,crossAxis:U,limiter:l||g?void 0:yy(e=>{if(!B.current)return{};let{width:t,height:n}=B.current.getBoundingClientRect(),r=Ph(Ah(e.placement)),i=r===`y`?t:n,a=r===`y`?F.left+F.right:F.top+F.bottom;return{offset:i/2+a/2}})}},[ee,l,g,F,T]);w===`shift`||T===`shift`||a===`center`?H.push(W,re):H.push(re,W),H.push(xy({...ee,apply({elements:{floating:e},availableWidth:t,availableHeight:n,rects:r}){if(!j.current)return;let i=e.style;i.setProperty(`--available-width`,`${t}px`),i.setProperty(`--available-height`,`${n}px`);let a=sp(e).devicePixelRatio||1,{x:o,y:s,width:c,height:l}=r.reference,u=(Math.round((o+c)*a)-Math.round(o*a))/a,d=(Math.round((s+l)*a)-Math.round(s*a))/a;i.setProperty(`--anchor-width`,`${u}px`),i.setProperty(`--anchor-height`,`${d}px`)}}),oM(()=>({element:B.current||Wp(B.current).createElement(`div`),padding:u,offsetParent:`floating`}),[u]),{name:`transformOrigin`,fn(e){let{elements:t,middlewareData:n,placement:a,rects:o,y:s}=e,c=Ah(a),l=Ph(c),u=B.current,d=n.arrow?.x||0,f=n.arrow?.y||0,p=u?.clientWidth||0,m=u?.clientHeight||0,h=d+p/2,g=f+m/2,_=Math.abs(n.shift?.y||0),v=o.reference.height/2,y=typeof i==`function`?i(dM(e,r,M)):i,b=_>y,x={top:`${h}px calc(100% + ${y}px)`,bottom:`${h}px ${-y}px`,left:`calc(100% + ${y}px) ${g}px`,right:`${-y}px ${g}px`}[c],S=`${h}px ${o.reference.y+v-s}px`;return t.floating.style.setProperty(`--transform-origin`,U&&l===`y`&&b?S:x),{}}},sM,v),X(()=>{!m&&p&&p.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[m,p]);let ie=b.useMemo(()=>({elementResize:!d&&typeof ResizeObserver<`u`,layoutShift:!d&&typeof IntersectionObserver<`u`}),[d]),{refs:ae,elements:oe,x:se,y:ce,middlewareData:le,update:ue,placement:de,context:fe,isPositioned:pe,floatingStyles:me}=cb({rootContext:p,open:f?m:void 0,placement:P,middleware:H,strategy:n,whileElementsMounted:f?void 0:(...e)=>ry(...e,ie),nodeId:_,externalTree:x}),{sideX:he,sideY:ge}=le.adaptiveOrigin||cM,_e=pe?n:`fixed`,ve=b.useMemo(()=>{let e=v?{position:_e,[he]:se,[ge]:ce}:{position:_e,...me};return pe||(e.opacity=0),e},[v,_e,he,se,ge,ce,me,pe]),ye=b.useRef(null);X(()=>{if(!m)return;let e=A.current,t=typeof e==`function`?e():e,n=(pM(t)?t.current:t)||null;n!==ye.current&&(ae.setPositionReference(n),ye.current=n)},[m,ae,k,A]),b.useEffect(()=>{if(!m)return;let e=A.current;typeof e!=`function`&&pM(e)&&e.current!==ye.current&&(ae.setPositionReference(e.current),ye.current=e.current)},[m,ae,k,A]),b.useEffect(()=>{if(f&&m&&oe.domReference&&oe.floating)return ry(oe.domReference,oe.floating,ue,ie)},[f,m,oe,ue,ie]);let be=Ah(de),xe=uM(r,be,M),Se=jh(de)||`center`,Ce=!!le.hide?.referenceHidden;X(()=>{y&&m&&pe&&C(be)},[y,m,pe,be]);let we=b.useMemo(()=>({position:`absolute`,top:le.arrow?.y,left:le.arrow?.x}),[le.arrow]),Te=le.arrow?.centerOffset!==0;return b.useMemo(()=>({positionerStyles:ve,arrowStyles:we,arrowRef:B,arrowUncentered:Te,side:xe,align:Se,physicalSide:be,anchorHidden:Ce,refs:ae,context:fe,isPositioned:pe,update:ue}),[ve,we,B,Te,xe,Se,be,Ce,ae,fe,pe,ue])}function pM(e){return e!=null&&`current`in e}var mM=b.createContext(void 0);function hM(){let e=b.useContext(mM);if(!e)throw Error(t_(59));return e}function gM(e,t){e&&Object.assign(e.style,t)}var _M={position:`relative`,maxHeight:`100%`,overflowX:`hidden`,overflowY:`auto`};function vM(e){return e===`starting`?A_:im}function yM(e,t,{styles:n,transitionStatus:r,props:i,refs:a,hidden:o,inert:s=!1}){let c={...n};return s&&(c.pointerEvents=`none`),w_(`div`,e,{state:t,ref:a,props:[{role:`presentation`,hidden:o,style:c},vM(r),i],stateAttributesMapping:sx})}var bM=20;function xM(e,t,n,r){let[i,a]=b.useState(!1);X(()=>{if(!e||!t||n==null){a(!1);return}let r=Wp(n).documentElement.clientWidth,i=n.offsetWidth;a(r>0&&i>0&&i>=r-bM)},[e,t,n]),pm(e&&(!t||i),r)}var SM={position:`fixed`},CM=b.forwardRef(function(e,t){let{anchor:n,positionMethod:r=`absolute`,className:i,render:a,side:o=`bottom`,align:s=`center`,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m,alignItemWithTrigger:h=!0,collisionAvoidance:g=M_,style:_,...v}=e,{store:x,listRef:S,labelsRef:C,alignItemWithTriggerActiveRef:w,selectedItemTextRef:T,valuesRef:E,initialValueRef:D,popupRef:O,setValue:k}=bj(),A=xj(),j=Ly(x,Pj.open),M=Ly(x,Pj.mounted),N=Ly(x,Pj.modal),P=Ly(x,Pj.value),F=Ly(x,Pj.openMethod),I=Ly(x,Pj.positionerElement),L=Ly(x,Pj.triggerElement),R=Ly(x,Pj.isItemEqualToValue),z=Ly(x,Pj.transitionStatus),ee=b.useRef(null),B=b.useRef(null),[te,V]=b.useState(h),H=M&&te&&F!==`touch`;!M&&te!==h&&V(h),X(()=>{M||(Pj.scrollUpArrowVisible(x.state)&&x.set(`scrollUpArrowVisible`,!1),Pj.scrollDownArrowVisible(x.state)&&x.set(`scrollDownArrowVisible`,!1))},[x,M]),b.useImperativeHandle(w,()=>H),xM((H||N)&&j,F===`touch`,I,L);let ne=fM({anchor:n,floatingRootContext:A,positionMethod:r,mounted:M,side:o,sideOffset:c,align:s,alignOffset:l,arrowPadding:f,collisionBoundary:u,collisionPadding:d,sticky:p,disableAnchorTracking:m??H,collisionAvoidance:g,keepMounted:!0}),U=H?`none`:ne.side,re=H?SM:ne.positionerStyles,W=yM(e,{open:j,side:U,align:ne.align,anchorHidden:ne.anchorHidden},{styles:re,transitionStatus:z,props:v,refs:[t,Z(e=>{x.set(`positionerElement`,e)})],hidden:!M,inert:!j}),ie=b.useRef(0),ae=Z(e=>{if(e.size===0&&ie.current===0||E.current.length===0)return;let t=ie.current;if(ie.current=e.size,e.size===t)return;let n=Lm(wm);if(t!==0&&!x.state.multiple&&P!==null&&Tj(E.current,P,R)===-1){let e=D.current,t=e!=null&&Tj(E.current,e,R)!==-1?e:null;k(t,n),t===null&&(x.set(`selectedIndex`,null),T.current=null)}if(t!==0&&x.state.multiple&&Array.isArray(P)){let e=e=>Tj(E.current,e,R)!==-1,t=P.filter(t=>e(t));(t.length!==P.length||t.some(e=>!wj(P,e,R)))&&(k(t,n),t.length===0&&(x.set(`selectedIndex`,null),T.current=null))}if(j&&H){x.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});let e={height:``};gM(I,e),gM(O.current,e)}}),oe=b.useMemo(()=>({...ne,side:U,alignItemWithTriggerActive:H,setControlledAlignItemWithTrigger:V,scrollUpArrowRef:ee,scrollDownArrowRef:B}),[ne,U,H,V]);return(0,y.jsx)($j,{elementsRef:S,labelsRef:C,onMapChange:ae,children:(0,y.jsxs)(mM.Provider,{value:oe,children:[M&&N&&(0,y.jsx)(Px,{inert:Nx(!j),cutout:L}),W]})})}),wM=`base-ui-disable-scrollbar`,TM={className:wM,getElement(e){return(0,y.jsx)(`style`,{nonce:e,href:wM,precedence:`base-ui:low`,children:`.${wM}{scrollbar-width:none}.${wM}::-webkit-scrollbar{display:none}`})}},EM=b.createContext(void 0);function DM(e){let t=b.useContext(EM);if(t===void 0&&!e)throw Error(t_(69));return t}var OM=b.createContext(void 0),kM={disableStyleElements:!1};function AM(){return b.useContext(OM)??kM}var jM={...sx,...Yy},MM=b.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,...o}=e,{store:s,popupRef:c,onOpenChangeComplete:l,setOpen:u,valueRef:d,selectedItemTextRef:f,keyboardActiveRef:p,multiple:m,handleScrollArrowVisibility:h,scrollHandlerRef:g,listRef:_,highlightItemOnHover:v}=bj(),{side:x,align:S,alignItemWithTriggerActive:C,isPositioned:w,setControlledAlignItemWithTrigger:T,scrollDownArrowRef:E,scrollUpArrowRef:D}=hM(),O=DM(!0)!=null,k=xj(),A=iM(),{nonce:j,disableStyleElements:M}=AM(),N=Ly(s,Pj.id),P=Ly(s,Pj.open),F=Ly(s,Pj.mounted),I=Ly(s,Pj.popupProps),L=Ly(s,Pj.transitionStatus),R=Ly(s,Pj.triggerElement),z=Ly(s,Pj.positionerElement),ee=Ly(s,Pj.listElement),B=b.useRef(!1),te=b.useRef(!1),V=b.useRef({}),H=tm(),ne=Z(e=>{if(!z||!c.current||!te.current)return;if(B.current||!C){h();return}let t=z.style.top===`0px`,n=z.style.bottom===`0px`;if(!t&&!n){h();return}let r=FM(z),i=IM(z.getBoundingClientRect().height,`y`,r),a=Wp(z),o=getComputedStyle(z),s=parseFloat(o.marginTop),l=parseFloat(o.marginBottom),u=NM(getComputedStyle(c.current)),d=Math.min(a.documentElement.clientHeight-s-l,u),f=e.scrollTop,p=PM(e),m=0,g=null,_=!1,v=!1,y=e=>{z.style.height=`${e}px`},b=(t,n)=>{let r=Fj(t,0,d-i);r>0&&y(i+r),e.scrollTop=n,d-(i+r)<=1&&(B.current=!0),h()},x=t?p-f:f,S=Math.min(i+x,d);if(m=S,x<=1){b(x,t?p:0);return}if(d-S>1?t?v=!0:g=0:(_=!0,n&&f<p&&(g=f-(x-(i+x-d)))),m=Math.ceil(m),m!==0&&y(m),v||g!=null){let t=PM(e),n=v?t:Fj(g,0,t);Math.abs(e.scrollTop-n)>1&&(e.scrollTop=n)}(_||m>=d-1)&&(B.current=!0),h()});b.useImperativeHandle(g,()=>ne,[ne]),Zy({open:P,ref:c,onComplete(){P&&l?.(!0)}});let U={open:P,transitionStatus:L,side:x,align:S};X(()=>{!z||!c.current||Object.keys(V.current).length||(V.current={top:z.style.top||`0`,left:z.style.left||`0`,right:z.style.right,height:z.style.height,bottom:z.style.bottom,minHeight:z.style.minHeight,maxHeight:z.style.maxHeight,marginTop:z.style.marginTop,marginBottom:z.style.marginBottom})},[c,z]),X(()=>{P||C||(te.current=!1,B.current=!1,gM(z,V.current))},[P,C,z,c]),X(()=>{let e=c.current;if(!P||!R||!z||!e||C&&!w||s.state.transitionStatus===`ending`)return;if(!C){te.current=!0,H.request(h),e.style.removeProperty(`--transform-origin`);return}let t=zM(e);e.style.removeProperty(`--transform-origin`);try{let t=f.current,n=d.current,r=getComputedStyle(z),i=getComputedStyle(e),a=Wp(R),o=sp(z),c=FM(R),l=LM(R.getBoundingClientRect(),c),u=LM(z.getBoundingClientRect(),c),p=l.height,m=ee||e,g=m.scrollHeight,y=parseFloat(i.borderBottomWidth),b=parseFloat(r.marginTop)||10,x=parseFloat(r.marginBottom)||10,S=parseFloat(r.minHeight)||100,C=NM(i),w=a.documentElement.clientHeight-b-x,E=a.documentElement.clientWidth,D=w-l.bottom+p,O,k=A===`rtl`?l.right-u.width:l.left,j=0;if(t&&n){let e=LM(n.getBoundingClientRect(),c);O=LM(t.getBoundingClientRect(),c),k=u.left+(A===`rtl`?e.right-O.right:e.left-O.left);let r=e.top-l.top+e.height/2;j=O.top-u.top+O.height/2-r}let M=D+j+x+y,N=Math.min(w,M),P=w-b-x,F=M-N,I=E-5;z.style.left=`${Fj(k,5,I-u.width)}px`,z.style.height=`${N}px`,z.style.maxHeight=`auto`,z.style.marginTop=`${b}px`,z.style.marginBottom=`${x}px`,e.style.height=`100%`;let L=PM(m),H=F>=L-1;H&&(N=Math.min(w,u.height)-(F-L));let ne=l.top<20||l.bottom>w-20||Math.ceil(N)+1<Math.min(g,S),U=(o.visualViewport?.scale??1)!==1&&Fp;if(ne||U){te.current=!0,gM(z,V.current),T(!1);return}let re=Math.max(S,N);if(H){let e=Math.max(0,w-M);z.style.top=u.height>=P?`0`:`${e}px`,z.style.height=`${N}px`,m.scrollTop=PM(m)}else z.style.bottom=`0`,m.scrollTop=F;if(O){let t=u.top,n=u.height,r=O.top+O.height/2,i=Fj(n>0?(r-t)/n*100:50,0,100);e.style.setProperty(`--transform-origin`,`50% ${i}%`)}(re===w||N>=C)&&(B.current=!0),h(),v&&s.state.selectedIndex===null&&s.state.activeIndex===null&&_.current[0]!=null&&s.set(`activeIndex`,0),te.current=!0}finally{t()}},[s,P,z,R,d,f,c,h,C,T,H,E,D,ee,_,v,A,w]),b.useEffect(()=>{if(!C||!z||!P)return;let e=sp(z);function t(e){u(!1,Lm(Im,e))}return Ap(e,`resize`,t)},[u,C,z,P]);let re={...ee?{role:`presentation`,"aria-orientation":void 0}:{role:`listbox`,"aria-multiselectable":m||void 0,id:`${N}-list`},onKeyDown(e){p.current=!0,O&&Ax.has(e.key)&&e.stopPropagation()},onMouseMove(){p.current=!1},onScroll(e){ee||ne(e.currentTarget)},...C&&{style:ee?{height:`100%`}:_M}},W=w_(`div`,e,{ref:[t,c],state:U,stateAttributesMapping:jM,props:[I,re,vM(L),{className:!ee&&C?TM.className:void 0},o]});return(0,y.jsxs)(b.Fragment,{children:[!M&&TM.getElement(j),(0,y.jsx)(av,{context:k,modal:!1,disabled:!F,returnFocus:a,restoreFocus:!0,children:W})]})});function NM(e){let t=e.maxHeight||``;return t.endsWith(`px`)&&parseFloat(t)||1/0}function PM(e){return Ij(e.scrollHeight,e.clientHeight)}function FM(e){return ey.getScale(e)}function IM(e,t,n){return e/n[t]}function LM(e,t){return Jh({x:IM(e.x,`x`,t),y:IM(e.y,`y`,t),width:IM(e.width,`x`,t),height:IM(e.height,`y`,t)})}var RM=[[`transform`,`none`],[`scale`,`1`],[`translate`,`0 0`]];function zM(e){let{style:t}=e,n={};for(let[e,r]of RM)n[e]=t.getPropertyValue(e),t.setProperty(e,r,`important`);return()=>{for(let[e]of RM){let r=n[e];r?t.setProperty(e,r):t.removeProperty(e)}}}var BM=b.forwardRef(function(e,t){let{className:n,render:r,style:i,...a}=e,{store:o,scrollHandlerRef:s}=bj(),{alignItemWithTriggerActive:c}=hM(),l=Ly(o,Pj.hasScrollArrows),u=Ly(o,Pj.openMethod),d=Ly(o,Pj.multiple),f={id:`${Ly(o,Pj.id)}-list`,role:`listbox`,"aria-multiselectable":d||void 0,onScroll(e){s.current?.(e.currentTarget)},...c&&{style:_M},className:l&&u!==`touch`?TM.className:void 0};return w_(`div`,e,{ref:[t,Z(e=>{o.set(`listElement`,e)})],props:[f,a]})}),VM=function(e){return e[e.None=0]=`None`,e[e.GuessFromOrder=1]=`GuessFromOrder`,e}({});function HM(e={}){let{label:t,metadata:n,textRef:r,indexGuessBehavior:i,index:a}=e,{register:o,unregister:s,subscribeMapChange:c,elementsRef:l,labelsRef:u,nextIndexRef:d}=Qj(),f=b.useRef(-1),[p,m]=b.useState(a??(i===VM.GuessFromOrder?()=>{if(f.current===-1){let e=d.current;d.current+=1,f.current=e}return f.current}:-1)),h=b.useRef(null),g=b.useCallback(e=>{if(h.current=e,p!==-1&&e!==null&&(l.current[p]=e,u)){let n=t!==void 0;u.current[p]=n?t:r?.current?.textContent??e.textContent}},[p,l,u,t,r]);return X(()=>{if(a!=null)return;let e=h.current;if(e)return o(e,n),()=>{s(e)}},[a,o,s,n]),X(()=>{if(a==null)return c(e=>{let t=h.current?e.get(h.current)?.index:null;t!=null&&m(t)})},[a,c,m]),b.useMemo(()=>({ref:g,index:p}),[p,g])}var UM=b.createContext(void 0);function WM(){let e=b.useContext(UM);if(!e)throw Error(t_(57));return e}var GM=b.memo(b.forwardRef(function(e,t){let{render:n,className:r,value:i=null,label:a,disabled:o=!1,nativeButton:s=!1,style:c,...l}=e,u=b.useRef(null),d=HM({label:a,textRef:u,indexGuessBehavior:VM.GuessFromOrder}),{store:f,getItemProps:p,setOpen:m,setValue:h,selectionRef:g,typingRef:_,valuesRef:v,multiple:x,selectedItemTextRef:S}=bj(),C=Ly(f,Pj.isActive,d.index),w=Ly(f,Pj.isSelected,d.index,i),T=Ly(f,Pj.isSelectedByFocus,d.index),E=Ly(f,Pj.isItemEqualToValue),D=d.index,O=D!==-1,k=b.useRef(null),A=Jm(D);X(()=>{if(!O)return;let e=v.current;return e[D]=i,()=>{delete e[D]}},[O,D,i,v]),X(()=>{if(!O)return;let e=f.state.value,t=e;x&&Array.isArray(e)&&e.length>0&&(t=e[e.length-1]),t!==void 0&&Cj(i,t,E)&&(f.set(`selectedIndex`,D),u.current&&(S.current=u.current))},[O,D,x,E,f,i,S]);let j={disabled:o,selected:w,highlighted:C},M=p({active:C,selected:w});M.id=void 0;let N=b.useRef(null),P=b.useRef(`mouse`),F=b.useRef(!1),{getButtonProps:I,buttonRef:L}=px({disabled:o,focusableWhenDisabled:!0,native:s,composite:!0});function R(e){let t=f.state.value;if(x){let n=Array.isArray(t)?t:[];h(w?Ej(n,i,E):[...n,i],Lm(km,e))}else h(i,Lm(km,e)),m(!1,Lm(km,e))}let z={role:`option`,"aria-selected":w,tabIndex:C?0:-1,onTouchStart(){g.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}},onKeyDown(e){N.current=e.key,f.set(`activeIndex`,D),e.key===` `&&_.current&&e.preventDefault()},onClick(e){F.current=!1,!(e.type===`keydown`&&N.current===null)&&(o||e.type===`keydown`&&N.current===` `&&_.current||P.current!==`touch`&&!C||(N.current=null,R(e.nativeEvent)))},onPointerEnter(e){P.current=e.pointerType},onPointerDown(e){P.current=e.pointerType,F.current=!0},onMouseUp(){if(o)return;if(F.current){F.current=!1;return}let e=!g.current.allowSelectedMouseUp&&w,t=!g.current.allowUnselectedMouseUp&&!w;e||t||P.current!==`touch`&&!C||k.current?.click()}},ee=w_(`div`,e,{ref:[L,t,d.ref,k],state:j,props:[M,z,l,I]}),B=b.useMemo(()=>({selected:w,indexRef:A,textRef:u,selectedByFocus:T,hasRegistered:O}),[w,A,u,T,O]);return(0,y.jsx)(UM.Provider,{value:B,children:ee})})),KM=b.forwardRef(function(e,t){let n=e.keepMounted??!1,{selected:r}=WM();return n||r?(0,y.jsx)(qM,{...e,ref:t}):null}),qM=b.memo(b.forwardRef((e,t)=>{let{render:n,className:r,style:i,keepMounted:a,...o}=e,{selected:s}=WM(),c=b.useRef(null),{transitionStatus:l,setMounted:u}=Gy(s),d=w_(`span`,e,{ref:[t,c],state:{selected:s,transitionStatus:l},props:[{"aria-hidden":!0,children:`✔️`},o],stateAttributesMapping:Yy});return Zy({open:s,ref:c,onComplete(){s||u(!1)}}),d})),JM=b.memo(b.forwardRef(function(e,t){let{indexRef:n,textRef:r,selectedByFocus:i,hasRegistered:a}=WM(),{selectedItemTextRef:o}=bj(),{className:s,render:c,style:l,...u}=e;return w_(`div`,e,{ref:[b.useCallback(e=>{if(!e||!a)return;let t=o.current===null||!o.current.isConnected;(i||t&&n.current===0)&&(o.current=e)},[o,n,i,a]),t,r],props:u})})),YM=b.forwardRef(function(e,t){let{render:n,className:r,style:i,direction:a,keepMounted:o=!1,...s}=e,c=a===`up`,{store:l,popupRef:u,listRef:d,handleScrollArrowVisibility:f,scrollArrowsMountedCountRef:p}=bj(),{side:m,scrollDownArrowRef:h,scrollUpArrowRef:g}=hM(),_=Ly(l,c?Pj.scrollUpArrowVisible:Pj.scrollDownArrowVisible),v=Ly(l,Pj.openMethod),y=_&&v!==`touch`,b=Zp(),x=c?g:h,{transitionStatus:S,setMounted:C}=Gy(y);X(()=>(p.current+=1,l.state.hasScrollArrows||l.set(`hasScrollArrows`,!0),()=>{p.current=Math.max(0,p.current-1),p.current===0&&l.state.hasScrollArrows&&l.set(`hasScrollArrows`,!1)}),[l,p]),Zy({open:y,ref:x,onComplete(){y||C(!1)}});let w=w_(`div`,e,{ref:[t,x],state:{direction:a,visible:y,side:m,transitionStatus:S},props:[{"aria-hidden":!0,children:c?`▲`:`▼`,style:{position:`absolute`},onMouseMove(e){if(e.movementX===0&&e.movementY===0||b.isStarted())return;l.set(`activeIndex`,null);function t(){let e=l.state.listElement??u.current;if(!e)return;l.set(`activeIndex`,null),f();let n=Ij(e.scrollHeight,e.clientHeight),r=Lj(e.scrollTop,n),i=r===(c?0:n),a=d.current;if(r!==e.scrollTop&&(e.scrollTop=r),a.length===0&&l.set(c?`scrollUpArrowVisible`:`scrollDownArrowVisible`,!i),i){b.clear();return}if(a.length>0){let t=x.current?.offsetHeight||0;e.scrollTop=XM(a,c,r,e.clientHeight,t,n)}b.start(40,t)}b.start(40,t)},onMouseLeave(){b.clear()}},s]});return y||o?w:null});function XM(e,t,n,r,i,a){if(t){let t=0,r=n+i-1;for(let n=0;n<e.length;n+=1){let i=e[n];if(i&&i.offsetTop>=r){t=n;break}}let o=Math.max(0,t-1),s=e[o];return o<t&&s?Lj(s.offsetTop-i,a):0}let o=e.length-1,s=n+r-i+1;for(let t=0;t<e.length;t+=1){let n=e[t];if(n&&n.offsetTop+n.offsetHeight>s){o=Math.max(0,t-1);break}}let c=Math.min(e.length-1,o+1),l=e[c];return c>o&&l?Lj(l.offsetTop+l.offsetHeight-r+i,a):a}var ZM=b.forwardRef(function(e,t){return(0,y.jsx)(YM,{...e,ref:t,direction:`down`})}),QM=b.forwardRef(function(e,t){return(0,y.jsx)(YM,{...e,ref:t,direction:`up`})}),$M=Rj;function eN({className:e,...t}){return(0,y.jsx)(qj,{"data-slot":`select-value`,className:rp(`flex flex-1 text-left`,e),...t})}function tN({className:e,size:t=`default`,children:n,...r}){return(0,y.jsxs)(Gj,{"data-slot":`select-trigger`,"data-size":t,className:rp(`flex w-fit items-center justify-between gap-1.5 rounded-md border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...r,children:[n,(0,y.jsx)(Jj,{render:(0,y.jsx)(fd,{className:`pointer-events-none size-4 text-muted-foreground`})})]})}function nN({className:e,children:t,footer:n,side:r=`bottom`,sideOffset:i=4,align:a=`center`,alignOffset:o=0,alignItemWithTrigger:s=!0,...c}){return(0,y.jsx)(Xj,{children:(0,y.jsx)(CM,{side:r,sideOffset:i,align:a,alignOffset:o,alignItemWithTrigger:s,className:`isolate z-50`,children:(0,y.jsxs)(MM,{"data-slot":`select-content`,"data-align-trigger":s,className:rp(`relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-md bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...c,children:[(0,y.jsx)(iN,{}),(0,y.jsx)(BM,{children:t}),(0,y.jsx)(aN,{}),n]})})})}function rN({className:e,children:t,...n}){return(0,y.jsxs)(GM,{"data-slot":`select-item`,className:rp(`relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2`,e),...n,children:[(0,y.jsx)(JM,{className:`flex flex-1 shrink-0 gap-2 whitespace-nowrap`,children:t}),(0,y.jsx)(KM,{render:(0,y.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex size-4 items-center justify-center`}),children:(0,y.jsx)(dd,{className:`pointer-events-none`})})]})}function iN({className:e,...t}){return(0,y.jsx)(QM,{"data-slot":`select-scroll-up-button`,className:rp(`top-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4`,e),...t,children:(0,y.jsx)(pd,{})})}function aN({className:e,...t}){return(0,y.jsx)(ZM,{"data-slot":`select-scroll-down-button`,className:rp(`bottom-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4`,e),...t,children:(0,y.jsx)(fd,{})})}var oN=`h-7 justify-between gap-1.5 rounded-md border-border/60 bg-transparent px-2 text-xs font-normal text-foreground shadow-none focus-visible:border-ring/40 focus-visible:ring-1 focus-visible:ring-ring/40 dark:bg-transparent`,sN=`max-h-72 w-(--anchor-width) origin-(--transform-origin) gap-0 overflow-x-hidden p-1 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden`,cN=`rounded-sm py-1.5 pr-7 pl-2 text-xs hover:bg-foreground/10 hover:text-foreground focus:bg-foreground/10 focus:text-foreground`,lN=({value:e,items:t,ariaLabel:n,placeholder:r,onValueChange:i,open:a,onOpenChange:o,onItemHover:s,triggerClassName:c,triggerStyle:l,footerSlot:u})=>{let d=t.find(t=>t.id===e),f=d?.itemStyle?{...d.itemStyle,...l}:l;return(0,y.jsxs)($M,{value:e,onValueChange:i,open:a,onOpenChange:o,children:[(0,y.jsx)(tN,{size:`sm`,"aria-label":n,className:rp(oN,`w-full`,c),style:f,children:(0,y.jsx)(eN,{placeholder:r,children:()=>d?.label||r})}),(0,y.jsx)(nN,{alignItemWithTrigger:!1,sideOffset:4,className:rp(sN,Lx,Rx),footer:u?(0,y.jsx)(`div`,{className:`border-t border-border/40 p-1`,children:u}):void 0,children:t.map(e=>(0,y.jsx)(rN,{value:e.id,className:cN,style:e.itemStyle,onPointerEnter:s?()=>s(e.id):void 0,onFocus:s?()=>s(e.id):void 0,children:e.label},e.id))})]})};function uN(e){let{open:t,defaultOpen:n,onOpenChange:r,disabled:i}=e,a=t!==void 0,[o,s]=wS({controlled:t,default:n,name:`Collapsible`,state:`open`}),{mounted:c,setMounted:l,transitionStatus:u}=Gy(o,!0,!0),[d,f]=b.useState(o),[{height:p,width:m},h]=b.useState({height:void 0,width:void 0}),g=gx(),[_,v]=b.useState(),y=_??g,[x,S]=b.useState(!1),[C,w]=b.useState(!1),T=b.useRef(null),E=b.useRef(null),D=b.useRef(null),O=b.useRef(null),k=Xy(O,!1),A=Z(e=>{let t=!o,n=Lm(Tm,e.nativeEvent);if(r(t,n),n.isCanceled)return;let i=O.current;E.current===`css-animation`&&i!=null&&i.style.removeProperty(`animation-name`),!x&&!C&&(E.current!=null&&E.current!==`css-animation`&&!c&&t&&l(!0),E.current===`css-animation`&&(!d&&t&&f(!0),!c&&t&&l(!0))),s(t),E.current===`none`&&c&&!t&&l(!1)});return X(()=>{a&&E.current===`none`&&!o&&l(!1)},[a,o,t,l]),b.useMemo(()=>({abortControllerRef:T,animationTypeRef:E,disabled:i,handleTrigger:A,height:p,mounted:c,open:o,panelId:y,panelRef:O,runOnceAnimationsFinish:k,setDimensions:h,setHiddenUntilFound:S,setKeepMounted:w,setMounted:l,setOpen:s,setPanelIdState:v,setVisible:f,transitionDimensionRef:D,transitionStatus:u,visible:d,width:m}),[T,E,i,A,p,c,o,y,O,k,h,S,w,l,s,f,D,u,d,m])}var dN=b.createContext(void 0);function fN(){let e=b.useContext(dN);if(e===void 0)throw Error(t_(15));return e}var pN=function(e){return e.open=`data-open`,e.closed=`data-closed`,e[e.startingStyle=Ky.startingStyle]=`startingStyle`,e[e.endingStyle=Ky.endingStyle]=`endingStyle`,e}({}),mN=function(e){return e.panelOpen=`data-panel-open`,e}({}),hN={[pN.open]:``},gN={[pN.closed]:``},_N={open(e){return e?{[mN.panelOpen]:``}:null}},vN={open(e){return e?hN:gN},...Yy},yN=b.forwardRef(function(e,t){let{render:n,className:r,defaultOpen:i=!1,disabled:a=!1,onOpenChange:o,open:s,style:c,...l}=e,u=Z(o),d=uN({open:s,defaultOpen:i,onOpenChange:u,disabled:a}),f=b.useMemo(()=>({open:d.open,disabled:d.disabled,transitionStatus:d.transitionStatus}),[d.open,d.disabled,d.transitionStatus]),p=b.useMemo(()=>({...d,onOpenChange:u,state:f}),[d,u,f]),m=w_(`div`,e,{state:f,ref:t,props:l,stateAttributesMapping:vN});return(0,y.jsx)(dN.Provider,{value:p,children:m})}),bN={..._N,...Yy},xN=b.forwardRef(function(e,t){let{panelId:n,open:r,handleTrigger:i,state:a,disabled:o}=fN(),{className:s,disabled:c=o,id:l,render:u,nativeButton:d=!0,style:f,...p}=e,{getButtonProps:m,buttonRef:h}=px({disabled:c,focusableWhenDisabled:!0,native:d}),g=b.useMemo(()=>({"aria-controls":r?n:void 0,"aria-expanded":r,onClick:i}),[n,r,i]);return w_(`button`,e,{state:a,ref:[t,h],props:[g,p,m],stateAttributesMapping:bN})}),SN=function(e){return e.disabled=`data-disabled`,e.orientation=`data-orientation`,e}({});function CN(e){let{abortControllerRef:t,animationTypeRef:n,externalRef:r,height:i,hiddenUntilFound:a,keepMounted:o,id:s,mounted:c,onOpenChange:l,open:u,panelRef:d,runOnceAnimationsFinish:f,setDimensions:p,setMounted:m,setOpen:h,setVisible:g,transitionDimensionRef:_,visible:v,width:y}=e,x=b.useRef(!1),S=b.useRef(null),C=b.useRef(u),w=b.useRef(u),T=tm(),E=b.useMemo(()=>n.current===`css-animation`?!v:!u&&!c,[u,c,v,n]),D=Hm(r,d,Z(e=>{if(!e)return;if(n.current==null||_.current==null){let t=getComputedStyle(e),r=t.animationName!==`none`&&t.animationName!==``,i=t.transitionDuration!==`0s`&&t.transitionDuration!==``;r&&i||(t.animationName===`none`&&t.transitionDuration!==`0s`?n.current=`css-transition`:t.animationName!==`none`&&t.transitionDuration===`0s`?n.current=`css-animation`:n.current=`none`),e.getAttribute(SN.orientation)===`horizontal`||t.transitionProperty.indexOf(`width`)>-1?_.current=`width`:_.current=`height`}if(n.current!==`css-transition`)return;(i===void 0||y===void 0)&&(p({height:e.scrollHeight,width:e.scrollWidth}),w.current&&e.style.setProperty(`transition-duration`,`0s`));let t=-1,r=-1;return t=em.request(()=>{w.current=!1,r=em.request(()=>{setTimeout(()=>{e.style.removeProperty(`transition-duration`)})})}),()=>{em.cancel(t),em.cancel(r)}}));return X(()=>{if(n.current!==`css-transition`)return;let e=d.current;if(!e)return;let r=-1;if(t.current!=null&&(t.current.abort(),t.current=null),u){let t={"justify-content":e.style.justifyContent,"align-items":e.style.alignItems,"align-content":e.style.alignContent,"justify-items":e.style.justifyItems};Object.keys(t).forEach(t=>{e.style.setProperty(t,`initial`,`important`)}),!w.current&&!o&&e.setAttribute(pN.startingStyle,``),p({height:e.scrollHeight,width:e.scrollWidth}),r=em.request(()=>{Object.entries(t).forEach(([t,n])=>{n===``?e.style.removeProperty(t):e.style.setProperty(t,n)})})}else{if(e.scrollHeight===0&&e.scrollWidth===0)return;p({height:e.scrollHeight,width:e.scrollWidth});let n=new AbortController;t.current=n;let r=n.signal,i=null,a=pN.endingStyle;return i=new MutationObserver(o=>{o.some(e=>e.type===`attributes`&&e.attributeName===a)&&(i?.disconnect(),i=null,f(()=>{p({height:0,width:0}),e.style.removeProperty(`content-visibility`),m(!1),t.current===n&&(t.current=null)},r))}),i.observe(e,{attributes:!0,attributeFilter:[a]}),()=>{i?.disconnect(),T.cancel(),t.current===n&&(n.abort(),t.current=null)}}return()=>{em.cancel(r)}},[t,n,T,a,o,c,u,d,f,p,m]),X(()=>{if(n.current!==`css-animation`)return;let e=d.current;e&&(S.current=e.style.animationName||S.current,e.style.setProperty(`animation-name`,`none`),p({height:e.scrollHeight,width:e.scrollWidth}),!C.current&&!x.current&&e.style.removeProperty(`animation-name`),u?(t.current!=null&&(t.current.abort(),t.current=null),m(!0),g(!0)):(t.current=new AbortController,f(()=>{m(!1),g(!1),t.current=null},t.current.signal)))},[t,n,u,d,f,p,m,g,v]),Jp(()=>{let e=em.request(()=>{C.current=!1});return()=>em.cancel(e)}),X(()=>{if(!a)return;let e=d.current;if(!e)return;let t=-1,n=-1;return u&&x.current&&(e.style.transitionDuration=`0s`,p({height:e.scrollHeight,width:e.scrollWidth}),t=em.request(()=>{x.current=!1,n=em.request(()=>{setTimeout(()=>{e.style.removeProperty(`transition-duration`)})})})),()=>{em.cancel(t),em.cancel(n)}},[a,u,d,p]),X(()=>{let e=d.current;e&&a&&E&&(e.setAttribute(`hidden`,`until-found`),n.current===`css-transition`&&e.setAttribute(pN.startingStyle,``))},[a,E,n,d]),b.useEffect(function(){let e=d.current;if(!e)return;function t(e){x.current=!0,h(!0),l(!0,Lm(wm,e))}return Ap(e,`beforematch`,t)},[l,d,h]),b.useMemo(()=>({props:{hidden:E,id:s,ref:D}}),[E,s,D])}var wN=function(e){return e.collapsiblePanelHeight=`--collapsible-panel-height`,e.collapsiblePanelWidth=`--collapsible-panel-width`,e}({}),TN=b.forwardRef(function(e,t){let{className:n,hiddenUntilFound:r,keepMounted:i,render:a,id:o,style:s,...c}=e,{abortControllerRef:l,animationTypeRef:u,height:d,mounted:f,onOpenChange:p,open:m,panelId:h,panelRef:g,runOnceAnimationsFinish:_,setDimensions:v,setHiddenUntilFound:y,setKeepMounted:x,setMounted:S,setPanelIdState:C,setOpen:w,setVisible:T,state:E,transitionDimensionRef:D,visible:O,width:k,transitionStatus:A}=fN(),j=r??!1,M=i??!1;X(()=>{if(o)return C(o),()=>{C(void 0)}},[o,C]),X(()=>{y(j)},[y,j]),X(()=>{x(M)},[x,M]);let{props:N}=CN({abortControllerRef:l,animationTypeRef:u,externalRef:t,height:d,hiddenUntilFound:j,id:h,keepMounted:M,mounted:f,onOpenChange:p,open:m,panelRef:g,runOnceAnimationsFinish:_,setDimensions:v,setMounted:S,setOpen:w,setVisible:T,transitionDimensionRef:D,visible:O,width:k});Zy({open:m&&A===`idle`,ref:g,onComplete(){m&&v({height:void 0,width:void 0})}});let P=w_(`div`,e,{state:b.useMemo(()=>({...E,transitionStatus:A}),[E,A]),ref:[t,g],props:[N,{style:{[wN.collapsiblePanelHeight]:d===void 0?`auto`:`${d}px`,[wN.collapsiblePanelWidth]:k===void 0?`auto`:`${k}px`}},c],stateAttributesMapping:vN});return M||j||f?P:null});function EN({...e}){return(0,y.jsx)(yN,{"data-slot":`collapsible`,...e})}function DN({...e}){return(0,y.jsx)(xN,{"data-slot":`collapsible-trigger`,...e})}function ON({...e}){return(0,y.jsx)(TN,{"data-slot":`collapsible-content`,...e})}function kN({className:e,...t}){return(0,y.jsx)(`label`,{"data-slot":`label`,className:rp(`flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50`,e),...t})}function AN({className:e,...t}){return(0,y.jsx)(`div`,{"data-slot":`field-group`,className:rp(`group/field-group @container/field-group flex w-full flex-col gap-7 data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4`,e),...t})}var jN=Jx(`group/field flex w-full gap-3 data-[invalid=true]:text-destructive`,{variants:{orientation:{vertical:`flex-col *:w-full [&>.sr-only]:w-auto`,horizontal:`flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`,responsive:`flex-col *:w-full @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:*:data-[slot=field-label]:flex-auto [&>.sr-only]:w-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`}},defaultVariants:{orientation:`vertical`}});function MN({className:e,orientation:t=`vertical`,...n}){return(0,y.jsx)(`div`,{role:`group`,"data-slot":`field`,"data-orientation":t,className:rp(jN({orientation:t}),e),...n})}function NN({className:e,...t}){return(0,y.jsx)(kN,{"data-slot":`field-label`,className:rp(`group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50 has-data-checked:border-primary/30 has-data-checked:bg-primary/5 has-[>[data-slot=field]]:rounded-md has-[>[data-slot=field]]:border *:data-[slot=field]:p-3 dark:has-data-checked:border-primary/20 dark:has-data-checked:bg-primary/10`,`has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col`,e),...t})}var PN=b.createContext(void 0);function FN(e){let t=b.useContext(PN);if(t===void 0&&!e)throw Error(t_(47));return t}function IN(){return{...ib(),disabled:!1,modal:!1,focusManagerModal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,nested:!1,openOnHover:!1,closeDelay:0,hasViewport:!1}}var LN={...ob,disabled:Q(e=>e.disabled),instantType:Q(e=>e.instantType),openMethod:Q(e=>e.openMethod),openChangeReason:Q(e=>e.openChangeReason),modal:Q(e=>e.modal),focusManagerModal:Q(e=>e.focusManagerModal),stickIfOpen:Q(e=>e.stickIfOpen),titleElementId:Q(e=>e.titleElementId),descriptionElementId:Q(e=>e.descriptionElementId),openOnHover:Q(e=>e.openOnHover),closeDelay:Q(e=>e.closeDelay),hasViewport:Q(e=>e.hasViewport)},RN=class e extends Hy{constructor(e){let t={...IN(),...e};t.open&&e?.mounted===void 0&&(t.mounted=!0),super(t,{popupRef:b.createRef(),backdropRef:b.createRef(),internalBackdropRef:b.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:b.createRef(),beforeContentFocusGuardRef:b.createRef(),stickIfOpenTimeout:new Xp,triggerElements:new nb},LN)}setOpen=(e,t)=>{let n=t.reason===Em,r=t.reason===`trigger-press`&&t.event.detail===0,i=!e&&(t.reason===`escape-key`||t.reason==null);if(t.preventUnmountOnClose=()=>{this.set(`preventUnmountingOnClose`,!0)},this.context.onOpenChange?.(e,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(e,t);let a=()=>{let n={open:e,openChangeReason:t.reason},r=t.trigger?.id??null;(r||e)&&(n.activeTriggerId=r,n.activeTriggerElement=t.trigger??null),this.update(n)};n?(this.set(`stickIfOpen`,!0),this.context.stickIfOpenTimeout.start(500,()=>{this.set(`stickIfOpen`,!1)}),F_.flushSync(a)):a(),r||i?this.set(`instantType`,r?`click`:`dismiss`):t.reason===`focus-out`?this.set(`instantType`,`focus`):this.set(`instantType`,void 0)};static useStore(t,n){let r=Kp(()=>new e(n)).current,i=t??r;return Jp(r.disposeEffect),i}disposeEffect=()=>this.context.stickIfOpenTimeout.disposeEffect()};function zN({props:e}){let{children:t,open:n,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:a,modal:o=!1,handle:s,triggerId:c,defaultTriggerId:l=null}=e,u=RN.useStore(s?.store,{modal:o,open:r,openProp:n,activeTriggerId:l,triggerIdProp:c});ip(()=>{n===void 0&&u.state.open===!1&&r===!0&&u.update({open:!0,activeTriggerId:l})}),u.useControlledProp(`openProp`,n),u.useControlledProp(`triggerIdProp`,c);let d=u.useState(`open`),f=u.useState(`payload`);u.useContextCallback(`onOpenChange`,i),u.useContextCallback(`onOpenChangeComplete`,a);let{openMethod:p,triggerProps:m}=Ub(d);eb(u);let{forceUnmount:h}=tb(d,u,()=>{u.update({stickIfOpen:!0,openChangeReason:null})});b.useEffect(()=>{d||u.context.stickIfOpenTimeout.clear()},[u,d]);let g=b.useCallback(()=>{u.setOpen(!1,Lm(Fm))},[u]);b.useImperativeHandle(e.actionsRef,()=>({unmount:h,close:g}),[h,g]);let _=lb({popupStore:u,onOpenChange:u.setOpen}),{getReferenceProps:v,getFloatingProps:x,getTriggerProps:S}=bb([pv(_,{outsidePressEvent:{mouse:o===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}}),jb(_)]),C=b.useMemo(()=>v(m),[v,m]),w=b.useMemo(()=>S(m),[S,m]),T=b.useMemo(()=>x(),[x]);u.useSyncedValues({modal:o,openMethod:p,activeTriggerProps:C,inactiveTriggerProps:w,popupProps:T,floatingRootContext:_,nested:G_()!=null});let E=b.useMemo(()=>({store:u}),[u]);return(0,y.jsx)(PN.Provider,{value:E,children:typeof t==`function`?t({payload:f}):t})}function BN(e){return FN(!0)?(0,y.jsx)(zN,{props:e}):(0,y.jsx)(Y_,{children:(0,y.jsx)(zN,{props:e})})}function VN(e,t){let n=b.useRef(null);return{preFocusGuardRef:n,handlePreFocusGuardFocus:Z(t=>{F_.flushSync(()=>{e.setOpen(!1,Lm(Am,t.nativeEvent,t.currentTarget))}),Og(n.current)?.focus()}),handleFocusTargetFocus:Z(n=>{let r=e.select(`positionerElement`);if(r&&kg(n,r))e.context.beforeContentFocusGuardRef.current?.focus();else{F_.flushSync(()=>{e.setOpen(!1,Lm(Am,n.nativeEvent,n.currentTarget))});let i=Dg(e.context.triggerFocusTargetRef.current||t.current);for(;i!==null&&dh(r,i);){let e=i;if(i=wg(i),i===e)break}i?.focus()}})}}var HN=b.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,nativeButton:a=!0,handle:o,payload:s,openOnHover:c=!1,delay:l=300,closeDelay:u=0,id:d,style:f,...p}=e,m=FN(!0),h=o?.store??m?.store;if(!h)throw Error(t_(74));let g=gx(d),_=h.useState(`isTriggerActive`,g),v=h.useState(`floatingRootContext`),x=h.useState(`isOpenedByTrigger`,g),S=b.useRef(null),{registerTrigger:C,isMountedByThisTrigger:w}=$y(g,S,h,{payload:s,disabled:i,openOnHover:c,closeDelay:u}),T=h.useState(`openChangeReason`),E=h.useState(`stickIfOpen`),D=h.useState(`openMethod`),O=h.useState(`focusManagerModal`),k=yb(v,{enabled:v!=null&&c&&(D!==`touch`||T!==`trigger-press`),mouseOnly:!0,move:!1,handleClose:Bb(),restMs:l,delay:{close:u},triggerElementRef:S,isActiveTrigger:_,isClosing:()=>h.select(`transitionStatus`)===`ending`}),A=bb([ov(v,{enabled:v!=null,stickIfOpen:E})]),j=h.useState(`triggerProps`,w),M={disabled:i,open:x},{getButtonProps:N,buttonRef:P}=px({disabled:i,native:a}),F=b.useMemo(()=>({open(e){return e&&T===`trigger-press`?ox.open(e):ax.open(e)}}),[T]),I=w_(`button`,e,{state:M,ref:[P,t,C,S],props:[A.getReferenceProps(),k,j,{[j_]:``,id:g},p,N],stateAttributesMapping:F}),{preFocusGuardRef:L,handlePreFocusGuardFocus:R,handleFocusTargetFocus:z}=VN(h,S);return _&&!O?(0,y.jsxs)(b.Fragment,{children:[(0,y.jsx)(rh,{ref:L,onFocus:R}),(0,y.jsx)(b.Fragment,{children:I},g),(0,y.jsx)(rh,{ref:h.context.triggerFocusTargetRef,onFocus:z})]}):(0,y.jsx)(b.Fragment,{children:I},g)}),UN=b.createContext(void 0);function WN(){let e=b.useContext(UN);if(e===void 0)throw Error(t_(45));return e}var GN=b.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i}=FN();return i.useState(`mounted`)||n?(0,y.jsx)(UN.Provider,{value:n,children:(0,y.jsx)(B_,{ref:t,...r})}):null}),KN=b.createContext(void 0);function qN(){let e=b.useContext(KN);if(!e)throw Error(t_(46));return e}var JN=b.forwardRef(function(e,t){let{render:n,className:r,anchor:i,positionMethod:a=`absolute`,side:o=`bottom`,align:s=`center`,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d=5,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:h=N_,style:g,..._}=e,{store:v}=FN(),x=WN(),S=q_(),C=v.useState(`floatingRootContext`),w=v.useState(`mounted`),T=v.useState(`open`),E=v.useState(`openChangeReason`),D=v.useState(`activeTriggerElement`),O=v.useState(`modal`),k=v.useState(`openMethod`),A=v.useState(`positionerElement`),j=v.useState(`instantType`),M=v.useState(`transitionStatus`),N=v.useState(`hasViewport`),P=b.useRef(null),F=Xy(A,!1,!1),I=fM({anchor:i,floatingRootContext:C,positionMethod:a,mounted:w,side:o,sideOffset:c,align:s,alignOffset:l,arrowPadding:f,collisionBoundary:u,collisionPadding:d,sticky:p,disableAnchorTracking:m,keepMounted:x,nodeId:S,collisionAvoidance:h,adaptiveOrigin:N?lM:void 0}),L=C.useState(`domReferenceElement`);X(()=>{let e=L,t=P.current;if(e&&(P.current=e),t&&e&&e!==t){v.set(`instantType`,void 0);let e=new AbortController;return F(()=>{v.set(`instantType`,`trigger-change`)},e.signal),()=>{e.abort()}}},[L,F,v]);let R={open:T,side:I.side,align:I.align,anchorHidden:I.anchorHidden,instant:j};xM(T&&O===!0&&E!==`trigger-hover`,k===`touch`,A,D);let z=b.useCallback(e=>{v.set(`positionerElement`,e)},[v]),ee=yM(e,R,{styles:I.positionerStyles,transitionStatus:M,props:_,refs:[t,z],hidden:!w,inert:!T});return(0,y.jsxs)(KN.Provider,{value:I,children:[w&&O===!0&&E!==`trigger-hover`&&(0,y.jsx)(Px,{ref:v.context.internalBackdropRef,inert:Nx(!T),cutout:D}),(0,y.jsx)(J_,{id:S,children:ee})]})}),YN=b.createContext(void 0);function XN(){let[e,t]=b.useState(0),n=Z(()=>(t(e=>e+1),()=>{t(e=>Math.max(0,e-1))}));return{context:b.useMemo(()=>({register:n}),[n]),hasClosePart:e>0}}function ZN(e){let{value:t,children:n}=e;return(0,y.jsx)(YN.Provider,{value:t,children:n})}var QN={...sx,...Yy},$N=b.forwardRef(function(e,t){let{className:n,render:r,initialFocus:i,finalFocus:a,style:o,...s}=e,{store:c}=FN(),l=qN(),u=DM(!0)!=null,{context:d,hasClosePart:f}=XN(),p=c.useState(`open`),m=c.useState(`openMethod`),h=c.useState(`instantType`),g=c.useState(`transitionStatus`),_=c.useState(`popupProps`),v=c.useState(`titleElementId`),x=c.useState(`descriptionElementId`),S=c.useState(`modal`),C=c.useState(`mounted`),w=c.useState(`openChangeReason`),T=c.useState(`activeTriggerElement`),E=c.useState(`floatingRootContext`);Zy({open:p,ref:c.context.popupRef,onComplete(){p&&c.context.onOpenChangeComplete?.(!0)}});let D=c.useState(`disabled`),O=c.useState(`openOnHover`),k=c.useState(`closeDelay`);_b(E,{enabled:O&&!D,closeDelay:k});function A(e){return e===`touch`?c.context.popupRef.current:!0}let j=i===void 0?A:i,M={open:p,side:l.side,align:l.align,instant:h,transitionStatus:g},N=S!==!1&&f;c.useSyncedValue(`focusManagerModal`,N);let P=b.useCallback(e=>{c.set(`popupElement`,e)},[c]),F=w_(`div`,e,{state:M,ref:[t,c.context.popupRef,P],props:[_,{"aria-labelledby":v,"aria-describedby":x,onKeyDown(e){u&&Ax.has(e.key)&&e.stopPropagation()}},vM(g),s],stateAttributesMapping:QN});return(0,y.jsx)(av,{context:E,openInteractionType:m,modal:N,disabled:!C||w===`trigger-hover`,initialFocus:j,returnFocus:a,restoreFocus:`popup`,previousFocusableElement:dp(T)?T:void 0,nextFocusableElement:c.context.triggerFocusTargetRef,beforeContentFocusGuardRef:c.context.beforeContentFocusGuardRef,children:(0,y.jsx)(ZN,{value:d,children:F})})});function eP({...e}){return(0,y.jsx)(BN,{"data-slot":`popover`,...e})}function tP({...e}){return(0,y.jsx)(HN,{"data-slot":`popover-trigger`,...e})}function nP({className:e,align:t=`center`,alignOffset:n=0,side:r=`bottom`,sideOffset:i=4,...a}){return(0,y.jsx)(GN,{children:(0,y.jsx)(JN,{align:t,alignOffset:n,side:r,sideOffset:i,className:`isolate z-50`,children:(0,y.jsx)($N,{"data-slot":`popover-content`,className:rp(`z-50 flex w-72 origin-(--transform-origin) flex-col gap-4 rounded-md bg-popover p-4 text-sm text-popover-foreground shadow-md ring-1 ring-foreground/10 outline-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...a})})})}var rP=b.createContext(void 0);function iP(){let e=b.useContext(rP);if(e===void 0)throw Error(t_(63));return e}var aP=function(e){return e.checked=`data-checked`,e.unchecked=`data-unchecked`,e.disabled=`data-disabled`,e.readonly=`data-readonly`,e.required=`data-required`,e.valid=`data-valid`,e.invalid=`data-invalid`,e.touched=`data-touched`,e.dirty=`data-dirty`,e.filled=`data-filled`,e.focused=`data-focused`,e}({}),oP={...pS,checked(e){return e?{[aP.checked]:``}:{[aP.unchecked]:``}}},sP=b.forwardRef(function(e,t){let{checked:n,className:r,defaultChecked:i,"aria-labelledby":a,form:o,id:s,inputRef:c,name:l,nativeButton:u=!1,onCheckedChange:d,readOnly:f=!1,required:p=!1,disabled:m=!1,render:h,uncheckedValue:g,value:_,style:v,...x}=e,{clearErrors:S}=_S(),{state:C,setTouched:w,setDirty:T,validityData:E,setFilled:D,setFocused:O,shouldValidateOnChange:k,validationMode:A,disabled:j,name:M,validation:N}=hS(),{labelId:P}=yS(),F=j||m,I=M??l,L=Z(d),R=b.useRef(null),z=Hm(R,c,N.inputRef),ee=b.useRef(null),B=gx(),te=CS({id:s,implicit:!1,controlRef:ee}),V=u?void 0:te,[H,ne]=wS({controlled:n,default:!!i,name:`Switch`,state:`checked`});TS(ee,{id:B,value:H}),X(()=>{R.current&&D(R.current.checked)},[R,D]),Hb(H,()=>{S(I),T(H!==E.initialValue),D(H),k()?N.commit(H):N.commit(H,!0)});let{getButtonProps:U,buttonRef:re}=px({disabled:F,native:u}),W=bS(a,P,R,!u,V),ie={id:u?te:B,role:`switch`,"aria-checked":H,"aria-readonly":f||void 0,"aria-required":p||void 0,"aria-labelledby":W,onFocus(){F||O(!0)},onBlur(){let e=R.current;!e||F||(w(!0),O(!1),A===`onBlur`&&N.commit(e.checked))},onClick(e){f||F||(e.preventDefault(),R.current?.dispatchEvent(new PointerEvent(`click`,{bubbles:!0,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey})))}},ae=b.useMemo(()=>u_({checked:H,disabled:F,form:o,id:V,name:I,required:p,style:I?nh:th,tabIndex:-1,type:`checkbox`,"aria-hidden":!0,ref:z,onChange(e){if(e.nativeEvent.defaultPrevented)return;if(f){e.preventDefault();return}let t=e.currentTarget.checked,n=Lm(wm,e.nativeEvent);L?.(t,n),!n.isCanceled&&ne(t)},onFocus(){ee.current?.focus()}},N.getInputValidationProps,_===void 0?im:{value:_}),[H,F,o,z,V,I,L,f,p,ne,N,_]),oe=b.useMemo(()=>({...C,checked:H,disabled:F,readOnly:f,required:p}),[C,H,F,f,p]),se=w_(`span`,e,{state:oe,ref:[t,ee,re],props:[ie,N.getValidationProps,x,U],stateAttributesMapping:oP});return(0,y.jsxs)(rP.Provider,{value:oe,children:[se,!H&&I&&g!==void 0&&(0,y.jsx)(`input`,{type:`hidden`,form:o,name:I,value:g}),(0,y.jsx)(`input`,{...ae,suppressHydrationWarning:!0})]})}),cP=b.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{state:o}=hS(),s=iP();return w_(`span`,e,{state:{...o,...s},ref:t,stateAttributesMapping:oP,props:a})});function lP({className:e,size:t=`default`,...n}){return(0,y.jsx)(sP,{"data-slot":`switch`,"data-size":t,className:rp(`peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 data-disabled:cursor-not-allowed data-disabled:opacity-50`,e),...n,children:(0,y.jsx)(cP,{"data-slot":`switch-thumb`,className:`pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] dark:data-checked:bg-primary-foreground group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 dark:data-unchecked:bg-foreground`})})}var uP=b.createContext(void 0);function dP(e){let t=b.useContext(uP);if(t===void 0&&!e)throw Error(t_(72));return t}var fP={...ob,disabled:Q(e=>e.disabled),instantType:Q(e=>e.instantType),isInstantPhase:Q(e=>e.isInstantPhase),trackCursorAxis:Q(e=>e.trackCursorAxis),disableHoverablePopup:Q(e=>e.disableHoverablePopup),lastOpenChangeReason:Q(e=>e.openChangeReason),closeOnClick:Q(e=>e.closeOnClick),closeDelay:Q(e=>e.closeDelay),hasViewport:Q(e=>e.hasViewport)},pP=class e extends Hy{constructor(e){super({...mP(),...e},{popupRef:b.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:new nb},fP)}setOpen=(e,t)=>{let n=t.reason,r=n===Em,i=e&&n===`trigger-focus`,a=!e&&(n===`trigger-press`||n===`escape-key`);if(t.preventUnmountOnClose=()=>{this.set(`preventUnmountingOnClose`,!0)},this.context.onOpenChange?.(e,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(e,t);let o=()=>{let r={open:e,openChangeReason:n};i?r.instantType=`focus`:a?r.instantType=`dismiss`:n===`trigger-hover`&&(r.instantType=void 0);let o=t.trigger?.id??null;(o||e)&&(r.activeTriggerId=o,r.activeTriggerElement=t.trigger??null),this.update(r)};r?F_.flushSync(o):o()};static useStore(t,n){let r=Kp(()=>new e(n)).current,i=t??r,a=lb({popupStore:i,onOpenChange:i.setOpen});return i.state.floatingRootContext=a,i}};function mP(){return{...ib(),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:`none`,disableHoverablePopup:!1,openChangeReason:null,closeOnClick:!0,closeDelay:0,hasViewport:!1}}var hP=jy(function(e){let{disabled:t=!1,defaultOpen:n=!1,open:r,disableHoverablePopup:i=!1,trackCursorAxis:a=`none`,actionsRef:o,onOpenChange:s,onOpenChangeComplete:c,handle:l,triggerId:u,defaultTriggerId:d=null,children:f}=e,p=pP.useStore(l?.store,{open:n,openProp:r,activeTriggerId:d,triggerIdProp:u});ip(()=>{r===void 0&&p.state.open===!1&&n===!0&&p.update({open:!0,activeTriggerId:d})}),p.useControlledProp(`openProp`,r),p.useControlledProp(`triggerIdProp`,u),p.useContextCallback(`onOpenChange`,s),p.useContextCallback(`onOpenChangeComplete`,c);let m=p.useState(`open`),h=!t&&m,g=p.useState(`activeTriggerId`),_=p.useState(`payload`);p.useSyncedValues({trackCursorAxis:a,disableHoverablePopup:i}),X(()=>{m&&t&&p.setOpen(!1,Lm(Pm))},[m,t,p]),p.useSyncedValue(`disabled`,t),eb(p);let{forceUnmount:v,transitionStatus:x}=tb(h,p),S=p.select(`floatingRootContext`),C=p.useState(`isInstantPhase`),w=p.useState(`instantType`),T=p.useState(`lastOpenChangeReason`),E=b.useRef(null);X(()=>{x===`ending`&&T===`none`||x!==`ending`&&C?(w!==`delay`&&(E.current=w),p.set(`instantType`,`delay`)):E.current!==null&&(p.set(`instantType`,E.current),E.current=null)},[x,C,T,w,p]),X(()=>{h&&(g??p.set(`payload`,void 0))},[p,g,h]);let D=b.useCallback(()=>{p.setOpen(!1,Lm(Fm))},[p]);b.useImperativeHandle(o,()=>({unmount:v,close:D}),[v,D]);let{getReferenceProps:O,getFloatingProps:k,getTriggerProps:A}=bb([pv(S,{enabled:!t,referencePress:()=>p.select(`closeOnClick`)}),lv(S,{enabled:!t&&a!==`none`,axis:a===`none`?void 0:a})]),j=b.useMemo(()=>O(),[O]),M=b.useMemo(()=>A(),[A]),N=b.useMemo(()=>k(),[k]);return p.useSyncedValues({activeTriggerProps:j,inactiveTriggerProps:M,popupProps:N}),(0,y.jsx)(uP.Provider,{value:p,children:typeof f==`function`?f({payload:_}):f})}),gP=b.createContext(void 0);function _P(){return b.useContext(gP)}var vP=function(e){return e[e.popupOpen=$b.popupOpen]=`popupOpen`,e.triggerDisabled=`data-trigger-disabled`,e}({}),yP=My(function(e,t){let{className:n,render:r,handle:i,payload:a,disabled:o,delay:s,closeOnClick:c=!0,closeDelay:l,id:u,style:d,...f}=e,p=dP(!0),m=i?.store??p;if(!m)throw Error(t_(82));let h=gx(u),g=m.useState(`isTriggerActive`,h),_=m.useState(`isOpenedByTrigger`,h),v=m.useState(`floatingRootContext`),y=b.useRef(null),x=s??600,S=l??0,{registerTrigger:C,isMountedByThisTrigger:w}=$y(h,y,m,{payload:a,closeOnClick:c,closeDelay:S}),T=_P(),{delayRef:E,isInstantPhase:D,hasProvider:O}=Bm(v,{open:_});m.useSyncedValue(`isInstantPhase`,D);let k=m.useState(`disabled`),A=o??k,j=m.useState(`trackCursorAxis`),M=m.useState(`disableHoverablePopup`),N=yb(v,{enabled:!A,mouseOnly:!0,move:!1,handleClose:!M&&j!==`both`?Bb():null,restMs(){let e=T?.delay,t=typeof E.current==`object`?E.current.open:void 0,n=x;return O&&(n=t===0?0:s??e??x),n},delay(){let e=typeof E.current==`object`?E.current.close:void 0,t=S;return l==null&&O&&(t=e),{close:t}},triggerElementRef:y,isActiveTrigger:g,isClosing:()=>m.select(`transitionStatus`)===`ending`}),P=db(v,{enabled:!A}).reference,F={open:_},I=m.useState(`triggerProps`,w);return w_(`button`,e,{state:F,ref:[t,C,y],props:[N,P,I,{onPointerDown(){m.set(`closeOnClick`,c)},id:h,[vP.triggerDisabled]:A?``:void 0},f],stateAttributesMapping:ax})}),bP=b.createContext(void 0);function xP(){let e=b.useContext(bP);if(e===void 0)throw Error(t_(70));return e}var SP=b.forwardRef(function(e,t){let{children:n,container:r,className:i,render:a,style:o,...s}=e,{portalNode:c,portalSubtree:l}=z_({container:r,ref:t,componentProps:e,elementProps:s});return!l&&!c?null:(0,y.jsxs)(b.Fragment,{children:[l,c&&F_.createPortal(n,c)]})}),CP=b.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e;return dP().useState(`mounted`)||n?(0,y.jsx)(bP.Provider,{value:n,children:(0,y.jsx)(SP,{ref:t,...r})}):null}),wP=b.createContext(void 0);function TP(){let e=b.useContext(wP);if(e===void 0)throw Error(t_(71));return e}var EP=b.forwardRef(function(e,t){let{render:n,className:r,anchor:i,positionMethod:a=`absolute`,side:o=`top`,align:s=`center`,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d=5,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:h=N_,style:g,..._}=e,v=dP(),x=xP(),S=v.useState(`open`),C=v.useState(`mounted`),w=v.useState(`trackCursorAxis`),T=v.useState(`disableHoverablePopup`),E=v.useState(`floatingRootContext`),D=v.useState(`instantType`),O=v.useState(`transitionStatus`),k=fM({anchor:i,positionMethod:a,floatingRootContext:E,mounted:C,side:o,sideOffset:c,align:s,alignOffset:l,collisionBoundary:u,collisionPadding:d,sticky:p,arrowPadding:f,disableAnchorTracking:m,keepMounted:x,collisionAvoidance:h,adaptiveOrigin:v.useState(`hasViewport`)?lM:void 0}),A=yM(e,b.useMemo(()=>({open:S,side:k.side,align:k.align,anchorHidden:k.anchorHidden,instant:w===`none`?D:`tracking-cursor`}),[S,k.side,k.align,k.anchorHidden,w,D]),{styles:k.positionerStyles,transitionStatus:O,props:_,refs:[t,v.useStateSetter(`positionerElement`)],hidden:!C,inert:!S||w===`both`||T});return(0,y.jsx)(wP.Provider,{value:k,children:A})}),DP={...sx,...Yy},OP=b.forwardRef(function(e,t){let{className:n,render:r,style:i,...a}=e,o=dP(),{side:s,align:c}=TP(),l=o.useState(`open`),u=o.useState(`instantType`),d=o.useState(`transitionStatus`),f=o.useState(`popupProps`),p=o.useState(`floatingRootContext`);Zy({open:l,ref:o.context.popupRef,onComplete(){l&&o.context.onOpenChangeComplete?.(!0)}});let m=o.useState(`disabled`),h=o.useState(`closeDelay`);return _b(p,{enabled:!m,closeDelay:h}),w_(`div`,e,{state:{open:l,side:s,align:c,instant:u,transitionStatus:d},ref:[t,o.context.popupRef,o.useStateSetter(`popupElement`)],props:[f,vM(d),a],stateAttributesMapping:DP})}),kP=b.forwardRef(function(e,t){let{className:n,render:r,style:i,...a}=e,o=dP(),s=o.useState(`open`),c=o.useState(`instantType`),{arrowRef:l,side:u,align:d,arrowUncentered:f,arrowStyles:p}=TP();return w_(`div`,e,{state:{open:s,side:u,align:d,uncentered:f,instant:c},ref:[t,l],props:[{style:p,"aria-hidden":!0},a],stateAttributesMapping:sx})}),AP=function(e){let{delay:t,closeDelay:n,timeout:r=400}=e,i=b.useMemo(()=>({delay:t,closeDelay:n}),[t,n]),a=b.useMemo(()=>({open:t,close:n}),[t,n]);return(0,y.jsx)(gP.Provider,{value:i,children:(0,y.jsx)(zm,{delay:a,timeoutMs:r,children:e.children})})};function jP({delay:e=0,...t}){return(0,y.jsx)(AP,{"data-slot":`tooltip-provider`,delay:e,...t})}function MP({...e}){return(0,y.jsx)(hP,{"data-slot":`tooltip`,...e})}function NP({...e}){return(0,y.jsx)(yP,{"data-slot":`tooltip-trigger`,...e})}function PP({className:e,side:t=`top`,sideOffset:n=4,align:r=`center`,alignOffset:i=0,children:a,...o}){return(0,y.jsx)(CP,{children:(0,y.jsx)(EP,{align:r,alignOffset:i,side:t,sideOffset:n,className:`isolate z-50`,children:(0,y.jsxs)(OP,{"data-slot":`tooltip-content`,className:rp(`z-50 inline-flex w-fit max-w-xs origin-(--transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...o,children:[a,(0,y.jsx)(kP,{className:`z-50 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground data-[side=bottom]:top-1 data-[side=inline-end]:top-1/2! data-[side=inline-end]:-left-1 data-[side=inline-end]:-translate-y-1/2 data-[side=inline-start]:top-1/2! data-[side=inline-start]:-right-1 data-[side=inline-start]:-translate-y-1/2 data-[side=left]:top-1/2! data-[side=left]:-right-1 data-[side=left]:-translate-y-1/2 data-[side=right]:top-1/2! data-[side=right]:-left-1 data-[side=right]:-translate-y-1/2 data-[side=top]:-bottom-2.5`})]})})})}var FP=[{id:`block`,name:`Block`},{id:`bar`,name:`Bar`},{id:`underline`,name:`Underline`}],IP=`block`,LP=FP.map(e=>e.id),RP=e=>typeof e==`string`&&LP.includes(e),zP=e=>e.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`),BP=`ui-monospace, SFMono-Regular, Menlo, Consolas, monospace`,VP=`"Symbols Nerd Font"`,HP=(e,t)=>`"${zP(e)}"${t?`, ${VP}`:``}, ${BP}`,UP=(e,t,n)=>({id:e,name:t,family:HP(t,!0),source:n}),WP=UP(`geist-mono`,`Geist Mono`,`fontsource`),GP=UP(`jetbrains-mono`,`JetBrains Mono`,`google`),KP=UP(`fira-code`,`Fira Code`,`google`),qP=UP(`ibm-plex-mono`,`IBM Plex Mono`,`google`),JP=UP(`source-code-pro`,`Source Code Pro`,`google`),YP=UP(`roboto-mono`,`Roboto Mono`,`google`),XP=UP(`dm-mono`,`DM Mono`,`google`),ZP=UP(`inconsolata`,`Inconsolata`,`google`),QP=UP(`space-mono`,`Space Mono`,`google`),$P=UP(`ubuntu-mono`,`Ubuntu Mono`,`google`),eF=[WP,UP(`anonymous-pro`,`Anonymous Pro`,`google`),XP,KP,qP,ZP,GP,YP,JP,QP,$P];WP.id;var tF=e=>e?eF.find(t=>t.id===e)??WP:WP,nF=(e,t)=>HP(e.name,t),rF=()=>{let e=eF.filter(e=>e.source===`google`);return e.length===0?``:`https://fonts.googleapis.com/css2?${e.map(e=>`family=${e.name.replace(/ /g,`+`)}:wght@400;700`).join(`&`)}&display=swap`},iF=[{value:1e3,label:`1k lines`},{value:1e4,label:`10k lines`},{value:5e4,label:`50k lines`},{value:1e5,label:`100k lines`}],aF=1e4,oF=iF.map(e=>e.value),sF=e=>oF.includes(e),cF={id:`vesper`,name:`Vesper`,source:`raunofreiberg/vesper`,colors:{background:`#101010`,foreground:`#ffffff`,cursor:`#ffc799`,cursorAccent:`#101010`,selectionBackground:`#2a2a2a`,selectionForeground:`#ffffff`,black:`#101010`,red:`#ff8080`,green:`#99ffe4`,yellow:`#ffc799`,blue:`#a0a0a0`,magenta:`#ffc799`,cyan:`#99ffe4`,white:`#ffffff`,brightBlack:`#505050`,brightRed:`#ff9999`,brightGreen:`#b3ffe4`,brightYellow:`#ffd1a8`,brightBlue:`#b0b0b0`,brightMagenta:`#ffc799`,brightCyan:`#66ddcc`,brightWhite:`#ffffff`}},lF=[cF,{id:`ayu-mirage`,name:`Ayu Mirage`,source:`ayu-theme/vscode-ayu`,colors:{background:`#1f2430`,foreground:`#cccac2`,cursor:`#ffcc66`,cursorAccent:`#1f2430`,selectionBackground:`#34455a`,selectionForeground:`#cccac2`,black:`#171b24`,red:`#f28273`,green:`#87d96c`,yellow:`#fcca60`,blue:`#6acdff`,magenta:`#ddbbff`,cyan:`#93e2c8`,white:`#c7c7c7`,brightBlack:`#686868`,brightRed:`#f28779`,brightGreen:`#d5ff80`,brightYellow:`#ffcd66`,brightBlue:`#73d0ff`,brightMagenta:`#dfbfff`,brightCyan:`#95e6cb`,brightWhite:`#ffffff`}},{id:`catppuccin-frappe`,name:`Catppuccin Frappé`,source:`catppuccin/wezterm + style-guide`,colors:{background:`#303446`,foreground:`#c6d0f5`,cursor:`#f2d5cf`,cursorAccent:`#232634`,selectionBackground:`#626880`,selectionForeground:`#c6d0f5`,black:`#51576d`,red:`#e78284`,green:`#a6d189`,yellow:`#e5c890`,blue:`#8caaee`,magenta:`#f4b8e4`,cyan:`#81c8be`,white:`#b5bfe2`,brightBlack:`#626880`,brightRed:`#e78284`,brightGreen:`#a6d189`,brightYellow:`#e5c890`,brightBlue:`#8caaee`,brightMagenta:`#f4b8e4`,brightCyan:`#81c8be`,brightWhite:`#a5adce`}},{id:`catppuccin-macchiato`,name:`Catppuccin Macchiato`,source:`catppuccin/wezterm + style-guide`,colors:{background:`#24273a`,foreground:`#cad3f5`,cursor:`#f4dbd6`,cursorAccent:`#181926`,selectionBackground:`#5b6078`,selectionForeground:`#cad3f5`,black:`#494d64`,red:`#ed8796`,green:`#a6da95`,yellow:`#eed49f`,blue:`#8aadf4`,magenta:`#f5bde6`,cyan:`#8bd5ca`,white:`#b8c0e0`,brightBlack:`#5b6078`,brightRed:`#ed8796`,brightGreen:`#a6da95`,brightYellow:`#eed49f`,brightBlue:`#8aadf4`,brightMagenta:`#f5bde6`,brightCyan:`#8bd5ca`,brightWhite:`#a5adcb`}},{id:`catppuccin-mocha`,name:`Catppuccin Mocha`,source:`catppuccin/wezterm + style-guide`,colors:{background:`#1e1e2e`,foreground:`#cdd6f4`,cursor:`#f5e0dc`,cursorAccent:`#11111b`,selectionBackground:`#585b70`,selectionForeground:`#cdd6f4`,black:`#45475a`,red:`#f38ba8`,green:`#a6e3a1`,yellow:`#f9e2af`,blue:`#89b4fa`,magenta:`#f5c2e7`,cyan:`#94e2d5`,white:`#bac2de`,brightBlack:`#585b70`,brightRed:`#f38ba8`,brightGreen:`#a6e3a1`,brightYellow:`#f9e2af`,brightBlue:`#89b4fa`,brightMagenta:`#f5c2e7`,brightCyan:`#94e2d5`,brightWhite:`#a6adc8`}},{id:`dracula`,name:`Dracula`,source:`dracula/visual-studio-code`,colors:{background:`#282a36`,foreground:`#f8f8f2`,cursor:`#f8f8f2`,cursorAccent:`#282a36`,selectionBackground:`#44475a`,selectionForeground:`#f8f8f2`,black:`#21222c`,red:`#ff5555`,green:`#50fa7b`,yellow:`#f1fa8c`,blue:`#bd93f9`,magenta:`#ff79c6`,cyan:`#8be9fd`,white:`#f8f8f2`,brightBlack:`#6272a4`,brightRed:`#ff6e6e`,brightGreen:`#69ff94`,brightYellow:`#ffffa5`,brightBlue:`#d6acff`,brightMagenta:`#ff92df`,brightCyan:`#a4ffff`,brightWhite:`#ffffff`}},{id:`github-dark`,name:`GitHub Dark Default`,source:`primer/github-vscode-theme + @primer/primitives`,colors:{background:`#0d1117`,foreground:`#e6edf3`,cursor:`#e6edf3`,cursorAccent:`#0d1117`,selectionBackground:`#264f78`,selectionForeground:`#e6edf3`,black:`#484f58`,red:`#ff7b72`,green:`#3fb950`,yellow:`#d29922`,blue:`#58a6ff`,magenta:`#bc8cff`,cyan:`#39c5cf`,white:`#b1bac4`,brightBlack:`#6e7681`,brightRed:`#ffa198`,brightGreen:`#56d364`,brightYellow:`#e3b341`,brightBlue:`#79c0ff`,brightMagenta:`#d2a8ff`,brightCyan:`#56d4dd`,brightWhite:`#ffffff`}},{id:`gruvbox-dark`,name:`Gruvbox Dark (Medium)`,source:`jdinhify/vscode-theme-gruvbox`,colors:{background:`#282828`,foreground:`#ebdbb2`,cursor:`#ebdbb2`,cursorAccent:`#282828`,selectionBackground:`#504945`,selectionForeground:`#ebdbb2`,black:`#3c3836`,red:`#cc241d`,green:`#98971a`,yellow:`#d79921`,blue:`#458588`,magenta:`#b16286`,cyan:`#689d6a`,white:`#a89984`,brightBlack:`#928374`,brightRed:`#fb4934`,brightGreen:`#b8bb26`,brightYellow:`#fabd2f`,brightBlue:`#83a598`,brightMagenta:`#d3869b`,brightCyan:`#8ec07c`,brightWhite:`#ebdbb2`}},{id:`monokai`,name:`Monokai`,source:`vscode/extensions/theme-monokai`,colors:{background:`#272822`,foreground:`#f8f8f2`,cursor:`#f8f8f0`,cursorAccent:`#272822`,selectionBackground:`#878b91`,selectionForeground:`#f8f8f2`,black:`#333333`,red:`#c4265e`,green:`#86b42b`,yellow:`#b3b42b`,blue:`#6a7ec8`,magenta:`#8c6bc8`,cyan:`#56adbc`,white:`#e3e3dd`,brightBlack:`#666666`,brightRed:`#f92672`,brightGreen:`#a6e22e`,brightYellow:`#e2e22e`,brightBlue:`#819aff`,brightMagenta:`#ae81ff`,brightCyan:`#66d9ef`,brightWhite:`#f8f8f2`}},{id:`night-owl`,name:`Night Owl`,source:`sdras/night-owl-vscode-theme`,colors:{background:`#011627`,foreground:`#d6deeb`,cursor:`#80a4c2`,cursorAccent:`#011627`,selectionBackground:`#1b90dd`,selectionForeground:`#d6deeb`,black:`#011627`,red:`#ef5350`,green:`#22da6e`,yellow:`#c5e478`,blue:`#82aaff`,magenta:`#c792ea`,cyan:`#21c7a8`,white:`#ffffff`,brightBlack:`#575656`,brightRed:`#ef5350`,brightGreen:`#22da6e`,brightYellow:`#ffeb95`,brightBlue:`#82aaff`,brightMagenta:`#c792ea`,brightCyan:`#7fdbca`,brightWhite:`#ffffff`}},{id:`nord`,name:`Nord`,source:`arcticicestudio/nord-visual-studio-code`,colors:{background:`#2e3440`,foreground:`#d8dee9`,cursor:`#d8dee9`,cursorAccent:`#2e3440`,selectionBackground:`#434c5e`,selectionForeground:`#eceff4`,black:`#3b4252`,red:`#bf616a`,green:`#a3be8c`,yellow:`#ebcb8b`,blue:`#81a1c1`,magenta:`#b48ead`,cyan:`#88c0d0`,white:`#e5e9f0`,brightBlack:`#4c566a`,brightRed:`#bf616a`,brightGreen:`#a3be8c`,brightYellow:`#ebcb8b`,brightBlue:`#81a1c1`,brightMagenta:`#b48ead`,brightCyan:`#8fbcbb`,brightWhite:`#eceff4`}},{id:`one-dark-pro`,name:`One Dark Pro`,source:`Binaryify/OneDark-Pro`,colors:{background:`#282c34`,foreground:`#abb2bf`,cursor:`#abb2bf`,cursorAccent:`#282c34`,selectionBackground:`#3e4452`,selectionForeground:`#abb2bf`,black:`#3f4451`,red:`#e05561`,green:`#8cc265`,yellow:`#d18f52`,blue:`#4aa5f0`,magenta:`#c162de`,cyan:`#42b3c2`,white:`#d7dae0`,brightBlack:`#4f5666`,brightRed:`#ff616e`,brightGreen:`#a5e075`,brightYellow:`#f0a45d`,brightBlue:`#4dc4ff`,brightMagenta:`#de73ff`,brightCyan:`#4cd1e0`,brightWhite:`#e6e6e6`}},{id:`solarized-dark`,name:`Solarized Dark`,source:`vscode/extensions/theme-solarized-dark`,colors:{background:`#002b36`,foreground:`#839496`,cursor:`#d30102`,cursorAccent:`#002b36`,selectionBackground:`#274642`,selectionForeground:`#93a1a1`,black:`#073642`,red:`#dc322f`,green:`#859900`,yellow:`#b58900`,blue:`#268bd2`,magenta:`#d33682`,cyan:`#2aa198`,white:`#eee8d5`,brightBlack:`#002b36`,brightRed:`#cb4b16`,brightGreen:`#586e75`,brightYellow:`#657b83`,brightBlue:`#839496`,brightMagenta:`#6c71c4`,brightCyan:`#93a1a1`,brightWhite:`#fdf6e3`}},{id:`synthwave-84`,name:`SynthWave '84`,source:`robb0wen/synthwave-vscode`,colors:{background:`#262335`,foreground:`#ffffff`,cursor:`#03edf9`,cursorAccent:`#262335`,selectionBackground:`#463465`,selectionForeground:`#ffffff`,black:`#2a2139`,red:`#fe4450`,green:`#72f1b8`,yellow:`#f3e70f`,blue:`#03edf9`,magenta:`#ff7edb`,cyan:`#03edf9`,white:`#ffffff`,brightBlack:`#495495`,brightRed:`#fe4450`,brightGreen:`#72f1b8`,brightYellow:`#fede5d`,brightBlue:`#03edf9`,brightMagenta:`#ff7edb`,brightCyan:`#03edf9`,brightWhite:`#ffffff`}},{id:`tokyo-night`,name:`Tokyo Night`,source:`enkia/tokyo-night-vscode-theme`,colors:{background:`#1a1b26`,foreground:`#a9b1d6`,cursor:`#c0caf5`,cursorAccent:`#1a1b26`,selectionBackground:`#515c7e`,selectionForeground:`#c0caf5`,black:`#363b54`,red:`#f7768e`,green:`#73daca`,yellow:`#e0af68`,blue:`#7aa2f7`,magenta:`#bb9af7`,cyan:`#7dcfff`,white:`#787c99`,brightBlack:`#363b54`,brightRed:`#f7768e`,brightGreen:`#73daca`,brightYellow:`#e0af68`,brightBlue:`#7aa2f7`,brightMagenta:`#bb9af7`,brightCyan:`#7dcfff`,brightWhite:`#acb0d0`}},{id:`tokyo-night-storm`,name:`Tokyo Night Storm`,source:`enkia/tokyo-night-vscode-theme`,colors:{background:`#24283b`,foreground:`#a9b1d6`,cursor:`#c0caf5`,cursorAccent:`#24283b`,selectionBackground:`#6f7bb6`,selectionForeground:`#c0caf5`,black:`#414868`,red:`#f7768e`,green:`#73daca`,yellow:`#e0af68`,blue:`#7aa2f7`,magenta:`#bb9af7`,cyan:`#7dcfff`,white:`#8089b3`,brightBlack:`#414868`,brightRed:`#f7768e`,brightGreen:`#73daca`,brightYellow:`#e0af68`,brightBlue:`#7aa2f7`,brightMagenta:`#bb9af7`,brightCyan:`#7dcfff`,brightWhite:`#a9b1d6`}}];cF.id;var uF=e=>e?lF.find(t=>t.id===e)??cF:cF,dF=`text-[10px] font-medium tracking-wide text-muted-foreground/70 uppercase`,fF=`text-xs font-normal text-muted-foreground`,pF=Object.fromEntries(eF.map(e=>[e.id,{fontFamily:e.family}])),mF=lF.map(e=>({id:e.id,label:e.name})),hF=eF.map(e=>({id:e.id,label:e.name,itemStyle:pF[e.id]})),gF=FP.map(e=>({id:e.id,label:e.name})),_F=iF.map(e=>({id:String(e.value),label:e.label})),vF=e=>e.toFixed(1),yF=({label:e,value:t,title:n,valueClassName:r})=>(0,y.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,y.jsx)(`dt`,{className:fF,children:e}),(0,y.jsx)(`dd`,{title:n??t,className:rp(`min-w-0 truncate text-right text-foreground/90`,r),children:t})]}),bF=({themeId:e,onThemeChange:t,onThemePreview:n,fontId:r,onFontChange:i,onFontPreview:a,nerdFontEnabled:o,onNerdFontEnabledChange:s,fontSize:c,onFontSizeChange:l,lineHeight:u,onLineHeightChange:d,paddingX:f,onPaddingXChange:p,paddingY:m,onPaddingYChange:h,cursorStyle:g,onCursorStyleChange:_,onCursorStylePreview:v,cursorBlink:x,onCursorBlinkChange:S,scrollback:C,onScrollbackChange:w,scrollOnUserInput:T,onScrollOnUserInputChange:E,notificationsPermission:D,onNotificationsPermissionRequest:O,sessionInfo:k,onPopoverOpenChange:A,onClose:j})=>{let[M,N]=(0,b.useState)(!1),[P,F]=(0,b.useState)(!1),I=(0,b.useRef)(null);return(0,y.jsxs)(eP,{open:M,onOpenChange:e=>{N(e),A?.(e),e||(F(!1),n?.(null),a?.(null),v?.(null),j?.())},children:[(0,y.jsx)(tP,{render:(0,y.jsx)(Xx,{variant:`ghost`,size:`icon-sm`,"aria-label":`terminal settings`,className:`hover:text-foreground`}),children:(0,y.jsx)(Dd,{})}),(0,y.jsx)(nP,{ref:I,side:`bottom`,align:`end`,sideOffset:8,className:rp(`w-64 gap-0 overflow-hidden p-3`,Lx,Rx),children:(0,y.jsxs)(AN,{className:`gap-3`,children:[(0,y.jsxs)(MN,{orientation:`vertical`,className:`gap-1.5`,children:[(0,y.jsx)(NN,{className:dF,children:`Theme`}),(0,y.jsx)(lN,{value:e,items:mF,ariaLabel:`select theme`,placeholder:`Theme`,onValueChange:e=>{e&&t(e)},onOpenChange:e=>{e||n?.(null)},onItemHover:n?e=>n(e):void 0})]}),(0,y.jsx)(cj,{className:`bg-border/40`}),(0,y.jsxs)(MN,{orientation:`vertical`,className:`gap-1.5`,children:[(0,y.jsx)(NN,{className:dF,children:`Font`}),(0,y.jsx)(lN,{value:r,items:hF,ariaLabel:`select font`,placeholder:`Font`,open:P,onValueChange:e=>{e&&i(e)},onOpenChange:e=>{F(e),e||a?.(null)},onItemHover:a?e=>a(e):void 0}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,y.jsx)(`span`,{className:fF,children:`Size`}),(0,y.jsx)(gj,{value:c,min:9,max:24,step:1,ariaLabel:`terminal font size`,decrementAriaLabel:`decrease font size`,incrementAriaLabel:`increase font size`,onValueChange:l})]}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,y.jsx)(`span`,{className:fF,children:`Line height`}),(0,y.jsx)(gj,{value:u,min:1,max:2,step:BS,ariaLabel:`terminal line height`,decrementAriaLabel:`decrease line height`,incrementAriaLabel:`increase line height`,formatDisplay:vF,onValueChange:d})]}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,y.jsxs)(MP,{children:[(0,y.jsx)(NP,{render:(0,y.jsx)(`span`,{className:fF}),children:`Nerd Font icons`}),(0,y.jsx)(PP,{side:`bottom`,sideOffset:8,className:`max-w-xs`,children:`Appends a Symbols Only Nerd Font to the font stack. Icon glyphs (Private Use Area codepoints) are resolved by the symbols font while all other characters render from the primary font above.`})]}),(0,y.jsx)(lP,{"aria-label":`toggle nerd font icons`,checked:o,onCheckedChange:s})]})]}),(0,y.jsx)(cj,{className:`bg-border/40`}),(0,y.jsxs)(MN,{orientation:`vertical`,className:`gap-1.5`,children:[(0,y.jsx)(NN,{className:dF,children:`Window`}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,y.jsx)(`span`,{className:fF,children:`Pad X`}),(0,y.jsx)(gj,{value:f,min:0,max:48,step:1,ariaLabel:`terminal horizontal padding`,decrementAriaLabel:`decrease horizontal padding`,incrementAriaLabel:`increase horizontal padding`,onValueChange:p})]}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,y.jsx)(`span`,{className:fF,children:`Pad Y`}),(0,y.jsx)(gj,{value:m,min:0,max:48,step:1,ariaLabel:`terminal vertical padding`,decrementAriaLabel:`decrease vertical padding`,incrementAriaLabel:`increase vertical padding`,onValueChange:h})]})]}),(0,y.jsx)(cj,{className:`bg-border/40`}),(0,y.jsxs)(MN,{orientation:`vertical`,className:`gap-1.5`,children:[(0,y.jsx)(NN,{className:dF,children:`Notifications`}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,y.jsxs)(MP,{children:[(0,y.jsx)(NP,{render:(0,y.jsx)(`span`,{className:fF}),children:`Desktop alerts`}),(0,y.jsx)(PP,{side:`bottom`,sideOffset:8,className:`max-w-xs`,children:`When on, OSC 9 sequences from the shell trigger browser notifications. Enable to receive alerts when the tab is in the background. Blocked permissions must be changed in browser settings.`})]}),(0,y.jsx)(lP,{"aria-label":`toggle desktop notifications`,checked:D===`granted`,disabled:D===`unsupported`||D===`denied`,onCheckedChange:e=>{e&&O()}})]})]}),(0,y.jsx)(cj,{className:`bg-border/40`}),(0,y.jsxs)(MN,{orientation:`vertical`,className:`gap-1.5`,children:[(0,y.jsx)(NN,{className:dF,children:`Cursor`}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,y.jsx)(`span`,{className:fF,children:`Style`}),(0,y.jsx)(lN,{value:g,items:gF,ariaLabel:`select cursor style`,placeholder:`Cursor style`,triggerClassName:`w-fit min-w-[7rem]`,onValueChange:e=>{RP(e)&&_(e)},onOpenChange:e=>{e||v?.(null)},onItemHover:v?e=>{RP(e)&&v?.(e)}:void 0})]}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,y.jsx)(`span`,{className:fF,children:`Blink`}),(0,y.jsx)(lP,{"aria-label":`toggle cursor blink`,checked:x,onCheckedChange:S})]})]}),(0,y.jsx)(cj,{className:`bg-border/40`}),(0,y.jsxs)(MN,{orientation:`vertical`,className:`gap-1.5`,children:[(0,y.jsx)(NN,{className:dF,children:`Scrollback`}),(0,y.jsx)(lN,{value:String(C),items:_F,ariaLabel:`select scrollback`,placeholder:`Scrollback`,onValueChange:e=>{if(e===null)return;let t=Number(e);sF(t)&&w(t)}}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,y.jsxs)(MP,{children:[(0,y.jsx)(NP,{render:(0,y.jsx)(`span`,{className:fF}),children:`Pin to bottom on input`}),(0,y.jsx)(PP,{side:`bottom`,sideOffset:8,className:`max-w-xs`,children:`When on, typing scrolls the viewport back to the bottom. When off, the viewport stays where you scrolled — useful for reading history while typing.`})]}),(0,y.jsx)(lP,{"aria-label":`toggle pin to bottom on input`,checked:T,onCheckedChange:E})]})]}),k?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(cj,{className:`bg-border/40`}),(0,y.jsxs)(EN,{defaultOpen:!1,children:[(0,y.jsx)(DN,{render:(0,y.jsxs)(`button`,{type:`button`,className:`group/shell flex w-full items-center justify-between gap-2 rounded-sm py-1 text-left transition-colors outline-none hover:text-foreground/90 focus-visible:text-foreground/90`,children:[(0,y.jsx)(`span`,{className:dF,children:`Shell`}),(0,y.jsx)(fd,{className:`size-3 text-muted-foreground/60 transition-transform duration-200 ease-snappy will-change-transform group-aria-expanded/shell:rotate-180`})]})}),(0,y.jsx)(ON,{className:`h-(--collapsible-panel-height) overflow-hidden transition-[height] duration-200 ease-snappy data-closed:h-0`,children:(0,y.jsxs)(`dl`,{className:`flex flex-col gap-1 pt-2 text-xs`,children:[(0,y.jsx)(yF,{label:`Name`,value:k.shellName}),(0,y.jsx)(yF,{label:`Path`,value:k.shell,title:k.shell}),(0,y.jsx)(yF,{label:`PID`,value:String(k.pid),valueClassName:`tabular-nums`}),(0,y.jsx)(yF,{label:`Cwd`,value:k.cwd,title:k.cwd})]})})]})]}):null]})})]})},xF=()=>{let[e,t]=(0,b.useState)(null);return{summary:e,setGitDiffSummary:t}},SF=2.4,CF=.04045,wF=12.92,TF=.055,EF=1.055,DF=.0031308,OF=24389/27,kF=216/24389,AF=.95047,jF=1,MF=1.08883,NF=.008856,PF=7.787,FF=e=>{let t=e/255;return t<=CF?t/wF:((t+TF)/EF)**+SF},IF=e=>e<=0?0:e>=1?255:Math.round(e<=DF?wF*e*255:(EF*e**(1/SF)-TF)*255),LF=e=>e>NF?Math.cbrt(e):PF*e+16/116,RF=e=>{let t=FF(e.r),n=FF(e.g),r=FF(e.b);return{x:.4124564*t+.3575761*n+.1804375*r,y:.2126729*t+.7151522*n+.072175*r,z:.0193339*t+.119192*n+.9503041*r}},zF=e=>{let t=3.2404542*e.x-1.5371385*e.y-.4985314*e.z,n=-.969266*e.x+1.8760108*e.y+.041556*e.z,r=.0556434*e.x-.2040259*e.y+1.0572252*e.z;return{r:IF(t),g:IF(n),b:IF(r)}},BF=e=>{let t=e.x/AF,n=e.y/jF,r=e.z/MF,i=LF(t),a=LF(n),o=LF(r);return{l:116*a-16,a:500*(i-a),b:200*(a-o)}},VF=(e,t)=>{let n=e*e*e;return n>kF?t*n:t*((116*e-16)/OF)},HF=e=>{let t=(e.l+16)/116,n=e.a/500+t,r=t-e.b/200;return{x:VF(n,AF),y:VF(t,jF),z:VF(r,MF)}},UF=e=>BF(RF(e)),WF=e=>zF(HF(e)),GF=e=>{let t=e.replace(/^#/,``);return{r:parseInt(t.slice(0,2),16),g:parseInt(t.slice(2,4),16),b:parseInt(t.slice(4,6),16)}},KF=e=>{let t=Math.max(0,Math.min(255,Math.round(e.r))),n=Math.max(0,Math.min(255,Math.round(e.g))),r=Math.max(0,Math.min(255,Math.round(e.b)));return`#${t.toString(16).padStart(2,`0`)}${n.toString(16).padStart(2,`0`)}${r.toString(16).padStart(2,`0`)}`},qF=e=>UF(GF(e)),JF=e=>KF(WF(e)),YF=6,XF=5,ZF=24,QF=25,$F=(e,t,n)=>({l:t.l+e*(n.l-t.l),a:t.a+e*(n.a-t.a),b:t.b+e*(n.b-t.b)}),eI=(e,t=!1)=>{let n=e.background??`#000000`,r=e.foreground??`#ffffff`,i=[qF(n),qF(e.red??`#ff0000`),qF(e.green??`#00ff00`),qF(e.yellow??`#ffff00`),qF(e.blue??`#0000ff`),qF(e.magenta??`#ff00ff`),qF(e.cyan??`#00ffff`),qF(r)];if(i[7].l<i[0].l&&!t){let e=i[0];i[0]=i[7],i[7]=e}let a=[];for(let e=0;e<YF;e++){let t=$F(e/XF,i[0],i[1]),n=$F(e/XF,i[2],i[3]),r=$F(e/XF,i[4],i[5]),o=$F(e/XF,i[6],i[7]);for(let e=0;e<YF;e++){let i=$F(e/XF,t,n),s=$F(e/XF,r,o);for(let e=0;e<YF;e++){let t=$F(e/XF,i,s);a.push(JF(t))}}}for(let e=0;e<ZF;e++){let t=(e+1)/QF;a.push(JF($F(t,i[0],i[7])))}return a},tI=`Symbols Nerd Font`,nI=``,rI=async e=>{if(!(typeof document>`u`)&&e.name)try{await document.fonts.ready;let t=[document.fonts.load(`16px "${e.name}"`),document.fonts.load(`bold 16px "${e.name}"`),document.fonts.load(`16px "${tI}"`,nI),document.fonts.load(`bold 16px "${tI}"`,nI)];await Promise.all(t)}catch{}},iI=(e,t)=>`\x1b[${e};${t+1}u`,aI=e=>{let t=e.buffer.active,n=Math.max(0,t.baseY-t.viewportY);return{distanceFromBottom:n,wasAtBottom:n===0}},oI=[[127995,127999],[128732,128735],[129008,129008],[129401,129401],[129484,129484],[129653,129655],[129659,129660],[129671,129672],[129705,129711],[129719,129725],[129727,129727],[129731,129733],[129742,129743],[129751,129755],[129760,129768],[129776,129784]],sI=e=>{if(e<127995||e>129784)return!1;for(let[t,n]of oI)if(e>=t&&e<=n)return!0;return!1},cI=6,lI=4,uI=class{version=`15-graphemes-emoji`;base;constructor(e){this.base=e}wcwidth(e){return sI(e)?2:this.base.wcwidth(e)}charProperties(e,t){let n=this.base.charProperties(e,t);return sI(e)?n&~cI|lI:n}},dI=e=>!!e.shiftKey|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0),fI=(e,t)=>{let n=e.buffer.active,r=Math.max(0,n.baseY-n.viewportY),i=r===0;try{t.fit()}catch{return!1}try{if(i)return e.scrollToBottom(),!0;let t=e.buffer.active;if(r>t.baseY)return e.scrollToBottom(),!0;let n=t.baseY-r-t.viewportY;n!==0&&e.scrollLines(n)}catch{}return!0},pI=(e,t)=>`\r\n\r\n\x1b[2;31m[connection lost · code ${e}${t?` · ${t}`:``}]\x1b[0m\r\n`,mI={block:{blink:`\x1B[1 q`,steady:`\x1B[2 q`},underline:{blink:`\x1B[3 q`,steady:`\x1B[4 q`},bar:{blink:`\x1B[5 q`,steady:`\x1B[6 q`}},hI=(e,t)=>{let n=t?`blink`:`steady`;return`\x1b[?25h${mI[e][n]}`},gI=(e,t)=>`${hI(e,t)}\r\n\x1b[2;32m[reconnected]\x1b[0m\r\n\r\n`,_I=e=>`\r\n\x1b[2;31m[${e===null?`shell exited`:`shell exited with code ${e}`}]\x1b[0m\r\n`,vI=55296,yI=56319,bI=(e,t)=>{if(e.length<=t)return[e];let n=[],r=0;for(;r<e.length;){let i=Math.min(r+t,e.length);if(i<e.length){let t=e.charCodeAt(i-1);t>=vI&&t<=yI&&--i}i===r&&(i=r+t),n.push(e.slice(r,i)),r=i}return n},xI=(e,t)=>{if(t.wasAtBottom){e.scrollToBottom();return}let n=e.buffer.active;if(t.distanceFromBottom>n.baseY){e.scrollToBottom();return}let r=n.baseY-t.distanceFromBottom-n.viewportY;r!==0&&e.scrollLines(r)},SI=new class{terminal=null;chunks=[];scheduled=!1;afterFlush=null;attach(e){this.terminal=e}setAfterFlush(e){this.afterFlush=e}detach(){this.flush(),this.terminal=null,this.afterFlush=null}push(e){this.chunks.push(e),this.scheduled||(this.scheduled=!0,queueMicrotask(()=>this.flush()))}flush(){this.scheduled=!1;let e=this.chunks,t=this.terminal;this.chunks=[],!(!t||e.length===0)&&(e.length===1?t.write(e[0]):t.write(e.join(``)),this.afterFlush?.())}},CI=e=>e[0]===3,wI=e=>{if(!Number.isFinite(e))return 13;let t=Math.round(e);return t<9?9:t>24?24:t},TI=1/BS,EI=e=>Math.round(e*TI)/TI,DI=e=>{if(!Number.isFinite(e))return zS;let t=EI(e);return t<1?1:t>2?2:t},OI=1/1,kI=e=>Math.round(e*OI)/OI,AI=e=>{if(!Number.isFinite(e))return 0;let t=kI(e);return t<0?0:t>48?48:t},jI=e=>{if(!Number.isFinite(e))return 0;let t=kI(e);return t<0?0:t>48?48:t},MI=()=>{if(typeof navigator>`u`)return!1;let e=navigator.platform||navigator.userAgent||``;return/Mac|iPhone|iPad|iPod/i.test(e)},NI=e=>e<1e3?String(e):e<1e4?`${(e/1e3).toFixed(1).replace(/\.0$/,``)}k`:`${Math.round(e/1e3)}k`,PI=(e,t,n)=>e.key!==t&&e.key!==t.toUpperCase()?!1:n?e.metaKey&&!e.ctrlKey&&!e.altKey:e.ctrlKey&&!e.metaKey&&!e.altKey,FI=(e,t)=>PI(e,`k`,t),II=(e,t)=>PI(e,`g`,t),LI=(e,t)=>PI(e,`f`,t),RI=(e,t)=>e.code===`Backslash`?e.altKey&&!e.metaKey&&!e.ctrlKey?!0:t?e.metaKey&&!e.ctrlKey&&!e.altKey:e.ctrlKey&&!e.metaKey&&!e.altKey:!1,zI=LA(iC,!0),BI=zI.load,VI=zI.store,HI=RA(rC,IP,RP),UI=HI.load,WI=HI.store,GI=zA(eC,e=>tF(e).id,e=>e),KI=GI.load,qI=GI.store,JI=IA(tC,13,wI),YI=JI.load,XI=JI.store,ZI=IA(nC,zS,DI),QI=ZI.load,$I=ZI.store,eL=IA(aC,aF,e=>sF(e)?e:aF),tL=eL.load,nL=eL.store,rL=LA(oC,!0),iL=rL.load,aL=rL.store,oL=zA($S,e=>uF(e).id,e=>e),sL=oL.load,cL=oL.store,lL=IA(sC,0,AI),uL=lL.load,dL=lL.store,fL=IA(cC,0,jI),pL=fL.load,mL=fL.store,hL=LA(uC,!1),gL=hL.load,_L=hL.store,vL=`<path d='m6 8 4 4-4 4M12 16h6'/>`,yL=[`<circle cx='7' cy='12' r='1.5' fill='currentColor' stroke='none'/>`,`<circle cx='12' cy='12' r='1.5' fill='currentColor' stroke='none'/>`,`<circle cx='17' cy='12' r='1.5' fill='currentColor' stroke='none'/>`].join(``),bL={ready:`hsl(220 8% 46%)`,running:`hsl(142 72% 45%)`,"alive-quiet":`hsl(210 65% 50%)`,dead:`hsl(0 72% 50%)`},xL={ready:`hsl(220 10% 16%)`,running:`hsl(142 85% 12%)`,"alive-quiet":`hsl(210 70% 14%)`,dead:`hsl(0 80% 12%)`},SL={ready:vL,running:yL,"alive-quiet":vL,dead:vL},CL=`<circle cx='19' cy='7' r='3.5' fill='hsl(0 72% 50%)' stroke='white' stroke-width='1.5'/>`,wL=(e,t=!1)=>{let n=bL[e],r=xL[e],i=SL[e],a=t?CL:``;return[`<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' color='${r}' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' opacity='${e===`dead`?KS:1}'>`,`<rect x='2' y='4' width='20' height='16' rx='2' fill='${n}'/>`,i,a,`</svg>`].join(``)},TL=`ready`,EL=null,DL=!1,OL=(e,t)=>EL===null||e!==TL||t!==DL,kL=(e,t)=>{TL=e,EL=e,DL=t},AL=()=>{TL=`ready`,EL=null,DL=!1},jL=(e,t=!1)=>{if(typeof document>`u`||!OL(e,t))return;kL(e,t);let n=`data:image/svg+xml,${encodeURIComponent(wL(e,t))}`,r=document.querySelector(`link[rel="icon"]`);r||(r=document.createElement(`link`),r.rel=`icon`,document.head.appendChild(r)),r.type=`image/svg+xml`,r.href=n},ML=`/api/health`,NL=async()=>{try{return(await fetch(ML)).ok}catch{return!1}},PL=(e,t)=>t.buffer.active.type!==`alternate`||t.modes.mouseTrackingMode!==`none`?!1:e.deltaMode===WheelEvent.DOM_DELTA_PIXEL,FL=e=>e||`localterm`,IL=e=>`${HS}${e||`localterm`}`,LL={matchBackground:XS,activeMatchBackground:ZS,activeMatchBorder:QS,matchOverviewRuler:ZS,activeMatchColorOverviewRuler:QS},RL=`cwd`,zL=e=>{let t=new URL(`/ws`,window.location.href);t.protocol=t.protocol===`https:`?`wss:`:`ws:`;let n=e??new URLSearchParams(window.location.search).get(RL);return n&&t.searchParams.set(RL,n),t.toString()},BL=e=>{let t=new URL(window.location.origin);return e&&t.searchParams.set(RL,e),t.toString()},VL=({onModalOpenChange:e,onForegroundProcessChange:t}={})=>{let n=(0,b.useRef)(null),r=(0,b.useRef)(null),i=(0,b.useRef)(!1),a=(0,b.useRef)(null),o=(0,b.useRef)(null),s=(0,b.useRef)(null),c=(0,b.useRef)(null),l=(0,b.useRef)(null),u=(0,b.useRef)(null),d=(0,b.useRef)(null),f=(0,b.useRef)(null),p=(0,b.useRef)(sL()),m=(0,b.useRef)(KI()),h=(0,b.useRef)(YI()),g=(0,b.useRef)(QI()),_=(0,b.useRef)(UI()),v=(0,b.useRef)(BI()),x=(0,b.useRef)(tL()),C=(0,b.useRef)(iL()),w=(0,b.useRef)(uL()),T=(0,b.useRef)(pL()),E=(0,b.useRef)(gL()),O=(0,b.useRef)(null),k=(0,b.useRef)(null),A=(0,b.useRef)(null),j=(0,b.useRef)(null),M=(0,b.useRef)(null),[N,P]=(0,b.useState)(null),[F,I]=(0,b.useState)(0),[L,R]=(0,b.useState)(!1),[z,ee]=(0,b.useState)(!1),[B,te]=(0,b.useState)(!1),[V,H]=(0,b.useState)(!1),ne=(0,b.useRef)(null),[U,re]=(0,b.useState)(0),[W,ie]=(0,b.useState)(!1),[ae,oe]=(0,b.useState)(!1),se=(0,b.useRef)(null),ce=(0,b.useRef)(!1),le=W||ae;ce.current=ae;let[ue,de]=(0,b.useState)(``),[fe,pe]=(0,b.useState)({resultIndex:-1,resultCount:0}),[me,he]=(0,b.useState)(p.current),[ge,_e]=(0,b.useState)(null),ve=ge??me,ye=(0,b.useMemo)(()=>uF(ve),[ve]),be=(0,b.useMemo)(()=>({...ye.colors,extendedAnsi:eI(ye.colors)}),[ye]),[xe,Se]=(0,b.useState)(m.current),[Ce,we]=(0,b.useState)(null),Te=Ce??xe,[Ee,De]=(0,b.useState)(E.current),Oe=(0,b.useMemo)(()=>tF(Te),[Te]),[ke,Ae]=(0,b.useState)(h.current),[je,Me]=(0,b.useState)(g.current),[Ne,Pe]=(0,b.useState)(_.current),[Fe,Ie]=(0,b.useState)(null),Le=Fe??Ne,[Re,ze]=(0,b.useState)(v.current),[Be,Ve]=(0,b.useState)(x.current),[He,Ue]=(0,b.useState)(C.current),[We,Ge]=(0,b.useState)(w.current),[qe,Ye]=(0,b.useState)(T.current),[Xe,Ze]=(0,b.useState)(null),[Qe,$e]=(0,b.useState)(`Notification`in window?Notification.permission:`unsupported`),[et,tt]=(0,b.useState)(null),nt=(0,b.useRef)(null),rt=(0,b.useRef)(!1),it=(0,b.useMemo)(MI,[]),[at,ot]=(0,b.useState)(!1),{summary:st,setGitDiffSummary:ct}=xF(),ut=st!==null&&st.isRepo&&st.files>0;(0,b.useEffect)(()=>{let e=n.current;if(!e)return;let l=!1,u=!1,d=!1,y=``,b=null,w=null,T=null,N=null,F=null,L=0,R=`ready`,z=!1,ee=!1,B=[0],te=()=>B[B.length-1]??0,V=()=>{let e=performance.now()-L;if(e<750){F=window.setTimeout(V,750-e);return}F=null,N!==null&&(window.clearTimeout(N),N=null),R===`running`&&(document.hidden&&(z=!0),ee?(R=`alive-quiet`,jL(`alive-quiet`,z)):(R=`ready`,jL(`ready`,z)))},H=()=>{R!==`running`&&N===null&&(N=window.setTimeout(()=>{N=null,!(l||u)&&(R=`running`,z=!1,jL(`running`))},250)),L=performance.now(),F===null&&(F=window.setTimeout(V,750))},U=()=>{N!==null&&(window.clearTimeout(N),N=null),F!==null&&(window.clearTimeout(F),F=null),(R!==`ready`||z)&&(R=`ready`,z=!1,jL(`ready`))},re=tF(m.current);rI(re).then(()=>{if(l)return;let e=r.current;e&&e.clearTextureAtlas(),W._core._charSizeService.measure(),je()});let W=new $u({allowProposedApi:!0,cursorBlink:v.current,cursorStyle:_.current,fontFamily:nF(re,E.current),fontSize:h.current,lineHeight:g.current,scrollback:x.current,theme:{...uF(p.current).colors,extendedAnsi:eI(uF(p.current).colors)},macOptionIsMeta:!0,scrollOnUserInput:C.current,windowOptions:{getWinSizePixels:!0,getCellSizePixels:!0,getWinSizeChars:!0},scrollbar:{showScrollbar:!1}});r.current=W,SI.attach(W);let ie=new D;O.current=ie,W.loadAddon(ie),W.loadAddon(new Mn),W.loadAddon(new S),W.loadAddon(new Ke),W.loadAddon(new Je),W.loadAddon(new En);let ae=W._core.unicodeService._activeProvider;W.unicode.register(new uI(ae)),W.unicode.activeVersion=`15-graphemes-emoji`;let oe=new lt;W.loadAddon(oe),o.current=oe;let se=oe.onDidChangeResults(pe);W.open(e),ie.proposeDimensions&&=()=>{if(!W||!W.element||!W.element.parentElement)return;let e=W,t=e._core._renderService.dimensions.css.cell.width,n=e._core._renderService.dimensions.css.cell.height;if(t===0||n===0)return;let r=window.getComputedStyle(W.element.parentElement),i=window.getComputedStyle(W.element),a=Math.max(0,parseInt(r.getPropertyValue(`width`)))-(parseInt(i.getPropertyValue(`padding-right`))+parseInt(i.getPropertyValue(`padding-left`))),o=parseInt(r.getPropertyValue(`height`))-(parseInt(i.getPropertyValue(`padding-top`))+parseInt(i.getPropertyValue(`padding-bottom`)));return{cols:Math.max(2,Math.floor(a/t)),rows:Math.max(1,Math.floor(o/n))}};let ce=()=>{let e=W.buffer.active,t=e.length,n=W.rows,r=e.viewportY+n>=t,i=t>n,a=j.current,o=M.current;if(!(!a||!o)&&(a.classList.toggle(`xterm-scrollbar-visible`,!r&&i),i)){let r=n/t,i=e.viewportY/t;o.style.height=`${r*100}%`,o.style.top=`${i*100}%`}};ce();let le=W.onScroll(ce);SI.setAfterFlush(ce);let ue=!1,de=0,fe=0,me=e=>{if(e.button===0){ue=!0,de=e.clientY,fe=W.buffer.active.viewportY;try{e.target.setPointerCapture(e.pointerId)}catch{}e.preventDefault()}},he=e=>{if(!ue)return;let t=j.current;if(!t)return;let n=t.clientHeight,r=W.buffer.active.length-W.rows;if(r<=0||n<=0)return;let i=n/r,a=e.clientY-de,o=Math.max(0,Math.min(r,fe+Math.round(a/i)));o!==W.buffer.active.viewportY&&W.scrollLines(o-W.buffer.active.viewportY)},ge=()=>{ue=!1},_e=e=>{if(e.button!==0||e.target===M.current)return;let t=j.current;if(!t)return;let n=t.getBoundingClientRect(),r=(e.clientY-n.top)/n.height,i=W.buffer.active,a=i.length,o=Math.max(0,Math.min(a-W.rows,Math.round(r*a)-Math.floor(W.rows/2)));W.scrollLines(o-i.viewportY)},ve=M.current,ye=j.current;ve&&(ve.addEventListener(`pointerdown`,me),ve.addEventListener(`pointermove`,he),ve.addEventListener(`pointerup`,ge),ve.addEventListener(`pointercancel`,ge)),ye&&ye.addEventListener(`pointerdown`,_e);try{let e=new ia;e.onContextLoss(()=>e.dispose()),W.loadAddon(e)}catch{}let be=W.parser.registerCsiHandler({prefix:`>`,final:`u`},e=>{let t=e[0],n=typeof t==`number`?t:1;return B.push(n),!0}),xe=W.parser.registerCsiHandler({prefix:`<`,final:`u`},e=>{let t=e[0],n=typeof t==`number`&&t>0?t:1;for(let e=0;e<n&&B.length>1;e+=1)B.pop();return!0}),Se=W.parser.registerCsiHandler({prefix:`=`,final:`u`},e=>{let t=e[0],n=e[1];if(typeof t!=`number`)return!0;let r=t,i=typeof n==`number`&&n>0?n:1,a=B.length-1,o=B[a]??0;return i===1?B[a]=r:i===2?B[a]=o|r:i===3&&(B[a]=o&~r),!0}),Ce=W.parser.registerCsiHandler({final:`J`},CI),we=W.parser.registerCsiHandler({prefix:`?`,final:`J`},CI),Te=e=>{b?.readyState===WebSocket.OPEN&&b.send(JSON.stringify(e))},Ee=()=>{let e=f.current;e&&cancelAnimationFrame(e.frameId),f.current=null},De=()=>{let e=f.current;e&&xI(W,e.anchor)},Oe=e=>{Ee(),f.current={anchor:e,frameId:requestAnimationFrame(()=>{De(),f.current=null})}};W.attachCustomWheelEventHandler(e=>PL(e,W)?(e.preventDefault(),!1):!0),W.attachCustomKeyEventHandler(e=>{if(e.key===`Tab`&&(e.metaKey||e.ctrlKey))return!1;if(RI(e,it)){if(e.type===`keydown`){e.preventDefault();let t=document.getElementById(`new-shell-link`);t instanceof HTMLAnchorElement&&t.click()}return!1}if(FI(e,it))return e.type===`keydown`&&(e.preventDefault(),ne.current?.()),!1;if(II(e,it))return e.type===`keydown`&&(e.preventDefault(),A.current?.()),!1;if(LI(e,it))return e.type===`keydown`&&(e.preventDefault(),k.current?.()),!1;if(e.type===`keydown`&&e.key===`Enter`){let t=dI(e),n=(te()&1)!=0;if(t!==0&&n)return e.preventDefault(),Te({type:`input`,data:iI(13,t)}),!1;if(t===1)return e.preventDefault(),Te({type:`input`,data:`
|
|
115
|
+
`}),!1}return!0});let ke=e=>{if(u)return;let t=e.trim();t&&(y=t,document.title=FL(t))};s.current=()=>W.focus(),c.current=e=>W.paste(e);let Ae=(e,t)=>{let n=W,r=n._core._renderService?.dimensions?.css?.canvas?.width,i=n._core._renderService?.dimensions?.css?.canvas?.height;Te({type:`resize`,cols:e,rows:t,...r!=null&&i!=null?{pixelWidth:Math.round(r),pixelHeight:Math.round(i)}:{}})},je=()=>{let e=aI(W);fI(W,ie)&&(Oe(e),Ae(W.cols,W.rows))},Me=()=>{T!==null&&window.clearTimeout(T),T=window.setTimeout(()=>{T=null,je()},80)};W.onData(e=>{for(let t of bI(e,OC))Te({type:`input`,data:t})}),W.onResize(({cols:e,rows:t})=>{Ae(e,t),ce()});let Ne=new ResizeObserver(Me),Pe=()=>{!document.hidden&&z&&(z=!1,jL(R))};document.addEventListener(`visibilitychange`,Pe),Ne.observe(e),je(),requestAnimationFrame(()=>W.focus());let Fe=e=>{if(!u){if(u=!0,e===null||e===0){window.close(),setTimeout(()=>{l||(U(),jL(`dead`),W.write(_I(e)),document.title=IL(y),P({reason:`shell-exited`,exitCode:e}),Ze(null))},100);return}U(),jL(`dead`),W.write(_I(e)),document.title=IL(y),P({reason:`shell-exited`,exitCode:e}),Ze(null)}},Ie=(e,t,n)=>{u||(u=!0,U(),jL(`dead`),W.write(pI(e,t)),document.title=IL(y),P({reason:`connection-lost`,closeCode:e,closeReason:t,wasClean:n}),Ze(null))},Le=()=>{if(l)return;let e=new WebSocket(zL(nt.current));b=e,e.addEventListener(`open`,()=>{l||b!==e||(d=!0,rt.current=!0,I(0),Ae(W.cols,W.rows))}),e.addEventListener(`message`,n=>{if(l||b!==e)return;let r;try{r=JSON.parse(typeof n.data==`string`?n.data:String(n.data))}catch{return}if(typeof r==`object`&&r&&r.type===`output`&&typeof r.data==`string`){let e=r.data;SI.push(e),H();return}let i=bA.safeParse(r);if(!i.success)return;let a=i.data;if(a.type===`title`)ke(a.title);else if(a.type===`session`)Ze({shell:a.shell,shellName:a.shellName,pid:a.pid,cwd:a.cwd,title:a.title}),tt(a.cwd),ke(a.title);else if(a.type===`cwd`)tt(a.cwd),ct(null);else if(a.type===`git-diff-summary`)ct(a.summary);else if(a.type===`foreground`){let e=a.process!==null;t?.(e),!e&&R===`alive-quiet`&&(R=`ready`,jL(`ready`,z)),ee=e}else a.type===`notification`?`Notification`in window&&Notification.permission===`granted`&&new Notification(a.body):a.type===`exit`&&(U(),Fe(a.code))}),e.addEventListener(`close`,t=>{if(b===e&&(b=null,rt.current=!1,!l&&!u)){if(d){console.warn(`[localterm] websocket closed: code=${t.code} reason=${JSON.stringify(t.reason)} wasClean=${t.wasClean}`),Ie(t.code,t.reason,t.wasClean);return}I(e=>e+1),w=window.setTimeout(Le,RS)}}),e.addEventListener(`error`,t=>{console.warn(`[localterm] websocket error`,t);try{e.close()}catch{}})};return a.current=()=>{if(!l){u=!1,d=!1,rt.current=!1,P(null),Ze(null),I(0),jL(`ready`),t?.(!1),w!==null&&(window.clearTimeout(w),w=null);try{b?.close()}catch{}b=null,Le()}},Le(),i.current=!0,()=>{l=!0,i.current=!1,ve&&(ve.removeEventListener(`pointerdown`,me),ve.removeEventListener(`pointermove`,he),ve.removeEventListener(`pointerup`,ge),ve.removeEventListener(`pointercancel`,ge)),ye&&ye.removeEventListener(`pointerdown`,_e),se.dispose(),le.dispose(),be.dispose(),xe.dispose(),Se.dispose(),Ce.dispose(),we.dispose(),w!==null&&window.clearTimeout(w),T!==null&&window.clearTimeout(T),Ee(),U(),document.removeEventListener(`visibilitychange`,Pe),Ne.disconnect();try{b?.close()}catch{}b=null,SI.detach(),W.dispose(),document.title=VS}},[]),(0,b.useEffect)(()=>{if(!i.current)return;let e=r.current;e&&(e.options.theme=be)},[be]),(0,b.useEffect)(()=>{if(!i.current||!r.current)return;let e=!1;return rI(Oe).then(()=>{if(e)return;let t=r.current;if(!t)return;t.options.fontFamily=nF(Oe,Ee),t.clearTextureAtlas();let n=O.current;n&&fI(t,n)}),()=>{e=!0}},[Oe,Ee]);let dt=(0,b.useCallback)(e=>{he(e),_e(null),cL(e)},[]),ft=(0,b.useCallback)(e=>{Se(e),we(null),qI(e)},[]),pt=(0,b.useCallback)(e=>{De(e),_L(e)},[]);(0,b.useEffect)(()=>{if(!i.current)return;let e=r.current;if(!e)return;e.options.fontSize=ke;let t=O.current;t&&fI(e,t)},[ke]);let mt=(0,b.useCallback)(e=>{let t=wI(e);Ae(t),XI(t)},[]);(0,b.useEffect)(()=>{if(!i.current)return;let e=r.current;if(!e)return;e.options.lineHeight=je;let t=O.current;t&&fI(e,t)},[je]);let ht=(0,b.useCallback)(e=>{let t=DI(e);Me(t),$I(t)},[]);(0,b.useEffect)(()=>{if(!i.current)return;let e=r.current;e&&(e.options.cursorStyle=Le)},[Le]);let gt=(0,b.useCallback)(e=>{Pe(e),Ie(null),WI(e)},[]);(0,b.useEffect)(()=>{if(!i.current)return;let e=r.current;e&&(e.options.cursorBlink=Re)},[Re]);let _t=(0,b.useCallback)(e=>{ze(e),VI(e)},[]);(0,b.useEffect)(()=>{if(!i.current)return;let e=r.current;e&&(e.options.scrollback=Be)},[Be]);let vt=(0,b.useCallback)(e=>{Ve(e),nL(e)},[]);(0,b.useEffect)(()=>{if(!i.current)return;let e=r.current;e&&(e.options.scrollOnUserInput=He)},[He]);let yt=(0,b.useCallback)(e=>{Ue(e),aL(e)},[]);(0,b.useEffect)(()=>{if(!i.current)return;let e=r.current;if(!e)return;let t=O.current;t&&fI(e,t)},[We,qe]);let bt=(0,b.useCallback)(e=>{let t=AI(e);Ge(t),dL(t)},[]),xt=(0,b.useCallback)(e=>{let t=jI(e);Ye(t),mL(t)},[]),St=(0,b.useCallback)(()=>{`Notification`in window&&Notification.requestPermission().then(e=>{$e(e)})},[]);(0,b.useEffect)(()=>{if(!B)return;let e=l.current;e&&(e.focus(),e.select())},[B,U]);let Ct=(0,b.useCallback)(e=>{if(!e){o.current?.clearDecorations(),pe({resultIndex:-1,resultCount:0});return}o.current?.findNext(e,{decorations:LL})},[]),wt=(0,b.useCallback)(e=>{e&&o.current?.findPrevious(e,{decorations:LL})},[]),Tt=(0,b.useCallback)(()=>{te(!1),de(``),pe({resultIndex:-1,resultCount:0}),o.current?.clearDecorations(),s.current?.()},[]),Et=(0,b.useCallback)(()=>{se.current!==null&&(window.clearTimeout(se.current),se.current=null),ie(!0)},[]),Dt=(0,b.useCallback)(e=>{let t=e.clientY<=0||e.clientX>=window.innerWidth-1?YS:200;se.current=window.setTimeout(()=>{se.current=null,ce.current||ie(!1)},t)},[]),Ot=(0,b.useCallback)(e=>{oe(e),e||(se.current!==null&&window.clearTimeout(se.current),se.current=window.setTimeout(()=>{se.current=null,ie(!1)},200))},[]);ne.current=(0,b.useCallback)(()=>{H(e=>!e)},[]);let kt=(0,b.useCallback)(()=>{H(!1),s.current?.()},[]),At=(0,b.useCallback)(()=>{te(!0),H(!1),re(e=>e+1)},[]);k.current=At;let jt=(0,b.useCallback)(()=>{ot(!0),H(!1)},[]);A.current=jt;let Mt=(0,b.useCallback)(()=>{ot(!1),s.current?.()},[]),Nt=(0,b.useCallback)(e=>{c.current?.(e)},[]),Pt=(0,b.useCallback)(e=>{let t=e.target.value;de(t),Ct(t)},[Ct]),Ft=(0,b.useCallback)(e=>{if(LI(e.nativeEvent,it)){e.preventDefault(),e.currentTarget.select();return}if(e.key===`Escape`){e.preventDefault(),Tt();return}e.key===`Enter`&&(e.preventDefault(),e.shiftKey?wt(ue):Ct(ue))},[Tt,Ct,wt,it,ue]),It=(0,b.useCallback)(()=>{ee(!0),a.current?.(),u.current!==null&&window.clearTimeout(u.current),u.current=window.setTimeout(()=>{u.current=null,ee(!1)},800)},[]),Lt=(0,b.useCallback)(()=>{navigator.clipboard.writeText(US).then(()=>{R(!0),d.current!==null&&window.clearTimeout(d.current),d.current=window.setTimeout(()=>{d.current=null,R(!1)},WS)}).catch(()=>{})},[]);(0,b.useEffect)(()=>()=>{se.current!==null&&(window.clearTimeout(se.current),se.current=null),u.current!==null&&(window.clearTimeout(u.current),u.current=null),d.current!==null&&(window.clearTimeout(d.current),d.current=null)},[]),(0,b.useEffect)(()=>{if(nt.current=et,!et)return;let e=new URL(window.location.href);if(e.searchParams.get(RL)!==et){e.searchParams.set(RL,et);try{window.history.replaceState(null,``,e)}catch{}}},[et]);let Rt=BL(et),zt=N!==null,Bt=!zt&&F>=2,Vt=zt||Bt,Ht=N!==null&&N.reason!==`shell-exited`||Bt;(0,b.useEffect)(()=>{if(!Ht)return;let e=Date.now(),t=!1,n=null,i=i=>{if(t||rt.current)return;if(i){let e=r.current;e&&(e.write(gI(Le,Re)),e.refresh(0,e.rows-1),e.focus()),a.current?.();return}let s=Date.now()-e<5e3?250:GS;n=window.setTimeout(o,s)},o=()=>{NL().then(i)};return o(),()=>{t=!0,n!==null&&window.clearTimeout(n)}},[Ht,Le,Re]),(0,b.useEffect)(()=>{e?.(Vt),Vt&&(H(!1),ot(!1))},[Vt,e]);let Ut=fe.resultCount===0?`0/0`:`${fe.resultIndex+1}/${fe.resultCount}`,Wt=ye.colors.background??`#101010`,Gt=(0,b.useMemo)(()=>{let e=it?`⌘`:`Ctrl+`;return[{id:`find`,label:`Find in terminal`,category:`Actions`,shortcut:`${e}F`,icon:(0,y.jsx)(Td,{className:`size-3.5`}),action:At},{id:`git-diff`,label:`View git diff`,category:`Actions`,shortcut:`${e}G`,icon:(0,y.jsx)(hd,{className:`size-3.5`}),action:jt},{id:`new-shell`,label:`Open new shell`,category:`Actions`,shortcut:`Alt+T`,icon:(0,y.jsx)(Cd,{className:`size-3.5`}),action:()=>{let e=document.getElementById(`new-shell-link`);e instanceof HTMLAnchorElement&&e.click()}},{id:`font-size-up`,label:`Increase font size`,category:`Settings`,shortcut:`${e}+`,icon:(0,y.jsx)(xd,{className:`size-3.5`}),action:()=>mt(ke+1)},{id:`font-size-down`,label:`Decrease font size`,category:`Settings`,shortcut:`${e}-`,icon:(0,y.jsx)(xd,{className:`size-3.5`}),action:()=>mt(ke-1)},{id:`cursor-blink`,label:`Cursor blink`,category:`Settings`,checked:Re,action:()=>_t(!Re)},{id:`scroll-on-input`,label:`Pin to bottom on input`,category:`Settings`,checked:He,action:()=>yt(!He)},...FP.map(e=>({id:`cursor:${e.id}`,label:e.name,category:`Cursor`,checked:e.id===Ne,action:()=>gt(e.id)})),...eF.map(e=>({id:`font:${e.id}`,label:e.name,category:`Font`,checked:e.id===xe,action:()=>ft(e.id)})),...lF.map(e=>({id:`theme:${e.id}`,label:e.name,category:`Theme`,checked:e.id===me,action:()=>dt(e.id)}))]},[it,dt,ft,At,jt,gt,Re,_t,ke,mt,He,yt,me,xe,Ne]),Kt=(0,b.useCallback)(e=>{let t=e?.id??``;_e(t.startsWith(`theme:`)?t.slice(6):null),we(t.startsWith(`font:`)?t.slice(5):null);let n=t.startsWith(`cursor:`)?t.slice(7):null;Ie(RP(n)?n:null)},[]);return(0,y.jsxs)(`div`,{className:`h-dvh w-dvw`,style:{background:Wt},children:[(0,y.jsxs)(`div`,{className:`relative h-full w-full`,children:[(0,y.jsx)(`div`,{ref:n,"aria-label":`terminal session`,className:`absolute`,style:{top:qe,right:We,bottom:qe,left:We}}),(0,y.jsx)(`div`,{ref:j,className:`xterm-scrollbar-track`,style:{top:qe,right:We,bottom:qe},children:(0,y.jsx)(`div`,{ref:M,className:`xterm-scrollbar-thumb`})}),N===null?null:(0,y.jsx)(cS,{variant:`destructive`,role:`status`,"aria-live":`polite`,className:`absolute top-2 left-3 z-10`,children:N.reason===`shell-exited`?N.exitCode===null?`exited`:`exited · code ${N.exitCode}`:`disconnected · code ${N.closeCode}`}),(0,y.jsxs)(`div`,{className:rp(`absolute right-0 top-0 z-10 flex flex-col items-end pr-3 pt-1`,le||ut?`pointer-events-auto`:`pointer-events-none`),onMouseEnter:Et,onMouseLeave:Dt,children:[(0,y.jsx)(`div`,{"aria-hidden":`true`,className:rp(`pointer-events-auto mr-0.5 h-[2px] w-5 rounded-full bg-muted-foreground/25 transition-opacity duration-150`,le||B||ut?`opacity-0`:`opacity-100`)}),!B&&(0,y.jsxs)(`div`,{role:`toolbar`,"aria-label":`terminal actions`,className:rp(`mt-1 flex items-center gap-0.5 rounded-md border border-border/60 bg-background/70 p-0.5 text-muted-foreground shadow-xs backdrop-blur-md`,`transition-[opacity,transform] duration-200 ease-snappy`,le||ut?`translate-y-0 opacity-100`:`pointer-events-none -translate-y-1 opacity-0`),onMouseDown:e=>e.preventDefault(),onKeyDown:()=>s.current?.(),children:[(0,y.jsx)(`div`,{className:rp(`grid`,ut&&`transition-[grid-template-columns] duration-200 ease-snappy`,ut&&!le?`grid-cols-[0fr]`:`grid-cols-[1fr]`),children:(0,y.jsxs)(`div`,{className:rp(`flex min-w-0 items-center gap-0.5 overflow-hidden`,ut&&`transition-opacity duration-200 ease-snappy`,ut&&!le?`pointer-events-none opacity-0`:`opacity-100`),children:[(0,y.jsx)(bF,{themeId:me,onThemeChange:dt,onThemePreview:_e,fontId:xe,onFontChange:ft,onFontPreview:we,nerdFontEnabled:Ee,onNerdFontEnabledChange:pt,fontSize:ke,onFontSizeChange:mt,lineHeight:je,onLineHeightChange:ht,cursorStyle:Ne,onCursorStyleChange:gt,onCursorStylePreview:Ie,cursorBlink:Re,onCursorBlinkChange:_t,scrollback:Be,onScrollbackChange:vt,scrollOnUserInput:He,onScrollOnUserInputChange:yt,paddingX:We,onPaddingXChange:bt,paddingY:qe,onPaddingYChange:xt,notificationsPermission:Qe,onNotificationsPermissionRequest:St,sessionInfo:Xe,onPopoverOpenChange:Ot,onClose:s.current??void 0}),(0,y.jsx)(Xx,{variant:`ghost`,size:`icon-sm`,onClick:At,"aria-label":`find in terminal`,className:`hover:text-foreground`,children:(0,y.jsx)(Td,{})}),(0,y.jsx)(Xx,{variant:`ghost`,size:`icon-sm`,nativeButton:!1,"aria-label":`open a new shell in a new browser tab`,render:(0,y.jsx)(`a`,{id:`new-shell-link`,href:Rt,target:`_blank`,rel:`noopener noreferrer`}),className:`hover:text-foreground`,children:(0,y.jsx)(Cd,{})})]})}),ut&&st!==null?(0,y.jsxs)(`button`,{type:`button`,onClick:jt,"aria-label":`view git diff: ${st.additions} additions, ${st.deletions} deletions${st.binaries>0?`, ${st.binaries} binary files changed`:``}`,title:`${it?`⌘`:`Ctrl+`}G`,className:`flex h-8 items-center gap-1 rounded-[min(var(--radius-md),10px)] px-2 font-mono text-xs tabular-nums outline-none transition-colors hover:bg-muted hover:text-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50`,children:[(0,y.jsxs)(`span`,{className:`text-emerald-400`,children:[`+`,NI(st.additions)]}),(0,y.jsxs)(`span`,{className:`text-red-400`,children:[`−`,NI(st.deletions)]}),st.binaries>0?(0,y.jsxs)(`span`,{className:`flex items-center gap-0.5 text-muted-foreground`,children:[(0,y.jsx)(ud,{className:`size-3`,"aria-hidden":`true`}),st.binaries]}):null]}):null]}),B&&(0,y.jsxs)(AS,{role:`search`,"aria-label":`find in terminal`,className:`mt-1 w-80 border-border/60 bg-background/70 text-muted-foreground shadow-xs backdrop-blur-md dark:bg-background/70`,children:[(0,y.jsx)(IS,{ref:l,type:`search`,value:ue,onChange:Pt,onKeyDown:Ft,placeholder:`Find`,"aria-label":`find query`,className:`text-xs`}),(0,y.jsxs)(MS,{align:`inline-end`,children:[(0,y.jsx)(FS,{role:`status`,"aria-label":`match count`,className:`text-xs tabular-nums`,children:Ut}),(0,y.jsx)(PS,{size:`icon-xs`,onClick:()=>wt(ue),disabled:fe.resultCount===0,"aria-label":`previous match`,children:(0,y.jsx)(pd,{})}),(0,y.jsx)(PS,{size:`icon-xs`,onClick:()=>Ct(ue),disabled:fe.resultCount===0,"aria-label":`next match`,children:(0,y.jsx)(fd,{})})]})]})]})]}),(0,y.jsx)(yC,{open:V,onClose:kt,commands:Gt,onActiveItemChange:Kt}),(0,y.jsx)(oj,{open:at,cwd:et,onClose:Mt,onSendToTerminal:Nt}),(0,y.jsx)(Zx,{open:Vt,children:(0,y.jsx)(eS,{children:N===null?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(tS,{children:[(0,y.jsxs)(rS,{className:`flex items-center gap-2`,children:[(0,y.jsx)(LS,{"aria-hidden":`true`,role:`presentation`,"aria-label":void 0}),`Lost connection`]}),(0,y.jsx)(iS,{children:`The localterm server isn't responding. Start it again from your terminal, then retry.`})]}),(0,y.jsxs)(AS,{children:[(0,y.jsx)(IS,{readOnly:!0,value:US,"aria-label":`restart command`,className:`font-mono`}),(0,y.jsx)(MS,{align:`inline-end`,children:(0,y.jsx)(PS,{size:`icon-xs`,onClick:Lt,"aria-label":L?`Copied`:`Copy restart command`,children:L?(0,y.jsx)(dd,{}):(0,y.jsx)(md,{})})})]}),(0,y.jsx)(nS,{children:(0,y.jsxs)(aS,{onClick:It,disabled:z,children:[z?(0,y.jsx)(LS,{"data-icon":`inline-start`}):null,`Retry`]})})]}):N.reason===`shell-exited`?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(tS,{children:[(0,y.jsx)(rS,{children:`Shell ended`}),(0,y.jsx)(iS,{children:N.exitCode===null||N.exitCode===0?`Open a new shell to keep going, or close this tab.`:`Exit code ${N.exitCode}. Open a new shell to keep going.`})]}),(0,y.jsx)(nS,{children:(0,y.jsx)(aS,{onClick:()=>window.open(Rt,`_blank`,`noopener,noreferrer`),children:`New shell`})})]}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(tS,{children:[(0,y.jsxs)(rS,{className:`flex items-center gap-2`,children:[(0,y.jsx)(LS,{"aria-hidden":`true`,role:`presentation`,"aria-label":void 0}),`Connection lost`]}),(0,y.jsxs)(iS,{children:[`The browser lost its connection to the localterm daemon (close code`,` `,N.closeCode,N.closeReason?` · ${N.closeReason}`:``,`). Reconnecting spawns a fresh shell. The previous one can't be reattached.`]})]}),(0,y.jsx)(nS,{children:(0,y.jsxs)(aS,{onClick:It,disabled:z,children:[z?(0,y.jsx)(LS,{"data-icon":`inline-start`}):null,`Reconnect`]})})]})})})]})},HL=()=>{let e=(0,b.useRef)(!1),t=(0,b.useRef)(!1);return(0,b.useEffect)(()=>{let n=n=>{e.current||t.current&&n.preventDefault()},r=()=>window.addEventListener(`beforeunload`,n);return window.addEventListener(`keydown`,r,{once:!0}),()=>{window.removeEventListener(`keydown`,r),window.removeEventListener(`beforeunload`,n)}},[]),(0,y.jsx)(VL,{onModalOpenChange:(0,b.useCallback)(t=>{e.current=t},[]),onForegroundProcessChange:(0,b.useCallback)(e=>{t.current=e},[])})};AL(),jL(`ready`),(()=>{if(typeof document>`u`||document.getElementById(`localterm-google-fonts`))return;let e=rF();if(!e)return;let t=document.createElement(`link`);t.id=lC,t.rel=`stylesheet`,t.href=e,document.head.appendChild(t)})();var UL=document.getElementById(`root`);if(!UL)throw Error(`Root element not found`);(0,x.createRoot)(UL).render((0,y.jsx)(b.StrictMode,{children:(0,y.jsx)(jP,{delay:300,children:(0,y.jsx)(HL,{})})}));
|
|
116
|
+
//# sourceMappingURL=index-BNcQ1ucu.js.map
|