agentpane 0.2.2 → 0.2.3

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.
Files changed (40) hide show
  1. package/package.json +1 -1
  2. package/web/apps/web/.next/BUILD_ID +1 -1
  3. package/web/apps/web/.next/build-manifest.json +2 -2
  4. package/web/apps/web/.next/server/app/_global-error.html +2 -2
  5. package/web/apps/web/.next/server/app/_global-error.rsc +1 -1
  6. package/web/apps/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  7. package/web/apps/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  8. package/web/apps/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  9. package/web/apps/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  10. package/web/apps/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  11. package/web/apps/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  12. package/web/apps/web/.next/server/app/_not-found.html +1 -1
  13. package/web/apps/web/.next/server/app/_not-found.rsc +2 -2
  14. package/web/apps/web/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
  15. package/web/apps/web/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  16. package/web/apps/web/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
  17. package/web/apps/web/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  18. package/web/apps/web/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  19. package/web/apps/web/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  20. package/web/apps/web/.next/server/app/page_client-reference-manifest.js +1 -1
  21. package/web/apps/web/.next/server/chunks/ssr/_27474ef5._.js +13 -13
  22. package/web/apps/web/.next/server/pages/404.html +1 -1
  23. package/web/apps/web/.next/server/pages/500.html +2 -2
  24. package/web/apps/web/.next/static/chunks/8c3d41abe40f9602.css +1 -0
  25. package/web/apps/web/.next/static/chunks/ef9c75ef5637ffea.js +140 -0
  26. package/web/node_modules/@img/sharp-libvips-linuxmusl-x64/package.json +42 -0
  27. package/web/node_modules/@img/sharp-linuxmusl-x64/package.json +46 -0
  28. package/web/node_modules/sharp/node_modules/@img/sharp-libvips-linuxmusl-x64/README.md +46 -0
  29. package/web/node_modules/sharp/node_modules/@img/sharp-libvips-linuxmusl-x64/lib/glib-2.0/include/glibconfig.h +221 -0
  30. package/web/node_modules/sharp/node_modules/@img/sharp-libvips-linuxmusl-x64/lib/index.js +1 -0
  31. package/web/node_modules/sharp/node_modules/@img/sharp-libvips-linuxmusl-x64/lib/libvips-cpp.so.8.17.3 +0 -0
  32. package/web/node_modules/sharp/node_modules/@img/sharp-libvips-linuxmusl-x64/package.json +42 -0
  33. package/web/node_modules/sharp/node_modules/@img/sharp-libvips-linuxmusl-x64/versions.json +30 -0
  34. package/web/node_modules/sharp/node_modules/@img/sharp-linuxmusl-x64/lib/sharp-linuxmusl-x64.node +0 -0
  35. package/web/node_modules/sharp/node_modules/@img/sharp-linuxmusl-x64/package.json +46 -0
  36. package/web/apps/web/.next/static/chunks/a8001a74eb99a559.css +0 -1
  37. package/web/apps/web/.next/static/chunks/fa2e2f06db180089.js +0 -140
  38. /package/web/apps/web/.next/static/{nTlSRT1A1ZhPsRFk0-q6- → FpPCH0I0NlzFu0nSYhJ0J}/_buildManifest.js +0 -0
  39. /package/web/apps/web/.next/static/{nTlSRT1A1ZhPsRFk0-q6- → FpPCH0I0NlzFu0nSYhJ0J}/_clientMiddlewareManifest.json +0 -0
  40. /package/web/apps/web/.next/static/{nTlSRT1A1ZhPsRFk0-q6- → FpPCH0I0NlzFu0nSYhJ0J}/_ssgManifest.js +0 -0
@@ -0,0 +1,140 @@
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,60678,e=>{"use strict";var t=e.i(71645),r=e.i(72775),n=e.i(12598),i=({children:e,options:i={},state:a,queryClient:o})=>{let s=(0,n.useQueryClient)(o),l=t.useRef(i);t.useEffect(()=>{l.current=i});let u=t.useMemo(()=>{if(a){if("object"!=typeof a)return;let e=s.getQueryCache(),t=a.queries||[],n=[],i=[];for(let r of t){let t=e.get(r.queryHash);t?(r.state.dataUpdatedAt>t.state.dataUpdatedAt||r.promise&&"pending"!==t.state.status&&"fetching"!==t.state.fetchStatus&&void 0!==r.dehydratedAt&&r.dehydratedAt>t.state.dataUpdatedAt)&&i.push(r):n.push(r)}if(n.length>0&&(0,r.hydrate)(s,{queries:n},l.current),i.length>0)return i}},[s,a]);return t.useEffect(()=>{u&&(0,r.hydrate)(s,{queries:u},l.current)},[s,u]),e};e.s(["HydrationBoundary",()=>i])},67034,(e,t,r)=>{var n={675:function(e,t){"use strict";t.byteLength=function(e){var t=l(e),r=t[0],n=t[1];return(r+n)*3/4-n},t.toByteArray=function(e){var t,r,a=l(e),o=a[0],s=a[1],u=new i((o+s)*3/4-s),c=0,d=s>0?o-4:o;for(r=0;r<d;r+=4)t=n[e.charCodeAt(r)]<<18|n[e.charCodeAt(r+1)]<<12|n[e.charCodeAt(r+2)]<<6|n[e.charCodeAt(r+3)],u[c++]=t>>16&255,u[c++]=t>>8&255,u[c++]=255&t;return 2===s&&(t=n[e.charCodeAt(r)]<<2|n[e.charCodeAt(r+1)]>>4,u[c++]=255&t),1===s&&(t=n[e.charCodeAt(r)]<<10|n[e.charCodeAt(r+1)]<<4|n[e.charCodeAt(r+2)]>>2,u[c++]=t>>8&255,u[c++]=255&t),u},t.fromByteArray=function(e){for(var t,n=e.length,i=n%3,a=[],o=0,s=n-i;o<s;o+=16383)a.push(function(e,t,n){for(var i,a=[],o=t;o<n;o+=3)i=(e[o]<<16&0xff0000)+(e[o+1]<<8&65280)+(255&e[o+2]),a.push(r[i>>18&63]+r[i>>12&63]+r[i>>6&63]+r[63&i]);return a.join("")}(e,o,o+16383>s?s:o+16383));return 1===i?a.push(r[(t=e[n-1])>>2]+r[t<<4&63]+"=="):2===i&&a.push(r[(t=(e[n-2]<<8)+e[n-1])>>10]+r[t>>4&63]+r[t<<2&63]+"="),a.join("")};for(var r=[],n=[],i="u">typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,s=a.length;o<s;++o)r[o]=a[o],n[a.charCodeAt(o)]=o;function l(e){var t=e.length;if(t%4>0)throw Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");-1===r&&(r=t);var n=r===t?0:4-r%4;return[r,n]}n[45]=62,n[95]=63},72:function(e,t,r){"use strict";var n=r(675),i=r(783),a="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;function o(e){if(e>0x7fffffff)throw RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return Object.setPrototypeOf(t,s.prototype),t}function s(e,t,r){if("number"==typeof e){if("string"==typeof t)throw TypeError('The "string" argument must be of type string. Received type number');return c(e)}return l(e,t,r)}function l(e,t,r){if("string"==typeof e){var n=e,i=t;if(("string"!=typeof i||""===i)&&(i="utf8"),!s.isEncoding(i))throw TypeError("Unknown encoding: "+i);var a=0|f(n,i),l=o(a),u=l.write(n,i);return u!==a&&(l=l.slice(0,u)),l}if(ArrayBuffer.isView(e))return d(e);if(null==e)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(I(e,ArrayBuffer)||e&&I(e.buffer,ArrayBuffer)||"u">typeof SharedArrayBuffer&&(I(e,SharedArrayBuffer)||e&&I(e.buffer,SharedArrayBuffer)))return function(e,t,r){var n;if(t<0||e.byteLength<t)throw RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw RangeError('"length" is outside of buffer bounds');return Object.setPrototypeOf(n=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r),s.prototype),n}(e,t,r);if("number"==typeof e)throw TypeError('The "value" argument must not be of type number. Received type number');var c=e.valueOf&&e.valueOf();if(null!=c&&c!==e)return s.from(c,t,r);var h=function(e){if(s.isBuffer(e)){var t=0|p(e.length),r=o(t);return 0===r.length||e.copy(r,0,0,t),r}return void 0!==e.length?"number"!=typeof e.length||function(e){return e!=e}(e.length)?o(0):d(e):"Buffer"===e.type&&Array.isArray(e.data)?d(e.data):void 0}(e);if(h)return h;if("u">typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return s.from(e[Symbol.toPrimitive]("string"),t,r);throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function u(e){if("number"!=typeof e)throw TypeError('"size" argument must be of type number');if(e<0)throw RangeError('The value "'+e+'" is invalid for option "size"')}function c(e){return u(e),o(e<0?0:0|p(e))}function d(e){for(var t=e.length<0?0:0|p(e.length),r=o(t),n=0;n<t;n+=1)r[n]=255&e[n];return r}t.Buffer=s,t.SlowBuffer=function(e){return+e!=e&&(e=0),s.alloc(+e)},t.INSPECT_MAX_BYTES=50,t.kMaxLength=0x7fffffff,s.TYPED_ARRAY_SUPPORT=function(){try{var e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),!s.TYPED_ARRAY_SUPPORT&&"u">typeof console&&"function"==typeof console.error&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}}),s.poolSize=8192,s.from=function(e,t,r){return l(e,t,r)},Object.setPrototypeOf(s.prototype,Uint8Array.prototype),Object.setPrototypeOf(s,Uint8Array),s.alloc=function(e,t,r){return(u(e),e<=0)?o(e):void 0!==t?"string"==typeof r?o(e).fill(t,r):o(e).fill(t):o(e)},s.allocUnsafe=function(e){return c(e)},s.allocUnsafeSlow=function(e){return c(e)};function p(e){if(e>=0x7fffffff)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x7fffffff bytes");return 0|e}function f(e,t){if(s.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||I(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return _(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return E(e).length;default:if(i)return n?-1:_(e).length;t=(""+t).toLowerCase(),i=!0}}function h(e,t,r){var i,a,o,s=!1;if((void 0===t||t<0)&&(t=0),t>this.length||((void 0===r||r>this.length)&&(r=this.length),r<=0||(r>>>=0)<=(t>>>=0)))return"";for(e||(e="utf8");;)switch(e){case"hex":return function(e,t,r){var n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);for(var i="",a=t;a<r;++a)i+=T[e[a]];return i}(this,t,r);case"utf8":case"utf-8":return v(this,t,r);case"ascii":return function(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(127&e[i]);return n}(this,t,r);case"latin1":case"binary":return function(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(e[i]);return n}(this,t,r);case"base64":return i=this,a=t,o=r,0===a&&o===i.length?n.fromByteArray(i):n.fromByteArray(i.slice(a,o));case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return function(e,t,r){for(var n=e.slice(t,r),i="",a=0;a<n.length;a+=2)i+=String.fromCharCode(n[a]+256*n[a+1]);return i}(this,t,r);default:if(s)throw TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),s=!0}}function m(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function g(e,t,r,n,i){var a;if(0===e.length)return -1;if("string"==typeof r?(n=r,r=0):r>0x7fffffff?r=0x7fffffff:r<-0x80000000&&(r=-0x80000000),(a=r*=1)!=a&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length)if(i)return -1;else r=e.length-1;else if(r<0)if(!i)return -1;else r=0;if("string"==typeof t&&(t=s.from(t,n)),s.isBuffer(t))return 0===t.length?-1:y(e,t,r,n,i);if("number"==typeof t){if(t&=255,"function"==typeof Uint8Array.prototype.indexOf)if(i)return Uint8Array.prototype.indexOf.call(e,t,r);else return Uint8Array.prototype.lastIndexOf.call(e,t,r);return y(e,[t],r,n,i)}throw TypeError("val must be string, number or Buffer")}function y(e,t,r,n,i){var a,o=1,s=e.length,l=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return -1;o=2,s/=2,l/=2,r/=2}function u(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i){var c=-1;for(a=r;a<s;a++)if(u(e,a)===u(t,-1===c?0:a-c)){if(-1===c&&(c=a),a-c+1===l)return c*o}else -1!==c&&(a-=a-c),c=-1}else for(r+l>s&&(r=s-l),a=r;a>=0;a--){for(var d=!0,p=0;p<l;p++)if(u(e,a+p)!==u(t,p)){d=!1;break}if(d)return a}return -1}s.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==s.prototype},s.compare=function(e,t){if(I(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),I(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(e)||!s.isBuffer(t))throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;for(var r=e.length,n=t.length,i=0,a=Math.min(r,n);i<a;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:+(n<r)},s.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},s.concat=function(e,t){if(!Array.isArray(e))throw TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return s.alloc(0);if(void 0===t)for(r=0,t=0;r<e.length;++r)t+=e[r].length;var r,n=s.allocUnsafe(t),i=0;for(r=0;r<e.length;++r){var a=e[r];if(I(a,Uint8Array)&&(a=s.from(a)),!s.isBuffer(a))throw TypeError('"list" argument must be an Array of Buffers');a.copy(n,i),i+=a.length}return n},s.byteLength=f,s.prototype._isBuffer=!0,s.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)m(this,t,t+1);return this},s.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)m(this,t,t+3),m(this,t+1,t+2);return this},s.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)m(this,t,t+7),m(this,t+1,t+6),m(this,t+2,t+5),m(this,t+3,t+4);return this},s.prototype.toString=function(){var e=this.length;return 0===e?"":0==arguments.length?v(this,0,e):h.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(e){if(!s.isBuffer(e))throw TypeError("Argument must be a Buffer");return this===e||0===s.compare(this,e)},s.prototype.inspect=function(){var e="",r=t.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"},a&&(s.prototype[a]=s.prototype.inspect),s.prototype.compare=function(e,t,r,n,i){if(I(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),!s.isBuffer(e))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return -1;if(t>=r)return 1;if(t>>>=0,r>>>=0,n>>>=0,i>>>=0,this===e)return 0;for(var a=i-n,o=r-t,l=Math.min(a,o),u=this.slice(n,i),c=e.slice(t,r),d=0;d<l;++d)if(u[d]!==c[d]){a=u[d],o=c[d];break}return a<o?-1:+(o<a)},s.prototype.includes=function(e,t,r){return -1!==this.indexOf(e,t,r)},s.prototype.indexOf=function(e,t,r){return g(this,e,t,r,!0)},s.prototype.lastIndexOf=function(e,t,r){return g(this,e,t,r,!1)};function v(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i<r;){var a,o,s,l,u=e[i],c=null,d=u>239?4:u>223?3:u>191?2:1;if(i+d<=r)switch(d){case 1:u<128&&(c=u);break;case 2:(192&(a=e[i+1]))==128&&(l=(31&u)<<6|63&a)>127&&(c=l);break;case 3:a=e[i+1],o=e[i+2],(192&a)==128&&(192&o)==128&&(l=(15&u)<<12|(63&a)<<6|63&o)>2047&&(l<55296||l>57343)&&(c=l);break;case 4:a=e[i+1],o=e[i+2],s=e[i+3],(192&a)==128&&(192&o)==128&&(192&s)==128&&(l=(15&u)<<18|(63&a)<<12|(63&o)<<6|63&s)>65535&&l<1114112&&(c=l)}null===c?(c=65533,d=1):c>65535&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|1023&c),n.push(c),i+=d}var p=n,f=p.length;if(f<=4096)return String.fromCharCode.apply(String,p);for(var h="",m=0;m<f;)h+=String.fromCharCode.apply(String,p.slice(m,m+=4096));return h}function b(e,t,r){if(e%1!=0||e<0)throw RangeError("offset is not uint");if(e+t>r)throw RangeError("Trying to access beyond buffer length")}function x(e,t,r,n,i,a){if(!s.isBuffer(e))throw TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<a)throw RangeError('"value" argument is out of bounds');if(r+n>e.length)throw RangeError("Index out of range")}function w(e,t,r,n,i,a){if(r+n>e.length||r<0)throw RangeError("Index out of range")}function S(e,t,r,n,a){return t*=1,r>>>=0,a||w(e,t,r,4,34028234663852886e22,-34028234663852886e22),i.write(e,t,r,n,23,4),r+4}function C(e,t,r,n,a){return t*=1,r>>>=0,a||w(e,t,r,8,17976931348623157e292,-17976931348623157e292),i.write(e,t,r,n,52,8),r+8}s.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else if(isFinite(t))t>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0);else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var i,a,o,s,l,u,c,d,p=this.length-t;if((void 0===r||r>p)&&(r=p),e.length>0&&(r<0||t<0)||t>this.length)throw RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var f=!1;;)switch(n){case"hex":return function(e,t,r,n){r=Number(r)||0;var i=e.length-r;n?(n=Number(n))>i&&(n=i):n=i;var a=t.length;n>a/2&&(n=a/2);for(var o=0;o<n;++o){var s,l=parseInt(t.substr(2*o,2),16);if((s=l)!=s)break;e[r+o]=l}return o}(this,e,t,r);case"utf8":case"utf-8":return i=t,a=r,N(_(e,this.length-i),this,i,a);case"ascii":return o=t,s=r,N(A(e),this,o,s);case"latin1":case"binary":return function(e,t,r,n){return N(A(t),e,r,n)}(this,e,t,r);case"base64":return l=t,u=r,N(E(e),this,l,u);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return c=t,d=r,N(function(e,t){for(var r,n,i=[],a=0;a<e.length&&!((t-=2)<0);++a)n=(r=e.charCodeAt(a))>>8,i.push(r%256),i.push(n);return i}(e,this.length-c),this,c,d);default:if(f)throw TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),f=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},s.prototype.slice=function(e,t){var r=this.length;e=~~e,t=void 0===t?r:~~t,e<0?(e+=r)<0&&(e=0):e>r&&(e=r),t<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e);var n=this.subarray(e,t);return Object.setPrototypeOf(n,s.prototype),n},s.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||b(e,t,this.length);for(var n=this[e],i=1,a=0;++a<t&&(i*=256);)n+=this[e+a]*i;return n},s.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||b(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},s.prototype.readUInt8=function(e,t){return e>>>=0,t||b(e,1,this.length),this[e]},s.prototype.readUInt16LE=function(e,t){return e>>>=0,t||b(e,2,this.length),this[e]|this[e+1]<<8},s.prototype.readUInt16BE=function(e,t){return e>>>=0,t||b(e,2,this.length),this[e]<<8|this[e+1]},s.prototype.readUInt32LE=function(e,t){return e>>>=0,t||b(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+0x1000000*this[e+3]},s.prototype.readUInt32BE=function(e,t){return e>>>=0,t||b(e,4,this.length),0x1000000*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},s.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||b(e,t,this.length);for(var n=this[e],i=1,a=0;++a<t&&(i*=256);)n+=this[e+a]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*t)),n},s.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||b(e,t,this.length);for(var n=t,i=1,a=this[e+--n];n>0&&(i*=256);)a+=this[e+--n]*i;return a>=(i*=128)&&(a-=Math.pow(2,8*t)),a},s.prototype.readInt8=function(e,t){return(e>>>=0,t||b(e,1,this.length),128&this[e])?-((255-this[e]+1)*1):this[e]},s.prototype.readInt16LE=function(e,t){e>>>=0,t||b(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?0xffff0000|r:r},s.prototype.readInt16BE=function(e,t){e>>>=0,t||b(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?0xffff0000|r:r},s.prototype.readInt32LE=function(e,t){return e>>>=0,t||b(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},s.prototype.readInt32BE=function(e,t){return e>>>=0,t||b(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},s.prototype.readFloatLE=function(e,t){return e>>>=0,t||b(e,4,this.length),i.read(this,e,!0,23,4)},s.prototype.readFloatBE=function(e,t){return e>>>=0,t||b(e,4,this.length),i.read(this,e,!1,23,4)},s.prototype.readDoubleLE=function(e,t){return e>>>=0,t||b(e,8,this.length),i.read(this,e,!0,52,8)},s.prototype.readDoubleBE=function(e,t){return e>>>=0,t||b(e,8,this.length),i.read(this,e,!1,52,8)},s.prototype.writeUIntLE=function(e,t,r,n){if(e*=1,t>>>=0,r>>>=0,!n){var i=Math.pow(2,8*r)-1;x(this,e,t,r,i,0)}var a=1,o=0;for(this[t]=255&e;++o<r&&(a*=256);)this[t+o]=e/a&255;return t+r},s.prototype.writeUIntBE=function(e,t,r,n){if(e*=1,t>>>=0,r>>>=0,!n){var i=Math.pow(2,8*r)-1;x(this,e,t,r,i,0)}var a=r-1,o=1;for(this[t+a]=255&e;--a>=0&&(o*=256);)this[t+a]=e/o&255;return t+r},s.prototype.writeUInt8=function(e,t,r){return e*=1,t>>>=0,r||x(this,e,t,1,255,0),this[t]=255&e,t+1},s.prototype.writeUInt16LE=function(e,t,r){return e*=1,t>>>=0,r||x(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},s.prototype.writeUInt16BE=function(e,t,r){return e*=1,t>>>=0,r||x(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},s.prototype.writeUInt32LE=function(e,t,r){return e*=1,t>>>=0,r||x(this,e,t,4,0xffffffff,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},s.prototype.writeUInt32BE=function(e,t,r){return e*=1,t>>>=0,r||x(this,e,t,4,0xffffffff,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},s.prototype.writeIntLE=function(e,t,r,n){if(e*=1,t>>>=0,!n){var i=Math.pow(2,8*r-1);x(this,e,t,r,i-1,-i)}var a=0,o=1,s=0;for(this[t]=255&e;++a<r&&(o*=256);)e<0&&0===s&&0!==this[t+a-1]&&(s=1),this[t+a]=(e/o|0)-s&255;return t+r},s.prototype.writeIntBE=function(e,t,r,n){if(e*=1,t>>>=0,!n){var i=Math.pow(2,8*r-1);x(this,e,t,r,i-1,-i)}var a=r-1,o=1,s=0;for(this[t+a]=255&e;--a>=0&&(o*=256);)e<0&&0===s&&0!==this[t+a+1]&&(s=1),this[t+a]=(e/o|0)-s&255;return t+r},s.prototype.writeInt8=function(e,t,r){return e*=1,t>>>=0,r||x(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},s.prototype.writeInt16LE=function(e,t,r){return e*=1,t>>>=0,r||x(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},s.prototype.writeInt16BE=function(e,t,r){return e*=1,t>>>=0,r||x(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},s.prototype.writeInt32LE=function(e,t,r){return e*=1,t>>>=0,r||x(this,e,t,4,0x7fffffff,-0x80000000),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},s.prototype.writeInt32BE=function(e,t,r){return e*=1,t>>>=0,r||x(this,e,t,4,0x7fffffff,-0x80000000),e<0&&(e=0xffffffff+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},s.prototype.writeFloatLE=function(e,t,r){return S(this,e,t,!0,r)},s.prototype.writeFloatBE=function(e,t,r){return S(this,e,t,!1,r)},s.prototype.writeDoubleLE=function(e,t,r){return C(this,e,t,!0,r)},s.prototype.writeDoubleBE=function(e,t,r){return C(this,e,t,!1,r)},s.prototype.copy=function(e,t,r,n){if(!s.isBuffer(e))throw TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r||0===e.length||0===this.length)return 0;if(t<0)throw RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw RangeError("Index out of range");if(n<0)throw RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);var i=n-r;if(this===e&&"function"==typeof Uint8Array.prototype.copyWithin)this.copyWithin(t,r,n);else if(this===e&&r<t&&t<n)for(var a=i-1;a>=0;--a)e[a+t]=this[a+r];else Uint8Array.prototype.set.call(e,this.subarray(r,n),t);return i},s.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw TypeError("encoding must be a string");if("string"==typeof n&&!s.isEncoding(n))throw TypeError("Unknown encoding: "+n);if(1===e.length){var i,a=e.charCodeAt(0);("utf8"===n&&a<128||"latin1"===n)&&(e=a)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<r)throw RangeError("Out of range index");if(r<=t)return this;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(i=t;i<r;++i)this[i]=e;else{var o=s.isBuffer(e)?e:s.from(e,n),l=o.length;if(0===l)throw TypeError('The value "'+e+'" is invalid for argument "value"');for(i=0;i<r-t;++i)this[i+t]=o[i%l]}return this};var k=/[^+/0-9A-Za-z-_]/g;function _(e,t){t=t||1/0;for(var r,n=e.length,i=null,a=[],o=0;o<n;++o){if((r=e.charCodeAt(o))>55295&&r<57344){if(!i){if(r>56319||o+1===n){(t-=3)>-1&&a.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&a.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;a.push(r)}else if(r<2048){if((t-=2)<0)break;a.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;a.push(r>>12|224,r>>6&63|128,63&r|128)}else if(r<1114112){if((t-=4)<0)break;a.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}else throw Error("Invalid code point")}return a}function A(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}function E(e){return n.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(k,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function N(e,t,r,n){for(var i=0;i<n&&!(i+r>=t.length)&&!(i>=e.length);++i)t[i+r]=e[i];return i}function I(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}var T=function(){for(var e="0123456789abcdef",t=Array(256),r=0;r<16;++r)for(var n=16*r,i=0;i<16;++i)t[n+i]=e[r]+e[i];return t}()},783:function(e,t){t.read=function(e,t,r,n,i){var a,o,s=8*i-n-1,l=(1<<s)-1,u=l>>1,c=-7,d=r?i-1:0,p=r?-1:1,f=e[t+d];for(d+=p,a=f&(1<<-c)-1,f>>=-c,c+=s;c>0;a=256*a+e[t+d],d+=p,c-=8);for(o=a&(1<<-c)-1,a>>=-c,c+=n;c>0;o=256*o+e[t+d],d+=p,c-=8);if(0===a)a=1-u;else{if(a===l)return o?NaN:1/0*(f?-1:1);o+=Math.pow(2,n),a-=u}return(f?-1:1)*o*Math.pow(2,a-n)},t.write=function(e,t,r,n,i,a){var o,s,l,u=8*a-i-1,c=(1<<u)-1,d=c>>1,p=5960464477539062e-23*(23===i),f=n?0:a-1,h=n?1:-1,m=+(t<0||0===t&&1/t<0);for(isNaN(t=Math.abs(t))||t===1/0?(s=+!!isNaN(t),o=c):(o=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-o))<1&&(o--,l*=2),o+d>=1?t+=p/l:t+=p*Math.pow(2,1-d),t*l>=2&&(o++,l/=2),o+d>=c?(s=0,o=c):o+d>=1?(s=(t*l-1)*Math.pow(2,i),o+=d):(s=t*Math.pow(2,d-1)*Math.pow(2,i),o=0));i>=8;e[r+f]=255&s,f+=h,s/=256,i-=8);for(o=o<<i|s,u+=i;u>0;e[r+f]=255&o,f+=h,o/=256,u-=8);e[r+f-h]|=128*m}}},i={};function a(e){var t=i[e];if(void 0!==t)return t.exports;var r=i[e]={exports:{}},o=!0;try{n[e](r,r.exports,a),o=!1}finally{o&&delete i[e]}return r.exports}a.ab="/ROOT/node_modules/next/dist/compiled/buffer/",t.exports=a(72)},14517,e=>{"use strict";let t,r,n,i,a,o,s,l,u,c;var d,p,f,h,m,g,y,v,b,x,w,S=e.i(18050),C=e.i(932),k=e.i(71645),_=e.i(12598);let A=()=>fetch("/api/health",{signal:AbortSignal.timeout(2e3)}),E=()=>fetch("/api/sessions"),N=e=>fetch("/api/sessions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e??{})}),I=(e,t)=>fetch(`/api/sessions/${e}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:t})}),T=e=>fetch(`/api/sessions/${e}`,{method:"DELETE"}),R=e=>fetch(`/api/sessions/${e}/conversation`),P=e=>fetch(`/api/sessions/${e}/token-usage`),M=(e,t)=>fetch(`/api/sessions/${e}/prompt`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify("string"==typeof t?{content:t}:t)}),j=e=>fetch(`/api/sessions/${e}/cancel`,{method:"POST"}),L=(e,t,r)=>fetch(`/api/sessions/${e}/permission`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({requestId:t,optionId:r})}),O=(e,t)=>fetch(`/api/sessions/${e}/connect`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t??{})}),D=e=>fetch(`/api/sessions/${e}/connect`,{method:"DELETE"}),$=e=>fetch(`/api/sessions/${e}/commands`),z=e=>fetch(`/api/sessions/${e}/config`),B=(e,t,r)=>fetch(`/api/sessions/${e}/config`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({configId:t,value:r})}),F=e=>fetch(`/api/sessions/${e}/mode`),G=(e,t)=>fetch(`/api/sessions/${e}/mode`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({modeId:t})}),U=e=>fetch(`/api/settings/${encodeURIComponent(e)}`),W=(e,t)=>fetch(`/api/settings/${encodeURIComponent(e)}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({value:t})});var H=e.i(75555),q=e.i(40143),V=e.i(86491),Q=e.i(15823),K=e.i(93803),X=e.i(19273),J=e.i(80166),Y=class extends Q.Subscribable{constructor(e,t){super(),this.options=t,this.#e=e,this.#t=null,this.#r=(0,K.pendingThenable)(),this.bindMethods(),this.setOptions(t)}#e;#n=void 0;#i=void 0;#a=void 0;#o;#s;#r;#t;#l;#u;#c;#d;#p;#f;#h=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){1===this.listeners.size&&(this.#n.addObserver(this),Z(this.#n,this.options)?this.#m():this.updateResult(),this.#g())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return ee(this.#n,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return ee(this.#n,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#y(),this.#v(),this.#n.removeObserver(this)}setOptions(e){let t=this.options,r=this.#n;if(this.options=this.#e.defaultQueryOptions(e),void 0!==this.options.enabled&&"boolean"!=typeof this.options.enabled&&"function"!=typeof this.options.enabled&&"boolean"!=typeof(0,X.resolveEnabled)(this.options.enabled,this.#n))throw Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#b(),this.#n.setOptions(this.options),t._defaulted&&!(0,X.shallowEqualObjects)(this.options,t)&&this.#e.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#n,observer:this});let n=this.hasListeners();n&&et(this.#n,r,this.options,t)&&this.#m(),this.updateResult(),n&&(this.#n!==r||(0,X.resolveEnabled)(this.options.enabled,this.#n)!==(0,X.resolveEnabled)(t.enabled,this.#n)||(0,X.resolveStaleTime)(this.options.staleTime,this.#n)!==(0,X.resolveStaleTime)(t.staleTime,this.#n))&&this.#x();let i=this.#w();n&&(this.#n!==r||(0,X.resolveEnabled)(this.options.enabled,this.#n)!==(0,X.resolveEnabled)(t.enabled,this.#n)||i!==this.#f)&&this.#S(i)}getOptimisticResult(e){var t,r;let n=this.#e.getQueryCache().build(this.#e,e),i=this.createResult(n,e);return t=this,r=i,(0,X.shallowEqualObjects)(t.getCurrentResult(),r)||(this.#a=i,this.#s=this.options,this.#o=this.#n.state),i}getCurrentResult(){return this.#a}trackResult(e,t){return new Proxy(e,{get:(e,r)=>(this.trackProp(r),t?.(r),"promise"===r&&(this.trackProp("data"),this.options.experimental_prefetchInRender||"pending"!==this.#r.status||this.#r.reject(Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(e,r))})}trackProp(e){this.#h.add(e)}getCurrentQuery(){return this.#n}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),r=this.#e.getQueryCache().build(this.#e,t);return r.fetch().then(()=>this.createResult(r,t))}fetch(e){return this.#m({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#a))}#m(e){this.#b();let t=this.#n.fetch(this.options,e);return e?.throwOnError||(t=t.catch(X.noop)),t}#x(){this.#y();let e=(0,X.resolveStaleTime)(this.options.staleTime,this.#n);if(X.isServer||this.#a.isStale||!(0,X.isValidTimeout)(e))return;let t=(0,X.timeUntilStale)(this.#a.dataUpdatedAt,e);this.#d=J.timeoutManager.setTimeout(()=>{this.#a.isStale||this.updateResult()},t+1)}#w(){return("function"==typeof this.options.refetchInterval?this.options.refetchInterval(this.#n):this.options.refetchInterval)??!1}#S(e){this.#v(),this.#f=e,!X.isServer&&!1!==(0,X.resolveEnabled)(this.options.enabled,this.#n)&&(0,X.isValidTimeout)(this.#f)&&0!==this.#f&&(this.#p=J.timeoutManager.setInterval(()=>{(this.options.refetchIntervalInBackground||H.focusManager.isFocused())&&this.#m()},this.#f))}#g(){this.#x(),this.#S(this.#w())}#y(){this.#d&&(J.timeoutManager.clearTimeout(this.#d),this.#d=void 0)}#v(){this.#p&&(J.timeoutManager.clearInterval(this.#p),this.#p=void 0)}createResult(e,t){let r,n=this.#n,i=this.options,a=this.#a,o=this.#o,s=this.#s,l=e!==n?e.state:this.#i,{state:u}=e,c={...u},d=!1;if(t._optimisticResults){let r=this.hasListeners(),a=!r&&Z(e,t),o=r&&et(e,n,t,i);(a||o)&&(c={...c,...(0,V.fetchState)(u.data,e.options)}),"isRestoring"===t._optimisticResults&&(c.fetchStatus="idle")}let{error:p,errorUpdatedAt:f,status:h}=c;r=c.data;let m=!1;if(void 0!==t.placeholderData&&void 0===r&&"pending"===h){let e;a?.isPlaceholderData&&t.placeholderData===s?.placeholderData?(e=a.data,m=!0):e="function"==typeof t.placeholderData?t.placeholderData(this.#c?.state.data,this.#c):t.placeholderData,void 0!==e&&(h="success",r=(0,X.replaceData)(a?.data,e,t),d=!0)}if(t.select&&void 0!==r&&!m)if(a&&r===o?.data&&t.select===this.#l)r=this.#u;else try{this.#l=t.select,r=t.select(r),r=(0,X.replaceData)(a?.data,r,t),this.#u=r,this.#t=null}catch(e){this.#t=e}this.#t&&(p=this.#t,r=this.#u,f=Date.now(),h="error");let g="fetching"===c.fetchStatus,y="pending"===h,v="error"===h,b=y&&g,x=void 0!==r,w={status:h,fetchStatus:c.fetchStatus,isPending:y,isSuccess:"success"===h,isError:v,isInitialLoading:b,isLoading:b,data:r,dataUpdatedAt:c.dataUpdatedAt,error:p,errorUpdatedAt:f,failureCount:c.fetchFailureCount,failureReason:c.fetchFailureReason,errorUpdateCount:c.errorUpdateCount,isFetched:c.dataUpdateCount>0||c.errorUpdateCount>0,isFetchedAfterMount:c.dataUpdateCount>l.dataUpdateCount||c.errorUpdateCount>l.errorUpdateCount,isFetching:g,isRefetching:g&&!y,isLoadingError:v&&!x,isPaused:"paused"===c.fetchStatus,isPlaceholderData:d,isRefetchError:v&&x,isStale:er(e,t),refetch:this.refetch,promise:this.#r,isEnabled:!1!==(0,X.resolveEnabled)(t.enabled,e)};if(this.options.experimental_prefetchInRender){let t=void 0!==w.data,r="error"===w.status&&!t,i=e=>{r?e.reject(w.error):t&&e.resolve(w.data)},a=()=>{i(this.#r=w.promise=(0,K.pendingThenable)())},o=this.#r;switch(o.status){case"pending":e.queryHash===n.queryHash&&i(o);break;case"fulfilled":(r||w.data!==o.value)&&a();break;case"rejected":r&&w.error===o.reason||a()}}return w}updateResult(){let e=this.#a,t=this.createResult(this.#n,this.options);if(this.#o=this.#n.state,this.#s=this.options,void 0!==this.#o.data&&(this.#c=this.#n),(0,X.shallowEqualObjects)(t,e))return;this.#a=t;let r=()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,r="function"==typeof t?t():t;if("all"===r||!r&&!this.#h.size)return!0;let n=new Set(r??this.#h);return this.options.throwOnError&&n.add("error"),Object.keys(this.#a).some(t=>this.#a[t]!==e[t]&&n.has(t))};this.#C({listeners:r()})}#b(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#n)return;let t=this.#n;this.#n=e,this.#i=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#g()}#C(e){q.notifyManager.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#a)}),this.#e.getQueryCache().notify({query:this.#n,type:"observerResultsUpdated"})})}};function Z(e,t){return!1!==(0,X.resolveEnabled)(t.enabled,e)&&void 0===e.state.data&&("error"!==e.state.status||!1!==t.retryOnMount)||void 0!==e.state.data&&ee(e,t,t.refetchOnMount)}function ee(e,t,r){if(!1!==(0,X.resolveEnabled)(t.enabled,e)&&"static"!==(0,X.resolveStaleTime)(t.staleTime,e)){let n="function"==typeof r?r(e):r;return"always"===n||!1!==n&&er(e,t)}return!1}function et(e,t,r,n){return(e!==t||!1===(0,X.resolveEnabled)(n.enabled,e))&&(!r.suspense||"error"!==e.state.status)&&er(e,r)}function er(e,t){return!1!==(0,X.resolveEnabled)(t.enabled,e)&&e.isStaleByTime((0,X.resolveStaleTime)(t.staleTime,e))}var en=e.i(47167),ei=k.createContext((a=!1,{clearReset:()=>{a=!1},reset:()=>{a=!0},isReset:()=>a})),ea=k.createContext(!1);ea.Provider;var eo=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset()});function es(e,t){return function(e,t,r){let n,i=k.useContext(ea),a=k.useContext(ei),o=(0,_.useQueryClient)(r),s=o.defaultQueryOptions(e);o.getDefaultOptions().queries?._experimental_beforeQuery?.(s);let l=o.getQueryCache().get(s.queryHash);if(s._optimisticResults=i?"isRestoring":"optimistic",s.suspense){let e=e=>"static"===e?e:Math.max(e??1e3,1e3),t=s.staleTime;s.staleTime="function"==typeof t?(...r)=>e(t(...r)):e(t),"number"==typeof s.gcTime&&(s.gcTime=Math.max(s.gcTime,1e3))}n=l?.state.error&&"function"==typeof s.throwOnError?(0,X.shouldThrowError)(s.throwOnError,[l.state.error,l]):s.throwOnError,(s.suspense||s.experimental_prefetchInRender||n)&&!a.isReset()&&(s.retryOnMount=!1),k.useEffect(()=>{a.clearReset()},[a]);let u=!o.getQueryCache().get(s.queryHash),[c]=k.useState(()=>new t(o,s)),d=c.getOptimisticResult(s),p=!i&&!1!==e.subscribed;if(k.useSyncExternalStore(k.useCallback(e=>{let t=p?c.subscribe(q.notifyManager.batchCalls(e)):X.noop;return c.updateResult(),t},[c,p]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),k.useEffect(()=>{c.setOptions(s)},[s,c]),s?.suspense&&d.isPending)throw eo(s,c,a);if((({result:e,errorResetBoundary:t,throwOnError:r,query:n,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&n&&(i&&void 0===e.data||(0,X.shouldThrowError)(r,[e.error,n])))({result:d,errorResetBoundary:a,throwOnError:s.throwOnError,query:l,suspense:s.suspense}))throw d.error;if(o.getDefaultOptions().queries?._experimental_afterQuery?.(s,d),s.experimental_prefetchInRender&&!X.isServer&&d.isLoading&&d.isFetching&&!i){let e=u?eo(s,c,a):l?.promise;e?.catch(X.noop).finally(()=>{c.updateResult()})}return s.notifyOnChangeProps?d:c.trackResult(d)}(e,Y,t)}var el=e.i(14272),eu=Q,ec=class extends eu.Subscribable{#e;#a=void 0;#k;#_;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#A()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),(0,X.shallowEqualObjects)(this.options,t)||this.#e.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#k,observer:this}),t?.mutationKey&&this.options.mutationKey&&(0,X.hashKey)(t.mutationKey)!==(0,X.hashKey)(this.options.mutationKey)?this.reset():this.#k?.state.status==="pending"&&this.#k.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#k?.removeObserver(this)}onMutationUpdate(e){this.#A(),this.#C(e)}getCurrentResult(){return this.#a}reset(){this.#k?.removeObserver(this),this.#k=void 0,this.#A(),this.#C()}mutate(e,t){return this.#_=t,this.#k?.removeObserver(this),this.#k=this.#e.getMutationCache().build(this.#e,this.options),this.#k.addObserver(this),this.#k.execute(e)}#A(){let e=this.#k?.state??(0,el.getDefaultState)();this.#a={...e,isPending:"pending"===e.status,isSuccess:"success"===e.status,isError:"error"===e.status,isIdle:"idle"===e.status,mutate:this.mutate,reset:this.reset}}#C(e){q.notifyManager.batch(()=>{if(this.#_&&this.hasListeners()){let t=this.#a.variables,r=this.#a.context,n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type==="success"){try{this.#_.onSuccess?.(e.data,t,r,n)}catch(e){Promise.reject(e)}try{this.#_.onSettled?.(e.data,null,t,r,n)}catch(e){Promise.reject(e)}}else if(e?.type==="error"){try{this.#_.onError?.(e.error,t,r,n)}catch(e){Promise.reject(e)}try{this.#_.onSettled?.(void 0,e.error,t,r,n)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#a)})})}};function ed(e,t){let r=(0,_.useQueryClient)(t),[n]=k.useState(()=>new ec(r,e));k.useEffect(()=>{n.setOptions(e)},[n,e]);let i=k.useSyncExternalStore(k.useCallback(e=>n.subscribe(q.notifyManager.batchCalls(e)),[n]),()=>n.getCurrentResult(),()=>n.getCurrentResult()),a=k.useCallback((e,t)=>{n.mutate(e,t).catch(X.noop)},[n]);if(i.error&&(0,X.shouldThrowError)(n.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}let ep=["sessions"],ef=e=>["conversation",e],eh=e=>["tokenUsage",e];async function em(){let e=await E();if(!e.ok)throw Error(`HTTP ${e.status}`);return e.json()}async function eg(e){let{agentType:t,cwd:r,mcpServers:n}=e,i={agent_type:t,cwd:r};n&&(i.mcpServers=n);let a=await N(i);if(!a.ok)throw Error((await a.json().catch(ey)).error??`HTTP ${a.status}`);return a.json()}function ey(){return{}}async function ev(e){return await T(e),e}async function eb(e){let{id:t,name:r}=e,n=await I(t,r);if(!n.ok)throw Error(`HTTP ${n.status}`);return n.json()}let ex=(0,k.createContext)(null);function ew(){let e=(0,k.useContext)(ex);if(!e)throw Error("useSession must be used within SessionProvider");return e}function eS(e){let t,r,n,i,a,o,s,l,u,c,d,p,f,h,m,g,y,v,b,x,w,E,N,I,T,R,P,M=(0,C.c)(37),{children:j,initialActiveSessionId:L}=e,O=(0,_.useQueryClient)(),D=((v=(0,C.c)(1))[0]===Symbol.for("react.memo_cache_sentinel")?(y={queryKey:ep,queryFn:em,staleTime:3e4},v[0]=y):y=v[0],es(y));M[0]!==D.data?(t=D.data??[],M[0]=D.data,M[1]=t):t=M[1];let $=t,[z,B]=(0,k.useState)(L??null),[F,G]=(0,k.useState)(null!=L?"online":"checking"),[U,W]=(0,k.useState)(!1),[H,q]=(0,k.useState)(!1),V=(x=(0,C.c)(2),w=(0,_.useQueryClient)(),x[0]!==w?(b={mutationFn:eg,onSuccess:e=>{w.setQueryData(ep,t=>t?[...t,e]:[e])}},x[0]=w,x[1]=b):b=x[1],ed(b)),Q=(N=(0,C.c)(2),I=(0,_.useQueryClient)(),N[0]!==I?(E={mutationFn:ev,onMutate:async e=>{await I.cancelQueries({queryKey:ep});let t=I.getQueryData(ep);return I.setQueryData(ep,t=>t?.filter(t=>t.id!==e)),{previous:t}},onError:(e,t,r)=>{r?.previous&&I.setQueryData(ep,r.previous)}},N[0]=I,N[1]=E):E=N[1],ed(E)),K=(R=(0,C.c)(2),P=(0,_.useQueryClient)(),R[0]!==P?(T={mutationFn:eb,onMutate:async e=>{let{id:t,name:r}=e;await P.cancelQueries({queryKey:ep});let n=P.getQueryData(ep);return P.setQueryData(ep,e=>e?.map(e=>e.id===t?{...e,name:r}:e)),{previous:n}},onError:(e,t,r)=>{r?.previous&&P.setQueryData(ep,r.previous)},onSuccess:e=>{P.setQueryData(ep,t=>t?.map(t=>t.id===e.id?{...t,...e}:t))}},R[0]=P,R[1]=T):T=R[1],ed(T));M[2]===Symbol.for("react.memo_cache_sentinel")?(r=e=>{B(e),e?localStorage.setItem("agentpane:activeSessionId",e):localStorage.removeItem("agentpane:activeSessionId")},M[2]=r):r=M[2];let X=r;M[3]===Symbol.for("react.memo_cache_sentinel")?(n=async e=>{let t;W(!0);try{let e=await A();t=await e.json()}catch{}void 0!==t&&"agentpane"===t.app?(G("online"),e?.()):G("offline"),W(!1)},M[3]=n):n=M[3];let J=n;M[4]!==L?(i=()=>{null==L&&J()},M[4]=L,M[5]=i):i=M[5],M[6]===Symbol.for("react.memo_cache_sentinel")?(a=[],M[6]=a):a=M[6],(0,k.useEffect)(i,a),D.isSuccess&&"online"!==F&&G("online");let[Y,Z]=(0,k.useState)($.length);if($.length>0&&$.length!==Y&&(Z($.length),!(null!==z&&$.some(e=>e.id===z)))){let e=$[0];B(void 0!==e?e.id:null)}M[7]!==F||M[8]!==O?(o=()=>{if("checking"===F)return;let e=setInterval(async()=>{let e;try{let t=await A();e=await t.json()}catch{}void 0!==e&&"agentpane"===e.app?"offline"===F&&O.invalidateQueries({queryKey:ep}):G("offline")},5e3);return()=>clearInterval(e)},s=[F,O],M[7]=F,M[8]=O,M[9]=o,M[10]=s):(o=M[9],s=M[10]),(0,k.useEffect)(o,s),M[11]===Symbol.for("react.memo_cache_sentinel")?(l=()=>{q(!0),X(null)},M[11]=l):l=M[11];let ee=l;M[12]!==V?(u=async(e,t,r)=>{let n={agentType:e,cwd:t};r&&(n.mcpServers=r),X((await V.mutateAsync(n)).id),q(!1)},M[12]=V,M[13]=u):u=M[13];let et=u;M[14]!==$?(c=()=>{if(q(!1),$.length>0){let e=localStorage.getItem("agentpane:activeSessionId");e&&$.some(t=>t.id===e)?B(e):B($[0].id)}},M[14]=$,M[15]=c):c=M[15];let er=c;M[16]!==Q?(d=async e=>{await Q.mutateAsync(e)},M[16]=Q,M[17]=d):d=M[17];let en=d;M[18]!==K?(p=async(e,t)=>{await K.mutateAsync({id:e,name:t})},M[18]=K,M[19]=p):p=M[19];let ei=p;M[20]!==O?(f=()=>{J(()=>{O.invalidateQueries({queryKey:ep})})},M[20]=O,M[21]=f):f=M[21];let ea=f;M[22]===Symbol.for("react.memo_cache_sentinel")?(h=e=>{q(!1),X(e)},M[22]=h):h=M[22];let eo=h;return M[23]!==z||M[24]!==F||M[25]!==er||M[26]!==en||M[27]!==U||M[28]!==ei||M[29]!==ea||M[30]!==$||M[31]!==H||M[32]!==et?(m={sessions:$,activeSessionId:z,backendStatus:F,healthChecking:U,showSetup:H,setActiveSession:eo,createSession:ee,startSession:et,cancelSetup:er,deleteSession:en,renameSession:ei,retryHealth:ea},M[23]=z,M[24]=F,M[25]=er,M[26]=en,M[27]=U,M[28]=ei,M[29]=ea,M[30]=$,M[31]=H,M[32]=et,M[33]=m):m=M[33],M[34]!==j||M[35]!==m?(g=(0,S.jsx)(ex,{value:m,children:j}),M[34]=j,M[35]=m,M[36]=g):g=M[36],g}let eC=0;function ek(){return`pane-${Date.now()}-${++eC}`}function e_(e){return Array.from({length:e},()=>100/e)}let eA=(0,k.createContext)(null);function eE(){let e=(0,k.useContext)(eA);if(!e)throw Error("useLayout must be used within LayoutProvider");return e}function eN(e){let t,r,n,i,a,o,s,l,u,c,d,p,f,h,m,g,y,v,b,x,w,_=(0,C.c)(46),{children:A,initialLayout:E}=e,{sessions:N,activeSessionId:I,setActiveSession:T}=ew();_[0]!==N?(t=new Set(N.map(eR)),_[0]=N,_[1]=t):t=_[1];let R=t;_[2]!==E?(r=()=>{var e;let t;return E??{panes:[{id:t="pane-default",tabSessionIds:(e=void 0,[]),activeTabSessionId:e??""}],focusedPaneId:t,paneSizes:[100]}},_[2]=E,_[3]=r):r=_[3];let[P,M]=(0,k.useState)(r),[j,L]=(0,k.useState)(null!=E),O=(0,k.useRef)(null);if(_[4]!==j||_[5]!==R||_[6]!==N.length?(n=()=>{if(j||0===N.length)return;let e=!1;return(async()=>{let t,r;try{t=await U("layout")}catch{}if(!e){if(void 0!==t&&t.ok){let e=await t.json();r=null!=e?e.value:void 0}if(r){let e=function(e,t){try{let r=JSON.parse(e);if(!Array.isArray(r.panes))return null;let n=r.panes.map(e=>{let r=e.tabSessionIds.filter(e=>t.has(e));return{...e,tabSessionIds:r,activeTabSessionId:r.includes(e.activeTabSessionId)?e.activeTabSessionId:r[0]??""}}).filter(e=>e.tabSessionIds.length>0);if(n.length>0){let e=n.some(e=>e.id===r.focusedPaneId)?r.focusedPaneId:n[0].id,t=r.paneSizes?.length===n.length?r.paneSizes:n.map(()=>100/n.length);return{panes:n,focusedPaneId:e,paneSizes:t}}}catch{}return null}(r,R);if(e){M(e),L(!0);return}}L(!0)}})(),()=>{e=!0}},_[4]=j,_[5]=R,_[6]=N.length,_[7]=n):n=_[7],_[8]!==j||_[9]!==N?(i=[N,j],_[8]=j,_[9]=N,_[10]=i):i=_[10],(0,k.useEffect)(n,i),_[11]!==j||_[12]!==P?(a=()=>{if(j)return O.current&&clearTimeout(O.current),O.current=setTimeout(()=>{W("layout",JSON.stringify(P)).catch(eT)},500),()=>{O.current&&clearTimeout(O.current)}},o=[P,j],_[11]=j,_[12]=P,_[13]=a,_[14]=o):(a=_[13],o=_[14]),(0,k.useEffect)(a,o),j&&P.panes.some(e=>e.tabSessionIds.some(e=>e&&!R.has(e)))){let e=P.panes.map(e=>{let t=e.tabSessionIds.filter(e=>R.has(e)),r=t.includes(e.activeTabSessionId)?e.activeTabSessionId:t[0]??"";return{...e,tabSessionIds:t,activeTabSessionId:r}}).filter(eI),t=e.length>0?e:[{id:P.panes[0]?.id??ek(),tabSessionIds:[],activeTabSessionId:""}],r=t.some(e=>e.id===P.focusedPaneId)?P.focusedPaneId:t[0].id;M({panes:t,focusedPaneId:r,paneSizes:t.length===P.panes.length?P.paneSizes:e_(t.length)})}_[15]!==I||_[16]!==j||_[17]!==P.focusedPaneId||_[18]!==P.panes||_[19]!==T?(s=()=>{if(!j)return;let e=P.panes.find(e=>e.id===P.focusedPaneId);e?.activeTabSessionId&&e.activeTabSessionId!==I&&T(e.activeTabSessionId)},_[15]=I,_[16]=j,_[17]=P.focusedPaneId,_[18]=P.panes,_[19]=T,_[20]=s):s=_[20],_[21]!==j||_[22]!==P.focusedPaneId||_[23]!==P.panes?(l=[P.focusedPaneId,P.panes,j],_[21]=j,_[22]=P.focusedPaneId,_[23]=P.panes,_[24]=l):l=_[24],(0,k.useEffect)(s,l);let[D,$]=(0,k.useState)(I);j&&I&&I!==D&&($(I),!P.panes.some(e=>e.tabSessionIds.includes(I))&&R.has(I)&&M(e=>{let t=e.panes.map(t=>t.id===e.focusedPaneId?{...t,tabSessionIds:[...t.tabSessionIds,I],activeTabSessionId:I}:t);return{...e,panes:t}})),_[25]===Symbol.for("react.memo_cache_sentinel")?(u=e=>{M(t=>{if(t.panes.length>=4)return t;let r=t.panes.find(t=>t.id===e);if(!r||!r.activeTabSessionId)return t;let n={id:ek(),tabSessionIds:[r.activeTabSessionId],activeTabSessionId:r.activeTabSessionId},i=t.panes.findIndex(t=>t.id===e),a=[...t.panes];return a.splice(i+1,0,n),{panes:a,focusedPaneId:n.id,paneSizes:e_(a.length)}})},_[25]=u):u=_[25];let z=u;_[26]===Symbol.for("react.memo_cache_sentinel")?(c=e=>{M(t=>{if(t.panes.length<=1)return t;let r=t.panes.filter(t=>t.id!==e),n=t.focusedPaneId===e?r[0].id:t.focusedPaneId;return{panes:r,focusedPaneId:n,paneSizes:e_(r.length)}})},_[26]=c):c=_[26];let B=c;_[27]===Symbol.for("react.memo_cache_sentinel")?(d=e=>{M(t=>t.focusedPaneId===e?t:{...t,focusedPaneId:e})},_[27]=d):d=_[27];let F=d;_[28]===Symbol.for("react.memo_cache_sentinel")?(p=(e,t)=>{M(r=>{let n=r.panes.map(r=>r.id!==e?r:r.tabSessionIds.includes(t)?{...r,activeTabSessionId:t}:{...r,tabSessionIds:[...r.tabSessionIds,t],activeTabSessionId:t});return{...r,panes:n,focusedPaneId:e}})},_[28]=p):p=_[28];let G=p;_[29]===Symbol.for("react.memo_cache_sentinel")?(f=(e,t)=>{M(r=>{let n=r.panes.find(t=>t.id===e);if(!n)return r;let i=n.tabSessionIds.filter(e=>e!==t);if(0===i.length){if(r.panes.length>1){let t=r.panes.filter(t=>t.id!==e),n=r.focusedPaneId===e?t[0].id:r.focusedPaneId;return{panes:t,focusedPaneId:n,paneSizes:e_(t.length)}}return{...r,panes:r.panes.map(t=>t.id===e?{...t,tabSessionIds:[],activeTabSessionId:""}:t)}}let a=i.includes(n.activeTabSessionId)?n.activeTabSessionId:i[Math.min(n.tabSessionIds.indexOf(t),i.length-1)];return{...r,panes:r.panes.map(t=>t.id===e?{...t,tabSessionIds:i,activeTabSessionId:a}:t)}})},_[29]=f):f=_[29];let H=f;_[30]===Symbol.for("react.memo_cache_sentinel")?(h=(e,t,r)=>{e!==t&&M(n=>{let i=n.panes.find(t=>t.id===e);if(!i||!i.tabSessionIds.includes(r))return n;let a=i.tabSessionIds.filter(e=>e!==r),o=n.panes.map(n=>{if(n.id===e){let e=a.includes(n.activeTabSessionId)?n.activeTabSessionId:a[0]??"";return{...n,tabSessionIds:a,activeTabSessionId:e}}return n.id===t?n.tabSessionIds.includes(r)?{...n,activeTabSessionId:r}:{...n,tabSessionIds:[...n.tabSessionIds,r],activeTabSessionId:r}:n});0===a.length&&o.length>1&&(o=o.filter(t=>t.id!==e));let s=o.some(e=>e.id===t)?t:o[0].id;return{panes:o,focusedPaneId:s,paneSizes:e_(o.length)}})},_[30]=h):h=_[30];let q=h;_[31]===Symbol.for("react.memo_cache_sentinel")?(m=(e,t,r)=>{M(n=>{let i=n.panes.find(t=>t.id===e);if(!i)return n;let a=i.tabSessionIds.indexOf(t);if(-1===a||a===r||a+1===r)return n;let o=[...i.tabSessionIds];return o.splice(a,1),o.splice(r>a?r-1:r,0,t),{...n,panes:n.panes.map(t=>t.id===e?{...t,tabSessionIds:o}:t)}})},_[31]=m):m=_[31];let V=m;_[32]===Symbol.for("react.memo_cache_sentinel")?(g=(e,t)=>{M(r=>{let n;if(r.panes.length>=4)return r;let i=r.panes.find(t=>t.id===e);if(!i||!i.tabSessionIds.includes(t))return r;let a=i.tabSessionIds.filter(e=>e!==t);n=0===a.length?r.panes.filter(t=>t.id!==e):r.panes.map(t=>{if(t.id!==e)return t;let r=a.includes(t.activeTabSessionId)?t.activeTabSessionId:a[0]??"";return{...t,tabSessionIds:a,activeTabSessionId:r}});let o=ek();return n.push({id:o,tabSessionIds:[t],activeTabSessionId:t}),{panes:n,focusedPaneId:o,paneSizes:e_(n.length)}})},_[32]=g):g=_[32];let Q=g;_[33]!==P.focusedPaneId?(y=e=>{G(P.focusedPaneId,e)},_[33]=P.focusedPaneId,_[34]=y):y=_[34];let K=y;_[35]!==P.focusedPaneId||_[36]!==P.panes?(v=e=>{P.panes.length>=4?G(P.focusedPaneId,e):M(t=>{let r=ek(),n=[...t.panes,{id:r,tabSessionIds:[e],activeTabSessionId:e}];return{panes:n,focusedPaneId:r,paneSizes:e_(n.length)}})},_[35]=P.focusedPaneId,_[36]=P.panes,_[37]=v):v=_[37];let X=v;_[38]===Symbol.for("react.memo_cache_sentinel")?(b=e=>{M(t=>({...t,paneSizes:e}))},_[38]=b):b=_[38];let J=b;_[39]!==P||_[40]!==K||_[41]!==X?(x={layout:P,splitPane:z,closePane:B,focusPane:F,openSessionInPane:G,closeTab:H,moveTab:q,reorderTab:V,openSessionInFocusedPane:K,openSessionInNewPane:X,moveTabToNewPane:Q,setPaneSizes:J},_[39]=P,_[40]=K,_[41]=X,_[42]=x):x=_[42];let Y=x;return _[43]!==A||_[44]!==Y?(w=(0,S.jsx)(eA,{value:Y,children:A}),_[43]=A,_[44]=Y,_[45]=w):w=_[45],w}function eI(e){return e.tabSessionIds.length>0}function eT(){}function eR(e){return e.id}function eP(e,t,{checkForDefaultPrevented:r=!0}={}){return function(n){if(e?.(n),!1===r||!n.defaultPrevented)return t?.(n)}}function eM(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function ej(...e){return t=>{let r=!1,n=e.map(e=>{let n=eM(e,t);return r||"function"!=typeof n||(r=!0),n});if(r)return()=>{for(let t=0;t<n.length;t++){let r=n[t];"function"==typeof r?r():eM(e[t],null)}}}}function eL(...e){return k.useCallback(ej(...e),e)}function eO(e,t=[]){let r=[],n=()=>{let t=r.map(e=>k.createContext(e));return function(r){let n=r?.[e]||t;return k.useMemo(()=>({[`__scope${e}`]:{...r,[e]:n}}),[r,n])}};return n.scopeName=e,[function(t,n){let i=k.createContext(n),a=r.length;r=[...r,n];let o=t=>{let{scope:r,children:n,...o}=t,s=r?.[e]?.[a]||i,l=k.useMemo(()=>o,Object.values(o));return(0,S.jsx)(s.Provider,{value:l,children:n})};return o.displayName=t+"Provider",[o,function(r,o){let s=o?.[e]?.[a]||i,l=k.useContext(s);if(l)return l;if(void 0!==n)return n;throw Error(`\`${r}\` must be used within \`${t}\``)}]},function(...e){let t=e[0];if(1===e.length)return t;let r=()=>{let r=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let n=r.reduce((t,{useScope:r,scopeName:n})=>{let i=r(e)[`__scope${n}`];return{...t,...i}},{});return k.useMemo(()=>({[`__scope${t.scopeName}`]:n}),[n])}};return r.scopeName=t.scopeName,r}(n,...t)]}"u">typeof window&&window.document&&window.document.createElement;var eD=globalThis?.document?k.useLayoutEffect:()=>{};k[" useEffectEvent ".trim().toString()],k[" useInsertionEffect ".trim().toString()];var e$=k[" useInsertionEffect ".trim().toString()]||eD;function ez({prop:e,defaultProp:t,onChange:r=()=>{},caller:n}){let[i,a,o]=function({defaultProp:e,onChange:t}){let[r,n]=k.useState(e),i=k.useRef(r),a=k.useRef(t);return e$(()=>{a.current=t},[t]),k.useEffect(()=>{i.current!==r&&(a.current?.(r),i.current=r)},[r,i]),[r,n,a]}({defaultProp:t,onChange:r}),s=void 0!==e,l=s?e:i;{let t=k.useRef(void 0!==e);k.useEffect(()=>{let e=t.current;if(e!==s){let t=s?"controlled":"uncontrolled";console.warn(`${n} is changing from ${e?"controlled":"uncontrolled"} to ${t}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`)}t.current=s},[s,n])}return[l,k.useCallback(t=>{if(s){let r="function"==typeof t?t(e):t;r!==e&&o.current?.(r)}else a(t)},[s,e,a,o])]}Symbol("RADIX:SYNC_STATE");var eB=e.i(74080);function eF(e){var t;let r,n=(t=e,(r=k.forwardRef((e,t)=>{let{children:r,...n}=e;if(k.isValidElement(r)){var i;let e,a,o=(i=r,(a=(e=Object.getOwnPropertyDescriptor(i.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.ref:(a=(e=Object.getOwnPropertyDescriptor(i,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.props.ref:i.props.ref||i.ref),s=function(e,t){let r={...t};for(let n in t){let i=e[n],a=t[n];/^on[A-Z]/.test(n)?i&&a?r[n]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(r[n]=i):"style"===n?r[n]={...i,...a}:"className"===n&&(r[n]=[i,a].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==k.Fragment&&(s.ref=t?ej(t,o):o),k.cloneElement(r,s)}return k.Children.count(r)>1?k.Children.only(null):null})).displayName=`${t}.SlotClone`,r),i=k.forwardRef((e,t)=>{let{children:r,...i}=e,a=k.Children.toArray(r),o=a.find(eU);if(o){let e=o.props.children,r=a.map(t=>t!==o?t:k.Children.count(e)>1?k.Children.only(null):k.isValidElement(e)?e.props.children:null);return(0,S.jsx)(n,{...i,ref:t,children:k.isValidElement(e)?k.cloneElement(e,void 0,r):null})}return(0,S.jsx)(n,{...i,ref:t,children:r})});return i.displayName=`${e}.Slot`,i}var eG=Symbol("radix.slottable");function eU(e){return k.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===eG}var eW=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{let r=eF(`Primitive.${t}`),n=k.forwardRef((e,n)=>{let{asChild:i,...a}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,S.jsx)(i?r:t,{...a,ref:n})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function eH(e,t){e&&eB.flushSync(()=>e.dispatchEvent(t))}function eq(e){let t=e+"CollectionProvider",[r,n]=eO(t),[i,a]=r(t,{collectionRef:{current:null},itemMap:new Map}),o=e=>{let{scope:t,children:r}=e,n=k.default.useRef(null),a=k.default.useRef(new Map).current;return(0,S.jsx)(i,{scope:t,itemMap:a,collectionRef:n,children:r})};o.displayName=t;let s=e+"CollectionSlot",l=eF(s),u=k.default.forwardRef((e,t)=>{let{scope:r,children:n}=e,i=eL(t,a(s,r).collectionRef);return(0,S.jsx)(l,{ref:i,children:n})});u.displayName=s;let c=e+"CollectionItemSlot",d="data-radix-collection-item",p=eF(c),f=k.default.forwardRef((e,t)=>{let{scope:r,children:n,...i}=e,o=k.default.useRef(null),s=eL(t,o),l=a(c,r);return k.default.useEffect(()=>(l.itemMap.set(o,{ref:o,...i}),()=>void l.itemMap.delete(o))),(0,S.jsx)(p,{...{[d]:""},ref:s,children:n})});return f.displayName=c,[{Provider:o,Slot:u,ItemSlot:f},function(t){let r=a(e+"CollectionConsumer",t);return k.default.useCallback(()=>{let e=r.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${d}]`));return Array.from(r.itemMap.values()).sort((e,r)=>t.indexOf(e.ref.current)-t.indexOf(r.ref.current))},[r.collectionRef,r.itemMap])},n]}var eV=new WeakMap;function eQ(e,t){var r,n;let i,a,o;if("at"in Array.prototype)return Array.prototype.at.call(e,t);let s=(r=e,n=t,i=r.length,(o=(a=eK(n))>=0?a:i+a)<0||o>=i?-1:o);return -1===s?void 0:e[s]}function eK(e){return e!=e||0===e?0:Math.trunc(e)}(class e extends Map{#E;constructor(e){super(e),this.#E=[...super.keys()],eV.set(this,!0)}set(e,t){return eV.get(this)&&(this.has(e)?this.#E[this.#E.indexOf(e)]=e:this.#E.push(e)),super.set(e,t),this}insert(e,t,r){let n,i=this.has(t),a=this.#E.length,o=eK(e),s=o>=0?o:a+o,l=s<0||s>=a?-1:s;if(l===this.size||i&&l===this.size-1||-1===l)return this.set(t,r),this;let u=this.size+ +!i;o<0&&s++;let c=[...this.#E],d=!1;for(let e=s;e<u;e++)if(s===e){let a=c[e];c[e]===t&&(a=c[e+1]),i&&this.delete(t),n=this.get(a),this.set(t,r)}else{d||c[e-1]!==t||(d=!0);let r=c[d?e:e-1],i=n;n=this.get(r),this.delete(r),this.set(r,i)}return this}with(t,r,n){let i=new e(this);return i.insert(t,r,n),i}before(e){let t=this.#E.indexOf(e)-1;if(!(t<0))return this.entryAt(t)}setBefore(e,t,r){let n=this.#E.indexOf(e);return -1===n?this:this.insert(n,t,r)}after(e){let t=this.#E.indexOf(e);if(-1!==(t=-1===t||t===this.size-1?-1:t+1))return this.entryAt(t)}setAfter(e,t,r){let n=this.#E.indexOf(e);return -1===n?this:this.insert(n+1,t,r)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return this.#E=[],super.clear()}delete(e){let t=super.delete(e);return t&&this.#E.splice(this.#E.indexOf(e),1),t}deleteAt(e){let t=this.keyAt(e);return void 0!==t&&this.delete(t)}at(e){let t=eQ(this.#E,e);if(void 0!==t)return this.get(t)}entryAt(e){let t=eQ(this.#E,e);if(void 0!==t)return[t,this.get(t)]}indexOf(e){return this.#E.indexOf(e)}keyAt(e){return eQ(this.#E,e)}from(e,t){let r=this.indexOf(e);if(-1===r)return;let n=r+t;return n<0&&(n=0),n>=this.size&&(n=this.size-1),this.at(n)}keyFrom(e,t){let r=this.indexOf(e);if(-1===r)return;let n=r+t;return n<0&&(n=0),n>=this.size&&(n=this.size-1),this.keyAt(n)}find(e,t){let r=0;for(let n of this){if(Reflect.apply(e,t,[n,r,this]))return n;r++}}findIndex(e,t){let r=0;for(let n of this){if(Reflect.apply(e,t,[n,r,this]))return r;r++}return -1}filter(t,r){let n=[],i=0;for(let e of this)Reflect.apply(t,r,[e,i,this])&&n.push(e),i++;return new e(n)}map(t,r){let n=[],i=0;for(let e of this)n.push([e[0],Reflect.apply(t,r,[e,i,this])]),i++;return new e(n)}reduce(...e){let[t,r]=e,n=0,i=r??this.at(0);for(let r of this)i=0===n&&1===e.length?r:Reflect.apply(t,this,[i,r,n,this]),n++;return i}reduceRight(...e){let[t,r]=e,n=r??this.at(-1);for(let r=this.size-1;r>=0;r--){let i=this.at(r);n=r===this.size-1&&1===e.length?i:Reflect.apply(t,this,[n,i,r,this])}return n}toSorted(t){return new e([...this.entries()].sort(t))}toReversed(){let t=new e;for(let e=this.size-1;e>=0;e--){let r=this.keyAt(e),n=this.get(r);t.set(r,n)}return t}toSpliced(...t){let r=[...this.entries()];return r.splice(...t),new e(r)}slice(t,r){let n=new e,i=this.size-1;if(void 0===t)return n;t<0&&(t+=this.size),void 0!==r&&r>0&&(i=r-1);for(let e=t;e<=i;e++){let t=this.keyAt(e),r=this.get(t);n.set(t,r)}return n}every(e,t){let r=0;for(let n of this){if(!Reflect.apply(e,t,[n,r,this]))return!1;r++}return!0}some(e,t){let r=0;for(let n of this){if(Reflect.apply(e,t,[n,r,this]))return!0;r++}return!1}});var eX=k.createContext(void 0);function eJ(e){let t=k.useContext(eX);return e||t||"ltr"}function eY(e){let t=k.useRef(e);return k.useEffect(()=>{t.current=e}),k.useMemo(()=>(...e)=>t.current?.(...e),[])}var eZ="dismissableLayer.update",e0=k.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),e1=k.forwardRef((e,t)=>{let{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:i,onFocusOutside:a,onInteractOutside:o,onDismiss:s,...l}=e,u=k.useContext(e0),[c,d]=k.useState(null),p=c?.ownerDocument??globalThis?.document,[,f]=k.useState({}),h=eL(t,e=>d(e)),m=Array.from(u.layers),[g]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),y=m.indexOf(g),v=c?m.indexOf(c):-1,b=u.layersWithOutsidePointerEventsDisabled.size>0,w=v>=y,C=function(e,t=globalThis?.document){let r=eY(e),n=k.useRef(!1),i=k.useRef(()=>{});return k.useEffect(()=>{let e=e=>{if(e.target&&!n.current){let n=function(){e5("dismissableLayer.pointerDownOutside",r,a,{discrete:!0})},a={originalEvent:e};"touch"===e.pointerType?(t.removeEventListener("click",i.current),i.current=n,t.addEventListener("click",i.current,{once:!0})):n()}else t.removeEventListener("click",i.current);n.current=!1},a=window.setTimeout(()=>{t.addEventListener("pointerdown",e)},0);return()=>{window.clearTimeout(a),t.removeEventListener("pointerdown",e),t.removeEventListener("click",i.current)}},[t,r]),{onPointerDownCapture:()=>n.current=!0}}(e=>{let t=e.target,r=[...u.branches].some(e=>e.contains(t));w&&!r&&(i?.(e),o?.(e),e.defaultPrevented||s?.())},p),_=function(e,t=globalThis?.document){let r=eY(e),n=k.useRef(!1);return k.useEffect(()=>{let e=e=>{e.target&&!n.current&&e5("dismissableLayer.focusOutside",r,{originalEvent:e},{discrete:!1})};return t.addEventListener("focusin",e),()=>t.removeEventListener("focusin",e)},[t,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}(e=>{let t=e.target;![...u.branches].some(e=>e.contains(t))&&(a?.(e),o?.(e),e.defaultPrevented||s?.())},p);return!function(e,t=globalThis?.document){let r=eY(e);k.useEffect(()=>{let e=e=>{"Escape"===e.key&&r(e)};return t.addEventListener("keydown",e,{capture:!0}),()=>t.removeEventListener("keydown",e,{capture:!0})},[r,t])}(e=>{v===u.layers.size-1&&(n?.(e),!e.defaultPrevented&&s&&(e.preventDefault(),s()))},p),k.useEffect(()=>{if(c)return r&&(0===u.layersWithOutsidePointerEventsDisabled.size&&(x=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(c)),u.layers.add(c),e2(),()=>{r&&1===u.layersWithOutsidePointerEventsDisabled.size&&(p.body.style.pointerEvents=x)}},[c,p,r,u]),k.useEffect(()=>()=>{c&&(u.layers.delete(c),u.layersWithOutsidePointerEventsDisabled.delete(c),e2())},[c,u]),k.useEffect(()=>{let e=()=>f({});return document.addEventListener(eZ,e),()=>document.removeEventListener(eZ,e)},[]),(0,S.jsx)(eW.div,{...l,ref:h,style:{pointerEvents:b?w?"auto":"none":void 0,...e.style},onFocusCapture:eP(e.onFocusCapture,_.onFocusCapture),onBlurCapture:eP(e.onBlurCapture,_.onBlurCapture),onPointerDownCapture:eP(e.onPointerDownCapture,C.onPointerDownCapture)})});function e2(){let e=new CustomEvent(eZ);document.dispatchEvent(e)}function e5(e,t,r,{discrete:n}){let i=r.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&i.addEventListener(e,t,{once:!0}),n?eH(i,a):i.dispatchEvent(a)}e1.displayName="DismissableLayer",k.forwardRef((e,t)=>{let r=k.useContext(e0),n=k.useRef(null),i=eL(t,n);return k.useEffect(()=>{let e=n.current;if(e)return r.branches.add(e),()=>{r.branches.delete(e)}},[r.branches]),(0,S.jsx)(eW.div,{...e,ref:i})}).displayName="DismissableLayerBranch";var e3=0;function e4(){let e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var e6="focusScope.autoFocusOnMount",e8="focusScope.autoFocusOnUnmount",e7={bubbles:!1,cancelable:!0},e9=k.forwardRef((e,t)=>{let{loop:r=!1,trapped:n=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,l]=k.useState(null),u=eY(i),c=eY(a),d=k.useRef(null),p=eL(t,e=>l(e)),f=k.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;k.useEffect(()=>{if(n){let e=function(e){if(f.paused||!s)return;let t=e.target;s.contains(t)?d.current=t:tr(d.current,{select:!0})},t=function(e){if(f.paused||!s)return;let t=e.relatedTarget;null!==t&&(s.contains(t)||tr(d.current,{select:!0}))};document.addEventListener("focusin",e),document.addEventListener("focusout",t);let r=new MutationObserver(function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&tr(s)});return s&&r.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",e),document.removeEventListener("focusout",t),r.disconnect()}}},[n,s,f.paused]),k.useEffect(()=>{if(s){tn.add(f);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(e6,e7);s.addEventListener(e6,u),s.dispatchEvent(t),t.defaultPrevented||(function(e,{select:t=!1}={}){let r=document.activeElement;for(let n of e)if(tr(n,{select:t}),document.activeElement!==r)return}(te(s).filter(e=>"A"!==e.tagName),{select:!0}),document.activeElement===e&&tr(s))}return()=>{s.removeEventListener(e6,u),setTimeout(()=>{let t=new CustomEvent(e8,e7);s.addEventListener(e8,c),s.dispatchEvent(t),t.defaultPrevented||tr(e??document.body,{select:!0}),s.removeEventListener(e8,c),tn.remove(f)},0)}}},[s,u,c,f]);let h=k.useCallback(e=>{if(!r&&!n||f.paused)return;let t="Tab"===e.key&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){var a;let t,n=e.currentTarget,[o,s]=[tt(t=te(a=n),a),tt(t.reverse(),a)];o&&s?e.shiftKey||i!==s?e.shiftKey&&i===o&&(e.preventDefault(),r&&tr(s,{select:!0})):(e.preventDefault(),r&&tr(o,{select:!0})):i===n&&e.preventDefault()}},[r,n,f.paused]);return(0,S.jsx)(eW.div,{tabIndex:-1,...o,ref:p,onKeyDown:h})});function te(e){let t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t="INPUT"===e.tagName&&"hidden"===e.type;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function tt(e,t){for(let r of e)if(!function(e,{upTo:t}){if("hidden"===getComputedStyle(e).visibility)return!0;for(;e&&(void 0===t||e!==t);){if("none"===getComputedStyle(e).display)return!0;e=e.parentElement}return!1}(r,{upTo:t}))return r}function tr(e,{select:t=!1}={}){if(e&&e.focus){var r;let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&(r=e)instanceof HTMLInputElement&&"select"in r&&t&&e.select()}}e9.displayName="FocusScope";var tn=(c=[],{add(e){let t=c[0];e!==t&&t?.pause(),(c=ti(c,e)).unshift(e)},remove(e){c=ti(c,e),c[0]?.resume()}});function ti(e,t){let r=[...e],n=r.indexOf(t);return -1!==n&&r.splice(n,1),r}var ta=k[" useId ".trim().toString()]||(()=>void 0),to=0;function ts(e){let[t,r]=k.useState(ta());return eD(()=>{e||r(e=>e??String(to++))},[e]),e||(t?`radix-${t}`:"")}let tl=["top","right","bottom","left"],tu=Math.min,tc=Math.max,td=Math.round,tp=Math.floor,tf=e=>({x:e,y:e}),th={left:"right",right:"left",bottom:"top",top:"bottom"},tm={start:"end",end:"start"};function tg(e,t){return"function"==typeof e?e(t):e}function ty(e){return e.split("-")[0]}function tv(e){return e.split("-")[1]}function tb(e){return"x"===e?"y":"x"}function tx(e){return"y"===e?"height":"width"}let tw=new Set(["top","bottom"]);function tS(e){return tw.has(ty(e))?"y":"x"}function tC(e){return e.replace(/start|end/g,e=>tm[e])}let tk=["left","right"],t_=["right","left"],tA=["top","bottom"],tE=["bottom","top"];function tN(e){return e.replace(/left|right|bottom|top/g,e=>th[e])}function tI(e){return"number"!=typeof e?{top:0,right:0,bottom:0,left:0,...e}:{top:e,right:e,bottom:e,left:e}}function tT(e){let{x:t,y:r,width:n,height:i}=e;return{width:n,height:i,top:r,left:t,right:t+n,bottom:r+i,x:t,y:r}}function tR(e,t,r){let n,{reference:i,floating:a}=e,o=tS(t),s=tb(tS(t)),l=tx(s),u=ty(t),c="y"===o,d=i.x+i.width/2-a.width/2,p=i.y+i.height/2-a.height/2,f=i[l]/2-a[l]/2;switch(u){case"top":n={x:d,y:i.y-a.height};break;case"bottom":n={x:d,y:i.y+i.height};break;case"right":n={x:i.x+i.width,y:p};break;case"left":n={x:i.x-a.width,y:p};break;default:n={x:i.x,y:i.y}}switch(tv(t)){case"start":n[s]-=f*(r&&c?-1:1);break;case"end":n[s]+=f*(r&&c?-1:1)}return n}async function tP(e,t){var r;void 0===t&&(t={});let{x:n,y:i,platform:a,rects:o,elements:s,strategy:l}=e,{boundary:u="clippingAncestors",rootBoundary:c="viewport",elementContext:d="floating",altBoundary:p=!1,padding:f=0}=tg(t,e),h=tI(f),m=s[p?"floating"===d?"reference":"floating":d],g=tT(await a.getClippingRect({element:null==(r=await (null==a.isElement?void 0:a.isElement(m)))||r?m:m.contextElement||await (null==a.getDocumentElement?void 0:a.getDocumentElement(s.floating)),boundary:u,rootBoundary:c,strategy:l})),y="floating"===d?{x:n,y:i,width:o.floating.width,height:o.floating.height}:o.reference,v=await (null==a.getOffsetParent?void 0:a.getOffsetParent(s.floating)),b=await (null==a.isElement?void 0:a.isElement(v))&&await (null==a.getScale?void 0:a.getScale(v))||{x:1,y:1},x=tT(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:y,offsetParent:v,strategy:l}):y);return{top:(g.top-x.top+h.top)/b.y,bottom:(x.bottom-g.bottom+h.bottom)/b.y,left:(g.left-x.left+h.left)/b.x,right:(x.right-g.right+h.right)/b.x}}let tM=async(e,t,r)=>{let{placement:n="bottom",strategy:i="absolute",middleware:a=[],platform:o}=r,s=a.filter(Boolean),l=await (null==o.isRTL?void 0:o.isRTL(t)),u=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:c,y:d}=tR(u,n,l),p=n,f={},h=0;for(let r=0;r<s.length;r++){var m;let{name:a,fn:g}=s[r],{x:y,y:v,data:b,reset:x}=await g({x:c,y:d,initialPlacement:n,placement:p,strategy:i,middlewareData:f,rects:u,platform:{...o,detectOverflow:null!=(m=o.detectOverflow)?m:tP},elements:{reference:e,floating:t}});c=null!=y?y:c,d=null!=v?v:d,f={...f,[a]:{...f[a],...b}},x&&h<=50&&(h++,"object"==typeof x&&(x.placement&&(p=x.placement),x.rects&&(u=!0===x.rects?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:c,y:d}=tR(u,p,l)),r=-1)}return{x:c,y:d,placement:p,strategy:i,middlewareData:f}};function tj(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function tL(e){return tl.some(t=>e[t]>=0)}let tO=new Set(["left","top"]);async function tD(e,t){let{placement:r,platform:n,elements:i}=e,a=await (null==n.isRTL?void 0:n.isRTL(i.floating)),o=ty(r),s=tv(r),l="y"===tS(r),u=tO.has(o)?-1:1,c=a&&l?-1:1,d=tg(t,e),{mainAxis:p,crossAxis:f,alignmentAxis:h}="number"==typeof d?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&"number"==typeof h&&(f="end"===s?-1*h:h),l?{x:f*c,y:p*u}:{x:p*u,y:f*c}}function t$(){return"u">typeof window}function tz(e){return tG(e)?(e.nodeName||"").toLowerCase():"#document"}function tB(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function tF(e){var t;return null==(t=(tG(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function tG(e){return!!t$()&&(e instanceof Node||e instanceof tB(e).Node)}function tU(e){return!!t$()&&(e instanceof Element||e instanceof tB(e).Element)}function tW(e){return!!t$()&&(e instanceof HTMLElement||e instanceof tB(e).HTMLElement)}function tH(e){return!(!t$()||"u"<typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof tB(e).ShadowRoot)}let tq=new Set(["inline","contents"]);function tV(e){let{overflow:t,overflowX:r,overflowY:n,display:i}=t3(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+r)&&!tq.has(i)}let tQ=new Set(["table","td","th"]),tK=[":popover-open",":modal"];function tX(e){return tK.some(t=>{try{return e.matches(t)}catch(e){return!1}})}let tJ=["transform","translate","scale","rotate","perspective"],tY=["transform","translate","scale","rotate","perspective","filter"],tZ=["paint","layout","strict","content"];function t0(e){let t=t1(),r=tU(e)?t3(e):e;return tJ.some(e=>!!r[e]&&"none"!==r[e])||!!r.containerType&&"normal"!==r.containerType||!t&&!!r.backdropFilter&&"none"!==r.backdropFilter||!t&&!!r.filter&&"none"!==r.filter||tY.some(e=>(r.willChange||"").includes(e))||tZ.some(e=>(r.contain||"").includes(e))}function t1(){return!("u"<typeof CSS)&&!!CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")}let t2=new Set(["html","body","#document"]);function t5(e){return t2.has(tz(e))}function t3(e){return tB(e).getComputedStyle(e)}function t4(e){return tU(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function t6(e){if("html"===tz(e))return e;let t=e.assignedSlot||e.parentNode||tH(e)&&e.host||tF(e);return tH(t)?t.host:t}function t8(e,t,r){var n;void 0===t&&(t=[]),void 0===r&&(r=!0);let i=function e(t){let r=t6(t);return t5(r)?t.ownerDocument?t.ownerDocument.body:t.body:tW(r)&&tV(r)?r:e(r)}(e),a=i===(null==(n=e.ownerDocument)?void 0:n.body),o=tB(i);if(a){let e=t7(o);return t.concat(o,o.visualViewport||[],tV(i)?i:[],e&&r?t8(e):[])}return t.concat(i,t8(i,[],r))}function t7(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function t9(e){let t=t3(e),r=parseFloat(t.width)||0,n=parseFloat(t.height)||0,i=tW(e),a=i?e.offsetWidth:r,o=i?e.offsetHeight:n,s=td(r)!==a||td(n)!==o;return s&&(r=a,n=o),{width:r,height:n,$:s}}function re(e){return tU(e)?e:e.contextElement}function rt(e){let t=re(e);if(!tW(t))return tf(1);let r=t.getBoundingClientRect(),{width:n,height:i,$:a}=t9(t),o=(a?td(r.width):r.width)/n,s=(a?td(r.height):r.height)/i;return o&&Number.isFinite(o)||(o=1),s&&Number.isFinite(s)||(s=1),{x:o,y:s}}let rr=tf(0);function rn(e){let t=tB(e);return t1()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:rr}function ri(e,t,r,n){var i;void 0===t&&(t=!1),void 0===r&&(r=!1);let a=e.getBoundingClientRect(),o=re(e),s=tf(1);t&&(n?tU(n)&&(s=rt(n)):s=rt(e));let l=(void 0===(i=r)&&(i=!1),n&&(!i||n===tB(o))&&i)?rn(o):tf(0),u=(a.left+l.x)/s.x,c=(a.top+l.y)/s.y,d=a.width/s.x,p=a.height/s.y;if(o){let e=tB(o),t=n&&tU(n)?tB(n):n,r=e,i=t7(r);for(;i&&n&&t!==r;){let e=rt(i),t=i.getBoundingClientRect(),n=t3(i),a=t.left+(i.clientLeft+parseFloat(n.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(n.paddingTop))*e.y;u*=e.x,c*=e.y,d*=e.x,p*=e.y,u+=a,c+=o,i=t7(r=tB(i))}}return tT({width:d,height:p,x:u,y:c})}function ra(e,t){let r=t4(e).scrollLeft;return t?t.left+r:ri(tF(e)).left+r}function ro(e,t){let r=e.getBoundingClientRect();return{x:r.left+t.scrollLeft-ra(e,r),y:r.top+t.scrollTop}}let rs=new Set(["absolute","fixed"]);function rl(e,t,r){var n;let i;if("viewport"===t)i=function(e,t){let r=tB(e),n=tF(e),i=r.visualViewport,a=n.clientWidth,o=n.clientHeight,s=0,l=0;if(i){a=i.width,o=i.height;let e=t1();(!e||e&&"fixed"===t)&&(s=i.offsetLeft,l=i.offsetTop)}let u=ra(n);if(u<=0){let e=n.ownerDocument,t=e.body,r=getComputedStyle(t),i="CSS1Compat"===e.compatMode&&parseFloat(r.marginLeft)+parseFloat(r.marginRight)||0,o=Math.abs(n.clientWidth-t.clientWidth-i);o<=25&&(a-=o)}else u<=25&&(a+=u);return{width:a,height:o,x:s,y:l}}(e,r);else if("document"===t){let t,r,a,o,s,l,u;n=tF(e),t=tF(n),r=t4(n),a=n.ownerDocument.body,o=tc(t.scrollWidth,t.clientWidth,a.scrollWidth,a.clientWidth),s=tc(t.scrollHeight,t.clientHeight,a.scrollHeight,a.clientHeight),l=-r.scrollLeft+ra(n),u=-r.scrollTop,"rtl"===t3(a).direction&&(l+=tc(t.clientWidth,a.clientWidth)-o),i={width:o,height:s,x:l,y:u}}else if(tU(t)){let e,n,a,o,s,l;n=(e=ri(t,!0,"fixed"===r)).top+t.clientTop,a=e.left+t.clientLeft,o=tW(t)?rt(t):tf(1),s=t.clientWidth*o.x,l=t.clientHeight*o.y,i={width:s,height:l,x:a*o.x,y:n*o.y}}else{let r=rn(e);i={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return tT(i)}function ru(e){return"static"===t3(e).position}function rc(e,t){if(!tW(e)||"fixed"===t3(e).position)return null;if(t)return t(e);let r=e.offsetParent;return tF(e)===r&&(r=r.ownerDocument.body),r}function rd(e,t){var r;let n=tB(e);if(tX(e))return n;if(!tW(e)){let t=t6(e);for(;t&&!t5(t);){if(tU(t)&&!ru(t))return t;t=t6(t)}return n}let i=rc(e,t);for(;i&&(r=i,tQ.has(tz(r)))&&ru(i);)i=rc(i,t);return i&&t5(i)&&ru(i)&&!t0(i)?n:i||function(e){let t=t6(e);for(;tW(t)&&!t5(t);){if(t0(t))return t;if(tX(t))break;t=t6(t)}return null}(e)||n}let rp=async function(e){let t=this.getOffsetParent||rd,r=this.getDimensions,n=await r(e.floating);return{reference:function(e,t,r){let n=tW(t),i=tF(t),a="fixed"===r,o=ri(e,!0,a,t),s={scrollLeft:0,scrollTop:0},l=tf(0);if(n||!n&&!a)if(("body"!==tz(t)||tV(i))&&(s=t4(t)),n){let e=ri(t,!0,a,t);l.x=e.x+t.clientLeft,l.y=e.y+t.clientTop}else i&&(l.x=ra(i));a&&!n&&i&&(l.x=ra(i));let u=!i||n||a?tf(0):ro(i,s);return{x:o.left+s.scrollLeft-l.x-u.x,y:o.top+s.scrollTop-l.y-u.y,width:o.width,height:o.height}}(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}},rf={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:r,offsetParent:n,strategy:i}=e,a="fixed"===i,o=tF(n),s=!!t&&tX(t.floating);if(n===o||s&&a)return r;let l={scrollLeft:0,scrollTop:0},u=tf(1),c=tf(0),d=tW(n);if((d||!d&&!a)&&(("body"!==tz(n)||tV(o))&&(l=t4(n)),tW(n))){let e=ri(n);u=rt(n),c.x=e.x+n.clientLeft,c.y=e.y+n.clientTop}let p=!o||d||a?tf(0):ro(o,l);return{width:r.width*u.x,height:r.height*u.y,x:r.x*u.x-l.scrollLeft*u.x+c.x+p.x,y:r.y*u.y-l.scrollTop*u.y+c.y+p.y}},getDocumentElement:tF,getClippingRect:function(e){let{element:t,boundary:r,rootBoundary:n,strategy:i}=e,a=[..."clippingAncestors"===r?tX(t)?[]:function(e,t){let r=t.get(e);if(r)return r;let n=t8(e,[],!1).filter(e=>tU(e)&&"body"!==tz(e)),i=null,a="fixed"===t3(e).position,o=a?t6(e):e;for(;tU(o)&&!t5(o);){let t=t3(o),r=t0(o);r||"fixed"!==t.position||(i=null),(a?!r&&!i:!r&&"static"===t.position&&!!i&&rs.has(i.position)||tV(o)&&!r&&function e(t,r){let n=t6(t);return!(n===r||!tU(n)||t5(n))&&("fixed"===t3(n).position||e(n,r))}(e,o))?n=n.filter(e=>e!==o):i=t,o=t6(o)}return t.set(e,n),n}(t,this._c):[].concat(r),n],o=a[0],s=a.reduce((e,r)=>{let n=rl(t,r,i);return e.top=tc(n.top,e.top),e.right=tu(n.right,e.right),e.bottom=tu(n.bottom,e.bottom),e.left=tc(n.left,e.left),e},rl(t,o,i));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}},getOffsetParent:rd,getElementRects:rp,getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){let{width:t,height:r}=t9(e);return{width:t,height:r}},getScale:rt,isElement:tU,isRTL:function(e){return"rtl"===t3(e).direction}};function rh(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}let rm=e=>({name:"arrow",options:e,async fn(t){let{x:r,y:n,placement:i,rects:a,platform:o,elements:s,middlewareData:l}=t,{element:u,padding:c=0}=tg(e,t)||{};if(null==u)return{};let d=tI(c),p={x:r,y:n},f=tb(tS(i)),h=tx(f),m=await o.getDimensions(u),g="y"===f,y=g?"clientHeight":"clientWidth",v=a.reference[h]+a.reference[f]-p[f]-a.floating[h],b=p[f]-a.reference[f],x=await (null==o.getOffsetParent?void 0:o.getOffsetParent(u)),w=x?x[y]:0;w&&await (null==o.isElement?void 0:o.isElement(x))||(w=s.floating[y]||a.floating[h]);let S=w/2-m[h]/2-1,C=tu(d[g?"top":"left"],S),k=tu(d[g?"bottom":"right"],S),_=w-m[h]-k,A=w/2-m[h]/2+(v/2-b/2),E=tc(C,tu(A,_)),N=!l.arrow&&null!=tv(i)&&A!==E&&a.reference[h]/2-(A<C?C:k)-m[h]/2<0,I=N?A<C?A-C:A-_:0;return{[f]:p[f]+I,data:{[f]:E,centerOffset:A-E-I,...N&&{alignmentOffset:I}},reset:N}}});var rg="u">typeof document?k.useLayoutEffect:function(){};function ry(e,t){let r,n,i;if(e===t)return!0;if(typeof e!=typeof t)return!1;if("function"==typeof e&&e.toString()===t.toString())return!0;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if((r=e.length)!==t.length)return!1;for(n=r;0!=n--;)if(!ry(e[n],t[n]))return!1;return!0}if((r=(i=Object.keys(e)).length)!==Object.keys(t).length)return!1;for(n=r;0!=n--;)if(!({}).hasOwnProperty.call(t,i[n]))return!1;for(n=r;0!=n--;){let r=i[n];if(("_owner"!==r||!e.$$typeof)&&!ry(e[r],t[r]))return!1}return!0}return e!=e&&t!=t}function rv(e){return"u"<typeof window?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function rb(e,t){let r=rv(e);return Math.round(t*r)/r}function rx(e){let t=k.useRef(e);return rg(()=>{t.current=e}),t}var rw=k.forwardRef((e,t)=>{let{children:r,width:n=10,height:i=5,...a}=e;return(0,S.jsx)(eW.svg,{...a,ref:t,width:n,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:(0,S.jsx)("polygon",{points:"0,0 30,0 15,10"})})});rw.displayName="Arrow";var rS="Popper",[rC,rk]=eO(rS),[r_,rA]=rC(rS),rE=e=>{let{__scopePopper:t,children:r}=e,[n,i]=k.useState(null);return(0,S.jsx)(r_,{scope:t,anchor:n,onAnchorChange:i,children:r})};rE.displayName=rS;var rN="PopperAnchor",rI=k.forwardRef((e,t)=>{let{__scopePopper:r,virtualRef:n,...i}=e,a=rA(rN,r),o=k.useRef(null),s=eL(t,o),l=k.useRef(null);return k.useEffect(()=>{let e=l.current;l.current=n?.current||o.current,e!==l.current&&a.onAnchorChange(l.current)}),n?null:(0,S.jsx)(eW.div,{...i,ref:s})});rI.displayName=rN;var rT="PopperContent",[rR,rP]=rC(rT),rM=k.forwardRef((e,t)=>{var r,n,i,a,o,s,l,u,c,d,p,f,h,m,g,y,v,b,x,w,C;let{__scopePopper:_,side:A="bottom",sideOffset:E=0,align:N="center",alignOffset:I=0,arrowPadding:T=0,avoidCollisions:R=!0,collisionBoundary:P=[],collisionPadding:M=0,sticky:j="partial",hideWhenDetached:L=!1,updatePositionStrategy:O="optimized",onPlaced:D,...$}=e,z=rA(rT,_),[B,F]=k.useState(null),G=eL(t,e=>F(e)),[U,W]=k.useState(null),H=function(e){let[t,r]=k.useState(void 0);return eD(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{let n,i;if(!Array.isArray(t)||!t.length)return;let a=t[0];if("borderBoxSize"in a){let e=a.borderBoxSize,t=Array.isArray(e)?e[0]:e;n=t.inlineSize,i=t.blockSize}else n=e.offsetWidth,i=e.offsetHeight;r({width:n,height:i})});return t.observe(e,{box:"border-box"}),()=>t.unobserve(e)}r(void 0)},[e]),t}(U),q=H?.width??0,V=H?.height??0,Q="number"==typeof M?M:{top:0,right:0,bottom:0,left:0,...M},K=Array.isArray(P)?P:[P],X=K.length>0,J={padding:Q,boundary:K.filter(rD),altBoundary:X},{refs:Y,floatingStyles:Z,placement:ee,isPositioned:et,middlewareData:er}=function(e){void 0===e&&(e={});let{placement:t="bottom",strategy:r="absolute",middleware:n=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:l,open:u}=e,[c,d]=k.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[p,f]=k.useState(n);ry(p,n)||f(n);let[h,m]=k.useState(null),[g,y]=k.useState(null),v=k.useCallback(e=>{e!==S.current&&(S.current=e,m(e))},[]),b=k.useCallback(e=>{e!==C.current&&(C.current=e,y(e))},[]),x=a||h,w=o||g,S=k.useRef(null),C=k.useRef(null),_=k.useRef(c),A=null!=l,E=rx(l),N=rx(i),I=rx(u),T=k.useCallback(()=>{var e,n;let i,a,o;if(!S.current||!C.current)return;let s={placement:t,strategy:r,middleware:p};N.current&&(s.platform=N.current),(e=S.current,n=C.current,i=new Map,o={...(a={platform:rf,...s}).platform,_c:i},tM(e,n,{...a,platform:o})).then(e=>{let t={...e,isPositioned:!1!==I.current};R.current&&!ry(_.current,t)&&(_.current=t,eB.flushSync(()=>{d(t)}))})},[p,t,r,N,I]);rg(()=>{!1===u&&_.current.isPositioned&&(_.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[u]);let R=k.useRef(!1);rg(()=>(R.current=!0,()=>{R.current=!1}),[]),rg(()=>{if(x&&(S.current=x),w&&(C.current=w),x&&w){if(E.current)return E.current(x,w,T);T()}},[x,w,T,E,A]);let P=k.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:b}),[v,b]),M=k.useMemo(()=>({reference:x,floating:w}),[x,w]),j=k.useMemo(()=>{let e={position:r,left:0,top:0};if(!M.floating)return e;let t=rb(M.floating,c.x),n=rb(M.floating,c.y);return s?{...e,transform:"translate("+t+"px, "+n+"px)",...rv(M.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:t,top:n}},[r,s,M.floating,c.x,c.y]);return k.useMemo(()=>({...c,update:T,refs:P,elements:M,floatingStyles:j}),[c,T,P,M,j])}({strategy:"fixed",placement:A+("center"!==N?"-"+N:""),whileElementsMounted:(...e)=>(function(e,t,r,n){let i;void 0===n&&(n={});let{ancestorScroll:a=!0,ancestorResize:o=!0,elementResize:s="function"==typeof ResizeObserver,layoutShift:l="function"==typeof IntersectionObserver,animationFrame:u=!1}=n,c=re(e),d=a||o?[...c?t8(c):[],...t8(t)]:[];d.forEach(e=>{a&&e.addEventListener("scroll",r,{passive:!0}),o&&e.addEventListener("resize",r)});let p=c&&l?function(e,t){let r,n=null,i=tF(e);function a(){var e;clearTimeout(r),null==(e=n)||e.disconnect(),n=null}return!function o(s,l){void 0===s&&(s=!1),void 0===l&&(l=1),a();let u=e.getBoundingClientRect(),{left:c,top:d,width:p,height:f}=u;if(s||t(),!p||!f)return;let h={rootMargin:-tp(d)+"px "+-tp(i.clientWidth-(c+p))+"px "+-tp(i.clientHeight-(d+f))+"px "+-tp(c)+"px",threshold:tc(0,tu(1,l))||1},m=!0;function g(t){let n=t[0].intersectionRatio;if(n!==l){if(!m)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}1!==n||rh(u,e.getBoundingClientRect())||o(),m=!1}try{n=new IntersectionObserver(g,{...h,root:i.ownerDocument})}catch(e){n=new IntersectionObserver(g,h)}n.observe(e)}(!0),a}(c,r):null,f=-1,h=null;s&&(h=new ResizeObserver(e=>{let[n]=e;n&&n.target===c&&h&&(h.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;null==(e=h)||e.observe(t)})),r()}),c&&!u&&h.observe(c),h.observe(t));let m=u?ri(e):null;return u&&function t(){let n=ri(e);m&&!rh(m,n)&&r(),m=n,i=requestAnimationFrame(t)}(),r(),()=>{var e;d.forEach(e=>{a&&e.removeEventListener("scroll",r),o&&e.removeEventListener("resize",r)}),null==p||p(),null==(e=h)||e.disconnect(),h=null,u&&cancelAnimationFrame(i)}})(...e,{animationFrame:"always"===O}),elements:{reference:z.anchor},middleware:[{...{name:"offset",options:i=r={mainAxis:E+V,alignmentAxis:I},async fn(e){var t,r;let{x:n,y:a,placement:o,middlewareData:s}=e,l=await tD(e,i);return o===(null==(t=s.offset)?void 0:t.placement)&&null!=(r=s.arrow)&&r.alignmentOffset?{}:{x:n+l.x,y:a+l.y,data:{...l,placement:o}}}},options:[r,n]},R&&{...{name:"shift",options:c=l={mainAxis:!0,crossAxis:!1,limiter:"partial"===j?{...(void 0===(s=a)&&(s={}),{options:s,fn(e){let{x:t,y:r,placement:n,rects:i,middlewareData:a}=e,{offset:o=0,mainAxis:l=!0,crossAxis:u=!0}=tg(s,e),c={x:t,y:r},d=tS(n),p=tb(d),f=c[p],h=c[d],m=tg(o,e),g="number"==typeof m?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(l){let e="y"===p?"height":"width",t=i.reference[p]-i.floating[e]+g.mainAxis,r=i.reference[p]+i.reference[e]-g.mainAxis;f<t?f=t:f>r&&(f=r)}if(u){var y,v;let e="y"===p?"width":"height",t=tO.has(ty(n)),r=i.reference[d]-i.floating[e]+(t&&(null==(y=a.offset)?void 0:y[d])||0)+(t?0:g.crossAxis),o=i.reference[d]+i.reference[e]+(t?0:(null==(v=a.offset)?void 0:v[d])||0)-(t?g.crossAxis:0);h<r?h=r:h>o&&(h=o)}return{[p]:f,[d]:h}}}),options:[a,o]}:void 0,...J},async fn(e){let{x:t,y:r,placement:n,platform:i}=e,{mainAxis:a=!0,crossAxis:o=!1,limiter:s={fn:e=>{let{x:t,y:r}=e;return{x:t,y:r}}},...l}=tg(c,e),u={x:t,y:r},d=await i.detectOverflow(e,l),p=tS(ty(n)),f=tb(p),h=u[f],m=u[p];if(a){let e="y"===f?"top":"left",t="y"===f?"bottom":"right",r=h+d[e],n=h-d[t];h=tc(r,tu(h,n))}if(o){let e="y"===p?"top":"left",t="y"===p?"bottom":"right",r=m+d[e],n=m-d[t];m=tc(r,tu(m,n))}let g=s.fn({...e,[f]:h,[p]:m});return{...g,data:{x:g.x-t,y:g.y-r,enabled:{[f]:a,[p]:o}}}}},options:[l,u]},R&&{...{name:"flip",options:f=d={...J},async fn(e){var t,r,n,i,a,o,s,l;let u,c,d,{placement:p,middlewareData:h,rects:m,initialPlacement:g,platform:y,elements:v}=e,{mainAxis:b=!0,crossAxis:x=!0,fallbackPlacements:w,fallbackStrategy:S="bestFit",fallbackAxisSideDirection:C="none",flipAlignment:k=!0,..._}=tg(f,e);if(null!=(t=h.arrow)&&t.alignmentOffset)return{};let A=ty(p),E=tS(g),N=ty(g)===g,I=await (null==y.isRTL?void 0:y.isRTL(v.floating)),T=w||(N||!k?[tN(g)]:(u=tN(g),[tC(g),u,tC(u)])),R="none"!==C;!w&&R&&T.push(...(c=tv(g),d=function(e,t,r){switch(e){case"top":case"bottom":if(r)return t?t_:tk;return t?tk:t_;case"left":case"right":return t?tA:tE;default:return[]}}(ty(g),"start"===C,I),c&&(d=d.map(e=>e+"-"+c),k&&(d=d.concat(d.map(tC)))),d));let P=[g,...T],M=await y.detectOverflow(e,_),j=[],L=(null==(r=h.flip)?void 0:r.overflows)||[];if(b&&j.push(M[A]),x){let e,t,r,n,i=(o=p,s=m,void 0===(l=I)&&(l=!1),e=tv(o),r=tx(t=tb(tS(o))),n="x"===t?e===(l?"end":"start")?"right":"left":"start"===e?"bottom":"top",s.reference[r]>s.floating[r]&&(n=tN(n)),[n,tN(n)]);j.push(M[i[0]],M[i[1]])}if(L=[...L,{placement:p,overflows:j}],!j.every(e=>e<=0)){let e=((null==(n=h.flip)?void 0:n.index)||0)+1,t=P[e];if(t&&("alignment"!==x||E===tS(t)||L.every(e=>tS(e.placement)!==E||e.overflows[0]>0)))return{data:{index:e,overflows:L},reset:{placement:t}};let r=null==(i=L.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:i.placement;if(!r)switch(S){case"bestFit":{let e=null==(a=L.filter(e=>{if(R){let t=tS(e.placement);return t===E||"y"===t}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])?void 0:a[0];e&&(r=e);break}case"initialPlacement":r=g}if(p!==r)return{reset:{placement:r}}}return{}}},options:[d,p]},{...{name:"size",options:g=h={...J,apply:({elements:e,rects:t,availableWidth:r,availableHeight:n})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty("--radix-popper-available-width",`${r}px`),o.setProperty("--radix-popper-available-height",`${n}px`),o.setProperty("--radix-popper-anchor-width",`${i}px`),o.setProperty("--radix-popper-anchor-height",`${a}px`)}},async fn(e){var t,r;let n,i,{placement:a,rects:o,platform:s,elements:l}=e,{apply:u=()=>{},...c}=tg(g,e),d=await s.detectOverflow(e,c),p=ty(a),f=tv(a),h="y"===tS(a),{width:m,height:y}=o.floating;"top"===p||"bottom"===p?(n=p,i=f===(await (null==s.isRTL?void 0:s.isRTL(l.floating))?"start":"end")?"left":"right"):(i=p,n="end"===f?"top":"bottom");let v=y-d.top-d.bottom,b=m-d.left-d.right,x=tu(y-d[n],v),w=tu(m-d[i],b),S=!e.middlewareData.shift,C=x,k=w;if(null!=(t=e.middlewareData.shift)&&t.enabled.x&&(k=b),null!=(r=e.middlewareData.shift)&&r.enabled.y&&(C=v),S&&!f){let e=tc(d.left,0),t=tc(d.right,0),r=tc(d.top,0),n=tc(d.bottom,0);h?k=m-2*(0!==e||0!==t?e+t:tc(d.left,d.right)):C=y-2*(0!==r||0!==n?r+n:tc(d.top,d.bottom))}await u({...e,availableWidth:k,availableHeight:C});let _=await s.getDimensions(l.floating);return m!==_.width||y!==_.height?{reset:{rects:!0}}:{}}},options:[h,m]},U&&{...{name:"arrow",options:b=y={element:U,padding:T},fn(e){let{element:t,padding:r}="function"==typeof b?b(e):b;return t&&({}).hasOwnProperty.call(t,"current")?null!=t.current?rm({element:t.current,padding:r}).fn(e):{}:t?rm({element:t,padding:r}).fn(e):{}}},options:[y,v]},r$({arrowWidth:q,arrowHeight:V}),L&&{...{name:"hide",options:C=x={strategy:"referenceHidden",...J},async fn(e){let{rects:t,platform:r}=e,{strategy:n="referenceHidden",...i}=tg(C,e);switch(n){case"referenceHidden":{let n=tj(await r.detectOverflow(e,{...i,elementContext:"reference"}),t.reference);return{data:{referenceHiddenOffsets:n,referenceHidden:tL(n)}}}case"escaped":{let n=tj(await r.detectOverflow(e,{...i,altBoundary:!0}),t.floating);return{data:{escapedOffsets:n,escaped:tL(n)}}}default:return{}}}},options:[x,w]}]}),[en,ei]=rz(ee),ea=eY(D);eD(()=>{et&&ea?.()},[et,ea]);let eo=er.arrow?.x,es=er.arrow?.y,el=er.arrow?.centerOffset!==0,[eu,ec]=k.useState();return eD(()=>{B&&ec(window.getComputedStyle(B).zIndex)},[B]),(0,S.jsx)("div",{ref:Y.setFloating,"data-radix-popper-content-wrapper":"",style:{...Z,transform:et?Z.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:eu,"--radix-popper-transform-origin":[er.transformOrigin?.x,er.transformOrigin?.y].join(" "),...er.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:(0,S.jsx)(rR,{scope:_,placedSide:en,onArrowChange:W,arrowX:eo,arrowY:es,shouldHideArrow:el,children:(0,S.jsx)(eW.div,{"data-side":en,"data-align":ei,...$,ref:G,style:{...$.style,animation:et?void 0:"none"}})})})});rM.displayName=rT;var rj="PopperArrow",rL={top:"bottom",right:"left",bottom:"top",left:"right"},rO=k.forwardRef(function(e,t){let{__scopePopper:r,...n}=e,i=rP(rj,r),a=rL[i.placedSide];return(0,S.jsx)("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:(0,S.jsx)(rw,{...n,ref:t,style:{...n.style,display:"block"}})})});function rD(e){return null!==e}rO.displayName=rj;var r$=e=>({name:"transformOrigin",options:e,fn(t){let{placement:r,rects:n,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[l,u]=rz(r),c={start:"0%",center:"50%",end:"100%"}[u],d=(i.arrow?.x??0)+o/2,p=(i.arrow?.y??0)+s/2,f="",h="";return"bottom"===l?(f=a?c:`${d}px`,h=`${-s}px`):"top"===l?(f=a?c:`${d}px`,h=`${n.floating.height+s}px`):"right"===l?(f=`${-s}px`,h=a?c:`${p}px`):"left"===l&&(f=`${n.floating.width+s}px`,h=a?c:`${p}px`),{data:{x:f,y:h}}}});function rz(e){let[t,r="center"]=e.split("-");return[t,r]}var rB=k.forwardRef((e,t)=>{let{container:r,...n}=e,[i,a]=k.useState(!1);eD(()=>a(!0),[]);let o=r||i&&globalThis?.document?.body;return o?eB.default.createPortal((0,S.jsx)(eW.div,{...n,ref:t}),o):null});rB.displayName="Portal";var rF=e=>{var t;let r,n,{present:i,children:a}=e,o=function(e){var t,r;let[n,i]=k.useState(),a=k.useRef(null),o=k.useRef(e),s=k.useRef("none"),[l,u]=(t=e?"mounted":"unmounted",r={mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}},k.useReducer((e,t)=>r[e][t]??e,t));return k.useEffect(()=>{let e=rG(a.current);s.current="mounted"===l?e:"none"},[l]),eD(()=>{let t=a.current,r=o.current;if(r!==e){let n=s.current,i=rG(t);e?u("MOUNT"):"none"===i||t?.display==="none"?u("UNMOUNT"):r&&n!==i?u("ANIMATION_OUT"):u("UNMOUNT"),o.current=e}},[e,u]),eD(()=>{if(n){let e,t=n.ownerDocument.defaultView??window,r=r=>{let i=rG(a.current).includes(CSS.escape(r.animationName));if(r.target===n&&i&&(u("ANIMATION_END"),!o.current)){let r=n.style.animationFillMode;n.style.animationFillMode="forwards",e=t.setTimeout(()=>{"forwards"===n.style.animationFillMode&&(n.style.animationFillMode=r)})}},i=e=>{e.target===n&&(s.current=rG(a.current))};return n.addEventListener("animationstart",i),n.addEventListener("animationcancel",r),n.addEventListener("animationend",r),()=>{t.clearTimeout(e),n.removeEventListener("animationstart",i),n.removeEventListener("animationcancel",r),n.removeEventListener("animationend",r)}}u("ANIMATION_END")},[n,u]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:k.useCallback(e=>{a.current=e?getComputedStyle(e):null,i(e)},[])}}(i),s="function"==typeof a?a({present:o.isPresent}):k.Children.only(a),l=eL(o.ref,(t=s,(n=(r=Object.getOwnPropertyDescriptor(t.props,"ref")?.get)&&"isReactWarning"in r&&r.isReactWarning)?t.ref:(n=(r=Object.getOwnPropertyDescriptor(t,"ref")?.get)&&"isReactWarning"in r&&r.isReactWarning)?t.props.ref:t.props.ref||t.ref));return"function"==typeof a||o.isPresent?k.cloneElement(s,{ref:l}):null};function rG(e){return e?.animationName||"none"}rF.displayName="Presence";var rU="rovingFocusGroup.onEntryFocus",rW={bubbles:!1,cancelable:!0},rH="RovingFocusGroup",[rq,rV,rQ]=eq(rH),[rK,rX]=eO(rH,[rQ]),[rJ,rY]=rK(rH),rZ=k.forwardRef((e,t)=>(0,S.jsx)(rq.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,S.jsx)(rq.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,S.jsx)(r0,{...e,ref:t})})}));rZ.displayName=rH;var r0=k.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:r,orientation:n,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:l,onEntryFocus:u,preventScrollOnEntryFocus:c=!1,...d}=e,p=k.useRef(null),f=eL(t,p),h=eJ(a),[m,g]=ez({prop:o,defaultProp:s??null,onChange:l,caller:rH}),[y,v]=k.useState(!1),b=eY(u),x=rV(r),w=k.useRef(!1),[C,_]=k.useState(0);return k.useEffect(()=>{let e=p.current;if(e)return e.addEventListener(rU,b),()=>e.removeEventListener(rU,b)},[b]),(0,S.jsx)(rJ,{scope:r,orientation:n,dir:h,loop:i,currentTabStopId:m,onItemFocus:k.useCallback(e=>g(e),[g]),onItemShiftTab:k.useCallback(()=>v(!0),[]),onFocusableItemAdd:k.useCallback(()=>_(e=>e+1),[]),onFocusableItemRemove:k.useCallback(()=>_(e=>e-1),[]),children:(0,S.jsx)(eW.div,{tabIndex:y||0===C?-1:0,"data-orientation":n,...d,ref:f,style:{outline:"none",...e.style},onMouseDown:eP(e.onMouseDown,()=>{w.current=!0}),onFocus:eP(e.onFocus,e=>{let t=!w.current;if(e.target===e.currentTarget&&t&&!y){let t=new CustomEvent(rU,rW);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=x().filter(e=>e.focusable);r3([e.find(e=>e.active),e.find(e=>e.id===m),...e].filter(Boolean).map(e=>e.ref.current),c)}}w.current=!1}),onBlur:eP(e.onBlur,()=>v(!1))})})}),r1="RovingFocusGroupItem",r2=k.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:r,focusable:n=!0,active:i=!1,tabStopId:a,children:o,...s}=e,l=ts(),u=a||l,c=rY(r1,r),d=c.currentTabStopId===u,p=rV(r),{onFocusableItemAdd:f,onFocusableItemRemove:h,currentTabStopId:m}=c;return k.useEffect(()=>{if(n)return f(),()=>h()},[n,f,h]),(0,S.jsx)(rq.ItemSlot,{scope:r,id:u,focusable:n,active:i,children:(0,S.jsx)(eW.span,{tabIndex:d?0:-1,"data-orientation":c.orientation,...s,ref:t,onMouseDown:eP(e.onMouseDown,e=>{n?c.onItemFocus(u):e.preventDefault()}),onFocus:eP(e.onFocus,()=>c.onItemFocus(u)),onKeyDown:eP(e.onKeyDown,e=>{if("Tab"===e.key&&e.shiftKey)return void c.onItemShiftTab();if(e.target!==e.currentTarget)return;let t=function(e,t,r){var n;let i=(n=e.key,"rtl"!==r?n:"ArrowLeft"===n?"ArrowRight":"ArrowRight"===n?"ArrowLeft":n);if(!("vertical"===t&&["ArrowLeft","ArrowRight"].includes(i))&&!("horizontal"===t&&["ArrowUp","ArrowDown"].includes(i)))return r5[i]}(e,c.orientation,c.dir);if(void 0!==t){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let i=p().filter(e=>e.focusable).map(e=>e.ref.current);if("last"===t)i.reverse();else if("prev"===t||"next"===t){var r,n;"prev"===t&&i.reverse();let a=i.indexOf(e.currentTarget);i=c.loop?(r=i,n=a+1,r.map((e,t)=>r[(n+t)%r.length])):i.slice(a+1)}setTimeout(()=>r3(i))}}),children:"function"==typeof o?o({isCurrentTabStop:d,hasTabStop:null!=m}):o})})});r2.displayName=r1;var r5={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function r3(e,t=!1){let r=document.activeElement;for(let n of e)if(n===r||(n.focus({preventScroll:t}),document.activeElement!==r))return}var r4=new WeakMap,r6=new WeakMap,r8={},r7=0,r9=function(e){return e&&(e.host||r9(e.parentNode))},ne=function(e,t,r,n){var i=(Array.isArray(e)?e:[e]).map(function(e){if(t.contains(e))return e;var r=r9(e);return r&&t.contains(r)?r:(console.error("aria-hidden",e,"in not contained inside",t,". Doing nothing"),null)}).filter(function(e){return!!e});r8[r]||(r8[r]=new WeakMap);var a=r8[r],o=[],s=new Set,l=new Set(i),u=function(e){!e||s.has(e)||(s.add(e),u(e.parentNode))};i.forEach(u);var c=function(e){!e||l.has(e)||Array.prototype.forEach.call(e.children,function(e){if(s.has(e))c(e);else try{var t=e.getAttribute(n),i=null!==t&&"false"!==t,l=(r4.get(e)||0)+1,u=(a.get(e)||0)+1;r4.set(e,l),a.set(e,u),o.push(e),1===l&&i&&r6.set(e,!0),1===u&&e.setAttribute(r,"true"),i||e.setAttribute(n,"true")}catch(t){console.error("aria-hidden: cannot operate on ",e,t)}})};return c(t),s.clear(),r7++,function(){o.forEach(function(e){var t=r4.get(e)-1,i=a.get(e)-1;r4.set(e,t),a.set(e,i),t||(r6.has(e)||e.removeAttribute(n),r6.delete(e)),i||e.removeAttribute(r)}),--r7||(r4=new WeakMap,r4=new WeakMap,r6=new WeakMap,r8={})}},nt=function(e,t,r){void 0===r&&(r="data-aria-hidden");var n=Array.from(Array.isArray(e)?e:[e]),i=t||("u"<typeof document?null:(Array.isArray(e)?e[0]:e).ownerDocument.body);return i?(n.push.apply(n,Array.from(i.querySelectorAll("[aria-live], script"))),ne(n,i,r,"aria-hidden")):function(){return null}},nr=function(){return(nr=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function nn(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)0>t.indexOf(n[i])&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r}var ni=("function"==typeof SuppressedError&&SuppressedError,"right-scroll-bar-position"),na="width-before-scroll-bar";function no(e,t){return"function"==typeof e?e(t):e&&(e.current=t),e}var ns="u">typeof window?k.useLayoutEffect:k.useEffect,nl=new WeakMap,nu=(void 0===d&&(d={}),(void 0===p&&(p=function(e){return e}),f=[],h=!1,m={read:function(){if(h)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return f.length?f[f.length-1]:null},useMedium:function(e){var t=p(e,h);return f.push(t),function(){f=f.filter(function(e){return e!==t})}},assignSyncMedium:function(e){for(h=!0;f.length;){var t=f;f=[],t.forEach(e)}f={push:function(t){return e(t)},filter:function(){return f}}},assignMedium:function(e){h=!0;var t=[];if(f.length){var r=f;f=[],r.forEach(e),t=f}var n=function(){var r=t;t=[],r.forEach(e)},i=function(){return Promise.resolve().then(n)};i(),f={push:function(e){t.push(e),i()},filter:function(e){return t=t.filter(e),f}}}}).options=nr({async:!0,ssr:!1},d),m),nc=function(){},nd=k.forwardRef(function(e,t){var r,n,i,a,o=k.useRef(null),s=k.useState({onScrollCapture:nc,onWheelCapture:nc,onTouchMoveCapture:nc}),l=s[0],u=s[1],c=e.forwardProps,d=e.children,p=e.className,f=e.removeScrollBar,h=e.enabled,m=e.shards,g=e.sideCar,y=e.noRelative,v=e.noIsolation,b=e.inert,x=e.allowPinchZoom,w=e.as,S=e.gapMode,C=nn(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),_=(r=[o,t],n=function(e){return r.forEach(function(t){return no(t,e)})},(i=(0,k.useState)(function(){return{value:null,callback:n,facade:{get current(){return i.value},set current(value){var e=i.value;e!==value&&(i.value=value,i.callback(value,e))}}}})[0]).callback=n,a=i.facade,ns(function(){var e=nl.get(a);if(e){var t=new Set(e),n=new Set(r),i=a.current;t.forEach(function(e){n.has(e)||no(e,null)}),n.forEach(function(e){t.has(e)||no(e,i)})}nl.set(a,r)},[r]),a),A=nr(nr({},C),l);return k.createElement(k.Fragment,null,h&&k.createElement(g,{sideCar:nu,removeScrollBar:f,shards:m,noRelative:y,noIsolation:v,inert:b,setCallbacks:u,allowPinchZoom:!!x,lockRef:o,gapMode:S}),c?k.cloneElement(k.Children.only(d),nr(nr({},A),{ref:_})):k.createElement(void 0===w?"div":w,nr({},A,{className:p,ref:_}),d))});nd.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},nd.classNames={fullWidth:na,zeroRight:ni};var np=function(e){var t=e.sideCar,r=nn(e,["sideCar"]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var n=t.read();if(!n)throw Error("Sidecar medium not found");return k.createElement(n,nr({},r))};np.isSideCarExport=!0;var nf=function(){var e=0,t=null;return{add:function(r){if(0==e&&(t=function(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=w||("u">typeof __webpack_nonce__?__webpack_nonce__:void 0);return t&&e.setAttribute("nonce",t),e}())){var n,i;(n=t).styleSheet?n.styleSheet.cssText=r:n.appendChild(document.createTextNode(r)),i=t,(document.head||document.getElementsByTagName("head")[0]).appendChild(i)}e++},remove:function(){--e||!t||(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},nh=function(){var e=nf();return function(t,r){k.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])}},nm=function(){var e=nh();return function(t){return e(t.styles,t.dynamic),null}},ng={left:0,top:0,right:0,gap:0},ny=function(e){return parseInt(e||"",10)||0},nv=function(e){var t=window.getComputedStyle(document.body),r=t["padding"===e?"paddingLeft":"marginLeft"],n=t["padding"===e?"paddingTop":"marginTop"],i=t["padding"===e?"paddingRight":"marginRight"];return[ny(r),ny(n),ny(i)]},nb=function(e){if(void 0===e&&(e="margin"),"u"<typeof window)return ng;var t=nv(e),r=document.documentElement.clientWidth,n=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,n-r+t[2]-t[0])}},nx=nm(),nw="data-scroll-locked",nS=function(e,t,r,n){var i=e.left,a=e.top,o=e.right,s=e.gap;return void 0===r&&(r="margin"),"\n .".concat("with-scroll-bars-hidden"," {\n overflow: hidden ").concat(n,";\n padding-right: ").concat(s,"px ").concat(n,";\n }\n body[").concat(nw,"] {\n overflow: hidden ").concat(n,";\n overscroll-behavior: contain;\n ").concat([t&&"position: relative ".concat(n,";"),"margin"===r&&"\n padding-left: ".concat(i,"px;\n padding-top: ").concat(a,"px;\n padding-right: ").concat(o,"px;\n margin-left:0;\n margin-top:0;\n margin-right: ").concat(s,"px ").concat(n,";\n "),"padding"===r&&"padding-right: ".concat(s,"px ").concat(n,";")].filter(Boolean).join(""),"\n }\n \n .").concat(ni," {\n right: ").concat(s,"px ").concat(n,";\n }\n \n .").concat(na," {\n margin-right: ").concat(s,"px ").concat(n,";\n }\n \n .").concat(ni," .").concat(ni," {\n right: 0 ").concat(n,";\n }\n \n .").concat(na," .").concat(na," {\n margin-right: 0 ").concat(n,";\n }\n \n body[").concat(nw,"] {\n ").concat("--removed-body-scroll-bar-size",": ").concat(s,"px;\n }\n")},nC=function(){var e=parseInt(document.body.getAttribute(nw)||"0",10);return isFinite(e)?e:0},nk=function(){k.useEffect(function(){return document.body.setAttribute(nw,(nC()+1).toString()),function(){var e=nC()-1;e<=0?document.body.removeAttribute(nw):document.body.setAttribute(nw,e.toString())}},[])},n_=function(e){var t=e.noRelative,r=e.noImportant,n=e.gapMode,i=void 0===n?"margin":n;nk();var a=k.useMemo(function(){return nb(i)},[i]);return k.createElement(nx,{styles:nS(a,!t,i,r?"":"!important")})},nA=!1;if("u">typeof window)try{var nE=Object.defineProperty({},"passive",{get:function(){return nA=!0,!0}});window.addEventListener("test",nE,nE),window.removeEventListener("test",nE,nE)}catch(e){nA=!1}var nN=!!nA&&{passive:!1},nI=function(e,t){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return"hidden"!==r[t]&&(r.overflowY!==r.overflowX||"TEXTAREA"===e.tagName||"visible"!==r[t])},nT=function(e,t){var r=t.ownerDocument,n=t;do{if("u">typeof ShadowRoot&&n instanceof ShadowRoot&&(n=n.host),nR(e,n)){var i=nP(e,n);if(i[1]>i[2])return!0}n=n.parentNode}while(n&&n!==r.body)return!1},nR=function(e,t){return"v"===e?nI(t,"overflowY"):nI(t,"overflowX")},nP=function(e,t){return"v"===e?[t.scrollTop,t.scrollHeight,t.clientHeight]:[t.scrollLeft,t.scrollWidth,t.clientWidth]},nM=function(e,t,r,n,i){var a,o=(a=window.getComputedStyle(t).direction,"h"===e&&"rtl"===a?-1:1),s=o*n,l=r.target,u=t.contains(l),c=!1,d=s>0,p=0,f=0;do{if(!l)break;var h=nP(e,l),m=h[0],g=h[1]-h[2]-o*m;(m||g)&&nR(e,l)&&(p+=g,f+=m);var y=l.parentNode;l=y&&y.nodeType===Node.DOCUMENT_FRAGMENT_NODE?y.host:y}while(!u&&l!==document.body||u&&(t.contains(l)||t===l))return d&&(i&&1>Math.abs(p)||!i&&s>p)?c=!0:!d&&(i&&1>Math.abs(f)||!i&&-s>f)&&(c=!0),c},nj=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},nL=function(e){return[e.deltaX,e.deltaY]},nO=function(e){return e&&"current"in e?e.current:e},nD=0,n$=[];let nz=(g=function(e){var t=k.useRef([]),r=k.useRef([0,0]),n=k.useRef(),i=k.useState(nD++)[0],a=k.useState(nm)[0],o=k.useRef(e);k.useEffect(function(){o.current=e},[e]),k.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(i));var t=(function(e,t,r){if(r||2==arguments.length)for(var n,i=0,a=t.length;i<a;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))})([e.lockRef.current],(e.shards||[]).map(nO),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),t.forEach(function(e){return e.classList.remove("allow-interactivity-".concat(i))})}}},[e.inert,e.lockRef.current,e.shards]);var s=k.useCallback(function(e,t){if("touches"in e&&2===e.touches.length||"wheel"===e.type&&e.ctrlKey)return!o.current.allowPinchZoom;var i,a=nj(e),s=r.current,l="deltaX"in e?e.deltaX:s[0]-a[0],u="deltaY"in e?e.deltaY:s[1]-a[1],c=e.target,d=Math.abs(l)>Math.abs(u)?"h":"v";if("touches"in e&&"h"===d&&"range"===c.type)return!1;var p=window.getSelection(),f=p&&p.anchorNode;if(f&&(f===c||f.contains(c)))return!1;var h=nT(d,c);if(!h)return!0;if(h?i=d:(i="v"===d?"h":"v",h=nT(d,c)),!h)return!1;if(!n.current&&"changedTouches"in e&&(l||u)&&(n.current=i),!i)return!0;var m=n.current||i;return nM(m,t,e,"h"===m?l:u,!0)},[]),l=k.useCallback(function(e){if(n$.length&&n$[n$.length-1]===a){var r="deltaY"in e?nL(e):nj(e),n=t.current.filter(function(t){var n;return t.name===e.type&&(t.target===e.target||e.target===t.shadowParent)&&(n=t.delta,n[0]===r[0]&&n[1]===r[1])})[0];if(n&&n.should){e.cancelable&&e.preventDefault();return}if(!n){var i=(o.current.shards||[]).map(nO).filter(Boolean).filter(function(t){return t.contains(e.target)});(i.length>0?s(e,i[0]):!o.current.noIsolation)&&e.cancelable&&e.preventDefault()}}},[]),u=k.useCallback(function(e,r,n,i){var a={name:e,delta:r,target:n,should:i,shadowParent:function(e){for(var t=null;null!==e;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}(n)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),c=k.useCallback(function(e){r.current=nj(e),n.current=void 0},[]),d=k.useCallback(function(t){u(t.type,nL(t),t.target,s(t,e.lockRef.current))},[]),p=k.useCallback(function(t){u(t.type,nj(t),t.target,s(t,e.lockRef.current))},[]);k.useEffect(function(){return n$.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:p}),document.addEventListener("wheel",l,nN),document.addEventListener("touchmove",l,nN),document.addEventListener("touchstart",c,nN),function(){n$=n$.filter(function(e){return e!==a}),document.removeEventListener("wheel",l,nN),document.removeEventListener("touchmove",l,nN),document.removeEventListener("touchstart",c,nN)}},[]);var f=e.removeScrollBar,h=e.inert;return k.createElement(k.Fragment,null,h?k.createElement(a,{styles:"\n .block-interactivity-".concat(i," {pointer-events: none;}\n .allow-interactivity-").concat(i," {pointer-events: all;}\n")}):null,f?k.createElement(n_,{noRelative:e.noRelative,gapMode:e.gapMode}):null)},nu.useMedium(g),np);var nB=k.forwardRef(function(e,t){return k.createElement(nd,nr({},e,{ref:t,sideCar:nz}))});nB.classNames=nd.classNames;var nF=["Enter"," "],nG=["ArrowUp","PageDown","End"],nU=["ArrowDown","PageUp","Home",...nG],nW={ltr:[...nF,"ArrowRight"],rtl:[...nF,"ArrowLeft"]},nH={ltr:["ArrowLeft"],rtl:["ArrowRight"]},nq="Menu",[nV,nQ,nK]=eq(nq),[nX,nJ]=eO(nq,[nK,rk,rX]),nY=rk(),nZ=rX(),[n0,n1]=nX(nq),[n2,n5]=nX(nq),n3=e=>{let{__scopeMenu:t,open:r=!1,children:n,dir:i,onOpenChange:a,modal:o=!0}=e,s=nY(t),[l,u]=k.useState(null),c=k.useRef(!1),d=eY(a),p=eJ(i);return k.useEffect(()=>{let e=()=>{c.current=!0,document.addEventListener("pointerdown",t,{capture:!0,once:!0}),document.addEventListener("pointermove",t,{capture:!0,once:!0})},t=()=>c.current=!1;return document.addEventListener("keydown",e,{capture:!0}),()=>{document.removeEventListener("keydown",e,{capture:!0}),document.removeEventListener("pointerdown",t,{capture:!0}),document.removeEventListener("pointermove",t,{capture:!0})}},[]),(0,S.jsx)(rE,{...s,children:(0,S.jsx)(n0,{scope:t,open:r,onOpenChange:d,content:l,onContentChange:u,children:(0,S.jsx)(n2,{scope:t,onClose:k.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:c,dir:p,modal:o,children:n})})})};n3.displayName=nq;var n4=k.forwardRef((e,t)=>{let{__scopeMenu:r,...n}=e,i=nY(r);return(0,S.jsx)(rI,{...i,...n,ref:t})});n4.displayName="MenuAnchor";var n6="MenuPortal",[n8,n7]=nX(n6,{forceMount:void 0}),n9=e=>{let{__scopeMenu:t,forceMount:r,children:n,container:i}=e,a=n1(n6,t);return(0,S.jsx)(n8,{scope:t,forceMount:r,children:(0,S.jsx)(rF,{present:r||a.open,children:(0,S.jsx)(rB,{asChild:!0,container:i,children:n})})})};n9.displayName=n6;var ie="MenuContent",[it,ir]=nX(ie),ii=k.forwardRef((e,t)=>{let r=n7(ie,e.__scopeMenu),{forceMount:n=r.forceMount,...i}=e,a=n1(ie,e.__scopeMenu),o=n5(ie,e.__scopeMenu);return(0,S.jsx)(nV.Provider,{scope:e.__scopeMenu,children:(0,S.jsx)(rF,{present:n||a.open,children:(0,S.jsx)(nV.Slot,{scope:e.__scopeMenu,children:o.modal?(0,S.jsx)(ia,{...i,ref:t}):(0,S.jsx)(io,{...i,ref:t})})})})}),ia=k.forwardRef((e,t)=>{let r=n1(ie,e.__scopeMenu),n=k.useRef(null),i=eL(t,n);return k.useEffect(()=>{let e=n.current;if(e)return nt(e)},[]),(0,S.jsx)(il,{...e,ref:i,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:eP(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),io=k.forwardRef((e,t)=>{let r=n1(ie,e.__scopeMenu);return(0,S.jsx)(il,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),is=eF("MenuContent.ScrollLock"),il=k.forwardRef((e,t)=>{let{__scopeMenu:r,loop:n=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEntryFocus:l,onEscapeKeyDown:u,onPointerDownOutside:c,onFocusOutside:d,onInteractOutside:p,onDismiss:f,disableOutsideScroll:h,...m}=e,g=n1(ie,r),y=n5(ie,r),v=nY(r),b=nZ(r),x=nQ(r),[w,C]=k.useState(null),_=k.useRef(null),A=eL(t,_,g.onContentChange),E=k.useRef(0),N=k.useRef(""),I=k.useRef(0),T=k.useRef(null),R=k.useRef("right"),P=k.useRef(0),M=h?nB:k.Fragment;k.useEffect(()=>()=>window.clearTimeout(E.current),[]),k.useEffect(()=>{let e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??e4()),document.body.insertAdjacentElement("beforeend",e[1]??e4()),e3++,()=>{1===e3&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),e3--}},[]);let j=k.useCallback(e=>{var t,r;return R.current===T.current?.side&&(t=e,!!(r=T.current?.area)&&function(e,t){let{x:r,y:n}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],l=o.x,u=o.y,c=s.x,d=s.y;u>n!=d>n&&r<(c-l)*(n-u)/(d-u)+l&&(i=!i)}return i}({x:t.clientX,y:t.clientY},r))},[]);return(0,S.jsx)(it,{scope:r,searchRef:N,onItemEnter:k.useCallback(e=>{j(e)&&e.preventDefault()},[j]),onItemLeave:k.useCallback(e=>{j(e)||(_.current?.focus(),C(null))},[j]),onTriggerLeave:k.useCallback(e=>{j(e)&&e.preventDefault()},[j]),pointerGraceTimerRef:I,onPointerGraceIntentChange:k.useCallback(e=>{T.current=e},[]),children:(0,S.jsx)(M,{...h?{as:is,allowPinchZoom:!0}:void 0,children:(0,S.jsx)(e9,{asChild:!0,trapped:i,onMountAutoFocus:eP(a,e=>{e.preventDefault(),_.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,S.jsx)(e1,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:u,onPointerDownOutside:c,onFocusOutside:d,onInteractOutside:p,onDismiss:f,children:(0,S.jsx)(rZ,{asChild:!0,...b,dir:y.dir,orientation:"vertical",loop:n,currentTabStopId:w,onCurrentTabStopIdChange:C,onEntryFocus:eP(l,e=>{y.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,S.jsx)(rM,{role:"menu","aria-orientation":"vertical","data-state":iD(g.open),"data-radix-menu-content":"",dir:y.dir,...v,...m,ref:A,style:{outline:"none",...m.style},onKeyDown:eP(m.onKeyDown,e=>{let t=e.target.closest("[data-radix-menu-content]")===e.currentTarget,r=e.ctrlKey||e.altKey||e.metaKey,n=1===e.key.length;if(t){var i;let t,a,o,s,l,u;"Tab"===e.key&&e.preventDefault(),!r&&n&&(i=e.key,t=N.current+i,a=x().filter(e=>!e.disabled),o=document.activeElement,s=a.find(e=>e.ref.current===o)?.textValue,l=function(e,t,r){var n;let i=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,a=r?e.indexOf(r):-1,o=(n=Math.max(a,0),e.map((t,r)=>e[(n+r)%e.length]));1===i.length&&(o=o.filter(e=>e!==r));let s=o.find(e=>e.toLowerCase().startsWith(i.toLowerCase()));return s!==r?s:void 0}(a.map(e=>e.textValue),t,s),u=a.find(e=>e.textValue===l)?.ref.current,function e(t){N.current=t,window.clearTimeout(E.current),""!==t&&(E.current=window.setTimeout(()=>e(""),1e3))}(t),u&&setTimeout(()=>u.focus()))}let a=_.current;if(e.target!==a||!nU.includes(e.key))return;e.preventDefault();let o=x().filter(e=>!e.disabled).map(e=>e.ref.current);nG.includes(e.key)&&o.reverse(),function(e){let t=document.activeElement;for(let r of e)if(r===t||(r.focus(),document.activeElement!==t))return}(o)}),onBlur:eP(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(E.current),N.current="")}),onPointerMove:eP(e.onPointerMove,iB(e=>{let t=e.target,r=P.current!==e.clientX;e.currentTarget.contains(t)&&r&&(R.current=e.clientX>P.current?"right":"left",P.current=e.clientX)}))})})})})})})});ii.displayName=ie;var iu=k.forwardRef((e,t)=>{let{__scopeMenu:r,...n}=e;return(0,S.jsx)(eW.div,{role:"group",...n,ref:t})});iu.displayName="MenuGroup";var ic=k.forwardRef((e,t)=>{let{__scopeMenu:r,...n}=e;return(0,S.jsx)(eW.div,{...n,ref:t})});ic.displayName="MenuLabel";var id="MenuItem",ip="menu.itemSelect",ih=k.forwardRef((e,t)=>{let{disabled:r=!1,onSelect:n,...i}=e,a=k.useRef(null),o=n5(id,e.__scopeMenu),s=ir(id,e.__scopeMenu),l=eL(t,a),u=k.useRef(!1);return(0,S.jsx)(im,{...i,ref:l,disabled:r,onClick:eP(e.onClick,()=>{let e=a.current;if(!r&&e){let t=new CustomEvent(ip,{bubbles:!0,cancelable:!0});e.addEventListener(ip,e=>n?.(e),{once:!0}),eH(e,t),t.defaultPrevented?u.current=!1:o.onClose()}}),onPointerDown:t=>{e.onPointerDown?.(t),u.current=!0},onPointerUp:eP(e.onPointerUp,e=>{u.current||e.currentTarget?.click()}),onKeyDown:eP(e.onKeyDown,e=>{let t=""!==s.searchRef.current;r||t&&" "===e.key||nF.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});ih.displayName=id;var im=k.forwardRef((e,t)=>{let{__scopeMenu:r,disabled:n=!1,textValue:i,...a}=e,o=ir(id,r),s=nZ(r),l=k.useRef(null),u=eL(t,l),[c,d]=k.useState(!1),[p,f]=k.useState("");return k.useEffect(()=>{let e=l.current;e&&f((e.textContent??"").trim())},[a.children]),(0,S.jsx)(nV.ItemSlot,{scope:r,disabled:n,textValue:i??p,children:(0,S.jsx)(r2,{asChild:!0,...s,focusable:!n,children:(0,S.jsx)(eW.div,{role:"menuitem","data-highlighted":c?"":void 0,"aria-disabled":n||void 0,"data-disabled":n?"":void 0,...a,ref:u,onPointerMove:eP(e.onPointerMove,iB(e=>{n?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:eP(e.onPointerLeave,iB(e=>o.onItemLeave(e))),onFocus:eP(e.onFocus,()=>d(!0)),onBlur:eP(e.onBlur,()=>d(!1))})})})}),ig=k.forwardRef((e,t)=>{let{checked:r=!1,onCheckedChange:n,...i}=e;return(0,S.jsx)(ik,{scope:e.__scopeMenu,checked:r,children:(0,S.jsx)(ih,{role:"menuitemcheckbox","aria-checked":i$(r)?"mixed":r,...i,ref:t,"data-state":iz(r),onSelect:eP(i.onSelect,()=>n?.(!!i$(r)||!r),{checkForDefaultPrevented:!1})})})});ig.displayName="MenuCheckboxItem";var iy="MenuRadioGroup",[iv,ib]=nX(iy,{value:void 0,onValueChange:()=>{}}),ix=k.forwardRef((e,t)=>{let{value:r,onValueChange:n,...i}=e,a=eY(n);return(0,S.jsx)(iv,{scope:e.__scopeMenu,value:r,onValueChange:a,children:(0,S.jsx)(iu,{...i,ref:t})})});ix.displayName=iy;var iw="MenuRadioItem",iS=k.forwardRef((e,t)=>{let{value:r,...n}=e,i=ib(iw,e.__scopeMenu),a=r===i.value;return(0,S.jsx)(ik,{scope:e.__scopeMenu,checked:a,children:(0,S.jsx)(ih,{role:"menuitemradio","aria-checked":a,...n,ref:t,"data-state":iz(a),onSelect:eP(n.onSelect,()=>i.onValueChange?.(r),{checkForDefaultPrevented:!1})})})});iS.displayName=iw;var iC="MenuItemIndicator",[ik,i_]=nX(iC,{checked:!1}),iA=k.forwardRef((e,t)=>{let{__scopeMenu:r,forceMount:n,...i}=e,a=i_(iC,r);return(0,S.jsx)(rF,{present:n||i$(a.checked)||!0===a.checked,children:(0,S.jsx)(eW.span,{...i,ref:t,"data-state":iz(a.checked)})})});iA.displayName=iC;var iE=k.forwardRef((e,t)=>{let{__scopeMenu:r,...n}=e;return(0,S.jsx)(eW.div,{role:"separator","aria-orientation":"horizontal",...n,ref:t})});iE.displayName="MenuSeparator";var iN=k.forwardRef((e,t)=>{let{__scopeMenu:r,...n}=e,i=nY(r);return(0,S.jsx)(rO,{...i,...n,ref:t})});iN.displayName="MenuArrow";var iI="MenuSub",[iT,iR]=nX(iI),iP=e=>{let{__scopeMenu:t,children:r,open:n=!1,onOpenChange:i}=e,a=n1(iI,t),o=nY(t),[s,l]=k.useState(null),[u,c]=k.useState(null),d=eY(i);return k.useEffect(()=>(!1===a.open&&d(!1),()=>d(!1)),[a.open,d]),(0,S.jsx)(rE,{...o,children:(0,S.jsx)(n0,{scope:t,open:n,onOpenChange:d,content:u,onContentChange:c,children:(0,S.jsx)(iT,{scope:t,contentId:ts(),triggerId:ts(),trigger:s,onTriggerChange:l,children:r})})})};iP.displayName=iI;var iM="MenuSubTrigger",ij=k.forwardRef((e,t)=>{let r=n1(iM,e.__scopeMenu),n=n5(iM,e.__scopeMenu),i=iR(iM,e.__scopeMenu),a=ir(iM,e.__scopeMenu),o=k.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:l}=a,u={__scopeMenu:e.__scopeMenu},c=k.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return k.useEffect(()=>c,[c]),k.useEffect(()=>{let e=s.current;return()=>{window.clearTimeout(e),l(null)}},[s,l]),(0,S.jsx)(n4,{asChild:!0,...u,children:(0,S.jsx)(im,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":i.contentId,"data-state":iD(r.open),...e,ref:ej(t,i.onTriggerChange),onClick:t=>{e.onClick?.(t),e.disabled||t.defaultPrevented||(t.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:eP(e.onPointerMove,iB(t=>{a.onItemEnter(t),!t.defaultPrevented&&(e.disabled||r.open||o.current||(a.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{r.onOpenChange(!0),c()},100)))})),onPointerLeave:eP(e.onPointerLeave,iB(e=>{c();let t=r.content?.getBoundingClientRect();if(t){let n=r.content?.dataset.side,i="right"===n,o=t[i?"left":"right"],l=t[i?"right":"left"];a.onPointerGraceIntentChange({area:[{x:e.clientX+(i?-5:5),y:e.clientY},{x:o,y:t.top},{x:l,y:t.top},{x:l,y:t.bottom},{x:o,y:t.bottom}],side:n}),window.clearTimeout(s.current),s.current=window.setTimeout(()=>a.onPointerGraceIntentChange(null),300)}else{if(a.onTriggerLeave(e),e.defaultPrevented)return;a.onPointerGraceIntentChange(null)}})),onKeyDown:eP(e.onKeyDown,t=>{let i=""!==a.searchRef.current;e.disabled||i&&" "===t.key||nW[n.dir].includes(t.key)&&(r.onOpenChange(!0),r.content?.focus(),t.preventDefault())})})})});ij.displayName=iM;var iL="MenuSubContent",iO=k.forwardRef((e,t)=>{let r=n7(ie,e.__scopeMenu),{forceMount:n=r.forceMount,...i}=e,a=n1(ie,e.__scopeMenu),o=n5(ie,e.__scopeMenu),s=iR(iL,e.__scopeMenu),l=k.useRef(null),u=eL(t,l);return(0,S.jsx)(nV.Provider,{scope:e.__scopeMenu,children:(0,S.jsx)(rF,{present:n||a.open,children:(0,S.jsx)(nV.Slot,{scope:e.__scopeMenu,children:(0,S.jsx)(il,{id:s.contentId,"aria-labelledby":s.triggerId,...i,ref:u,align:"start",side:"rtl"===o.dir?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{o.isUsingKeyboardRef.current&&l.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:eP(e.onFocusOutside,e=>{e.target!==s.trigger&&a.onOpenChange(!1)}),onEscapeKeyDown:eP(e.onEscapeKeyDown,e=>{o.onClose(),e.preventDefault()}),onKeyDown:eP(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),r=nH[o.dir].includes(e.key);t&&r&&(a.onOpenChange(!1),s.trigger?.focus(),e.preventDefault())})})})})})});function iD(e){return e?"open":"closed"}function i$(e){return"indeterminate"===e}function iz(e){return i$(e)?"indeterminate":e?"checked":"unchecked"}function iB(e){return t=>"mouse"===t.pointerType?e(t):void 0}iO.displayName=iL;var iF="DropdownMenu",[iG,iU]=eO(iF,[nJ]),iW=nJ(),[iH,iq]=iG(iF),iV=e=>{let{__scopeDropdownMenu:t,children:r,dir:n,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,l=iW(t),u=k.useRef(null),[c,d]=ez({prop:i,defaultProp:a??!1,onChange:o,caller:iF});return(0,S.jsx)(iH,{scope:t,triggerId:ts(),triggerRef:u,contentId:ts(),open:c,onOpenChange:d,onOpenToggle:k.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,S.jsx)(n3,{...l,open:c,onOpenChange:d,dir:n,modal:s,children:r})})};iV.displayName=iF;var iQ="DropdownMenuTrigger",iK=k.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,disabled:n=!1,...i}=e,a=iq(iQ,r),o=iW(r);return(0,S.jsx)(n4,{asChild:!0,...o,children:(0,S.jsx)(eW.button,{type:"button",id:a.triggerId,"aria-haspopup":"menu","aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?"open":"closed","data-disabled":n?"":void 0,disabled:n,...i,ref:ej(t,a.triggerRef),onPointerDown:eP(e.onPointerDown,e=>{!n&&0===e.button&&!1===e.ctrlKey&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:eP(e.onKeyDown,e=>{!n&&(["Enter"," "].includes(e.key)&&a.onOpenToggle(),"ArrowDown"===e.key&&a.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(e.key)&&e.preventDefault())})})})});iK.displayName=iQ;var iX=e=>{let{__scopeDropdownMenu:t,...r}=e,n=iW(t);return(0,S.jsx)(n9,{...n,...r})};iX.displayName="DropdownMenuPortal";var iJ="DropdownMenuContent",iY=k.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,i=iq(iJ,r),a=iW(r),o=k.useRef(!1);return(0,S.jsx)(ii,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...n,ref:t,onCloseAutoFocus:eP(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:eP(e.onInteractOutside,e=>{let t=e.detail.originalEvent,r=0===t.button&&!0===t.ctrlKey,n=2===t.button||r;(!i.modal||n)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});iY.displayName=iJ;var iZ=k.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,i=iW(r);return(0,S.jsx)(iu,{...i,...n,ref:t})});iZ.displayName="DropdownMenuGroup";var i0=k.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,i=iW(r);return(0,S.jsx)(ic,{...i,...n,ref:t})});i0.displayName="DropdownMenuLabel";var i1=k.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,i=iW(r);return(0,S.jsx)(ih,{...i,...n,ref:t})});i1.displayName="DropdownMenuItem";var i2=k.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,i=iW(r);return(0,S.jsx)(ig,{...i,...n,ref:t})});i2.displayName="DropdownMenuCheckboxItem";var i5=k.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,i=iW(r);return(0,S.jsx)(ix,{...i,...n,ref:t})});i5.displayName="DropdownMenuRadioGroup";var i3=k.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,i=iW(r);return(0,S.jsx)(iS,{...i,...n,ref:t})});i3.displayName="DropdownMenuRadioItem";var i4=k.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,i=iW(r);return(0,S.jsx)(iA,{...i,...n,ref:t})});i4.displayName="DropdownMenuItemIndicator";var i6=k.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,i=iW(r);return(0,S.jsx)(iE,{...i,...n,ref:t})});i6.displayName="DropdownMenuSeparator";var i8=k.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,i=iW(r);return(0,S.jsx)(iN,{...i,...n,ref:t})});i8.displayName="DropdownMenuArrow";var i7=e=>{let{__scopeDropdownMenu:t,children:r,open:n,onOpenChange:i,defaultOpen:a}=e,o=iW(t),[s,l]=ez({prop:n,defaultProp:a??!1,onChange:i,caller:"DropdownMenuSub"});return(0,S.jsx)(iP,{...o,open:s,onOpenChange:l,children:r})},i9=k.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,i=iW(r);return(0,S.jsx)(ij,{...i,...n,ref:t})});i9.displayName="DropdownMenuSubTrigger";var ae=k.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,i=iW(r);return(0,S.jsx)(iO,{...i,...n,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});ae.displayName="DropdownMenuSubContent",e.s(["Arrow",()=>i8,"CheckboxItem",()=>i2,"Content",()=>iY,"DropdownMenu",()=>iV,"DropdownMenuArrow",()=>i8,"DropdownMenuCheckboxItem",()=>i2,"DropdownMenuContent",()=>iY,"DropdownMenuGroup",()=>iZ,"DropdownMenuItem",()=>i1,"DropdownMenuItemIndicator",()=>i4,"DropdownMenuLabel",()=>i0,"DropdownMenuPortal",()=>iX,"DropdownMenuRadioGroup",()=>i5,"DropdownMenuRadioItem",()=>i3,"DropdownMenuSeparator",()=>i6,"DropdownMenuSub",()=>i7,"DropdownMenuSubContent",()=>ae,"DropdownMenuSubTrigger",()=>i9,"DropdownMenuTrigger",()=>iK,"Group",()=>iZ,"Item",()=>i1,"ItemIndicator",()=>i4,"Label",()=>i0,"Portal",()=>iX,"RadioGroup",()=>i5,"RadioItem",()=>i3,"Root",()=>iV,"Separator",()=>i6,"Sub",()=>i7,"SubContent",()=>ae,"SubTrigger",()=>i9,"Trigger",()=>iK,"createDropdownMenuScope",()=>iU],40666);var at=e.i(40666),at=at,ar=e.i(7670),an=e.i(19056);function ai(...e){return(0,an.twMerge)((0,ar.clsx)(e))}function aa(e){let t,r,n=(0,C.c)(4);return n[0]!==e?({...t}=e,n[0]=e,n[1]=t):t=n[1],n[2]!==t?(r=(0,S.jsx)(at.Root,{"data-slot":"dropdown-menu",...t}),n[2]=t,n[3]=r):r=n[3],r}function ao(e){let t,r,n=(0,C.c)(4);return n[0]!==e?({...t}=e,n[0]=e,n[1]=t):t=n[1],n[2]!==t?(r=(0,S.jsx)(at.Trigger,{"data-slot":"dropdown-menu-trigger",...t}),n[2]=t,n[3]=r):r=n[3],r}function as(e){let t,r,n,i,a,o=(0,C.c)(10);o[0]!==e?({className:t,sideOffset:n,...r}=e,o[0]=e,o[1]=t,o[2]=r,o[3]=n):(t=o[1],r=o[2],n=o[3]);let s=void 0===n?4:n;return o[4]!==t?(i=ai("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-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 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",t),o[4]=t,o[5]=i):i=o[5],o[6]!==r||o[7]!==s||o[8]!==i?(a=(0,S.jsx)(at.Portal,{children:(0,S.jsx)(at.Content,{"data-slot":"dropdown-menu-content",sideOffset:s,className:i,...r})}),o[6]=r,o[7]=s,o[8]=i,o[9]=a):a=o[9],a}function al(e){let t,r,n,i,a,o,s=(0,C.c)(12);s[0]!==e?({className:t,inset:r,variant:i,...n}=e,s[0]=e,s[1]=t,s[2]=r,s[3]=n,s[4]=i):(t=s[1],r=s[2],n=s[3],i=s[4]);let l=void 0===i?"default":i;return s[5]!==t?(a=ai("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),s[5]=t,s[6]=a):a=s[6],s[7]!==r||s[8]!==n||s[9]!==a||s[10]!==l?(o=(0,S.jsx)(at.Item,{"data-slot":"dropdown-menu-item","data-inset":r,"data-variant":l,className:a,...n}),s[7]=r,s[8]=n,s[9]=a,s[10]=l,s[11]=o):o=s[11],o}let au=(...e)=>e.filter((e,t,r)=>!!e&&""!==e.trim()&&r.indexOf(e)===t).join(" ").trim(),ac=e=>{let t=e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,r)=>r?r.toUpperCase():t.toLowerCase());return t.charAt(0).toUpperCase()+t.slice(1)};var ad={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"};let ap=(0,k.forwardRef)(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:i="",children:a,iconNode:o,...s},l)=>(0,k.createElement)("svg",{ref:l,...ad,width:t,height:t,stroke:e,strokeWidth:n?24*Number(r)/Number(t):r,className:au("lucide",i),...!a&&!(e=>{for(let t in e)if(t.startsWith("aria-")||"role"===t||"title"===t)return!0;return!1})(s)&&{"aria-hidden":"true"},...s},[...o.map(([e,t])=>(0,k.createElement)(e,t)),...Array.isArray(a)?a:[a]])),af=(e,t)=>{let r=(0,k.forwardRef)(({className:r,...n},i)=>(0,k.createElement)(ap,{ref:i,iconNode:t,className:au(`lucide-${ac(e).replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,`lucide-${e}`,r),...n}));return r.displayName=ac(e),r},ah=af("ellipsis-vertical",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]]),am=af("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]),ag=af("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]),ay=af("sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]),av=af("moon",[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]]),ab=af("monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]);var ax=e.i(63178);let aw="application/x-sidebar-session",aS="application/x-pane-tab";function aC(e,t){let r=e.dataTransfer?.getData(t);if(!r)return null;try{return JSON.parse(r)}catch{return null}}let ak={"claude-code":{id:"claude-code",name:"Claude Code",shortLabel:"CLAUDE",description:"Anthropic's agentic coding assistant"},codex:{id:"codex",name:"Codex",shortLabel:"CODEX",description:"OpenAI's coding agent"}},a_=Object.values(ak);function aA(e){let t=(0,C.c)(6),{session:r,size:n,showDisconnected:i}=e,a="sm"===(void 0===n?"md":n)?"size-1.5":"size-2";if(r?.prompting){let e,r=`shrink-0 ${a} rounded-full bg-[var(--t-amber)] animate-pulse`;return t[0]!==r?(e=(0,S.jsx)("span",{className:r}),t[0]=r,t[1]=e):e=t[1],e}if(r?.connected){let e,r=`shrink-0 ${a} rounded-full bg-[var(--t-green)]`;return t[2]!==r?(e=(0,S.jsx)("span",{className:r}),t[2]=r,t[3]=e):e=t[3],e}if(void 0!==i&&i){let e,r=`shrink-0 ${a} rounded-full bg-[var(--t-dim)]/40`;return t[4]!==r?(e=(0,S.jsx)("span",{className:r}),t[4]=r,t[5]=e):e=t[5],e}return null}function aE(e){let t,r,n,i,a=(0,C.c)(20),{session:o,isHistory:s,isActive:l,isOpenInAnyPane:u,editingId:c,editValue:d,onEditValueChange:p,onEditKeyDown:f,onEditBlur:h,onClick:m,onStartRename:g,onDelete:y}=e;a[0]!==o.id?(t=e=>{e.dataTransfer.setData(aw,JSON.stringify({sessionId:o.id})),e.dataTransfer.effectAllowed="copyMove"},a[0]=o.id,a[1]=t):t=a[1];let v=t,b=c!==o.id;a[2]!==m?(r=e=>{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),m())},a[2]=m,a[3]=r):r=a[3];let x=`group flex items-center gap-2.5 px-3 py-2 cursor-pointer text-[13px] transition-colors ${l?"bg-[var(--t-elevated)] text-[var(--t-white)] border-l-2 border-l-[var(--t-accent)]":u?"bg-[var(--t-bg)]/50 text-[var(--t-text)] hover:bg-[var(--t-bg)] hover:text-[var(--t-bright)] border-l-2 border-l-[var(--t-dim)]":s?"text-[var(--t-muted)] hover:bg-[var(--t-bg)] hover:text-[var(--t-text)] border-l-2 border-l-transparent":"text-[var(--t-text)] hover:bg-[var(--t-bg)] hover:text-[var(--t-bright)] border-l-2 border-l-transparent"}`;return a[4]!==d||a[5]!==c||a[6]!==y||a[7]!==h||a[8]!==f||a[9]!==p||a[10]!==g||a[11]!==o?(n=c===o.id?(0,S.jsx)("input",{autoFocus:!0,value:d,onChange:e=>p(e.target.value),onFocus:aI,onKeyDown:f,onBlur:h,className:"flex-1 bg-[var(--t-bg)] text-[var(--t-white)] text-[13px] outline-none border border-[var(--t-dim)] rounded px-1.5 py-0.5",spellCheck:!1}):(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(aA,{session:o}),(0,S.jsx)("span",{className:"flex-1 truncate",children:o.name}),o.agent_type&&(0,S.jsx)("span",{className:"shrink-0 text-[10px] font-mono font-medium tracking-wide text-[var(--t-muted)]",children:ak[o.agent_type]?.shortLabel??o.agent_type.toUpperCase()}),(0,S.jsxs)(aa,{children:[(0,S.jsx)(ao,{asChild:!0,children:(0,S.jsx)("button",{onClick:aN,className:"opacity-0 group-hover:opacity-100 data-[state=open]:opacity-100 shrink-0 cursor-pointer text-[var(--t-dim)] hover:text-[var(--t-bright)] hover:bg-[var(--t-dim)]/20 data-[state=open]:text-[var(--t-bright)] data-[state=open]:bg-[var(--t-dim)]/20 transition-colors rounded px-0.5 py-1",children:(0,S.jsx)(ah,{className:"size-3"})})}),(0,S.jsxs)(as,{align:"start",side:"bottom",className:"min-w-32",children:[(0,S.jsx)(al,{onClick:e=>{e.stopPropagation(),g()},children:"Rename"}),(0,S.jsx)(al,{variant:"destructive",onClick:e=>{e.stopPropagation(),y()},children:"Delete"})]})]})]}),a[4]=d,a[5]=c,a[6]=y,a[7]=h,a[8]=f,a[9]=p,a[10]=g,a[11]=o,a[12]=n):n=a[12],a[13]!==v||a[14]!==m||a[15]!==b||a[16]!==r||a[17]!==x||a[18]!==n?(i=(0,S.jsx)("div",{role:"button",tabIndex:0,draggable:b,onDragStart:v,onClick:m,onKeyDown:r,className:x,children:n}),a[13]=v,a[14]=m,a[15]=b,a[16]=r,a[17]=x,a[18]=n,a[19]=i):i=a[19],i}function aN(e){return e.stopPropagation()}function aI(e){return e.target.select()}function aT(){let e,t,r,n,i,a,o,s,l,u,c,d,p,f,h,m,g,y,v=(0,C.c)(78),{sessions:b,showSetup:x,backendStatus:w,createSession:_,deleteSession:A,renameSession:E}=ew(),{layout:N,openSessionInFocusedPane:I}=eE(),{theme:T,setTheme:R,resolvedTheme:P}=(0,ax.useTheme)(),[M,j]=(0,k.useState)(!1);v[0]===Symbol.for("react.memo_cache_sentinel")?(e=()=>j(!0),t=[],v[0]=e,v[1]=t):(e=v[0],t=v[1]),(0,k.useEffect)(e,t);let[L,O]=(0,k.useState)(null),[D,$]=(0,k.useState)(""),[z,B]=(0,k.useState)(!1);v[2]!==w?(r=()=>{if("checking"!==w)return;let e=setTimeout(()=>B(!0),2e3);return()=>clearTimeout(e)},n=[w],v[2]=w,v[3]=r,v[4]=n):(r=v[3],n=v[4]),(0,k.useEffect)(r,n),z&&"checking"!==w&&B(!1),v[5]===Symbol.for("react.memo_cache_sentinel")?(i=(e,t)=>{O(e),$(t)},v[5]=i):i=v[5];let F=i;v[6]!==D||v[7]!==L||v[8]!==E?(a=()=>{L&&D.trim()&&E(L,D.trim()),O(null)},v[6]=D,v[7]=L,v[8]=E,v[9]=a):a=v[9];let G=a;v[10]!==G?(o=e=>{"Enter"===e.key&&G(),"Escape"===e.key&&O(null)},v[10]=G,v[11]=o):o=v[11];let U=o;if(v[12]!==G||v[13]!==_||v[14]!==A||v[15]!==D||v[16]!==L||v[17]!==U||v[18]!==N.focusedPaneId||v[19]!==N.panes||v[20]!==I||v[21]!==b||v[22]!==z||v[23]!==x){let e,t,r,n,i,a,o,f,h=b.filter(aj).sort(aM),m=b.filter(aP).sort(aR);if(v[30]!==N.focusedPaneId||v[31]!==N.panes){let t;v[33]!==N.focusedPaneId?(t=e=>e.id===N.focusedPaneId,v[33]=N.focusedPaneId,v[34]=t):t=v[34],e=N.panes.find(t),v[30]=N.focusedPaneId,v[31]=N.panes,v[32]=e}else e=v[32];let g=e;l="flex h-full w-56 min-h-0 flex-col bg-[var(--t-surface)] border-r border-[var(--t-border)]",v[35]===Symbol.for("react.memo_cache_sentinel")?(t=(0,S.jsx)("span",{className:"text-xs font-semibold text-[var(--t-bright)]",children:"AgentPane"}),v[35]=t):t=v[35],v[36]!==z?(r=z&&(0,S.jsx)(am,{className:"size-3 animate-spin text-[var(--t-dim)]"}),v[36]=z,v[37]=r):r=v[37],v[38]!==r?(n=(0,S.jsxs)("div",{className:"flex h-10 items-center justify-between px-4 border-b border-[var(--t-border)]",children:[t,r]}),v[38]=r,v[39]=n):n=v[39],v[40]!==_?(i=()=>_(),v[40]=_,v[41]=i):i=v[41];let y=`flex w-full items-center justify-center gap-1.5 rounded-md border px-3 py-2 text-xs font-medium transition-colors cursor-pointer ${x?"border-[var(--t-accent)] bg-[var(--t-accent)]/10 text-[var(--t-accent)]":"border-[var(--t-border)] bg-[var(--t-bg)] text-[var(--t-text)] hover:bg-[var(--t-elevated)] hover:text-[var(--t-bright)] hover:border-[var(--t-dim)]"}`;v[42]===Symbol.for("react.memo_cache_sentinel")?(a=(0,S.jsx)(ag,{className:"size-3.5"}),v[42]=a):a=v[42],v[43]!==i||v[44]!==y?(o=(0,S.jsx)("div",{className:"px-3 pt-3 pb-2",children:(0,S.jsxs)("button",{onClick:i,className:y,children:[a,"New Session"]})}),v[43]=i,v[44]=y,v[45]=o):o=v[45],v[46]!==n||v[47]!==o?(u=(0,S.jsxs)("div",{className:"shrink-0",children:[n,o]}),v[46]=n,v[47]=o,v[48]=u):u=v[48],s="flex-1 min-h-0 overflow-y-auto",c="py-1",v[49]!==G||v[50]!==A||v[51]!==D||v[52]!==L||v[53]!==g?.activeTabSessionId||v[54]!==U||v[55]!==N.panes||v[56]!==I||v[57]!==x?(f=e=>(0,S.jsx)(aE,{session:e,isHistory:!1,isActive:g?.activeTabSessionId===e.id&&!x,isOpenInAnyPane:N.panes.some(t=>t.tabSessionIds.includes(e.id)),editingId:L,editValue:D,onEditValueChange:$,onEditKeyDown:U,onEditBlur:G,onClick:()=>I(e.id),onStartRename:()=>F(e.id,e.name),onDelete:()=>A(e.id)},e.id),v[49]=G,v[50]=A,v[51]=D,v[52]=L,v[53]=g?.activeTabSessionId,v[54]=U,v[55]=N.panes,v[56]=I,v[57]=x,v[58]=f):f=v[58],d=h.map(f),p=m.length>0&&(0,S.jsxs)(S.Fragment,{children:[h.length>0&&(0,S.jsx)("div",{className:"mx-3 my-2 border-t border-[var(--t-border)]"}),(0,S.jsx)("div",{className:"px-3 py-1.5",children:(0,S.jsx)("span",{className:"text-[10px] font-medium uppercase tracking-wider text-[var(--t-dim)]",children:"History"})}),m.map(e=>(0,S.jsx)(aE,{session:e,isHistory:!0,isActive:g?.activeTabSessionId===e.id&&!x,isOpenInAnyPane:N.panes.some(t=>t.tabSessionIds.includes(e.id)),editingId:L,editValue:D,onEditValueChange:$,onEditKeyDown:U,onEditBlur:G,onClick:()=>I(e.id),onStartRename:()=>F(e.id,e.name),onDelete:()=>A(e.id)},e.id))]}),v[12]=G,v[13]=_,v[14]=A,v[15]=D,v[16]=L,v[17]=U,v[18]=N.focusedPaneId,v[19]=N.panes,v[20]=I,v[21]=b,v[22]=z,v[23]=x,v[24]=s,v[25]=l,v[26]=u,v[27]=c,v[28]=d,v[29]=p}else s=v[24],l=v[25],u=v[26],c=v[27],d=v[28],p=v[29];return v[59]!==c||v[60]!==d||v[61]!==p?(f=(0,S.jsxs)("div",{className:c,children:[d,p]}),v[59]=c,v[60]=d,v[61]=p,v[62]=f):f=v[62],v[63]!==s||v[64]!==f?(h=(0,S.jsx)("div",{className:s,children:f}),v[63]=s,v[64]=f,v[65]=h):h=v[65],v[66]!==M||v[67]!==P||v[68]!==R||v[69]!==T?(m=M&&(0,S.jsxs)("button",{onClick:()=>R("dark"===T?"light":"light"===T?"system":"dark"),className:"flex items-center gap-2 text-xs text-[var(--t-muted)] hover:text-[var(--t-bright)] transition-colors cursor-pointer",title:`Theme: ${T}`,children:["dark"===P?(0,S.jsx)(av,{className:"size-3.5"}):"light"===P?(0,S.jsx)(ay,{className:"size-3.5"}):(0,S.jsx)(ab,{className:"size-3.5"}),(0,S.jsx)("span",{className:"capitalize",children:T})]}),v[66]=M,v[67]=P,v[68]=R,v[69]=T,v[70]=m):m=v[70],v[71]!==m?(g=(0,S.jsx)("div",{className:"shrink-0 h-12 flex items-center px-3 border-t border-[var(--t-border)]",children:m}),v[71]=m,v[72]=g):g=v[72],v[73]!==l||v[74]!==u||v[75]!==h||v[76]!==g?(y=(0,S.jsxs)("div",{className:l,children:[u,h,g]}),v[73]=l,v[74]=u,v[75]=h,v[76]=g,v[77]=y):y=v[77],y}function aR(e,t){return t.created_at-e.created_at}function aP(e){return!e.connected}function aM(e,t){return t.created_at-e.created_at}function aj(e){return e.connected}function aL({groupSize:e,panelElement:t,styleProp:r}){let n,[i,a]=function(e){switch(typeof e){case"number":return[e,"px"];case"string":{let t=parseFloat(e);return e.endsWith("%")?[t,"%"]:e.endsWith("px")?[t,"px"]:e.endsWith("rem")?[t,"rem"]:e.endsWith("em")?[t,"em"]:e.endsWith("vh")?[t,"vh"]:e.endsWith("vw")?[t,"vw"]:[t,"%"]}}}(r);switch(a){case"%":n=i/100*e;break;case"px":n=i;break;case"rem":n=i*parseFloat(getComputedStyle(t.ownerDocument.body).fontSize);break;case"em":n=i*parseFloat(getComputedStyle(t).fontSize);break;case"vh":n=i/100*window.innerHeight;break;case"vw":n=i/100*window.innerWidth}return n}function aO(e){return parseFloat(e.toFixed(3))}function aD({group:e}){let{orientation:t,panels:r}=e;return r.reduce((e,r)=>e+="horizontal"===t?r.element.offsetWidth:r.element.offsetHeight,0)}function a$(e){let{panels:t}=e,r=aD({group:e});return 0===r?t.map(e=>({collapsedSize:0,collapsible:!0===e.panelConstraints.collapsible,defaultSize:void 0,disabled:e.panelConstraints.disabled,minSize:0,maxSize:100,panelId:e.id})):t.map(e=>{let t,{element:n,panelConstraints:i}=e,a=0;void 0!==i.collapsedSize&&(a=aO(aL({groupSize:r,panelElement:n,styleProp:i.collapsedSize})/r*100)),void 0!==i.defaultSize&&(t=aO(aL({groupSize:r,panelElement:n,styleProp:i.defaultSize})/r*100));let o=0;void 0!==i.minSize&&(o=aO(aL({groupSize:r,panelElement:n,styleProp:i.minSize})/r*100));let s=100;return void 0!==i.maxSize&&(s=aO(aL({groupSize:r,panelElement:n,styleProp:i.maxSize})/r*100)),{collapsedSize:a,collapsible:!0===i.collapsible,defaultSize:t,disabled:i.disabled,minSize:o,maxSize:s,panelId:e.id}})}function az(e,t="Assertion error"){if(!e)throw Error(t)}function aB(e,t){return Array.from(t).sort("horizontal"===e?aF:aG)}function aF(e,t){let r=e.element.offsetLeft-t.element.offsetLeft;return 0!==r?r:e.element.offsetWidth-t.element.offsetWidth}function aG(e,t){let r=e.element.offsetTop-t.element.offsetTop;return 0!==r?r:e.element.offsetHeight-t.element.offsetHeight}function aU(e){return null!==e&&"object"==typeof e&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function aW(e,t){return{x:e.x>=t.left&&e.x<=t.right?0:Math.min(Math.abs(e.x-t.left),Math.abs(e.x-t.right)),y:e.y>=t.top&&e.y<=t.bottom?0:Math.min(Math.abs(e.y-t.top),Math.abs(e.y-t.bottom))}}function aH(e){let{element:r,orientation:n,panels:i,separators:a}=e,o=aB(n,Array.from(r.children).filter(aU).map(e=>({element:e}))).map(({element:e})=>e),s=[],l=!1,u=!1,c=-1,d=-1,p=0,f,h=[];{let e=-1;for(let t of o)t.hasAttribute("data-panel")&&(e++,null===t.ariaDisabled&&(p++,-1===c&&(c=e),d=e))}if(p>1){let r=-1;for(let p of o)if(p.hasAttribute("data-panel")){r++;let a=i.find(e=>e.element===p);if(a){if(f){let i,o=f.element.getBoundingClientRect(),m=p.getBoundingClientRect();if(u){let e="horizontal"===n?new DOMRect(o.right,o.top,0,o.height):new DOMRect(o.left,o.bottom,o.width,0),t="horizontal"===n?new DOMRect(m.left,m.top,0,m.height):new DOMRect(m.left,m.top,m.width,0);switch(h.length){case 0:i=[e,t];break;case 1:{let r=h[0],a=function({orientation:e,rects:t,targetRect:r}){let n={x:r.x+r.width/2,y:r.y+r.height/2},i,a=Number.MAX_VALUE;for(let r of t){let{x:t,y:o}=aW(n,r),s="horizontal"===e?t:o;s<a&&(a=s,i=r)}return az(i,"No rect found"),i}({orientation:n,rects:[o,m],targetRect:r.element.getBoundingClientRect()});i=[r,a===o?t:e];break}default:i=h}}else i=h.length?h:["horizontal"===n?new DOMRect(o.right,m.top,m.left-o.right,m.height):new DOMRect(m.left,o.bottom,m.width,m.top-o.bottom)];for(let n of i){let i="width"in n?n:n.element.getBoundingClientRect(),o=(void 0===t&&(t="function"==typeof matchMedia&&!!matchMedia("(pointer:coarse)").matches),t)?e.resizeTargetMinimumSize.coarse:e.resizeTargetMinimumSize.fine;if(i.width<o){let e=o-i.width;i=new DOMRect(i.x-e/2,i.y,i.width+e,i.height)}if(i.height<o){let e=o-i.height;i=new DOMRect(i.x,i.y-e/2,i.width,i.height+e)}let u=r<=c||r>d;l||u||s.push({group:e,groupSize:aD({group:e}),panels:[f,a],separator:"width"in n?void 0:n,rect:i}),l=!1}}u=!1,f=a,h=[]}}else if(p.hasAttribute("data-separator")){null!==p.ariaDisabled&&(l=!0);let e=a.find(e=>e.element===p);e?h.push(e):(f=void 0,h=[])}else u=!0}return s}function aq(e,t,r=0){return Math.abs(aO(e)-aO(t))<=r}let aV={cursorFlags:0,interactionState:{state:"inactive"},mountedGroups:new Map},aQ=new class{#N={};addListener(e,t){let r=this.#N[e];return void 0===r?this.#N[e]=[t]:r.includes(t)||r.push(t),()=>{this.removeListener(e,t)}}emit(e,t){let r=this.#N[e];if(void 0!==r)if(1===r.length)r[0].call(null,t);else{let e=!1,n=null,i=Array.from(r);for(let r=0;r<i.length;r++){let a=i[r];try{a.call(null,t)}catch(t){null===n&&(e=!0,n=t)}}if(e)throw n}}removeAllListeners(){this.#N={}}removeListener(e,t){let r=this.#N[e];if(void 0!==r){let e=r.indexOf(t);e>=0&&r.splice(e,1)}}};function aK(e){let t="function"==typeof e?e(aV):e;if(aV===t)return aV;let r=aV;return aV={...aV,...t},void 0!==t.cursorFlags&&aQ.emit("cursorFlagsChange",aV.cursorFlags),void 0!==t.interactionState&&aQ.emit("interactionStateChange",aV.interactionState),void 0!==t.mountedGroups&&(aV.mountedGroups.forEach((e,t)=>{e.derivedPanelConstraints.forEach(n=>{if(n.collapsible){let{layout:i}=r.mountedGroups.get(t)??{};if(i){let r=aq(n.collapsedSize,e.layout[n.panelId]),a=aq(n.collapsedSize,i[n.panelId]);r&&!a&&(t.inMemoryLastExpandedPanelSizes[n.panelId]=i[n.panelId])}}})}),aQ.emit("mountedGroupsChange",aV.mountedGroups)),aV}let aX=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function aJ(e){let t=e.length;for(;t--;){let r=e[t];if(az(r,"Missing node"),function(e){let t,r=getComputedStyle(e);return!!("fixed"===r.position||"auto"!==r.zIndex&&("static"!==r.position||"flex"===(t=getComputedStyle(a0(e)??e).display)||"inline-flex"===t)||1>+r.opacity||"transform"in r&&"none"!==r.transform||"webkitTransform"in r&&"none"!==r.webkitTransform||"mixBlendMode"in r&&"normal"!==r.mixBlendMode||"filter"in r&&"none"!==r.filter||"webkitFilter"in r&&"none"!==r.webkitFilter||"isolation"in r&&"isolate"===r.isolation||aX.test(r.willChange)||"touch"===r.webkitOverflowScrolling)}(r))return r}return null}function aY(e){return e&&Number(getComputedStyle(e).zIndex)||0}function aZ(e){let t=[];for(;e;)t.push(e),e=a0(e);return t}function a0(e){let{parentNode:t}=e;return null!==t&&"object"==typeof t&&"nodeType"in t&&t.nodeType===Node.DOCUMENT_FRAGMENT_NODE?t.host:t}function a1(e,t){let r=[];return t.forEach((t,n)=>{if(n.disabled)return;let i=aH(n),a=function(e,t,r){let n,i={x:1/0,y:1/0};for(let a of t){let t=aW(r,a.rect);switch(e){case"horizontal":t.x<=i.x&&(n=a,i=t);break;case"vertical":t.y<=i.y&&(n=a,i=t)}}return n?{distance:i,hitRegion:n}:void 0}(n.orientation,i,{x:e.clientX,y:e.clientY});a&&a.distance.x<=0&&a.distance.y<=0&&function({groupElement:e,hitRegion:t,pointerEventTarget:r}){if(!aU(r)||r.contains(e)||e.contains(r))return!0;if(function(e,t){let r;if(e===t)throw Error("Cannot compare node with itself");let n={a:aZ(e),b:aZ(t)};for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();az(r,"Stacking order can only be calculated for elements with a common ancestor");let i={a:aY(aJ(n.a)),b:aY(aJ(n.b))};if(i.a===i.b){let e=r.childNodes,t={a:n.a.at(-1),b:n.b.at(-1)},i=e.length;for(;i--;){let r=e[i];if(r===t.a)return 1;if(r===t.b)return -1}}return Math.sign(i.a-i.b)}(r,e)>0){let i=r;for(;i;){var n;if(i.contains(e))break;if(n=i.getBoundingClientRect(),n.x<t.x+t.width&&n.x+n.width>t.x&&n.y<t.y+t.height&&n.y+n.height>t.y)return!1;i=i.parentElement}}return!0}({groupElement:n.element,hitRegion:a.hitRegion.rect,pointerEventTarget:e.target})&&r.push(a.hitRegion)}),r}function a2(e,t){return aq(e,t)?0:e>t?1:-1}function a5({overrideDisabledPanels:e,panelConstraints:t,prevSize:r,size:n}){let{collapsedSize:i=0,collapsible:a,disabled:o,maxSize:s=100,minSize:l=0}=t;return o&&!e?r:(0>a2(n,l)&&(n=a&&0>a2(n,(i+l)/2)?i:l),aO(n=Math.min(s,n)))}function a3({delta:e,initialLayout:t,panelConstraints:r,pivotIndices:n,prevLayout:i,trigger:a}){if(aq(e,0))return t;let o="imperative-api"===a,s=Object.values(t),l=Object.values(i),u=[...s],[c,d]=n;az(null!=c,"Invalid first pivot index"),az(null!=d,"Invalid second pivot index");let p=0;if("keyboard"===a){{let t=e<0?d:c,n=r[t];az(n,`Panel constraints not found for index ${t}`);let{collapsedSize:i=0,collapsible:a,minSize:o=0}=n;if(a){let r=s[t];if(az(null!=r,`Previous layout not found for panel index ${t}`),aq(r,i)){let t=o-r;a2(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{let t=e<0?c:d,n=r[t];az(n,`No panel constraints found for index ${t}`);let{collapsedSize:i=0,collapsible:a,minSize:o=0}=n;if(a){let r=s[t];if(az(null!=r,`Previous layout not found for panel index ${t}`),aq(r,o)){let t=r-i;a2(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}}else{let t=e<0?d:c,n=r[t];az(n,`Panel constraints not found for index ${t}`);let i=s[t],{collapsible:a,collapsedSize:o,minSize:l}=n;if(a&&0>a2(i,l))if(e>0){let t=l-o;0>a2(i+e,l)&&(e=0>=a2(e,t/2)?0:t)}else{let t=l-o;0>a2(i-e,l)&&(e=a2(100+e,100-t/2)>0?0:-t)}}{let t=e<0?1:-1,n=e<0?d:c,i=0;for(;;){let e=s[n];if(az(null!=e,`Previous layout not found for panel index ${n}`),i+=a5({overrideDisabledPanels:o,panelConstraints:r[n],prevSize:e,size:100})-e,(n+=t)<0||n>=r.length)break}let a=Math.min(Math.abs(e),Math.abs(i));e=e<0?0-a:a}{let t=e<0?c:d;for(;t>=0&&t<r.length;){let n=Math.abs(e)-Math.abs(p),i=s[t];az(null!=i,`Previous layout not found for panel index ${t}`);let a=i-n,l=a5({overrideDisabledPanels:o,panelConstraints:r[t],prevSize:i,size:a});if(!aq(i,l)&&(p+=i-l,u[t]=l,p.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?t--:t++}}if(function(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!=t[r])return!1;return!0}(l,u))return i;{let t=e<0?d:c,n=s[t];az(null!=n,`Previous layout not found for panel index ${t}`);let i=n+p,a=a5({overrideDisabledPanels:o,panelConstraints:r[t],prevSize:n,size:i});if(u[t]=a,!aq(a,i)){let t=i-a,n=e<0?d:c;for(;n>=0&&n<r.length;){let i=u[n];az(null!=i,`Previous layout not found for panel index ${n}`);let a=i+t,s=a5({overrideDisabledPanels:o,panelConstraints:r[n],prevSize:i,size:a});if(aq(i,s)||(t-=s-i,u[n]=s),aq(t,0))break;e>0?n--:n++}}}if(!aq(Object.values(u).reduce((e,t)=>t+e,0),100,.1))return i;let f=Object.keys(i);return u.reduce((e,t,r)=>(e[f[r]]=t,e),{})}function a4(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let r in e)if(void 0===t[r]||0!==a2(e[r],t[r]))return!1;return!0}function a6({layout:e,panelConstraints:t}){let r=Object.values(e),n=[...r],i=n.reduce((e,t)=>e+t,0);if(n.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${n.map(e=>`${e}%`).join(", ")}`);if(!aq(i,100)&&n.length>0)for(let e=0;e<t.length;e++){let t=n[e];az(null!=t,`No layout data found for index ${e}`);let r=100/i*t;n[e]=r}let a=0;for(let e=0;e<t.length;e++){let i=r[e];az(null!=i,`No layout data found for index ${e}`);let o=n[e];az(null!=o,`No layout data found for index ${e}`);let s=a5({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:i,size:o});o!=s&&(a+=o-s,n[e]=s)}if(!aq(a,0))for(let e=0;e<t.length;e++){let r=n[e];az(null!=r,`No layout data found for index ${e}`);let i=r+a,o=a5({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:r,size:i});if(r!==o&&(a-=o-r,n[e]=o,aq(a,0)))break}let o=Object.keys(e);return n.reduce((e,t,r)=>(e[o[r]]=t,e),{})}function a8({groupId:e,panelId:t}){let r=()=>{let{mountedGroups:t}=aV;for(let[r,{defaultLayoutDeferred:n,derivedPanelConstraints:i,layout:a,separatorToPanels:o}]of t)if(r.id===e)return{defaultLayoutDeferred:n,derivedPanelConstraints:i,group:r,layout:a,separatorToPanels:o};throw Error(`Group ${e} not found`)},n=()=>{let e=r().derivedPanelConstraints.find(e=>e.panelId===t);if(void 0!==e)return e;throw Error(`Panel constraints not found for Panel ${t}`)},i=()=>{let e=r().group.panels.find(e=>e.id===t);if(void 0!==e)return e;throw Error(`Layout not found for Panel ${t}`)},a=()=>{let e=r().layout[t];if(void 0!==e)return e;throw Error(`Layout not found for Panel ${t}`)},o=e=>{let n=a();if(e===n)return;let{defaultLayoutDeferred:i,derivedPanelConstraints:o,group:s,layout:l,separatorToPanels:u}=r(),c=s.panels.findIndex(e=>e.id===t),d=c===s.panels.length-1,p=a6({layout:a3({delta:d?n-e:e-n,initialLayout:l,panelConstraints:o,pivotIndices:d?[c-1,c]:[c,c+1],prevLayout:l,trigger:"imperative-api"}),panelConstraints:o});a4(l,p)||aK(e=>({mountedGroups:new Map(e.mountedGroups).set(s,{defaultLayoutDeferred:i,derivedPanelConstraints:o,layout:p,separatorToPanels:u})}))};return{collapse:()=>{let{collapsible:e,collapsedSize:t}=n(),{mutableValues:r}=i(),s=a();e&&s!==t&&(r.expandToSize=s,o(t))},expand:()=>{let{collapsible:e,collapsedSize:t,minSize:r}=n(),{mutableValues:s}=i(),l=a();if(e&&l===t){let e=s.expandToSize??r;0===e&&(e=1),o(e)}},getSize:()=>{let{group:e}=r(),t=a(),{element:n}=i();return{asPercentage:t,inPixels:"horizontal"===e.orientation?n.offsetWidth:n.offsetHeight}},isCollapsed:()=>{let{collapsible:e,collapsedSize:t}=n(),r=a();return e&&aq(t,r)},resize:e=>{if(a()!==e){let t;switch(typeof e){case"number":{let{group:n}=r();t=aO(e/aD({group:n})*100);break}case"string":t=parseFloat(e)}o(t)}}}}function a7(e){if(e.defaultPrevented)return;let{mountedGroups:t}=aV;a1(e,t).forEach(t=>{if(t.separator){let r=t.panels.find(e=>void 0!==e.panelConstraints.defaultSize);if(r){let n=r.panelConstraints.defaultSize,i=a8({groupId:t.group.id,panelId:r.id});i&&void 0!==n&&(i.resize(n),e.preventDefault())}}})}function a9(e){let{mountedGroups:t}=aV;for(let[r]of t)if(r.separators.some(t=>t.element===e))return r;throw Error("Could not find parent Group for separator element")}function oe({groupId:e}){let t=()=>{let{mountedGroups:t}=aV;for(let[r,n]of t)if(r.id===e)return{group:r,...n};throw Error(`Could not find Group with id "${e}"`)};return{getLayout(){let{defaultLayoutDeferred:e,layout:r}=t();return e?{}:r},setLayout(e){let{defaultLayoutDeferred:r,derivedPanelConstraints:n,group:i,layout:a,separatorToPanels:o}=t(),s=a6({layout:e,panelConstraints:n});return r?a:(a4(a,s)||aK(e=>({mountedGroups:new Map(e.mountedGroups).set(i,{defaultLayoutDeferred:r,derivedPanelConstraints:n,layout:s,separatorToPanels:o})})),s)}}}function ot(e){let{mountedGroups:t}=aV,r=t.get(e);return az(r,`Mounted Group ${e.id} not found`),r}function or(e,t){let r=a9(e),n=ot(r),i=r.separators.find(t=>t.element===e);az(i,"Matching separator not found");let a=n.separatorToPanels.get(i);az(a,"Matching panels not found");let o=a.map(e=>r.panels.indexOf(e)),s=oe({groupId:r.id}).getLayout(),l=a6({layout:a3({delta:t,initialLayout:s,panelConstraints:n.derivedPanelConstraints,pivotIndices:o,prevLayout:s,trigger:"keyboard"}),panelConstraints:n.derivedPanelConstraints});a4(s,l)||aK(e=>({mountedGroups:new Map(e.mountedGroups).set(r,{defaultLayoutDeferred:n.defaultLayoutDeferred,derivedPanelConstraints:n.derivedPanelConstraints,layout:l,separatorToPanels:n.separatorToPanels})}))}function on(e){if(e.defaultPrevented)return;let t=e.currentTarget,r=a9(t);if(!r.disabled)switch(e.key){case"ArrowDown":e.preventDefault(),"vertical"===r.orientation&&or(t,5);break;case"ArrowLeft":e.preventDefault(),"horizontal"===r.orientation&&or(t,-5);break;case"ArrowRight":e.preventDefault(),"horizontal"===r.orientation&&or(t,5);break;case"ArrowUp":e.preventDefault(),"vertical"===r.orientation&&or(t,-5);break;case"End":e.preventDefault(),or(t,100);break;case"Enter":{e.preventDefault();let r=a9(t),{derivedPanelConstraints:n,layout:i,separatorToPanels:a}=ot(r),o=r.separators.find(e=>e.element===t);az(o,"Matching separator not found");let s=a.get(o);az(s,"Matching panels not found");let l=s[0],u=n.find(e=>e.panelId===l.id);if(az(u,"Panel metadata not found"),u.collapsible){let e=i[l.id];or(t,(u.collapsedSize===e?r.inMemoryLastExpandedPanelSizes[l.id]??u.minSize:u.collapsedSize)-e)}break}case"F6":{e.preventDefault();let r=a9(t).separators.map(e=>e.element),n=Array.from(r).findIndex(t=>t===e.currentTarget);az(null!==n,"Index not found");let i=e.shiftKey?n>0?n-1:r.length-1:n+1<r.length?n+1:0;r[i].focus();break}case"Home":e.preventDefault(),or(t,-100)}}function oi(e){if(e.defaultPrevented||"mouse"===e.pointerType&&e.button>0)return;let{mountedGroups:t}=aV,r=a1(e,t),n=new Map,i=!1;r.forEach(e=>{e.separator&&(i||(i=!0,e.separator.element.focus()));let r=t.get(e.group);r&&n.set(e.group,r.layout)}),aK({interactionState:{hitRegions:r,initialLayoutMap:n,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:"active"}}),r.length&&e.preventDefault()}let oa=e=>e,oo=()=>{};function os(){return void 0===r&&(r=!1,"u">typeof window&&(window.navigator.userAgent.includes("Chrome")||window.navigator.userAgent.includes("Firefox"))&&(r=!0)),r}let ol=new WeakMap;function ou(e){if(null===e.defaultView||void 0===e.defaultView)return;let{prevStyle:t,styleSheet:r}=ol.get(e)??{};void 0===r&&(r=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&e.adoptedStyleSheets.push(r));let{cursorFlags:n,interactionState:i}=aV;switch(i.state){case"active":case"hover":{let e=function({cursorFlags:e,groups:t,state:r}){let n=0,i=0;switch(r){case"active":case"hover":t.forEach(e=>{if(!e.disableCursor)switch(e.orientation){case"horizontal":n++;break;case"vertical":i++}})}if(0!==n||0!==i){if("active"===r&&e&&os()){let t=(4&e)!=0,r=(8&e)!=0;if((1&e)!=0)return t?"se-resize":r?"ne-resize":"e-resize";if((2&e)!=0)return t?"sw-resize":r?"nw-resize":"w-resize";if(t)return"s-resize";if(r)return"n-resize"}return os()?n>0&&i>0?"move":n>0?"ew-resize":"ns-resize":n>0&&i>0?"grab":n>0?"col-resize":"row-resize"}}({cursorFlags:n,groups:i.hitRegions.map(e=>e.group),state:i.state}),a=`*, *:hover {cursor: ${e} !important; }`;if(t===a)return;t=a,e?0===r.cssRules.length?r.insertRule(a):r.replaceSync(a):1===r.cssRules.length&&r.deleteRule(0);break}case"inactive":t=void 0,1===r.cssRules.length&&r.deleteRule(0)}ol.set(e,{prevStyle:t,styleSheet:r})}function oc({document:e,event:t,hitRegions:r,initialLayoutMap:n,mountedGroups:i,pointerDownAtPoint:a,prevCursorFlags:o}){let s=0,l=new Map(i);r.forEach(e=>{let{group:r,groupSize:o}=e,{disableCursor:u,orientation:c,panels:d}=r,p=0;p=a?"horizontal"===c?(t.clientX-a.x)/o*100:(t.clientY-a.y)/o*100:"horizontal"===c?t.clientX<0?-100:100:t.clientY<0?-100:100;let f=n.get(r),{defaultLayoutDeferred:h,derivedPanelConstraints:m,layout:g,separatorToPanels:y}=i.get(r)??{defaultLayoutDeferred:!1};if(m&&f&&g&&y){let t=a3({delta:p,initialLayout:f,panelConstraints:m,pivotIndices:e.panels.map(e=>d.indexOf(e)),prevLayout:g,trigger:"mouse-or-touch"});if(a4(t,g)){if(0!==p&&!u)switch(c){case"horizontal":s|=p<0?1:2;break;case"vertical":s|=p<0?4:8}}else l.set(e.group,{defaultLayoutDeferred:h,derivedPanelConstraints:m,layout:t,separatorToPanels:y})}});let u=0;0===t.movementX?u|=3&o:u|=3&s,0===t.movementY?u|=12&o:u|=12&s,aK({cursorFlags:u,mountedGroups:l}),ou(e)}function od(e){let{cursorFlags:t,interactionState:r,mountedGroups:n}=aV;"active"===r.state&&oc({document:e.currentTarget,event:e,hitRegions:r.hitRegions,initialLayoutMap:r.initialLayoutMap,mountedGroups:n,prevCursorFlags:t})}function op(e){if(e.defaultPrevented)return;let{cursorFlags:t,interactionState:r,mountedGroups:n}=aV;if("active"===r.state){if(0===e.buttons){aK(e=>"inactive"===e.interactionState.state?e:{cursorFlags:0,interactionState:{state:"inactive"}}),aK(e=>({mountedGroups:new Map(e.mountedGroups)}));return}oc({document:e.currentTarget,event:e,hitRegions:r.hitRegions,initialLayoutMap:r.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:r.pointerDownAtPoint,prevCursorFlags:t})}else{let t=a1(e,n);0===t.length?"inactive"!==r.state&&aK({interactionState:{state:"inactive"}}):aK({interactionState:{hitRegions:t,state:"hover"}}),ou(e.currentTarget)}}function of(e){if(e.relatedTarget instanceof HTMLIFrameElement){let{interactionState:e}=aV;"hover"===e.state&&aK({interactionState:{state:"inactive"}})}}function oh(e){if(e.defaultPrevented||"mouse"===e.pointerType&&e.button>0)return;let{interactionState:t}=aV;"active"===t.state&&(aK({cursorFlags:0,interactionState:{state:"inactive"}}),t.hitRegions.length>0&&(ou(e.currentTarget),aK(e=>({mountedGroups:new Map(e.mountedGroups)})),e.preventDefault()))}function om(e){let t=0,r=0,n={};for(let i of e)if(void 0!==i.defaultSize){t++;let e=aO(i.defaultSize);r+=e,n[i.panelId]=e}else n[i.panelId]=void 0;let i=e.length-t;if(0!==i){let t=aO((100-r)/i);for(let r of e)void 0===r.defaultSize&&(n[r.panelId]=t)}return n}let og=new Map;function oy(e){let t=(0,k.useId)();return`${e??t}`}let ov="u">typeof window?k.useLayoutEffect:k.useEffect;function ob(e){let t=(0,k.useRef)(e);return ov(()=>{t.current=e},[e]),(0,k.useCallback)((...e)=>t.current?.(...e),[t])}function ox(...e){return ob(t=>{e.forEach(e=>{if(e)switch(typeof e){case"function":e(t);break;case"object":e.current=t}})})}function ow(e){let t=(0,k.useRef)({...e});return ov(()=>{for(let r in e)t.current[r]=e[r]},[e]),t.current}let oS=(0,k.createContext)(null);function oC({children:e,className:t,defaultLayout:r,disableCursor:n,disabled:i,elementRef:a,groupRef:o,id:s,onLayoutChange:l,onLayoutChanged:u,orientation:c="horizontal",resizeTargetMinimumSize:d={coarse:20,fine:10},style:p,...f}){let h,m=(0,k.useRef)({onLayoutChange:{},onLayoutChanged:{}}),g=ob(e=>{a4(m.current.onLayoutChange,e)||(m.current.onLayoutChange=e,l?.(e))}),y=ob(e=>{a4(m.current.onLayoutChanged,e)||(m.current.onLayoutChanged=e,u?.(e))}),v=oy(s),b=(0,k.useRef)(null),[x,w]=function(){let[e,t]=(0,k.useState)({});return[e,(0,k.useCallback)(()=>t({}),[])]}(),C=(0,k.useRef)({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:d,separators:[]}),_=ox(b,a);h=(0,k.useRef)({getLayout:()=>({}),setLayout:oa}),(0,k.useImperativeHandle)(o,()=>h.current,[]),ov(()=>{Object.assign(h.current,oe({groupId:v}))});let A=ob((e,t)=>{let{interactionState:n,mountedGroups:i}=aV;for(let r of i.keys())if(r.id===e){let e=i.get(r);if(e){let i=!1;return"active"===n.state&&(i=n.hitRegions.some(e=>e.group===r)),{flexGrow:e.layout[t]??1,pointerEvents:i?"none":void 0}}}return{flexGrow:r?.[t]??1}}),E=ow({defaultLayout:r,disableCursor:n}),N=(0,k.useMemo)(()=>({get disableCursor(){return!!E.disableCursor},getPanelStyles:A,id:v,orientation:c,registerPanel:e=>{let t=C.current;return t.panels=aB(c,[...t.panels,e]),w(),()=>{t.panels=t.panels.filter(t=>t!==e),w()}},registerSeparator:e=>{let t=C.current;return t.separators=aB(c,[...t.separators,e]),w(),()=>{t.separators=t.separators.filter(t=>t!==e),w()}},togglePanelDisabled:(e,t)=>{let r=C.current.panels.find(t=>t.id===e);r&&(r.panelConstraints.disabled=t);let{mountedGroups:n}=aV;for(let e of n.keys())if(e.id===v){let t=n.get(e);t&&(t.derivedPanelConstraints=a$(e))}},toggleSeparatorDisabled:(e,t)=>{let r=C.current.separators.find(t=>t.id===e);r&&(r.disabled=t)}}),[A,v,w,c,E]),I=(0,k.useRef)(null);return ov(()=>{let e,t,r,n,a,o,s,l,u,d,p,f,h,m=b.current;if(null===m)return;let x=C.current;if(void 0!==E.defaultLayout&&Object.keys(E.defaultLayout).length===x.panels.length)for(let t of(e={},x.panels)){let r=E.defaultLayout[t.id];void 0!==r&&(e[t.id]=r)}let w={defaultLayout:e,disableCursor:!!E.disableCursor,disabled:!!i,element:m,id:v,inMemoryLastExpandedPanelSizes:C.current.lastExpandedPanelSizes,inMemoryLayouts:C.current.layouts,orientation:c,panels:x.panels,resizeTargetMinimumSize:x.resizeTargetMinimumSize,separators:x.separators};I.current=w;let S=(t=!0,az(w.element.ownerDocument.defaultView,"Cannot register an unmounted Group"),r=w.element.ownerDocument.defaultView.ResizeObserver,n=new Set,a=new Set,(o=new r(e=>{for(let r of e){let{borderBoxSize:e,target:n}=r;if(n===w.element){if(t){if(0===aD({group:w}))return;aK(e=>{let t=e.mountedGroups.get(w);if(t){let r=a$(w),n=t.defaultLayoutDeferred?om(r):t.layout,i=a6({layout:n,panelConstraints:r});return!t.defaultLayoutDeferred&&a4(n,i)&&function(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let r in e)if(e[r]!==t[r])return!1;return!0}(t.derivedPanelConstraints,r)?e:{mountedGroups:new Map(e.mountedGroups).set(w,{defaultLayoutDeferred:!1,derivedPanelConstraints:r,layout:i,separatorToPanels:t.separatorToPanels})}}return e})}}else!function(e,t,r){if(!r[0])return;let n=e.panels.find(e=>e.element===t);if(!n||!n.onResize)return;let i=aD({group:e}),a="horizontal"===e.orientation?n.element.offsetWidth:n.element.offsetHeight,o=n.mutableValues.prevSize,s={asPercentage:aO(a/i*100),inPixels:a};n.mutableValues.prevSize=s,n.onResize(s,n.id,o)}(w,n,e)}})).observe(w.element),w.panels.forEach(e=>{az(!n.has(e.id),`Panel ids must be unique; id "${e.id}" was used more than once`),n.add(e.id),e.onResize&&o.observe(e.element)}),s=aD({group:w}),l=a$(w),u=w.panels.map(({id:e})=>e).join(","),(d=w.defaultLayout)&&(function(e,t){let r=e.map(e=>e.id),n=Object.keys(t);if(r.length!==n.length)return!1;for(let e of r)if(!n.includes(e))return!1;return!0}(w.panels,d)||(d=void 0)),p=a6({layout:w.inMemoryLayouts[u]??d??om(l),panelConstraints:l}),f=aH(w),h=w.element.ownerDocument,aK(e=>{let t=new Map;return og.set(h,(og.get(h)??0)+1),f.forEach(e=>{e.separator&&t.set(e.separator,e.panels)}),{mountedGroups:new Map(e.mountedGroups).set(w,{defaultLayoutDeferred:0===s,derivedPanelConstraints:l,layout:p,separatorToPanels:t})}}),w.separators.forEach(e=>{az(!a.has(e.id),`Separator ids must be unique; id "${e.id}" was used more than once`),a.add(e.id),e.element.addEventListener("keydown",on)}),1===og.get(h)&&(h.addEventListener("dblclick",a7,!0),h.addEventListener("pointerdown",oi,!0),h.addEventListener("pointerleave",od),h.addEventListener("pointermove",op),h.addEventListener("pointerout",of),h.addEventListener("pointerup",oh,!0)),function(){t=!1,og.set(h,Math.max(0,(og.get(h)??0)-1)),aK(e=>{let t=new Map(e.mountedGroups);return t.delete(w),{mountedGroups:t}}),w.separators.forEach(e=>{e.element.removeEventListener("keydown",on)}),og.get(h)||(h.removeEventListener("dblclick",a7,!0),h.removeEventListener("pointerdown",oi,!0),h.removeEventListener("pointerleave",od),h.removeEventListener("pointermove",op),h.removeEventListener("pointerout",of),h.removeEventListener("pointerup",oh,!0)),o.disconnect()}),k=aV.mountedGroups.get(w);if(k){let{defaultLayoutDeferred:e,derivedPanelConstraints:t,layout:r}=k;!e&&t.length>0&&(g(r),y(r))}let _=aQ.addListener("interactionStateChange",e=>{e.state}),A=aQ.addListener("mountedGroupsChange",e=>{let t=e.get(w);if(t){let{defaultLayoutDeferred:e,derivedPanelConstraints:r,layout:n}=t;if(e||0===r.length)return;let i=w.panels.map(({id:e})=>e).join(",");w.inMemoryLayouts[i]=n;let{interactionState:a}=aV,o="active"!==a.state;g(n),o&&y(n)}});return()=>{I.current=null,S(),_(),A()}},[i,v,y,g,c,x,E]),(0,k.useEffect)(()=>{let e=I.current;e&&(e.defaultLayout=r,e.disableCursor=!!n)}),(0,S.jsx)(oS.Provider,{value:N,children:(0,S.jsx)("div",{...f,className:t,"data-group":!0,"data-testid":v,id:v,ref:_,style:{height:"100%",width:"100%",overflow:"hidden",...p,display:"flex",flexDirection:"horizontal"===c?"row":"column",flexWrap:"nowrap",touchAction:"horizontal"===c?"pan-y":"pan-x"},children:e})})}function ok(){let e=(0,k.useContext)(oS);return az(e,"Group Context not found; did you render a Panel or Separator outside of a Group?"),e}function o_({children:e,className:t,collapsedSize:r="0%",collapsible:n=!1,defaultSize:i,disabled:a,elementRef:o,id:s,maxSize:l="100%",minSize:u="0%",onResize:c,panelRef:d,style:p,...f}){let h=!!s,m=oy(s),g=ow({disabled:a}),y=(0,k.useRef)(null),v=ox(y,o),{getPanelStyles:b,id:x,orientation:w,registerPanel:C,togglePanelDisabled:_}=ok(),A=null!==c,E=ob((e,t,r)=>{c?.(e,s,r)});ov(()=>{let e=y.current;if(null!==e)return C({element:e,id:m,idIsStable:h,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:A?E:void 0,panelConstraints:{collapsedSize:r,collapsible:n,defaultSize:i,disabled:g.disabled,maxSize:l,minSize:u}})},[r,n,i,A,m,h,l,u,E,C,g]),(0,k.useEffect)(()=>{_(m,!!a)},[a,m,_]),function(e,t){let{id:r}=ok(),n=(0,k.useRef)({collapse:oo,expand:oo,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:oo});(0,k.useImperativeHandle)(t,()=>n.current,[]),ov(()=>{Object.assign(n.current,a8({groupId:r,panelId:e}))})}(m,d);let N=(0,k.useSyncExternalStore)(e=>(aQ.addListener("mountedGroupsChange",e),()=>{aQ.removeListener("mountedGroupsChange",e)}),()=>JSON.stringify(b(x,m)),()=>JSON.stringify(b(x,m)));return(0,S.jsx)("div",{...f,"aria-disabled":a||void 0,"data-panel":!0,"data-testid":m,id:m,ref:v,style:{...oA,display:"flex",flexBasis:0,flexShrink:1,overflow:"hidden",...JSON.parse(N)},children:(0,S.jsx)("div",{className:t,style:{maxHeight:"100%",maxWidth:"100%",flexGrow:1,...p,touchAction:"horizontal"===w?"pan-y":"pan-x"},children:e})})}oC.displayName="Group",o_.displayName="Panel";let oA={minHeight:0,maxHeight:"100%",height:"auto",minWidth:0,maxWidth:"100%",width:"auto",border:"none",borderWidth:0,padding:0,margin:0};function oE({children:e,className:t,disabled:r,elementRef:n,id:i,style:a,...o}){let s,l=oy(i),u=ow({disabled:r}),[c,d]=(0,k.useState)({}),[p,f]=(0,k.useState)("inactive"),h=(0,k.useRef)(null),m=ox(h,n),{disableCursor:g,id:y,orientation:v,registerSeparator:b,toggleSeparatorDisabled:x}=ok();return ov(()=>{let e=h.current;if(null!==e){let t={disabled:u.disabled,element:e,id:l},r=b(t),n=aQ.addListener("interactionStateChange",e=>{f("inactive"!==e.state&&e.hitRegions.some(e=>e.separator===t)?e.state:"inactive")}),i=aQ.addListener("mountedGroupsChange",e=>{e.forEach(({derivedPanelConstraints:e,layout:r,separatorToPanels:n},i)=>{if(i.id===y){let a=n.get(t);if(a){let t=a[0],n=i.panels.indexOf(t);d(function({layout:e,panelConstraints:t,panelId:r,panelIndex:n}){let i,a,o=e[r],s=t.find(e=>e.panelId===r);if(s){let l=s.maxSize,u=s.collapsible?s.collapsedSize:s.minSize,c=[n,n+1];a=a6({layout:a3({delta:u-o,initialLayout:e,panelConstraints:t,pivotIndices:c,prevLayout:e}),panelConstraints:t})[r],i=a6({layout:a3({delta:l-o,initialLayout:e,panelConstraints:t,pivotIndices:c,prevLayout:e}),panelConstraints:t})[r]}return{valueControls:r,valueMax:i,valueMin:a,valueNow:o}}({layout:r,panelConstraints:e,panelId:t.id,panelIndex:n}))}}})});return()=>{n(),i(),r()}}},[y,l,b,u]),(0,k.useEffect)(()=>{x(l,!!r)},[r,l,x]),r&&!g&&(s="not-allowed"),(0,S.jsx)("div",{...o,"aria-controls":c.valueControls,"aria-disabled":r||void 0,"aria-orientation":"horizontal"===v?"vertical":"horizontal","aria-valuemax":c.valueMax,"aria-valuemin":c.valueMin,"aria-valuenow":c.valueNow,children:e,className:t,"data-separator":r?"disabled":p,"data-testid":l,id:l,ref:m,role:"separator",style:{flexBasis:"auto",cursor:s,...a,flexGrow:0,flexShrink:0,touchAction:"none"},tabIndex:r?void 0:0})}oE.displayName="Separator";let oN=af("columns-2",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]]),oI=af("terminal",[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]]),oT=af("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"}]]);function oR(){let e,t,r,n,i,a=(0,C.c)(10),{healthChecking:o,retryHealth:s}=ew();a[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,S.jsx)("div",{className:"mx-auto flex size-12 items-center justify-center rounded-full bg-[var(--t-surface)] border border-[var(--t-border)]",children:(0,S.jsx)(oI,{className:"size-5 text-[var(--t-muted)]"})}),a[0]=e):e=a[0],a[1]===Symbol.for("react.memo_cache_sentinel")?(t=(0,S.jsxs)("div",{className:"space-y-2",children:[(0,S.jsx)("h2",{className:"text-sm font-medium text-[var(--t-bright)]",children:"Backend not running"}),(0,S.jsx)("p",{className:"text-xs text-[var(--t-muted)] leading-relaxed",children:"Start the AgentPane server to connect."})]}),a[1]=t):t=a[1],a[2]===Symbol.for("react.memo_cache_sentinel")?(r=(0,S.jsx)("div",{className:"rounded-lg border border-[var(--t-border)] bg-[var(--t-surface)] px-4 py-3",children:(0,S.jsx)("code",{className:"text-xs text-[var(--t-accent)] font-mono",children:"npx agentpane"})}),a[2]=r):r=a[2];let l=`size-3 ${o?"animate-spin":""}`;a[3]!==l?(n=(0,S.jsx)(oT,{className:l}),a[3]=l,a[4]=n):n=a[4];let u=o?"Checking...":"Retry";return a[5]!==o||a[6]!==s||a[7]!==n||a[8]!==u?(i=(0,S.jsx)("div",{className:"flex h-full items-center justify-center bg-[var(--t-bg)]",children:(0,S.jsxs)("div",{className:"w-full max-w-sm px-6 space-y-6 text-center",children:[e,t,r,(0,S.jsxs)("button",{onClick:s,disabled:o,className:"inline-flex items-center gap-2 rounded-lg border border-[var(--t-border)] bg-[var(--t-surface)] px-4 py-2 text-xs font-medium text-[var(--t-text)] transition-colors hover:bg-[var(--t-elevated)] hover:border-[var(--t-dim)] cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed",children:[n,u]})]})}),a[5]=o,a[6]=s,a[7]=n,a[8]=u,a[9]=i):i=a[9],i}let oP=af("folder-open",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]),oM=af("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]),oj=af("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function oL(){let{startSession:e,cancelSetup:t}=ew(),[r,n]=(0,k.useState)(null),[i,a]=(0,k.useState)("~"),[o,s]=(0,k.useState)(null),[l,u]=(0,k.useState)(!1),c=(0,k.useRef)(null),[d,p]=(0,k.useState)([]),[f,h]=(0,k.useState)(!1),[m,g]=(0,k.useState)(""),[y,v]=(0,k.useState)("stdio"),[b,x]=(0,k.useState)(""),[w,C]=(0,k.useState)(""),[_,A]=(0,k.useState)("");(0,k.useEffect)(()=>{c.current?.focus(),U("mcp_servers").then(async e=>{if(!e.ok)return;let t=await e.json();try{let e=JSON.parse(t.value);Array.isArray(e)&&p(e)}catch{}}).catch(()=>{})},[]);let E=async()=>{if(!r||l)return;s(null),u(!0);let t=i.trim()||"~",n=!1,a="Failed to start session";try{await e(r,t,d.length>0?d:void 0)}catch(e){n=!0,e instanceof Error&&(a=e.message)}n&&(s(a),u(!1))};return(0,S.jsx)("div",{className:"flex h-full flex-col bg-[var(--t-bg)]",children:(0,S.jsx)("div",{className:"flex-1 flex items-center justify-center",children:(0,S.jsxs)("div",{className:"w-full max-w-md px-6 space-y-6",children:[(0,S.jsxs)("div",{className:"space-y-2",children:[(0,S.jsx)("div",{className:"text-xs font-medium text-[var(--t-muted)] uppercase tracking-wider",children:"Agent"}),(0,S.jsx)("div",{className:"grid grid-cols-2 gap-3",children:a_.map(e=>{let t=r===e.id;return(0,S.jsxs)("button",{onClick:()=>n(e.id),className:`group relative text-left rounded-lg border px-4 py-3.5 transition-all cursor-pointer ${t?"border-[var(--t-accent)] bg-[var(--t-accent)]/8":"border-[var(--t-border)] bg-[var(--t-surface)] hover:border-[var(--t-dim)] hover:bg-[var(--t-elevated)]"}`,children:[(0,S.jsx)("div",{className:`text-sm font-medium ${t?"text-[var(--t-accent)]":"text-[var(--t-bright)]"}`,children:e.name}),(0,S.jsx)("div",{className:"text-[11px] text-[var(--t-muted)] mt-0.5 leading-snug",children:e.description}),t&&(0,S.jsx)("div",{className:"absolute top-2.5 right-2.5 size-2 rounded-full bg-[var(--t-accent)]"})]},e.id)})})]}),(0,S.jsxs)("div",{className:"space-y-2",children:[(0,S.jsx)("div",{className:"text-xs font-medium text-[var(--t-muted)] uppercase tracking-wider",children:"Working directory"}),(0,S.jsxs)("div",{className:"flex items-center gap-2 rounded-lg border border-[var(--t-border)] bg-[var(--t-surface)] px-3 py-2 focus-within:border-[var(--t-dim)]",children:[(0,S.jsx)(oP,{className:"size-3.5 shrink-0 text-[var(--t-muted)]"}),(0,S.jsx)("input",{ref:c,value:i,onChange:e=>a(e.target.value),onKeyDown:e=>{"Enter"===e.key&&r&&(e.preventDefault(),E()),"Escape"===e.key&&t()},className:"flex-1 bg-transparent text-sm text-[var(--t-bright)] outline-none placeholder:text-[var(--t-dim)] font-mono",placeholder:"~/projects/my-app",spellCheck:!1})]})]}),(0,S.jsxs)("div",{className:"space-y-2",children:[(0,S.jsxs)("button",{type:"button",onClick:()=>h(!f),className:"flex items-center gap-1.5 text-xs font-medium text-[var(--t-muted)] uppercase tracking-wider cursor-pointer hover:text-[var(--t-bright)] transition-colors",children:[(0,S.jsx)(oM,{className:`size-3 transition-transform ${f?"":"-rotate-90"}`}),"MCP Servers ",d.length>0&&`(${d.length})`]}),f&&(0,S.jsxs)("div",{className:"space-y-2",children:[d.map((e,t)=>(0,S.jsxs)("div",{className:"flex items-center gap-2 rounded-lg border border-[var(--t-border)] bg-[var(--t-surface)] px-3 py-2",children:[(0,S.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,S.jsx)("div",{className:"text-sm text-[var(--t-bright)] truncate",children:e.name}),(0,S.jsx)("div",{className:"text-[11px] text-[var(--t-muted)] truncate",children:"stdio"===e.type?e.command:e.url})]}),(0,S.jsx)("button",{type:"button",onClick:()=>{p(e=>e.filter((e,r)=>r!==t))},className:"shrink-0 text-[var(--t-dim)] hover:text-[var(--t-red)] cursor-pointer",children:(0,S.jsx)(oj,{className:"size-3.5"})})]},t)),(0,S.jsxs)("div",{className:"space-y-1.5",children:[(0,S.jsxs)("div",{className:"flex gap-2",children:[(0,S.jsx)("input",{value:m,onChange:e=>g(e.target.value),className:"flex-1 rounded border border-[var(--t-border)] bg-[var(--t-surface)] px-2 py-1.5 text-xs text-[var(--t-bright)] outline-none placeholder:text-[var(--t-dim)] font-mono",placeholder:"Name",spellCheck:!1}),(0,S.jsxs)("select",{value:y,onChange:e=>v(e.target.value),className:"rounded border border-[var(--t-border)] bg-[var(--t-surface)] px-2 py-1.5 text-xs text-[var(--t-bright)] outline-none cursor-pointer",children:[(0,S.jsx)("option",{value:"stdio",children:"stdio"}),(0,S.jsx)("option",{value:"http",children:"http"}),(0,S.jsx)("option",{value:"sse",children:"sse"})]})]}),"stdio"===y?(0,S.jsxs)("div",{className:"flex gap-2",children:[(0,S.jsx)("input",{value:b,onChange:e=>x(e.target.value),className:"flex-1 rounded border border-[var(--t-border)] bg-[var(--t-surface)] px-2 py-1.5 text-xs text-[var(--t-bright)] outline-none placeholder:text-[var(--t-dim)] font-mono",placeholder:"Command (e.g. npx)",spellCheck:!1}),(0,S.jsx)("input",{value:w,onChange:e=>C(e.target.value),className:"flex-1 rounded border border-[var(--t-border)] bg-[var(--t-surface)] px-2 py-1.5 text-xs text-[var(--t-bright)] outline-none placeholder:text-[var(--t-dim)] font-mono",placeholder:"Args (space-separated)",spellCheck:!1})]}):(0,S.jsx)("input",{value:_,onChange:e=>A(e.target.value),className:"w-full rounded border border-[var(--t-border)] bg-[var(--t-surface)] px-2 py-1.5 text-xs text-[var(--t-bright)] outline-none placeholder:text-[var(--t-dim)] font-mono",placeholder:"URL",spellCheck:!1}),(0,S.jsxs)("button",{type:"button",onClick:()=>{let e;if(m.trim()){if("stdio"===y){if(!b.trim())return;let t={name:m.trim(),type:"stdio",command:b.trim()};w.trim()&&(t.args=w.trim().split(/\s+/)),e=t}else{if(!_.trim())return;e={name:m.trim(),type:y,url:_.trim()}}p(t=>[...t,e]),g(""),x(""),C(""),A("")}},className:"flex items-center gap-1 text-xs text-[var(--t-accent)] hover:text-[var(--t-bright)] cursor-pointer",children:[(0,S.jsx)(ag,{className:"size-3"})," Add server"]})]})]})]}),o&&(0,S.jsx)("div",{className:"rounded-lg border border-red-500/30 bg-red-500/10 px-4 py-3 text-sm text-red-400",children:o}),(0,S.jsx)("button",{onClick:E,disabled:!r||l,className:`w-full rounded-lg py-2.5 text-sm font-medium transition-all ${r&&!l?"bg-[var(--t-accent)] text-[var(--t-bg)] hover:brightness-110 cursor-pointer":"bg-[var(--t-border)] text-[var(--t-dim)] cursor-not-allowed"}`,children:l?"Starting...":"Start session"})]})})})}let oO=af("panel-right-close",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m8 9 3 3-3 3",key:"12hl5m"}]]);function oD(e){let t,r,n,i,a,o,s,l,u,c,d,p,f,h,m,g,y,v,b=(0,C.c)(61),{paneId:x,tabSessionIds:w,activeTabSessionId:_,isFocused:A}=e,{sessions:E}=ew(),{layout:N,openSessionInPane:I,closeTab:T,moveTab:R,reorderTab:P,splitPane:M,closePane:j,focusPane:L}=eE(),[O,D]=(0,k.useState)(!1),[$,z]=(0,k.useState)(null),B=(0,k.useRef)(null);b[0]===Symbol.for("react.memo_cache_sentinel")?(t=()=>{let e=()=>{D(!1),z(null),B.current=null};return document.addEventListener("dragend",e),()=>document.removeEventListener("dragend",e)},r=[],b[0]=t,b[1]=r):(t=b[0],r=b[1]),(0,k.useEffect)(t,r),b[2]!==x?(n=(e,t)=>{e.dataTransfer.setData(aS,JSON.stringify({fromPaneId:x,sessionId:t})),e.dataTransfer.effectAllowed="move"},b[2]=x,b[3]=n):n=b[3];let F=n;if(b[4]!==_||b[5]!==T||b[6]!==$||b[7]!==O||b[8]!==L||b[9]!==F||b[10]!==A||b[11]!==N||b[12]!==R||b[13]!==I||b[14]!==x||b[15]!==P||b[16]!==E||b[17]!==w){i=Symbol.for("react.early_return_sentinel");e:{let e,t,r;b[25]===Symbol.for("react.memo_cache_sentinel")?(e=e=>{let t=e.dataTransfer.types.includes(aS),r=e.dataTransfer.types.includes(aw);(t||r)&&(e.preventDefault(),e.dataTransfer.dropEffect=t?"move":"copy",r&&D(!0))},b[25]=e):e=b[25];let n=e;b[26]===Symbol.for("react.memo_cache_sentinel")?(t=e=>{e.currentTarget.contains(e.relatedTarget)||(D(!1),z(null),B.current=null)},b[26]=t):t=b[26];let d=t;b[27]!==L||b[28]!==R||b[29]!==I||b[30]!==x||b[31]!==P?(r=e=>{e.preventDefault(),D(!1);let t=B.current;z(null),B.current=null;let r=aC(e,aS);if(r)return void(r.fromPaneId===x&&null!==t?P(x,r.sessionId,t):r.fromPaneId!==x&&R(r.fromPaneId,x,r.sessionId));let n=aC(e,aw);n&&(I(x,n.sessionId),L(x))},b[27]=L,b[28]=R,b[29]=I,b[30]=x,b[31]=P,b[32]=r):r=b[32];let p=r;if(!(w.length>1||N.panes.length>1)){i=null;break e}s=`flex items-end shrink-0 bg-[var(--t-surface)] transition-colors ${O?"ring-1 ring-inset ring-[var(--t-accent)]":""}`,l=n,u=d,c=p,a="flex-1 flex items-end min-w-0 overflow-x-auto scrollbar-none gap-px px-1.5 pt-1.5",o=w.map((e,t)=>{let r=E.find(t=>t.id===e),n=e===_;return(0,S.jsxs)(k.Fragment,{children:[$===t&&(0,S.jsx)("div",{className:"w-0.5 shrink-0 self-stretch my-1 rounded-full bg-[var(--t-accent)]"}),(0,S.jsxs)("div",{role:"tab",tabIndex:0,"aria-selected":n,draggable:!0,onDragStart:t=>F(t,e),onDragOver:e=>((e,t)=>{if(!e.dataTransfer.types.includes(aS))return;e.preventDefault(),e.dataTransfer.dropEffect="move";let r=e.currentTarget.getBoundingClientRect(),n=r.left+r.width/2,i=e.clientX<n?t:t+1;B.current=i,z(i)})(e,t),onClick:()=>{I(x,e),L(x)},onKeyDown:t=>{("Enter"===t.key||" "===t.key)&&(t.preventDefault(),I(x,e),L(x))},className:`group relative flex items-center gap-1.5 pl-2.5 pr-1.5 py-1.5 text-[11px] cursor-pointer shrink-0 rounded-t-md transition-colors ${n?"bg-[var(--t-bg)] text-[var(--t-bright)]":"text-[var(--t-dim)] hover:text-[var(--t-text)] hover:bg-[var(--t-elevated)]/60"}`,children:[n&&(0,S.jsx)("span",{className:`absolute bottom-0 left-1.5 right-1.5 h-0.5 rounded-full ${A?"bg-[var(--t-accent)]":"bg-[var(--t-dim)]/50"}`}),(0,S.jsx)(aA,{session:r,size:"sm",showDisconnected:!0}),(0,S.jsx)("span",{className:"truncate max-w-32",children:r?.name??"Session"}),(0,S.jsx)("button",{onClick:t=>{t.stopPropagation(),T(x,e)},className:`shrink-0 p-0.5 rounded-sm transition-all ${n?"text-[var(--t-dim)] hover:text-[var(--t-bright)] hover:bg-[var(--t-elevated)]":"opacity-0 group-hover:opacity-100 text-[var(--t-dim)] hover:text-[var(--t-bright)] hover:bg-[var(--t-dim)]/20"}`,children:(0,S.jsx)(oj,{className:"size-3"})})]})]},e)})}b[4]=_,b[5]=T,b[6]=$,b[7]=O,b[8]=L,b[9]=F,b[10]=A,b[11]=N,b[12]=R,b[13]=I,b[14]=x,b[15]=P,b[16]=E,b[17]=w,b[18]=i,b[19]=a,b[20]=o,b[21]=s,b[22]=l,b[23]=u,b[24]=c}else i=b[18],a=b[19],o=b[20],s=b[21],l=b[22],u=b[23],c=b[24];if(i!==Symbol.for("react.early_return_sentinel"))return i;b[33]!==$||b[34]!==w.length?(d=$===w.length&&(0,S.jsx)("div",{className:"w-0.5 shrink-0 self-stretch my-1 rounded-full bg-[var(--t-accent)]"}),b[33]=$,b[34]=w.length,b[35]=d):d=b[35],b[36]!==d||b[37]!==a||b[38]!==o?(p=(0,S.jsxs)("div",{className:a,children:[o,d]}),b[36]=d,b[37]=a,b[38]=o,b[39]=p):p=b[39],b[40]!==x||b[41]!==M?(f=()=>M(x),b[40]=x,b[41]=M,b[42]=f):f=b[42];let G=N.panes.length>=4||!_;return b[43]===Symbol.for("react.memo_cache_sentinel")?(h=(0,S.jsx)(oN,{className:"size-3"}),b[43]=h):h=b[43],b[44]!==f||b[45]!==G?(m=(0,S.jsx)("button",{onClick:f,disabled:G,className:"p-1 rounded-sm text-[var(--t-dim)] hover:text-[var(--t-bright)] hover:bg-[var(--t-dim)]/20 transition-colors cursor-pointer disabled:opacity-30 disabled:cursor-not-allowed",title:"Split pane",children:h}),b[44]=f,b[45]=G,b[46]=m):m=b[46],b[47]!==j||b[48]!==N.panes.length||b[49]!==x?(g=N.panes.length>1&&(0,S.jsx)("button",{onClick:()=>j(x),className:"p-1 rounded-sm text-[var(--t-dim)] hover:text-[var(--t-bright)] hover:bg-[var(--t-dim)]/20 transition-colors cursor-pointer",title:"Close pane",children:(0,S.jsx)(oO,{className:"size-3"})}),b[47]=j,b[48]=N.panes.length,b[49]=x,b[50]=g):g=b[50],b[51]!==m||b[52]!==g?(y=(0,S.jsxs)("div",{className:"flex items-center shrink-0 px-1.5 pb-1 gap-0.5",children:[m,g]}),b[51]=m,b[52]=g,b[53]=y):y=b[53],b[54]!==p||b[55]!==y||b[56]!==s||b[57]!==l||b[58]!==u||b[59]!==c?(v=(0,S.jsxs)("div",{className:s,onDragOver:l,onDragLeave:u,onDrop:c,children:[p,y]}),b[54]=p,b[55]=y,b[56]=s,b[57]=l,b[58]=u,b[59]=c,b[60]=v):v=b[60],v}let o$=af("git-branch",[["path",{d:"M15 6a9 9 0 0 0-9 9V3",key:"1cii5b"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}]]),oz=af("plug",[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z",key:"1xoxul"}],["path",{d:"M9 8V2",key:"14iosj"}]]),oB=af("unplug",[["path",{d:"m19 5 3-3",key:"yk6iyv"}],["path",{d:"m2 22 3-3",key:"19mgm9"}],["path",{d:"M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z",key:"goz73y"}],["path",{d:"M7.5 13.5 10 11",key:"7xgeeb"}],["path",{d:"M10.5 16.5 13 14",key:"10btkg"}],["path",{d:"m12 6 6 6 2.3-2.3a2.4 2.4 0 0 0 0-3.4l-2.6-2.6a2.4 2.4 0 0 0-3.4 0Z",key:"1snsnr"}]]);function oF(e){return!!e&&"object"==typeof e&&"string"==typeof e.modeId&&"string"==typeof e.name}function oG(e){let t,r,n,i,a,o,s,l,u,c,d,p,f,h,m,g,y=(0,C.c)(38),{cwd:v,connected:b,prompting:x,connecting:w,configOptions:_,pendingAuthMethods:A,modes:E,onConnect:N,onAuthenticateAndConnect:I,onDisconnect:T,onSetConfigOption:R,onSetMode:P}=e,{data:M}=((m=(0,C.c)(8))[0]!==v?(p=["gitBranch",v],m[0]=v,m[1]=p):p=m[1],m[2]!==v?(f=async()=>{let e,t=await (e=v,fetch(`/api/git-branch?cwd=${encodeURIComponent(e)}`));return(await t.json()).branch},m[2]=v,m[3]=f):f=m[3],g=!!v,m[4]!==p||m[5]!==f||m[6]!==g?(h={queryKey:p,queryFn:f,enabled:g},m[4]=p,m[5]=f,m[6]=g,m[7]=h):h=m[7],es(h)),[j,L]=(0,k.useState)(""),O=(E?.modes??[]).filter(oF);y[0]!==A||y[1]!==j?(t=A?.find(e=>e.id===j),r=t?.description?.trim()||"",y[0]=A,y[1]=j,y[2]=t,y[3]=r):(t=y[2],r=y[3]);let D=r;y[4]!==A?.[0]?(n=()=>{let e=A?.[0];L(e?.id??"")},y[4]=A?.[0],y[5]=n):n=y[5],y[6]!==A?(i=[A],y[6]=A,y[7]=i):i=y[7],(0,k.useEffect)(n,i),y[8]!==M||y[9]!==v?(a=v?(0,S.jsxs)("div",{className:"flex items-center gap-2.5 min-w-0",children:[(0,S.jsx)("span",{className:"text-xs font-semibold text-[var(--t-accent)] truncate",children:v.replace(/^\/home\/[^/]+/,"~")}),M&&(0,S.jsxs)("span",{className:"flex items-center gap-1 text-[11px] text-[var(--t-muted)] shrink-0",children:[(0,S.jsx)(o$,{className:"size-3"}),M]})]}):(0,S.jsx)("span",{}),y[8]=M,y[9]=v,y[10]=a):a=y[10],y[11]!==_||y[12]!==R?(o=_&&_.length>0&&_.map(e=>(0,S.jsx)("select",{value:e.currentValue,onChange:t=>R?.(e.id,t.target.value),title:e.description||e.name,className:"h-6 px-1.5 rounded border border-[var(--t-border)] bg-[var(--t-surface)] text-[var(--t-text)] text-xs outline-none cursor-pointer hover:border-[var(--t-accent)] transition-colors",children:e.options.map(oH)},e.id)),y[11]=_,y[12]=R,y[13]=o):o=y[13];let $=O.length>0&&(0,S.jsx)("select",{value:E?.currentModeId??"",onChange:e=>P?.(e.target.value),title:"Session mode",className:"h-6 px-1.5 rounded border border-[var(--t-border)] bg-[var(--t-surface)] text-[var(--t-text)] text-xs outline-none cursor-pointer hover:border-[var(--t-accent)] transition-colors",children:O.map(oW)});return y[14]!==w||y[15]!==I||y[16]!==A||y[17]!==D||y[18]!==t?.description||y[19]!==j?(s=!!A?.length&&(0,S.jsxs)("div",{className:"flex items-center gap-1",children:[(0,S.jsx)("select",{value:j,onChange:e=>L(e.target.value),title:t?.description||"Authentication method",className:"h-6 px-1.5 rounded border border-[var(--t-border)] bg-[var(--t-surface)] text-[var(--t-text)] text-xs outline-none cursor-pointer hover:border-[var(--t-accent)] transition-colors",children:A.map(oU)}),(0,S.jsx)("button",{type:"button",onClick:()=>I?.(j),disabled:!j||w,className:"h-6 px-2 rounded border border-[var(--t-border)] text-[var(--t-text)] hover:border-[var(--t-accent)] disabled:opacity-60 disabled:cursor-default",title:"Authenticate and connect",children:"auth"}),D&&(0,S.jsx)("span",{className:"max-w-44 truncate text-[10px] text-[var(--t-muted)]",title:D,children:D})]}),y[14]=w,y[15]=I,y[16]=A,y[17]=D,y[18]=t?.description,y[19]=j,y[20]=s):s=y[20],y[21]!==x?(l=x&&(0,S.jsxs)("span",{className:"flex items-center gap-1.5 text-[var(--t-amber)]",children:[(0,S.jsx)("span",{className:"size-1.5 rounded-full bg-[var(--t-amber)] animate-pulse"}),"thinking"]}),y[21]=x,y[22]=l):l=y[22],y[23]!==b||y[24]!==w||y[25]!==v||y[26]!==N||y[27]!==T?(u=v&&(0,S.jsxs)("button",{type:"button",onClick:b?T:N,disabled:w,className:`flex items-center gap-1.5 px-2 py-1 rounded-md text-xs transition-colors cursor-pointer disabled:cursor-default ${w?"text-[var(--t-amber)] bg-[var(--t-amber)]/10":b?"text-[var(--t-green)] hover:bg-[var(--t-red)]/10 hover:text-[var(--t-red)]":"text-[var(--t-dim)] hover:bg-[var(--t-green)]/10 hover:text-[var(--t-green)]"}`,title:w?"Connecting...":b?"Disconnect agent":"Connect agent",children:[w?(0,S.jsx)(am,{className:"size-3 animate-spin"}):b?(0,S.jsx)(oz,{className:"size-3"}):(0,S.jsx)(oB,{className:"size-3"}),w?"connecting":b?"connected":"disconnected"]}),y[23]=b,y[24]=w,y[25]=v,y[26]=N,y[27]=T,y[28]=u):u=y[28],y[29]!==l||y[30]!==u||y[31]!==o||y[32]!==$||y[33]!==s?(c=(0,S.jsxs)("div",{className:"flex items-center gap-3 text-xs",children:[o,$,s,l,u]}),y[29]=l,y[30]=u,y[31]=o,y[32]=$,y[33]=s,y[34]=c):c=y[34],y[35]!==c||y[36]!==a?(d=(0,S.jsxs)("div",{className:"flex h-10 shrink-0 items-center justify-between px-4 bg-[var(--t-surface)] border-b border-[var(--t-border)]",children:[a,c]}),y[35]=c,y[36]=a,y[37]=d):d=y[37],d}function oU(e){return(0,S.jsx)("option",{value:e.id,title:e.description,children:e.name},e.id)}function oW(e){return(0,S.jsx)("option",{value:e.modeId,children:e.name},e.modeId)}function oH(e){return"group"in e?(0,S.jsx)("optgroup",{label:e.name,children:e.options.map(oq)},e.group):(0,S.jsx)("option",{value:e.value,children:e.name},e.value)}function oq(e){return(0,S.jsx)("option",{value:e.value,children:e.name},e.value)}let oV=af("square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]),oQ=af("paperclip",[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]]);function oK(e){var t;let r,n,i,a,o,s,l,u,c,d,p,f,h,m,g,y,v,b,x,w,_,A,E,N,I,T,R,M,j,L=(0,C.c)(64),{sessionId:O,active:D,prompting:$,connecting:z,connected:B,availableCommands:F,usageUpdate:G,supportsImages:U,onSend:W,onCancel:H,autoFocus:q}=e,V=void 0===q||q,[Q,K]=(0,k.useState)(""),[X,J]=(0,k.useState)(0);L[0]===Symbol.for("react.memo_cache_sentinel")?(r=[],L[0]=r):r=L[0];let[Y,Z]=(0,k.useState)(r),ee=(0,k.useRef)(null),et=(0,k.useRef)(null),er=(0,k.useRef)(null),{data:en}=(t=O??void 0,(M=(0,C.c)(8))[0]!==t?(I=eh(t??""),M[0]=t,M[1]=I):I=M[1],M[2]!==t?(T=async()=>{let e=await P(t);if(!e.ok)throw Error(`HTTP ${e.status}`);return e.json()},M[2]=t,M[3]=T):T=M[3],j=!!t,M[4]!==I||M[5]!==T||M[6]!==j?(R={queryKey:I,queryFn:T,enabled:j,staleTime:1/0},M[4]=I,M[5]=T,M[6]=j,M[7]=R):R=M[7],es(R));if(L[1]!==en||L[2]!==G){let e,t;n=G?(e=e=>e>=1e3?`${(e/1e3).toFixed(0)}k`:String(e),t=`${e(G.used)}/${e(G.size)}`,G.cost&&(t+=` $${G.cost.amount.toFixed(2)}`),t):en&&en.tokenized_turns>0?`${en.total_tokens.toLocaleString()} tok`:null,L[1]=en,L[2]=G,L[3]=n}else n=L[3];let ei=n,ea=Q.startsWith("/")&&!Q.includes(" ")?F.filter(e=>e.name.toLowerCase().startsWith(Q.slice(1).toLowerCase())):[];L[4]===Symbol.for("react.memo_cache_sentinel")?(i=e=>{for(let t of e){if(!t.type.startsWith("image/"))continue;let e=new FileReader;e.onload=()=>{let r=e.result,n=r.split(",")[1];Z(e=>[...e,{data:n,mimeType:t.type,preview:r}])},e.readAsDataURL(t)}},L[4]=i):i=L[4];let eo=i;L[5]!==eo||L[6]!==U?(a=e=>{e.preventDefault(),U&&e.dataTransfer.files.length&&eo(e.dataTransfer.files)},L[5]=eo,L[6]=U,L[7]=a):a=L[7];let el=a;L[8]!==U?(o=e=>{U&&(e.preventDefault(),e.dataTransfer.dropEffect="copy")},L[8]=U,L[9]=o):o=L[9];let eu=o;L[10]!==eo||L[11]!==U?(s=e=>{if(!U)return;let t=e.clipboardData.items,r=[];for(let e of t)if(e.type.startsWith("image/")){let t=e.getAsFile();t&&r.push(t)}r.length>0&&(e.preventDefault(),eo(r))},L[10]=eo,L[11]=U,L[12]=s):s=L[12];let ec=s;L[13]===Symbol.for("react.memo_cache_sentinel")?(l=e=>{Z(t=>t.filter((t,r)=>r!==e))},L[13]=l):l=L[13];let ed=l,ep=ea.length>0&&!$&&!z;L[14]===Symbol.for("react.memo_cache_sentinel")?(c=()=>{ee.current&&(ee.current.style.height="auto")},u=[],L[14]=u,L[15]=c):(u=L[14],c=L[15]),(0,k.useEffect)(c,u),L[16]!==D||L[17]!==V||L[18]!==z||L[19]!==$?(d=()=>{V&&D&&!$&&!z&&ee.current?.focus()},p=[V,D,$,z],L[16]=D,L[17]=V,L[18]=z,L[19]=$,L[20]=d,L[21]=p):(d=L[20],p=L[21]),(0,k.useEffect)(d,p),L[22]!==D||L[23]!==V?(f=()=>{if(!V||!D)return;let e=e=>{e.target instanceof HTMLInputElement||e.target instanceof HTMLTextAreaElement||e.metaKey||e.ctrlKey||e.altKey||1===e.key.length&&ee.current?.focus()};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},h=[V,D],L[22]=D,L[23]=V,L[24]=f,L[25]=h):(f=L[24],h=L[25]),(0,k.useEffect)(f,h);let ef=e=>{K(`/${e.name} `),J(0),ee.current?.focus()},em=e=>{if(ep){if("ArrowDown"===e.key){e.preventDefault(),J(e=>Math.min(e+1,ea.length-1));return}if("ArrowUp"===e.key){e.preventDefault(),J(oX);return}if("Tab"===e.key||"Enter"===e.key&&!e.shiftKey){e.preventDefault();let t=ea[X];t&&ef(t);return}if("Escape"===e.key){e.preventDefault(),K(""),J(0);return}}if("Enter"===e.key&&!e.shiftKey){e.preventDefault();let t=Q.trim();if((t||Y.length>0)&&!$){let e=[];for(let r of(t&&e.push({type:"text",text:t}),Y))e.push({type:"image",data:r.data,mimeType:r.mimeType});K(""),J(0),Z([]),ee.current&&(ee.current.style.height="auto"),W(t,e.length>1||Y.length>0?e:void 0)}}"Escape"===e.key&&$&&H()};L[26]===Symbol.for("react.memo_cache_sentinel")?(m=e=>{K(e),J(0),ee.current&&(ee.current.style.height="auto",ee.current.style.height=`${Math.min(ee.current.scrollHeight,200)}px`)},L[26]=m):m=L[26];let eg=m;L[27]!==Y?(g=Y.length>0&&(0,S.jsx)("div",{className:"max-w-3xl mx-auto flex gap-2 pt-2 pb-1",children:Y.map((e,t)=>(0,S.jsxs)("div",{className:"relative group",children:[(0,S.jsx)("img",{src:e.preview,alt:"",className:"h-12 rounded border border-[var(--t-border)] object-cover"}),(0,S.jsx)("button",{type:"button",onClick:()=>ed(t),className:"absolute -top-1.5 -right-1.5 rounded-full bg-[var(--t-surface)] border border-[var(--t-border)] p-0.5 opacity-0 group-hover:opacity-100 transition-opacity cursor-pointer",children:(0,S.jsx)(oj,{className:"size-2.5 text-[var(--t-muted)]"})})]},t))}),L[27]=Y,L[28]=g):g=L[28];let ey=ep&&(0,S.jsx)("div",{ref:et,className:"absolute bottom-full left-0 right-0 px-5 pb-1",children:(0,S.jsx)("div",{className:"max-w-3xl mx-auto rounded-md border border-[var(--t-border)] bg-[var(--t-surface)] shadow-lg overflow-hidden",children:ea.map((e,t)=>(0,S.jsxs)("button",{type:"button",onMouseDown:t=>{t.preventDefault(),ef(e)},onMouseEnter:()=>J(t),className:`w-full flex items-center gap-3 px-3 py-1.5 text-left text-sm transition-colors cursor-pointer ${t===X?"bg-[var(--t-elevated)]":"hover:bg-[var(--t-elevated)]/50"}`,children:[(0,S.jsxs)("span",{className:"font-mono text-[var(--t-accent)] shrink-0",children:["/",e.name]}),(0,S.jsx)("span",{className:"text-[var(--t-muted)] truncate text-xs",children:e.description})]},e.name))})}),ev=`shrink-0 text-sm font-mono select-none ${!D||$||z?"text-[var(--t-dim)]":"text-[var(--t-accent)]"}`;L[29]!==ev?(y=(0,S.jsx)("span",{className:ev,children:"❯"}),L[29]=ev,L[30]=y):y=L[30],L[31]!==eg?(v=e=>eg(e.target.value),L[31]=eg,L[32]=v):v=L[32];let eb=!D||z;L[33]===Symbol.for("react.memo_cache_sentinel")?(b={caretColor:"var(--t-accent)"},L[33]=b):b=L[33];let ex=D?z?"Connecting agent...":$?"Agent is thinking...":B?`Send a message${ei?` (${ei})`:""}...`:`Send a message to reconnect${ei?` (${ei})`:""}...`:"";return L[34]!==em||L[35]!==ec||L[36]!==Q||L[37]!==v||L[38]!==eb||L[39]!==ex?(x=(0,S.jsx)("textarea",{ref:ee,value:Q,onChange:v,onKeyDown:em,onPaste:ec,disabled:eb,rows:1,className:"flex-1 resize-none bg-transparent text-sm text-[var(--t-bright)] outline-none placeholder:text-[var(--t-dim)] disabled:opacity-40",style:b,placeholder:ex,spellCheck:!1}),L[34]=em,L[35]=ec,L[36]=Q,L[37]=v,L[38]=eb,L[39]=ex,L[40]=x):x=L[40],L[41]!==D||L[42]!==z||L[43]!==eo||L[44]!==$||L[45]!==U?(w=U&&D&&!$&&!z&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)("input",{ref:er,type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:e=>{e.target.files&&eo(e.target.files),e.target.value=""}}),(0,S.jsx)("button",{type:"button",onClick:()=>er.current?.click(),className:"shrink-0 text-[var(--t-dim)] hover:text-[var(--t-muted)] transition-colors cursor-pointer",title:"Attach image",children:(0,S.jsx)(oQ,{className:"size-3.5"})})]}),L[41]=D,L[42]=z,L[43]=eo,L[44]=$,L[45]=U,L[46]=w):w=L[46],L[47]!==D||L[48]!==H||L[49]!==$?(_=D&&$?(0,S.jsx)("button",{type:"button",onClick:H,className:"shrink-0 rounded-md bg-[var(--t-red)]/15 p-2 text-[var(--t-red)] hover:bg-[var(--t-red)]/25 transition-colors cursor-pointer",title:"Stop (Esc)",children:(0,S.jsx)(oV,{className:"size-3.5"})}):D?(0,S.jsx)("span",{className:"shrink-0 text-xs text-[var(--t-muted)] select-none",children:"enter ↵"}):null,L[47]=D,L[48]=H,L[49]=$,L[50]=_):_=L[50],L[51]!==y||L[52]!==x||L[53]!==w||L[54]!==_?(A=(0,S.jsxs)("div",{className:"max-w-3xl mx-auto w-full flex items-center gap-2.5",children:[y,x,w,_]}),L[51]=y,L[52]=x,L[53]=w,L[54]=_,L[55]=A):A=L[55],L[56]!==ey||L[57]!==A?(E=(0,S.jsxs)("div",{className:"h-12 flex items-center relative",children:[ey,A]}),L[56]=ey,L[57]=A,L[58]=E):E=L[58],L[59]!==eu||L[60]!==el||L[61]!==g||L[62]!==E?(N=(0,S.jsxs)("div",{className:"shrink-0 border-t border-[var(--t-border)] bg-[var(--t-surface)] px-5 relative",onDrop:el,onDragOver:eu,children:[g,E]}),L[59]=eu,L[60]=el,L[61]=g,L[62]=E,L[63]=N):N=L[63],N}function oX(e){return Math.max(e-1,0)}var oJ=e.i(4678),oY=oJ;let oZ=af("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]),o0=af("file-text",[["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:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]),o1=af("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]),o2=af("brain",[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]]),o5=af("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"}]]),o3=af("globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);class o4{diff(e,t,r={}){let n;"function"==typeof r?(n=r,r={}):"callback"in r&&(n=r.callback);let i=this.castInput(e,r),a=this.castInput(t,r),o=this.removeEmpty(this.tokenize(i,r)),s=this.removeEmpty(this.tokenize(a,r));return this.diffWithOptionsObj(o,s,r,n)}diffWithOptionsObj(e,t,r,n){var i;let a=e=>(e=this.postProcess(e,r),n)?void setTimeout(function(){n(e)},0):e,o=t.length,s=e.length,l=1,u=o+s;null!=r.maxEditLength&&(u=Math.min(u,r.maxEditLength));let c=null!=(i=r.timeout)?i:1/0,d=Date.now()+c,p=[{oldPos:-1,lastComponent:void 0}],f=this.extractCommon(p[0],t,e,0,r);if(p[0].oldPos+1>=s&&f+1>=o)return a(this.buildValues(p[0].lastComponent,t,e));let h=-1/0,m=1/0,g=()=>{for(let n=Math.max(h,-l);n<=Math.min(m,l);n+=2){let i,l=p[n-1],u=p[n+1];l&&(p[n-1]=void 0);let c=!1;if(u){let e=u.oldPos-n;c=u&&0<=e&&e<o}let d=l&&l.oldPos+1<s;if(!c&&!d){p[n]=void 0;continue}if(i=!d||c&&l.oldPos<u.oldPos?this.addToPath(u,!0,!1,0,r):this.addToPath(l,!1,!0,1,r),f=this.extractCommon(i,t,e,n,r),i.oldPos+1>=s&&f+1>=o)return a(this.buildValues(i.lastComponent,t,e))||!0;p[n]=i,i.oldPos+1>=s&&(m=Math.min(m,n-1)),f+1>=o&&(h=Math.max(h,n+1))}l++};if(n)!function e(){setTimeout(function(){if(l>u||Date.now()>d)return n(void 0);g()||e()},0)}();else for(;l<=u&&Date.now()<=d;){let e=g();if(e)return e}}addToPath(e,t,r,n,i){let a=e.lastComponent;return a&&!i.oneChangePerToken&&a.added===t&&a.removed===r?{oldPos:e.oldPos+n,lastComponent:{count:a.count+1,added:t,removed:r,previousComponent:a.previousComponent}}:{oldPos:e.oldPos+n,lastComponent:{count:1,added:t,removed:r,previousComponent:a}}}extractCommon(e,t,r,n,i){let a=t.length,o=r.length,s=e.oldPos,l=s-n,u=0;for(;l+1<a&&s+1<o&&this.equals(r[s+1],t[l+1],i);)l++,s++,u++,i.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return u&&!i.oneChangePerToken&&(e.lastComponent={count:u,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=s,l}equals(e,t,r){return r.comparator?r.comparator(e,t):e===t||!!r.ignoreCase&&e.toLowerCase()===t.toLowerCase()}removeEmpty(e){let t=[];for(let r=0;r<e.length;r++)e[r]&&t.push(e[r]);return t}castInput(e,t){return e}tokenize(e,t){return Array.from(e)}join(e){return e.join("")}postProcess(e,t){return e}get useLongestToken(){return!1}buildValues(e,t,r){let n,i=[];for(;e;)i.push(e),n=e.previousComponent,delete e.previousComponent,e=n;i.reverse();let a=i.length,o=0,s=0,l=0;for(;o<a;o++){let e=i[o];if(e.removed)e.value=this.join(r.slice(l,l+e.count)),l+=e.count;else{if(!e.added&&this.useLongestToken){let n=t.slice(s,s+e.count);n=n.map(function(e,t){let n=r[l+t];return n.length>e.length?n:e}),e.value=this.join(n)}else e.value=this.join(t.slice(s,s+e.count));s+=e.count,e.added||(l+=e.count)}}return i}}let o6=new class extends o4{constructor(){super(...arguments),this.tokenize=o8}equals(e,t,r){return r.ignoreWhitespace?(r.newlineIsToken&&e.includes("\n")||(e=e.trim()),r.newlineIsToken&&t.includes("\n")||(t=t.trim())):r.ignoreNewlineAtEof&&!r.newlineIsToken&&(e.endsWith("\n")&&(e=e.slice(0,-1)),t.endsWith("\n")&&(t=t.slice(0,-1))),super.equals(e,t,r)}};function o8(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,"\n"));let r=[],n=e.split(/(\n|\r\n)/);n[n.length-1]||n.pop();for(let e=0;e<n.length;e++){let i=n[e];e%2&&!t.newlineIsToken?r[r.length-1]+=i:r.push(i)}return r}function o7(e){try{return JSON.parse(e)}catch{return null}}let o9={execute:oI,read:o0,edit:o5,search:o1,think:o2,command_execution:oI,file_operation:o0,web_request:o3,code_execution:oI},se={completed:[oZ,"size-3.5 shrink-0 text-[var(--t-green)]"],failed:[oj,"size-3.5 shrink-0 text-[var(--t-red)]"],in_progress:[am,"size-3.5 shrink-0 animate-spin text-[var(--t-amber)]"],pending:[am,"size-3.5 shrink-0 animate-spin text-[var(--t-amber)]"]};function st(e){return!e||"object"!=typeof e||Array.isArray(e)?null:e}function sr(e){let t="string"==typeof e?o7(e):e;if(!t||"object"!=typeof t)return null;if(t.changes&&"object"==typeof t.changes){let e=[];for(let[r,n]of Object.entries(t.changes))n&&"object"==typeof n&&e.push({path:r,content:"string"==typeof n.content?n.content:"",type:"string"==typeof n.type?n.type:"unknown",oldContent:"string"==typeof n.old_content?n.old_content:void 0});return e.length>0?e:null}return"string"==typeof t.old_string||"string"==typeof t.new_string?[{path:"string"==typeof t.file_path?t.file_path:"",type:t.old_string?"edit":"add",content:"string"==typeof t.new_string?t.new_string:"",oldContent:"string"==typeof t.old_string?t.old_string:void 0}]:null}let sn=/^(?:https?|file):\/\//i,si=0;function sa(){return`text-${++si}`}let so=0;function ss(e,t){return e.findIndex(e=>"tool_call"===e.type&&e.state.toolCallId===t)}function sl(e,t,r){return e.map((e,n)=>n===t?r:e)}function su(e,t){let r=e[e.length-1];return r?.type==="text"?[...e.slice(0,-1),{type:"text",id:r.id,content:r.content+`
2
+
3
+ ${t}`}]:[...e,{type:"text",id:sa(),content:t}]}let sc={streamingBlocks:[],prompting:!1,optimisticTurn:null};function sd(e,t){switch(t.type){case"SET_OPTIMISTIC_TURN":return{...e,optimisticTurn:t.turn};case"SSE_PROMPT_STARTED":return{...e,prompting:!0,streamingBlocks:[]};case"SSE_PROMPT_FINISHED":case"SSE_DISCONNECTED":return{...e,prompting:!1};case"SSE_DONE":return{...e,prompting:!1,optimisticTurn:null,streamingBlocks:[]};case"SSE_STATUS":return e.prompting===t.prompting?e:{...e,prompting:t.prompting};case"SSE_ERROR":return{...e,prompting:!1,streamingBlocks:su(e.streamingBlocks,t.message)};case"SSE_STREAMING":return{...e,streamingBlocks:function(e,t){let r=t.sessionUpdate;if("agent_thought_chunk"===r&&t.content?.type==="text"){let r=t.content.text,n=e[e.length-1];return n?.type==="thought"?[...e.slice(0,-1),{type:"thought",id:n.id,content:n.content+r}]:[...e,{type:"thought",id:`thought-${++so}`,content:r}]}if("user_message_chunk"===r)return e;if("agent_message_chunk"===r){let r=t.content;if(r?.type==="text"){let t=r.text,n=e[e.length-1];return n?.type==="text"?[...e.slice(0,-1),{type:"text",id:n.id,content:n.content+t}]:[...e,{type:"text",id:sa(),content:t}]}return r?.type==="image"?[...e,{type:"image",id:sa(),data:r.data,mimeType:r.mimeType}]:e}if("tool_call"===r||"tool_call_update"===r){let n=t.toolCallId,i=ss(e,n);if(i>=0){let r,n=e[i].state;return sl(e,i,{type:"tool_call",state:(r={...n},null!=t.title&&(r.title=t.title),null!=t.kind&&(r.kind=t.kind),null!=t.status&&(r.status=t.status),void 0!==t.rawInput&&(r.rawInput=t.rawInput),void 0!==t.rawOutput&&(r.rawOutput=t.rawOutput),r)})}if("tool_call"===r){let r={toolCallId:n,title:t.title||"Tool call",status:t.status||"in_progress"};return null!=t.kind&&(r.kind=t.kind),void 0!==t.rawInput&&(r.rawInput=t.rawInput),void 0!==t.rawOutput&&(r.rawOutput=t.rawOutput),[...e,{type:"tool_call",state:r}]}return e}if("permission_request"===r){let r=t.toolCall,n=r?.toolCallId,i=t.requestId,a=t.options;if(n){let t=ss(e,n);if(t>=0){let r=e[t].state;return sl(e,t,{type:"tool_call",state:{...r,permissionRequest:{requestId:i,options:a}}})}let o={toolCallId:n,title:r?.title||"Tool call",status:r?.status||"pending",permissionRequest:{requestId:i,options:a}};return r?.kind!=null&&(o.kind=r.kind),r?.rawInput!==void 0&&(o.rawInput=r.rawInput),[...e,{type:"tool_call",state:o}]}return e}if("plan"===r){let r=t.entries,n=e.findIndex(e=>"plan"===e.type);return n>=0?sl(e,n,{type:"plan",entries:r}):[...e,{type:"plan",entries:r}]}if("permission_resolved"===r){let r=t.requestId,n=e.findIndex(e=>"tool_call"===e.type&&e.state.permissionRequest?.requestId===r);if(n>=0){let t=e[n].state;return sl(e,n,{type:"tool_call",state:{...t,permissionRequest:void 0}})}}return e}(e.streamingBlocks,t.data)};case"APPEND_ERROR":return{...e,streamingBlocks:su(e.streamingBlocks,t.message)};case"RESET":return sc}}var oY=oJ;let sp=[{id:"abap",name:"ABAP",import:()=>e.A(16690)},{id:"actionscript-3",name:"ActionScript",import:()=>e.A(74435)},{id:"ada",name:"Ada",import:()=>e.A(96339)},{id:"angular-html",name:"Angular HTML",import:()=>e.A(96546)},{id:"angular-ts",name:"Angular TypeScript",import:()=>e.A(60308)},{id:"apache",name:"Apache Conf",import:()=>e.A(8734)},{id:"apex",name:"Apex",import:()=>e.A(2952)},{id:"apl",name:"APL",import:()=>e.A(14026)},{id:"applescript",name:"AppleScript",import:()=>e.A(10042)},{id:"ara",name:"Ara",import:()=>e.A(27701)},{id:"asciidoc",name:"AsciiDoc",aliases:["adoc"],import:()=>e.A(64940)},{id:"asm",name:"Assembly",import:()=>e.A(81996)},{id:"astro",name:"Astro",import:()=>e.A(85223)},{id:"awk",name:"AWK",import:()=>e.A(77689)},{id:"ballerina",name:"Ballerina",import:()=>e.A(87861)},{id:"bat",name:"Batch File",aliases:["batch"],import:()=>e.A(69047)},{id:"beancount",name:"Beancount",import:()=>e.A(66005)},{id:"berry",name:"Berry",aliases:["be"],import:()=>e.A(64129)},{id:"bibtex",name:"BibTeX",import:()=>e.A(86785)},{id:"bicep",name:"Bicep",import:()=>e.A(34475)},{id:"bird2",name:"BIRD2 Configuration",aliases:["bird"],import:()=>e.A(73197)},{id:"blade",name:"Blade",import:()=>e.A(84291)},{id:"bsl",name:"1C (Enterprise)",aliases:["1c"],import:()=>e.A(54810)},{id:"c",name:"C",import:()=>e.A(15630)},{id:"c3",name:"C3",import:()=>e.A(21406)},{id:"cadence",name:"Cadence",aliases:["cdc"],import:()=>e.A(28418)},{id:"cairo",name:"Cairo",import:()=>e.A(96018)},{id:"clarity",name:"Clarity",import:()=>e.A(68805)},{id:"clojure",name:"Clojure",aliases:["clj"],import:()=>e.A(85670)},{id:"cmake",name:"CMake",import:()=>e.A(50277)},{id:"cobol",name:"COBOL",import:()=>e.A(8435)},{id:"codeowners",name:"CODEOWNERS",import:()=>e.A(77655)},{id:"codeql",name:"CodeQL",aliases:["ql"],import:()=>e.A(93919)},{id:"coffee",name:"CoffeeScript",aliases:["coffeescript"],import:()=>e.A(99510)},{id:"common-lisp",name:"Common Lisp",aliases:["lisp"],import:()=>e.A(14583)},{id:"coq",name:"Coq",import:()=>e.A(38305)},{id:"cpp",name:"C++",aliases:["c++"],import:()=>e.A(62895)},{id:"crystal",name:"Crystal",import:()=>e.A(15822)},{id:"csharp",name:"C#",aliases:["c#","cs"],import:()=>e.A(56548)},{id:"css",name:"CSS",import:()=>e.A(68853)},{id:"csv",name:"CSV",import:()=>e.A(8072)},{id:"cue",name:"CUE",import:()=>e.A(79420)},{id:"cypher",name:"Cypher",aliases:["cql"],import:()=>e.A(1081)},{id:"d",name:"D",import:()=>e.A(32086)},{id:"dart",name:"Dart",import:()=>e.A(8814)},{id:"dax",name:"DAX",import:()=>e.A(6010)},{id:"desktop",name:"Desktop",import:()=>e.A(11671)},{id:"diff",name:"Diff",import:()=>e.A(99264)},{id:"docker",name:"Dockerfile",aliases:["dockerfile"],import:()=>e.A(64927)},{id:"dotenv",name:"dotEnv",import:()=>e.A(86855)},{id:"dream-maker",name:"Dream Maker",import:()=>e.A(55357)},{id:"edge",name:"Edge",import:()=>e.A(40814)},{id:"elixir",name:"Elixir",import:()=>e.A(34593)},{id:"elm",name:"Elm",import:()=>e.A(80402)},{id:"emacs-lisp",name:"Emacs Lisp",aliases:["elisp"],import:()=>e.A(59962)},{id:"erb",name:"ERB",import:()=>e.A(55306)},{id:"erlang",name:"Erlang",aliases:["erl"],import:()=>e.A(79291)},{id:"fennel",name:"Fennel",import:()=>e.A(56334)},{id:"fish",name:"Fish",import:()=>e.A(55953)},{id:"fluent",name:"Fluent",aliases:["ftl"],import:()=>e.A(72286)},{id:"fortran-fixed-form",name:"Fortran (Fixed Form)",aliases:["f","for","f77"],import:()=>e.A(9599)},{id:"fortran-free-form",name:"Fortran (Free Form)",aliases:["f90","f95","f03","f08","f18"],import:()=>e.A(17187)},{id:"fsharp",name:"F#",aliases:["f#","fs"],import:()=>e.A(6583)},{id:"gdresource",name:"GDResource",aliases:["tscn","tres"],import:()=>e.A(350)},{id:"gdscript",name:"GDScript",aliases:["gd"],import:()=>e.A(18592)},{id:"gdshader",name:"GDShader",import:()=>e.A(64292)},{id:"genie",name:"Genie",import:()=>e.A(51227)},{id:"gherkin",name:"Gherkin",import:()=>e.A(81674)},{id:"git-commit",name:"Git Commit Message",import:()=>e.A(65886)},{id:"git-rebase",name:"Git Rebase Message",import:()=>e.A(43635)},{id:"gleam",name:"Gleam",import:()=>e.A(69752)},{id:"glimmer-js",name:"Glimmer JS",aliases:["gjs"],import:()=>e.A(20210)},{id:"glimmer-ts",name:"Glimmer TS",aliases:["gts"],import:()=>e.A(70415)},{id:"glsl",name:"GLSL",import:()=>e.A(15932)},{id:"gn",name:"GN",import:()=>e.A(46517)},{id:"gnuplot",name:"Gnuplot",import:()=>e.A(34810)},{id:"go",name:"Go",import:()=>e.A(18233)},{id:"graphql",name:"GraphQL",aliases:["gql"],import:()=>e.A(27502)},{id:"groovy",name:"Groovy",import:()=>e.A(83131)},{id:"hack",name:"Hack",import:()=>e.A(66363)},{id:"haml",name:"Ruby Haml",import:()=>e.A(36482)},{id:"handlebars",name:"Handlebars",aliases:["hbs"],import:()=>e.A(19104)},{id:"haskell",name:"Haskell",aliases:["hs"],import:()=>e.A(82274)},{id:"haxe",name:"Haxe",import:()=>e.A(43593)},{id:"hcl",name:"HashiCorp HCL",import:()=>e.A(92582)},{id:"hjson",name:"Hjson",import:()=>e.A(32395)},{id:"hlsl",name:"HLSL",import:()=>e.A(36975)},{id:"html",name:"HTML",import:()=>e.A(15475)},{id:"html-derivative",name:"HTML (Derivative)",import:()=>e.A(36812)},{id:"http",name:"HTTP",import:()=>e.A(22332)},{id:"hurl",name:"Hurl",import:()=>e.A(77996)},{id:"hxml",name:"HXML",import:()=>e.A(12671)},{id:"hy",name:"Hy",import:()=>e.A(98975)},{id:"imba",name:"Imba",import:()=>e.A(21794)},{id:"ini",name:"INI",aliases:["properties"],import:()=>e.A(12237)},{id:"java",name:"Java",import:()=>e.A(28056)},{id:"javascript",name:"JavaScript",aliases:["js","cjs","mjs"],import:()=>e.A(92799)},{id:"jinja",name:"Jinja",import:()=>e.A(535)},{id:"jison",name:"Jison",import:()=>e.A(99868)},{id:"json",name:"JSON",import:()=>e.A(92658)},{id:"json5",name:"JSON5",import:()=>e.A(45390)},{id:"jsonc",name:"JSON with Comments",import:()=>e.A(59901)},{id:"jsonl",name:"JSON Lines",import:()=>e.A(44018)},{id:"jsonnet",name:"Jsonnet",import:()=>e.A(32597)},{id:"jssm",name:"JSSM",aliases:["fsl"],import:()=>e.A(86493)},{id:"jsx",name:"JSX",import:()=>e.A(87672)},{id:"julia",name:"Julia",aliases:["jl"],import:()=>e.A(48045)},{id:"just",name:"Just",import:()=>e.A(4538)},{id:"kdl",name:"KDL",import:()=>e.A(22051)},{id:"kotlin",name:"Kotlin",aliases:["kt","kts"],import:()=>e.A(78014)},{id:"kusto",name:"Kusto",aliases:["kql"],import:()=>e.A(11938)},{id:"latex",name:"LaTeX",import:()=>e.A(82697)},{id:"lean",name:"Lean 4",aliases:["lean4"],import:()=>e.A(6774)},{id:"less",name:"Less",import:()=>e.A(57069)},{id:"liquid",name:"Liquid",import:()=>e.A(33954)},{id:"llvm",name:"LLVM IR",import:()=>e.A(69445)},{id:"log",name:"Log file",import:()=>e.A(32210)},{id:"logo",name:"Logo",import:()=>e.A(17136)},{id:"lua",name:"Lua",import:()=>e.A(47287)},{id:"luau",name:"Luau",import:()=>e.A(98173)},{id:"make",name:"Makefile",aliases:["makefile"],import:()=>e.A(18877)},{id:"markdown",name:"Markdown",aliases:["md"],import:()=>e.A(59142)},{id:"marko",name:"Marko",import:()=>e.A(44609)},{id:"matlab",name:"MATLAB",import:()=>e.A(23845)},{id:"mdc",name:"MDC",import:()=>e.A(67535)},{id:"mdx",name:"MDX",import:()=>e.A(59189)},{id:"mermaid",name:"Mermaid",aliases:["mmd"],import:()=>e.A(57619)},{id:"mipsasm",name:"MIPS Assembly",aliases:["mips"],import:()=>e.A(1626)},{id:"mojo",name:"Mojo",import:()=>e.A(24176)},{id:"moonbit",name:"MoonBit",aliases:["mbt","mbti"],import:()=>e.A(5353)},{id:"move",name:"Move",import:()=>e.A(47969)},{id:"narrat",name:"Narrat Language",aliases:["nar"],import:()=>e.A(55902)},{id:"nextflow",name:"Nextflow",aliases:["nf"],import:()=>e.A(57638)},{id:"nextflow-groovy",name:"nextflow-groovy",import:()=>e.A(72194)},{id:"nginx",name:"Nginx",import:()=>e.A(47723)},{id:"nim",name:"Nim",import:()=>e.A(46820)},{id:"nix",name:"Nix",import:()=>e.A(65220)},{id:"nushell",name:"nushell",aliases:["nu"],import:()=>e.A(21908)},{id:"objective-c",name:"Objective-C",aliases:["objc"],import:()=>e.A(98543)},{id:"objective-cpp",name:"Objective-C++",import:()=>e.A(53213)},{id:"ocaml",name:"OCaml",import:()=>e.A(57016)},{id:"odin",name:"Odin",import:()=>e.A(144)},{id:"openscad",name:"OpenSCAD",aliases:["scad"],import:()=>e.A(89188)},{id:"pascal",name:"Pascal",import:()=>e.A(67102)},{id:"perl",name:"Perl",import:()=>e.A(90087)},{id:"php",name:"PHP",import:()=>e.A(53525)},{id:"pkl",name:"Pkl",import:()=>e.A(6695)},{id:"plsql",name:"PL/SQL",import:()=>e.A(85641)},{id:"po",name:"Gettext PO",aliases:["pot","potx"],import:()=>e.A(15520)},{id:"polar",name:"Polar",import:()=>e.A(79736)},{id:"postcss",name:"PostCSS",import:()=>e.A(44743)},{id:"powerquery",name:"PowerQuery",import:()=>e.A(69901)},{id:"powershell",name:"PowerShell",aliases:["ps","ps1"],import:()=>e.A(49765)},{id:"prisma",name:"Prisma",import:()=>e.A(25840)},{id:"prolog",name:"Prolog",import:()=>e.A(78110)},{id:"proto",name:"Protocol Buffer 3",aliases:["protobuf"],import:()=>e.A(10002)},{id:"pug",name:"Pug",aliases:["jade"],import:()=>e.A(53456)},{id:"puppet",name:"Puppet",import:()=>e.A(28116)},{id:"purescript",name:"PureScript",import:()=>e.A(62792)},{id:"python",name:"Python",aliases:["py"],import:()=>e.A(48436)},{id:"qml",name:"QML",import:()=>e.A(85774)},{id:"qmldir",name:"QML Directory",import:()=>e.A(22682)},{id:"qss",name:"Qt Style Sheets",import:()=>e.A(29273)},{id:"r",name:"R",import:()=>e.A(17431)},{id:"racket",name:"Racket",import:()=>e.A(27184)},{id:"raku",name:"Raku",aliases:["perl6"],import:()=>e.A(2999)},{id:"razor",name:"ASP.NET Razor",import:()=>e.A(22510)},{id:"reg",name:"Windows Registry Script",import:()=>e.A(92914)},{id:"regexp",name:"RegExp",aliases:["regex"],import:()=>e.A(64980)},{id:"rel",name:"Rel",import:()=>e.A(62249)},{id:"riscv",name:"RISC-V",import:()=>e.A(19686)},{id:"ron",name:"RON",import:()=>e.A(23169)},{id:"rosmsg",name:"ROS Interface",import:()=>e.A(66973)},{id:"rst",name:"reStructuredText",import:()=>e.A(80357)},{id:"ruby",name:"Ruby",aliases:["rb"],import:()=>e.A(60137)},{id:"rust",name:"Rust",aliases:["rs"],import:()=>e.A(25837)},{id:"sas",name:"SAS",import:()=>e.A(59154)},{id:"sass",name:"Sass",import:()=>e.A(28160)},{id:"scala",name:"Scala",import:()=>e.A(79226)},{id:"scheme",name:"Scheme",import:()=>e.A(95554)},{id:"scss",name:"SCSS",import:()=>e.A(56229)},{id:"sdbl",name:"1C (Query)",aliases:["1c-query"],import:()=>e.A(57294)},{id:"shaderlab",name:"ShaderLab",aliases:["shader"],import:()=>e.A(87646)},{id:"shellscript",name:"Shell",aliases:["bash","sh","shell","zsh"],import:()=>e.A(77876)},{id:"shellsession",name:"Shell Session",aliases:["console"],import:()=>e.A(2789)},{id:"smalltalk",name:"Smalltalk",import:()=>e.A(5404)},{id:"solidity",name:"Solidity",import:()=>e.A(64050)},{id:"soy",name:"Closure Templates",aliases:["closure-templates"],import:()=>e.A(23766)},{id:"sparql",name:"SPARQL",import:()=>e.A(71095)},{id:"splunk",name:"Splunk Query Language",aliases:["spl"],import:()=>e.A(13125)},{id:"sql",name:"SQL",import:()=>e.A(47760)},{id:"ssh-config",name:"SSH Config",import:()=>e.A(25380)},{id:"stata",name:"Stata",import:()=>e.A(27772)},{id:"stylus",name:"Stylus",aliases:["styl"],import:()=>e.A(31592)},{id:"surrealql",name:"SurrealQL",aliases:["surql"],import:()=>e.A(42509)},{id:"svelte",name:"Svelte",import:()=>e.A(9551)},{id:"swift",name:"Swift",import:()=>e.A(74099)},{id:"system-verilog",name:"SystemVerilog",import:()=>e.A(1250)},{id:"systemd",name:"Systemd Units",import:()=>e.A(44475)},{id:"talonscript",name:"TalonScript",aliases:["talon"],import:()=>e.A(538)},{id:"tasl",name:"Tasl",import:()=>e.A(36651)},{id:"tcl",name:"Tcl",import:()=>e.A(9948)},{id:"templ",name:"Templ",import:()=>e.A(40336)},{id:"terraform",name:"Terraform",aliases:["tf","tfvars"],import:()=>e.A(8436)},{id:"tex",name:"TeX",import:()=>e.A(55636)},{id:"toml",name:"TOML",import:()=>e.A(51979)},{id:"ts-tags",name:"TypeScript with Tags",aliases:["lit"],import:()=>e.A(65678)},{id:"tsv",name:"TSV",import:()=>e.A(41727)},{id:"tsx",name:"TSX",import:()=>e.A(57754)},{id:"turtle",name:"Turtle",import:()=>e.A(70454)},{id:"twig",name:"Twig",import:()=>e.A(70515)},{id:"typescript",name:"TypeScript",aliases:["ts","cts","mts"],import:()=>e.A(48460)},{id:"typespec",name:"TypeSpec",aliases:["tsp"],import:()=>e.A(44538)},{id:"typst",name:"Typst",aliases:["typ"],import:()=>e.A(63321)},{id:"v",name:"V",import:()=>e.A(43837)},{id:"vala",name:"Vala",import:()=>e.A(30536)},{id:"vb",name:"Visual Basic",aliases:["cmd"],import:()=>e.A(85051)},{id:"verilog",name:"Verilog",import:()=>e.A(86017)},{id:"vhdl",name:"VHDL",import:()=>e.A(95694)},{id:"viml",name:"Vim Script",aliases:["vim","vimscript"],import:()=>e.A(4547)},{id:"vue",name:"Vue",import:()=>e.A(34329)},{id:"vue-html",name:"Vue HTML",import:()=>e.A(60550)},{id:"vue-vine",name:"Vue Vine",import:()=>e.A(109)},{id:"vyper",name:"Vyper",aliases:["vy"],import:()=>e.A(34235)},{id:"wasm",name:"WebAssembly",import:()=>e.A(79931)},{id:"wenyan",name:"Wenyan",aliases:["文言"],import:()=>e.A(38463)},{id:"wgsl",name:"WGSL",import:()=>e.A(64547)},{id:"wikitext",name:"Wikitext",aliases:["mediawiki","wiki"],import:()=>e.A(74196)},{id:"wit",name:"WebAssembly Interface Types",import:()=>e.A(26245)},{id:"wolfram",name:"Wolfram",aliases:["wl"],import:()=>e.A(98654)},{id:"xml",name:"XML",import:()=>e.A(60115)},{id:"xsl",name:"XSL",import:()=>e.A(56841)},{id:"yaml",name:"YAML",aliases:["yml"],import:()=>e.A(91412)},{id:"zenscript",name:"ZenScript",import:()=>e.A(41270)},{id:"zig",name:"Zig",import:()=>e.A(32344)}],sf=Object.fromEntries(sp.map(e=>[e.id,e.import])),sh=Object.fromEntries(sp.flatMap(e=>e.aliases?.map(t=>[t,e.import])||[])),sm={...sf,...sh};class sg extends Error{constructor(e){super(e),this.name="ShikiError"}}function sy(e,...t){return t.forEach(t=>{for(let r in t)e[r]=t[r]}),e}var sv=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,sb=class{static hasCaptures(e){return null!==e&&(sv.lastIndex=0,sv.test(e))}static replaceCaptures(e,t,r){return e.replace(sv,(e,n,i,a)=>{let o=r[parseInt(n||i,10)];if(!o)return e;{let e=t.substring(o.start,o.end);for(;"."===e[0];)e=e.substring(1);switch(a){case"downcase":return e.toLowerCase();case"upcase":return e.toUpperCase();default:return e}}})}};function sx(e,t){if(null===e&&null===t)return 0;if(!e)return -1;if(!t)return 1;let r=e.length,n=t.length;if(r===n){for(let n=0;n<r;n++){var i,a;let r=(i=e[n],i<(a=t[n])?-1:+(i>a));if(0!==r)return r}return 0}return r-n}function sw(e){return!!(/^#[0-9a-f]{6}$/i.test(e)||/^#[0-9a-f]{8}$/i.test(e)||/^#[0-9a-f]{3}$/i.test(e)||/^#[0-9a-f]{4}$/i.test(e))}function sS(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var sC=class{constructor(e){this.fn=e}cache=new Map;get(e){if(this.cache.has(e))return this.cache.get(e);let t=this.fn(e);return this.cache.set(e,t),t}},sk=class{constructor(e,t,r){this._colorMap=e,this._defaults=t,this._root=r}static createFromRawTheme(e,t){return this.createFromParsedTheme(function(e){if(!e||!e.settings||!Array.isArray(e.settings))return[];let t=e.settings,r=[],n=0;for(let e=0,i=t.length;e<i;e++){let i,a=t[e];if(!a.settings)continue;if("string"==typeof a.scope){let e=a.scope;i=(e=(e=e.replace(/^[,]+/,"")).replace(/[,]+$/,"")).split(",")}else i=Array.isArray(a.scope)?a.scope:[""];let o=-1;if("string"==typeof a.settings.fontStyle){o=0;let e=a.settings.fontStyle.split(" ");for(let t=0,r=e.length;t<r;t++)switch(e[t]){case"italic":o|=1;break;case"bold":o|=2;break;case"underline":o|=4;break;case"strikethrough":o|=8}}let s=null;"string"==typeof a.settings.foreground&&sw(a.settings.foreground)&&(s=a.settings.foreground);let l=null;"string"==typeof a.settings.background&&sw(a.settings.background)&&(l=a.settings.background);for(let t=0,a=i.length;t<a;t++){let a=i[t].trim().split(" "),u=a[a.length-1],c=null;a.length>1&&(c=a.slice(0,a.length-1)).reverse(),r[n++]=new sE(u,c,e,o,s,l)}}return r}(e),t)}static createFromParsedTheme(e,t){return function(e,t){e.sort((e,t)=>{var r,n;let i=(r=e.scope,r<(n=t.scope)?-1:+(r>n));return 0!==i||0!==(i=sx(e.parentScopes,t.parentScopes))?i:e.index-t.index});let r=0,n="#000000",i="#ffffff";for(;e.length>=1&&""===e[0].scope;){let t=e.shift();-1!==t.fontStyle&&(r=t.fontStyle),null!==t.foreground&&(n=t.foreground),null!==t.background&&(i=t.background)}let a=new sI(t),o=new sA(r,a.getId(n),a.getId(i)),s=new sP(new sR(0,null,-1,0,0),[]);for(let t=0,r=e.length;t<r;t++){let r=e[t];s.insert(0,r.scope,r.parentScopes,r.fontStyle,a.getId(r.foreground),a.getId(r.background))}return new sk(a,o,s)}(e,t)}_cachedMatchRoot=new sC(e=>this._root.match(e));getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(e){if(null===e)return this._defaults;let t=e.scopeName,r=this._cachedMatchRoot.get(t).find(t=>(function(e,t){if(0===t.length)return!0;for(let i=0;i<t.length;i++){var r,n;let a=t[i],o=!1;if(">"===a){if(i===t.length-1)return!1;a=t[++i],o=!0}for(;e&&(r=e.scopeName,!((n=a)===r||r.startsWith(n)&&"."===r[n.length]));){if(o)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0})(e.parent,t.parentScopes));return r?new sA(r.fontStyle,r.foreground,r.background):null}},s_=class e{constructor(e,t){this.parent=e,this.scopeName=t}static push(t,r){for(let n of r)t=new e(t,n);return t}static from(...t){let r=null;for(let n=0;n<t.length;n++)r=new e(r,t[n]);return r}push(t){return new e(this,t)}getSegments(){let e=this,t=[];for(;e;)t.push(e.scopeName),e=e.parent;return t.reverse(),t}toString(){return this.getSegments().join(" ")}extends(e){return this===e||null!==this.parent&&this.parent.extends(e)}getExtensionIfDefined(e){let t=[],r=this;for(;r&&r!==e;)t.push(r.scopeName),r=r.parent;return r===e?t.reverse():void 0}},sA=class{constructor(e,t,r){this.fontStyle=e,this.foregroundId=t,this.backgroundId=r}},sE=class{constructor(e,t,r,n,i,a){this.scope=e,this.parentScopes=t,this.index=r,this.fontStyle=n,this.foreground=i,this.background=a}},sN=((y=sN||{})[y.NotSet=-1]="NotSet",y[y.None=0]="None",y[y.Italic=1]="Italic",y[y.Bold=2]="Bold",y[y.Underline=4]="Underline",y[y.Strikethrough=8]="Strikethrough",y),sI=class{_isFrozen;_lastColorId;_id2color;_color2id;constructor(e){if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(e)){this._isFrozen=!0;for(let t=0,r=e.length;t<r;t++)this._color2id[e[t]]=t,this._id2color[t]=e[t]}else this._isFrozen=!1}getId(e){if(null===e)return 0;e=e.toUpperCase();let t=this._color2id[e];if(t)return t;if(this._isFrozen)throw Error(`Missing color in color map - ${e}`);return t=++this._lastColorId,this._color2id[e]=t,this._id2color[t]=e,t}getColorMap(){return this._id2color.slice(0)}},sT=Object.freeze([]),sR=class e{scopeDepth;parentScopes;fontStyle;foreground;background;constructor(e,t,r,n,i){this.scopeDepth=e,this.parentScopes=t||sT,this.fontStyle=r,this.foreground=n,this.background=i}clone(){return new e(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(e){let t=[];for(let r=0,n=e.length;r<n;r++)t[r]=e[r].clone();return t}acceptOverwrite(e,t,r,n){this.scopeDepth>e?console.log("how did this happen?"):this.scopeDepth=e,-1!==t&&(this.fontStyle=t),0!==r&&(this.foreground=r),0!==n&&(this.background=n)}},sP=class e{constructor(e,t=[],r={}){this._mainRule=e,this._children=r,this._rulesWithParentScopes=t}_rulesWithParentScopes;static _cmpBySpecificity(e,t){if(e.scopeDepth!==t.scopeDepth)return t.scopeDepth-e.scopeDepth;let r=0,n=0;for(;">"===e.parentScopes[r]&&r++,">"===t.parentScopes[n]&&n++,!(r>=e.parentScopes.length)&&!(n>=t.parentScopes.length);){let i=t.parentScopes[n].length-e.parentScopes[r].length;if(0!==i)return i;r++,n++}return t.parentScopes.length-e.parentScopes.length}match(t){if(""!==t){let e,r,n=t.indexOf(".");if(-1===n?(e=t,r=""):(e=t.substring(0,n),r=t.substring(n+1)),this._children.hasOwnProperty(e))return this._children[e].match(r)}let r=this._rulesWithParentScopes.concat(this._mainRule);return r.sort(e._cmpBySpecificity),r}insert(t,r,n,i,a,o){let s,l,u;if(""===r)return void this._doInsertHere(t,n,i,a,o);let c=r.indexOf(".");-1===c?(s=r,l=""):(s=r.substring(0,c),l=r.substring(c+1)),this._children.hasOwnProperty(s)?u=this._children[s]:(u=new e(this._mainRule.clone(),sR.cloneArr(this._rulesWithParentScopes)),this._children[s]=u),u.insert(t+1,l,n,i,a,o)}_doInsertHere(e,t,r,n,i){if(null===t)return void this._mainRule.acceptOverwrite(e,r,n,i);for(let a=0,o=this._rulesWithParentScopes.length;a<o;a++){let o=this._rulesWithParentScopes[a];if(0===sx(o.parentScopes,t))return void o.acceptOverwrite(e,r,n,i)}-1===r&&(r=this._mainRule.fontStyle),0===n&&(n=this._mainRule.foreground),0===i&&(i=this._mainRule.background),this._rulesWithParentScopes.push(new sR(e,t,r,n,i))}},sM=class e{static toBinaryStr(e){return e.toString(2).padStart(32,"0")}static print(t){let r=e.getLanguageId(t),n=e.getTokenType(t),i=e.getFontStyle(t);console.log({languageId:r,tokenType:n,fontStyle:i,foreground:e.getForeground(t),background:e.getBackground(t)})}static getLanguageId(e){return(255&e)>>>0}static getTokenType(e){return(768&e)>>>8}static containsBalancedBrackets(e){return(1024&e)!=0}static getFontStyle(e){return(30720&e)>>>11}static getForeground(e){return(0xff8000&e)>>>15}static getBackground(e){return(0xff000000&e)>>>24}static set(t,r,n,i,a,o,s){let l=e.getLanguageId(t),u=e.getTokenType(t),c=+!!e.containsBalancedBrackets(t),d=e.getFontStyle(t),p=e.getForeground(t),f=e.getBackground(t);return 0!==r&&(l=r),8!==n&&(u=n),null!==i&&(c=+!!i),-1!==a&&(d=a),0!==o&&(p=o),0!==s&&(f=s),(l|u<<8|c<<10|d<<11|p<<15|f<<24)>>>0}};function sj(e,t){var r;let n,i,a=[],o=(r=e,i=(n=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g).exec(r),{next:()=>{if(!i)return null;let e=i[0];return i=n.exec(r),e}}),s=o.next();for(;null!==s;){let e=0;if(2===s.length&&":"===s.charAt(1)){switch(s.charAt(0)){case"R":e=1;break;case"L":e=-1;break;default:console.log(`Unknown priority ${s} in scope selector`)}s=o.next()}let t=u();if(a.push({matcher:t,priority:e}),","!==s)break;s=o.next()}return a;function l(){if("-"===s){s=o.next();let e=l();return t=>!!e&&!e(t)}if("("===s){s=o.next();let e=function(){let e=[],t=u();for(;t&&(e.push(t),"|"===s||","===s);){do s=o.next();while("|"===s||","===s)t=u()}return t=>e.some(e=>e(t))}();return")"===s&&(s=o.next()),e}if(sL(s)){let e=[];do e.push(s),s=o.next();while(sL(s))return r=>t(e,r)}return null}function u(){let e=[],t=l();for(;t;)e.push(t),t=l();return t=>e.every(e=>e(t))}}function sL(e){return!!e&&!!e.match(/[\w\.:]+/)}var sO=((v=sO||{})[v.None=0]="None",v[v.NotBeginString=1]="NotBeginString",v[v.NotEndString=2]="NotEndString",v[v.NotBeginPosition=4]="NotBeginPosition",v[v.DebugCall=8]="DebugCall",v);function sD(e){"function"==typeof e.dispose&&e.dispose()}var s$=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},sz=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},sB=class{_references=[];_seenReferenceKeys=new Set;get references(){return this._references}visitedRule=new Set;add(e){let t=e.toKey();this._seenReferenceKeys.has(t)||(this._seenReferenceKeys.add(t),this._references.push(e))}},sF=class{constructor(e,t){this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new s$(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){let e=this.Q;this.Q=[];let t=new sB;for(let r of e)!function(e,t,r,n){let i=r.lookup(e.scopeName);if(!i){if(e.scopeName===t)throw Error(`No grammar provided for <${t}>`);return}let a=r.lookup(t);e instanceof s$?sU({baseGrammar:a,selfGrammar:i},n):sG(e.ruleName,{baseGrammar:a,selfGrammar:i,repository:i.repository},n);let o=r.injections(e.scopeName);if(o)for(let e of o)n.add(new s$(e))}(r,this.initialScopeName,this.repo,t);for(let e of t.references)if(e instanceof s$){if(this.seenFullScopeRequests.has(e.scopeName))continue;this.seenFullScopeRequests.add(e.scopeName),this.Q.push(e)}else{if(this.seenFullScopeRequests.has(e.scopeName)||this.seenPartialScopeRequests.has(e.toKey()))continue;this.seenPartialScopeRequests.add(e.toKey()),this.Q.push(e)}}};function sG(e,t,r){t.repository&&t.repository[e]&&sW([t.repository[e]],t,r)}function sU(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&&sW(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&&sW(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function sW(e,t,r){for(let n of e){if(r.visitedRule.has(n))continue;r.visitedRule.add(n);let e=n.repository?sy({},t.repository,n.repository):t.repository;Array.isArray(n.patterns)&&sW(n.patterns,{...t,repository:e},r);let i=n.include;if(!i)continue;let a=sX(i);switch(a.kind){case 0:sU({...t,selfGrammar:t.baseGrammar},r);break;case 1:sU(t,r);break;case 2:sG(a.ruleName,{...t,repository:e},r);break;case 3:case 4:let o=a.scopeName===t.selfGrammar.scopeName?t.selfGrammar:a.scopeName===t.baseGrammar.scopeName?t.baseGrammar:void 0;if(o){let n={baseGrammar:t.baseGrammar,selfGrammar:o,repository:e};4===a.kind?sG(a.ruleName,n,r):sU(n,r)}else 4===a.kind?r.add(new sz(a.scopeName,a.ruleName)):r.add(new s$(a.scopeName))}}}var sH=class{kind=0},sq=class{kind=1},sV=class{constructor(e){this.ruleName=e}kind=2},sQ=class{constructor(e){this.scopeName=e}kind=3},sK=class{constructor(e,t){this.scopeName=e,this.ruleName=t}kind=4};function sX(e){if("$base"===e)return new sH;if("$self"===e)return new sq;let t=e.indexOf("#");return -1===t?new sQ(e):0===t?new sV(e.substring(1)):new sK(e.substring(0,t),e.substring(t+1))}var sJ=/\\(\d+)/,sY=/\\(\d+)/g;Symbol("RuleId");var sZ=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(e,t,r,n){this.$location=e,this.id=t,this._name=r||null,this._nameIsCapturing=sb.hasCaptures(this._name),this._contentName=n||null,this._contentNameIsCapturing=sb.hasCaptures(this._contentName)}get debugName(){let e=this.$location?`${function e(t){let r=~t.lastIndexOf("/")||~t.lastIndexOf("\\");return 0===r?t:~r==t.length-1?e(t.substring(0,t.length-1)):t.substr(~r+1)}(this.$location.filename)}:${this.$location.line}`:"unknown";return`${this.constructor.name}#${this.id} @ ${e}`}getName(e,t){return this._nameIsCapturing&&null!==this._name&&null!==e&&null!==t?sb.replaceCaptures(this._name,e,t):this._name}getContentName(e,t){return this._contentNameIsCapturing&&null!==this._contentName?sb.replaceCaptures(this._contentName,e,t):this._contentName}},s0=class extends sZ{retokenizeCapturedWithRuleId;constructor(e,t,r,n,i){super(e,t,r,n),this.retokenizeCapturedWithRuleId=i}dispose(){}collectPatterns(e,t){throw Error("Not supported!")}compile(e,t){throw Error("Not supported!")}compileAG(e,t,r,n){throw Error("Not supported!")}},s1=class extends sZ{_match;captures;_cachedCompiledPatterns;constructor(e,t,r,n,i){super(e,t,r,null),this._match=new s6(n,this.id),this.captures=i,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(e,t){t.push(this._match)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,r,n){return this._getCachedCompiledPatterns(e).compileAG(e,r,n)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new s8,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},s2=class extends sZ{hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,r,n,i){super(e,t,r,n),this.patterns=i.patterns,this.hasMissingPatterns=i.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}collectPatterns(e,t){for(let r of this.patterns)e.getRule(r).collectPatterns(e,t)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,r,n){return this._getCachedCompiledPatterns(e).compileAG(e,r,n)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new s8,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},s5=class extends sZ{_begin;beginCaptures;_end;endHasBackReferences;endCaptures;applyEndPatternLast;hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,r,n,i,a,o,s,l,u){super(e,t,r,n),this._begin=new s6(i,this.id),this.beginCaptures=a,this._end=new s6(o||"￿",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=s,this.applyEndPatternLast=l||!1,this.patterns=u.patterns,this.hasMissingPatterns=u.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(e,t){return this._end.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e,t).compile(e)}compileAG(e,t,r,n){return this._getCachedCompiledPatterns(e,t).compileAG(e,r,n)}_getCachedCompiledPatterns(e,t){if(!this._cachedCompiledPatterns){for(let t of(this._cachedCompiledPatterns=new s8,this.patterns))e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns);this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,t):this._cachedCompiledPatterns.setSource(0,t)),this._cachedCompiledPatterns}},s3=class extends sZ{_begin;beginCaptures;whileCaptures;_while;whileHasBackReferences;hasMissingPatterns;patterns;_cachedCompiledPatterns;_cachedCompiledWhilePatterns;constructor(e,t,r,n,i,a,o,s,l){super(e,t,r,n),this._begin=new s6(i,this.id),this.beginCaptures=a,this.whileCaptures=s,this._while=new s6(o,-2),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=l.patterns,this.hasMissingPatterns=l.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null),this._cachedCompiledWhilePatterns&&(this._cachedCompiledWhilePatterns.dispose(),this._cachedCompiledWhilePatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(e,t){return this._while.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,r,n){return this._getCachedCompiledPatterns(e).compileAG(e,r,n)}_getCachedCompiledPatterns(e){if(!this._cachedCompiledPatterns)for(let t of(this._cachedCompiledPatterns=new s8,this.patterns))e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns);return this._cachedCompiledPatterns}compileWhile(e,t){return this._getCachedCompiledWhilePatterns(e,t).compile(e)}compileWhileAG(e,t,r,n){return this._getCachedCompiledWhilePatterns(e,t).compileAG(e,r,n)}_getCachedCompiledWhilePatterns(e,t){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new s8,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,t||"￿"),this._cachedCompiledWhilePatterns}},s4=class e{static createCaptureRule(e,t,r,n,i){return e.registerRule(e=>new s0(t,e,r,n,i))}static getCompiledRuleId(t,r,n){return t.id||r.registerRule(i=>{if(t.id=i,t.match)return new s1(t.$vscodeTextmateLocation,t.id,t.name,t.match,e._compileCaptures(t.captures,r,n));if(void 0===t.begin){t.repository&&(n=sy({},n,t.repository));let i=t.patterns;return void 0===i&&t.include&&(i=[{include:t.include}]),new s2(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,e._compilePatterns(i,r,n))}return t.while?new s3(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,e._compileCaptures(t.beginCaptures||t.captures,r,n),t.while,e._compileCaptures(t.whileCaptures||t.captures,r,n),e._compilePatterns(t.patterns,r,n)):new s5(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,e._compileCaptures(t.beginCaptures||t.captures,r,n),t.end,e._compileCaptures(t.endCaptures||t.captures,r,n),t.applyEndPatternLast,e._compilePatterns(t.patterns,r,n))}),t.id}static _compileCaptures(t,r,n){let i=[];if(t){let a=0;for(let e in t){if("$vscodeTextmateLocation"===e)continue;let t=parseInt(e,10);t>a&&(a=t)}for(let e=0;e<=a;e++)i[e]=null;for(let a in t){if("$vscodeTextmateLocation"===a)continue;let o=parseInt(a,10),s=0;t[a].patterns&&(s=e.getCompiledRuleId(t[a],r,n)),i[o]=e.createCaptureRule(r,t[a].$vscodeTextmateLocation,t[a].name,t[a].contentName,s)}}return i}static _compilePatterns(t,r,n){let i=[];if(t)for(let a=0,o=t.length;a<o;a++){let o=t[a],s=-1;if(o.include){let t=sX(o.include);switch(t.kind){case 0:case 1:s=e.getCompiledRuleId(n[o.include],r,n);break;case 2:let i=n[t.ruleName];i&&(s=e.getCompiledRuleId(i,r,n));break;case 3:case 4:let a=t.scopeName,l=4===t.kind?t.ruleName:null,u=r.getExternalGrammar(a,n);if(u)if(l){let t=u.repository[l];t&&(s=e.getCompiledRuleId(t,r,u.repository))}else s=e.getCompiledRuleId(u.repository.$self,r,u.repository)}}else s=e.getCompiledRuleId(o,r,n);if(-1!==s){let e=r.getRule(s),t=!1;if((e instanceof s2||e instanceof s5||e instanceof s3)&&e.hasMissingPatterns&&0===e.patterns.length&&(t=!0),t)continue;i.push(s)}}return{patterns:i,hasMissingPatterns:(t?t.length:0)!==i.length}}},s6=class e{source;ruleId;hasAnchor;hasBackReferences;_anchorCache;constructor(e,t){if(e&&"string"==typeof e){const t=e.length;let r=0,n=[],i=!1;for(let a=0;a<t;a++)if("\\"===e.charAt(a)&&a+1<t){const t=e.charAt(a+1);"z"===t?(n.push(e.substring(r,a)),n.push("$(?!\\n)(?<!\\n)"),r=a+2):("A"===t||"G"===t)&&(i=!0),a++}this.hasAnchor=i,0===r?this.source=e:(n.push(e.substring(r,t)),this.source=n.join(""))}else this.hasAnchor=!1,this.source=e;this.hasAnchor?this._anchorCache=this._buildAnchorCache():this._anchorCache=null,this.ruleId=t,"string"==typeof this.source?this.hasBackReferences=sJ.test(this.source):this.hasBackReferences=!1}clone(){return new e(this.source,this.ruleId)}setSource(e){this.source!==e&&(this.source=e,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(e,t){if("string"!=typeof this.source)throw Error("This method should only be called if the source is a string");let r=t.map(t=>e.substring(t.start,t.end));return sY.lastIndex=0,this.source.replace(sY,(e,t)=>sS(r[parseInt(t,10)]||""))}_buildAnchorCache(){let e,t,r,n;if("string"!=typeof this.source)throw Error("This method should only be called if the source is a string");let i=[],a=[],o=[],s=[];for(e=0,t=this.source.length;e<t;e++)r=this.source.charAt(e),i[e]=r,a[e]=r,o[e]=r,s[e]=r,"\\"===r&&e+1<t&&("A"===(n=this.source.charAt(e+1))?(i[e+1]="￿",a[e+1]="￿",o[e+1]="A",s[e+1]="A"):"G"===n?(i[e+1]="￿",a[e+1]="G",o[e+1]="￿",s[e+1]="G"):(i[e+1]=n,a[e+1]=n,o[e+1]=n,s[e+1]=n),e++);return{A0_G0:i.join(""),A0_G1:a.join(""),A1_G0:o.join(""),A1_G1:s.join("")}}resolveAnchors(e,t){if(!this.hasAnchor||!this._anchorCache||"string"!=typeof this.source)return this.source;if(e)if(t)return this._anchorCache.A1_G1;else return this._anchorCache.A1_G0;return t?this._anchorCache.A0_G1:this._anchorCache.A0_G0}},s8=class{_items;_hasAnchors;_cached;_anchorCache;constructor(){this._items=[],this._hasAnchors=!1,this._cached=null,this._anchorCache={A0_G0:null,A0_G1:null,A1_G0:null,A1_G1:null}}dispose(){this._disposeCaches()}_disposeCaches(){this._cached&&(this._cached.dispose(),this._cached=null),this._anchorCache.A0_G0&&(this._anchorCache.A0_G0.dispose(),this._anchorCache.A0_G0=null),this._anchorCache.A0_G1&&(this._anchorCache.A0_G1.dispose(),this._anchorCache.A0_G1=null),this._anchorCache.A1_G0&&(this._anchorCache.A1_G0.dispose(),this._anchorCache.A1_G0=null),this._anchorCache.A1_G1&&(this._anchorCache.A1_G1.dispose(),this._anchorCache.A1_G1=null)}push(e){this._items.push(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}unshift(e){this._items.unshift(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}length(){return this._items.length}setSource(e,t){this._items[e].source!==t&&(this._disposeCaches(),this._items[e].setSource(t))}compile(e){if(!this._cached){let t=this._items.map(e=>e.source);this._cached=new s7(e,t,this._items.map(e=>e.ruleId))}return this._cached}compileAG(e,t,r){if(!this._hasAnchors)return this.compile(e);if(t)if(r)return this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(e,t,r)),this._anchorCache.A1_G1;else return this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(e,t,r)),this._anchorCache.A1_G0;return r?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(e,t,r)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(e,t,r)),this._anchorCache.A0_G0)}_resolveAnchors(e,t,r){return new s7(e,this._items.map(e=>e.resolveAnchors(t,r)),this._items.map(e=>e.ruleId))}},s7=class{constructor(e,t,r){this.regExps=t,this.rules=r,this.scanner=e.createOnigScanner(t)}scanner;dispose(){"function"==typeof this.scanner.dispose&&this.scanner.dispose()}toString(){let e=[];for(let t=0,r=this.rules.length;t<r;t++)e.push(" - "+this.rules[t]+": "+this.regExps[t]);return e.join("\n")}findNextMatchSync(e,t,r){let n=this.scanner.findNextMatchSync(e,t,r);return n?{ruleId:this.rules[n.index],captureIndices:n.captureIndices}:null}},s9=class{constructor(e,t){this.languageId=e,this.tokenType=t}},le=class e{_defaultAttributes;_embeddedLanguagesMatcher;constructor(e,t){this._defaultAttributes=new s9(e,8),this._embeddedLanguagesMatcher=new lt(Object.entries(t||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(t){return null===t?e._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(t)}static _NULL_SCOPE_METADATA=new s9(0,0);_getBasicScopeAttributes=new sC(e=>new s9(this._scopeToLanguage(e),this._toStandardTokenType(e)));_scopeToLanguage(e){return this._embeddedLanguagesMatcher.match(e)||0}_toStandardTokenType(t){let r=t.match(e.STANDARD_TOKEN_TYPE_REGEXP);if(!r)return 8;switch(r[1]){case"comment":return 1;case"string":return 2;case"regex":return 3;case"meta.embedded":return 0}throw Error("Unexpected match for standard token type!")}static STANDARD_TOKEN_TYPE_REGEXP=/\b(comment|string|regex|meta\.embedded)\b/},lt=class{values;scopesRegExp;constructor(e){if(0===e.length)this.values=null,this.scopesRegExp=null;else{this.values=new Map(e);const t=e.map(([e,t])=>sS(e));t.sort(),t.reverse(),this.scopesRegExp=RegExp(`^((${t.join(")|(")}))($|\\.)`,"")}}match(e){if(!this.scopesRegExp)return;let t=e.match(this.scopesRegExp);if(t)return this.values.get(t[1])}};void 0!==en.default&&en.default.env.VSCODE_TEXTMATE_DEBUG;var lr=class{constructor(e,t){this.stack=e,this.stoppedEarly=t}};function ln(e,t,r,n,i,a,o,s){let l=t.content.length,u=!1,c=-1;if(o){let o=function(e,t,r,n,i,a){let o=i.beginRuleCapturedEOL?0:-1,s=[];for(let t=i;t;t=t.pop()){let r=t.getRule(e);r instanceof s3&&s.push({rule:r,stack:t})}for(let f=s.pop();f;f=s.pop()){var l,u,c,d,p;let{ruleScanner:s,findOptions:h}=(l=f.rule,u=e,c=f.stack.endRule,d=r,p=n===o,{ruleScanner:l.compileWhileAG(u,c,d,p),findOptions:0}),m=s.findNextMatchSync(t,n,h);if(m){if(-2!==m.ruleId){i=f.stack.pop();break}m.captureIndices&&m.captureIndices.length&&(a.produce(f.stack,m.captureIndices[0].start),la(e,t,r,f.stack,a,f.rule.whileCaptures,m.captureIndices),a.produce(f.stack,m.captureIndices[0].end),o=m.captureIndices[0].end,m.captureIndices[0].end>n&&(n=m.captureIndices[0].end,r=!1))}else{i=f.stack.pop();break}}return{stack:i,linePos:n,anchorPosition:o,isFirstLine:r}}(e,t,r,n,i,a);i=o.stack,n=o.linePos,r=o.isFirstLine,c=o.anchorPosition}let d=Date.now();for(;!u;){if(0!==s&&Date.now()-d>s)return new lr(i,!0);!function(){let o=function(e,t,r,n,i,a){let o=function(e,t,r,n,i,a){let{ruleScanner:o,findOptions:s}=li(i.getRule(e),e,i.endRule,r,n===a),l=o.findNextMatchSync(t,n,s);return l?{captureIndices:l.captureIndices,matchedRuleId:l.ruleId}:null}(e,t,r,n,i,a),s=e.getInjections();if(0===s.length)return o;let l=function(e,t,r,n,i,a,o){let s,l=Number.MAX_VALUE,u=null,c=0,d=a.contentNameScopesList.getScopeNames();for(let a=0,p=e.length;a<p;a++){let p=e[a];if(!p.matcher(d))continue;let{ruleScanner:f,findOptions:h}=li(t.getRule(p.ruleId),t,null,n,i===o),m=f.findNextMatchSync(r,i,h);if(!m)continue;let g=m.captureIndices[0].start;if(!(g>=l)&&(l=g,u=m.captureIndices,s=m.ruleId,c=p.priority,l===i))break}return u?{priorityMatch:-1===c,captureIndices:u,matchedRuleId:s}:null}(s,e,t,r,n,i,a);if(!l)return o;if(!o)return l;let u=o.captureIndices[0].start,c=l.captureIndices[0].start;return c<u||l.priorityMatch&&c===u?l:o}(e,t,r,n,i,c);if(!o){a.produce(i,l),u=!0;return}let s=o.captureIndices,d=o.matchedRuleId,p=!!s&&s.length>0&&s[0].end>n;if(-1===d){let o=i.getRule(e);a.produce(i,s[0].start),i=i.withContentNameScopesList(i.nameScopesList),la(e,t,r,i,a,o.endCaptures,s),a.produce(i,s[0].end);let d=i;if(i=i.parent,c=d.getAnchorPos(),!p&&d.getEnterPos()===n){i=d,a.produce(i,l),u=!0;return}}else{let o=e.getRule(d);a.produce(i,s[0].start);let f=i,h=o.getName(t.content,s),m=i.contentNameScopesList.pushAttributed(h,e);if(i=i.push(d,n,c,s[0].end===l,null,m,m),o instanceof s5){la(e,t,r,i,a,o.beginCaptures,s),a.produce(i,s[0].end),c=s[0].end;let n=o.getContentName(t.content,s),d=m.pushAttributed(n,e);if(i=i.withContentNameScopesList(d),o.endHasBackReferences&&(i=i.withEndRule(o.getEndWithResolvedBackReferences(t.content,s))),!p&&f.hasSameRuleAs(i)){i=i.pop(),a.produce(i,l),u=!0;return}}else if(o instanceof s3){la(e,t,r,i,a,o.beginCaptures,s),a.produce(i,s[0].end),c=s[0].end;let n=o.getContentName(t.content,s),d=m.pushAttributed(n,e);if(i=i.withContentNameScopesList(d),o.whileHasBackReferences&&(i=i.withEndRule(o.getWhileWithResolvedBackReferences(t.content,s))),!p&&f.hasSameRuleAs(i)){i=i.pop(),a.produce(i,l),u=!0;return}}else if(la(e,t,r,i,a,o.captures,s),a.produce(i,s[0].end),i=i.pop(),!p){i=i.safePop(),a.produce(i,l),u=!0;return}}s[0].end>n&&(n=s[0].end,r=!1)}()}return new lr(i,!1)}function li(e,t,r,n,i){return{ruleScanner:e.compileAG(t,r,n,i),findOptions:0}}function la(e,t,r,n,i,a,o){if(0===a.length)return;let s=t.content,l=Math.min(a.length,o.length),u=[],c=o[0].end;for(let t=0;t<l;t++){let l=a[t];if(null===l)continue;let d=o[t];if(0===d.length)continue;if(d.start>c)break;for(;u.length>0&&u[u.length-1].endPos<=d.start;)i.produceFromScopes(u[u.length-1].scopes,u[u.length-1].endPos),u.pop();if(u.length>0?i.produceFromScopes(u[u.length-1].scopes,d.start):i.produce(n,d.start),l.retokenizeCapturedWithRuleId){let t=l.getName(s,o),a=n.contentNameScopesList.pushAttributed(t,e),u=l.getContentName(s,o),c=a.pushAttributed(u,e),p=n.push(l.retokenizeCapturedWithRuleId,d.start,-1,!1,null,a,c),f=e.createOnigString(s.substring(0,d.end));ln(e,f,r&&0===d.start,d.start,p,i,!1,0),sD(f);continue}let p=l.getName(s,o);if(null!==p){let t=(u.length>0?u[u.length-1].scopes:n.contentNameScopesList).pushAttributed(p,e);u.push(new lo(t,d.end))}}for(;u.length>0;)i.produceFromScopes(u[u.length-1].scopes,u[u.length-1].endPos),u.pop()}var lo=class{scopes;endPos;constructor(e,t){this.scopes=e,this.endPos=t}};function ls(e,t,r,n,i){let a=sj(t,ll),o=s4.getCompiledRuleId(r,n,i.repository);for(let r of a)e.push({debugSelector:t,matcher:r.matcher,ruleId:o,grammar:i,priority:r.priority})}function ll(e,t){if(t.length<e.length)return!1;let r=0;return e.every(e=>{for(let n=r;n<t.length;n++)if(function(e,t){if(!e)return!1;if(e===t)return!0;let r=t.length;return e.length>r&&e.substr(0,r)===t&&"."===e[r]}(t[n],e))return r=n+1,!0;return!1})}var lu=class{constructor(e,t,r,n,i,a,o,s){if(this._rootScopeName=e,this.balancedBracketSelectors=a,this._onigLib=s,this._basicScopeAttributesProvider=new le(r,n),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=o,this._grammar=lc(t,null),this._injections=null,this._tokenTypeMatchers=[],i)for(const e of Object.keys(i))for(const t of sj(e,ll))this._tokenTypeMatchers.push({matcher:t.matcher,type:i[e]})}_rootId;_lastRuleId;_ruleId2desc;_includedGrammars;_grammarRepository;_grammar;_injections;_basicScopeAttributesProvider;_tokenTypeMatchers;get themeProvider(){return this._grammarRepository}dispose(){for(let e of this._ruleId2desc)e&&e.dispose()}createOnigScanner(e){return this._onigLib.createOnigScanner(e)}createOnigString(e){return this._onigLib.createOnigString(e)}getMetadataForScope(e){return this._basicScopeAttributesProvider.getBasicScopeAttributes(e)}_collectInjections(){let e=[],t=this._rootScopeName,r=({lookup:e=>e===this._rootScopeName?this._grammar:this.getExternalGrammar(e),injections:e=>this._grammarRepository.injections(e)}).lookup(t);if(r){let n=r.injections;if(n)for(let t in n)ls(e,t,n[t],this,r);let i=this._grammarRepository.injections(t);i&&i.forEach(t=>{let r=this.getExternalGrammar(t);if(r){let t=r.injectionSelector;t&&ls(e,t,r,this,r)}})}return e.sort((e,t)=>e.priority-t.priority),e}getInjections(){return null===this._injections&&(this._injections=this._collectInjections()),this._injections}registerRule(e){let t=++this._lastRuleId,r=e(t);return this._ruleId2desc[t]=r,r}getRule(e){return this._ruleId2desc[e]}getExternalGrammar(e,t){if(this._includedGrammars[e])return this._includedGrammars[e];if(this._grammarRepository){let r=this._grammarRepository.lookup(e);if(r)return this._includedGrammars[e]=lc(r,t&&t.$base),this._includedGrammars[e]}}tokenizeLine(e,t,r=0){let n=this._tokenize(e,t,!1,r);return{tokens:n.lineTokens.getResult(n.ruleStack,n.lineLength),ruleStack:n.ruleStack,stoppedEarly:n.stoppedEarly}}tokenizeLine2(e,t,r=0){let n=this._tokenize(e,t,!0,r);return{tokens:n.lineTokens.getBinaryResult(n.ruleStack,n.lineLength),ruleStack:n.ruleStack,stoppedEarly:n.stoppedEarly}}_tokenize(e,t,r,n){let i;if(-1===this._rootId&&(this._rootId=s4.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections()),t&&t!==lp.NULL)i=!1,t.reset();else{let e;i=!0;let r=this._basicScopeAttributesProvider.getDefaultAttributes(),n=this.themeProvider.getDefaults(),a=sM.set(0,r.languageId,r.tokenType,null,n.fontStyle,n.foregroundId,n.backgroundId),o=this.getRule(this._rootId).getName(null,null);e=o?ld.createRootAndLookUpScopeName(o,a,this):ld.createRoot("unknown",a),t=new lp(null,this._rootId,-1,-1,!1,null,e,e)}e+="\n";let a=this.createOnigString(e),o=a.content.length,s=new lh(r,e,this._tokenTypeMatchers,this.balancedBracketSelectors),l=ln(this,a,i,0,t,s,!0,n);return sD(a),{lineLength:o,lineTokens:s,ruleStack:l.stack,stoppedEarly:l.stoppedEarly}}};function lc(e,t){return(e=function e(t){return Array.isArray(t)?function(t){let r=[];for(let n=0,i=t.length;n<i;n++)r[n]=e(t[n]);return r}(t):t instanceof RegExp?t:"object"==typeof t?function(t){let r={};for(let n in t)r[n]=e(t[n]);return r}(t):t}(e)).repository=e.repository||{},e.repository.$self={$vscodeTextmateLocation:e.$vscodeTextmateLocation,patterns:e.patterns,name:e.scopeName},e.repository.$base=t||e.repository.$self,e}var ld=class e{constructor(e,t,r){this.parent=e,this.scopePath=t,this.tokenAttributes=r}static fromExtension(t,r){let n=t,i=t?.scopePath??null;for(let t of r)n=new e(n,i=s_.push(i,t.scopeNames),t.encodedTokenAttributes);return n}static createRoot(t,r){return new e(null,new s_(null,t),r)}static createRootAndLookUpScopeName(t,r,n){let i=n.getMetadataForScope(t),a=new s_(null,t),o=n.themeProvider.themeMatch(a),s=e.mergeAttributes(r,i,o);return new e(null,a,s)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(" ")}equals(t){return e.equals(this,t)}static equals(e,t){for(;;){if(e===t||!e&&!t)return!0;if(!e||!t||e.scopeName!==t.scopeName||e.tokenAttributes!==t.tokenAttributes)return!1;e=e.parent,t=t.parent}}static mergeAttributes(e,t,r){let n=-1,i=0,a=0;return null!==r&&(n=r.fontStyle,i=r.foregroundId,a=r.backgroundId),sM.set(e,t.languageId,t.tokenType,null,n,i,a)}pushAttributed(t,r){if(null===t)return this;if(-1===t.indexOf(" "))return e._pushAttributed(this,t,r);let n=t.split(/ /g),i=this;for(let t of n)i=e._pushAttributed(i,t,r);return i}static _pushAttributed(t,r,n){let i=n.getMetadataForScope(r),a=t.scopePath.push(r),o=n.themeProvider.themeMatch(a),s=e.mergeAttributes(t.tokenAttributes,i,o);return new e(t,a,s)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(e){let t=[],r=this;for(;r&&r!==e;)t.push({encodedTokenAttributes:r.tokenAttributes,scopeNames:r.scopePath.getExtensionIfDefined(r.parent?.scopePath??null)}),r=r.parent;return r===e?t.reverse():void 0}},lp=class e{constructor(e,t,r,n,i,a,o,s){this.parent=e,this.ruleId=t,this.beginRuleCapturedEOL=i,this.endRule=a,this.nameScopesList=o,this.contentNameScopesList=s,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=r,this._anchorPos=n}_stackElementBrand=void 0;static NULL=new e(null,0,0,0,!1,null,null,null);_enterPos;_anchorPos;depth;equals(t){return null!==t&&e._equals(this,t)}static _equals(e,t){return e===t||!!this._structuralEquals(e,t)&&ld.equals(e.contentNameScopesList,t.contentNameScopesList)}static _structuralEquals(e,t){for(;;){if(e===t||!e&&!t)return!0;if(!e||!t||e.depth!==t.depth||e.ruleId!==t.ruleId||e.endRule!==t.endRule)return!1;e=e.parent,t=t.parent}}clone(){return this}static _reset(e){for(;e;)e._enterPos=-1,e._anchorPos=-1,e=e.parent}reset(){e._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(t,r,n,i,a,o,s){return new e(this,t,r,n,i,a,o,s)}getEnterPos(){return this._enterPos}getAnchorPos(){return this._anchorPos}getRule(e){return e.getRule(this.ruleId)}toString(){let e=[];return this._writeString(e,0),"["+e.join(",")+"]"}_writeString(e,t){return this.parent&&(t=this.parent._writeString(e,t)),e[t++]=`(${this.ruleId}, ${this.nameScopesList?.toString()}, ${this.contentNameScopesList?.toString()})`,t}withContentNameScopesList(e){return this.contentNameScopesList===e?this:this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,e)}withEndRule(t){return this.endRule===t?this:new e(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,t,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(e){let t=this;for(;t&&t._enterPos===e._enterPos;){if(t.ruleId===e.ruleId)return!0;t=t.parent}return!1}toStateStackFrame(){return{ruleId:this.ruleId,beginRuleCapturedEOL:this.beginRuleCapturedEOL,endRule:this.endRule,nameScopesList:this.nameScopesList?.getExtensionIfDefined(this.parent?.nameScopesList??null)??[],contentNameScopesList:this.contentNameScopesList?.getExtensionIfDefined(this.nameScopesList)??[]}}static pushFrame(t,r){let n=ld.fromExtension(t?.nameScopesList??null,r.nameScopesList);return new e(t,r.ruleId,r.enterPos??-1,r.anchorPos??-1,r.beginRuleCapturedEOL,r.endRule,n,ld.fromExtension(n,r.contentNameScopesList))}},lf=class{balancedBracketScopes;unbalancedBracketScopes;allowAny=!1;constructor(e,t){this.balancedBracketScopes=e.flatMap(e=>"*"===e?(this.allowAny=!0,[]):sj(e,ll).map(e=>e.matcher)),this.unbalancedBracketScopes=t.flatMap(e=>sj(e,ll).map(e=>e.matcher))}get matchesAlways(){return this.allowAny&&0===this.unbalancedBracketScopes.length}get matchesNever(){return 0===this.balancedBracketScopes.length&&!this.allowAny}match(e){for(let t of this.unbalancedBracketScopes)if(t(e))return!1;for(let t of this.balancedBracketScopes)if(t(e))return!0;return this.allowAny}},lh=class{constructor(e,t,r,n){this.balancedBracketSelectors=n,this._emitBinaryTokens=e,this._tokenTypeOverrides=r,this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}_emitBinaryTokens;_lineText;_tokens;_binaryTokens;_lastTokenEndIndex;_tokenTypeOverrides;produce(e,t){this.produceFromScopes(e.contentNameScopesList,t)}produceFromScopes(e,t){if(this._lastTokenEndIndex>=t)return;if(this._emitBinaryTokens){let r=e?.tokenAttributes??0,n=!1;if(this.balancedBracketSelectors?.matchesAlways&&(n=!0),this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){let t=e?.getScopeNames()??[];for(let e of this._tokenTypeOverrides)e.matcher(t)&&(r=sM.set(r,0,e.type,null,-1,0,0));this.balancedBracketSelectors&&(n=this.balancedBracketSelectors.match(t))}if(n&&(r=sM.set(r,0,8,n,-1,0,0)),this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===r){this._lastTokenEndIndex=t;return}this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(r),this._lastTokenEndIndex=t;return}let r=e?.getScopeNames()??[];this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:t,scopes:r}),this._lastTokenEndIndex=t}getResult(e,t){return this._tokens.length>0&&this._tokens[this._tokens.length-1].startIndex===t-1&&this._tokens.pop(),0===this._tokens.length&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._tokens[this._tokens.length-1].startIndex=0),this._tokens}getBinaryResult(e,t){this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-2]===t-1&&(this._binaryTokens.pop(),this._binaryTokens.pop()),0===this._binaryTokens.length&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._binaryTokens[this._binaryTokens.length-2]=0);let r=new Uint32Array(this._binaryTokens.length);for(let e=0,t=this._binaryTokens.length;e<t;e++)r[e]=this._binaryTokens[e];return r}},lm=class{constructor(e,t){this._onigLib=t,this._theme=e}_grammars=new Map;_rawGrammars=new Map;_injectionGrammars=new Map;_theme;dispose(){for(let e of this._grammars.values())e.dispose()}setTheme(e){this._theme=e}getColorMap(){return this._theme.getColorMap()}addGrammar(e,t){this._rawGrammars.set(e.scopeName,e),t&&this._injectionGrammars.set(e.scopeName,t)}lookup(e){return this._rawGrammars.get(e)}injections(e){return this._injectionGrammars.get(e)}getDefaults(){return this._theme.getDefaults()}themeMatch(e){return this._theme.match(e)}grammarForScopeName(e,t,r,n,i){if(!this._grammars.has(e)){let a=this._rawGrammars.get(e);if(!a)return null;this._grammars.set(e,new lu(e,a,t,r,n,i,this,this._onigLib))}return this._grammars.get(e)}},lg=class{_options;_syncRegistry;_ensureGrammarCache;constructor(e){this._options=e,this._syncRegistry=new lm(sk.createFromRawTheme(e.theme,e.colorMap),e.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(e,t){this._syncRegistry.setTheme(sk.createFromRawTheme(e,t))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(e,t,r){return this.loadGrammarWithConfiguration(e,t,{embeddedLanguages:r})}loadGrammarWithConfiguration(e,t,r){return this._loadGrammar(e,t,r.embeddedLanguages,r.tokenTypes,new lf(r.balancedBracketSelectors||[],r.unbalancedBracketSelectors||[]))}loadGrammar(e){return this._loadGrammar(e,0,null,null,null)}_loadGrammar(e,t,r,n,i){let a=new sF(this._syncRegistry,e);for(;a.Q.length>0;)a.Q.map(e=>this._loadSingleGrammar(e.scopeName)),a.processQueue();return this._grammarForScopeName(e,t,r,n,i)}_loadSingleGrammar(e){this._ensureGrammarCache.has(e)||(this._doLoadSingleGrammar(e),this._ensureGrammarCache.set(e,!0))}_doLoadSingleGrammar(e){let t=this._options.loadGrammar(e);if(t){let r="function"==typeof this._options.getInjections?this._options.getInjections(e):void 0;this._syncRegistry.addGrammar(t,r)}}addGrammar(e,t=[],r=0,n=null){return this._syncRegistry.addGrammar(e,t),this._grammarForScopeName(e.scopeName,r,n)}_grammarForScopeName(e,t=0,r=null,n=null,i=null){return this._syncRegistry.grammarForScopeName(e,t,r,n,i)}},ly=lp.NULL,lv=e.i(41631),lb=e.i(57871),lx=e.i(69587);let lw=/["&'<>`]/g,lS=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,lC=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,lk=/[|\\{}()[\]^$+*?.]/g,l_=new WeakMap,lA=/[\dA-Fa-f]/,lE=/\d/,lN=["AElig","AMP","Aacute","Acirc","Agrave","Aring","Atilde","Auml","COPY","Ccedil","ETH","Eacute","Ecirc","Egrave","Euml","GT","Iacute","Icirc","Igrave","Iuml","LT","Ntilde","Oacute","Ocirc","Ograve","Oslash","Otilde","Ouml","QUOT","REG","THORN","Uacute","Ucirc","Ugrave","Uuml","Yacute","aacute","acirc","acute","aelig","agrave","amp","aring","atilde","auml","brvbar","ccedil","cedil","cent","copy","curren","deg","divide","eacute","ecirc","egrave","eth","euml","frac12","frac14","frac34","gt","iacute","icirc","iexcl","igrave","iquest","iuml","laquo","lt","macr","micro","middot","nbsp","not","ntilde","oacute","ocirc","ograve","ordf","ordm","oslash","otilde","ouml","para","plusmn","pound","quot","raquo","reg","sect","shy","sup1","sup2","sup3","szlig","thorn","times","uacute","ucirc","ugrave","uml","uuml","yacute","yen","yuml"],lI={nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"­",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",fnof:"ƒ",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",bull:"•",hellip:"…",prime:"′",Prime:"″",oline:"‾",frasl:"⁄",weierp:"℘",image:"ℑ",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",lang:"〈",rang:"〉",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦",quot:'"',amp:"&",lt:"<",gt:">",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",circ:"ˆ",tilde:"˜",ensp:" ",emsp:" ",thinsp:" ",zwnj:"‌",zwj:"‍",lrm:"‎",rlm:"‏",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",permil:"‰",lsaquo:"‹",rsaquo:"›",euro:"€"},lT=["cent","copy","divide","gt","lt","not","para","times"],lR={}.hasOwnProperty,lP={};for(n in lI)lR.call(lI,n)&&(lP[lI[n]]=n);let lM=/[^\dA-Za-z]/;function lj(e,t,r){var n,i;let a,o,s=(n=r.omitOptionalSemicolons,a="&#x"+e.toString(16).toUpperCase(),n&&t&&!lA.test(String.fromCharCode(t))?a:a+";");if((r.useNamedReferences||r.useShortestReferences)&&(o=function(e,t,r,n){let i=String.fromCharCode(e);if(lR.call(lP,i)){let e=lP[i],a="&"+e;return r&&lN.includes(e)&&!lT.includes(e)&&(!n||t&&61!==t&&lM.test(String.fromCharCode(t)))?a:a+";"}return""}(e,t,r.omitOptionalSemicolons,r.attribute)),(r.useShortestReferences||!o)&&r.useShortestReferences){let n,a=(i=r.omitOptionalSemicolons,n="&#"+String(e),i&&t&&!lE.test(String.fromCharCode(t))?n:n+";");a.length<s.length&&(s=a)}return o&&(!r.useShortestReferences||o.length<s.length)?o:s}function lL(e,t){let r;var n,i=e,a=Object.assign({format:lj},t);if(i=i.replace(a.subset?(n=a.subset,(r=l_.get(n))||(r=function(e){let t=[],r=-1;for(;++r<e.length;)t.push(e[r].replace(lk,"\\$&"));return RegExp("(?:"+t.join("|")+")","g")}(n),l_.set(n,r)),r):lw,o),a.subset||a.escapeOnly)return i;return i.replace(lS,function(e,t,r){return a.format((e.charCodeAt(0)-55296)*1024+e.charCodeAt(1)-56320+65536,r.charCodeAt(t+2),a)}).replace(lC,o);function o(e,t,r){return a.format(e.charCodeAt(0),r.charCodeAt(t+1),a)}}let lO=/^>|^->|<!--|-->|--!>|<!-$/g,lD=[">"],l$=["<",">"];var lz=e.i(96481),lB=e.i(76696),lF=e.i(40553),lG=e.i(59091),lU=e.i(24963);let lW=lV(1),lH=lV(-1),lq=[];function lV(e){return function(t,r,n){let i=t?t.children:lq,a=(r||0)+e,o=i[a];if(!n)for(;o&&(0,lU.whitespace)(o);)a+=e,o=i[a];return o}}let lQ={}.hasOwnProperty;function lK(e){return function(t,r,n){return lQ.call(e,t.tagName)&&e[t.tagName](t,r,n)}}let lX=lK({body:function(e,t,r){let n=lW(r,t);return!n||"comment"!==n.type},caption:lJ,colgroup:lJ,dd:function(e,t,r){let n=lW(r,t);return!n||"element"===n.type&&("dt"===n.tagName||"dd"===n.tagName)},dt:function(e,t,r){let n=lW(r,t);return!!(n&&"element"===n.type&&("dt"===n.tagName||"dd"===n.tagName))},head:lJ,html:function(e,t,r){let n=lW(r,t);return!n||"comment"!==n.type},li:function(e,t,r){let n=lW(r,t);return!n||"element"===n.type&&"li"===n.tagName},optgroup:function(e,t,r){let n=lW(r,t);return!n||"element"===n.type&&"optgroup"===n.tagName},option:function(e,t,r){let n=lW(r,t);return!n||"element"===n.type&&("option"===n.tagName||"optgroup"===n.tagName)},p:function(e,t,r){let n=lW(r,t);return n?"element"===n.type&&("address"===n.tagName||"article"===n.tagName||"aside"===n.tagName||"blockquote"===n.tagName||"details"===n.tagName||"div"===n.tagName||"dl"===n.tagName||"fieldset"===n.tagName||"figcaption"===n.tagName||"figure"===n.tagName||"footer"===n.tagName||"form"===n.tagName||"h1"===n.tagName||"h2"===n.tagName||"h3"===n.tagName||"h4"===n.tagName||"h5"===n.tagName||"h6"===n.tagName||"header"===n.tagName||"hgroup"===n.tagName||"hr"===n.tagName||"main"===n.tagName||"menu"===n.tagName||"nav"===n.tagName||"ol"===n.tagName||"p"===n.tagName||"pre"===n.tagName||"section"===n.tagName||"table"===n.tagName||"ul"===n.tagName):!r||"element"!==r.type||"a"!==r.tagName&&"audio"!==r.tagName&&"del"!==r.tagName&&"ins"!==r.tagName&&"map"!==r.tagName&&"noscript"!==r.tagName&&"video"!==r.tagName},rp:lY,rt:lY,tbody:function(e,t,r){let n=lW(r,t);return!n||"element"===n.type&&("tbody"===n.tagName||"tfoot"===n.tagName)},td:lZ,tfoot:function(e,t,r){return!lW(r,t)},th:lZ,thead:function(e,t,r){let n=lW(r,t);return!!(n&&"element"===n.type&&("tbody"===n.tagName||"tfoot"===n.tagName))},tr:function(e,t,r){let n=lW(r,t);return!n||"element"===n.type&&"tr"===n.tagName}});function lJ(e,t,r){let n=lW(r,t,!0);return!n||"comment"!==n.type&&!("text"===n.type&&(0,lU.whitespace)(n.value.charAt(0)))}function lY(e,t,r){let n=lW(r,t);return!n||"element"===n.type&&("rp"===n.tagName||"rt"===n.tagName)}function lZ(e,t,r){let n=lW(r,t);return!n||"element"===n.type&&("td"===n.tagName||"th"===n.tagName)}let l0=lK({body:function(e){let t=lW(e,-1,!0);return!t||"comment"!==t.type&&!("text"===t.type&&(0,lU.whitespace)(t.value.charAt(0)))&&("element"!==t.type||"meta"!==t.tagName&&"link"!==t.tagName&&"script"!==t.tagName&&"style"!==t.tagName&&"template"!==t.tagName)},colgroup:function(e,t,r){let n=lH(r,t),i=lW(e,-1,!0);return!(r&&n&&"element"===n.type&&"colgroup"===n.tagName&&lX(n,r.children.indexOf(n),r))&&!!(i&&"element"===i.type&&"col"===i.tagName)},head:function(e){let t=new Set;for(let r of e.children)if("element"===r.type&&("base"===r.tagName||"title"===r.tagName)){if(t.has(r.tagName))return!1;t.add(r.tagName)}let r=e.children[0];return!r||"element"===r.type},html:function(e){let t=lW(e,-1);return!t||"comment"!==t.type},tbody:function(e,t,r){let n=lH(r,t),i=lW(e,-1);return!(r&&n&&"element"===n.type&&("thead"===n.tagName||"tbody"===n.tagName)&&lX(n,r.children.indexOf(n),r))&&!!(i&&"element"===i.type&&"tr"===i.tagName)}}),l1={name:[[" \n\f\r &/=>".split("")," \n\f\r \"&'/=>`".split("")],["\0 \n\f\r \"&'/<=>".split(""),"\0 \n\f\r \"&'/<=>`".split("")]],unquoted:[[" \n\f\r &>".split(""),"\0 \n\f\r \"&'<=>`".split("")],["\0 \n\f\r \"&'<=>`".split(""),"\0 \n\f\r \"&'<=>`".split("")]],single:[["&'".split(""),"\"&'`".split("")],["\0&'".split(""),"\0\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\0"&'.split(""),"\0\"&'`".split("")]]},l2=["<","&"];function l5(e,t,r,n){return r&&"element"===r.type&&("script"===r.tagName||"style"===r.tagName)?e.value:lL(e.value,Object.assign({},n.settings.characterReferences,{subset:l2}))}let l3=(0,lx.zwitch)("type",{invalid:function(e){throw Error("Expected node, not `"+e+"`")},unknown:function(e){throw Error("Cannot compile unknown node `"+e.type+"`")},handlers:{comment:function(e,t,r,n){return n.settings.bogusComments?"<?"+lL(e.value,Object.assign({},n.settings.characterReferences,{subset:lD}))+">":"<!--"+e.value.replace(lO,function(e){return lL(e,Object.assign({},n.settings.characterReferences,{subset:l$}))})+"-->"},doctype:function(e,t,r,n){return"<!"+(n.settings.upperDoctype?"DOCTYPE":"doctype")+(n.settings.tightDoctype?"":" ")+"html>"},element:function(e,t,r,n){let i,a=n.schema,o="svg"!==a.space&&n.settings.omitOptionalTags,s="svg"===a.space?n.settings.closeEmptyElements:n.settings.voids.includes(e.tagName.toLowerCase()),l=[];"html"===a.space&&"svg"===e.tagName&&(n.schema=lb.svg);let u=function(e,t){let r,n=[],i=-1;if(t){for(r in t)if(null!==t[r]&&void 0!==t[r]){let i=function(e,t,r){let n,i=(0,lF.find)(e.schema,t),a=e.settings.allowParseErrors&&"html"===e.schema.space?0:1,o=+!e.settings.allowDangerousCharacters,s=e.quote;if(i.overloadedBoolean&&(r===i.attribute||""===r)?r=!0:(i.boolean||i.overloadedBoolean)&&("string"!=typeof r||r===i.attribute||""===r)&&(r=!!r),null==r||!1===r||"number"==typeof r&&Number.isNaN(r))return"";let l=lL(i.attribute,Object.assign({},e.settings.characterReferences,{subset:l1.name[a][o]}));return!0===r||(r=Array.isArray(r)?(i.commaSeparated?lB.stringify:lG.stringify)(r,{padLeft:!e.settings.tightCommaSeparatedLists}):String(r),e.settings.collapseEmptyAttributes&&!r)?l:(e.settings.preferUnquoted&&(n=lL(r,Object.assign({},e.settings.characterReferences,{attribute:!0,subset:l1.unquoted[a][o]}))),n!==r&&(e.settings.quoteSmart&&(0,lz.ccount)(r,s)>(0,lz.ccount)(r,e.alternative)&&(s=e.alternative),n=s+lL(r,Object.assign({},e.settings.characterReferences,{subset:("'"===s?l1.single:l1.double)[a][o],attribute:!0}))+s),l+(n?"="+n:n))}(e,r,t[r]);i&&n.push(i)}}for(;++i<n.length;){let t=e.settings.tightAttributes?n[i].charAt(n[i].length-1):void 0;i!==n.length-1&&'"'!==t&&"'"!==t&&(n[i]+=" ")}return n.join("")}(n,e.properties),c=n.all("html"===a.space&&"template"===e.tagName?e.content:e);return n.schema=a,c&&(s=!1),!u&&o&&l0(e,t,r)||(l.push("<",e.tagName,u?" "+u:""),s&&("svg"===a.space||n.settings.closeSelfClosing)&&(i=u.charAt(u.length-1),(!n.settings.tightSelfClosing||"/"===i||i&&'"'!==i&&"'"!==i)&&l.push(" "),l.push("/")),l.push(">")),l.push(c),s||o&&lX(e,t,r)||l.push("</"+e.tagName+">"),l.join("")},raw:function(e,t,r,n){return n.settings.allowDangerousHtml?e.value:l5(e,t,r,n)},root:function(e,t,r,n){return n.all(e)},text:l5}}),l4={},l6={},l8=[];function l7(e,t,r){return l3(e,t,r,this)}function l9(e){let t=[],r=e&&e.children||l8,n=-1;for(;++n<r.length;)t[n]=this.one(r[n],n,e);return t.join("")}function ue(e,t){let r="string"==typeof e?{}:{...e.colorReplacements},n="string"==typeof e?e:e.name;for(let[e,i]of Object.entries(t?.colorReplacements||{}))"string"==typeof i?r[e]=i:e===n&&Object.assign(r,i);return r}function ut(e,t){return e&&t?.[e?.toLowerCase()]||e}async function ur(e){return Promise.resolve("function"==typeof e?e():e).then(e=>e.default||e)}function un(e){return!e||["plaintext","txt","text","plain"].includes(e)}function ui(e){return"ansi"===e||un(e)}function ua(e){return"none"===e}function uo(e,t){if(!t)return e;for(let r of(e.properties||={},e.properties.class||=[],"string"==typeof e.properties.class&&(e.properties.class=e.properties.class.split(/\s+/g)),Array.isArray(e.properties.class)||(e.properties.class=[]),Array.isArray(t)?t:t.split(/\s+/g)))r&&!e.properties.class.includes(r)&&e.properties.class.push(r);return e}function us(e,t=!1){if(0===e.length)return[["",0]];let r=e.split(/(\r?\n)/g),n=0,i=[];for(let e=0;e<r.length;e+=2){let a=t?r[e]+(r[e+1]||""):r[e];i.push([a,n]),n+=r[e].length,n+=r[e+1]?.length||0}return i}let ul="light-dark()",uu=["color","background-color"];function uc(e){let t={};if(e.color&&(t.color=e.color),e.bgColor&&(t["background-color"]=e.bgColor),e.fontStyle){e.fontStyle&sN.Italic&&(t["font-style"]="italic"),e.fontStyle&sN.Bold&&(t["font-weight"]="bold");let r=[];e.fontStyle&sN.Underline&&r.push("underline"),e.fontStyle&sN.Strikethrough&&r.push("line-through"),r.length&&(t["text-decoration"]=r.join(" "))}return t}function ud(e){return"string"==typeof e?e:Object.entries(e).map(([e,t])=>`${e}:${t}`).join(";")}let up=new WeakMap;function uf(e,t){up.set(e,t)}function uh(e){return up.get(e)}class um{_stacks={};lang;get themes(){return Object.keys(this._stacks)}get theme(){return this.themes[0]}get _stack(){return this._stacks[this.theme]}static initial(e,t){return new um(Object.fromEntries((Array.isArray(t)?t:[t]).map(e=>[e,ly])),e)}constructor(...e){if(2===e.length){const[t,r]=e;this.lang=r,this._stacks=t}else{const[t,r,n]=e;this.lang=r,this._stacks={[n]:t}}}getInternalStack(e=this.theme){return this._stacks[e]}getScopes(e=this.theme){var t;let r,n;return t=this._stacks[e],r=[],n=new Set,!function e(t){if(n.has(t))return;n.add(t);let i=t?.nameScopesList?.scopeName;i&&r.push(i),t.parent&&e(t.parent)}(t),r}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.getScopes()}}}let ug=[function(){let e=new WeakMap;function t(t){if(!e.has(t.meta)){var r;let n,i=function(e){if("number"==typeof e){if(e<0||e>t.source.length)throw new sg(`Invalid decoration offset: ${e}. Code length: ${t.source.length}`);return{...a.indexToPos(e),offset:e}}{let t=a.lines[e.line];if(void 0===t)throw new sg(`Invalid decoration position ${JSON.stringify(e)}. Lines length: ${a.lines.length}`);let r=e.character;if(r<0&&(r=t.length+r),r<0||r>t.length)throw new sg(`Invalid decoration position ${JSON.stringify(e)}. Line ${e.line} length: ${t.length}`);return{...e,character:r,offset:a.posToIndex(e.line,r)}}},a={lines:n=us(r=t.source,!0).map(([e])=>e),indexToPos:function(e){if(e===r.length)return{line:n.length-1,character:n[n.length-1].length};let t=e,i=0;for(let e of n){if(t<e.length)break;t-=e.length,i++}return{line:i,character:t}},posToIndex:function(e,t){let r=0;for(let t=0;t<e;t++)r+=n[t].length;return r+t}},o=(t.options.decorations||[]).map(e=>({...e,start:i(e.start),end:i(e.end)}));(function(e){for(let t=0;t<e.length;t++){let r=e[t];if(r.start.offset>r.end.offset)throw new sg(`Invalid decoration range: ${JSON.stringify(r.start)} - ${JSON.stringify(r.end)}`);for(let n=t+1;n<e.length;n++){let t=e[n],i=r.start.offset<=t.start.offset&&t.start.offset<r.end.offset,a=r.start.offset<t.end.offset&&t.end.offset<=r.end.offset,o=t.start.offset<=r.start.offset&&r.start.offset<t.end.offset,s=t.start.offset<r.end.offset&&r.end.offset<=t.end.offset;if(i||a||o||s){if(i&&a||o&&s||o&&r.start.offset===r.end.offset||a&&t.start.offset===t.end.offset)continue;throw new sg(`Decorations ${JSON.stringify(r.start)} and ${JSON.stringify(t.start)} intersect.`)}}}})(o),e.set(t.meta,{decorations:o,converter:a,source:t.source})}return e.get(t.meta)}return{name:"shiki:decorations",tokens(e){let r;if(!this.options.decorations?.length)return;let n=t(this).decorations.flatMap(e=>[e.start.offset,e.end.offset]);return(r=Array.from(n instanceof Set?n:new Set(n)).sort((e,t)=>e-t)).length?e.map(e=>e.flatMap(e=>{let t=r.filter(t=>e.offset<t&&t<e.offset+e.content.length).map(t=>t-e.offset).sort((e,t)=>e-t);if(!t.length)return e;let n=0,i=[];for(let r of t)r>n&&i.push({...e,content:e.content.slice(n,r),offset:e.offset+n}),n=r;return n<e.content.length&&i.push({...e,content:e.content.slice(n),offset:e.offset+n}),i})):e},code(e){if(!this.options.decorations?.length)return;let r=t(this),n=Array.from(e.children).filter(e=>"element"===e.type&&"span"===e.tagName);if(n.length!==r.converter.lines.length)throw new sg(`Number of lines in code element (${n.length}) does not match the number of lines in the source (${r.converter.lines.length}). Failed to apply decorations.`);function i(e,t,r,i){let o=n[e],s="",l=-1,u=-1;if(0===t&&(l=0),0===r&&(u=0),r===1/0&&(u=o.children.length),-1===l||-1===u)for(let e=0;e<o.children.length;e++)s+=function e(t){return"text"===t.type?t.value:"element"===t.type?t.children.map(e).join(""):""}(o.children[e]),-1===l&&s.length===t&&(l=e+1),-1===u&&s.length===r&&(u=e+1);if(-1===l)throw new sg(`Failed to find start index for decoration ${JSON.stringify(i.start)}`);if(-1===u)throw new sg(`Failed to find end index for decoration ${JSON.stringify(i.end)}`);let c=o.children.slice(l,u);if(i.alwaysWrap||c.length!==o.children.length)if(i.alwaysWrap||1!==c.length||"element"!==c[0].type){let e={type:"element",tagName:"span",properties:{},children:c};a(e,i,"wrapper"),o.children.splice(l,c.length,e)}else a(c[0],i,"token");else a(o,i,"line")}function a(e,t,r){let n=t.properties||{},i=t.transform||(e=>e);return e.tagName=t.tagName||"span",e.properties={...e.properties,...n,class:e.properties.class},t.properties?.class&&uo(e,t.properties.class),e=i(e,r)||e}let o=[];for(let e of r.decorations.sort((e,t)=>t.start.offset-e.start.offset||e.end.offset-t.end.offset)){let{start:t,end:r}=e;if(t.line===r.line)i(t.line,t.character,r.character,e);else if(t.line<r.line){i(t.line,t.character,1/0,e);for(let i=t.line+1;i<r.line;i++)o.unshift(()=>{var t;n[t=i]=a(n[t],e,"line")});i(r.line,0,r.character,e)}}o.forEach(e=>e())}}}()];function uy(e){let t=function(e){let t=[],r=[],n=[];for(let i of e)switch(i.enforce){case"pre":t.push(i);break;case"post":r.push(i);break;default:n.push(i)}return{pre:t,post:r,normal:n}}(e.transformers||[]);return[...t.pre,...t.normal,...t.post,...ug]}var uv=["black","red","green","yellow","blue","magenta","cyan","white","brightBlack","brightRed","brightGreen","brightYellow","brightBlue","brightMagenta","brightCyan","brightWhite"],ub={1:"bold",2:"dim",3:"italic",4:"underline",7:"reverse",8:"hidden",9:"strikethrough"};function ux(e){let t=e.shift();if("2"===t){let t=e.splice(0,3).map(e=>Number.parseInt(e));if(3!==t.length||t.some(e=>Number.isNaN(e)))return;return{type:"rgb",rgb:t}}if("5"===t){let t=e.shift();if(t)return{type:"table",index:Number(t)}}}var uw={black:"#000000",red:"#bb0000",green:"#00bb00",yellow:"#bbbb00",blue:"#0000bb",magenta:"#ff00ff",cyan:"#00bbbb",white:"#eeeeee",brightBlack:"#555555",brightRed:"#ff5555",brightGreen:"#00ff00",brightYellow:"#ffff55",brightBlue:"#5555ff",brightMagenta:"#ff55ff",brightCyan:"#55ffff",brightWhite:"#ffffff"};let uS={black:"#000000",red:"#cd3131",green:"#0DBC79",yellow:"#E5E510",blue:"#2472C8",magenta:"#BC3FBC",cyan:"#11A8CD",white:"#E5E5E5",brightBlack:"#666666",brightRed:"#F14C4C",brightGreen:"#23D18B",brightYellow:"#F5F543",brightBlue:"#3B8EEA",brightMagenta:"#D670D6",brightCyan:"#29B8DB",brightWhite:"#FFFFFF"};function uC(e,t,r={}){var n,i;let a,o,{theme:s=e.getLoadedThemes()[0]}=r,l=e.resolveLangAlias(r.lang||"text");if(un(l)||ua(s))return us(t).map(e=>[{content:e[0],offset:e[1]}]);let{theme:u,colorMap:c}=e.setTheme(s);if("ansi"===l){let e,n,i,a,o,s,l;return e=ue(u,r),n=us(t),i=function(e=uw){let t;function r(e){return`#${e.map(e=>Math.max(0,Math.min(e,255)).toString(16).padStart(2,"0")).join("")}`}return{value:function(n){switch(n.type){case"named":return e[n.name];case"rgb":return r(n.rgb);case"table":var i;return i=n.index,function(){if(t)return t;t=[];for(let r=0;r<uv.length;r++)t.push(e[uv[r]]);let n=[0,95,135,175,215,255];for(let e=0;e<6;e++)for(let i=0;i<6;i++)for(let a=0;a<6;a++)t.push(r([n[e],n[i],n[a]]));let i=8;for(let e=0;e<24;e++,i+=10)t.push(r([i,i,i]));return t}()[i]}}}}(Object.fromEntries(uv.map(e=>{let t=`terminal.ansi${e[0].toUpperCase()}${e.substring(1)}`;return[e,u.colors?.[t]||uS[e]]}))),a=null,o=null,s=new Set,l={parse(e){let t=[],r=0;do{let n=function(e,t){let r=e.indexOf("\x1b",t);if(-1!==r&&"["===e[r+1]){let t=e.indexOf("m",r);if(-1!==t)return{sequence:e.substring(r+2,t).split(";"),startPosition:r,position:t+1}}return{position:e.length}}(e,r),i=n.sequence?e.substring(r,n.startPosition):e.substring(r);if(i.length>0&&t.push({value:i,foreground:a,background:o,decorations:new Set(s)}),n.sequence){let e=function(e){let t=[];for(;e.length>0;){let r=e.shift();if(!r)continue;let n=Number.parseInt(r);if(!Number.isNaN(n))if(0===n)t.push({type:"resetAll"});else if(n<=9)ub[n]&&t.push({type:"setDecoration",value:ub[n]});else if(n<=29){let e=ub[n-20];e&&(t.push({type:"resetDecoration",value:e}),"dim"===e&&t.push({type:"resetDecoration",value:"bold"}))}else if(n<=37)t.push({type:"setForegroundColor",value:{type:"named",name:uv[n-30]}});else if(38===n){let r=ux(e);r&&t.push({type:"setForegroundColor",value:r})}else if(39===n)t.push({type:"resetForegroundColor"});else if(n<=47)t.push({type:"setBackgroundColor",value:{type:"named",name:uv[n-40]}});else if(48===n){let r=ux(e);r&&t.push({type:"setBackgroundColor",value:r})}else 49===n?t.push({type:"resetBackgroundColor"}):53===n?t.push({type:"setDecoration",value:"overline"}):55===n?t.push({type:"resetDecoration",value:"overline"}):n>=90&&n<=97?t.push({type:"setForegroundColor",value:{type:"named",name:uv[n-90+8]}}):n>=100&&n<=107&&t.push({type:"setBackgroundColor",value:{type:"named",name:uv[n-100+8]}})}return t}(n.sequence);for(let t of e)"resetAll"===t.type?(a=null,o=null,s.clear()):"resetForegroundColor"===t.type?a=null:"resetBackgroundColor"===t.type?o=null:"resetDecoration"===t.type&&s.delete(t.value);for(let t of e)"setForegroundColor"===t.type?a=t.value:"setBackgroundColor"===t.type?o=t.value:"setDecoration"===t.type&&s.add(t.value)}r=n.position}while(r<e.length)return t}},n.map(t=>l.parse(t[0]).map(r=>{let n,a;r.decorations.has("reverse")?(n=r.background?i.value(r.background):u.bg,a=r.foreground?i.value(r.foreground):u.fg):(n=r.foreground?i.value(r.foreground):u.fg,a=r.background?i.value(r.background):void 0),n=ut(n,e),a=ut(a,e),r.decorations.has("dim")&&(n=function(e){let t=e.match(/#([0-9a-f]{3,8})/i);if(t){let e=t[1];if(8===e.length){let t=Math.round(Number.parseInt(e.slice(6,8),16)/2).toString(16).padStart(2,"0");return`#${e.slice(0,6)}${t}`}if(6===e.length)return`#${e}80`;if(4===e.length){let t=e[0],r=e[1],n=e[2],i=e[3],a=Math.round(Number.parseInt(`${i}${i}`,16)/2).toString(16).padStart(2,"0");return`#${t}${t}${r}${r}${n}${n}${a}`}else if(3===e.length){let t=e[0],r=e[1],n=e[2];return`#${t}${t}${r}${r}${n}${n}80`}}let r=e.match(/var\((--[\w-]+-ansi-[\w-]+)\)/);return r?`var(${r[1]}-dim)`:e}(n));let o=sN.None;return r.decorations.has("bold")&&(o|=sN.Bold),r.decorations.has("italic")&&(o|=sN.Italic),r.decorations.has("underline")&&(o|=sN.Underline),r.decorations.has("strikethrough")&&(o|=sN.Strikethrough),{content:r.value,offset:t[1],color:n,bgColor:a,fontStyle:o}}))}let d=e.getLanguage(r.lang||"text");if(r.grammarState){if(r.grammarState.lang!==d.name)throw new sg(`Grammar state language "${r.grammarState.lang}" does not match highlight language "${d.name}"`);if(!r.grammarState.themes.includes(u.name))throw new sg(`Grammar state themes "${r.grammarState.themes}" do not contain highlight theme "${u.name}"`)}return o=new um((a=uk(t,n=d,i=u,c,r)).stateStack,n.name,i.name),uf(a.tokens,o),a.tokens}function uk(e,t,r,n,i){let a=ue(r,i),{tokenizeMaxLineLength:o=0,tokenizeTimeLimit:s=500}=i,l=us(e),u=i.grammarState?function(e,t){if(!(e instanceof um))throw new sg("Invalid grammar state");return e.getInternalStack(t)}(i.grammarState,r.name)??ly:null!=i.grammarContextCode?uk(i.grammarContextCode,t,r,n,{...i,grammarState:void 0,grammarContextCode:void 0}).stateStack:ly,c=[],d=[];for(let e=0,p=l.length;e<p;e++){let p,f,[h,m]=l[e];if(""===h){c=[],d.push([]);continue}if(o>0&&h.length>=o){c=[],d.push([{content:h,offset:m,color:"",fontStyle:0}]);continue}i.includeExplanation&&(p=t.tokenizeLine(h,u,s).tokens,f=0);let g=t.tokenizeLine2(h,u,s),y=g.tokens.length/2;for(let e=0;e<y;e++){let t=g.tokens[2*e],o=e+1<y?g.tokens[2*e+2]:h.length;if(t===o)continue;let s=g.tokens[2*e+1],l=ut(n[sM.getForeground(s)],a),u=sM.getFontStyle(s),d={content:h.substring(t,o),offset:m+t,color:l,fontStyle:u};if(i.includeExplanation){let e=[];if("scopeName"!==i.includeExplanation)for(let t of r.settings){let r;switch(typeof t.scope){case"string":r=t.scope.split(/,/).map(e=>e.trim());break;case"object":r=t.scope;break;default:continue}e.push({settings:t,selectors:r.map(e=>e.split(/ /))})}d.explanation=[];let n=0;for(;t+n<o;){let t=p[f],r=h.substring(t.startIndex,t.endIndex);n+=r.length,d.explanation.push({content:r,scopes:"scopeName"===i.includeExplanation?t.scopes.map(e=>({scopeName:e})):function(e,t){let r=[];for(let n=0,i=t.length;n<i;n++){let i=t[n];r[n]={scopeName:i,themeMatches:function(e,t,r){let n=[];for(let{selectors:i,settings:a}of e)for(let e of i)if(function(e,t,r){if(!u_(e[e.length-1],t))return!1;let n=e.length-2,i=r.length-1;for(;n>=0&&i>=0;)u_(e[n],r[i])&&(n-=1),i-=1;return -1===n}(e,t,r)){n.push(a);break}return n}(e,i,t.slice(0,n))}}return r}(e,t.scopes)}),f+=1}}c.push(d)}d.push(c),c=[],u=g.ruleStack}return{tokens:d,stateStack:u}}function u_(e,t){return e===t||t.substring(0,e.length)===e&&"."===t[e.length]}function uA(e,t,r){let n=Object.entries(r.themes).filter(e=>e[1]).map(e=>({color:e[0],theme:e[1]})),i=n.map(n=>{let i=uC(e,t,{...r,theme:n.theme}),a=uh(i);return{tokens:i,state:a,theme:"string"==typeof n.theme?n.theme:n.theme.name}}),a=function(...e){let t=e.map(()=>[]),r=e.length;for(let n=0;n<e[0].length;n++){let i=e.map(e=>e[n]),a=t.map(()=>[]);t.forEach((e,t)=>e.push(a[t]));let o=i.map(()=>0),s=i.map(e=>e[0]);for(;s.every(e=>e);){let e=Math.min(...s.map(e=>e.content.length));for(let t=0;t<r;t++){let r=s[t];r.content.length===e?(a[t].push(r),o[t]+=1,s[t]=i[t][o[t]]):(a[t].push({...r,content:r.content.slice(0,e)}),s[t]={...r,content:r.content.slice(e),offset:r.offset+e})}}}return t}(...i.map(e=>e.tokens)),o=a[0].map((e,t)=>e.map((e,i)=>{let o={content:e.content,variants:{},offset:e.offset};return"includeExplanation"in r&&r.includeExplanation&&(o.explanation=e.explanation),a.forEach((e,r)=>{let{content:a,explanation:s,offset:l,...u}=e[t][i];o.variants[n[r].color]=u}),o})),s=i[0].state?new um(Object.fromEntries(i.map(e=>[e.theme,e.state?.getInternalStack(e.theme)])),i[0].state.lang):void 0;return s&&uf(o,s),o}function uE(e,t,r){let n,i,a,o,s,l;if("themes"in r){let{defaultColor:u="light",cssVariablePrefix:c="--shiki-",colorsRendering:d="css-vars"}=r,p=Object.entries(r.themes).filter(e=>e[1]).map(e=>({color:e[0],theme:e[1]})).sort((e,t)=>e.color===u?-1:+(t.color===u));if(0===p.length)throw new sg("`themes` option must not be empty");let f=uA(e,t,r);if(l=uh(f),u&&ul!==u&&!p.find(e=>e.color===u))throw new sg(`\`themes\` option must contain the defaultColor key \`${u}\``);let h=p.map(t=>e.getTheme(t.theme)),m=p.map(e=>e.color);a=f.map(e=>e.map(e=>(function(e,t,r,n,i="css-vars"){let a={content:e.content,explanation:e.explanation,offset:e.offset},o=t.map(t=>uc(e.variants[t])),s=new Set(o.flatMap(e=>Object.keys(e))),l={},u=(e,n)=>{let i="color"===n?"":"background-color"===n?"-bg":`-${n}`;return r+t[e]+("color"===n?"":i)};return o.forEach((e,r)=>{for(let a of s){let s=e[a]||"inherit";if(0===r&&n&&uu.includes(a))if(n===ul&&o.length>1){let e=t.findIndex(e=>"light"===e),n=t.findIndex(e=>"dark"===e);if(-1===e||-1===n)throw new sg('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');let c=o[e][a]||"inherit",d=o[n][a]||"inherit";l[a]=`light-dark(${c}, ${d})`,"css-vars"===i&&(l[u(r,a)]=s)}else l[a]=s;else"css-vars"===i&&(l[u(r,a)]=s)}}),a.htmlStyle=l,a})(e,m,c,u,d))),l&&uf(a,l);let g=p.map(e=>ue(e.theme,r));i=uN(p,h,g,c,u,"fg",d),n=uN(p,h,g,c,u,"bg",d),o=`shiki-themes ${h.map(e=>e.name).join(" ")}`,s=u?void 0:[i,n].join(";")}else if("theme"in r){let s=ue(r.theme,r);a=uC(e,t,r);let u=e.getTheme(r.theme);n=ut(u.bg,s),i=ut(u.fg,s),o=u.name,l=uh(a)}else throw new sg("Invalid options, either `theme` or `themes` must be provided");return{tokens:a,fg:i,bg:n,themeName:o,rootStyle:s,grammarState:l}}function uN(e,t,r,n,i,a,o){return e.map((s,l)=>{let u=ut(t[l][a],r[l])||"inherit",c=`${n+s.color}${"bg"===a?"-bg":""}:${u}`;if(0===l&&i){if(i===ul&&e.length>1){let n=e.findIndex(e=>"light"===e.color),i=e.findIndex(e=>"dark"===e.color);if(-1===n||-1===i)throw new sg('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');let o=ut(t[n][a],r[n])||"inherit",s=ut(t[i][a],r[i])||"inherit";return`light-dark(${o}, ${s});${c}`}return u}return"css-vars"===o?c:null}).filter(e=>!!e).join(";")}function uI(e,t,r,n={meta:{},options:r,codeToHast:(t,r)=>uI(e,t,r),codeToTokens:(t,r)=>uE(e,t,r)}){let i=t;for(let e of uy(r))i=e.preprocess?.call(n,i,r)||i;let{tokens:a,fg:o,bg:s,themeName:l,rootStyle:u,grammarState:c}=uE(e,i,r),{mergeWhitespaces:d=!0,mergeSameStyleTokens:p=!1}=r;!0===d?a=a.map(e=>{let t,r=[],n="";return e.forEach((i,a)=>{let o=!(i.fontStyle&&(i.fontStyle&sN.Underline||i.fontStyle&sN.Strikethrough));o&&i.content.match(/^\s+$/)&&e[a+1]?(void 0===t&&(t=i.offset),n+=i.content):n?(o?r.push({...i,offset:t,content:n+i.content}):r.push({content:n,offset:t},i),t=void 0,n=""):r.push(i)}),r}):"never"===d&&(a=a.map(e=>e.flatMap(e=>{if(e.content.match(/^\s+$/))return e;let t=e.content.match(/^(\s*)(.*?)(\s*)$/);if(!t)return e;let[,r,n,i]=t;if(!r&&!i)return e;let a=[{...e,offset:e.offset+r.length,content:n}];return r&&a.unshift({content:r,offset:e.offset}),i&&a.push({content:i,offset:e.offset+r.length+n.length}),a}))),p&&(a=a.map(e=>{let t=[];for(let r of e){if(0===t.length){t.push({...r});continue}let e=t[t.length-1],n=ud(e.htmlStyle||uc(e)),i=ud(r.htmlStyle||uc(r)),a=e.fontStyle&&(e.fontStyle&sN.Underline||e.fontStyle&sN.Strikethrough),o=r.fontStyle&&(r.fontStyle&sN.Underline||r.fontStyle&sN.Strikethrough);a||o||n!==i?t.push({...r}):e.content+=r.content}return t}));let f={...n,get source(){return i}};for(let e of uy(r))a=e.tokens?.call(f,a)||a;return function(e,t,r,n=uh(e)){let i=uy(t),a=[],o={type:"root",children:[]},{structure:s="classic",tabindex:l="0"}=t,u={class:`shiki ${t.themeName||""}`};for(let[e,r]of(!1!==t.rootStyle&&(null!=t.rootStyle?u.style=t.rootStyle:u.style=`background-color:${t.bg};color:${t.fg}`),!1!==l&&null!=l&&(u.tabindex=l.toString()),Object.entries(t.meta||{})))e.startsWith("_")||(u[e]=r);let c={type:"element",tagName:"pre",properties:u,children:[],data:t.data},d={type:"element",tagName:"code",properties:{},children:a},p=[],f={...r,structure:s,addClassToHast:uo,get source(){return r.source},get tokens(){return e},get options(){return t},get root(){return o},get pre(){return c},get code(){return d},get lines(){return p}};if(e.forEach((e,t)=>{t&&("inline"===s?o.children.push({type:"element",tagName:"br",properties:{},children:[]}):"classic"===s&&a.push({type:"text",value:"\n"}));let r={type:"element",tagName:"span",properties:{class:"line"},children:[]},n=0;for(let a of e){let e={type:"element",tagName:"span",properties:{...a.htmlAttrs},children:[{type:"text",value:a.content}]},l=ud(a.htmlStyle||uc(a));for(let o of(l&&(e.properties.style=l),i))e=o?.span?.call(f,e,t+1,n,r,a)||e;"inline"===s?o.children.push(e):"classic"===s&&r.children.push(e),n+=a.content.length}if("classic"===s){for(let e of i)r=e?.line?.call(f,r,t+1)||r;p.push(r),a.push(r)}else"inline"===s&&p.push(r)}),"classic"===s){for(let e of i)d=e?.code?.call(f,d)||d;for(let e of(c.children.push(d),i))c=e?.pre?.call(f,c)||c;o.children.push(c)}else if("inline"===s){let e=[],t={type:"element",tagName:"span",properties:{class:"line"},children:[]};for(let r of o.children)"element"===r.type&&"br"===r.tagName?(e.push(t),t={type:"element",tagName:"span",properties:{class:"line"},children:[]}):("element"===r.type||"text"===r.type)&&t.children.push(r);e.push(t);let r={type:"element",tagName:"code",properties:{},children:e};for(let e of i)r=e?.code?.call(f,r)||r;o.children=[];for(let e=0;e<r.children.length;e++){e>0&&o.children.push({type:"element",tagName:"br",properties:{},children:[]});let t=r.children[e];"element"===t.type&&o.children.push(...t.children)}}let h=o;for(let e of i)h=e?.root?.call(f,h)||h;return n&&uf(h,n),h}(a,{...r,fg:o,bg:s,themeName:l,rootStyle:!1!==r.rootStyle&&(r.rootStyle??u)},f,c)}let uT=function(e,t){let r=t||l4,n=r.quote||'"';if('"'!==n&&"'"!==n)throw Error("Invalid quote `"+n+"`, expected `'` or `\"`");return({one:l7,all:l9,settings:{omitOptionalTags:r.omitOptionalTags||!1,allowParseErrors:r.allowParseErrors||!1,allowDangerousCharacters:r.allowDangerousCharacters||!1,quoteSmart:r.quoteSmart||!1,preferUnquoted:r.preferUnquoted||!1,tightAttributes:r.tightAttributes||!1,upperDoctype:r.upperDoctype||!1,tightDoctype:r.tightDoctype||!1,bogusComments:r.bogusComments||!1,tightCommaSeparatedLists:r.tightCommaSeparatedLists||!1,tightSelfClosing:r.tightSelfClosing||!1,collapseEmptyAttributes:r.collapseEmptyAttributes||!1,allowDangerousHtml:r.allowDangerousHtml||!1,voids:r.voids||lv.htmlVoidElements,characterReferences:r.characterReferences||l6,closeSelfClosing:r.closeSelfClosing||!1,closeEmptyElements:r.closeEmptyElements||!1},schema:"svg"===r.space?lb.svg:lb.html,quote:n,alternative:'"'===n?"'":'"'}).one(Array.isArray(e)?{type:"root",children:e}:e,void 0,void 0)},uR="__shiki_resolved";function uP(e){if(e?.[uR])return e;let t={...e};t.tokenColors&&!t.settings&&(t.settings=t.tokenColors,delete t.tokenColors),t.type||="dark",t.colorReplacements={...t.colorReplacements},t.settings||=[];let{bg:r,fg:n}=t;if(!r||!n){let e=t.settings?t.settings.find(e=>!e.name&&!e.scope):void 0;e?.settings?.foreground&&(n=e.settings.foreground),e?.settings?.background&&(r=e.settings.background),!n&&t?.colors?.["editor.foreground"]&&(n=t.colors["editor.foreground"]),!r&&t?.colors?.["editor.background"]&&(r=t.colors["editor.background"]),n||(n="light"===t.type?"#333333":"#bbbbbb"),r||(r="light"===t.type?"#fffffe":"#1e1e1e"),t.fg=n,t.bg=r}t.settings[0]&&t.settings[0].settings&&!t.settings[0].scope||t.settings.unshift({settings:{foreground:t.fg,background:t.bg}});let i=0,a=new Map;function o(e){if(a.has(e))return a.get(e);i+=1;let r=`#${i.toString(16).padStart(8,"0").toLowerCase()}`;return t.colorReplacements?.[`#${r}`]?o(e):(a.set(e,r),r)}for(let e of(t.settings=t.settings.map(e=>{let r=e.settings?.foreground&&!e.settings.foreground.startsWith("#"),n=e.settings?.background&&!e.settings.background.startsWith("#");if(!r&&!n)return e;let i={...e,settings:{...e.settings}};if(r){let r=o(e.settings.foreground);t.colorReplacements[r]=e.settings.foreground,i.settings.foreground=r}if(n){let r=o(e.settings.background);t.colorReplacements[r]=e.settings.background,i.settings.background=r}return i}),Object.keys(t.colors||{})))if(("editor.foreground"===e||"editor.background"===e||e.startsWith("terminal.ansi"))&&!t.colors[e]?.startsWith("#")){let r=o(t.colors[e]);t.colorReplacements[r]=t.colors[e],t.colors[e]=r}return Object.defineProperty(t,uR,{enumerable:!1,writable:!1,value:!0}),t}async function uM(e){return Array.from(new Set((await Promise.all(e.filter(e=>!ui(e)).map(async e=>await ur(e).then(e=>Array.isArray(e)?e:[e])))).flat()))}async function uj(e){return(await Promise.all(e.map(async e=>ua(e)?null:uP(await ur(e))))).filter(e=>!!e)}class uL extends Error{constructor(e){super(e),this.name="ShikiError"}}function uO(e,t){if(!t)return e;if(t[e]){let r=new Set([e]);for(;t[e];){if(e=t[e],r.has(e))throw new uL(`Circular alias \`${Array.from(r).join(" -> ")} -> ${e}\``);r.add(e)}}return e}class uD extends lg{constructor(e,t,r,n={}){super(e),this._resolver=e,this._themes=t,this._langs=r,this._alias=n,this._themes.map(e=>this.loadTheme(e)),this.loadLanguages(this._langs)}_resolvedThemes=new Map;_resolvedGrammars=new Map;_langMap=new Map;_langGraph=new Map;_textmateThemeCache=new WeakMap;_loadedThemesCache=null;_loadedLanguagesCache=null;getTheme(e){return"string"==typeof e?this._resolvedThemes.get(e):this.loadTheme(e)}loadTheme(e){let t=uP(e);return t.name&&(this._resolvedThemes.set(t.name,t),this._loadedThemesCache=null),t}getLoadedThemes(){return this._loadedThemesCache||(this._loadedThemesCache=[...this._resolvedThemes.keys()]),this._loadedThemesCache}setTheme(e){let t=this._textmateThemeCache.get(e);t||(t=sk.createFromRawTheme(e),this._textmateThemeCache.set(e,t)),this._syncRegistry.setTheme(t)}getGrammar(e){return e=uO(e,this._alias),this._resolvedGrammars.get(e)}loadLanguage(e){if(this.getGrammar(e.name))return;let t=new Set([...this._langMap.values()].filter(t=>t.embeddedLangsLazy?.includes(e.name)));this._resolver.addLanguage(e);let r={balancedBracketSelectors:e.balancedBracketSelectors||["*"],unbalancedBracketSelectors:e.unbalancedBracketSelectors||[]};this._syncRegistry._rawGrammars.set(e.scopeName,e);let n=this.loadGrammarWithConfiguration(e.scopeName,1,r);if(n.name=e.name,this._resolvedGrammars.set(e.name,n),e.aliases&&e.aliases.forEach(t=>{this._alias[t]=e.name}),this._loadedLanguagesCache=null,t.size)for(let e of t)this._resolvedGrammars.delete(e.name),this._loadedLanguagesCache=null,this._syncRegistry?._injectionGrammars?.delete(e.scopeName),this._syncRegistry?._grammars?.delete(e.scopeName),this.loadLanguage(this._langMap.get(e.name))}dispose(){super.dispose(),this._resolvedThemes.clear(),this._resolvedGrammars.clear(),this._langMap.clear(),this._langGraph.clear(),this._loadedThemesCache=null}loadLanguages(e){for(let t of e)this.resolveEmbeddedLanguages(t);let t=Array.from(this._langGraph.entries()),r=t.filter(([e,t])=>!t);if(r.length){let e=t.filter(([e,t])=>{if(!t)return!1;let n=t.embeddedLanguages||t.embeddedLangs;return n?.some(e=>r.map(([e])=>e).includes(e))}).filter(e=>!r.includes(e));throw new uL(`Missing languages ${r.map(([e])=>`\`${e}\``).join(", ")}, required by ${e.map(([e])=>`\`${e}\``).join(", ")}`)}for(let[e,r]of t)this._resolver.addLanguage(r);for(let[e,r]of t)this.loadLanguage(r)}getLoadedLanguages(){return this._loadedLanguagesCache||(this._loadedLanguagesCache=[...new Set([...this._resolvedGrammars.keys(),...Object.keys(this._alias)])]),this._loadedLanguagesCache}resolveEmbeddedLanguages(e){this._langMap.set(e.name,e),this._langGraph.set(e.name,e);let t=e.embeddedLanguages??e.embeddedLangs;if(t)for(let e of t)this._langGraph.set(e,this._langMap.get(e))}}class u${_langs=new Map;_scopeToLang=new Map;_injections=new Map;_onigLib;constructor(e,t){this._onigLib={createOnigScanner:t=>e.createScanner(t),createOnigString:t=>e.createString(t)},t.forEach(e=>this.addLanguage(e))}get onigLib(){return this._onigLib}getLangRegistration(e){return this._langs.get(e)}loadGrammar(e){return this._scopeToLang.get(e)}addLanguage(e){this._langs.set(e.name,e),e.aliases&&e.aliases.forEach(t=>{this._langs.set(t,e)}),this._scopeToLang.set(e.scopeName,e),e.injectTo&&e.injectTo.forEach(t=>{this._injections.get(t)||this._injections.set(t,[]),this._injections.get(t).push(e.scopeName)})}getInjections(e){let t=e.split("."),r=[];for(let e=1;e<=t.length;e++){let n=t.slice(0,e).join(".");r=[...r,...this._injections.get(n)||[]]}return r}}let uz=0;async function uB(e){e.engine||function(e,t=3){if(!(t>3))if(1)console.trace(`[SHIKI DEPRECATE]: ${e}`);else throw Error(`[SHIKI DEPRECATE]: ${e}`)}("`engine` option is required. Use `createOnigurumaEngine` or `createJavaScriptRegexEngine` to create an engine.");let[t,r,n]=await Promise.all([uj(e.themes||[]),uM(e.langs||[]),e.engine]);return function(e){let t;uz+=1,!1!==e.warnings&&uz>=10&&uz%10==0&&console.warn(`[Shiki] ${uz} instances have been created. Shiki is supposed to be used as a singleton, consider refactoring your code to cache your highlighter instance; Or call \`highlighter.dispose()\` to release unused instances.`);let r=!1;if(!e.engine)throw new uL("`engine` option is required for synchronous mode");let n=(e.langs||[]).flat(1),i=(e.themes||[]).flat(1).map(uP),a=new uD(new u$(e.engine,n),i,n,e.langAlias);function o(e){if("none"===e)return{bg:"",fg:"",name:"none",settings:[],type:"dark"};u();let t=a.getTheme(e);if(!t)throw new uL(`Theme \`${e}\` not found, you may need to load it first`);return t}function s(...e){u(),a.loadLanguages(e.flat(1))}function l(...e){for(let t of(u(),e.flat(1)))a.loadTheme(t)}function u(){if(r)throw new uL("Shiki instance has been disposed")}function c(){r||(r=!0,a.dispose(),uz-=1)}return{setTheme:function(e){u();let r=o(e);return t!==e&&(a.setTheme(r),t=e),{theme:r,colorMap:a.getColorMap()}},getTheme:o,getLanguage:function(e){u();let t=a.getGrammar("string"==typeof e?e:e.name);if(!t)throw new uL(`Language \`${e}\` not found, you may need to load it first`);return t},getLoadedThemes:function(){return u(),a.getLoadedThemes()},getLoadedLanguages:function(){return u(),a.getLoadedLanguages()},resolveLangAlias:function(t){return uO(t,e.langAlias)},loadLanguage:async function(...e){return s(await uM(e))},loadLanguageSync:s,loadTheme:async function(...e){return u(),l(await uj(e))},loadThemeSync:l,dispose:c,[Symbol.dispose]:c}}({...e,themes:t,langs:r,engine:n})}async function uF(e){let t=await uB(e);return{getLastGrammarState:(...e)=>(function(...e){if(2===e.length)return uh(e[1]);let[t,r,n={}]=e,{lang:i="text",theme:a=t.getLoadedThemes()[0]}=n;if(un(i)||ua(a))throw new sg("Plain language does not have grammar state");if("ansi"===i)throw new sg("ANSI language does not have grammar state");let{theme:o,colorMap:s}=t.setTheme(a),l=t.getLanguage(i);return new um(uk(r,l,o,s,n).stateStack,l.name,o.name)})(t,...e),codeToTokensBase:(e,r)=>uC(t,e,r),codeToTokensWithThemes:(e,r)=>uA(t,e,r),codeToTokens:(e,r)=>uE(t,e,r),codeToHast:(e,r)=>uI(t,e,r),codeToHtml:(e,r)=>(function(e,t,r){let n={meta:{},options:r,codeToHast:(t,r)=>uI(e,t,r),codeToTokens:(t,r)=>uE(e,t,r)},i=uT(uI(e,t,r,n));for(let e of uy(r))i=e.postprocess?.call(n,i,r)||i;return i})(t,e,r),getBundledLanguages:()=>({}),getBundledThemes:()=>({}),...t,getInternalContext:()=>t}}let uG=Object.fromEntries([{id:"andromeeda",displayName:"Andromeeda",type:"dark",import:()=>e.A(52913)},{id:"aurora-x",displayName:"Aurora X",type:"dark",import:()=>e.A(95208)},{id:"ayu-dark",displayName:"Ayu Dark",type:"dark",import:()=>e.A(52844)},{id:"ayu-light",displayName:"Ayu Light",type:"light",import:()=>e.A(76488)},{id:"ayu-mirage",displayName:"Ayu Mirage",type:"dark",import:()=>e.A(36002)},{id:"catppuccin-frappe",displayName:"Catppuccin Frappé",type:"dark",import:()=>e.A(72934)},{id:"catppuccin-latte",displayName:"Catppuccin Latte",type:"light",import:()=>e.A(31036)},{id:"catppuccin-macchiato",displayName:"Catppuccin Macchiato",type:"dark",import:()=>e.A(23803)},{id:"catppuccin-mocha",displayName:"Catppuccin Mocha",type:"dark",import:()=>e.A(86330)},{id:"dark-plus",displayName:"Dark Plus",type:"dark",import:()=>e.A(81001)},{id:"dracula",displayName:"Dracula Theme",type:"dark",import:()=>e.A(95735)},{id:"dracula-soft",displayName:"Dracula Theme Soft",type:"dark",import:()=>e.A(2100)},{id:"everforest-dark",displayName:"Everforest Dark",type:"dark",import:()=>e.A(58172)},{id:"everforest-light",displayName:"Everforest Light",type:"light",import:()=>e.A(75274)},{id:"github-dark",displayName:"GitHub Dark",type:"dark",import:()=>e.A(57811)},{id:"github-dark-default",displayName:"GitHub Dark Default",type:"dark",import:()=>e.A(14214)},{id:"github-dark-dimmed",displayName:"GitHub Dark Dimmed",type:"dark",import:()=>e.A(48353)},{id:"github-dark-high-contrast",displayName:"GitHub Dark High Contrast",type:"dark",import:()=>e.A(40920)},{id:"github-light",displayName:"GitHub Light",type:"light",import:()=>e.A(79755)},{id:"github-light-default",displayName:"GitHub Light Default",type:"light",import:()=>e.A(5550)},{id:"github-light-high-contrast",displayName:"GitHub Light High Contrast",type:"light",import:()=>e.A(60233)},{id:"gruvbox-dark-hard",displayName:"Gruvbox Dark Hard",type:"dark",import:()=>e.A(80721)},{id:"gruvbox-dark-medium",displayName:"Gruvbox Dark Medium",type:"dark",import:()=>e.A(27266)},{id:"gruvbox-dark-soft",displayName:"Gruvbox Dark Soft",type:"dark",import:()=>e.A(31214)},{id:"gruvbox-light-hard",displayName:"Gruvbox Light Hard",type:"light",import:()=>e.A(81110)},{id:"gruvbox-light-medium",displayName:"Gruvbox Light Medium",type:"light",import:()=>e.A(37683)},{id:"gruvbox-light-soft",displayName:"Gruvbox Light Soft",type:"light",import:()=>e.A(28130)},{id:"horizon",displayName:"Horizon",type:"dark",import:()=>e.A(70579)},{id:"horizon-bright",displayName:"Horizon Bright",type:"dark",import:()=>e.A(87165)},{id:"houston",displayName:"Houston",type:"dark",import:()=>e.A(77856)},{id:"kanagawa-dragon",displayName:"Kanagawa Dragon",type:"dark",import:()=>e.A(94363)},{id:"kanagawa-lotus",displayName:"Kanagawa Lotus",type:"light",import:()=>e.A(48953)},{id:"kanagawa-wave",displayName:"Kanagawa Wave",type:"dark",import:()=>e.A(11812)},{id:"laserwave",displayName:"LaserWave",type:"dark",import:()=>e.A(9732)},{id:"light-plus",displayName:"Light Plus",type:"light",import:()=>e.A(30788)},{id:"material-theme",displayName:"Material Theme",type:"dark",import:()=>e.A(11374)},{id:"material-theme-darker",displayName:"Material Theme Darker",type:"dark",import:()=>e.A(69460)},{id:"material-theme-lighter",displayName:"Material Theme Lighter",type:"light",import:()=>e.A(74478)},{id:"material-theme-ocean",displayName:"Material Theme Ocean",type:"dark",import:()=>e.A(49008)},{id:"material-theme-palenight",displayName:"Material Theme Palenight",type:"dark",import:()=>e.A(77952)},{id:"min-dark",displayName:"Min Dark",type:"dark",import:()=>e.A(20463)},{id:"min-light",displayName:"Min Light",type:"light",import:()=>e.A(30169)},{id:"monokai",displayName:"Monokai",type:"dark",import:()=>e.A(77035)},{id:"night-owl",displayName:"Night Owl",type:"dark",import:()=>e.A(61439)},{id:"night-owl-light",displayName:"Night Owl Light",type:"light",import:()=>e.A(28589)},{id:"nord",displayName:"Nord",type:"dark",import:()=>e.A(67304)},{id:"one-dark-pro",displayName:"One Dark Pro",type:"dark",import:()=>e.A(94497)},{id:"one-light",displayName:"One Light",type:"light",import:()=>e.A(53619)},{id:"plastic",displayName:"Plastic",type:"dark",import:()=>e.A(41717)},{id:"poimandres",displayName:"Poimandres",type:"dark",import:()=>e.A(3232)},{id:"red",displayName:"Red",type:"dark",import:()=>e.A(69411)},{id:"rose-pine",displayName:"Rosé Pine",type:"dark",import:()=>e.A(53065)},{id:"rose-pine-dawn",displayName:"Rosé Pine Dawn",type:"light",import:()=>e.A(81356)},{id:"rose-pine-moon",displayName:"Rosé Pine Moon",type:"dark",import:()=>e.A(91336)},{id:"slack-dark",displayName:"Slack Dark",type:"dark",import:()=>e.A(58732)},{id:"slack-ochin",displayName:"Slack Ochin",type:"light",import:()=>e.A(5358)},{id:"snazzy-light",displayName:"Snazzy Light",type:"light",import:()=>e.A(53493)},{id:"solarized-dark",displayName:"Solarized Dark",type:"dark",import:()=>e.A(67374)},{id:"solarized-light",displayName:"Solarized Light",type:"light",import:()=>e.A(61630)},{id:"synthwave-84",displayName:"Synthwave '84",type:"dark",import:()=>e.A(35353)},{id:"tokyo-night",displayName:"Tokyo Night",type:"dark",import:()=>e.A(29817)},{id:"vesper",displayName:"Vesper",type:"dark",import:()=>e.A(66144)},{id:"vitesse-black",displayName:"Vitesse Black",type:"dark",import:()=>e.A(96740)},{id:"vitesse-dark",displayName:"Vitesse Dark",type:"dark",import:()=>e.A(96290)},{id:"vitesse-light",displayName:"Vitesse Light",type:"light",import:()=>e.A(61379)}].map(e=>[e.id,e.import]));var uU=e.i(67034);class uW extends Error{constructor(e){super(e),this.name="ShikiError"}}function uH(){return"u">typeof performance?performance.now():Date.now()}let uq=(e,t)=>e+(t-e%t)%t;async function uV(e){let t,r,n={};function i(e){r=e,n.HEAPU8=new Uint8Array(e),n.HEAPU32=new Uint32Array(e)}let a="u">typeof TextDecoder?new TextDecoder("utf8"):void 0;function o(e,t){return e?function(e,t,r=1024){let n=t+r,i=t;for(;e[i]&&!(i>=n);)++i;if(i-t>16&&e.buffer&&a)return a.decode(e.subarray(t,i));let o="";for(;t<i;){let r=e[t++];if(!(128&r)){o+=String.fromCharCode(r);continue}let n=63&e[t++];if((224&r)==192){o+=String.fromCharCode((31&r)<<6|n);continue}let i=63&e[t++];if((r=(240&r)==224?(15&r)<<12|n<<6|i:(7&r)<<18|n<<12|i<<6|63&e[t++])<65536)o+=String.fromCharCode(r);else{let e=r-65536;o+=String.fromCharCode(55296|e>>10,56320|1023&e)}}return o}(n.HEAPU8,e,t):""}let s={emscripten_get_now:uH,emscripten_memcpy_big:function(e,t,r){n.HEAPU8.copyWithin(e,t,t+r)},emscripten_resize_heap:function(e){let a=n.HEAPU8.length;if((e>>>=0)>0x80000000)return!1;for(let n=1;n<=4;n*=2){let o=a*(1+.2/n);if(o=Math.min(o,e+0x6000000),function(e){try{return t.grow(e-r.byteLength+65535>>>16),i(t.buffer),1}catch{}}(Math.min(0x80000000,uq(Math.max(e,o),65536))))return!0}return!1},fd_write:()=>0};async function l(){let r=await e({env:s,wasi_snapshot_preview1:s});i((t=r.memory).buffer),Object.assign(n,r),n.UTF8ToString=o}return await l(),n}var uQ=Object.defineProperty,uK=(e,t,r)=>{let n;return(n="symbol"!=typeof t?t+"":t)in e?uQ(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r};let uX=null;class uJ{constructor(e){uK(this,"utf16Length"),uK(this,"utf8Length"),uK(this,"utf16Value"),uK(this,"utf8Value"),uK(this,"utf16OffsetToUtf8"),uK(this,"utf8OffsetToUtf16");const t=e.length,r=uJ._utf8ByteLength(e),n=r!==t,i=n?new Uint32Array(t+1):null;n&&(i[t]=r);const a=n?new Uint32Array(r+1):null;n&&(a[r]=t);const o=new Uint8Array(r);let s=0;for(let r=0;r<t;r++){const l=e.charCodeAt(r);let u=l,c=!1;if(l>=55296&&l<=56319&&r+1<t){const t=e.charCodeAt(r+1);t>=56320&&t<=57343&&(u=(l-55296<<10)+65536|t-56320,c=!0)}n&&(i[r]=s,c&&(i[r+1]=s),u<=127?a[s+0]=r:u<=2047?(a[s+0]=r,a[s+1]=r):u<=65535?(a[s+0]=r,a[s+1]=r,a[s+2]=r):(a[s+0]=r,a[s+1]=r,a[s+2]=r,a[s+3]=r)),u<=127?o[s++]=u:(u<=2047?o[s++]=192|(1984&u)>>>6:(u<=65535?o[s++]=224|(61440&u)>>>12:(o[s++]=240|(1835008&u)>>>18,o[s++]=128|(258048&u)>>>12),o[s++]=128|(4032&u)>>>6),o[s++]=128|(63&u)>>>0),c&&r++}this.utf16Length=t,this.utf8Length=r,this.utf16Value=e,this.utf8Value=o,this.utf16OffsetToUtf8=i,this.utf8OffsetToUtf16=a}static _utf8ByteLength(e){let t=0;for(let r=0,n=e.length;r<n;r++){let i=e.charCodeAt(r),a=i,o=!1;if(i>=55296&&i<=56319&&r+1<n){let t=e.charCodeAt(r+1);t>=56320&&t<=57343&&(a=(i-55296<<10)+65536|t-56320,o=!0)}a<=127?t+=1:a<=2047?t+=2:a<=65535?t+=3:t+=4,o&&r++}return t}createString(e){let t=e.omalloc(this.utf8Length);return e.HEAPU8.set(this.utf8Value,t),t}}let uY=class e{constructor(t){if(uK(this,"id",++e.LAST_ID),uK(this,"_onigBinding"),uK(this,"content"),uK(this,"utf16Length"),uK(this,"utf8Length"),uK(this,"utf16OffsetToUtf8"),uK(this,"utf8OffsetToUtf16"),uK(this,"ptr"),!uX)throw new uW("Must invoke loadWasm first.");this._onigBinding=uX,this.content=t;const r=new uJ(t);this.utf16Length=r.utf16Length,this.utf8Length=r.utf8Length,this.utf16OffsetToUtf8=r.utf16OffsetToUtf8,this.utf8OffsetToUtf16=r.utf8OffsetToUtf16,this.utf8Length<1e4&&!e._sharedPtrInUse?(e._sharedPtr||(e._sharedPtr=uX.omalloc(1e4)),e._sharedPtrInUse=!0,uX.HEAPU8.set(r.utf8Value,e._sharedPtr),this.ptr=e._sharedPtr):this.ptr=r.createString(uX)}convertUtf8OffsetToUtf16(e){return this.utf8OffsetToUtf16?e<0?0:e>this.utf8Length?this.utf16Length:this.utf8OffsetToUtf16[e]:e}convertUtf16OffsetToUtf8(e){return this.utf16OffsetToUtf8?e<0?0:e>this.utf16Length?this.utf8Length:this.utf16OffsetToUtf8[e]:e}dispose(){this.ptr===e._sharedPtr?e._sharedPtrInUse=!1:this._onigBinding.ofree(this.ptr)}};uK(uY,"LAST_ID",0),uK(uY,"_sharedPtr",0),uK(uY,"_sharedPtrInUse",!1);class uZ{constructor(e){if(uK(this,"_onigBinding"),uK(this,"_ptr"),!uX)throw new uW("Must invoke loadWasm first.");const t=[],r=[];for(let n=0,i=e.length;n<i;n++){const i=new uJ(e[n]);t[n]=i.createString(uX),r[n]=i.utf8Length}const n=uX.omalloc(4*e.length);uX.HEAPU32.set(t,n/4);const i=uX.omalloc(4*e.length);uX.HEAPU32.set(r,i/4);const a=uX.createOnigScanner(n,i,e.length);for(let r=0,n=e.length;r<n;r++)uX.ofree(t[r]);uX.ofree(i),uX.ofree(n),0===a&&function(e){throw new uW(e.UTF8ToString(e.getLastOnigError()))}(uX),this._onigBinding=uX,this._ptr=a}dispose(){this._onigBinding.freeOnigScanner(this._ptr)}findNextMatchSync(e,t,r){let n=0;if("number"==typeof r&&(n=r),"string"==typeof e){e=new uY(e);let r=this._findNextMatchSync(e,t,!1,n);return e.dispose(),r}return this._findNextMatchSync(e,t,!1,n)}_findNextMatchSync(e,t,r,n){let i=this._onigBinding,a=i.findNextOnigScannerMatch(this._ptr,e.id,e.ptr,e.utf8Length,e.convertUtf16OffsetToUtf8(t),n);if(0===a)return null;let o=i.HEAPU32,s=a/4,l=o[s++],u=o[s++],c=[];for(let t=0;t<u;t++){let r=e.convertUtf8OffsetToUtf16(o[s++]),n=e.convertUtf8OffsetToUtf16(o[s++]);c[t]={start:r,end:n,length:n-r}}return{index:l,captureIndices:c}}}function u0(e){return t=>WebAssembly.instantiate(e,t)}async function u1(e){return e&&await (i||(i=async function(){uX=await uV(async t=>{let r=e;if("function"==typeof(r=await r)&&(r=await r(t)),"function"==typeof r&&(r=await r(t)),"function"==typeof r.instantiator)r=await r.instantiator(t);else if("function"==typeof r.default)r=await r.default(t);else{var n,i,a,o;if(void 0!==r.data&&(r=r.data),n=r,"u">typeof Response&&n instanceof Response){r="function"==typeof WebAssembly.instantiateStreaming?await (a=r,e=>WebAssembly.instantiateStreaming(a,e))(t):await (o=r,async e=>{let t=await o.arrayBuffer();return WebAssembly.instantiate(t,e)})(t)}else(i=r,"u">typeof ArrayBuffer&&(i instanceof ArrayBuffer||ArrayBuffer.isView(i))||void 0!==uU.Buffer&&uU.Buffer.isBuffer?.(i)||"u">typeof SharedArrayBuffer&&i instanceof SharedArrayBuffer||"u">typeof Uint32Array&&i instanceof Uint32Array||r instanceof WebAssembly.Module)?r=await u0(r)(t):"default"in r&&r.default instanceof WebAssembly.Module&&(r=await u0(r.default)(t))}return"instance"in r&&(r=r.instance),"exports"in r&&(r=r.exports),r})}())),{createScanner:e=>new uZ(e.map(e=>"string"==typeof e?e:e.source)),createString:e=>new uY(e)}}let u2=(o=(b={langs:sm,themes:uG,engine:()=>u1(e.A(14467))}).langs,s=b.themes,l=b.engine,async function(e){function t(t){if("string"==typeof t){if(ui(t=e.langAlias?.[t]||t))return[];let r=o[t];if(!r)throw new sg(`Language \`${t}\` is not included in this bundle. You may want to load it from external source.`);return r}return t}function r(e){if(ua(e))return"none";if("string"==typeof e){let t=s[e];if(!t)throw new sg(`Theme \`${e}\` is not included in this bundle. You may want to load it from external source.`);return t}return e}let n=(e.themes??[]).map(e=>r(e)),i=(e.langs??[]).map(e=>t(e)),a=await uF({engine:e.engine??l(),...e,themes:n,langs:i});return{...a,loadLanguage:(...e)=>a.loadLanguage(...e.map(t)),loadTheme:(...e)=>a.loadTheme(...e.map(r)),getBundledLanguages:()=>o,getBundledThemes:()=>s}});function u5(e){if(1!=[...e].length)throw Error(`Expected "${e}" to be a single code point`);return e.codePointAt(0)}let u3=new Set(["alnum","alpha","ascii","blank","cntrl","digit","graph","lower","print","punct","space","upper","word","xdigit"]),u4=String.raw;function u6(e,t){if(null==e)throw Error(t??"Value expected");return e}let u8=u4`\[\^?`,u7=`c.? | C(?:-.?)?|${u4`[pP]\{(?:\^?[-\x20_]*[A-Za-z][-\x20\w]*\})?`}|${u4`x[89A-Fa-f]\p{AHex}(?:\\x[89A-Fa-f]\p{AHex})*`}|${u4`u(?:\p{AHex}{4})? | x\{[^\}]*\}? | x\p{AHex}{0,2}`}|${u4`o\{[^\}]*\}?`}|${u4`\d{1,3}`}`,u9=/[?*+][?+]?|\{(?:\d+(?:,\d*)?|,\d+)\}\??/,ce=RegExp(u4`
4
+ \\ (?:
5
+ ${u7}
6
+ | [gk]<[^>]*>?
7
+ | [gk]'[^']*'?
8
+ | .
9
+ )
10
+ | \( (?:
11
+ \? (?:
12
+ [:=!>({]
13
+ | <[=!]
14
+ | <[^>]*>
15
+ | '[^']*'
16
+ | ~\|?
17
+ | #(?:[^)\\]|\\.?)*
18
+ | [^:)]*[:)]
19
+ )?
20
+ | \*[^\)]*\)?
21
+ )?
22
+ | (?:${u9.source})+
23
+ | ${u8}
24
+ | .
25
+ `.replace(/\s+/g,""),"gsu"),ct=RegExp(u4`
26
+ \\ (?:
27
+ ${u7}
28
+ | .
29
+ )
30
+ | \[:(?:\^?\p{Alpha}+|\^):\]
31
+ | ${u8}
32
+ | &&
33
+ | .
34
+ `.replace(/\s+/g,""),"gsu");function cr(e,{inCharClass:t}){let r=e[1];if("c"===r||"C"===r){var n,i=e;let t="c"===i[1]?i[2]:i[3];if(!t||!/[A-Za-z]/.test(t))throw Error(`Unsupported control character "${i}"`);return ca(u5(t.toUpperCase())-64,i)}if("dDhHsSwW".includes(r)){let t;return cs({d:"digit",h:"hex",s:"space",w:"word"}[t=(n=e)[1].toLowerCase()],n,{negate:n[1]!==t})}if(e.startsWith(u4`\o{`))throw Error(`Incomplete, invalid, or unsupported octal code point "${e}"`);if(/^\\[pP]\{/.test(e)){if(3===e.length)throw Error(`Incomplete or invalid Unicode property "${e}"`);return function(e){let{p:t,neg:r,value:n}=/^\\(?<p>[pP])\{(?<neg>\^?)(?<value>[^}]+)/.exec(e).groups;return cs("property",e,{value:n,negate:"P"===t&&!r||"p"===t&&!!r})}(e)}if(/^\\x[89A-Fa-f]\p{AHex}/u.test(e))try{let t=e.split(/\\x/).slice(1).map(e=>parseInt(e,16)),r=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}).decode(new Uint8Array(t)),n=new TextEncoder;return[...r].map(e=>{let t=[...n.encode(e)].map(e=>`\\x${e.toString(16)}`).join("");return ca(u5(e),t)})}catch{throw Error(`Multibyte code "${e}" incomplete or invalid in Oniguruma`)}if("u"===r||"x"===r)return ca(function(e){if(/^(?:\\u(?!\p{AHex}{4})|\\x(?!\p{AHex}{1,2}|\{\p{AHex}{1,8}\}))/u.test(e))throw Error(`Incomplete or invalid escape "${e}"`);return parseInt("{"===e[2]?/^\\x\{\s*(?<hex>\p{AHex}+)/u.exec(e).groups.hex:e.slice(2),16)}(e),e);if(cd.has(r))return ca(cd.get(r),e);if(/\d/.test(r))return{type:"EscapedNumber",inCharClass:t,raw:e};if("\\"===e)throw Error(u4`Incomplete escape "\"`);if("M"===r)throw Error(`Unsupported meta "${e}"`);if(2==[...e].length)return ca(e.codePointAt(1),e);throw Error(`Unexpected escape "${e}"`)}function cn(e,t){return{type:"Assertion",kind:e,raw:t}}function ci(e){return{type:"Backreference",raw:e}}function ca(e,t){return{type:"Character",value:e,raw:t}}function co(e,t){return{type:"CharacterClassOpen",negate:e,raw:t}}function cs(e,t,r={}){return{type:"CharacterSet",kind:e,...r,raw:t}}function cl(e,t,r={}){return"keep"===e?{type:"Directive",kind:e,raw:t}:{type:"Directive",kind:e,flags:u6(r.flags),raw:t}}function cu(e,t,r={}){return{type:"GroupOpen",kind:e,...r,raw:t}}let cc=new Set(["COUNT","CMP","ERROR","FAIL","MAX","MISMATCH","SKIP","TOTAL_COUNT"]),cd=new Map([["a",7],["b",8],["e",27],["f",12],["n",10],["r",13],["t",9],["v",11]]);function cp(e){let t=null,r,n;if("{"===e[0]){let{minStr:i,maxStr:a}=/^\{(?<minStr>\d*)(?:,(?<maxStr>\d*))?/.exec(e).groups;if(+i>1e5||a&&+a>1e5)throw Error("Quantifier value unsupported in Oniguruma");if((r=+i)>(n=void 0===a?+i:""===a?1/0:+a)&&(t="possessive",[r,n]=[n,r]),e.endsWith("?")){if("possessive"===t)throw Error('Unsupported possessive interval quantifier chain with "?"');t="lazy"}else t||(t="greedy")}else r=+("+"===e[0]),n="?"===e[0]?1:1/0,t="+"===e[1]?"possessive":"?"===e[1]?"lazy":"greedy";return{type:"Quantifier",kind:t,min:r,max:n,raw:e}}function cf(e){let t={};return e.includes("i")&&(t.ignoreCase=!0),e.includes("m")&&(t.dotAll=!0),e.includes("x")&&(t.extended=!0),Object.keys(t).length?t:null}function ch(e,t){if(!Array.isArray(e.body))throw Error("Expected node with body array");if(1!==e.body.length)return!1;let r=e.body[0];return!t||Object.keys(t).every(e=>t[e]===r[e])}let cm=new Set(["AbsenceFunction","Backreference","CapturingGroup","Character","CharacterClass","CharacterSet","Group","Quantifier","Subroutine"]);function cg(e,t={}){var r;let n={flags:"",normalizeUnknownPropertyNames:!1,skipBackrefValidation:!1,skipLookbehindValidation:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...t,rules:{captureGroup:!1,singleline:!1,...t.rules}},i=function(e,t={}){let r={flags:"",...t,rules:{captureGroup:!1,singleline:!1,...t.rules}};if("string"!=typeof e)throw Error("String expected as pattern");let n=function(e){let t={ignoreCase:!1,dotAll:!1,extended:!1,digitIsAscii:!1,posixIsAscii:!1,spaceIsAscii:!1,wordIsAscii:!1,textSegmentMode:null};for(let r=0;r<e.length;r++){let n=e[r];if(!"imxDPSWy".includes(n))throw Error(`Invalid flag "${n}"`);if("y"===n){if(!/^y{[gw]}/.test(e.slice(r)))throw Error('Invalid or unspecified flag "y" mode');t.textSegmentMode="g"===e[r+2]?"grapheme":"word",r+=3;continue}t[({i:"ignoreCase",m:"dotAll",x:"extended",D:"digitIsAscii",P:"posixIsAscii",S:"spaceIsAscii",W:"wordIsAscii"})[n]]=!0}return t}(r.flags),i=[n.extended],a={captureGroup:r.rules.captureGroup,getCurrentModX:()=>i.at(-1),numOpenGroups:0,popModX(){i.pop()},pushModX(e){i.push(e)},replaceCurrentModX(e){i[i.length-1]=e},singleline:r.rules.singleline},o=[],s;for(ce.lastIndex=0;s=ce.exec(e);){let t=function(e,t,r,n){let[i,a]=r;if("["===r||"[^"===r){let e=function(e,t,r){let n=[co("^"===t[1],t)],i=1,a;for(ct.lastIndex=r;a=ct.exec(e);){let e=a[0];if("["===e[0]&&":"!==e[1])i++,n.push(co("^"===e[1],e));else if("]"===e){if("CharacterClassOpen"===n.at(-1).type)n.push(ca(93,e));else if(i--,n.push({type:"CharacterClassClose",raw:e}),!i)break}else{let t=function(e){if("\\"===e[0])return cr(e,{inCharClass:!0});if("["===e[0]){let t=/\[:(?<negate>\^?)(?<name>[a-z]+):\]/.exec(e);if(!t||!u3.has(t.groups.name))throw Error(`Invalid POSIX class "${e}"`);return cs("posix",e,{value:t.groups.name,negate:!!t.groups.negate})}return"-"===e?{type:"CharacterClassHyphen",raw:e}:"&&"===e?{type:"CharacterClassIntersector",raw:e}:ca(u5(e),e)}(e);Array.isArray(t)?n.push(...t):n.push(t)}}return{tokens:n,lastIndex:ct.lastIndex||e.length}}(t,r,n);return{tokens:e.tokens,lastIndex:e.lastIndex}}if("\\"===i){if("AbBGyYzZ".includes(a))return{token:cn(r,r)};if(/^\\g[<']/.test(r)){if(!/^\\g(?:<[^>]+>|'[^']+')$/.test(r))throw Error(`Invalid group name "${r}"`);return{token:{type:"Subroutine",raw:r}}}if(/^\\k[<']/.test(r)){if(!/^\\k(?:<[^>]+>|'[^']+')$/.test(r))throw Error(`Invalid group name "${r}"`);return{token:ci(r)}}if("K"===a)return{token:cl("keep",r)};if("N"===a||"R"===a)return{token:cs("newline",r,{negate:"N"===a})};if("O"===a)return{token:cs("any",r)};if("X"===a)return{token:cs("text_segment",r)};let e=cr(r,{inCharClass:!1});return Array.isArray(e)?{tokens:e}:{token:e}}if("("===i){if("*"===a)return{token:function(e){let t=/\(\*(?<name>[A-Za-z_]\w*)?(?:\[(?<tag>(?:[A-Za-z_]\w*)?)\])?(?:\{(?<args>[^}]*)\})?\)/.exec(e);if(!t)throw Error(`Incomplete or invalid named callout "${e}"`);let{name:r,tag:n,args:i}=t.groups;if(!r)throw Error(`Invalid named callout "${e}"`);if(""===n)throw Error(`Named callout tag with empty value not allowed "${e}"`);let a=i?i.split(",").filter(e=>""!==e).map(e=>/^[+-]?\d+$/.test(e)?+e:e):[],[o,s,l]=a,u=cc.has(r)?r.toLowerCase():"custom";switch(u){case"fail":case"mismatch":case"skip":if(a.length>0)throw Error(`Named callout arguments not allowed "${a}"`);break;case"error":if(a.length>1)throw Error(`Named callout allows only one argument "${a}"`);if("string"==typeof o)throw Error(`Named callout argument must be a number "${o}"`);break;case"max":if(!a.length||a.length>2)throw Error(`Named callout must have one or two arguments "${a}"`);if("string"==typeof o&&!/^[A-Za-z_]\w*$/.test(o))throw Error(`Named callout argument one must be a tag or number "${o}"`);if(2===a.length&&("number"==typeof s||!/^[<>X]$/.test(s)))throw Error(`Named callout optional argument two must be '<', '>', or 'X' "${s}"`);break;case"count":case"total_count":if(a.length>1)throw Error(`Named callout allows only one argument "${a}"`);if(1===a.length&&("number"==typeof o||!/^[<>X]$/.test(o)))throw Error(`Named callout optional argument must be '<', '>', or 'X' "${o}"`);break;case"cmp":if(3!==a.length)throw Error(`Named callout must have three arguments "${a}"`);if("string"==typeof o&&!/^[A-Za-z_]\w*$/.test(o))throw Error(`Named callout argument one must be a tag or number "${o}"`);if("number"==typeof s||!/^(?:[<>!=]=|[<>])$/.test(s))throw Error(`Named callout argument two must be '==', '!=', '>', '<', '>=', or '<=' "${s}"`);if("string"==typeof l&&!/^[A-Za-z_]\w*$/.test(l))throw Error(`Named callout argument three must be a tag or number "${l}"`);break;case"custom":throw Error(`Undefined callout name "${r}"`);default:throw Error(`Unexpected named callout kind "${u}"`)}return{type:"NamedCallout",kind:u,tag:n??null,arguments:i?.split(",")??null,raw:e}}(r)};if("(?{"===r)throw Error(`Unsupported callout "${r}"`);if(r.startsWith("(?#")){if(")"!==t[n])throw Error('Unclosed comment group "(?#"');return{lastIndex:n+1}}if(/^\(\?[-imx]+[:)]$/.test(r))return{token:function(e,t){let{on:r,off:n}=/^\(\?(?<on>[imx]*)(?:-(?<off>[-imx]*))?/.exec(e).groups;n??="";let i=(t.getCurrentModX()||r.includes("x"))&&!n.includes("x"),a=cf(r),o=cf(n),s={};if(a&&(s.enable=a),o&&(s.disable=o),e.endsWith(")"))return t.replaceCurrentModX(i),cl("flags",e,{flags:s});if(e.endsWith(":"))return t.pushModX(i),t.numOpenGroups++,cu("group",e,{...(a||o)&&{flags:s}});throw Error(`Unexpected flag modifier "${e}"`)}(r,e)};if(e.pushModX(e.getCurrentModX()),e.numOpenGroups++,"("===r&&!e.captureGroup||"(?:"===r)return{token:cu("group",r)};if("(?>"===r)return{token:cu("atomic",r)};if("(?="===r||"(?!"===r||"(?<="===r||"(?<!"===r)return{token:cu("<"===r[2]?"lookbehind":"lookahead",r,{negate:r.endsWith("!")})};if("("===r&&e.captureGroup||r.startsWith("(?<")&&r.endsWith(">")||r.startsWith("(?'")&&r.endsWith("'"))return{token:cu("capturing",r,{..."("!==r&&{name:r.slice(3,-1)}})};if(r.startsWith("(?~")){if("(?~|"===r)throw Error(`Unsupported absence function kind "${r}"`);return{token:cu("absence_repeater",r)}}throw"(?("===r?Error(`Unsupported conditional "${r}"`):Error(`Invalid or unsupported group option "${r}"`)}if(")"===r){if(e.popModX(),e.numOpenGroups--,e.numOpenGroups<0)throw Error('Unmatched ")"');return{token:{type:"GroupClose",raw:r}}}if(e.getCurrentModX()){if("#"===r){let e=t.indexOf(`
35
+ `,n);return{lastIndex:-1===e?t.length:e}}if(/^\s$/.test(r)){let e=/\s+/y;return e.lastIndex=n,{lastIndex:e.exec(t)?e.lastIndex:n}}}return"."===r?{token:cs("dot",r)}:"^"===r||"$"===r?{token:cn(e.singleline?({"^":u4`\A`,$:u4`\Z`})[r]:r,r)}:"|"===r?{token:{type:"Alternator",raw:r}}:u9.test(r)?{tokens:function(e){let t,r=[],n=RegExp(u9,"gy");for(;t=n.exec(e);){let e=t[0];if("{"===e[0]){let t=/^\{(?<min>\d+),(?<max>\d+)\}\??$/.exec(e);if(t){let{min:i,max:a}=t.groups;if(+i>+a&&e.endsWith("?")){n.lastIndex--,r.push(cp(e.slice(0,-1)));continue}}}r.push(cp(e))}return r}(r)}:{token:ca(u5(r),r)}}(a,e,s[0],ce.lastIndex);t.tokens?o.push(...t.tokens):t.token&&o.push(t.token),void 0!==t.lastIndex&&(ce.lastIndex=t.lastIndex)}let l=[],u=0;o.filter(e=>"GroupOpen"===e.type).forEach(e=>{"capturing"===e.kind?e.number=++u:"("===e.raw&&l.push(e)}),u||l.forEach((e,t)=>{e.kind="capturing",e.number=t+1});let c=u||l.length;return{tokens:o.map(e=>"EscapedNumber"===e.type?function(e,t){let{raw:r,inCharClass:n}=e,i=r.slice(1);if(!n&&("0"!==i&&1===i.length||"0"!==i[0]&&+i<=t))return[ci(r)];let a=[],o=i.match(/^[0-7]+|\d/g);for(let e=0;e<o.length;e++){let t,n=o[e];if(0===e&&"8"!==n&&"9"!==n){if((t=parseInt(n,8))>127)throw Error(u4`Octal encoded byte above 177 unsupported "${r}"`)}else t=u5(n);a.push(ca(t,(0===e?"\\":"")+n))}return a}(e,c):e).flat(),flags:n}}(e,{flags:n.flags,rules:{captureGroup:n.rules.captureGroup,singleline:n.rules.singleline}}),a=(e,t)=>{let r=i.tokens[o.nextIndex];switch(o.parent=e,o.nextIndex++,r.type){case"Alternator":return cy();case"Assertion":return function({kind:e}){return cv(u6({"^":"line_start",$:"line_end","\\A":"string_start","\\b":"word_boundary","\\B":"word_boundary","\\G":"search_start","\\y":"text_segment_boundary","\\Y":"text_segment_boundary","\\z":"string_end","\\Z":"string_end_newline"}[e],`Unexpected assertion kind "${e}"`),{negate:e===u4`\B`||e===u4`\Y`})}(r);case"Backreference":return function({raw:e},t){let r=/^\\k[<']/.test(e),n=r?e.slice(3,-1):e.slice(1),i=(r,n=!1)=>{let i=t.capturingGroups.length,a=!1;if(r>i)if(t.skipBackrefValidation)a=!0;else throw Error(`Not enough capturing groups defined to the left "${e}"`);return t.hasNumberedRef=!0,cb(n?i+1-r:r,{orphan:a})};if(r){let r=/^(?<sign>-?)0*(?<num>[1-9]\d*)$/.exec(n);if(r)return i(+r.groups.num,!!r.groups.sign);if(/[-+]/.test(n))throw Error(`Invalid backref name "${e}"`);if(!t.namedGroupsByName.has(n))throw Error(`Group name not defined to the left "${e}"`);return cb(n)}return i(+n)}(r,o);case"Character":return cw(r.value,{useLastValid:!!t.isCheckingRangeEnd});case"CharacterClassHyphen":return function(e,t,r){let{tokens:n,walk:i}=t,a=t.parent,o=a.body.at(-1),s=n[t.nextIndex];if(!r.isCheckingRangeEnd&&o&&"CharacterClass"!==o.type&&"CharacterClassRange"!==o.type&&s&&"CharacterClassOpen"!==s.type&&"CharacterClassClose"!==s.type&&"CharacterClassIntersector"!==s.type){let e=i(a,{...r,isCheckingRangeEnd:!0});if("Character"===o.type&&"Character"===e.type)return a.body.pop(),function(e,t){if(t.value<e.value)throw Error("Character class range out of order");return{type:"CharacterClassRange",min:e,max:t}}(o,e);throw Error("Invalid character class range")}return cw(u5("-"))}(0,o,t);case"CharacterClassOpen":return function({negate:e},t,r){let{tokens:n,walk:i}=t,a=n[t.nextIndex],o=[cS()],s=cj(a);for(;"CharacterClassClose"!==s.type;){if("CharacterClassIntersector"===s.type)o.push(cS()),t.nextIndex++;else{let e=o.at(-1);e.body.push(i(e,r))}s=cj(n[t.nextIndex],a)}let l=cS({negate:e});return 1===o.length?l.body=o[0].body:(l.kind="intersection",l.body=o.map(e=>1===e.body.length?e.body[0]:e)),t.nextIndex++,l}(r,o,t);case"CharacterSet":return function({kind:e,negate:t,value:r},n){let{normalizeUnknownPropertyNames:i,skipPropertyNameValidation:a,unicodePropertyMap:o}=n;if("property"===e){let n=cM(r);if(!u3.has(n)||o?.has(n))return cN(r,{negate:t,normalizeUnknownPropertyNames:i,skipPropertyNameValidation:a,unicodePropertyMap:o});e="posix",r=n}return"posix"===e?function(e,t){let r=!!t?.negate;if(!u3.has(e))throw Error(`Invalid POSIX class "${e}"`);return{type:"CharacterSet",kind:"posix",value:e,negate:r}}(r,{negate:t}):cC(e,{negate:t})}(r,o);case"Directive":return function(e,t={}){if("keep"===e)return{type:"Directive",kind:e};if("flags"===e)return{type:"Directive",kind:e,flags:u6(t.flags)};throw Error(`Unexpected directive kind "${e}"`)}(r.kind,{flags:r.flags});case"GroupOpen":return function(e,t,r){var n,i;let{tokens:a,capturingGroups:o,namedGroupsByName:s,skipLookbehindValidation:l,walk:u}=t,c=function({flags:e,kind:t,name:r,negate:n,number:i}){switch(t){case"absence_repeater":var a="repeater";!1;return{type:"AbsenceFunction",kind:a,body:cI(void 0)};case"atomic":return ck({atomic:!0});case"capturing":return cx(i,{name:r});case"group":return ck({flags:e});case"lookahead":case"lookbehind":return c_({behind:"lookbehind"===t,negate:n});default:throw Error(`Unexpected group kind "${t}"`)}}(e),d="AbsenceFunction"===c.type,p=cP(c),f=p&&c.negate;if("CapturingGroup"===c.type&&(o.push(c),c.name&&(n=c.name,i=[],s.has(n)||s.set(n,i),s.get(n)).push(c)),d&&r.isInAbsenceFunction)throw Error("Nested absence function not supported by Oniguruma");let h=cL(a[t.nextIndex]);for(;"GroupClose"!==h.type;){if("Alternator"===h.type)c.body.push(cy()),t.nextIndex++;else{let e=c.body.at(-1),t=u(e,{...r,isInAbsenceFunction:r.isInAbsenceFunction||d,isInLookbehind:r.isInLookbehind||p,isInNegLookbehind:r.isInNegLookbehind||f});if(e.body.push(t),(p||r.isInLookbehind)&&!l){let e="Lookbehind includes a pattern not allowed by Oniguruma";if(f||r.isInNegLookbehind){if(cR(t)||"CapturingGroup"===t.type)throw Error(e)}else if(cR(t)||cP(t)&&t.negate)throw Error(e)}}h=cL(a[t.nextIndex])}return t.nextIndex++,c}(r,o,t);case"NamedCallout":var n,a;return n=r.kind,a=r.tag,{type:"NamedCallout",kind:n,tag:a,arguments:r.arguments};case"Quantifier":return function({kind:e,min:t,max:r},n){let i=n.parent,a=i.body.at(-1);if(!a||!cm.has(a.type))throw Error("Quantifier requires a repeatable token");let o=cA(e,t,r,a);return i.body.pop(),o}(r,o);case"Subroutine":return function({raw:e},t){let{capturingGroups:r,subroutines:n}=t,i=e.slice(3,-1),a=/^(?<sign>[-+]?)0*(?<num>[1-9]\d*)$/.exec(i);if(a){let e=+a.groups.num,n=r.length;if(t.hasNumberedRef=!0,(i=({"":e,"+":n+e,"-":n+1-e})[a.groups.sign])<1)throw Error("Invalid subroutine number")}else"0"===i&&(i=0);let o=cE(i);return n.push(o),o}(r,o);default:throw Error(`Unexpected token type "${r.type}"`)}},o={capturingGroups:[],hasNumberedRef:!1,namedGroupsByName:new Map,nextIndex:0,normalizeUnknownPropertyNames:n.normalizeUnknownPropertyNames,parent:null,skipBackrefValidation:n.skipBackrefValidation,skipLookbehindValidation:n.skipLookbehindValidation,skipPropertyNameValidation:n.skipPropertyNameValidation,subroutines:[],tokens:i.tokens,unicodePropertyMap:n.unicodePropertyMap,walk:a},s=(r={type:"Flags",...i.flags},{type:"Regex",body:cI(void 0),flags:r}),l=s.body[0];for(;o.nextIndex<i.tokens.length;){let e=a(l,{});"Alternative"===e.type?(s.body.push(e),l=e):l.body.push(e)}let{capturingGroups:u,hasNumberedRef:c,namedGroupsByName:d,subroutines:p}=o;if(c&&d.size&&!n.rules.captureGroup)throw Error("Numbered backref/subroutine not allowed when using named capture");for(let{ref:e}of p)if("number"==typeof e){if(e>u.length)throw Error("Subroutine uses a group number that's not defined");e&&(u[e-1].isSubroutined=!0)}else if(d.has(e)){if(d.get(e).length>1)throw Error(u4`Subroutine uses a duplicate group name "\g<${e}>"`);d.get(e)[0].isSubroutined=!0}else throw Error(u4`Subroutine uses a group name that's not defined "\g<${e}>"`);return s}function cy(e){return{type:"Alternative",body:cT(e?.body)}}function cv(e,t){let r={type:"Assertion",kind:e};return("word_boundary"===e||"text_segment_boundary"===e)&&(r.negate=!!t?.negate),r}function cb(e,t){let r=!!t?.orphan;return{type:"Backreference",ref:e,...r&&{orphan:r}}}function cx(e,t){var r;let n={name:void 0,isSubroutined:!1,...t};if(void 0!==n.name&&(r=n.name,!/^[\p{Alpha}\p{Pc}][^)]*$/u.test(r)))throw Error(`Group name "${n.name}" invalid in Oniguruma`);return{type:"CapturingGroup",number:e,...n.name&&{name:n.name},...n.isSubroutined&&{isSubroutined:n.isSubroutined},body:cI(t?.body)}}function cw(e,t){let r={useLastValid:!1,...t};if(e>1114111){let t=e.toString(16);if(r.useLastValid)e=1114111;else throw e>1310719?Error(`Invalid code point out of range "\\x{${t}}"`):Error(`Invalid code point out of range in JS "\\x{${t}}"`)}return{type:"Character",value:e}}function cS(e){let t={kind:"union",negate:!1,...e};return{type:"CharacterClass",kind:t.kind,negate:t.negate,body:cT(e?.body)}}function cC(e,t){let r=!!t?.negate,n={type:"CharacterSet",kind:e};return("digit"===e||"hex"===e||"newline"===e||"space"===e||"word"===e)&&(n.negate=r),"text_segment"!==e&&("newline"!==e||r)||(n.variableLength=!0),n}function ck(e){let t=e?.atomic,r=e?.flags;if(t&&r)throw Error("Atomic group cannot have flags");return{type:"Group",...t&&{atomic:t},...r&&{flags:r},body:cI(e?.body)}}function c_(e){let t={behind:!1,negate:!1,...e};return{type:"LookaroundAssertion",kind:t.behind?"lookbehind":"lookahead",negate:t.negate,body:cI(e?.body)}}function cA(e,t,r,n){if(t>r)throw Error("Invalid reversed quantifier range");return{type:"Quantifier",kind:e,min:t,max:r,body:n}}function cE(e){return{type:"Subroutine",ref:e}}function cN(e,t){let r={negate:!1,normalizeUnknownPropertyNames:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...t},n=r.unicodePropertyMap?.get(cM(e));if(!n){if(r.normalizeUnknownPropertyNames)n=e.trim().replace(/[- _]+/g,"_").replace(/[A-Z][a-z]+(?=[A-Z])/g,"$&_").replace(/[A-Za-z]+/g,e=>e[0].toUpperCase()+e.slice(1).toLowerCase());else if(r.unicodePropertyMap&&!r.skipPropertyNameValidation)throw Error(u4`Invalid Unicode property "\p{${e}}"`)}return{type:"CharacterSet",kind:"property",value:n??e,negate:r.negate}}function cI(e){if(void 0===e)e=[cy()];else if(!Array.isArray(e)||!e.length||!e.every(e=>"Alternative"===e.type))throw Error("Invalid body; expected array of one or more Alternative nodes");return e}function cT(e){if(void 0===e)e=[];else if(!Array.isArray(e)||!e.every(e=>!!e.type))throw Error("Invalid body; expected array of nodes");return e}function cR(e){return"LookaroundAssertion"===e.type&&"lookahead"===e.kind}function cP(e){return"LookaroundAssertion"===e.type&&"lookbehind"===e.kind}function cM(e){return e.replace(/[- _]+/g,"").toLowerCase()}function cj(e,t){return u6(e,`${t?.type==="Character"&&93===t.value?"Empty":"Unclosed"} character class`)}function cL(e){return u6(e,"Unclosed group")}function cO(e,t,r=null){function n(e,t){for(let r=0;r<e.length;r++){let n=i(e[r],t,r,e);r=Math.max(-1,r+n)}}function i(a,o=null,s=null,l=null){let u=0,c=!1,d={node:a,parent:o,key:s,container:l,root:e,remove(){cD(l).splice(Math.max(0,c$(s)+u),1),u--,c=!0},removeAllNextSiblings:()=>cD(l).splice(c$(s)+1),removeAllPrevSiblings(){let e=c$(s)+u;return u-=e,cD(l).splice(0,Math.max(0,e))},replaceWith(e,t={}){let r=!!t.traverse;l?l[Math.max(0,c$(s)+u)]=e:u6(o,"Can't replace root node")[s]=e,r&&i(e,o,s,l),c=!0},replaceWithMultiple(e,t={}){let r=!!t.traverse;if(cD(l).splice(Math.max(0,c$(s)+u),1,...e),u+=e.length-1,r){let t=0;for(let r=0;r<e.length;r++)t+=i(e[r],o,c$(s)+r+t,l)}c=!0},skip(){c=!0}},{type:p}=a,f=t["*"],h=t[p],m="function"==typeof f?f:f?.enter,g="function"==typeof h?h:h?.enter;if(m?.(d,r),g?.(d,r),!c)switch(p){case"AbsenceFunction":case"CapturingGroup":case"Group":case"Alternative":case"CharacterClass":case"LookaroundAssertion":n(a.body,a);break;case"Assertion":case"Backreference":case"Character":case"CharacterSet":case"Directive":case"Flags":case"NamedCallout":case"Subroutine":break;case"CharacterClassRange":i(a.min,a,"min"),i(a.max,a,"max");break;case"Quantifier":i(a.body,a,"body");break;case"Regex":n(a.body,a),i(a.flags,a,"flags");break;default:throw Error(`Unexpected node type "${p}"`)}return h?.exit?.(d,r),f?.exit?.(d,r),u}return i(e),e}function cD(e){if(!Array.isArray(e))throw Error("Container expected");return e}function c$(e){if("number"!=typeof e)throw Error("Numeric key expected");return e}let cz=String.raw`\(\?(?:[:=!>A-Za-z\-]|<[=!]|\(DEFINE\))`,cB=Object.freeze({DEFAULT:"DEFAULT",CHAR_CLASS:"CHAR_CLASS"});function cF(e,t,r,n){let i=RegExp(String.raw`${t}|(?<$skip>\[\^?|\\?.)`,"gsu"),a=[!1],o=0,s="";for(let t of e.matchAll(i)){let{0:e,groups:{$skip:i}}=t;if(!i&&(!n||n===cB.DEFAULT==!o)){r instanceof Function?s+=r(t,{context:o?cB.CHAR_CLASS:cB.DEFAULT,negated:a[a.length-1]}):s+=r;continue}"["===e[0]?(o++,a.push("^"===e[1])):"]"===e&&o&&(o--,a.pop()),s+=e}return s}function cG(e,t,r){return!!function(e,t,r=0,n){let i;if(!RegExp(t,"su").test(e))return null;let a=RegExp(`${t}|(?<$skip>\\\\?.)`,"gsu");a.lastIndex=r;let o=0;for(;i=a.exec(e);){let{0:e,groups:{$skip:t}}=i;if(!t&&(!n||n===cB.DEFAULT==!o))return i;"["===e?o++:"]"===e&&o&&o--,a.lastIndex==i.index&&a.lastIndex++}return null}(e,t,0,r)}let cU=RegExp(String.raw`(?<noncapturingStart>${cz})|(?<capturingStart>\((?:\?<[^>]+>)?)|\\?.`,"gsu"),cW=String.raw`(?:[?*+]|\{\d+(?:,\d*)?\})`,cH=RegExp(String.raw`
36
+ \\(?: \d+
37
+ | c[A-Za-z]
38
+ | [gk]<[^>]+>
39
+ | [pPu]\{[^\}]+\}
40
+ | u[A-Fa-f\d]{4}
41
+ | x[A-Fa-f\d]{2}
42
+ )
43
+ | \((?: \? (?: [:=!>]
44
+ | <(?:[=!]|[^>]+>)
45
+ | [A-Za-z\-]+:
46
+ | \(DEFINE\)
47
+ ))?
48
+ | (?<qBase>${cW})(?<qMod>[?+]?)(?<invalidQ>[?*+\{]?)
49
+ | \\?.
50
+ `.replace(/\s+/g,""),"gsu"),cq=String.raw,cV=cq`\\g<(?<gRNameOrNum>[^>&]+)&R=(?<gRDepth>[^>]+)>`,cQ=cq`\(\?R=(?<rDepth>[^\)]+)\)|${cV}`,cK=cq`\(\?<(?![=!])(?<captureName>[^>]+)>`,cX=cq`${cK}|(?<unnamed>\()(?!\?)`,cJ=RegExp(cq`${cK}|${cQ}|\(\?|\\?.`,"gsu"),cY="Cannot use multiple overlapping recursions";function cZ(e){let t=`Max depth must be integer between 2 and 100; used ${e}`;if(!/^[1-9]\d*$/.test(e)||(e*=1)<2||e>100)throw Error(t)}function c0(e,t,r,n,i,a,o){let s=new Set;n&&cF(e+t,cK,({groups:{captureName:e}})=>{s.add(e)},cB.DEFAULT);let l=[r,n?s:null,i,a,o];return`${e}${c1(`(?:${e}`,"forward",...l)}(?:)${c1(`${t})`,"backward",...l)}${t}`}function c1(e,t,r,n,i,a,o){let s=e=>"forward"===t?e+2:r-e+2-1,l="";for(let t=0;t<r;t++){let r=s(t);l+=cF(e,cq`${cX}|\\k<(?<backref>[^>]+)>`,({0:e,groups:{captureName:t,unnamed:s,backref:l}})=>{if(l&&n&&!n.has(l))return e;let u=`_$${r}`;if(s||t){let r=o+a.length+1;return a.push(r),function(e,t){for(let r=0;r<e.length;r++)e[r]>=t&&e[r]++}(i,r),s?e:`(?<${t}${u}>`}return cq`\k<${l}${u}>`},cB.DEFAULT)}return l}function c2(e,t,r,n,i,a){if(e.size&&n){let o=0;cF(t,cX,()=>o++,cB.DEFAULT);let s=a-o+i,l=new Map;return e.forEach((e,t)=>{let i=(n-o*r)/r,a=o*r,u=t>s+o?t+n:t,c=[];for(let t of e)if(t<=s)c.push(t);else if(t>s+o+i)c.push(t+n);else if(t<=s+o)for(let e=0;e<=r;e++)c.push(t+o*e);else for(let e=0;e<=r;e++)c.push(t+a+i*e);l.set(u,c)}),l}return e}var c5=String.fromCodePoint,c3=String.raw,c4={flagGroups:(()=>{try{RegExp("(?i:)")}catch{return!1}return!0})(),unicodeSets:(()=>{try{RegExp("[[]]","v")}catch{return!1}return!0})()};function c6(e,{enable:t,disable:r}){return{dotAll:!r?.dotAll&&!!(t?.dotAll||e.dotAll),ignoreCase:!r?.ignoreCase&&!!(t?.ignoreCase||e.ignoreCase)}}function c8(e,t,r){return e.has(t)||e.set(t,r),e.get(t)}c4.bugFlagVLiteralHyphenIsRange=!!c4.unicodeSets&&(()=>{try{RegExp(c3`[\d\-a]`,"v")}catch{return!0}return!1})(),c4.bugNestedClassIgnoresNegation=c4.unicodeSets&&RegExp("[[^a]]","v").test("a");var c7={ES2025:2025,ES2024:2024,ES2018:2018},c9={auto:"auto",ES2025:"ES2025",ES2024:"ES2024",ES2018:"ES2018"};function de(e={}){if("[object Object]"!==({}).toString.call(e))throw Error("Unexpected options");if(void 0!==e.target&&!c9[e.target])throw Error(`Unexpected target "${e.target}"`);let t={accuracy:"default",avoidSubclass:!1,flags:"",global:!1,hasIndices:!1,lazyCompileLength:1/0,target:"auto",verbose:!1,...e,rules:{allowOrphanBackrefs:!1,asciiWordBoundaries:!1,captureGroup:!1,recursionLimit:20,singleline:!1,...e.rules}};return"auto"===t.target&&(t.target=c4.flagGroups?"ES2025":c4.unicodeSets?"ES2024":"ES2018"),t}var dt=new Set([c5(304),c5(305)]),dr=c3`[\p{L}\p{M}\p{N}\p{Pc}]`;function dn(e){if(dt.has(e))return[e];let t=new Set,r=e.toLowerCase(),n=r.toUpperCase(),i=dl.get(r),a=da.get(r),o=ds.get(r);return 1==[...n].length&&t.add(n),o&&t.add(o),i&&t.add(i),t.add(r),a&&t.add(a),[...t]}var di=new Map(`C Other
51
+ Cc Control cntrl
52
+ Cf Format
53
+ Cn Unassigned
54
+ Co Private_Use
55
+ Cs Surrogate
56
+ L Letter
57
+ LC Cased_Letter
58
+ Ll Lowercase_Letter
59
+ Lm Modifier_Letter
60
+ Lo Other_Letter
61
+ Lt Titlecase_Letter
62
+ Lu Uppercase_Letter
63
+ M Mark Combining_Mark
64
+ Mc Spacing_Mark
65
+ Me Enclosing_Mark
66
+ Mn Nonspacing_Mark
67
+ N Number
68
+ Nd Decimal_Number digit
69
+ Nl Letter_Number
70
+ No Other_Number
71
+ P Punctuation punct
72
+ Pc Connector_Punctuation
73
+ Pd Dash_Punctuation
74
+ Pe Close_Punctuation
75
+ Pf Final_Punctuation
76
+ Pi Initial_Punctuation
77
+ Po Other_Punctuation
78
+ Ps Open_Punctuation
79
+ S Symbol
80
+ Sc Currency_Symbol
81
+ Sk Modifier_Symbol
82
+ Sm Math_Symbol
83
+ So Other_Symbol
84
+ Z Separator
85
+ Zl Line_Separator
86
+ Zp Paragraph_Separator
87
+ Zs Space_Separator
88
+ ASCII
89
+ ASCII_Hex_Digit AHex
90
+ Alphabetic Alpha
91
+ Any
92
+ Assigned
93
+ Bidi_Control Bidi_C
94
+ Bidi_Mirrored Bidi_M
95
+ Case_Ignorable CI
96
+ Cased
97
+ Changes_When_Casefolded CWCF
98
+ Changes_When_Casemapped CWCM
99
+ Changes_When_Lowercased CWL
100
+ Changes_When_NFKC_Casefolded CWKCF
101
+ Changes_When_Titlecased CWT
102
+ Changes_When_Uppercased CWU
103
+ Dash
104
+ Default_Ignorable_Code_Point DI
105
+ Deprecated Dep
106
+ Diacritic Dia
107
+ Emoji
108
+ Emoji_Component EComp
109
+ Emoji_Modifier EMod
110
+ Emoji_Modifier_Base EBase
111
+ Emoji_Presentation EPres
112
+ Extended_Pictographic ExtPict
113
+ Extender Ext
114
+ Grapheme_Base Gr_Base
115
+ Grapheme_Extend Gr_Ext
116
+ Hex_Digit Hex
117
+ IDS_Binary_Operator IDSB
118
+ IDS_Trinary_Operator IDST
119
+ ID_Continue IDC
120
+ ID_Start IDS
121
+ Ideographic Ideo
122
+ Join_Control Join_C
123
+ Logical_Order_Exception LOE
124
+ Lowercase Lower
125
+ Math
126
+ Noncharacter_Code_Point NChar
127
+ Pattern_Syntax Pat_Syn
128
+ Pattern_White_Space Pat_WS
129
+ Quotation_Mark QMark
130
+ Radical
131
+ Regional_Indicator RI
132
+ Sentence_Terminal STerm
133
+ Soft_Dotted SD
134
+ Terminal_Punctuation Term
135
+ Unified_Ideograph UIdeo
136
+ Uppercase Upper
137
+ Variation_Selector VS
138
+ White_Space space
139
+ XID_Continue XIDC
140
+ XID_Start XIDS`.split(/\s/).map(e=>[cM(e),e])),da=new Map([["s",c5(383)],[c5(383),"s"]]),ds=new Map([[c5(223),c5(7838)],[c5(107),c5(8490)],[c5(229),c5(8491)],[c5(969),c5(8486)]]),dl=new Map([dc(453),dc(456),dc(459),dc(498),...dd(8072,8079),...dd(8088,8095),...dd(8104,8111),dc(8124),dc(8140),dc(8188)]),du=new Map([["alnum",c3`[\p{Alpha}\p{Nd}]`],["alpha",c3`\p{Alpha}`],["ascii",c3`\p{ASCII}`],["blank",c3`[\p{Zs}\t]`],["cntrl",c3`\p{Cc}`],["digit",c3`\p{Nd}`],["graph",c3`[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]`],["lower",c3`\p{Lower}`],["print",c3`[[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]\p{Zs}]`],["punct",c3`[\p{P}\p{S}]`],["space",c3`\p{space}`],["upper",c3`\p{Upper}`],["word",c3`[\p{Alpha}\p{M}\p{Nd}\p{Pc}]`],["xdigit",c3`\p{AHex}`]]);function dc(e){let t=c5(e);return[t.toLowerCase(),t]}function dd(e,t){return(function(e,t){let r=[];for(let n=e;n<=t;n++)r.push(n);return r})(e,t).map(e=>dc(e))}var dp=new Set(["Lower","Lowercase","Upper","Uppercase","Ll","Lowercase_Letter","Lt","Titlecase_Letter","Lu","Uppercase_Letter"]),df={AbsenceFunction({node:e,parent:t,replaceWith:r}){let{body:n,kind:i}=e;if("repeater"===i){let e=ck();e.body[0].body.push(c_({negate:!0,body:n}),cN("Any"));let i=ck();i.body[0].body.push(cA("greedy",0,1/0,e)),r(d_(i,t),{traverse:!0})}else throw Error('Unsupported absence function "(?~|"')},Alternative:{enter({node:e,parent:t,key:r},{flagDirectivesByAlt:n}){let i=e.body.filter(e=>"flags"===e.kind);for(let e=r+1;e<t.body.length;e++)c8(n,t.body[e],[]).push(...i)},exit({node:e},{flagDirectivesByAlt:t}){if(t.get(e)?.length){let r=db(t.get(e));if(r){let t=ck({flags:r});t.body[0].body=e.body,e.body=[d_(t,e)]}}}},Assertion({node:e,parent:t,key:r,container:n,root:i,remove:a,replaceWith:o},s){let{kind:l,negate:u}=e,{asciiWordBoundaries:c,avoidSubclass:d,supportedGNodes:p,wordIsAscii:f}=s;if("text_segment_boundary"===l)throw Error(`Unsupported text segment boundary "\\${u?"Y":"y"}"`);if("line_end"===l)o(d_(c_({body:[cy({body:[cv("string_end")]}),cy({body:[cw(10)]})]}),t));else if("line_start"===l)o(d_(dS(c3`(?<=\A|\n(?!\z))`,{skipLookbehindValidation:!0}),t));else if("search_start"===l)if(p.has(e))i.flags.sticky=!0,a();else{var h;let e,i=n[r-1];if(i&&((e=["Character","CharacterClass","CharacterSet"]).includes((h=i).type)||"Quantifier"===h.type&&h.min&&e.includes(h.body.type)))o(d_(c_({negate:!0}),t));else if(d)throw Error(c3`Uses "\G" in a way that requires a subclass`);else o(dk(cv("string_start"),t)),s.strategy="clip_search"}else if("string_end"===l||"string_start"===l);else if("string_end_newline"===l)o(d_(dS(c3`(?=\n?\z)`),t));else if("word_boundary"===l){if(!f&&!c){let e=`(?:(?<=${dr})(?!${dr})|(?<!${dr})(?=${dr}))`,r=`(?:(?<=${dr})(?=${dr})|(?<!${dr})(?!${dr}))`;o(d_(dS(u?r:e),t))}}else throw Error(`Unexpected assertion kind "${l}"`)},Backreference({node:e},{jsGroupNameMap:t}){let{ref:r}=e;"string"!=typeof r||dw(r)||(e.ref=r=dv(r,t))},CapturingGroup({node:e},{jsGroupNameMap:t,subroutineRefMap:r}){let{name:n}=e;n&&!dw(n)&&(e.name=n=dv(n,t)),r.set(e.number,e),n&&r.set(n,e)},CharacterClassRange({node:e,parent:t,replaceWith:r}){"intersection"===t.kind&&r(d_(cS({body:[e]}),t),{traverse:!0})},CharacterSet({node:e,parent:t,replaceWith:r},{accuracy:n,minTargetEs2024:i,digitIsAscii:a,spaceIsAscii:o,wordIsAscii:s}){let{kind:l,negate:u,value:c}=e;if(a&&("digit"===l||"digit"===c))return void r(dk(cC("digit",{negate:u}),t));if(o&&("space"===l||"space"===c))return void r(d_(dC(dS("[ -\r ]"),u),t));if(s&&("word"===l||"word"===c))return void r(dk(cC("word",{negate:u}),t));if("any"===l)r(dk(cN("Any"),t));else if("digit"===l)r(dk(cN("Nd",{negate:u}),t));else if("dot"===l);else if("text_segment"===l){if("strict"===n)throw Error(c3`Use of "\X" requires non-strict accuracy`);let e="\\p{Emoji}(?:\\p{EMod}|\\uFE0F\\u20E3?|[\\x{E0020}-\\x{E007E}]+\\x{E007F})?",a=c3`\p{RI}{2}|${e}(?:\u200D${e})*`;r(d_(dS(c3`(?>\r\n|${i?c3`\p{RGI_Emoji}`:a}|\P{M}\p{M}*)`,{skipPropertyNameValidation:!0}),t))}else if("hex"===l)r(dk(cN("AHex",{negate:u}),t));else if("newline"===l)r(d_(dS(u?"[^\n]":"(?>\r\n?|[\n\v\f…\u2028\u2029])"),t));else if("posix"===l)if(i||"graph"!==c&&"print"!==c)r(d_(dC(dS(du.get(c)),u),t));else{if("strict"===n)throw Error(`POSIX class "${c}" requires min target ES2024 or non-strict accuracy`);let e={graph:"!-~",print:" -~"}[c];u&&(e=`\0-${c5(e.codePointAt(0)-1)}${c5(e.codePointAt(2)+1)}-\u{10FFFF}`),r(d_(dS(`[${e}]`),t))}else if("property"===l)di.has(cM(c))||(e.key="sc");else if("space"===l)r(dk(cN("space",{negate:u}),t));else if("word"===l)r(d_(dC(dS(dr),u),t));else throw Error(`Unexpected character set kind "${l}"`)},Directive({node:e,parent:t,root:r,remove:n,replaceWith:i,removeAllPrevSiblings:a,removeAllNextSiblings:o}){let{kind:s,flags:l}=e;if("flags"===s)if(l.enable||l.disable){let e=ck({flags:l});e.body[0].body=o(),i(d_(e,t),{traverse:!0})}else n();else if("keep"===s){let e=r.body[0],n=1===r.body.length&&ch(e,{type:"Group"})&&1===e.body[0].body.length?e.body[0]:r;if(t.parent!==n||n.body.length>1)throw Error(c3`Uses "\K" in a way that's unsupported`);let o=c_({behind:!0});o.body[0].body=a(),i(d_(o,t))}else throw Error(`Unexpected directive kind "${s}"`)},Flags({node:e,parent:t}){if(e.posixIsAscii)throw Error('Unsupported flag "P"');if("word"===e.textSegmentMode)throw Error('Unsupported flag "y{w}"');["digitIsAscii","extended","posixIsAscii","spaceIsAscii","wordIsAscii","textSegmentMode"].forEach(t=>delete e[t]),Object.assign(e,{global:!1,hasIndices:!1,multiline:!1,sticky:e.sticky??!1}),t.options={disable:{x:!0,n:!0},force:{v:!0}}},Group({node:e}){if(!e.flags)return;let{enable:t,disable:r}=e.flags;t?.extended&&delete t.extended,r?.extended&&delete r.extended,t?.dotAll&&r?.dotAll&&delete t.dotAll,t?.ignoreCase&&r?.ignoreCase&&delete t.ignoreCase,t&&!Object.keys(t).length&&delete e.flags.enable,r&&!Object.keys(r).length&&delete e.flags.disable,e.flags.enable||e.flags.disable||delete e.flags},LookaroundAssertion({node:e},t){let{kind:r}=e;"lookbehind"===r&&(t.passedLookbehind=!0)},NamedCallout({node:e,parent:t,replaceWith:r}){let{kind:n}=e;if("fail"===n)r(d_(c_({negate:!0}),t));else throw Error(`Unsupported named callout "(*${n.toUpperCase()}"`)},Quantifier({node:e}){if("Quantifier"===e.body.type){let t=ck();t.body[0].body.push(e.body),e.body=d_(t,e)}},Regex:{enter({node:e},{supportedGNodes:t}){let r=[],n=!1,i=!1;for(let t of e.body)if(1===t.body.length&&"search_start"===t.body[0].kind)t.body.pop();else{let e=function e(t){let r=t.find(e=>"search_start"===e.kind||function(e,t){let r={negate:null,...t};return"LookaroundAssertion"===e.type&&(null===r.negate||e.negate===r.negate)&&1===e.body.length&&ch(e.body[0],{type:"Assertion",kind:"search_start"})}(e,{negate:!1})||!function({type:e}){return"Assertion"===e||"Directive"===e||"LookaroundAssertion"===e}(e));if(!r)return null;if("search_start"===r.kind)return r;if("LookaroundAssertion"===r.type)return r.body[0].body[0];if("CapturingGroup"===r.type||"Group"===r.type){let t=[];for(let n of r.body){let r=e(n.body);if(!r)return null;Array.isArray(r)?t.push(...r):t.push(r)}return t}return null}(t.body);e?(n=!0,Array.isArray(e)?r.push(...e):r.push(e)):i=!0}n&&!i&&r.forEach(e=>t.add(e))},exit(e,{accuracy:t,passedLookbehind:r,strategy:n}){if("strict"===t&&r&&n)throw Error(c3`Uses "\G" in a way that requires non-strict accuracy`)}},Subroutine({node:e},{jsGroupNameMap:t}){let{ref:r}=e;"string"!=typeof r||dw(r)||(e.ref=r=dv(r,t))}},dh={Backreference({node:e},{multiplexCapturesToLeftByRef:t,reffedNodesByReferencer:r}){let{orphan:n,ref:i}=e;n||r.set(e,[...t.get(i).map(({node:e})=>e)])},CapturingGroup:{enter({node:e,parent:t,replaceWith:r,skip:n},{groupOriginByCopy:i,groupsByName:a,multiplexCapturesToLeftByRef:o,openRefs:s,reffedNodesByReferencer:l}){let u=i.get(e);if(u&&s.has(e.number)){let n=dk(dy(e.number),t);l.set(n,s.get(e.number)),r(n);return}s.set(e.number,e),o.set(e.number,[]),e.name&&c8(o,e.name,[]);let c=o.get(e.name??e.number);for(let t=0;t<c.length;t++){let r=c[t];if(u===r.node||u&&u===r.origin||e===r.origin){c.splice(t,1);break}}if(o.get(e.number).push({node:e,origin:u}),e.name&&o.get(e.name).push({node:e,origin:u}),e.name){let t=c8(a,e.name,new Map),r=!1;if(u)r=!0;else for(let e of t.values())if(!e.hasDuplicateNameToRemove){r=!0;break}a.get(e.name).set(e,{node:e,hasDuplicateNameToRemove:r})}},exit({node:e},{openRefs:t}){t.delete(e.number)}},Group:{enter({node:e},t){t.prevFlags=t.currentFlags,e.flags&&(t.currentFlags=c6(t.currentFlags,e.flags))},exit(e,t){t.currentFlags=t.prevFlags}},Subroutine({node:e,parent:t,replaceWith:r},n){let{isRecursive:i,ref:a}=e;if(i){let r=t;for(;(r=r.parent)&&("CapturingGroup"!==r.type||r.name!==a&&r.number!==a););n.reffedNodesByReferencer.set(e,r);return}let o=n.subroutineRefMap.get(a),s=0===a,l=s?dy(0):function e(t,r,n,i){let a=Array.isArray(t)?[]:{};for(let[o,s]of Object.entries(t))"parent"===o?a.parent=Array.isArray(n)?i:n:s&&"object"==typeof s?a[o]=e(s,r,a,n):("type"===o&&"CapturingGroup"===s&&r.set(a,r.get(t)??t),a[o]=s);return a}(o,n.groupOriginByCopy,null),u=l;if(!s){var c,d;let e=db(function(e,t){let r=[];for(;e=e.parent;)(!t||t(e))&&r.push(e);return r}(o,e=>"Group"===e.type&&!!e.flags)),t=e?c6(n.globalFlags,e):n.globalFlags;c=t,d=n.currentFlags,(c.dotAll!==d.dotAll||c.ignoreCase!==d.ignoreCase)&&(u=ck({flags:function({dotAll:e,ignoreCase:t}){let r={};return(e||t)&&(r.enable={},e&&(r.enable.dotAll=!0),t&&(r.enable.ignoreCase=!0)),e&&t||(r.disable={},e||(r.disable.dotAll=!0),t||(r.disable.ignoreCase=!0)),r}(t)})).body[0].body.push(l)}r(d_(u,t),{traverse:!s})}},dm={Backreference({node:e,parent:t,replaceWith:r},n){if(e.orphan){n.highestOrphanBackref=Math.max(n.highestOrphanBackref,e.ref);return}let i=n.reffedNodesByReferencer.get(e).filter(t=>(function(e,t){let r=t;do{if("Regex"===r.type)return!1;if("Alternative"===r.type)continue;if(r===e)return!1;for(let t of dx(r.parent)){if(t===r)break;if(t===e||function e(t,r){for(let n of dx(t)??[])if(n===r||e(n,r))return!0;return!1}(t,e))return!0}}while(r=r.parent)throw Error("Unexpected path")})(t,e));i.length?i.length>1?r(d_(ck({atomic:!0,body:i.reverse().map(e=>cy({body:[cb(e.number)]}))}),t)):e.ref=i[0].number:r(d_(c_({negate:!0}),t))},CapturingGroup({node:e},t){e.number=++t.numCapturesToLeft,e.name&&t.groupsByName.get(e.name).get(e).hasDuplicateNameToRemove&&delete e.name},Regex:{exit({node:e},t){let r=Math.max(t.highestOrphanBackref-t.numCapturesToLeft,0);for(let t=0;t<r;t++){let t=cx();e.body.at(-1).body.push(t)}}},Subroutine({node:e},t){e.isRecursive&&0!==e.ref&&(e.ref=t.reffedNodesByReferencer.get(e).number)}};function dg(e){cO(e,{"*"({node:e,parent:t}){e.parent=t}})}function dy(e){let t=cE(e);return t.isRecursive=!0,t}function dv(e,t){if(t.has(e))return t.get(e);let r=`$${t.size}_${e.replace(/^[^$_\p{IDS}]|[^$\u200C\u200D\p{IDC}]/ug,"_")}`;return t.set(e,r),r}function db(e){let t=["dotAll","ignoreCase"],r={enable:{},disable:{}};return(e.forEach(({flags:e})=>{t.forEach(t=>{e.enable?.[t]&&(delete r.disable[t],r.enable[t]=!0),e.disable?.[t]&&(r.disable[t]=!0)})}),Object.keys(r.enable).length||delete r.enable,Object.keys(r.disable).length||delete r.disable,r.enable||r.disable)?r:null}function dx(e){if(!e)throw Error("Node expected");let{body:t}=e;return Array.isArray(t)?t:t?[t]:null}function dw(e){return/^[$_\p{IDS}][$\u200C\u200D\p{IDC}]*$/u.test(e)}function dS(e,t){let r=cg(e,{...t,unicodePropertyMap:di}).body;return r.length>1||r[0].body.length>1?ck({body:r}):r[0].body[0]}function dC(e,t){return e.negate=t,e}function dk(e,t){return e.parent=t,e}function d_(e,t){return dg(e),e.parent=t,e}var dA={"*":{enter({node:e},t){if(dO(e)){let r=t.getCurrentModI();t.pushModI(e.flags?c6({ignoreCase:r},e.flags).ignoreCase:r)}},exit({node:e},t){dO(e)&&t.popModI()}},Backreference(e,t){t.setHasCasedChar()},Character({node:e},t){dM(c5(e.value))&&t.setHasCasedChar()},CharacterClassRange({node:e,skip:t},r){t(),dj(e,{firstOnly:!0}).length&&r.setHasCasedChar()},CharacterSet({node:e},t){"property"===e.kind&&dp.has(e.value)&&t.setHasCasedChar()}},dE={Alternative:({body:e},t,r)=>e.map(r).join(""),Assertion({kind:e,negate:t}){if("string_end"===e)return"$";if("string_start"===e)return"^";if("word_boundary"===e)return t?c3`\B`:c3`\b`;throw Error(`Unexpected assertion kind "${e}"`)},Backreference({ref:e},t){if("number"!=typeof e)throw Error("Unexpected named backref in transformed AST");if(!t.useFlagMods&&"strict"===t.accuracy&&t.currentFlags.ignoreCase&&!t.captureMap.get(e).ignoreCase)throw Error("Use of case-insensitive backref to case-sensitive group requires target ES2025 or non-strict accuracy");return"\\"+e},CapturingGroup(e,t,r){let{body:n,name:i,number:a}=e,o={ignoreCase:t.currentFlags.ignoreCase},s=t.originMap.get(e);return s&&(o.hidden=!0,a>s.number&&(o.transferTo=s.number)),t.captureMap.set(a,o),`(${i?`?<${i}>`:""}${n.map(r).join("|")})`},Character({value:e},t){let r=c5(e),n=dL(e,{escDigit:"Backreference"===t.lastNode.type,inCharClass:t.inCharClass,useFlagV:t.useFlagV});if(n!==r)return n;if(t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase&&dM(r)){let e=dn(r);return t.inCharClass?e.join(""):e.length>1?`[${e.join("")}]`:e[0]}return r},CharacterClass(e,t,r){let{kind:n,negate:i,parent:a}=e,{body:o}=e;if("intersection"===n&&!t.useFlagV)throw Error("Use of character class intersection requires min target ES2024");c4.bugFlagVLiteralHyphenIsRange&&t.useFlagV&&o.some(dD)&&(o=[cw(45),...o.filter(e=>!dD(e))]);let s=()=>`[${i?"^":""}${o.map(r).join("intersection"===n?"&&":"")}]`;if(!t.inCharClass){if((!t.useFlagV||c4.bugNestedClassIgnoresNegation)&&!i){let t=o.filter(e=>"CharacterClass"===e.type&&"union"===e.kind&&e.negate);if(t.length){let n=ck(),i=n.body[0];return n.parent=a,i.parent=n,e.body=o=o.filter(e=>!t.includes(e)),o.length?(e.parent=i,i.body.push(e)):n.body.pop(),t.forEach(e=>{let t=cy({body:[e]});e.parent=t,t.parent=n,n.body.push(t)}),r(n)}}t.inCharClass=!0;let n=s();return t.inCharClass=!1,n}let l=o[0];if("union"===n&&!i&&l&&((!t.useFlagV||!t.verbose)&&"union"===a.kind&&!(c4.bugFlagVLiteralHyphenIsRange&&t.useFlagV)||!t.verbose&&"intersection"===a.kind&&1===o.length&&"CharacterClassRange"!==l.type))return o.map(r).join("");if(!t.useFlagV&&"CharacterClass"===a.type)throw Error("Uses nested character class in a way that requires min target ES2024");return s()},CharacterClassRange(e,t){let r=e.min.value,n=e.max.value,i={escDigit:!1,inCharClass:!0,useFlagV:t.useFlagV},a=dL(r,i),o=dL(n,i),s=new Set;return t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase&&(function(e){let t=e.map(e=>e.codePointAt(0)).sort((e,t)=>e-t),r=[],n=null;for(let e=0;e<t.length;e++)t[e+1]===t[e]+1?n??=t[e]:null===n?r.push(t[e]):(r.push([n,t[e]]),n=null);return r})(dj(e)).forEach(e=>{s.add(Array.isArray(e)?`${dL(e[0],i)}-${dL(e[1],i)}`:dL(e,i))}),`${a}-${o}${[...s].join("")}`},CharacterSet({kind:e,negate:t,value:r,key:n},i){if("dot"===e)return i.currentFlags.dotAll?i.appliedGlobalFlags.dotAll||i.useFlagMods?".":"[^]":c3`[^\n]`;if("digit"===e)return t?c3`\D`:c3`\d`;if("property"===e){if(i.useAppliedIgnoreCase&&i.currentFlags.ignoreCase&&dp.has(r))throw Error(`Unicode property "${r}" can't be case-insensitive when other chars have specific case`);return`${t?c3`\P`:c3`\p`}{${n?`${n}=`:""}${r}}`}if("word"===e)return t?c3`\W`:c3`\w`;throw Error(`Unexpected character set kind "${e}"`)},Flags:(e,t)=>(t.appliedGlobalFlags.ignoreCase?"i":"")+(e.dotAll?"s":"")+(e.sticky?"y":""),Group({atomic:e,body:t,flags:r,parent:n},i,a){let o=i.currentFlags;r&&(i.currentFlags=c6(o,r));let s=t.map(a).join("|"),l=i.verbose||1!==t.length||"Quantifier"===n.type||e||i.useFlagMods&&r?`(?${function(e,t,r){if(e)return">";let n="";if(t&&r){let{enable:e,disable:r}=t;n=(e?.ignoreCase?"i":"")+(e?.dotAll?"s":"")+(r?"-":"")+(r?.ignoreCase?"i":"")+(r?.dotAll?"s":"")}return`${n}:`}(e,r,i.useFlagMods)}${s})`:s;return i.currentFlags=o,l},LookaroundAssertion({body:e,kind:t,negate:r},n,i){let a=`${"lookahead"===t?"":"<"}${r?"!":"="}`;return`(?${a}${e.map(i).join("|")})`},Quantifier:(e,t,r)=>r(e.body)+function({kind:e,max:t,min:r}){return(r||1!==t?r||t!==1/0?1===r&&t===1/0?"+":r===t?`{${r}}`:`{${r},${t===1/0?"":t}}`:"*":"?")+({greedy:"",lazy:"?",possessive:"+"})[e]}(e),Subroutine({isRecursive:e,ref:t},r){if(!e)throw Error("Unexpected non-recursive subroutine in transformed AST");let n=r.recursionLimit;return 0===t?`(?R=${n})`:c3`\g<${t}&R=${n}>`}},dN=new Set(["$","(",")","*","+",".","?","[","\\","]","^","{","|","}"]),dI=new Set(["-","\\","]","^","["]),dT=new Set(["(",")","-","/","[","\\","]","^","{","|","}","!","#","$","%","&","*","+",",",".",":",";","<","=",">","?","@","`","~"]),dR=new Map([[9,c3`\t`],[10,c3`\n`],[11,c3`\v`],[12,c3`\f`],[13,c3`\r`],[8232,c3`\u2028`],[8233,c3`\u2029`],[65279,c3`\uFEFF`]]),dP=/^\p{Cased}$/u;function dM(e){return dP.test(e)}function dj(e,t){let r=!!t?.firstOnly,n=e.min.value,i=e.max.value,a=[];if(n<65&&(65535===i||i>=131071)||65536===n&&i>=131071)return a;for(let e=n;e<=i;e++){let t=c5(e);if(!dM(t))continue;let o=dn(t).filter(e=>{let t=e.codePointAt(0);return t<n||t>i});if(o.length&&(a.push(...o),r))break}return a}function dL(e,{escDigit:t,inCharClass:r,useFlagV:n}){var i;if(dR.has(e))return dR.get(e);if(e<32||e>126&&e<160||e>262143||t&&(i=e)>47&&i<58)return e>255?`\\u{${e.toString(16).toUpperCase()}}`:`\\x${e.toString(16).toUpperCase().padStart(2,"0")}`;let a=c5(e);return((r?n?dT:dI:dN).has(a)?"\\":"")+a}function dO({type:e}){return"CapturingGroup"===e||"Group"===e||"LookaroundAssertion"===e}function dD({type:e,value:t}){return"Character"===e&&45===t}var d$=class e extends RegExp{#I=new Map;#T=null;#R;#P=null;#M=null;rawOptions={};get source(){return this.#R||"(?:)"}constructor(t,r,n){const i=!!n?.lazyCompile;if(t instanceof RegExp){if(n)throw Error("Cannot provide options when copying a regexp");super(t,r),this.#R=t.source,t instanceof e&&(this.#I=t.#I,this.#P=t.#P,this.#M=t.#M,this.rawOptions=t.rawOptions)}else{const e={hiddenCaptures:[],strategy:null,transfers:[],...n};super(i?"":t,r),this.#R=t,this.#I=function(e,t){let r=new Map;for(let t of e)r.set(t,{hidden:!0});for(let[e,n]of t)for(let t of n)c8(r,t,{}).transferTo=e;return r}(e.hiddenCaptures,e.transfers),this.#M=e.strategy,this.rawOptions=n??{}}i||(this.#T=this)}exec(t){if(!this.#T){let{lazyCompile:t,...r}=this.rawOptions;this.#T=new e(this.#R,this.flags,r)}let r=this.global||this.sticky,n=this.lastIndex;if("clip_search"===this.#M&&r&&n){this.lastIndex=0;let e=this.#j(t.slice(n));return e&&(function(e,t,r,n){if(e.index+=t,e.input=r,n){let r=e.indices;for(let e=0;e<r.length;e++){let n=r[e];n&&(r[e]=[n[0]+t,n[1]+t])}let n=r.groups;n&&Object.keys(n).forEach(e=>{let r=n[e];r&&(n[e]=[r[0]+t,r[1]+t])})}}(e,n,t,this.hasIndices),this.lastIndex+=n),e}return this.#j(t)}#j(e){let t;this.#T.lastIndex=this.lastIndex;let r=super.exec.call(this.#T,e);if(this.lastIndex=this.#T.lastIndex,!r||!this.#I.size)return r;let n=[...r];r.length=1,this.hasIndices&&(t=[...r.indices],r.indices.length=1);let i=[0];for(let e=1;e<n.length;e++){let{hidden:a,transferTo:o}=this.#I.get(e)??{};if(a?i.push(null):(i.push(r.length),r.push(n[e]),this.hasIndices&&r.indices.push(t[e])),o&&void 0!==n[e]){let a=i[o];if(!a)throw Error(`Invalid capture transfer to "${a}"`);if(r[a]=n[e],this.hasIndices&&(r.indices[a]=t[e]),r.groups){this.#P||(this.#P=function(e){let t,r=/(?<capture>\((?:\?<(?![=!])(?<name>[^>]+)>|(?!\?)))|\\?./gsu,n=new Map,i=0,a=0;for(;t=r.exec(e);){let{0:e,groups:{capture:r,name:o}}=t;"["===e?i++:i?"]"===e&&i--:r&&(a++,o&&n.set(a,o))}return n}(this.source));let i=this.#P.get(o);i&&(r.groups[i]=n[e],this.hasIndices&&(r.indices.groups[i]=t[e]))}}}return r}};class dz{constructor(e,t={}){this.patterns=e,this.options=t;const{forgiving:r=!1,cache:n,regexConstructor:i}=t;if(!i)throw Error("Option `regexConstructor` is not provided");this.regexps=e.map(e=>{if("string"!=typeof e)return e;let t=n?.get(e);if(t){if(t instanceof RegExp)return t;if(r)return null;throw t}try{let t=i(e);return n?.set(e,t),t}catch(t){if(n?.set(e,t),r)return null;throw t}})}regexps;findNextMatchSync(e,t,r){let n="string"==typeof e?e:e.content,i=[];function a(e,t,r=0){return{index:e,captureIndices:t.indices.map(e=>null==e?{start:0xffffffff,end:0xffffffff,length:0}:{start:e[0]+r,end:e[1]+r,length:e[1]-e[0]})}}for(let e=0;e<this.regexps.length;e++){let r=this.regexps[e];if(r)try{r.lastIndex=t;let o=r.exec(n);if(!o)continue;if(o.index===t)return a(e,o,0);i.push([e,o,0])}catch(e){if(this.options.forgiving)continue;throw e}}if(i.length){let e=Math.min(...i.map(e=>e[1].index));for(let[t,r,n]of i)if(r.index===e)return a(t,r,n)}return null}}var dB=function(e={}){let t=Object.assign({target:"auto",cache:new Map},e);return t.regexConstructor||=e=>{let r;return(r=function(e,t){var r;let n,i,a,o,s=de(t),l=(r=cg(e,{flags:s.flags,normalizeUnknownPropertyNames:!0,rules:{captureGroup:s.rules.captureGroup,singleline:s.rules.singleline},skipBackrefValidation:s.rules.allowOrphanBackrefs,unicodePropertyMap:di}),n={accuracy:"default",asciiWordBoundaries:!1,avoidSubclass:!1,bestEffortTarget:"ES2025",...{accuracy:s.accuracy,asciiWordBoundaries:s.rules.asciiWordBoundaries,avoidSubclass:s.avoidSubclass,bestEffortTarget:s.target}},dg(r),i={accuracy:n.accuracy,asciiWordBoundaries:n.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,flagDirectivesByAlt:new Map,jsGroupNameMap:new Map,minTargetEs2024:c7[n.bestEffortTarget]>=c7.ES2024,passedLookbehind:!1,strategy:null,subroutineRefMap:new Map,supportedGNodes:new Set,digitIsAscii:r.flags.digitIsAscii,spaceIsAscii:r.flags.spaceIsAscii,wordIsAscii:r.flags.wordIsAscii},cO(r,df,i),o={currentFlags:a={dotAll:r.flags.dotAll,ignoreCase:r.flags.ignoreCase},prevFlags:null,globalFlags:a,groupOriginByCopy:new Map,groupsByName:new Map,multiplexCapturesToLeftByRef:new Map,openRefs:new Map,reffedNodesByReferencer:new Map,subroutineRefMap:i.subroutineRefMap},cO(r,dh,o),cO(r,dm,{groupsByName:o.groupsByName,highestOrphanBackref:0,numCapturesToLeft:0,reffedNodesByReferencer:o.reffedNodesByReferencer}),r._originMap=o.groupOriginByCopy,r._strategy=i.strategy,r),u=function(e,t){let r=de(t),n=c7[r.target]>=c7.ES2024,i=c7[r.target]>=c7.ES2025,a=r.rules.recursionLimit;if(!Number.isInteger(a)||a<2||a>20)throw Error("Invalid recursionLimit; use 2-20");let o=null,s=null;if(!i){let t=[e.flags.ignoreCase];cO(e,dA,{getCurrentModI:()=>t.at(-1),popModI(){t.pop()},pushModI(e){t.push(e)},setHasCasedChar(){t.at(-1)?o=!0:s=!0}})}let l={dotAll:e.flags.dotAll,ignoreCase:!!((e.flags.ignoreCase||o)&&!s)},u=e,c={accuracy:r.accuracy,appliedGlobalFlags:l,captureMap:new Map,currentFlags:{dotAll:e.flags.dotAll,ignoreCase:e.flags.ignoreCase},inCharClass:!1,lastNode:u,originMap:e._originMap,recursionLimit:a,useAppliedIgnoreCase:!!(!i&&o&&s),useFlagMods:i,useFlagV:n,verbose:r.verbose};function d(e){return c.lastNode=u,u=e,(function(e,t){if(null==e)throw Error(t??"Value expected");return e})(dE[e.type],`Unexpected node type "${e.type}"`)(e,c,d)}let p={pattern:e.body.map(d).join("|"),flags:d(e.flags),options:{...e.options}};return n||(delete p.options.force.v,p.options.disable.v=!0,p.options.unicodeSetsPlugin=null),p._captureTransfers=new Map,p._hiddenCaptures=[],c.captureMap.forEach((e,t)=>{e.hidden&&p._hiddenCaptures.push(t),e.transferTo&&c8(p._captureTransfers,e.transferTo,[]).push(t)}),p}(l,s),c=function(e,t){let r,{hiddenCaptures:n,mode:i}={hiddenCaptures:[],mode:"plugin",...t},a=t?.captureTransfers??new Map;if(!RegExp(cQ,"su").test(e))return{pattern:e,captureTransfers:a,hiddenCaptures:n};if("plugin"===i&&cG(e,cq`\(\?\(DEFINE\)`,cB.DEFAULT))throw Error("DEFINE groups cannot be used with recursion");let o=[],s=cG(e,cq`\\[1-9]`,cB.DEFAULT),l=new Map,u=[],c=!1,d=0,p=0;for(cJ.lastIndex=0;r=cJ.exec(e);){let{0:t,groups:{captureName:f,rDepth:h,gRNameOrNum:m,gRDepth:g}}=r;if("["===t)d++;else if(d)"]"===t&&d--;else if(h){if(cZ(h),c)throw Error(cY);if(s)throw Error(`${"external"===i?"Backrefs":"Numbered backrefs"} cannot be used with global recursion`);let t=e.slice(0,r.index),l=e.slice(cJ.lastIndex);if(cG(l,cQ,cB.DEFAULT))throw Error(cY);let u=h-1;e=c0(t,l,u,!1,n,o,p),a=c2(a,t,u,o.length,0,p);break}else if(m){cZ(g);let d=!1;for(let e of u)if(e.name===m||e.num===+m){if(d=!0,e.hasRecursedWithin)throw Error(cY);break}if(!d)throw Error(cq`Recursive \g cannot be used outside the referenced group "${"external"===i?m:cq`\g<${m}&R=${g}>`}"`);let f=l.get(m),h=function(e,t){let r,n=/\\?./gsu;n.lastIndex=t;let i=e.length,a=0,o=1;for(;r=n.exec(e);){let[e]=r;if("["===e)a++;else if(a)"]"===e&&a--;else if("("===e)o++;else if(")"===e&&!--o){i=r.index;break}}return e.slice(t,i)}(e,f);if(s&&cG(h,cq`${cK}|\((?!\?)`,cB.DEFAULT))throw Error(`${"external"===i?"Backrefs":"Numbered backrefs"} cannot be used with recursion of capturing groups`);let y=e.slice(f,r.index),v=h.slice(y.length+t.length),b=o.length,x=g-1,w=c0(y,v,x,!0,n,o,p);a=c2(a,y,x,o.length-b,b,p);let S=e.slice(0,f),C=e.slice(f+h.length);e=`${S}${w}${C}`,cJ.lastIndex+=w.length-t.length-y.length-v.length,u.forEach(e=>e.hasRecursedWithin=!0),c=!0}else if(f)p++,l.set(String(p),cJ.lastIndex),l.set(f,cJ.lastIndex),u.push({num:p,name:f});else if("("===t[0]){let e="("===t;e&&(p++,l.set(String(p),cJ.lastIndex)),u.push(e?{num:p}:{})}else")"===t&&u.pop()}return n.push(...o),{pattern:e,captureTransfers:a,hiddenCaptures:n}}(u.pattern,{captureTransfers:u._captureTransfers,hiddenCaptures:u._hiddenCaptures,mode:"external"}),d=function(e,t){let r,n=t?.hiddenCaptures??[],i=t?.captureTransfers??new Map;if(!/\(\?>/.test(e))return{pattern:e,captureTransfers:i,hiddenCaptures:n};let a="(?:(?=(",o=[0],s=[],l=0,u=0,c=NaN;do{let t;r=!1;let d=0,p=0,f=!1;for(cU.lastIndex=Number.isNaN(c)?0:c+a.length;t=cU.exec(e);){let{0:h,index:m,groups:{capturingStart:g,noncapturingStart:y}}=t;if("["===h)d++;else if(d)"]"===h&&d--;else if("(?>"!==h||f){if(f&&y)p++;else if(g)f?p++:(l++,o.push(l+u));else if(")"===h&&f){if(!p){let t=l+ ++u;e=`${e.slice(0,c)}${a}${e.slice(c+3,m)}))<$$${t}>)${e.slice(m+1)}`,r=!0,s.push(t);for(let e=0;e<n.length;e++)n[e]>=t&&n[e]++;if(i.size){let e=new Map;i.forEach((r,n)=>{e.set(n>=t?n+1:n,r.map(e=>e>=t?e+1:e))}),i=e}break}p--}}else c=m,f=!0}}while(r)return n.push(...s),{pattern:e=cF(e,String.raw`\\(?<backrefNum>[1-9]\d*)|<\$\$(?<wrappedBackrefNum>\d+)>`,({0:e,groups:{backrefNum:t,wrappedBackrefNum:r}})=>{if(t){let r=+t;if(r>o.length-1)throw Error(`Backref "${e}" greater than number of captures`);return`\\${o[r]}`}return`\\${r}`},cB.DEFAULT),captureTransfers:i,hiddenCaptures:n}}(function(e){let t;if(!RegExp(`${cW}\\+`).test(e))return{pattern:e};let r=[],n=null,i=null,a="",o=0;for(cH.lastIndex=0;t=cH.exec(e);){let{0:u,index:c,groups:{qBase:d,qMod:p,invalidQ:f}}=t;if("["===u)o||(i=c),o++;else if("]"===u)o?o--:i=null;else if(!o)if("+"===p&&a&&!a.startsWith("(")){if(f)throw Error(`Invalid quantifier "${u}"`);let t=-1;if(/^\{\d+\}$/.test(d)){var s,l;s=e,l=c+d.length,e=s.slice(0,l)+""+s.slice(l+p.length)}else{if(")"===a||"]"===a){let t=")"===a?n:i;if(null===t)throw Error(`Invalid unmatched "${a}"`);e=`${e.slice(0,t)}(?>${e.slice(t,c)}${d})${e.slice(c+u.length)}`}else e=`${e.slice(0,c-a.length)}(?>${a}${d})${e.slice(c+u.length)}`;t+=4}cH.lastIndex+=t}else"("===u[0]?r.push(c):")"===u&&(n=r.length?r.pop():null);a=u}return{pattern:e}}(c.pattern).pattern,{captureTransfers:c.captureTransfers,hiddenCaptures:c.hiddenCaptures}),p={pattern:d.pattern,flags:`${s.hasIndices?"d":""}${s.global?"g":""}${u.flags}${u.options.disable.v?"u":"v"}`};if(s.avoidSubclass){if(s.lazyCompileLength!==1/0)throw Error("Lazy compilation requires subclass")}else{let e=d.hiddenCaptures.sort((e,t)=>e-t),t=Array.from(d.captureTransfers),r=l._strategy,n=p.pattern.length>=s.lazyCompileLength;(e.length||t.length||r||n)&&(p.options={...e.length&&{hiddenCaptures:e},...t.length&&{transfers:t},...r&&{strategy:r},...n&&{lazyCompile:n}})}return p}(e,{global:!0,hasIndices:!0,lazyCompileLength:3e3,rules:{allowOrphanBackrefs:!0,asciiWordBoundaries:!0,captureGroup:!0,recursionLimit:5,singleline:!0},...{target:t.target}})).options?new d$(r.pattern,r.flags,r.options):new RegExp(r.pattern,r.flags)},{createScanner:e=>new dz(e,t),createString:e=>({content:e})}}({forgiving:!0}),dF=Object.fromEntries(sp.flatMap(e=>{var t;return(null!=(t=e.aliases)?t:[]).map(t=>[t,e.id])})),dG=new Set(Object.keys(sm)),dU=e=>{let t=e.trim().toLowerCase();return dF[t]||(dG.has(t),t)},dW=new Map,dH=new Map,dq=new Map,dV=function(e={}){var t;let r=null!=(t=e.themes)?t:["github-light","github-dark"];return{name:"shiki",type:"code-highlighter",supportsLanguage(e){let t=dU(e);return dG.has(t)},getSupportedLanguages:()=>Array.from(dG),getThemes:()=>r,highlight({code:e,language:t,themes:r},n){let i,a,o=dU(t),s=(i=e.slice(0,100),a=e.length>100?e.slice(-100):"",`${o}:${r[0]}:${r[1]}:${e.length}:${i}:${a}`);return dH.has(s)?dH.get(s):(n&&(dq.has(s)||dq.set(s,new Set),dq.get(s).add(n)),((e,t)=>{let r=`${e}-${t[0]}-${t[1]}`;if(dW.has(r))return dW.get(r);let n=u2({themes:t,langs:[e],engine:dB});return dW.set(r,n),n})(o,r).then(t=>{let n=t.getLoadedLanguages().includes(o)?o:"text",i=t.codeToTokens(e,{lang:n,themes:{light:r[0],dark:r[1]}});dH.set(s,i);let a=dq.get(s);if(a){for(let e of a)e(i);dq.delete(s)}}).catch(e=>{console.error("[Streamdown Code] Failed to highlight code:",e),dq.delete(s)}),null)}}}();let dQ=af("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"}]]);function dK(e){let t,r,n,i,a,o=(0,C.c)(10),{code:s}=e,[l,u]=(0,k.useState)(!1),c=(0,k.useRef)(0);o[0]===Symbol.for("react.memo_cache_sentinel")?(t=()=>()=>{window.clearTimeout(c.current)},r=[],o[0]=t,o[1]=r):(t=o[0],r=o[1]),(0,k.useEffect)(t,r),o[2]!==s||o[3]!==l?(n=async()=>{if(!l)try{await navigator.clipboard.writeText(s),u(!0),c.current=window.setTimeout(()=>u(!1),2e3)}catch{}},o[2]=s,o[3]=l,o[4]=n):n=o[4];let d=n;return o[5]!==l?(i=l?(0,S.jsx)(oZ,{size:14}):(0,S.jsx)(dQ,{size:14}),o[5]=l,o[6]=i):i=o[6],o[7]!==d||o[8]!==i?(a=(0,S.jsx)("button",{className:"cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground",onClick:d,title:"Copy code",type:"button",children:i}),o[7]=d,o[8]=i,o[9]=a):a=o[9],a}function dX(e){let t,r,n,i,a,o,s,l,u,c,d,p,f,h=(0,C.c)(33),{code:m,language:g,plugin:y,themes:v}=e;h[0]!==m?(t={tokens:(r=m.replace(/\n+$/,"")).split("\n").map(e=>[{content:e,color:"inherit",bgColor:"transparent",htmlStyle:{},offset:0}]),bg:"transparent",fg:"inherit"},h[0]=m,h[1]=t,h[2]=r):(t=h[1],r=h[2]);let b=t,[x,w]=(0,k.useState)(b);if(h[3]!==g||h[4]!==y||h[5]!==v||h[6]!==r?(n=()=>{let e=e=>w(e),t=y.highlight({code:r,language:g,themes:v},e);t&&e(t)},i=[r,g,y,v],h[3]=g,h[4]=y,h[5]=v,h[6]=r,h[7]=n,h[8]=i):(n=h[7],i=h[8]),(0,k.useEffect)(n,i),h[9]!==x.bg||h[10]!==x.fg||h[11]!==x.rootStyle){if(a={},x.bg&&(a["--sdm-bg"]=x.bg),x.fg&&(a["--sdm-fg"]=x.fg),x.rootStyle)for(let e of x.rootStyle.split(";")){let t=e.indexOf(":");if(t>0){let r=e.slice(0,t).trim(),n=e.slice(t+1).trim();r&&n&&(a[r]=n)}}h[9]=x.bg,h[10]=x.fg,h[11]=x.rootStyle,h[12]=a}else a=h[12];return h[13]===Symbol.for("react.memo_cache_sentinel")?(o={contentVisibility:"auto",containIntrinsicSize:"auto 200px"},h[13]=o):o=h[13],h[14]!==g?(s=(0,S.jsx)("span",{className:"ml-1 font-mono lowercase",children:g}),h[14]=g,h[15]=s):s=h[15],h[16]!==m?(l=(0,S.jsx)("div",{className:"flex items-center gap-2",children:(0,S.jsx)(dK,{code:m})}),h[16]=m,h[17]=l):l=h[17],h[18]!==s||h[19]!==l?(u=(0,S.jsxs)("div",{className:"flex items-center justify-between bg-muted/80 p-3 text-muted-foreground text-xs","data-streamdown":"code-block-header",children:[s,l]}),h[18]=s,h[19]=l,h[20]=u):u=h[20],h[21]!==x.tokens?(c=x.tokens.map(dJ),h[21]=x.tokens,h[22]=c):c=h[22],h[23]!==c?(d=(0,S.jsx)("code",{className:"[counter-increment:line_0] [counter-reset:line]",children:c}),h[23]=c,h[24]=d):d=h[24],h[25]!==g||h[26]!==a||h[27]!==d?(p=(0,S.jsx)("pre",{className:"p-4 text-sm overflow-x-auto border-border border-t bg-[var(--sdm-bg,transparent)] dark:bg-[var(--shiki-dark-bg,var(--sdm-bg,transparent))]","data-language":g,"data-streamdown":"code-block-body",style:a,children:d}),h[25]=g,h[26]=a,h[27]=d,h[28]=p):p=h[28],h[29]!==g||h[30]!==p||h[31]!==u?(f=(0,S.jsxs)("div",{className:"my-4 w-full overflow-hidden rounded-xl border border-border","data-language":g,"data-streamdown":"code-block",style:o,children:[u,p]}),h[29]=g,h[30]=p,h[31]=u,h[32]=f):f=h[32],f}function dJ(e,t){return(0,S.jsx)("span",{className:"block before:content-[counter(line)] before:inline-block before:[counter-increment:line] before:w-6 before:mr-4 before:text-[13px] before:text-right before:text-muted-foreground/50 before:font-mono before:select-none",children:e.map((e,r)=>(0,S.jsx)("span",{className:["text-[var(--sdm-c,inherit)]","dark:text-[var(--shiki-dark,var(--sdm-c,inherit))]",e.bgColor?"bg-[var(--sdm-tbg)]":"",e.bgColor?"dark:bg-[var(--shiki-dark-bg,var(--sdm-tbg))]":""].filter(Boolean).join(" "),style:{...e.color?{"--sdm-c":e.color}:{},...e.bgColor?{"--sdm-tbg":e.bgColor}:{},...e.htmlStyle},...e.htmlAttrs,children:e.content},`${t}-${r}`))},`L${t}`)}let dY={code:dV},dZ={code:(u=dV.getThemes(),function({className:e,children:t,...r}){if(!("data-block"in r))return(0,S.jsx)("code",{className:"rounded bg-muted px-1.5 py-0.5 font-mono text-sm",...r,children:t});let n=e?.match(/language-([\S]+)/),i=n?.[1]??"",a="";return(0,k.isValidElement)(t)&&"string"==typeof t.props?.children?a=t.props.children:"string"==typeof t&&(a=t),(0,S.jsx)(dX,{code:a,language:i,plugin:dV,themes:u})})};function d0(e){return null==e?"":"string"==typeof e?e:JSON.stringify(e,null,2)}function d1(e){let t,r,n,i,a=(0,C.c)(7),{rawInput:o}=e;if(a[0]!==o){n=Symbol.for("react.early_return_sentinel");e:{let e=sr(o);if(!e){n=null;break e}t="space-y-2",r=e.map((t,r)=>{var n,i;let a=t.oldContent?(n=t.oldContent,(i=t.content,o6.diff(n,i,void 0)).flatMap(e=>e.value.replace(/\n$/,"").split("\n").map(t=>({type:e.added?"add":e.removed?"remove":"same",content:t})))):t.content.split("\n").map(d5);return(0,S.jsxs)("div",{children:[e.length>1&&(0,S.jsx)("div",{className:"text-[10px] text-[var(--t-dim)] mb-1 truncate",children:t.path}),(0,S.jsx)("div",{className:"text-xs font-mono leading-[1.6] overflow-x-auto max-h-60 overflow-y-auto",children:a.map(d2)})]},r)})}a[0]=o,a[1]=t,a[2]=r,a[3]=n}else t=a[1],r=a[2],n=a[3];return n!==Symbol.for("react.early_return_sentinel")?n:(a[4]!==t||a[5]!==r?(i=(0,S.jsx)("div",{className:t,children:r}),a[4]=t,a[5]=r,a[6]=i):i=a[6],i)}function d2(e,t){return(0,S.jsxs)("div",{className:"add"===e.type?"bg-[var(--t-green)]/10 text-[var(--t-green)]":"remove"===e.type?"bg-[var(--t-red)]/10 text-[var(--t-red)]":"text-[var(--t-dim)]",children:[(0,S.jsx)("span",{className:"select-none inline-block w-4 text-center opacity-60",children:"add"===e.type?"+":"remove"===e.type?"−":" "}),e.content||" "]},t)}function d5(e){return{type:"add",content:e}}function d3(e){let t,r=(0,C.c)(2),{content:n}=e;return r[0]!==n?(t=(0,S.jsx)("div",{className:"text-sm leading-[1.7] text-[var(--t-text)] max-h-96 overflow-y-auto",children:(0,S.jsx)(oY.m,{plugins:dY,components:dZ,mode:"static",children:n})}),r[0]=n,r[1]=t):t=r[1],t}function d4(e){let t,r,n,i=(0,C.c)(10),{sessionId:a,requestId:o,options:s}=e,[l,u]=(0,k.useState)(!1);i[0]!==o||i[1]!==a?(t=e=>{u(!0),L(a,o,e).catch(()=>{u(!1)})},i[0]=o,i[1]=a,i[2]=t):t=i[2];let c=t;if(l)return null;if(i[3]!==c||i[4]!==s){let e;i[6]!==c?(e=e=>{let t=e.kind.startsWith("reject");return(0,S.jsx)("button",{onClick:()=>c(e.optionId),className:`px-2.5 py-1 text-xs font-medium rounded border transition-colors ${t?"border-[var(--t-red)]/40 text-[var(--t-red)] hover:bg-[var(--t-red)]/10":"border-[var(--t-green)]/40 text-[var(--t-green)] hover:bg-[var(--t-green)]/10"}`,children:e.name},e.optionId)},i[6]=c,i[7]=e):e=i[7],r=s.map(e),i[3]=c,i[4]=s,i[5]=r}else r=i[5];return i[8]!==r?(n=(0,S.jsx)("div",{className:"flex items-center gap-2 pt-1",children:r}),i[8]=r,i[9]=n):n=i[9],n}function d6(e){let t,r,n,i=(0,C.c)(7),{command:a,outputText:o}=e;return i[0]!==a?(t=a&&(0,S.jsxs)("div",{className:"text-xs font-mono text-[var(--t-accent)]",children:[(0,S.jsx)("span",{className:"text-[var(--t-dim)] select-none",children:"$ "}),a]}),i[0]=a,i[1]=t):t=i[1],i[2]!==o?(r=o&&(0,S.jsx)("pre",{className:"text-xs leading-relaxed font-mono whitespace-pre overflow-x-auto text-[var(--t-muted)] max-h-60 overflow-y-auto",children:o}),i[2]=o,i[3]=r):r=i[3],i[4]!==t||i[5]!==r?(n=(0,S.jsxs)("div",{className:"space-y-1.5",children:[t,r]}),i[4]=t,i[5]=r,i[6]=n):n=i[6],n}function d8(e){let t,r,n,i,a=(0,C.c)(11),{rawInput:o,outputText:s,rawOutput:l}=e,u=o&&"{}"!==o,c=s||l;a[0]!==c?(t=!!c&&c.length>200&&/^#{1,3}\s/m.test(c),a[0]=c,a[1]=t):t=a[1];let d=t;return a[2]!==o||a[3]!==u?(r=u&&(0,S.jsx)("pre",{className:"text-xs leading-relaxed font-mono overflow-x-auto whitespace-pre-wrap text-[var(--t-muted)] max-h-40 overflow-y-auto",children:o}),a[2]=o,a[3]=u,a[4]=r):r=a[4],a[5]!==c||a[6]!==d?(n=d?(0,S.jsx)(d3,{content:c}):c?(0,S.jsx)("pre",{className:"text-xs leading-relaxed font-mono overflow-x-auto whitespace-pre-wrap text-[var(--t-text)] max-h-60 overflow-y-auto",children:c}):null,a[5]=c,a[6]=d,a[7]=n):n=a[7],a[8]!==r||a[9]!==n?(i=(0,S.jsxs)(S.Fragment,{children:[r,n]}),a[8]=r,a[9]=n,a[10]=i):i=a[10],i}function d7(e){var t,r,n;let i,a,o,s,l,u,c,d,p,f,h,m,g,y,v,b,x=(0,C.c)(54),{state:w,sessionId:_}=e;x[0]!==w.kind||x[1]!==w.rawInput?(i="edit"===w.kind&&!!sr(w.rawInput),x[0]=w.kind,x[1]=w.rawInput,x[2]=i):i=x[2];let A=i;if(x[3]!==w.rawInput){let e;a=(e=st(w.rawInput))&&"string"==typeof e.plan&&Array.isArray(e.allowedPrompts)?e.plan:null,x[3]=w.rawInput,x[4]=a}else a=x[4];let E=a,N=!!w.permissionRequest,[I,T]=(0,k.useState)(A||!!E||N),[R,P]=(0,k.useState)(N);if(N&&!R?(P(N),T(!0)):R!==N&&P(N),t=w.rawInput,st(t)?.subagent_type==="Plan")return null;x[5]!==w.rawOutput?(o=function(e){if(Array.isArray(e)){let t=e.filter(e=>e&&"object"==typeof e&&"text"===e.type&&"string"==typeof e.text).map(e=>e.text);if(t.length>0)return t.join("\n")}if(e&&"object"==typeof e&&!Array.isArray(e)){let t=[];if("string"==typeof e.stdout&&e.stdout&&t.push(e.stdout),"string"==typeof e.stderr&&e.stderr&&t.push(e.stderr),t.length>0)return t.join("\n")}return null}(w.rawOutput),x[5]=w.rawOutput,x[6]=o):o=x[6];let M=o;x[7]!==w.rawInput?(s=function(e){if(!e||"object"!=typeof e)return null;if("string"==typeof e.command)return e.command;if(Array.isArray(e.command)){let t=e.command,r=t.findIndex(e=>"-c"===e||"-lc"===e);return r>=0&&t[r+1]?t[r+1]:t[t.length-1]??null}return null}(w.rawInput),x[7]=w.rawInput,x[8]=s):s=x[8];let j=s,L=!A&&("execute"===w.kind||!!j);x[9]!==w.rawOutput?(l=d0(w.rawOutput),x[9]=w.rawOutput,x[10]=l):l=x[10];let O=l;x[11]!==w.rawInput?(u=d0(w.rawInput),x[11]=w.rawInput,x[12]=u):u=x[12];let D=u,$=A||!!E||L||!!M||!!D&&"{}"!==D||!!O&&"{}"!==O&&"null"!==O&&""!==O;x[13]!==I||x[14]!==$?(c=()=>$&&T(!I),x[13]=I,x[14]=$,x[15]=c):c=x[15];let z=`flex w-full items-center gap-2 px-3 py-1.5 text-xs font-mono transition-colors ${$?"cursor-pointer hover:bg-[var(--t-elevated)]":"cursor-default"}`;if(x[16]===Symbol.for("react.memo_cache_sentinel")?(d={color:"var(--t-text)"},x[16]=d):d=x[16],x[17]!==w.kind){let e;p=(e=(r=w.kind)?o9[r]:void 0)?(0,k.createElement)(e,{className:"size-3.5 shrink-0"}):(0,k.createElement)("span",{className:"text-xs shrink-0"},"♦"),x[17]=w.kind,x[18]=p}else p=x[18];if(x[19]!==p?(f=(0,S.jsx)("span",{className:"text-[var(--t-blue)]",children:p}),x[19]=p,x[20]=f):f=x[20],x[21]!==w.title?(h=(0,S.jsx)("span",{className:"flex-1 text-left truncate",children:w.title}),x[21]=w.title,x[22]=h):h=x[22],x[23]!==E||x[24]!==w.status){let e;m=E?(0,S.jsx)(oZ,{className:"size-3.5 shrink-0 text-[var(--t-green)]"}):(e=(n=w.status)?se[n]:void 0)?(0,k.createElement)(e[0],{className:e[1]}):null,x[23]=E,x[24]=w.status,x[25]=m}else m=x[25];return x[26]!==I||x[27]!==$?(g=$&&(0,S.jsx)("span",{className:"text-[var(--t-dim)] text-[10px]",children:I?"▾":"▸"}),x[26]=I,x[27]=$,x[28]=g):g=x[28],x[29]!==f||x[30]!==h||x[31]!==m||x[32]!==g||x[33]!==c||x[34]!==z?(y=(0,S.jsxs)("button",{onClick:c,className:z,style:d,children:[f,h,m,g]}),x[29]=f,x[30]=h,x[31]=m,x[32]=g,x[33]=c,x[34]=z,x[35]=y):y=x[35],x[36]!==j||x[37]!==I||x[38]!==$||x[39]!==N||x[40]!==A||x[41]!==L||x[42]!==M||x[43]!==E||x[44]!==D||x[45]!==O||x[46]!==_||x[47]!==w.kind||x[48]!==w.permissionRequest||x[49]!==w.rawInput?(v=I&&($||N)&&(0,S.jsxs)("div",{className:"border-t border-[var(--t-border)] px-3 py-2 space-y-2",children:[A?(0,S.jsx)(d1,{rawInput:w.rawInput}):E?(0,S.jsx)(d3,{content:E}):L?(0,S.jsx)(d6,{command:j,outputText:M}):"read"===w.kind?(0,S.jsx)("pre",{className:"text-xs leading-relaxed font-mono whitespace-pre overflow-x-auto text-[var(--t-text)] max-h-60 overflow-y-auto",children:M||O}):(0,S.jsx)(d8,{rawInput:D,outputText:M,rawOutput:O}),N&&_&&(0,S.jsx)(d4,{sessionId:_,requestId:w.permissionRequest.requestId,options:w.permissionRequest.options})]}),x[36]=j,x[37]=I,x[38]=$,x[39]=N,x[40]=A,x[41]=L,x[42]=M,x[43]=E,x[44]=D,x[45]=O,x[46]=_,x[47]=w.kind,x[48]=w.permissionRequest,x[49]=w.rawInput,x[50]=v):v=x[50],x[51]!==y||x[52]!==v?(b=(0,S.jsxs)("div",{className:"my-1.5 rounded-md bg-[var(--t-surface)] border border-[var(--t-border)]",children:[y,v]}),x[51]=y,x[52]=v,x[53]=b):b=x[53],b}function d9(e){let t,r,n,i=(0,C.c)(5),{entries:a}=e;return i[0]===Symbol.for("react.memo_cache_sentinel")?(t=(0,S.jsx)("div",{className:"text-[10px] font-mono uppercase tracking-wider text-[var(--t-dim)] mb-1.5",children:"Plan"}),i[0]=t):t=i[0],i[1]!==a?(r=a.map(pe),i[1]=a,i[2]=r):r=i[2],i[3]!==r?(n=(0,S.jsxs)("div",{className:"my-1.5 rounded-md bg-[var(--t-surface)] border border-[var(--t-border)] px-3 py-2",children:[t,(0,S.jsx)("div",{className:"space-y-0.5",children:r})]}),i[3]=r,i[4]=n):n=i[4],n}function pe(e,t){return(0,S.jsxs)("div",{className:"flex items-center gap-2 text-xs font-mono py-0.5",style:{opacity:"low"===e.priority?.55:"medium"===e.priority?.8:1},children:["completed"===e.status?(0,S.jsx)(oZ,{className:"size-3.5 shrink-0 text-[var(--t-green)]"}):"in_progress"===e.status?(0,S.jsx)(am,{className:"size-3.5 shrink-0 animate-spin text-[var(--t-amber)]"}):(0,S.jsx)("span",{className:"size-3.5 shrink-0 inline-flex items-center justify-center text-[var(--t-dim)]",children:"◦"}),(0,S.jsx)("span",{className:"completed"===e.status?"text-[var(--t-dim)]":"text-[var(--t-text)]",children:e.content})]},t)}function pt(e){let t,r,n,i,a=(0,C.c)(11),{block:o}=e;a[0]!==o?(t=function(e){let t=o7(e.content);if(!t)return null;let r="string"==typeof t.uri?t.uri:"",n="string"==typeof t.name?t.name:"";return r&&n&&sn.test(r)?{uri:r,name:n,description:"string"==typeof t.description?t.description:null,title:"string"==typeof t.title?t.title:null,mimeType:"string"==typeof t.mimeType?t.mimeType:null}:null}(o),a[0]=o,a[1]=t):t=a[1];let s=t;if(!s)return null;let l=s.description??s.uri;a[2]!==s.name?(r=(0,S.jsx)("div",{className:"text-xs text-[var(--t-accent)] truncate",children:s.name}),a[2]=s.name,a[3]=r):r=a[3];let u=s.title??s.uri;return a[4]!==u?(n=(0,S.jsx)("div",{className:"text-[11px] text-[var(--t-muted)] truncate",children:u}),a[4]=u,a[5]=n):n=a[5],a[6]!==s.uri||a[7]!==l||a[8]!==r||a[9]!==n?(i=(0,S.jsxs)("a",{href:s.uri,target:"_blank",rel:"noreferrer",className:"block rounded-md border border-[var(--t-border)] px-2.5 py-2 hover:border-[var(--t-accent)] transition-colors",title:l,children:[r,n]}),a[6]=s.uri,a[7]=l,a[8]=r,a[9]=n,a[10]=i):i=a[10],i}function pr(e){let t,r,n,i,a,o,s,l,u,c,d=(0,C.c)(21),{turn:p}=e;if(d[0]!==p.blocks){let{text:e,images:l,resourceLinks:u}=function(e){let t=[],r=[],n=[];for(let i of e)"text"===i.kind?t.push(i):"image"===i.kind?r.push(i):"resource_link"===i.kind&&n.push(i);return{text:t,images:r,resourceLinks:n}}(p.blocks),c=e.map(pa).join("\n");s="mt-5 mb-3 -mx-3 px-3 py-2.5 rounded-lg bg-[var(--t-elevated)]",a="flex items-start gap-2.5",d[8]===Symbol.for("react.memo_cache_sentinel")?(o=(0,S.jsx)("span",{className:"shrink-0 text-sm font-mono text-[var(--t-accent)] select-none leading-relaxed",children:"❯"}),d[8]=o):o=d[8],t="min-w-0 flex-1 space-y-2",r=c&&(0,S.jsx)("div",{className:"text-sm leading-relaxed whitespace-pre-wrap text-[var(--t-white)]",children:c}),n=l.map(pi),i=u.map(pn),d[0]=p.blocks,d[1]=t,d[2]=r,d[3]=n,d[4]=i,d[5]=a,d[6]=o,d[7]=s}else t=d[1],r=d[2],n=d[3],i=d[4],a=d[5],o=d[6],s=d[7];return d[9]!==t||d[10]!==r||d[11]!==n||d[12]!==i?(l=(0,S.jsxs)("div",{className:t,children:[r,n,i]}),d[9]=t,d[10]=r,d[11]=n,d[12]=i,d[13]=l):l=d[13],d[14]!==a||d[15]!==o||d[16]!==l?(u=(0,S.jsxs)("div",{className:a,children:[o,l]}),d[14]=a,d[15]=o,d[16]=l,d[17]=u):u=d[17],d[18]!==s||d[19]!==u?(c=(0,S.jsx)("div",{className:s,children:u}),d[18]=s,d[19]=u,d[20]=c):c=d[20],c}function pn(e){return(0,S.jsx)(pt,{block:e},e.id)}function pi(e){let t=o7(e.content);return t?(0,S.jsx)("img",{src:`data:${t.mimeType};base64,${t.data}`,alt:"",className:"max-h-48 rounded-md border border-[var(--t-border)]"},e.id):null}function pa(e){return e.content}let po=new Set(["text","thought","tool_call","resource_link","plan"]);function ps(e){let t,r=(0,C.c)(17),{block:n,sessionId:i,turnCompleted:a}=e;if("thought"===n.kind){let e,t;return r[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,S.jsx)("summary",{className:"text-xs text-[var(--t-dim)] cursor-pointer select-none py-0.5",children:"Thinking"}),r[0]=e):e=r[0],r[1]!==n.content?(t=(0,S.jsxs)("details",{className:"pl-5 border-l-2 border-[var(--t-border)]",children:[e,(0,S.jsx)("div",{className:"text-sm leading-[1.7] text-[var(--t-muted)] italic",children:(0,S.jsx)(oY.m,{plugins:dY,components:dZ,mode:"static",children:n.content})})]}),r[1]=n.content,r[2]=t):t=r[2],t}if("text"===n.kind){let e;return r[3]!==n.content?(e=(0,S.jsx)("div",{className:"text-sm leading-[1.7] text-[var(--t-text)] pl-5 border-l-2 border-[var(--t-border)]",children:(0,S.jsx)(oY.m,{plugins:dY,components:dZ,mode:"static",children:n.content})}),r[3]=n.content,r[4]=e):e=r[4],e}if("plan"===n.kind){let e,t;if(r[5]!==n.content){let t;e=(t=o7(n.content))&&Array.isArray(t.entries)?t.entries:[],r[5]=n.content,r[6]=e}else e=r[6];return r[7]!==e?(t=(0,S.jsx)("div",{className:"pl-5 border-l-2 border-[var(--t-border)]",children:(0,S.jsx)(d9,{entries:e})}),r[7]=e,r[8]=t):t=r[8],t}if("tool_call"===n.kind){let e,t;return r[9]!==n||r[10]!==a?(e=function(e){let t=o7(e.content);if(t){let r={toolCallId:t.toolCallId||e.id,title:t.title||t.toolName||"Tool call"};return"string"==typeof t.kind&&(r.kind=t.kind),"string"==typeof t.status&&(r.status=t.status),void 0!==t.rawInput&&(r.rawInput=t.rawInput),void 0!==t.rawOutput&&(r.rawOutput=t.rawOutput),r}return{toolCallId:e.id,title:e.kind||"Tool call"}}(n),a&&("in_progress"===e.status||"pending"===e.status)&&(e.status="completed"),r[9]=n,r[10]=a,r[11]=e):e=r[11],r[12]!==i||r[13]!==e?(t=(0,S.jsx)("div",{className:"pl-5 border-l-2 border-[var(--t-border)]",children:(0,S.jsx)(d7,{state:e,sessionId:i})}),r[12]=i,r[13]=e,r[14]=t):t=r[14],t}return r[15]!==n?(t=(0,S.jsx)("div",{className:"pl-5 border-l-2 border-[var(--t-border)]",children:(0,S.jsx)(pt,{block:n})}),r[15]=n,r[16]=t):t=r[16],t}function pl(e){let t,r,n,i,a,o=(0,C.c)(19),{turn:s,sessionId:l}=e;if(o[0]!==l||o[1]!==s.blocks||o[2]!==s.stop_reason){let e,i,a=function(e){let t=new Map,r=new Map;for(let n of e){if("tool_call"!==n.kind&&"tool_call_update"!==n.kind)continue;let e=o7(n.content);if(!e)continue;r.set(n,e);let i=e.toolCallId;if(!i)continue;let a=t.get(i);a?(null!=e.title&&(a.title=e.title),null!=e.kind&&(a.kind=e.kind),null!=e.status&&(a.status=e.status),void 0!==e.rawInput&&(a.rawInput=e.rawInput),void 0!==e.rawOutput&&(a.rawOutput=e.rawOutput)):t.set(i,e)}let n=new Set;return e.filter(e=>{if("tool_call_update"===e.kind)return!1;if("tool_call"===e.kind){let t=r.get(e)?.toolCallId;if(t){if(n.has(t))return!1;n.add(t)}}return!0}).map(e=>{if("tool_call"===e.kind){let n=r.get(e)?.toolCallId,i=n?t.get(n):void 0;if(i)return{...e,content:JSON.stringify(i)}}return e})}(s.blocks),u=!!s.stop_reason,c=a.filter(pc),d=a.filter(pu);t="py-1",o[6]!==l||o[7]!==u?(e=e=>(0,S.jsx)(ps,{block:e,sessionId:l,turnCompleted:u},e.id),o[6]=l,o[7]=u,o[8]=e):e=o[8],r=c.map(e),o[9]!==l||o[10]!==u?(i=e=>(0,S.jsx)(ps,{block:e,sessionId:l,turnCompleted:u},e.id),o[9]=l,o[10]=u,o[11]=i):i=o[11],n=d.map(i),o[0]=l,o[1]=s.blocks,o[2]=s.stop_reason,o[3]=t,o[4]=r,o[5]=n}else t=o[3],r=o[4],n=o[5];return o[12]!==s.stop_reason?(i=s.stop_reason&&"end_turn"!==s.stop_reason&&(0,S.jsxs)("div",{className:"pl-5 mt-1 text-[11px] font-mono text-[var(--t-dim)]",children:["[",s.stop_reason,"]"]}),o[12]=s.stop_reason,o[13]=i):i=o[13],o[14]!==t||o[15]!==r||o[16]!==n||o[17]!==i?(a=(0,S.jsxs)("div",{className:t,children:[r,n,i]}),o[14]=t,o[15]=r,o[16]=n,o[17]=i,o[18]=a):a=o[18],a}function pu(e){return"thought"!==e.kind&&po.has(e.kind)}function pc(e){return"thought"===e.kind}function pd(e){let t,r,n,i,a,o,s,l,u,c,d,p,f,h,m,g,y,v,b=(0,C.c)(42),{sessionId:x,lastSentPrompt:w,promptError:A,onConfigOptionsChange:E,onAvailableCommandsChange:N,onModesChange:I,onPromptCapabilitiesChange:T,onMcpCapabilitiesChange:P,onUsageUpdate:M}=e,j=(0,_.useQueryClient)(),{data:L}=((v=(0,C.c)(7))[0]!==x?(m=ef(x),v[0]=x,v[1]=m):m=v[1],v[2]!==x?(g=async()=>{let e=await R(x);if(!e.ok)throw Error(`HTTP ${e.status}`);return e.json()},v[2]=x,v[3]=g):g=v[3],v[4]!==m||v[5]!==g?(y={queryKey:m,queryFn:g,staleTime:1/0},v[4]=m,v[5]=g,v[6]=y):y=v[6],es(y));b[0]!==L?(t=void 0===L?[]:L,b[0]=L,b[1]=t):t=b[1];let O=t,[D,$]=(0,k.useReducer)(sd,sc),{streamingBlocks:z,prompting:B,optimisticTurn:F}=D,G=(0,k.useRef)(null),U=(0,k.useRef)(0),W=(0,k.useRef)(0),H=(0,k.useRef)(void 0);b[2]!==F||b[3]!==O?(r=F&&!O.some(e=>e.id===F.id)?[...O,F]:O,b[2]=F,b[3]=O,b[4]=r):r=b[4];let q=r,V=z.length>0;if(b[5]===Symbol.for("react.memo_cache_sentinel")?(n=()=>{let e=G.current;e&&(e.scrollTop=0)},b[5]=n):n=b[5],b[6]!==q||b[7]!==V?(i=[q,V],b[6]=q,b[7]=V,b[8]=i):i=b[8],(0,k.useEffect)(n,i),b[9]!==w||b[10]!==x?(a=()=>{w&&w.ts!==U.current&&(U.current=w.ts,$({type:"SET_OPTIMISTIC_TURN",turn:{id:`temp-user-${w.ts}`,session_id:x,role:"user",stop_reason:"end_turn",created_at:w.ts,blocks:[{id:`temp-block-${w.ts}`,turn_id:`temp-user-${w.ts}`,kind:"text",content:w.text,created_at:w.ts}]}}))},o=[w,x],b[9]=w,b[10]=x,b[11]=a,b[12]=o):(a=b[11],o=b[12]),(0,k.useEffect)(a,o),b[13]!==A?(l=()=>{A&&A.ts!==W.current&&(W.current=A.ts,$({type:"APPEND_ERROR",message:A.message}))},s=[A],b[13]=A,b[14]=s,b[15]=l):(s=b[14],l=b[15]),(0,k.useEffect)(l,s),b[16]!==N||b[17]!==E||b[18]!==P||b[19]!==I||b[20]!==T||b[21]!==M||b[22]!==j||b[23]!==x?(u=()=>{let e,t=e=>{j.setQueryData(ep,t=>t?.map(t=>t.id===x?{...t,...e}:t))},r=new EventSource((e=x,`http://localhost:3456/api/sessions/${e}/events`));return r.onmessage=e=>{let r;try{r=JSON.parse(e.data)}catch{return}let n=r.sessionUpdate,i=e.lastEventId,a=i?parseInt(i,10):void 0;if("status"===n){let e=r.latestEventId;H.current="number"==typeof e?e:void 0,$({type:"SSE_STATUS",prompting:r.prompting}),t({prompting:r.prompting}),!0===r.replayGap&&(j.invalidateQueries({queryKey:ef(x)}),j.invalidateQueries({queryKey:eh(x)}));return}if(null==a||null==H.current||!(a<=H.current))if("connected"===n){t({connected:!0});let e=r.configOptions??[],n=r.availableCommands??[],i=r.modes??null;E?.(e),N?.(n),I?.(i),T?.(r.promptCapabilities??{}),P?.(r.mcpCapabilities??{})}else if("usage_update"===n){let e={used:r.used??0,size:r.size??0};if(r.cost&&"object"==typeof r.cost){let t=r.cost;e.cost={amount:t.amount??0,currency:t.currency??"USD"}}M?.(e)}else if("config_option_update"===n)E?.(r.configOptions??[]);else if("available_commands_update"===n)N?.(r.availableCommands??[]);else if("current_mode_update"===n){let{currentModeId:e,modes:t}=r,n={};"string"==typeof e&&(n.currentModeId=e),Array.isArray(t)&&(n.modes=t),I?.(n)}else"prompt_started"===n?($({type:"SSE_PROMPT_STARTED"}),t({prompting:!0})):"done"===n?($({type:"SSE_PROMPT_FINISHED"}),t({prompting:!1}),Promise.all([j.invalidateQueries({queryKey:ef(x)}),j.invalidateQueries({queryKey:eh(x)})]).then(()=>$({type:"SSE_DONE"}))):"error"===n?($({type:"SSE_ERROR",message:`Error: ${r.message}`}),t({prompting:!1}),j.invalidateQueries({queryKey:eh(x)})):"session_info_update"===n?"string"==typeof r.title&&t({name:r.title}):"disconnected"===n?($({type:"SSE_DISCONNECTED"}),t({connected:!1,prompting:!1}),E?.([]),N?.([]),I?.(null),T?.({}),P?.({}),M?.(null)):$({type:"SSE_STREAMING",data:r})},r.onerror=pp,()=>r.close()},c=[x,j,E,N,I,T,P,M],b[16]=N,b[17]=E,b[18]=P,b[19]=I,b[20]=T,b[21]=M,b[22]=j,b[23]=x,b[24]=u,b[25]=c):(u=b[24],c=b[25]),(0,k.useEffect)(u,c),b[26]!==q||b[27]!==x){let e;b[29]!==x?(e=e=>(0,S.jsx)("div",{children:"user"===e.role?(0,S.jsx)(pr,{turn:e}):(0,S.jsx)(pl,{turn:e,sessionId:x})},e.id),b[29]=x,b[30]=e):e=b[30],d=q.map(e),b[26]=q,b[27]=x,b[28]=d}else d=b[28];return b[31]!==V||b[32]!==x||b[33]!==z?(p=V&&(0,S.jsx)("div",{className:"py-1",children:z.map((e,t)=>{let r=t===z.length-1,n="text"===e.type||"thought"===e.type||"image"===e.type?e.id:"plan"===e.type?"plan":e.state.toolCallId;return"image"===e.type?(0,S.jsx)("div",{className:"pl-5 border-l-2 border-[var(--t-accent)]",children:(0,S.jsx)("img",{src:`data:${e.mimeType};base64,${e.data}`,alt:"",className:"max-h-64 rounded-md border border-[var(--t-border)]"})},n):"thought"===e.type?(0,S.jsxs)("details",{className:"pl-5 border-l-2 border-[var(--t-accent)]",open:!0,children:[(0,S.jsx)("summary",{className:"text-xs text-[var(--t-dim)] cursor-pointer select-none py-0.5",children:"Thinking"}),(0,S.jsx)("div",{className:"text-sm leading-[1.7] text-[var(--t-muted)] italic",children:(0,S.jsx)(oY.m,{plugins:dY,components:dZ,mode:r?"streaming":"static",isAnimating:r,children:e.content})})]},n):"text"===e.type?(0,S.jsx)("div",{className:"text-sm leading-[1.7] text-[var(--t-text)] pl-5 border-l-2 border-[var(--t-accent)]",children:(0,S.jsx)(oY.m,{plugins:dY,components:dZ,mode:r?"streaming":"static",isAnimating:r,children:e.content})},n):"plan"===e.type?(0,S.jsx)("div",{className:"pl-5 border-l-2 border-[var(--t-accent)]",children:(0,S.jsx)(d9,{entries:e.entries})},n):(0,S.jsx)("div",{className:"pl-5 border-l-2 border-[var(--t-accent)]",children:(0,S.jsx)(d7,{state:e.state,sessionId:x})},n)})}),b[31]=V,b[32]=x,b[33]=z,b[34]=p):p=b[34],b[35]!==V||b[36]!==B?(f=B&&!V&&(0,S.jsx)("div",{className:"py-1",children:(0,S.jsx)("div",{className:"text-sm text-[var(--t-muted)] pl-5 border-l-2 border-[var(--t-accent)]",children:(0,S.jsx)("span",{className:"animate-pulse",children:"..."})})}),b[35]=V,b[36]=B,b[37]=f):f=b[37],b[38]!==d||b[39]!==p||b[40]!==f?(h=(0,S.jsx)("div",{ref:G,className:"h-full overflow-y-auto flex flex-col-reverse",children:(0,S.jsxs)("div",{className:"max-w-3xl w-full mx-auto px-5 py-6 space-y-1",children:[d,p,f]})}),b[38]=d,b[39]=p,b[40]=f,b[41]=h):h=b[41],h}function pp(){}let pf={connecting:!1,lastSentPrompt:null,promptError:null,configOptions:[],availableCommands:[],pendingAuthMethods:[],modes:null,promptCapabilities:{},mcpCapabilities:{},usageUpdate:null};function ph(e,t){switch(t.type){case"RESET":return pf;case"SET_CONNECTING":return{...e,connecting:t.value};case"SET_LAST_SENT_PROMPT":return{...e,lastSentPrompt:t.value};case"SET_PROMPT_ERROR":return{...e,promptError:t.value};case"SET_CONFIG_OPTIONS":return{...e,configOptions:t.value};case"SET_AVAILABLE_COMMANDS":return{...e,availableCommands:t.value};case"SET_PENDING_AUTH_METHODS":return{...e,pendingAuthMethods:t.value};case"SET_MODES":return{...e,modes:t.value};case"UPDATE_MODE":return{...e,modes:{...e.modes??{},currentModeId:t.modeId}};case"SET_PROMPT_CAPABILITIES":return{...e,promptCapabilities:t.value};case"SET_MCP_CAPABILITIES":return{...e,mcpCapabilities:t.value};case"SET_USAGE_UPDATE":return{...e,usageUpdate:t.value};case"CONNECT_ERROR":return{...e,pendingAuthMethods:t.authMethods??[],promptError:t.promptError}}}function pm(e){let t,r,n,i,a,o,s,l,u,c,d=(0,C.c)(63),{paneId:p}=e,{layout:f,focusPane:h,openSessionInPane:m}=eE();if(d[0]!==f.panes||d[1]!==p){let e;d[3]!==p?(e=e=>e.id===p,d[3]=p,d[4]=e):e=d[4],t=f.panes.find(e),d[0]=f.panes,d[1]=p,d[2]=t}else t=d[2];let g=t,y=f.focusedPaneId===p,v=g?.activeTabSessionId??"",b=function(e){let{sessions:t}=ew(),r=t.find(t=>t.id===e),n=!!r?.connected,i=!!r?.prompting,[a,o]=(0,k.useReducer)(ph,pf),s=(0,k.useRef)(a.configOptions);s.current=a.configOptions,(0,k.useEffect)(()=>{o({type:"RESET"})},[e]);let l=async(e,t)=>{o({type:"SET_CONNECTING",value:!0});try{let r={agent_type:e.agent_type,cwd:e.cwd};t&&(r.authMethodId=t);let n=await O(e.id,r);if(!n.ok){let e=await n.json().catch(()=>({error:"Connection failed"}));return 401===n.status&&Array.isArray(e.authMethods)?o({type:"CONNECT_ERROR",promptError:{message:`Error: ${e.error??"Authentication required"}`,ts:Date.now()},authMethods:e.authMethods}):o({type:"CONNECT_ERROR",promptError:{message:`Error: ${e.error??"Connection failed"}`,ts:Date.now()}}),!1}return o({type:"SET_PENDING_AUTH_METHODS",value:[]}),!0}catch{return o({type:"CONNECT_ERROR",promptError:{message:"Error: Failed to connect agent",ts:Date.now()}}),!1}finally{o({type:"SET_CONNECTING",value:!1})}},u=async()=>{r&&!a.connecting&&await l(r)},c=async e=>{r&&!a.connecting&&e&&await l(r,e)},d=async()=>{r&&await D(r.id).catch(()=>{})},p=async(e,t)=>{if(!r)return;let n=s.current;o({type:"SET_CONFIG_OPTIONS",value:n.map(r=>r.id===e?{...r,currentValue:t}:r)});try{let i=await B(r.id,e,t);if(i.ok){let e=await i.json();o({type:"SET_CONFIG_OPTIONS",value:e})}else o({type:"SET_CONFIG_OPTIONS",value:n})}catch{o({type:"SET_CONFIG_OPTIONS",value:n})}},f=async e=>{if(!r)return;let t=a.modes;o({type:"UPDATE_MODE",modeId:e});try{let n=await G(r.id,e);if(n.ok){let e=await n.json();o({type:"SET_MODES",value:e})}else o({type:"SET_MODES",value:t})}catch{o({type:"SET_MODES",value:t})}},h=async(e,t)=>{if(r&&!i&&(o({type:"SET_LAST_SENT_PROMPT",value:{text:e,ts:Date.now()}}),n||await l(r)))try{let n=await M(r.id,t?{blocks:t}:e);if(!n.ok){let e=await n.json().catch(()=>({error:"Unknown error"}));o({type:"SET_PROMPT_ERROR",value:{message:`Error: ${e.error}`,ts:Date.now()}})}}catch{o({type:"SET_PROMPT_ERROR",value:{message:"Error: Network error",ts:Date.now()}})}},m=r?.id;return(0,k.useEffect)(()=>{m&&n&&($(m).then(async e=>{e.ok&&o({type:"SET_AVAILABLE_COMMANDS",value:await e.json()})}).catch(()=>{}),z(m).then(async e=>{e.ok&&o({type:"SET_CONFIG_OPTIONS",value:await e.json()})}).catch(()=>{}),F(m).then(async e=>{e.ok&&o({type:"SET_MODES",value:await e.json()})}).catch(()=>{}))},[m,n]),{activeSession:r,connected:n,prompting:i,connecting:a.connecting,lastSentPrompt:a.lastSentPrompt,promptError:a.promptError,configOptions:a.configOptions,availableCommands:a.availableCommands,pendingAuthMethods:a.pendingAuthMethods,modes:a.modes,promptCapabilities:a.promptCapabilities,mcpCapabilities:a.mcpCapabilities,usageUpdate:a.usageUpdate,connectAgent:u,authenticateAndConnect:c,disconnectAgent:d,sendPrompt:h,cancelPrompt:()=>{r&&j(r.id).catch(()=>{})},setConfigOption:p,setMode:f,onConfigOptionsChange:e=>o({type:"SET_CONFIG_OPTIONS",value:e}),onAvailableCommandsChange:e=>o({type:"SET_AVAILABLE_COMMANDS",value:e}),onModesChange:e=>o({type:"SET_MODES",value:e}),onPromptCapabilitiesChange:e=>o({type:"SET_PROMPT_CAPABILITIES",value:e}),onMcpCapabilitiesChange:e=>o({type:"SET_MCP_CAPABILITIES",value:e}),onUsageUpdate:e=>o({type:"SET_USAGE_UPDATE",value:e})}}(v||void 0);d[5]!==m||d[6]!==p?(r=e=>{let t=aC(e,aw);t&&(e.preventDefault(),m(p,t.sessionId))},d[5]=m,d[6]=p,d[7]=r):r=d[7];let x=r;d[8]!==h||d[9]!==p?(n=()=>h(p),i=e=>{e.target===e.currentTarget&&("Enter"===e.key||" "===e.key)&&h(p)},d[8]=h,d[9]=p,d[10]=n,d[11]=i):(n=d[10],i=d[11]),d[12]!==g?.tabSessionIds?(a=g?.tabSessionIds??[],d[12]=g?.tabSessionIds,d[13]=a):a=d[13],d[14]!==v||d[15]!==y||d[16]!==p||d[17]!==a?(o=(0,S.jsx)(oD,{paneId:p,tabSessionIds:a,activeTabSessionId:v,isFocused:y}),d[14]=v,d[15]=y,d[16]=p,d[17]=a,d[18]=o):o=d[18];let w=b.activeSession?.cwd;d[19]!==b.authenticateAndConnect||d[20]!==b.configOptions||d[21]!==b.connectAgent||d[22]!==b.connected||d[23]!==b.connecting||d[24]!==b.disconnectAgent||d[25]!==b.modes||d[26]!==b.pendingAuthMethods||d[27]!==b.prompting||d[28]!==b.setConfigOption||d[29]!==b.setMode||d[30]!==w?(s=(0,S.jsx)(oG,{cwd:w,connected:b.connected,prompting:b.prompting,connecting:b.connecting,configOptions:b.configOptions,pendingAuthMethods:b.pendingAuthMethods,modes:b.modes,onConnect:b.connectAgent,onAuthenticateAndConnect:b.authenticateAndConnect,onDisconnect:b.disconnectAgent,onSetConfigOption:b.setConfigOption,onSetMode:b.setMode}),d[19]=b.authenticateAndConnect,d[20]=b.configOptions,d[21]=b.connectAgent,d[22]=b.connected,d[23]=b.connecting,d[24]=b.disconnectAgent,d[25]=b.modes,d[26]=b.pendingAuthMethods,d[27]=b.prompting,d[28]=b.setConfigOption,d[29]=b.setMode,d[30]=w,d[31]=s):s=d[31],d[32]!==b.activeSession||d[33]!==b.lastSentPrompt||d[34]!==b.onAvailableCommandsChange||d[35]!==b.onConfigOptionsChange||d[36]!==b.onMcpCapabilitiesChange||d[37]!==b.onModesChange||d[38]!==b.onPromptCapabilitiesChange||d[39]!==b.onUsageUpdate||d[40]!==b.promptError?(l=(0,S.jsx)("div",{className:"flex-1 min-h-0 relative",children:b.activeSession?(0,S.jsx)(pd,{sessionId:b.activeSession.id,lastSentPrompt:b.lastSentPrompt,promptError:b.promptError,onConfigOptionsChange:b.onConfigOptionsChange,onAvailableCommandsChange:b.onAvailableCommandsChange,onModesChange:b.onModesChange,onPromptCapabilitiesChange:b.onPromptCapabilitiesChange,onMcpCapabilitiesChange:b.onMcpCapabilitiesChange,onUsageUpdate:b.onUsageUpdate},b.activeSession.id):(0,S.jsx)("div",{className:"flex h-full items-center justify-center text-[var(--t-muted)] text-sm",children:"No session selected. Open one from the sidebar."})}),d[32]=b.activeSession,d[33]=b.lastSentPrompt,d[34]=b.onAvailableCommandsChange,d[35]=b.onConfigOptionsChange,d[36]=b.onMcpCapabilitiesChange,d[37]=b.onModesChange,d[38]=b.onPromptCapabilitiesChange,d[39]=b.onUsageUpdate,d[40]=b.promptError,d[41]=l):l=d[41];let _=b.activeSession?.id??"empty",A=b.activeSession?.id??null,E=!!b.activeSession,N=!0===b.promptCapabilities.image;return d[42]!==y||d[43]!==b.availableCommands||d[44]!==b.cancelPrompt||d[45]!==b.connected||d[46]!==b.connecting||d[47]!==b.prompting||d[48]!==b.sendPrompt||d[49]!==b.usageUpdate||d[50]!==_||d[51]!==A||d[52]!==E||d[53]!==N?(u=(0,S.jsx)(oK,{sessionId:A,active:E,prompting:b.prompting,connecting:b.connecting,connected:b.connected,availableCommands:b.availableCommands,usageUpdate:b.usageUpdate,supportsImages:N,onSend:b.sendPrompt,onCancel:b.cancelPrompt,autoFocus:y},_),d[42]=y,d[43]=b.availableCommands,d[44]=b.cancelPrompt,d[45]=b.connected,d[46]=b.connecting,d[47]=b.prompting,d[48]=b.sendPrompt,d[49]=b.usageUpdate,d[50]=_,d[51]=A,d[52]=E,d[53]=N,d[54]=u):u=d[54],d[55]!==x||d[56]!==u||d[57]!==n||d[58]!==i||d[59]!==o||d[60]!==s||d[61]!==l?(c=(0,S.jsxs)("div",{role:"group",className:"flex flex-col h-full min-w-0 min-h-0 bg-[var(--t-bg)]",onClick:n,onKeyDown:i,onDragOver:pg,onDrop:x,children:[o,s,l,u]}),d[55]=x,d[56]=u,d[57]=n,d[58]=i,d[59]=o,d[60]=s,d[61]=l,d[62]=c):c=d[62],c}function pg(e){e.dataTransfer.types.includes(aw)&&(e.preventDefault(),e.dataTransfer.dropEffect="copy")}function py(){let e,t,r,n,i,a,o,s,l,u,c,d=(0,C.c)(27),{backendStatus:p,showSetup:f}=ew(),{layout:h,setPaneSizes:m,openSessionInNewPane:g,moveTabToNewPane:y}=eE();d[0]===Symbol.for("react.memo_cache_sentinel")?(e={dragging:!1,splitDropHover:!1},d[0]=e):e=d[0];let[v,b]=(0,k.useState)(e);d[1]===Symbol.for("react.memo_cache_sentinel")?(t=()=>{let e=e=>{(e.dataTransfer?.types.includes(aw)||e.dataTransfer?.types.includes(aS))&&b(px)},t=()=>{b({dragging:!1,splitDropHover:!1})};return document.addEventListener("dragstart",e),document.addEventListener("dragend",t),document.addEventListener("drop",t),()=>{document.removeEventListener("dragstart",e),document.removeEventListener("dragend",t),document.removeEventListener("drop",t)}},r=[],d[1]=t,d[2]=r):(t=d[1],r=d[2]),(0,k.useEffect)(t,r),d[3]!==h.panes||d[4]!==m?(n=e=>{m(h.panes.map(t=>e[t.id]??100/h.panes.length))},d[3]=h.panes,d[4]=m,d[5]=n):n=d[5];let x=n;d[6]===Symbol.for("react.memo_cache_sentinel")?(i=e=>{let t=e.dataTransfer.types.includes(aw),r=e.dataTransfer.types.includes(aS);(t||r)&&(e.preventDefault(),e.dataTransfer.dropEffect=t?"copy":"move",b(pb))},d[6]=i):i=d[6];let w=i;d[7]===Symbol.for("react.memo_cache_sentinel")?(a=()=>b(pv),d[7]=a):a=d[7];let _=a;d[8]!==y||d[9]!==g?(o=e=>{e.preventDefault(),b({dragging:!1,splitDropHover:!1});let t=aC(e,aw);if(t)return void g(t.sessionId);let r=aC(e,aS);r&&y(r.fromPaneId,r.sessionId)},d[8]=y,d[9]=g,d[10]=o):o=d[10];let A=o;if("offline"===p){let e;return d[11]===Symbol.for("react.memo_cache_sentinel")?(e=(0,S.jsx)("div",{className:"flex-1 min-w-0 min-h-0 flex flex-col bg-[var(--t-bg)]",children:(0,S.jsx)(oR,{})}),d[11]=e):e=d[11],e}if(f){let e;return d[12]===Symbol.for("react.memo_cache_sentinel")?(e=(0,S.jsx)("div",{className:"flex-1 min-w-0 min-h-0 flex flex-col bg-[var(--t-bg)]",children:(0,S.jsx)(oL,{})}),d[12]=e):e=d[12],e}if("checking"===p){let e;return d[13]===Symbol.for("react.memo_cache_sentinel")?(e=(0,S.jsx)("div",{className:"flex-1 min-w-0 min-h-0 bg-[var(--t-bg)]"}),d[13]=e):e=d[13],e}d[14]!==h.paneSizes||d[15]!==h.panes?(s=[],h.panes.forEach((e,t)=>{t>0&&s.push((0,S.jsx)(oE,{className:"w-1 bg-[var(--t-surface)] hover:bg-[var(--t-accent)] active:bg-[var(--t-accent)] transition-colors cursor-col-resize"},`sep-${e.id}`)),s.push((0,S.jsx)(o_,{id:e.id,defaultSize:`${h.paneSizes[t]??100/h.panes.length}%`,minSize:"15%",children:(0,S.jsx)(pm,{paneId:e.id})},e.id))}),d[14]=h.paneSizes,d[15]=h.panes,d[16]=s):s=d[16];let E=h.panes.length<4&&v.dragging;return d[17]!==s||d[18]!==x?(l=(0,S.jsx)("div",{className:"flex-1 min-w-0",children:(0,S.jsx)(oC,{orientation:"horizontal",onLayoutChanged:x,id:"agentpane-panels",children:s})}),d[17]=s,d[18]=x,d[19]=l):l=d[19],d[20]!==v||d[21]!==A||d[22]!==E?(u=E&&(0,S.jsx)("button",{type:"button",onDragOver:w,onDragLeave:_,onDrop:A,className:`shrink-0 flex items-center justify-center transition-all duration-150 ${v.splitDropHover?"w-24 bg-[var(--t-accent)]/10 border-l-2 border-[var(--t-accent)]":"w-8 bg-[var(--t-surface)]/50 border-l border-dashed border-[var(--t-dim)]"}`,children:(0,S.jsxs)("div",{className:`flex flex-col items-center gap-1.5 transition-colors ${v.splitDropHover?"text-[var(--t-accent)]":"text-[var(--t-dim)]"}`,children:[(0,S.jsx)(oN,{className:"size-4"}),v.splitDropHover&&(0,S.jsx)("span",{className:"text-[10px] font-medium",children:"Split"})]})}),d[20]=v,d[21]=A,d[22]=E,d[23]=u):u=d[23],d[24]!==l||d[25]!==u?(c=(0,S.jsxs)("div",{className:"flex-1 min-w-0 min-h-0 flex",children:[l,u]}),d[24]=l,d[25]=u,d[26]=c):c=d[26],c}function pv(e){return{...e,splitDropHover:!1}}function pb(e){return{...e,splitDropHover:!0}}function px(e){return{...e,dragging:!0}}function pw(e){let t,r,n,i=(0,C.c)(6),{initialLayout:a,initialActiveSessionId:o}=e;return i[0]===Symbol.for("react.memo_cache_sentinel")?(t=(0,S.jsxs)("div",{className:"flex h-screen bg-[var(--t-bg)] overflow-hidden",children:[(0,S.jsx)(aT,{}),(0,S.jsx)(py,{})]}),i[0]=t):t=i[0],i[1]!==a?(r=(0,S.jsx)(eN,{initialLayout:a,children:t}),i[1]=a,i[2]=r):r=i[2],i[3]!==o||i[4]!==r?(n=(0,S.jsx)(eS,{initialActiveSessionId:o,children:r}),i[3]=o,i[4]=r,i[5]=n):n=i[5],n}e.s(["default",()=>pw],14517)}]);