sparkecoder 0.1.20 → 0.1.22

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 (100) hide show
  1. package/dist/agent/index.d.ts +2 -2
  2. package/dist/agent/index.js +53 -3
  3. package/dist/agent/index.js.map +1 -1
  4. package/dist/cli.js +397 -46
  5. package/dist/cli.js.map +1 -1
  6. package/dist/db/index.d.ts +2 -1
  7. package/dist/db/index.js.map +1 -1
  8. package/dist/{index-BzedNBK-.d.ts → index-CNwLFGiZ.d.ts} +24 -3
  9. package/dist/index.d.ts +4 -4
  10. package/dist/index.js +392 -41
  11. package/dist/index.js.map +1 -1
  12. package/dist/{schema-CkrIadxa.d.ts → schema-Df7MU3nM.d.ts} +26 -3
  13. package/dist/server/index.js +392 -41
  14. package/dist/server/index.js.map +1 -1
  15. package/dist/tools/index.js.map +1 -1
  16. package/package.json +1 -1
  17. package/web/.next/BUILD_ID +1 -1
  18. package/web/.next/standalone/web/.next/BUILD_ID +1 -1
  19. package/web/.next/standalone/web/.next/build-manifest.json +2 -2
  20. package/web/.next/standalone/web/.next/prerender-manifest.json +3 -3
  21. package/web/.next/standalone/web/.next/server/app/(main)/page.js.nft.json +1 -1
  22. package/web/.next/standalone/web/.next/server/app/(main)/page_client-reference-manifest.js +1 -1
  23. package/web/.next/standalone/web/.next/server/app/(main)/session/[id]/page.js.nft.json +1 -1
  24. package/web/.next/standalone/web/.next/server/app/(main)/session/[id]/page_client-reference-manifest.js +1 -1
  25. package/web/.next/standalone/web/.next/server/app/_global-error.html +2 -2
  26. package/web/.next/standalone/web/.next/server/app/_global-error.rsc +1 -1
  27. package/web/.next/standalone/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  28. package/web/.next/standalone/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  29. package/web/.next/standalone/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  30. package/web/.next/standalone/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  31. package/web/.next/standalone/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  32. package/web/.next/standalone/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  33. package/web/.next/standalone/web/.next/server/app/_not-found.html +1 -1
  34. package/web/.next/standalone/web/.next/server/app/_not-found.rsc +2 -2
  35. package/web/.next/standalone/web/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
  36. package/web/.next/standalone/web/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  37. package/web/.next/standalone/web/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
  38. package/web/.next/standalone/web/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  39. package/web/.next/standalone/web/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  40. package/web/.next/standalone/web/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  41. package/web/.next/standalone/web/.next/server/app/index.html +1 -1
  42. package/web/.next/standalone/web/.next/server/app/index.rsc +4 -4
  43. package/web/.next/standalone/web/.next/server/app/index.segments/!KG1haW4p/__PAGE__.segment.rsc +2 -2
  44. package/web/.next/standalone/web/.next/server/app/index.segments/!KG1haW4p.segment.rsc +2 -2
  45. package/web/.next/standalone/web/.next/server/app/index.segments/_full.segment.rsc +4 -4
  46. package/web/.next/standalone/web/.next/server/app/index.segments/_head.segment.rsc +1 -1
  47. package/web/.next/standalone/web/.next/server/app/index.segments/_index.segment.rsc +2 -2
  48. package/web/.next/standalone/web/.next/server/app/index.segments/_tree.segment.rsc +2 -2
  49. package/web/.next/standalone/web/.next/server/chunks/ssr/{2374f_1d78db71._.js → 2374f_387a1437._.js} +1 -1
  50. package/web/.next/standalone/web/.next/server/chunks/ssr/{2374f_378282b1._.js → 2374f_5f58fd73._.js} +1 -1
  51. package/web/.next/standalone/web/.next/server/chunks/ssr/{2374f_30f9df13._.js → 2374f_65fcfd95._.js} +1 -1
  52. package/web/.next/standalone/web/.next/server/chunks/ssr/{2374f_8825dcc9._.js → 2374f_741f6b67._.js} +1 -1
  53. package/web/.next/standalone/web/.next/server/chunks/ssr/{2374f_9bf3c7f3._.js → 2374f_814be2c9._.js} +2 -2
  54. package/web/.next/standalone/web/.next/server/chunks/ssr/{2374f_5de336d2._.js → 2374f_84859a94._.js} +1 -1
  55. package/web/.next/standalone/web/.next/server/chunks/ssr/{2374f_bbc99511._.js → 2374f_cfd0137a._.js} +1 -1
  56. package/web/.next/standalone/web/.next/server/chunks/ssr/{2374f_d94c2b70._.js → 2374f_f1038f7c._.js} +1 -1
  57. package/web/.next/standalone/web/.next/server/chunks/ssr/{[root-of-the-server]__a984d933._.js → [root-of-the-server]__3ec22171._.js} +2 -2
  58. package/web/.next/standalone/web/.next/server/chunks/ssr/web_96bca05b._.js +1 -1
  59. package/web/.next/standalone/web/.next/server/chunks/ssr/web_c7618534._.js +8 -0
  60. package/web/.next/standalone/web/.next/server/chunks/ssr/web_d7d3e40d._.js +1 -1
  61. package/web/.next/standalone/web/.next/server/pages/404.html +1 -1
  62. package/web/.next/standalone/web/.next/server/pages/500.html +2 -2
  63. package/web/.next/standalone/web/.next/server/server-reference-manifest.js +1 -1
  64. package/web/.next/standalone/web/.next/server/server-reference-manifest.json +1 -1
  65. package/web/.next/standalone/web/.next/static/chunks/{55705f91c6cfe307.js → 3bb454ca848ec78e.js} +3 -3
  66. package/web/.next/standalone/web/.next/static/chunks/{5ec82ce8f3aabaf0.js → 5e5b485d77ac0d8f.js} +1 -1
  67. package/web/.next/standalone/web/.next/static/chunks/{c9d8a4b9a763e232.js → beb9625c4a470042.js} +1 -1
  68. package/web/.next/standalone/web/.next/static/chunks/c81c1aec4369c77f.js +5 -0
  69. package/web/.next/standalone/web/.next/static/chunks/cb355fac10c6ad11.css +1 -0
  70. package/web/.next/standalone/web/.next/static/static/chunks/{55705f91c6cfe307.js → 3bb454ca848ec78e.js} +3 -3
  71. package/web/.next/standalone/web/.next/static/static/chunks/{5ec82ce8f3aabaf0.js → 5e5b485d77ac0d8f.js} +1 -1
  72. package/web/.next/standalone/web/.next/static/static/chunks/{c9d8a4b9a763e232.js → beb9625c4a470042.js} +1 -1
  73. package/web/.next/standalone/web/.next/static/static/chunks/c81c1aec4369c77f.js +5 -0
  74. package/web/.next/standalone/web/.next/static/static/chunks/cb355fac10c6ad11.css +1 -0
  75. package/web/.next/standalone/web/src/app/(main)/layout.tsx +2 -2
  76. package/web/.next/standalone/web/src/components/ai-elements/speech-input.tsx +89 -36
  77. package/web/.next/standalone/web/src/components/chat-interface.tsx +354 -38
  78. package/web/.next/standalone/web/src/components/ui/sidebar.tsx +2 -2
  79. package/web/.next/standalone/web/src/lib/api.ts +133 -2
  80. package/web/.next/static/chunks/{55705f91c6cfe307.js → 3bb454ca848ec78e.js} +3 -3
  81. package/web/.next/static/chunks/{5ec82ce8f3aabaf0.js → 5e5b485d77ac0d8f.js} +1 -1
  82. package/web/.next/static/chunks/{c9d8a4b9a763e232.js → beb9625c4a470042.js} +1 -1
  83. package/web/.next/static/chunks/c81c1aec4369c77f.js +5 -0
  84. package/web/.next/static/chunks/cb355fac10c6ad11.css +1 -0
  85. package/web/.next/standalone/web/.next/server/chunks/ssr/web_19b6934c._.js +0 -8
  86. package/web/.next/standalone/web/.next/static/chunks/61d61c75ce7cd4ba.js +0 -5
  87. package/web/.next/standalone/web/.next/static/chunks/d0a69c59b1c0d99c.css +0 -1
  88. package/web/.next/standalone/web/.next/static/static/chunks/61d61c75ce7cd4ba.js +0 -5
  89. package/web/.next/standalone/web/.next/static/static/chunks/d0a69c59b1c0d99c.css +0 -1
  90. package/web/.next/static/chunks/61d61c75ce7cd4ba.js +0 -5
  91. package/web/.next/static/chunks/d0a69c59b1c0d99c.css +0 -1
  92. /package/web/.next/standalone/web/.next/static/{ogmHZngrFt0TlARPSetHj → n86r6x1RoUipFp6nLIk-R}/_buildManifest.js +0 -0
  93. /package/web/.next/standalone/web/.next/static/{ogmHZngrFt0TlARPSetHj → n86r6x1RoUipFp6nLIk-R}/_clientMiddlewareManifest.json +0 -0
  94. /package/web/.next/standalone/web/.next/static/{ogmHZngrFt0TlARPSetHj → n86r6x1RoUipFp6nLIk-R}/_ssgManifest.js +0 -0
  95. /package/web/.next/standalone/web/.next/static/static/{ogmHZngrFt0TlARPSetHj → n86r6x1RoUipFp6nLIk-R}/_buildManifest.js +0 -0
  96. /package/web/.next/standalone/web/.next/static/static/{ogmHZngrFt0TlARPSetHj → n86r6x1RoUipFp6nLIk-R}/_clientMiddlewareManifest.json +0 -0
  97. /package/web/.next/standalone/web/.next/static/static/{ogmHZngrFt0TlARPSetHj → n86r6x1RoUipFp6nLIk-R}/_ssgManifest.js +0 -0
  98. /package/web/.next/static/{ogmHZngrFt0TlARPSetHj → n86r6x1RoUipFp6nLIk-R}/_buildManifest.js +0 -0
  99. /package/web/.next/static/{ogmHZngrFt0TlARPSetHj → n86r6x1RoUipFp6nLIk-R}/_clientMiddlewareManifest.json +0 -0
  100. /package/web/.next/static/{ogmHZngrFt0TlARPSetHj → n86r6x1RoUipFp6nLIk-R}/_ssgManifest.js +0 -0
@@ -1,7 +1,7 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,520683,(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,s=l(e),a=s[0],o=s[1],c=new i((a+o)*3/4-o),u=0,d=o>0?a-4:a;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)],c[u++]=t>>16&255,c[u++]=t>>8&255,c[u++]=255&t;return 2===o&&(t=n[e.charCodeAt(r)]<<2|n[e.charCodeAt(r+1)]>>4,c[u++]=255&t),1===o&&(t=n[e.charCodeAt(r)]<<10|n[e.charCodeAt(r+1)]<<4|n[e.charCodeAt(r+2)]>>2,c[u++]=t>>8&255,c[u++]=255&t),c},t.fromByteArray=function(e){for(var t,n=e.length,i=n%3,s=[],a=0,o=n-i;a<o;a+=16383)s.push(function(e,t,n){for(var i,s=[],a=t;a<n;a+=3)i=(e[a]<<16&0xff0000)+(e[a+1]<<8&65280)+(255&e[a+2]),s.push(r[i>>18&63]+r[i>>12&63]+r[i>>6&63]+r[63&i]);return s.join("")}(e,a,a+16383>o?o:a+16383));return 1===i?s.push(r[(t=e[n-1])>>2]+r[t<<4&63]+"=="):2===i&&s.push(r[(t=(e[n-2]<<8)+e[n-1])>>10]+r[t>>4&63]+r[t<<2&63]+"="),s.join("")};for(var r=[],n=[],i="u">typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,o=s.length;a<o;++a)r[a]=s[a],n[s.charCodeAt(a)]=a;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),s="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;function a(e){if(e>0x7fffffff)throw RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return Object.setPrototypeOf(t,o.prototype),t}function o(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 u(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"),!o.isEncoding(i))throw TypeError("Unknown encoding: "+i);var s=0|p(n,i),l=a(s),c=l.write(n,i);return c!==s&&(l=l.slice(0,c)),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(T(e,ArrayBuffer)||e&&T(e.buffer,ArrayBuffer)||"u">typeof SharedArrayBuffer&&(T(e,SharedArrayBuffer)||e&&T(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),o.prototype),n}(e,t,r);if("number"==typeof e)throw TypeError('The "value" argument must not be of type number. Received type number');var u=e.valueOf&&e.valueOf();if(null!=u&&u!==e)return o.from(u,t,r);var m=function(e){if(o.isBuffer(e)){var t=0|h(e.length),r=a(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)?a(0):d(e):"Buffer"===e.type&&Array.isArray(e.data)?d(e.data):void 0}(e);if(m)return m;if("u">typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return o.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 c(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 u(e){return c(e),a(e<0?0:0|h(e))}function d(e){for(var t=e.length<0?0:0|h(e.length),r=a(t),n=0;n<t;n+=1)r[n]=255&e[n];return r}t.Buffer=o,t.SlowBuffer=function(e){return+e!=e&&(e=0),o.alloc(+e)},t.INSPECT_MAX_BYTES=50,t.kMaxLength=0x7fffffff,o.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}}(),!o.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(o.prototype,"parent",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.buffer}}),Object.defineProperty(o.prototype,"offset",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.byteOffset}}),o.poolSize=8192,o.from=function(e,t,r){return l(e,t,r)},Object.setPrototypeOf(o.prototype,Uint8Array.prototype),Object.setPrototypeOf(o,Uint8Array),o.alloc=function(e,t,r){return(c(e),e<=0)?a(e):void 0!==t?"string"==typeof r?a(e).fill(t,r):a(e).fill(t):a(e)},o.allocUnsafe=function(e){return u(e)},o.allocUnsafeSlow=function(e){return u(e)};function h(e){if(e>=0x7fffffff)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x7fffffff bytes");return 0|e}function p(e,t){if(o.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||T(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 A(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return C(e).length;default:if(i)return n?-1:A(e).length;t=(""+t).toLowerCase(),i=!0}}function m(e,t,r){var i,s,a,o=!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="",s=t;s<r;++s)i+=E[e[s]];return i}(this,t,r);case"utf8":case"utf-8":return x(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,s=t,a=r,0===s&&a===i.length?n.fromByteArray(i):n.fromByteArray(i.slice(s,a));case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return function(e,t,r){for(var n=e.slice(t,r),i="",s=0;s<n.length;s+=2)i+=String.fromCharCode(n[s]+256*n[s+1]);return i}(this,t,r);default:if(o)throw TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),o=!0}}function f(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function g(e,t,r,n,i){var s;if(0===e.length)return -1;if("string"==typeof r?(n=r,r=0):r>0x7fffffff?r=0x7fffffff:r<-0x80000000&&(r=-0x80000000),(s=r*=1)!=s&&(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=o.from(t,n)),o.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 s,a=1,o=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;a=2,o/=2,l/=2,r/=2}function c(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(i){var u=-1;for(s=r;s<o;s++)if(c(e,s)===c(t,-1===u?0:s-u)){if(-1===u&&(u=s),s-u+1===l)return u*a}else -1!==u&&(s-=s-u),u=-1}else for(r+l>o&&(r=o-l),s=r;s>=0;s--){for(var d=!0,h=0;h<l;h++)if(c(e,s+h)!==c(t,h)){d=!1;break}if(d)return s}return -1}o.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==o.prototype},o.compare=function(e,t){if(T(e,Uint8Array)&&(e=o.from(e,e.offset,e.byteLength)),T(t,Uint8Array)&&(t=o.from(t,t.offset,t.byteLength)),!o.isBuffer(e)||!o.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,s=Math.min(r,n);i<s;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:+(n<r)},o.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}},o.concat=function(e,t){if(!Array.isArray(e))throw TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return o.alloc(0);if(void 0===t)for(r=0,t=0;r<e.length;++r)t+=e[r].length;var r,n=o.allocUnsafe(t),i=0;for(r=0;r<e.length;++r){var s=e[r];if(T(s,Uint8Array)&&(s=o.from(s)),!o.isBuffer(s))throw TypeError('"list" argument must be an Array of Buffers');s.copy(n,i),i+=s.length}return n},o.byteLength=p,o.prototype._isBuffer=!0,o.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)f(this,t,t+1);return this},o.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)f(this,t,t+3),f(this,t+1,t+2);return this},o.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)f(this,t,t+7),f(this,t+1,t+6),f(this,t+2,t+5),f(this,t+3,t+4);return this},o.prototype.toString=function(){var e=this.length;return 0===e?"":0==arguments.length?x(this,0,e):m.apply(this,arguments)},o.prototype.toLocaleString=o.prototype.toString,o.prototype.equals=function(e){if(!o.isBuffer(e))throw TypeError("Argument must be a Buffer");return this===e||0===o.compare(this,e)},o.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+">"},s&&(o.prototype[s]=o.prototype.inspect),o.prototype.compare=function(e,t,r,n,i){if(T(e,Uint8Array)&&(e=o.from(e,e.offset,e.byteLength)),!o.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 s=i-n,a=r-t,l=Math.min(s,a),c=this.slice(n,i),u=e.slice(t,r),d=0;d<l;++d)if(c[d]!==u[d]){s=c[d],a=u[d];break}return s<a?-1:+(a<s)},o.prototype.includes=function(e,t,r){return -1!==this.indexOf(e,t,r)},o.prototype.indexOf=function(e,t,r){return g(this,e,t,r,!0)},o.prototype.lastIndexOf=function(e,t,r){return g(this,e,t,r,!1)};function x(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i<r;){var s,a,o,l,c=e[i],u=null,d=c>239?4:c>223?3:c>191?2:1;if(i+d<=r)switch(d){case 1:c<128&&(u=c);break;case 2:(192&(s=e[i+1]))==128&&(l=(31&c)<<6|63&s)>127&&(u=l);break;case 3:s=e[i+1],a=e[i+2],(192&s)==128&&(192&a)==128&&(l=(15&c)<<12|(63&s)<<6|63&a)>2047&&(l<55296||l>57343)&&(u=l);break;case 4:s=e[i+1],a=e[i+2],o=e[i+3],(192&s)==128&&(192&a)==128&&(192&o)==128&&(l=(15&c)<<18|(63&s)<<12|(63&a)<<6|63&o)>65535&&l<1114112&&(u=l)}null===u?(u=65533,d=1):u>65535&&(u-=65536,n.push(u>>>10&1023|55296),u=56320|1023&u),n.push(u),i+=d}var h=n,p=h.length;if(p<=4096)return String.fromCharCode.apply(String,h);for(var m="",f=0;f<p;)m+=String.fromCharCode.apply(String,h.slice(f,f+=4096));return m}function v(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 b(e,t,r,n,i,s){if(!o.isBuffer(e))throw TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<s)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,s){if(r+n>e.length||r<0)throw RangeError("Index out of range")}function k(e,t,r,n,s){return t*=1,r>>>=0,s||w(e,t,r,4,34028234663852886e22,-34028234663852886e22),i.write(e,t,r,n,23,4),r+4}function S(e,t,r,n,s){return t*=1,r>>>=0,s||w(e,t,r,8,17976931348623157e292,-17976931348623157e292),i.write(e,t,r,n,52,8),r+8}o.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,s,a,o,l,c,u,d,h=this.length-t;if((void 0===r||r>h)&&(r=h),e.length>0&&(r<0||t<0)||t>this.length)throw RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var p=!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 s=t.length;n>s/2&&(n=s/2);for(var a=0;a<n;++a){var o,l=parseInt(t.substr(2*a,2),16);if((o=l)!=o)break;e[r+a]=l}return a}(this,e,t,r);case"utf8":case"utf-8":return i=t,s=r,_(A(e,this.length-i),this,i,s);case"ascii":return a=t,o=r,_(N(e),this,a,o);case"latin1":case"binary":return function(e,t,r,n){return _(N(t),e,r,n)}(this,e,t,r);case"base64":return l=t,c=r,_(C(e),this,l,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return u=t,d=r,_(function(e,t){for(var r,n,i=[],s=0;s<e.length&&!((t-=2)<0);++s)n=(r=e.charCodeAt(s))>>8,i.push(r%256),i.push(n);return i}(e,this.length-u),this,u,d);default:if(p)throw TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),p=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},o.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,o.prototype),n},o.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||v(e,t,this.length);for(var n=this[e],i=1,s=0;++s<t&&(i*=256);)n+=this[e+s]*i;return n},o.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||v(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},o.prototype.readUInt8=function(e,t){return e>>>=0,t||v(e,1,this.length),this[e]},o.prototype.readUInt16LE=function(e,t){return e>>>=0,t||v(e,2,this.length),this[e]|this[e+1]<<8},o.prototype.readUInt16BE=function(e,t){return e>>>=0,t||v(e,2,this.length),this[e]<<8|this[e+1]},o.prototype.readUInt32LE=function(e,t){return e>>>=0,t||v(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+0x1000000*this[e+3]},o.prototype.readUInt32BE=function(e,t){return e>>>=0,t||v(e,4,this.length),0x1000000*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},o.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||v(e,t,this.length);for(var n=this[e],i=1,s=0;++s<t&&(i*=256);)n+=this[e+s]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*t)),n},o.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||v(e,t,this.length);for(var n=t,i=1,s=this[e+--n];n>0&&(i*=256);)s+=this[e+--n]*i;return s>=(i*=128)&&(s-=Math.pow(2,8*t)),s},o.prototype.readInt8=function(e,t){return(e>>>=0,t||v(e,1,this.length),128&this[e])?-((255-this[e]+1)*1):this[e]},o.prototype.readInt16LE=function(e,t){e>>>=0,t||v(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?0xffff0000|r:r},o.prototype.readInt16BE=function(e,t){e>>>=0,t||v(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?0xffff0000|r:r},o.prototype.readInt32LE=function(e,t){return e>>>=0,t||v(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},o.prototype.readInt32BE=function(e,t){return e>>>=0,t||v(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},o.prototype.readFloatLE=function(e,t){return e>>>=0,t||v(e,4,this.length),i.read(this,e,!0,23,4)},o.prototype.readFloatBE=function(e,t){return e>>>=0,t||v(e,4,this.length),i.read(this,e,!1,23,4)},o.prototype.readDoubleLE=function(e,t){return e>>>=0,t||v(e,8,this.length),i.read(this,e,!0,52,8)},o.prototype.readDoubleBE=function(e,t){return e>>>=0,t||v(e,8,this.length),i.read(this,e,!1,52,8)},o.prototype.writeUIntLE=function(e,t,r,n){if(e*=1,t>>>=0,r>>>=0,!n){var i=Math.pow(2,8*r)-1;b(this,e,t,r,i,0)}var s=1,a=0;for(this[t]=255&e;++a<r&&(s*=256);)this[t+a]=e/s&255;return t+r},o.prototype.writeUIntBE=function(e,t,r,n){if(e*=1,t>>>=0,r>>>=0,!n){var i=Math.pow(2,8*r)-1;b(this,e,t,r,i,0)}var s=r-1,a=1;for(this[t+s]=255&e;--s>=0&&(a*=256);)this[t+s]=e/a&255;return t+r},o.prototype.writeUInt8=function(e,t,r){return e*=1,t>>>=0,r||b(this,e,t,1,255,0),this[t]=255&e,t+1},o.prototype.writeUInt16LE=function(e,t,r){return e*=1,t>>>=0,r||b(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},o.prototype.writeUInt16BE=function(e,t,r){return e*=1,t>>>=0,r||b(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},o.prototype.writeUInt32LE=function(e,t,r){return e*=1,t>>>=0,r||b(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},o.prototype.writeUInt32BE=function(e,t,r){return e*=1,t>>>=0,r||b(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},o.prototype.writeIntLE=function(e,t,r,n){if(e*=1,t>>>=0,!n){var i=Math.pow(2,8*r-1);b(this,e,t,r,i-1,-i)}var s=0,a=1,o=0;for(this[t]=255&e;++s<r&&(a*=256);)e<0&&0===o&&0!==this[t+s-1]&&(o=1),this[t+s]=(e/a|0)-o&255;return t+r},o.prototype.writeIntBE=function(e,t,r,n){if(e*=1,t>>>=0,!n){var i=Math.pow(2,8*r-1);b(this,e,t,r,i-1,-i)}var s=r-1,a=1,o=0;for(this[t+s]=255&e;--s>=0&&(a*=256);)e<0&&0===o&&0!==this[t+s+1]&&(o=1),this[t+s]=(e/a|0)-o&255;return t+r},o.prototype.writeInt8=function(e,t,r){return e*=1,t>>>=0,r||b(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},o.prototype.writeInt16LE=function(e,t,r){return e*=1,t>>>=0,r||b(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},o.prototype.writeInt16BE=function(e,t,r){return e*=1,t>>>=0,r||b(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},o.prototype.writeInt32LE=function(e,t,r){return e*=1,t>>>=0,r||b(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},o.prototype.writeInt32BE=function(e,t,r){return e*=1,t>>>=0,r||b(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},o.prototype.writeFloatLE=function(e,t,r){return k(this,e,t,!0,r)},o.prototype.writeFloatBE=function(e,t,r){return k(this,e,t,!1,r)},o.prototype.writeDoubleLE=function(e,t,r){return S(this,e,t,!0,r)},o.prototype.writeDoubleBE=function(e,t,r){return S(this,e,t,!1,r)},o.prototype.copy=function(e,t,r,n){if(!o.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 s=i-1;s>=0;--s)e[s+t]=this[s+r];else Uint8Array.prototype.set.call(e,this.subarray(r,n),t);return i},o.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&&!o.isEncoding(n))throw TypeError("Unknown encoding: "+n);if(1===e.length){var i,s=e.charCodeAt(0);("utf8"===n&&s<128||"latin1"===n)&&(e=s)}}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 a=o.isBuffer(e)?e:o.from(e,n),l=a.length;if(0===l)throw TypeError('The value "'+e+'" is invalid for argument "value"');for(i=0;i<r-t;++i)this[i+t]=a[i%l]}return this};var j=/[^+/0-9A-Za-z-_]/g;function A(e,t){t=t||1/0;for(var r,n=e.length,i=null,s=[],a=0;a<n;++a){if((r=e.charCodeAt(a))>55295&&r<57344){if(!i){if(r>56319||a+1===n){(t-=3)>-1&&s.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&s.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(t-=3)>-1&&s.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;s.push(r)}else if(r<2048){if((t-=2)<0)break;s.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;s.push(r>>12|224,r>>6&63|128,63&r|128)}else if(r<1114112){if((t-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}else throw Error("Invalid code point")}return s}function N(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}function C(e){return n.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(j,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function _(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 T(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}var E=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 s,a,o=8*i-n-1,l=(1<<o)-1,c=l>>1,u=-7,d=r?i-1:0,h=r?-1:1,p=e[t+d];for(d+=h,s=p&(1<<-u)-1,p>>=-u,u+=o;u>0;s=256*s+e[t+d],d+=h,u-=8);for(a=s&(1<<-u)-1,s>>=-u,u+=n;u>0;a=256*a+e[t+d],d+=h,u-=8);if(0===s)s=1-c;else{if(s===l)return a?NaN:1/0*(p?-1:1);a+=Math.pow(2,n),s-=c}return(p?-1:1)*a*Math.pow(2,s-n)},t.write=function(e,t,r,n,i,s){var a,o,l,c=8*s-i-1,u=(1<<c)-1,d=u>>1,h=5960464477539062e-23*(23===i),p=n?0:s-1,m=n?1:-1,f=+(t<0||0===t&&1/t<0);for(isNaN(t=Math.abs(t))||t===1/0?(o=+!!isNaN(t),a=u):(a=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-a))<1&&(a--,l*=2),a+d>=1?t+=h/l:t+=h*Math.pow(2,1-d),t*l>=2&&(a++,l/=2),a+d>=u?(o=0,a=u):a+d>=1?(o=(t*l-1)*Math.pow(2,i),a+=d):(o=t*Math.pow(2,d-1)*Math.pow(2,i),a=0));i>=8;e[r+p]=255&o,p+=m,o/=256,i-=8);for(a=a<<i|o,c+=i;c>0;e[r+p]=255&a,p+=m,a/=256,c-=8);e[r+p-m]|=128*f}}},i={};function s(e){var t=i[e];if(void 0!==t)return t.exports;var r=i[e]={exports:{}},a=!0;try{n[e](r,r.exports,s),a=!1}finally{a&&delete i[e]}return r.exports}s.ab="/ROOT/web/node_modules/next/dist/compiled/buffer/",t.exports=s(72)},330460,e=>{"use strict";let t,r,n,i,s,a,o,l,c,u,d;var h,p,m,f,g,y,x,v=e.i(414294),b=e.i(430878),w=e.i(353913),k=e.i(292623),S=e.i(392295),j=e.i(770008),A=e.i(555552);let N=(0,j.cva)("inline-flex items-center justify-center rounded-full border border-transparent px-2.5 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1.5 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-all duration-200 overflow-hidden",{variants:{variant:{default:"bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border-border text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground",ghost:"[a&]:hover:bg-accent [a&]:hover:text-accent-foreground",link:"text-primary underline-offset-4 [a&]:hover:underline"}},defaultVariants:{variant:"default"}});function C({className:e,variant:t="default",asChild:r=!1,...n}){let i=r?S.Slot:"span";return(0,v.jsx)(i,{"data-slot":"badge","data-variant":t,className:(0,A.cn)(N({variant:t}),e),...n})}var _=e.i(666904),T=e.i(87614),E=e.i(292511);let P=(0,E.default)("arrow-down",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]),R={damping:.7,stiffness:.05,mass:1.25},M=1e3/60,L=!1;function I(e,t){let r=(0,b.useCallback)(t=>(r.current=t,e(t)),t);return r}globalThis.document?.addEventListener("mousedown",()=>{L=!0}),globalThis.document?.addEventListener("mouseup",()=>{L=!1}),globalThis.document?.addEventListener("click",()=>{L=!1});let D=new Map;function O(...e){let t={...R},r=!1;for(let n of e){if("instant"===n){r=!0;continue}"object"==typeof n&&(r=!1,t.damping=n.damping??t.damping,t.stiffness=n.stiffness??t.stiffness,t.mass=n.mass??t.mass)}let n=JSON.stringify(t);return D.has(n)||D.set(n,Object.freeze(t)),r?"instant":D.get(n)}let B=(0,b.createContext)(null),F="u">typeof window?b.useLayoutEffect:b.useEffect;function $({instance:e,children:t,resize:r,initial:n,mass:i,damping:s,stiffness:a,targetScrollTop:o,contextRef:l,...c}){let u=(0,b.useRef)(null),d=((e={})=>{let[t,r]=(0,b.useState)(!1),[n,i]=(0,b.useState)(!1!==e.initial),[s,a]=(0,b.useState)(!1),o=(0,b.useRef)(null);o.current=e;let l=(0,b.useCallback)(()=>{if(!L)return!1;let e=window.getSelection();if(!e||!e.rangeCount)return!1;let t=e.getRangeAt(0);return t.commonAncestorContainer.contains(g.current)||g.current?.contains(t.commonAncestorContainer)},[]),c=(0,b.useCallback)(e=>{d.isAtBottom=e,i(e)},[]),u=(0,b.useCallback)(e=>{d.escapedFromLock=e,r(e)},[]),d=(0,b.useMemo)(()=>{let r;return{escapedFromLock:t,isAtBottom:n,resizeDifference:0,accumulated:0,velocity:0,listeners:new Set,get scrollTop(){return g.current?.scrollTop??0},set scrollTop(scrollTop){g.current&&(g.current.scrollTop=scrollTop,d.ignoreScrollToTop=g.current.scrollTop)},get targetScrollTop(){if(!g.current||!y.current)return 0;return g.current.scrollHeight-1-g.current.clientHeight},get calculatedTargetScrollTop(){if(!g.current||!y.current)return 0;let{targetScrollTop:t}=this;if(!e.targetScrollTop)return t;if(r?.targetScrollTop===t)return r.calculatedScrollTop;let n=Math.max(Math.min(e.targetScrollTop(t,{scrollElement:g.current,contentElement:y.current}),t),0);return r={targetScrollTop:t,calculatedScrollTop:n},requestAnimationFrame(()=>{r=void 0}),n},get scrollDifference(){return this.calculatedTargetScrollTop-this.scrollTop},get isNearBottom(){return this.scrollDifference<=70}}},[]),h=(0,b.useCallback)((e={})=>{let t;"string"==typeof e&&(e={animation:e}),e.preserveScrollPosition||c(!0);let r=Date.now()+(Number(e.wait)||0),n=O(o.current,e.animation),{ignoreEscapes:i=!1}=e,s=d.calculatedTargetScrollTop;e.duration instanceof Promise?e.duration.finally(()=>{t=Date.now()}):t=r+(e.duration??0);let a=async()=>{let e=new Promise(requestAnimationFrame).then(()=>{if(!d.isAtBottom)return d.animation=void 0,!1;let{scrollTop:c}=d,u=performance.now(),p=(u-(d.lastTick??u))/M;if(d.animation||(d.animation={behavior:n,promise:e,ignoreEscapes:i}),d.animation.behavior===n&&(d.lastTick=u),l()||r>Date.now())return a();if(c<Math.min(s,d.calculatedTargetScrollTop)){if(d.animation?.behavior===n){if("instant"===n)return d.scrollTop=d.calculatedTargetScrollTop,a();d.velocity=(n.damping*d.velocity+n.stiffness*d.scrollDifference)/n.mass,d.accumulated+=d.velocity*p,d.scrollTop+=d.accumulated,d.scrollTop!==c&&(d.accumulated=0)}return a()}return t>Date.now()?(s=d.calculatedTargetScrollTop,a()):(d.animation=void 0,d.scrollTop<d.calculatedTargetScrollTop)?h({animation:O(o.current,o.current.resize),ignoreEscapes:i,duration:Math.max(0,t-Date.now())||void 0}):d.isAtBottom});return e.then(e=>(requestAnimationFrame(()=>{d.animation||(d.lastTick=void 0,d.velocity=0)}),e))};return(!0!==e.wait&&(d.animation=void 0),d.animation?.behavior===n)?d.animation.promise:a()},[c,l,d]),p=(0,b.useCallback)(()=>{u(!0),c(!1)},[u,c]),m=(0,b.useCallback)(({target:e})=>{if(e!==g.current)return;let{scrollTop:t,ignoreScrollToTop:r}=d,{lastScrollTop:n=t}=d;d.lastScrollTop=t,d.ignoreScrollToTop=void 0,r&&r>t&&(n=r),a(d.isNearBottom),setTimeout(()=>{if(d.resizeDifference||t===r)return;if(l()){u(!0),c(!1);return}let e=t>n,i=t<n;if(d.animation?.ignoreEscapes){d.scrollTop=n;return}i&&(u(!0),c(!1)),e&&u(!1),!d.escapedFromLock&&d.isNearBottom&&c(!0)},1)},[u,c,l,d]),f=(0,b.useCallback)(({target:e,deltaY:t})=>{let r=e;for(;!["scroll","auto"].includes(getComputedStyle(r).overflow);){if(!r.parentElement)return;r=r.parentElement}r===g.current&&t<0&&g.current.scrollHeight>g.current.clientHeight&&!d.animation?.ignoreEscapes&&(u(!0),c(!1))},[u,c,d]),g=I(e=>{g.current?.removeEventListener("scroll",m),g.current?.removeEventListener("wheel",f),e?.addEventListener("scroll",m,{passive:!0}),e?.addEventListener("wheel",f,{passive:!0})},[]),y=I(e=>{let t;d.resizeObserver?.disconnect(),e&&(d.resizeObserver=new ResizeObserver(([e])=>{let{height:r}=e.contentRect,n=r-(t??r);if(d.resizeDifference=n,d.scrollTop>d.targetScrollTop&&(d.scrollTop=d.targetScrollTop),a(d.isNearBottom),n>=0){let e=O(o.current,t?o.current.resize:o.current.initial);h({animation:e,wait:!0,preserveScrollPosition:!0,duration:"instant"===e?void 0:350})}else d.isNearBottom&&(u(!1),c(!0));t=r,requestAnimationFrame(()=>{setTimeout(()=>{d.resizeDifference===n&&(d.resizeDifference=0)},1)})}),d.resizeObserver?.observe(e))},[]);return{contentRef:y,scrollRef:g,scrollToBottom:h,stopScroll:p,isAtBottom:n||s,isNearBottom:s,escapedFromLock:t,state:d}})({mass:i,damping:s,stiffness:a,resize:r,initial:n,targetScrollTop:b.useCallback((e,t)=>{let r=v?.targetScrollTop??o;return r?.(e,t)??e},[o])}),{scrollRef:h,contentRef:p,scrollToBottom:m,stopScroll:f,isAtBottom:g,escapedFromLock:y,state:x}=e??d,v=(0,b.useMemo)(()=>({scrollToBottom:m,stopScroll:f,scrollRef:h,isAtBottom:g,escapedFromLock:y,contentRef:p,state:x,get targetScrollTop(){return u.current},set targetScrollTop(targetScrollTop){u.current=targetScrollTop}}),[m,g,p,h,f,y,x]);return(0,b.useImperativeHandle)(l,()=>v,[v]),F(()=>{h.current&&"visible"===getComputedStyle(h.current).overflow&&(h.current.style.overflow="auto")},[]),b.createElement(B.Provider,{value:v},b.createElement("div",{...c},"function"==typeof t?t(v):t))}function z(){let e=(0,b.useContext)(B);if(!e)throw Error("use-stick-to-bottom component context must be used within a StickToBottom component");return e}($||($={})).Content=function({children:e,scrollClassName:t,...r}){let n=z();return b.createElement("div",{ref:n.scrollRef,style:{height:"100%",width:"100%",scrollbarGutter:"stable both-edges"},className:t},b.createElement("div",{...r,ref:n.contentRef},"function"==typeof e?e(n):e))};let V=({className:e,...t})=>(0,v.jsx)($,{className:(0,A.cn)("relative flex-1 overflow-y-hidden",e),initial:"smooth",resize:"smooth",role:"log",...t}),U=({className:e,...t})=>(0,v.jsx)($.Content,{className:(0,A.cn)("flex flex-col gap-8 p-4",e),...t}),G=({className:e,title:t="No messages yet",description:r="Start a conversation to see messages here",icon:n,children:i,...s})=>(0,v.jsx)("div",{className:(0,A.cn)("flex size-full flex-col items-center justify-center gap-4 p-8 text-center",e),...s,children:i??(0,v.jsxs)(v.Fragment,{children:[n&&(0,v.jsx)("div",{className:"text-muted-foreground/50 p-4 rounded-2xl bg-muted/30",children:n}),(0,v.jsxs)("div",{className:"space-y-2",children:[(0,v.jsx)("h3",{className:"font-semibold text-base text-foreground",children:t}),r&&(0,v.jsx)("p",{className:"text-muted-foreground text-sm max-w-xs",children:r})]})]})}),W=({className:e,...t})=>{let{isAtBottom:r,scrollToBottom:n}=z(),i=(0,b.useCallback)(()=>{n()},[n]);return!r&&(0,v.jsx)(_.Button,{className:(0,A.cn)("absolute bottom-4 left-[50%] translate-x-[-50%] rounded-full dark:bg-background dark:hover:bg-muted",e),onClick:i,size:"icon",type:"button",variant:"outline",...t,children:(0,v.jsx)(P,{className:"size-4"})})};e.i(534432),(0,j.cva)("flex w-fit items-stretch [&>*]:focus-visible:z-10 [&>*]:focus-visible:relative [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-md has-[>[data-slot=button-group]]:gap-2",{variants:{orientation:{horizontal:"[&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none",vertical:"flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none"}},defaultVariants:{orientation:"horizontal"}});var H=e.i(47513),q=e.i(725656),K=Object.defineProperty,Y=J(/\p{P}|\p{S}/u),X=J(/\s/);function J(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCodePoint(t))}}function Z(e){if(null===e||(0,q.markdownLineEndingOrSpace)(e)||X(e))return 1;let t=0;if(e>=4352){if(null!==e&&e>=65024&&e<=65038)return y.nonEmojiGeneralUseVS;switch(function(e){if(!e||e<4352)return!1;switch(function(e){if(!Number.isSafeInteger(e))throw TypeError(`Expected a code point, got \`${typeof e}\`.`);return 161===e||164===e||167===e||168===e||170===e||173===e||174===e||e>=176&&e<=180||e>=182&&e<=186||e>=188&&e<=191||198===e||208===e||215===e||216===e||e>=222&&e<=225||230===e||e>=232&&e<=234||236===e||237===e||240===e||242===e||243===e||e>=247&&e<=250||252===e||254===e||257===e||273===e||275===e||283===e||294===e||295===e||299===e||e>=305&&e<=307||312===e||e>=319&&e<=322||324===e||e>=328&&e<=331||333===e||338===e||339===e||358===e||359===e||363===e||462===e||464===e||466===e||468===e||470===e||472===e||474===e||476===e||593===e||609===e||708===e||711===e||e>=713&&e<=715||717===e||720===e||e>=728&&e<=731||733===e||735===e||e>=768&&e<=879||e>=913&&e<=929||e>=931&&e<=937||e>=945&&e<=961||e>=963&&e<=969||1025===e||e>=1040&&e<=1103||1105===e||8208===e||e>=8211&&e<=8214||8216===e||8217===e||8220===e||8221===e||e>=8224&&e<=8226||e>=8228&&e<=8231||8240===e||8242===e||8243===e||8245===e||8251===e||8254===e||8308===e||8319===e||e>=8321&&e<=8324||8364===e||8451===e||8453===e||8457===e||8467===e||8470===e||8481===e||8482===e||8486===e||8491===e||8531===e||8532===e||e>=8539&&e<=8542||e>=8544&&e<=8555||e>=8560&&e<=8569||8585===e||e>=8592&&e<=8601||8632===e||8633===e||8658===e||8660===e||8679===e||8704===e||8706===e||8707===e||8711===e||8712===e||8715===e||8719===e||8721===e||8725===e||8730===e||e>=8733&&e<=8736||8739===e||8741===e||e>=8743&&e<=8748||8750===e||e>=8756&&e<=8759||8764===e||8765===e||8776===e||8780===e||8786===e||8800===e||8801===e||e>=8804&&e<=8807||8810===e||8811===e||8814===e||8815===e||8834===e||8835===e||8838===e||8839===e||8853===e||8857===e||8869===e||8895===e||8978===e||e>=9312&&e<=9449||e>=9451&&e<=9547||e>=9552&&e<=9587||e>=9600&&e<=9615||e>=9618&&e<=9621||9632===e||9633===e||e>=9635&&e<=9641||9650===e||9651===e||9654===e||9655===e||9660===e||9661===e||9664===e||9665===e||e>=9670&&e<=9672||9675===e||e>=9678&&e<=9681||e>=9698&&e<=9701||9711===e||9733===e||9734===e||9737===e||9742===e||9743===e||9756===e||9758===e||9792===e||9794===e||9824===e||9825===e||e>=9827&&e<=9829||e>=9831&&e<=9834||9836===e||9837===e||9839===e||9886===e||9887===e||9919===e||e>=9926&&e<=9933||e>=9935&&e<=9939||e>=9941&&e<=9953||9955===e||9960===e||9961===e||e>=9963&&e<=9969||9972===e||e>=9974&&e<=9977||9979===e||9980===e||9982===e||9983===e||10045===e||e>=10102&&e<=10111||e>=11094&&e<=11097||e>=12872&&e<=12879||e>=57344&&e<=63743||e>=65024&&e<=65039||65533===e||e>=127232&&e<=127242||e>=127248&&e<=127277||e>=127280&&e<=127337||e>=127344&&e<=127373||127375===e||127376===e||e>=127387&&e<=127404||e>=917760&&e<=917999||e>=983040&&e<=1048573||e>=1048576&&e<=1114109?"ambiguous":12288===e||e>=65281&&e<=65376||e>=65504&&e<=65510?"fullwidth":8361===e||e>=65377&&e<=65470||e>=65474&&e<=65479||e>=65482&&e<=65487||e>=65490&&e<=65495||e>=65498&&e<=65500||e>=65512&&e<=65518?"halfwidth":e>=32&&e<=126||162===e||163===e||165===e||166===e||172===e||175===e||e>=10214&&e<=10221||10629===e||10630===e?"narrow":e>=4352&&e<=4447||8986===e||8987===e||9001===e||9002===e||e>=9193&&e<=9196||9200===e||9203===e||9725===e||9726===e||9748===e||9749===e||e>=9776&&e<=9783||e>=9800&&e<=9811||9855===e||e>=9866&&e<=9871||9875===e||9889===e||9898===e||9899===e||9917===e||9918===e||9924===e||9925===e||9934===e||9940===e||9962===e||9970===e||9971===e||9973===e||9978===e||9981===e||9989===e||9994===e||9995===e||10024===e||10060===e||10062===e||e>=10067&&e<=10069||10071===e||e>=10133&&e<=10135||10160===e||10175===e||11035===e||11036===e||11088===e||11093===e||e>=11904&&e<=11929||e>=11931&&e<=12019||e>=12032&&e<=12245||e>=12272&&e<=12287||e>=12289&&e<=12350||e>=12353&&e<=12438||e>=12441&&e<=12543||e>=12549&&e<=12591||e>=12593&&e<=12686||e>=12688&&e<=12773||e>=12783&&e<=12830||e>=12832&&e<=12871||e>=12880&&e<=42124||e>=42128&&e<=42182||e>=43360&&e<=43388||e>=44032&&e<=55203||e>=63744&&e<=64255||e>=65040&&e<=65049||e>=65072&&e<=65106||e>=65108&&e<=65126||e>=65128&&e<=65131||e>=94176&&e<=94180||e>=94192&&e<=94198||e>=94208&&e<=101589||e>=101631&&e<=101662||e>=101760&&e<=101874||e>=110576&&e<=110579||e>=110581&&e<=110587||110589===e||110590===e||e>=110592&&e<=110882||110898===e||e>=110928&&e<=110930||110933===e||e>=110948&&e<=110951||e>=110960&&e<=111355||e>=119552&&e<=119638||e>=119648&&e<=119670||126980===e||127183===e||127374===e||e>=127377&&e<=127386||e>=127488&&e<=127490||e>=127504&&e<=127547||e>=127552&&e<=127560||127568===e||127569===e||e>=127584&&e<=127589||e>=127744&&e<=127776||e>=127789&&e<=127797||e>=127799&&e<=127868||e>=127870&&e<=127891||e>=127904&&e<=127946||e>=127951&&e<=127955||e>=127968&&e<=127984||127988===e||e>=127992&&e<=128062||128064===e||e>=128066&&e<=128252||e>=128255&&e<=128317||e>=128331&&e<=128334||e>=128336&&e<=128359||128378===e||128405===e||128406===e||128420===e||e>=128507&&e<=128591||e>=128640&&e<=128709||128716===e||e>=128720&&e<=128722||e>=128725&&e<=128728||e>=128732&&e<=128735||128747===e||128748===e||e>=128756&&e<=128764||e>=128992&&e<=129003||129008===e||e>=129292&&e<=129338||e>=129340&&e<=129349||e>=129351&&e<=129535||e>=129648&&e<=129660||e>=129664&&e<=129674||e>=129678&&e<=129734||129736===e||e>=129741&&e<=129756||e>=129759&&e<=129770||e>=129775&&e<=129784||e>=131072&&e<=196605||e>=196608&&e<=262141?"wide":"neutral"}(e)){case"fullwidth":case"halfwidth":return!0;case"wide":return!/^\p{Emoji_Presentation}/u.test(String.fromCodePoint(e));case"narrow":return!1;case"ambiguous":return 917760<=e&&e<=917999&&null;case"neutral":return/^\p{sc=Hangul}/u.test(String.fromCodePoint(e))}}(e)){case null:return y.ivs;case!0:t|=y.cjk}}return Y(e)&&(t|=2),t}function Q(e,t,r){if(e!==y.nonEmojiGeneralUseVS)return e;let n=t(),i=Z(n);return!n||1&i?e:65025===r&&n&&!(n<8216)&&(8216===n||8217===n||8220===n||8221===n)?y.cjkPunctuation:i&~y.ivs}(h=y||(y={})).spaceOrPunctuation=3,h.cjk=4096,h.cjkPunctuation=4098,h.ivs=8192,h.cjkOrIvs=12288,h.nonEmojiGeneralUseVS=16384,h.variationSelector=24576,h.ivsToCjkRightShift=1;function ee(e){return(e&y.cjkPunctuation)==2}function et(e){return!!(e&y.cjk)}function er(e){return!!(e&y.spaceOrPunctuation)}function en(e){return!!(e&&e>=55296&&e<=56319)}function ei(e){return!!(e&&e>=56320&&e<=57343)}function es(e,t,r){if(t._bufferIndex<2)return e;let n=r({start:{...t,_bufferIndex:t._bufferIndex-2},end:t}).codePointAt(0);return n&&n>=65536?n:e}var ea=class{constructor(e,t,r){this.previousCode=e,this.nowPoint=t,this.sliceSerialize=r,((e,t,r)=>{let n;return(n="symbol"!=typeof t?t+"":t)in e?K(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r})(this,"cachedValue")}value(){return void 0===this.cachedValue&&(this.cachedValue=function(e,t,r){let n=e>=65536?2:1;if(t._bufferIndex<1+n)return null;let i=t._bufferIndex-n-2,s=r({start:{...t,_bufferIndex:i>=0?i:0},end:{...t,_bufferIndex:t._bufferIndex-n}}),a=s.charCodeAt(s.length-1);if(Number.isNaN(a))return null;if(s.length<2||a<56320||57343<a)return a;let o=s.codePointAt(0);return o&&o>=65536?o:a}(this.previousCode,this.nowPoint,this.sliceSerialize)),this.cachedValue}};function eo(e,t,r){let n=r({start:t,end:{...t,_bufferIndex:t._bufferIndex+2}}).codePointAt(0);return n&&n>=65536?n:e}var el=e.i(171142),ec=e.i(672742);let eu="emphasisSequence",ed="strongSequence";var eh={name:"attention",resolveAll:function(e,t){let r,n,i,s,a,o,l,c,u=-1;for(;++u<e.length;)if("enter"===e[u][0]&&"attentionSequence"===e[u][1].type&&e[u][1]._close){for(r=u;r--;)if("exit"===e[r][0]&&"attentionSequence"===e[r][1].type&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[u][1]).charCodeAt(0)){if((e[r][1]._close||e[u][1]._open)&&(e[u][1].end.offset-e[u][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[u][1].end.offset-e[u][1].start.offset)%3))continue;o=e[r][1].end.offset-e[r][1].start.offset>1&&e[u][1].end.offset-e[u][1].start.offset>1?2:1;let d={...e[r][1].end},h={...e[u][1].start};ep(d,-o),ep(h,o),s={type:o>1?ed:eu,start:d,end:{...e[r][1].end}},a={type:o>1?ed:eu,start:{...e[u][1].start},end:h},i={type:o>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[u][1].start}},n={type:o>1?"strong":"emphasis",start:{...s.start},end:{...a.end}},e[r][1].end={...s.start},e[u][1].start={...a.end},l=[],e[r][1].end.offset-e[r][1].start.offset&&(l=(0,el.push)(l,[["enter",e[r][1],t],["exit",e[r][1],t]])),l=(0,el.push)(l,[["enter",n,t],["enter",s,t],["exit",s,t],["enter",i,t]]),(0,H.ok)(t.parser.constructs.insideSpan.null,"expected `insideSpan` to be populated"),l=(0,el.push)(l,(0,ec.resolveAll)(t.parser.constructs.insideSpan.null,e.slice(r+1,u),t)),l=(0,el.push)(l,[["exit",i,t],["enter",a,t],["exit",a,t],["exit",n,t]]),e[u][1].end.offset-e[u][1].start.offset?(c=2,l=(0,el.push)(l,[["enter",e[u][1],t],["exit",e[u][1],t]])):c=0,(0,el.splice)(e,r-1,u-r+3,l),u=r+l.length-c-2;break}}for(u=-1;++u<e.length;)"attentionSequence"===e[u][1].type&&(e[u][1].type="data");return e},tokenize:function(e,t){let r,n=this.parser.constructs.attentionMarkers.null,{now:i,sliceSerialize:s,previous:a}=this,o=ei(a)?es(a,i(),s):a,l=Z(o),c=new ea(o,i(),s),u=Q(l,c.value.bind(c),o);return function(a){return(0,H.ok)(42===a||95===a,"expected asterisk or underscore"),r=a,e.enter("attentionSequence"),function a(l){if(l===r)return e.consume(l),a;let c=e.exit("attentionSequence"),d=Z(en(l)?eo(l,i(),s):l);(0,H.ok)(n,"expected `attentionMarkers` to be populated");let h=ee(u),p=h||!!(1&u),m=ee(d),f=m||!!(1&d),g=!!(u&y.cjkOrIvs),x=!f||m&&(p||g)||n.includes(l),v=!p||h&&(f||et(d))||n.includes(o);return c._open=!!(42===r?x:x&&(er(u)||!v)),c._close=!!(42===r?v:v&&(er(d)||!x)),t(l)}(a)}}};function ep(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var em=e.i(73033),ef=new Set(["。",".",",","、","?","!",":",";","(",")","【","】","「","」","『","』","〈","〉","《","》"]),eg=/^(https?:\/\/|mailto:|www\.)/i,ey=(a=[...i=[function(){let e=this.data();(e.micromarkExtensions||(e.micromarkExtensions=[])).push({text:{42:eh,95:eh},insideSpan:{null:[eh]}})}],...s=[()=>e=>{(0,em.visit)(e,"link",(e,t,r)=>{if(!r||"number"!=typeof t||!(e=>{if(1!==e.children.length)return!1;let t=e.children[0];return"text"===t.type&&t.value===e.url})(e)||!eg.test(e.url))return;let n=(e=>{let t=0;for(let r of e){if(ef.has(r))return t;t+=r.length}return null})(e.url);if(null===n||0===n)return;let i=e.url.slice(0,n),s=e.url.slice(n),a={...e,url:i,children:[{type:"text",value:i}]};return r.children.splice(t,1,a,{type:"text",value:s}),t+1})},function(e){let t,r,n=this.data();(n.micromarkExtensions||(n.micromarkExtensions=[])).push((t=(e||{}).singleTilde,r={name:"strikethrough",tokenize:function(e,r,n){let{now:i,sliceSerialize:s,previous:a}=this,o=ei(a)?es(a,i(),s):a,l=Z(o),c=new ea(o,i(),s),u=Q(l,c.value.bind(c),o),d=this.events,h=0;return function(a){return((0,H.ok)(126===a,"expected `~`"),126===o&&"characterEscape"!==d[d.length-1][1].type)?n(a):(e.enter("strikethroughSequenceTemporary"),function a(l){let c=Z(o);if(126===l)return h>1?n(l):(e.consume(l),h++,a);if(h<2&&!t)return n(l);let d=e.exit("strikethroughSequenceTemporary"),p=Z(en(l)?eo(l,i(),s):l),m=ee(u)||!!(1&u),f=ee(p)||!!(1&p),g=et(u)||c===y.ivs;return d._open=!f||2===p&&(m||g),d._close=!m||2===c&&(f||et(p)),r(l)}(a))}},resolveAll:function(e,t){let r=-1;for(;++r<e.length;)if("enter"===e[r][0]&&"strikethroughSequenceTemporary"===e[r][1].type&&e[r][1]._close){let n=r;for(;n--;)if("exit"===e[n][0]&&"strikethroughSequenceTemporary"===e[n][1].type&&e[n][1]._open&&e[r][1].end.offset-e[r][1].start.offset==e[n][1].end.offset-e[n][1].start.offset){e[r][1].type="strikethroughSequence",e[n][1].type="strikethroughSequence";let i={type:"strikethrough",start:Object.assign({},e[n][1].start),end:Object.assign({},e[r][1].end)},s={type:"strikethroughText",start:Object.assign({},e[n][1].end),end:Object.assign({},e[r][1].start)},a=[["enter",i,t],["enter",e[n][1],t],["exit",e[n][1],t],["enter",s,t]],o=t.parser.constructs.insideSpan.null;o&&(0,el.splice)(a,a.length,0,(0,ec.resolveAll)(o,e.slice(n+1,r),t)),(0,el.splice)(a,a.length,0,[["exit",s,t],["enter",e[r][1],t],["exit",e[r][1],t],["exit",i,t]]),(0,el.splice)(e,n-1,r-n+3,a),r=n+a.length-2;break}}for(r=-1;++r<e.length;)"strikethroughSequenceTemporary"===e[r][1].type&&(e[r][1].type="data");return e}},null==t&&(t=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}}))}]],{name:"cjk",type:"cjk",remarkPluginsBefore:i,remarkPluginsAfter:s,remarkPlugins:a});let ex=[{id:"abap",name:"ABAP",import:()=>e.A(424922)},{id:"actionscript-3",name:"ActionScript",import:()=>e.A(168873)},{id:"ada",name:"Ada",import:()=>e.A(267555)},{id:"angular-html",name:"Angular HTML",import:()=>e.A(273354)},{id:"angular-ts",name:"Angular TypeScript",import:()=>e.A(601681)},{id:"apache",name:"Apache Conf",import:()=>e.A(780677)},{id:"apex",name:"Apex",import:()=>e.A(832664)},{id:"apl",name:"APL",import:()=>e.A(759864)},{id:"applescript",name:"AppleScript",import:()=>e.A(748203)},{id:"ara",name:"Ara",import:()=>e.A(710100)},{id:"asciidoc",name:"AsciiDoc",aliases:["adoc"],import:()=>e.A(665143)},{id:"asm",name:"Assembly",import:()=>e.A(552321)},{id:"astro",name:"Astro",import:()=>e.A(96633)},{id:"awk",name:"AWK",import:()=>e.A(731195)},{id:"ballerina",name:"Ballerina",import:()=>e.A(9251)},{id:"bat",name:"Batch File",aliases:["batch"],import:()=>e.A(52303)},{id:"beancount",name:"Beancount",import:()=>e.A(326771)},{id:"berry",name:"Berry",aliases:["be"],import:()=>e.A(934449)},{id:"bibtex",name:"BibTeX",import:()=>e.A(74926)},{id:"bicep",name:"Bicep",import:()=>e.A(257442)},{id:"blade",name:"Blade",import:()=>e.A(240923)},{id:"bsl",name:"1C (Enterprise)",aliases:["1c"],import:()=>e.A(52297)},{id:"c",name:"C",import:()=>e.A(95831)},{id:"c3",name:"C3",import:()=>e.A(336373)},{id:"cadence",name:"Cadence",aliases:["cdc"],import:()=>e.A(172636)},{id:"cairo",name:"Cairo",import:()=>e.A(751803)},{id:"clarity",name:"Clarity",import:()=>e.A(615206)},{id:"clojure",name:"Clojure",aliases:["clj"],import:()=>e.A(886435)},{id:"cmake",name:"CMake",import:()=>e.A(208400)},{id:"cobol",name:"COBOL",import:()=>e.A(774210)},{id:"codeowners",name:"CODEOWNERS",import:()=>e.A(325806)},{id:"codeql",name:"CodeQL",aliases:["ql"],import:()=>e.A(454881)},{id:"coffee",name:"CoffeeScript",aliases:["coffeescript"],import:()=>e.A(728920)},{id:"common-lisp",name:"Common Lisp",aliases:["lisp"],import:()=>e.A(556516)},{id:"coq",name:"Coq",import:()=>e.A(768810)},{id:"cpp",name:"C++",aliases:["c++"],import:()=>e.A(36055)},{id:"crystal",name:"Crystal",import:()=>e.A(378958)},{id:"csharp",name:"C#",aliases:["c#","cs"],import:()=>e.A(848127)},{id:"css",name:"CSS",import:()=>e.A(904556)},{id:"csv",name:"CSV",import:()=>e.A(347771)},{id:"cue",name:"CUE",import:()=>e.A(686137)},{id:"cypher",name:"Cypher",aliases:["cql"],import:()=>e.A(949690)},{id:"d",name:"D",import:()=>e.A(183836)},{id:"dart",name:"Dart",import:()=>e.A(290920)},{id:"dax",name:"DAX",import:()=>e.A(613593)},{id:"desktop",name:"Desktop",import:()=>e.A(294887)},{id:"diff",name:"Diff",import:()=>e.A(538357)},{id:"docker",name:"Dockerfile",aliases:["dockerfile"],import:()=>e.A(741723)},{id:"dotenv",name:"dotEnv",import:()=>e.A(105283)},{id:"dream-maker",name:"Dream Maker",import:()=>e.A(392999)},{id:"edge",name:"Edge",import:()=>e.A(619029)},{id:"elixir",name:"Elixir",import:()=>e.A(679713)},{id:"elm",name:"Elm",import:()=>e.A(25691)},{id:"emacs-lisp",name:"Emacs Lisp",aliases:["elisp"],import:()=>e.A(86556)},{id:"erb",name:"ERB",import:()=>e.A(310443)},{id:"erlang",name:"Erlang",aliases:["erl"],import:()=>e.A(994828)},{id:"fennel",name:"Fennel",import:()=>e.A(684352)},{id:"fish",name:"Fish",import:()=>e.A(137028)},{id:"fluent",name:"Fluent",aliases:["ftl"],import:()=>e.A(837437)},{id:"fortran-fixed-form",name:"Fortran (Fixed Form)",aliases:["f","for","f77"],import:()=>e.A(785635)},{id:"fortran-free-form",name:"Fortran (Free Form)",aliases:["f90","f95","f03","f08","f18"],import:()=>e.A(415116)},{id:"fsharp",name:"F#",aliases:["f#","fs"],import:()=>e.A(891657)},{id:"gdresource",name:"GDResource",import:()=>e.A(693084)},{id:"gdscript",name:"GDScript",import:()=>e.A(445204)},{id:"gdshader",name:"GDShader",import:()=>e.A(975967)},{id:"genie",name:"Genie",import:()=>e.A(267018)},{id:"gherkin",name:"Gherkin",import:()=>e.A(309317)},{id:"git-commit",name:"Git Commit Message",import:()=>e.A(388952)},{id:"git-rebase",name:"Git Rebase Message",import:()=>e.A(455006)},{id:"gleam",name:"Gleam",import:()=>e.A(283831)},{id:"glimmer-js",name:"Glimmer JS",aliases:["gjs"],import:()=>e.A(87687)},{id:"glimmer-ts",name:"Glimmer TS",aliases:["gts"],import:()=>e.A(726414)},{id:"glsl",name:"GLSL",import:()=>e.A(712039)},{id:"gn",name:"GN",import:()=>e.A(105287)},{id:"gnuplot",name:"Gnuplot",import:()=>e.A(58916)},{id:"go",name:"Go",import:()=>e.A(465381)},{id:"graphql",name:"GraphQL",aliases:["gql"],import:()=>e.A(398913)},{id:"groovy",name:"Groovy",import:()=>e.A(344283)},{id:"hack",name:"Hack",import:()=>e.A(310258)},{id:"haml",name:"Ruby Haml",import:()=>e.A(196446)},{id:"handlebars",name:"Handlebars",aliases:["hbs"],import:()=>e.A(78905)},{id:"haskell",name:"Haskell",aliases:["hs"],import:()=>e.A(808975)},{id:"haxe",name:"Haxe",import:()=>e.A(64439)},{id:"hcl",name:"HashiCorp HCL",import:()=>e.A(280445)},{id:"hjson",name:"Hjson",import:()=>e.A(822969)},{id:"hlsl",name:"HLSL",import:()=>e.A(590834)},{id:"html",name:"HTML",import:()=>e.A(407645)},{id:"html-derivative",name:"HTML (Derivative)",import:()=>e.A(115233)},{id:"http",name:"HTTP",import:()=>e.A(895764)},{id:"hurl",name:"Hurl",import:()=>e.A(172420)},{id:"hxml",name:"HXML",import:()=>e.A(987718)},{id:"hy",name:"Hy",import:()=>e.A(38679)},{id:"imba",name:"Imba",import:()=>e.A(787201)},{id:"ini",name:"INI",aliases:["properties"],import:()=>e.A(980017)},{id:"java",name:"Java",import:()=>e.A(144131)},{id:"javascript",name:"JavaScript",aliases:["js","cjs","mjs"],import:()=>e.A(502431)},{id:"jinja",name:"Jinja",import:()=>e.A(729473)},{id:"jison",name:"Jison",import:()=>e.A(576554)},{id:"json",name:"JSON",import:()=>e.A(113295)},{id:"json5",name:"JSON5",import:()=>e.A(991170)},{id:"jsonc",name:"JSON with Comments",import:()=>e.A(26929)},{id:"jsonl",name:"JSON Lines",import:()=>e.A(281787)},{id:"jsonnet",name:"Jsonnet",import:()=>e.A(808302)},{id:"jssm",name:"JSSM",aliases:["fsl"],import:()=>e.A(514714)},{id:"jsx",name:"JSX",import:()=>e.A(941751)},{id:"julia",name:"Julia",aliases:["jl"],import:()=>e.A(44535)},{id:"kdl",name:"KDL",import:()=>e.A(694401)},{id:"kotlin",name:"Kotlin",aliases:["kt","kts"],import:()=>e.A(580413)},{id:"kusto",name:"Kusto",aliases:["kql"],import:()=>e.A(681665)},{id:"latex",name:"LaTeX",import:()=>e.A(378842)},{id:"lean",name:"Lean 4",aliases:["lean4"],import:()=>e.A(214730)},{id:"less",name:"Less",import:()=>e.A(553944)},{id:"liquid",name:"Liquid",import:()=>e.A(834697)},{id:"llvm",name:"LLVM IR",import:()=>e.A(472126)},{id:"log",name:"Log file",import:()=>e.A(485531)},{id:"logo",name:"Logo",import:()=>e.A(336844)},{id:"lua",name:"Lua",import:()=>e.A(251683)},{id:"luau",name:"Luau",import:()=>e.A(470369)},{id:"make",name:"Makefile",aliases:["makefile"],import:()=>e.A(233461)},{id:"markdown",name:"Markdown",aliases:["md"],import:()=>e.A(803482)},{id:"marko",name:"Marko",import:()=>e.A(948534)},{id:"matlab",name:"MATLAB",import:()=>e.A(301121)},{id:"mdc",name:"MDC",import:()=>e.A(602420)},{id:"mdx",name:"MDX",import:()=>e.A(506813)},{id:"mermaid",name:"Mermaid",aliases:["mmd"],import:()=>e.A(140850)},{id:"mipsasm",name:"MIPS Assembly",aliases:["mips"],import:()=>e.A(549647)},{id:"mojo",name:"Mojo",import:()=>e.A(962276)},{id:"moonbit",name:"MoonBit",aliases:["mbt","mbti"],import:()=>e.A(488064)},{id:"move",name:"Move",import:()=>e.A(935257)},{id:"narrat",name:"Narrat Language",aliases:["nar"],import:()=>e.A(145171)},{id:"nextflow",name:"Nextflow",aliases:["nf"],import:()=>e.A(371822)},{id:"nginx",name:"Nginx",import:()=>e.A(670410)},{id:"nim",name:"Nim",import:()=>e.A(339255)},{id:"nix",name:"Nix",import:()=>e.A(868854)},{id:"nushell",name:"nushell",aliases:["nu"],import:()=>e.A(22667)},{id:"objective-c",name:"Objective-C",aliases:["objc"],import:()=>e.A(436910)},{id:"objective-cpp",name:"Objective-C++",import:()=>e.A(507940)},{id:"ocaml",name:"OCaml",import:()=>e.A(55452)},{id:"openscad",name:"OpenSCAD",aliases:["scad"],import:()=>e.A(933900)},{id:"pascal",name:"Pascal",import:()=>e.A(246481)},{id:"perl",name:"Perl",import:()=>e.A(325975)},{id:"php",name:"PHP",import:()=>e.A(832212)},{id:"pkl",name:"Pkl",import:()=>e.A(929773)},{id:"plsql",name:"PL/SQL",import:()=>e.A(997293)},{id:"po",name:"Gettext PO",aliases:["pot","potx"],import:()=>e.A(948438)},{id:"polar",name:"Polar",import:()=>e.A(714648)},{id:"postcss",name:"PostCSS",import:()=>e.A(378567)},{id:"powerquery",name:"PowerQuery",import:()=>e.A(656940)},{id:"powershell",name:"PowerShell",aliases:["ps","ps1"],import:()=>e.A(197812)},{id:"prisma",name:"Prisma",import:()=>e.A(286754)},{id:"prolog",name:"Prolog",import:()=>e.A(714818)},{id:"proto",name:"Protocol Buffer 3",aliases:["protobuf"],import:()=>e.A(26675)},{id:"pug",name:"Pug",aliases:["jade"],import:()=>e.A(694488)},{id:"puppet",name:"Puppet",import:()=>e.A(118886)},{id:"purescript",name:"PureScript",import:()=>e.A(354419)},{id:"python",name:"Python",aliases:["py"],import:()=>e.A(196728)},{id:"qml",name:"QML",import:()=>e.A(850381)},{id:"qmldir",name:"QML Directory",import:()=>e.A(776789)},{id:"qss",name:"Qt Style Sheets",import:()=>e.A(988321)},{id:"r",name:"R",import:()=>e.A(577036)},{id:"racket",name:"Racket",import:()=>e.A(733419)},{id:"raku",name:"Raku",aliases:["perl6"],import:()=>e.A(755698)},{id:"razor",name:"ASP.NET Razor",import:()=>e.A(525413)},{id:"reg",name:"Windows Registry Script",import:()=>e.A(871580)},{id:"regexp",name:"RegExp",aliases:["regex"],import:()=>e.A(719347)},{id:"rel",name:"Rel",import:()=>e.A(418074)},{id:"riscv",name:"RISC-V",import:()=>e.A(248688)},{id:"rosmsg",name:"ROS Interface",import:()=>e.A(417101)},{id:"rst",name:"reStructuredText",import:()=>e.A(205156)},{id:"ruby",name:"Ruby",aliases:["rb"],import:()=>e.A(616617)},{id:"rust",name:"Rust",aliases:["rs"],import:()=>e.A(712841)},{id:"sas",name:"SAS",import:()=>e.A(407559)},{id:"sass",name:"Sass",import:()=>e.A(329481)},{id:"scala",name:"Scala",import:()=>e.A(906092)},{id:"scheme",name:"Scheme",import:()=>e.A(99440)},{id:"scss",name:"SCSS",import:()=>e.A(280679)},{id:"sdbl",name:"1C (Query)",aliases:["1c-query"],import:()=>e.A(54004)},{id:"shaderlab",name:"ShaderLab",aliases:["shader"],import:()=>e.A(529105)},{id:"shellscript",name:"Shell",aliases:["bash","sh","shell","zsh"],import:()=>e.A(430026)},{id:"shellsession",name:"Shell Session",aliases:["console"],import:()=>e.A(681262)},{id:"smalltalk",name:"Smalltalk",import:()=>e.A(429843)},{id:"solidity",name:"Solidity",import:()=>e.A(790483)},{id:"soy",name:"Closure Templates",aliases:["closure-templates"],import:()=>e.A(66378)},{id:"sparql",name:"SPARQL",import:()=>e.A(14166)},{id:"splunk",name:"Splunk Query Language",aliases:["spl"],import:()=>e.A(825194)},{id:"sql",name:"SQL",import:()=>e.A(486478)},{id:"ssh-config",name:"SSH Config",import:()=>e.A(29704)},{id:"stata",name:"Stata",import:()=>e.A(205697)},{id:"stylus",name:"Stylus",aliases:["styl"],import:()=>e.A(561937)},{id:"svelte",name:"Svelte",import:()=>e.A(69149)},{id:"swift",name:"Swift",import:()=>e.A(558167)},{id:"system-verilog",name:"SystemVerilog",import:()=>e.A(471804)},{id:"systemd",name:"Systemd Units",import:()=>e.A(699598)},{id:"talonscript",name:"TalonScript",aliases:["talon"],import:()=>e.A(224168)},{id:"tasl",name:"Tasl",import:()=>e.A(268280)},{id:"tcl",name:"Tcl",import:()=>e.A(341811)},{id:"templ",name:"Templ",import:()=>e.A(760495)},{id:"terraform",name:"Terraform",aliases:["tf","tfvars"],import:()=>e.A(983690)},{id:"tex",name:"TeX",import:()=>e.A(981895)},{id:"toml",name:"TOML",import:()=>e.A(523467)},{id:"ts-tags",name:"TypeScript with Tags",aliases:["lit"],import:()=>e.A(70493)},{id:"tsv",name:"TSV",import:()=>e.A(528966)},{id:"tsx",name:"TSX",import:()=>e.A(765573)},{id:"turtle",name:"Turtle",import:()=>e.A(889390)},{id:"twig",name:"Twig",import:()=>e.A(158869)},{id:"typescript",name:"TypeScript",aliases:["ts","cts","mts"],import:()=>e.A(540873)},{id:"typespec",name:"TypeSpec",aliases:["tsp"],import:()=>e.A(941325)},{id:"typst",name:"Typst",aliases:["typ"],import:()=>e.A(905331)},{id:"v",name:"V",import:()=>e.A(634520)},{id:"vala",name:"Vala",import:()=>e.A(749827)},{id:"vb",name:"Visual Basic",aliases:["cmd"],import:()=>e.A(723339)},{id:"verilog",name:"Verilog",import:()=>e.A(659928)},{id:"vhdl",name:"VHDL",import:()=>e.A(676577)},{id:"viml",name:"Vim Script",aliases:["vim","vimscript"],import:()=>e.A(9996)},{id:"vue",name:"Vue",import:()=>e.A(990512)},{id:"vue-html",name:"Vue HTML",import:()=>e.A(318085)},{id:"vue-vine",name:"Vue Vine",import:()=>e.A(984300)},{id:"vyper",name:"Vyper",aliases:["vy"],import:()=>e.A(712096)},{id:"wasm",name:"WebAssembly",import:()=>e.A(959984)},{id:"wenyan",name:"Wenyan",aliases:["文言"],import:()=>e.A(657695)},{id:"wgsl",name:"WGSL",import:()=>e.A(216503)},{id:"wikitext",name:"Wikitext",aliases:["mediawiki","wiki"],import:()=>e.A(237218)},{id:"wit",name:"WebAssembly Interface Types",import:()=>e.A(944971)},{id:"wolfram",name:"Wolfram",aliases:["wl"],import:()=>e.A(483867)},{id:"xml",name:"XML",import:()=>e.A(190206)},{id:"xsl",name:"XSL",import:()=>e.A(893978)},{id:"yaml",name:"YAML",aliases:["yml"],import:()=>e.A(267823)},{id:"zenscript",name:"ZenScript",import:()=>e.A(747329)},{id:"zig",name:"Zig",import:()=>e.A(904154)}],ev=Object.fromEntries(ex.map(e=>[e.id,e.import])),eb=Object.fromEntries(ex.flatMap(e=>e.aliases?.map(t=>[t,e.import])||[])),ew={...ev,...eb};class ek extends Error{constructor(e){super(e),this.name="ShikiError"}}var eS=e.i(950382);function ej(e,...t){return t.forEach(t=>{for(let r in t)e[r]=t[r]}),e}var eA=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,eN=class{static hasCaptures(e){return null!==e&&(eA.lastIndex=0,eA.test(e))}static replaceCaptures(e,t,r){return e.replace(eA,(e,n,i,s)=>{let a=r[parseInt(n||i,10)];if(!a)return e;{let e=t.substring(a.start,a.end);for(;"."===e[0];)e=e.substring(1);switch(s){case"downcase":return e.toLowerCase();case"upcase":return e.toUpperCase();default:return e}}})}};function eC(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,s;let r=(i=e[n],i<(s=t[n])?-1:+(i>s));if(0!==r)return r}return 0}return r-n}function e_(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 eT(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var eE=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}},eP=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,s=t[e];if(!s.settings)continue;if("string"==typeof s.scope){let e=s.scope;i=(e=(e=e.replace(/^[,]+/,"")).replace(/[,]+$/,"")).split(",")}else i=Array.isArray(s.scope)?s.scope:[""];let a=-1;if("string"==typeof s.settings.fontStyle){a=0;let e=s.settings.fontStyle.split(" ");for(let t=0,r=e.length;t<r;t++)switch(e[t]){case"italic":a|=1;break;case"bold":a|=2;break;case"underline":a|=4;break;case"strikethrough":a|=8}}let o=null;"string"==typeof s.settings.foreground&&e_(s.settings.foreground)&&(o=s.settings.foreground);let l=null;"string"==typeof s.settings.background&&e_(s.settings.background)&&(l=s.settings.background);for(let t=0,s=i.length;t<s;t++){let s=i[t].trim().split(" "),c=s[s.length-1],u=null;s.length>1&&(u=s.slice(0,s.length-1)).reverse(),r[n++]=new eL(c,u,e,a,o,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=eC(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 s=new eD(t),a=new eM(r,s.getId(n),s.getId(i)),o=new eF(new eB(0,null,-1,0,0),[]);for(let t=0,r=e.length;t<r;t++){let r=e[t];o.insert(0,r.scope,r.parentScopes,r.fontStyle,s.getId(r.foreground),s.getId(r.background))}return new eP(s,a,o)}(e,t)}_cachedMatchRoot=new eE(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 s=t[i],a=!1;if(">"===s){if(i===t.length-1)return!1;s=t[++i],a=!0}for(;e&&(r=e.scopeName,!((n=s)===r||r.startsWith(n)&&"."===r[n.length]));){if(a)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0})(e.parent,t.parentScopes));return r?new eM(r.fontStyle,r.foreground,r.background):null}},eR=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}},eM=class{constructor(e,t,r){this.fontStyle=e,this.foregroundId=t,this.backgroundId=r}},eL=class{constructor(e,t,r,n,i,s){this.scope=e,this.parentScopes=t,this.index=r,this.fontStyle=n,this.foreground=i,this.background=s}},eI=((p=eI||{})[p.NotSet=-1]="NotSet",p[p.None=0]="None",p[p.Italic=1]="Italic",p[p.Bold=2]="Bold",p[p.Underline=4]="Underline",p[p.Strikethrough=8]="Strikethrough",p),eD=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)}},eO=Object.freeze([]),eB=class e{scopeDepth;parentScopes;fontStyle;foreground;background;constructor(e,t,r,n,i){this.scopeDepth=e,this.parentScopes=t||eO,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)}},eF=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,s,a){let o,l,c;if(""===r)return void this._doInsertHere(t,n,i,s,a);let u=r.indexOf(".");-1===u?(o=r,l=""):(o=r.substring(0,u),l=r.substring(u+1)),this._children.hasOwnProperty(o)?c=this._children[o]:(c=new e(this._mainRule.clone(),eB.cloneArr(this._rulesWithParentScopes)),this._children[o]=c),c.insert(t+1,l,n,i,s,a)}_doInsertHere(e,t,r,n,i){if(null===t)return void this._mainRule.acceptOverwrite(e,r,n,i);for(let s=0,a=this._rulesWithParentScopes.length;s<a;s++){let a=this._rulesWithParentScopes[s];if(0===eC(a.parentScopes,t))return void a.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 eB(e,t,r,n,i))}},e$=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,s,a,o){let l=e.getLanguageId(t),c=e.getTokenType(t),u=+!!e.containsBalancedBrackets(t),d=e.getFontStyle(t),h=e.getForeground(t),p=e.getBackground(t);return 0!==r&&(l=r),8!==n&&(c=n),null!==i&&(u=+!!i),-1!==s&&(d=s),0!==a&&(h=a),0!==o&&(p=o),(l|c<<8|u<<10|d<<11|h<<15|p<<24)>>>0}};function ez(e,t){var r;let n,i,s=[],a=(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}}),o=a.next();for(;null!==o;){let e=0;if(2===o.length&&":"===o.charAt(1)){switch(o.charAt(0)){case"R":e=1;break;case"L":e=-1;break;default:console.log(`Unknown priority ${o} in scope selector`)}o=a.next()}let t=c();if(s.push({matcher:t,priority:e}),","!==o)break;o=a.next()}return s;function l(){if("-"===o){o=a.next();let e=l();return t=>!!e&&!e(t)}if("("===o){o=a.next();let e=function(){let e=[],t=c();for(;t&&(e.push(t),"|"===o||","===o);){do o=a.next();while("|"===o||","===o)t=c()}return t=>e.some(e=>e(t))}();return")"===o&&(o=a.next()),e}if(eV(o)){let e=[];do e.push(o),o=a.next();while(eV(o))return r=>t(e,r)}return null}function c(){let e=[],t=l();for(;t;)e.push(t),t=l();return t=>e.every(e=>e(t))}}function eV(e){return!!e&&!!e.match(/[\w\.:]+/)}var eU=((m=eU||{})[m.None=0]="None",m[m.NotBeginString=1]="NotBeginString",m[m.NotEndString=2]="NotEndString",m[m.NotBeginPosition=4]="NotBeginPosition",m[m.DebugCall=8]="DebugCall",m);function eG(e){"function"==typeof e.dispose&&e.dispose()}var eW=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},eH=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},eq=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))}},eK=class{constructor(e,t){this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new eW(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){let e=this.Q;this.Q=[];let t=new eq;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 s=r.lookup(t);e instanceof eW?eX({baseGrammar:s,selfGrammar:i},n):eY(e.ruleName,{baseGrammar:s,selfGrammar:i,repository:i.repository},n);let a=r.injections(e.scopeName);if(a)for(let e of a)n.add(new eW(e))}(r,this.initialScopeName,this.repo,t);for(let e of t.references)if(e instanceof eW){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 eY(e,t,r){t.repository&&t.repository[e]&&eJ([t.repository[e]],t,r)}function eX(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&&eJ(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&&eJ(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function eJ(e,t,r){for(let n of e){if(r.visitedRule.has(n))continue;r.visitedRule.add(n);let e=n.repository?ej({},t.repository,n.repository):t.repository;Array.isArray(n.patterns)&&eJ(n.patterns,{...t,repository:e},r);let i=n.include;if(!i)continue;let s=e5(i);switch(s.kind){case 0:eX({...t,selfGrammar:t.baseGrammar},r);break;case 1:eX(t,r);break;case 2:eY(s.ruleName,{...t,repository:e},r);break;case 3:case 4:let a=s.scopeName===t.selfGrammar.scopeName?t.selfGrammar:s.scopeName===t.baseGrammar.scopeName?t.baseGrammar:void 0;if(a){let n={baseGrammar:t.baseGrammar,selfGrammar:a,repository:e};4===s.kind?eY(s.ruleName,n,r):eX(n,r)}else 4===s.kind?r.add(new eH(s.scopeName,s.ruleName)):r.add(new eW(s.scopeName))}}}var eZ=class{kind=0},eQ=class{kind=1},e0=class{constructor(e){this.ruleName=e}kind=2},e1=class{constructor(e){this.scopeName=e}kind=3},e2=class{constructor(e,t){this.scopeName=e,this.ruleName=t}kind=4};function e5(e){if("$base"===e)return new eZ;if("$self"===e)return new eQ;let t=e.indexOf("#");return -1===t?new e1(e):0===t?new e0(e.substring(1)):new e2(e.substring(0,t),e.substring(t+1))}var e3=/\\(\d+)/,e6=/\\(\d+)/g;Symbol("RuleId");var e8=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(e,t,r,n){this.$location=e,this.id=t,this._name=r||null,this._nameIsCapturing=eN.hasCaptures(this._name),this._contentName=n||null,this._contentNameIsCapturing=eN.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?eN.replaceCaptures(this._name,e,t):this._name}getContentName(e,t){return this._contentNameIsCapturing&&null!==this._contentName?eN.replaceCaptures(this._contentName,e,t):this._contentName}},e4=class extends e8{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!")}},e9=class extends e8{_match;captures;_cachedCompiledPatterns;constructor(e,t,r,n,i){super(e,t,r,null),this._match=new tn(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 ti,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},e7=class extends e8{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 ti,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},te=class extends e8{_begin;beginCaptures;_end;endHasBackReferences;endCaptures;applyEndPatternLast;hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,r,n,i,s,a,o,l,c){super(e,t,r,n),this._begin=new tn(i,this.id),this.beginCaptures=s,this._end=new tn(a||"￿",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=o,this.applyEndPatternLast=l||!1,this.patterns=c.patterns,this.hasMissingPatterns=c.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 ti,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}},tt=class extends e8{_begin;beginCaptures;whileCaptures;_while;whileHasBackReferences;hasMissingPatterns;patterns;_cachedCompiledPatterns;_cachedCompiledWhilePatterns;constructor(e,t,r,n,i,s,a,o,l){super(e,t,r,n),this._begin=new tn(i,this.id),this.beginCaptures=s,this.whileCaptures=o,this._while=new tn(a,-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 ti,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 ti,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,t||"￿"),this._cachedCompiledWhilePatterns}},tr=class e{static createCaptureRule(e,t,r,n,i){return e.registerRule(e=>new e4(t,e,r,n,i))}static getCompiledRuleId(t,r,n){return t.id||r.registerRule(i=>{if(t.id=i,t.match)return new e9(t.$vscodeTextmateLocation,t.id,t.name,t.match,e._compileCaptures(t.captures,r,n));if(void 0===t.begin){t.repository&&(n=ej({},n,t.repository));let i=t.patterns;return void 0===i&&t.include&&(i=[{include:t.include}]),new e7(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,e._compilePatterns(i,r,n))}return t.while?new tt(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 te(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 s=0;for(let e in t){if("$vscodeTextmateLocation"===e)continue;let t=parseInt(e,10);t>s&&(s=t)}for(let e=0;e<=s;e++)i[e]=null;for(let s in t){if("$vscodeTextmateLocation"===s)continue;let a=parseInt(s,10),o=0;t[s].patterns&&(o=e.getCompiledRuleId(t[s],r,n)),i[a]=e.createCaptureRule(r,t[s].$vscodeTextmateLocation,t[s].name,t[s].contentName,o)}}return i}static _compilePatterns(t,r,n){let i=[];if(t)for(let s=0,a=t.length;s<a;s++){let a=t[s],o=-1;if(a.include){let t=e5(a.include);switch(t.kind){case 0:case 1:o=e.getCompiledRuleId(n[a.include],r,n);break;case 2:let i=n[t.ruleName];i&&(o=e.getCompiledRuleId(i,r,n));break;case 3:case 4:let s=t.scopeName,l=4===t.kind?t.ruleName:null,c=r.getExternalGrammar(s,n);if(c)if(l){let t=c.repository[l];t&&(o=e.getCompiledRuleId(t,r,c.repository))}else o=e.getCompiledRuleId(c.repository.$self,r,c.repository)}}else o=e.getCompiledRuleId(a,r,n);if(-1!==o){let e=r.getRule(o),t=!1;if((e instanceof e7||e instanceof te||e instanceof tt)&&e.hasMissingPatterns&&0===e.patterns.length&&(t=!0),t)continue;i.push(o)}}return{patterns:i,hasMissingPatterns:(t?t.length:0)!==i.length}}},tn=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 s=0;s<t;s++)if("\\"===e.charAt(s)&&s+1<t){const t=e.charAt(s+1);"z"===t?(n.push(e.substring(r,s)),n.push("$(?!\\n)(?<!\\n)"),r=s+2):("A"===t||"G"===t)&&(i=!0),s++}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=e3.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 e6.lastIndex=0,this.source.replace(e6,(e,t)=>eT(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=[],s=[],a=[],o=[];for(e=0,t=this.source.length;e<t;e++)r=this.source.charAt(e),i[e]=r,s[e]=r,a[e]=r,o[e]=r,"\\"===r&&e+1<t&&("A"===(n=this.source.charAt(e+1))?(i[e+1]="￿",s[e+1]="￿",a[e+1]="A",o[e+1]="A"):"G"===n?(i[e+1]="￿",s[e+1]="G",a[e+1]="￿",o[e+1]="G"):(i[e+1]=n,s[e+1]=n,a[e+1]=n,o[e+1]=n),e++);return{A0_G0:i.join(""),A0_G1:s.join(""),A1_G0:a.join(""),A1_G1:o.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}},ti=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 ts(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 ts(e,this._items.map(e=>e.resolveAnchors(t,r)),this._items.map(e=>e.ruleId))}},ts=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}},ta=class{constructor(e,t){this.languageId=e,this.tokenType=t}},to=class e{_defaultAttributes;_embeddedLanguagesMatcher;constructor(e,t){this._defaultAttributes=new ta(e,8),this._embeddedLanguagesMatcher=new tl(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 ta(0,0);_getBasicScopeAttributes=new eE(e=>new ta(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/},tl=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])=>eT(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!==eS.default&&eS.default.env.VSCODE_TEXTMATE_DEBUG;var tc=class{constructor(e,t){this.stack=e,this.stoppedEarly=t}};function tu(e,t,r,n,i,s,a,o){let l=t.content.length,c=!1,u=-1;if(a){let a=function(e,t,r,n,i,s){let a=i.beginRuleCapturedEOL?0:-1,o=[];for(let t=i;t;t=t.pop()){let r=t.getRule(e);r instanceof tt&&o.push({rule:r,stack:t})}for(let p=o.pop();p;p=o.pop()){var l,c,u,d,h;let{ruleScanner:o,findOptions:m}=(l=p.rule,c=e,u=p.stack.endRule,d=r,h=n===a,{ruleScanner:l.compileWhileAG(c,u,d,h),findOptions:0}),f=o.findNextMatchSync(t,n,m);if(f){if(-2!==f.ruleId){i=p.stack.pop();break}f.captureIndices&&f.captureIndices.length&&(s.produce(p.stack,f.captureIndices[0].start),th(e,t,r,p.stack,s,p.rule.whileCaptures,f.captureIndices),s.produce(p.stack,f.captureIndices[0].end),a=f.captureIndices[0].end,f.captureIndices[0].end>n&&(n=f.captureIndices[0].end,r=!1))}else{i=p.stack.pop();break}}return{stack:i,linePos:n,anchorPosition:a,isFirstLine:r}}(e,t,r,n,i,s);i=a.stack,n=a.linePos,r=a.isFirstLine,u=a.anchorPosition}let d=Date.now();for(;!c;){if(0!==o&&Date.now()-d>o)return new tc(i,!0);!function(){let a=function(e,t,r,n,i,s){let a=function(e,t,r,n,i,s){let{ruleScanner:a,findOptions:o}=td(i.getRule(e),e,i.endRule,r,n===s),l=a.findNextMatchSync(t,n,o);return l?{captureIndices:l.captureIndices,matchedRuleId:l.ruleId}:null}(e,t,r,n,i,s),o=e.getInjections();if(0===o.length)return a;let l=function(e,t,r,n,i,s,a){let o,l=Number.MAX_VALUE,c=null,u=0,d=s.contentNameScopesList.getScopeNames();for(let s=0,h=e.length;s<h;s++){let h=e[s];if(!h.matcher(d))continue;let{ruleScanner:p,findOptions:m}=td(t.getRule(h.ruleId),t,null,n,i===a),f=p.findNextMatchSync(r,i,m);if(!f)continue;let g=f.captureIndices[0].start;if(!(g>=l)&&(l=g,c=f.captureIndices,o=f.ruleId,u=h.priority,l===i))break}return c?{priorityMatch:-1===u,captureIndices:c,matchedRuleId:o}:null}(o,e,t,r,n,i,s);if(!l)return a;if(!a)return l;let c=a.captureIndices[0].start,u=l.captureIndices[0].start;return u<c||l.priorityMatch&&u===c?l:a}(e,t,r,n,i,u);if(!a){s.produce(i,l),c=!0;return}let o=a.captureIndices,d=a.matchedRuleId,h=!!o&&o.length>0&&o[0].end>n;if(-1===d){let a=i.getRule(e);s.produce(i,o[0].start),i=i.withContentNameScopesList(i.nameScopesList),th(e,t,r,i,s,a.endCaptures,o),s.produce(i,o[0].end);let d=i;if(i=i.parent,u=d.getAnchorPos(),!h&&d.getEnterPos()===n){i=d,s.produce(i,l),c=!0;return}}else{let a=e.getRule(d);s.produce(i,o[0].start);let p=i,m=a.getName(t.content,o),f=i.contentNameScopesList.pushAttributed(m,e);if(i=i.push(d,n,u,o[0].end===l,null,f,f),a instanceof te){th(e,t,r,i,s,a.beginCaptures,o),s.produce(i,o[0].end),u=o[0].end;let n=a.getContentName(t.content,o),d=f.pushAttributed(n,e);if(i=i.withContentNameScopesList(d),a.endHasBackReferences&&(i=i.withEndRule(a.getEndWithResolvedBackReferences(t.content,o))),!h&&p.hasSameRuleAs(i)){i=i.pop(),s.produce(i,l),c=!0;return}}else if(a instanceof tt){th(e,t,r,i,s,a.beginCaptures,o),s.produce(i,o[0].end),u=o[0].end;let n=a.getContentName(t.content,o),d=f.pushAttributed(n,e);if(i=i.withContentNameScopesList(d),a.whileHasBackReferences&&(i=i.withEndRule(a.getWhileWithResolvedBackReferences(t.content,o))),!h&&p.hasSameRuleAs(i)){i=i.pop(),s.produce(i,l),c=!0;return}}else if(th(e,t,r,i,s,a.captures,o),s.produce(i,o[0].end),i=i.pop(),!h){i=i.safePop(),s.produce(i,l),c=!0;return}}o[0].end>n&&(n=o[0].end,r=!1)}()}return new tc(i,!1)}function td(e,t,r,n,i){return{ruleScanner:e.compileAG(t,r,n,i),findOptions:0}}function th(e,t,r,n,i,s,a){if(0===s.length)return;let o=t.content,l=Math.min(s.length,a.length),c=[],u=a[0].end;for(let t=0;t<l;t++){let l=s[t];if(null===l)continue;let d=a[t];if(0===d.length)continue;if(d.start>u)break;for(;c.length>0&&c[c.length-1].endPos<=d.start;)i.produceFromScopes(c[c.length-1].scopes,c[c.length-1].endPos),c.pop();if(c.length>0?i.produceFromScopes(c[c.length-1].scopes,d.start):i.produce(n,d.start),l.retokenizeCapturedWithRuleId){let t=l.getName(o,a),s=n.contentNameScopesList.pushAttributed(t,e),c=l.getContentName(o,a),u=s.pushAttributed(c,e),h=n.push(l.retokenizeCapturedWithRuleId,d.start,-1,!1,null,s,u),p=e.createOnigString(o.substring(0,d.end));tu(e,p,r&&0===d.start,d.start,h,i,!1,0),eG(p);continue}let h=l.getName(o,a);if(null!==h){let t=(c.length>0?c[c.length-1].scopes:n.contentNameScopesList).pushAttributed(h,e);c.push(new tp(t,d.end))}}for(;c.length>0;)i.produceFromScopes(c[c.length-1].scopes,c[c.length-1].endPos),c.pop()}var tp=class{scopes;endPos;constructor(e,t){this.scopes=e,this.endPos=t}};function tm(e,t,r,n,i){let s=ez(t,tf),a=tr.getCompiledRuleId(r,n,i.repository);for(let r of s)e.push({debugSelector:t,matcher:r.matcher,ruleId:a,grammar:i,priority:r.priority})}function tf(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 tg=class{constructor(e,t,r,n,i,s,a,o){if(this._rootScopeName=e,this.balancedBracketSelectors=s,this._onigLib=o,this._basicScopeAttributesProvider=new to(r,n),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=a,this._grammar=ty(t,null),this._injections=null,this._tokenTypeMatchers=[],i)for(const e of Object.keys(i))for(const t of ez(e,tf))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)tm(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&&tm(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]=ty(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=tr.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections()),t&&t!==tv.NULL)i=!1,t.reset();else{let e;i=!0;let r=this._basicScopeAttributesProvider.getDefaultAttributes(),n=this.themeProvider.getDefaults(),s=e$.set(0,r.languageId,r.tokenType,null,n.fontStyle,n.foregroundId,n.backgroundId),a=this.getRule(this._rootId).getName(null,null);e=a?tx.createRootAndLookUpScopeName(a,s,this):tx.createRoot("unknown",s),t=new tv(null,this._rootId,-1,-1,!1,null,e,e)}e+="\n";let s=this.createOnigString(e),a=s.content.length,o=new tw(r,e,this._tokenTypeMatchers,this.balancedBracketSelectors),l=tu(this,s,i,0,t,o,!0,n);return eG(s),{lineLength:a,lineTokens:o,ruleStack:l.stack,stoppedEarly:l.stoppedEarly}}};function ty(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 tx=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=eR.push(i,t.scopeNames),t.encodedTokenAttributes);return n}static createRoot(t,r){return new e(null,new eR(null,t),r)}static createRootAndLookUpScopeName(t,r,n){let i=n.getMetadataForScope(t),s=new eR(null,t),a=n.themeProvider.themeMatch(s),o=e.mergeAttributes(r,i,a);return new e(null,s,o)}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,s=0;return null!==r&&(n=r.fontStyle,i=r.foregroundId,s=r.backgroundId),e$.set(e,t.languageId,t.tokenType,null,n,i,s)}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),s=t.scopePath.push(r),a=n.themeProvider.themeMatch(s),o=e.mergeAttributes(t.tokenAttributes,i,a);return new e(t,s,o)}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}},tv=class e{constructor(e,t,r,n,i,s,a,o){this.parent=e,this.ruleId=t,this.beginRuleCapturedEOL=i,this.endRule=s,this.nameScopesList=a,this.contentNameScopesList=o,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)&&tx.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,s,a,o){return new e(this,t,r,n,i,s,a,o)}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=tx.fromExtension(t?.nameScopesList??null,r.nameScopesList);return new e(t,r.ruleId,r.enterPos??-1,r.anchorPos??-1,r.beginRuleCapturedEOL,r.endRule,n,tx.fromExtension(n,r.contentNameScopesList))}},tb=class{balancedBracketScopes;unbalancedBracketScopes;allowAny=!1;constructor(e,t){this.balancedBracketScopes=e.flatMap(e=>"*"===e?(this.allowAny=!0,[]):ez(e,tf).map(e=>e.matcher)),this.unbalancedBracketScopes=t.flatMap(e=>ez(e,tf).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}},tw=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=e$.set(r,0,e.type,null,-1,0,0));this.balancedBracketSelectors&&(n=this.balancedBracketSelectors.match(t))}if(n&&(r=e$.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}},tk=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 s=this._rawGrammars.get(e);if(!s)return null;this._grammars.set(e,new tg(e,s,t,r,n,i,this,this._onigLib))}return this._grammars.get(e)}},tS=class{_options;_syncRegistry;_ensureGrammarCache;constructor(e){this._options=e,this._syncRegistry=new tk(eP.createFromRawTheme(e.theme,e.colorMap),e.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(e,t){this._syncRegistry.setTheme(eP.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 tb(r.balancedBracketSelectors||[],r.unbalancedBracketSelectors||[]))}loadGrammar(e){return this._loadGrammar(e,0,null,null,null)}_loadGrammar(e,t,r,n,i){let s=new eK(this._syncRegistry,e);for(;s.Q.length>0;)s.Q.map(e=>this._loadSingleGrammar(e.scopeName)),s.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)}},tj=tv.NULL,tA=e.i(766368),tN=e.i(145767),tC=e.i(456940);let t_=/["&'<>`]/g,tT=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,tE=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,tP=/[|\\{}()[\]^$+*?.]/g,tR=new WeakMap,tM=/[\dA-Fa-f]/,tL=/\d/,tI=["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"],tD={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:"€"},tO=["cent","copy","divide","gt","lt","not","para","times"],tB={}.hasOwnProperty,tF={};for(t in tD)tB.call(tD,t)&&(tF[tD[t]]=t);let t$=/[^\dA-Za-z]/;function tz(e,t,r){var n,i;let s,a,o=(n=r.omitOptionalSemicolons,s="&#x"+e.toString(16).toUpperCase(),n&&t&&!tM.test(String.fromCharCode(t))?s:s+";");if((r.useNamedReferences||r.useShortestReferences)&&(a=function(e,t,r,n){let i=String.fromCharCode(e);if(tB.call(tF,i)){let e=tF[i],s="&"+e;return r&&tI.includes(e)&&!tO.includes(e)&&(!n||t&&61!==t&&t$.test(String.fromCharCode(t)))?s:s+";"}return""}(e,t,r.omitOptionalSemicolons,r.attribute)),(r.useShortestReferences||!a)&&r.useShortestReferences){let n,s=(i=r.omitOptionalSemicolons,n="&#"+String(e),i&&t&&!tL.test(String.fromCharCode(t))?n:n+";");s.length<o.length&&(o=s)}return a&&(!r.useShortestReferences||a.length<o.length)?a:o}function tV(e,t){let r;var n,i=e,s=Object.assign({format:tz},t);if(i=i.replace(s.subset?(n=s.subset,(r=tR.get(n))||(r=function(e){let t=[],r=-1;for(;++r<e.length;)t.push(e[r].replace(tP,"\\$&"));return RegExp("(?:"+t.join("|")+")","g")}(n),tR.set(n,r)),r):t_,a),s.subset||s.escapeOnly)return i;return i.replace(tT,function(e,t,r){return s.format((e.charCodeAt(0)-55296)*1024+e.charCodeAt(1)-56320+65536,r.charCodeAt(t+2),s)}).replace(tE,a);function a(e,t,r){return s.format(e.charCodeAt(0),r.charCodeAt(t+1),s)}}let tU=/^>|^->|<!--|-->|--!>|<!-$/g,tG=[">"],tW=["<",">"];var tH=e.i(294254),tq=e.i(214644),tK=e.i(781812),tY=e.i(645060),tX=e.i(960688);let tJ=t0(1),tZ=t0(-1),tQ=[];function t0(e){return function(t,r,n){let i=t?t.children:tQ,s=(r||0)+e,a=i[s];if(!n)for(;a&&(0,tX.whitespace)(a);)s+=e,a=i[s];return a}}let t1={}.hasOwnProperty;function t2(e){return function(t,r,n){return t1.call(e,t.tagName)&&e[t.tagName](t,r,n)}}let t5=t2({body:function(e,t,r){let n=tJ(r,t);return!n||"comment"!==n.type},caption:t3,colgroup:t3,dd:function(e,t,r){let n=tJ(r,t);return!n||"element"===n.type&&("dt"===n.tagName||"dd"===n.tagName)},dt:function(e,t,r){let n=tJ(r,t);return!!(n&&"element"===n.type&&("dt"===n.tagName||"dd"===n.tagName))},head:t3,html:function(e,t,r){let n=tJ(r,t);return!n||"comment"!==n.type},li:function(e,t,r){let n=tJ(r,t);return!n||"element"===n.type&&"li"===n.tagName},optgroup:function(e,t,r){let n=tJ(r,t);return!n||"element"===n.type&&"optgroup"===n.tagName},option:function(e,t,r){let n=tJ(r,t);return!n||"element"===n.type&&("option"===n.tagName||"optgroup"===n.tagName)},p:function(e,t,r){let n=tJ(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:t6,rt:t6,tbody:function(e,t,r){let n=tJ(r,t);return!n||"element"===n.type&&("tbody"===n.tagName||"tfoot"===n.tagName)},td:t8,tfoot:function(e,t,r){return!tJ(r,t)},th:t8,thead:function(e,t,r){let n=tJ(r,t);return!!(n&&"element"===n.type&&("tbody"===n.tagName||"tfoot"===n.tagName))},tr:function(e,t,r){let n=tJ(r,t);return!n||"element"===n.type&&"tr"===n.tagName}});function t3(e,t,r){let n=tJ(r,t,!0);return!n||"comment"!==n.type&&!("text"===n.type&&(0,tX.whitespace)(n.value.charAt(0)))}function t6(e,t,r){let n=tJ(r,t);return!n||"element"===n.type&&("rp"===n.tagName||"rt"===n.tagName)}function t8(e,t,r){let n=tJ(r,t);return!n||"element"===n.type&&("td"===n.tagName||"th"===n.tagName)}let t4=t2({body:function(e){let t=tJ(e,-1,!0);return!t||"comment"!==t.type&&!("text"===t.type&&(0,tX.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=tZ(r,t),i=tJ(e,-1,!0);return!(r&&n&&"element"===n.type&&"colgroup"===n.tagName&&t5(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=tJ(e,-1);return!t||"comment"!==t.type},tbody:function(e,t,r){let n=tZ(r,t),i=tJ(e,-1);return!(r&&n&&"element"===n.type&&("thead"===n.tagName||"tbody"===n.tagName)&&t5(n,r.children.indexOf(n),r))&&!!(i&&"element"===i.type&&"tr"===i.tagName)}}),t9={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("")]]},t7=["<","&"];function re(e,t,r,n){return r&&"element"===r.type&&("script"===r.tagName||"style"===r.tagName)?e.value:tV(e.value,Object.assign({},n.settings.characterReferences,{subset:t7}))}let rt=(0,tC.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?"<?"+tV(e.value,Object.assign({},n.settings.characterReferences,{subset:tG}))+">":"<!--"+e.value.replace(tU,function(e){return tV(e,Object.assign({},n.settings.characterReferences,{subset:tW}))})+"-->"},doctype:function(e,t,r,n){return"<!"+(n.settings.upperDoctype?"DOCTYPE":"doctype")+(n.settings.tightDoctype?"":" ")+"html>"},element:function(e,t,r,n){let i,s=n.schema,a="svg"!==s.space&&n.settings.omitOptionalTags,o="svg"===s.space?n.settings.closeEmptyElements:n.settings.voids.includes(e.tagName.toLowerCase()),l=[];"html"===s.space&&"svg"===e.tagName&&(n.schema=tN.svg);let c=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,tK.find)(e.schema,t),s=e.settings.allowParseErrors&&"html"===e.schema.space?0:1,a=+!e.settings.allowDangerousCharacters,o=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=tV(i.attribute,Object.assign({},e.settings.characterReferences,{subset:t9.name[s][a]}));return!0===r||(r=Array.isArray(r)?(i.commaSeparated?tq.stringify:tY.stringify)(r,{padLeft:!e.settings.tightCommaSeparatedLists}):String(r),e.settings.collapseEmptyAttributes&&!r)?l:(e.settings.preferUnquoted&&(n=tV(r,Object.assign({},e.settings.characterReferences,{attribute:!0,subset:t9.unquoted[s][a]}))),n!==r&&(e.settings.quoteSmart&&(0,tH.ccount)(r,o)>(0,tH.ccount)(r,e.alternative)&&(o=e.alternative),n=o+tV(r,Object.assign({},e.settings.characterReferences,{subset:("'"===o?t9.single:t9.double)[s][a],attribute:!0}))+o),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),u=n.all("html"===s.space&&"template"===e.tagName?e.content:e);return n.schema=s,u&&(o=!1),!c&&a&&t4(e,t,r)||(l.push("<",e.tagName,c?" "+c:""),o&&("svg"===s.space||n.settings.closeSelfClosing)&&(i=c.charAt(c.length-1),(!n.settings.tightSelfClosing||"/"===i||i&&'"'!==i&&"'"!==i)&&l.push(" "),l.push("/")),l.push(">")),l.push(u),o||a&&t5(e,t,r)||l.push("</"+e.tagName+">"),l.join("")},raw:function(e,t,r,n){return n.settings.allowDangerousHtml?e.value:re(e,t,r,n)},root:function(e,t,r,n){return n.all(e)},text:re}}),rr={},rn={},ri=[];function rs(e,t,r){return rt(e,t,r,this)}function ra(e){let t=[],r=e&&e.children||ri,n=-1;for(;++n<r.length;)t[n]=this.one(r[n],n,e);return t.join("")}function ro(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 rl(e,t){return e&&t?.[e?.toLowerCase()]||e}async function rc(e){return Promise.resolve("function"==typeof e?e():e).then(e=>e.default||e)}function ru(e){return!e||["plaintext","txt","text","plain"].includes(e)}function rd(e){return"ansi"===e||ru(e)}function rh(e){return"none"===e}function rp(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 rm(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 s=t?r[e]+(r[e+1]||""):r[e];i.push([s,n]),n+=r[e].length,n+=r[e+1]?.length||0}return i}let rf="light-dark()",rg=["color","background-color"];function ry(e){let t={};if(e.color&&(t.color=e.color),e.bgColor&&(t["background-color"]=e.bgColor),e.fontStyle){e.fontStyle&eI.Italic&&(t["font-style"]="italic"),e.fontStyle&eI.Bold&&(t["font-weight"]="bold");let r=[];e.fontStyle&eI.Underline&&r.push("underline"),e.fontStyle&eI.Strikethrough&&r.push("line-through"),r.length&&(t["text-decoration"]=r.join(" "))}return t}function rx(e){return"string"==typeof e?e:Object.entries(e).map(([e,t])=>`${e}:${t}`).join(";")}let rv=new WeakMap;function rb(e,t){rv.set(e,t)}function rw(e){return rv.get(e)}class rk{_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 rk(Object.fromEntries((Array.isArray(t)?t:[t]).map(e=>[e,tj])),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 rS=[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 ek(`Invalid decoration offset: ${e}. Code length: ${t.source.length}`);return{...s.indexToPos(e),offset:e}}{let t=s.lines[e.line];if(void 0===t)throw new ek(`Invalid decoration position ${JSON.stringify(e)}. Lines length: ${s.lines.length}`);let r=e.character;if(r<0&&(r=t.length+r),r<0||r>t.length)throw new ek(`Invalid decoration position ${JSON.stringify(e)}. Line ${e.line} length: ${t.length}`);return{...e,character:r,offset:s.posToIndex(e.line,r)}}},s={lines:n=rm(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}},a=(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 ek(`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,s=r.start.offset<t.end.offset&&t.end.offset<=r.end.offset,a=t.start.offset<=r.start.offset&&r.start.offset<t.end.offset,o=t.start.offset<r.end.offset&&r.end.offset<=t.end.offset;if(i||s||a||o){if(i&&s||a&&o||a&&r.start.offset===r.end.offset||s&&t.start.offset===t.end.offset)continue;throw new ek(`Decorations ${JSON.stringify(r.start)} and ${JSON.stringify(t.start)} intersect.`)}}}})(a),e.set(t.meta,{decorations:a,converter:s,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 ek(`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 a=n[e],o="",l=-1,c=-1;if(0===t&&(l=0),0===r&&(c=0),r===1/0&&(c=a.children.length),-1===l||-1===c)for(let e=0;e<a.children.length;e++)o+=function e(t){return"text"===t.type?t.value:"element"===t.type?t.children.map(e).join(""):""}(a.children[e]),-1===l&&o.length===t&&(l=e+1),-1===c&&o.length===r&&(c=e+1);if(-1===l)throw new ek(`Failed to find start index for decoration ${JSON.stringify(i.start)}`);if(-1===c)throw new ek(`Failed to find end index for decoration ${JSON.stringify(i.end)}`);let u=a.children.slice(l,c);if(i.alwaysWrap||u.length!==a.children.length)if(i.alwaysWrap||1!==u.length||"element"!==u[0].type){let e={type:"element",tagName:"span",properties:{},children:u};s(e,i,"wrapper"),a.children.splice(l,u.length,e)}else s(u[0],i,"token");else s(a,i,"line")}function s(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&&rp(e,t.properties.class),e=i(e,r)||e}let a=[];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++)a.unshift(()=>{var t;n[t=i]=s(n[t],e,"line")});i(r.line,0,r.character,e)}}a.forEach(e=>e())}}}()];function rj(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,...rS]}var rA=["black","red","green","yellow","blue","magenta","cyan","white","brightBlack","brightRed","brightGreen","brightYellow","brightBlue","brightMagenta","brightCyan","brightWhite"],rN={1:"bold",2:"dim",3:"italic",4:"underline",7:"reverse",8:"hidden",9:"strikethrough"};function rC(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 r_={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 rT={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 rE(e,t,r={}){var n,i;let s,a,{theme:o=e.getLoadedThemes()[0]}=r,l=e.resolveLangAlias(r.lang||"text");if(ru(l)||rh(o))return rm(t).map(e=>[{content:e[0],offset:e[1]}]);let{theme:c,colorMap:u}=e.setTheme(o);if("ansi"===l){let e,n,i,s,a,o,l;return e=ro(c,r),n=rm(t),i=function(e=r_){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<rA.length;r++)t.push(e[rA[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 s=0;s<6;s++)t.push(r([n[e],n[i],n[s]]));let i=8;for(let e=0;e<24;e++,i+=10)t.push(r([i,i,i]));return t}()[i]}}}}(Object.fromEntries(rA.map(e=>{let t=`terminal.ansi${e[0].toUpperCase()}${e.substring(1)}`;return[e,c.colors?.[t]||rT[e]]}))),s=null,a=null,o=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:s,background:a,decorations:new Set(o)}),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)rN[n]&&t.push({type:"setDecoration",value:rN[n]});else if(n<=29){let e=rN[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:rA[n-30]}});else if(38===n){let r=rC(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:rA[n-40]}});else if(48===n){let r=rC(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:rA[n-90+8]}}):n>=100&&n<=107&&t.push({type:"setBackgroundColor",value:{type:"named",name:rA[n-100+8]}})}return t}(n.sequence);for(let t of e)"resetAll"===t.type?(s=null,a=null,o.clear()):"resetForegroundColor"===t.type?s=null:"resetBackgroundColor"===t.type?a=null:"resetDecoration"===t.type&&o.delete(t.value);for(let t of e)"setForegroundColor"===t.type?s=t.value:"setBackgroundColor"===t.type?a=t.value:"setDecoration"===t.type&&o.add(t.value)}r=n.position}while(r<e.length)return t}},n.map(t=>l.parse(t[0]).map(r=>{let n,s;r.decorations.has("reverse")?(n=r.background?i.value(r.background):c.bg,s=r.foreground?i.value(r.foreground):c.fg):(n=r.foreground?i.value(r.foreground):c.fg,s=r.background?i.value(r.background):void 0),n=rl(n,e),s=rl(s,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],s=Math.round(Number.parseInt(`${i}${i}`,16)/2).toString(16).padStart(2,"0");return`#${t}${t}${r}${r}${n}${n}${s}`}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 a=eI.None;return r.decorations.has("bold")&&(a|=eI.Bold),r.decorations.has("italic")&&(a|=eI.Italic),r.decorations.has("underline")&&(a|=eI.Underline),r.decorations.has("strikethrough")&&(a|=eI.Strikethrough),{content:r.value,offset:t[1],color:n,bgColor:s,fontStyle:a}}))}let d=e.getLanguage(r.lang||"text");if(r.grammarState){if(r.grammarState.lang!==d.name)throw new ek(`Grammar state language "${r.grammarState.lang}" does not match highlight language "${d.name}"`);if(!r.grammarState.themes.includes(c.name))throw new ek(`Grammar state themes "${r.grammarState.themes}" do not contain highlight theme "${c.name}"`)}return a=new rk((s=rP(t,n=d,i=c,u,r)).stateStack,n.name,i.name),rb(s.tokens,a),s.tokens}function rP(e,t,r,n,i){let s=ro(r,i),{tokenizeMaxLineLength:a=0,tokenizeTimeLimit:o=500}=i,l=rm(e),c=i.grammarState?function(e,t){if(!(e instanceof rk))throw new ek("Invalid grammar state");return e.getInternalStack(t)}(i.grammarState,r.name)??tj:null!=i.grammarContextCode?rP(i.grammarContextCode,t,r,n,{...i,grammarState:void 0,grammarContextCode:void 0}).stateStack:tj,u=[],d=[];for(let e=0,h=l.length;e<h;e++){let h,p,[m,f]=l[e];if(""===m){u=[],d.push([]);continue}if(a>0&&m.length>=a){u=[],d.push([{content:m,offset:f,color:"",fontStyle:0}]);continue}i.includeExplanation&&(h=t.tokenizeLine(m,c,o).tokens,p=0);let g=t.tokenizeLine2(m,c,o),y=g.tokens.length/2;for(let e=0;e<y;e++){let t=g.tokens[2*e],a=e+1<y?g.tokens[2*e+2]:m.length;if(t===a)continue;let o=g.tokens[2*e+1],l=rl(n[e$.getForeground(o)],s),c=e$.getFontStyle(o),d={content:m.substring(t,a),offset:f+t,color:l,fontStyle:c};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<a;){let t=h[p],r=m.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:s}of e)for(let e of i)if(function(e,t,r){if(!rR(e[e.length-1],t))return!1;let n=e.length-2,i=r.length-1;for(;n>=0&&i>=0;)rR(e[n],r[i])&&(n-=1),i-=1;return -1===n}(e,t,r)){n.push(s);break}return n}(e,i,t.slice(0,n))}}return r}(e,t.scopes)}),p+=1}}u.push(d)}d.push(u),u=[],c=g.ruleStack}return{tokens:d,stateStack:c}}function rR(e,t){return e===t||t.substring(0,e.length)===e&&"."===t[e.length]}function rM(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=rE(e,t,{...r,theme:n.theme}),s=rw(i);return{tokens:i,state:s,theme:"string"==typeof n.theme?n.theme:n.theme.name}}),s=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]),s=t.map(()=>[]);t.forEach((e,t)=>e.push(s[t]));let a=i.map(()=>0),o=i.map(e=>e[0]);for(;o.every(e=>e);){let e=Math.min(...o.map(e=>e.content.length));for(let t=0;t<r;t++){let r=o[t];r.content.length===e?(s[t].push(r),a[t]+=1,o[t]=i[t][a[t]]):(s[t].push({...r,content:r.content.slice(0,e)}),o[t]={...r,content:r.content.slice(e),offset:r.offset+e})}}}return t}(...i.map(e=>e.tokens)),a=s[0].map((e,t)=>e.map((e,i)=>{let a={content:e.content,variants:{},offset:e.offset};return"includeExplanation"in r&&r.includeExplanation&&(a.explanation=e.explanation),s.forEach((e,r)=>{let{content:s,explanation:o,offset:l,...c}=e[t][i];a.variants[n[r].color]=c}),a})),o=i[0].state?new rk(Object.fromEntries(i.map(e=>[e.theme,e.state?.getInternalStack(e.theme)])),i[0].state.lang):void 0;return o&&rb(a,o),a}function rL(e,t,r){let n,i,s,a,o,l;if("themes"in r){let{defaultColor:c="light",cssVariablePrefix:u="--shiki-",colorsRendering:d="css-vars"}=r,h=Object.entries(r.themes).filter(e=>e[1]).map(e=>({color:e[0],theme:e[1]})).sort((e,t)=>e.color===c?-1:+(t.color===c));if(0===h.length)throw new ek("`themes` option must not be empty");let p=rM(e,t,r);if(l=rw(p),c&&rf!==c&&!h.find(e=>e.color===c))throw new ek(`\`themes\` option must contain the defaultColor key \`${c}\``);let m=h.map(t=>e.getTheme(t.theme)),f=h.map(e=>e.color);s=p.map(e=>e.map(e=>(function(e,t,r,n,i="css-vars"){let s={content:e.content,explanation:e.explanation,offset:e.offset},a=t.map(t=>ry(e.variants[t])),o=new Set(a.flatMap(e=>Object.keys(e))),l={},c=(e,n)=>{let i="color"===n?"":"background-color"===n?"-bg":`-${n}`;return r+t[e]+("color"===n?"":i)};return a.forEach((e,r)=>{for(let s of o){let o=e[s]||"inherit";if(0===r&&n&&rg.includes(s))if(n===rf&&a.length>1){let e=t.findIndex(e=>"light"===e),n=t.findIndex(e=>"dark"===e);if(-1===e||-1===n)throw new ek('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');let u=a[e][s]||"inherit",d=a[n][s]||"inherit";l[s]=`light-dark(${u}, ${d})`,"css-vars"===i&&(l[c(r,s)]=o)}else l[s]=o;else"css-vars"===i&&(l[c(r,s)]=o)}}),s.htmlStyle=l,s})(e,f,u,c,d))),l&&rb(s,l);let g=h.map(e=>ro(e.theme,r));i=rI(h,m,g,u,c,"fg",d),n=rI(h,m,g,u,c,"bg",d),a=`shiki-themes ${m.map(e=>e.name).join(" ")}`,o=c?void 0:[i,n].join(";")}else if("theme"in r){let o=ro(r.theme,r);s=rE(e,t,r);let c=e.getTheme(r.theme);n=rl(c.bg,o),i=rl(c.fg,o),a=c.name,l=rw(s)}else throw new ek("Invalid options, either `theme` or `themes` must be provided");return{tokens:s,fg:i,bg:n,themeName:a,rootStyle:o,grammarState:l}}function rI(e,t,r,n,i,s,a){return e.map((o,l)=>{let c=rl(t[l][s],r[l])||"inherit",u=`${n+o.color}${"bg"===s?"-bg":""}:${c}`;if(0===l&&i){if(i===rf&&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 ek('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');let a=rl(t[n][s],r[n])||"inherit",o=rl(t[i][s],r[i])||"inherit";return`light-dark(${a}, ${o});${u}`}return c}return"css-vars"===a?u:null}).filter(e=>!!e).join(";")}function rD(e,t,r,n={meta:{},options:r,codeToHast:(t,r)=>rD(e,t,r),codeToTokens:(t,r)=>rL(e,t,r)}){let i=t;for(let e of rj(r))i=e.preprocess?.call(n,i,r)||i;let{tokens:s,fg:a,bg:o,themeName:l,rootStyle:c,grammarState:u}=rL(e,i,r),{mergeWhitespaces:d=!0,mergeSameStyleTokens:h=!1}=r;!0===d?s=s.map(e=>{let t,r=[],n="";return e.forEach((i,s)=>{let a=!(i.fontStyle&&(i.fontStyle&eI.Underline||i.fontStyle&eI.Strikethrough));a&&i.content.match(/^\s+$/)&&e[s+1]?(void 0===t&&(t=i.offset),n+=i.content):n?(a?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&&(s=s.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 s=[{...e,offset:e.offset+r.length,content:n}];return r&&s.unshift({content:r,offset:e.offset}),i&&s.push({content:i,offset:e.offset+r.length+n.length}),s}))),h&&(s=s.map(e=>{let t=[];for(let r of e){if(0===t.length){t.push({...r});continue}let e=t[t.length-1],n=rx(e.htmlStyle||ry(e)),i=rx(r.htmlStyle||ry(r)),s=e.fontStyle&&(e.fontStyle&eI.Underline||e.fontStyle&eI.Strikethrough),a=r.fontStyle&&(r.fontStyle&eI.Underline||r.fontStyle&eI.Strikethrough);s||a||n!==i?t.push({...r}):e.content+=r.content}return t}));let p={...n,get source(){return i}};for(let e of rj(r))s=e.tokens?.call(p,s)||s;return function(e,t,r,n=rw(e)){let i=rj(t),s=[],a={type:"root",children:[]},{structure:o="classic",tabindex:l="0"}=t,c={class:`shiki ${t.themeName||""}`};for(let[e,r]of(!1!==t.rootStyle&&(null!=t.rootStyle?c.style=t.rootStyle:c.style=`background-color:${t.bg};color:${t.fg}`),!1!==l&&null!=l&&(c.tabindex=l.toString()),Object.entries(t.meta||{})))e.startsWith("_")||(c[e]=r);let u={type:"element",tagName:"pre",properties:c,children:[],data:t.data},d={type:"element",tagName:"code",properties:{},children:s},h=[],p={...r,structure:o,addClassToHast:rp,get source(){return r.source},get tokens(){return e},get options(){return t},get root(){return a},get pre(){return u},get code(){return d},get lines(){return h}};if(e.forEach((e,t)=>{t&&("inline"===o?a.children.push({type:"element",tagName:"br",properties:{},children:[]}):"classic"===o&&s.push({type:"text",value:"\n"}));let r={type:"element",tagName:"span",properties:{class:"line"},children:[]},n=0;for(let s of e){let e={type:"element",tagName:"span",properties:{...s.htmlAttrs},children:[{type:"text",value:s.content}]},l=rx(s.htmlStyle||ry(s));for(let a of(l&&(e.properties.style=l),i))e=a?.span?.call(p,e,t+1,n,r,s)||e;"inline"===o?a.children.push(e):"classic"===o&&r.children.push(e),n+=s.content.length}if("classic"===o){for(let e of i)r=e?.line?.call(p,r,t+1)||r;h.push(r),s.push(r)}else"inline"===o&&h.push(r)}),"classic"===o){for(let e of i)d=e?.code?.call(p,d)||d;for(let e of(u.children.push(d),i))u=e?.pre?.call(p,u)||u;a.children.push(u)}else if("inline"===o){let e=[],t={type:"element",tagName:"span",properties:{class:"line"},children:[]};for(let r of a.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(p,r)||r;a.children=[];for(let e=0;e<r.children.length;e++){e>0&&a.children.push({type:"element",tagName:"br",properties:{},children:[]});let t=r.children[e];"element"===t.type&&a.children.push(...t.children)}}let m=a;for(let e of i)m=e?.root?.call(p,m)||m;return n&&rb(m,n),m}(s,{...r,fg:a,bg:o,themeName:l,rootStyle:!1!==r.rootStyle&&(r.rootStyle??c)},p,u)}let rO=function(e,t){let r=t||rr,n=r.quote||'"';if('"'!==n&&"'"!==n)throw Error("Invalid quote `"+n+"`, expected `'` or `\"`");return({one:rs,all:ra,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||tA.htmlVoidElements,characterReferences:r.characterReferences||rn,closeSelfClosing:r.closeSelfClosing||!1,closeEmptyElements:r.closeEmptyElements||!1},schema:"svg"===r.space?tN.svg:tN.html,quote:n,alternative:'"'===n?"'":'"'}).one(Array.isArray(e)?{type:"root",children:e}:e,void 0,void 0)},rB="__shiki_resolved";function rF(e){if(e?.[rB])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,s=new Map;function a(e){if(s.has(e))return s.get(e);i+=1;let r=`#${i.toString(16).padStart(8,"0").toLowerCase()}`;return t.colorReplacements?.[`#${r}`]?a(e):(s.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=a(e.settings.foreground);t.colorReplacements[r]=e.settings.foreground,i.settings.foreground=r}if(n){let r=a(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=a(t.colors[e]);t.colorReplacements[r]=t.colors[e],t.colors[e]=r}return Object.defineProperty(t,rB,{enumerable:!1,writable:!1,value:!0}),t}async function r$(e){return Array.from(new Set((await Promise.all(e.filter(e=>!rd(e)).map(async e=>await rc(e).then(e=>Array.isArray(e)?e:[e])))).flat()))}async function rz(e){return(await Promise.all(e.map(async e=>rh(e)?null:rF(await rc(e))))).filter(e=>!!e)}class rV extends Error{constructor(e){super(e),this.name="ShikiError"}}function rU(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 rV(`Circular alias \`${Array.from(r).join(" -> ")} -> ${e}\``);r.add(e)}}return e}class rG extends tS{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=rF(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=eP.createFromRawTheme(e),this._textmateThemeCache.set(e,t)),this._syncRegistry.setTheme(t)}getGrammar(e){return e=rU(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 rV(`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 rW{_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 rH=0;async function rq(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([rz(e.themes||[]),r$(e.langs||[]),e.engine]);return function(e){let t;rH+=1,!1!==e.warnings&&rH>=10&&rH%10==0&&console.warn(`[Shiki] ${rH} 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 rV("`engine` option is required for synchronous mode");let n=(e.langs||[]).flat(1),i=(e.themes||[]).flat(1).map(rF),s=new rG(new rW(e.engine,n),i,n,e.langAlias);function a(e){if("none"===e)return{bg:"",fg:"",name:"none",settings:[],type:"dark"};c();let t=s.getTheme(e);if(!t)throw new rV(`Theme \`${e}\` not found, you may need to load it first`);return t}function o(...e){c(),s.loadLanguages(e.flat(1))}function l(...e){for(let t of(c(),e.flat(1)))s.loadTheme(t)}function c(){if(r)throw new rV("Shiki instance has been disposed")}function u(){r||(r=!0,s.dispose(),rH-=1)}return{setTheme:function(e){c();let r=a(e);return t!==e&&(s.setTheme(r),t=e),{theme:r,colorMap:s.getColorMap()}},getTheme:a,getLanguage:function(e){c();let t=s.getGrammar("string"==typeof e?e:e.name);if(!t)throw new rV(`Language \`${e}\` not found, you may need to load it first`);return t},getLoadedThemes:function(){return c(),s.getLoadedThemes()},getLoadedLanguages:function(){return c(),s.getLoadedLanguages()},resolveLangAlias:function(t){return rU(t,e.langAlias)},loadLanguage:async function(...e){return o(await r$(e))},loadLanguageSync:o,loadTheme:async function(...e){return c(),l(await rz(e))},loadThemeSync:l,dispose:u,[Symbol.dispose]:u}}({...e,themes:t,langs:r,engine:n})}async function rK(e){let t=await rq(e);return{getLastGrammarState:(...e)=>(function(...e){if(2===e.length)return rw(e[1]);let[t,r,n={}]=e,{lang:i="text",theme:s=t.getLoadedThemes()[0]}=n;if(ru(i)||rh(s))throw new ek("Plain language does not have grammar state");if("ansi"===i)throw new ek("ANSI language does not have grammar state");let{theme:a,colorMap:o}=t.setTheme(s),l=t.getLanguage(i);return new rk(rP(r,l,a,o,n).stateStack,l.name,a.name)})(t,...e),codeToTokensBase:(e,r)=>rE(t,e,r),codeToTokensWithThemes:(e,r)=>rM(t,e,r),codeToTokens:(e,r)=>rL(t,e,r),codeToHast:(e,r)=>rD(t,e,r),codeToHtml:(e,r)=>(function(e,t,r){let n={meta:{},options:r,codeToHast:(t,r)=>rD(e,t,r),codeToTokens:(t,r)=>rL(e,t,r)},i=rO(rD(e,t,r,n));for(let e of rj(r))i=e.postprocess?.call(n,i,r)||i;return i})(t,e,r),getBundledLanguages:()=>({}),getBundledThemes:()=>({}),...t,getInternalContext:()=>t}}let rY=Object.fromEntries([{id:"andromeeda",displayName:"Andromeeda",type:"dark",import:()=>e.A(189508)},{id:"aurora-x",displayName:"Aurora X",type:"dark",import:()=>e.A(327553)},{id:"ayu-dark",displayName:"Ayu Dark",type:"dark",import:()=>e.A(759341)},{id:"catppuccin-frappe",displayName:"Catppuccin Frappé",type:"dark",import:()=>e.A(557366)},{id:"catppuccin-latte",displayName:"Catppuccin Latte",type:"light",import:()=>e.A(127572)},{id:"catppuccin-macchiato",displayName:"Catppuccin Macchiato",type:"dark",import:()=>e.A(398911)},{id:"catppuccin-mocha",displayName:"Catppuccin Mocha",type:"dark",import:()=>e.A(765061)},{id:"dark-plus",displayName:"Dark Plus",type:"dark",import:()=>e.A(814228)},{id:"dracula",displayName:"Dracula Theme",type:"dark",import:()=>e.A(374789)},{id:"dracula-soft",displayName:"Dracula Theme Soft",type:"dark",import:()=>e.A(675562)},{id:"everforest-dark",displayName:"Everforest Dark",type:"dark",import:()=>e.A(264696)},{id:"everforest-light",displayName:"Everforest Light",type:"light",import:()=>e.A(42530)},{id:"github-dark",displayName:"GitHub Dark",type:"dark",import:()=>e.A(427713)},{id:"github-dark-default",displayName:"GitHub Dark Default",type:"dark",import:()=>e.A(576963)},{id:"github-dark-dimmed",displayName:"GitHub Dark Dimmed",type:"dark",import:()=>e.A(329581)},{id:"github-dark-high-contrast",displayName:"GitHub Dark High Contrast",type:"dark",import:()=>e.A(195279)},{id:"github-light",displayName:"GitHub Light",type:"light",import:()=>e.A(516651)},{id:"github-light-default",displayName:"GitHub Light Default",type:"light",import:()=>e.A(689651)},{id:"github-light-high-contrast",displayName:"GitHub Light High Contrast",type:"light",import:()=>e.A(642036)},{id:"gruvbox-dark-hard",displayName:"Gruvbox Dark Hard",type:"dark",import:()=>e.A(840055)},{id:"gruvbox-dark-medium",displayName:"Gruvbox Dark Medium",type:"dark",import:()=>e.A(398687)},{id:"gruvbox-dark-soft",displayName:"Gruvbox Dark Soft",type:"dark",import:()=>e.A(18935)},{id:"gruvbox-light-hard",displayName:"Gruvbox Light Hard",type:"light",import:()=>e.A(52380)},{id:"gruvbox-light-medium",displayName:"Gruvbox Light Medium",type:"light",import:()=>e.A(24410)},{id:"gruvbox-light-soft",displayName:"Gruvbox Light Soft",type:"light",import:()=>e.A(795210)},{id:"houston",displayName:"Houston",type:"dark",import:()=>e.A(695303)},{id:"kanagawa-dragon",displayName:"Kanagawa Dragon",type:"dark",import:()=>e.A(686210)},{id:"kanagawa-lotus",displayName:"Kanagawa Lotus",type:"light",import:()=>e.A(847729)},{id:"kanagawa-wave",displayName:"Kanagawa Wave",type:"dark",import:()=>e.A(233589)},{id:"laserwave",displayName:"LaserWave",type:"dark",import:()=>e.A(951946)},{id:"light-plus",displayName:"Light Plus",type:"light",import:()=>e.A(279775)},{id:"material-theme",displayName:"Material Theme",type:"dark",import:()=>e.A(593928)},{id:"material-theme-darker",displayName:"Material Theme Darker",type:"dark",import:()=>e.A(198658)},{id:"material-theme-lighter",displayName:"Material Theme Lighter",type:"light",import:()=>e.A(270659)},{id:"material-theme-ocean",displayName:"Material Theme Ocean",type:"dark",import:()=>e.A(320719)},{id:"material-theme-palenight",displayName:"Material Theme Palenight",type:"dark",import:()=>e.A(525766)},{id:"min-dark",displayName:"Min Dark",type:"dark",import:()=>e.A(610344)},{id:"min-light",displayName:"Min Light",type:"light",import:()=>e.A(100684)},{id:"monokai",displayName:"Monokai",type:"dark",import:()=>e.A(291123)},{id:"night-owl",displayName:"Night Owl",type:"dark",import:()=>e.A(198410)},{id:"nord",displayName:"Nord",type:"dark",import:()=>e.A(785810)},{id:"one-dark-pro",displayName:"One Dark Pro",type:"dark",import:()=>e.A(350612)},{id:"one-light",displayName:"One Light",type:"light",import:()=>e.A(492494)},{id:"plastic",displayName:"Plastic",type:"dark",import:()=>e.A(59650)},{id:"poimandres",displayName:"Poimandres",type:"dark",import:()=>e.A(533273)},{id:"red",displayName:"Red",type:"dark",import:()=>e.A(473810)},{id:"rose-pine",displayName:"Rosé Pine",type:"dark",import:()=>e.A(486978)},{id:"rose-pine-dawn",displayName:"Rosé Pine Dawn",type:"light",import:()=>e.A(371553)},{id:"rose-pine-moon",displayName:"Rosé Pine Moon",type:"dark",import:()=>e.A(297035)},{id:"slack-dark",displayName:"Slack Dark",type:"dark",import:()=>e.A(747632)},{id:"slack-ochin",displayName:"Slack Ochin",type:"light",import:()=>e.A(93215)},{id:"snazzy-light",displayName:"Snazzy Light",type:"light",import:()=>e.A(612986)},{id:"solarized-dark",displayName:"Solarized Dark",type:"dark",import:()=>e.A(255674)},{id:"solarized-light",displayName:"Solarized Light",type:"light",import:()=>e.A(731013)},{id:"synthwave-84",displayName:"Synthwave '84",type:"dark",import:()=>e.A(94801)},{id:"tokyo-night",displayName:"Tokyo Night",type:"dark",import:()=>e.A(457836)},{id:"vesper",displayName:"Vesper",type:"dark",import:()=>e.A(13877)},{id:"vitesse-black",displayName:"Vitesse Black",type:"dark",import:()=>e.A(448048)},{id:"vitesse-dark",displayName:"Vitesse Dark",type:"dark",import:()=>e.A(639922)},{id:"vitesse-light",displayName:"Vitesse Light",type:"light",import:()=>e.A(595345)}].map(e=>[e.id,e.import]));var rX=e.i(520683);class rJ extends Error{constructor(e){super(e),this.name="ShikiError"}}function rZ(){return"u">typeof performance?performance.now():Date.now()}let rQ=(e,t)=>e+(t-e%t)%t;async function r0(e){let t,r,n={};function i(e){r=e,n.HEAPU8=new Uint8Array(e),n.HEAPU32=new Uint32Array(e)}let s="u">typeof TextDecoder?new TextDecoder("utf8"):void 0;function a(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&&s)return s.decode(e.subarray(t,i));let a="";for(;t<i;){let r=e[t++];if(!(128&r)){a+=String.fromCharCode(r);continue}let n=63&e[t++];if((224&r)==192){a+=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)a+=String.fromCharCode(r);else{let e=r-65536;a+=String.fromCharCode(55296|e>>10,56320|1023&e)}}return a}(n.HEAPU8,e,t):""}let o={emscripten_get_now:rZ,emscripten_memcpy_big:function(e,t,r){n.HEAPU8.copyWithin(e,t,t+r)},emscripten_resize_heap:function(e){let s=n.HEAPU8.length;if((e>>>=0)>0x80000000)return!1;for(let n=1;n<=4;n*=2){let a=s*(1+.2/n);if(a=Math.min(a,e+0x6000000),function(e){try{return t.grow(e-r.byteLength+65535>>>16),i(t.buffer),1}catch{}}(Math.min(0x80000000,rQ(Math.max(e,a),65536))))return!0}return!1},fd_write:()=>0};async function l(){let r=await e({env:o,wasi_snapshot_preview1:o});i((t=r.memory).buffer),Object.assign(n,r),n.UTF8ToString=a}return await l(),n}var r1=Object.defineProperty,r2=(e,t,r)=>{let n;return(n="symbol"!=typeof t?t+"":t)in e?r1(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r};let r5=null;class r3{constructor(e){r2(this,"utf16Length"),r2(this,"utf8Length"),r2(this,"utf16Value"),r2(this,"utf8Value"),r2(this,"utf16OffsetToUtf8"),r2(this,"utf8OffsetToUtf16");const t=e.length,r=r3._utf8ByteLength(e),n=r!==t,i=n?new Uint32Array(t+1):null;n&&(i[t]=r);const s=n?new Uint32Array(r+1):null;n&&(s[r]=t);const a=new Uint8Array(r);let o=0;for(let r=0;r<t;r++){const l=e.charCodeAt(r);let c=l,u=!1;if(l>=55296&&l<=56319&&r+1<t){const t=e.charCodeAt(r+1);t>=56320&&t<=57343&&(c=(l-55296<<10)+65536|t-56320,u=!0)}n&&(i[r]=o,u&&(i[r+1]=o),c<=127?s[o+0]=r:c<=2047?(s[o+0]=r,s[o+1]=r):c<=65535?(s[o+0]=r,s[o+1]=r,s[o+2]=r):(s[o+0]=r,s[o+1]=r,s[o+2]=r,s[o+3]=r)),c<=127?a[o++]=c:(c<=2047?a[o++]=192|(1984&c)>>>6:(c<=65535?a[o++]=224|(61440&c)>>>12:(a[o++]=240|(1835008&c)>>>18,a[o++]=128|(258048&c)>>>12),a[o++]=128|(4032&c)>>>6),a[o++]=128|(63&c)>>>0),u&&r++}this.utf16Length=t,this.utf8Length=r,this.utf16Value=e,this.utf8Value=a,this.utf16OffsetToUtf8=i,this.utf8OffsetToUtf16=s}static _utf8ByteLength(e){let t=0;for(let r=0,n=e.length;r<n;r++){let i=e.charCodeAt(r),s=i,a=!1;if(i>=55296&&i<=56319&&r+1<n){let t=e.charCodeAt(r+1);t>=56320&&t<=57343&&(s=(i-55296<<10)+65536|t-56320,a=!0)}s<=127?t+=1:s<=2047?t+=2:s<=65535?t+=3:t+=4,a&&r++}return t}createString(e){let t=e.omalloc(this.utf8Length);return e.HEAPU8.set(this.utf8Value,t),t}}let r6=class e{constructor(t){if(r2(this,"id",++e.LAST_ID),r2(this,"_onigBinding"),r2(this,"content"),r2(this,"utf16Length"),r2(this,"utf8Length"),r2(this,"utf16OffsetToUtf8"),r2(this,"utf8OffsetToUtf16"),r2(this,"ptr"),!r5)throw new rJ("Must invoke loadWasm first.");this._onigBinding=r5,this.content=t;const r=new r3(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=r5.omalloc(1e4)),e._sharedPtrInUse=!0,r5.HEAPU8.set(r.utf8Value,e._sharedPtr),this.ptr=e._sharedPtr):this.ptr=r.createString(r5)}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)}};r2(r6,"LAST_ID",0),r2(r6,"_sharedPtr",0),r2(r6,"_sharedPtrInUse",!1);class r8{constructor(e){if(r2(this,"_onigBinding"),r2(this,"_ptr"),!r5)throw new rJ("Must invoke loadWasm first.");const t=[],r=[];for(let n=0,i=e.length;n<i;n++){const i=new r3(e[n]);t[n]=i.createString(r5),r[n]=i.utf8Length}const n=r5.omalloc(4*e.length);r5.HEAPU32.set(t,n/4);const i=r5.omalloc(4*e.length);r5.HEAPU32.set(r,i/4);const s=r5.createOnigScanner(n,i,e.length);for(let r=0,n=e.length;r<n;r++)r5.ofree(t[r]);r5.ofree(i),r5.ofree(n),0===s&&function(e){throw new rJ(e.UTF8ToString(e.getLastOnigError()))}(r5),this._onigBinding=r5,this._ptr=s}dispose(){this._onigBinding.freeOnigScanner(this._ptr)}findNextMatchSync(e,t,r){let n=0;if("number"==typeof r&&(n=r),"string"==typeof e){e=new r6(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,s=i.findNextOnigScannerMatch(this._ptr,e.id,e.ptr,e.utf8Length,e.convertUtf16OffsetToUtf8(t),n);if(0===s)return null;let a=i.HEAPU32,o=s/4,l=a[o++],c=a[o++],u=[];for(let t=0;t<c;t++){let r=e.convertUtf8OffsetToUtf16(a[o++]),n=e.convertUtf8OffsetToUtf16(a[o++]);u[t]={start:r,end:n,length:n-r}}return{index:l,captureIndices:u}}}function r4(e){return t=>WebAssembly.instantiate(e,t)}async function r9(e){return e&&await (r||(r=async function(){r5=await r0(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,s,a;if(void 0!==r.data&&(r=r.data),n=r,"u">typeof Response&&n instanceof Response){r="function"==typeof WebAssembly.instantiateStreaming?await (s=r,e=>WebAssembly.instantiateStreaming(s,e))(t):await (a=r,async e=>{let t=await a.arrayBuffer();return WebAssembly.instantiate(t,e)})(t)}else(i=r,"u">typeof ArrayBuffer&&(i instanceof ArrayBuffer||ArrayBuffer.isView(i))||void 0!==rX.Buffer&&rX.Buffer.isBuffer?.(i)||"u">typeof SharedArrayBuffer&&i instanceof SharedArrayBuffer||"u">typeof Uint32Array&&i instanceof Uint32Array||r instanceof WebAssembly.Module)?r=await r4(r)(t):"default"in r&&r.default instanceof WebAssembly.Module&&(r=await r4(r.default)(t))}return"instance"in r&&(r=r.instance),"exports"in r&&(r=r.exports),r})}())),{createScanner:e=>new r8(e.map(e=>"string"==typeof e?e:e.source)),createString:e=>new r6(e)}}let r7=(o=(f={langs:ew,themes:rY,engine:()=>r9(e.A(259500))}).langs,l=f.themes,c=f.engine,async function(e){function t(t){if("string"==typeof t){if(rd(t=e.langAlias?.[t]||t))return[];let r=o[t];if(!r)throw new ek(`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(rh(e))return"none";if("string"==typeof e){let t=l[e];if(!t)throw new ek(`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)),s=await rK({engine:e.engine??c(),...e,themes:n,langs:i});return{...s,loadLanguage:(...e)=>s.loadLanguage(...e.map(t)),loadTheme:(...e)=>s.loadTheme(...e.map(r)),getBundledLanguages:()=>o,getBundledThemes:()=>l}});var ne=new Set(Object.keys(ew)),nt=new Map,nr=new Map,nn=new Map,ni=function(e={}){var t;let r=null!=(t=e.themes)?t:["github-light","github-dark"];return{name:"shiki",type:"code-highlighter",supportsLanguage:e=>ne.has(e),getSupportedLanguages:()=>Array.from(ne),getThemes:()=>r,highlight({code:e,language:t,themes:r},n){let i,s,a=(i=e.slice(0,100),s=e.length>100?e.slice(-100):"",`${t}:${r[0]}:${r[1]}:${e.length}:${i}:${s}`);return nr.has(a)?nr.get(a):(n&&(nn.has(a)||nn.set(a,new Set),nn.get(a).add(n)),((e,t)=>{let r=`${e}-${t[0]}-${t[1]}`;if(nt.has(r))return nt.get(r);let n=r7({themes:t,langs:[e]});return nt.set(r,n),n})(t,r).then(n=>{let i=n.getLoadedLanguages().includes(t)?t:"text",s=n.codeToTokens(e,{lang:i,themes:{light:r[0],dark:r[1]}});nr.set(a,s);let o=nn.get(a);if(o){for(let e of o)e(s);nn.delete(a)}}).catch(e=>{console.error("[Streamdown Code] Failed to highlight code:",e),nn.delete(a)}),null)}}}(),ns=e.i(501201),na=e.i(178747);function no(e,t){let r=function(e,t){switch(e.nodeType){case 1:return function(e,t){let r=e.namespaceURI,n=r===na.webNamespaces.svg?ns.s:ns.h,i=r===na.webNamespaces.html?e.tagName.toLowerCase():e.tagName,s=r===na.webNamespaces.html&&"template"===i?e.content:e,a=e.getAttributeNames(),o={},l=-1;for(;++l<a.length;)o[a[l]]=e.getAttribute(a[l])||"";return n(i,o,nl(s,t))}(e,t);case 3:return{type:"text",value:e.nodeValue||""};case 8:return{type:"comment",value:e.nodeValue||""};case 9:case 11:return function(e,t){return{type:"root",children:nl(e,t)}}(e,t);case 10:return{type:"doctype"};default:return}}(e,t);return r&&t.afterTransform&&t.afterTransform(e,r),r}function nl(e,t){let r=e.childNodes,n=[],i=-1;for(;++i<r.length;){let e=no(r[i],t);void 0!==e&&n.push(e)}return n}let nc=new DOMParser;var nu=e.i(336200);let nd=function(e,t,r){let n=(0,nu.convert)(r);if(!e||!e.type||!e.children)throw Error("Expected parent node");if("number"==typeof t){if(t<0||t===1/0)throw Error("Expected positive finite number as index")}else if((t=e.children.indexOf(t))<0)throw Error("Expected child node or index");for(;++t<e.children.length;)if(n(e.children[t],t,e))return e.children[t]},nh=function(e){if(null==e)return nm;if("string"==typeof e){var t;return t=e,np(function(e){return e.tagName===t})}if("object"==typeof e){var r=e;let t=[],n=-1;for(;++n<r.length;)t[n]=nh(r[n]);return np(function(...e){let r=-1;for(;++r<t.length;)if(t[r].apply(this,e))return!0;return!1})}if("function"==typeof e)return np(e);throw Error("Expected function, string, or array as `test`")};function np(e){return function(t,r,n){var i;return!!(null!==(i=t)&&"object"==typeof i&&"type"in i&&"tagName"in i&&e.call(this,t,"number"==typeof r?r:void 0,n||void 0))}}function nm(e){return!!(e&&"object"==typeof e&&"type"in e&&"element"===e.type&&"tagName"in e&&"string"==typeof e.tagName)}let nf=/\n/g,ng=/[\t ]+/g,ny=nh("br"),nx=nh(function(e){return"td"===e.tagName||"th"===e.tagName}),nv=nh("p"),nb=nh("tr"),nw=nh(["datalist","head","noembed","noframes","noscript","rp","script","style","template","title",function(e){return!!(e.properties||{}).hidden},function(e){return"dialog"===e.tagName&&!(e.properties||{}).open}]),nk=nh(["address","article","aside","blockquote","body","caption","center","dd","dialog","dir","dl","dt","div","figure","figcaption","footer","form,","h1","h2","h3","h4","h5","h6","header","hgroup","hr","html","legend","li","listing","main","menu","nav","ol","p","plaintext","pre","section","ul","xmp"]);function nS(e,t){let r,n=String(e.value),i=[],s=[],a=0;for(;a<=n.length;){nf.lastIndex=a;let e=nf.exec(n),r=e&&"index"in e?e.index:n.length;i.push(function(e,t,r){let n,i=[],s=0;for(;s<e.length;){ng.lastIndex=s;let r=ng.exec(e);n=r?r.index:e.length,s||n||!r||t||i.push(""),s!==n&&i.push(e.slice(s,n)),s=r?n+r[0].length:n}return s===n||r||i.push(""),i.join(" ")}(n.slice(a,r).replace(/[\u061C\u200E\u200F\u202A-\u202E\u2066-\u2069]/g,""),0!==a||t.breakBefore,r!==n.length||t.breakAfter)),a=r+1}let o=-1;for(;++o<i.length;)8203===i[o].charCodeAt(i[o].length-1)||o<i.length-1&&8203===i[o+1].charCodeAt(0)?(s.push(i[o]),r=void 0):i[o]?("number"==typeof r&&s.push(r),s.push(i[o]),r=0):(0===o||o===i.length-1)&&s.push(0);return s}function nj(e,t){if("element"===e.type){let r=e.properties||{};switch(e.tagName){case"listing":case"plaintext":case"xmp":return"pre";case"nobr":return"nowrap";case"pre":return r.wrap?"pre-wrap":"pre";case"td":case"th":return r.noWrap?"nowrap":t.whitespace;case"textarea":return"pre-wrap"}}return t.whitespace}var nA=e.i(751692),nN=e.i(687685);let nC={},n_=[];function nT(e){let t=e||nC;return function(e,r){(0,nN.visitParents)(e,"element",function(e,n){let i,s=Array.isArray(e.properties.className)?e.properties.className:n_,a=s.includes("language-math"),o=s.includes("math-display"),l=s.includes("math-inline"),c=o;if(!a&&!o&&!l)return;let u=n[n.length-1],d=e;if("code"===e.tagName&&a&&u&&"element"===u.type&&"pre"===u.tagName&&(d=u,u=n[n.length-2],c=!0),!u)return;let h=function(e,t){let r,n="children"in e?e.children:[],i=nk(e),s=nj(e,{whitespace:(t||{}).whitespace||"normal",breakBefore:!1,breakAfter:!1}),a=[];("text"===e.type||"comment"===e.type)&&a.push(...nS(e,{whitespace:s,breakBefore:!0,breakAfter:!0}));let o=-1;for(;++o<n.length;)a.push(...function e(t,r,n){return"element"===t.type?function(t,r,n){let i,s,a=nj(t,n),o=t.children||[],l=-1,c=[];if(nw(t))return c;for(ny(t)||nb(t)&&nd(r,t,nb)?s="\n":nv(t)?(i=2,s=2):nk(t)&&(i=1,s=1);++l<o.length;)c=c.concat(e(o[l],t,{whitespace:a,breakBefore:l?void 0:i,breakAfter:l<o.length-1?ny(o[l+1]):s}));return nx(t)&&nd(r,t,nx)&&c.push(" "),i&&c.unshift(i),s&&c.push(s),c}(t,r,n):"text"===t.type?"normal"===n.whitespace?nS(t,n):[String(t.value)]:[]}(n[o],e,{whitespace:s,breakBefore:o?void 0:i,breakAfter:o<n.length-1?ny(n[o+1]):i}));let l=[];for(o=-1;++o<a.length;){let e=a[o];"number"==typeof e?void 0!==r&&e>r&&(r=e):e&&(void 0!==r&&r>-1&&l.push("\n".repeat(r)||" "),r=-1,l.push(e))}return l.join("")}(d,{whitespace:"pre"});try{i=nA.default.renderToString(h,{...t,displayMode:c,throwOnError:!0})}catch(a){let s=a.name.toLowerCase();r.message("Could not render math with KaTeX",{ancestors:[...n,e],cause:a,place:e.position,ruleId:s,source:"rehype-katex"});try{i=nA.default.renderToString(h,{...t,displayMode:c,strict:"ignore",throwOnError:!1})}catch{i=[{type:"element",tagName:"span",properties:{className:["katex-error"],style:"color:"+(t.errorColor||"#cc0000"),title:String(a)},children:[{type:"text",value:h}]}]}}if("string"==typeof i){var p,m,f;let e;i=(p=i,m={fragment:!0},no(m?.fragment?(f=p,(e=document.createElement("template")).innerHTML=f,e.content):nc.parseFromString(p,"text/html"),{})||{type:"root",children:[]}).children}let g=u.children.indexOf(d);return u.children.splice(g,1,...i),nN.SKIP})}}var nE=e.i(529008),nP=e.i(854732);let nR={tokenize:function(e,t,r){let n=this,i=n.events[n.events.length-1],s=i&&"linePrefix"===i[1].type?i[2].sliceSerialize(i[1],!0).length:0,a=0;return function(t){return e.enter("mathFlow"),e.enter("mathFlowFence"),e.enter("mathFlowFenceSequence"),function t(n){return 36===n?(e.consume(n),a++,t):a<2?r(n):(e.exit("mathFlowFenceSequence"),(0,nP.factorySpace)(e,o,"whitespace")(n))}(t)};function o(t){return null===t||(0,q.markdownLineEnding)(t)?l(t):(e.enter("mathFlowFenceMeta"),e.enter("chunkString",{contentType:"string"}),function t(n){return null===n||(0,q.markdownLineEnding)(n)?(e.exit("chunkString"),e.exit("mathFlowFenceMeta"),l(n)):36===n?r(n):(e.consume(n),t)}(t))}function l(r){return(e.exit("mathFlowFence"),n.interrupt)?t(r):e.attempt(nM,c,h)(r)}function c(t){return e.attempt({tokenize:p,partial:!0},h,u)(t)}function u(t){return(s?(0,nP.factorySpace)(e,d,"linePrefix",s+1):d)(t)}function d(t){return null===t?h(t):(0,q.markdownLineEnding)(t)?e.attempt(nM,c,h)(t):(e.enter("mathFlowValue"),function t(r){return null===r||(0,q.markdownLineEnding)(r)?(e.exit("mathFlowValue"),d(r)):(e.consume(r),t)}(t))}function h(r){return e.exit("mathFlow"),t(r)}function p(e,t,r){let i=0;return(0,nP.factorySpace)(e,function(t){return e.enter("mathFlowFence"),e.enter("mathFlowFenceSequence"),function t(n){return 36===n?(i++,e.consume(n),t):i<a?r(n):(e.exit("mathFlowFenceSequence"),(0,nP.factorySpace)(e,s,"whitespace")(n))}(t)},"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4);function s(n){return null===n||(0,q.markdownLineEnding)(n)?(e.exit("mathFlowFence"),t(n)):r(n)}}},concrete:!0,name:"mathFlow"},nM={tokenize:function(e,t,r){let n=this;return function(r){return null===r?t(r):(e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),i)};function i(e){return n.parser.lazy[n.now().line]?r(e):t(e)}},partial:!0};function nL(e){let t,r,n=e.length-4,i=3;if(("lineEnding"===e[3][1].type||"space"===e[i][1].type)&&("lineEnding"===e[n][1].type||"space"===e[n][1].type)){for(t=i;++t<n;)if("mathTextData"===e[t][1].type){e[n][1].type="mathTextPadding",e[i][1].type="mathTextPadding",i+=2,n-=2;break}}for(t=i-1,n++;++t<=n;)void 0===r?t!==n&&"lineEnding"!==e[t][1].type&&(r=t):(t===n||"lineEnding"===e[t][1].type)&&(e[r][1].type="mathTextData",t!==r+2&&(e[r][1].end=e[t-1][1].end,e.splice(r+2,t-r-2),n-=t-r-2,t=r+2),r=void 0);return e}function nI(e){return 36!==e||"characterEscape"===this.events[this.events.length-1][1].type}let nD={};function nO(e){let t,r=e||nD,n=this.data(),i=n.micromarkExtensions||(n.micromarkExtensions=[]),s=n.fromMarkdownExtensions||(n.fromMarkdownExtensions=[]),a=n.toMarkdownExtensions||(n.toMarkdownExtensions=[]);i.push({flow:{36:nR},text:{36:(null==(t=(r||{}).singleDollarTextMath)&&(t=!0),{tokenize:function(e,r,n){let i,s,a=0;return function(r){return e.enter("mathText"),e.enter("mathTextSequence"),function r(i){return 36===i?(e.consume(i),a++,r):a<2&&!t?n(i):(e.exit("mathTextSequence"),o(i))}(r)};function o(t){return null===t?n(t):36===t?(s=e.enter("mathTextSequence"),i=0,function t(n){return 36===n?(e.consume(n),i++,t):i===a?(e.exit("mathTextSequence"),e.exit("mathText"),r(n)):(s.type="mathTextData",l(n))}(t)):32===t?(e.enter("space"),e.consume(t),e.exit("space"),o):(0,q.markdownLineEnding)(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),o):(e.enter("mathTextData"),l(t))}function l(t){return null===t||32===t||36===t||(0,q.markdownLineEnding)(t)?(e.exit("mathTextData"),o(t)):(e.consume(t),l)}},resolve:nL,previous:nI,name:"mathText"})}}),s.push(function(){return{enter:{mathFlow:function(e){this.enter({type:"math",meta:null,value:"",data:{hName:"pre",hChildren:[{type:"element",tagName:"code",properties:{className:["language-math","math-display"]},children:[]}]}},e)},mathFlowFenceMeta:function(){this.buffer()},mathText:function(e){this.enter({type:"inlineMath",value:"",data:{hName:"code",hProperties:{className:["language-math","math-inline"]},hChildren:[]}},e),this.buffer()}},exit:{mathFlow:function(e){let t=this.resume().replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),r=this.stack[this.stack.length-1];(0,H.ok)("math"===r.type),this.exit(e),r.value=t;let n=r.data.hChildren[0];(0,H.ok)("element"===n.type),(0,H.ok)("code"===n.tagName),n.children.push({type:"text",value:t}),this.data.mathFlowInside=void 0},mathFlowFence:function(){this.data.mathFlowInside||(this.buffer(),this.data.mathFlowInside=!0)},mathFlowFenceMeta:function(){let e=this.resume(),t=this.stack[this.stack.length-1];(0,H.ok)("math"===t.type),t.meta=e},mathFlowValue:e,mathText:function(e){let t=this.resume(),r=this.stack[this.stack.length-1];(0,H.ok)("inlineMath"===r.type),this.exit(e),r.value=t,r.data.hChildren.push({type:"text",value:t})},mathTextData:e}};function e(e){this.config.enter.data.call(this,e),this.config.exit.data.call(this,e)}}()),a.push(function(e){let t=(e||{}).singleDollarTextMath;return null==t&&(t=!0),r.peek=function(){return"$"},{unsafe:[{character:"\r",inConstruct:"mathFlowMeta"},{character:"\n",inConstruct:"mathFlowMeta"},{character:"$",after:t?void 0:"\\$",inConstruct:"phrasing"},{character:"$",inConstruct:"mathFlowMeta"},{atBreak:!0,character:"$",after:"\\$"}],handlers:{math:function(e,t,r,n){let i=e.value||"",s=r.createTracker(n),a="$".repeat(Math.max((0,nE.longestStreak)(i,"$")+1,2)),o=r.enter("mathFlow"),l=s.move(a);if(e.meta){let t=r.enter("mathFlowMeta");l+=s.move(r.safe(e.meta,{after:"\n",before:l,encode:["$"],...s.current()})),t()}return l+=s.move("\n"),i&&(l+=s.move(i+"\n")),l+=s.move(a),o(),l},inlineMath:r}};function r(e,r,n){let i=e.value||"",s=1;for(!t&&s++;RegExp("(^|[^$])"+"\\$".repeat(s)+"([^$]|$)").test(i);)s++;let a="$".repeat(s);/[^ \r\n]/.test(i)&&(/^[ \r\n]/.test(i)&&/[ \r\n]$/.test(i)||/^\$|\$$/.test(i))&&(i=" "+i+" ");let o=-1;for(;++o<n.unsafe.length;){let e,t=n.unsafe[o];if(!t.atBreak)continue;let r=n.compilePattern(t);for(;e=r.exec(i);){let t=e.index;10===i.codePointAt(t)&&13===i.codePointAt(t-1)&&t--,i=i.slice(0,t)+" "+i.slice(e.index+1)}}return a+i+a}}(r))}var nB=function(e={}){var t,r;return{name:"katex",type:"math",remarkPlugin:[nO,{singleDollarTextMath:null!=(t=e.singleDollarTextMath)&&t}],rehypePlugin:[nT,{errorColor:null!=(r=e.errorColor)?r:"var(--color-muted-foreground)"}],getStyles:()=>"katex/dist/katex.min.css"}}(),nF=e.i(356212),n$=e.i(687734),nz=e.i(856012),nV=e.i(364601);e.i(628511),e.i(537981),e.i(17415),e.i(661981),e.i(916048);var nU=e.i(284421),nG=e.i(97482),nW=e.i(209026),nH=e.i(460753),nq=e.i(116288);e.i(492314);var nK=e.i(59955),nY="comm",nX="rule",nJ="decl",nZ=Math.abs,nQ=String.fromCharCode;function n0(e,t,r){return e.replace(t,r)}function n1(e,t){return 0|e.charCodeAt(t)}function n2(e,t,r){return e.slice(t,r)}function n5(e){return e.length}function n3(e,t){return t.push(e),e}var n6=1,n8=1,n4=0,n9=0,n7=0,ie="";function it(e,t,r,n,i,s,a,o){return{value:e,root:t,parent:r,type:n,props:i,children:s,line:n6,column:n8,length:a,return:"",siblings:o}}function ir(){return n7=n9<n4?n1(ie,n9++):0,n8++,10===n7&&(n8=1,n6++),n7}function ii(){return n1(ie,n9)}function is(e){switch(e){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function ia(e){var t,r;return(t=n9-1,r=function e(t){for(;ir();)switch(n7){case t:return n9;case 34:case 39:34!==t&&39!==t&&e(n7);break;case 40:41===t&&e(t);break;case 92:ir()}return n9}(91===e?e+2:40===e?e+1:e),n2(ie,t,r)).trim()}function io(e,t,r,n,i,s,a,o,l,c,u,d){for(var h=i-1,p=0===i?s:[""],m=p.length,f=0,g=0,y=0;f<n;++f)for(var x=0,v=n2(e,h+1,h=nZ(g=a[f])),b=e;x<m;++x)(b=(g>0?p[x]+" "+v:n0(v,/&\f/g,p[x])).trim())&&(l[y++]=b);return it(e,t,r,0===i?nX:o,l,c,u,d)}function il(e,t,r,n,i){return it(e,t,r,nJ,n2(e,0,n),n2(e,n+1,-1),n,i)}function ic(e,t){for(var r="",n=0;n<e.length;n++)r+=t(e[n],n,e,t)||"";return r}function iu(e,t,r,n){switch(e.type){case"@layer":if(e.children.length)break;case"@import":case"@namespace":case nJ:return e.return=e.return||e.value;case nY:return"";case"@keyframes":return e.return=e.value+"{"+ic(e.children,n)+"}";case nX:if(!n5(e.value=e.props.join(",")))return""}return n5(r=ic(e.children,n))?e.return=e.value+"{"+r+"}":""}var id=e.i(190002),ih=e.i(473063),ip={id:"c4",detector:(0,nH.__name)(e=>/^\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/.test(e),"detector"),loader:(0,nH.__name)(async()=>{let{diagram:t}=await e.A(533915);return{id:"c4",diagram:t}},"loader")},im="flowchart",ig=(0,nH.__name)((e,t)=>t?.flowchart?.defaultRenderer!=="dagre-wrapper"&&t?.flowchart?.defaultRenderer!=="elk"&&/^\s*graph/.test(e),"detector"),iy=(0,nH.__name)(async()=>{let{diagram:t}=await e.A(956761);return{id:im,diagram:t}},"loader"),ix={id:im,detector:ig,loader:iy},iv="flowchart-v2",ib=(0,nH.__name)((e,t)=>t?.flowchart?.defaultRenderer!=="dagre-d3"&&(t?.flowchart?.defaultRenderer==="elk"&&(t.layout="elk"),!!/^\s*graph/.test(e)&&t?.flowchart?.defaultRenderer==="dagre-wrapper"||/^\s*flowchart/.test(e)),"detector"),iw=(0,nH.__name)(async()=>{let{diagram:t}=await e.A(956761);return{id:iv,diagram:t}},"loader"),ik={id:iv,detector:ib,loader:iw},iS={id:"er",detector:(0,nH.__name)(e=>/^\s*erDiagram/.test(e),"detector"),loader:(0,nH.__name)(async()=>{let{diagram:t}=await e.A(943185);return{id:"er",diagram:t}},"loader")},ij="gitGraph",iA=(0,nH.__name)(e=>/^\s*gitGraph/.test(e),"detector"),iN=(0,nH.__name)(async()=>{let{diagram:t}=await e.A(388129);return{id:ij,diagram:t}},"loader"),iC={id:ij,detector:iA,loader:iN},i_="gantt",iT=(0,nH.__name)(e=>/^\s*gantt/.test(e),"detector"),iE=(0,nH.__name)(async()=>{let{diagram:t}=await e.A(941076);return{id:i_,diagram:t}},"loader"),iP={id:i_,detector:iT,loader:iE},iR="info",iM=(0,nH.__name)(e=>/^\s*info/.test(e),"detector"),iL=(0,nH.__name)(async()=>{let{diagram:t}=await e.A(781187);return{id:iR,diagram:t}},"loader"),iI={id:iR,detector:iM,loader:iL},iD={id:"pie",detector:(0,nH.__name)(e=>/^\s*pie/.test(e),"detector"),loader:(0,nH.__name)(async()=>{let{diagram:t}=await e.A(459696);return{id:"pie",diagram:t}},"loader")},iO="quadrantChart",iB=(0,nH.__name)(e=>/^\s*quadrantChart/.test(e),"detector"),iF=(0,nH.__name)(async()=>{let{diagram:t}=await e.A(348039);return{id:iO,diagram:t}},"loader"),i$={id:iO,detector:iB,loader:iF},iz="xychart",iV=(0,nH.__name)(e=>/^\s*xychart(-beta)?/.test(e),"detector"),iU=(0,nH.__name)(async()=>{let{diagram:t}=await e.A(110104);return{id:iz,diagram:t}},"loader"),iG={id:iz,detector:iV,loader:iU},iW="requirement",iH=(0,nH.__name)(e=>/^\s*requirement(Diagram)?/.test(e),"detector"),iq=(0,nH.__name)(async()=>{let{diagram:t}=await e.A(666358);return{id:iW,diagram:t}},"loader"),iK={id:iW,detector:iH,loader:iq},iY="sequence",iX=(0,nH.__name)(e=>/^\s*sequenceDiagram/.test(e),"detector"),iJ=(0,nH.__name)(async()=>{let{diagram:t}=await e.A(966453);return{id:iY,diagram:t}},"loader"),iZ={id:iY,detector:iX,loader:iJ},iQ="class",i0=(0,nH.__name)((e,t)=>t?.class?.defaultRenderer!=="dagre-wrapper"&&/^\s*classDiagram/.test(e),"detector"),i1=(0,nH.__name)(async()=>{let{diagram:t}=await e.A(723358);return{id:iQ,diagram:t}},"loader"),i2={id:iQ,detector:i0,loader:i1},i5="classDiagram",i3=(0,nH.__name)((e,t)=>!!/^\s*classDiagram/.test(e)&&t?.class?.defaultRenderer==="dagre-wrapper"||/^\s*classDiagram-v2/.test(e),"detector"),i6=(0,nH.__name)(async()=>{let{diagram:t}=await e.A(873682);return{id:i5,diagram:t}},"loader"),i8={id:i5,detector:i3,loader:i6},i4="state",i9=(0,nH.__name)((e,t)=>t?.state?.defaultRenderer!=="dagre-wrapper"&&/^\s*stateDiagram/.test(e),"detector"),i7=(0,nH.__name)(async()=>{let{diagram:t}=await e.A(334989);return{id:i4,diagram:t}},"loader"),se={id:i4,detector:i9,loader:i7},st="stateDiagram",sr=(0,nH.__name)((e,t)=>!!(/^\s*stateDiagram-v2/.test(e)||/^\s*stateDiagram/.test(e)&&t?.state?.defaultRenderer==="dagre-wrapper"),"detector"),sn=(0,nH.__name)(async()=>{let{diagram:t}=await e.A(740095);return{id:st,diagram:t}},"loader"),si={id:st,detector:sr,loader:sn},ss="journey",sa=(0,nH.__name)(e=>/^\s*journey/.test(e),"detector"),so=(0,nH.__name)(async()=>{let{diagram:t}=await e.A(984866);return{id:ss,diagram:t}},"loader"),sl={id:ss,detector:sa,loader:so},sc={draw:(0,nH.__name)((e,t,r)=>{nH.log.debug("rendering svg for syntax error\n");let n=(0,n$.selectSvgElement)(t),i=n.append("g");n.attr("viewBox","0 0 2412 512"),(0,nW.configureSvgSize)(n,100,512,!0),i.append("path").attr("class","error-icon").attr("d","m411.313,123.313c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32-9.375,9.375-20.688-20.688c-12.484-12.5-32.766-12.5-45.25,0l-16,16c-1.261,1.261-2.304,2.648-3.31,4.051-21.739-8.561-45.324-13.426-70.065-13.426-105.867,0-192,86.133-192,192s86.133,192 192,192 192-86.133 192-192c0-24.741-4.864-48.327-13.426-70.065 1.402-1.007 2.79-2.049 4.051-3.31l16-16c12.5-12.492 12.5-32.758 0-45.25l-20.688-20.688 9.375-9.375 32.001-31.999zm-219.313,100.687c-52.938,0-96,43.063-96,96 0,8.836-7.164,16-16,16s-16-7.164-16-16c0-70.578 57.422-128 128-128 8.836,0 16,7.164 16,16s-7.164,16-16,16z"),i.append("path").attr("class","error-icon").attr("d","m459.02,148.98c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l16,16c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16.001-16z"),i.append("path").attr("class","error-icon").attr("d","m340.395,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16-16c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l15.999,16z"),i.append("path").attr("class","error-icon").attr("d","m400,64c8.844,0 16-7.164 16-16v-32c0-8.836-7.156-16-16-16-8.844,0-16,7.164-16,16v32c0,8.836 7.156,16 16,16z"),i.append("path").attr("class","error-icon").attr("d","m496,96.586h-32c-8.844,0-16,7.164-16,16 0,8.836 7.156,16 16,16h32c8.844,0 16-7.164 16-16 0-8.836-7.156-16-16-16z"),i.append("path").attr("class","error-icon").attr("d","m436.98,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688l32-32c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32c-6.251,6.25-6.251,16.375-0.001,22.625z"),i.append("text").attr("class","error-text").attr("x",1440).attr("y",250).attr("font-size","150px").style("text-anchor","middle").text("Syntax error in text"),i.append("text").attr("class","error-text").attr("x",1250).attr("y",400).attr("font-size","100px").style("text-anchor","middle").text(`mermaid version ${r}`)},"draw")},su={db:{},renderer:sc,parser:{parse:(0,nH.__name)(()=>{},"parse")}},sd="flowchart-elk",sh=(0,nH.__name)((e,t={})=>!!(/^\s*flowchart-elk/.test(e)||/^\s*(flowchart|graph)/.test(e)&&t?.flowchart?.defaultRenderer==="elk")&&(t.layout="elk",!0),"detector"),sp=(0,nH.__name)(async()=>{let{diagram:t}=await e.A(956761);return{id:sd,diagram:t}},"loader"),sm={id:sd,detector:sh,loader:sp},sf="timeline",sg=(0,nH.__name)(e=>/^\s*timeline/.test(e),"detector"),sy=(0,nH.__name)(async()=>{let{diagram:t}=await e.A(886387);return{id:sf,diagram:t}},"loader"),sx={id:sf,detector:sg,loader:sy},sv="mindmap",sb=(0,nH.__name)(e=>/^\s*mindmap/.test(e),"detector"),sw=(0,nH.__name)(async()=>{let{diagram:t}=await e.A(391450);return{id:sv,diagram:t}},"loader"),sk={id:sv,detector:sb,loader:sw},sS="kanban",sj=(0,nH.__name)(e=>/^\s*kanban/.test(e),"detector"),sA=(0,nH.__name)(async()=>{let{diagram:t}=await e.A(870423);return{id:sS,diagram:t}},"loader"),sN={id:sS,detector:sj,loader:sA},sC="sankey",s_=(0,nH.__name)(e=>/^\s*sankey(-beta)?/.test(e),"detector"),sT=(0,nH.__name)(async()=>{let{diagram:t}=await e.A(390930);return{id:sC,diagram:t}},"loader"),sE={id:sC,detector:s_,loader:sT},sP="packet",sR=(0,nH.__name)(e=>/^\s*packet(-beta)?/.test(e),"detector"),sM=(0,nH.__name)(async()=>{let{diagram:t}=await e.A(776122);return{id:sP,diagram:t}},"loader"),sL={id:sP,detector:sR,loader:sM},sI="radar",sD=(0,nH.__name)(e=>/^\s*radar-beta/.test(e),"detector"),sO=(0,nH.__name)(async()=>{let{diagram:t}=await e.A(336554);return{id:sI,diagram:t}},"loader"),sB={id:sI,detector:sD,loader:sO},sF="block",s$=(0,nH.__name)(e=>/^\s*block(-beta)?/.test(e),"detector"),sz=(0,nH.__name)(async()=>{let{diagram:t}=await e.A(840096);return{id:sF,diagram:t}},"loader"),sV={id:sF,detector:s$,loader:sz},sU="architecture",sG=(0,nH.__name)(e=>/^\s*architecture/.test(e),"detector"),sW=(0,nH.__name)(async()=>{let{diagram:t}=await e.A(604139);return{id:sU,diagram:t}},"loader"),sH={id:sU,detector:sG,loader:sW},sq="treemap",sK=(0,nH.__name)(e=>/^\s*treemap/.test(e),"detector"),sY=(0,nH.__name)(async()=>{let{diagram:t}=await e.A(717464);return{id:sq,diagram:t}},"loader"),sX={id:sq,detector:sK,loader:sY},sJ=!1,sZ=(0,nH.__name)(()=>{sJ||(sJ=!0,(0,nW.registerDiagram)("error",su,e=>"error"===e.toLowerCase().trim()),(0,nW.registerDiagram)("---",{db:{clear:(0,nH.__name)(()=>{},"clear")},styles:{},renderer:{draw:(0,nH.__name)(()=>{},"draw")},parser:{parse:(0,nH.__name)(()=>{throw Error("Diagrams beginning with --- are not valid. If you were trying to use a YAML front-matter, please ensure that you've correctly opened and closed the YAML front-matter with un-indented `---` blocks")},"parse")},init:(0,nH.__name)(()=>null,"init")},e=>e.toLowerCase().trimStart().startsWith("---")),(0,nW.registerLazyLoadedDiagrams)(sm,sk,sH),(0,nW.registerLazyLoadedDiagrams)(ip,sN,i8,i2,iS,iP,iI,iD,iK,iZ,ik,ix,sx,iC,si,se,sl,i$,sE,sL,iG,sV,sB,sX))},"addDiagrams"),sQ=(0,nH.__name)(async()=>{nH.log.debug("Loading registered diagrams");let e=(await Promise.allSettled(Object.entries(nW.detectors).map(async([e,{detector:t,loader:r}])=>{if(r)try{(0,nW.getDiagram)(e)}catch{try{let{diagram:e,id:n}=await r();(0,nW.registerDiagram)(n,e,t)}catch(t){throw nH.log.error(`Failed to load external diagram with key ${e}. Removing from detectors.`),delete nW.detectors[e],t}}}))).filter(e=>"rejected"===e.status);if(e.length>0){for(let t of(nH.log.error(`Failed to load ${e.length} external diagrams`),e))nH.log.error(t);throw Error(`Failed to load ${e.length} external diagrams`)}},"loadRegisteredDiagrams");function s0(e,t){e.attr("role","graphics-document document"),""!==t&&e.attr("aria-roledescription",t)}function s1(e,t,r,n){if(void 0!==e.insert){if(r){let t=`chart-desc-${n}`;e.attr("aria-describedby",t),e.insert("desc",":first-child").attr("id",t).text(r)}if(t){let r=`chart-title-${n}`;e.attr("aria-labelledby",r),e.insert("title",":first-child").attr("id",r).text(t)}}}(0,nH.__name)(s0,"setA11yDiagramInfo"),(0,nH.__name)(s1,"addSVGa11yTitleDescription");var s2=class e{constructor(e,t,r,n,i){this.type=e,this.text=t,this.db=r,this.parser=n,this.renderer=i}static{(0,nH.__name)(this,"Diagram")}static async fromText(t,r={}){let n=(0,nW.getConfig)(),i=(0,nW.detectType)(t,n);t=(0,nG.encodeEntities)(t)+"\n";try{(0,nW.getDiagram)(i)}catch{let e=(0,nW.getDiagramLoader)(i);if(!e)throw new nW.UnknownDiagramError(`Diagram ${i} not found.`);let{id:t,diagram:r}=await e();(0,nW.registerDiagram)(t,r)}let{db:s,parser:a,renderer:o,init:l}=(0,nW.getDiagram)(i);return a.parser&&(a.parser.yy=s),s.clear?.(),l?.(n),r.title&&s.setDiagramTitle?.(r.title),await a.parse(t),new e(i,t,s,a,o)}async render(e,t){await this.renderer.draw(this.text,e,t,this)}getParser(){return this.parser}getType(){return this.type}},s5=[],s3=(0,nH.__name)(()=>{s5.forEach(e=>{e()}),s5=[]},"attachFunctions"),s6=(0,nH.__name)(e=>e.replace(/^\s*%%(?!{)[^\n]+\n?/gm,"").trimStart(),"cleanupComments");function s8(e){let t=e.match(nW.frontMatterRegex);if(!t)return{text:e,metadata:{}};let r=(0,nz.load)(t[1],{schema:nz.JSON_SCHEMA})??{};r="object"!=typeof r||Array.isArray(r)?{}:r;let n={};return r.displayMode&&(n.displayMode=r.displayMode.toString()),r.title&&(n.title=r.title.toString()),r.config&&(n.config=r.config),{text:e.slice(t[0].length),metadata:n}}(0,nH.__name)(s8,"extractFrontMatter");var s4=(0,nH.__name)(e=>e.replace(/\r\n?/g,"\n").replace(/<(\w+)([^>]*)>/g,(e,t,r)=>"<"+t+r.replace(/="([^"]*)"/g,"='$1'")+">"),"cleanupText"),s9=(0,nH.__name)(e=>{let{text:t,metadata:r}=s8(e),{displayMode:n,title:i,config:s={}}=r;return n&&(s.gantt||(s.gantt={}),s.gantt.displayMode=n),{title:i,config:s,text:t}},"processFrontmatter"),s7=(0,nH.__name)(e=>{let t=nG.utils_default.detectInit(e)??{},r=nG.utils_default.detectDirective(e,"wrap");return Array.isArray(r)?t.wrap=r.some(({type:e})=>"wrap"===e):r?.type==="wrap"&&(t.wrap=!0),{text:(0,nG.removeDirectives)(e),directive:t}},"processDirectives");function ae(e){let t=s9(s4(e)),r=s7(t.text),n=(0,nG.cleanAndMerge)(t.config,r.directive);return{code:e=s6(r.text),title:t.title,config:n}}function at(e){return btoa(Array.from(new TextEncoder().encode(e),e=>String.fromCodePoint(e)).join(""))}(0,nH.__name)(ae,"preprocessDiagram"),(0,nH.__name)(at,"toBase64");var ar=["foreignobject"],an=["dominant-baseline"];function ai(e){let t=ae(e);return(0,nW.reset)(),(0,nW.addDirective)(t.config??{}),t}async function as(e,t){sZ();try{let{code:t,config:r}=ai(e);return{diagramType:(await ag(t)).type,config:r}}catch(e){if(t?.suppressErrors)return!1;throw e}}(0,nH.__name)(ai,"processAndSetConfigs"),(0,nH.__name)(as,"parse");var aa=(0,nH.__name)((e,t,r=[])=>`
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,520683,(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,s=l(e),a=s[0],o=s[1],c=new i((a+o)*3/4-o),u=0,d=o>0?a-4:a;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)],c[u++]=t>>16&255,c[u++]=t>>8&255,c[u++]=255&t;return 2===o&&(t=n[e.charCodeAt(r)]<<2|n[e.charCodeAt(r+1)]>>4,c[u++]=255&t),1===o&&(t=n[e.charCodeAt(r)]<<10|n[e.charCodeAt(r+1)]<<4|n[e.charCodeAt(r+2)]>>2,c[u++]=t>>8&255,c[u++]=255&t),c},t.fromByteArray=function(e){for(var t,n=e.length,i=n%3,s=[],a=0,o=n-i;a<o;a+=16383)s.push(function(e,t,n){for(var i,s=[],a=t;a<n;a+=3)i=(e[a]<<16&0xff0000)+(e[a+1]<<8&65280)+(255&e[a+2]),s.push(r[i>>18&63]+r[i>>12&63]+r[i>>6&63]+r[63&i]);return s.join("")}(e,a,a+16383>o?o:a+16383));return 1===i?s.push(r[(t=e[n-1])>>2]+r[t<<4&63]+"=="):2===i&&s.push(r[(t=(e[n-2]<<8)+e[n-1])>>10]+r[t>>4&63]+r[t<<2&63]+"="),s.join("")};for(var r=[],n=[],i="u">typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,o=s.length;a<o;++a)r[a]=s[a],n[s.charCodeAt(a)]=a;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),s="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;function a(e){if(e>0x7fffffff)throw RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return Object.setPrototypeOf(t,o.prototype),t}function o(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 u(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"),!o.isEncoding(i))throw TypeError("Unknown encoding: "+i);var s=0|p(n,i),l=a(s),c=l.write(n,i);return c!==s&&(l=l.slice(0,c)),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(T(e,ArrayBuffer)||e&&T(e.buffer,ArrayBuffer)||"u">typeof SharedArrayBuffer&&(T(e,SharedArrayBuffer)||e&&T(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),o.prototype),n}(e,t,r);if("number"==typeof e)throw TypeError('The "value" argument must not be of type number. Received type number');var u=e.valueOf&&e.valueOf();if(null!=u&&u!==e)return o.from(u,t,r);var m=function(e){if(o.isBuffer(e)){var t=0|h(e.length),r=a(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)?a(0):d(e):"Buffer"===e.type&&Array.isArray(e.data)?d(e.data):void 0}(e);if(m)return m;if("u">typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return o.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 c(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 u(e){return c(e),a(e<0?0:0|h(e))}function d(e){for(var t=e.length<0?0:0|h(e.length),r=a(t),n=0;n<t;n+=1)r[n]=255&e[n];return r}t.Buffer=o,t.SlowBuffer=function(e){return+e!=e&&(e=0),o.alloc(+e)},t.INSPECT_MAX_BYTES=50,t.kMaxLength=0x7fffffff,o.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}}(),!o.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(o.prototype,"parent",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.buffer}}),Object.defineProperty(o.prototype,"offset",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.byteOffset}}),o.poolSize=8192,o.from=function(e,t,r){return l(e,t,r)},Object.setPrototypeOf(o.prototype,Uint8Array.prototype),Object.setPrototypeOf(o,Uint8Array),o.alloc=function(e,t,r){return(c(e),e<=0)?a(e):void 0!==t?"string"==typeof r?a(e).fill(t,r):a(e).fill(t):a(e)},o.allocUnsafe=function(e){return u(e)},o.allocUnsafeSlow=function(e){return u(e)};function h(e){if(e>=0x7fffffff)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x7fffffff bytes");return 0|e}function p(e,t){if(o.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||T(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 N(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return C(e).length;default:if(i)return n?-1:N(e).length;t=(""+t).toLowerCase(),i=!0}}function m(e,t,r){var i,s,a,o=!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="",s=t;s<r;++s)i+=E[e[s]];return i}(this,t,r);case"utf8":case"utf-8":return x(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,s=t,a=r,0===s&&a===i.length?n.fromByteArray(i):n.fromByteArray(i.slice(s,a));case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return function(e,t,r){for(var n=e.slice(t,r),i="",s=0;s<n.length;s+=2)i+=String.fromCharCode(n[s]+256*n[s+1]);return i}(this,t,r);default:if(o)throw TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),o=!0}}function f(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function g(e,t,r,n,i){var s;if(0===e.length)return -1;if("string"==typeof r?(n=r,r=0):r>0x7fffffff?r=0x7fffffff:r<-0x80000000&&(r=-0x80000000),(s=r*=1)!=s&&(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=o.from(t,n)),o.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 s,a=1,o=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;a=2,o/=2,l/=2,r/=2}function c(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(i){var u=-1;for(s=r;s<o;s++)if(c(e,s)===c(t,-1===u?0:s-u)){if(-1===u&&(u=s),s-u+1===l)return u*a}else -1!==u&&(s-=s-u),u=-1}else for(r+l>o&&(r=o-l),s=r;s>=0;s--){for(var d=!0,h=0;h<l;h++)if(c(e,s+h)!==c(t,h)){d=!1;break}if(d)return s}return -1}o.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==o.prototype},o.compare=function(e,t){if(T(e,Uint8Array)&&(e=o.from(e,e.offset,e.byteLength)),T(t,Uint8Array)&&(t=o.from(t,t.offset,t.byteLength)),!o.isBuffer(e)||!o.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,s=Math.min(r,n);i<s;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:+(n<r)},o.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}},o.concat=function(e,t){if(!Array.isArray(e))throw TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return o.alloc(0);if(void 0===t)for(r=0,t=0;r<e.length;++r)t+=e[r].length;var r,n=o.allocUnsafe(t),i=0;for(r=0;r<e.length;++r){var s=e[r];if(T(s,Uint8Array)&&(s=o.from(s)),!o.isBuffer(s))throw TypeError('"list" argument must be an Array of Buffers');s.copy(n,i),i+=s.length}return n},o.byteLength=p,o.prototype._isBuffer=!0,o.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)f(this,t,t+1);return this},o.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)f(this,t,t+3),f(this,t+1,t+2);return this},o.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)f(this,t,t+7),f(this,t+1,t+6),f(this,t+2,t+5),f(this,t+3,t+4);return this},o.prototype.toString=function(){var e=this.length;return 0===e?"":0==arguments.length?x(this,0,e):m.apply(this,arguments)},o.prototype.toLocaleString=o.prototype.toString,o.prototype.equals=function(e){if(!o.isBuffer(e))throw TypeError("Argument must be a Buffer");return this===e||0===o.compare(this,e)},o.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+">"},s&&(o.prototype[s]=o.prototype.inspect),o.prototype.compare=function(e,t,r,n,i){if(T(e,Uint8Array)&&(e=o.from(e,e.offset,e.byteLength)),!o.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 s=i-n,a=r-t,l=Math.min(s,a),c=this.slice(n,i),u=e.slice(t,r),d=0;d<l;++d)if(c[d]!==u[d]){s=c[d],a=u[d];break}return s<a?-1:+(a<s)},o.prototype.includes=function(e,t,r){return -1!==this.indexOf(e,t,r)},o.prototype.indexOf=function(e,t,r){return g(this,e,t,r,!0)},o.prototype.lastIndexOf=function(e,t,r){return g(this,e,t,r,!1)};function x(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i<r;){var s,a,o,l,c=e[i],u=null,d=c>239?4:c>223?3:c>191?2:1;if(i+d<=r)switch(d){case 1:c<128&&(u=c);break;case 2:(192&(s=e[i+1]))==128&&(l=(31&c)<<6|63&s)>127&&(u=l);break;case 3:s=e[i+1],a=e[i+2],(192&s)==128&&(192&a)==128&&(l=(15&c)<<12|(63&s)<<6|63&a)>2047&&(l<55296||l>57343)&&(u=l);break;case 4:s=e[i+1],a=e[i+2],o=e[i+3],(192&s)==128&&(192&a)==128&&(192&o)==128&&(l=(15&c)<<18|(63&s)<<12|(63&a)<<6|63&o)>65535&&l<1114112&&(u=l)}null===u?(u=65533,d=1):u>65535&&(u-=65536,n.push(u>>>10&1023|55296),u=56320|1023&u),n.push(u),i+=d}var h=n,p=h.length;if(p<=4096)return String.fromCharCode.apply(String,h);for(var m="",f=0;f<p;)m+=String.fromCharCode.apply(String,h.slice(f,f+=4096));return m}function v(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 b(e,t,r,n,i,s){if(!o.isBuffer(e))throw TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<s)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,s){if(r+n>e.length||r<0)throw RangeError("Index out of range")}function k(e,t,r,n,s){return t*=1,r>>>=0,s||w(e,t,r,4,34028234663852886e22,-34028234663852886e22),i.write(e,t,r,n,23,4),r+4}function j(e,t,r,n,s){return t*=1,r>>>=0,s||w(e,t,r,8,17976931348623157e292,-17976931348623157e292),i.write(e,t,r,n,52,8),r+8}o.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,s,a,o,l,c,u,d,h=this.length-t;if((void 0===r||r>h)&&(r=h),e.length>0&&(r<0||t<0)||t>this.length)throw RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var p=!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 s=t.length;n>s/2&&(n=s/2);for(var a=0;a<n;++a){var o,l=parseInt(t.substr(2*a,2),16);if((o=l)!=o)break;e[r+a]=l}return a}(this,e,t,r);case"utf8":case"utf-8":return i=t,s=r,_(N(e,this.length-i),this,i,s);case"ascii":return a=t,o=r,_(A(e),this,a,o);case"latin1":case"binary":return function(e,t,r,n){return _(A(t),e,r,n)}(this,e,t,r);case"base64":return l=t,c=r,_(C(e),this,l,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return u=t,d=r,_(function(e,t){for(var r,n,i=[],s=0;s<e.length&&!((t-=2)<0);++s)n=(r=e.charCodeAt(s))>>8,i.push(r%256),i.push(n);return i}(e,this.length-u),this,u,d);default:if(p)throw TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),p=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},o.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,o.prototype),n},o.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||v(e,t,this.length);for(var n=this[e],i=1,s=0;++s<t&&(i*=256);)n+=this[e+s]*i;return n},o.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||v(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},o.prototype.readUInt8=function(e,t){return e>>>=0,t||v(e,1,this.length),this[e]},o.prototype.readUInt16LE=function(e,t){return e>>>=0,t||v(e,2,this.length),this[e]|this[e+1]<<8},o.prototype.readUInt16BE=function(e,t){return e>>>=0,t||v(e,2,this.length),this[e]<<8|this[e+1]},o.prototype.readUInt32LE=function(e,t){return e>>>=0,t||v(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+0x1000000*this[e+3]},o.prototype.readUInt32BE=function(e,t){return e>>>=0,t||v(e,4,this.length),0x1000000*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},o.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||v(e,t,this.length);for(var n=this[e],i=1,s=0;++s<t&&(i*=256);)n+=this[e+s]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*t)),n},o.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||v(e,t,this.length);for(var n=t,i=1,s=this[e+--n];n>0&&(i*=256);)s+=this[e+--n]*i;return s>=(i*=128)&&(s-=Math.pow(2,8*t)),s},o.prototype.readInt8=function(e,t){return(e>>>=0,t||v(e,1,this.length),128&this[e])?-((255-this[e]+1)*1):this[e]},o.prototype.readInt16LE=function(e,t){e>>>=0,t||v(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?0xffff0000|r:r},o.prototype.readInt16BE=function(e,t){e>>>=0,t||v(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?0xffff0000|r:r},o.prototype.readInt32LE=function(e,t){return e>>>=0,t||v(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},o.prototype.readInt32BE=function(e,t){return e>>>=0,t||v(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},o.prototype.readFloatLE=function(e,t){return e>>>=0,t||v(e,4,this.length),i.read(this,e,!0,23,4)},o.prototype.readFloatBE=function(e,t){return e>>>=0,t||v(e,4,this.length),i.read(this,e,!1,23,4)},o.prototype.readDoubleLE=function(e,t){return e>>>=0,t||v(e,8,this.length),i.read(this,e,!0,52,8)},o.prototype.readDoubleBE=function(e,t){return e>>>=0,t||v(e,8,this.length),i.read(this,e,!1,52,8)},o.prototype.writeUIntLE=function(e,t,r,n){if(e*=1,t>>>=0,r>>>=0,!n){var i=Math.pow(2,8*r)-1;b(this,e,t,r,i,0)}var s=1,a=0;for(this[t]=255&e;++a<r&&(s*=256);)this[t+a]=e/s&255;return t+r},o.prototype.writeUIntBE=function(e,t,r,n){if(e*=1,t>>>=0,r>>>=0,!n){var i=Math.pow(2,8*r)-1;b(this,e,t,r,i,0)}var s=r-1,a=1;for(this[t+s]=255&e;--s>=0&&(a*=256);)this[t+s]=e/a&255;return t+r},o.prototype.writeUInt8=function(e,t,r){return e*=1,t>>>=0,r||b(this,e,t,1,255,0),this[t]=255&e,t+1},o.prototype.writeUInt16LE=function(e,t,r){return e*=1,t>>>=0,r||b(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},o.prototype.writeUInt16BE=function(e,t,r){return e*=1,t>>>=0,r||b(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},o.prototype.writeUInt32LE=function(e,t,r){return e*=1,t>>>=0,r||b(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},o.prototype.writeUInt32BE=function(e,t,r){return e*=1,t>>>=0,r||b(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},o.prototype.writeIntLE=function(e,t,r,n){if(e*=1,t>>>=0,!n){var i=Math.pow(2,8*r-1);b(this,e,t,r,i-1,-i)}var s=0,a=1,o=0;for(this[t]=255&e;++s<r&&(a*=256);)e<0&&0===o&&0!==this[t+s-1]&&(o=1),this[t+s]=(e/a|0)-o&255;return t+r},o.prototype.writeIntBE=function(e,t,r,n){if(e*=1,t>>>=0,!n){var i=Math.pow(2,8*r-1);b(this,e,t,r,i-1,-i)}var s=r-1,a=1,o=0;for(this[t+s]=255&e;--s>=0&&(a*=256);)e<0&&0===o&&0!==this[t+s+1]&&(o=1),this[t+s]=(e/a|0)-o&255;return t+r},o.prototype.writeInt8=function(e,t,r){return e*=1,t>>>=0,r||b(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},o.prototype.writeInt16LE=function(e,t,r){return e*=1,t>>>=0,r||b(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},o.prototype.writeInt16BE=function(e,t,r){return e*=1,t>>>=0,r||b(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},o.prototype.writeInt32LE=function(e,t,r){return e*=1,t>>>=0,r||b(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},o.prototype.writeInt32BE=function(e,t,r){return e*=1,t>>>=0,r||b(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},o.prototype.writeFloatLE=function(e,t,r){return k(this,e,t,!0,r)},o.prototype.writeFloatBE=function(e,t,r){return k(this,e,t,!1,r)},o.prototype.writeDoubleLE=function(e,t,r){return j(this,e,t,!0,r)},o.prototype.writeDoubleBE=function(e,t,r){return j(this,e,t,!1,r)},o.prototype.copy=function(e,t,r,n){if(!o.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 s=i-1;s>=0;--s)e[s+t]=this[s+r];else Uint8Array.prototype.set.call(e,this.subarray(r,n),t);return i},o.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&&!o.isEncoding(n))throw TypeError("Unknown encoding: "+n);if(1===e.length){var i,s=e.charCodeAt(0);("utf8"===n&&s<128||"latin1"===n)&&(e=s)}}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 a=o.isBuffer(e)?e:o.from(e,n),l=a.length;if(0===l)throw TypeError('The value "'+e+'" is invalid for argument "value"');for(i=0;i<r-t;++i)this[i+t]=a[i%l]}return this};var S=/[^+/0-9A-Za-z-_]/g;function N(e,t){t=t||1/0;for(var r,n=e.length,i=null,s=[],a=0;a<n;++a){if((r=e.charCodeAt(a))>55295&&r<57344){if(!i){if(r>56319||a+1===n){(t-=3)>-1&&s.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&s.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(t-=3)>-1&&s.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;s.push(r)}else if(r<2048){if((t-=2)<0)break;s.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;s.push(r>>12|224,r>>6&63|128,63&r|128)}else if(r<1114112){if((t-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}else throw Error("Invalid code point")}return s}function A(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}function C(e){return n.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(S,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function _(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 T(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}var E=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 s,a,o=8*i-n-1,l=(1<<o)-1,c=l>>1,u=-7,d=r?i-1:0,h=r?-1:1,p=e[t+d];for(d+=h,s=p&(1<<-u)-1,p>>=-u,u+=o;u>0;s=256*s+e[t+d],d+=h,u-=8);for(a=s&(1<<-u)-1,s>>=-u,u+=n;u>0;a=256*a+e[t+d],d+=h,u-=8);if(0===s)s=1-c;else{if(s===l)return a?NaN:1/0*(p?-1:1);a+=Math.pow(2,n),s-=c}return(p?-1:1)*a*Math.pow(2,s-n)},t.write=function(e,t,r,n,i,s){var a,o,l,c=8*s-i-1,u=(1<<c)-1,d=u>>1,h=5960464477539062e-23*(23===i),p=n?0:s-1,m=n?1:-1,f=+(t<0||0===t&&1/t<0);for(isNaN(t=Math.abs(t))||t===1/0?(o=+!!isNaN(t),a=u):(a=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-a))<1&&(a--,l*=2),a+d>=1?t+=h/l:t+=h*Math.pow(2,1-d),t*l>=2&&(a++,l/=2),a+d>=u?(o=0,a=u):a+d>=1?(o=(t*l-1)*Math.pow(2,i),a+=d):(o=t*Math.pow(2,d-1)*Math.pow(2,i),a=0));i>=8;e[r+p]=255&o,p+=m,o/=256,i-=8);for(a=a<<i|o,c+=i;c>0;e[r+p]=255&a,p+=m,a/=256,c-=8);e[r+p-m]|=128*f}}},i={};function s(e){var t=i[e];if(void 0!==t)return t.exports;var r=i[e]={exports:{}},a=!0;try{n[e](r,r.exports,s),a=!1}finally{a&&delete i[e]}return r.exports}s.ab="/ROOT/web/node_modules/next/dist/compiled/buffer/",t.exports=s(72)},330460,e=>{"use strict";let t,r,n,i,s,a,o,l,c,u,d;var h,p,m,f,g,y,x,v=e.i(414294),b=e.i(430878),w=e.i(353913),k=e.i(292623),j=e.i(555552),S=e.i(392295),N=e.i(770008);let A=(0,N.cva)("inline-flex items-center justify-center rounded-full border border-transparent px-2.5 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1.5 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-all duration-200 overflow-hidden",{variants:{variant:{default:"bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border-border text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground",ghost:"[a&]:hover:bg-accent [a&]:hover:text-accent-foreground",link:"text-primary underline-offset-4 [a&]:hover:underline"}},defaultVariants:{variant:"default"}});function C({className:e,variant:t="default",asChild:r=!1,...n}){let i=r?S.Slot:"span";return(0,v.jsx)(i,{"data-slot":"badge","data-variant":t,className:(0,j.cn)(A({variant:t}),e),...n})}var _=e.i(666904),T=e.i(87614),E=e.i(292511);let P=(0,E.default)("arrow-down",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]),R={damping:.7,stiffness:.05,mass:1.25},M=1e3/60,L=!1;function I(e,t){let r=(0,b.useCallback)(t=>(r.current=t,e(t)),t);return r}globalThis.document?.addEventListener("mousedown",()=>{L=!0}),globalThis.document?.addEventListener("mouseup",()=>{L=!1}),globalThis.document?.addEventListener("click",()=>{L=!1});let D=new Map;function O(...e){let t={...R},r=!1;for(let n of e){if("instant"===n){r=!0;continue}"object"==typeof n&&(r=!1,t.damping=n.damping??t.damping,t.stiffness=n.stiffness??t.stiffness,t.mass=n.mass??t.mass)}let n=JSON.stringify(t);return D.has(n)||D.set(n,Object.freeze(t)),r?"instant":D.get(n)}let B=(0,b.createContext)(null),F="u">typeof window?b.useLayoutEffect:b.useEffect;function z({instance:e,children:t,resize:r,initial:n,mass:i,damping:s,stiffness:a,targetScrollTop:o,contextRef:l,...c}){let u=(0,b.useRef)(null),d=((e={})=>{let[t,r]=(0,b.useState)(!1),[n,i]=(0,b.useState)(!1!==e.initial),[s,a]=(0,b.useState)(!1),o=(0,b.useRef)(null);o.current=e;let l=(0,b.useCallback)(()=>{if(!L)return!1;let e=window.getSelection();if(!e||!e.rangeCount)return!1;let t=e.getRangeAt(0);return t.commonAncestorContainer.contains(g.current)||g.current?.contains(t.commonAncestorContainer)},[]),c=(0,b.useCallback)(e=>{d.isAtBottom=e,i(e)},[]),u=(0,b.useCallback)(e=>{d.escapedFromLock=e,r(e)},[]),d=(0,b.useMemo)(()=>{let r;return{escapedFromLock:t,isAtBottom:n,resizeDifference:0,accumulated:0,velocity:0,listeners:new Set,get scrollTop(){return g.current?.scrollTop??0},set scrollTop(scrollTop){g.current&&(g.current.scrollTop=scrollTop,d.ignoreScrollToTop=g.current.scrollTop)},get targetScrollTop(){if(!g.current||!y.current)return 0;return g.current.scrollHeight-1-g.current.clientHeight},get calculatedTargetScrollTop(){if(!g.current||!y.current)return 0;let{targetScrollTop:t}=this;if(!e.targetScrollTop)return t;if(r?.targetScrollTop===t)return r.calculatedScrollTop;let n=Math.max(Math.min(e.targetScrollTop(t,{scrollElement:g.current,contentElement:y.current}),t),0);return r={targetScrollTop:t,calculatedScrollTop:n},requestAnimationFrame(()=>{r=void 0}),n},get scrollDifference(){return this.calculatedTargetScrollTop-this.scrollTop},get isNearBottom(){return this.scrollDifference<=70}}},[]),h=(0,b.useCallback)((e={})=>{let t;"string"==typeof e&&(e={animation:e}),e.preserveScrollPosition||c(!0);let r=Date.now()+(Number(e.wait)||0),n=O(o.current,e.animation),{ignoreEscapes:i=!1}=e,s=d.calculatedTargetScrollTop;e.duration instanceof Promise?e.duration.finally(()=>{t=Date.now()}):t=r+(e.duration??0);let a=async()=>{let e=new Promise(requestAnimationFrame).then(()=>{if(!d.isAtBottom)return d.animation=void 0,!1;let{scrollTop:c}=d,u=performance.now(),p=(u-(d.lastTick??u))/M;if(d.animation||(d.animation={behavior:n,promise:e,ignoreEscapes:i}),d.animation.behavior===n&&(d.lastTick=u),l()||r>Date.now())return a();if(c<Math.min(s,d.calculatedTargetScrollTop)){if(d.animation?.behavior===n){if("instant"===n)return d.scrollTop=d.calculatedTargetScrollTop,a();d.velocity=(n.damping*d.velocity+n.stiffness*d.scrollDifference)/n.mass,d.accumulated+=d.velocity*p,d.scrollTop+=d.accumulated,d.scrollTop!==c&&(d.accumulated=0)}return a()}return t>Date.now()?(s=d.calculatedTargetScrollTop,a()):(d.animation=void 0,d.scrollTop<d.calculatedTargetScrollTop)?h({animation:O(o.current,o.current.resize),ignoreEscapes:i,duration:Math.max(0,t-Date.now())||void 0}):d.isAtBottom});return e.then(e=>(requestAnimationFrame(()=>{d.animation||(d.lastTick=void 0,d.velocity=0)}),e))};return(!0!==e.wait&&(d.animation=void 0),d.animation?.behavior===n)?d.animation.promise:a()},[c,l,d]),p=(0,b.useCallback)(()=>{u(!0),c(!1)},[u,c]),m=(0,b.useCallback)(({target:e})=>{if(e!==g.current)return;let{scrollTop:t,ignoreScrollToTop:r}=d,{lastScrollTop:n=t}=d;d.lastScrollTop=t,d.ignoreScrollToTop=void 0,r&&r>t&&(n=r),a(d.isNearBottom),setTimeout(()=>{if(d.resizeDifference||t===r)return;if(l()){u(!0),c(!1);return}let e=t>n,i=t<n;if(d.animation?.ignoreEscapes){d.scrollTop=n;return}i&&(u(!0),c(!1)),e&&u(!1),!d.escapedFromLock&&d.isNearBottom&&c(!0)},1)},[u,c,l,d]),f=(0,b.useCallback)(({target:e,deltaY:t})=>{let r=e;for(;!["scroll","auto"].includes(getComputedStyle(r).overflow);){if(!r.parentElement)return;r=r.parentElement}r===g.current&&t<0&&g.current.scrollHeight>g.current.clientHeight&&!d.animation?.ignoreEscapes&&(u(!0),c(!1))},[u,c,d]),g=I(e=>{g.current?.removeEventListener("scroll",m),g.current?.removeEventListener("wheel",f),e?.addEventListener("scroll",m,{passive:!0}),e?.addEventListener("wheel",f,{passive:!0})},[]),y=I(e=>{let t;d.resizeObserver?.disconnect(),e&&(d.resizeObserver=new ResizeObserver(([e])=>{let{height:r}=e.contentRect,n=r-(t??r);if(d.resizeDifference=n,d.scrollTop>d.targetScrollTop&&(d.scrollTop=d.targetScrollTop),a(d.isNearBottom),n>=0){let e=O(o.current,t?o.current.resize:o.current.initial);h({animation:e,wait:!0,preserveScrollPosition:!0,duration:"instant"===e?void 0:350})}else d.isNearBottom&&(u(!1),c(!0));t=r,requestAnimationFrame(()=>{setTimeout(()=>{d.resizeDifference===n&&(d.resizeDifference=0)},1)})}),d.resizeObserver?.observe(e))},[]);return{contentRef:y,scrollRef:g,scrollToBottom:h,stopScroll:p,isAtBottom:n||s,isNearBottom:s,escapedFromLock:t,state:d}})({mass:i,damping:s,stiffness:a,resize:r,initial:n,targetScrollTop:b.useCallback((e,t)=>{let r=v?.targetScrollTop??o;return r?.(e,t)??e},[o])}),{scrollRef:h,contentRef:p,scrollToBottom:m,stopScroll:f,isAtBottom:g,escapedFromLock:y,state:x}=e??d,v=(0,b.useMemo)(()=>({scrollToBottom:m,stopScroll:f,scrollRef:h,isAtBottom:g,escapedFromLock:y,contentRef:p,state:x,get targetScrollTop(){return u.current},set targetScrollTop(targetScrollTop){u.current=targetScrollTop}}),[m,g,p,h,f,y,x]);return(0,b.useImperativeHandle)(l,()=>v,[v]),F(()=>{h.current&&"visible"===getComputedStyle(h.current).overflow&&(h.current.style.overflow="auto")},[]),b.createElement(B.Provider,{value:v},b.createElement("div",{...c},"function"==typeof t?t(v):t))}function $(){let e=(0,b.useContext)(B);if(!e)throw Error("use-stick-to-bottom component context must be used within a StickToBottom component");return e}(z||(z={})).Content=function({children:e,scrollClassName:t,...r}){let n=$();return b.createElement("div",{ref:n.scrollRef,style:{height:"100%",width:"100%",scrollbarGutter:"stable both-edges"},className:t},b.createElement("div",{...r,ref:n.contentRef},"function"==typeof e?e(n):e))};let V=({className:e,...t})=>(0,v.jsx)(z,{className:(0,j.cn)("relative flex-1 overflow-y-hidden",e),initial:"smooth",resize:"smooth",role:"log",...t}),U=({className:e,...t})=>(0,v.jsx)(z.Content,{className:(0,j.cn)("flex flex-col gap-8 p-4",e),...t}),W=({className:e,title:t="No messages yet",description:r="Start a conversation to see messages here",icon:n,children:i,...s})=>(0,v.jsx)("div",{className:(0,j.cn)("flex size-full flex-col items-center justify-center gap-4 p-8 text-center",e),...s,children:i??(0,v.jsxs)(v.Fragment,{children:[n&&(0,v.jsx)("div",{className:"text-muted-foreground/50 p-4 rounded-2xl bg-muted/30",children:n}),(0,v.jsxs)("div",{className:"space-y-2",children:[(0,v.jsx)("h3",{className:"font-semibold text-base text-foreground",children:t}),r&&(0,v.jsx)("p",{className:"text-muted-foreground text-sm max-w-xs",children:r})]})]})}),G=({className:e,...t})=>{let{isAtBottom:r,scrollToBottom:n}=$(),i=(0,b.useCallback)(()=>{n()},[n]);return!r&&(0,v.jsx)(_.Button,{className:(0,j.cn)("absolute bottom-4 left-[50%] translate-x-[-50%] rounded-full dark:bg-background dark:hover:bg-muted",e),onClick:i,size:"icon",type:"button",variant:"outline",...t,children:(0,v.jsx)(P,{className:"size-4"})})};e.i(534432),(0,N.cva)("flex w-fit items-stretch [&>*]:focus-visible:z-10 [&>*]:focus-visible:relative [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-md has-[>[data-slot=button-group]]:gap-2",{variants:{orientation:{horizontal:"[&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none",vertical:"flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none"}},defaultVariants:{orientation:"horizontal"}});var H=e.i(47513),q=e.i(725656),K=Object.defineProperty,Y=J(/\p{P}|\p{S}/u),X=J(/\s/);function J(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCodePoint(t))}}function Z(e){if(null===e||(0,q.markdownLineEndingOrSpace)(e)||X(e))return 1;let t=0;if(e>=4352){if(null!==e&&e>=65024&&e<=65038)return y.nonEmojiGeneralUseVS;switch(function(e){if(!e||e<4352)return!1;switch(function(e){if(!Number.isSafeInteger(e))throw TypeError(`Expected a code point, got \`${typeof e}\`.`);return 161===e||164===e||167===e||168===e||170===e||173===e||174===e||e>=176&&e<=180||e>=182&&e<=186||e>=188&&e<=191||198===e||208===e||215===e||216===e||e>=222&&e<=225||230===e||e>=232&&e<=234||236===e||237===e||240===e||242===e||243===e||e>=247&&e<=250||252===e||254===e||257===e||273===e||275===e||283===e||294===e||295===e||299===e||e>=305&&e<=307||312===e||e>=319&&e<=322||324===e||e>=328&&e<=331||333===e||338===e||339===e||358===e||359===e||363===e||462===e||464===e||466===e||468===e||470===e||472===e||474===e||476===e||593===e||609===e||708===e||711===e||e>=713&&e<=715||717===e||720===e||e>=728&&e<=731||733===e||735===e||e>=768&&e<=879||e>=913&&e<=929||e>=931&&e<=937||e>=945&&e<=961||e>=963&&e<=969||1025===e||e>=1040&&e<=1103||1105===e||8208===e||e>=8211&&e<=8214||8216===e||8217===e||8220===e||8221===e||e>=8224&&e<=8226||e>=8228&&e<=8231||8240===e||8242===e||8243===e||8245===e||8251===e||8254===e||8308===e||8319===e||e>=8321&&e<=8324||8364===e||8451===e||8453===e||8457===e||8467===e||8470===e||8481===e||8482===e||8486===e||8491===e||8531===e||8532===e||e>=8539&&e<=8542||e>=8544&&e<=8555||e>=8560&&e<=8569||8585===e||e>=8592&&e<=8601||8632===e||8633===e||8658===e||8660===e||8679===e||8704===e||8706===e||8707===e||8711===e||8712===e||8715===e||8719===e||8721===e||8725===e||8730===e||e>=8733&&e<=8736||8739===e||8741===e||e>=8743&&e<=8748||8750===e||e>=8756&&e<=8759||8764===e||8765===e||8776===e||8780===e||8786===e||8800===e||8801===e||e>=8804&&e<=8807||8810===e||8811===e||8814===e||8815===e||8834===e||8835===e||8838===e||8839===e||8853===e||8857===e||8869===e||8895===e||8978===e||e>=9312&&e<=9449||e>=9451&&e<=9547||e>=9552&&e<=9587||e>=9600&&e<=9615||e>=9618&&e<=9621||9632===e||9633===e||e>=9635&&e<=9641||9650===e||9651===e||9654===e||9655===e||9660===e||9661===e||9664===e||9665===e||e>=9670&&e<=9672||9675===e||e>=9678&&e<=9681||e>=9698&&e<=9701||9711===e||9733===e||9734===e||9737===e||9742===e||9743===e||9756===e||9758===e||9792===e||9794===e||9824===e||9825===e||e>=9827&&e<=9829||e>=9831&&e<=9834||9836===e||9837===e||9839===e||9886===e||9887===e||9919===e||e>=9926&&e<=9933||e>=9935&&e<=9939||e>=9941&&e<=9953||9955===e||9960===e||9961===e||e>=9963&&e<=9969||9972===e||e>=9974&&e<=9977||9979===e||9980===e||9982===e||9983===e||10045===e||e>=10102&&e<=10111||e>=11094&&e<=11097||e>=12872&&e<=12879||e>=57344&&e<=63743||e>=65024&&e<=65039||65533===e||e>=127232&&e<=127242||e>=127248&&e<=127277||e>=127280&&e<=127337||e>=127344&&e<=127373||127375===e||127376===e||e>=127387&&e<=127404||e>=917760&&e<=917999||e>=983040&&e<=1048573||e>=1048576&&e<=1114109?"ambiguous":12288===e||e>=65281&&e<=65376||e>=65504&&e<=65510?"fullwidth":8361===e||e>=65377&&e<=65470||e>=65474&&e<=65479||e>=65482&&e<=65487||e>=65490&&e<=65495||e>=65498&&e<=65500||e>=65512&&e<=65518?"halfwidth":e>=32&&e<=126||162===e||163===e||165===e||166===e||172===e||175===e||e>=10214&&e<=10221||10629===e||10630===e?"narrow":e>=4352&&e<=4447||8986===e||8987===e||9001===e||9002===e||e>=9193&&e<=9196||9200===e||9203===e||9725===e||9726===e||9748===e||9749===e||e>=9776&&e<=9783||e>=9800&&e<=9811||9855===e||e>=9866&&e<=9871||9875===e||9889===e||9898===e||9899===e||9917===e||9918===e||9924===e||9925===e||9934===e||9940===e||9962===e||9970===e||9971===e||9973===e||9978===e||9981===e||9989===e||9994===e||9995===e||10024===e||10060===e||10062===e||e>=10067&&e<=10069||10071===e||e>=10133&&e<=10135||10160===e||10175===e||11035===e||11036===e||11088===e||11093===e||e>=11904&&e<=11929||e>=11931&&e<=12019||e>=12032&&e<=12245||e>=12272&&e<=12287||e>=12289&&e<=12350||e>=12353&&e<=12438||e>=12441&&e<=12543||e>=12549&&e<=12591||e>=12593&&e<=12686||e>=12688&&e<=12773||e>=12783&&e<=12830||e>=12832&&e<=12871||e>=12880&&e<=42124||e>=42128&&e<=42182||e>=43360&&e<=43388||e>=44032&&e<=55203||e>=63744&&e<=64255||e>=65040&&e<=65049||e>=65072&&e<=65106||e>=65108&&e<=65126||e>=65128&&e<=65131||e>=94176&&e<=94180||e>=94192&&e<=94198||e>=94208&&e<=101589||e>=101631&&e<=101662||e>=101760&&e<=101874||e>=110576&&e<=110579||e>=110581&&e<=110587||110589===e||110590===e||e>=110592&&e<=110882||110898===e||e>=110928&&e<=110930||110933===e||e>=110948&&e<=110951||e>=110960&&e<=111355||e>=119552&&e<=119638||e>=119648&&e<=119670||126980===e||127183===e||127374===e||e>=127377&&e<=127386||e>=127488&&e<=127490||e>=127504&&e<=127547||e>=127552&&e<=127560||127568===e||127569===e||e>=127584&&e<=127589||e>=127744&&e<=127776||e>=127789&&e<=127797||e>=127799&&e<=127868||e>=127870&&e<=127891||e>=127904&&e<=127946||e>=127951&&e<=127955||e>=127968&&e<=127984||127988===e||e>=127992&&e<=128062||128064===e||e>=128066&&e<=128252||e>=128255&&e<=128317||e>=128331&&e<=128334||e>=128336&&e<=128359||128378===e||128405===e||128406===e||128420===e||e>=128507&&e<=128591||e>=128640&&e<=128709||128716===e||e>=128720&&e<=128722||e>=128725&&e<=128728||e>=128732&&e<=128735||128747===e||128748===e||e>=128756&&e<=128764||e>=128992&&e<=129003||129008===e||e>=129292&&e<=129338||e>=129340&&e<=129349||e>=129351&&e<=129535||e>=129648&&e<=129660||e>=129664&&e<=129674||e>=129678&&e<=129734||129736===e||e>=129741&&e<=129756||e>=129759&&e<=129770||e>=129775&&e<=129784||e>=131072&&e<=196605||e>=196608&&e<=262141?"wide":"neutral"}(e)){case"fullwidth":case"halfwidth":return!0;case"wide":return!/^\p{Emoji_Presentation}/u.test(String.fromCodePoint(e));case"narrow":return!1;case"ambiguous":return 917760<=e&&e<=917999&&null;case"neutral":return/^\p{sc=Hangul}/u.test(String.fromCodePoint(e))}}(e)){case null:return y.ivs;case!0:t|=y.cjk}}return Y(e)&&(t|=2),t}function Q(e,t,r){if(e!==y.nonEmojiGeneralUseVS)return e;let n=t(),i=Z(n);return!n||1&i?e:65025===r&&n&&!(n<8216)&&(8216===n||8217===n||8220===n||8221===n)?y.cjkPunctuation:i&~y.ivs}(h=y||(y={})).spaceOrPunctuation=3,h.cjk=4096,h.cjkPunctuation=4098,h.ivs=8192,h.cjkOrIvs=12288,h.nonEmojiGeneralUseVS=16384,h.variationSelector=24576,h.ivsToCjkRightShift=1;function ee(e){return(e&y.cjkPunctuation)==2}function et(e){return!!(e&y.cjk)}function er(e){return!!(e&y.spaceOrPunctuation)}function en(e){return!!(e&&e>=55296&&e<=56319)}function ei(e){return!!(e&&e>=56320&&e<=57343)}function es(e,t,r){if(t._bufferIndex<2)return e;let n=r({start:{...t,_bufferIndex:t._bufferIndex-2},end:t}).codePointAt(0);return n&&n>=65536?n:e}var ea=class{constructor(e,t,r){this.previousCode=e,this.nowPoint=t,this.sliceSerialize=r,((e,t,r)=>{let n;return(n="symbol"!=typeof t?t+"":t)in e?K(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r})(this,"cachedValue")}value(){return void 0===this.cachedValue&&(this.cachedValue=function(e,t,r){let n=e>=65536?2:1;if(t._bufferIndex<1+n)return null;let i=t._bufferIndex-n-2,s=r({start:{...t,_bufferIndex:i>=0?i:0},end:{...t,_bufferIndex:t._bufferIndex-n}}),a=s.charCodeAt(s.length-1);if(Number.isNaN(a))return null;if(s.length<2||a<56320||57343<a)return a;let o=s.codePointAt(0);return o&&o>=65536?o:a}(this.previousCode,this.nowPoint,this.sliceSerialize)),this.cachedValue}};function eo(e,t,r){let n=r({start:t,end:{...t,_bufferIndex:t._bufferIndex+2}}).codePointAt(0);return n&&n>=65536?n:e}var el=e.i(171142),ec=e.i(672742);let eu="emphasisSequence",ed="strongSequence";var eh={name:"attention",resolveAll:function(e,t){let r,n,i,s,a,o,l,c,u=-1;for(;++u<e.length;)if("enter"===e[u][0]&&"attentionSequence"===e[u][1].type&&e[u][1]._close){for(r=u;r--;)if("exit"===e[r][0]&&"attentionSequence"===e[r][1].type&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[u][1]).charCodeAt(0)){if((e[r][1]._close||e[u][1]._open)&&(e[u][1].end.offset-e[u][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[u][1].end.offset-e[u][1].start.offset)%3))continue;o=e[r][1].end.offset-e[r][1].start.offset>1&&e[u][1].end.offset-e[u][1].start.offset>1?2:1;let d={...e[r][1].end},h={...e[u][1].start};ep(d,-o),ep(h,o),s={type:o>1?ed:eu,start:d,end:{...e[r][1].end}},a={type:o>1?ed:eu,start:{...e[u][1].start},end:h},i={type:o>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[u][1].start}},n={type:o>1?"strong":"emphasis",start:{...s.start},end:{...a.end}},e[r][1].end={...s.start},e[u][1].start={...a.end},l=[],e[r][1].end.offset-e[r][1].start.offset&&(l=(0,el.push)(l,[["enter",e[r][1],t],["exit",e[r][1],t]])),l=(0,el.push)(l,[["enter",n,t],["enter",s,t],["exit",s,t],["enter",i,t]]),(0,H.ok)(t.parser.constructs.insideSpan.null,"expected `insideSpan` to be populated"),l=(0,el.push)(l,(0,ec.resolveAll)(t.parser.constructs.insideSpan.null,e.slice(r+1,u),t)),l=(0,el.push)(l,[["exit",i,t],["enter",a,t],["exit",a,t],["exit",n,t]]),e[u][1].end.offset-e[u][1].start.offset?(c=2,l=(0,el.push)(l,[["enter",e[u][1],t],["exit",e[u][1],t]])):c=0,(0,el.splice)(e,r-1,u-r+3,l),u=r+l.length-c-2;break}}for(u=-1;++u<e.length;)"attentionSequence"===e[u][1].type&&(e[u][1].type="data");return e},tokenize:function(e,t){let r,n=this.parser.constructs.attentionMarkers.null,{now:i,sliceSerialize:s,previous:a}=this,o=ei(a)?es(a,i(),s):a,l=Z(o),c=new ea(o,i(),s),u=Q(l,c.value.bind(c),o);return function(a){return(0,H.ok)(42===a||95===a,"expected asterisk or underscore"),r=a,e.enter("attentionSequence"),function a(l){if(l===r)return e.consume(l),a;let c=e.exit("attentionSequence"),d=Z(en(l)?eo(l,i(),s):l);(0,H.ok)(n,"expected `attentionMarkers` to be populated");let h=ee(u),p=h||!!(1&u),m=ee(d),f=m||!!(1&d),g=!!(u&y.cjkOrIvs),x=!f||m&&(p||g)||n.includes(l),v=!p||h&&(f||et(d))||n.includes(o);return c._open=!!(42===r?x:x&&(er(u)||!v)),c._close=!!(42===r?v:v&&(er(d)||!x)),t(l)}(a)}}};function ep(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var em=e.i(73033),ef=new Set(["。",".",",","、","?","!",":",";","(",")","【","】","「","」","『","』","〈","〉","《","》"]),eg=/^(https?:\/\/|mailto:|www\.)/i,ey=(a=[...i=[function(){let e=this.data();(e.micromarkExtensions||(e.micromarkExtensions=[])).push({text:{42:eh,95:eh},insideSpan:{null:[eh]}})}],...s=[()=>e=>{(0,em.visit)(e,"link",(e,t,r)=>{if(!r||"number"!=typeof t||!(e=>{if(1!==e.children.length)return!1;let t=e.children[0];return"text"===t.type&&t.value===e.url})(e)||!eg.test(e.url))return;let n=(e=>{let t=0;for(let r of e){if(ef.has(r))return t;t+=r.length}return null})(e.url);if(null===n||0===n)return;let i=e.url.slice(0,n),s=e.url.slice(n),a={...e,url:i,children:[{type:"text",value:i}]};return r.children.splice(t,1,a,{type:"text",value:s}),t+1})},function(e){let t,r,n=this.data();(n.micromarkExtensions||(n.micromarkExtensions=[])).push((t=(e||{}).singleTilde,r={name:"strikethrough",tokenize:function(e,r,n){let{now:i,sliceSerialize:s,previous:a}=this,o=ei(a)?es(a,i(),s):a,l=Z(o),c=new ea(o,i(),s),u=Q(l,c.value.bind(c),o),d=this.events,h=0;return function(a){return((0,H.ok)(126===a,"expected `~`"),126===o&&"characterEscape"!==d[d.length-1][1].type)?n(a):(e.enter("strikethroughSequenceTemporary"),function a(l){let c=Z(o);if(126===l)return h>1?n(l):(e.consume(l),h++,a);if(h<2&&!t)return n(l);let d=e.exit("strikethroughSequenceTemporary"),p=Z(en(l)?eo(l,i(),s):l),m=ee(u)||!!(1&u),f=ee(p)||!!(1&p),g=et(u)||c===y.ivs;return d._open=!f||2===p&&(m||g),d._close=!m||2===c&&(f||et(p)),r(l)}(a))}},resolveAll:function(e,t){let r=-1;for(;++r<e.length;)if("enter"===e[r][0]&&"strikethroughSequenceTemporary"===e[r][1].type&&e[r][1]._close){let n=r;for(;n--;)if("exit"===e[n][0]&&"strikethroughSequenceTemporary"===e[n][1].type&&e[n][1]._open&&e[r][1].end.offset-e[r][1].start.offset==e[n][1].end.offset-e[n][1].start.offset){e[r][1].type="strikethroughSequence",e[n][1].type="strikethroughSequence";let i={type:"strikethrough",start:Object.assign({},e[n][1].start),end:Object.assign({},e[r][1].end)},s={type:"strikethroughText",start:Object.assign({},e[n][1].end),end:Object.assign({},e[r][1].start)},a=[["enter",i,t],["enter",e[n][1],t],["exit",e[n][1],t],["enter",s,t]],o=t.parser.constructs.insideSpan.null;o&&(0,el.splice)(a,a.length,0,(0,ec.resolveAll)(o,e.slice(n+1,r),t)),(0,el.splice)(a,a.length,0,[["exit",s,t],["enter",e[r][1],t],["exit",e[r][1],t],["exit",i,t]]),(0,el.splice)(e,n-1,r-n+3,a),r=n+a.length-2;break}}for(r=-1;++r<e.length;)"strikethroughSequenceTemporary"===e[r][1].type&&(e[r][1].type="data");return e}},null==t&&(t=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}}))}]],{name:"cjk",type:"cjk",remarkPluginsBefore:i,remarkPluginsAfter:s,remarkPlugins:a});let ex=[{id:"abap",name:"ABAP",import:()=>e.A(424922)},{id:"actionscript-3",name:"ActionScript",import:()=>e.A(168873)},{id:"ada",name:"Ada",import:()=>e.A(267555)},{id:"angular-html",name:"Angular HTML",import:()=>e.A(273354)},{id:"angular-ts",name:"Angular TypeScript",import:()=>e.A(601681)},{id:"apache",name:"Apache Conf",import:()=>e.A(780677)},{id:"apex",name:"Apex",import:()=>e.A(832664)},{id:"apl",name:"APL",import:()=>e.A(759864)},{id:"applescript",name:"AppleScript",import:()=>e.A(748203)},{id:"ara",name:"Ara",import:()=>e.A(710100)},{id:"asciidoc",name:"AsciiDoc",aliases:["adoc"],import:()=>e.A(665143)},{id:"asm",name:"Assembly",import:()=>e.A(552321)},{id:"astro",name:"Astro",import:()=>e.A(96633)},{id:"awk",name:"AWK",import:()=>e.A(731195)},{id:"ballerina",name:"Ballerina",import:()=>e.A(9251)},{id:"bat",name:"Batch File",aliases:["batch"],import:()=>e.A(52303)},{id:"beancount",name:"Beancount",import:()=>e.A(326771)},{id:"berry",name:"Berry",aliases:["be"],import:()=>e.A(934449)},{id:"bibtex",name:"BibTeX",import:()=>e.A(74926)},{id:"bicep",name:"Bicep",import:()=>e.A(257442)},{id:"blade",name:"Blade",import:()=>e.A(240923)},{id:"bsl",name:"1C (Enterprise)",aliases:["1c"],import:()=>e.A(52297)},{id:"c",name:"C",import:()=>e.A(95831)},{id:"c3",name:"C3",import:()=>e.A(336373)},{id:"cadence",name:"Cadence",aliases:["cdc"],import:()=>e.A(172636)},{id:"cairo",name:"Cairo",import:()=>e.A(751803)},{id:"clarity",name:"Clarity",import:()=>e.A(615206)},{id:"clojure",name:"Clojure",aliases:["clj"],import:()=>e.A(886435)},{id:"cmake",name:"CMake",import:()=>e.A(208400)},{id:"cobol",name:"COBOL",import:()=>e.A(774210)},{id:"codeowners",name:"CODEOWNERS",import:()=>e.A(325806)},{id:"codeql",name:"CodeQL",aliases:["ql"],import:()=>e.A(454881)},{id:"coffee",name:"CoffeeScript",aliases:["coffeescript"],import:()=>e.A(728920)},{id:"common-lisp",name:"Common Lisp",aliases:["lisp"],import:()=>e.A(556516)},{id:"coq",name:"Coq",import:()=>e.A(768810)},{id:"cpp",name:"C++",aliases:["c++"],import:()=>e.A(36055)},{id:"crystal",name:"Crystal",import:()=>e.A(378958)},{id:"csharp",name:"C#",aliases:["c#","cs"],import:()=>e.A(848127)},{id:"css",name:"CSS",import:()=>e.A(904556)},{id:"csv",name:"CSV",import:()=>e.A(347771)},{id:"cue",name:"CUE",import:()=>e.A(686137)},{id:"cypher",name:"Cypher",aliases:["cql"],import:()=>e.A(949690)},{id:"d",name:"D",import:()=>e.A(183836)},{id:"dart",name:"Dart",import:()=>e.A(290920)},{id:"dax",name:"DAX",import:()=>e.A(613593)},{id:"desktop",name:"Desktop",import:()=>e.A(294887)},{id:"diff",name:"Diff",import:()=>e.A(538357)},{id:"docker",name:"Dockerfile",aliases:["dockerfile"],import:()=>e.A(741723)},{id:"dotenv",name:"dotEnv",import:()=>e.A(105283)},{id:"dream-maker",name:"Dream Maker",import:()=>e.A(392999)},{id:"edge",name:"Edge",import:()=>e.A(619029)},{id:"elixir",name:"Elixir",import:()=>e.A(679713)},{id:"elm",name:"Elm",import:()=>e.A(25691)},{id:"emacs-lisp",name:"Emacs Lisp",aliases:["elisp"],import:()=>e.A(86556)},{id:"erb",name:"ERB",import:()=>e.A(310443)},{id:"erlang",name:"Erlang",aliases:["erl"],import:()=>e.A(994828)},{id:"fennel",name:"Fennel",import:()=>e.A(684352)},{id:"fish",name:"Fish",import:()=>e.A(137028)},{id:"fluent",name:"Fluent",aliases:["ftl"],import:()=>e.A(837437)},{id:"fortran-fixed-form",name:"Fortran (Fixed Form)",aliases:["f","for","f77"],import:()=>e.A(785635)},{id:"fortran-free-form",name:"Fortran (Free Form)",aliases:["f90","f95","f03","f08","f18"],import:()=>e.A(415116)},{id:"fsharp",name:"F#",aliases:["f#","fs"],import:()=>e.A(891657)},{id:"gdresource",name:"GDResource",import:()=>e.A(693084)},{id:"gdscript",name:"GDScript",import:()=>e.A(445204)},{id:"gdshader",name:"GDShader",import:()=>e.A(975967)},{id:"genie",name:"Genie",import:()=>e.A(267018)},{id:"gherkin",name:"Gherkin",import:()=>e.A(309317)},{id:"git-commit",name:"Git Commit Message",import:()=>e.A(388952)},{id:"git-rebase",name:"Git Rebase Message",import:()=>e.A(455006)},{id:"gleam",name:"Gleam",import:()=>e.A(283831)},{id:"glimmer-js",name:"Glimmer JS",aliases:["gjs"],import:()=>e.A(87687)},{id:"glimmer-ts",name:"Glimmer TS",aliases:["gts"],import:()=>e.A(726414)},{id:"glsl",name:"GLSL",import:()=>e.A(712039)},{id:"gn",name:"GN",import:()=>e.A(105287)},{id:"gnuplot",name:"Gnuplot",import:()=>e.A(58916)},{id:"go",name:"Go",import:()=>e.A(465381)},{id:"graphql",name:"GraphQL",aliases:["gql"],import:()=>e.A(398913)},{id:"groovy",name:"Groovy",import:()=>e.A(344283)},{id:"hack",name:"Hack",import:()=>e.A(310258)},{id:"haml",name:"Ruby Haml",import:()=>e.A(196446)},{id:"handlebars",name:"Handlebars",aliases:["hbs"],import:()=>e.A(78905)},{id:"haskell",name:"Haskell",aliases:["hs"],import:()=>e.A(808975)},{id:"haxe",name:"Haxe",import:()=>e.A(64439)},{id:"hcl",name:"HashiCorp HCL",import:()=>e.A(280445)},{id:"hjson",name:"Hjson",import:()=>e.A(822969)},{id:"hlsl",name:"HLSL",import:()=>e.A(590834)},{id:"html",name:"HTML",import:()=>e.A(407645)},{id:"html-derivative",name:"HTML (Derivative)",import:()=>e.A(115233)},{id:"http",name:"HTTP",import:()=>e.A(895764)},{id:"hurl",name:"Hurl",import:()=>e.A(172420)},{id:"hxml",name:"HXML",import:()=>e.A(987718)},{id:"hy",name:"Hy",import:()=>e.A(38679)},{id:"imba",name:"Imba",import:()=>e.A(787201)},{id:"ini",name:"INI",aliases:["properties"],import:()=>e.A(980017)},{id:"java",name:"Java",import:()=>e.A(144131)},{id:"javascript",name:"JavaScript",aliases:["js","cjs","mjs"],import:()=>e.A(502431)},{id:"jinja",name:"Jinja",import:()=>e.A(729473)},{id:"jison",name:"Jison",import:()=>e.A(576554)},{id:"json",name:"JSON",import:()=>e.A(113295)},{id:"json5",name:"JSON5",import:()=>e.A(991170)},{id:"jsonc",name:"JSON with Comments",import:()=>e.A(26929)},{id:"jsonl",name:"JSON Lines",import:()=>e.A(281787)},{id:"jsonnet",name:"Jsonnet",import:()=>e.A(808302)},{id:"jssm",name:"JSSM",aliases:["fsl"],import:()=>e.A(514714)},{id:"jsx",name:"JSX",import:()=>e.A(941751)},{id:"julia",name:"Julia",aliases:["jl"],import:()=>e.A(44535)},{id:"kdl",name:"KDL",import:()=>e.A(694401)},{id:"kotlin",name:"Kotlin",aliases:["kt","kts"],import:()=>e.A(580413)},{id:"kusto",name:"Kusto",aliases:["kql"],import:()=>e.A(681665)},{id:"latex",name:"LaTeX",import:()=>e.A(378842)},{id:"lean",name:"Lean 4",aliases:["lean4"],import:()=>e.A(214730)},{id:"less",name:"Less",import:()=>e.A(553944)},{id:"liquid",name:"Liquid",import:()=>e.A(834697)},{id:"llvm",name:"LLVM IR",import:()=>e.A(472126)},{id:"log",name:"Log file",import:()=>e.A(485531)},{id:"logo",name:"Logo",import:()=>e.A(336844)},{id:"lua",name:"Lua",import:()=>e.A(251683)},{id:"luau",name:"Luau",import:()=>e.A(470369)},{id:"make",name:"Makefile",aliases:["makefile"],import:()=>e.A(233461)},{id:"markdown",name:"Markdown",aliases:["md"],import:()=>e.A(803482)},{id:"marko",name:"Marko",import:()=>e.A(948534)},{id:"matlab",name:"MATLAB",import:()=>e.A(301121)},{id:"mdc",name:"MDC",import:()=>e.A(602420)},{id:"mdx",name:"MDX",import:()=>e.A(506813)},{id:"mermaid",name:"Mermaid",aliases:["mmd"],import:()=>e.A(140850)},{id:"mipsasm",name:"MIPS Assembly",aliases:["mips"],import:()=>e.A(549647)},{id:"mojo",name:"Mojo",import:()=>e.A(962276)},{id:"moonbit",name:"MoonBit",aliases:["mbt","mbti"],import:()=>e.A(488064)},{id:"move",name:"Move",import:()=>e.A(935257)},{id:"narrat",name:"Narrat Language",aliases:["nar"],import:()=>e.A(145171)},{id:"nextflow",name:"Nextflow",aliases:["nf"],import:()=>e.A(371822)},{id:"nginx",name:"Nginx",import:()=>e.A(670410)},{id:"nim",name:"Nim",import:()=>e.A(339255)},{id:"nix",name:"Nix",import:()=>e.A(868854)},{id:"nushell",name:"nushell",aliases:["nu"],import:()=>e.A(22667)},{id:"objective-c",name:"Objective-C",aliases:["objc"],import:()=>e.A(436910)},{id:"objective-cpp",name:"Objective-C++",import:()=>e.A(507940)},{id:"ocaml",name:"OCaml",import:()=>e.A(55452)},{id:"openscad",name:"OpenSCAD",aliases:["scad"],import:()=>e.A(933900)},{id:"pascal",name:"Pascal",import:()=>e.A(246481)},{id:"perl",name:"Perl",import:()=>e.A(325975)},{id:"php",name:"PHP",import:()=>e.A(832212)},{id:"pkl",name:"Pkl",import:()=>e.A(929773)},{id:"plsql",name:"PL/SQL",import:()=>e.A(997293)},{id:"po",name:"Gettext PO",aliases:["pot","potx"],import:()=>e.A(948438)},{id:"polar",name:"Polar",import:()=>e.A(714648)},{id:"postcss",name:"PostCSS",import:()=>e.A(378567)},{id:"powerquery",name:"PowerQuery",import:()=>e.A(656940)},{id:"powershell",name:"PowerShell",aliases:["ps","ps1"],import:()=>e.A(197812)},{id:"prisma",name:"Prisma",import:()=>e.A(286754)},{id:"prolog",name:"Prolog",import:()=>e.A(714818)},{id:"proto",name:"Protocol Buffer 3",aliases:["protobuf"],import:()=>e.A(26675)},{id:"pug",name:"Pug",aliases:["jade"],import:()=>e.A(694488)},{id:"puppet",name:"Puppet",import:()=>e.A(118886)},{id:"purescript",name:"PureScript",import:()=>e.A(354419)},{id:"python",name:"Python",aliases:["py"],import:()=>e.A(196728)},{id:"qml",name:"QML",import:()=>e.A(850381)},{id:"qmldir",name:"QML Directory",import:()=>e.A(776789)},{id:"qss",name:"Qt Style Sheets",import:()=>e.A(988321)},{id:"r",name:"R",import:()=>e.A(577036)},{id:"racket",name:"Racket",import:()=>e.A(733419)},{id:"raku",name:"Raku",aliases:["perl6"],import:()=>e.A(755698)},{id:"razor",name:"ASP.NET Razor",import:()=>e.A(525413)},{id:"reg",name:"Windows Registry Script",import:()=>e.A(871580)},{id:"regexp",name:"RegExp",aliases:["regex"],import:()=>e.A(719347)},{id:"rel",name:"Rel",import:()=>e.A(418074)},{id:"riscv",name:"RISC-V",import:()=>e.A(248688)},{id:"rosmsg",name:"ROS Interface",import:()=>e.A(417101)},{id:"rst",name:"reStructuredText",import:()=>e.A(205156)},{id:"ruby",name:"Ruby",aliases:["rb"],import:()=>e.A(616617)},{id:"rust",name:"Rust",aliases:["rs"],import:()=>e.A(712841)},{id:"sas",name:"SAS",import:()=>e.A(407559)},{id:"sass",name:"Sass",import:()=>e.A(329481)},{id:"scala",name:"Scala",import:()=>e.A(906092)},{id:"scheme",name:"Scheme",import:()=>e.A(99440)},{id:"scss",name:"SCSS",import:()=>e.A(280679)},{id:"sdbl",name:"1C (Query)",aliases:["1c-query"],import:()=>e.A(54004)},{id:"shaderlab",name:"ShaderLab",aliases:["shader"],import:()=>e.A(529105)},{id:"shellscript",name:"Shell",aliases:["bash","sh","shell","zsh"],import:()=>e.A(430026)},{id:"shellsession",name:"Shell Session",aliases:["console"],import:()=>e.A(681262)},{id:"smalltalk",name:"Smalltalk",import:()=>e.A(429843)},{id:"solidity",name:"Solidity",import:()=>e.A(790483)},{id:"soy",name:"Closure Templates",aliases:["closure-templates"],import:()=>e.A(66378)},{id:"sparql",name:"SPARQL",import:()=>e.A(14166)},{id:"splunk",name:"Splunk Query Language",aliases:["spl"],import:()=>e.A(825194)},{id:"sql",name:"SQL",import:()=>e.A(486478)},{id:"ssh-config",name:"SSH Config",import:()=>e.A(29704)},{id:"stata",name:"Stata",import:()=>e.A(205697)},{id:"stylus",name:"Stylus",aliases:["styl"],import:()=>e.A(561937)},{id:"svelte",name:"Svelte",import:()=>e.A(69149)},{id:"swift",name:"Swift",import:()=>e.A(558167)},{id:"system-verilog",name:"SystemVerilog",import:()=>e.A(471804)},{id:"systemd",name:"Systemd Units",import:()=>e.A(699598)},{id:"talonscript",name:"TalonScript",aliases:["talon"],import:()=>e.A(224168)},{id:"tasl",name:"Tasl",import:()=>e.A(268280)},{id:"tcl",name:"Tcl",import:()=>e.A(341811)},{id:"templ",name:"Templ",import:()=>e.A(760495)},{id:"terraform",name:"Terraform",aliases:["tf","tfvars"],import:()=>e.A(983690)},{id:"tex",name:"TeX",import:()=>e.A(981895)},{id:"toml",name:"TOML",import:()=>e.A(523467)},{id:"ts-tags",name:"TypeScript with Tags",aliases:["lit"],import:()=>e.A(70493)},{id:"tsv",name:"TSV",import:()=>e.A(528966)},{id:"tsx",name:"TSX",import:()=>e.A(765573)},{id:"turtle",name:"Turtle",import:()=>e.A(889390)},{id:"twig",name:"Twig",import:()=>e.A(158869)},{id:"typescript",name:"TypeScript",aliases:["ts","cts","mts"],import:()=>e.A(540873)},{id:"typespec",name:"TypeSpec",aliases:["tsp"],import:()=>e.A(941325)},{id:"typst",name:"Typst",aliases:["typ"],import:()=>e.A(905331)},{id:"v",name:"V",import:()=>e.A(634520)},{id:"vala",name:"Vala",import:()=>e.A(749827)},{id:"vb",name:"Visual Basic",aliases:["cmd"],import:()=>e.A(723339)},{id:"verilog",name:"Verilog",import:()=>e.A(659928)},{id:"vhdl",name:"VHDL",import:()=>e.A(676577)},{id:"viml",name:"Vim Script",aliases:["vim","vimscript"],import:()=>e.A(9996)},{id:"vue",name:"Vue",import:()=>e.A(990512)},{id:"vue-html",name:"Vue HTML",import:()=>e.A(318085)},{id:"vue-vine",name:"Vue Vine",import:()=>e.A(984300)},{id:"vyper",name:"Vyper",aliases:["vy"],import:()=>e.A(712096)},{id:"wasm",name:"WebAssembly",import:()=>e.A(959984)},{id:"wenyan",name:"Wenyan",aliases:["文言"],import:()=>e.A(657695)},{id:"wgsl",name:"WGSL",import:()=>e.A(216503)},{id:"wikitext",name:"Wikitext",aliases:["mediawiki","wiki"],import:()=>e.A(237218)},{id:"wit",name:"WebAssembly Interface Types",import:()=>e.A(944971)},{id:"wolfram",name:"Wolfram",aliases:["wl"],import:()=>e.A(483867)},{id:"xml",name:"XML",import:()=>e.A(190206)},{id:"xsl",name:"XSL",import:()=>e.A(893978)},{id:"yaml",name:"YAML",aliases:["yml"],import:()=>e.A(267823)},{id:"zenscript",name:"ZenScript",import:()=>e.A(747329)},{id:"zig",name:"Zig",import:()=>e.A(904154)}],ev=Object.fromEntries(ex.map(e=>[e.id,e.import])),eb=Object.fromEntries(ex.flatMap(e=>e.aliases?.map(t=>[t,e.import])||[])),ew={...ev,...eb};class ek extends Error{constructor(e){super(e),this.name="ShikiError"}}var ej=e.i(950382);function eS(e,...t){return t.forEach(t=>{for(let r in t)e[r]=t[r]}),e}var eN=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,eA=class{static hasCaptures(e){return null!==e&&(eN.lastIndex=0,eN.test(e))}static replaceCaptures(e,t,r){return e.replace(eN,(e,n,i,s)=>{let a=r[parseInt(n||i,10)];if(!a)return e;{let e=t.substring(a.start,a.end);for(;"."===e[0];)e=e.substring(1);switch(s){case"downcase":return e.toLowerCase();case"upcase":return e.toUpperCase();default:return e}}})}};function eC(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,s;let r=(i=e[n],i<(s=t[n])?-1:+(i>s));if(0!==r)return r}return 0}return r-n}function e_(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 eT(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var eE=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}},eP=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,s=t[e];if(!s.settings)continue;if("string"==typeof s.scope){let e=s.scope;i=(e=(e=e.replace(/^[,]+/,"")).replace(/[,]+$/,"")).split(",")}else i=Array.isArray(s.scope)?s.scope:[""];let a=-1;if("string"==typeof s.settings.fontStyle){a=0;let e=s.settings.fontStyle.split(" ");for(let t=0,r=e.length;t<r;t++)switch(e[t]){case"italic":a|=1;break;case"bold":a|=2;break;case"underline":a|=4;break;case"strikethrough":a|=8}}let o=null;"string"==typeof s.settings.foreground&&e_(s.settings.foreground)&&(o=s.settings.foreground);let l=null;"string"==typeof s.settings.background&&e_(s.settings.background)&&(l=s.settings.background);for(let t=0,s=i.length;t<s;t++){let s=i[t].trim().split(" "),c=s[s.length-1],u=null;s.length>1&&(u=s.slice(0,s.length-1)).reverse(),r[n++]=new eL(c,u,e,a,o,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=eC(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 s=new eD(t),a=new eM(r,s.getId(n),s.getId(i)),o=new eF(new eB(0,null,-1,0,0),[]);for(let t=0,r=e.length;t<r;t++){let r=e[t];o.insert(0,r.scope,r.parentScopes,r.fontStyle,s.getId(r.foreground),s.getId(r.background))}return new eP(s,a,o)}(e,t)}_cachedMatchRoot=new eE(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 s=t[i],a=!1;if(">"===s){if(i===t.length-1)return!1;s=t[++i],a=!0}for(;e&&(r=e.scopeName,!((n=s)===r||r.startsWith(n)&&"."===r[n.length]));){if(a)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0})(e.parent,t.parentScopes));return r?new eM(r.fontStyle,r.foreground,r.background):null}},eR=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}},eM=class{constructor(e,t,r){this.fontStyle=e,this.foregroundId=t,this.backgroundId=r}},eL=class{constructor(e,t,r,n,i,s){this.scope=e,this.parentScopes=t,this.index=r,this.fontStyle=n,this.foreground=i,this.background=s}},eI=((p=eI||{})[p.NotSet=-1]="NotSet",p[p.None=0]="None",p[p.Italic=1]="Italic",p[p.Bold=2]="Bold",p[p.Underline=4]="Underline",p[p.Strikethrough=8]="Strikethrough",p),eD=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)}},eO=Object.freeze([]),eB=class e{scopeDepth;parentScopes;fontStyle;foreground;background;constructor(e,t,r,n,i){this.scopeDepth=e,this.parentScopes=t||eO,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)}},eF=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,s,a){let o,l,c;if(""===r)return void this._doInsertHere(t,n,i,s,a);let u=r.indexOf(".");-1===u?(o=r,l=""):(o=r.substring(0,u),l=r.substring(u+1)),this._children.hasOwnProperty(o)?c=this._children[o]:(c=new e(this._mainRule.clone(),eB.cloneArr(this._rulesWithParentScopes)),this._children[o]=c),c.insert(t+1,l,n,i,s,a)}_doInsertHere(e,t,r,n,i){if(null===t)return void this._mainRule.acceptOverwrite(e,r,n,i);for(let s=0,a=this._rulesWithParentScopes.length;s<a;s++){let a=this._rulesWithParentScopes[s];if(0===eC(a.parentScopes,t))return void a.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 eB(e,t,r,n,i))}},ez=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,s,a,o){let l=e.getLanguageId(t),c=e.getTokenType(t),u=+!!e.containsBalancedBrackets(t),d=e.getFontStyle(t),h=e.getForeground(t),p=e.getBackground(t);return 0!==r&&(l=r),8!==n&&(c=n),null!==i&&(u=+!!i),-1!==s&&(d=s),0!==a&&(h=a),0!==o&&(p=o),(l|c<<8|u<<10|d<<11|h<<15|p<<24)>>>0}};function e$(e,t){var r;let n,i,s=[],a=(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}}),o=a.next();for(;null!==o;){let e=0;if(2===o.length&&":"===o.charAt(1)){switch(o.charAt(0)){case"R":e=1;break;case"L":e=-1;break;default:console.log(`Unknown priority ${o} in scope selector`)}o=a.next()}let t=c();if(s.push({matcher:t,priority:e}),","!==o)break;o=a.next()}return s;function l(){if("-"===o){o=a.next();let e=l();return t=>!!e&&!e(t)}if("("===o){o=a.next();let e=function(){let e=[],t=c();for(;t&&(e.push(t),"|"===o||","===o);){do o=a.next();while("|"===o||","===o)t=c()}return t=>e.some(e=>e(t))}();return")"===o&&(o=a.next()),e}if(eV(o)){let e=[];do e.push(o),o=a.next();while(eV(o))return r=>t(e,r)}return null}function c(){let e=[],t=l();for(;t;)e.push(t),t=l();return t=>e.every(e=>e(t))}}function eV(e){return!!e&&!!e.match(/[\w\.:]+/)}var eU=((m=eU||{})[m.None=0]="None",m[m.NotBeginString=1]="NotBeginString",m[m.NotEndString=2]="NotEndString",m[m.NotBeginPosition=4]="NotBeginPosition",m[m.DebugCall=8]="DebugCall",m);function eW(e){"function"==typeof e.dispose&&e.dispose()}var eG=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},eH=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},eq=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))}},eK=class{constructor(e,t){this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new eG(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){let e=this.Q;this.Q=[];let t=new eq;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 s=r.lookup(t);e instanceof eG?eX({baseGrammar:s,selfGrammar:i},n):eY(e.ruleName,{baseGrammar:s,selfGrammar:i,repository:i.repository},n);let a=r.injections(e.scopeName);if(a)for(let e of a)n.add(new eG(e))}(r,this.initialScopeName,this.repo,t);for(let e of t.references)if(e instanceof eG){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 eY(e,t,r){t.repository&&t.repository[e]&&eJ([t.repository[e]],t,r)}function eX(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&&eJ(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&&eJ(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function eJ(e,t,r){for(let n of e){if(r.visitedRule.has(n))continue;r.visitedRule.add(n);let e=n.repository?eS({},t.repository,n.repository):t.repository;Array.isArray(n.patterns)&&eJ(n.patterns,{...t,repository:e},r);let i=n.include;if(!i)continue;let s=e5(i);switch(s.kind){case 0:eX({...t,selfGrammar:t.baseGrammar},r);break;case 1:eX(t,r);break;case 2:eY(s.ruleName,{...t,repository:e},r);break;case 3:case 4:let a=s.scopeName===t.selfGrammar.scopeName?t.selfGrammar:s.scopeName===t.baseGrammar.scopeName?t.baseGrammar:void 0;if(a){let n={baseGrammar:t.baseGrammar,selfGrammar:a,repository:e};4===s.kind?eY(s.ruleName,n,r):eX(n,r)}else 4===s.kind?r.add(new eH(s.scopeName,s.ruleName)):r.add(new eG(s.scopeName))}}}var eZ=class{kind=0},eQ=class{kind=1},e0=class{constructor(e){this.ruleName=e}kind=2},e1=class{constructor(e){this.scopeName=e}kind=3},e2=class{constructor(e,t){this.scopeName=e,this.ruleName=t}kind=4};function e5(e){if("$base"===e)return new eZ;if("$self"===e)return new eQ;let t=e.indexOf("#");return -1===t?new e1(e):0===t?new e0(e.substring(1)):new e2(e.substring(0,t),e.substring(t+1))}var e3=/\\(\d+)/,e6=/\\(\d+)/g;Symbol("RuleId");var e4=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(e,t,r,n){this.$location=e,this.id=t,this._name=r||null,this._nameIsCapturing=eA.hasCaptures(this._name),this._contentName=n||null,this._contentNameIsCapturing=eA.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?eA.replaceCaptures(this._name,e,t):this._name}getContentName(e,t){return this._contentNameIsCapturing&&null!==this._contentName?eA.replaceCaptures(this._contentName,e,t):this._contentName}},e8=class extends e4{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!")}},e9=class extends e4{_match;captures;_cachedCompiledPatterns;constructor(e,t,r,n,i){super(e,t,r,null),this._match=new tn(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 ti,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},e7=class extends e4{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 ti,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},te=class extends e4{_begin;beginCaptures;_end;endHasBackReferences;endCaptures;applyEndPatternLast;hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,r,n,i,s,a,o,l,c){super(e,t,r,n),this._begin=new tn(i,this.id),this.beginCaptures=s,this._end=new tn(a||"￿",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=o,this.applyEndPatternLast=l||!1,this.patterns=c.patterns,this.hasMissingPatterns=c.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 ti,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}},tt=class extends e4{_begin;beginCaptures;whileCaptures;_while;whileHasBackReferences;hasMissingPatterns;patterns;_cachedCompiledPatterns;_cachedCompiledWhilePatterns;constructor(e,t,r,n,i,s,a,o,l){super(e,t,r,n),this._begin=new tn(i,this.id),this.beginCaptures=s,this.whileCaptures=o,this._while=new tn(a,-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 ti,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 ti,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,t||"￿"),this._cachedCompiledWhilePatterns}},tr=class e{static createCaptureRule(e,t,r,n,i){return e.registerRule(e=>new e8(t,e,r,n,i))}static getCompiledRuleId(t,r,n){return t.id||r.registerRule(i=>{if(t.id=i,t.match)return new e9(t.$vscodeTextmateLocation,t.id,t.name,t.match,e._compileCaptures(t.captures,r,n));if(void 0===t.begin){t.repository&&(n=eS({},n,t.repository));let i=t.patterns;return void 0===i&&t.include&&(i=[{include:t.include}]),new e7(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,e._compilePatterns(i,r,n))}return t.while?new tt(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 te(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 s=0;for(let e in t){if("$vscodeTextmateLocation"===e)continue;let t=parseInt(e,10);t>s&&(s=t)}for(let e=0;e<=s;e++)i[e]=null;for(let s in t){if("$vscodeTextmateLocation"===s)continue;let a=parseInt(s,10),o=0;t[s].patterns&&(o=e.getCompiledRuleId(t[s],r,n)),i[a]=e.createCaptureRule(r,t[s].$vscodeTextmateLocation,t[s].name,t[s].contentName,o)}}return i}static _compilePatterns(t,r,n){let i=[];if(t)for(let s=0,a=t.length;s<a;s++){let a=t[s],o=-1;if(a.include){let t=e5(a.include);switch(t.kind){case 0:case 1:o=e.getCompiledRuleId(n[a.include],r,n);break;case 2:let i=n[t.ruleName];i&&(o=e.getCompiledRuleId(i,r,n));break;case 3:case 4:let s=t.scopeName,l=4===t.kind?t.ruleName:null,c=r.getExternalGrammar(s,n);if(c)if(l){let t=c.repository[l];t&&(o=e.getCompiledRuleId(t,r,c.repository))}else o=e.getCompiledRuleId(c.repository.$self,r,c.repository)}}else o=e.getCompiledRuleId(a,r,n);if(-1!==o){let e=r.getRule(o),t=!1;if((e instanceof e7||e instanceof te||e instanceof tt)&&e.hasMissingPatterns&&0===e.patterns.length&&(t=!0),t)continue;i.push(o)}}return{patterns:i,hasMissingPatterns:(t?t.length:0)!==i.length}}},tn=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 s=0;s<t;s++)if("\\"===e.charAt(s)&&s+1<t){const t=e.charAt(s+1);"z"===t?(n.push(e.substring(r,s)),n.push("$(?!\\n)(?<!\\n)"),r=s+2):("A"===t||"G"===t)&&(i=!0),s++}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=e3.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 e6.lastIndex=0,this.source.replace(e6,(e,t)=>eT(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=[],s=[],a=[],o=[];for(e=0,t=this.source.length;e<t;e++)r=this.source.charAt(e),i[e]=r,s[e]=r,a[e]=r,o[e]=r,"\\"===r&&e+1<t&&("A"===(n=this.source.charAt(e+1))?(i[e+1]="￿",s[e+1]="￿",a[e+1]="A",o[e+1]="A"):"G"===n?(i[e+1]="￿",s[e+1]="G",a[e+1]="￿",o[e+1]="G"):(i[e+1]=n,s[e+1]=n,a[e+1]=n,o[e+1]=n),e++);return{A0_G0:i.join(""),A0_G1:s.join(""),A1_G0:a.join(""),A1_G1:o.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}},ti=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 ts(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 ts(e,this._items.map(e=>e.resolveAnchors(t,r)),this._items.map(e=>e.ruleId))}},ts=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}},ta=class{constructor(e,t){this.languageId=e,this.tokenType=t}},to=class e{_defaultAttributes;_embeddedLanguagesMatcher;constructor(e,t){this._defaultAttributes=new ta(e,8),this._embeddedLanguagesMatcher=new tl(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 ta(0,0);_getBasicScopeAttributes=new eE(e=>new ta(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/},tl=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])=>eT(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!==ej.default&&ej.default.env.VSCODE_TEXTMATE_DEBUG;var tc=class{constructor(e,t){this.stack=e,this.stoppedEarly=t}};function tu(e,t,r,n,i,s,a,o){let l=t.content.length,c=!1,u=-1;if(a){let a=function(e,t,r,n,i,s){let a=i.beginRuleCapturedEOL?0:-1,o=[];for(let t=i;t;t=t.pop()){let r=t.getRule(e);r instanceof tt&&o.push({rule:r,stack:t})}for(let p=o.pop();p;p=o.pop()){var l,c,u,d,h;let{ruleScanner:o,findOptions:m}=(l=p.rule,c=e,u=p.stack.endRule,d=r,h=n===a,{ruleScanner:l.compileWhileAG(c,u,d,h),findOptions:0}),f=o.findNextMatchSync(t,n,m);if(f){if(-2!==f.ruleId){i=p.stack.pop();break}f.captureIndices&&f.captureIndices.length&&(s.produce(p.stack,f.captureIndices[0].start),th(e,t,r,p.stack,s,p.rule.whileCaptures,f.captureIndices),s.produce(p.stack,f.captureIndices[0].end),a=f.captureIndices[0].end,f.captureIndices[0].end>n&&(n=f.captureIndices[0].end,r=!1))}else{i=p.stack.pop();break}}return{stack:i,linePos:n,anchorPosition:a,isFirstLine:r}}(e,t,r,n,i,s);i=a.stack,n=a.linePos,r=a.isFirstLine,u=a.anchorPosition}let d=Date.now();for(;!c;){if(0!==o&&Date.now()-d>o)return new tc(i,!0);!function(){let a=function(e,t,r,n,i,s){let a=function(e,t,r,n,i,s){let{ruleScanner:a,findOptions:o}=td(i.getRule(e),e,i.endRule,r,n===s),l=a.findNextMatchSync(t,n,o);return l?{captureIndices:l.captureIndices,matchedRuleId:l.ruleId}:null}(e,t,r,n,i,s),o=e.getInjections();if(0===o.length)return a;let l=function(e,t,r,n,i,s,a){let o,l=Number.MAX_VALUE,c=null,u=0,d=s.contentNameScopesList.getScopeNames();for(let s=0,h=e.length;s<h;s++){let h=e[s];if(!h.matcher(d))continue;let{ruleScanner:p,findOptions:m}=td(t.getRule(h.ruleId),t,null,n,i===a),f=p.findNextMatchSync(r,i,m);if(!f)continue;let g=f.captureIndices[0].start;if(!(g>=l)&&(l=g,c=f.captureIndices,o=f.ruleId,u=h.priority,l===i))break}return c?{priorityMatch:-1===u,captureIndices:c,matchedRuleId:o}:null}(o,e,t,r,n,i,s);if(!l)return a;if(!a)return l;let c=a.captureIndices[0].start,u=l.captureIndices[0].start;return u<c||l.priorityMatch&&u===c?l:a}(e,t,r,n,i,u);if(!a){s.produce(i,l),c=!0;return}let o=a.captureIndices,d=a.matchedRuleId,h=!!o&&o.length>0&&o[0].end>n;if(-1===d){let a=i.getRule(e);s.produce(i,o[0].start),i=i.withContentNameScopesList(i.nameScopesList),th(e,t,r,i,s,a.endCaptures,o),s.produce(i,o[0].end);let d=i;if(i=i.parent,u=d.getAnchorPos(),!h&&d.getEnterPos()===n){i=d,s.produce(i,l),c=!0;return}}else{let a=e.getRule(d);s.produce(i,o[0].start);let p=i,m=a.getName(t.content,o),f=i.contentNameScopesList.pushAttributed(m,e);if(i=i.push(d,n,u,o[0].end===l,null,f,f),a instanceof te){th(e,t,r,i,s,a.beginCaptures,o),s.produce(i,o[0].end),u=o[0].end;let n=a.getContentName(t.content,o),d=f.pushAttributed(n,e);if(i=i.withContentNameScopesList(d),a.endHasBackReferences&&(i=i.withEndRule(a.getEndWithResolvedBackReferences(t.content,o))),!h&&p.hasSameRuleAs(i)){i=i.pop(),s.produce(i,l),c=!0;return}}else if(a instanceof tt){th(e,t,r,i,s,a.beginCaptures,o),s.produce(i,o[0].end),u=o[0].end;let n=a.getContentName(t.content,o),d=f.pushAttributed(n,e);if(i=i.withContentNameScopesList(d),a.whileHasBackReferences&&(i=i.withEndRule(a.getWhileWithResolvedBackReferences(t.content,o))),!h&&p.hasSameRuleAs(i)){i=i.pop(),s.produce(i,l),c=!0;return}}else if(th(e,t,r,i,s,a.captures,o),s.produce(i,o[0].end),i=i.pop(),!h){i=i.safePop(),s.produce(i,l),c=!0;return}}o[0].end>n&&(n=o[0].end,r=!1)}()}return new tc(i,!1)}function td(e,t,r,n,i){return{ruleScanner:e.compileAG(t,r,n,i),findOptions:0}}function th(e,t,r,n,i,s,a){if(0===s.length)return;let o=t.content,l=Math.min(s.length,a.length),c=[],u=a[0].end;for(let t=0;t<l;t++){let l=s[t];if(null===l)continue;let d=a[t];if(0===d.length)continue;if(d.start>u)break;for(;c.length>0&&c[c.length-1].endPos<=d.start;)i.produceFromScopes(c[c.length-1].scopes,c[c.length-1].endPos),c.pop();if(c.length>0?i.produceFromScopes(c[c.length-1].scopes,d.start):i.produce(n,d.start),l.retokenizeCapturedWithRuleId){let t=l.getName(o,a),s=n.contentNameScopesList.pushAttributed(t,e),c=l.getContentName(o,a),u=s.pushAttributed(c,e),h=n.push(l.retokenizeCapturedWithRuleId,d.start,-1,!1,null,s,u),p=e.createOnigString(o.substring(0,d.end));tu(e,p,r&&0===d.start,d.start,h,i,!1,0),eW(p);continue}let h=l.getName(o,a);if(null!==h){let t=(c.length>0?c[c.length-1].scopes:n.contentNameScopesList).pushAttributed(h,e);c.push(new tp(t,d.end))}}for(;c.length>0;)i.produceFromScopes(c[c.length-1].scopes,c[c.length-1].endPos),c.pop()}var tp=class{scopes;endPos;constructor(e,t){this.scopes=e,this.endPos=t}};function tm(e,t,r,n,i){let s=e$(t,tf),a=tr.getCompiledRuleId(r,n,i.repository);for(let r of s)e.push({debugSelector:t,matcher:r.matcher,ruleId:a,grammar:i,priority:r.priority})}function tf(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 tg=class{constructor(e,t,r,n,i,s,a,o){if(this._rootScopeName=e,this.balancedBracketSelectors=s,this._onigLib=o,this._basicScopeAttributesProvider=new to(r,n),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=a,this._grammar=ty(t,null),this._injections=null,this._tokenTypeMatchers=[],i)for(const e of Object.keys(i))for(const t of e$(e,tf))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)tm(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&&tm(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]=ty(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=tr.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections()),t&&t!==tv.NULL)i=!1,t.reset();else{let e;i=!0;let r=this._basicScopeAttributesProvider.getDefaultAttributes(),n=this.themeProvider.getDefaults(),s=ez.set(0,r.languageId,r.tokenType,null,n.fontStyle,n.foregroundId,n.backgroundId),a=this.getRule(this._rootId).getName(null,null);e=a?tx.createRootAndLookUpScopeName(a,s,this):tx.createRoot("unknown",s),t=new tv(null,this._rootId,-1,-1,!1,null,e,e)}e+="\n";let s=this.createOnigString(e),a=s.content.length,o=new tw(r,e,this._tokenTypeMatchers,this.balancedBracketSelectors),l=tu(this,s,i,0,t,o,!0,n);return eW(s),{lineLength:a,lineTokens:o,ruleStack:l.stack,stoppedEarly:l.stoppedEarly}}};function ty(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 tx=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=eR.push(i,t.scopeNames),t.encodedTokenAttributes);return n}static createRoot(t,r){return new e(null,new eR(null,t),r)}static createRootAndLookUpScopeName(t,r,n){let i=n.getMetadataForScope(t),s=new eR(null,t),a=n.themeProvider.themeMatch(s),o=e.mergeAttributes(r,i,a);return new e(null,s,o)}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,s=0;return null!==r&&(n=r.fontStyle,i=r.foregroundId,s=r.backgroundId),ez.set(e,t.languageId,t.tokenType,null,n,i,s)}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),s=t.scopePath.push(r),a=n.themeProvider.themeMatch(s),o=e.mergeAttributes(t.tokenAttributes,i,a);return new e(t,s,o)}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}},tv=class e{constructor(e,t,r,n,i,s,a,o){this.parent=e,this.ruleId=t,this.beginRuleCapturedEOL=i,this.endRule=s,this.nameScopesList=a,this.contentNameScopesList=o,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)&&tx.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,s,a,o){return new e(this,t,r,n,i,s,a,o)}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=tx.fromExtension(t?.nameScopesList??null,r.nameScopesList);return new e(t,r.ruleId,r.enterPos??-1,r.anchorPos??-1,r.beginRuleCapturedEOL,r.endRule,n,tx.fromExtension(n,r.contentNameScopesList))}},tb=class{balancedBracketScopes;unbalancedBracketScopes;allowAny=!1;constructor(e,t){this.balancedBracketScopes=e.flatMap(e=>"*"===e?(this.allowAny=!0,[]):e$(e,tf).map(e=>e.matcher)),this.unbalancedBracketScopes=t.flatMap(e=>e$(e,tf).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}},tw=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=ez.set(r,0,e.type,null,-1,0,0));this.balancedBracketSelectors&&(n=this.balancedBracketSelectors.match(t))}if(n&&(r=ez.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}},tk=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 s=this._rawGrammars.get(e);if(!s)return null;this._grammars.set(e,new tg(e,s,t,r,n,i,this,this._onigLib))}return this._grammars.get(e)}},tj=class{_options;_syncRegistry;_ensureGrammarCache;constructor(e){this._options=e,this._syncRegistry=new tk(eP.createFromRawTheme(e.theme,e.colorMap),e.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(e,t){this._syncRegistry.setTheme(eP.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 tb(r.balancedBracketSelectors||[],r.unbalancedBracketSelectors||[]))}loadGrammar(e){return this._loadGrammar(e,0,null,null,null)}_loadGrammar(e,t,r,n,i){let s=new eK(this._syncRegistry,e);for(;s.Q.length>0;)s.Q.map(e=>this._loadSingleGrammar(e.scopeName)),s.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)}},tS=tv.NULL,tN=e.i(766368),tA=e.i(145767),tC=e.i(456940);let t_=/["&'<>`]/g,tT=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,tE=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,tP=/[|\\{}()[\]^$+*?.]/g,tR=new WeakMap,tM=/[\dA-Fa-f]/,tL=/\d/,tI=["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"],tD={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:"€"},tO=["cent","copy","divide","gt","lt","not","para","times"],tB={}.hasOwnProperty,tF={};for(t in tD)tB.call(tD,t)&&(tF[tD[t]]=t);let tz=/[^\dA-Za-z]/;function t$(e,t,r){var n,i;let s,a,o=(n=r.omitOptionalSemicolons,s="&#x"+e.toString(16).toUpperCase(),n&&t&&!tM.test(String.fromCharCode(t))?s:s+";");if((r.useNamedReferences||r.useShortestReferences)&&(a=function(e,t,r,n){let i=String.fromCharCode(e);if(tB.call(tF,i)){let e=tF[i],s="&"+e;return r&&tI.includes(e)&&!tO.includes(e)&&(!n||t&&61!==t&&tz.test(String.fromCharCode(t)))?s:s+";"}return""}(e,t,r.omitOptionalSemicolons,r.attribute)),(r.useShortestReferences||!a)&&r.useShortestReferences){let n,s=(i=r.omitOptionalSemicolons,n="&#"+String(e),i&&t&&!tL.test(String.fromCharCode(t))?n:n+";");s.length<o.length&&(o=s)}return a&&(!r.useShortestReferences||a.length<o.length)?a:o}function tV(e,t){let r;var n,i=e,s=Object.assign({format:t$},t);if(i=i.replace(s.subset?(n=s.subset,(r=tR.get(n))||(r=function(e){let t=[],r=-1;for(;++r<e.length;)t.push(e[r].replace(tP,"\\$&"));return RegExp("(?:"+t.join("|")+")","g")}(n),tR.set(n,r)),r):t_,a),s.subset||s.escapeOnly)return i;return i.replace(tT,function(e,t,r){return s.format((e.charCodeAt(0)-55296)*1024+e.charCodeAt(1)-56320+65536,r.charCodeAt(t+2),s)}).replace(tE,a);function a(e,t,r){return s.format(e.charCodeAt(0),r.charCodeAt(t+1),s)}}let tU=/^>|^->|<!--|-->|--!>|<!-$/g,tW=[">"],tG=["<",">"];var tH=e.i(294254),tq=e.i(214644),tK=e.i(781812),tY=e.i(645060),tX=e.i(960688);let tJ=t0(1),tZ=t0(-1),tQ=[];function t0(e){return function(t,r,n){let i=t?t.children:tQ,s=(r||0)+e,a=i[s];if(!n)for(;a&&(0,tX.whitespace)(a);)s+=e,a=i[s];return a}}let t1={}.hasOwnProperty;function t2(e){return function(t,r,n){return t1.call(e,t.tagName)&&e[t.tagName](t,r,n)}}let t5=t2({body:function(e,t,r){let n=tJ(r,t);return!n||"comment"!==n.type},caption:t3,colgroup:t3,dd:function(e,t,r){let n=tJ(r,t);return!n||"element"===n.type&&("dt"===n.tagName||"dd"===n.tagName)},dt:function(e,t,r){let n=tJ(r,t);return!!(n&&"element"===n.type&&("dt"===n.tagName||"dd"===n.tagName))},head:t3,html:function(e,t,r){let n=tJ(r,t);return!n||"comment"!==n.type},li:function(e,t,r){let n=tJ(r,t);return!n||"element"===n.type&&"li"===n.tagName},optgroup:function(e,t,r){let n=tJ(r,t);return!n||"element"===n.type&&"optgroup"===n.tagName},option:function(e,t,r){let n=tJ(r,t);return!n||"element"===n.type&&("option"===n.tagName||"optgroup"===n.tagName)},p:function(e,t,r){let n=tJ(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:t6,rt:t6,tbody:function(e,t,r){let n=tJ(r,t);return!n||"element"===n.type&&("tbody"===n.tagName||"tfoot"===n.tagName)},td:t4,tfoot:function(e,t,r){return!tJ(r,t)},th:t4,thead:function(e,t,r){let n=tJ(r,t);return!!(n&&"element"===n.type&&("tbody"===n.tagName||"tfoot"===n.tagName))},tr:function(e,t,r){let n=tJ(r,t);return!n||"element"===n.type&&"tr"===n.tagName}});function t3(e,t,r){let n=tJ(r,t,!0);return!n||"comment"!==n.type&&!("text"===n.type&&(0,tX.whitespace)(n.value.charAt(0)))}function t6(e,t,r){let n=tJ(r,t);return!n||"element"===n.type&&("rp"===n.tagName||"rt"===n.tagName)}function t4(e,t,r){let n=tJ(r,t);return!n||"element"===n.type&&("td"===n.tagName||"th"===n.tagName)}let t8=t2({body:function(e){let t=tJ(e,-1,!0);return!t||"comment"!==t.type&&!("text"===t.type&&(0,tX.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=tZ(r,t),i=tJ(e,-1,!0);return!(r&&n&&"element"===n.type&&"colgroup"===n.tagName&&t5(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=tJ(e,-1);return!t||"comment"!==t.type},tbody:function(e,t,r){let n=tZ(r,t),i=tJ(e,-1);return!(r&&n&&"element"===n.type&&("thead"===n.tagName||"tbody"===n.tagName)&&t5(n,r.children.indexOf(n),r))&&!!(i&&"element"===i.type&&"tr"===i.tagName)}}),t9={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("")]]},t7=["<","&"];function re(e,t,r,n){return r&&"element"===r.type&&("script"===r.tagName||"style"===r.tagName)?e.value:tV(e.value,Object.assign({},n.settings.characterReferences,{subset:t7}))}let rt=(0,tC.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?"<?"+tV(e.value,Object.assign({},n.settings.characterReferences,{subset:tW}))+">":"<!--"+e.value.replace(tU,function(e){return tV(e,Object.assign({},n.settings.characterReferences,{subset:tG}))})+"-->"},doctype:function(e,t,r,n){return"<!"+(n.settings.upperDoctype?"DOCTYPE":"doctype")+(n.settings.tightDoctype?"":" ")+"html>"},element:function(e,t,r,n){let i,s=n.schema,a="svg"!==s.space&&n.settings.omitOptionalTags,o="svg"===s.space?n.settings.closeEmptyElements:n.settings.voids.includes(e.tagName.toLowerCase()),l=[];"html"===s.space&&"svg"===e.tagName&&(n.schema=tA.svg);let c=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,tK.find)(e.schema,t),s=e.settings.allowParseErrors&&"html"===e.schema.space?0:1,a=+!e.settings.allowDangerousCharacters,o=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=tV(i.attribute,Object.assign({},e.settings.characterReferences,{subset:t9.name[s][a]}));return!0===r||(r=Array.isArray(r)?(i.commaSeparated?tq.stringify:tY.stringify)(r,{padLeft:!e.settings.tightCommaSeparatedLists}):String(r),e.settings.collapseEmptyAttributes&&!r)?l:(e.settings.preferUnquoted&&(n=tV(r,Object.assign({},e.settings.characterReferences,{attribute:!0,subset:t9.unquoted[s][a]}))),n!==r&&(e.settings.quoteSmart&&(0,tH.ccount)(r,o)>(0,tH.ccount)(r,e.alternative)&&(o=e.alternative),n=o+tV(r,Object.assign({},e.settings.characterReferences,{subset:("'"===o?t9.single:t9.double)[s][a],attribute:!0}))+o),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),u=n.all("html"===s.space&&"template"===e.tagName?e.content:e);return n.schema=s,u&&(o=!1),!c&&a&&t8(e,t,r)||(l.push("<",e.tagName,c?" "+c:""),o&&("svg"===s.space||n.settings.closeSelfClosing)&&(i=c.charAt(c.length-1),(!n.settings.tightSelfClosing||"/"===i||i&&'"'!==i&&"'"!==i)&&l.push(" "),l.push("/")),l.push(">")),l.push(u),o||a&&t5(e,t,r)||l.push("</"+e.tagName+">"),l.join("")},raw:function(e,t,r,n){return n.settings.allowDangerousHtml?e.value:re(e,t,r,n)},root:function(e,t,r,n){return n.all(e)},text:re}}),rr={},rn={},ri=[];function rs(e,t,r){return rt(e,t,r,this)}function ra(e){let t=[],r=e&&e.children||ri,n=-1;for(;++n<r.length;)t[n]=this.one(r[n],n,e);return t.join("")}function ro(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 rl(e,t){return e&&t?.[e?.toLowerCase()]||e}async function rc(e){return Promise.resolve("function"==typeof e?e():e).then(e=>e.default||e)}function ru(e){return!e||["plaintext","txt","text","plain"].includes(e)}function rd(e){return"ansi"===e||ru(e)}function rh(e){return"none"===e}function rp(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 rm(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 s=t?r[e]+(r[e+1]||""):r[e];i.push([s,n]),n+=r[e].length,n+=r[e+1]?.length||0}return i}let rf="light-dark()",rg=["color","background-color"];function ry(e){let t={};if(e.color&&(t.color=e.color),e.bgColor&&(t["background-color"]=e.bgColor),e.fontStyle){e.fontStyle&eI.Italic&&(t["font-style"]="italic"),e.fontStyle&eI.Bold&&(t["font-weight"]="bold");let r=[];e.fontStyle&eI.Underline&&r.push("underline"),e.fontStyle&eI.Strikethrough&&r.push("line-through"),r.length&&(t["text-decoration"]=r.join(" "))}return t}function rx(e){return"string"==typeof e?e:Object.entries(e).map(([e,t])=>`${e}:${t}`).join(";")}let rv=new WeakMap;function rb(e,t){rv.set(e,t)}function rw(e){return rv.get(e)}class rk{_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 rk(Object.fromEntries((Array.isArray(t)?t:[t]).map(e=>[e,tS])),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 rj=[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 ek(`Invalid decoration offset: ${e}. Code length: ${t.source.length}`);return{...s.indexToPos(e),offset:e}}{let t=s.lines[e.line];if(void 0===t)throw new ek(`Invalid decoration position ${JSON.stringify(e)}. Lines length: ${s.lines.length}`);let r=e.character;if(r<0&&(r=t.length+r),r<0||r>t.length)throw new ek(`Invalid decoration position ${JSON.stringify(e)}. Line ${e.line} length: ${t.length}`);return{...e,character:r,offset:s.posToIndex(e.line,r)}}},s={lines:n=rm(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}},a=(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 ek(`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,s=r.start.offset<t.end.offset&&t.end.offset<=r.end.offset,a=t.start.offset<=r.start.offset&&r.start.offset<t.end.offset,o=t.start.offset<r.end.offset&&r.end.offset<=t.end.offset;if(i||s||a||o){if(i&&s||a&&o||a&&r.start.offset===r.end.offset||s&&t.start.offset===t.end.offset)continue;throw new ek(`Decorations ${JSON.stringify(r.start)} and ${JSON.stringify(t.start)} intersect.`)}}}})(a),e.set(t.meta,{decorations:a,converter:s,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 ek(`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 a=n[e],o="",l=-1,c=-1;if(0===t&&(l=0),0===r&&(c=0),r===1/0&&(c=a.children.length),-1===l||-1===c)for(let e=0;e<a.children.length;e++)o+=function e(t){return"text"===t.type?t.value:"element"===t.type?t.children.map(e).join(""):""}(a.children[e]),-1===l&&o.length===t&&(l=e+1),-1===c&&o.length===r&&(c=e+1);if(-1===l)throw new ek(`Failed to find start index for decoration ${JSON.stringify(i.start)}`);if(-1===c)throw new ek(`Failed to find end index for decoration ${JSON.stringify(i.end)}`);let u=a.children.slice(l,c);if(i.alwaysWrap||u.length!==a.children.length)if(i.alwaysWrap||1!==u.length||"element"!==u[0].type){let e={type:"element",tagName:"span",properties:{},children:u};s(e,i,"wrapper"),a.children.splice(l,u.length,e)}else s(u[0],i,"token");else s(a,i,"line")}function s(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&&rp(e,t.properties.class),e=i(e,r)||e}let a=[];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++)a.unshift(()=>{var t;n[t=i]=s(n[t],e,"line")});i(r.line,0,r.character,e)}}a.forEach(e=>e())}}}()];function rS(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,...rj]}var rN=["black","red","green","yellow","blue","magenta","cyan","white","brightBlack","brightRed","brightGreen","brightYellow","brightBlue","brightMagenta","brightCyan","brightWhite"],rA={1:"bold",2:"dim",3:"italic",4:"underline",7:"reverse",8:"hidden",9:"strikethrough"};function rC(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 r_={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 rT={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 rE(e,t,r={}){var n,i;let s,a,{theme:o=e.getLoadedThemes()[0]}=r,l=e.resolveLangAlias(r.lang||"text");if(ru(l)||rh(o))return rm(t).map(e=>[{content:e[0],offset:e[1]}]);let{theme:c,colorMap:u}=e.setTheme(o);if("ansi"===l){let e,n,i,s,a,o,l;return e=ro(c,r),n=rm(t),i=function(e=r_){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<rN.length;r++)t.push(e[rN[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 s=0;s<6;s++)t.push(r([n[e],n[i],n[s]]));let i=8;for(let e=0;e<24;e++,i+=10)t.push(r([i,i,i]));return t}()[i]}}}}(Object.fromEntries(rN.map(e=>{let t=`terminal.ansi${e[0].toUpperCase()}${e.substring(1)}`;return[e,c.colors?.[t]||rT[e]]}))),s=null,a=null,o=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:s,background:a,decorations:new Set(o)}),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)rA[n]&&t.push({type:"setDecoration",value:rA[n]});else if(n<=29){let e=rA[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:rN[n-30]}});else if(38===n){let r=rC(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:rN[n-40]}});else if(48===n){let r=rC(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:rN[n-90+8]}}):n>=100&&n<=107&&t.push({type:"setBackgroundColor",value:{type:"named",name:rN[n-100+8]}})}return t}(n.sequence);for(let t of e)"resetAll"===t.type?(s=null,a=null,o.clear()):"resetForegroundColor"===t.type?s=null:"resetBackgroundColor"===t.type?a=null:"resetDecoration"===t.type&&o.delete(t.value);for(let t of e)"setForegroundColor"===t.type?s=t.value:"setBackgroundColor"===t.type?a=t.value:"setDecoration"===t.type&&o.add(t.value)}r=n.position}while(r<e.length)return t}},n.map(t=>l.parse(t[0]).map(r=>{let n,s;r.decorations.has("reverse")?(n=r.background?i.value(r.background):c.bg,s=r.foreground?i.value(r.foreground):c.fg):(n=r.foreground?i.value(r.foreground):c.fg,s=r.background?i.value(r.background):void 0),n=rl(n,e),s=rl(s,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],s=Math.round(Number.parseInt(`${i}${i}`,16)/2).toString(16).padStart(2,"0");return`#${t}${t}${r}${r}${n}${n}${s}`}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 a=eI.None;return r.decorations.has("bold")&&(a|=eI.Bold),r.decorations.has("italic")&&(a|=eI.Italic),r.decorations.has("underline")&&(a|=eI.Underline),r.decorations.has("strikethrough")&&(a|=eI.Strikethrough),{content:r.value,offset:t[1],color:n,bgColor:s,fontStyle:a}}))}let d=e.getLanguage(r.lang||"text");if(r.grammarState){if(r.grammarState.lang!==d.name)throw new ek(`Grammar state language "${r.grammarState.lang}" does not match highlight language "${d.name}"`);if(!r.grammarState.themes.includes(c.name))throw new ek(`Grammar state themes "${r.grammarState.themes}" do not contain highlight theme "${c.name}"`)}return a=new rk((s=rP(t,n=d,i=c,u,r)).stateStack,n.name,i.name),rb(s.tokens,a),s.tokens}function rP(e,t,r,n,i){let s=ro(r,i),{tokenizeMaxLineLength:a=0,tokenizeTimeLimit:o=500}=i,l=rm(e),c=i.grammarState?function(e,t){if(!(e instanceof rk))throw new ek("Invalid grammar state");return e.getInternalStack(t)}(i.grammarState,r.name)??tS:null!=i.grammarContextCode?rP(i.grammarContextCode,t,r,n,{...i,grammarState:void 0,grammarContextCode:void 0}).stateStack:tS,u=[],d=[];for(let e=0,h=l.length;e<h;e++){let h,p,[m,f]=l[e];if(""===m){u=[],d.push([]);continue}if(a>0&&m.length>=a){u=[],d.push([{content:m,offset:f,color:"",fontStyle:0}]);continue}i.includeExplanation&&(h=t.tokenizeLine(m,c,o).tokens,p=0);let g=t.tokenizeLine2(m,c,o),y=g.tokens.length/2;for(let e=0;e<y;e++){let t=g.tokens[2*e],a=e+1<y?g.tokens[2*e+2]:m.length;if(t===a)continue;let o=g.tokens[2*e+1],l=rl(n[ez.getForeground(o)],s),c=ez.getFontStyle(o),d={content:m.substring(t,a),offset:f+t,color:l,fontStyle:c};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<a;){let t=h[p],r=m.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:s}of e)for(let e of i)if(function(e,t,r){if(!rR(e[e.length-1],t))return!1;let n=e.length-2,i=r.length-1;for(;n>=0&&i>=0;)rR(e[n],r[i])&&(n-=1),i-=1;return -1===n}(e,t,r)){n.push(s);break}return n}(e,i,t.slice(0,n))}}return r}(e,t.scopes)}),p+=1}}u.push(d)}d.push(u),u=[],c=g.ruleStack}return{tokens:d,stateStack:c}}function rR(e,t){return e===t||t.substring(0,e.length)===e&&"."===t[e.length]}function rM(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=rE(e,t,{...r,theme:n.theme}),s=rw(i);return{tokens:i,state:s,theme:"string"==typeof n.theme?n.theme:n.theme.name}}),s=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]),s=t.map(()=>[]);t.forEach((e,t)=>e.push(s[t]));let a=i.map(()=>0),o=i.map(e=>e[0]);for(;o.every(e=>e);){let e=Math.min(...o.map(e=>e.content.length));for(let t=0;t<r;t++){let r=o[t];r.content.length===e?(s[t].push(r),a[t]+=1,o[t]=i[t][a[t]]):(s[t].push({...r,content:r.content.slice(0,e)}),o[t]={...r,content:r.content.slice(e),offset:r.offset+e})}}}return t}(...i.map(e=>e.tokens)),a=s[0].map((e,t)=>e.map((e,i)=>{let a={content:e.content,variants:{},offset:e.offset};return"includeExplanation"in r&&r.includeExplanation&&(a.explanation=e.explanation),s.forEach((e,r)=>{let{content:s,explanation:o,offset:l,...c}=e[t][i];a.variants[n[r].color]=c}),a})),o=i[0].state?new rk(Object.fromEntries(i.map(e=>[e.theme,e.state?.getInternalStack(e.theme)])),i[0].state.lang):void 0;return o&&rb(a,o),a}function rL(e,t,r){let n,i,s,a,o,l;if("themes"in r){let{defaultColor:c="light",cssVariablePrefix:u="--shiki-",colorsRendering:d="css-vars"}=r,h=Object.entries(r.themes).filter(e=>e[1]).map(e=>({color:e[0],theme:e[1]})).sort((e,t)=>e.color===c?-1:+(t.color===c));if(0===h.length)throw new ek("`themes` option must not be empty");let p=rM(e,t,r);if(l=rw(p),c&&rf!==c&&!h.find(e=>e.color===c))throw new ek(`\`themes\` option must contain the defaultColor key \`${c}\``);let m=h.map(t=>e.getTheme(t.theme)),f=h.map(e=>e.color);s=p.map(e=>e.map(e=>(function(e,t,r,n,i="css-vars"){let s={content:e.content,explanation:e.explanation,offset:e.offset},a=t.map(t=>ry(e.variants[t])),o=new Set(a.flatMap(e=>Object.keys(e))),l={},c=(e,n)=>{let i="color"===n?"":"background-color"===n?"-bg":`-${n}`;return r+t[e]+("color"===n?"":i)};return a.forEach((e,r)=>{for(let s of o){let o=e[s]||"inherit";if(0===r&&n&&rg.includes(s))if(n===rf&&a.length>1){let e=t.findIndex(e=>"light"===e),n=t.findIndex(e=>"dark"===e);if(-1===e||-1===n)throw new ek('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');let u=a[e][s]||"inherit",d=a[n][s]||"inherit";l[s]=`light-dark(${u}, ${d})`,"css-vars"===i&&(l[c(r,s)]=o)}else l[s]=o;else"css-vars"===i&&(l[c(r,s)]=o)}}),s.htmlStyle=l,s})(e,f,u,c,d))),l&&rb(s,l);let g=h.map(e=>ro(e.theme,r));i=rI(h,m,g,u,c,"fg",d),n=rI(h,m,g,u,c,"bg",d),a=`shiki-themes ${m.map(e=>e.name).join(" ")}`,o=c?void 0:[i,n].join(";")}else if("theme"in r){let o=ro(r.theme,r);s=rE(e,t,r);let c=e.getTheme(r.theme);n=rl(c.bg,o),i=rl(c.fg,o),a=c.name,l=rw(s)}else throw new ek("Invalid options, either `theme` or `themes` must be provided");return{tokens:s,fg:i,bg:n,themeName:a,rootStyle:o,grammarState:l}}function rI(e,t,r,n,i,s,a){return e.map((o,l)=>{let c=rl(t[l][s],r[l])||"inherit",u=`${n+o.color}${"bg"===s?"-bg":""}:${c}`;if(0===l&&i){if(i===rf&&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 ek('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');let a=rl(t[n][s],r[n])||"inherit",o=rl(t[i][s],r[i])||"inherit";return`light-dark(${a}, ${o});${u}`}return c}return"css-vars"===a?u:null}).filter(e=>!!e).join(";")}function rD(e,t,r,n={meta:{},options:r,codeToHast:(t,r)=>rD(e,t,r),codeToTokens:(t,r)=>rL(e,t,r)}){let i=t;for(let e of rS(r))i=e.preprocess?.call(n,i,r)||i;let{tokens:s,fg:a,bg:o,themeName:l,rootStyle:c,grammarState:u}=rL(e,i,r),{mergeWhitespaces:d=!0,mergeSameStyleTokens:h=!1}=r;!0===d?s=s.map(e=>{let t,r=[],n="";return e.forEach((i,s)=>{let a=!(i.fontStyle&&(i.fontStyle&eI.Underline||i.fontStyle&eI.Strikethrough));a&&i.content.match(/^\s+$/)&&e[s+1]?(void 0===t&&(t=i.offset),n+=i.content):n?(a?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&&(s=s.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 s=[{...e,offset:e.offset+r.length,content:n}];return r&&s.unshift({content:r,offset:e.offset}),i&&s.push({content:i,offset:e.offset+r.length+n.length}),s}))),h&&(s=s.map(e=>{let t=[];for(let r of e){if(0===t.length){t.push({...r});continue}let e=t[t.length-1],n=rx(e.htmlStyle||ry(e)),i=rx(r.htmlStyle||ry(r)),s=e.fontStyle&&(e.fontStyle&eI.Underline||e.fontStyle&eI.Strikethrough),a=r.fontStyle&&(r.fontStyle&eI.Underline||r.fontStyle&eI.Strikethrough);s||a||n!==i?t.push({...r}):e.content+=r.content}return t}));let p={...n,get source(){return i}};for(let e of rS(r))s=e.tokens?.call(p,s)||s;return function(e,t,r,n=rw(e)){let i=rS(t),s=[],a={type:"root",children:[]},{structure:o="classic",tabindex:l="0"}=t,c={class:`shiki ${t.themeName||""}`};for(let[e,r]of(!1!==t.rootStyle&&(null!=t.rootStyle?c.style=t.rootStyle:c.style=`background-color:${t.bg};color:${t.fg}`),!1!==l&&null!=l&&(c.tabindex=l.toString()),Object.entries(t.meta||{})))e.startsWith("_")||(c[e]=r);let u={type:"element",tagName:"pre",properties:c,children:[],data:t.data},d={type:"element",tagName:"code",properties:{},children:s},h=[],p={...r,structure:o,addClassToHast:rp,get source(){return r.source},get tokens(){return e},get options(){return t},get root(){return a},get pre(){return u},get code(){return d},get lines(){return h}};if(e.forEach((e,t)=>{t&&("inline"===o?a.children.push({type:"element",tagName:"br",properties:{},children:[]}):"classic"===o&&s.push({type:"text",value:"\n"}));let r={type:"element",tagName:"span",properties:{class:"line"},children:[]},n=0;for(let s of e){let e={type:"element",tagName:"span",properties:{...s.htmlAttrs},children:[{type:"text",value:s.content}]},l=rx(s.htmlStyle||ry(s));for(let a of(l&&(e.properties.style=l),i))e=a?.span?.call(p,e,t+1,n,r,s)||e;"inline"===o?a.children.push(e):"classic"===o&&r.children.push(e),n+=s.content.length}if("classic"===o){for(let e of i)r=e?.line?.call(p,r,t+1)||r;h.push(r),s.push(r)}else"inline"===o&&h.push(r)}),"classic"===o){for(let e of i)d=e?.code?.call(p,d)||d;for(let e of(u.children.push(d),i))u=e?.pre?.call(p,u)||u;a.children.push(u)}else if("inline"===o){let e=[],t={type:"element",tagName:"span",properties:{class:"line"},children:[]};for(let r of a.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(p,r)||r;a.children=[];for(let e=0;e<r.children.length;e++){e>0&&a.children.push({type:"element",tagName:"br",properties:{},children:[]});let t=r.children[e];"element"===t.type&&a.children.push(...t.children)}}let m=a;for(let e of i)m=e?.root?.call(p,m)||m;return n&&rb(m,n),m}(s,{...r,fg:a,bg:o,themeName:l,rootStyle:!1!==r.rootStyle&&(r.rootStyle??c)},p,u)}let rO=function(e,t){let r=t||rr,n=r.quote||'"';if('"'!==n&&"'"!==n)throw Error("Invalid quote `"+n+"`, expected `'` or `\"`");return({one:rs,all:ra,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||tN.htmlVoidElements,characterReferences:r.characterReferences||rn,closeSelfClosing:r.closeSelfClosing||!1,closeEmptyElements:r.closeEmptyElements||!1},schema:"svg"===r.space?tA.svg:tA.html,quote:n,alternative:'"'===n?"'":'"'}).one(Array.isArray(e)?{type:"root",children:e}:e,void 0,void 0)},rB="__shiki_resolved";function rF(e){if(e?.[rB])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,s=new Map;function a(e){if(s.has(e))return s.get(e);i+=1;let r=`#${i.toString(16).padStart(8,"0").toLowerCase()}`;return t.colorReplacements?.[`#${r}`]?a(e):(s.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=a(e.settings.foreground);t.colorReplacements[r]=e.settings.foreground,i.settings.foreground=r}if(n){let r=a(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=a(t.colors[e]);t.colorReplacements[r]=t.colors[e],t.colors[e]=r}return Object.defineProperty(t,rB,{enumerable:!1,writable:!1,value:!0}),t}async function rz(e){return Array.from(new Set((await Promise.all(e.filter(e=>!rd(e)).map(async e=>await rc(e).then(e=>Array.isArray(e)?e:[e])))).flat()))}async function r$(e){return(await Promise.all(e.map(async e=>rh(e)?null:rF(await rc(e))))).filter(e=>!!e)}class rV extends Error{constructor(e){super(e),this.name="ShikiError"}}function rU(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 rV(`Circular alias \`${Array.from(r).join(" -> ")} -> ${e}\``);r.add(e)}}return e}class rW extends tj{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=rF(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=eP.createFromRawTheme(e),this._textmateThemeCache.set(e,t)),this._syncRegistry.setTheme(t)}getGrammar(e){return e=rU(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 rV(`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 rG{_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 rH=0;async function rq(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([r$(e.themes||[]),rz(e.langs||[]),e.engine]);return function(e){let t;rH+=1,!1!==e.warnings&&rH>=10&&rH%10==0&&console.warn(`[Shiki] ${rH} 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 rV("`engine` option is required for synchronous mode");let n=(e.langs||[]).flat(1),i=(e.themes||[]).flat(1).map(rF),s=new rW(new rG(e.engine,n),i,n,e.langAlias);function a(e){if("none"===e)return{bg:"",fg:"",name:"none",settings:[],type:"dark"};c();let t=s.getTheme(e);if(!t)throw new rV(`Theme \`${e}\` not found, you may need to load it first`);return t}function o(...e){c(),s.loadLanguages(e.flat(1))}function l(...e){for(let t of(c(),e.flat(1)))s.loadTheme(t)}function c(){if(r)throw new rV("Shiki instance has been disposed")}function u(){r||(r=!0,s.dispose(),rH-=1)}return{setTheme:function(e){c();let r=a(e);return t!==e&&(s.setTheme(r),t=e),{theme:r,colorMap:s.getColorMap()}},getTheme:a,getLanguage:function(e){c();let t=s.getGrammar("string"==typeof e?e:e.name);if(!t)throw new rV(`Language \`${e}\` not found, you may need to load it first`);return t},getLoadedThemes:function(){return c(),s.getLoadedThemes()},getLoadedLanguages:function(){return c(),s.getLoadedLanguages()},resolveLangAlias:function(t){return rU(t,e.langAlias)},loadLanguage:async function(...e){return o(await rz(e))},loadLanguageSync:o,loadTheme:async function(...e){return c(),l(await r$(e))},loadThemeSync:l,dispose:u,[Symbol.dispose]:u}}({...e,themes:t,langs:r,engine:n})}async function rK(e){let t=await rq(e);return{getLastGrammarState:(...e)=>(function(...e){if(2===e.length)return rw(e[1]);let[t,r,n={}]=e,{lang:i="text",theme:s=t.getLoadedThemes()[0]}=n;if(ru(i)||rh(s))throw new ek("Plain language does not have grammar state");if("ansi"===i)throw new ek("ANSI language does not have grammar state");let{theme:a,colorMap:o}=t.setTheme(s),l=t.getLanguage(i);return new rk(rP(r,l,a,o,n).stateStack,l.name,a.name)})(t,...e),codeToTokensBase:(e,r)=>rE(t,e,r),codeToTokensWithThemes:(e,r)=>rM(t,e,r),codeToTokens:(e,r)=>rL(t,e,r),codeToHast:(e,r)=>rD(t,e,r),codeToHtml:(e,r)=>(function(e,t,r){let n={meta:{},options:r,codeToHast:(t,r)=>rD(e,t,r),codeToTokens:(t,r)=>rL(e,t,r)},i=rO(rD(e,t,r,n));for(let e of rS(r))i=e.postprocess?.call(n,i,r)||i;return i})(t,e,r),getBundledLanguages:()=>({}),getBundledThemes:()=>({}),...t,getInternalContext:()=>t}}let rY=Object.fromEntries([{id:"andromeeda",displayName:"Andromeeda",type:"dark",import:()=>e.A(189508)},{id:"aurora-x",displayName:"Aurora X",type:"dark",import:()=>e.A(327553)},{id:"ayu-dark",displayName:"Ayu Dark",type:"dark",import:()=>e.A(759341)},{id:"catppuccin-frappe",displayName:"Catppuccin Frappé",type:"dark",import:()=>e.A(557366)},{id:"catppuccin-latte",displayName:"Catppuccin Latte",type:"light",import:()=>e.A(127572)},{id:"catppuccin-macchiato",displayName:"Catppuccin Macchiato",type:"dark",import:()=>e.A(398911)},{id:"catppuccin-mocha",displayName:"Catppuccin Mocha",type:"dark",import:()=>e.A(765061)},{id:"dark-plus",displayName:"Dark Plus",type:"dark",import:()=>e.A(814228)},{id:"dracula",displayName:"Dracula Theme",type:"dark",import:()=>e.A(374789)},{id:"dracula-soft",displayName:"Dracula Theme Soft",type:"dark",import:()=>e.A(675562)},{id:"everforest-dark",displayName:"Everforest Dark",type:"dark",import:()=>e.A(264696)},{id:"everforest-light",displayName:"Everforest Light",type:"light",import:()=>e.A(42530)},{id:"github-dark",displayName:"GitHub Dark",type:"dark",import:()=>e.A(427713)},{id:"github-dark-default",displayName:"GitHub Dark Default",type:"dark",import:()=>e.A(576963)},{id:"github-dark-dimmed",displayName:"GitHub Dark Dimmed",type:"dark",import:()=>e.A(329581)},{id:"github-dark-high-contrast",displayName:"GitHub Dark High Contrast",type:"dark",import:()=>e.A(195279)},{id:"github-light",displayName:"GitHub Light",type:"light",import:()=>e.A(516651)},{id:"github-light-default",displayName:"GitHub Light Default",type:"light",import:()=>e.A(689651)},{id:"github-light-high-contrast",displayName:"GitHub Light High Contrast",type:"light",import:()=>e.A(642036)},{id:"gruvbox-dark-hard",displayName:"Gruvbox Dark Hard",type:"dark",import:()=>e.A(840055)},{id:"gruvbox-dark-medium",displayName:"Gruvbox Dark Medium",type:"dark",import:()=>e.A(398687)},{id:"gruvbox-dark-soft",displayName:"Gruvbox Dark Soft",type:"dark",import:()=>e.A(18935)},{id:"gruvbox-light-hard",displayName:"Gruvbox Light Hard",type:"light",import:()=>e.A(52380)},{id:"gruvbox-light-medium",displayName:"Gruvbox Light Medium",type:"light",import:()=>e.A(24410)},{id:"gruvbox-light-soft",displayName:"Gruvbox Light Soft",type:"light",import:()=>e.A(795210)},{id:"houston",displayName:"Houston",type:"dark",import:()=>e.A(695303)},{id:"kanagawa-dragon",displayName:"Kanagawa Dragon",type:"dark",import:()=>e.A(686210)},{id:"kanagawa-lotus",displayName:"Kanagawa Lotus",type:"light",import:()=>e.A(847729)},{id:"kanagawa-wave",displayName:"Kanagawa Wave",type:"dark",import:()=>e.A(233589)},{id:"laserwave",displayName:"LaserWave",type:"dark",import:()=>e.A(951946)},{id:"light-plus",displayName:"Light Plus",type:"light",import:()=>e.A(279775)},{id:"material-theme",displayName:"Material Theme",type:"dark",import:()=>e.A(593928)},{id:"material-theme-darker",displayName:"Material Theme Darker",type:"dark",import:()=>e.A(198658)},{id:"material-theme-lighter",displayName:"Material Theme Lighter",type:"light",import:()=>e.A(270659)},{id:"material-theme-ocean",displayName:"Material Theme Ocean",type:"dark",import:()=>e.A(320719)},{id:"material-theme-palenight",displayName:"Material Theme Palenight",type:"dark",import:()=>e.A(525766)},{id:"min-dark",displayName:"Min Dark",type:"dark",import:()=>e.A(610344)},{id:"min-light",displayName:"Min Light",type:"light",import:()=>e.A(100684)},{id:"monokai",displayName:"Monokai",type:"dark",import:()=>e.A(291123)},{id:"night-owl",displayName:"Night Owl",type:"dark",import:()=>e.A(198410)},{id:"nord",displayName:"Nord",type:"dark",import:()=>e.A(785810)},{id:"one-dark-pro",displayName:"One Dark Pro",type:"dark",import:()=>e.A(350612)},{id:"one-light",displayName:"One Light",type:"light",import:()=>e.A(492494)},{id:"plastic",displayName:"Plastic",type:"dark",import:()=>e.A(59650)},{id:"poimandres",displayName:"Poimandres",type:"dark",import:()=>e.A(533273)},{id:"red",displayName:"Red",type:"dark",import:()=>e.A(473810)},{id:"rose-pine",displayName:"Rosé Pine",type:"dark",import:()=>e.A(486978)},{id:"rose-pine-dawn",displayName:"Rosé Pine Dawn",type:"light",import:()=>e.A(371553)},{id:"rose-pine-moon",displayName:"Rosé Pine Moon",type:"dark",import:()=>e.A(297035)},{id:"slack-dark",displayName:"Slack Dark",type:"dark",import:()=>e.A(747632)},{id:"slack-ochin",displayName:"Slack Ochin",type:"light",import:()=>e.A(93215)},{id:"snazzy-light",displayName:"Snazzy Light",type:"light",import:()=>e.A(612986)},{id:"solarized-dark",displayName:"Solarized Dark",type:"dark",import:()=>e.A(255674)},{id:"solarized-light",displayName:"Solarized Light",type:"light",import:()=>e.A(731013)},{id:"synthwave-84",displayName:"Synthwave '84",type:"dark",import:()=>e.A(94801)},{id:"tokyo-night",displayName:"Tokyo Night",type:"dark",import:()=>e.A(457836)},{id:"vesper",displayName:"Vesper",type:"dark",import:()=>e.A(13877)},{id:"vitesse-black",displayName:"Vitesse Black",type:"dark",import:()=>e.A(448048)},{id:"vitesse-dark",displayName:"Vitesse Dark",type:"dark",import:()=>e.A(639922)},{id:"vitesse-light",displayName:"Vitesse Light",type:"light",import:()=>e.A(595345)}].map(e=>[e.id,e.import]));var rX=e.i(520683);class rJ extends Error{constructor(e){super(e),this.name="ShikiError"}}function rZ(){return"u">typeof performance?performance.now():Date.now()}let rQ=(e,t)=>e+(t-e%t)%t;async function r0(e){let t,r,n={};function i(e){r=e,n.HEAPU8=new Uint8Array(e),n.HEAPU32=new Uint32Array(e)}let s="u">typeof TextDecoder?new TextDecoder("utf8"):void 0;function a(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&&s)return s.decode(e.subarray(t,i));let a="";for(;t<i;){let r=e[t++];if(!(128&r)){a+=String.fromCharCode(r);continue}let n=63&e[t++];if((224&r)==192){a+=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)a+=String.fromCharCode(r);else{let e=r-65536;a+=String.fromCharCode(55296|e>>10,56320|1023&e)}}return a}(n.HEAPU8,e,t):""}let o={emscripten_get_now:rZ,emscripten_memcpy_big:function(e,t,r){n.HEAPU8.copyWithin(e,t,t+r)},emscripten_resize_heap:function(e){let s=n.HEAPU8.length;if((e>>>=0)>0x80000000)return!1;for(let n=1;n<=4;n*=2){let a=s*(1+.2/n);if(a=Math.min(a,e+0x6000000),function(e){try{return t.grow(e-r.byteLength+65535>>>16),i(t.buffer),1}catch{}}(Math.min(0x80000000,rQ(Math.max(e,a),65536))))return!0}return!1},fd_write:()=>0};async function l(){let r=await e({env:o,wasi_snapshot_preview1:o});i((t=r.memory).buffer),Object.assign(n,r),n.UTF8ToString=a}return await l(),n}var r1=Object.defineProperty,r2=(e,t,r)=>{let n;return(n="symbol"!=typeof t?t+"":t)in e?r1(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r};let r5=null;class r3{constructor(e){r2(this,"utf16Length"),r2(this,"utf8Length"),r2(this,"utf16Value"),r2(this,"utf8Value"),r2(this,"utf16OffsetToUtf8"),r2(this,"utf8OffsetToUtf16");const t=e.length,r=r3._utf8ByteLength(e),n=r!==t,i=n?new Uint32Array(t+1):null;n&&(i[t]=r);const s=n?new Uint32Array(r+1):null;n&&(s[r]=t);const a=new Uint8Array(r);let o=0;for(let r=0;r<t;r++){const l=e.charCodeAt(r);let c=l,u=!1;if(l>=55296&&l<=56319&&r+1<t){const t=e.charCodeAt(r+1);t>=56320&&t<=57343&&(c=(l-55296<<10)+65536|t-56320,u=!0)}n&&(i[r]=o,u&&(i[r+1]=o),c<=127?s[o+0]=r:c<=2047?(s[o+0]=r,s[o+1]=r):c<=65535?(s[o+0]=r,s[o+1]=r,s[o+2]=r):(s[o+0]=r,s[o+1]=r,s[o+2]=r,s[o+3]=r)),c<=127?a[o++]=c:(c<=2047?a[o++]=192|(1984&c)>>>6:(c<=65535?a[o++]=224|(61440&c)>>>12:(a[o++]=240|(1835008&c)>>>18,a[o++]=128|(258048&c)>>>12),a[o++]=128|(4032&c)>>>6),a[o++]=128|(63&c)>>>0),u&&r++}this.utf16Length=t,this.utf8Length=r,this.utf16Value=e,this.utf8Value=a,this.utf16OffsetToUtf8=i,this.utf8OffsetToUtf16=s}static _utf8ByteLength(e){let t=0;for(let r=0,n=e.length;r<n;r++){let i=e.charCodeAt(r),s=i,a=!1;if(i>=55296&&i<=56319&&r+1<n){let t=e.charCodeAt(r+1);t>=56320&&t<=57343&&(s=(i-55296<<10)+65536|t-56320,a=!0)}s<=127?t+=1:s<=2047?t+=2:s<=65535?t+=3:t+=4,a&&r++}return t}createString(e){let t=e.omalloc(this.utf8Length);return e.HEAPU8.set(this.utf8Value,t),t}}let r6=class e{constructor(t){if(r2(this,"id",++e.LAST_ID),r2(this,"_onigBinding"),r2(this,"content"),r2(this,"utf16Length"),r2(this,"utf8Length"),r2(this,"utf16OffsetToUtf8"),r2(this,"utf8OffsetToUtf16"),r2(this,"ptr"),!r5)throw new rJ("Must invoke loadWasm first.");this._onigBinding=r5,this.content=t;const r=new r3(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=r5.omalloc(1e4)),e._sharedPtrInUse=!0,r5.HEAPU8.set(r.utf8Value,e._sharedPtr),this.ptr=e._sharedPtr):this.ptr=r.createString(r5)}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)}};r2(r6,"LAST_ID",0),r2(r6,"_sharedPtr",0),r2(r6,"_sharedPtrInUse",!1);class r4{constructor(e){if(r2(this,"_onigBinding"),r2(this,"_ptr"),!r5)throw new rJ("Must invoke loadWasm first.");const t=[],r=[];for(let n=0,i=e.length;n<i;n++){const i=new r3(e[n]);t[n]=i.createString(r5),r[n]=i.utf8Length}const n=r5.omalloc(4*e.length);r5.HEAPU32.set(t,n/4);const i=r5.omalloc(4*e.length);r5.HEAPU32.set(r,i/4);const s=r5.createOnigScanner(n,i,e.length);for(let r=0,n=e.length;r<n;r++)r5.ofree(t[r]);r5.ofree(i),r5.ofree(n),0===s&&function(e){throw new rJ(e.UTF8ToString(e.getLastOnigError()))}(r5),this._onigBinding=r5,this._ptr=s}dispose(){this._onigBinding.freeOnigScanner(this._ptr)}findNextMatchSync(e,t,r){let n=0;if("number"==typeof r&&(n=r),"string"==typeof e){e=new r6(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,s=i.findNextOnigScannerMatch(this._ptr,e.id,e.ptr,e.utf8Length,e.convertUtf16OffsetToUtf8(t),n);if(0===s)return null;let a=i.HEAPU32,o=s/4,l=a[o++],c=a[o++],u=[];for(let t=0;t<c;t++){let r=e.convertUtf8OffsetToUtf16(a[o++]),n=e.convertUtf8OffsetToUtf16(a[o++]);u[t]={start:r,end:n,length:n-r}}return{index:l,captureIndices:u}}}function r8(e){return t=>WebAssembly.instantiate(e,t)}async function r9(e){return e&&await (r||(r=async function(){r5=await r0(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,s,a;if(void 0!==r.data&&(r=r.data),n=r,"u">typeof Response&&n instanceof Response){r="function"==typeof WebAssembly.instantiateStreaming?await (s=r,e=>WebAssembly.instantiateStreaming(s,e))(t):await (a=r,async e=>{let t=await a.arrayBuffer();return WebAssembly.instantiate(t,e)})(t)}else(i=r,"u">typeof ArrayBuffer&&(i instanceof ArrayBuffer||ArrayBuffer.isView(i))||void 0!==rX.Buffer&&rX.Buffer.isBuffer?.(i)||"u">typeof SharedArrayBuffer&&i instanceof SharedArrayBuffer||"u">typeof Uint32Array&&i instanceof Uint32Array||r instanceof WebAssembly.Module)?r=await r8(r)(t):"default"in r&&r.default instanceof WebAssembly.Module&&(r=await r8(r.default)(t))}return"instance"in r&&(r=r.instance),"exports"in r&&(r=r.exports),r})}())),{createScanner:e=>new r4(e.map(e=>"string"==typeof e?e:e.source)),createString:e=>new r6(e)}}let r7=(o=(f={langs:ew,themes:rY,engine:()=>r9(e.A(259500))}).langs,l=f.themes,c=f.engine,async function(e){function t(t){if("string"==typeof t){if(rd(t=e.langAlias?.[t]||t))return[];let r=o[t];if(!r)throw new ek(`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(rh(e))return"none";if("string"==typeof e){let t=l[e];if(!t)throw new ek(`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)),s=await rK({engine:e.engine??c(),...e,themes:n,langs:i});return{...s,loadLanguage:(...e)=>s.loadLanguage(...e.map(t)),loadTheme:(...e)=>s.loadTheme(...e.map(r)),getBundledLanguages:()=>o,getBundledThemes:()=>l}});var ne=new Set(Object.keys(ew)),nt=new Map,nr=new Map,nn=new Map,ni=function(e={}){var t;let r=null!=(t=e.themes)?t:["github-light","github-dark"];return{name:"shiki",type:"code-highlighter",supportsLanguage:e=>ne.has(e),getSupportedLanguages:()=>Array.from(ne),getThemes:()=>r,highlight({code:e,language:t,themes:r},n){let i,s,a=(i=e.slice(0,100),s=e.length>100?e.slice(-100):"",`${t}:${r[0]}:${r[1]}:${e.length}:${i}:${s}`);return nr.has(a)?nr.get(a):(n&&(nn.has(a)||nn.set(a,new Set),nn.get(a).add(n)),((e,t)=>{let r=`${e}-${t[0]}-${t[1]}`;if(nt.has(r))return nt.get(r);let n=r7({themes:t,langs:[e]});return nt.set(r,n),n})(t,r).then(n=>{let i=n.getLoadedLanguages().includes(t)?t:"text",s=n.codeToTokens(e,{lang:i,themes:{light:r[0],dark:r[1]}});nr.set(a,s);let o=nn.get(a);if(o){for(let e of o)e(s);nn.delete(a)}}).catch(e=>{console.error("[Streamdown Code] Failed to highlight code:",e),nn.delete(a)}),null)}}}(),ns=e.i(501201),na=e.i(178747);function no(e,t){let r=function(e,t){switch(e.nodeType){case 1:return function(e,t){let r=e.namespaceURI,n=r===na.webNamespaces.svg?ns.s:ns.h,i=r===na.webNamespaces.html?e.tagName.toLowerCase():e.tagName,s=r===na.webNamespaces.html&&"template"===i?e.content:e,a=e.getAttributeNames(),o={},l=-1;for(;++l<a.length;)o[a[l]]=e.getAttribute(a[l])||"";return n(i,o,nl(s,t))}(e,t);case 3:return{type:"text",value:e.nodeValue||""};case 8:return{type:"comment",value:e.nodeValue||""};case 9:case 11:return function(e,t){return{type:"root",children:nl(e,t)}}(e,t);case 10:return{type:"doctype"};default:return}}(e,t);return r&&t.afterTransform&&t.afterTransform(e,r),r}function nl(e,t){let r=e.childNodes,n=[],i=-1;for(;++i<r.length;){let e=no(r[i],t);void 0!==e&&n.push(e)}return n}let nc=new DOMParser;var nu=e.i(336200);let nd=function(e,t,r){let n=(0,nu.convert)(r);if(!e||!e.type||!e.children)throw Error("Expected parent node");if("number"==typeof t){if(t<0||t===1/0)throw Error("Expected positive finite number as index")}else if((t=e.children.indexOf(t))<0)throw Error("Expected child node or index");for(;++t<e.children.length;)if(n(e.children[t],t,e))return e.children[t]},nh=function(e){if(null==e)return nm;if("string"==typeof e){var t;return t=e,np(function(e){return e.tagName===t})}if("object"==typeof e){var r=e;let t=[],n=-1;for(;++n<r.length;)t[n]=nh(r[n]);return np(function(...e){let r=-1;for(;++r<t.length;)if(t[r].apply(this,e))return!0;return!1})}if("function"==typeof e)return np(e);throw Error("Expected function, string, or array as `test`")};function np(e){return function(t,r,n){var i;return!!(null!==(i=t)&&"object"==typeof i&&"type"in i&&"tagName"in i&&e.call(this,t,"number"==typeof r?r:void 0,n||void 0))}}function nm(e){return!!(e&&"object"==typeof e&&"type"in e&&"element"===e.type&&"tagName"in e&&"string"==typeof e.tagName)}let nf=/\n/g,ng=/[\t ]+/g,ny=nh("br"),nx=nh(function(e){return"td"===e.tagName||"th"===e.tagName}),nv=nh("p"),nb=nh("tr"),nw=nh(["datalist","head","noembed","noframes","noscript","rp","script","style","template","title",function(e){return!!(e.properties||{}).hidden},function(e){return"dialog"===e.tagName&&!(e.properties||{}).open}]),nk=nh(["address","article","aside","blockquote","body","caption","center","dd","dialog","dir","dl","dt","div","figure","figcaption","footer","form,","h1","h2","h3","h4","h5","h6","header","hgroup","hr","html","legend","li","listing","main","menu","nav","ol","p","plaintext","pre","section","ul","xmp"]);function nj(e,t){let r,n=String(e.value),i=[],s=[],a=0;for(;a<=n.length;){nf.lastIndex=a;let e=nf.exec(n),r=e&&"index"in e?e.index:n.length;i.push(function(e,t,r){let n,i=[],s=0;for(;s<e.length;){ng.lastIndex=s;let r=ng.exec(e);n=r?r.index:e.length,s||n||!r||t||i.push(""),s!==n&&i.push(e.slice(s,n)),s=r?n+r[0].length:n}return s===n||r||i.push(""),i.join(" ")}(n.slice(a,r).replace(/[\u061C\u200E\u200F\u202A-\u202E\u2066-\u2069]/g,""),0!==a||t.breakBefore,r!==n.length||t.breakAfter)),a=r+1}let o=-1;for(;++o<i.length;)8203===i[o].charCodeAt(i[o].length-1)||o<i.length-1&&8203===i[o+1].charCodeAt(0)?(s.push(i[o]),r=void 0):i[o]?("number"==typeof r&&s.push(r),s.push(i[o]),r=0):(0===o||o===i.length-1)&&s.push(0);return s}function nS(e,t){if("element"===e.type){let r=e.properties||{};switch(e.tagName){case"listing":case"plaintext":case"xmp":return"pre";case"nobr":return"nowrap";case"pre":return r.wrap?"pre-wrap":"pre";case"td":case"th":return r.noWrap?"nowrap":t.whitespace;case"textarea":return"pre-wrap"}}return t.whitespace}var nN=e.i(751692),nA=e.i(687685);let nC={},n_=[];function nT(e){let t=e||nC;return function(e,r){(0,nA.visitParents)(e,"element",function(e,n){let i,s=Array.isArray(e.properties.className)?e.properties.className:n_,a=s.includes("language-math"),o=s.includes("math-display"),l=s.includes("math-inline"),c=o;if(!a&&!o&&!l)return;let u=n[n.length-1],d=e;if("code"===e.tagName&&a&&u&&"element"===u.type&&"pre"===u.tagName&&(d=u,u=n[n.length-2],c=!0),!u)return;let h=function(e,t){let r,n="children"in e?e.children:[],i=nk(e),s=nS(e,{whitespace:(t||{}).whitespace||"normal",breakBefore:!1,breakAfter:!1}),a=[];("text"===e.type||"comment"===e.type)&&a.push(...nj(e,{whitespace:s,breakBefore:!0,breakAfter:!0}));let o=-1;for(;++o<n.length;)a.push(...function e(t,r,n){return"element"===t.type?function(t,r,n){let i,s,a=nS(t,n),o=t.children||[],l=-1,c=[];if(nw(t))return c;for(ny(t)||nb(t)&&nd(r,t,nb)?s="\n":nv(t)?(i=2,s=2):nk(t)&&(i=1,s=1);++l<o.length;)c=c.concat(e(o[l],t,{whitespace:a,breakBefore:l?void 0:i,breakAfter:l<o.length-1?ny(o[l+1]):s}));return nx(t)&&nd(r,t,nx)&&c.push(" "),i&&c.unshift(i),s&&c.push(s),c}(t,r,n):"text"===t.type?"normal"===n.whitespace?nj(t,n):[String(t.value)]:[]}(n[o],e,{whitespace:s,breakBefore:o?void 0:i,breakAfter:o<n.length-1?ny(n[o+1]):i}));let l=[];for(o=-1;++o<a.length;){let e=a[o];"number"==typeof e?void 0!==r&&e>r&&(r=e):e&&(void 0!==r&&r>-1&&l.push("\n".repeat(r)||" "),r=-1,l.push(e))}return l.join("")}(d,{whitespace:"pre"});try{i=nN.default.renderToString(h,{...t,displayMode:c,throwOnError:!0})}catch(a){let s=a.name.toLowerCase();r.message("Could not render math with KaTeX",{ancestors:[...n,e],cause:a,place:e.position,ruleId:s,source:"rehype-katex"});try{i=nN.default.renderToString(h,{...t,displayMode:c,strict:"ignore",throwOnError:!1})}catch{i=[{type:"element",tagName:"span",properties:{className:["katex-error"],style:"color:"+(t.errorColor||"#cc0000"),title:String(a)},children:[{type:"text",value:h}]}]}}if("string"==typeof i){var p,m,f;let e;i=(p=i,m={fragment:!0},no(m?.fragment?(f=p,(e=document.createElement("template")).innerHTML=f,e.content):nc.parseFromString(p,"text/html"),{})||{type:"root",children:[]}).children}let g=u.children.indexOf(d);return u.children.splice(g,1,...i),nA.SKIP})}}var nE=e.i(529008),nP=e.i(854732);let nR={tokenize:function(e,t,r){let n=this,i=n.events[n.events.length-1],s=i&&"linePrefix"===i[1].type?i[2].sliceSerialize(i[1],!0).length:0,a=0;return function(t){return e.enter("mathFlow"),e.enter("mathFlowFence"),e.enter("mathFlowFenceSequence"),function t(n){return 36===n?(e.consume(n),a++,t):a<2?r(n):(e.exit("mathFlowFenceSequence"),(0,nP.factorySpace)(e,o,"whitespace")(n))}(t)};function o(t){return null===t||(0,q.markdownLineEnding)(t)?l(t):(e.enter("mathFlowFenceMeta"),e.enter("chunkString",{contentType:"string"}),function t(n){return null===n||(0,q.markdownLineEnding)(n)?(e.exit("chunkString"),e.exit("mathFlowFenceMeta"),l(n)):36===n?r(n):(e.consume(n),t)}(t))}function l(r){return(e.exit("mathFlowFence"),n.interrupt)?t(r):e.attempt(nM,c,h)(r)}function c(t){return e.attempt({tokenize:p,partial:!0},h,u)(t)}function u(t){return(s?(0,nP.factorySpace)(e,d,"linePrefix",s+1):d)(t)}function d(t){return null===t?h(t):(0,q.markdownLineEnding)(t)?e.attempt(nM,c,h)(t):(e.enter("mathFlowValue"),function t(r){return null===r||(0,q.markdownLineEnding)(r)?(e.exit("mathFlowValue"),d(r)):(e.consume(r),t)}(t))}function h(r){return e.exit("mathFlow"),t(r)}function p(e,t,r){let i=0;return(0,nP.factorySpace)(e,function(t){return e.enter("mathFlowFence"),e.enter("mathFlowFenceSequence"),function t(n){return 36===n?(i++,e.consume(n),t):i<a?r(n):(e.exit("mathFlowFenceSequence"),(0,nP.factorySpace)(e,s,"whitespace")(n))}(t)},"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4);function s(n){return null===n||(0,q.markdownLineEnding)(n)?(e.exit("mathFlowFence"),t(n)):r(n)}}},concrete:!0,name:"mathFlow"},nM={tokenize:function(e,t,r){let n=this;return function(r){return null===r?t(r):(e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),i)};function i(e){return n.parser.lazy[n.now().line]?r(e):t(e)}},partial:!0};function nL(e){let t,r,n=e.length-4,i=3;if(("lineEnding"===e[3][1].type||"space"===e[i][1].type)&&("lineEnding"===e[n][1].type||"space"===e[n][1].type)){for(t=i;++t<n;)if("mathTextData"===e[t][1].type){e[n][1].type="mathTextPadding",e[i][1].type="mathTextPadding",i+=2,n-=2;break}}for(t=i-1,n++;++t<=n;)void 0===r?t!==n&&"lineEnding"!==e[t][1].type&&(r=t):(t===n||"lineEnding"===e[t][1].type)&&(e[r][1].type="mathTextData",t!==r+2&&(e[r][1].end=e[t-1][1].end,e.splice(r+2,t-r-2),n-=t-r-2,t=r+2),r=void 0);return e}function nI(e){return 36!==e||"characterEscape"===this.events[this.events.length-1][1].type}let nD={};function nO(e){let t,r=e||nD,n=this.data(),i=n.micromarkExtensions||(n.micromarkExtensions=[]),s=n.fromMarkdownExtensions||(n.fromMarkdownExtensions=[]),a=n.toMarkdownExtensions||(n.toMarkdownExtensions=[]);i.push({flow:{36:nR},text:{36:(null==(t=(r||{}).singleDollarTextMath)&&(t=!0),{tokenize:function(e,r,n){let i,s,a=0;return function(r){return e.enter("mathText"),e.enter("mathTextSequence"),function r(i){return 36===i?(e.consume(i),a++,r):a<2&&!t?n(i):(e.exit("mathTextSequence"),o(i))}(r)};function o(t){return null===t?n(t):36===t?(s=e.enter("mathTextSequence"),i=0,function t(n){return 36===n?(e.consume(n),i++,t):i===a?(e.exit("mathTextSequence"),e.exit("mathText"),r(n)):(s.type="mathTextData",l(n))}(t)):32===t?(e.enter("space"),e.consume(t),e.exit("space"),o):(0,q.markdownLineEnding)(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),o):(e.enter("mathTextData"),l(t))}function l(t){return null===t||32===t||36===t||(0,q.markdownLineEnding)(t)?(e.exit("mathTextData"),o(t)):(e.consume(t),l)}},resolve:nL,previous:nI,name:"mathText"})}}),s.push(function(){return{enter:{mathFlow:function(e){this.enter({type:"math",meta:null,value:"",data:{hName:"pre",hChildren:[{type:"element",tagName:"code",properties:{className:["language-math","math-display"]},children:[]}]}},e)},mathFlowFenceMeta:function(){this.buffer()},mathText:function(e){this.enter({type:"inlineMath",value:"",data:{hName:"code",hProperties:{className:["language-math","math-inline"]},hChildren:[]}},e),this.buffer()}},exit:{mathFlow:function(e){let t=this.resume().replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),r=this.stack[this.stack.length-1];(0,H.ok)("math"===r.type),this.exit(e),r.value=t;let n=r.data.hChildren[0];(0,H.ok)("element"===n.type),(0,H.ok)("code"===n.tagName),n.children.push({type:"text",value:t}),this.data.mathFlowInside=void 0},mathFlowFence:function(){this.data.mathFlowInside||(this.buffer(),this.data.mathFlowInside=!0)},mathFlowFenceMeta:function(){let e=this.resume(),t=this.stack[this.stack.length-1];(0,H.ok)("math"===t.type),t.meta=e},mathFlowValue:e,mathText:function(e){let t=this.resume(),r=this.stack[this.stack.length-1];(0,H.ok)("inlineMath"===r.type),this.exit(e),r.value=t,r.data.hChildren.push({type:"text",value:t})},mathTextData:e}};function e(e){this.config.enter.data.call(this,e),this.config.exit.data.call(this,e)}}()),a.push(function(e){let t=(e||{}).singleDollarTextMath;return null==t&&(t=!0),r.peek=function(){return"$"},{unsafe:[{character:"\r",inConstruct:"mathFlowMeta"},{character:"\n",inConstruct:"mathFlowMeta"},{character:"$",after:t?void 0:"\\$",inConstruct:"phrasing"},{character:"$",inConstruct:"mathFlowMeta"},{atBreak:!0,character:"$",after:"\\$"}],handlers:{math:function(e,t,r,n){let i=e.value||"",s=r.createTracker(n),a="$".repeat(Math.max((0,nE.longestStreak)(i,"$")+1,2)),o=r.enter("mathFlow"),l=s.move(a);if(e.meta){let t=r.enter("mathFlowMeta");l+=s.move(r.safe(e.meta,{after:"\n",before:l,encode:["$"],...s.current()})),t()}return l+=s.move("\n"),i&&(l+=s.move(i+"\n")),l+=s.move(a),o(),l},inlineMath:r}};function r(e,r,n){let i=e.value||"",s=1;for(!t&&s++;RegExp("(^|[^$])"+"\\$".repeat(s)+"([^$]|$)").test(i);)s++;let a="$".repeat(s);/[^ \r\n]/.test(i)&&(/^[ \r\n]/.test(i)&&/[ \r\n]$/.test(i)||/^\$|\$$/.test(i))&&(i=" "+i+" ");let o=-1;for(;++o<n.unsafe.length;){let e,t=n.unsafe[o];if(!t.atBreak)continue;let r=n.compilePattern(t);for(;e=r.exec(i);){let t=e.index;10===i.codePointAt(t)&&13===i.codePointAt(t-1)&&t--,i=i.slice(0,t)+" "+i.slice(e.index+1)}}return a+i+a}}(r))}var nB=function(e={}){var t,r;return{name:"katex",type:"math",remarkPlugin:[nO,{singleDollarTextMath:null!=(t=e.singleDollarTextMath)&&t}],rehypePlugin:[nT,{errorColor:null!=(r=e.errorColor)?r:"var(--color-muted-foreground)"}],getStyles:()=>"katex/dist/katex.min.css"}}(),nF=e.i(356212),nz=e.i(687734),n$=e.i(856012),nV=e.i(364601);e.i(628511),e.i(537981),e.i(17415),e.i(661981),e.i(916048);var nU=e.i(284421),nW=e.i(97482),nG=e.i(209026),nH=e.i(460753),nq=e.i(116288);e.i(492314);var nK=e.i(59955),nY="comm",nX="rule",nJ="decl",nZ=Math.abs,nQ=String.fromCharCode;function n0(e,t,r){return e.replace(t,r)}function n1(e,t){return 0|e.charCodeAt(t)}function n2(e,t,r){return e.slice(t,r)}function n5(e){return e.length}function n3(e,t){return t.push(e),e}var n6=1,n4=1,n8=0,n9=0,n7=0,ie="";function it(e,t,r,n,i,s,a,o){return{value:e,root:t,parent:r,type:n,props:i,children:s,line:n6,column:n4,length:a,return:"",siblings:o}}function ir(){return n7=n9<n8?n1(ie,n9++):0,n4++,10===n7&&(n4=1,n6++),n7}function ii(){return n1(ie,n9)}function is(e){switch(e){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function ia(e){var t,r;return(t=n9-1,r=function e(t){for(;ir();)switch(n7){case t:return n9;case 34:case 39:34!==t&&39!==t&&e(n7);break;case 40:41===t&&e(t);break;case 92:ir()}return n9}(91===e?e+2:40===e?e+1:e),n2(ie,t,r)).trim()}function io(e,t,r,n,i,s,a,o,l,c,u,d){for(var h=i-1,p=0===i?s:[""],m=p.length,f=0,g=0,y=0;f<n;++f)for(var x=0,v=n2(e,h+1,h=nZ(g=a[f])),b=e;x<m;++x)(b=(g>0?p[x]+" "+v:n0(v,/&\f/g,p[x])).trim())&&(l[y++]=b);return it(e,t,r,0===i?nX:o,l,c,u,d)}function il(e,t,r,n,i){return it(e,t,r,nJ,n2(e,0,n),n2(e,n+1,-1),n,i)}function ic(e,t){for(var r="",n=0;n<e.length;n++)r+=t(e[n],n,e,t)||"";return r}function iu(e,t,r,n){switch(e.type){case"@layer":if(e.children.length)break;case"@import":case"@namespace":case nJ:return e.return=e.return||e.value;case nY:return"";case"@keyframes":return e.return=e.value+"{"+ic(e.children,n)+"}";case nX:if(!n5(e.value=e.props.join(",")))return""}return n5(r=ic(e.children,n))?e.return=e.value+"{"+r+"}":""}var id=e.i(190002),ih=e.i(473063),ip={id:"c4",detector:(0,nH.__name)(e=>/^\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/.test(e),"detector"),loader:(0,nH.__name)(async()=>{let{diagram:t}=await e.A(533915);return{id:"c4",diagram:t}},"loader")},im="flowchart",ig=(0,nH.__name)((e,t)=>t?.flowchart?.defaultRenderer!=="dagre-wrapper"&&t?.flowchart?.defaultRenderer!=="elk"&&/^\s*graph/.test(e),"detector"),iy=(0,nH.__name)(async()=>{let{diagram:t}=await e.A(956761);return{id:im,diagram:t}},"loader"),ix={id:im,detector:ig,loader:iy},iv="flowchart-v2",ib=(0,nH.__name)((e,t)=>t?.flowchart?.defaultRenderer!=="dagre-d3"&&(t?.flowchart?.defaultRenderer==="elk"&&(t.layout="elk"),!!/^\s*graph/.test(e)&&t?.flowchart?.defaultRenderer==="dagre-wrapper"||/^\s*flowchart/.test(e)),"detector"),iw=(0,nH.__name)(async()=>{let{diagram:t}=await e.A(956761);return{id:iv,diagram:t}},"loader"),ik={id:iv,detector:ib,loader:iw},ij={id:"er",detector:(0,nH.__name)(e=>/^\s*erDiagram/.test(e),"detector"),loader:(0,nH.__name)(async()=>{let{diagram:t}=await e.A(943185);return{id:"er",diagram:t}},"loader")},iS="gitGraph",iN=(0,nH.__name)(e=>/^\s*gitGraph/.test(e),"detector"),iA=(0,nH.__name)(async()=>{let{diagram:t}=await e.A(388129);return{id:iS,diagram:t}},"loader"),iC={id:iS,detector:iN,loader:iA},i_="gantt",iT=(0,nH.__name)(e=>/^\s*gantt/.test(e),"detector"),iE=(0,nH.__name)(async()=>{let{diagram:t}=await e.A(941076);return{id:i_,diagram:t}},"loader"),iP={id:i_,detector:iT,loader:iE},iR="info",iM=(0,nH.__name)(e=>/^\s*info/.test(e),"detector"),iL=(0,nH.__name)(async()=>{let{diagram:t}=await e.A(781187);return{id:iR,diagram:t}},"loader"),iI={id:iR,detector:iM,loader:iL},iD={id:"pie",detector:(0,nH.__name)(e=>/^\s*pie/.test(e),"detector"),loader:(0,nH.__name)(async()=>{let{diagram:t}=await e.A(459696);return{id:"pie",diagram:t}},"loader")},iO="quadrantChart",iB=(0,nH.__name)(e=>/^\s*quadrantChart/.test(e),"detector"),iF=(0,nH.__name)(async()=>{let{diagram:t}=await e.A(348039);return{id:iO,diagram:t}},"loader"),iz={id:iO,detector:iB,loader:iF},i$="xychart",iV=(0,nH.__name)(e=>/^\s*xychart(-beta)?/.test(e),"detector"),iU=(0,nH.__name)(async()=>{let{diagram:t}=await e.A(110104);return{id:i$,diagram:t}},"loader"),iW={id:i$,detector:iV,loader:iU},iG="requirement",iH=(0,nH.__name)(e=>/^\s*requirement(Diagram)?/.test(e),"detector"),iq=(0,nH.__name)(async()=>{let{diagram:t}=await e.A(666358);return{id:iG,diagram:t}},"loader"),iK={id:iG,detector:iH,loader:iq},iY="sequence",iX=(0,nH.__name)(e=>/^\s*sequenceDiagram/.test(e),"detector"),iJ=(0,nH.__name)(async()=>{let{diagram:t}=await e.A(966453);return{id:iY,diagram:t}},"loader"),iZ={id:iY,detector:iX,loader:iJ},iQ="class",i0=(0,nH.__name)((e,t)=>t?.class?.defaultRenderer!=="dagre-wrapper"&&/^\s*classDiagram/.test(e),"detector"),i1=(0,nH.__name)(async()=>{let{diagram:t}=await e.A(723358);return{id:iQ,diagram:t}},"loader"),i2={id:iQ,detector:i0,loader:i1},i5="classDiagram",i3=(0,nH.__name)((e,t)=>!!/^\s*classDiagram/.test(e)&&t?.class?.defaultRenderer==="dagre-wrapper"||/^\s*classDiagram-v2/.test(e),"detector"),i6=(0,nH.__name)(async()=>{let{diagram:t}=await e.A(873682);return{id:i5,diagram:t}},"loader"),i4={id:i5,detector:i3,loader:i6},i8="state",i9=(0,nH.__name)((e,t)=>t?.state?.defaultRenderer!=="dagre-wrapper"&&/^\s*stateDiagram/.test(e),"detector"),i7=(0,nH.__name)(async()=>{let{diagram:t}=await e.A(334989);return{id:i8,diagram:t}},"loader"),se={id:i8,detector:i9,loader:i7},st="stateDiagram",sr=(0,nH.__name)((e,t)=>!!(/^\s*stateDiagram-v2/.test(e)||/^\s*stateDiagram/.test(e)&&t?.state?.defaultRenderer==="dagre-wrapper"),"detector"),sn=(0,nH.__name)(async()=>{let{diagram:t}=await e.A(740095);return{id:st,diagram:t}},"loader"),si={id:st,detector:sr,loader:sn},ss="journey",sa=(0,nH.__name)(e=>/^\s*journey/.test(e),"detector"),so=(0,nH.__name)(async()=>{let{diagram:t}=await e.A(984866);return{id:ss,diagram:t}},"loader"),sl={id:ss,detector:sa,loader:so},sc={draw:(0,nH.__name)((e,t,r)=>{nH.log.debug("rendering svg for syntax error\n");let n=(0,nz.selectSvgElement)(t),i=n.append("g");n.attr("viewBox","0 0 2412 512"),(0,nG.configureSvgSize)(n,100,512,!0),i.append("path").attr("class","error-icon").attr("d","m411.313,123.313c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32-9.375,9.375-20.688-20.688c-12.484-12.5-32.766-12.5-45.25,0l-16,16c-1.261,1.261-2.304,2.648-3.31,4.051-21.739-8.561-45.324-13.426-70.065-13.426-105.867,0-192,86.133-192,192s86.133,192 192,192 192-86.133 192-192c0-24.741-4.864-48.327-13.426-70.065 1.402-1.007 2.79-2.049 4.051-3.31l16-16c12.5-12.492 12.5-32.758 0-45.25l-20.688-20.688 9.375-9.375 32.001-31.999zm-219.313,100.687c-52.938,0-96,43.063-96,96 0,8.836-7.164,16-16,16s-16-7.164-16-16c0-70.578 57.422-128 128-128 8.836,0 16,7.164 16,16s-7.164,16-16,16z"),i.append("path").attr("class","error-icon").attr("d","m459.02,148.98c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l16,16c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16.001-16z"),i.append("path").attr("class","error-icon").attr("d","m340.395,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16-16c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l15.999,16z"),i.append("path").attr("class","error-icon").attr("d","m400,64c8.844,0 16-7.164 16-16v-32c0-8.836-7.156-16-16-16-8.844,0-16,7.164-16,16v32c0,8.836 7.156,16 16,16z"),i.append("path").attr("class","error-icon").attr("d","m496,96.586h-32c-8.844,0-16,7.164-16,16 0,8.836 7.156,16 16,16h32c8.844,0 16-7.164 16-16 0-8.836-7.156-16-16-16z"),i.append("path").attr("class","error-icon").attr("d","m436.98,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688l32-32c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32c-6.251,6.25-6.251,16.375-0.001,22.625z"),i.append("text").attr("class","error-text").attr("x",1440).attr("y",250).attr("font-size","150px").style("text-anchor","middle").text("Syntax error in text"),i.append("text").attr("class","error-text").attr("x",1250).attr("y",400).attr("font-size","100px").style("text-anchor","middle").text(`mermaid version ${r}`)},"draw")},su={db:{},renderer:sc,parser:{parse:(0,nH.__name)(()=>{},"parse")}},sd="flowchart-elk",sh=(0,nH.__name)((e,t={})=>!!(/^\s*flowchart-elk/.test(e)||/^\s*(flowchart|graph)/.test(e)&&t?.flowchart?.defaultRenderer==="elk")&&(t.layout="elk",!0),"detector"),sp=(0,nH.__name)(async()=>{let{diagram:t}=await e.A(956761);return{id:sd,diagram:t}},"loader"),sm={id:sd,detector:sh,loader:sp},sf="timeline",sg=(0,nH.__name)(e=>/^\s*timeline/.test(e),"detector"),sy=(0,nH.__name)(async()=>{let{diagram:t}=await e.A(886387);return{id:sf,diagram:t}},"loader"),sx={id:sf,detector:sg,loader:sy},sv="mindmap",sb=(0,nH.__name)(e=>/^\s*mindmap/.test(e),"detector"),sw=(0,nH.__name)(async()=>{let{diagram:t}=await e.A(391450);return{id:sv,diagram:t}},"loader"),sk={id:sv,detector:sb,loader:sw},sj="kanban",sS=(0,nH.__name)(e=>/^\s*kanban/.test(e),"detector"),sN=(0,nH.__name)(async()=>{let{diagram:t}=await e.A(870423);return{id:sj,diagram:t}},"loader"),sA={id:sj,detector:sS,loader:sN},sC="sankey",s_=(0,nH.__name)(e=>/^\s*sankey(-beta)?/.test(e),"detector"),sT=(0,nH.__name)(async()=>{let{diagram:t}=await e.A(390930);return{id:sC,diagram:t}},"loader"),sE={id:sC,detector:s_,loader:sT},sP="packet",sR=(0,nH.__name)(e=>/^\s*packet(-beta)?/.test(e),"detector"),sM=(0,nH.__name)(async()=>{let{diagram:t}=await e.A(776122);return{id:sP,diagram:t}},"loader"),sL={id:sP,detector:sR,loader:sM},sI="radar",sD=(0,nH.__name)(e=>/^\s*radar-beta/.test(e),"detector"),sO=(0,nH.__name)(async()=>{let{diagram:t}=await e.A(336554);return{id:sI,diagram:t}},"loader"),sB={id:sI,detector:sD,loader:sO},sF="block",sz=(0,nH.__name)(e=>/^\s*block(-beta)?/.test(e),"detector"),s$=(0,nH.__name)(async()=>{let{diagram:t}=await e.A(840096);return{id:sF,diagram:t}},"loader"),sV={id:sF,detector:sz,loader:s$},sU="architecture",sW=(0,nH.__name)(e=>/^\s*architecture/.test(e),"detector"),sG=(0,nH.__name)(async()=>{let{diagram:t}=await e.A(604139);return{id:sU,diagram:t}},"loader"),sH={id:sU,detector:sW,loader:sG},sq="treemap",sK=(0,nH.__name)(e=>/^\s*treemap/.test(e),"detector"),sY=(0,nH.__name)(async()=>{let{diagram:t}=await e.A(717464);return{id:sq,diagram:t}},"loader"),sX={id:sq,detector:sK,loader:sY},sJ=!1,sZ=(0,nH.__name)(()=>{sJ||(sJ=!0,(0,nG.registerDiagram)("error",su,e=>"error"===e.toLowerCase().trim()),(0,nG.registerDiagram)("---",{db:{clear:(0,nH.__name)(()=>{},"clear")},styles:{},renderer:{draw:(0,nH.__name)(()=>{},"draw")},parser:{parse:(0,nH.__name)(()=>{throw Error("Diagrams beginning with --- are not valid. If you were trying to use a YAML front-matter, please ensure that you've correctly opened and closed the YAML front-matter with un-indented `---` blocks")},"parse")},init:(0,nH.__name)(()=>null,"init")},e=>e.toLowerCase().trimStart().startsWith("---")),(0,nG.registerLazyLoadedDiagrams)(sm,sk,sH),(0,nG.registerLazyLoadedDiagrams)(ip,sA,i4,i2,ij,iP,iI,iD,iK,iZ,ik,ix,sx,iC,si,se,sl,iz,sE,sL,iW,sV,sB,sX))},"addDiagrams"),sQ=(0,nH.__name)(async()=>{nH.log.debug("Loading registered diagrams");let e=(await Promise.allSettled(Object.entries(nG.detectors).map(async([e,{detector:t,loader:r}])=>{if(r)try{(0,nG.getDiagram)(e)}catch{try{let{diagram:e,id:n}=await r();(0,nG.registerDiagram)(n,e,t)}catch(t){throw nH.log.error(`Failed to load external diagram with key ${e}. Removing from detectors.`),delete nG.detectors[e],t}}}))).filter(e=>"rejected"===e.status);if(e.length>0){for(let t of(nH.log.error(`Failed to load ${e.length} external diagrams`),e))nH.log.error(t);throw Error(`Failed to load ${e.length} external diagrams`)}},"loadRegisteredDiagrams");function s0(e,t){e.attr("role","graphics-document document"),""!==t&&e.attr("aria-roledescription",t)}function s1(e,t,r,n){if(void 0!==e.insert){if(r){let t=`chart-desc-${n}`;e.attr("aria-describedby",t),e.insert("desc",":first-child").attr("id",t).text(r)}if(t){let r=`chart-title-${n}`;e.attr("aria-labelledby",r),e.insert("title",":first-child").attr("id",r).text(t)}}}(0,nH.__name)(s0,"setA11yDiagramInfo"),(0,nH.__name)(s1,"addSVGa11yTitleDescription");var s2=class e{constructor(e,t,r,n,i){this.type=e,this.text=t,this.db=r,this.parser=n,this.renderer=i}static{(0,nH.__name)(this,"Diagram")}static async fromText(t,r={}){let n=(0,nG.getConfig)(),i=(0,nG.detectType)(t,n);t=(0,nW.encodeEntities)(t)+"\n";try{(0,nG.getDiagram)(i)}catch{let e=(0,nG.getDiagramLoader)(i);if(!e)throw new nG.UnknownDiagramError(`Diagram ${i} not found.`);let{id:t,diagram:r}=await e();(0,nG.registerDiagram)(t,r)}let{db:s,parser:a,renderer:o,init:l}=(0,nG.getDiagram)(i);return a.parser&&(a.parser.yy=s),s.clear?.(),l?.(n),r.title&&s.setDiagramTitle?.(r.title),await a.parse(t),new e(i,t,s,a,o)}async render(e,t){await this.renderer.draw(this.text,e,t,this)}getParser(){return this.parser}getType(){return this.type}},s5=[],s3=(0,nH.__name)(()=>{s5.forEach(e=>{e()}),s5=[]},"attachFunctions"),s6=(0,nH.__name)(e=>e.replace(/^\s*%%(?!{)[^\n]+\n?/gm,"").trimStart(),"cleanupComments");function s4(e){let t=e.match(nG.frontMatterRegex);if(!t)return{text:e,metadata:{}};let r=(0,n$.load)(t[1],{schema:n$.JSON_SCHEMA})??{};r="object"!=typeof r||Array.isArray(r)?{}:r;let n={};return r.displayMode&&(n.displayMode=r.displayMode.toString()),r.title&&(n.title=r.title.toString()),r.config&&(n.config=r.config),{text:e.slice(t[0].length),metadata:n}}(0,nH.__name)(s4,"extractFrontMatter");var s8=(0,nH.__name)(e=>e.replace(/\r\n?/g,"\n").replace(/<(\w+)([^>]*)>/g,(e,t,r)=>"<"+t+r.replace(/="([^"]*)"/g,"='$1'")+">"),"cleanupText"),s9=(0,nH.__name)(e=>{let{text:t,metadata:r}=s4(e),{displayMode:n,title:i,config:s={}}=r;return n&&(s.gantt||(s.gantt={}),s.gantt.displayMode=n),{title:i,config:s,text:t}},"processFrontmatter"),s7=(0,nH.__name)(e=>{let t=nW.utils_default.detectInit(e)??{},r=nW.utils_default.detectDirective(e,"wrap");return Array.isArray(r)?t.wrap=r.some(({type:e})=>"wrap"===e):r?.type==="wrap"&&(t.wrap=!0),{text:(0,nW.removeDirectives)(e),directive:t}},"processDirectives");function ae(e){let t=s9(s8(e)),r=s7(t.text),n=(0,nW.cleanAndMerge)(t.config,r.directive);return{code:e=s6(r.text),title:t.title,config:n}}function at(e){return btoa(Array.from(new TextEncoder().encode(e),e=>String.fromCodePoint(e)).join(""))}(0,nH.__name)(ae,"preprocessDiagram"),(0,nH.__name)(at,"toBase64");var ar=["foreignobject"],an=["dominant-baseline"];function ai(e){let t=ae(e);return(0,nG.reset)(),(0,nG.addDirective)(t.config??{}),t}async function as(e,t){sZ();try{let{code:t,config:r}=ai(e);return{diagramType:(await ag(t)).type,config:r}}catch(e){if(t?.suppressErrors)return!1;throw e}}(0,nH.__name)(ai,"processAndSetConfigs"),(0,nH.__name)(as,"parse");var aa=(0,nH.__name)((e,t,r=[])=>`
2
2
  .${e} ${t} { ${r.join(" !important; ")} !important; }`,"cssImportantStyles"),ao=(0,nH.__name)((e,t=new Map)=>{let r="";if(void 0!==e.themeCSS&&(r+=`
3
3
  ${e.themeCSS}`),void 0!==e.fontFamily&&(r+=`
4
4
  :root { --mermaid-font-family: ${e.fontFamily}}`),void 0!==e.altFontFamily&&(r+=`
5
- :root { --mermaid-alt-font-family: ${e.altFontFamily}}`),t instanceof Map){let n=e.htmlLabels??e.flowchart?.htmlLabels?["> *","span"]:["rect","polygon","ellipse","circle","path"];t.forEach(e=>{(0,ih.default)(e.styles)||n.forEach(t=>{r+=aa(e.id,t,e.styles)}),(0,ih.default)(e.textStyles)||(r+=aa(e.id,"tspan",(e?.textStyles||[]).map(e=>e.replace("color","fill"))))})}return r},"createCssStyles"),al=(0,nH.__name)((e,t,r,n)=>{var i,s,a;let o=ao(e,r),l=(0,nW.styles_default)(t,o,e.themeVariables);return ic((a=function e(t,r,n,i,s,a,o,l,c){for(var u,d,h,p,m,f,g=0,y=0,x=o,v=0,b=0,w=0,k=1,S=1,j=1,A=0,N="",C=s,_=a,T=i,E=N;S;)switch(w=A,A=ir()){case 40:if(108!=w&&58==n1(E,x-1)){-1!=(m=E+=n0(ia(A),"&","&\f"),f=nZ(g?l[g-1]:0),m.indexOf("&\f",f))&&(j=-1);break}case 34:case 39:case 91:E+=ia(A);break;case 9:case 10:case 13:case 32:E+=function(e){for(;n7=ii();)if(n7<33)ir();else break;return is(e)>2||is(n7)>3?"":" "}(w);break;case 92:E+=function(e,t){for(var r;--t&&ir()&&!(n7<48)&&!(n7>102)&&(!(n7>57)||!(n7<65))&&(!(n7>70)||!(n7<97)););return r=n9+(t<6&&32==ii()&&32==ir()),n2(ie,e,r)}(n9-1,7);continue;case 47:switch(ii()){case 42:case 47:n3((u=function(e,t){for(;ir();)if(e+n7===57)break;else if(e+n7===84&&47===ii())break;return"/*"+n2(ie,t,n9-1)+"*"+nQ(47===e?e:ir())}(ir(),n9),d=r,h=n,p=c,it(u,d,h,nY,nQ(n7),n2(u,2,-2),0,p)),c),(5==is(w||1)||5==is(ii()||1))&&n5(E)&&" "!==n2(E,-1,void 0)&&(E+=" ");break;default:E+="/"}break;case 123*k:l[g++]=n5(E)*j;case 125*k:case 59:case 0:switch(A){case 0:case 125:S=0;case 59+y:-1==j&&(E=n0(E,/\f/g,"")),b>0&&(n5(E)-x||0===k&&47===w)&&n3(b>32?il(E+";",i,n,x-1,c):il(n0(E," ","")+";",i,n,x-2,c),c);break;case 59:E+=";";default:if(n3(T=io(E,r,n,g,y,s,l,N,C=[],_=[],x,a),a),123===A)if(0===y)e(E,r,T,T,C,a,x,l,_);else{switch(v){case 99:if(110===n1(E,3))break;case 108:if(97===n1(E,2))break;default:y=0;case 100:case 109:case 115:}y?e(t,T,T,i&&n3(io(t,T,T,0,0,s,l,N,s,C=[],x,_),_),s,_,x,l,i?C:_):e(E,T,T,T,[""],_,0,l,_)}}g=y=b=0,k=j=1,N=E="",x=o;break;case 58:x=1+n5(E),b=w;default:if(k<1){if(123==A)--k;else if(125==A&&0==k++&&125==(n7=n9>0?n1(ie,--n9):0,n8--,10===n7&&(n8=1,n6--),n7))continue}switch(E+=nQ(A),A*k){case 38:j=y>0?1:(E+="\f",-1);break;case 44:l[g++]=(n5(E)-1)*j,j=1;break;case 64:45===ii()&&(E+=ia(ir())),v=ii(),y=x=n5(N=E+=function(e){for(;!is(ii());)ir();return n2(ie,e,n9)}(n9)),A++;break;case 45:45===w&&2==n5(E)&&(k=0)}}return a}("",null,null,null,[""],(s=i=`${n}{${l}}`,n6=n8=1,n4=n5(ie=s),n9=0,i=[]),0,[0],i),ie="",a),iu)},"createUserStyles"),ac=(0,nH.__name)((e="",t,r)=>{let n=e;return r||t||(n=n.replace(/marker-end="url\([\d+./:=?A-Za-z-]*?#/g,'marker-end="url(#')),n=(n=(0,nG.decodeEntities)(n)).replace(/<br>/g,"<br/>")},"cleanUpSvgCode"),au=(0,nH.__name)((e="",t)=>{let r=t?.viewBox?.baseVal?.height?t.viewBox.baseVal.height+"px":"100%",n=at(`<body style="margin:0">${e}</body>`);return`<iframe style="width:100%;height:${r};border:0;margin:0;" src="data:text/html;charset=UTF-8;base64,${n}" sandbox="allow-top-navigation-by-user-activation allow-popups">
5
+ :root { --mermaid-alt-font-family: ${e.altFontFamily}}`),t instanceof Map){let n=e.htmlLabels??e.flowchart?.htmlLabels?["> *","span"]:["rect","polygon","ellipse","circle","path"];t.forEach(e=>{(0,ih.default)(e.styles)||n.forEach(t=>{r+=aa(e.id,t,e.styles)}),(0,ih.default)(e.textStyles)||(r+=aa(e.id,"tspan",(e?.textStyles||[]).map(e=>e.replace("color","fill"))))})}return r},"createCssStyles"),al=(0,nH.__name)((e,t,r,n)=>{var i,s,a;let o=ao(e,r),l=(0,nG.styles_default)(t,o,e.themeVariables);return ic((a=function e(t,r,n,i,s,a,o,l,c){for(var u,d,h,p,m,f,g=0,y=0,x=o,v=0,b=0,w=0,k=1,j=1,S=1,N=0,A="",C=s,_=a,T=i,E=A;j;)switch(w=N,N=ir()){case 40:if(108!=w&&58==n1(E,x-1)){-1!=(m=E+=n0(ia(N),"&","&\f"),f=nZ(g?l[g-1]:0),m.indexOf("&\f",f))&&(S=-1);break}case 34:case 39:case 91:E+=ia(N);break;case 9:case 10:case 13:case 32:E+=function(e){for(;n7=ii();)if(n7<33)ir();else break;return is(e)>2||is(n7)>3?"":" "}(w);break;case 92:E+=function(e,t){for(var r;--t&&ir()&&!(n7<48)&&!(n7>102)&&(!(n7>57)||!(n7<65))&&(!(n7>70)||!(n7<97)););return r=n9+(t<6&&32==ii()&&32==ir()),n2(ie,e,r)}(n9-1,7);continue;case 47:switch(ii()){case 42:case 47:n3((u=function(e,t){for(;ir();)if(e+n7===57)break;else if(e+n7===84&&47===ii())break;return"/*"+n2(ie,t,n9-1)+"*"+nQ(47===e?e:ir())}(ir(),n9),d=r,h=n,p=c,it(u,d,h,nY,nQ(n7),n2(u,2,-2),0,p)),c),(5==is(w||1)||5==is(ii()||1))&&n5(E)&&" "!==n2(E,-1,void 0)&&(E+=" ");break;default:E+="/"}break;case 123*k:l[g++]=n5(E)*S;case 125*k:case 59:case 0:switch(N){case 0:case 125:j=0;case 59+y:-1==S&&(E=n0(E,/\f/g,"")),b>0&&(n5(E)-x||0===k&&47===w)&&n3(b>32?il(E+";",i,n,x-1,c):il(n0(E," ","")+";",i,n,x-2,c),c);break;case 59:E+=";";default:if(n3(T=io(E,r,n,g,y,s,l,A,C=[],_=[],x,a),a),123===N)if(0===y)e(E,r,T,T,C,a,x,l,_);else{switch(v){case 99:if(110===n1(E,3))break;case 108:if(97===n1(E,2))break;default:y=0;case 100:case 109:case 115:}y?e(t,T,T,i&&n3(io(t,T,T,0,0,s,l,A,s,C=[],x,_),_),s,_,x,l,i?C:_):e(E,T,T,T,[""],_,0,l,_)}}g=y=b=0,k=S=1,A=E="",x=o;break;case 58:x=1+n5(E),b=w;default:if(k<1){if(123==N)--k;else if(125==N&&0==k++&&125==(n7=n9>0?n1(ie,--n9):0,n4--,10===n7&&(n4=1,n6--),n7))continue}switch(E+=nQ(N),N*k){case 38:S=y>0?1:(E+="\f",-1);break;case 44:l[g++]=(n5(E)-1)*S,S=1;break;case 64:45===ii()&&(E+=ia(ir())),v=ii(),y=x=n5(A=E+=function(e){for(;!is(ii());)ir();return n2(ie,e,n9)}(n9)),N++;break;case 45:45===w&&2==n5(E)&&(k=0)}}return a}("",null,null,null,[""],(s=i=`${n}{${l}}`,n6=n4=1,n8=n5(ie=s),n9=0,i=[]),0,[0],i),ie="",a),iu)},"createUserStyles"),ac=(0,nH.__name)((e="",t,r)=>{let n=e;return r||t||(n=n.replace(/marker-end="url\([\d+./:=?A-Za-z-]*?#/g,'marker-end="url(#')),n=(n=(0,nW.decodeEntities)(n)).replace(/<br>/g,"<br/>")},"cleanUpSvgCode"),au=(0,nH.__name)((e="",t)=>{let r=t?.viewBox?.baseVal?.height?t.viewBox.baseVal.height+"px":"100%",n=at(`<body style="margin:0">${e}</body>`);return`<iframe style="width:100%;height:${r};border:0;margin:0;" src="data:text/html;charset=UTF-8;base64,${n}" sandbox="allow-top-navigation-by-user-activation allow-popups">
6
6
  The "iframe" tag is not supported by your browser.
7
- </iframe>`},"putIntoIFrame"),ad=(0,nH.__name)((e,t,r,n,i)=>{let s=e.append("div");s.attr("id",r),n&&s.attr("style",n);let a=s.append("svg").attr("id",t).attr("width","100%").attr("xmlns","http://www.w3.org/2000/svg");return i&&a.attr("xmlns:xlink",i),a.append("g"),e},"appendDivSvgG");function ah(e,t){return e.append("iframe").attr("id",t).attr("style","width: 100%; height: 100%;").attr("sandbox","")}(0,nH.__name)(ah,"sandboxedIframe");var ap=(0,nH.__name)((e,t,r,n)=>{e.getElementById(t)?.remove(),e.getElementById(r)?.remove(),e.getElementById(n)?.remove()},"removeExistingElements"),am=(0,nH.__name)(async function(e,t,r){let n,i;sZ();let s=ai(t);t=s.code;let a=(0,nW.getConfig)();nH.log.debug(a),t.length>(a?.maxTextSize??5e4)&&(t="graph TB;a[Maximum text size in diagram exceeded];style a fill:#faa");let o="#"+e,l="i"+e,c="#"+l,u="d"+e,d="#"+u,h=(0,nH.__name)(()=>{let e=m?c:d,t=(0,nK.select)(e).node();t&&"remove"in t&&t.remove()},"removeTempElements"),p=(0,nK.select)("body"),m="sandbox"===a.securityLevel,f="loose"===a.securityLevel,g=a.fontFamily;if(void 0!==r){if(r&&(r.innerHTML=""),m){let e=ah((0,nK.select)(r),l);(p=(0,nK.select)(e.nodes()[0].contentDocument.body)).node().style.margin=0}else p=(0,nK.select)(r);ad(p,e,u,`font-family: ${g}`,"http://www.w3.org/1999/xlink")}else{if(ap(document,e,u,l),m){let e=ah((0,nK.select)("body"),l);(p=(0,nK.select)(e.nodes()[0].contentDocument.body)).node().style.margin=0}else p=(0,nK.select)("body");ad(p,e,u)}try{n=await s2.fromText(t,{title:s.title})}catch(e){if(a.suppressErrorRendering)throw h(),e;n=await s2.fromText("error"),i=e}let y=p.select(d).node(),x=n.type,v=y.firstChild,b=v.firstChild,w=al(a,x,n.renderer.getClasses?.(t,n),o),k=document.createElement("style");k.innerHTML=w,v.insertBefore(k,b);try{await n.renderer.draw(t,e,nF.package_default.version,n)}catch(r){throw a.suppressErrorRendering?h():sc.draw(t,e,nF.package_default.version),r}ay(x,p.select(`${d} svg`),n.db.getAccTitle?.(),n.db.getAccDescription?.()),p.select(`[id="${e}"]`).selectAll("foreignobject > *").attr("xmlns","http://www.w3.org/1999/xhtml");let S=p.select(d).node().innerHTML;if(nH.log.debug("config.arrowMarkerAbsolute",a.arrowMarkerAbsolute),S=ac(S,m,(0,nW.evaluate)(a.arrowMarkerAbsolute)),m?S=au(S,p.select(d+" svg").node()):f||(S=id.default.sanitize(S,{ADD_TAGS:ar,ADD_ATTR:an,HTML_INTEGRATION_POINTS:{foreignobject:!0}})),s3(),i)throw i;return h(),{diagramType:x,svg:S,bindFunctions:n.db.bindFunctions}},"render");function af(e={}){let t=(0,nW.assignWithDepth_default)({},e);t?.fontFamily&&!t.themeVariables?.fontFamily&&(t.themeVariables||(t.themeVariables={}),t.themeVariables.fontFamily=t.fontFamily),(0,nW.saveConfigFromInitialize)(t),t?.theme&&t.theme in nW.themes_default?t.themeVariables=nW.themes_default[t.theme].getThemeVariables(t.themeVariables):t&&(t.themeVariables=nW.themes_default.default.getThemeVariables(t.themeVariables));let r="object"==typeof t?(0,nW.setSiteConfig)(t):(0,nW.getSiteConfig)();(0,nH.setLogLevel)(r.logLevel),sZ()}(0,nH.__name)(af,"initialize");var ag=(0,nH.__name)((e,t={})=>{let{code:r}=ae(e);return s2.fromText(r,t)},"getDiagramFromText");function ay(e,t,r,n){s0(t,e),s1(t,r,n,t.attr("id"))}(0,nH.__name)(ay,"addA11yInfo");var ax=Object.freeze({render:am,parse:as,getDiagramFromText:ag,initialize:af,getConfig:nW.getConfig,setConfig:nW.setConfig,getSiteConfig:nW.getSiteConfig,updateSiteConfig:nW.updateSiteConfig,reset:(0,nH.__name)(()=>{(0,nW.reset)()},"reset"),globalReset:(0,nH.__name)(()=>{(0,nW.reset)(nW.defaultConfig)},"globalReset"),defaultConfig:nW.defaultConfig});(0,nH.setLogLevel)((0,nW.getConfig)().logLevel),(0,nW.reset)((0,nW.getConfig)());var av=(0,nH.__name)((e,t,r)=>{nH.log.warn(e),(0,nG.isDetailedError)(e)?(r&&r(e.str,e.hash),t.push({...e,message:e.str,error:e})):(r&&r(e),e instanceof Error&&t.push({str:e.message,message:e.message,hash:e.name,error:e}))},"handleError"),ab=(0,nH.__name)(async function(e={querySelector:".mermaid"}){try{await aw(e)}catch(t){if((0,nG.isDetailedError)(t)&&nH.log.error(t.str),aM.parseError&&aM.parseError(t),!e.suppressErrors)throw nH.log.error("Use the suppressErrors option to suppress these errors"),t}},"run"),aw=(0,nH.__name)(async function({postRenderCallback:e,querySelector:t,nodes:r}={querySelector:".mermaid"}){let n,i,s=ax.getConfig();if(nH.log.debug(`${!e?"No ":""}Callback function found`),r)n=r;else if(t)n=document.querySelectorAll(t);else throw Error("Nodes and querySelector are both undefined");nH.log.debug(`Found ${n.length} diagrams`),s?.startOnLoad!==void 0&&(nH.log.debug("Start On Load: "+s?.startOnLoad),ax.updateSiteConfig({startOnLoad:s?.startOnLoad}));let a=new nG.utils_default.InitIDGenerator(s.deterministicIds,s.deterministicIDSeed),o=[];for(let t of Array.from(n)){if(nH.log.info("Rendering diagram: "+t.id),t.getAttribute("data-processed"))continue;t.setAttribute("data-processed","true");let r=`mermaid-${a.next()}`;i=t.innerHTML,i=(0,nq.dedent)(nG.utils_default.entityDecode(i)).trim().replace(/<br\s*\/?>/gi,"<br/>");let n=nG.utils_default.detectInit(i);n&&nH.log.debug("Detected early reinit: ",n);try{let{svg:n,bindFunctions:s}=await aP(r,i,t);t.innerHTML=n,e&&await e(r),s&&s(t)}catch(e){av(e,o,aM.parseError)}}if(o.length>0)throw o[0]},"runThrowsErrors"),ak=(0,nH.__name)(function(e){ax.initialize(e)},"initialize"),aS=(0,nH.__name)(async function(e,t,r){nH.log.warn("mermaid.init is deprecated. Please use run instead."),e&&ak(e);let n={postRenderCallback:r,querySelector:".mermaid"};"string"==typeof t?n.querySelector=t:t&&(t instanceof HTMLElement?n.nodes=[t]:n.nodes=t),await ab(n)},"init"),aj=(0,nH.__name)(async(e,{lazyLoad:t=!0}={})=>{sZ(),(0,nW.registerLazyLoadedDiagrams)(...e),!1===t&&await sQ()},"registerExternalDiagrams"),aA=(0,nH.__name)(function(){if(aM.startOnLoad){let{startOnLoad:e}=ax.getConfig();e&&aM.run().catch(e=>nH.log.error("Mermaid failed to initialize",e))}},"contentLoaded");"u">typeof document&&window.addEventListener("load",aA,!1);var aN=(0,nH.__name)(function(e){aM.parseError=e},"setParseErrorHandler"),aC=[],a_=!1,aT=(0,nH.__name)(async()=>{if(!a_){for(a_=!0;aC.length>0;){let e=aC.shift();if(e)try{await e()}catch(e){nH.log.error("Error executing queue",e)}}a_=!1}},"executeQueue"),aE=(0,nH.__name)(async(e,t)=>new Promise((r,n)=>{let i=(0,nH.__name)(()=>new Promise((i,s)=>{ax.parse(e,t).then(e=>{i(e),r(e)},e=>{nH.log.error("Error parsing",e),aM.parseError?.(e),s(e),n(e)})}),"performCall");aC.push(i),aT().catch(n)}),"parse"),aP=(0,nH.__name)((e,t,r)=>new Promise((n,i)=>{let s=(0,nH.__name)(()=>new Promise((s,a)=>{ax.render(e,t,r).then(e=>{s(e),n(e)},e=>{nH.log.error("Error parsing",e),aM.parseError?.(e),a(e),i(e)})}),"performCall");aC.push(s),aT().catch(i)}),"render"),aR=(0,nH.__name)(()=>Object.keys(nW.detectors).map(e=>({id:e})),"getRegisteredDiagramsMetadata"),aM={startOnLoad:!0,mermaidAPI:ax,parse:aE,render:aP,init:aS,run:ab,registerExternalDiagrams:aj,registerLayoutLoaders:nV.registerLayoutLoaders,initialize:ak,parseError:void 0,contentLoaded:aA,setParseErrorHandler:aN,detectType:nW.detectType,registerIconPacks:nU.registerIconPacks,getRegisteredDiagramsMetadata:aR},aL={startOnLoad:!1,theme:"default",securityLevel:"strict",fontFamily:"monospace",suppressErrorRendering:!0},aI=function(e={}){let t=!1,r={...aL,...e.config},n={initialize(n){r={...aL,...e.config,...n},aM.initialize(r),t=!0},render:async(e,n)=>(t||(aM.initialize(r),t=!0),await aM.render(e,n))};return{name:"mermaid",type:"diagram",language:"mermaid",getMermaid:e=>(e&&n.initialize(e),n)}}();(0,E.default)("chevron-left",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);let aD=(0,E.default)("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);var aO=e.i(77589),aO=aO,aB=e.i(349416),aF=e.i(773340),a$=e.i(991106),az=a$;let aV=({className:e,from:t,...r})=>(0,v.jsx)("div",{className:(0,A.cn)("group flex w-full max-w-[95%] flex-col gap-2 transition-all duration-200","user"===t?"is-user ml-auto justify-end":"is-assistant",e),...r}),aU=({children:e,className:t,...r})=>(0,v.jsx)("div",{className:(0,A.cn)("is-user:dark flex w-fit min-w-0 max-w-full flex-col gap-2 overflow-hidden text-sm","group-[.is-user]:ml-auto group-[.is-user]:rounded-2xl group-[.is-user]:rounded-br-md group-[.is-user]:bg-primary group-[.is-user]:px-4 group-[.is-user]:py-3 group-[.is-user]:text-primary-foreground group-[.is-user]:shadow-sm","group-[.is-assistant]:text-foreground",t),...r,children:e}),aG=({className:e,children:t,...r})=>(0,v.jsx)("div",{className:(0,A.cn)("flex items-center gap-1",e),...r,children:t}),aW=({tooltip:e,children:t,label:r,variant:n="ghost",size:i="icon-sm",...s})=>{let a=(0,v.jsxs)(_.Button,{size:i,type:"button",variant:n,...s,children:[t,(0,v.jsx)("span",{className:"sr-only",children:r||e})]});return e?(0,v.jsx)(T.TooltipProvider,{children:(0,v.jsxs)(T.Tooltip,{children:[(0,v.jsx)(T.TooltipTrigger,{asChild:!0,children:a}),(0,v.jsx)(T.TooltipContent,{children:(0,v.jsx)("p",{children:e})})]})}):a},aH=({url:e,isOpen:t,onClose:r,onConfirm:n})=>{let[i,s]=(0,b.useState)(!1);if((0,b.useEffect)(()=>{s(!0)},[]),!i||!t)return null;let a=(()=>{try{return new URL(e).hostname}catch{return e}})();return(0,aF.createPortal)((0,v.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onClick:r,onKeyDown:e=>"Escape"===e.key&&r(),children:(0,v.jsxs)("div",{className:"relative mx-4 max-w-md rounded-lg bg-background p-6 shadow-lg",onClick:e=>e.stopPropagation(),children:[(0,v.jsxs)("button",{className:"absolute right-3 top-3 rounded-sm p-1 text-muted-foreground hover:bg-muted hover:text-foreground",onClick:r,type:"button",children:[(0,v.jsx)(aB.XIcon,{className:"h-4 w-4"}),(0,v.jsx)("span",{className:"sr-only",children:"Close"})]}),(0,v.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,v.jsxs)("div",{className:"flex items-center gap-2 text-lg font-semibold",children:[(0,v.jsx)(aO.default,{className:"h-5 w-5"}),(0,v.jsx)("span",{children:"External Link"})]}),(0,v.jsx)("p",{className:"text-sm text-muted-foreground",children:"You are about to visit an external website:"}),(0,v.jsx)("p",{className:"break-all rounded bg-muted px-3 py-2 text-sm font-mono",children:a}),(0,v.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,v.jsx)(_.Button,{variant:"outline",onClick:r,children:"Cancel"}),(0,v.jsx)(_.Button,{onClick:n,children:"Continue"})]})]})]})}),document.body)},aq=(0,b.memo)(({className:e,linkSafety:t,...r})=>(0,v.jsx)(az.j,{className:(0,A.cn)("size-full [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",e),plugins:{code:ni,mermaid:aI,math:nB,cjk:ey},linkSafety:{enabled:t?.enabled??!0,onLinkCheck:t?.onLinkCheck,renderModal:t?.renderModal??aH},...r}),(e,t)=>e.children===t.children);aq.displayName="MessageResponse";var aK=e.i(241416),aY=e.i(465488),aX=e.i(995945),aJ=e.i(309945),aZ=Symbol("radix.slottable");function aQ(e){return b.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===aZ}var a0=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{var r,n;let i,s,a,o=(n=r=`Primitive.${t}`,(i=b.forwardRef((e,t)=>{let{children:r,...n}=e;if(b.isValidElement(r)){var i;let e,s,a=(i=r,(s=(e=Object.getOwnPropertyDescriptor(i.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.ref:(s=(e=Object.getOwnPropertyDescriptor(i,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.props.ref:i.props.ref||i.ref),o=function(e,t){let r={...t};for(let n in t){let i=e[n],s=t[n];/^on[A-Z]/.test(n)?i&&s?r[n]=(...e)=>{let t=s(...e);return i(...e),t}:i&&(r[n]=i):"style"===n?r[n]={...i,...s}:"className"===n&&(r[n]=[i,s].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==b.Fragment&&(o.ref=t?(0,aJ.composeRefs)(t,a):a),b.cloneElement(r,o)}return b.Children.count(r)>1?b.Children.only(null):null})).displayName=`${n}.SlotClone`,s=i,(a=b.forwardRef((e,t)=>{let{children:r,...n}=e,i=b.Children.toArray(r),a=i.find(aQ);if(a){let e=a.props.children,r=i.map(t=>t!==a?t:b.Children.count(e)>1?b.Children.only(null):b.isValidElement(e)?e.props.children:null);return(0,v.jsx)(s,{...n,ref:t,children:b.isValidElement(e)?b.cloneElement(e,void 0,r):null})}return(0,v.jsx)(s,{...n,ref:t,children:r})})).displayName=`${r}.Slot`,a),l=b.forwardRef((e,r)=>{let{asChild:n,...i}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,v.jsx)(n?o:t,{...i,ref:r})});return l.displayName=`Primitive.${t}`,{...e,[t]:l}},{}),a1=e.i(395509),a2=e.i(610559),a5="Collapsible",[a3,a6]=function(e,t=[]){let r=[],n=()=>{let t=r.map(e=>b.createContext(e));return function(r){let n=r?.[e]||t;return b.useMemo(()=>({[`__scope${e}`]:{...r,[e]:n}}),[r,n])}};return n.scopeName=e,[function(t,n){let i=b.createContext(n),s=r.length;r=[...r,n];let a=t=>{let{scope:r,children:n,...a}=t,o=r?.[e]?.[s]||i,l=b.useMemo(()=>a,Object.values(a));return(0,v.jsx)(o.Provider,{value:l,children:n})};return a.displayName=t+"Provider",[a,function(r,a){let o=a?.[e]?.[s]||i,l=b.useContext(o);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 b.useMemo(()=>({[`__scope${t.scopeName}`]:n}),[n])}};return r.scopeName=t.scopeName,r}(n,...t)]}(a5),[a8,a4]=a3(a5),a9=b.forwardRef((e,t)=>{let{__scopeCollapsible:r,open:n,defaultOpen:i,disabled:s,onOpenChange:a,...o}=e,[l,c]=(0,aY.useControllableState)({prop:n,defaultProp:i??!1,onChange:a,caller:a5});return(0,v.jsx)(a8,{scope:r,disabled:s,contentId:(0,a2.useId)(),open:l,onOpenToggle:b.useCallback(()=>c(e=>!e),[c]),children:(0,v.jsx)(a0.div,{"data-state":oi(l),"data-disabled":s?"":void 0,...o,ref:t})})});a9.displayName=a5;var a7="CollapsibleTrigger",oe=b.forwardRef((e,t)=>{let{__scopeCollapsible:r,...n}=e,i=a4(a7,r);return(0,v.jsx)(a0.button,{type:"button","aria-controls":i.contentId,"aria-expanded":i.open||!1,"data-state":oi(i.open),"data-disabled":i.disabled?"":void 0,disabled:i.disabled,...n,ref:t,onClick:(0,aK.composeEventHandlers)(e.onClick,i.onOpenToggle)})});oe.displayName=a7;var ot="CollapsibleContent",or=b.forwardRef((e,t)=>{let{forceMount:r,...n}=e,i=a4(ot,e.__scopeCollapsible);return(0,v.jsx)(a1.Presence,{present:r||i.open,children:({present:e})=>(0,v.jsx)(on,{...n,ref:t,present:e})})});or.displayName=ot;var on=b.forwardRef((e,t)=>{let{__scopeCollapsible:r,present:n,children:i,...s}=e,a=a4(ot,r),[o,l]=b.useState(n),c=b.useRef(null),u=(0,aJ.useComposedRefs)(t,c),d=b.useRef(0),h=d.current,p=b.useRef(0),m=p.current,f=a.open||o,g=b.useRef(f),y=b.useRef(void 0);return b.useEffect(()=>{let e=requestAnimationFrame(()=>g.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,aX.useLayoutEffect)(()=>{let e=c.current;if(e){y.current=y.current||{transitionDuration:e.style.transitionDuration,animationName:e.style.animationName},e.style.transitionDuration="0s",e.style.animationName="none";let t=e.getBoundingClientRect();d.current=t.height,p.current=t.width,g.current||(e.style.transitionDuration=y.current.transitionDuration,e.style.animationName=y.current.animationName),l(n)}},[a.open,n]),(0,v.jsx)(a0.div,{"data-state":oi(a.open),"data-disabled":a.disabled?"":void 0,id:a.contentId,hidden:!f,...s,ref:u,style:{"--radix-collapsible-content-height":h?`${h}px`:void 0,"--radix-collapsible-content-width":m?`${m}px`:void 0,...e.style},children:f&&i})});function oi(e){return e?"open":"closed"}function os({...e}){return(0,v.jsx)(a9,{"data-slot":"collapsible",...e})}function oa({...e}){return(0,v.jsx)(oe,{"data-slot":"collapsible-trigger",...e})}function oo({...e}){return(0,v.jsx)(or,{"data-slot":"collapsible-content",...e})}let ol=(0,E.default)("circle-check-big",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);var oc=e.i(100536);let ou=(0,E.default)("circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]),od=(0,E.default)("clock",[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]),oh=(0,E.default)("wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]]),op=(0,E.default)("circle-x",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);var om=e.i(553880);e.i(196582);let of=(0,E.default)("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"}]]),og=({token:e})=>{let t,r,n;return(0,v.jsx)("span",{className:"dark:!bg-[var(--shiki-dark-bg)] dark:!text-[var(--shiki-dark)]",style:{color:e.color,backgroundColor:e.bgColor,...e.htmlStyle,fontStyle:(t=e.fontStyle)&&1&t?"italic":void 0,fontWeight:(r=e.fontStyle)&&2&r?"bold":void 0,textDecoration:(n=e.fontStyle)&&4&n?"underline":void 0},children:e.content})},oy=({keyedLine:e,showLineNumbers:t})=>(0,v.jsx)("span",{className:t?oS:"block",children:0===e.tokens.length?"\n":e.tokens.map(({token:e,key:t})=>(0,v.jsx)(og,{token:e},t))}),ox=(0,b.createContext)({code:""}),ov=new Map,ob=new Map,ow=new Map;function ok(e,t,r){let n,i,s=(n=e.slice(0,100),i=e.length>100?e.slice(-100):"",`${t}:${e.length}:${n}:${i}`),a=ob.get(s);return a||(r&&(ow.has(s)||ow.set(s,new Set),ow.get(s)?.add(r)),(e=>{let t=ov.get(e);if(t)return t;let r=r7({themes:["github-light","github-dark"],langs:[e]});return ov.set(e,r),r})(t).then(r=>{let n=r.getLoadedLanguages().includes(t)?t:"text",i=r.codeToTokens(e,{lang:n,themes:{light:"github-light",dark:"github-dark"}}),a={tokens:i.tokens,fg:i.fg??"",bg:i.bg??""};ob.set(s,a);let o=ow.get(s);if(o){for(let e of o)e(a);ow.delete(s)}}).catch(e=>{console.error("Failed to highlight code:",e),ow.delete(s)}),null)}let oS=(0,A.cn)("block","before:content-[counter(line)]","before:inline-block","before:[counter-increment:line]","before:w-8","before:mr-4","before:text-right","before:text-muted-foreground/50","before:font-mono","before:select-none"),oj=(0,b.memo)(({tokenized:e,showLineNumbers:t,className:r})=>{let n=(0,b.useMemo)(()=>({backgroundColor:e.bg,color:e.fg}),[e.bg,e.fg]),i=(0,b.useMemo)(()=>e.tokens.map((e,t)=>({key:`line-${t}`,tokens:e.map((e,r)=>({token:e,key:`line-${t}-${r}`}))})),[e.tokens]);return(0,v.jsx)("pre",{className:(0,A.cn)("dark:!bg-[var(--shiki-dark-bg)] dark:!text-[var(--shiki-dark)] m-0 p-4 text-sm",r),style:n,children:(0,v.jsx)("code",{className:(0,A.cn)("font-mono text-sm",t&&"[counter-increment:line_0] [counter-reset:line]"),children:i.map(e=>(0,v.jsx)(oy,{keyedLine:e,showLineNumbers:t},e.key))})})},(e,t)=>e.tokenized===t.tokenized&&e.showLineNumbers===t.showLineNumbers&&e.className===t.className),oA=({className:e,language:t,style:r,...n})=>(0,v.jsx)("div",{className:(0,A.cn)("group relative w-full overflow-hidden rounded-md border bg-background text-foreground",e),"data-language":t,style:{contentVisibility:"auto",containIntrinsicSize:"auto 200px",...r},...n}),oN=({children:e,className:t,...r})=>(0,v.jsx)("div",{className:(0,A.cn)("flex items-center justify-between bg-muted/80 px-3 py-2 text-muted-foreground text-xs",t),...r,children:e}),oC=({children:e,className:t,...r})=>(0,v.jsx)("div",{className:(0,A.cn)("flex items-center gap-2",t),...r,children:e}),o_=({children:e,className:t,...r})=>(0,v.jsx)("span",{className:(0,A.cn)("font-mono",t),...r,children:e}),oT=({code:e,language:t,showLineNumbers:r=!1})=>{let n=(0,b.useMemo)(()=>({tokens:e.split("\n").map(e=>""===e?[]:[{content:e,color:"inherit"}]),fg:"inherit",bg:"transparent"}),[e]),[i,s]=(0,b.useState)(()=>ok(e,t)??n);return(0,b.useEffect)(()=>{s(ok(e,t)??n),ok(e,t,s)},[e,t,n]),(0,v.jsx)("div",{className:"relative overflow-auto",children:(0,v.jsx)(oj,{showLineNumbers:r,tokenized:i})})},oE=({code:e,language:t,showLineNumbers:r=!1,className:n,children:i,...s})=>(0,v.jsx)(ox.Provider,{value:{code:e},children:(0,v.jsxs)(oA,{className:n,language:t,...s,children:[i,(0,v.jsx)(oT,{code:e,language:t,showLineNumbers:r})]})}),oP=({className:e,...t})=>(0,v.jsx)(os,{className:(0,A.cn)("group not-prose mb-4 w-full max-w-full overflow-hidden rounded-md border",e),...t}),oR=({className:e,title:t,type:r,state:n,toolName:i,...s})=>{let a,o="dynamic-tool"===r?i:r.split("-").slice(1).join("-");return(0,v.jsxs)(oa,{className:(0,A.cn)("flex w-full items-center justify-between gap-4 p-3",e),...s,children:[(0,v.jsxs)("div",{className:"flex items-center gap-2",children:[(0,v.jsx)(oh,{className:"size-4 text-muted-foreground"}),(0,v.jsx)("span",{className:"font-medium text-sm",children:t??o}),(a={"input-streaming":(0,v.jsx)(ou,{className:"size-4"}),"input-available":(0,v.jsx)(od,{className:"size-4 animate-pulse"}),"approval-requested":(0,v.jsx)(od,{className:"size-4 text-yellow-600"}),"approval-responded":(0,v.jsx)(ol,{className:"size-4 text-blue-600"}),"output-available":(0,v.jsx)(ol,{className:"size-4 text-green-600"}),"output-error":(0,v.jsx)(op,{className:"size-4 text-red-600"}),"output-denied":(0,v.jsx)(op,{className:"size-4 text-orange-600"})},(0,v.jsxs)(C,{className:"gap-1.5 rounded-full text-xs",variant:"secondary",children:[a[n],{"input-streaming":"Pending","input-available":"Running","approval-requested":"Awaiting Approval","approval-responded":"Responded","output-available":"Completed","output-error":"Error","output-denied":"Denied"}[n]]}))]}),(0,v.jsx)(oc.ChevronDownIcon,{className:"size-4 text-muted-foreground transition-transform group-data-[state=open]:rotate-180"})]})},oM=({className:e,...t})=>(0,v.jsx)(oo,{className:(0,A.cn)("data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-popover-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in",e),...t}),oL=({className:e,input:t,...r})=>(0,v.jsxs)("div",{className:(0,A.cn)("space-y-2 overflow-hidden p-4 max-w-full",e),...r,children:[(0,v.jsx)("h4",{className:"font-medium text-muted-foreground text-xs uppercase tracking-wide",children:"Parameters"}),(0,v.jsx)("div",{className:"rounded-md bg-muted/50 overflow-x-auto max-w-full",children:(0,v.jsx)(oE,{code:JSON.stringify(t,null,2),language:"json"})})]}),oI=({className:e,output:t,errorText:r,...n})=>{if(!(t||r))return null;let i=(0,v.jsx)("div",{children:t});return"object"!=typeof t||(0,b.isValidElement)(t)?"string"==typeof t&&(i=(0,v.jsx)(oE,{code:t,language:"json"})):i=(0,v.jsx)(oE,{code:JSON.stringify(t,null,2),language:"json"}),(0,v.jsxs)("div",{className:(0,A.cn)("space-y-2 p-4 max-w-full overflow-hidden",e),...n,children:[(0,v.jsx)("h4",{className:"font-medium text-muted-foreground text-xs uppercase tracking-wide",children:r?"Error":"Result"}),(0,v.jsxs)("div",{className:(0,A.cn)("overflow-x-auto rounded-md text-xs max-w-full [&_table]:w-full",r?"bg-destructive/10 text-destructive":"bg-muted/50 text-foreground"),children:[r&&(0,v.jsx)("div",{children:r}),i]})]})},oD=({className:e,...t})=>(0,v.jsx)("div",{className:(0,A.cn)("flex flex-col overflow-hidden rounded-lg border bg-background shadow-sm",e),...t}),oO=({className:e,...t})=>(0,v.jsx)("div",{className:(0,A.cn)("flex items-center justify-between border-b bg-muted/50 px-4 py-3",e),...t}),oB=({className:e,...t})=>(0,v.jsx)("p",{className:(0,A.cn)("font-medium text-foreground text-sm",e),...t}),oF=({className:e,...t})=>(0,v.jsx)("p",{className:(0,A.cn)("text-muted-foreground text-sm",e),...t}),o$=({className:e,...t})=>(0,v.jsx)("div",{className:(0,A.cn)("flex items-center gap-1",e),...t}),oz=({tooltip:e,label:t,icon:r,children:n,className:i,size:s="sm",variant:a="ghost",...o})=>{let l=(0,v.jsxs)(_.Button,{className:(0,A.cn)("size-8 p-0 text-muted-foreground hover:text-foreground",i),size:s,type:"button",variant:a,...o,children:[r?(0,v.jsx)(r,{className:"size-4"}):n,(0,v.jsx)("span",{className:"sr-only",children:t||e})]});return e?(0,v.jsx)(T.TooltipProvider,{children:(0,v.jsxs)(T.Tooltip,{children:[(0,v.jsx)(T.TooltipTrigger,{asChild:!0,children:l}),(0,v.jsx)(T.TooltipContent,{children:(0,v.jsx)("p",{children:e})})]})}):l},oV=({className:e,...t})=>(0,v.jsx)("div",{className:(0,A.cn)("flex-1 overflow-auto p-4",e),...t}),oU=(0,j.cva)("relative w-full rounded-lg border px-4 py-3 text-sm grid has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] grid-cols-[0_1fr] has-[>svg]:gap-x-3 gap-y-0.5 items-start [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"text-destructive bg-card [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90"}},defaultVariants:{variant:"default"}});function oG({className:e,variant:t,...r}){return(0,v.jsx)("div",{"data-slot":"alert",role:"alert",className:(0,A.cn)(oU({variant:t}),e),...r})}let oW=(0,b.createContext)(null),oH=()=>{let e=(0,b.useContext)(oW);if(!e)throw Error("Confirmation components must be used within Confirmation");return e},oq=({className:e,approval:t,state:r,...n})=>t&&"input-streaming"!==r&&"input-available"!==r?(0,v.jsx)(oW.Provider,{value:{approval:t,state:r},children:(0,v.jsx)(oG,{className:(0,A.cn)("flex flex-col gap-2",e),...n})}):null,oK=({children:e})=>{let{state:t}=oH();return"approval-requested"!==t?null:e},oY=({className:e,...t})=>{let{state:r}=oH();return"approval-requested"!==r?null:(0,v.jsx)("div",{className:(0,A.cn)("flex items-center justify-end gap-2 self-end",e),...t})},oX=e=>(0,v.jsx)(_.Button,{className:"h-8 px-3 text-sm",type:"button",...e}),oJ=({size:e=16})=>(0,v.jsxs)("svg",{height:e,strokeLinejoin:"round",style:{color:"currentcolor"},viewBox:"0 0 16 16",width:e,children:[(0,v.jsx)("title",{children:"Loader"}),(0,v.jsxs)("g",{clipPath:"url(#clip0_2393_1490)",children:[(0,v.jsx)("path",{d:"M8 0V4",stroke:"currentColor",strokeWidth:"1.5"}),(0,v.jsx)("path",{d:"M8 16V12",opacity:"0.5",stroke:"currentColor",strokeWidth:"1.5"}),(0,v.jsx)("path",{d:"M3.29773 1.52783L5.64887 4.7639",opacity:"0.9",stroke:"currentColor",strokeWidth:"1.5"}),(0,v.jsx)("path",{d:"M12.7023 1.52783L10.3511 4.7639",opacity:"0.1",stroke:"currentColor",strokeWidth:"1.5"}),(0,v.jsx)("path",{d:"M12.7023 14.472L10.3511 11.236",opacity:"0.4",stroke:"currentColor",strokeWidth:"1.5"}),(0,v.jsx)("path",{d:"M3.29773 14.472L5.64887 11.236",opacity:"0.6",stroke:"currentColor",strokeWidth:"1.5"}),(0,v.jsx)("path",{d:"M15.6085 5.52783L11.8043 6.7639",opacity:"0.2",stroke:"currentColor",strokeWidth:"1.5"}),(0,v.jsx)("path",{d:"M0.391602 10.472L4.19583 9.23598",opacity:"0.7",stroke:"currentColor",strokeWidth:"1.5"}),(0,v.jsx)("path",{d:"M15.6085 10.4722L11.8043 9.2361",opacity:"0.3",stroke:"currentColor",strokeWidth:"1.5"}),(0,v.jsx)("path",{d:"M0.391602 5.52783L4.19583 6.7639",opacity:"0.8",stroke:"currentColor",strokeWidth:"1.5"})]}),(0,v.jsx)("defs",{children:(0,v.jsx)("clipPath",{id:"clip0_2393_1490",children:(0,v.jsx)("rect",{fill:"white",height:"16",width:"16"})})})]}),oZ=({className:e,size:t=16,...r})=>(0,v.jsx)("div",{className:(0,A.cn)("inline-flex animate-spin items-center justify-center",e),...r,children:(0,v.jsx)(oJ,{size:t})}),oQ=(0,E.default)("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"}]]);var az=a$;let o0=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],o1=new Set(o0),o2=(e,t,r)=>r>t?t:r<e?e:r,o5={test:e=>"number"==typeof e,parse:parseFloat,transform:e=>e},o3={...o5,transform:e=>o2(0,1,e)},o6={...o5,default:1},o8=e=>Math.round(1e5*e)/1e5,o4=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu,o9=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,o7=(e,t)=>r=>!!("string"==typeof r&&o9.test(r)&&r.startsWith(e)||t&&null!=r&&Object.prototype.hasOwnProperty.call(r,t)),le=(e,t,r)=>n=>{if("string"!=typeof n)return n;let[i,s,a,o]=n.match(o4);return{[e]:parseFloat(i),[t]:parseFloat(s),[r]:parseFloat(a),alpha:void 0!==o?parseFloat(o):1}},lt={...o5,transform:e=>Math.round(o2(0,255,e))},lr={test:o7("rgb","red"),parse:le("red","green","blue"),transform:({red:e,green:t,blue:r,alpha:n=1})=>"rgba("+lt.transform(e)+", "+lt.transform(t)+", "+lt.transform(r)+", "+o8(o3.transform(n))+")"},ln={test:o7("#"),parse:function(e){let t="",r="",n="",i="";return e.length>5?(t=e.substring(1,3),r=e.substring(3,5),n=e.substring(5,7),i=e.substring(7,9)):(t=e.substring(1,2),r=e.substring(2,3),n=e.substring(3,4),i=e.substring(4,5),t+=t,r+=r,n+=n,i+=i),{red:parseInt(t,16),green:parseInt(r,16),blue:parseInt(n,16),alpha:i?parseInt(i,16)/255:1}},transform:lr.transform},li=e=>({test:t=>"string"==typeof t&&t.endsWith(e)&&1===t.split(" ").length,parse:parseFloat,transform:t=>`${t}${e}`}),ls=li("deg"),la=li("%"),lo=li("px"),ll=li("vh"),lc=li("vw"),lu={...la,parse:e=>la.parse(e)/100,transform:e=>la.transform(100*e)},ld={test:o7("hsl","hue"),parse:le("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:r,alpha:n=1})=>"hsla("+Math.round(e)+", "+la.transform(o8(t))+", "+la.transform(o8(r))+", "+o8(o3.transform(n))+")"},lh={test:e=>lr.test(e)||ln.test(e)||ld.test(e),parse:e=>lr.test(e)?lr.parse(e):ld.test(e)?ld.parse(e):ln.parse(e),transform:e=>"string"==typeof e?e:e.hasOwnProperty("red")?lr.transform(e):ld.transform(e),getAnimatableNone:e=>{let t=lh.parse(e);return t.alpha=0,lh.transform(t)}},lp=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu,lm="number",lf="color",lg=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function ly(e){let t=e.toString(),r=[],n={color:[],number:[],var:[]},i=[],s=0,a=t.replace(lg,e=>(lh.test(e)?(n.color.push(s),i.push(lf),r.push(lh.parse(e))):e.startsWith("var(")?(n.var.push(s),i.push("var"),r.push(e)):(n.number.push(s),i.push(lm),r.push(parseFloat(e))),++s,"${}")).split("${}");return{values:r,split:a,indexes:n,types:i}}function lx(e){return ly(e).values}function lv(e){let{split:t,types:r}=ly(e),n=t.length;return e=>{let i="";for(let s=0;s<n;s++)if(i+=t[s],void 0!==e[s]){let t=r[s];t===lm?i+=o8(e[s]):t===lf?i+=lh.transform(e[s]):i+=e[s]}return i}}let lb=e=>"number"==typeof e?0:lh.test(e)?lh.getAnimatableNone(e):e,lw={test:function(e){return isNaN(e)&&"string"==typeof e&&(e.match(o4)?.length||0)+(e.match(lp)?.length||0)>0},parse:lx,createTransformer:lv,getAnimatableNone:function(e){let t=lx(e);return lv(e)(t.map(lb))}},lk=new Set(["brightness","contrast","saturate","opacity"]);function lS(e){let[t,r]=e.slice(0,-1).split("(");if("drop-shadow"===t)return e;let[n]=r.match(o4)||[];if(!n)return e;let i=r.replace(n,""),s=+!!lk.has(t);return n!==r&&(s*=100),t+"("+s+i+")"}let lj=/\b([a-z-]*)\(.*?\)/gu,lA={...lw,getAnimatableNone:e=>{let t=e.match(lj);return t?t.map(lS).join(" "):e}},lN={...o5,transform:Math.round},lC={borderWidth:lo,borderTopWidth:lo,borderRightWidth:lo,borderBottomWidth:lo,borderLeftWidth:lo,borderRadius:lo,borderTopLeftRadius:lo,borderTopRightRadius:lo,borderBottomRightRadius:lo,borderBottomLeftRadius:lo,width:lo,maxWidth:lo,height:lo,maxHeight:lo,top:lo,right:lo,bottom:lo,left:lo,inset:lo,insetBlock:lo,insetBlockStart:lo,insetBlockEnd:lo,insetInline:lo,insetInlineStart:lo,insetInlineEnd:lo,padding:lo,paddingTop:lo,paddingRight:lo,paddingBottom:lo,paddingLeft:lo,paddingBlock:lo,paddingBlockStart:lo,paddingBlockEnd:lo,paddingInline:lo,paddingInlineStart:lo,paddingInlineEnd:lo,margin:lo,marginTop:lo,marginRight:lo,marginBottom:lo,marginLeft:lo,marginBlock:lo,marginBlockStart:lo,marginBlockEnd:lo,marginInline:lo,marginInlineStart:lo,marginInlineEnd:lo,fontSize:lo,backgroundPositionX:lo,backgroundPositionY:lo,rotate:ls,rotateX:ls,rotateY:ls,rotateZ:ls,scale:o6,scaleX:o6,scaleY:o6,scaleZ:o6,skew:ls,skewX:ls,skewY:ls,distance:lo,translateX:lo,translateY:lo,translateZ:lo,x:lo,y:lo,z:lo,perspective:lo,transformPerspective:lo,opacity:o3,originX:lu,originY:lu,originZ:lo,zIndex:lN,fillOpacity:o3,strokeOpacity:o3,numOctaves:lN},l_={...lC,color:lh,backgroundColor:lh,outlineColor:lh,fill:lh,stroke:lh,borderColor:lh,borderTopColor:lh,borderRightColor:lh,borderBottomColor:lh,borderLeftColor:lh,filter:lA,WebkitFilter:lA},lT=e=>l_[e],lE=()=>({translate:0,scale:1,origin:0,originPoint:0}),lP=()=>({x:lE(),y:lE()}),lR=()=>({min:0,max:0}),lM=()=>({x:lR(),y:lR()}),lL=e=>!!(e&&e.getVelocity),lI=new Set(["width","height","top","left","right","bottom",...o0]),lD=e=>t=>t.test(e),lO=[o5,lo,la,ls,lc,ll,{test:e=>"auto"===e,parse:e=>e}],lB=e=>lO.find(lD(e)),lF=()=>{},l$=()=>{};eS.default;let lz=e=>t=>"string"==typeof t&&t.startsWith(e),lV=lz("--"),lU=lz("var(--"),lG=e=>!!lU(e)&&lW.test(e.split("/*")[0].trim()),lW=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function lH(e){return"string"==typeof e&&e.split("/*")[0].includes("var(--")}let lq=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u,lK=e=>180*e/Math.PI,lY=e=>lJ(lK(Math.atan2(e[1],e[0]))),lX={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:lY,rotateZ:lY,skewX:e=>lK(Math.atan(e[1])),skewY:e=>lK(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},lJ=e=>((e%=360)<0&&(e+=360),e),lZ=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),lQ=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),l0={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:lZ,scaleY:lQ,scale:e=>(lZ(e)+lQ(e))/2,rotateX:e=>lJ(lK(Math.atan2(e[6],e[5]))),rotateY:e=>lJ(lK(Math.atan2(-e[2],e[0]))),rotateZ:lY,rotate:lY,skewX:e=>lK(Math.atan(e[4])),skewY:e=>lK(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function l1(e){return+!!e.includes("scale")}function l2(e,t){let r,n;if(!e||"none"===e)return l1(t);let i=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);if(i)r=l0,n=i;else{let t=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=lX,n=t}if(!n)return l1(t);let s=r[t],a=n[1].split(",").map(l5);return"function"==typeof s?s(a):a[s]}function l5(e){return parseFloat(e.trim())}let l3=e=>e===o5||e===lo,l6=new Set(["x","y","z"]),l8=o0.filter(e=>!l6.has(e)),l4={width:({x:e},{paddingLeft:t="0",paddingRight:r="0"})=>e.max-e.min-parseFloat(t)-parseFloat(r),height:({y:e},{paddingTop:t="0",paddingBottom:r="0"})=>e.max-e.min-parseFloat(t)-parseFloat(r),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>l2(t,"x"),y:(e,{transform:t})=>l2(t,"y")};l4.translateX=l4.x,l4.translateY=l4.y;let l9=e=>e,l7={},ce=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function ct(e,t){let r=!1,n=!0,i={delta:0,timestamp:0,isProcessing:!1},s=()=>r=!0,a=ce.reduce((e,r)=>(e[r]=function(e,t){let r=new Set,n=new Set,i=!1,s=!1,a=new WeakSet,o={delta:0,timestamp:0,isProcessing:!1},l=0;function c(t){a.has(t)&&(u.schedule(t),e()),l++,t(o)}let u={schedule:(e,t=!1,s=!1)=>{let o=s&&i?r:n;return t&&a.add(e),o.has(e)||o.add(e),e},cancel:e=>{n.delete(e),a.delete(e)},process:e=>{if(o=e,i){s=!0;return}i=!0,[r,n]=[n,r],r.forEach(c),t,l=0,r.clear(),i=!1,s&&(s=!1,u.process(e))}};return u}(s,t?r:void 0),e),{}),{setup:o,read:l,resolveKeyframes:c,preUpdate:u,update:d,preRender:h,render:p,postRender:m}=a,f=()=>{let s=l7.useManualTiming?i.timestamp:performance.now();r=!1,l7.useManualTiming||(i.delta=n?1e3/60:Math.max(Math.min(s-i.timestamp,40),1)),i.timestamp=s,i.isProcessing=!0,o.process(i),l.process(i),c.process(i),u.process(i),d.process(i),h.process(i),p.process(i),m.process(i),i.isProcessing=!1,r&&t&&(n=!1,e(f))};return{schedule:ce.reduce((t,s)=>{let o=a[s];return t[s]=(t,s=!1,a=!1)=>(!r&&(r=!0,n=!0,i.isProcessing||e(f)),o.schedule(t,s,a)),t},{}),cancel:e=>{for(let t=0;t<ce.length;t++)a[ce[t]].cancel(e)},state:i,steps:a}}let{schedule:cr,cancel:cn,state:ci,steps:cs}=ct("u">typeof requestAnimationFrame?requestAnimationFrame:l9,!0),ca=new Set,co=!1,cl=!1,cc=!1;function cu(){if(cl){let e=Array.from(ca).filter(e=>e.needsMeasurement),t=new Set(e.map(e=>e.element)),r=new Map;t.forEach(e=>{let t,n=(t=[],l8.forEach(r=>{let n=e.getValue(r);void 0!==n&&(t.push([r,n.get()]),n.set(+!!r.startsWith("scale")))}),t);n.length&&(r.set(e,n),e.render())}),e.forEach(e=>e.measureInitialState()),t.forEach(e=>{e.render();let t=r.get(e);t&&t.forEach(([t,r])=>{e.getValue(t)?.set(r)})}),e.forEach(e=>e.measureEndState()),e.forEach(e=>{void 0!==e.suspendedScrollY&&window.scrollTo(0,e.suspendedScrollY)})}cl=!1,co=!1,ca.forEach(e=>e.complete(cc)),ca.clear()}function cd(){ca.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(cl=!0)})}class ch{constructor(e,t,r,n,i,s=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=t,this.name=r,this.motionValue=n,this.element=i,this.isAsync=s}scheduleResolve(){this.state="scheduled",this.isAsync?(ca.add(this),co||(co=!0,cr.read(cd),cr.resolveKeyframes(cu))):(this.readKeyframes(),this.complete())}readKeyframes(){let{unresolvedKeyframes:e,name:t,element:r,motionValue:n}=this;if(null===e[0]){let i=n?.get(),s=e[e.length-1];if(void 0!==i)e[0]=i;else if(r&&t){let n=r.readValue(t,s);null!=n&&(e[0]=n)}void 0===e[0]&&(e[0]=s),n&&void 0===i&&n.set(e[0])}for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),ca.delete(this)}cancel(){"scheduled"===this.state&&(ca.delete(this),this.state="pending")}resume(){"pending"===this.state&&this.scheduleResolve()}}function cp(e,t){let r=lT(e);return r!==lA&&(r=lw),r.getAnimatableNone?r.getAnimatableNone(t):void 0}let cm=new Set(["auto","none","0"]);class cf extends ch{constructor(e,t,r,n,i){super(e,t,r,n,i,!0)}readKeyframes(){let{unresolvedKeyframes:e,element:t,name:r}=this;if(!t||!t.current)return;super.readKeyframes();for(let r=0;r<e.length;r++){let n=e[r];if("string"==typeof n&&lG(n=n.trim())){let i=function e(t,r,n=1){l$(n<=4,`Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`,"max-css-var-depth");let[i,s]=function(e){let t=lq.exec(e);if(!t)return[,];let[,r,n,i]=t;return[`--${r??n}`,i]}(t);if(!i)return;let a=window.getComputedStyle(r).getPropertyValue(i);if(a){let e=a.trim();return/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e)?parseFloat(e):e}return lG(s)?e(s,r,n+1):s}(n,t.current);void 0!==i&&(e[r]=i),r===e.length-1&&(this.finalKeyframe=n)}}if(this.resolveNoneKeyframes(),!lI.has(r)||2!==e.length)return;let[n,i]=e,s=lB(n),a=lB(i);if(lH(n)!==lH(i)&&l4[r]){this.needsMeasurement=!0;return}if(s!==a)if(l3(s)&&l3(a))for(let t=0;t<e.length;t++){let r=e[t];"string"==typeof r&&(e[t]=parseFloat(r))}else l4[r]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){let{unresolvedKeyframes:e,name:t}=this,r=[];for(let t=0;t<e.length;t++)(null===e[t]||function(e){if("number"==typeof e)return 0===e;if(null===e)return!0;return"none"===e||"0"===e||/^0[^.\s]+$/u.test(e)}(e[t]))&&r.push(t);r.length&&function(e,t,r){let n,i=0;for(;i<e.length&&!n;){let t=e[i];"string"==typeof t&&!cm.has(t)&&ly(t).values.length&&(n=e[i]),i++}if(n&&r)for(let i of t)e[i]=cp(r,n)}(e,r,t)}measureInitialState(){let{element:e,unresolvedKeyframes:t,name:r}=this;if(!e||!e.current)return;"height"===r&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=l4[r](e.measureViewportBox(),window.getComputedStyle(e.current)),t[0]=this.measuredOrigin;let n=t[t.length-1];void 0!==n&&e.getValue(r,n).jump(n,!1)}measureEndState(){let{element:e,name:t,unresolvedKeyframes:r}=this;if(!e||!e.current)return;let n=e.getValue(t);n&&n.jump(this.measuredOrigin,!1);let i=r.length-1,s=r[i];r[i]=l4[t](e.measureViewportBox(),window.getComputedStyle(e.current)),null!==s&&void 0===this.finalKeyframe&&(this.finalKeyframe=s),this.removedTransforms?.length&&this.removedTransforms.forEach(([t,r])=>{e.getValue(t).set(r)}),this.resolveNoneKeyframes()}}function cg(e,t){-1===e.indexOf(t)&&e.push(t)}function cy(e,t){let r=e.indexOf(t);r>-1&&e.splice(r,1)}class cx{constructor(){this.subscriptions=[]}add(e){return cg(this.subscriptions,e),()=>cy(this.subscriptions,e)}notify(e,t,r){let n=this.subscriptions.length;if(n)if(1===n)this.subscriptions[0](e,t,r);else for(let i=0;i<n;i++){let n=this.subscriptions[i];n&&n(e,t,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}let{schedule:cv}=ct(queueMicrotask,!1);function cb(){n=void 0}let cw={now:()=>(void 0===n&&cw.set(ci.isProcessing||l7.useManualTiming?ci.timestamp:performance.now()),n),set:e=>{n=e,queueMicrotask(cb)}};class ck{constructor(e,t={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=e=>{let t=cw.now();if(this.updatedAt!==t&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(e),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(let e of this.dependents)e.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=t.owner}setCurrent(e){this.current=e,this.updatedAt=cw.now(),null===this.canTrackVelocity&&void 0!==e&&(this.canTrackVelocity=!isNaN(parseFloat(this.current)))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on("change",e)}on(e,t){this.events[e]||(this.events[e]=new cx);let r=this.events[e].add(t);return"change"===e?()=>{r(),cr.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(let e in this.events)this.events[e].clear()}attach(e,t){this.passiveEffect=e,this.stopPassiveEffect=t}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,t,r){this.set(t),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-r}jump(e,t=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,t&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(e){this.dependents||(this.dependents=new Set),this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return d&&d.push(this),this.current}getPrevious(){return this.prev}getVelocity(){var e;let t=cw.now();if(!this.canTrackVelocity||void 0===this.prevFrameValue||t-this.updatedAt>30)return 0;let r=Math.min(this.updatedAt-this.prevUpdatedAt,30);return e=parseFloat(this.current)-parseFloat(this.prevFrameValue),r?1e3/r*e:0}start(e){return this.stop(),new Promise(t=>{this.hasAnimated=!0,this.animation=e(t),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function cS(e,t){return new ck(e,t)}let cj=[...lO,lh,lw],cA={current:null},cN={current:!1},cC="u">typeof window,c_=new WeakMap;function cT(e){return null!==e&&"object"==typeof e&&"function"==typeof e.start}function cE(e){return"string"==typeof e||Array.isArray(e)}let cP=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],cR=["initial",...cP];function cM(e){return cT(e.animate)||cR.some(t=>cE(e[t]))}function cL(e){return!!(cM(e)||e.variants)}function cI(e){let t=[{},{}];return e?.values.forEach((e,r)=>{t[0][r]=e.get(),t[1][r]=e.getVelocity()}),t}function cD(e,t,r,n){if("function"==typeof t){let[i,s]=cI(n);t=t(void 0!==r?r:e.custom,i,s)}if("string"==typeof t&&(t=e.variants&&e.variants[t]),"function"==typeof t){let[i,s]=cI(n);t=t(void 0!==r?r:e.custom,i,s)}return t}let cO=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"],cB={};class cF{scrapeMotionValuesFromProps(e,t,r){return{}}constructor({parent:e,props:t,presenceContext:r,reducedMotionConfig:n,blockInitialAnimation:i,visualState:s},a={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=ch,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{let e=cw.now();this.renderScheduledAt<e&&(this.renderScheduledAt=e,cr.render(this.render,!1,!0))};const{latestValues:o,renderState:l}=s;this.latestValues=o,this.baseTarget={...o},this.initialValues=t.initial?{...o}:{},this.renderState=l,this.parent=e,this.props=t,this.presenceContext=r,this.depth=e?e.depth+1:0,this.reducedMotionConfig=n,this.options=a,this.blockInitialAnimation=!!i,this.isControllingVariants=cM(t),this.isVariantNode=cL(t),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:c,...u}=this.scrapeMotionValuesFromProps(t,{},this);for(const e in u){const t=u[e];void 0!==o[e]&&lL(t)&&t.set(o[e])}}mount(e){this.current=e,c_.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((e,t)=>this.bindToMotionValue(t,e)),"never"===this.reducedMotionConfig?this.shouldReduceMotion=!1:"always"===this.reducedMotionConfig?this.shouldReduceMotion=!0:(cN.current||function(){if(cN.current=!0,cC)if(window.matchMedia){let e=window.matchMedia("(prefers-reduced-motion)"),t=()=>cA.current=e.matches;e.addEventListener("change",t),t()}else cA.current=!1}(),this.shouldReduceMotion=cA.current),this.parent?.addChild(this),this.update(this.props,this.presenceContext)}unmount(){for(let e in this.projection&&this.projection.unmount(),cn(this.notifyUpdate),cn(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this),this.events)this.events[e].clear();for(let e in this.features){let t=this.features[e];t&&(t.unmount(),t.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,t){let r;this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)();let n=o1.has(e);n&&this.onBindTransform&&this.onBindTransform();let i=t.on("change",t=>{this.latestValues[e]=t,this.props.onUpdate&&cr.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});"u">typeof window&&window.MotionCheckAppearSync&&(r=window.MotionCheckAppearSync(this,e,t)),this.valueSubscriptions.set(e,()=>{i(),r&&r(),t.owner&&t.stop()})}sortNodePosition(e){return this.current&&this.sortInstanceNodePosition&&this.type===e.type?this.sortInstanceNodePosition(this.current,e.current):0}updateFeatures(){let e="animation";for(e in cB){let t=cB[e];if(!t)continue;let{isEnabled:r,Feature:n}=t;if(!this.features[e]&&n&&r(this.props)&&(this.features[e]=new n(this)),this.features[e]){let t=this.features[e];t.isMounted?t.update():(t.mount(),t.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):lM()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,t){this.latestValues[e]=t}update(e,t){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=t;for(let t=0;t<cO.length;t++){let r=cO[t];this.propEventSubscriptions[r]&&(this.propEventSubscriptions[r](),delete this.propEventSubscriptions[r]);let n=e["on"+r];n&&(this.propEventSubscriptions[r]=this.on(r,n))}this.prevMotionValues=function(e,t,r){for(let n in t){let i=t[n],s=r[n];if(lL(i))e.addValue(n,i);else if(lL(s))e.addValue(n,cS(i,{owner:e}));else if(s!==i)if(e.hasValue(n)){let t=e.getValue(n);!0===t.liveStyle?t.jump(i):t.hasAnimated||t.set(i)}else{let t=e.getStaticValue(n);e.addValue(n,cS(void 0!==t?t:i,{owner:e}))}}for(let n in r)void 0===t[n]&&e.removeValue(n);return t}(this,this.scrapeMotionValuesFromProps(e,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(e){let t=this.getClosestVariantNode();if(t)return t.variantChildren&&t.variantChildren.add(e),()=>t.variantChildren.delete(e)}addValue(e,t){let r=this.values.get(e);t!==r&&(r&&this.removeValue(e),this.bindToMotionValue(e,t),this.values.set(e,t),this.latestValues[e]=t.get())}removeValue(e){this.values.delete(e);let t=this.valueSubscriptions.get(e);t&&(t(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,t){if(this.props.values&&this.props.values[e])return this.props.values[e];let r=this.values.get(e);return void 0===r&&void 0!==t&&(r=cS(null===t?void 0:t,{owner:this}),this.addValue(e,r)),r}readValue(e,t){let r=void 0===this.latestValues[e]&&this.current?this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options):this.latestValues[e];if(null!=r){let n,i;if("string"==typeof r&&(n=r,/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(n)||(i=r,/^0[^.\s]+$/u.test(i))))r=parseFloat(r);else{let n;n=r,!cj.find(lD(n))&&lw.test(t)&&(r=cp(e,t))}this.setBaseTarget(e,lL(r)?r.get():r)}return lL(r)?r.get():r}setBaseTarget(e,t){this.baseTarget[e]=t}getBaseTarget(e){let t,{initial:r}=this.props;if("string"==typeof r||"object"==typeof r){let n=cD(this.props,r,this.presenceContext?.custom);n&&(t=n[e])}if(r&&void 0!==t)return t;let n=this.getBaseTargetFromProps(this.props,e);return void 0===n||lL(n)?void 0!==this.initialValues[e]&&void 0===t?void 0:this.baseTarget[e]:n}on(e,t){return this.events[e]||(this.events[e]=new cx),this.events[e].add(t)}notify(e,...t){this.events[e]&&this.events[e].notify(...t)}scheduleRenderMicrotask(){cv.render(this.render)}}class c$ extends cF{constructor(){super(...arguments),this.KeyframeResolver=cf}sortInstanceNodePosition(e,t){return 2&e.compareDocumentPosition(t)?1:-1}getBaseTargetFromProps(e,t){let r=e.style;return r?r[t]:void 0}removeValueFromRenderState(e,{vars:t,style:r}){delete t[e],delete r[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);let{children:e}=this.props;lL(e)&&(this.childSubscription=e.on("change",e=>{this.current&&(this.current.textContent=`${e}`)}))}}function cz(e){return e.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`)}let cV=(e,t)=>t&&"number"==typeof e?t.transform(e):e,cU={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},cG=o0.length;function cW(e,t,r){let{style:n,vars:i,transformOrigin:s}=e,a=!1,o=!1;for(let e in t){let r=t[e];if(o1.has(e)){a=!0;continue}if(lV(e)){i[e]=r;continue}{let t=cV(r,lC[e]);e.startsWith("origin")?(o=!0,s[e]=t):n[e]=t}}if(!t.transform&&(a||r?n.transform=function(e,t,r){let n="",i=!0;for(let s=0;s<cG;s++){let a=o0[s],o=e[a];if(void 0===o)continue;let l=!0;if("number"==typeof o)l=o===+!!a.startsWith("scale");else{let e=parseFloat(o);l=a.startsWith("scale")?1===e:0===e}if(!l||r){let e=cV(o,lC[a]);if(!l){i=!1;let t=cU[a]||a;n+=`${t}(${e}) `}r&&(t[a]=e)}}return n=n.trim(),r?n=r(t,i?"":n):i&&(n="none"),n}(t,e.transform,r):n.transform&&(n.transform="none")),o){let{originX:e="50%",originY:t="50%",originZ:r=0}=s;n.transformOrigin=`${e} ${t} ${r}`}}let cH={offset:"stroke-dashoffset",array:"stroke-dasharray"},cq={offset:"strokeDashoffset",array:"strokeDasharray"},cK=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function cY(e,{attrX:t,attrY:r,attrScale:n,pathLength:i,pathSpacing:s=1,pathOffset:a=0,...o},l,c,u){if(cW(e,o,c),l){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};let{attrs:d,style:h}=e;for(let e of(d.transform&&(h.transform=d.transform,delete d.transform),(h.transform||d.transformOrigin)&&(h.transformOrigin=d.transformOrigin??"50% 50%",delete d.transformOrigin),h.transform&&(h.transformBox=u?.transformBox??"fill-box",delete d.transformBox),cK))void 0!==d[e]&&(h[e]=d[e],delete d[e]);void 0!==t&&(d.x=t),void 0!==r&&(d.y=r),void 0!==n&&(d.scale=n),void 0!==i&&function(e,t,r=1,n=0,i=!0){e.pathLength=1;let s=i?cH:cq;e[s.offset]=`${-n}`,e[s.array]=`${t} ${r}`}(d,i,s,a,!1)}let cX=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]),cJ=e=>"string"==typeof e&&"svg"===e.toLowerCase();function cZ(e,{style:t,vars:r},n,i){let s,a=e.style;for(s in t)a[s]=t[s];for(s in i?.applyProjectionStyles(a,n),r)a.setProperty(s,r[s])}function cQ(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}let c0={correct:(e,t)=>{if(!t.target)return e;if("string"==typeof e)if(!lo.test(e))return e;else e=parseFloat(e);let r=cQ(e,t.target.x),n=cQ(e,t.target.y);return`${r}% ${n}%`}},c1=(e,t,r)=>e+(t-e)*r,c2={borderRadius:{...c0,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:c0,borderTopRightRadius:c0,borderBottomLeftRadius:c0,borderBottomRightRadius:c0,boxShadow:{correct:(e,{treeScale:t,projectionDelta:r})=>{let n=lw.parse(e);if(n.length>5)return e;let i=lw.createTransformer(e),s=+("number"!=typeof n[0]),a=r.x.scale*t.x,o=r.y.scale*t.y;n[0+s]/=a,n[1+s]/=o;let l=c1(a,o,.5);return"number"==typeof n[2+s]&&(n[2+s]/=l),"number"==typeof n[3+s]&&(n[3+s]/=l),i(n)}}};function c5(e,{layout:t,layoutId:r}){return o1.has(e)||e.startsWith("origin")||(t||void 0!==r)&&(!!c2[e]||"opacity"===e)}function c3(e,t,r){let n=e.style,i=t?.style,s={};if(!n)return s;for(let t in n)(lL(n[t])||i&&lL(i[t])||c5(t,e)||r?.getValue(t)?.liveStyle!==void 0)&&(s[t]=n[t]);return s}function c6(e,t,r){let n=c3(e,t,r);for(let r in e)(lL(e[r])||lL(t[r]))&&(n[-1!==o0.indexOf(r)?"attr"+r.charAt(0).toUpperCase()+r.substring(1):r]=e[r]);return n}class c8 extends c${constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=lM}getBaseTargetFromProps(e,t){return e[t]}readValueFromInstance(e,t){if(o1.has(t)){let e=lT(t);return e&&e.default||0}return t=cX.has(t)?t:cz(t),e.getAttribute(t)}scrapeMotionValuesFromProps(e,t,r){return c6(e,t,r)}build(e,t,r){cY(e,t,this.isSVGTag,r.transformTemplate,r.style)}renderInstance(e,t,r,n){for(let r in cZ(e,t,void 0,n),t.attrs)e.setAttribute(cX.has(r)?r:cz(r),t.attrs[r])}mount(e){this.isSVGTag=cJ(e.tagName),super.mount(e)}}function c4({top:e,left:t,right:r,bottom:n}){return{x:{min:t,max:r},y:{min:e,max:n}}}function c9(e){return void 0===e||1===e}function c7({scale:e,scaleX:t,scaleY:r}){return!c9(e)||!c9(t)||!c9(r)}function ue(e){return c7(e)||ut(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function ut(e){var t,r;return(t=e.x)&&"0%"!==t||(r=e.y)&&"0%"!==r}function ur(e,t,r,n,i){return void 0!==i&&(e=n+i*(e-n)),n+r*(e-n)+t}function un(e,t=0,r=1,n,i){e.min=ur(e.min,t,r,n,i),e.max=ur(e.max,t,r,n,i)}function ui(e,{x:t,y:r}){un(e.x,t.translate,t.scale,t.originPoint),un(e.y,r.translate,r.scale,r.originPoint)}function us(e,t){e.min=e.min+t,e.max=e.max+t}function ua(e,t,r,n,i=.5){let s=c1(e.min,e.max,i);un(e,t,r,s,n)}function uo(e,t){ua(e.x,t.x,t.scaleX,t.scale,t.originX),ua(e.y,t.y,t.scaleY,t.scale,t.originY)}function ul(e,t){return c4(function(e,t){if(!t)return e;let r=t({x:e.left,y:e.top}),n=t({x:e.right,y:e.bottom});return{top:r.y,left:r.x,bottom:n.y,right:n.x}}(e.getBoundingClientRect(),t))}class uc extends c${constructor(){super(...arguments),this.type="html",this.renderInstance=cZ}readValueFromInstance(e,t){if(o1.has(t))return this.projection?.isProjecting?l1(t):((e,t)=>{let{transform:r="none"}=getComputedStyle(e);return l2(r,t)})(e,t);{let r=window.getComputedStyle(e),n=(lV(t)?r.getPropertyValue(t):r[t])||0;return"string"==typeof n?n.trim():n}}measureInstanceViewportBox(e,{transformPagePoint:t}){return ul(e,t)}build(e,t,r){cW(e,t,r.transformTemplate)}scrapeMotionValuesFromProps(e,t,r){return c3(e,t,r)}}let uu=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function ud(e){if("string"!=typeof e||e.includes("-"));else if(uu.indexOf(e)>-1||/[A-Z]/u.test(e))return!0;return!1}let uh=(0,b.createContext)({}),up=(0,b.createContext)({strict:!1}),um=(0,b.createContext)({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"}),uf=(0,b.createContext)({});function ug(e){return Array.isArray(e)?e.join(" "):e}let uy=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function ux(e,t,r){for(let n in t)lL(t[n])||c5(n,r)||(e[n]=t[n])}let uv=()=>({...uy(),attrs:{}}),ub=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function uw(e){return e.startsWith("while")||e.startsWith("drag")&&"draggable"!==e||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||ub.has(e)}let uk=e=>!uw(e);try{g=(()=>{let e=Error("Cannot find module '@emotion/is-prop-valid'");throw e.code="MODULE_NOT_FOUND",e})().default,"function"==typeof g&&(uk=e=>e.startsWith("on")?!uw(e):g(e))}catch{}function uS(e){return lL(e)?e.get():e}let uj=(0,b.createContext)(null),uA=e=>(t,r)=>{let n,i=(0,b.useContext)(uf),s=(0,b.useContext)(uj),a=()=>(function({scrapeMotionValuesFromProps:e,createRenderState:t},r,n,i){return{latestValues:function(e,t,r,n){let i={},s=n(e,{});for(let e in s)i[e]=uS(s[e]);let{initial:a,animate:o}=e,l=cM(e),c=cL(e);t&&c&&!l&&!1!==e.inherit&&(void 0===a&&(a=t.initial),void 0===o&&(o=t.animate));let u=!!r&&!1===r.initial,d=(u=u||!1===a)?o:a;if(d&&"boolean"!=typeof d&&!cT(d)){let t=Array.isArray(d)?d:[d];for(let r=0;r<t.length;r++){let n=cD(e,t[r]);if(n){let{transitionEnd:e,transition:t,...r}=n;for(let e in r){let t=r[e];if(Array.isArray(t)){let e=u?t.length-1:0;t=t[e]}null!==t&&(i[e]=t)}for(let t in e)i[t]=e[t]}}}return i}(r,n,i,e),renderState:t()}})(e,t,i,s);return r?a():(null===(n=(0,b.useRef)(null)).current&&(n.current=a()),n.current)},uN=uA({scrapeMotionValuesFromProps:c3,createRenderState:uy}),uC=uA({scrapeMotionValuesFromProps:c6,createRenderState:uv}),u_="u">typeof window,uT={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},uE=!1;function uP(){return!function(){if(uE)return;let e={};for(let t in uT)e[t]={isEnabled:e=>uT[t].some(t=>!!e[t])};cB=e,uE=!0}(),cB}let uR=Symbol.for("motionComponentSymbol"),uM="data-"+cz("framerAppearId"),uL=(0,b.createContext)({});function uI(e){return e&&"object"==typeof e&&Object.prototype.hasOwnProperty.call(e,"current")}let uD=u_?b.useLayoutEffect:b.useEffect;function uO(e,{forwardMotionProps:t=!1,type:r}={},n,i){n&&function(e){let t=uP();for(let r in e)t[r]={...t[r],...e[r]};cB=t}(n);let s=r?"svg"===r:ud(e),a=s?uC:uN;function o(r,n){var o;let l,c,u,d={...(0,b.useContext)(um),...r,layoutId:function({layoutId:e}){let t=(0,b.useContext)(uh).id;return t&&void 0!==e?t+"-"+e:e}(r)},{isStatic:h}=d,p=function(e){let{initial:t,animate:r}=function(e,t){if(cM(e)){let{initial:t,animate:r}=e;return{initial:!1===t||cE(t)?t:void 0,animate:cE(r)?r:void 0}}return!1!==e.inherit?t:{}}(e,(0,b.useContext)(uf));return(0,b.useMemo)(()=>({initial:t,animate:r}),[ug(t),ug(r)])}(r),m=a(r,h);if(!h&&u_){(0,b.useContext)(up).strict;let t=function(e){let{drag:t,layout:r}=uP();if(!t&&!r)return{};let n={...t,...r};return{MeasureLayout:t?.isEnabled(e)||r?.isEnabled(e)?n.MeasureLayout:void 0,ProjectionNode:n.ProjectionNode}}(d);l=t.MeasureLayout,p.visualElement=function(e,t,r,n,i,s){let{visualElement:a}=(0,b.useContext)(uf),o=(0,b.useContext)(up),l=(0,b.useContext)(uj),c=(0,b.useContext)(um).reducedMotion,u=(0,b.useRef)(null),d=(0,b.useRef)(!1);n=n||o.renderer,!u.current&&n&&(u.current=n(e,{visualState:t,parent:a,props:r,presenceContext:l,blockInitialAnimation:!!l&&!1===l.initial,reducedMotionConfig:c,isSVG:s}),d.current&&u.current&&(u.current.manuallyAnimateOnMount=!0));let h=u.current,p=(0,b.useContext)(uL);h&&!h.projection&&i&&("html"===h.type||"svg"===h.type)&&function(e,t,r,n){let{layoutId:i,layout:s,drag:a,dragConstraints:o,layoutScroll:l,layoutRoot:c,layoutCrossfade:u}=t;e.projection=new r(e.latestValues,t["data-framer-portal-id"]?void 0:function e(t){if(t)return!1!==t.options.allowProjection?t.projection:e(t.parent)}(e.parent)),e.projection.setOptions({layoutId:i,layout:s,alwaysMeasureLayout:!!a||o&&uI(o),visualElement:e,animationType:"string"==typeof s?s:"both",initialPromotionConfig:n,crossfade:u,layoutScroll:l,layoutRoot:c})}(u.current,r,i,p);let m=(0,b.useRef)(!1);(0,b.useInsertionEffect)(()=>{h&&m.current&&h.update(r,l)});let f=r[uM],g=(0,b.useRef)(!!f&&!window.MotionHandoffIsComplete?.(f)&&window.MotionHasOptimisedAnimation?.(f));return uD(()=>{d.current=!0,h&&(m.current=!0,window.MotionIsMounted=!0,h.updateFeatures(),h.scheduleRenderMicrotask(),g.current&&h.animationState&&h.animationState.animateChanges())}),(0,b.useEffect)(()=>{h&&(!g.current&&h.animationState&&h.animationState.animateChanges(),g.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(f)}),g.current=!1),h.enteringChildren=void 0)}),h}(e,m,d,i,t.ProjectionNode,s)}return(0,v.jsxs)(uf.Provider,{value:p,children:[l&&p.visualElement?(0,v.jsx)(l,{visualElement:p.visualElement,...d}):null,function(e,t,r,{latestValues:n},i,s=!1,a){let o=(a??ud(e)?function(e,t,r,n){let i=(0,b.useMemo)(()=>{let r=uv();return cY(r,t,cJ(n),e.transformTemplate,e.style),{...r.attrs,style:{...r.style}}},[t]);if(e.style){let t={};ux(t,e.style,e),i.style={...t,...i.style}}return i}:function(e,t){let r,n,i={},s=(r=e.style||{},ux(n={},r,e),Object.assign(n,function({transformTemplate:e},t){return(0,b.useMemo)(()=>{let r=uy();return cW(r,t,e),Object.assign({},r.vars,r.style)},[t])}(e,t)),n);return e.drag&&!1!==e.dragListener&&(i.draggable=!1,s.userSelect=s.WebkitUserSelect=s.WebkitTouchCallout="none",s.touchAction=!0===e.drag?"none":`pan-${"x"===e.drag?"y":"x"}`),void 0===e.tabIndex&&(e.onTap||e.onTapStart||e.whileTap)&&(i.tabIndex=0),i.style=s,i})(t,n,i,e),l=function(e,t,r){let n={};for(let i in e)("values"!==i||"object"!=typeof e.values)&&(uk(i)||!0===r&&uw(i)||!t&&!uw(i)||e.draggable&&i.startsWith("onDrag"))&&(n[i]=e[i]);return n}(t,"string"==typeof e,s),c=e!==b.Fragment?{...l,...o,ref:r}:{},{children:u}=t,d=(0,b.useMemo)(()=>lL(u)?u.get():u,[u]);return(0,b.createElement)(e,{...c,children:d})}(e,r,(o=p.visualElement,c=(0,b.useRef)(n),(0,b.useInsertionEffect)(()=>{c.current=n}),u=(0,b.useRef)(null),(0,b.useCallback)(e=>{e&&m.onMount?.(e),o&&(e?o.mount(e):o.unmount());let t=c.current;if("function"==typeof t)if(e){let r=t(e);"function"==typeof r&&(u.current=r)}else u.current?(u.current(),u.current=null):t(e);else t&&(t.current=e)},[o])),m,h,t,s)]})}o.displayName=`motion.${"string"==typeof e?e:`create(${e.displayName??e.name??""})`}`;let l=(0,b.forwardRef)(o);return l[uR]=e,l}class uB{constructor(e){this.isMounted=!1,this.node=e}update(){}}function uF(e,t,r){let n=e.getProps();return cD(n,t,void 0!==r?r:n.custom,e)}function u$(e,t){return e?.[t]??e?.default??e}let uz=e=>Array.isArray(e);function uV(e,t){let r=e.getValue("willChange");if(lL(r)&&r.add)return r.add(t);if(!r&&l7.WillChange){let r=new l7.WillChange("auto");e.addValue("willChange",r),r.add(t)}}let uU=e=>1e3*e,uG=(e,t)=>r=>t(e(r)),uW=(...e)=>e.reduce(uG),uH={layout:0,mainThread:0,waapi:0};function uq(e,t,r){return(r<0&&(r+=1),r>1&&(r-=1),r<1/6)?e+(t-e)*6*r:r<.5?t:r<2/3?e+(t-e)*(2/3-r)*6:e}function uK(e,t){return r=>r>0?t:e}let uY=(e,t,r)=>{let n=e*e,i=r*(t*t-n)+n;return i<0?0:Math.sqrt(i)},uX=[ln,lr,ld];function uJ(e){let t=uX.find(t=>t.test(e));if(lF(!!t,`'${e}' is not an animatable color. Use the equivalent color code instead.`,"color-not-animatable"),!t)return!1;let r=t.parse(e);return t===ld&&(r=function({hue:e,saturation:t,lightness:r,alpha:n}){e/=360,r/=100;let i=0,s=0,a=0;if(t/=100){let n=r<.5?r*(1+t):r+t-r*t,o=2*r-n;i=uq(o,n,e+1/3),s=uq(o,n,e),a=uq(o,n,e-1/3)}else i=s=a=r;return{red:Math.round(255*i),green:Math.round(255*s),blue:Math.round(255*a),alpha:n}}(r)),r}let uZ=(e,t)=>{let r=uJ(e),n=uJ(t);if(!r||!n)return uK(e,t);let i={...r};return e=>(i.red=uY(r.red,n.red,e),i.green=uY(r.green,n.green,e),i.blue=uY(r.blue,n.blue,e),i.alpha=c1(r.alpha,n.alpha,e),lr.transform(i))},uQ=new Set(["none","hidden"]);function u0(e,t){return r=>c1(e,t,r)}function u1(e){return"number"==typeof e?u0:"string"==typeof e?lG(e)?uK:lh.test(e)?uZ:u3:Array.isArray(e)?u2:"object"==typeof e?lh.test(e)?uZ:u5:uK}function u2(e,t){let r=[...e],n=r.length,i=e.map((e,r)=>u1(e)(e,t[r]));return e=>{for(let t=0;t<n;t++)r[t]=i[t](e);return r}}function u5(e,t){let r={...e,...t},n={};for(let i in r)void 0!==e[i]&&void 0!==t[i]&&(n[i]=u1(e[i])(e[i],t[i]));return e=>{for(let t in n)r[t]=n[t](e);return r}}let u3=(e,t)=>{let r=lw.createTransformer(t),n=ly(e),i=ly(t);if(!(n.indexes.var.length===i.indexes.var.length&&n.indexes.color.length===i.indexes.color.length&&n.indexes.number.length>=i.indexes.number.length))return lF(!0,`Complex values '${e}' and '${t}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`,"complex-values-different"),uK(e,t);if(uQ.has(e)&&!i.values.length||uQ.has(t)&&!n.values.length)return uQ.has(e)?r=>r<=0?e:t:r=>r>=1?t:e;return uW(u2(function(e,t){let r=[],n={color:0,var:0,number:0};for(let i=0;i<t.values.length;i++){let s=t.types[i],a=e.indexes[s][n[s]],o=e.values[a]??0;r[i]=o,n[s]++}return r}(n,i),i.values),r)};function u6(e,t,r){return"number"==typeof e&&"number"==typeof t&&"number"==typeof r?c1(e,t,r):u1(e)(e,t)}let u8=e=>{let t=({timestamp:t})=>e(t);return{start:(e=!0)=>cr.update(t,e),stop:()=>cn(t),now:()=>ci.isProcessing?ci.timestamp:cw.now()}},u4=(e,t,r=10)=>{let n="",i=Math.max(Math.round(t/r),2);for(let t=0;t<i;t++)n+=Math.round(1e4*e(t/(i-1)))/1e4+", ";return`linear(${n.substring(0,n.length-2)})`};function u9(e){let t=0,r=e.next(t);for(;!r.done&&t<2e4;)t+=50,r=e.next(t);return t>=2e4?1/0:t}function u7(e,t,r){var n,i;let s=Math.max(t-5,0);return n=r-e(s),(i=t-s)?1e3/i*n:0}let de=.01,dt=2,dr=.005,dn=.5;function di(e,t){return e*Math.sqrt(1-t*t)}let ds=["duration","bounce"],da=["stiffness","damping","mass"];function dl(e,t){return t.some(t=>void 0!==e[t])}function dc(e=.3,t=.3){let r,n="object"!=typeof e?{visualDuration:e,keyframes:[0,1],bounce:t}:e,{restSpeed:i,restDelta:s}=n,a=n.keyframes[0],o=n.keyframes[n.keyframes.length-1],l={done:!1,value:a},{stiffness:c,damping:u,mass:d,duration:h,velocity:p,isResolvedFromDuration:m}=function(e){let t={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...e};if(!dl(e,da)&&dl(e,ds))if(e.visualDuration){let r=2*Math.PI/(1.2*e.visualDuration),n=r*r,i=2*o2(.05,1,1-(e.bounce||0))*Math.sqrt(n);t={...t,mass:1,stiffness:n,damping:i}}else{let r=function({duration:e=800,bounce:t=.3,velocity:r=0,mass:n=1}){let i,s;lF(e<=uU(10),"Spring duration must be 10 seconds or less","spring-duration-limit");let a=1-t;a=o2(.05,1,a),e=o2(.01,10,e/1e3),a<1?(i=t=>{let n=t*a,i=n*e;return .001-(n-r)/di(t,a)*Math.exp(-i)},s=t=>{let n=t*a*e,s=Math.pow(a,2)*Math.pow(t,2)*e,o=Math.exp(-n),l=di(Math.pow(t,2),a);return(n*r+r-s)*o*(-i(t)+.001>0?-1:1)/l}):(i=t=>-.001+Math.exp(-t*e)*((t-r)*e+1),s=t=>e*e*(r-t)*Math.exp(-t*e));let o=function(e,t,r){let n=r;for(let r=1;r<12;r++)n-=e(n)/t(n);return n}(i,s,5/e);if(e=uU(e),isNaN(o))return{stiffness:100,damping:10,duration:e};{let t=Math.pow(o,2)*n;return{stiffness:t,damping:2*a*Math.sqrt(n*t),duration:e}}}(e);(t={...t,...r,mass:1}).isResolvedFromDuration=!0}return t}({...n,velocity:-((n.velocity||0)/1e3)}),f=p||0,g=u/(2*Math.sqrt(c*d)),y=o-a,x=Math.sqrt(c/d)/1e3,v=5>Math.abs(y);if(i||(i=v?de:dt),s||(s=v?dr:dn),g<1){let e=di(x,g);r=t=>o-Math.exp(-g*x*t)*((f+g*x*y)/e*Math.sin(e*t)+y*Math.cos(e*t))}else if(1===g)r=e=>o-Math.exp(-x*e)*(y+(f+x*y)*e);else{let e=x*Math.sqrt(g*g-1);r=t=>{let r=Math.exp(-g*x*t),n=Math.min(e*t,300);return o-r*((f+g*x*y)*Math.sinh(n)+e*y*Math.cosh(n))/e}}let b={calculatedDuration:m&&h||null,next:e=>{let t=r(e);if(m)l.done=e>=h;else{let n=0===e?f:0;g<1&&(n=0===e?uU(f):u7(r,e,t));let a=Math.abs(o-t)<=s;l.done=Math.abs(n)<=i&&a}return l.value=l.done?o:t,l},toString:()=>{let e=Math.min(u9(b),2e4),t=u4(t=>b.next(e*t).value,e,30);return e+"ms "+t},toTransition:()=>{}};return b}function du({keyframes:e,velocity:t=0,power:r=.8,timeConstant:n=325,bounceDamping:i=10,bounceStiffness:s=500,modifyTarget:a,min:o,max:l,restDelta:c=.5,restSpeed:u}){let d,h,p=e[0],m={done:!1,value:p},f=r*t,g=p+f,y=void 0===a?g:a(g);y!==g&&(f=y-p);let x=e=>-f*Math.exp(-e/n),v=e=>y+x(e),b=e=>{let t=x(e),r=v(e);m.done=Math.abs(t)<=c,m.value=m.done?y:r},w=e=>{let t;if(t=m.value,void 0!==o&&t<o||void 0!==l&&t>l){var r;d=e,h=dc({keyframes:[m.value,(r=m.value,void 0===o?l:void 0===l||Math.abs(o-r)<Math.abs(l-r)?o:l)],velocity:u7(v,e,m.value),damping:i,stiffness:s,restDelta:c,restSpeed:u})}};return w(0),{calculatedDuration:null,next:e=>{let t=!1;return(h||void 0!==d||(t=!0,b(e),w(e)),void 0!==d&&e>=d)?h.next(e-d):(t||b(e),m)}}}dc.applyToOptions=e=>{let t=function(e,t=100,r){let n=r({...e,keyframes:[0,t]}),i=Math.min(u9(n),2e4);return{type:"keyframes",ease:e=>n.next(i*e).value/t,duration:i/1e3}}(e,100,dc);return e.ease=t.ease,e.duration=uU(t.duration),e.type="keyframes",e};let dd=(e,t,r)=>(((1-3*r+3*t)*e+(3*r-6*t))*e+3*t)*e;function dh(e,t,r,n){return e===t&&r===n?l9:i=>0===i||1===i?i:dd(function(e,t,r,n,i){let s,a,o=0;do(s=dd(a=t+(r-t)/2,n,i)-e)>0?r=a:t=a;while(Math.abs(s)>1e-7&&++o<12)return a}(i,0,1,e,r),t,n)}let dp=dh(.42,0,1,1),dm=dh(0,0,.58,1),df=dh(.42,0,.58,1),dg=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,dy=e=>t=>1-e(1-t),dx=dh(.33,1.53,.69,.99),dv=dy(dx),db=dg(dv),dw=e=>(e*=2)<1?.5*dv(e):.5*(2-Math.pow(2,-10*(e-1))),dk=e=>1-Math.sin(Math.acos(e)),dS=dy(dk),dj=dg(dk),dA=e=>Array.isArray(e)&&"number"==typeof e[0],dN={linear:l9,easeIn:dp,easeInOut:df,easeOut:dm,circIn:dk,circInOut:dj,circOut:dS,backIn:dv,backInOut:db,backOut:dx,anticipate:dw},dC=e=>{if(dA(e)){l$(4===e.length,"Cubic bezier arrays must contain four numerical values.","cubic-bezier-length");let[t,r,n,i]=e;return dh(t,r,n,i)}return"string"==typeof e?(l$(void 0!==dN[e],`Invalid easing type '${e}'`,"invalid-easing-type"),dN[e]):e},d_=(e,t,r)=>{let n=t-e;return 0===n?1:(r-e)/n};function dT({duration:e=300,keyframes:t,times:r,ease:n="easeInOut"}){var i;let s,a=Array.isArray(n)&&"number"!=typeof n[0]?n.map(dC):dC(n),o={done:!1,value:t[0]},l=function(e,t,{clamp:r=!0,ease:n,mixer:i}={}){let s=e.length;if(l$(s===t.length,"Both input and output ranges must be the same length","range-length"),1===s)return()=>t[0];if(2===s&&t[0]===t[1])return()=>t[1];let a=e[0]===e[1];e[0]>e[s-1]&&(e=[...e].reverse(),t=[...t].reverse());let o=function(e,t,r){let n=[],i=r||l7.mix||u6,s=e.length-1;for(let r=0;r<s;r++){let s=i(e[r],e[r+1]);t&&(s=uW(Array.isArray(t)?t[r]||l9:t,s)),n.push(s)}return n}(t,n,i),l=o.length,c=r=>{if(a&&r<e[0])return t[0];let n=0;if(l>1)for(;n<e.length-2&&!(r<e[n+1]);n++);let i=d_(e[n],e[n+1],r);return o[n](i)};return r?t=>c(o2(e[0],e[s-1],t)):c}((i=r&&r.length===t.length?r:(!function(e,t){let r=e[e.length-1];for(let n=1;n<=t;n++){let i=d_(0,t,n);e.push(c1(r,1,i))}}(s=[0],t.length-1),s),i.map(t=>t*e)),t,{ease:Array.isArray(a)?a:t.map(()=>a||df).splice(0,t.length-1)});return{calculatedDuration:e,next:t=>(o.value=l(t),o.done=t>=e,o)}}let dE=e=>null!==e;function dP(e,{repeat:t,repeatType:r="loop"},n,i=1){let s=e.filter(dE),a=i<0||t&&"loop"!==r&&t%2==1?0:s.length-1;return a&&void 0!==n?n:s[a]}let dR={decay:du,inertia:du,tween:dT,keyframes:dT,spring:dc};function dM(e){"string"==typeof e.type&&(e.type=dR[e.type])}class dL{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,t){return this.finished.then(e,t)}}let dI=e=>e/100;class dD extends dL{constructor(e){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{let{motionValue:e}=this.options;e&&e.updatedAt!==cw.now()&&this.tick(cw.now()),this.isStopped=!0,"idle"!==this.state&&(this.teardown(),this.options.onStop?.())},uH.mainThread++,this.options=e,this.initAnimation(),this.play(),!1===e.autoplay&&this.pause()}initAnimation(){let{options:e}=this;dM(e);let{type:t=dT,repeat:r=0,repeatDelay:n=0,repeatType:i,velocity:s=0}=e,{keyframes:a}=e,o=t||dT;o!==dT&&"number"!=typeof a[0]&&(this.mixKeyframes=uW(dI,u6(a[0],a[1])),a=[0,100]);let l=o({...e,keyframes:a});"mirror"===i&&(this.mirroredGenerator=o({...e,keyframes:[...a].reverse(),velocity:-s})),null===l.calculatedDuration&&(l.calculatedDuration=u9(l));let{calculatedDuration:c}=l;this.calculatedDuration=c,this.resolvedDuration=c+n,this.totalDuration=this.resolvedDuration*(r+1)-n,this.generator=l}updateTime(e){let t=Math.round(e-this.startTime)*this.playbackSpeed;null!==this.holdTime?this.currentTime=this.holdTime:this.currentTime=t}tick(e,t=!1){let{generator:r,totalDuration:n,mixKeyframes:i,mirroredGenerator:s,resolvedDuration:a,calculatedDuration:o}=this;if(null===this.startTime)return r.next(0);let{delay:l=0,keyframes:c,repeat:u,repeatType:d,repeatDelay:h,type:p,onUpdate:m,finalKeyframe:f}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-n/this.speed,this.startTime)),t?this.currentTime=e:this.updateTime(e);let g=this.currentTime-l*(this.playbackSpeed>=0?1:-1),y=this.playbackSpeed>=0?g<0:g>n;this.currentTime=Math.max(g,0),"finished"===this.state&&null===this.holdTime&&(this.currentTime=n);let x=this.currentTime,v=r;if(u){let e=Math.min(this.currentTime,n)/a,t=Math.floor(e),r=e%1;!r&&e>=1&&(r=1),1===r&&t--,(t=Math.min(t,u+1))%2&&("reverse"===d?(r=1-r,h&&(r-=h/a)):"mirror"===d&&(v=s)),x=o2(0,1,r)*a}let b=y?{done:!1,value:c[0]}:v.next(x);i&&(b.value=i(b.value));let{done:w}=b;y||null===o||(w=this.playbackSpeed>=0?this.currentTime>=n:this.currentTime<=0);let k=null===this.holdTime&&("finished"===this.state||"running"===this.state&&w);return k&&p!==du&&(b.value=dP(c,this.options,f,this.speed)),m&&m(b.value),k&&this.finish(),b}then(e,t){return this.finished.then(e,t)}get duration(){return this.calculatedDuration/1e3}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+e/1e3}get time(){return this.currentTime/1e3}set time(e){e=uU(e),this.currentTime=e,null===this.startTime||null!==this.holdTime||0===this.playbackSpeed?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?.start(!1)}get speed(){return this.playbackSpeed}set speed(e){this.updateTime(cw.now());let t=this.playbackSpeed!==e;this.playbackSpeed=e,t&&(this.time=this.currentTime/1e3)}play(){if(this.isStopped)return;let{driver:e=u8,startTime:t}=this.options;this.driver||(this.driver=e(e=>this.tick(e))),this.options.onPlay?.();let r=this.driver.now();"finished"===this.state?(this.updateFinished(),this.startTime=r):null!==this.holdTime?this.startTime=r-this.holdTime:this.startTime||(this.startTime=t??r),"finished"===this.state&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(cw.now()),this.holdTime=this.currentTime}complete(){"running"!==this.state&&this.play(),this.state="finished",this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state="finished",this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null,uH.mainThread--}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),this.driver?.stop(),e.observe(this)}}function dO(e){let t;return()=>(void 0===t&&(t=e()),t)}let dB=dO(()=>void 0!==window.ScrollTimeline),dF={},d$=(u=dO(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(e){return!1}return!0}),()=>dF.linearEasing??u()),dz=([e,t,r,n])=>`cubic-bezier(${e}, ${t}, ${r}, ${n})`,dV={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:dz([0,.65,.55,1]),circOut:dz([.55,0,1,.45]),backIn:dz([.31,.01,.66,-.59]),backOut:dz([.33,1.53,.69,.99])};function dU(e){return"function"==typeof e&&"applyToOptions"in e}class dG extends dL{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!e)return;const{element:t,name:r,keyframes:n,pseudoElement:i,allowFlatten:s=!1,finalKeyframe:a,onComplete:o}=e;this.isPseudoElement=!!i,this.allowFlatten=s,this.options=e,l$("string"!=typeof e.type,'Mini animate() doesn\'t support "type" as a string.',"mini-spring");const l=function({type:e,...t}){return dU(e)&&d$()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}(e);this.animation=function(e,t,r,{delay:n=0,duration:i=300,repeat:s=0,repeatType:a="loop",ease:o="easeOut",times:l}={},c){let u={[t]:r};l&&(u.offset=l);let d=function e(t,r){if(t)return"function"==typeof t?d$()?u4(t,r):"ease-out":dA(t)?dz(t):Array.isArray(t)?t.map(t=>e(t,r)||dV.easeOut):dV[t]}(o,i);Array.isArray(d)&&(u.easing=d);let h={delay:n,duration:i,easing:Array.isArray(d)?"linear":d,fill:"both",iterations:s+1,direction:"reverse"===a?"alternate":"normal"};c&&(h.pseudoElement=c);let p=e.animate(u,h);return p}(t,r,n,l,i),!1===l.autoplay&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!i){let e=dP(n,this.options,a,this.speed);this.updateMotionValue?this.updateMotionValue(e):r.startsWith("--")?t.style.setProperty(r,e):t.style[r]=e,this.animation.cancel()}o?.(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),"finished"===this.state&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch(e){}}stop(){if(this.isStopped)return;this.isStopped=!0;let{state:e}=this;"idle"!==e&&"finished"!==e&&(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){this.isPseudoElement||this.animation.commitStyles?.()}get duration(){return Number(this.animation.effect?.getComputedTiming?.().duration||0)/1e3}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+e/1e3}get time(){return(Number(this.animation.currentTime)||0)/1e3}set time(e){this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=uU(e)}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return null!==this.finishedTime?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(e){this.manualStartTime=this.animation.startTime=e}attachTimeline({timeline:e,observe:t}){return(this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,e&&dB())?(this.animation.timeline=e,l9):t(this)}}let dW={anticipate:dw,backInOut:db,circInOut:dj};class dH extends dG{constructor(e){!function(e){"string"==typeof e.ease&&e.ease in dW&&(e.ease=dW[e.ease])}(e),dM(e),super(e),void 0!==e.startTime&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){let{motionValue:t,onUpdate:r,onComplete:n,element:i,...s}=this.options;if(!t)return;if(void 0!==e)return void t.set(e);let a=new dD({...s,autoplay:!1}),o=Math.max(10,cw.now()-this.startTime),l=o2(0,10,o-10);t.setWithVelocity(a.sample(Math.max(0,o-l)).value,a.sample(o).value,l),a.stop()}}let dq=(e,t)=>"zIndex"!==t&&!!("number"==typeof e||Array.isArray(e)||"string"==typeof e&&(lw.test(e)||"0"===e)&&!e.startsWith("url("));function dK(e){e.duration=0,e.type="keyframes"}let dY=new Set(["opacity","clipPath","filter","transform"]),dX=dO(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));class dJ extends dL{constructor({autoplay:e=!0,delay:t=0,type:r="keyframes",repeat:n=0,repeatDelay:i=0,repeatType:s="loop",keyframes:a,name:o,motionValue:l,element:c,...u}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=cw.now();const d={autoplay:e,delay:t,type:r,repeat:n,repeatDelay:i,repeatType:s,name:o,motionValue:l,element:c,...u},h=c?.KeyframeResolver||ch;this.keyframeResolver=new h(a,(e,t,r)=>this.onKeyframesResolved(e,t,d,!r),o,l,c),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,t,r,n){this.keyframeResolver=void 0;let{name:i,type:s,velocity:a,delay:o,isHandoff:l,onUpdate:c}=r;this.resolvedAt=cw.now(),!function(e,t,r,n){let i=e[0];if(null===i)return!1;if("display"===t||"visibility"===t)return!0;let s=e[e.length-1],a=dq(i,t),o=dq(s,t);return lF(a===o,`You are trying to animate ${t} from "${i}" to "${s}". "${a?s:i}" is not an animatable value.`,"value-not-animatable"),!!a&&!!o&&(function(e){let t=e[0];if(1===e.length)return!0;for(let r=0;r<e.length;r++)if(e[r]!==t)return!0}(e)||("spring"===r||dU(r))&&n)}(e,i,s,a)&&((l7.instantAnimations||!o)&&c?.(dP(e,r,t)),e[0]=e[e.length-1],dK(r),r.repeat=0);let u={startTime:n?this.resolvedAt&&this.resolvedAt-this.createdAt>40?this.resolvedAt:this.createdAt:void 0,finalKeyframe:t,...r,keyframes:e},d=!l&&function(e){let{motionValue:t,name:r,repeatDelay:n,repeatType:i,damping:s,type:a}=e;if(!(t?.owner?.current instanceof HTMLElement))return!1;let{onUpdate:o,transformTemplate:l}=t.owner.getProps();return dX()&&r&&dY.has(r)&&("transform"!==r||!l)&&!o&&!n&&"mirror"!==i&&0!==s&&"inertia"!==a}(u),h=u.motionValue?.owner?.current,p=d?new dH({...u,element:h}):new dD(u);p.finished.then(()=>{this.notifyFinished()}).catch(l9),this.pendingTimeline&&(this.stopTimeline=p.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=p}get finished(){return this._animation?this.animation.finished:this._finished}then(e,t){return this.finished.finally(e).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),cc=!0,cd(),cu(),cc=!1),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}}let dZ={type:"spring",stiffness:500,damping:25,restSpeed:10},dQ={type:"keyframes",duration:.8},d0={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},d1=e=>null!==e,d2=(e,t,r,n={},i,s)=>a=>{let o=u$(n,e)||{},l=o.delay||n.delay||0,{elapsed:c=0}=n;c-=uU(l);let u={keyframes:Array.isArray(r)?r:[null,r],ease:"easeOut",velocity:t.getVelocity(),...o,delay:-c,onUpdate:e=>{t.set(e),o.onUpdate&&o.onUpdate(e)},onComplete:()=>{a(),o.onComplete&&o.onComplete()},name:e,motionValue:t,element:s?void 0:i};!function({when:e,delay:t,delayChildren:r,staggerChildren:n,staggerDirection:i,repeat:s,repeatType:a,repeatDelay:o,from:l,elapsed:c,...u}){return!!Object.keys(u).length}(o)&&Object.assign(u,((e,{keyframes:t})=>t.length>2?dQ:o1.has(e)?e.startsWith("scale")?{type:"spring",stiffness:550,damping:0===t[1]?2*Math.sqrt(550):30,restSpeed:10}:dZ:d0)(e,u)),u.duration&&(u.duration=uU(u.duration)),u.repeatDelay&&(u.repeatDelay=uU(u.repeatDelay)),void 0!==u.from&&(u.keyframes[0]=u.from);let d=!1;if(!1!==u.type&&(0!==u.duration||u.repeatDelay)||(dK(u),0===u.delay&&(d=!0)),(l7.instantAnimations||l7.skipAnimations)&&(d=!0,dK(u),u.delay=0),u.allowFlatten=!o.type&&!o.ease,d&&!s&&void 0!==t.get()){let e=function(e,{repeat:t,repeatType:r="loop"},n){let i=e.filter(d1),s=t&&"loop"!==r&&t%2==1?0:i.length-1;return i[s]}(u.keyframes,o);if(void 0!==e)return void cr.update(()=>{u.onUpdate(e),u.onComplete()})}return o.isSync?new dD(u):new dJ(u)};function d5(e,t,{delay:r=0,transitionOverride:n,type:i}={}){let{transition:s=e.getDefaultTransition(),transitionEnd:a,...o}=t;n&&(s=n);let l=[],c=i&&e.animationState&&e.animationState.getState()[i];for(let t in o){let n=e.getValue(t,e.latestValues[t]??null),i=o[t];if(void 0===i||c&&function({protectedKeys:e,needsAnimating:t},r){let n=e.hasOwnProperty(r)&&!0!==t[r];return t[r]=!1,n}(c,t))continue;let a={delay:r,...u$(s||{},t)},u=n.get();if(void 0!==u&&!n.isAnimating&&!Array.isArray(i)&&i===u&&!a.velocity)continue;let d=!1;if(window.MotionHandoffAnimation){let r=e.props[uM];if(r){let e=window.MotionHandoffAnimation(r,t,cr);null!==e&&(a.startTime=e,d=!0)}}uV(e,t),n.start(d2(t,n,i,e.shouldReduceMotion&&lI.has(t)?{type:!1}:a,e,d));let h=n.animation;h&&l.push(h)}return a&&Promise.all(l).then(()=>{cr.update(()=>{a&&function(e,t){let{transitionEnd:r={},transition:n={},...i}=uF(e,t)||{};for(let t in i={...i,...r}){var s;let r=uz(s=i[t])?s[s.length-1]||0:s;e.hasValue(t)?e.getValue(t).set(r):e.addValue(t,cS(r))}}(e,a)})}),l}function d3(e,t,r,n=0,i=1){let s=Array.from(e).sort((e,t)=>e.sortNodePosition(t)).indexOf(t),a=e.size,o=(a-1)*n;return"function"==typeof r?r(s,a):1===i?s*n:o-s*n}function d6(e,t,r={}){let n=uF(e,t,"exit"===r.type?e.presenceContext?.custom:void 0),{transition:i=e.getDefaultTransition()||{}}=n||{};r.transitionOverride&&(i=r.transitionOverride);let s=n?()=>Promise.all(d5(e,n,r)):()=>Promise.resolve(),a=e.variantChildren&&e.variantChildren.size?(n=0)=>{let{delayChildren:s=0,staggerChildren:a,staggerDirection:o}=i;return function(e,t,r=0,n=0,i=0,s=1,a){let o=[];for(let l of e.variantChildren)l.notify("AnimationStart",t),o.push(d6(l,t,{...a,delay:r+("function"==typeof n?0:n)+d3(e.variantChildren,l,n,i,s)}).then(()=>l.notify("AnimationComplete",t)));return Promise.all(o)}(e,t,n,s,a,o,r)}:()=>Promise.resolve(),{when:o}=i;if(!o)return Promise.all([s(),a(r.delay)]);{let[e,t]="beforeChildren"===o?[s,a]:[a,s];return e().then(()=>t())}}let d8=cR.length;function d4(e,t){if(!Array.isArray(t))return!1;let r=t.length;if(r!==e.length)return!1;for(let n=0;n<r;n++)if(t[n]!==e[n])return!1;return!0}let d9=[...cP].reverse(),d7=cP.length;function he(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function ht(){return{animate:he(!0),whileInView:he(),whileHover:he(),whileTap:he(),whileDrag:he(),whileFocus:he(),exit:he()}}let hr=0;function hn(e){return[e("x"),e("y")]}let hi=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function hs(e){return hi.has(e.tagName)||!0===e.isContentEditable}function ha(e,t,r,n={passive:!0}){return e.addEventListener(t,r,n),()=>e.removeEventListener(t,r)}let ho={x:!1,y:!1};function hl(e){return e.max-e.min}function hc(e,t,r,n=.5){e.origin=n,e.originPoint=c1(t.min,t.max,e.origin),e.scale=hl(r)/hl(t),e.translate=c1(r.min,r.max,e.origin)-e.originPoint,(e.scale>=.9999&&e.scale<=1.0001||isNaN(e.scale))&&(e.scale=1),(e.translate>=-.01&&e.translate<=.01||isNaN(e.translate))&&(e.translate=0)}function hu(e,t,r,n){hc(e.x,t.x,r.x,n?n.originX:void 0),hc(e.y,t.y,r.y,n?n.originY:void 0)}function hd(e,t,r){e.min=r.min+t.min,e.max=e.min+hl(t)}function hh(e,t,r){e.min=t.min-r.min,e.max=e.min+hl(t)}function hp(e,t,r){hh(e.x,t.x,r.x),hh(e.y,t.y,r.y)}let hm=e=>"mouse"===e.pointerType?"number"!=typeof e.button||e.button<=0:!1!==e.isPrimary;function hf(e){return{point:{x:e.pageX,y:e.pageY}}}function hg(e,t,r,n){return ha(e,t,e=>hm(e)&&r(e,hf(e)),n)}let hy=({current:e})=>e?e.ownerDocument.defaultView:null,hx=(e,t)=>Math.abs(e-t),hv=new Set(["auto","scroll"]);class hb{constructor(e,t,{transformPagePoint:r,contextWindow:n=window,dragSnapToOrigin:i=!1,distanceThreshold:s=3,element:a}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=e=>{this.handleScroll(e.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{var e,t;if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;let r=hS(this.lastMoveEventInfo,this.history),n=null!==this.startEvent,i=(e=r.offset,t={x:0,y:0},Math.sqrt(hx(e.x,t.x)**2+hx(e.y,t.y)**2)>=this.distanceThreshold);if(!n&&!i)return;let{point:s}=r,{timestamp:a}=ci;this.history.push({...s,timestamp:a});let{onStart:o,onMove:l}=this.handlers;n||(o&&o(this.lastMoveEvent,r),this.startEvent=this.lastMoveEvent),l&&l(this.lastMoveEvent,r)},this.handlePointerMove=(e,t)=>{this.lastMoveEvent=e,this.lastMoveEventInfo=hw(t,this.transformPagePoint),cr.update(this.updatePoint,!0)},this.handlePointerUp=(e,t)=>{this.end();let{onEnd:r,onSessionEnd:n,resumeAnimation:i}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&i&&i(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;let s=hS("pointercancel"===e.type?this.lastMoveEventInfo:hw(t,this.transformPagePoint),this.history);this.startEvent&&r&&r(e,s),n&&n(e,s)},!hm(e))return;this.dragSnapToOrigin=i,this.handlers=t,this.transformPagePoint=r,this.distanceThreshold=s,this.contextWindow=n||window;const o=hw(hf(e),this.transformPagePoint),{point:l}=o,{timestamp:c}=ci;this.history=[{...l,timestamp:c}];const{onSessionStart:u}=t;u&&u(e,hS(o,this.history)),this.removeListeners=uW(hg(this.contextWindow,"pointermove",this.handlePointerMove),hg(this.contextWindow,"pointerup",this.handlePointerUp),hg(this.contextWindow,"pointercancel",this.handlePointerUp)),a&&this.startScrollTracking(a)}startScrollTracking(e){let t=e.parentElement;for(;t;){let e=getComputedStyle(t);(hv.has(e.overflowX)||hv.has(e.overflowY))&&this.scrollPositions.set(t,{x:t.scrollLeft,y:t.scrollTop}),t=t.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0,passive:!0}),window.addEventListener("scroll",this.onWindowScroll,{passive:!0}),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(e){let t=this.scrollPositions.get(e);if(!t)return;let r=e===window,n=r?{x:window.scrollX,y:window.scrollY}:{x:e.scrollLeft,y:e.scrollTop},i={x:n.x-t.x,y:n.y-t.y};(0!==i.x||0!==i.y)&&(r?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=i.x,this.lastMoveEventInfo.point.y+=i.y):this.history.length>0&&(this.history[0].x-=i.x,this.history[0].y-=i.y),this.scrollPositions.set(e,n),cr.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),cn(this.updatePoint)}}function hw(e,t){return t?{point:t(e.point)}:e}function hk(e,t){return{x:e.x-t.x,y:e.y-t.y}}function hS({point:e},t){return{point:e,delta:hk(e,hj(t)),offset:hk(e,t[0]),velocity:function(e,t){if(e.length<2)return{x:0,y:0};let r=e.length-1,n=null,i=hj(e);for(;r>=0&&(n=e[r],!(i.timestamp-n.timestamp>uU(.1)));)r--;if(!n)return{x:0,y:0};let s=(i.timestamp-n.timestamp)/1e3;if(0===s)return{x:0,y:0};let a={x:(i.x-n.x)/s,y:(i.y-n.y)/s};return a.x===1/0&&(a.x=0),a.y===1/0&&(a.y=0),a}(t,.1)}}function hj(e){return e[e.length-1]}function hA(e,t,r){return{min:void 0!==t?e.min+t:void 0,max:void 0!==r?e.max+r-(e.max-e.min):void 0}}function hN(e,t){let r=t.min-e.min,n=t.max-e.max;return t.max-t.min<e.max-e.min&&([r,n]=[n,r]),{min:r,max:n}}function hC(e,t,r){return{min:h_(e,t),max:h_(e,r)}}function h_(e,t){return"number"==typeof e?e:e[t]||0}let hT=new WeakMap;class hE{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=lM(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:t=!1,distanceThreshold:r}={}){let{presenceContext:n}=this.visualElement;if(n&&!1===n.isPresent)return;let i=e=>{t?(this.stopAnimation(),this.snapToCursor(hf(e).point)):this.pauseAnimation()},s=(e,t)=>{this.stopAnimation();let{drag:r,dragPropagation:n,onDragStart:i}=this.getProps();if(r&&!n&&(this.openDragLock&&this.openDragLock(),this.openDragLock=function(e){if("x"===e||"y"===e)if(ho[e])return null;else return ho[e]=!0,()=>{ho[e]=!1};return ho.x||ho.y?null:(ho.x=ho.y=!0,()=>{ho.x=ho.y=!1})}(r),!this.openDragLock))return;this.latestPointerEvent=e,this.latestPanInfo=t,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),hn(e=>{let t=this.getAxisMotionValue(e).get()||0;if(la.test(t)){let{projection:r}=this.visualElement;if(r&&r.layout){let n=r.layout.layoutBox[e];n&&(t=hl(n)*(parseFloat(t)/100))}}this.originPoint[e]=t}),i&&cr.postRender(()=>i(e,t)),uV(this.visualElement,"transform");let{animationState:s}=this.visualElement;s&&s.setActive("whileDrag",!0)},a=(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t;let{dragPropagation:r,dragDirectionLock:n,onDirectionLock:i,onDrag:s}=this.getProps();if(!r&&!this.openDragLock)return;let{offset:a}=t;if(n&&null===this.currentDirection){this.currentDirection=function(e,t=10){let r=null;return Math.abs(e.y)>t?r="y":Math.abs(e.x)>t&&(r="x"),r}(a),null!==this.currentDirection&&i&&i(this.currentDirection);return}this.updateAxis("x",t.point,a),this.updateAxis("y",t.point,a),this.visualElement.render(),s&&s(e,t)},o=(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t,this.stop(e,t),this.latestPointerEvent=null,this.latestPanInfo=null},l=()=>hn(e=>"paused"===this.getAnimationState(e)&&this.getAxisMotionValue(e).animation?.play()),{dragSnapToOrigin:c}=this.getProps();this.panSession=new hb(e,{onSessionStart:i,onStart:s,onMove:a,onSessionEnd:o,resumeAnimation:l},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:c,distanceThreshold:r,contextWindow:hy(this.visualElement),element:this.visualElement.current})}stop(e,t){let r=e||this.latestPointerEvent,n=t||this.latestPanInfo,i=this.isDragging;if(this.cancel(),!i||!n||!r)return;let{velocity:s}=n;this.startAnimation(s);let{onDragEnd:a}=this.getProps();a&&cr.postRender(()=>a(r,n))}cancel(){this.isDragging=!1;let{projection:e,animationState:t}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.endPanSession();let{dragPropagation:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),t&&t.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(e,t,r){let{drag:n}=this.getProps();if(!r||!hP(e,n,this.currentDirection))return;let i=this.getAxisMotionValue(e),s=this.originPoint[e]+r[e];this.constraints&&this.constraints[e]&&(s=function(e,{min:t,max:r},n){return void 0!==t&&e<t?e=n?c1(t,e,n.min):Math.max(e,t):void 0!==r&&e>r&&(e=n?c1(r,e,n.max):Math.min(e,r)),e}(s,this.constraints[e],this.elastic[e])),i.set(s)}resolveConstraints(){let{dragConstraints:e,dragElastic:t}=this.getProps(),r=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,n=this.constraints;e&&uI(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&r?this.constraints=function(e,{top:t,left:r,bottom:n,right:i}){return{x:hA(e.x,r,i),y:hA(e.y,t,n)}}(r.layoutBox,e):this.constraints=!1,this.elastic=function(e=.35){return!1===e?e=0:!0===e&&(e=.35),{x:hC(e,"left","right"),y:hC(e,"top","bottom")}}(t),n!==this.constraints&&r&&this.constraints&&!this.hasMutatedConstraints&&hn(e=>{var t,n;let i;!1!==this.constraints&&this.getAxisMotionValue(e)&&(this.constraints[e]=(t=r.layoutBox[e],n=this.constraints[e],i={},void 0!==n.min&&(i.min=n.min-t.min),void 0!==n.max&&(i.max=n.max-t.min),i))})}resolveRefConstraints(){var e;let{dragConstraints:t,onMeasureDragConstraints:r}=this.getProps();if(!t||!uI(t))return!1;let n=t.current;l$(null!==n,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.","drag-constraints-ref");let{projection:i}=this.visualElement;if(!i||!i.layout)return!1;let s=function(e,t,r){let n=ul(e,r),{scroll:i}=t;return i&&(us(n.x,i.offset.x),us(n.y,i.offset.y)),n}(n,i.root,this.visualElement.getTransformPagePoint()),a=(e=i.layout.layoutBox,{x:hN(e.x,s.x),y:hN(e.y,s.y)});if(r){let e=r(function({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}(a));this.hasMutatedConstraints=!!e,e&&(a=c4(e))}return a}startAnimation(e){let{drag:t,dragMomentum:r,dragElastic:n,dragTransition:i,dragSnapToOrigin:s,onDragTransitionEnd:a}=this.getProps(),o=this.constraints||{};return Promise.all(hn(a=>{if(!hP(a,t,this.currentDirection))return;let l=o&&o[a]||{};s&&(l={min:0,max:0});let c={type:"inertia",velocity:r?e[a]:0,bounceStiffness:n?200:1e6,bounceDamping:n?40:1e7,timeConstant:750,restDelta:1,restSpeed:10,...i,...l};return this.startAxisValueAnimation(a,c)})).then(a)}startAxisValueAnimation(e,t){let r=this.getAxisMotionValue(e);return uV(this.visualElement,e),r.start(d2(e,r,0,t,this.visualElement,!1))}stopAnimation(){hn(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){hn(e=>this.getAxisMotionValue(e).animation?.pause())}getAnimationState(e){return this.getAxisMotionValue(e).animation?.state}getAxisMotionValue(e){let t=`_drag${e.toUpperCase()}`,r=this.visualElement.getProps();return r[t]||this.visualElement.getValue(e,(r.initial?r.initial[e]:void 0)||0)}snapToCursor(e){hn(t=>{let{drag:r}=this.getProps();if(!hP(t,r,this.currentDirection))return;let{projection:n}=this.visualElement,i=this.getAxisMotionValue(t);if(n&&n.layout){let{min:r,max:s}=n.layout.layoutBox[t],a=i.get()||0;i.set(e[t]-c1(r,s,.5)+a)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;let{drag:e,dragConstraints:t}=this.getProps(),{projection:r}=this.visualElement;if(!uI(t)||!r||!this.constraints)return;this.stopAnimation();let n={x:0,y:0};hn(e=>{let t=this.getAxisMotionValue(e);if(t&&!1!==this.constraints){var r,i;let s,a,o,l=t.get();n[e]=(r={min:l,max:l},i=this.constraints[e],s=.5,a=hl(r),(o=hl(i))>a?s=d_(i.min,i.max-a,r.min):a>o&&(s=d_(r.min,r.max-o,i.min)),o2(0,1,s))}});let{transformTemplate:i}=this.visualElement.getProps();this.visualElement.current.style.transform=i?i({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.resolveConstraints(),hn(t=>{if(!hP(t,e,null))return;let r=this.getAxisMotionValue(t),{min:i,max:s}=this.constraints[t];r.set(c1(i,s,n[t]))})}addListeners(){if(!this.visualElement.current)return;hT.set(this.visualElement,this);let e=this.visualElement.current,t=hg(e,"pointerdown",t=>{let{drag:r,dragListener:n=!0}=this.getProps(),i=t.target,s=i!==e&&hs(i);r&&n&&!s&&this.start(t)}),r=()=>{let{dragConstraints:e}=this.getProps();uI(e)&&e.current&&(this.constraints=this.resolveRefConstraints())},{projection:n}=this.visualElement,i=n.addEventListener("measure",r);n&&!n.layout&&(n.root&&n.root.updateScroll(),n.updateLayout()),cr.read(r);let s=ha(window,"resize",()=>this.scalePositionWithinConstraints()),a=n.addEventListener("didUpdate",({delta:e,hasLayoutChanged:t})=>{this.isDragging&&t&&(hn(t=>{let r=this.getAxisMotionValue(t);r&&(this.originPoint[t]+=e[t].translate,r.set(r.get()+e[t].translate))}),this.visualElement.render())});return()=>{s(),t(),i(),a&&a()}}getProps(){let e=this.visualElement.getProps(),{drag:t=!1,dragDirectionLock:r=!1,dragPropagation:n=!1,dragConstraints:i=!1,dragElastic:s=.35,dragMomentum:a=!0}=e;return{...e,drag:t,dragDirectionLock:r,dragPropagation:n,dragConstraints:i,dragElastic:s,dragMomentum:a}}}function hP(e,t,r){return(!0===t||t===e)&&(null===r||r===e)}let hR=e=>(t,r)=>{e&&cr.postRender(()=>e(t,r))},hM={hasAnimatedSinceResize:!0,hasEverUpdated:!1};var hL=b;let hI=!1;class hD extends hL.Component{componentDidMount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:r,layoutId:n}=this.props,{projection:i}=e;i&&(t.group&&t.group.add(i),r&&r.register&&n&&r.register(i),hI&&i.root.didUpdate(),i.addEventListener("animationComplete",()=>{this.safeToRemove()}),i.setOptions({...i.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),hM.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){let{layoutDependency:t,visualElement:r,drag:n,isPresent:i}=this.props,{projection:s}=r;return s&&(s.isPresent=i,e.layoutDependency!==t&&s.setOptions({...s.options,layoutDependency:t}),hI=!0,n||e.layoutDependency!==t||void 0===t||e.isPresent!==i?s.willUpdate():this.safeToRemove(),e.isPresent!==i&&(i?s.promote():s.relegate()||cr.postRender(()=>{let e=s.getStack();e&&e.members.length||this.safeToRemove()}))),null}componentDidUpdate(){let{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),cv.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:r}=this.props,{projection:n}=e;hI=!0,n&&(n.scheduleCheckAfterUnmount(),t&&t.group&&t.group.remove(n),r&&r.deregister&&r.deregister(n))}safeToRemove(){let{safeToRemove:e}=this.props;e&&e()}render(){return null}}function hO(e){let[t,r]=function(e=!0){let t=(0,b.useContext)(uj);if(null===t)return[!0,null];let{isPresent:r,onExitComplete:n,register:i}=t,s=(0,b.useId)();(0,b.useEffect)(()=>{if(e)return i(s)},[e]);let a=(0,b.useCallback)(()=>e&&n&&n(s),[s,n,e]);return!r&&n?[!1,a]:[!0]}(),n=(0,hL.useContext)(uh);return(0,v.jsx)(hD,{...e,layoutGroup:n,switchLayoutGroup:(0,hL.useContext)(uL),isPresent:t,safeToRemove:r})}function hB(e,t,r,n,i){return e-=t,e=n+1/r*(e-n),void 0!==i&&(e=n+1/i*(e-n)),e}function hF(e,t,[r,n,i],s,a){!function(e,t=0,r=1,n=.5,i,s=e,a=e){if(la.test(t)&&(t=parseFloat(t),t=c1(a.min,a.max,t/100)-a.min),"number"!=typeof t)return;let o=c1(s.min,s.max,n);e===s&&(o-=t),e.min=hB(e.min,t,r,o,i),e.max=hB(e.max,t,r,o,i)}(e,t[r],t[n],t[i],t.scale,s,a)}let h$=["x","scaleX","originX"],hz=["y","scaleY","originY"];function hV(e,t,r,n){hF(e.x,t,h$,r?r.x:void 0,n?n.x:void 0),hF(e.y,t,hz,r?r.y:void 0,n?n.y:void 0)}function hU(e,t){e.min=t.min,e.max=t.max}function hG(e,t){hU(e.x,t.x),hU(e.y,t.y)}function hW(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function hH(e){return 0===e.translate&&1===e.scale}function hq(e){return hH(e.x)&&hH(e.y)}function hK(e,t){return e.min===t.min&&e.max===t.max}function hY(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function hX(e,t){return hY(e.x,t.x)&&hY(e.y,t.y)}function hJ(e){return hl(e.x)/hl(e.y)}function hZ(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}let hQ=["TopLeft","TopRight","BottomLeft","BottomRight"],h0=hQ.length,h1=e=>"string"==typeof e?parseFloat(e):e,h2=e=>"number"==typeof e||lo.test(e);function h5(e,t){return void 0!==e[t]?e[t]:e.borderRadius}let h3=h8(0,.5,dS),h6=h8(.5,.95,l9);function h8(e,t,r){return n=>n<e?0:n>t?1:r(d_(e,t,n))}function h4(e){return"object"==typeof e&&null!==e}function h9(e){return h4(e)&&"ownerSVGElement"in e}let h7=(e,t)=>e.depth-t.depth;class pe{constructor(){this.children=[],this.isDirty=!1}add(e){cg(this.children,e),this.isDirty=!0}remove(e){cy(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(h7),this.isDirty=!1,this.children.forEach(e)}}class pt{constructor(){this.members=[]}add(e){cg(this.members,e),e.scheduleRender()}remove(e){if(cy(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){let e=this.members[this.members.length-1];e&&this.promote(e)}}relegate(e){let t,r=this.members.findIndex(t=>e===t);if(0===r)return!1;for(let e=r;e>=0;e--){let r=this.members[e];if(!1!==r.isPresent){t=r;break}}return!!t&&(this.promote(t),!0)}promote(e,t){let r=this.lead;if(e!==r&&(this.prevLead=r,this.lead=e,e.show(),r)){r.instance&&r.scheduleRender(),e.scheduleRender();let n=r.options.layoutDependency,i=e.options.layoutDependency;(void 0===n||void 0===i||n!==i)&&(e.resumeFrom=r,t&&(e.resumeFrom.preserveOpacity=!0),r.snapshot&&(e.snapshot=r.snapshot,e.snapshot.latestValues=r.animationValues||r.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0));let{crossfade:s}=e.options;!1===s&&r.hide()}}exitAnimationComplete(){this.members.forEach(e=>{let{options:t,resumingFrom:r}=e;t.onExitComplete&&t.onExitComplete(),r&&r.options.onExitComplete&&r.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}let pr=["","X","Y","Z"],pn=0;function pi(e,t,r,n){let{latestValues:i}=t;i[e]&&(r[e]=i[e],t.setStaticValue(e,0),n&&(n[e]=0))}function ps({attachResizeListener:e,defaultParent:t,measureScroll:r,checkIsScrollRoot:n,resetTransform:i}){return class{constructor(e={},r=t?.()){this.id=pn++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(pl),this.nodes.forEach(pf),this.nodes.forEach(pg),this.nodes.forEach(pc)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=e,this.root=r?r.root||r:this,this.path=r?[...r.path,r]:[],this.parent=r,this.depth=r?r.depth+1:0;for(let e=0;e<this.path.length;e++)this.path[e].shouldResetTransform=!0;this.root===this&&(this.nodes=new pe)}addEventListener(e,t){return this.eventHandlers.has(e)||this.eventHandlers.set(e,new cx),this.eventHandlers.get(e).add(t)}notifyListeners(e,...t){let r=this.eventHandlers.get(e);r&&r.notify(...t)}hasListeners(e){return this.eventHandlers.has(e)}mount(t){if(this.instance)return;this.isSVG=h9(t)&&!(h9(t)&&"svg"===t.tagName),this.instance=t;let{layoutId:r,layout:n,visualElement:i}=this.options;if(i&&!i.current&&i.mount(t),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(n||r)&&(this.isLayoutDirty=!0),e){let r,n=0,i=()=>this.root.updateBlockedByResize=!1;cr.read(()=>{n=window.innerWidth}),e(t,()=>{let e=window.innerWidth;if(e!==n){let t,s;n=e,this.root.updateBlockedByResize=!0,r&&r(),t=cw.now(),s=({timestamp:e})=>{let r=e-t;r>=250&&(cn(s),i(r-250))},cr.setup(s,!0),r=()=>cn(s),hM.hasAnimatedSinceResize&&(hM.hasAnimatedSinceResize=!1,this.nodes.forEach(pm))}})}r&&this.root.registerSharedNode(r,this),!1!==this.options.animate&&i&&(r||n)&&this.addEventListener("didUpdate",({delta:e,hasLayoutChanged:t,hasRelativeLayoutChanged:r,layout:n})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}let s=this.options.transition||i.getDefaultTransition()||pk,{onLayoutAnimationStart:a,onLayoutAnimationComplete:o}=i.getProps(),l=!this.targetLayout||!hX(this.targetLayout,n),c=!t&&r;if(this.options.layoutRoot||this.resumeFrom||c||t&&(l||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);let t={...u$(s,"layout"),onPlay:a,onComplete:o};(i.shouldReduceMotion||this.options.layoutRoot)&&(t.delay=0,t.type=!1),this.startAnimation(t),this.setAnimationOrigin(e,c)}else t||pm(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=n})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);let e=this.getStack();e&&e.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),cn(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){!this.isUpdateBlocked()&&(this.isUpdating=!0,this.nodes&&this.nodes.forEach(py),this.animationId++)}getTransformTemplate(){let{visualElement:e}=this.options;return e&&e.getProps().transformTemplate}willUpdate(e=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&function e(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;let{visualElement:r}=t.options;if(!r)return;let n=r.props[uM];if(window.MotionHasOptimisedAnimation(n,"transform")){let{layout:e,layoutId:r}=t.options;window.MotionCancelOptimisedAnimation(n,"transform",cr,!(e||r))}let{parent:i}=t;i&&!i.hasCheckedOptimisedAppear&&e(i)}(this),this.root.isUpdating||this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let e=0;e<this.path.length;e++){let t=this.path[e];t.shouldResetTransform=!0,t.updateScroll("snapshot"),t.options.layoutRoot&&t.willUpdate(!1)}let{layoutId:t,layout:r}=this.options;if(void 0===t&&!r)return;let n=this.getTransformTemplate();this.prevTransformTemplateValue=n?n(this.latestValues,""):void 0,this.updateSnapshot(),e&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(pd);return}if(this.animationId<=this.animationCommitId)return void this.nodes.forEach(ph);this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(pp),this.nodes.forEach(pa),this.nodes.forEach(po)):this.nodes.forEach(ph),this.clearAllSnapshots();let e=cw.now();ci.delta=o2(0,1e3/60,e-ci.timestamp),ci.timestamp=e,ci.isProcessing=!0,cs.update.process(ci),cs.preRender.process(ci),cs.render.process(ci),ci.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,cv.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(pu),this.sharedNodes.forEach(px)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,cr.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){cr.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){!this.snapshot&&this.instance&&(this.snapshot=this.measure(),!this.snapshot||hl(this.snapshot.measuredBox.x)||hl(this.snapshot.measuredBox.y)||(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let e=0;e<this.path.length;e++)this.path[e].updateScroll();let e=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected=lM(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);let{visualElement:t}=this.options;t&&t.notify("LayoutMeasure",this.layout.layoutBox,e?e.layoutBox:void 0)}updateScroll(e="measure"){let t=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===e&&(t=!1),t&&this.instance){let t=n(this.instance);this.scroll={animationId:this.root.animationId,phase:e,isRoot:t,offset:r(this.instance),wasRoot:this.scroll?this.scroll.isRoot:t}}}resetTransform(){if(!i)return;let e=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,t=this.projectionDelta&&!hq(this.projectionDelta),r=this.getTransformTemplate(),n=r?r(this.latestValues,""):void 0,s=n!==this.prevTransformTemplateValue;e&&this.instance&&(t||ue(this.latestValues)||s)&&(i(this.instance,n),this.shouldResetTransform=!1,this.scheduleRender())}measure(e=!0){var t;let r=this.measurePageBox(),n=this.removeElementScroll(r);return e&&(n=this.removeTransform(n)),pA((t=n).x),pA(t.y),{animationId:this.root.animationId,measuredBox:r,layoutBox:n,latestValues:{},source:this.id}}measurePageBox(){let{visualElement:e}=this.options;if(!e)return lM();let t=e.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(pC))){let{scroll:e}=this.root;e&&(us(t.x,e.offset.x),us(t.y,e.offset.y))}return t}removeElementScroll(e){let t=lM();if(hG(t,e),this.scroll?.wasRoot)return t;for(let r=0;r<this.path.length;r++){let n=this.path[r],{scroll:i,options:s}=n;n!==this.root&&i&&s.layoutScroll&&(i.wasRoot&&hG(t,e),us(t.x,i.offset.x),us(t.y,i.offset.y))}return t}applyTransform(e,t=!1){let r=lM();hG(r,e);for(let e=0;e<this.path.length;e++){let n=this.path[e];!t&&n.options.layoutScroll&&n.scroll&&n!==n.root&&uo(r,{x:-n.scroll.offset.x,y:-n.scroll.offset.y}),ue(n.latestValues)&&uo(r,n.latestValues)}return ue(this.latestValues)&&uo(r,this.latestValues),r}removeTransform(e){let t=lM();hG(t,e);for(let e=0;e<this.path.length;e++){let r=this.path[e];if(!r.instance||!ue(r.latestValues))continue;c7(r.latestValues)&&r.updateSnapshot();let n=lM();hG(n,r.measurePageBox()),hV(t,r.latestValues,r.snapshot?r.snapshot.layoutBox:void 0,n)}return ue(this.latestValues)&&hV(t,this.latestValues),t}setTargetDelta(e){this.targetDelta=e,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(e){this.options={...this.options,...e,crossfade:void 0===e.crossfade||e.crossfade}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==ci.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(e=!1){let t=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=t.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=t.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=t.isSharedProjectionDirty);let r=!!this.resumingFrom||this!==t;if(!(e||r&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;let{layout:n,layoutId:i}=this.options;if(!this.layout||!(n||i))return;this.resolvedRelativeTargetAt=ci.timestamp;let s=this.getClosestProjectingParent();if(s&&this.linkedParentVersion!==s.layoutVersion&&!s.options.layoutRoot&&this.removeRelativeTarget(),this.targetDelta||this.relativeTarget||(s&&s.layout?this.createRelativeTarget(s,this.layout.layoutBox,s.layout.layoutBox):this.removeRelativeTarget()),this.relativeTarget||this.targetDelta){if(this.target||(this.target=lM(),this.targetWithTransforms=lM()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target){var a,o,l;this.forceRelativeParentToResolveTarget(),a=this.target,o=this.relativeTarget,l=this.relativeParent.target,hd(a.x,o.x,l.x),hd(a.y,o.y,l.y)}else this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):hG(this.target,this.layout.layoutBox),ui(this.target,this.targetDelta)):hG(this.target,this.layout.layoutBox);this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,s&&!!s.resumingFrom==!!this.resumingFrom&&!s.options.layoutScroll&&s.target&&1!==this.animationProgress?this.createRelativeTarget(s,this.target,s.target):this.relativeParent=this.relativeTarget=void 0)}}getClosestProjectingParent(){if(!(!this.parent||c7(this.parent.latestValues)||ut(this.parent.latestValues)))if(this.parent.isProjecting())return this.parent;else return this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(e,t,r){this.relativeParent=e,this.linkedParentVersion=e.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=lM(),this.relativeTargetOrigin=lM(),hp(this.relativeTargetOrigin,t,r),hG(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){let e=this.getLead(),t=!!this.resumingFrom||this!==e,r=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(r=!1),t&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(r=!1),this.resolvedRelativeTargetAt===ci.timestamp&&(r=!1),r)return;let{layout:n,layoutId:i}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(n||i))return;hG(this.layoutCorrected,this.layout.layoutBox);let s=this.treeScale.x,a=this.treeScale.y;!function(e,t,r,n=!1){let i,s,a=r.length;if(a){t.x=t.y=1;for(let o=0;o<a;o++){s=(i=r[o]).projectionDelta;let{visualElement:a}=i.options;(!a||!a.props.style||"contents"!==a.props.style.display)&&(n&&i.options.layoutScroll&&i.scroll&&i!==i.root&&uo(e,{x:-i.scroll.offset.x,y:-i.scroll.offset.y}),s&&(t.x*=s.x.scale,t.y*=s.y.scale,ui(e,s)),n&&ue(i.latestValues)&&uo(e,i.latestValues))}t.x<1.0000000000001&&t.x>.999999999999&&(t.x=1),t.y<1.0000000000001&&t.y>.999999999999&&(t.y=1)}}(this.layoutCorrected,this.treeScale,this.path,t),e.layout&&!e.target&&(1!==this.treeScale.x||1!==this.treeScale.y)&&(e.target=e.layout.layoutBox,e.targetWithTransforms=lM());let{target:o}=e;if(!o){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}this.projectionDelta&&this.prevProjectionDelta?(hW(this.prevProjectionDelta.x,this.projectionDelta.x),hW(this.prevProjectionDelta.y,this.projectionDelta.y)):this.createProjectionDeltas(),hu(this.projectionDelta,this.layoutCorrected,o,this.latestValues),this.treeScale.x===s&&this.treeScale.y===a&&hZ(this.projectionDelta.x,this.prevProjectionDelta.x)&&hZ(this.projectionDelta.y,this.prevProjectionDelta.y)||(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",o))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(e=!0){if(this.options.visualElement?.scheduleRender(),e){let e=this.getStack();e&&e.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=lP(),this.projectionDelta=lP(),this.projectionDeltaWithTransform=lP()}setAnimationOrigin(e,t=!1){let r,n=this.snapshot,i=n?n.latestValues:{},s={...this.latestValues},a=lP();this.relativeParent&&this.relativeParent.options.layoutRoot||(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!t;let o=lM(),l=(n?n.source:void 0)!==(this.layout?this.layout.source:void 0),c=this.getStack(),u=!c||c.members.length<=1,d=!!(l&&!u&&!0===this.options.crossfade&&!this.path.some(pw));this.animationProgress=0,this.mixTargetDelta=t=>{let n=t/1e3;if(pv(a.x,e.x,n),pv(a.y,e.y,n),this.setTargetDelta(a),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout){var c,h,p,m,f,g;hp(o,this.layout.layoutBox,this.relativeParent.layout.layoutBox),p=this.relativeTarget,m=this.relativeTargetOrigin,f=o,g=n,pb(p.x,m.x,f.x,g),pb(p.y,m.y,f.y,g),r&&(c=this.relativeTarget,h=r,hK(c.x,h.x)&&hK(c.y,h.y))&&(this.isProjectionDirty=!1),r||(r=lM()),hG(r,this.relativeTarget)}l&&(this.animationValues=s,function(e,t,r,n,i,s){i?(e.opacity=c1(0,r.opacity??1,h3(n)),e.opacityExit=c1(t.opacity??1,0,h6(n))):s&&(e.opacity=c1(t.opacity??1,r.opacity??1,n));for(let i=0;i<h0;i++){let s=`border${hQ[i]}Radius`,a=h5(t,s),o=h5(r,s);(void 0!==a||void 0!==o)&&(a||(a=0),o||(o=0),0===a||0===o||h2(a)===h2(o)?(e[s]=Math.max(c1(h1(a),h1(o),n),0),(la.test(o)||la.test(a))&&(e[s]+="%")):e[s]=o)}(t.rotate||r.rotate)&&(e.rotate=c1(t.rotate||0,r.rotate||0,n))}(s,i,this.latestValues,n,d,u)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=n},this.mixTargetDelta(1e3*!!this.options.layoutRoot)}startAnimation(e){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(cn(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=cr.update(()=>{var t,r,n;let i;hM.hasAnimatedSinceResize=!0,uH.layout++,this.motionValue||(this.motionValue=cS(0)),this.currentAnimation=(t=this.motionValue,r=[0,1e3],n={...e,velocity:0,isSync:!0,onUpdate:t=>{this.mixTargetDelta(t),e.onUpdate&&e.onUpdate(t)},onStop:()=>{uH.layout--},onComplete:()=>{uH.layout--,e.onComplete&&e.onComplete(),this.completeAnimation()}},(i=lL(t)?t:cS(t)).start(d2("",i,r,n)),i.animation),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);let e=this.getStack();e&&e.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(1e3),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){let e=this.getLead(),{targetWithTransforms:t,target:r,layout:n,latestValues:i}=e;if(t&&r&&n){if(this!==e&&this.layout&&n&&pN(this.options.animationType,this.layout.layoutBox,n.layoutBox)){r=this.target||lM();let t=hl(this.layout.layoutBox.x);r.x.min=e.target.x.min,r.x.max=r.x.min+t;let n=hl(this.layout.layoutBox.y);r.y.min=e.target.y.min,r.y.max=r.y.min+n}hG(t,r),uo(t,i),hu(this.projectionDeltaWithTransform,this.layoutCorrected,t,i)}}registerSharedNode(e,t){this.sharedNodes.has(e)||this.sharedNodes.set(e,new pt),this.sharedNodes.get(e).add(t);let r=t.options.initialPromotionConfig;t.promote({transition:r?r.transition:void 0,preserveFollowOpacity:r&&r.shouldPreserveFollowOpacity?r.shouldPreserveFollowOpacity(t):void 0})}isLead(){let e=this.getStack();return!e||e.lead===this}getLead(){let{layoutId:e}=this.options;return e&&this.getStack()?.lead||this}getPrevLead(){let{layoutId:e}=this.options;return e?this.getStack()?.prevLead:void 0}getStack(){let{layoutId:e}=this.options;if(e)return this.root.sharedNodes.get(e)}promote({needsReset:e,transition:t,preserveFollowOpacity:r}={}){let n=this.getStack();n&&n.promote(this,r),e&&(this.projectionDelta=void 0,this.needsReset=!0),t&&this.setOptions({transition:t})}relegate(){let e=this.getStack();return!!e&&e.relegate(this)}resetSkewAndRotation(){let{visualElement:e}=this.options;if(!e)return;let t=!1,{latestValues:r}=e;if((r.z||r.rotate||r.rotateX||r.rotateY||r.rotateZ||r.skewX||r.skewY)&&(t=!0),!t)return;let n={};r.z&&pi("z",e,n,this.animationValues);for(let t=0;t<pr.length;t++)pi(`rotate${pr[t]}`,e,n,this.animationValues),pi(`skew${pr[t]}`,e,n,this.animationValues);for(let t in e.render(),n)e.setStaticValue(t,n[t]),this.animationValues&&(this.animationValues[t]=n[t]);e.scheduleRender()}applyProjectionStyles(e,t){if(!this.instance||this.isSVG)return;if(!this.isVisible){e.visibility="hidden";return}let r=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,e.visibility="",e.opacity="",e.pointerEvents=uS(t?.pointerEvents)||"",e.transform=r?r(this.latestValues,""):"none";return}let n=this.getLead();if(!this.projectionDelta||!this.layout||!n.target){this.options.layoutId&&(e.opacity=void 0!==this.latestValues.opacity?this.latestValues.opacity:1,e.pointerEvents=uS(t?.pointerEvents)||""),this.hasProjected&&!ue(this.latestValues)&&(e.transform=r?r({},""):"none",this.hasProjected=!1);return}e.visibility="";let i=n.animationValues||n.latestValues;this.applyTransformsToTarget();let s=function(e,t,r){let n="",i=e.x.translate/t.x,s=e.y.translate/t.y,a=r?.z||0;if((i||s||a)&&(n=`translate3d(${i}px, ${s}px, ${a}px) `),(1!==t.x||1!==t.y)&&(n+=`scale(${1/t.x}, ${1/t.y}) `),r){let{transformPerspective:e,rotate:t,rotateX:i,rotateY:s,skewX:a,skewY:o}=r;e&&(n=`perspective(${e}px) ${n}`),t&&(n+=`rotate(${t}deg) `),i&&(n+=`rotateX(${i}deg) `),s&&(n+=`rotateY(${s}deg) `),a&&(n+=`skewX(${a}deg) `),o&&(n+=`skewY(${o}deg) `)}let o=e.x.scale*t.x,l=e.y.scale*t.y;return(1!==o||1!==l)&&(n+=`scale(${o}, ${l})`),n||"none"}(this.projectionDeltaWithTransform,this.treeScale,i);r&&(s=r(i,s)),e.transform=s;let{x:a,y:o}=this.projectionDelta;for(let t in e.transformOrigin=`${100*a.origin}% ${100*o.origin}% 0`,n.animationValues?e.opacity=n===this?i.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:i.opacityExit:e.opacity=n===this?void 0!==i.opacity?i.opacity:"":void 0!==i.opacityExit?i.opacityExit:0,c2){if(void 0===i[t])continue;let{correct:r,applyTo:a,isCSSVariable:o}=c2[t],l="none"===s?i[t]:r(i[t],n);if(a){let t=a.length;for(let r=0;r<t;r++)e[a[r]]=l}else o?this.options.visualElement.renderState.vars[t]=l:e[t]=l}this.options.layoutId&&(e.pointerEvents=n===this?uS(t?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(e=>e.currentAnimation?.stop()),this.root.nodes.forEach(pd),this.root.sharedNodes.clear()}}}function pa(e){e.updateLayout()}function po(e){let t=e.resumeFrom?.snapshot||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners("didUpdate")){let{layoutBox:r,measuredBox:n}=e.layout,{animationType:i}=e.options,s=t.source!==e.layout.source;"size"===i?hn(e=>{let n=s?t.measuredBox[e]:t.layoutBox[e],i=hl(n);n.min=r[e].min,n.max=n.min+i}):pN(i,t.layoutBox,r)&&hn(n=>{let i=s?t.measuredBox[n]:t.layoutBox[n],a=hl(r[n]);i.max=i.min+a,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[n].max=e.relativeTarget[n].min+a)});let a=lP();hu(a,r,t.layoutBox);let o=lP();s?hu(o,e.applyTransform(n,!0),t.measuredBox):hu(o,r,t.layoutBox);let l=!hq(a),c=!1;if(!e.resumeFrom){let n=e.getClosestProjectingParent();if(n&&!n.resumeFrom){let{snapshot:i,layout:s}=n;if(i&&s){let a=lM();hp(a,t.layoutBox,i.layoutBox);let o=lM();hp(o,r,s.layoutBox),hX(a,o)||(c=!0),n.options.layoutRoot&&(e.relativeTarget=o,e.relativeTargetOrigin=a,e.relativeParent=n)}}}e.notifyListeners("didUpdate",{layout:r,snapshot:t,delta:o,layoutDelta:a,hasLayoutChanged:l,hasRelativeLayoutChanged:c})}else if(e.isLead()){let{onExitComplete:t}=e.options;t&&t()}e.options.transition=void 0}function pl(e){e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function pc(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function pu(e){e.clearSnapshot()}function pd(e){e.clearMeasurements()}function ph(e){e.isLayoutDirty=!1}function pp(e){let{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function pm(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function pf(e){e.resolveTargetDelta()}function pg(e){e.calcProjection()}function py(e){e.resetSkewAndRotation()}function px(e){e.removeLeadSnapshot()}function pv(e,t,r){e.translate=c1(t.translate,0,r),e.scale=c1(t.scale,1,r),e.origin=t.origin,e.originPoint=t.originPoint}function pb(e,t,r,n){e.min=c1(t.min,r.min,n),e.max=c1(t.max,r.max,n)}function pw(e){return e.animationValues&&void 0!==e.animationValues.opacityExit}let pk={duration:.45,ease:[.4,0,.1,1]},pS=e=>"u">typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),pj=pS("applewebkit/")&&!pS("chrome/")?Math.round:l9;function pA(e){e.min=pj(e.min),e.max=pj(e.max)}function pN(e,t,r){return"position"===e||"preserve-aspect"===e&&!(.2>=Math.abs(hJ(t)-hJ(r)))}function pC(e){return e!==e.root&&e.scroll?.wasRoot}let p_=ps({attachResizeListener:(e,t)=>ha(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),pT={current:void 0},pE=ps({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!pT.current){let e=new p_({});e.mount(window),e.setOptions({layoutScroll:!0}),pT.current=e}return pT.current},resetTransform:(e,t)=>{e.style.transform=void 0!==t?t:"none"},checkIsScrollRoot:e=>"fixed"===window.getComputedStyle(e).position});function pP(e,t){let r=function(e,t,r){if(null==e)return[];if(e instanceof EventTarget)return[e];if("string"==typeof e){let t=document,r=(void 0)??t.querySelectorAll(e);return r?Array.from(r):[]}return Array.from(e).filter(e=>null!=e)}(e),n=new AbortController;return[r,{passive:!0,...t,signal:n.signal},()=>n.abort()]}function pR(e){return!("touch"===e.pointerType||ho.x||ho.y)}function pM(e,t,r){let{props:n}=e;e.animationState&&n.whileHover&&e.animationState.setActive("whileHover","Start"===r);let i=n["onHover"+r];i&&cr.postRender(()=>i(t,hf(t)))}let pL=(e,t)=>!!t&&(e===t||pL(e,t.parentElement)),pI=new WeakSet;function pD(e){return t=>{"Enter"===t.key&&e(t)}}function pO(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}function pB(e){return hm(e)&&!(ho.x||ho.y)}function pF(e,t,r){let{props:n}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&n.whileTap&&e.animationState.setActive("whileTap","Start"===r);let i=n["onTap"+("End"===r?"":r)];i&&cr.postRender(()=>i(t,hf(t)))}let p$=new WeakMap,pz=new WeakMap,pV=e=>{let t=p$.get(e.target);t&&t(e)},pU=e=>{e.forEach(pV)},pG={some:0,all:1},pW=function(e,t){if("u"<typeof Proxy)return uO;let r=new Map,n=(r,n)=>uO(r,n,e,t);return new Proxy((e,t)=>n(e,t),{get:(i,s)=>"create"===s?n:(r.has(s)||r.set(s,uO(s,void 0,e,t)),r.get(s))})}({animation:{Feature:class extends uB{constructor(e){super(e),e.animationState||(e.animationState=function(e){let t=t=>Promise.all(t.map(({animation:t,options:r})=>(function(e,t,r={}){let n;if(e.notify("AnimationStart",t),Array.isArray(t))n=Promise.all(t.map(t=>d6(e,t,r)));else if("string"==typeof t)n=d6(e,t,r);else{let i="function"==typeof t?uF(e,t,r.custom):t;n=Promise.all(d5(e,i,r))}return n.then(()=>{e.notify("AnimationComplete",t)})})(e,t,r))),r=ht(),n=!0,i=t=>(r,n)=>{let i=uF(e,n,"exit"===t?e.presenceContext?.custom:void 0);if(i){let{transition:e,transitionEnd:t,...n}=i;r={...r,...n,...t}}return r};function s(s){let{props:a}=e,o=function e(t){if(!t)return;if(!t.isControllingVariants){let r=t.parent&&e(t.parent)||{};return void 0!==t.props.initial&&(r.initial=t.props.initial),r}let r={};for(let e=0;e<d8;e++){let n=cR[e],i=t.props[n];(cE(i)||!1===i)&&(r[n]=i)}return r}(e.parent)||{},l=[],c=new Set,u={},d=1/0;for(let t=0;t<d7;t++){var h,p;let m=d9[t],f=r[m],g=void 0!==a[m]?a[m]:o[m],y=cE(g),x=m===s?f.isActive:null;!1===x&&(d=t);let v=g===o[m]&&g!==a[m]&&y;if(v&&n&&e.manuallyAnimateOnMount&&(v=!1),f.protectedKeys={...u},!f.isActive&&null===x||!g&&!f.prevProp||cT(g)||"boolean"==typeof g)continue;let b=(h=f.prevProp,"string"==typeof(p=g)?p!==h:!!Array.isArray(p)&&!d4(p,h)),w=b||m===s&&f.isActive&&!v&&y||t>d&&y,k=!1,S=Array.isArray(g)?g:[g],j=S.reduce(i(m),{});!1===x&&(j={});let{prevResolvedValues:A={}}=f,N={...A,...j},C=t=>{w=!0,c.has(t)&&(k=!0,c.delete(t)),f.needsAnimating[t]=!0;let r=e.getValue(t);r&&(r.liveStyle=!1)};for(let e in N){let t=j[e],r=A[e];if(!u.hasOwnProperty(e))(uz(t)&&uz(r)?d4(t,r):t===r)?void 0!==t&&c.has(e)?C(e):f.protectedKeys[e]=!0:null!=t?C(e):c.add(e)}f.prevProp=g,f.prevResolvedValues=j,f.isActive&&(u={...u,...j}),n&&e.blockInitialAnimation&&(w=!1);let _=v&&b,T=!_||k;w&&T&&l.push(...S.map(t=>{let r={type:m};if("string"==typeof t&&n&&!_&&e.manuallyAnimateOnMount&&e.parent){let{parent:n}=e,i=uF(n,t);if(n.enteringChildren&&i){let{delayChildren:t}=i.transition||{};r.delay=d3(n.enteringChildren,e,t)}}return{animation:t,options:r}}))}if(c.size){let t={};if("boolean"!=typeof a.initial){let r=uF(e,Array.isArray(a.initial)?a.initial[0]:a.initial);r&&r.transition&&(t.transition=r.transition)}c.forEach(r=>{let n=e.getBaseTarget(r),i=e.getValue(r);i&&(i.liveStyle=!0),t[r]=n??null}),l.push({animation:t})}let m=!!l.length;return n&&(!1===a.initial||a.initial===a.animate)&&!e.manuallyAnimateOnMount&&(m=!1),n=!1,m?t(l):Promise.resolve()}return{animateChanges:s,setActive:function(t,n){if(r[t].isActive===n)return Promise.resolve();e.variantChildren?.forEach(e=>e.animationState?.setActive(t,n)),r[t].isActive=n;let i=s(t);for(let e in r)r[e].protectedKeys={};return i},setAnimateFunction:function(r){t=r(e)},getState:()=>r,reset:()=>{r=ht()}}}(e))}updateAnimationControlsSubscription(){let{animate:e}=this.node.getProps();cT(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){let{animate:e}=this.node.getProps(),{animate:t}=this.node.prevProps||{};e!==t&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}}},exit:{Feature:class extends uB{constructor(){super(...arguments),this.id=hr++}update(){if(!this.node.presenceContext)return;let{isPresent:e,onExitComplete:t}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===r)return;let n=this.node.animationState.setActive("exit",!e);t&&!e&&n.then(()=>{t(this.id)})}mount(){let{register:e,onExitComplete:t}=this.node.presenceContext||{};t&&t(this.id),e&&(this.unmount=e(this.id))}unmount(){}}},inView:{Feature:class extends uB{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){var e;let t;this.unmount();let{viewport:r={}}=this.node.getProps(),{root:n,margin:i,amount:s="some",once:a}=r,o={root:n?n.current:void 0,rootMargin:i,threshold:"number"==typeof s?s:pG[s]},l=e=>{let{isIntersecting:t}=e;if(this.isInView===t||(this.isInView=t,a&&!t&&this.hasEnteredView))return;t&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",t);let{onViewportEnter:r,onViewportLeave:n}=this.node.getProps(),i=t?r:n;i&&i(e)};return e=this.node.current,t=function({root:e,...t}){let r=e||document;pz.has(r)||pz.set(r,{});let n=pz.get(r),i=JSON.stringify(t);return n[i]||(n[i]=new IntersectionObserver(pU,{root:e,...t})),n[i]}(o),p$.set(e,l),t.observe(e),()=>{p$.delete(e),t.unobserve(e)}}mount(){this.startObserver()}update(){if("u"<typeof IntersectionObserver)return;let{props:e,prevProps:t}=this.node;["amount","margin","root"].some(function({viewport:e={}},{viewport:t={}}={}){return r=>e[r]!==t[r]}(e,t))&&this.startObserver()}unmount(){}}},tap:{Feature:class extends uB{mount(){let{current:e}=this.node;e&&(this.unmount=function(e,t,r={}){let[n,i,s]=pP(e,r),a=e=>{let n=e.currentTarget;if(!pB(e))return;pI.add(n);let s=t(n,e),a=(e,t)=>{window.removeEventListener("pointerup",o),window.removeEventListener("pointercancel",l),pI.has(n)&&pI.delete(n),pB(e)&&"function"==typeof s&&s(e,{success:t})},o=e=>{a(e,n===window||n===document||r.useGlobalTarget||pL(n,e.target))},l=e=>{a(e,!1)};window.addEventListener("pointerup",o,i),window.addEventListener("pointercancel",l,i)};return n.forEach(e=>{(r.useGlobalTarget?window:e).addEventListener("pointerdown",a,i),h4(e)&&"offsetHeight"in e&&(e.addEventListener("focus",e=>((e,t)=>{let r=e.currentTarget;if(!r)return;let n=pD(()=>{if(pI.has(r))return;pO(r,"down");let e=pD(()=>{pO(r,"up")});r.addEventListener("keyup",e,t),r.addEventListener("blur",()=>pO(r,"cancel"),t)});r.addEventListener("keydown",n,t),r.addEventListener("blur",()=>r.removeEventListener("keydown",n),t)})(e,i)),hs(e)||e.hasAttribute("tabindex")||(e.tabIndex=0))}),s}(e,(e,t)=>(pF(this.node,t,"Start"),(e,{success:t})=>pF(this.node,e,t?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}},focus:{Feature:class extends uB{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch(t){e=!0}e&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){this.isActive&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=uW(ha(this.node.current,"focus",()=>this.onFocus()),ha(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}},hover:{Feature:class extends uB{mount(){let{current:e}=this.node;e&&(this.unmount=function(e,t,r={}){let[n,i,s]=pP(e,r),a=e=>{if(!pR(e))return;let{target:r}=e,n=t(r,e);if("function"!=typeof n||!r)return;let s=e=>{pR(e)&&(n(e),r.removeEventListener("pointerleave",s))};r.addEventListener("pointerleave",s,i)};return n.forEach(e=>{e.addEventListener("pointerenter",a,i)}),s}(e,(e,t)=>(pM(this.node,t,"Start"),e=>pM(this.node,e,"End"))))}unmount(){}}},pan:{Feature:class extends uB{constructor(){super(...arguments),this.removePointerDownListener=l9}onPointerDown(e){this.session=new hb(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:hy(this.node)})}createPanHandlers(){let{onPanSessionStart:e,onPanStart:t,onPan:r,onPanEnd:n}=this.node.getProps();return{onSessionStart:hR(e),onStart:hR(t),onMove:r,onEnd:(e,t)=>{delete this.session,n&&cr.postRender(()=>n(e,t))}}}mount(){this.removePointerDownListener=hg(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}},drag:{Feature:class extends uB{constructor(e){super(e),this.removeGroupControls=l9,this.removeListeners=l9,this.controls=new hE(e)}mount(){let{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||l9}update(){let{dragControls:e}=this.node.getProps(),{dragControls:t}=this.node.prevProps||{};e!==t&&(this.removeGroupControls(),e&&(this.removeGroupControls=e.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}},ProjectionNode:pE,MeasureLayout:hO},layout:{ProjectionNode:pE,MeasureLayout:hO}},(e,t)=>t.isSVG??ud(e)?new c8(t):new uc(t,{allowProjection:e!==b.Fragment})),pH=(0,b.memo)(({children:e,as:t="p",className:r,duration:n=2,spread:i=2})=>{let s=pW.create(t),a=(0,b.useMemo)(()=>(e?.length??0)*i,[e,i]);return(0,v.jsx)(s,{animate:{backgroundPosition:"0% center"},className:(0,A.cn)("relative inline-block bg-[length:250%_100%,auto] bg-clip-text text-transparent","[--bg:linear-gradient(90deg,#0000_calc(50%-var(--spread)),var(--color-background),#0000_calc(50%+var(--spread)))] [background-repeat:no-repeat,padding-box]",r),initial:{backgroundPosition:"100% center"},style:{"--spread":`${a}px`,backgroundImage:"var(--bg), linear-gradient(var(--color-muted-foreground), var(--color-muted-foreground))"},transition:{repeat:1/0,duration:n,ease:"linear"},children:e})}),pq=(0,b.createContext)(null),pK=(0,b.memo)(({className:e,isStreaming:t=!1,open:r,defaultOpen:n=!0,onOpenChange:i,duration:s,children:a,...o})=>{let[l,c]=(0,aY.useControllableState)({prop:r,defaultProp:n,onChange:i}),[u,d]=(0,aY.useControllableState)({prop:s,defaultProp:void 0}),[h,p]=(0,b.useState)(!1),[m,f]=(0,b.useState)(null);return(0,b.useEffect)(()=>{t?null===m&&f(Date.now()):null!==m&&(d(Math.ceil((Date.now()-m)/1e3)),f(null))},[t,m,d]),(0,b.useEffect)(()=>{if(n&&!t&&l&&!h){let e=setTimeout(()=>{c(!1),p(!0)},1e3);return()=>clearTimeout(e)}},[t,l,n,c,h]),(0,v.jsx)(pq.Provider,{value:{isStreaming:t,isOpen:l,setIsOpen:c,duration:u},children:(0,v.jsx)(os,{className:(0,A.cn)("not-prose mb-4",e),onOpenChange:e=>{c(e)},open:l,...o,children:a})})}),pY=(e,t)=>e||0===t?(0,v.jsx)(pH,{duration:1,children:"Thinking..."}):void 0===t?(0,v.jsx)("p",{children:"Thought for a few seconds"}):(0,v.jsxs)("p",{children:["Thought for ",t," seconds"]}),pX=(0,b.memo)(({className:e,children:t,getThinkingMessage:r=pY,...n})=>{let{isStreaming:i,isOpen:s,duration:a}=(()=>{let e=(0,b.useContext)(pq);if(!e)throw Error("Reasoning components must be used within Reasoning");return e})();return(0,v.jsx)(oa,{className:(0,A.cn)("flex w-full items-center gap-2 text-muted-foreground text-sm transition-colors hover:text-foreground",e),...n,children:t??(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(oQ,{className:"size-4"}),r(i,a),(0,v.jsx)(oc.ChevronDownIcon,{className:(0,A.cn)("size-4 transition-transform",s?"rotate-180":"rotate-0")})]})})}),pJ=(0,b.memo)(({className:e,children:t,...r})=>(0,v.jsx)(oo,{className:(0,A.cn)("mt-4 text-sm","data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-muted-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in",e),...r,children:(0,v.jsx)(az.j,{plugins:{code:ni,mermaid:aI,math:nB,cjk:ey},linkSafety:{enabled:!0,renderModal:aH},...r,children:t})}));pK.displayName="Reasoning",pX.displayName="ReasoningTrigger",pJ.displayName="ReasoningContent";var pZ=/[\\\/_+.#"@\[\(\{&]/,pQ=/[\\\/_+.#"@\[\(\{&]/g,p0=/[\s-]/,p1=/[\s-]/g;function p2(e){return e.toLowerCase().replace(p1," ")}var p5=e.i(7631),p3=e.i(408744),p6='[cmdk-group=""]',p8='[cmdk-group-items=""]',p4='[cmdk-item=""]',p9=`${p4}:not([aria-disabled="true"])`,p7="cmdk-item-select",me="data-value",mt=(e,t,r)=>{var n;return n=e,function e(t,r,n,i,s,a,o){if(a===r.length)return s===t.length?1:.99;var l=`${s},${a}`;if(void 0!==o[l])return o[l];for(var c,u,d,h,p=i.charAt(a),m=n.indexOf(p,s),f=0;m>=0;)(c=e(t,r,n,i,m+1,a+1,o))>f&&(m===s?c*=1:pZ.test(t.charAt(m-1))?(c*=.8,(d=t.slice(s,m-1).match(pQ))&&s>0&&(c*=Math.pow(.999,d.length))):p0.test(t.charAt(m-1))?(c*=.9,(h=t.slice(s,m-1).match(p1))&&s>0&&(c*=Math.pow(.999,h.length))):(c*=.17,s>0&&(c*=Math.pow(.999,m-s))),t.charAt(m)!==r.charAt(a)&&(c*=.9999)),(c<.1&&n.charAt(m-1)===i.charAt(a+1)||i.charAt(a+1)===i.charAt(a)&&n.charAt(m-1)!==i.charAt(a))&&.1*(u=e(t,r,n,i,m+1,a+2,o))>c&&(c=.1*u),c>f&&(f=c),m=n.indexOf(p,m+1);return o[l]=f,f}(n=r&&r.length>0?`${n+" "+r.join(" ")}`:n,t,p2(n),p2(t),0,0,{})},mr=b.createContext(void 0),mn=b.createContext(void 0),mi=b.createContext(void 0),ms=b.forwardRef((e,t)=>{let r=mm(()=>{var t,r;return{search:"",value:null!=(r=null!=(t=e.value)?t:e.defaultValue)?r:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),n=mm(()=>new Set),i=mm(()=>new Map),s=mm(()=>new Map),a=mm(()=>new Set),o=mh(e),{label:l,children:c,value:u,onValueChange:d,filter:h,shouldFilter:p,loop:m,disablePointerSelection:f=!1,vimBindings:g=!0,...y}=e,x=(0,a2.useId)(),v=(0,a2.useId)(),w=(0,a2.useId)(),k=b.useRef(null),S=my();mp(()=>{if(void 0!==u){let e=u.trim();r.current.value=e,j.emit()}},[u]),mp(()=>{S(6,E)},[]);let j=b.useMemo(()=>({subscribe:e=>(a.current.add(e),()=>a.current.delete(e)),snapshot:()=>r.current,setState:(e,t,n)=>{var i,s,a,l;if(!Object.is(r.current[e],t)){if(r.current[e]=t,"search"===e)T(),C(),S(1,_);else if("value"===e){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let e=document.getElementById(w);e?e.focus():null==(i=document.getElementById(x))||i.focus()}if(S(7,()=>{var e;r.current.selectedItemId=null==(e=P())?void 0:e.id,j.emit()}),n||S(5,E),(null==(s=o.current)?void 0:s.value)!==void 0){null==(l=(a=o.current).onValueChange)||l.call(a,null!=t?t:"");return}}j.emit()}},emit:()=>{a.current.forEach(e=>e())}}),[]),A=b.useMemo(()=>({value:(e,t,n)=>{var i;t!==(null==(i=s.current.get(e))?void 0:i.value)&&(s.current.set(e,{value:t,keywords:n}),r.current.filtered.items.set(e,N(t,n)),S(2,()=>{C(),j.emit()}))},item:(e,t)=>(n.current.add(e),t&&(i.current.has(t)?i.current.get(t).add(e):i.current.set(t,new Set([e]))),S(3,()=>{T(),C(),r.current.value||_(),j.emit()}),()=>{s.current.delete(e),n.current.delete(e),r.current.filtered.items.delete(e);let t=P();S(4,()=>{T(),(null==t?void 0:t.getAttribute("id"))===e&&_(),j.emit()})}),group:e=>(i.current.has(e)||i.current.set(e,new Set),()=>{s.current.delete(e),i.current.delete(e)}),filter:()=>o.current.shouldFilter,label:l||e["aria-label"],getDisablePointerSelection:()=>o.current.disablePointerSelection,listId:x,inputId:w,labelId:v,listInnerRef:k}),[]);function N(e,t){var n,i;let s=null!=(i=null==(n=o.current)?void 0:n.filter)?i:mt;return e?s(e,r.current.search,t):0}function C(){if(!r.current.search||!1===o.current.shouldFilter)return;let e=r.current.filtered.items,t=[];r.current.filtered.groups.forEach(r=>{let n=i.current.get(r),s=0;n.forEach(t=>{s=Math.max(e.get(t),s)}),t.push([r,s])});let n=k.current;R().sort((t,r)=>{var n,i;let s=t.getAttribute("id"),a=r.getAttribute("id");return(null!=(n=e.get(a))?n:0)-(null!=(i=e.get(s))?i:0)}).forEach(e=>{let t=e.closest(p8);t?t.appendChild(e.parentElement===t?e:e.closest(`${p8} > *`)):n.appendChild(e.parentElement===n?e:e.closest(`${p8} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{var t;let r=null==(t=k.current)?void 0:t.querySelector(`${p6}[${me}="${encodeURIComponent(e[0])}"]`);null==r||r.parentElement.appendChild(r)})}function _(){let e=R().find(e=>"true"!==e.getAttribute("aria-disabled")),t=null==e?void 0:e.getAttribute(me);j.setState("value",t||void 0)}function T(){var e,t,a,l;if(!r.current.search||!1===o.current.shouldFilter){r.current.filtered.count=n.current.size;return}r.current.filtered.groups=new Set;let c=0;for(let i of n.current){let n=N(null!=(t=null==(e=s.current.get(i))?void 0:e.value)?t:"",null!=(l=null==(a=s.current.get(i))?void 0:a.keywords)?l:[]);r.current.filtered.items.set(i,n),n>0&&c++}for(let[e,t]of i.current)for(let n of t)if(r.current.filtered.items.get(n)>0){r.current.filtered.groups.add(e);break}r.current.filtered.count=c}function E(){var e,t,r;let n=P();n&&((null==(e=n.parentElement)?void 0:e.firstChild)===n&&(null==(r=null==(t=n.closest(p6))?void 0:t.querySelector('[cmdk-group-heading=""]'))||r.scrollIntoView({block:"nearest"})),n.scrollIntoView({block:"nearest"}))}function P(){var e;return null==(e=k.current)?void 0:e.querySelector(`${p4}[aria-selected="true"]`)}function R(){var e;return Array.from((null==(e=k.current)?void 0:e.querySelectorAll(p9))||[])}function M(e){let t=R()[e];t&&j.setState("value",t.getAttribute(me))}function L(e){var t;let r=P(),n=R(),i=n.findIndex(e=>e===r),s=n[i+e];null!=(t=o.current)&&t.loop&&(s=i+e<0?n[n.length-1]:i+e===n.length?n[0]:n[i+e]),s&&j.setState("value",s.getAttribute(me))}function I(e){let t=P(),r=null==t?void 0:t.closest(p6),n;for(;r&&!n;)n=null==(r=e>0?function(e,t){let r=e.nextElementSibling;for(;r;){if(r.matches(t))return r;r=r.nextElementSibling}}(r,p6):function(e,t){let r=e.previousElementSibling;for(;r;){if(r.matches(t))return r;r=r.previousElementSibling}}(r,p6))?void 0:r.querySelector(p9);n?j.setState("value",n.getAttribute(me)):L(e)}let D=()=>M(R().length-1),O=e=>{e.preventDefault(),e.metaKey?D():e.altKey?I(1):L(1)},B=e=>{e.preventDefault(),e.metaKey?M(0):e.altKey?I(-1):L(-1)};return b.createElement(p3.Primitive.div,{ref:t,tabIndex:-1,...y,"cmdk-root":"",onKeyDown:e=>{var t;null==(t=y.onKeyDown)||t.call(y,e);let r=e.nativeEvent.isComposing||229===e.keyCode;if(!(e.defaultPrevented||r))switch(e.key){case"n":case"j":g&&e.ctrlKey&&O(e);break;case"ArrowDown":O(e);break;case"p":case"k":g&&e.ctrlKey&&B(e);break;case"ArrowUp":B(e);break;case"Home":e.preventDefault(),M(0);break;case"End":e.preventDefault(),D();break;case"Enter":{e.preventDefault();let t=P();if(t){let e=new Event(p7);t.dispatchEvent(e)}}}}},b.createElement("label",{"cmdk-label":"",htmlFor:A.inputId,id:A.labelId,style:mv},l),mx(e,e=>b.createElement(mn.Provider,{value:j},b.createElement(mr.Provider,{value:A},e))))}),ma=b.forwardRef((e,t)=>{var r,n;let i=(0,a2.useId)(),s=b.useRef(null),a=b.useContext(mi),o=b.useContext(mr),l=mh(e),c=null!=(n=null==(r=l.current)?void 0:r.forceMount)?n:null==a?void 0:a.forceMount;mp(()=>{if(!c)return o.item(i,null==a?void 0:a.id)},[c]);let u=mg(i,s,[e.value,e.children,s],e.keywords),d=b.useContext(mn),h=mf(e=>e.value&&e.value===u.current),p=mf(e=>!!c||!1===o.filter()||!e.search||e.filtered.items.get(i)>0);function m(){var e,t;f(),null==(t=(e=l.current).onSelect)||t.call(e,u.current)}function f(){d.setState("value",u.current,!0)}if(b.useEffect(()=>{let t=s.current;if(!(!t||e.disabled))return t.addEventListener(p7,m),()=>t.removeEventListener(p7,m)},[p,e.onSelect,e.disabled]),!p)return null;let{disabled:g,value:y,onSelect:x,forceMount:v,keywords:w,...k}=e;return b.createElement(p3.Primitive.div,{ref:(0,aJ.composeRefs)(s,t),...k,id:i,"cmdk-item":"",role:"option","aria-disabled":!!g,"aria-selected":!!h,"data-disabled":!!g,"data-selected":!!h,onPointerMove:g||o.getDisablePointerSelection()?void 0:f,onClick:g?void 0:m},e.children)}),mo=b.forwardRef((e,t)=>{let{heading:r,children:n,forceMount:i,...s}=e,a=(0,a2.useId)(),o=b.useRef(null),l=b.useRef(null),c=(0,a2.useId)(),u=b.useContext(mr),d=mf(e=>!!i||!1===u.filter()||!e.search||e.filtered.groups.has(a));mp(()=>u.group(a),[]),mg(a,o,[e.value,e.heading,l]);let h=b.useMemo(()=>({id:a,forceMount:i}),[i]);return b.createElement(p3.Primitive.div,{ref:(0,aJ.composeRefs)(o,t),...s,"cmdk-group":"",role:"presentation",hidden:!d||void 0},r&&b.createElement("div",{ref:l,"cmdk-group-heading":"","aria-hidden":!0,id:c},r),mx(e,e=>b.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?c:void 0},b.createElement(mi.Provider,{value:h},e))))}),ml=b.forwardRef((e,t)=>{let{alwaysRender:r,...n}=e,i=b.useRef(null),s=mf(e=>!e.search);return r||s?b.createElement(p3.Primitive.div,{ref:(0,aJ.composeRefs)(i,t),...n,"cmdk-separator":"",role:"separator"}):null}),mc=b.forwardRef((e,t)=>{let{onValueChange:r,...n}=e,i=null!=e.value,s=b.useContext(mn),a=mf(e=>e.search),o=mf(e=>e.selectedItemId),l=b.useContext(mr);return b.useEffect(()=>{null!=e.value&&s.setState("search",e.value)},[e.value]),b.createElement(p3.Primitive.input,{ref:t,...n,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":l.listId,"aria-labelledby":l.labelId,"aria-activedescendant":o,id:l.inputId,type:"text",value:i?e.value:a,onChange:e=>{i||s.setState("search",e.target.value),null==r||r(e.target.value)}})}),mu=b.forwardRef((e,t)=>{let{children:r,label:n="Suggestions",...i}=e,s=b.useRef(null),a=b.useRef(null),o=mf(e=>e.selectedItemId),l=b.useContext(mr);return b.useEffect(()=>{if(a.current&&s.current){let e=a.current,t=s.current,r,n=new ResizeObserver(()=>{r=requestAnimationFrame(()=>{let r=e.offsetHeight;t.style.setProperty("--cmdk-list-height",r.toFixed(1)+"px")})});return n.observe(e),()=>{cancelAnimationFrame(r),n.unobserve(e)}}},[]),b.createElement(p3.Primitive.div,{ref:(0,aJ.composeRefs)(s,t),...i,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":o,"aria-label":n,id:l.listId},mx(e,e=>b.createElement("div",{ref:(0,aJ.composeRefs)(a,l.listInnerRef),"cmdk-list-sizer":""},e)))}),md=b.forwardRef((e,t)=>{let{open:r,onOpenChange:n,overlayClassName:i,contentClassName:s,container:a,...o}=e;return b.createElement(p5.Root,{open:r,onOpenChange:n},b.createElement(p5.Portal,{container:a},b.createElement(p5.Overlay,{"cmdk-overlay":"",className:i}),b.createElement(p5.Content,{"aria-label":e.label,"cmdk-dialog":"",className:s},b.createElement(ms,{ref:t,...o}))))});function mh(e){let t=b.useRef(e);return mp(()=>{t.current=e}),t}Object.assign(ms,{List:mu,Item:ma,Input:mc,Group:mo,Separator:ml,Dialog:md,Empty:b.forwardRef((e,t)=>mf(e=>0===e.filtered.count)?b.createElement(p3.Primitive.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),Loading:b.forwardRef((e,t)=>{let{progress:r,children:n,label:i="Loading...",...s}=e;return b.createElement(p3.Primitive.div,{ref:t,...s,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},mx(e,e=>b.createElement("div",{"aria-hidden":!0},e)))})});var mp="u"<typeof window?b.useEffect:b.useLayoutEffect;function mm(e){let t=b.useRef();return void 0===t.current&&(t.current=e()),t}function mf(e){let t=b.useContext(mn),r=()=>e(t.snapshot());return b.useSyncExternalStore(t.subscribe,r,r)}function mg(e,t,r,n=[]){let i=b.useRef(),s=b.useContext(mr);return mp(()=>{var a;let o=(()=>{var e;for(let t of r){if("string"==typeof t)return t.trim();if("object"==typeof t&&"current"in t)return t.current?null==(e=t.current.textContent)?void 0:e.trim():i.current}})(),l=n.map(e=>e.trim());s.value(e,o,l),null==(a=t.current)||a.setAttribute(me,o),i.current=o}),i}var my=()=>{let[e,t]=b.useState(),r=mm(()=>new Map);return mp(()=>{r.current.forEach(e=>e()),r.current=new Map},[e]),(e,n)=>{r.current.set(e,n),t({})}};function mx({asChild:e,children:t},r){let n;return e&&b.isValidElement(t)?b.cloneElement("function"==typeof(n=t.type)?n(t.props):"render"in n?n.render(t.props):t,{ref:t.ref},r(t.props.children)):r(t)}var mv={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};(0,E.default)("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]);var mb=e.i(836191),mw=Symbol("radix.slottable");function mk(e){return b.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===mw}var mS=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{var r,n;let i,s,a,o=(n=r=`Primitive.${t}`,(i=b.forwardRef((e,t)=>{let{children:r,...n}=e;if(b.isValidElement(r)){var i;let e,s,a=(i=r,(s=(e=Object.getOwnPropertyDescriptor(i.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.ref:(s=(e=Object.getOwnPropertyDescriptor(i,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.props.ref:i.props.ref||i.ref),o=function(e,t){let r={...t};for(let n in t){let i=e[n],s=t[n];/^on[A-Z]/.test(n)?i&&s?r[n]=(...e)=>{let t=s(...e);return i(...e),t}:i&&(r[n]=i):"style"===n?r[n]={...i,...s}:"className"===n&&(r[n]=[i,s].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==b.Fragment&&(o.ref=t?(0,aJ.composeRefs)(t,a):a),b.cloneElement(r,o)}return b.Children.count(r)>1?b.Children.only(null):null})).displayName=`${n}.SlotClone`,s=i,(a=b.forwardRef((e,t)=>{let{children:r,...n}=e,i=b.Children.toArray(r),a=i.find(mk);if(a){let e=a.props.children,r=i.map(t=>t!==a?t:b.Children.count(e)>1?b.Children.only(null):b.isValidElement(e)?e.props.children:null);return(0,v.jsx)(s,{...n,ref:t,children:b.isValidElement(e)?b.cloneElement(e,void 0,r):null})}return(0,v.jsx)(s,{...n,ref:t,children:r})})).displayName=`${r}.Slot`,a),l=b.forwardRef((e,r)=>{let{asChild:n,...i}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,v.jsx)(n?o:t,{...i,ref:r})});return l.displayName=`Primitive.${t}`,{...e,[t]:l}},{}),mj=e.i(736180),mA=e.i(542899),mN=e.i(272741),mC=e.i(721648),m_=e.i(498101),mT=e.i(874057),mE=e.i(383044);function mP(e){var t;let r,n=(t=e,(r=b.forwardRef((e,t)=>{let{children:r,...n}=e;if(b.isValidElement(r)){var i;let e,s,a=(i=r,(s=(e=Object.getOwnPropertyDescriptor(i.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.ref:(s=(e=Object.getOwnPropertyDescriptor(i,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.props.ref:i.props.ref||i.ref),o=function(e,t){let r={...t};for(let n in t){let i=e[n],s=t[n];/^on[A-Z]/.test(n)?i&&s?r[n]=(...e)=>{let t=s(...e);return i(...e),t}:i&&(r[n]=i):"style"===n?r[n]={...i,...s}:"className"===n&&(r[n]=[i,s].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==b.Fragment&&(o.ref=t?(0,aJ.composeRefs)(t,a):a),b.cloneElement(r,o)}return b.Children.count(r)>1?b.Children.only(null):null})).displayName=`${t}.SlotClone`,r),i=b.forwardRef((e,t)=>{let{children:r,...i}=e,s=b.Children.toArray(r),a=s.find(mM);if(a){let e=a.props.children,r=s.map(t=>t!==a?t:b.Children.count(e)>1?b.Children.only(null):b.isValidElement(e)?e.props.children:null);return(0,v.jsx)(n,{...i,ref:t,children:b.isValidElement(e)?b.cloneElement(e,void 0,r):null})}return(0,v.jsx)(n,{...i,ref:t,children:r})});return i.displayName=`${e}.Slot`,i}var mR=Symbol("radix.slottable");function mM(e){return b.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===mR}var mL=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{let r=mP(`Primitive.${t}`),n=b.forwardRef((e,n)=>{let{asChild:i,...s}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,v.jsx)(i?r:t,{...s,ref:n})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),mI=Symbol("radix.slottable");function mD(e){return b.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===mI}var mO=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{var r,n;let i,s,a,o=(n=r=`Primitive.${t}`,(i=b.forwardRef((e,t)=>{let{children:r,...n}=e;if(b.isValidElement(r)){var i;let e,s,a=(i=r,(s=(e=Object.getOwnPropertyDescriptor(i.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.ref:(s=(e=Object.getOwnPropertyDescriptor(i,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.props.ref:i.props.ref||i.ref),o=function(e,t){let r={...t};for(let n in t){let i=e[n],s=t[n];/^on[A-Z]/.test(n)?i&&s?r[n]=(...e)=>{let t=s(...e);return i(...e),t}:i&&(r[n]=i):"style"===n?r[n]={...i,...s}:"className"===n&&(r[n]=[i,s].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==b.Fragment&&(o.ref=t?(0,aJ.composeRefs)(t,a):a),b.cloneElement(r,o)}return b.Children.count(r)>1?b.Children.only(null):null})).displayName=`${n}.SlotClone`,s=i,(a=b.forwardRef((e,t)=>{let{children:r,...n}=e,i=b.Children.toArray(r),a=i.find(mD);if(a){let e=a.props.children,r=i.map(t=>t!==a?t:b.Children.count(e)>1?b.Children.only(null):b.isValidElement(e)?e.props.children:null);return(0,v.jsx)(s,{...n,ref:t,children:b.isValidElement(e)?b.cloneElement(e,void 0,r):null})}return(0,v.jsx)(s,{...n,ref:t,children:r})})).displayName=`${r}.Slot`,a),l=b.forwardRef((e,r)=>{let{asChild:n,...i}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,v.jsx)(n?o:t,{...i,ref:r})});return l.displayName=`Primitive.${t}`,{...e,[t]:l}},{}),mB=e.i(897462),mF="rovingFocusGroup.onEntryFocus",m$={bubbles:!1,cancelable:!0},mz="RovingFocusGroup",[mV,mU,mG]=(0,mj.createCollection)(mz),[mW,mH]=function(e,t=[]){let r=[],n=()=>{let t=r.map(e=>b.createContext(e));return function(r){let n=r?.[e]||t;return b.useMemo(()=>({[`__scope${e}`]:{...r,[e]:n}}),[r,n])}};return n.scopeName=e,[function(t,n){let i=b.createContext(n),s=r.length;r=[...r,n];let a=t=>{let{scope:r,children:n,...a}=t,o=r?.[e]?.[s]||i,l=b.useMemo(()=>a,Object.values(a));return(0,v.jsx)(o.Provider,{value:l,children:n})};return a.displayName=t+"Provider",[a,function(r,a){let o=a?.[e]?.[s]||i,l=b.useContext(o);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 b.useMemo(()=>({[`__scope${t.scopeName}`]:n}),[n])}};return r.scopeName=t.scopeName,r}(n,...t)]}(mz,[mG]),[mq,mK]=mW(mz),mY=b.forwardRef((e,t)=>(0,v.jsx)(mV.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,v.jsx)(mV.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,v.jsx)(mX,{...e,ref:t})})}));mY.displayName=mz;var mX=b.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:r,orientation:n,loop:i=!1,dir:s,currentTabStopId:a,defaultCurrentTabStopId:o,onCurrentTabStopIdChange:l,onEntryFocus:c,preventScrollOnEntryFocus:u=!1,...d}=e,h=b.useRef(null),p=(0,aJ.useComposedRefs)(t,h),m=(0,mA.useDirection)(s),[f,g]=(0,aY.useControllableState)({prop:a,defaultProp:o??null,onChange:l,caller:mz}),[y,x]=b.useState(!1),w=(0,mB.useCallbackRef)(c),k=mU(r),S=b.useRef(!1),[j,A]=b.useState(0);return b.useEffect(()=>{let e=h.current;if(e)return e.addEventListener(mF,w),()=>e.removeEventListener(mF,w)},[w]),(0,v.jsx)(mq,{scope:r,orientation:n,dir:m,loop:i,currentTabStopId:f,onItemFocus:b.useCallback(e=>g(e),[g]),onItemShiftTab:b.useCallback(()=>x(!0),[]),onFocusableItemAdd:b.useCallback(()=>A(e=>e+1),[]),onFocusableItemRemove:b.useCallback(()=>A(e=>e-1),[]),children:(0,v.jsx)(mO.div,{tabIndex:y||0===j?-1:0,"data-orientation":n,...d,ref:p,style:{outline:"none",...e.style},onMouseDown:(0,aK.composeEventHandlers)(e.onMouseDown,()=>{S.current=!0}),onFocus:(0,aK.composeEventHandlers)(e.onFocus,e=>{let t=!S.current;if(e.target===e.currentTarget&&t&&!y){let t=new CustomEvent(mF,m$);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=k().filter(e=>e.focusable);m0([e.find(e=>e.active),e.find(e=>e.id===f),...e].filter(Boolean).map(e=>e.ref.current),u)}}S.current=!1}),onBlur:(0,aK.composeEventHandlers)(e.onBlur,()=>x(!1))})})}),mJ="RovingFocusGroupItem",mZ=b.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:r,focusable:n=!0,active:i=!1,tabStopId:s,children:a,...o}=e,l=(0,a2.useId)(),c=s||l,u=mK(mJ,r),d=u.currentTabStopId===c,h=mU(r),{onFocusableItemAdd:p,onFocusableItemRemove:m,currentTabStopId:f}=u;return b.useEffect(()=>{if(n)return p(),()=>m()},[n,p,m]),(0,v.jsx)(mV.ItemSlot,{scope:r,id:c,focusable:n,active:i,children:(0,v.jsx)(mO.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...o,ref:t,onMouseDown:(0,aK.composeEventHandlers)(e.onMouseDown,e=>{n?u.onItemFocus(c):e.preventDefault()}),onFocus:(0,aK.composeEventHandlers)(e.onFocus,()=>u.onItemFocus(c)),onKeyDown:(0,aK.composeEventHandlers)(e.onKeyDown,e=>{if("Tab"===e.key&&e.shiftKey)return void u.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 mQ[i]}(e,u.orientation,u.dir);if(void 0!==t){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let i=h().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 s=i.indexOf(e.currentTarget);i=u.loop?(r=i,n=s+1,r.map((e,t)=>r[(n+t)%r.length])):i.slice(s+1)}setTimeout(()=>m0(i))}}),children:"function"==typeof a?a({isCurrentTabStop:d,hasTabStop:null!=f}):a})})});mZ.displayName=mJ;var mQ={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function m0(e,t=!1){let r=document.activeElement;for(let n of e)if(n===r||(n.focus({preventScroll:t}),document.activeElement!==r))return}var m1=e.i(567706),m2=e.i(883944),m5=["Enter"," "],m3=["ArrowUp","PageDown","End"],m6=["ArrowDown","PageUp","Home",...m3],m8={ltr:[...m5,"ArrowRight"],rtl:[...m5,"ArrowLeft"]},m4={ltr:["ArrowLeft"],rtl:["ArrowRight"]},m9="Menu",[m7,fe,ft]=(0,mj.createCollection)(m9),[fr,fn]=function(e,t=[]){let r=[],n=()=>{let t=r.map(e=>b.createContext(e));return function(r){let n=r?.[e]||t;return b.useMemo(()=>({[`__scope${e}`]:{...r,[e]:n}}),[r,n])}};return n.scopeName=e,[function(t,n){let i=b.createContext(n),s=r.length;r=[...r,n];let a=t=>{let{scope:r,children:n,...a}=t,o=r?.[e]?.[s]||i,l=b.useMemo(()=>a,Object.values(a));return(0,v.jsx)(o.Provider,{value:l,children:n})};return a.displayName=t+"Provider",[a,function(r,a){let o=a?.[e]?.[s]||i,l=b.useContext(o);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 b.useMemo(()=>({[`__scope${t.scopeName}`]:n}),[n])}};return r.scopeName=t.scopeName,r}(n,...t)]}(m9,[ft,mT.createPopperScope,mH]),fi=(0,mT.createPopperScope)(),fs=mH(),[fa,fo]=fr(m9),[fl,fc]=fr(m9),fu=b.forwardRef((e,t)=>{let{__scopeMenu:r,...n}=e,i=fi(r);return(0,v.jsx)(mT.Anchor,{...i,...n,ref:t})});fu.displayName="MenuAnchor";var fd="MenuPortal",[fh,fp]=fr(fd,{forceMount:void 0}),fm="MenuContent",[ff,fg]=fr(fm),fy=b.forwardRef((e,t)=>{let r=fp(fm,e.__scopeMenu),{forceMount:n=r.forceMount,...i}=e,s=fo(fm,e.__scopeMenu),a=fc(fm,e.__scopeMenu);return(0,v.jsx)(m7.Provider,{scope:e.__scopeMenu,children:(0,v.jsx)(a1.Presence,{present:n||s.open,children:(0,v.jsx)(m7.Slot,{scope:e.__scopeMenu,children:a.modal?(0,v.jsx)(fx,{...i,ref:t}):(0,v.jsx)(fv,{...i,ref:t})})})})}),fx=b.forwardRef((e,t)=>{let r=fo(fm,e.__scopeMenu),n=b.useRef(null),i=(0,aJ.useComposedRefs)(t,n);return b.useEffect(()=>{let e=n.current;if(e)return(0,m1.hideOthers)(e)},[]),(0,v.jsx)(fw,{...e,ref:i,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:(0,aK.composeEventHandlers)(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),fv=b.forwardRef((e,t)=>{let r=fo(fm,e.__scopeMenu);return(0,v.jsx)(fw,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),fb=mP("MenuContent.ScrollLock"),fw=b.forwardRef((e,t)=>{let{__scopeMenu:r,loop:n=!1,trapFocus:i,onOpenAutoFocus:s,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEntryFocus:l,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:h,onDismiss:p,disableOutsideScroll:m,...f}=e,g=fo(fm,r),y=fc(fm,r),x=fi(r),w=fs(r),k=fe(r),[S,j]=b.useState(null),A=b.useRef(null),N=(0,aJ.useComposedRefs)(t,A,g.onContentChange),C=b.useRef(0),_=b.useRef(""),T=b.useRef(0),E=b.useRef(null),P=b.useRef("right"),R=b.useRef(0),M=m?m2.RemoveScroll:b.Fragment;b.useEffect(()=>()=>window.clearTimeout(C.current),[]),(0,mC.useFocusGuards)();let L=b.useCallback(e=>{var t,r;return P.current===E.current?.side&&(t=e,!!(r=E.current?.area)&&function(e,t){let{x:r,y:n}=e,i=!1;for(let e=0,s=t.length-1;e<t.length;s=e++){let a=t[e],o=t[s],l=a.x,c=a.y,u=o.x,d=o.y;c>n!=d>n&&r<(u-l)*(n-c)/(d-c)+l&&(i=!i)}return i}({x:t.clientX,y:t.clientY},r))},[]);return(0,v.jsx)(ff,{scope:r,searchRef:_,onItemEnter:b.useCallback(e=>{L(e)&&e.preventDefault()},[L]),onItemLeave:b.useCallback(e=>{L(e)||(A.current?.focus(),j(null))},[L]),onTriggerLeave:b.useCallback(e=>{L(e)&&e.preventDefault()},[L]),pointerGraceTimerRef:T,onPointerGraceIntentChange:b.useCallback(e=>{E.current=e},[]),children:(0,v.jsx)(M,{...m?{as:fb,allowPinchZoom:!0}:void 0,children:(0,v.jsx)(m_.FocusScope,{asChild:!0,trapped:i,onMountAutoFocus:(0,aK.composeEventHandlers)(s,e=>{e.preventDefault(),A.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:a,children:(0,v.jsx)(mN.DismissableLayer,{asChild:!0,disableOutsidePointerEvents:o,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:h,onDismiss:p,children:(0,v.jsx)(mY,{asChild:!0,...w,dir:y.dir,orientation:"vertical",loop:n,currentTabStopId:S,onCurrentTabStopIdChange:j,onEntryFocus:(0,aK.composeEventHandlers)(l,e=>{y.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,v.jsx)(mT.Content,{role:"menu","aria-orientation":"vertical","data-state":fq(g.open),"data-radix-menu-content":"",dir:y.dir,...x,...f,ref:N,style:{outline:"none",...f.style},onKeyDown:(0,aK.composeEventHandlers)(f.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,s,a,o,l,c;"Tab"===e.key&&e.preventDefault(),!r&&n&&(i=e.key,t=_.current+i,s=k().filter(e=>!e.disabled),a=document.activeElement,o=s.find(e=>e.ref.current===a)?.textValue,l=function(e,t,r){var n;let i=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,s=r?e.indexOf(r):-1,a=(n=Math.max(s,0),e.map((t,r)=>e[(n+r)%e.length]));1===i.length&&(a=a.filter(e=>e!==r));let o=a.find(e=>e.toLowerCase().startsWith(i.toLowerCase()));return o!==r?o:void 0}(s.map(e=>e.textValue),t,o),c=s.find(e=>e.textValue===l)?.ref.current,function e(t){_.current=t,window.clearTimeout(C.current),""!==t&&(C.current=window.setTimeout(()=>e(""),1e3))}(t),c&&setTimeout(()=>c.focus()))}let s=A.current;if(e.target!==s||!m6.includes(e.key))return;e.preventDefault();let a=k().filter(e=>!e.disabled).map(e=>e.ref.current);m3.includes(e.key)&&a.reverse(),function(e){let t=document.activeElement;for(let r of e)if(r===t||(r.focus(),document.activeElement!==t))return}(a)}),onBlur:(0,aK.composeEventHandlers)(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(C.current),_.current="")}),onPointerMove:(0,aK.composeEventHandlers)(e.onPointerMove,fX(e=>{let t=e.target,r=R.current!==e.clientX;e.currentTarget.contains(t)&&r&&(P.current=e.clientX>R.current?"right":"left",R.current=e.clientX)}))})})})})})})});fy.displayName=fm;var fk=b.forwardRef((e,t)=>{let{__scopeMenu:r,...n}=e;return(0,v.jsx)(mL.div,{role:"group",...n,ref:t})});fk.displayName="MenuGroup";var fS=b.forwardRef((e,t)=>{let{__scopeMenu:r,...n}=e;return(0,v.jsx)(mL.div,{...n,ref:t})});fS.displayName="MenuLabel";var fj="MenuItem",fA="menu.itemSelect",fN=b.forwardRef((e,t)=>{let{disabled:r=!1,onSelect:n,...i}=e,s=b.useRef(null),a=fc(fj,e.__scopeMenu),o=fg(fj,e.__scopeMenu),l=(0,aJ.useComposedRefs)(t,s),c=b.useRef(!1);return(0,v.jsx)(fC,{...i,ref:l,disabled:r,onClick:(0,aK.composeEventHandlers)(e.onClick,()=>{let e=s.current;if(!r&&e){let t=new CustomEvent(fA,{bubbles:!0,cancelable:!0});e.addEventListener(fA,e=>n?.(e),{once:!0}),e&&aF.flushSync(()=>e.dispatchEvent(t)),t.defaultPrevented?c.current=!1:a.onClose()}}),onPointerDown:t=>{e.onPointerDown?.(t),c.current=!0},onPointerUp:(0,aK.composeEventHandlers)(e.onPointerUp,e=>{c.current||e.currentTarget?.click()}),onKeyDown:(0,aK.composeEventHandlers)(e.onKeyDown,e=>{let t=""!==o.searchRef.current;r||t&&" "===e.key||m5.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});fN.displayName=fj;var fC=b.forwardRef((e,t)=>{let{__scopeMenu:r,disabled:n=!1,textValue:i,...s}=e,a=fg(fj,r),o=fs(r),l=b.useRef(null),c=(0,aJ.useComposedRefs)(t,l),[u,d]=b.useState(!1),[h,p]=b.useState("");return b.useEffect(()=>{let e=l.current;e&&p((e.textContent??"").trim())},[s.children]),(0,v.jsx)(m7.ItemSlot,{scope:r,disabled:n,textValue:i??h,children:(0,v.jsx)(mZ,{asChild:!0,...o,focusable:!n,children:(0,v.jsx)(mL.div,{role:"menuitem","data-highlighted":u?"":void 0,"aria-disabled":n||void 0,"data-disabled":n?"":void 0,...s,ref:c,onPointerMove:(0,aK.composeEventHandlers)(e.onPointerMove,fX(e=>{n?a.onItemLeave(e):(a.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:(0,aK.composeEventHandlers)(e.onPointerLeave,fX(e=>a.onItemLeave(e))),onFocus:(0,aK.composeEventHandlers)(e.onFocus,()=>d(!0)),onBlur:(0,aK.composeEventHandlers)(e.onBlur,()=>d(!1))})})})}),f_=b.forwardRef((e,t)=>{let{checked:r=!1,onCheckedChange:n,...i}=e;return(0,v.jsx)(fD,{scope:e.__scopeMenu,checked:r,children:(0,v.jsx)(fN,{role:"menuitemcheckbox","aria-checked":fK(r)?"mixed":r,...i,ref:t,"data-state":fY(r),onSelect:(0,aK.composeEventHandlers)(i.onSelect,()=>n?.(!!fK(r)||!r),{checkForDefaultPrevented:!1})})})});f_.displayName="MenuCheckboxItem";var fT="MenuRadioGroup",[fE,fP]=fr(fT,{value:void 0,onValueChange:()=>{}}),fR=b.forwardRef((e,t)=>{let{value:r,onValueChange:n,...i}=e,s=(0,mB.useCallbackRef)(n);return(0,v.jsx)(fE,{scope:e.__scopeMenu,value:r,onValueChange:s,children:(0,v.jsx)(fk,{...i,ref:t})})});fR.displayName=fT;var fM="MenuRadioItem",fL=b.forwardRef((e,t)=>{let{value:r,...n}=e,i=fP(fM,e.__scopeMenu),s=r===i.value;return(0,v.jsx)(fD,{scope:e.__scopeMenu,checked:s,children:(0,v.jsx)(fN,{role:"menuitemradio","aria-checked":s,...n,ref:t,"data-state":fY(s),onSelect:(0,aK.composeEventHandlers)(n.onSelect,()=>i.onValueChange?.(r),{checkForDefaultPrevented:!1})})})});fL.displayName=fM;var fI="MenuItemIndicator",[fD,fO]=fr(fI,{checked:!1}),fB=b.forwardRef((e,t)=>{let{__scopeMenu:r,forceMount:n,...i}=e,s=fO(fI,r);return(0,v.jsx)(a1.Presence,{present:n||fK(s.checked)||!0===s.checked,children:(0,v.jsx)(mL.span,{...i,ref:t,"data-state":fY(s.checked)})})});fB.displayName=fI;var fF=b.forwardRef((e,t)=>{let{__scopeMenu:r,...n}=e;return(0,v.jsx)(mL.div,{role:"separator","aria-orientation":"horizontal",...n,ref:t})});fF.displayName="MenuSeparator";var f$=b.forwardRef((e,t)=>{let{__scopeMenu:r,...n}=e,i=fi(r);return(0,v.jsx)(mT.Arrow,{...i,...n,ref:t})});f$.displayName="MenuArrow";var[fz,fV]=fr("MenuSub"),fU="MenuSubTrigger",fG=b.forwardRef((e,t)=>{let r=fo(fU,e.__scopeMenu),n=fc(fU,e.__scopeMenu),i=fV(fU,e.__scopeMenu),s=fg(fU,e.__scopeMenu),a=b.useRef(null),{pointerGraceTimerRef:o,onPointerGraceIntentChange:l}=s,c={__scopeMenu:e.__scopeMenu},u=b.useCallback(()=>{a.current&&window.clearTimeout(a.current),a.current=null},[]);return b.useEffect(()=>u,[u]),b.useEffect(()=>{let e=o.current;return()=>{window.clearTimeout(e),l(null)}},[o,l]),(0,v.jsx)(fu,{asChild:!0,...c,children:(0,v.jsx)(fC,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":i.contentId,"data-state":fq(r.open),...e,ref:(0,aJ.composeRefs)(t,i.onTriggerChange),onClick:t=>{e.onClick?.(t),e.disabled||t.defaultPrevented||(t.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:(0,aK.composeEventHandlers)(e.onPointerMove,fX(t=>{s.onItemEnter(t),!t.defaultPrevented&&(e.disabled||r.open||a.current||(s.onPointerGraceIntentChange(null),a.current=window.setTimeout(()=>{r.onOpenChange(!0),u()},100)))})),onPointerLeave:(0,aK.composeEventHandlers)(e.onPointerLeave,fX(e=>{u();let t=r.content?.getBoundingClientRect();if(t){let n=r.content?.dataset.side,i="right"===n,a=t[i?"left":"right"],l=t[i?"right":"left"];s.onPointerGraceIntentChange({area:[{x:e.clientX+(i?-5:5),y:e.clientY},{x:a,y:t.top},{x:l,y:t.top},{x:l,y:t.bottom},{x:a,y:t.bottom}],side:n}),window.clearTimeout(o.current),o.current=window.setTimeout(()=>s.onPointerGraceIntentChange(null),300)}else{if(s.onTriggerLeave(e),e.defaultPrevented)return;s.onPointerGraceIntentChange(null)}})),onKeyDown:(0,aK.composeEventHandlers)(e.onKeyDown,t=>{let i=""!==s.searchRef.current;e.disabled||i&&" "===t.key||m8[n.dir].includes(t.key)&&(r.onOpenChange(!0),r.content?.focus(),t.preventDefault())})})})});fG.displayName=fU;var fW="MenuSubContent",fH=b.forwardRef((e,t)=>{let r=fp(fm,e.__scopeMenu),{forceMount:n=r.forceMount,...i}=e,s=fo(fm,e.__scopeMenu),a=fc(fm,e.__scopeMenu),o=fV(fW,e.__scopeMenu),l=b.useRef(null),c=(0,aJ.useComposedRefs)(t,l);return(0,v.jsx)(m7.Provider,{scope:e.__scopeMenu,children:(0,v.jsx)(a1.Presence,{present:n||s.open,children:(0,v.jsx)(m7.Slot,{scope:e.__scopeMenu,children:(0,v.jsx)(fw,{id:o.contentId,"aria-labelledby":o.triggerId,...i,ref:c,align:"start",side:"rtl"===a.dir?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{a.isUsingKeyboardRef.current&&l.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:(0,aK.composeEventHandlers)(e.onFocusOutside,e=>{e.target!==o.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:(0,aK.composeEventHandlers)(e.onEscapeKeyDown,e=>{a.onClose(),e.preventDefault()}),onKeyDown:(0,aK.composeEventHandlers)(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),r=m4[a.dir].includes(e.key);t&&r&&(s.onOpenChange(!1),o.trigger?.focus(),e.preventDefault())})})})})})});function fq(e){return e?"open":"closed"}function fK(e){return"indeterminate"===e}function fY(e){return fK(e)?"indeterminate":e?"checked":"unchecked"}function fX(e){return t=>"mouse"===t.pointerType?e(t):void 0}fH.displayName=fW;var fJ="DropdownMenu",[fZ,fQ]=function(e,t=[]){let r=[],n=()=>{let t=r.map(e=>b.createContext(e));return function(r){let n=r?.[e]||t;return b.useMemo(()=>({[`__scope${e}`]:{...r,[e]:n}}),[r,n])}};return n.scopeName=e,[function(t,n){let i=b.createContext(n),s=r.length;r=[...r,n];let a=t=>{let{scope:r,children:n,...a}=t,o=r?.[e]?.[s]||i,l=b.useMemo(()=>a,Object.values(a));return(0,v.jsx)(o.Provider,{value:l,children:n})};return a.displayName=t+"Provider",[a,function(r,a){let o=a?.[e]?.[s]||i,l=b.useContext(o);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 b.useMemo(()=>({[`__scope${t.scopeName}`]:n}),[n])}};return r.scopeName=t.scopeName,r}(n,...t)]}(fJ,[fn]),f0=fn(),[f1,f2]=fZ(fJ),f5="DropdownMenuTrigger";b.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,disabled:n=!1,...i}=e,s=f2(f5,r),a=f0(r);return(0,v.jsx)(fu,{asChild:!0,...a,children:(0,v.jsx)(mS.button,{type:"button",id:s.triggerId,"aria-haspopup":"menu","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":s.open?"open":"closed","data-disabled":n?"":void 0,disabled:n,...i,ref:(0,aJ.composeRefs)(t,s.triggerRef),onPointerDown:(0,aK.composeEventHandlers)(e.onPointerDown,e=>{!n&&0===e.button&&!1===e.ctrlKey&&(s.onOpenToggle(),s.open||e.preventDefault())}),onKeyDown:(0,aK.composeEventHandlers)(e.onKeyDown,e=>{!n&&(["Enter"," "].includes(e.key)&&s.onOpenToggle(),"ArrowDown"===e.key&&s.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(e.key)&&e.preventDefault())})})})}).displayName=f5;var f3="DropdownMenuContent";b.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,i=f2(f3,r),s=f0(r),a=b.useRef(!1);return(0,v.jsx)(fy,{id:i.contentId,"aria-labelledby":i.triggerId,...s,...n,ref:t,onCloseAutoFocus:(0,aK.composeEventHandlers)(e.onCloseAutoFocus,e=>{a.current||i.triggerRef.current?.focus(),a.current=!1,e.preventDefault()}),onInteractOutside:(0,aK.composeEventHandlers)(e.onInteractOutside,e=>{let t=e.detail.originalEvent,r=0===t.button&&!0===t.ctrlKey,n=2===t.button||r;(!i.modal||n)&&(a.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)"}})}).displayName=f3,b.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,i=f0(r);return(0,v.jsx)(fk,{...i,...n,ref:t})}).displayName="DropdownMenuGroup",b.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,i=f0(r);return(0,v.jsx)(fS,{...i,...n,ref:t})}).displayName="DropdownMenuLabel",b.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,i=f0(r);return(0,v.jsx)(fN,{...i,...n,ref:t})}).displayName="DropdownMenuItem",b.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,i=f0(r);return(0,v.jsx)(f_,{...i,...n,ref:t})}).displayName="DropdownMenuCheckboxItem",b.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,i=f0(r);return(0,v.jsx)(fR,{...i,...n,ref:t})}).displayName="DropdownMenuRadioGroup",b.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,i=f0(r);return(0,v.jsx)(fL,{...i,...n,ref:t})}).displayName="DropdownMenuRadioItem",b.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,i=f0(r);return(0,v.jsx)(fB,{...i,...n,ref:t})}).displayName="DropdownMenuItemIndicator",b.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,i=f0(r);return(0,v.jsx)(fF,{...i,...n,ref:t})}).displayName="DropdownMenuSeparator",b.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,i=f0(r);return(0,v.jsx)(f$,{...i,...n,ref:t})}).displayName="DropdownMenuArrow",b.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,i=f0(r);return(0,v.jsx)(fG,{...i,...n,ref:t})}).displayName="DropdownMenuSubTrigger",b.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,i=f0(r);return(0,v.jsx)(fH,{...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)"}})}).displayName="DropdownMenuSubContent";var f6=Symbol("radix.slottable");function f8(e){return b.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===f6}var f4=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{var r,n;let i,s,a,o=(n=r=`Primitive.${t}`,(i=b.forwardRef((e,t)=>{let{children:r,...n}=e;if(b.isValidElement(r)){var i;let e,s,a=(i=r,(s=(e=Object.getOwnPropertyDescriptor(i.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.ref:(s=(e=Object.getOwnPropertyDescriptor(i,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.props.ref:i.props.ref||i.ref),o=function(e,t){let r={...t};for(let n in t){let i=e[n],s=t[n];/^on[A-Z]/.test(n)?i&&s?r[n]=(...e)=>{let t=s(...e);return i(...e),t}:i&&(r[n]=i):"style"===n?r[n]={...i,...s}:"className"===n&&(r[n]=[i,s].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==b.Fragment&&(o.ref=t?(0,aJ.composeRefs)(t,a):a),b.cloneElement(r,o)}return b.Children.count(r)>1?b.Children.only(null):null})).displayName=`${n}.SlotClone`,s=i,(a=b.forwardRef((e,t)=>{let{children:r,...n}=e,i=b.Children.toArray(r),a=i.find(f8);if(a){let e=a.props.children,r=i.map(t=>t!==a?t:b.Children.count(e)>1?b.Children.only(null):b.isValidElement(e)?e.props.children:null);return(0,v.jsx)(s,{...n,ref:t,children:b.isValidElement(e)?b.cloneElement(e,void 0,r):null})}return(0,v.jsx)(s,{...n,ref:t,children:r})})).displayName=`${r}.Slot`,a),l=b.forwardRef((e,r)=>{let{asChild:n,...i}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,v.jsx)(n?o:t,{...i,ref:r})});return l.displayName=`Primitive.${t}`,{...e,[t]:l}},{}),f9="HoverCard",[f7,ge]=function(e,t=[]){let r=[],n=()=>{let t=r.map(e=>b.createContext(e));return function(r){let n=r?.[e]||t;return b.useMemo(()=>({[`__scope${e}`]:{...r,[e]:n}}),[r,n])}};return n.scopeName=e,[function(t,n){let i=b.createContext(n),s=r.length;r=[...r,n];let a=t=>{let{scope:r,children:n,...a}=t,o=r?.[e]?.[s]||i,l=b.useMemo(()=>a,Object.values(a));return(0,v.jsx)(o.Provider,{value:l,children:n})};return a.displayName=t+"Provider",[a,function(r,a){let o=a?.[e]?.[s]||i,l=b.useContext(o);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 b.useMemo(()=>({[`__scope${t.scopeName}`]:n}),[n])}};return r.scopeName=t.scopeName,r}(n,...t)]}(f9,[mT.createPopperScope]),gt=(0,mT.createPopperScope)(),[gr,gn]=f7(f9),gi="HoverCardTrigger";b.forwardRef((e,t)=>{let{__scopeHoverCard:r,...n}=e,i=gn(gi,r),s=gt(r);return(0,v.jsx)(mT.Anchor,{asChild:!0,...s,children:(0,v.jsx)(f4.a,{"data-state":i.open?"open":"closed",...n,ref:t,onPointerEnter:(0,aK.composeEventHandlers)(e.onPointerEnter,gc(i.onOpen)),onPointerLeave:(0,aK.composeEventHandlers)(e.onPointerLeave,gc(i.onClose)),onFocus:(0,aK.composeEventHandlers)(e.onFocus,i.onOpen),onBlur:(0,aK.composeEventHandlers)(e.onBlur,i.onClose),onTouchStart:(0,aK.composeEventHandlers)(e.onTouchStart,e=>e.preventDefault())})})}).displayName=gi;var[gs,ga]=f7("HoverCardPortal",{forceMount:void 0}),go="HoverCardContent";b.forwardRef((e,t)=>{let r=ga(go,e.__scopeHoverCard),{forceMount:n=r.forceMount,...i}=e,s=gn(go,e.__scopeHoverCard);return(0,v.jsx)(a1.Presence,{present:n||s.open,children:(0,v.jsx)(gl,{"data-state":s.open?"open":"closed",...i,onPointerEnter:(0,aK.composeEventHandlers)(e.onPointerEnter,gc(s.onOpen)),onPointerLeave:(0,aK.composeEventHandlers)(e.onPointerLeave,gc(s.onClose)),ref:t})})}).displayName=go;var gl=b.forwardRef((e,t)=>{let{__scopeHoverCard:r,onEscapeKeyDown:n,onPointerDownOutside:i,onFocusOutside:s,onInteractOutside:a,...o}=e,l=gn(go,r),c=gt(r),u=b.useRef(null),d=(0,aJ.useComposedRefs)(t,u),[h,p]=b.useState(!1);return b.useEffect(()=>{if(h){let e=document.body;return x=e.style.userSelect||e.style.webkitUserSelect,e.style.userSelect="none",e.style.webkitUserSelect="none",()=>{e.style.userSelect=x,e.style.webkitUserSelect=x}}},[h]),b.useEffect(()=>{if(u.current){let e=()=>{p(!1),l.isPointerDownOnContentRef.current=!1,setTimeout(()=>{document.getSelection()?.toString()!==""&&(l.hasSelectionRef.current=!0)})};return document.addEventListener("pointerup",e),()=>{document.removeEventListener("pointerup",e),l.hasSelectionRef.current=!1,l.isPointerDownOnContentRef.current=!1}}},[l.isPointerDownOnContentRef,l.hasSelectionRef]),b.useEffect(()=>{u.current&&(function(e){let t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP});for(;r.nextNode();)t.push(r.currentNode);return t})(u.current).forEach(e=>e.setAttribute("tabindex","-1"))}),(0,v.jsx)(mN.DismissableLayer,{asChild:!0,disableOutsidePointerEvents:!1,onInteractOutside:a,onEscapeKeyDown:n,onPointerDownOutside:i,onFocusOutside:(0,aK.composeEventHandlers)(s,e=>{e.preventDefault()}),onDismiss:l.onDismiss,children:(0,v.jsx)(mT.Content,{...c,...o,onPointerDown:(0,aK.composeEventHandlers)(o.onPointerDown,e=>{e.currentTarget.contains(e.target)&&p(!0),l.hasSelectionRef.current=!1,l.isPointerDownOnContentRef.current=!0}),ref:d,style:{...o.style,userSelect:h?"text":void 0,WebkitUserSelect:h?"text":void 0,"--radix-hover-card-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-hover-card-content-available-width":"var(--radix-popper-available-width)","--radix-hover-card-content-available-height":"var(--radix-popper-available-height)","--radix-hover-card-trigger-width":"var(--radix-popper-anchor-width)","--radix-hover-card-trigger-height":"var(--radix-popper-anchor-height)"}})})});function gc(e){return t=>"touch"===t.pointerType?void 0:e()}b.forwardRef((e,t)=>{let{__scopeHoverCard:r,...n}=e,i=gt(r);return(0,v.jsx)(mT.Arrow,{...i,...n,ref:t})}).displayName="HoverCardArrow";var gu=e.i(77982);function gd({className:e,...t}){return(0,v.jsx)("textarea",{"data-slot":"textarea",className:(0,A.cn)("border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),...t})}function gh({className:e,...t}){return(0,v.jsx)("div",{"data-slot":"input-group",role:"group",className:(0,A.cn)("group/input-group border-input dark:bg-input/30 relative flex w-full items-center rounded-md border shadow-xs transition-[color,box-shadow] outline-none","h-9 min-w-0 has-[>textarea]:h-auto","has-[>[data-align=inline-start]]:[&>input]:pl-2","has-[>[data-align=inline-end]]:[&>input]:pr-2","has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>[data-align=block-start]]:[&>input]:pb-3","has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-end]]:[&>input]:pt-3","has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot=input-group-control]:focus-visible]:ring-[3px]","has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[[data-slot][aria-invalid=true]]:border-destructive dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40",e),...t})}let gp=(0,j.cva)("text-muted-foreground flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium select-none [&>svg:not([class*='size-'])]:size-4 [&>kbd]:rounded-[calc(var(--radius)-5px)] group-data-[disabled=true]/input-group:opacity-50",{variants:{align:{"inline-start":"order-first pl-3 has-[>button]:ml-[-0.45rem] has-[>kbd]:ml-[-0.35rem]","inline-end":"order-last pr-3 has-[>button]:mr-[-0.45rem] has-[>kbd]:mr-[-0.35rem]","block-start":"order-first w-full justify-start px-3 pt-3 [.border-b]:pb-3 group-has-[>input]/input-group:pt-2.5","block-end":"order-last w-full justify-start px-3 pb-3 [.border-t]:pt-3 group-has-[>input]/input-group:pb-2.5"}},defaultVariants:{align:"inline-start"}});function gm({className:e,align:t="inline-start",...r}){return(0,v.jsx)("div",{role:"group","data-slot":"input-group-addon","data-align":t,className:(0,A.cn)(gp({align:t}),e),onClick:e=>{e.target.closest("button")||e.currentTarget.parentElement?.querySelector("input")?.focus()},...r})}let gf=(0,j.cva)("text-sm shadow-none flex gap-2 items-center",{variants:{size:{xs:"h-6 gap-1 px-2 rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-3.5 has-[>svg]:px-2",sm:"h-8 px-2.5 gap-1.5 rounded-md has-[>svg]:px-2.5","icon-xs":"size-6 rounded-[calc(var(--radius)-5px)] p-0 has-[>svg]:p-0","icon-sm":"size-8 p-0 has-[>svg]:p-0"}},defaultVariants:{size:"xs"}});function gg({className:e,type:t="button",variant:r="ghost",size:n="xs",...i}){return(0,v.jsx)(_.Button,{type:t,"data-size":n,variant:r,className:(0,A.cn)(gf({size:n}),e),...i})}function gy({className:e,...t}){return(0,v.jsx)(gd,{"data-slot":"input-group-control",className:(0,A.cn)("flex-1 resize-none rounded-none border-0 bg-transparent py-3 shadow-none focus-visible:ring-0 dark:bg-transparent",e),...t})}let gx=(0,E.default)("corner-down-left",[["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}],["path",{d:"m9 10-5 5 5 5",key:"1kshq7"}]]);(0,E.default)("image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);var gv=e.i(675182),gv=gv,gb=e.i(257868),gb=gb;let gw=(0,E.default)("square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]),gk=(e=21)=>{let t="",r=crypto.getRandomValues(new Uint8Array(e|=0));for(;e--;)t+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[63&r[e]];return t},gS=(0,b.createContext)(null),gj=(0,b.createContext)(null),gA=()=>(0,b.useContext)(gS),gN=(0,b.createContext)(null),gC=(0,b.createContext)(null),g_=({className:e,accept:t,multiple:r,globalDrop:n,syncHiddenInput:i,maxFiles:s,maxFileSize:a,onError:o,onSubmit:l,children:c,...u})=>{let d=gA(),h=!!d,p=(0,b.useRef)(null),m=(0,b.useRef)(null),[f,g]=(0,b.useState)([]),y=h?d.attachments.files:f,[x,w]=(0,b.useState)([]),k=(0,b.useRef)(y);k.current=y;let S=(0,b.useCallback)(()=>{p.current?.click()},[]),j=(0,b.useCallback)(e=>!t||""===t.trim()||t.split(",").map(e=>e.trim()).filter(Boolean).some(t=>{if(t.endsWith("/*")){let r=t.slice(0,-1);return e.type.startsWith(r)}return e.type===t}),[t]),N=(0,b.useCallback)(e=>{let t=Array.from(e),r=t.filter(e=>j(e));if(t.length&&0===r.length)return void o?.({code:"accept",message:"No files match the accepted types."});let n=r.filter(e=>!a||e.size<=a);r.length>0&&0===n.length?o?.({code:"max_file_size",message:"All files exceed the maximum size."}):g(e=>{let t="number"==typeof s?Math.max(0,s-e.length):void 0,r="number"==typeof t?n.slice(0,t):n;"number"==typeof t&&n.length>t&&o?.({code:"max_files",message:"Too many files. Some were not added."});let i=[];for(let e of r)i.push({id:gk(),type:"file",url:URL.createObjectURL(e),mediaType:e.type,filename:e.name});return e.concat(i)})},[j,s,a,o]),C=(0,b.useCallback)(e=>g(t=>{let r=t.find(t=>t.id===e);return r?.url&&URL.revokeObjectURL(r.url),t.filter(t=>t.id!==e)}),[]),_=(0,b.useCallback)(e=>{let t=Array.from(e),r=t.filter(e=>j(e));if(t.length&&0===r.length)return void o?.({code:"accept",message:"No files match the accepted types."});let n=r.filter(e=>!a||e.size<=a);if(r.length>0&&0===n.length)return void o?.({code:"max_file_size",message:"All files exceed the maximum size."});let i=y.length,l="number"==typeof s?Math.max(0,s-i):void 0,c="number"==typeof l?n.slice(0,l):n;"number"==typeof l&&n.length>l&&o?.({code:"max_files",message:"Too many files. Some were not added."}),c.length>0&&d?.attachments.add(c)},[j,a,s,o,y.length,d]),T=(0,b.useCallback)(()=>h?d?.attachments.clear():g(e=>{for(let t of e)t.url&&URL.revokeObjectURL(t.url);return[]}),[h,d]),E=(0,b.useCallback)(()=>w([]),[]),P=h?_:N,R=h?d.attachments.remove:C,M=h?d.attachments.openFileDialog:S,L=(0,b.useCallback)(()=>{T(),E()},[T,E]);(0,b.useEffect)(()=>{h&&d.__registerFileInput(p,()=>p.current?.click())},[h,d]),(0,b.useEffect)(()=>{i&&p.current&&0===y.length&&(p.current.value="")},[y,i]),(0,b.useEffect)(()=>{let e=m.current;if(!e||n)return;let t=e=>{e.dataTransfer?.types?.includes("Files")&&e.preventDefault()},r=e=>{e.dataTransfer?.types?.includes("Files")&&e.preventDefault(),e.dataTransfer?.files&&e.dataTransfer.files.length>0&&P(e.dataTransfer.files)};return e.addEventListener("dragover",t),e.addEventListener("drop",r),()=>{e.removeEventListener("dragover",t),e.removeEventListener("drop",r)}},[P,n]),(0,b.useEffect)(()=>{if(!n)return;let e=e=>{e.dataTransfer?.types?.includes("Files")&&e.preventDefault()},t=e=>{e.dataTransfer?.types?.includes("Files")&&e.preventDefault(),e.dataTransfer?.files&&e.dataTransfer.files.length>0&&P(e.dataTransfer.files)};return document.addEventListener("dragover",e),document.addEventListener("drop",t),()=>{document.removeEventListener("dragover",e),document.removeEventListener("drop",t)}},[P,n]),(0,b.useEffect)(()=>()=>{if(!h)for(let e of k.current)e.url&&URL.revokeObjectURL(e.url)},[h]);let I=async e=>{try{let t=await fetch(e),r=await t.blob();return new Promise(e=>{let t=new FileReader;t.onloadend=()=>e(t.result),t.onerror=()=>e(null),t.readAsDataURL(r)})}catch{return null}},D=(0,b.useMemo)(()=>({files:y.map(e=>({...e,id:e.id})),add:P,remove:R,clear:T,openFileDialog:M,fileInputRef:p}),[y,P,R,T,M]),O=(0,b.useMemo)(()=>({sources:x,add:e=>{let t=Array.isArray(e)?e:[e];w(e=>e.concat(t.map(e=>({...e,id:gk()}))))},remove:e=>{w(t=>t.filter(t=>t.id!==e))},clear:E}),[x,E]),B=(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)("input",{accept:t,"aria-label":"Upload files",className:"hidden",multiple:r,onChange:e=>{e.currentTarget.files&&P(e.currentTarget.files),e.currentTarget.value=""},ref:p,title:"Upload files",type:"file"}),(0,v.jsx)("form",{className:(0,A.cn)("w-full",e),onSubmit:e=>{e.preventDefault();let t=e.currentTarget,r=h?d.textInput.value:new FormData(t).get("message")||"";h||t.reset(),Promise.all(y.map(async({id:e,...t})=>{if(t.url?.startsWith("blob:")){let e=await I(t.url);return{...t,url:e??t.url}}return t})).then(t=>{try{let n=l({text:r,files:t},e);n instanceof Promise?n.then(()=>{L(),h&&d.textInput.clear()}).catch(()=>{}):(L(),h&&d.textInput.clear())}catch{}}).catch(()=>{})},ref:m,...u,children:(0,v.jsx)(gh,{className:"overflow-hidden",children:c})})]}),F=(0,v.jsx)(gC.Provider,{value:O,children:B});return(0,v.jsx)(gN.Provider,{value:D,children:F})},gT=({className:e,...t})=>(0,v.jsx)("div",{className:(0,A.cn)("contents",e),...t}),gE=({onChange:e,onKeyDown:t,className:r,placeholder:n="What would you like to know?",...i})=>{let s=gA(),a=(()=>{let e=(0,b.useContext)(gj),t=(0,b.useContext)(gN)??e;if(!t)throw Error("usePromptInputAttachments must be used within a PromptInput or PromptInputProvider");return t})(),[o,l]=(0,b.useState)(!1),c=s?{value:s.textInput.value,onChange:t=>{s.textInput.setInput(t.currentTarget.value),e?.(t)}}:{onChange:e};return(0,v.jsx)(gy,{className:(0,A.cn)("field-sizing-content max-h-48 min-h-10",r),name:"message",onCompositionEnd:()=>l(!1),onCompositionStart:()=>l(!0),onKeyDown:e=>{if(t?.(e),!e.defaultPrevented){if("Enter"===e.key){if(o||e.nativeEvent.isComposing||e.shiftKey)return;e.preventDefault();let t=e.currentTarget.form,r=t?.querySelector('button[type="submit"]');if(r?.disabled)return;t?.requestSubmit()}if("Backspace"===e.key&&""===e.currentTarget.value&&a.files.length>0){e.preventDefault();let t=a.files.at(-1);t&&a.remove(t.id)}}},onPaste:e=>{let t=e.clipboardData?.items;if(!t)return;let r=[];for(let e of t)if("file"===e.kind){let t=e.getAsFile();t&&r.push(t)}r.length>0&&(e.preventDefault(),a.add(r))},placeholder:n,...i,...c})},gP=({className:e,...t})=>(0,v.jsx)(gm,{align:"block-end",className:(0,A.cn)("justify-between gap-1",e),...t}),gR=({className:e,variant:t="default",size:r="icon-sm",status:n,onStop:i,onClick:s,children:a,...o})=>{let l="submitted"===n||"streaming"===n,c=(0,v.jsx)(gx,{className:"size-4"});return"submitted"===n?c=(0,v.jsx)(gv.default,{className:"size-4 animate-spin"}):"streaming"===n?c=(0,v.jsx)(gw,{className:"size-4"}):"error"===n&&(c=(0,v.jsx)(aB.XIcon,{className:"size-4"})),(0,v.jsx)(gg,{"aria-label":l?"Stop":"Submit",className:(0,A.cn)(e),onClick:e=>{if(l&&i){e.preventDefault(),i();return}s?.(e)},size:r,type:l&&i?"button":"submit",variant:t,...o,children:a??c})};var gM=Symbol("radix.slottable");function gL(e){return b.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===gM}var gI=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{var r,n;let i,s,a,o=(n=r=`Primitive.${t}`,(i=b.forwardRef((e,t)=>{let{children:r,...n}=e;if(b.isValidElement(r)){var i;let e,s,a=(i=r,(s=(e=Object.getOwnPropertyDescriptor(i.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.ref:(s=(e=Object.getOwnPropertyDescriptor(i,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.props.ref:i.props.ref||i.ref),o=function(e,t){let r={...t};for(let n in t){let i=e[n],s=t[n];/^on[A-Z]/.test(n)?i&&s?r[n]=(...e)=>{let t=s(...e);return i(...e),t}:i&&(r[n]=i):"style"===n?r[n]={...i,...s}:"className"===n&&(r[n]=[i,s].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==b.Fragment&&(o.ref=t?(0,aJ.composeRefs)(t,a):a),b.cloneElement(r,o)}return b.Children.count(r)>1?b.Children.only(null):null})).displayName=`${n}.SlotClone`,s=i,(a=b.forwardRef((e,t)=>{let{children:r,...n}=e,i=b.Children.toArray(r),a=i.find(gL);if(a){let e=a.props.children,r=i.map(t=>t!==a?t:b.Children.count(e)>1?b.Children.only(null):b.isValidElement(e)?e.props.children:null);return(0,v.jsx)(s,{...n,ref:t,children:b.isValidElement(e)?b.cloneElement(e,void 0,r):null})}return(0,v.jsx)(s,{...n,ref:t,children:r})})).displayName=`${r}.Slot`,a),l=b.forwardRef((e,r)=>{let{asChild:n,...i}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,v.jsx)(n?o:t,{...i,ref:r})});return l.displayName=`Primitive.${t}`,{...e,[t]:l}},{}),gD=e.i(992421),gO="ScrollArea",[gB,gF]=function(e,t=[]){let r=[],n=()=>{let t=r.map(e=>b.createContext(e));return function(r){let n=r?.[e]||t;return b.useMemo(()=>({[`__scope${e}`]:{...r,[e]:n}}),[r,n])}};return n.scopeName=e,[function(t,n){let i=b.createContext(n),s=r.length;r=[...r,n];let a=t=>{let{scope:r,children:n,...a}=t,o=r?.[e]?.[s]||i,l=b.useMemo(()=>a,Object.values(a));return(0,v.jsx)(o.Provider,{value:l,children:n})};return a.displayName=t+"Provider",[a,function(r,a){let o=a?.[e]?.[s]||i,l=b.useContext(o);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 b.useMemo(()=>({[`__scope${t.scopeName}`]:n}),[n])}};return r.scopeName=t.scopeName,r}(n,...t)]}(gO),[g$,gz]=gB(gO),gV=b.forwardRef((e,t)=>{let{__scopeScrollArea:r,type:n="hover",dir:i,scrollHideDelay:s=600,...a}=e,[o,l]=b.useState(null),[c,u]=b.useState(null),[d,h]=b.useState(null),[p,m]=b.useState(null),[f,g]=b.useState(null),[y,x]=b.useState(0),[w,k]=b.useState(0),[S,j]=b.useState(!1),[A,N]=b.useState(!1),C=(0,aJ.useComposedRefs)(t,e=>l(e)),_=(0,mA.useDirection)(i);return(0,v.jsx)(g$,{scope:r,type:n,dir:_,scrollHideDelay:s,scrollArea:o,viewport:c,onViewportChange:u,content:d,onContentChange:h,scrollbarX:p,onScrollbarXChange:m,scrollbarXEnabled:S,onScrollbarXEnabledChange:j,scrollbarY:f,onScrollbarYChange:g,scrollbarYEnabled:A,onScrollbarYEnabledChange:N,onCornerWidthChange:x,onCornerHeightChange:k,children:(0,v.jsx)(gI.div,{dir:_,...a,ref:C,style:{position:"relative","--radix-scroll-area-corner-width":y+"px","--radix-scroll-area-corner-height":w+"px",...e.style}})})});gV.displayName=gO;var gU="ScrollAreaViewport",gG=b.forwardRef((e,t)=>{let{__scopeScrollArea:r,children:n,nonce:i,...s}=e,a=gz(gU,r),o=b.useRef(null),l=(0,aJ.useComposedRefs)(t,o,a.onViewportChange);return(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:i}),(0,v.jsx)(gI.div,{"data-radix-scroll-area-viewport":"",...s,ref:l,style:{overflowX:a.scrollbarXEnabled?"scroll":"hidden",overflowY:a.scrollbarYEnabled?"scroll":"hidden",...e.style},children:(0,v.jsx)("div",{ref:a.onContentChange,style:{minWidth:"100%",display:"table"},children:n})})]})});gG.displayName=gU;var gW="ScrollAreaScrollbar",gH=b.forwardRef((e,t)=>{let{forceMount:r,...n}=e,i=gz(gW,e.__scopeScrollArea),{onScrollbarXEnabledChange:s,onScrollbarYEnabledChange:a}=i,o="horizontal"===e.orientation;return b.useEffect(()=>(o?s(!0):a(!0),()=>{o?s(!1):a(!1)}),[o,s,a]),"hover"===i.type?(0,v.jsx)(gq,{...n,ref:t,forceMount:r}):"scroll"===i.type?(0,v.jsx)(gK,{...n,ref:t,forceMount:r}):"auto"===i.type?(0,v.jsx)(gY,{...n,ref:t,forceMount:r}):"always"===i.type?(0,v.jsx)(gX,{...n,ref:t}):null});gH.displayName=gW;var gq=b.forwardRef((e,t)=>{let{forceMount:r,...n}=e,i=gz(gW,e.__scopeScrollArea),[s,a]=b.useState(!1);return b.useEffect(()=>{let e=i.scrollArea,t=0;if(e){let r=()=>{window.clearTimeout(t),a(!0)},n=()=>{t=window.setTimeout(()=>a(!1),i.scrollHideDelay)};return e.addEventListener("pointerenter",r),e.addEventListener("pointerleave",n),()=>{window.clearTimeout(t),e.removeEventListener("pointerenter",r),e.removeEventListener("pointerleave",n)}}},[i.scrollArea,i.scrollHideDelay]),(0,v.jsx)(a1.Presence,{present:r||s,children:(0,v.jsx)(gY,{"data-state":s?"visible":"hidden",...n,ref:t})})}),gK=b.forwardRef((e,t)=>{var r;let{forceMount:n,...i}=e,s=gz(gW,e.__scopeScrollArea),a="horizontal"===e.orientation,o=yi(()=>c("SCROLL_END"),100),[l,c]=(r={hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}},b.useReducer((e,t)=>r[e][t]??e,"hidden"));return b.useEffect(()=>{if("idle"===l){let e=window.setTimeout(()=>c("HIDE"),s.scrollHideDelay);return()=>window.clearTimeout(e)}},[l,s.scrollHideDelay,c]),b.useEffect(()=>{let e=s.viewport,t=a?"scrollLeft":"scrollTop";if(e){let r=e[t],n=()=>{let n=e[t];r!==n&&(c("SCROLL"),o()),r=n};return e.addEventListener("scroll",n),()=>e.removeEventListener("scroll",n)}},[s.viewport,a,c,o]),(0,v.jsx)(a1.Presence,{present:n||"hidden"!==l,children:(0,v.jsx)(gX,{"data-state":"hidden"===l?"hidden":"visible",...i,ref:t,onPointerEnter:(0,aK.composeEventHandlers)(e.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:(0,aK.composeEventHandlers)(e.onPointerLeave,()=>c("POINTER_LEAVE"))})})}),gY=b.forwardRef((e,t)=>{let r=gz(gW,e.__scopeScrollArea),{forceMount:n,...i}=e,[s,a]=b.useState(!1),o="horizontal"===e.orientation,l=yi(()=>{if(r.viewport){let e=r.viewport.offsetWidth<r.viewport.scrollWidth,t=r.viewport.offsetHeight<r.viewport.scrollHeight;a(o?e:t)}},10);return ys(r.viewport,l),ys(r.content,l),(0,v.jsx)(a1.Presence,{present:n||s,children:(0,v.jsx)(gX,{"data-state":s?"visible":"hidden",...i,ref:t})})}),gX=b.forwardRef((e,t)=>{let{orientation:r="vertical",...n}=e,i=gz(gW,e.__scopeScrollArea),s=b.useRef(null),a=b.useRef(0),[o,l]=b.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),c=g7(o.viewport,o.content),u={...n,sizes:o,onSizesChange:l,hasThumb:!!(c>0&&c<1),onThumbChange:e=>s.current=e,onThumbPointerUp:()=>a.current=0,onThumbPointerDown:e=>a.current=e};function d(e,t){return function(e,t,r,n="ltr"){let i=ye(r),s=t||i/2,a=r.scrollbar.paddingStart+s,o=r.scrollbar.size-r.scrollbar.paddingEnd-(i-s),l=r.content-r.viewport;return yr([a,o],"ltr"===n?[0,l]:[-1*l,0])(e)}(e,a.current,o,t)}return"horizontal"===r?(0,v.jsx)(gJ,{...u,ref:t,onThumbPositionChange:()=>{if(i.viewport&&s.current){let e=yt(i.viewport.scrollLeft,o,i.dir);s.current.style.transform=`translate3d(${e}px, 0, 0)`}},onWheelScroll:e=>{i.viewport&&(i.viewport.scrollLeft=e)},onDragScroll:e=>{i.viewport&&(i.viewport.scrollLeft=d(e,i.dir))}}):"vertical"===r?(0,v.jsx)(gZ,{...u,ref:t,onThumbPositionChange:()=>{if(i.viewport&&s.current){let e=yt(i.viewport.scrollTop,o);s.current.style.transform=`translate3d(0, ${e}px, 0)`}},onWheelScroll:e=>{i.viewport&&(i.viewport.scrollTop=e)},onDragScroll:e=>{i.viewport&&(i.viewport.scrollTop=d(e))}}):null}),gJ=b.forwardRef((e,t)=>{let{sizes:r,onSizesChange:n,...i}=e,s=gz(gW,e.__scopeScrollArea),[a,o]=b.useState(),l=b.useRef(null),c=(0,aJ.useComposedRefs)(t,l,s.onScrollbarXChange);return b.useEffect(()=>{l.current&&o(getComputedStyle(l.current))},[l]),(0,v.jsx)(g1,{"data-orientation":"horizontal",...i,ref:c,sizes:r,style:{bottom:0,left:"rtl"===s.dir?"var(--radix-scroll-area-corner-width)":0,right:"ltr"===s.dir?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":ye(r)+"px",...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.x),onDragScroll:t=>e.onDragScroll(t.x),onWheelScroll:(t,r)=>{if(s.viewport){var n,i;let a=s.viewport.scrollLeft+t.deltaX;e.onWheelScroll(a),n=a,i=r,n>0&&n<i&&t.preventDefault()}},onResize:()=>{l.current&&s.viewport&&a&&n({content:s.viewport.scrollWidth,viewport:s.viewport.offsetWidth,scrollbar:{size:l.current.clientWidth,paddingStart:g9(a.paddingLeft),paddingEnd:g9(a.paddingRight)}})}})}),gZ=b.forwardRef((e,t)=>{let{sizes:r,onSizesChange:n,...i}=e,s=gz(gW,e.__scopeScrollArea),[a,o]=b.useState(),l=b.useRef(null),c=(0,aJ.useComposedRefs)(t,l,s.onScrollbarYChange);return b.useEffect(()=>{l.current&&o(getComputedStyle(l.current))},[l]),(0,v.jsx)(g1,{"data-orientation":"vertical",...i,ref:c,sizes:r,style:{top:0,right:"ltr"===s.dir?0:void 0,left:"rtl"===s.dir?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":ye(r)+"px",...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.y),onDragScroll:t=>e.onDragScroll(t.y),onWheelScroll:(t,r)=>{if(s.viewport){var n,i;let a=s.viewport.scrollTop+t.deltaY;e.onWheelScroll(a),n=a,i=r,n>0&&n<i&&t.preventDefault()}},onResize:()=>{l.current&&s.viewport&&a&&n({content:s.viewport.scrollHeight,viewport:s.viewport.offsetHeight,scrollbar:{size:l.current.clientHeight,paddingStart:g9(a.paddingTop),paddingEnd:g9(a.paddingBottom)}})}})}),[gQ,g0]=gB(gW),g1=b.forwardRef((e,t)=>{let{__scopeScrollArea:r,sizes:n,hasThumb:i,onThumbChange:s,onThumbPointerUp:a,onThumbPointerDown:o,onThumbPositionChange:l,onDragScroll:c,onWheelScroll:u,onResize:d,...h}=e,p=gz(gW,r),[m,f]=b.useState(null),g=(0,aJ.useComposedRefs)(t,e=>f(e)),y=b.useRef(null),x=b.useRef(""),w=p.viewport,k=n.content-n.viewport,S=(0,mB.useCallbackRef)(u),j=(0,mB.useCallbackRef)(l),A=yi(d,10);function N(e){y.current&&c({x:e.clientX-y.current.left,y:e.clientY-y.current.top})}return b.useEffect(()=>{let e=e=>{let t=e.target;m?.contains(t)&&S(e,k)};return document.addEventListener("wheel",e,{passive:!1}),()=>document.removeEventListener("wheel",e,{passive:!1})},[w,m,k,S]),b.useEffect(j,[n,j]),ys(m,A),ys(p.content,A),(0,v.jsx)(gQ,{scope:r,scrollbar:m,hasThumb:i,onThumbChange:(0,mB.useCallbackRef)(s),onThumbPointerUp:(0,mB.useCallbackRef)(a),onThumbPositionChange:j,onThumbPointerDown:(0,mB.useCallbackRef)(o),children:(0,v.jsx)(gI.div,{...h,ref:g,style:{position:"absolute",...h.style},onPointerDown:(0,aK.composeEventHandlers)(e.onPointerDown,e=>{0===e.button&&(e.target.setPointerCapture(e.pointerId),y.current=m.getBoundingClientRect(),x.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",p.viewport&&(p.viewport.style.scrollBehavior="auto"),N(e))}),onPointerMove:(0,aK.composeEventHandlers)(e.onPointerMove,N),onPointerUp:(0,aK.composeEventHandlers)(e.onPointerUp,e=>{let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),document.body.style.webkitUserSelect=x.current,p.viewport&&(p.viewport.style.scrollBehavior=""),y.current=null})})})}),g2="ScrollAreaThumb",g5=b.forwardRef((e,t)=>{let{forceMount:r,...n}=e,i=g0(g2,e.__scopeScrollArea);return(0,v.jsx)(a1.Presence,{present:r||i.hasThumb,children:(0,v.jsx)(g3,{ref:t,...n})})}),g3=b.forwardRef((e,t)=>{let{__scopeScrollArea:r,style:n,...i}=e,s=gz(g2,r),a=g0(g2,r),{onThumbPositionChange:o}=a,l=(0,aJ.useComposedRefs)(t,e=>a.onThumbChange(e)),c=b.useRef(void 0),u=yi(()=>{c.current&&(c.current(),c.current=void 0)},100);return b.useEffect(()=>{let e=s.viewport;if(e){let t=()=>{u(),c.current||(c.current=yn(e,o),o())};return o(),e.addEventListener("scroll",t),()=>e.removeEventListener("scroll",t)}},[s.viewport,u,o]),(0,v.jsx)(gI.div,{"data-state":a.hasThumb?"visible":"hidden",...i,ref:l,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...n},onPointerDownCapture:(0,aK.composeEventHandlers)(e.onPointerDownCapture,e=>{let t=e.target.getBoundingClientRect(),r=e.clientX-t.left,n=e.clientY-t.top;a.onThumbPointerDown({x:r,y:n})}),onPointerUp:(0,aK.composeEventHandlers)(e.onPointerUp,a.onThumbPointerUp)})});g5.displayName=g2;var g6="ScrollAreaCorner",g8=b.forwardRef((e,t)=>{let r=gz(g6,e.__scopeScrollArea),n=!!(r.scrollbarX&&r.scrollbarY);return"scroll"!==r.type&&n?(0,v.jsx)(g4,{...e,ref:t}):null});g8.displayName=g6;var g4=b.forwardRef((e,t)=>{let{__scopeScrollArea:r,...n}=e,i=gz(g6,r),[s,a]=b.useState(0),[o,l]=b.useState(0),c=!!(s&&o);return ys(i.scrollbarX,()=>{let e=i.scrollbarX?.offsetHeight||0;i.onCornerHeightChange(e),l(e)}),ys(i.scrollbarY,()=>{let e=i.scrollbarY?.offsetWidth||0;i.onCornerWidthChange(e),a(e)}),c?(0,v.jsx)(gI.div,{...n,ref:t,style:{width:s,height:o,position:"absolute",right:"ltr"===i.dir?0:void 0,left:"rtl"===i.dir?0:void 0,bottom:0,...e.style}}):null});function g9(e){return e?parseInt(e,10):0}function g7(e,t){let r=e/t;return isNaN(r)?0:r}function ye(e){let t=g7(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd;return Math.max((e.scrollbar.size-r)*t,18)}function yt(e,t,r="ltr"){let n=ye(t),i=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,s=t.scrollbar.size-i,a=t.content-t.viewport,o=(0,gD.clamp)(e,"ltr"===r?[0,a]:[-1*a,0]);return yr([0,a],[0,s-n])(o)}function yr(e,t){return r=>{if(e[0]===e[1]||t[0]===t[1])return t[0];let n=(t[1]-t[0])/(e[1]-e[0]);return t[0]+n*(r-e[0])}}var yn=(e,t=()=>{})=>{let r={left:e.scrollLeft,top:e.scrollTop},n=0;return!function i(){let s={left:e.scrollLeft,top:e.scrollTop},a=r.left!==s.left,o=r.top!==s.top;(a||o)&&t(),r=s,n=window.requestAnimationFrame(i)}(),()=>window.cancelAnimationFrame(n)};function yi(e,t){let r=(0,mB.useCallbackRef)(e),n=b.useRef(0);return b.useEffect(()=>()=>window.clearTimeout(n.current),[]),b.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(r,t)},[r,t])}function ys(e,t){let r=(0,mB.useCallbackRef)(t);(0,aX.useLayoutEffect)(()=>{let t=0;if(e){let n=new ResizeObserver(()=>{cancelAnimationFrame(t),t=window.requestAnimationFrame(r)});return n.observe(e),()=>{window.cancelAnimationFrame(t),n.unobserve(e)}}},[e,r])}function ya({className:e,children:t,...r}){return(0,v.jsxs)(gV,{"data-slot":"scroll-area",className:(0,A.cn)("relative",e),...r,children:[(0,v.jsx)(gG,{"data-slot":"scroll-area-viewport",className:"focus-visible:ring-ring/50 size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1",children:t}),(0,v.jsx)(yo,{}),(0,v.jsx)(g8,{})]})}function yo({className:e,orientation:t="vertical",...r}){return(0,v.jsx)(gH,{"data-slot":"scroll-area-scrollbar",orientation:t,className:(0,A.cn)("flex touch-none p-px transition-colors select-none","vertical"===t&&"h-full w-2.5 border-l border-l-transparent","horizontal"===t&&"h-2.5 flex-col border-t border-t-transparent",e),...r,children:(0,v.jsx)(g5,{"data-slot":"scroll-area-thumb",className:"bg-border relative flex-1 rounded-full"})})}let yl=({className:e,children:t,...r})=>(0,v.jsxs)(ya,{className:"w-full overflow-x-auto whitespace-nowrap",...r,children:[(0,v.jsx)("div",{className:(0,A.cn)("flex w-max flex-nowrap items-center gap-2",e),children:t}),(0,v.jsx)(yo,{className:"hidden",orientation:"horizontal"})]}),yc=({suggestion:e,onClick:t,className:r,variant:n="outline",size:i="sm",children:s,...a})=>(0,v.jsx)(_.Button,{className:(0,A.cn)("cursor-pointer rounded-full px-4 transition-all duration-200","hover:scale-[1.02] hover:shadow-md hover:border-primary/50",r),onClick:()=>{t?.(e)},size:i,type:"button",variant:n,...a,children:s||e});var yu=e.i(524741);let yd=(0,E.default)("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),yh=(0,E.default)("circle-dot",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]]),yp=(0,E.default)("list-todo",[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["rect",{x:"3",y:"4",width:"6",height:"6",rx:"1",key:"cif1o7"}]]),ym={pending:ou,in_progress:yh,completed:yd,cancelled:op},yf={pending:"text-muted-foreground",in_progress:"text-primary",completed:"text-green-500",cancelled:"text-muted-foreground/50"};function yg({todosData:e,isLoading:t,className:r}){let[n,i]=(0,b.useState)(!1);if(!e||0===e.todos.length)return null;let{todos:s,stats:a,nextTodo:o}=e,l=[...s].sort((e,t)=>{let r={in_progress:0,pending:1,completed:2,cancelled:3};return(r[e.status]??4)-(r[t.status]??4)}),c=a.total>0?Math.round(a.completed/a.total*100):0;return(0,v.jsxs)("div",{className:(0,A.cn)("rounded-lg border bg-card/50 backdrop-blur-sm overflow-hidden",r),children:[(0,v.jsxs)("button",{onClick:()=>i(!n),className:"flex items-center justify-between w-full px-3 py-2 hover:bg-muted/50 transition-colors",children:[(0,v.jsxs)("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[(0,v.jsx)(yp,{className:"size-4 text-primary shrink-0"}),!n&&o?(0,v.jsxs)("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[(0,v.jsx)(yh,{className:"size-3.5 text-primary shrink-0"}),(0,v.jsx)("span",{className:"text-sm truncate",children:o.content})]}):(0,v.jsx)("span",{className:"font-medium text-sm",children:"Tasks"}),(0,v.jsxs)("span",{className:"text-xs text-muted-foreground shrink-0",children:[a.completed,"/",a.total]})]}),(0,v.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[(0,v.jsx)("div",{className:"w-16 h-1.5 bg-muted rounded-full overflow-hidden",children:(0,v.jsx)("div",{className:"h-full bg-primary transition-all duration-300",style:{width:`${c}%`}})}),n?(0,v.jsx)(oc.ChevronDownIcon,{className:"size-4 text-muted-foreground"}):(0,v.jsx)(aD,{className:"size-4 text-muted-foreground"})]})]}),n&&(0,v.jsxs)("div",{className:"border-t",children:[o&&(0,v.jsxs)("div",{className:"px-3 py-2 bg-primary/5 border-b flex items-center gap-2",children:[(0,v.jsx)(yh,{className:"size-4 text-primary shrink-0"}),(0,v.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,v.jsx)("span",{className:"text-xs text-primary font-medium uppercase tracking-wide",children:"Current"}),(0,v.jsx)("p",{className:"text-sm font-medium truncate",children:o.content})]})]}),(0,v.jsx)("div",{className:"max-h-[200px] overflow-auto",children:l.map(e=>{let t=ym[e.status]||ou,r=yf[e.status]||"text-muted-foreground",n=e.id===o?.id;return(0,v.jsxs)(T.Tooltip,{children:[(0,v.jsx)(T.TooltipTrigger,{asChild:!0,children:(0,v.jsxs)("div",{className:(0,A.cn)("flex items-start gap-2 px-3 py-1.5 hover:bg-muted/30 transition-colors cursor-default",n&&"bg-primary/5"),children:[(0,v.jsx)(t,{className:(0,A.cn)("size-4 mt-0.5 shrink-0",r)}),(0,v.jsx)("span",{className:(0,A.cn)("text-sm flex-1 min-w-0 truncate","cancelled"===e.status&&"line-through text-muted-foreground/50","completed"===e.status&&"text-muted-foreground"),children:e.content})]})}),(0,v.jsxs)(T.TooltipContent,{side:"left",className:"max-w-xs",children:[(0,v.jsx)("p",{className:"text-sm",children:e.content}),(0,v.jsx)("p",{className:"text-xs text-muted-foreground capitalize mt-1",children:e.status.replace("_"," ")})]})]},e.id)})}),(0,v.jsxs)("div",{className:"px-3 py-1.5 border-t bg-muted/30 flex items-center gap-3 text-xs text-muted-foreground",children:[a.inProgress>0&&(0,v.jsxs)("span",{className:"flex items-center gap-1",children:[(0,v.jsx)(yh,{className:"size-3 text-primary"}),a.inProgress," active"]}),a.pending>0&&(0,v.jsxs)("span",{className:"flex items-center gap-1",children:[(0,v.jsx)(ou,{className:"size-3"}),a.pending," pending"]}),a.completed>0&&(0,v.jsxs)("span",{className:"flex items-center gap-1",children:[(0,v.jsx)(yd,{className:"size-3 text-green-500"}),a.completed," done"]})]})]})]})}var yy=e.i(739963),yx=e.i(300739);let yv=(0,E.default)("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),yb=(0,E.default)("file-code",[["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 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}]]),yw=(0,E.default)("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"}]]);var yk=e.i(719583),yS=e.i(816187);let yj=(0,E.default)("rotate-ccw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]),yA=(0,E.default)("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"}]]);var yN=e.i(220563),yC=e.i(529757),y_=e.i(865259),yT=e.i(634066);let yE=(0,E.default)("file",[["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"}]]),yP=(0,E.default)("file-plus",[["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:"M9 15h6",key:"cctwl0"}],["path",{d:"M12 18v-6",key:"17g6i2"}]]),yR=(0,b.memo)(({line:e,type:t})=>(0,v.jsxs)("div",{className:(0,A.cn)("font-mono text-xs leading-5 px-2","add"===t?"bg-green-500/10":"remove"===t?"bg-red-500/10":"","add"===t?"text-green-600 dark:text-green-400":"remove"===t?"text-red-600 dark:text-red-400":"text-muted-foreground"),children:[(0,v.jsx)("span",{className:"select-none w-4 inline-block",children:"add"===t?"+":"remove"===t?"-":" "}),(0,v.jsx)("span",{className:"whitespace-pre-wrap break-all",children:e||" "})]}));function yM({input:e,output:t,status:r,streamingArgsText:n,className:i}){let[s,a]=(0,b.useState)(!0),o=e?.path||"",l=o.split("/").pop()||"file",c=e?.mode||t?.mode||"full",u={ts:"typescript",tsx:"tsx",js:"javascript",jsx:"jsx",py:"python",rb:"ruby",go:"go",rs:"rust",java:"java",c:"c",cpp:"cpp",h:"c",hpp:"cpp",cs:"csharp",php:"php",swift:"swift",kt:"kotlin",scala:"scala",sh:"bash",bash:"bash",zsh:"bash",fish:"bash",ps1:"powershell",sql:"sql",html:"html",htm:"html",css:"css",scss:"scss",sass:"sass",less:"less",json:"json",yaml:"yaml",yml:"yaml",xml:"xml",md:"markdown",markdown:"markdown",txt:"plaintext",toml:"toml",ini:"ini",cfg:"ini",conf:"ini",dockerfile:"dockerfile",makefile:"makefile"}[o.split(".").pop()?.toLowerCase()||""]||"plaintext",d=(0,b.useMemo)(()=>{if(!n)return null;try{return JSON.parse(n)}catch{let e=n.match(/"content"\s*:\s*"((?:[^"\\]|\\[\s\S])*)(?:"|$)/);if(e)try{return{content:JSON.parse(`"${e[1]}"`)}}catch{return{content:e[1]}}let t=n.match(/"old_string"\s*:\s*"((?:[^"\\]|\\[\s\S])*)(?:"|$)/),r=n.match(/"new_string"\s*:\s*"((?:[^"\\]|\\[\s\S])*)(?:"|$)/);if(t||r)return{old_string:t?t[1]:void 0,new_string:r?r[1]:void 0};return null}},[n]),h=e?.content||d?.content||"",p=e?.old_string||d?.old_string||"",m=e?.new_string||d?.new_string||"",f="streaming"===r||"pending"===r,g="completed"===r,y="error"===r||t?.success===!1,x=g&&t?.success?ol:y?op:f?yb:yE,w=g&&t?.success?"text-green-600 dark:text-green-500":y?"text-red-600 dark:text-red-500":f?"text-blue-600 dark:text-blue-500":"text-muted-foreground",k="str_replace"===c?yw:t?.action==="created"?yP:yb;return(0,v.jsxs)("div",{className:(0,A.cn)("rounded-lg border overflow-hidden bg-background",i),children:[(0,v.jsxs)("button",{onClick:()=>a(!s),className:"flex items-center justify-between w-full px-3 py-2.5 bg-muted/50 hover:bg-muted/70 transition-colors",children:[(0,v.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,v.jsx)(x,{className:(0,A.cn)("size-4 shrink-0",w)}),(0,v.jsx)(k,{className:"size-3.5 text-muted-foreground shrink-0"}),(0,v.jsx)("span",{className:"font-medium text-sm truncate",children:l}),"str_replace"===c&&(0,v.jsx)(C,{variant:"secondary",className:"text-xs shrink-0",children:"edit"}),t?.action==="created"&&(0,v.jsx)(C,{variant:"secondary",className:"text-xs shrink-0",children:"new"}),f&&(0,v.jsx)("span",{className:"text-xs text-muted-foreground animate-pulse",children:"streaming..."})]}),(0,v.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[t?.success&&void 0!==t.lineDelta&&(0,v.jsxs)("span",{className:(0,A.cn)("text-xs font-mono",t.lineDelta>=0?"text-green-600 dark:text-green-400":"text-red-600 dark:text-red-400"),children:[t.lineDelta>=0?"+":"",t.lineDelta]}),s?(0,v.jsx)(oc.ChevronDownIcon,{className:"size-4 text-muted-foreground"}):(0,v.jsx)(aD,{className:"size-4 text-muted-foreground"})]})]}),s&&(0,v.jsxs)("div",{className:"border-t",children:[(0,v.jsxs)("div",{className:"px-3 py-1.5 bg-muted/30 border-b flex items-center justify-between",children:[(0,v.jsx)("span",{className:"text-xs text-muted-foreground font-mono truncate",children:o}),h&&(0,v.jsx)(_.Button,{variant:"ghost",size:"icon",className:"size-6",onClick:()=>navigator.clipboard.writeText(h),children:(0,v.jsx)(of,{className:"size-3"})})]}),"str_replace"===c?(0,v.jsxs)("div",{className:"max-h-[200px] overflow-auto",children:[p&&(0,v.jsxs)("div",{className:"border-b",children:[(0,v.jsx)("div",{className:"px-3 py-1 bg-red-500/5 border-b text-xs text-red-600 dark:text-red-400 font-medium",children:"Removed"}),(0,v.jsx)("div",{className:"py-1",children:p.split("\n").map((e,t)=>(0,v.jsx)(yR,{line:e,type:"remove"},`old-${t}`))})]}),m&&(0,v.jsxs)("div",{children:[(0,v.jsx)("div",{className:"px-3 py-1 bg-green-500/5 border-b text-xs text-green-600 dark:text-green-400 font-medium",children:"Added"}),(0,v.jsx)("div",{className:"py-1",children:m.split("\n").map((e,t)=>(0,v.jsx)(yR,{line:e,type:"add"},`new-${t}`))})]}),!p&&!m&&f&&(0,v.jsx)("div",{className:"px-3 py-4 text-center text-muted-foreground text-sm",children:(0,v.jsx)("span",{className:"animate-pulse",children:"Receiving changes..."})})]}):(0,v.jsx)("div",{className:"max-h-[200px] overflow-auto",children:h?(0,v.jsx)(oE,{code:h,language:u,showLineNumbers:!0}):f?(0,v.jsx)("div",{className:"px-3 py-4 text-center text-muted-foreground text-sm",children:(0,v.jsx)("span",{className:"animate-pulse",children:"Writing file..."})}):null}),(t?.success===!0||t?.success===!1||y)&&(0,v.jsx)("div",{className:(0,A.cn)("px-3 py-2 border-t text-xs flex items-center gap-2",t?.success===!0?"bg-green-500/5 text-green-600 dark:text-green-400":"bg-red-500/5 text-red-600 dark:text-red-400"),children:t?.success===!0?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(ol,{className:"size-3.5"}),(0,v.jsx)("span",{children:"str_replace"===c?`Replaced ${t.linesRemoved||0} → ${t.linesAdded||0} lines`:`${"created"===t.action?"Created":"Updated"} (${t.lineCount||0} lines)`})]}):(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(op,{className:"size-3.5"}),(0,v.jsx)("span",{children:t?.error||"Failed to write file"})]})})]})]})}yR.displayName="DiffLine";let yL=(0,E.default)("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"}]]);var yI=e.i(416667),yI=yI;let yD=(0,E.default)("scissors",[["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M8.12 8.12 12 12",key:"1alkpv"}],["path",{d:"M20 4 8.12 15.88",key:"xgtan2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M14.8 14.8 20 20",key:"ptml3r"}]]);function yO({input:e,output:t,status:r,className:n}){var i;let[s,a]=(0,b.useState)(!0),o=e?.path||t?.relativePath||t?.path||"",l=o.split("/").pop()||"file",c={ts:"typescript",tsx:"tsx",js:"javascript",jsx:"jsx",py:"python",rb:"ruby",go:"go",rs:"rust",java:"java",c:"c",cpp:"cpp",h:"c",hpp:"cpp",cs:"csharp",php:"php",swift:"swift",kt:"kotlin",scala:"scala",sh:"bash",bash:"bash",zsh:"bash",fish:"bash",ps1:"powershell",sql:"sql",html:"html",htm:"html",css:"css",scss:"scss",sass:"sass",less:"less",json:"json",yaml:"yaml",yml:"yaml",xml:"xml",md:"markdown",markdown:"markdown",txt:"plaintext",toml:"toml",ini:"ini",cfg:"ini",conf:"ini",dockerfile:"dockerfile",makefile:"makefile"}[o.split(".").pop()?.toLowerCase()||""]||"plaintext",u=t?.content||"",d="pending"===r||"streaming"===r||"running"===r,h="completed"===r&&t?.success===!0,p="error"===r||t?.success===!1,m=(0,b.useMemo)(()=>e?.startLine&&e?.endLine?`lines ${e.startLine}-${e.endLine}`:e?.startLine?`from line ${e.startLine}`:e?.endLine?`to line ${e.endLine}`:null,[e?.startLine,e?.endLine]),f=h?ol:p?yI.default:yE;return(0,v.jsxs)("div",{className:(0,A.cn)("rounded-lg border overflow-hidden bg-background",n),children:[(0,v.jsxs)("button",{onClick:()=>a(!s),className:"flex items-center justify-between w-full px-3 py-2.5 bg-muted/50 hover:bg-muted/70 transition-colors",children:[(0,v.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,v.jsx)(f,{className:(0,A.cn)("size-4 shrink-0",h?"text-green-600 dark:text-green-500":p?"text-red-600 dark:text-red-500":"text-muted-foreground")}),(0,v.jsx)(yL,{className:"size-3.5 text-muted-foreground shrink-0"}),(0,v.jsx)("span",{className:"font-medium text-sm truncate",children:l}),m&&(0,v.jsx)(C,{variant:"outline",className:"text-xs shrink-0",children:m}),t?.wasTruncated&&(0,v.jsxs)(C,{variant:"secondary",className:"text-xs shrink-0 gap-1",children:[(0,v.jsx)(yD,{className:"size-3"}),"truncated"]}),d&&(0,v.jsx)("span",{className:"text-xs text-muted-foreground animate-pulse",children:"reading..."})]}),(0,v.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[t?.lineCount!==void 0&&(0,v.jsxs)("span",{className:"text-xs text-muted-foreground",children:[t.lineCount," lines"]}),s?(0,v.jsx)(oc.ChevronDownIcon,{className:"size-4 text-muted-foreground"}):(0,v.jsx)(aD,{className:"size-4 text-muted-foreground"})]})]}),s&&(0,v.jsxs)("div",{className:"border-t",children:[(0,v.jsxs)("div",{className:"px-3 py-1.5 bg-muted/30 border-b flex items-center justify-between",children:[(0,v.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,v.jsx)("span",{className:"text-xs text-muted-foreground font-mono truncate",children:o}),t?.sizeBytes!==void 0&&(0,v.jsxs)("span",{className:"text-xs text-muted-foreground/60 shrink-0",children:["(",(i=t.sizeBytes)<1024?`${i} B`:i<1048576?`${(i/1024).toFixed(1)} KB`:`${(i/1024/1024).toFixed(2)} MB`,")"]})]}),u&&(0,v.jsx)(_.Button,{variant:"ghost",size:"icon",className:"size-6",onClick:e=>{e.stopPropagation(),navigator.clipboard.writeText(u)},children:(0,v.jsx)(of,{className:"size-3"})})]}),(0,v.jsx)("div",{className:"max-h-[200px] overflow-auto",children:d?(0,v.jsx)("div",{className:"px-3 py-8 text-center text-muted-foreground text-sm",children:(0,v.jsx)("span",{className:"animate-pulse",children:"Reading file..."})}):p?(0,v.jsxs)("div",{className:"px-3 py-4 text-red-600 dark:text-red-400 text-sm flex items-start gap-2",children:[(0,v.jsx)(yI.default,{className:"size-4 mt-0.5 shrink-0"}),(0,v.jsx)("span",{children:t?.error||"Failed to read file"})]}):u?(0,v.jsx)(oE,{code:u,language:c,showLineNumbers:!0}):(0,v.jsx)("div",{className:"px-3 py-4 text-muted-foreground text-sm italic",children:"File is empty"})}),t?.wasTruncated&&(0,v.jsxs)("div",{className:"px-3 py-2 border-t bg-amber-500/5 text-xs text-amber-600 dark:text-amber-400 flex items-center gap-2",children:[(0,v.jsx)(yD,{className:"size-3.5"}),(0,v.jsx)("span",{children:"Content was truncated. Use startLine/endLine to read specific sections."})]})]})]})}let yB=(0,E.default)("terminal",[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]]),yF=(0,E.default)("radio",[["path",{d:"M16.247 7.761a6 6 0 0 1 0 8.478",key:"1fwjs5"}],["path",{d:"M19.075 4.933a10 10 0 0 1 0 14.134",key:"ehdyv1"}],["path",{d:"M4.925 19.067a10 10 0 0 1 0-14.134",key:"1q22gi"}],["path",{d:"M7.753 16.239a6 6 0 0 1 0-8.478",key:"r2q7qm"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]),y$=(0,E.default)("circle-stop",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]]);function yz({input:e,output:t,status:r,terminalId:n,liveOutput:i,className:s}){let[a,o]=(0,b.useState)(!0),l=(0,b.useRef)(null);(0,b.useEffect)(()=>{l.current&&(l.current.scrollTop=l.current.scrollHeight)},[i,t?.output]);let c=e?.command||"",u=e?.background||!1,d=e?.kill===!0,h=e?.id&&(e?.input!==void 0||e?.key!==void 0),p=e?.id&&!e?.command&&!e?.kill&&!h,m="pending"===r||"streaming"===r||"running"===r,f=m&&n&&void 0!==i,g="completed"===r,y="error"===r||t?.success===!1,x=t?.exitCode,w=(()=>{if(f)return i||"";if(t){let e=t.output||t.stdout||"",r=t.stderr||"";return r?e+(e?"\n":"")+r:e}return""})(),k=c.length>50?c.slice(0,50)+"...":c,{Icon:S,color:j,label:N}=(()=>{if(d)return{Icon:y$,color:"text-amber-600 dark:text-amber-500",label:t?.status==="stopped"?"Stopped":"Stopping..."};if(h){let t=e?.key?`key: ${e.key}`:`input: "${e?.input?.slice(0,20)}..."`;return{Icon:yB,color:"text-purple-600 dark:text-purple-500",label:m?"Sending...":t}}return p?{Icon:yB,color:"text-blue-600 dark:text-blue-500",label:"Logs"}:f?{Icon:yF,color:"text-green-600 dark:text-green-500 animate-pulse",label:"Live"}:m?{Icon:od,color:"text-muted-foreground animate-pulse",label:"Executing..."}:g&&0===x?{Icon:ol,color:"text-green-600 dark:text-green-500",label:"Completed"}:g&&0!==x?{Icon:op,color:"text-red-600 dark:text-red-500",label:`Exit ${x}`}:y?{Icon:op,color:"text-red-600 dark:text-red-500",label:"Error"}:{Icon:yB,color:"text-muted-foreground",label:""}})();return(0,v.jsxs)("div",{className:(0,A.cn)("rounded-lg border overflow-hidden bg-background",s),children:[(0,v.jsxs)("button",{onClick:()=>o(!a),className:"flex items-center justify-between w-full px-3 py-2.5 bg-muted/50 hover:bg-muted/70 transition-colors",children:[(0,v.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,v.jsx)(S,{className:(0,A.cn)("size-4 shrink-0",j)}),(0,v.jsx)(yB,{className:"size-3.5 text-muted-foreground shrink-0"}),(0,v.jsx)("code",{className:"font-mono text-sm truncate",title:c,children:k||(d?`kill ${e?.id}`:p?`logs ${e?.id}`:"bash")}),u&&(0,v.jsx)(C,{variant:"secondary",className:"text-xs shrink-0",children:"background"}),f&&(0,v.jsxs)(C,{variant:"secondary",className:"text-xs shrink-0 bg-green-500/10 text-green-600 dark:text-green-400 gap-1",children:[(0,v.jsx)(yF,{className:"size-2 animate-pulse"}),"live"]}),N&&!f&&(0,v.jsx)("span",{className:(0,A.cn)("text-xs shrink-0",j),children:N})]}),(0,v.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[void 0!==x&&g&&(0,v.jsxs)(C,{variant:0===x?"secondary":"destructive",className:(0,A.cn)("text-xs",0===x?"bg-green-500/10 text-green-600 dark:text-green-400":""),children:["exit ",x]}),a?(0,v.jsx)(oc.ChevronDownIcon,{className:"size-4 text-muted-foreground"}):(0,v.jsx)(aD,{className:"size-4 text-muted-foreground"})]})]}),a&&(0,v.jsxs)("div",{className:"border-t",children:[c&&(0,v.jsxs)("div",{className:"px-3 py-1.5 bg-muted/30 border-b flex items-center justify-between",children:[(0,v.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,v.jsx)("span",{className:"text-muted-foreground text-xs",children:"$"}),(0,v.jsx)("code",{className:"text-xs font-mono truncate",children:c})]}),(0,v.jsx)(_.Button,{variant:"ghost",size:"icon",className:"size-6",onClick:e=>{e.stopPropagation(),navigator.clipboard.writeText(c)},children:(0,v.jsx)(of,{className:"size-3"})})]}),(0,v.jsxs)("div",{ref:l,className:"bg-zinc-950 dark:bg-zinc-950 relative max-h-[300px] overflow-auto",children:[(0,v.jsxs)("pre",{className:"px-3 py-2 text-xs font-mono text-zinc-300 whitespace-pre-wrap break-all min-h-[40px]",children:[w||(0,v.jsx)("span",{className:"text-muted-foreground italic",children:m?"Waiting for output...":"(no output)"}),f&&(0,v.jsx)("span",{className:"inline-block w-2 h-4 bg-green-500 animate-pulse ml-0.5"})]}),w&&(0,v.jsx)(_.Button,{variant:"ghost",size:"icon",className:"absolute top-1 right-1 size-6 text-zinc-500 hover:text-zinc-300 bg-zinc-900/80",onClick:e=>{e.stopPropagation(),navigator.clipboard.writeText(w)},children:(0,v.jsx)(of,{className:"size-3"})})]}),t?.error&&(0,v.jsxs)("div",{className:"px-3 py-2 border-t bg-red-500/5 text-red-600 dark:text-red-400 text-xs flex items-start gap-2",children:[(0,v.jsx)(op,{className:"size-3.5 mt-0.5 shrink-0"}),(0,v.jsx)("span",{children:t.error})]}),t?.message&&!t?.error&&(0,v.jsx)("div",{className:"px-3 py-2 border-t bg-muted/30 text-muted-foreground text-xs",children:t.message})]})]})}var gb=gb;let yV=(0,E.default)("trash",[["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]),yU={pending:ou,in_progress:yh,completed:ol,cancelled:op},yG={pending:"text-muted-foreground",in_progress:"text-blue-600 dark:text-blue-400",completed:"text-green-600 dark:text-green-400",cancelled:"text-muted-foreground/50"},yW={add:"Add Tasks",list:"List Tasks",mark:"Update Task",clear:"Clear Tasks"},yH=({action:e})=>{switch(e){case"add":return(0,v.jsx)(gb.default,{className:"size-3.5"});case"list":default:return(0,v.jsx)(yp,{className:"size-3.5"});case"mark":return(0,v.jsx)(ol,{className:"size-3.5"});case"clear":return(0,v.jsx)(yV,{className:"size-3.5"})}};function yq({input:e,output:t,status:r,className:n}){let[i,s]=(0,b.useState)(!0),a=e?.action||"list",o="pending"===r||"streaming"===r||"running"===r,l="completed"===r,c="error"===r||t?.success===!1,u=l&&t?.success?ol:c?op:o?od:yp,d=l&&t?.success?"text-green-600 dark:text-green-500":c?"text-red-600 dark:text-red-500":o?"text-muted-foreground animate-pulse":"text-muted-foreground",h=e=>{let t=yU[e.status]||ou,r=yG[e.status]||"text-muted-foreground";return(0,v.jsxs)("div",{className:"flex items-start gap-2 py-1",children:[(0,v.jsx)(t,{className:(0,A.cn)("size-4 mt-0.5 shrink-0",r)}),(0,v.jsx)("span",{className:(0,A.cn)("text-sm","cancelled"===e.status&&"line-through text-muted-foreground/50","completed"===e.status&&"text-muted-foreground"),children:e.content})]},e.id)};return(0,v.jsxs)("div",{className:(0,A.cn)("rounded-lg border overflow-hidden bg-background",n),children:[(0,v.jsxs)("button",{onClick:()=>s(!i),className:"flex items-center justify-between w-full px-3 py-2.5 bg-muted/50 hover:bg-muted/70 transition-colors",children:[(0,v.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,v.jsx)(u,{className:(0,A.cn)("size-4 shrink-0",d)}),(0,v.jsx)(yH,{action:a}),(0,v.jsx)("span",{className:"font-medium text-sm",children:yW[a]||a}),o&&(0,v.jsx)("span",{className:"text-xs text-muted-foreground animate-pulse",children:"running..."})]}),(0,v.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[t?.stats&&(0,v.jsx)("div",{className:"flex items-center gap-1.5 text-xs",children:(0,v.jsxs)("span",{className:"text-muted-foreground",children:[t.stats.completed,"/",t.stats.total]})}),t?.itemsAdded!==void 0&&(0,v.jsxs)(C,{variant:"secondary",className:"text-xs bg-green-500/10 text-green-600 dark:text-green-400",children:["+",t.itemsAdded]}),t?.itemsRemoved!==void 0&&(0,v.jsxs)(C,{variant:"secondary",className:"text-xs",children:["cleared ",t.itemsRemoved]}),i?(0,v.jsx)(oc.ChevronDownIcon,{className:"size-4 text-muted-foreground"}):(0,v.jsx)(aD,{className:"size-4 text-muted-foreground"})]})]}),i&&(0,v.jsxs)("div",{className:"border-t",children:[t?.stats&&(0,v.jsxs)("div",{className:"px-3 py-2 bg-muted/30 border-b flex items-center gap-4 text-xs",children:[(0,v.jsxs)("div",{className:"flex items-center gap-1",children:[(0,v.jsx)(ou,{className:"size-3 text-muted-foreground"}),(0,v.jsxs)("span",{children:[t.stats.pending," pending"]})]}),(0,v.jsxs)("div",{className:"flex items-center gap-1",children:[(0,v.jsx)(yh,{className:"size-3 text-blue-500"}),(0,v.jsxs)("span",{children:[t.stats.inProgress," active"]})]}),(0,v.jsxs)("div",{className:"flex items-center gap-1",children:[(0,v.jsx)(ol,{className:"size-3 text-green-500"}),(0,v.jsxs)("span",{children:[t.stats.completed," done"]})]})]}),t?.items&&t.items.length>0&&(0,v.jsx)("div",{className:"px-3 py-2 max-h-[200px] overflow-auto",children:t.items.map(h)}),t?.item&&!t.items&&(0,v.jsx)("div",{className:"px-3 py-2",children:h(t.item)}),"add"===a&&e?.items&&!t?.items&&(0,v.jsx)("div",{className:"px-3 py-2 max-h-[200px] overflow-auto",children:e.items.map((e,t)=>(0,v.jsxs)("div",{className:"flex items-start gap-2 py-1 text-muted-foreground",children:[(0,v.jsx)(ou,{className:"size-4 mt-0.5 shrink-0"}),(0,v.jsx)("span",{className:"text-sm",children:e.content})]},t))}),"list"===a&&t?.items?.length===0&&(0,v.jsx)("div",{className:"px-3 py-4 text-center text-muted-foreground text-sm",children:"No tasks yet"}),t?.error&&(0,v.jsxs)("div",{className:"px-3 py-2 border-t bg-red-500/5 text-red-600 dark:text-red-400 text-xs flex items-start gap-2",children:[(0,v.jsx)(op,{className:"size-3.5 mt-0.5 shrink-0"}),(0,v.jsx)("span",{children:t.error})]})]})]})}let yK=(0,E.default)("book-open",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]),yY=(0,E.default)("list",[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]]),yX=(0,E.default)("sparkles",[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]]);function yJ({input:e,output:t,status:r,className:n}){let[i,s]=(0,b.useState)(!0),a=e?.action||"list",o=e?.skillName||t?.skillName,l="pending"===r||"streaming"===r||"running"===r,c="completed"===r,u="error"===r||t?.success===!1,d=c&&t?.success?ol:u?op:l?od:yK,h=c&&t?.success?"text-green-600 dark:text-green-500":u?"text-red-600 dark:text-red-500":l?"text-muted-foreground animate-pulse":"text-muted-foreground",p="load"===a?o?`Load: ${o}`:"Load Skill":"List Skills";return(0,v.jsxs)("div",{className:(0,A.cn)("rounded-lg border overflow-hidden bg-background",n),children:[(0,v.jsxs)("button",{onClick:()=>s(!i),className:"flex items-center justify-between w-full px-3 py-2.5 bg-muted/50 hover:bg-muted/70 transition-colors",children:[(0,v.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,v.jsx)(d,{className:(0,A.cn)("size-4 shrink-0",h)}),"list"===a?(0,v.jsx)(yY,{className:"size-3.5 text-muted-foreground"}):(0,v.jsx)(yX,{className:"size-3.5 text-muted-foreground"}),(0,v.jsx)("span",{className:"font-medium text-sm truncate",children:p}),l&&(0,v.jsx)("span",{className:"text-xs text-muted-foreground animate-pulse",children:"loading..."})]}),(0,v.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[t?.skillCount!==void 0&&(0,v.jsxs)(C,{variant:"secondary",className:"text-xs",children:[t.skillCount," skills"]}),t?.contentLength!==void 0&&(0,v.jsxs)(C,{variant:"secondary",className:"text-xs",children:[Math.round(t.contentLength/1e3),"k chars"]}),i?(0,v.jsx)(oc.ChevronDownIcon,{className:"size-4 text-muted-foreground"}):(0,v.jsx)(aD,{className:"size-4 text-muted-foreground"})]})]}),i&&(0,v.jsxs)("div",{className:"border-t",children:[t?.skills&&t.skills.length>0&&(0,v.jsx)("div",{className:"max-h-[200px] overflow-auto",children:t.skills.map((e,r)=>(0,v.jsxs)("div",{className:(0,A.cn)("px-3 py-2 flex items-start gap-2",r<t.skills.length-1&&"border-b"),children:[(0,v.jsx)(yK,{className:"size-4 mt-0.5 shrink-0 text-muted-foreground"}),(0,v.jsxs)("div",{className:"min-w-0",children:[(0,v.jsx)("div",{className:"font-medium text-sm",children:e.name}),e.description&&(0,v.jsx)("div",{className:"text-xs text-muted-foreground truncate",children:e.description})]})]},e.name))}),"load"===a&&t?.success&&t.skillName&&(0,v.jsxs)("div",{className:"px-3 py-2 bg-muted/30",children:[(0,v.jsxs)("div",{className:"flex items-center justify-between",children:[(0,v.jsxs)("div",{className:"flex items-center gap-2",children:[(0,v.jsx)(yX,{className:"size-4 text-green-600 dark:text-green-400"}),(0,v.jsx)("span",{className:"font-medium text-sm",children:t.skillName})]}),t.content&&(0,v.jsx)(_.Button,{variant:"ghost",size:"icon",className:"size-6",onClick:e=>{e.stopPropagation(),navigator.clipboard.writeText(t.content)},children:(0,v.jsx)(of,{className:"size-3"})})]}),t.description&&(0,v.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:t.description})]}),t?.content&&(0,v.jsx)("div",{className:"max-h-[150px] overflow-auto border-t",children:(0,v.jsxs)("pre",{className:"px-3 py-2 text-xs font-mono text-muted-foreground whitespace-pre-wrap",children:[t.content.slice(0,500),t.content.length>500&&"..."]})}),t?.availableSkills&&t.availableSkills.length>0&&(0,v.jsx)("div",{className:"px-3 py-2 bg-muted/30 border-t",children:(0,v.jsxs)("div",{className:"text-xs text-muted-foreground",children:["Available: ",t.availableSkills.join(", ")]})}),"list"===a&&t?.skills?.length===0&&(0,v.jsx)("div",{className:"px-3 py-4 text-center text-muted-foreground text-sm",children:"No skills available"}),t?.error&&(0,v.jsxs)("div",{className:"px-3 py-2 border-t bg-red-500/5 text-red-600 dark:text-red-400 text-xs flex items-start gap-2",children:[(0,v.jsx)(op,{className:"size-3.5 mt-0.5 shrink-0"}),(0,v.jsx)("span",{children:t.error})]})]})]})}var yI=yI;let yZ=(0,E.default)("info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]),yQ=(0,E.default)("search-code",[["path",{d:"m13 13.5 2-2.5-2-2.5",key:"1rvxrh"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}],["path",{d:"M9 8.5 7 11l2 2.5",key:"6ffwbx"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]);function y0({severity:e,className:t}){switch(e){case"error":return(0,v.jsx)(yI.default,{className:(0,A.cn)("text-red-500",t)});case"warning":return(0,v.jsx)(yv,{className:(0,A.cn)("text-yellow-500",t)});case"info":return(0,v.jsx)(yZ,{className:(0,A.cn)("text-blue-500",t)});default:return(0,v.jsx)(yZ,{className:(0,A.cn)("text-muted-foreground",t)})}}function y1({file:e,isExpanded:t,onToggle:r}){let n=e.errors>0,i=e.warnings>0;return(0,v.jsxs)("div",{className:"border-b last:border-b-0",children:[(0,v.jsxs)("button",{onClick:r,className:"flex items-center justify-between w-full px-3 py-2 hover:bg-muted/50 transition-colors text-left",children:[(0,v.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,v.jsx)(yE,{className:"size-3.5 text-muted-foreground shrink-0"}),(0,v.jsx)("span",{className:"font-mono text-sm truncate",children:e.relativePath}),n&&(0,v.jsxs)(C,{variant:"destructive",className:"text-xs gap-1",children:[(0,v.jsx)(yI.default,{className:"size-3"}),e.errors]}),i&&(0,v.jsxs)(C,{variant:"secondary",className:"text-xs gap-1 bg-yellow-500/10 text-yellow-600 dark:text-yellow-400",children:[(0,v.jsx)(yv,{className:"size-3"}),e.warnings]})]}),t?(0,v.jsx)(oc.ChevronDownIcon,{className:"size-4 text-muted-foreground shrink-0"}):(0,v.jsx)(aD,{className:"size-4 text-muted-foreground shrink-0"})]}),t&&e.diagnostics.length>0&&(0,v.jsx)("div",{className:"bg-muted/30 px-3 py-2 space-y-1",children:e.diagnostics.map((e,t)=>(0,v.jsxs)("div",{className:(0,A.cn)("flex items-start gap-2 px-2 py-1.5 rounded text-sm","error"===e.severity&&"bg-red-500/5","warning"===e.severity&&"bg-yellow-500/5"),children:[(0,v.jsx)(y0,{severity:e.severity,className:"size-4 mt-0.5 shrink-0"}),(0,v.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,v.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,v.jsxs)("span",{className:"font-mono text-xs text-muted-foreground shrink-0",children:[e.line,":",e.column]}),e.source&&(0,v.jsx)(C,{variant:"outline",className:"text-xs",children:e.source}),e.code&&(0,v.jsxs)("span",{className:"text-xs text-muted-foreground font-mono",children:["[",e.code,"]"]})]}),(0,v.jsx)("p",{className:"text-sm mt-0.5 break-words",children:e.message})]})]},t))})]})}function y2({input:e,output:t,status:r,className:n}){let[i,s]=(0,b.useState)(!0),[a,o]=(0,b.useState)(new Set),l="pending"===r||"streaming"===r||"running"===r||"completed"===r&&!t,c="completed"===r&&t?.success===!0,u="error"===r||t?.success===!1,d=t?.totalErrors??0,h=t?.totalWarnings??0,p=d>0||h>0,m=t?.files?.length??0,f=(0,b.useMemo)(()=>e.paths&&0!==e.paths.length?1===e.paths.length?e.paths[0]:`${e.paths.length} paths`:"all files",[e.paths]),g=(0,b.useMemo)(()=>t?.files?.filter(e=>e.errors>0)||[],[t?.files]);(0,b.useMemo)(()=>{g.length>0&&0===a.size&&o(new Set(g.slice(0,5).map(e=>e.path)))},[g]);let y=p?yI.default:c?ol:u?yI.default:yQ,x=p?"text-red-500":c?"text-green-500":u?"text-red-500":"text-muted-foreground";return(0,v.jsxs)("div",{className:(0,A.cn)("rounded-lg border overflow-hidden bg-background",n),children:[(0,v.jsxs)("button",{onClick:()=>s(!i),className:"flex items-center justify-between w-full px-3 py-2.5 bg-muted/50 hover:bg-muted/70 transition-colors",children:[(0,v.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,v.jsx)(y,{className:(0,A.cn)("size-4 shrink-0",x)}),(0,v.jsx)("span",{className:"font-medium text-sm",children:"Linter"}),(0,v.jsxs)("span",{className:"text-xs text-muted-foreground truncate",children:[c?"checked":"checking"," ",f]}),l&&(0,v.jsx)("span",{className:"text-xs text-muted-foreground animate-pulse",children:"analyzing..."})]}),(0,v.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[c&&(0,v.jsxs)(v.Fragment,{children:[d>0&&(0,v.jsxs)(C,{variant:"destructive",className:"text-xs gap-1",children:[(0,v.jsx)(yI.default,{className:"size-3"}),d," error",1!==d?"s":""]}),h>0&&(0,v.jsxs)(C,{variant:"secondary",className:"text-xs gap-1 bg-yellow-500/10 text-yellow-600 dark:text-yellow-400",children:[(0,v.jsx)(yv,{className:"size-3"}),h," warning",1!==h?"s":""]}),!p&&(0,v.jsxs)(C,{variant:"secondary",className:"text-xs gap-1 bg-green-500/10 text-green-600 dark:text-green-400",children:[(0,v.jsx)(ol,{className:"size-3"}),"No issues"]})]}),i?(0,v.jsx)(oc.ChevronDownIcon,{className:"size-4 text-muted-foreground"}):(0,v.jsx)(aD,{className:"size-4 text-muted-foreground"})]})]}),i&&(0,v.jsxs)("div",{className:"border-t",children:[l?(0,v.jsxs)("div",{className:"px-3 py-8 text-center text-muted-foreground text-sm",children:[(0,v.jsx)(yQ,{className:"size-6 mx-auto mb-2 animate-pulse"}),(0,v.jsx)("span",{children:"Analyzing files for lint errors..."})]}):u&&t?.error?(0,v.jsxs)("div",{className:"px-3 py-4 text-red-600 dark:text-red-400 text-sm flex items-start gap-2",children:[(0,v.jsx)(yI.default,{className:"size-4 mt-0.5 shrink-0"}),(0,v.jsx)("span",{children:t.error})]}):t?.files&&t.files.length>0?(0,v.jsx)("div",{className:"max-h-[400px] overflow-y-auto",children:t.files.map(e=>(0,v.jsx)(y1,{file:e,isExpanded:a.has(e.path),onToggle:()=>{var t;return t=e.path,void o(e=>{let r=new Set(e);return r.has(t)?r.delete(t):r.add(t),r})}},e.path))}):(0,v.jsx)("div",{className:"px-3 py-4 text-sm",children:t?.message?(0,v.jsxs)("div",{className:"flex items-center gap-2 text-green-600 dark:text-green-400",children:[(0,v.jsx)(ol,{className:"size-4"}),(0,v.jsx)("span",{children:t.message})]}):(0,v.jsx)("div",{className:"text-muted-foreground italic",children:"No files analyzed yet."})}),c&&m>0&&(0,v.jsxs)("div",{className:"px-3 py-2 border-t bg-muted/30 text-xs text-muted-foreground",children:["Checked ",m," file",1!==m?"s":"",p&&(0,v.jsxs)("span",{children:[" • ",(0,v.jsxs)("span",{className:d>0?"text-red-500":"",children:[d," error",1!==d?"s":""]})," • ",(0,v.jsxs)("span",{className:h>0?"text-yellow-500":"",children:[h," warning",1!==h?"s":""]})]})]})]})]})}function y5(){let{toggleSidebar:e,isMobile:t}=(0,yC.useSidebar)();return t?(0,v.jsxs)(_.Button,{size:"icon",variant:"ghost",onClick:e,className:"size-7 shrink-0",children:[(0,v.jsx)(yN.PanelLeft,{className:"size-4"}),(0,v.jsx)("span",{className:"sr-only",children:"Toggle sidebar"})]}):null}function y3({session:e}){let[t,r]=(0,b.useState)([]),[n,i]=(0,b.useState)(""),[s,a]=(0,b.useState)(!1),[o,l]=(0,b.useState)(!1),[c,u]=(0,b.useState)(null),[d,h]=(0,b.useState)(""),[p,m]=(0,b.useState)(""),[f,g]=(0,b.useState)(!1),[y,x]=(0,b.useState)([]),[w,S]=(0,b.useState)([]),[j,A]=(0,b.useState)(null),[N,E]=(0,b.useState)([]),[P,R]=(0,b.useState)(!1),M=(0,b.useRef)(""),L=(0,b.useRef)(""),I=(0,b.useRef)([]),[D,O]=(0,b.useState)(!1),B=(0,b.useRef)(null),F=(0,b.useRef)(null),$=(0,b.useRef)(!1),z=(0,b.useRef)(!1),H=(0,b.useRef)(new Map),[q,K]=(0,b.useState)(e.model),[Y,X]=(0,b.useState)(e.name||""),[J,Z]=(0,b.useState)(!1),[Q,ee]=(0,b.useState)(null),[et,er]=(0,b.useState)(e.config||{}),[en,ei]=(0,b.useState)(!1),es=(0,b.useRef)(null);(0,b.useEffect)(()=>{(0,yy.getConfig)().then(ee)},[]),(0,b.useEffect)(()=>{K(e.model),X(e.name||""),er(e.config||{})},[e.id,e.model,e.name,e.config]),(0,b.useEffect)(()=>{J&&es.current&&(es.current.focus(),es.current.select())},[J]);let ea=async t=>{K(t);try{await (0,yu.updateSession)(e.id,{model:t}),(0,yx.mutateSessions)()}catch(t){console.error("Failed to update model:",t),K(e.model)}},eo=async()=>{Z(!1);let t=Y.trim()||"Session";if(t!==e.name)try{await (0,yu.updateSession)(e.id,{name:t}),(0,yx.mutateSessions)()}catch(t){console.error("Failed to update name:",t),X(e.name||"")}},el=e=>e&&"object"==typeof e&&"type"in e&&"value"in e&&("json"===e.type||"text"===e.type)?e.value:e,ec=e=>{let t=[],r=new Map;for(let t of e)if("tool"===t.role&&Array.isArray(t.content)){for(let e of t.content)if("tool-result"===e.type){let t=e.output??e.result;r.set(e.toolCallId,el(t))}}let n=0;for(let i of e){if("user"===i.role)t.push({id:i.id,type:"user-message",content:"string"==typeof i.content?i.content:"",messageSequence:n});else if("assistant"===i.role){if("string"==typeof i.content)i.content.trim()&&t.push({id:i.id,type:"assistant-text",content:i.content});else if(Array.isArray(i.content))for(let e=0;e<i.content.length;e++){let n=i.content[e];if("reasoning"===n.type&&n.text?.trim())t.push({id:`${i.id}-reasoning-${e}`,type:"reasoning",content:n.text});else if("text"===n.type&&n.text?.trim())t.push({id:`${i.id}-text-${e}`,type:"assistant-text",content:n.text});else if("tool-call"===n.type){let s=r.get(n.toolCallId),a=s?.rejected===!0||s?.status==="rejected";t.push({id:`${i.id}-tool-${e}`,type:"tool-call",toolCall:{toolCallId:n.toolCallId,toolName:n.toolName,input:n.input??n.args,output:s,status:a?"rejected":void 0!==s?"completed":"pending"}})}}}n++}return t},eu=async(t,n)=>{let s=N.find(e=>e.messageSequence===t);if(!s)return void console.error("No checkpoint found for message sequence:",t);if(window.confirm("Revert to before this message? This will undo all file changes and delete messages from this point.")){R(!0);try{await (0,yu.revertToCheckpoint)(e.id,s.id);let[t,a]=await Promise.all([(0,yu.getSessionMessages)(e.id),(0,yu.getSessionCheckpoints)(e.id).catch(()=>({checkpoints:[]}))]),o=[...t].sort((e,t)=>new Date(e.createdAt).getTime()-new Date(t.createdAt).getTime()),l=ec(o);r(l),E(a.checkpoints||[]),h(""),m(""),x([]),M.current="",L.current="",I.current=[],n&&i(n)}catch(e){console.error("Failed to revert:",e),alert("Failed to revert: "+(e instanceof Error?e.message:"Unknown error"))}finally{R(!1)}}},ed=t=>{if("tool-progress"===t.type){if("bash"===t.toolName&&"started"===t.data.status){let e=t.data.terminalId;if(I.current=I.current.map(t=>"bash"!==t.toolName||t.terminalId||"running"!==t.status&&"streaming"!==t.status?t:{...t,terminalId:e,liveOutput:""}),x([...I.current]),!H.current.has(e)){let t=(0,yu.streamTerminal)(e,t=>{I.current=I.current.map(r=>r.terminalId===e?{...r,liveOutput:(r.liveOutput||"")+t}:r),x([...I.current])},()=>{H.current.delete(e)});H.current.set(e,t)}}return}switch(t.type){case"start":case"data-session":case"text-start":case"text-end":break;case"data-stream-id":u(t.streamId),F.current=t.streamId;break;case"data-user-message":t.data?.content&&!z.current&&r(e=>e.some(e=>"user-message"===e.type&&e.content===t.data.content)?e:[...e,{id:t.data.id||`user-${Date.now()}`,type:"user-message",content:t.data.content}]);break;case"text-delta":M.current+=t.delta,h(M.current);break;case"reasoning-start":g(!0),L.current="",m("");break;case"reasoning-delta":L.current+=t.delta,m(L.current);break;case"reasoning-end":if(g(!1),L.current.trim()){let e={id:`reasoning-${Date.now()}`,type:"reasoning",content:L.current};r(t=>[...t,e])}L.current="",m("");break;case"tool-input-start":if(M.current.trim()){let e={id:`text-${Date.now()}`,type:"assistant-text",content:M.current};r(t=>[...t,e]),M.current="",h("")}let n={toolCallId:t.toolCallId,toolName:t.toolName,input:{},status:"streaming",streamingArgsText:""};I.current=[...I.current,n],x([...I.current]);break;case"tool-input-delta":I.current=I.current.map(e=>e.toolCallId!==t.toolCallId?e:{...e,streamingArgsText:(e.streamingArgsText||"")+t.argsTextDelta}),x([...I.current]);break;case"tool-input-available":let i=I.current.find(e=>e.toolCallId===t.toolCallId);if(M.current.trim()){let e={id:`text-${Date.now()}`,type:"assistant-text",content:M.current};r(t=>[...t,e]),M.current="",h("")}let s={toolCallId:t.toolCallId,toolName:t.toolName,input:t.input,status:"running",streamingArgsText:i?.streamingArgsText};i?I.current=I.current.map(e=>e.toolCallId!==t.toolCallId?e:s):I.current=[...I.current,s],x([...I.current]);break;case"tool-output-available":let o=I.current.find(e=>e.toolCallId===t.toolCallId);if(o?.terminalId){let e=H.current.get(o.terminalId);e&&(e(),H.current.delete(o.terminalId))}let c=el(t.output),d=c?.rejected===!0||c?.status==="rejected",p=I.current.find(e=>e.toolCallId===t.toolCallId);I.current=I.current.filter(e=>e.toolCallId!==t.toolCallId),x([...I.current]);let f={id:`tool-${t.toolCallId}`,type:"tool-call",toolCall:{toolCallId:t.toolCallId,toolName:p?.toolName||"unknown",input:p?.input||{},output:c,status:d?"rejected":"completed"}};r(e=>{let r=e.findIndex(e=>"tool-call"===e.type&&e.toolCall?.toolCallId===t.toolCallId);if(r>=0){let t=[...e];return t[r]=f,t}return[...e,f]});break;case"data-approval-required":S(e=>e.some(e=>e.id===t.data.id)?e:[...e,t.data]);break;case"finish-step":if(M.current.trim()){let e={id:`text-${Date.now()}`,type:"assistant-text",content:M.current};r(t=>[...t,e]),M.current="",h("")}break;case"finish":h(""),m(""),g(!1),x([]),u(null),M.current="",L.current="",I.current=[],B.current=null,$.current=!1,z.current=!1,a(!1),l(!1),Promise.all([(0,yu.getSessionMessages)(e.id),(0,yu.getSessionCheckpoints)(e.id).catch(()=>({checkpoints:[]}))]).then(([e,t])=>{r(ec([...e].sort((e,t)=>new Date(e.createdAt).getTime()-new Date(t.createdAt).getTime()))),E(t.checkpoints||[])}).catch(()=>{});break;case"abort":if(L.current.trim()){let e={id:`reasoning-${Date.now()}`,type:"reasoning",content:L.current};r(t=>[...t,e])}if(M.current.trim()){let e={id:`text-${Date.now()}`,type:"assistant-text",content:M.current+" [stopped]"};r(t=>[...t,e])}h(""),m(""),g(!1),x([]),u(null),M.current="",L.current="",I.current=[],B.current=null,$.current=!1,z.current=!1,a(!1),l(!1);break;case"error":console.error("Agent error:",t.errorText),B.current=null,a(!1),l(!1)}};(0,b.useEffect)(()=>{(async()=>{O(!0),r([]),h(""),m(""),x([]),S([]),a(!1),l(!1),u(null),M.current="",L.current="",I.current=[];try{let[t,n]=await Promise.all([(0,yu.getSessionMessages)(e.id),(0,yu.getSessionCheckpoints)(e.id).catch(()=>({checkpoints:[]}))]),i=[...t].sort((e,t)=>new Date(e.createdAt).getTime()-new Date(t.createdAt).getTime()),s=ec(i);r(s),E(n.checkpoints||[]);let o=await (0,yu.getActiveStream)(e.id);o.hasActiveStream&&o.stream&&(console.log("Found active stream, connecting...",o.stream.streamId),z.current=!1,l(!0),a(!0),u(o.stream.streamId),B.current=(0,yu.watchStream)(e.id,ed,{streamId:o.stream.streamId,onStreamId:e=>u(e)}))}catch(e){console.error("Failed to load messages:",e)}finally{O(!1)}})();let t=H.current;return()=>{B.current&&(B.current(),B.current=null),t.forEach(e=>e()),t.clear()}},[e.id]),(0,b.useEffect)(()=>{let t=async()=>{try{let t=await (0,yu.getPendingApprovals)(e.id);S(t)}catch{}};t();let r=setInterval(t,2e3);return()=>clearInterval(r)},[e.id]),(0,b.useEffect)(()=>{let t=async()=>{try{let t=await (0,yu.getSessionTodos)(e.id);A(t)}catch{}};t();let r=setInterval(t,s?1e3:5e3);return()=>clearInterval(r)},[e.id,s]),(0,b.useEffect)(()=>{let t=setInterval(async()=>{if(!s&&!$.current)try{let t=await (0,yu.getActiveStream)(e.id);if(t.hasActiveStream&&t.stream){let n=t.stream.streamId;if(n!==F.current){if(console.log("New active stream detected, connecting...",n),$.current=!0,z.current=!1,L.current.trim()){let e={id:`reasoning-${Date.now()}`,type:"reasoning",content:L.current};r(t=>[...t,e]),L.current="",m("")}if(M.current.trim()){let e={id:`text-${Date.now()}`,type:"assistant-text",content:M.current};r(t=>[...t,e]),M.current="",h("")}for(let e of I.current){let t={id:`tool-${e.toolCallId}`,type:"tool-call",toolCall:e};r(r=>r.some(t=>"tool-call"===t.type&&t.toolCall?.toolCallId===e.toolCallId)?r:[...r,t])}I.current=[],x([]),g(!1);try{let t=[...await (0,yu.getSessionMessages)(e.id)].sort((e,t)=>new Date(e.createdAt).getTime()-new Date(t.createdAt).getTime()),n=ec(t);r(n)}catch(e){console.error("Failed to refresh messages:",e)}l(!0),a(!0),u(n),F.current=n,B.current=(0,yu.watchStream)(e.id,ed,{streamId:n,onStreamId:e=>{u(e),F.current=e}}),$.current=!1}}}catch(e){console.error("Failed to check for new stream:",e),$.current=!1}},1e3);return()=>{clearInterval(t)}},[e.id,s]);let eh=async()=>{try{await (0,yu.abortStream)(e.id)}catch(e){console.error("Failed to abort stream:",e)}if(B.current&&(B.current(),B.current=null),L.current.trim()){let e={id:`reasoning-${Date.now()}`,type:"reasoning",content:L.current};r(t=>[...t,e])}if(M.current.trim()){let e={id:`text-${Date.now()}`,type:"assistant-text",content:M.current+" [stopped]"};r(t=>[...t,e])}h(""),m(""),g(!1),x([]),u(null),M.current="",L.current="",I.current=[],$.current=!1,a(!1),l(!1)},ep=async t=>{try{await (0,yu.approveExecution)(e.id,t.toolCallId),S(e=>e.filter(e=>e.id!==t.id))}catch(e){console.error("Failed to approve:",e)}},em=async t=>{try{await (0,yu.rejectExecution)(e.id,t.toolCallId,"User rejected"),S(e=>e.filter(e=>e.id!==t.id))}catch(e){console.error("Failed to reject:",e)}},ef=async t=>{try{await (0,yu.approveExecution)(e.id,t.toolCallId),S(e=>e.filter(e=>e.id!==t.id));let r=await (0,yu.updateToolApproval)(e.id,t.toolName,!1,et);er(r.config||{})}catch(e){console.error("Failed to approve and disable:",e)}},eg=async(t,r)=>{try{let n=await (0,yu.updateToolApproval)(e.id,t,!r,et);er(n.config||{})}catch(e){console.error("Failed to update tool approval:",e)}},ey=e=>({ts:"typescript",tsx:"tsx",js:"javascript",jsx:"jsx",py:"python",rb:"ruby",go:"go",rs:"rust",java:"java",c:"c",cpp:"cpp",h:"c",hpp:"cpp",cs:"csharp",php:"php",swift:"swift",kt:"kotlin",scala:"scala",sh:"bash",bash:"bash",zsh:"bash",fish:"bash",ps1:"powershell",sql:"sql",html:"html",htm:"html",css:"css",scss:"scss",sass:"sass",less:"less",json:"json",yaml:"yaml",yml:"yaml",xml:"xml",md:"markdown",markdown:"markdown",txt:"plaintext",toml:"toml",ini:"ini",cfg:"ini",conf:"ini",dockerfile:"dockerfile",makefile:"makefile"})[e.split(".").pop()?.toLowerCase()||""]||"plaintext";return(0,v.jsxs)("div",{className:"flex flex-col h-full bg-background",children:[(0,v.jsxs)("div",{className:"border-b border-border/50 px-3 sm:px-4 py-2 flex items-center justify-between bg-card/50 backdrop-blur-sm",children:[(0,v.jsxs)("div",{className:"min-w-0 flex items-center gap-2 sm:gap-3",children:[(0,v.jsx)(y5,{}),(0,v.jsx)("div",{className:"flex items-center gap-1.5",children:J?(0,v.jsxs)("form",{onSubmit:e=>{e.preventDefault(),eo()},className:"flex items-center gap-1",children:[(0,v.jsx)(gu.Input,{ref:es,value:Y,onChange:e=>X(e.target.value),onBlur:eo,className:"h-7 text-sm font-semibold w-40 px-2",placeholder:"Session name"}),(0,v.jsx)(_.Button,{type:"submit",size:"icon",variant:"ghost",className:"size-6 text-muted-foreground hover:text-foreground",children:(0,v.jsx)(yk.Check,{className:"size-3.5"})})]}):(0,v.jsx)(T.TooltipProvider,{children:(0,v.jsxs)(T.Tooltip,{children:[(0,v.jsx)(T.TooltipTrigger,{asChild:!0,children:(0,v.jsxs)("button",{onClick:()=>Z(!0),className:"flex items-center gap-1.5 group hover:bg-muted/50 rounded px-1.5 py-0.5 -mx-1.5 transition-colors",children:[(0,v.jsx)("h2",{className:"font-semibold text-foreground truncate max-w-[200px]",children:Y||"Untitled Session"}),(0,v.jsx)(yw,{className:"size-3 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity"})]})}),(0,v.jsx)(T.TooltipContent,{children:"Click to rename"})]})})}),(0,v.jsx)(T.TooltipProvider,{children:(0,v.jsxs)(T.Tooltip,{children:[(0,v.jsx)(T.TooltipTrigger,{asChild:!0,children:(0,v.jsx)("div",{children:(0,v.jsxs)(om.Select,{value:q,onValueChange:ea,disabled:s,children:[(0,v.jsx)(om.SelectTrigger,{className:"h-7 text-xs border-border/50 bg-muted/30 hover:bg-muted/50 transition-colors min-w-[160px]",children:(0,v.jsx)(om.SelectValue,{placeholder:"Select model"})}),(0,v.jsx)(om.SelectContent,{children:Q?.availableModels.map(e=>(0,v.jsx)(om.SelectItem,{value:e.id,className:"text-xs",children:(0,v.jsxs)("div",{className:"flex items-center gap-2",children:[(0,v.jsx)("span",{children:e.name}),(0,v.jsx)("span",{className:"text-[10px] text-muted-foreground",children:e.provider})]})},e.id))})]})})}),(0,v.jsx)(T.TooltipContent,{children:s?"Cannot change model while running":"Switch model for next message"})]})}),(0,v.jsx)(T.TooltipProvider,{children:(0,v.jsxs)(T.Tooltip,{children:[(0,v.jsx)(T.TooltipTrigger,{asChild:!0,children:(0,v.jsxs)("div",{className:"flex items-center gap-1.5 px-2 py-1 rounded-md bg-muted/30 text-xs text-muted-foreground max-w-[200px]",children:[(0,v.jsx)(yA,{className:"size-3.5 shrink-0"}),(0,v.jsx)("span",{className:"truncate font-mono",children:e.workingDirectory.split("/").pop()||e.workingDirectory})]})}),(0,v.jsx)(T.TooltipContent,{side:"bottom",className:"max-w-md",children:(0,v.jsx)("p",{className:"font-mono text-xs",children:e.workingDirectory})})]})})]}),(0,v.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[o&&(0,v.jsx)(T.TooltipProvider,{children:(0,v.jsxs)(T.Tooltip,{children:[(0,v.jsx)(T.TooltipTrigger,{asChild:!0,children:(0,v.jsxs)(C,{variant:"outline",className:"gap-1.5 text-xs border-emerald-500/30 bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 cursor-help",children:[(0,v.jsx)("span",{className:"size-1.5 rounded-full bg-current animate-pulse"}),"Watching"]})}),(0,v.jsx)(T.TooltipContent,{children:"Watching stream from another client"})]})}),(0,v.jsx)(T.TooltipProvider,{children:(0,v.jsxs)(T.Tooltip,{children:[(0,v.jsx)(T.TooltipTrigger,{asChild:!0,children:(0,v.jsx)(C,{variant:s?"default":"secondary",className:`cursor-help ${s?"bg-primary/90":""}`,children:s?o?"streaming":"running":e.status})}),(0,v.jsx)(T.TooltipContent,{children:s?o?"Receiving streamed response":"Agent is processing":`Session is ${e.status}`})]})}),(0,v.jsxs)(mb.Dialog,{open:en,onOpenChange:ei,children:[(0,v.jsx)(T.TooltipProvider,{children:(0,v.jsxs)(T.Tooltip,{children:[(0,v.jsx)(T.TooltipTrigger,{asChild:!0,children:(0,v.jsx)(mb.DialogTrigger,{asChild:!0,children:(0,v.jsx)(_.Button,{size:"icon",variant:"ghost",className:"size-7 hover:bg-accent transition-colors",children:(0,v.jsx)(yS.Settings,{className:"size-4"})})})}),(0,v.jsx)(T.TooltipContent,{children:"Session Settings"})]})}),(0,v.jsxs)(mb.DialogContent,{className:"sm:max-w-md",children:[(0,v.jsx)(mb.DialogHeader,{children:(0,v.jsxs)(mb.DialogTitle,{className:"flex items-center gap-2",children:[(0,v.jsx)("div",{className:"size-8 rounded-lg bg-muted flex items-center justify-center",children:(0,v.jsx)(yS.Settings,{className:"size-4"})}),"Session Settings"]})}),(0,v.jsxs)("div",{className:"space-y-4 pt-2",children:[(0,v.jsxs)("div",{className:"space-y-2",children:[(0,v.jsx)(yT.Label,{className:"flex items-center gap-2 text-sm font-medium",children:"Tool Approvals"}),(0,v.jsx)("p",{className:"text-xs text-muted-foreground -mt-0.5",children:"Toggle on to require approval before tool executes"}),(0,v.jsx)("div",{className:"space-y-1 rounded-lg border p-2.5 bg-muted/30",children:Q?.availableTools.map(e=>{var t;let r=(t=e.id,et.toolApprovals?.[t]!==void 0?et.toolApprovals[t]:"bash"===t);return(0,v.jsxs)("div",{className:"flex items-center justify-between py-1.5 hover:bg-muted/50 rounded px-2 -mx-1 transition-colors",children:[(0,v.jsxs)("div",{className:"space-y-0",children:[(0,v.jsxs)("div",{className:"flex items-center gap-2",children:[(0,v.jsx)("span",{className:"text-sm font-medium",children:e.name}),e.dangerous&&(0,v.jsx)("span",{className:"text-[10px] bg-amber-500/20 text-amber-600 dark:text-amber-400 px-1.5 py-0.5 rounded font-medium",children:"risky"})]}),(0,v.jsx)("p",{className:"text-[11px] text-muted-foreground",children:e.description})]}),(0,v.jsx)(y_.Switch,{checked:r,onCheckedChange:()=>eg(e.id,r)})]},e.id)})})]}),(0,v.jsx)("p",{className:"text-xs text-muted-foreground",children:"These settings only apply to this session. Changes take effect for future tool calls."})]})]})]})]})]}),j&&j.todos&&j.todos.length>0&&(0,v.jsx)("div",{className:"px-4 py-2 border-b border-border/50 bg-muted/20",children:(0,v.jsx)(yg,{todosData:j})}),w.length>0&&(0,v.jsx)("div",{className:"p-4 border-b border-border space-y-3",children:w.map(e=>{let t=e.input;return(0,v.jsxs)(oq,{approval:{id:e.id,approved:!1},state:"approval-requested",children:[(0,v.jsx)(oK,{children:(0,v.jsxs)("div",{className:"flex items-start gap-3",children:[(0,v.jsx)("div",{className:"size-8 rounded-lg bg-amber-500/20 flex items-center justify-center shrink-0",children:(0,v.jsx)(yv,{className:"size-4 text-amber-500"})}),(0,v.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,v.jsx)("p",{className:"font-medium text-sm",children:"Approval Required"}),(0,v.jsx)("p",{className:"text-sm text-muted-foreground mt-0.5",children:(0,v.jsx)("code",{className:"bg-muted px-1.5 py-0.5 rounded font-mono text-foreground",children:e.toolName})}),(0,v.jsx)("div",{className:"mt-3 rounded-lg border bg-muted/30 overflow-hidden",children:Object.entries(t).map(([e,t])=>(0,v.jsxs)("div",{className:"flex border-b border-border/50 last:border-b-0",children:[(0,v.jsx)("div",{className:"px-3 py-2 bg-muted/50 text-xs font-medium text-muted-foreground w-24 shrink-0",children:e}),(0,v.jsx)("div",{className:"px-3 py-2 text-xs font-mono flex-1 min-w-0 overflow-auto max-h-24",children:"string"==typeof t?(0,v.jsx)("span",{className:"whitespace-pre-wrap break-words",children:t}):(0,v.jsx)("span",{className:"text-muted-foreground",children:JSON.stringify(t)})})]},e))})]})]})}),(0,v.jsxs)(oY,{children:[(0,v.jsx)(oX,{variant:"outline",onClick:()=>em(e),children:"Reject"}),(0,v.jsx)(oX,{variant:"ghost",onClick:()=>ef(e),className:"text-muted-foreground hover:text-foreground",children:"Don't ask again"}),(0,v.jsx)(oX,{variant:"default",onClick:()=>ep(e),children:"Approve"})]})]},e.id)})}),(0,v.jsxs)(V,{className:"flex-1 p-4",children:[(0,v.jsxs)(U,{className:"max-w-3xl mx-auto w-full",children:[D&&(0,v.jsx)("div",{className:"flex justify-center py-12",children:(0,v.jsx)(oZ,{size:24})}),!D&&0===t.length&&!d&&(0,v.jsx)(G,{icon:(0,v.jsxs)("div",{className:"relative overflow-hidden rounded-2xl size-16 shadow-lg ring-1 ring-white/10",children:[(0,v.jsx)(k.default,{src:"/sparke-coder.png",alt:"SparkECoder",width:64,height:64,className:"absolute inset-0 size-full object-cover",priority:!0}),s&&(0,v.jsx)("video",{src:"/sparkecode.mp4",autoPlay:!0,muted:!0,loop:!0,playsInline:!0,className:"absolute inset-0 size-full object-cover"})]}),title:"Start a conversation",description:"Ask SparkECoder to help you with coding tasks"}),t.filter(e=>!("tool-call"===e.type&&e.toolCall&&w.some(t=>t.toolCallId===e.toolCall?.toolCallId))&&!0).map(e=>{if("user-message"===e.type){let t=void 0!==e.messageSequence&&N.some(t=>t.messageSequence===e.messageSequence);return(0,v.jsxs)(aV,{from:"user",children:[(0,v.jsx)(aU,{children:(0,v.jsx)("p",{className:"whitespace-pre-wrap",children:e.content})}),t&&!s&&(0,v.jsx)(aG,{className:"justify-end mt-1",children:(0,v.jsx)(T.TooltipProvider,{children:(0,v.jsxs)(T.Tooltip,{children:[(0,v.jsx)(T.TooltipTrigger,{asChild:!0,children:(0,v.jsxs)(_.Button,{variant:"ghost",size:"sm",onClick:()=>eu(e.messageSequence,e.content),disabled:P,className:"h-6 px-2 text-xs text-muted-foreground hover:text-destructive gap-1",children:[(0,v.jsx)(yj,{className:"h-3 w-3"}),"Revert"]})}),(0,v.jsx)(T.TooltipContent,{children:(0,v.jsx)("p",{children:"Revert to before this message (undo all changes after)"})})]})})})]},e.id)}if("reasoning"===e.type)return(0,v.jsxs)(pK,{isStreaming:!1,defaultOpen:!1,children:[(0,v.jsx)(pX,{}),(0,v.jsx)(pJ,{children:e.content||""})]},e.id);if("assistant-text"===e.type)return(0,v.jsx)(aV,{from:"assistant",children:(0,v.jsxs)("div",{className:"flex gap-3",children:[(0,v.jsx)("div",{className:"relative overflow-hidden rounded-lg size-8 shadow-sm ring-1 ring-white/10 shrink-0",children:(0,v.jsx)(k.default,{src:"/sparke-coder.png",alt:"SparkECoder",width:32,height:32,className:"absolute inset-0 size-full object-cover"})}),(0,v.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,v.jsx)(aU,{children:(0,v.jsx)(aq,{children:e.content||""})}),(0,v.jsx)(aG,{children:(0,v.jsx)(aW,{label:"Copy",onClick:()=>navigator.clipboard.writeText(e.content||""),children:(0,v.jsx)(of,{className:"size-3"})})})]})]})},e.id);if("tool-call"===e.type&&e.toolCall){let t=e.toolCall,r=`tool-${t.toolName}`;if("write_file"===t.toolName)return(0,v.jsx)(yM,{input:t.input,output:t.output,status:t.status,streamingArgsText:t.streamingArgsText},e.id);if("read_file"===t.toolName)return(0,v.jsx)(yO,{input:t.input,output:t.output,status:t.status},e.id);if("bash"===t.toolName)return(0,v.jsx)(yz,{input:t.input,output:t.output,status:t.status,terminalId:t.terminalId,liveOutput:t.liveOutput},e.id);if("todo"===t.toolName)return(0,v.jsx)(yq,{input:t.input,output:t.output,status:t.status},e.id);if("load_skill"===t.toolName)return(0,v.jsx)(yJ,{input:t.input,output:t.output,status:t.status},e.id);if("linter"===t.toolName)return(0,v.jsx)(y2,{input:t.input,output:t.output,status:t.status},e.id);let n="completed"!==t.status;return(0,v.jsxs)(oP,{defaultOpen:n,children:[(0,v.jsx)(oR,{type:r,state:function(e){switch(e){case"pending":case"streaming":default:return"input-streaming";case"running":return"input-available";case"completed":return"output-available";case"rejected":return"output-denied";case"error":return"output-error"}}(t.status),title:t.toolName}),(0,v.jsxs)(oM,{children:[(0,v.jsx)(oL,{input:t.input}),(e=>{let t=e.output,r=e.input;if("bash"===e.toolName)return(0,v.jsx)(yz,{input:e.input,output:e.output,status:e.status,terminalId:e.terminalId,liveOutput:e.liveOutput,className:"mt-2"});if("todo"===e.toolName)return(0,v.jsx)(yq,{input:e.input,output:e.output,status:e.status,className:"mt-2"});if("load_skill"===e.toolName)return(0,v.jsx)(yJ,{input:e.input,output:e.output,status:e.status,className:"mt-2"});if("write_file"===e.toolName&&r){let e=r.path||"file",n=r.mode||"full",i=e.split("/").pop()||"file",s=ey(e);if("str_replace"===n){let e=r.old_string||"",n=r.new_string||"";return(0,v.jsxs)("div",{className:"mt-2 max-w-full overflow-hidden space-y-2",children:[(0,v.jsxs)("div",{className:"flex items-center gap-2 text-sm",children:[(0,v.jsx)(yb,{className:"size-4 text-muted-foreground"}),(0,v.jsx)("span",{className:"font-medium",children:i}),(0,v.jsx)(C,{variant:"secondary",className:"text-xs",children:"str_replace"})]}),(0,v.jsxs)("div",{className:"rounded-md border overflow-hidden",children:[(0,v.jsxs)("div",{className:"bg-red-500/10 border-b p-2",children:[(0,v.jsx)("div",{className:"text-xs text-red-500 mb-1",children:"- Remove:"}),(0,v.jsx)("pre",{className:"text-xs overflow-x-auto whitespace-pre-wrap break-words text-red-400",children:e.length>500?e.slice(0,500)+"...":e})]}),(0,v.jsxs)("div",{className:"bg-green-500/10 p-2",children:[(0,v.jsx)("div",{className:"text-xs text-green-500 mb-1",children:"+ Add:"}),(0,v.jsx)("pre",{className:"text-xs overflow-x-auto whitespace-pre-wrap break-words text-green-400",children:n.length>500?n.slice(0,500)+"...":n})]})]}),t&&(0,v.jsxs)("div",{className:`text-xs flex items-center gap-1 ${t.success?"text-green-600 dark:text-green-400":"text-red-600 dark:text-red-400"}`,children:[(0,v.jsx)("span",{children:t.success?"✓":"✗"}),(0,v.jsx)("span",{children:t.success?`Replaced (${void 0!==t.lineDelta?(t.lineDelta>=0?"+":"")+t.lineDelta+" lines":"done"})`:t.error||"Failed"})]})]})}let a=r.content||"";return(0,v.jsxs)("div",{className:"mt-2 max-w-full overflow-hidden",children:[(0,v.jsxs)(oD,{children:[(0,v.jsxs)(oO,{children:[(0,v.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,v.jsx)(yb,{className:"size-4 text-muted-foreground shrink-0"}),(0,v.jsx)(oB,{className:"truncate",children:i}),(0,v.jsx)(oF,{className:"truncate text-xs hidden sm:block",children:e})]}),(0,v.jsx)(o$,{children:(0,v.jsx)(oz,{icon:of,label:"Copy",onClick:()=>navigator.clipboard.writeText(a)})})]}),a&&(0,v.jsx)(oV,{className:"p-0 max-h-[300px] overflow-auto",children:(0,v.jsx)(oE,{code:a,language:s,showLineNumbers:!0,children:(0,v.jsx)(oN,{className:"sr-only",children:(0,v.jsx)(oC,{children:(0,v.jsx)(o_,{children:i})})})})})]}),t&&(0,v.jsxs)("div",{className:`mt-2 text-xs flex items-center gap-1 ${t.success?"text-green-600 dark:text-green-400":"text-red-600 dark:text-red-400"}`,children:[(0,v.jsx)("span",{children:t.success?"✓":"✗"}),(0,v.jsx)("span",{children:t.success?`File ${t.action||"written"} successfully`:t.error||"Failed"})]})]})}if("read_file"===e.toolName&&t){let e=r?.path||"file",n=t.content||JSON.stringify(t,null,2),i=e.split("/").pop()||"file",s=ey(e);return(0,v.jsx)("div",{className:"mt-2 max-w-full overflow-hidden",children:(0,v.jsxs)(oD,{children:[(0,v.jsxs)(oO,{children:[(0,v.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,v.jsx)(yb,{className:"size-4 text-muted-foreground shrink-0"}),(0,v.jsx)(oB,{className:"truncate",children:i}),(0,v.jsx)(oF,{className:"truncate text-xs hidden sm:block",children:e})]}),(0,v.jsx)(o$,{children:(0,v.jsx)(oz,{icon:of,label:"Copy",onClick:()=>navigator.clipboard.writeText(n)})})]}),(0,v.jsx)(oV,{className:"p-0 max-h-[300px] overflow-auto",children:(0,v.jsx)(oE,{code:n,language:s,showLineNumbers:!0,children:(0,v.jsx)(oN,{className:"sr-only",children:(0,v.jsx)(oC,{children:(0,v.jsx)(o_,{children:i})})})})})]})})}return t?(0,v.jsx)(oI,{output:(0,v.jsxs)("pre",{className:"text-xs overflow-x-auto max-w-full whitespace-pre-wrap break-words",children:[JSON.stringify(t,null,2).slice(0,500),JSON.stringify(t).length>500?"...":""]}),errorText:"error"===e.status?"Tool execution failed":void 0}):null})(t)]})]},e.id)}return null}),s&&!d&&!p&&0===y.length&&(0,v.jsxs)("div",{className:"flex gap-3 items-center",children:[(0,v.jsx)("div",{className:"relative overflow-hidden rounded-lg size-8 shadow-sm ring-1 ring-white/10 shrink-0",children:(0,v.jsx)("video",{src:"/sparkecode.mp4",autoPlay:!0,muted:!0,loop:!0,playsInline:!0,className:"absolute inset-0 size-full object-cover"})}),(0,v.jsx)("span",{className:"text-sm text-muted-foreground",children:"Thinking..."})]}),s&&(f||p)&&(0,v.jsxs)(pK,{isStreaming:f,defaultOpen:!0,children:[(0,v.jsx)(pX,{}),(0,v.jsx)(pJ,{children:p})]}),s&&d&&(0,v.jsx)(aV,{from:"assistant",children:(0,v.jsxs)("div",{className:"flex gap-3",children:[(0,v.jsx)("div",{className:"relative overflow-hidden rounded-lg size-8 shadow-sm ring-1 ring-white/10 shrink-0",children:(0,v.jsx)("video",{src:"/sparkecode.mp4",autoPlay:!0,muted:!0,loop:!0,playsInline:!0,className:"absolute inset-0 size-full object-cover"})}),(0,v.jsx)("div",{className:"flex-1 min-w-0",children:(0,v.jsxs)(aU,{children:[(0,v.jsx)(aq,{children:d}),(0,v.jsx)("span",{className:"inline-block w-2 h-4 bg-primary animate-pulse ml-1"})]})})]})}),s&&y.map(e=>"write_file"===e.toolName?(0,v.jsx)(yM,{input:e.input,output:e.output,status:e.status,streamingArgsText:e.streamingArgsText},e.toolCallId):"read_file"===e.toolName?(0,v.jsx)(yO,{input:e.input,output:e.output,status:e.status},e.toolCallId):"bash"===e.toolName?(0,v.jsx)(yz,{input:e.input,output:e.output,status:e.status,terminalId:e.terminalId,liveOutput:e.liveOutput},e.toolCallId):"todo"===e.toolName?(0,v.jsx)(yq,{input:e.input,output:e.output,status:e.status},e.toolCallId):"load_skill"===e.toolName?(0,v.jsx)(yJ,{input:e.input,output:e.output,status:e.status},e.toolCallId):"linter"===e.toolName?(0,v.jsx)(y2,{input:e.input,output:e.output,status:e.status},e.toolCallId):(0,v.jsxs)(oP,{defaultOpen:!0,children:[(0,v.jsx)(oR,{type:`tool-${e.toolName}`,state:"streaming"===e.status?"input-streaming":"input-available",title:e.toolName}),(0,v.jsxs)(oM,{children:[(0,v.jsx)(oL,{input:e.input}),(0,v.jsxs)("div",{className:"flex items-center gap-2 p-3 text-muted-foreground",children:[(0,v.jsx)(oZ,{size:14}),(0,v.jsx)("span",{className:"text-sm",children:"streaming"===e.status?"Receiving...":"Executing..."})]})]})]},e.toolCallId)),s&&!d&&0===y.length&&(0,v.jsxs)("div",{className:"flex items-center gap-2 text-muted-foreground",children:[(0,v.jsx)(oZ,{size:16}),(0,v.jsx)("span",{className:"text-sm",children:"Thinking..."})]})]}),(0,v.jsx)(W,{})]}),(0,v.jsx)("div",{className:"border-t border-border/50 p-4 pb-6 bg-card/30",children:(0,v.jsxs)("div",{className:"max-w-3xl mx-auto",children:[!D&&0===t.length&&!d&&!s&&(0,v.jsx)(yl,{className:"mb-3",children:['Create a hello.txt file with "Hello, World!"',"List files in the current directory","Show the current git status"].map(e=>(0,v.jsx)(yc,{suggestion:e,onClick:e=>{i(e)}},e))}),(0,v.jsxs)(g_,{onSubmit:()=>{if(!n.trim()||s)return;let t={id:`user-${Date.now()}`,type:"user-message",content:n};r(e=>[...e,t]),i(""),a(!0),l(!1),z.current=!0,h(""),m(""),g(!1),x([]),M.current="",L.current="",I.current=[],B.current=(0,yu.runAgent)(e.id,n,ed,{onStreamId:e=>u(e)})},className:"shadow-sm",children:[(0,v.jsx)(gT,{children:(0,v.jsx)(gE,{value:n,onChange:e=>i(e.target.value),placeholder:"Ask SparkECoder to help...",disabled:s,autoFocus:!0,className:"min-h-[80px] focus:ring-2 focus:ring-primary/20 transition-all"})}),(0,v.jsxs)(gP,{children:[(0,v.jsx)("div",{className:"flex-1"}),(0,v.jsx)(gR,{disabled:!s&&!n.trim(),status:s?"streaming":"ready",onStop:eh,className:"bg-primary hover:bg-primary/90 transition-colors"})]})]})]})})]})}var y6=e.i(461957);function y8({params:e}){let{id:t}=(0,b.use)(e),r=(0,w.useRouter)(),[n,i]=(0,b.useState)(null),[s,a]=(0,b.useState)(!0),[o,l]=(0,b.useState)(null);return((0,b.useEffect)(()=>{!async function(){try{let e=await (0,yu.getSession)(t);if(!e)return void l("Session not found");i(e)}catch(e){console.error("Failed to load session:",e),l("Failed to load session")}finally{a(!1)}}()},[t]),s)?(0,v.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,v.jsx)(y6.Loader2,{className:"size-8 animate-spin text-muted-foreground"})}):o||!n?(0,v.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,v.jsxs)("div",{className:"text-center",children:[(0,v.jsx)("p",{className:"text-muted-foreground mb-4",children:o||"Session not found"}),(0,v.jsx)("button",{onClick:()=>r.push("/"),className:"text-primary hover:underline",children:"Go back home"})]})}):(0,v.jsx)(y3,{session:n})}e.s(["default",()=>y8],330460)}]);
7
+ </iframe>`},"putIntoIFrame"),ad=(0,nH.__name)((e,t,r,n,i)=>{let s=e.append("div");s.attr("id",r),n&&s.attr("style",n);let a=s.append("svg").attr("id",t).attr("width","100%").attr("xmlns","http://www.w3.org/2000/svg");return i&&a.attr("xmlns:xlink",i),a.append("g"),e},"appendDivSvgG");function ah(e,t){return e.append("iframe").attr("id",t).attr("style","width: 100%; height: 100%;").attr("sandbox","")}(0,nH.__name)(ah,"sandboxedIframe");var ap=(0,nH.__name)((e,t,r,n)=>{e.getElementById(t)?.remove(),e.getElementById(r)?.remove(),e.getElementById(n)?.remove()},"removeExistingElements"),am=(0,nH.__name)(async function(e,t,r){let n,i;sZ();let s=ai(t);t=s.code;let a=(0,nG.getConfig)();nH.log.debug(a),t.length>(a?.maxTextSize??5e4)&&(t="graph TB;a[Maximum text size in diagram exceeded];style a fill:#faa");let o="#"+e,l="i"+e,c="#"+l,u="d"+e,d="#"+u,h=(0,nH.__name)(()=>{let e=m?c:d,t=(0,nK.select)(e).node();t&&"remove"in t&&t.remove()},"removeTempElements"),p=(0,nK.select)("body"),m="sandbox"===a.securityLevel,f="loose"===a.securityLevel,g=a.fontFamily;if(void 0!==r){if(r&&(r.innerHTML=""),m){let e=ah((0,nK.select)(r),l);(p=(0,nK.select)(e.nodes()[0].contentDocument.body)).node().style.margin=0}else p=(0,nK.select)(r);ad(p,e,u,`font-family: ${g}`,"http://www.w3.org/1999/xlink")}else{if(ap(document,e,u,l),m){let e=ah((0,nK.select)("body"),l);(p=(0,nK.select)(e.nodes()[0].contentDocument.body)).node().style.margin=0}else p=(0,nK.select)("body");ad(p,e,u)}try{n=await s2.fromText(t,{title:s.title})}catch(e){if(a.suppressErrorRendering)throw h(),e;n=await s2.fromText("error"),i=e}let y=p.select(d).node(),x=n.type,v=y.firstChild,b=v.firstChild,w=al(a,x,n.renderer.getClasses?.(t,n),o),k=document.createElement("style");k.innerHTML=w,v.insertBefore(k,b);try{await n.renderer.draw(t,e,nF.package_default.version,n)}catch(r){throw a.suppressErrorRendering?h():sc.draw(t,e,nF.package_default.version),r}ay(x,p.select(`${d} svg`),n.db.getAccTitle?.(),n.db.getAccDescription?.()),p.select(`[id="${e}"]`).selectAll("foreignobject > *").attr("xmlns","http://www.w3.org/1999/xhtml");let j=p.select(d).node().innerHTML;if(nH.log.debug("config.arrowMarkerAbsolute",a.arrowMarkerAbsolute),j=ac(j,m,(0,nG.evaluate)(a.arrowMarkerAbsolute)),m?j=au(j,p.select(d+" svg").node()):f||(j=id.default.sanitize(j,{ADD_TAGS:ar,ADD_ATTR:an,HTML_INTEGRATION_POINTS:{foreignobject:!0}})),s3(),i)throw i;return h(),{diagramType:x,svg:j,bindFunctions:n.db.bindFunctions}},"render");function af(e={}){let t=(0,nG.assignWithDepth_default)({},e);t?.fontFamily&&!t.themeVariables?.fontFamily&&(t.themeVariables||(t.themeVariables={}),t.themeVariables.fontFamily=t.fontFamily),(0,nG.saveConfigFromInitialize)(t),t?.theme&&t.theme in nG.themes_default?t.themeVariables=nG.themes_default[t.theme].getThemeVariables(t.themeVariables):t&&(t.themeVariables=nG.themes_default.default.getThemeVariables(t.themeVariables));let r="object"==typeof t?(0,nG.setSiteConfig)(t):(0,nG.getSiteConfig)();(0,nH.setLogLevel)(r.logLevel),sZ()}(0,nH.__name)(af,"initialize");var ag=(0,nH.__name)((e,t={})=>{let{code:r}=ae(e);return s2.fromText(r,t)},"getDiagramFromText");function ay(e,t,r,n){s0(t,e),s1(t,r,n,t.attr("id"))}(0,nH.__name)(ay,"addA11yInfo");var ax=Object.freeze({render:am,parse:as,getDiagramFromText:ag,initialize:af,getConfig:nG.getConfig,setConfig:nG.setConfig,getSiteConfig:nG.getSiteConfig,updateSiteConfig:nG.updateSiteConfig,reset:(0,nH.__name)(()=>{(0,nG.reset)()},"reset"),globalReset:(0,nH.__name)(()=>{(0,nG.reset)(nG.defaultConfig)},"globalReset"),defaultConfig:nG.defaultConfig});(0,nH.setLogLevel)((0,nG.getConfig)().logLevel),(0,nG.reset)((0,nG.getConfig)());var av=(0,nH.__name)((e,t,r)=>{nH.log.warn(e),(0,nW.isDetailedError)(e)?(r&&r(e.str,e.hash),t.push({...e,message:e.str,error:e})):(r&&r(e),e instanceof Error&&t.push({str:e.message,message:e.message,hash:e.name,error:e}))},"handleError"),ab=(0,nH.__name)(async function(e={querySelector:".mermaid"}){try{await aw(e)}catch(t){if((0,nW.isDetailedError)(t)&&nH.log.error(t.str),aM.parseError&&aM.parseError(t),!e.suppressErrors)throw nH.log.error("Use the suppressErrors option to suppress these errors"),t}},"run"),aw=(0,nH.__name)(async function({postRenderCallback:e,querySelector:t,nodes:r}={querySelector:".mermaid"}){let n,i,s=ax.getConfig();if(nH.log.debug(`${!e?"No ":""}Callback function found`),r)n=r;else if(t)n=document.querySelectorAll(t);else throw Error("Nodes and querySelector are both undefined");nH.log.debug(`Found ${n.length} diagrams`),s?.startOnLoad!==void 0&&(nH.log.debug("Start On Load: "+s?.startOnLoad),ax.updateSiteConfig({startOnLoad:s?.startOnLoad}));let a=new nW.utils_default.InitIDGenerator(s.deterministicIds,s.deterministicIDSeed),o=[];for(let t of Array.from(n)){if(nH.log.info("Rendering diagram: "+t.id),t.getAttribute("data-processed"))continue;t.setAttribute("data-processed","true");let r=`mermaid-${a.next()}`;i=t.innerHTML,i=(0,nq.dedent)(nW.utils_default.entityDecode(i)).trim().replace(/<br\s*\/?>/gi,"<br/>");let n=nW.utils_default.detectInit(i);n&&nH.log.debug("Detected early reinit: ",n);try{let{svg:n,bindFunctions:s}=await aP(r,i,t);t.innerHTML=n,e&&await e(r),s&&s(t)}catch(e){av(e,o,aM.parseError)}}if(o.length>0)throw o[0]},"runThrowsErrors"),ak=(0,nH.__name)(function(e){ax.initialize(e)},"initialize"),aj=(0,nH.__name)(async function(e,t,r){nH.log.warn("mermaid.init is deprecated. Please use run instead."),e&&ak(e);let n={postRenderCallback:r,querySelector:".mermaid"};"string"==typeof t?n.querySelector=t:t&&(t instanceof HTMLElement?n.nodes=[t]:n.nodes=t),await ab(n)},"init"),aS=(0,nH.__name)(async(e,{lazyLoad:t=!0}={})=>{sZ(),(0,nG.registerLazyLoadedDiagrams)(...e),!1===t&&await sQ()},"registerExternalDiagrams"),aN=(0,nH.__name)(function(){if(aM.startOnLoad){let{startOnLoad:e}=ax.getConfig();e&&aM.run().catch(e=>nH.log.error("Mermaid failed to initialize",e))}},"contentLoaded");"u">typeof document&&window.addEventListener("load",aN,!1);var aA=(0,nH.__name)(function(e){aM.parseError=e},"setParseErrorHandler"),aC=[],a_=!1,aT=(0,nH.__name)(async()=>{if(!a_){for(a_=!0;aC.length>0;){let e=aC.shift();if(e)try{await e()}catch(e){nH.log.error("Error executing queue",e)}}a_=!1}},"executeQueue"),aE=(0,nH.__name)(async(e,t)=>new Promise((r,n)=>{let i=(0,nH.__name)(()=>new Promise((i,s)=>{ax.parse(e,t).then(e=>{i(e),r(e)},e=>{nH.log.error("Error parsing",e),aM.parseError?.(e),s(e),n(e)})}),"performCall");aC.push(i),aT().catch(n)}),"parse"),aP=(0,nH.__name)((e,t,r)=>new Promise((n,i)=>{let s=(0,nH.__name)(()=>new Promise((s,a)=>{ax.render(e,t,r).then(e=>{s(e),n(e)},e=>{nH.log.error("Error parsing",e),aM.parseError?.(e),a(e),i(e)})}),"performCall");aC.push(s),aT().catch(i)}),"render"),aR=(0,nH.__name)(()=>Object.keys(nG.detectors).map(e=>({id:e})),"getRegisteredDiagramsMetadata"),aM={startOnLoad:!0,mermaidAPI:ax,parse:aE,render:aP,init:aj,run:ab,registerExternalDiagrams:aS,registerLayoutLoaders:nV.registerLayoutLoaders,initialize:ak,parseError:void 0,contentLoaded:aN,setParseErrorHandler:aA,detectType:nG.detectType,registerIconPacks:nU.registerIconPacks,getRegisteredDiagramsMetadata:aR},aL={startOnLoad:!1,theme:"default",securityLevel:"strict",fontFamily:"monospace",suppressErrorRendering:!0},aI=function(e={}){let t=!1,r={...aL,...e.config},n={initialize(n){r={...aL,...e.config,...n},aM.initialize(r),t=!0},render:async(e,n)=>(t||(aM.initialize(r),t=!0),await aM.render(e,n))};return{name:"mermaid",type:"diagram",language:"mermaid",getMermaid:e=>(e&&n.initialize(e),n)}}();(0,E.default)("chevron-left",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);let aD=(0,E.default)("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);var aO=e.i(77589),aO=aO,aB=e.i(349416),aF=e.i(773340),az=e.i(991106),a$=az;let aV=({className:e,from:t,...r})=>(0,v.jsx)("div",{className:(0,j.cn)("group flex w-full max-w-[95%] flex-col gap-2 transition-all duration-200","user"===t?"is-user ml-auto justify-end":"is-assistant",e),...r}),aU=({children:e,className:t,...r})=>(0,v.jsx)("div",{className:(0,j.cn)("is-user:dark flex w-fit min-w-0 max-w-full flex-col gap-2 overflow-hidden text-sm","group-[.is-user]:ml-auto group-[.is-user]:rounded-2xl group-[.is-user]:rounded-br-md group-[.is-user]:bg-primary group-[.is-user]:px-4 group-[.is-user]:py-3 group-[.is-user]:text-primary-foreground group-[.is-user]:shadow-sm","group-[.is-assistant]:text-foreground",t),...r,children:e}),aW=({className:e,children:t,...r})=>(0,v.jsx)("div",{className:(0,j.cn)("flex items-center gap-1",e),...r,children:t}),aG=({tooltip:e,children:t,label:r,variant:n="ghost",size:i="icon-sm",...s})=>{let a=(0,v.jsxs)(_.Button,{size:i,type:"button",variant:n,...s,children:[t,(0,v.jsx)("span",{className:"sr-only",children:r||e})]});return e?(0,v.jsx)(T.TooltipProvider,{children:(0,v.jsxs)(T.Tooltip,{children:[(0,v.jsx)(T.TooltipTrigger,{asChild:!0,children:a}),(0,v.jsx)(T.TooltipContent,{children:(0,v.jsx)("p",{children:e})})]})}):a},aH=({url:e,isOpen:t,onClose:r,onConfirm:n})=>{let[i,s]=(0,b.useState)(!1);if((0,b.useEffect)(()=>{s(!0)},[]),!i||!t)return null;let a=(()=>{try{return new URL(e).hostname}catch{return e}})();return(0,aF.createPortal)((0,v.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onClick:r,onKeyDown:e=>"Escape"===e.key&&r(),children:(0,v.jsxs)("div",{className:"relative mx-4 max-w-md rounded-lg bg-background p-6 shadow-lg",onClick:e=>e.stopPropagation(),children:[(0,v.jsxs)("button",{className:"absolute right-3 top-3 rounded-sm p-1 text-muted-foreground hover:bg-muted hover:text-foreground",onClick:r,type:"button",children:[(0,v.jsx)(aB.XIcon,{className:"h-4 w-4"}),(0,v.jsx)("span",{className:"sr-only",children:"Close"})]}),(0,v.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,v.jsxs)("div",{className:"flex items-center gap-2 text-lg font-semibold",children:[(0,v.jsx)(aO.default,{className:"h-5 w-5"}),(0,v.jsx)("span",{children:"External Link"})]}),(0,v.jsx)("p",{className:"text-sm text-muted-foreground",children:"You are about to visit an external website:"}),(0,v.jsx)("p",{className:"break-all rounded bg-muted px-3 py-2 text-sm font-mono",children:a}),(0,v.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,v.jsx)(_.Button,{variant:"outline",onClick:r,children:"Cancel"}),(0,v.jsx)(_.Button,{onClick:n,children:"Continue"})]})]})]})}),document.body)},aq=(0,b.memo)(({className:e,linkSafety:t,...r})=>(0,v.jsx)(a$.j,{className:(0,j.cn)("size-full [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",e),plugins:{code:ni,mermaid:aI,math:nB,cjk:ey},linkSafety:{enabled:t?.enabled??!0,onLinkCheck:t?.onLinkCheck,renderModal:t?.renderModal??aH},...r}),(e,t)=>e.children===t.children);aq.displayName="MessageResponse";var aK=e.i(241416),aY=e.i(465488),aX=e.i(995945),aJ=e.i(309945),aZ=Symbol("radix.slottable");function aQ(e){return b.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===aZ}var a0=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{var r,n;let i,s,a,o=(n=r=`Primitive.${t}`,(i=b.forwardRef((e,t)=>{let{children:r,...n}=e;if(b.isValidElement(r)){var i;let e,s,a=(i=r,(s=(e=Object.getOwnPropertyDescriptor(i.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.ref:(s=(e=Object.getOwnPropertyDescriptor(i,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.props.ref:i.props.ref||i.ref),o=function(e,t){let r={...t};for(let n in t){let i=e[n],s=t[n];/^on[A-Z]/.test(n)?i&&s?r[n]=(...e)=>{let t=s(...e);return i(...e),t}:i&&(r[n]=i):"style"===n?r[n]={...i,...s}:"className"===n&&(r[n]=[i,s].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==b.Fragment&&(o.ref=t?(0,aJ.composeRefs)(t,a):a),b.cloneElement(r,o)}return b.Children.count(r)>1?b.Children.only(null):null})).displayName=`${n}.SlotClone`,s=i,(a=b.forwardRef((e,t)=>{let{children:r,...n}=e,i=b.Children.toArray(r),a=i.find(aQ);if(a){let e=a.props.children,r=i.map(t=>t!==a?t:b.Children.count(e)>1?b.Children.only(null):b.isValidElement(e)?e.props.children:null);return(0,v.jsx)(s,{...n,ref:t,children:b.isValidElement(e)?b.cloneElement(e,void 0,r):null})}return(0,v.jsx)(s,{...n,ref:t,children:r})})).displayName=`${r}.Slot`,a),l=b.forwardRef((e,r)=>{let{asChild:n,...i}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,v.jsx)(n?o:t,{...i,ref:r})});return l.displayName=`Primitive.${t}`,{...e,[t]:l}},{}),a1=e.i(395509),a2=e.i(610559),a5="Collapsible",[a3,a6]=function(e,t=[]){let r=[],n=()=>{let t=r.map(e=>b.createContext(e));return function(r){let n=r?.[e]||t;return b.useMemo(()=>({[`__scope${e}`]:{...r,[e]:n}}),[r,n])}};return n.scopeName=e,[function(t,n){let i=b.createContext(n),s=r.length;r=[...r,n];let a=t=>{let{scope:r,children:n,...a}=t,o=r?.[e]?.[s]||i,l=b.useMemo(()=>a,Object.values(a));return(0,v.jsx)(o.Provider,{value:l,children:n})};return a.displayName=t+"Provider",[a,function(r,a){let o=a?.[e]?.[s]||i,l=b.useContext(o);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 b.useMemo(()=>({[`__scope${t.scopeName}`]:n}),[n])}};return r.scopeName=t.scopeName,r}(n,...t)]}(a5),[a4,a8]=a3(a5),a9=b.forwardRef((e,t)=>{let{__scopeCollapsible:r,open:n,defaultOpen:i,disabled:s,onOpenChange:a,...o}=e,[l,c]=(0,aY.useControllableState)({prop:n,defaultProp:i??!1,onChange:a,caller:a5});return(0,v.jsx)(a4,{scope:r,disabled:s,contentId:(0,a2.useId)(),open:l,onOpenToggle:b.useCallback(()=>c(e=>!e),[c]),children:(0,v.jsx)(a0.div,{"data-state":oi(l),"data-disabled":s?"":void 0,...o,ref:t})})});a9.displayName=a5;var a7="CollapsibleTrigger",oe=b.forwardRef((e,t)=>{let{__scopeCollapsible:r,...n}=e,i=a8(a7,r);return(0,v.jsx)(a0.button,{type:"button","aria-controls":i.contentId,"aria-expanded":i.open||!1,"data-state":oi(i.open),"data-disabled":i.disabled?"":void 0,disabled:i.disabled,...n,ref:t,onClick:(0,aK.composeEventHandlers)(e.onClick,i.onOpenToggle)})});oe.displayName=a7;var ot="CollapsibleContent",or=b.forwardRef((e,t)=>{let{forceMount:r,...n}=e,i=a8(ot,e.__scopeCollapsible);return(0,v.jsx)(a1.Presence,{present:r||i.open,children:({present:e})=>(0,v.jsx)(on,{...n,ref:t,present:e})})});or.displayName=ot;var on=b.forwardRef((e,t)=>{let{__scopeCollapsible:r,present:n,children:i,...s}=e,a=a8(ot,r),[o,l]=b.useState(n),c=b.useRef(null),u=(0,aJ.useComposedRefs)(t,c),d=b.useRef(0),h=d.current,p=b.useRef(0),m=p.current,f=a.open||o,g=b.useRef(f),y=b.useRef(void 0);return b.useEffect(()=>{let e=requestAnimationFrame(()=>g.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,aX.useLayoutEffect)(()=>{let e=c.current;if(e){y.current=y.current||{transitionDuration:e.style.transitionDuration,animationName:e.style.animationName},e.style.transitionDuration="0s",e.style.animationName="none";let t=e.getBoundingClientRect();d.current=t.height,p.current=t.width,g.current||(e.style.transitionDuration=y.current.transitionDuration,e.style.animationName=y.current.animationName),l(n)}},[a.open,n]),(0,v.jsx)(a0.div,{"data-state":oi(a.open),"data-disabled":a.disabled?"":void 0,id:a.contentId,hidden:!f,...s,ref:u,style:{"--radix-collapsible-content-height":h?`${h}px`:void 0,"--radix-collapsible-content-width":m?`${m}px`:void 0,...e.style},children:f&&i})});function oi(e){return e?"open":"closed"}function os({...e}){return(0,v.jsx)(a9,{"data-slot":"collapsible",...e})}function oa({...e}){return(0,v.jsx)(oe,{"data-slot":"collapsible-trigger",...e})}function oo({...e}){return(0,v.jsx)(or,{"data-slot":"collapsible-content",...e})}let ol=(0,E.default)("circle-check-big",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);var oc=e.i(100536);let ou=(0,E.default)("circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]),od=(0,E.default)("clock",[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]),oh=(0,E.default)("wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]]),op=(0,E.default)("circle-x",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);var om=e.i(553880);e.i(196582);let of=(0,E.default)("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"}]]),og=({token:e})=>{let t,r,n;return(0,v.jsx)("span",{className:"dark:!bg-[var(--shiki-dark-bg)] dark:!text-[var(--shiki-dark)]",style:{color:e.color,backgroundColor:e.bgColor,...e.htmlStyle,fontStyle:(t=e.fontStyle)&&1&t?"italic":void 0,fontWeight:(r=e.fontStyle)&&2&r?"bold":void 0,textDecoration:(n=e.fontStyle)&&4&n?"underline":void 0},children:e.content})},oy=({keyedLine:e,showLineNumbers:t})=>(0,v.jsx)("span",{className:t?oj:"block",children:0===e.tokens.length?"\n":e.tokens.map(({token:e,key:t})=>(0,v.jsx)(og,{token:e},t))}),ox=(0,b.createContext)({code:""}),ov=new Map,ob=new Map,ow=new Map;function ok(e,t,r){let n,i,s=(n=e.slice(0,100),i=e.length>100?e.slice(-100):"",`${t}:${e.length}:${n}:${i}`),a=ob.get(s);return a||(r&&(ow.has(s)||ow.set(s,new Set),ow.get(s)?.add(r)),(e=>{let t=ov.get(e);if(t)return t;let r=r7({themes:["github-light","github-dark"],langs:[e]});return ov.set(e,r),r})(t).then(r=>{let n=r.getLoadedLanguages().includes(t)?t:"text",i=r.codeToTokens(e,{lang:n,themes:{light:"github-light",dark:"github-dark"}}),a={tokens:i.tokens,fg:i.fg??"",bg:i.bg??""};ob.set(s,a);let o=ow.get(s);if(o){for(let e of o)e(a);ow.delete(s)}}).catch(e=>{console.error("Failed to highlight code:",e),ow.delete(s)}),null)}let oj=(0,j.cn)("block","before:content-[counter(line)]","before:inline-block","before:[counter-increment:line]","before:w-8","before:mr-4","before:text-right","before:text-muted-foreground/50","before:font-mono","before:select-none"),oS=(0,b.memo)(({tokenized:e,showLineNumbers:t,className:r})=>{let n=(0,b.useMemo)(()=>({backgroundColor:e.bg,color:e.fg}),[e.bg,e.fg]),i=(0,b.useMemo)(()=>e.tokens.map((e,t)=>({key:`line-${t}`,tokens:e.map((e,r)=>({token:e,key:`line-${t}-${r}`}))})),[e.tokens]);return(0,v.jsx)("pre",{className:(0,j.cn)("dark:!bg-[var(--shiki-dark-bg)] dark:!text-[var(--shiki-dark)] m-0 p-4 text-sm",r),style:n,children:(0,v.jsx)("code",{className:(0,j.cn)("font-mono text-sm",t&&"[counter-increment:line_0] [counter-reset:line]"),children:i.map(e=>(0,v.jsx)(oy,{keyedLine:e,showLineNumbers:t},e.key))})})},(e,t)=>e.tokenized===t.tokenized&&e.showLineNumbers===t.showLineNumbers&&e.className===t.className),oN=({className:e,language:t,style:r,...n})=>(0,v.jsx)("div",{className:(0,j.cn)("group relative w-full overflow-hidden rounded-md border bg-background text-foreground",e),"data-language":t,style:{contentVisibility:"auto",containIntrinsicSize:"auto 200px",...r},...n}),oA=({children:e,className:t,...r})=>(0,v.jsx)("div",{className:(0,j.cn)("flex items-center justify-between bg-muted/80 px-3 py-2 text-muted-foreground text-xs",t),...r,children:e}),oC=({children:e,className:t,...r})=>(0,v.jsx)("div",{className:(0,j.cn)("flex items-center gap-2",t),...r,children:e}),o_=({children:e,className:t,...r})=>(0,v.jsx)("span",{className:(0,j.cn)("font-mono",t),...r,children:e}),oT=({code:e,language:t,showLineNumbers:r=!1})=>{let n=(0,b.useMemo)(()=>({tokens:e.split("\n").map(e=>""===e?[]:[{content:e,color:"inherit"}]),fg:"inherit",bg:"transparent"}),[e]),[i,s]=(0,b.useState)(()=>ok(e,t)??n);return(0,b.useEffect)(()=>{s(ok(e,t)??n),ok(e,t,s)},[e,t,n]),(0,v.jsx)("div",{className:"relative overflow-auto",children:(0,v.jsx)(oS,{showLineNumbers:r,tokenized:i})})},oE=({code:e,language:t,showLineNumbers:r=!1,className:n,children:i,...s})=>(0,v.jsx)(ox.Provider,{value:{code:e},children:(0,v.jsxs)(oN,{className:n,language:t,...s,children:[i,(0,v.jsx)(oT,{code:e,language:t,showLineNumbers:r})]})}),oP=({className:e,...t})=>(0,v.jsx)(os,{className:(0,j.cn)("group not-prose mb-4 w-full max-w-full overflow-hidden rounded-md border",e),...t}),oR=({className:e,title:t,type:r,state:n,toolName:i,...s})=>{let a,o="dynamic-tool"===r?i:r.split("-").slice(1).join("-");return(0,v.jsxs)(oa,{className:(0,j.cn)("flex w-full items-center justify-between gap-4 p-3",e),...s,children:[(0,v.jsxs)("div",{className:"flex items-center gap-2",children:[(0,v.jsx)(oh,{className:"size-4 text-muted-foreground"}),(0,v.jsx)("span",{className:"font-medium text-sm",children:t??o}),(a={"input-streaming":(0,v.jsx)(ou,{className:"size-4"}),"input-available":(0,v.jsx)(od,{className:"size-4 animate-pulse"}),"approval-requested":(0,v.jsx)(od,{className:"size-4 text-yellow-600"}),"approval-responded":(0,v.jsx)(ol,{className:"size-4 text-blue-600"}),"output-available":(0,v.jsx)(ol,{className:"size-4 text-green-600"}),"output-error":(0,v.jsx)(op,{className:"size-4 text-red-600"}),"output-denied":(0,v.jsx)(op,{className:"size-4 text-orange-600"})},(0,v.jsxs)(C,{className:"gap-1.5 rounded-full text-xs",variant:"secondary",children:[a[n],{"input-streaming":"Pending","input-available":"Running","approval-requested":"Awaiting Approval","approval-responded":"Responded","output-available":"Completed","output-error":"Error","output-denied":"Denied"}[n]]}))]}),(0,v.jsx)(oc.ChevronDownIcon,{className:"size-4 text-muted-foreground transition-transform group-data-[state=open]:rotate-180"})]})},oM=({className:e,...t})=>(0,v.jsx)(oo,{className:(0,j.cn)("data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-popover-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in",e),...t}),oL=({className:e,input:t,...r})=>(0,v.jsxs)("div",{className:(0,j.cn)("space-y-2 overflow-hidden p-4 max-w-full",e),...r,children:[(0,v.jsx)("h4",{className:"font-medium text-muted-foreground text-xs uppercase tracking-wide",children:"Parameters"}),(0,v.jsx)("div",{className:"rounded-md bg-muted/50 overflow-x-auto max-w-full",children:(0,v.jsx)(oE,{code:JSON.stringify(t,null,2),language:"json"})})]}),oI=({className:e,output:t,errorText:r,...n})=>{if(!(t||r))return null;let i=(0,v.jsx)("div",{children:t});return"object"!=typeof t||(0,b.isValidElement)(t)?"string"==typeof t&&(i=(0,v.jsx)(oE,{code:t,language:"json"})):i=(0,v.jsx)(oE,{code:JSON.stringify(t,null,2),language:"json"}),(0,v.jsxs)("div",{className:(0,j.cn)("space-y-2 p-4 max-w-full overflow-hidden",e),...n,children:[(0,v.jsx)("h4",{className:"font-medium text-muted-foreground text-xs uppercase tracking-wide",children:r?"Error":"Result"}),(0,v.jsxs)("div",{className:(0,j.cn)("overflow-x-auto rounded-md text-xs max-w-full [&_table]:w-full",r?"bg-destructive/10 text-destructive":"bg-muted/50 text-foreground"),children:[r&&(0,v.jsx)("div",{children:r}),i]})]})},oD=({className:e,...t})=>(0,v.jsx)("div",{className:(0,j.cn)("flex flex-col overflow-hidden rounded-lg border bg-background shadow-sm",e),...t}),oO=({className:e,...t})=>(0,v.jsx)("div",{className:(0,j.cn)("flex items-center justify-between border-b bg-muted/50 px-4 py-3",e),...t}),oB=({className:e,...t})=>(0,v.jsx)("p",{className:(0,j.cn)("font-medium text-foreground text-sm",e),...t}),oF=({className:e,...t})=>(0,v.jsx)("p",{className:(0,j.cn)("text-muted-foreground text-sm",e),...t}),oz=({className:e,...t})=>(0,v.jsx)("div",{className:(0,j.cn)("flex items-center gap-1",e),...t}),o$=({tooltip:e,label:t,icon:r,children:n,className:i,size:s="sm",variant:a="ghost",...o})=>{let l=(0,v.jsxs)(_.Button,{className:(0,j.cn)("size-8 p-0 text-muted-foreground hover:text-foreground",i),size:s,type:"button",variant:a,...o,children:[r?(0,v.jsx)(r,{className:"size-4"}):n,(0,v.jsx)("span",{className:"sr-only",children:t||e})]});return e?(0,v.jsx)(T.TooltipProvider,{children:(0,v.jsxs)(T.Tooltip,{children:[(0,v.jsx)(T.TooltipTrigger,{asChild:!0,children:l}),(0,v.jsx)(T.TooltipContent,{children:(0,v.jsx)("p",{children:e})})]})}):l},oV=({className:e,...t})=>(0,v.jsx)("div",{className:(0,j.cn)("flex-1 overflow-auto p-4",e),...t}),oU=(0,N.cva)("relative w-full rounded-lg border px-4 py-3 text-sm grid has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] grid-cols-[0_1fr] has-[>svg]:gap-x-3 gap-y-0.5 items-start [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"text-destructive bg-card [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90"}},defaultVariants:{variant:"default"}});function oW({className:e,variant:t,...r}){return(0,v.jsx)("div",{"data-slot":"alert",role:"alert",className:(0,j.cn)(oU({variant:t}),e),...r})}let oG=(0,b.createContext)(null),oH=()=>{let e=(0,b.useContext)(oG);if(!e)throw Error("Confirmation components must be used within Confirmation");return e},oq=({className:e,approval:t,state:r,...n})=>t&&"input-streaming"!==r&&"input-available"!==r?(0,v.jsx)(oG.Provider,{value:{approval:t,state:r},children:(0,v.jsx)(oW,{className:(0,j.cn)("flex flex-col gap-2",e),...n})}):null,oK=({children:e})=>{let{state:t}=oH();return"approval-requested"!==t?null:e},oY=({className:e,...t})=>{let{state:r}=oH();return"approval-requested"!==r?null:(0,v.jsx)("div",{className:(0,j.cn)("flex items-center justify-end gap-2 self-end",e),...t})},oX=e=>(0,v.jsx)(_.Button,{className:"h-8 px-3 text-sm",type:"button",...e}),oJ=({size:e=16})=>(0,v.jsxs)("svg",{height:e,strokeLinejoin:"round",style:{color:"currentcolor"},viewBox:"0 0 16 16",width:e,children:[(0,v.jsx)("title",{children:"Loader"}),(0,v.jsxs)("g",{clipPath:"url(#clip0_2393_1490)",children:[(0,v.jsx)("path",{d:"M8 0V4",stroke:"currentColor",strokeWidth:"1.5"}),(0,v.jsx)("path",{d:"M8 16V12",opacity:"0.5",stroke:"currentColor",strokeWidth:"1.5"}),(0,v.jsx)("path",{d:"M3.29773 1.52783L5.64887 4.7639",opacity:"0.9",stroke:"currentColor",strokeWidth:"1.5"}),(0,v.jsx)("path",{d:"M12.7023 1.52783L10.3511 4.7639",opacity:"0.1",stroke:"currentColor",strokeWidth:"1.5"}),(0,v.jsx)("path",{d:"M12.7023 14.472L10.3511 11.236",opacity:"0.4",stroke:"currentColor",strokeWidth:"1.5"}),(0,v.jsx)("path",{d:"M3.29773 14.472L5.64887 11.236",opacity:"0.6",stroke:"currentColor",strokeWidth:"1.5"}),(0,v.jsx)("path",{d:"M15.6085 5.52783L11.8043 6.7639",opacity:"0.2",stroke:"currentColor",strokeWidth:"1.5"}),(0,v.jsx)("path",{d:"M0.391602 10.472L4.19583 9.23598",opacity:"0.7",stroke:"currentColor",strokeWidth:"1.5"}),(0,v.jsx)("path",{d:"M15.6085 10.4722L11.8043 9.2361",opacity:"0.3",stroke:"currentColor",strokeWidth:"1.5"}),(0,v.jsx)("path",{d:"M0.391602 5.52783L4.19583 6.7639",opacity:"0.8",stroke:"currentColor",strokeWidth:"1.5"})]}),(0,v.jsx)("defs",{children:(0,v.jsx)("clipPath",{id:"clip0_2393_1490",children:(0,v.jsx)("rect",{fill:"white",height:"16",width:"16"})})})]}),oZ=({className:e,size:t=16,...r})=>(0,v.jsx)("div",{className:(0,j.cn)("inline-flex animate-spin items-center justify-center",e),...r,children:(0,v.jsx)(oJ,{size:t})}),oQ=(0,E.default)("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"}]]);var a$=az;let o0=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],o1=new Set(o0),o2=(e,t,r)=>r>t?t:r<e?e:r,o5={test:e=>"number"==typeof e,parse:parseFloat,transform:e=>e},o3={...o5,transform:e=>o2(0,1,e)},o6={...o5,default:1},o4=e=>Math.round(1e5*e)/1e5,o8=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu,o9=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,o7=(e,t)=>r=>!!("string"==typeof r&&o9.test(r)&&r.startsWith(e)||t&&null!=r&&Object.prototype.hasOwnProperty.call(r,t)),le=(e,t,r)=>n=>{if("string"!=typeof n)return n;let[i,s,a,o]=n.match(o8);return{[e]:parseFloat(i),[t]:parseFloat(s),[r]:parseFloat(a),alpha:void 0!==o?parseFloat(o):1}},lt={...o5,transform:e=>Math.round(o2(0,255,e))},lr={test:o7("rgb","red"),parse:le("red","green","blue"),transform:({red:e,green:t,blue:r,alpha:n=1})=>"rgba("+lt.transform(e)+", "+lt.transform(t)+", "+lt.transform(r)+", "+o4(o3.transform(n))+")"},ln={test:o7("#"),parse:function(e){let t="",r="",n="",i="";return e.length>5?(t=e.substring(1,3),r=e.substring(3,5),n=e.substring(5,7),i=e.substring(7,9)):(t=e.substring(1,2),r=e.substring(2,3),n=e.substring(3,4),i=e.substring(4,5),t+=t,r+=r,n+=n,i+=i),{red:parseInt(t,16),green:parseInt(r,16),blue:parseInt(n,16),alpha:i?parseInt(i,16)/255:1}},transform:lr.transform},li=e=>({test:t=>"string"==typeof t&&t.endsWith(e)&&1===t.split(" ").length,parse:parseFloat,transform:t=>`${t}${e}`}),ls=li("deg"),la=li("%"),lo=li("px"),ll=li("vh"),lc=li("vw"),lu={...la,parse:e=>la.parse(e)/100,transform:e=>la.transform(100*e)},ld={test:o7("hsl","hue"),parse:le("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:r,alpha:n=1})=>"hsla("+Math.round(e)+", "+la.transform(o4(t))+", "+la.transform(o4(r))+", "+o4(o3.transform(n))+")"},lh={test:e=>lr.test(e)||ln.test(e)||ld.test(e),parse:e=>lr.test(e)?lr.parse(e):ld.test(e)?ld.parse(e):ln.parse(e),transform:e=>"string"==typeof e?e:e.hasOwnProperty("red")?lr.transform(e):ld.transform(e),getAnimatableNone:e=>{let t=lh.parse(e);return t.alpha=0,lh.transform(t)}},lp=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu,lm="number",lf="color",lg=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function ly(e){let t=e.toString(),r=[],n={color:[],number:[],var:[]},i=[],s=0,a=t.replace(lg,e=>(lh.test(e)?(n.color.push(s),i.push(lf),r.push(lh.parse(e))):e.startsWith("var(")?(n.var.push(s),i.push("var"),r.push(e)):(n.number.push(s),i.push(lm),r.push(parseFloat(e))),++s,"${}")).split("${}");return{values:r,split:a,indexes:n,types:i}}function lx(e){return ly(e).values}function lv(e){let{split:t,types:r}=ly(e),n=t.length;return e=>{let i="";for(let s=0;s<n;s++)if(i+=t[s],void 0!==e[s]){let t=r[s];t===lm?i+=o4(e[s]):t===lf?i+=lh.transform(e[s]):i+=e[s]}return i}}let lb=e=>"number"==typeof e?0:lh.test(e)?lh.getAnimatableNone(e):e,lw={test:function(e){return isNaN(e)&&"string"==typeof e&&(e.match(o8)?.length||0)+(e.match(lp)?.length||0)>0},parse:lx,createTransformer:lv,getAnimatableNone:function(e){let t=lx(e);return lv(e)(t.map(lb))}},lk=new Set(["brightness","contrast","saturate","opacity"]);function lj(e){let[t,r]=e.slice(0,-1).split("(");if("drop-shadow"===t)return e;let[n]=r.match(o8)||[];if(!n)return e;let i=r.replace(n,""),s=+!!lk.has(t);return n!==r&&(s*=100),t+"("+s+i+")"}let lS=/\b([a-z-]*)\(.*?\)/gu,lN={...lw,getAnimatableNone:e=>{let t=e.match(lS);return t?t.map(lj).join(" "):e}},lA={...o5,transform:Math.round},lC={borderWidth:lo,borderTopWidth:lo,borderRightWidth:lo,borderBottomWidth:lo,borderLeftWidth:lo,borderRadius:lo,borderTopLeftRadius:lo,borderTopRightRadius:lo,borderBottomRightRadius:lo,borderBottomLeftRadius:lo,width:lo,maxWidth:lo,height:lo,maxHeight:lo,top:lo,right:lo,bottom:lo,left:lo,inset:lo,insetBlock:lo,insetBlockStart:lo,insetBlockEnd:lo,insetInline:lo,insetInlineStart:lo,insetInlineEnd:lo,padding:lo,paddingTop:lo,paddingRight:lo,paddingBottom:lo,paddingLeft:lo,paddingBlock:lo,paddingBlockStart:lo,paddingBlockEnd:lo,paddingInline:lo,paddingInlineStart:lo,paddingInlineEnd:lo,margin:lo,marginTop:lo,marginRight:lo,marginBottom:lo,marginLeft:lo,marginBlock:lo,marginBlockStart:lo,marginBlockEnd:lo,marginInline:lo,marginInlineStart:lo,marginInlineEnd:lo,fontSize:lo,backgroundPositionX:lo,backgroundPositionY:lo,rotate:ls,rotateX:ls,rotateY:ls,rotateZ:ls,scale:o6,scaleX:o6,scaleY:o6,scaleZ:o6,skew:ls,skewX:ls,skewY:ls,distance:lo,translateX:lo,translateY:lo,translateZ:lo,x:lo,y:lo,z:lo,perspective:lo,transformPerspective:lo,opacity:o3,originX:lu,originY:lu,originZ:lo,zIndex:lA,fillOpacity:o3,strokeOpacity:o3,numOctaves:lA},l_={...lC,color:lh,backgroundColor:lh,outlineColor:lh,fill:lh,stroke:lh,borderColor:lh,borderTopColor:lh,borderRightColor:lh,borderBottomColor:lh,borderLeftColor:lh,filter:lN,WebkitFilter:lN},lT=e=>l_[e],lE=()=>({translate:0,scale:1,origin:0,originPoint:0}),lP=()=>({x:lE(),y:lE()}),lR=()=>({min:0,max:0}),lM=()=>({x:lR(),y:lR()}),lL=e=>!!(e&&e.getVelocity),lI=new Set(["width","height","top","left","right","bottom",...o0]),lD=e=>t=>t.test(e),lO=[o5,lo,la,ls,lc,ll,{test:e=>"auto"===e,parse:e=>e}],lB=e=>lO.find(lD(e)),lF=()=>{},lz=()=>{};ej.default;let l$=e=>t=>"string"==typeof t&&t.startsWith(e),lV=l$("--"),lU=l$("var(--"),lW=e=>!!lU(e)&&lG.test(e.split("/*")[0].trim()),lG=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function lH(e){return"string"==typeof e&&e.split("/*")[0].includes("var(--")}let lq=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u,lK=e=>180*e/Math.PI,lY=e=>lJ(lK(Math.atan2(e[1],e[0]))),lX={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:lY,rotateZ:lY,skewX:e=>lK(Math.atan(e[1])),skewY:e=>lK(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},lJ=e=>((e%=360)<0&&(e+=360),e),lZ=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),lQ=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),l0={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:lZ,scaleY:lQ,scale:e=>(lZ(e)+lQ(e))/2,rotateX:e=>lJ(lK(Math.atan2(e[6],e[5]))),rotateY:e=>lJ(lK(Math.atan2(-e[2],e[0]))),rotateZ:lY,rotate:lY,skewX:e=>lK(Math.atan(e[4])),skewY:e=>lK(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function l1(e){return+!!e.includes("scale")}function l2(e,t){let r,n;if(!e||"none"===e)return l1(t);let i=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);if(i)r=l0,n=i;else{let t=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=lX,n=t}if(!n)return l1(t);let s=r[t],a=n[1].split(",").map(l5);return"function"==typeof s?s(a):a[s]}function l5(e){return parseFloat(e.trim())}let l3=e=>e===o5||e===lo,l6=new Set(["x","y","z"]),l4=o0.filter(e=>!l6.has(e)),l8={width:({x:e},{paddingLeft:t="0",paddingRight:r="0"})=>e.max-e.min-parseFloat(t)-parseFloat(r),height:({y:e},{paddingTop:t="0",paddingBottom:r="0"})=>e.max-e.min-parseFloat(t)-parseFloat(r),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>l2(t,"x"),y:(e,{transform:t})=>l2(t,"y")};l8.translateX=l8.x,l8.translateY=l8.y;let l9=e=>e,l7={},ce=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function ct(e,t){let r=!1,n=!0,i={delta:0,timestamp:0,isProcessing:!1},s=()=>r=!0,a=ce.reduce((e,r)=>(e[r]=function(e,t){let r=new Set,n=new Set,i=!1,s=!1,a=new WeakSet,o={delta:0,timestamp:0,isProcessing:!1},l=0;function c(t){a.has(t)&&(u.schedule(t),e()),l++,t(o)}let u={schedule:(e,t=!1,s=!1)=>{let o=s&&i?r:n;return t&&a.add(e),o.has(e)||o.add(e),e},cancel:e=>{n.delete(e),a.delete(e)},process:e=>{if(o=e,i){s=!0;return}i=!0,[r,n]=[n,r],r.forEach(c),t,l=0,r.clear(),i=!1,s&&(s=!1,u.process(e))}};return u}(s,t?r:void 0),e),{}),{setup:o,read:l,resolveKeyframes:c,preUpdate:u,update:d,preRender:h,render:p,postRender:m}=a,f=()=>{let s=l7.useManualTiming?i.timestamp:performance.now();r=!1,l7.useManualTiming||(i.delta=n?1e3/60:Math.max(Math.min(s-i.timestamp,40),1)),i.timestamp=s,i.isProcessing=!0,o.process(i),l.process(i),c.process(i),u.process(i),d.process(i),h.process(i),p.process(i),m.process(i),i.isProcessing=!1,r&&t&&(n=!1,e(f))};return{schedule:ce.reduce((t,s)=>{let o=a[s];return t[s]=(t,s=!1,a=!1)=>(!r&&(r=!0,n=!0,i.isProcessing||e(f)),o.schedule(t,s,a)),t},{}),cancel:e=>{for(let t=0;t<ce.length;t++)a[ce[t]].cancel(e)},state:i,steps:a}}let{schedule:cr,cancel:cn,state:ci,steps:cs}=ct("u">typeof requestAnimationFrame?requestAnimationFrame:l9,!0),ca=new Set,co=!1,cl=!1,cc=!1;function cu(){if(cl){let e=Array.from(ca).filter(e=>e.needsMeasurement),t=new Set(e.map(e=>e.element)),r=new Map;t.forEach(e=>{let t,n=(t=[],l4.forEach(r=>{let n=e.getValue(r);void 0!==n&&(t.push([r,n.get()]),n.set(+!!r.startsWith("scale")))}),t);n.length&&(r.set(e,n),e.render())}),e.forEach(e=>e.measureInitialState()),t.forEach(e=>{e.render();let t=r.get(e);t&&t.forEach(([t,r])=>{e.getValue(t)?.set(r)})}),e.forEach(e=>e.measureEndState()),e.forEach(e=>{void 0!==e.suspendedScrollY&&window.scrollTo(0,e.suspendedScrollY)})}cl=!1,co=!1,ca.forEach(e=>e.complete(cc)),ca.clear()}function cd(){ca.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(cl=!0)})}class ch{constructor(e,t,r,n,i,s=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=t,this.name=r,this.motionValue=n,this.element=i,this.isAsync=s}scheduleResolve(){this.state="scheduled",this.isAsync?(ca.add(this),co||(co=!0,cr.read(cd),cr.resolveKeyframes(cu))):(this.readKeyframes(),this.complete())}readKeyframes(){let{unresolvedKeyframes:e,name:t,element:r,motionValue:n}=this;if(null===e[0]){let i=n?.get(),s=e[e.length-1];if(void 0!==i)e[0]=i;else if(r&&t){let n=r.readValue(t,s);null!=n&&(e[0]=n)}void 0===e[0]&&(e[0]=s),n&&void 0===i&&n.set(e[0])}for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),ca.delete(this)}cancel(){"scheduled"===this.state&&(ca.delete(this),this.state="pending")}resume(){"pending"===this.state&&this.scheduleResolve()}}function cp(e,t){let r=lT(e);return r!==lN&&(r=lw),r.getAnimatableNone?r.getAnimatableNone(t):void 0}let cm=new Set(["auto","none","0"]);class cf extends ch{constructor(e,t,r,n,i){super(e,t,r,n,i,!0)}readKeyframes(){let{unresolvedKeyframes:e,element:t,name:r}=this;if(!t||!t.current)return;super.readKeyframes();for(let r=0;r<e.length;r++){let n=e[r];if("string"==typeof n&&lW(n=n.trim())){let i=function e(t,r,n=1){lz(n<=4,`Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`,"max-css-var-depth");let[i,s]=function(e){let t=lq.exec(e);if(!t)return[,];let[,r,n,i]=t;return[`--${r??n}`,i]}(t);if(!i)return;let a=window.getComputedStyle(r).getPropertyValue(i);if(a){let e=a.trim();return/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e)?parseFloat(e):e}return lW(s)?e(s,r,n+1):s}(n,t.current);void 0!==i&&(e[r]=i),r===e.length-1&&(this.finalKeyframe=n)}}if(this.resolveNoneKeyframes(),!lI.has(r)||2!==e.length)return;let[n,i]=e,s=lB(n),a=lB(i);if(lH(n)!==lH(i)&&l8[r]){this.needsMeasurement=!0;return}if(s!==a)if(l3(s)&&l3(a))for(let t=0;t<e.length;t++){let r=e[t];"string"==typeof r&&(e[t]=parseFloat(r))}else l8[r]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){let{unresolvedKeyframes:e,name:t}=this,r=[];for(let t=0;t<e.length;t++)(null===e[t]||function(e){if("number"==typeof e)return 0===e;if(null===e)return!0;return"none"===e||"0"===e||/^0[^.\s]+$/u.test(e)}(e[t]))&&r.push(t);r.length&&function(e,t,r){let n,i=0;for(;i<e.length&&!n;){let t=e[i];"string"==typeof t&&!cm.has(t)&&ly(t).values.length&&(n=e[i]),i++}if(n&&r)for(let i of t)e[i]=cp(r,n)}(e,r,t)}measureInitialState(){let{element:e,unresolvedKeyframes:t,name:r}=this;if(!e||!e.current)return;"height"===r&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=l8[r](e.measureViewportBox(),window.getComputedStyle(e.current)),t[0]=this.measuredOrigin;let n=t[t.length-1];void 0!==n&&e.getValue(r,n).jump(n,!1)}measureEndState(){let{element:e,name:t,unresolvedKeyframes:r}=this;if(!e||!e.current)return;let n=e.getValue(t);n&&n.jump(this.measuredOrigin,!1);let i=r.length-1,s=r[i];r[i]=l8[t](e.measureViewportBox(),window.getComputedStyle(e.current)),null!==s&&void 0===this.finalKeyframe&&(this.finalKeyframe=s),this.removedTransforms?.length&&this.removedTransforms.forEach(([t,r])=>{e.getValue(t).set(r)}),this.resolveNoneKeyframes()}}function cg(e,t){-1===e.indexOf(t)&&e.push(t)}function cy(e,t){let r=e.indexOf(t);r>-1&&e.splice(r,1)}class cx{constructor(){this.subscriptions=[]}add(e){return cg(this.subscriptions,e),()=>cy(this.subscriptions,e)}notify(e,t,r){let n=this.subscriptions.length;if(n)if(1===n)this.subscriptions[0](e,t,r);else for(let i=0;i<n;i++){let n=this.subscriptions[i];n&&n(e,t,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}let{schedule:cv}=ct(queueMicrotask,!1);function cb(){n=void 0}let cw={now:()=>(void 0===n&&cw.set(ci.isProcessing||l7.useManualTiming?ci.timestamp:performance.now()),n),set:e=>{n=e,queueMicrotask(cb)}};class ck{constructor(e,t={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=e=>{let t=cw.now();if(this.updatedAt!==t&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(e),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(let e of this.dependents)e.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=t.owner}setCurrent(e){this.current=e,this.updatedAt=cw.now(),null===this.canTrackVelocity&&void 0!==e&&(this.canTrackVelocity=!isNaN(parseFloat(this.current)))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on("change",e)}on(e,t){this.events[e]||(this.events[e]=new cx);let r=this.events[e].add(t);return"change"===e?()=>{r(),cr.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(let e in this.events)this.events[e].clear()}attach(e,t){this.passiveEffect=e,this.stopPassiveEffect=t}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,t,r){this.set(t),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-r}jump(e,t=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,t&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(e){this.dependents||(this.dependents=new Set),this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return d&&d.push(this),this.current}getPrevious(){return this.prev}getVelocity(){var e;let t=cw.now();if(!this.canTrackVelocity||void 0===this.prevFrameValue||t-this.updatedAt>30)return 0;let r=Math.min(this.updatedAt-this.prevUpdatedAt,30);return e=parseFloat(this.current)-parseFloat(this.prevFrameValue),r?1e3/r*e:0}start(e){return this.stop(),new Promise(t=>{this.hasAnimated=!0,this.animation=e(t),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function cj(e,t){return new ck(e,t)}let cS=[...lO,lh,lw],cN={current:null},cA={current:!1},cC="u">typeof window,c_=new WeakMap;function cT(e){return null!==e&&"object"==typeof e&&"function"==typeof e.start}function cE(e){return"string"==typeof e||Array.isArray(e)}let cP=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],cR=["initial",...cP];function cM(e){return cT(e.animate)||cR.some(t=>cE(e[t]))}function cL(e){return!!(cM(e)||e.variants)}function cI(e){let t=[{},{}];return e?.values.forEach((e,r)=>{t[0][r]=e.get(),t[1][r]=e.getVelocity()}),t}function cD(e,t,r,n){if("function"==typeof t){let[i,s]=cI(n);t=t(void 0!==r?r:e.custom,i,s)}if("string"==typeof t&&(t=e.variants&&e.variants[t]),"function"==typeof t){let[i,s]=cI(n);t=t(void 0!==r?r:e.custom,i,s)}return t}let cO=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"],cB={};class cF{scrapeMotionValuesFromProps(e,t,r){return{}}constructor({parent:e,props:t,presenceContext:r,reducedMotionConfig:n,blockInitialAnimation:i,visualState:s},a={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=ch,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{let e=cw.now();this.renderScheduledAt<e&&(this.renderScheduledAt=e,cr.render(this.render,!1,!0))};const{latestValues:o,renderState:l}=s;this.latestValues=o,this.baseTarget={...o},this.initialValues=t.initial?{...o}:{},this.renderState=l,this.parent=e,this.props=t,this.presenceContext=r,this.depth=e?e.depth+1:0,this.reducedMotionConfig=n,this.options=a,this.blockInitialAnimation=!!i,this.isControllingVariants=cM(t),this.isVariantNode=cL(t),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:c,...u}=this.scrapeMotionValuesFromProps(t,{},this);for(const e in u){const t=u[e];void 0!==o[e]&&lL(t)&&t.set(o[e])}}mount(e){this.current=e,c_.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((e,t)=>this.bindToMotionValue(t,e)),"never"===this.reducedMotionConfig?this.shouldReduceMotion=!1:"always"===this.reducedMotionConfig?this.shouldReduceMotion=!0:(cA.current||function(){if(cA.current=!0,cC)if(window.matchMedia){let e=window.matchMedia("(prefers-reduced-motion)"),t=()=>cN.current=e.matches;e.addEventListener("change",t),t()}else cN.current=!1}(),this.shouldReduceMotion=cN.current),this.parent?.addChild(this),this.update(this.props,this.presenceContext)}unmount(){for(let e in this.projection&&this.projection.unmount(),cn(this.notifyUpdate),cn(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this),this.events)this.events[e].clear();for(let e in this.features){let t=this.features[e];t&&(t.unmount(),t.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,t){let r;this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)();let n=o1.has(e);n&&this.onBindTransform&&this.onBindTransform();let i=t.on("change",t=>{this.latestValues[e]=t,this.props.onUpdate&&cr.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});"u">typeof window&&window.MotionCheckAppearSync&&(r=window.MotionCheckAppearSync(this,e,t)),this.valueSubscriptions.set(e,()=>{i(),r&&r(),t.owner&&t.stop()})}sortNodePosition(e){return this.current&&this.sortInstanceNodePosition&&this.type===e.type?this.sortInstanceNodePosition(this.current,e.current):0}updateFeatures(){let e="animation";for(e in cB){let t=cB[e];if(!t)continue;let{isEnabled:r,Feature:n}=t;if(!this.features[e]&&n&&r(this.props)&&(this.features[e]=new n(this)),this.features[e]){let t=this.features[e];t.isMounted?t.update():(t.mount(),t.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):lM()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,t){this.latestValues[e]=t}update(e,t){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=t;for(let t=0;t<cO.length;t++){let r=cO[t];this.propEventSubscriptions[r]&&(this.propEventSubscriptions[r](),delete this.propEventSubscriptions[r]);let n=e["on"+r];n&&(this.propEventSubscriptions[r]=this.on(r,n))}this.prevMotionValues=function(e,t,r){for(let n in t){let i=t[n],s=r[n];if(lL(i))e.addValue(n,i);else if(lL(s))e.addValue(n,cj(i,{owner:e}));else if(s!==i)if(e.hasValue(n)){let t=e.getValue(n);!0===t.liveStyle?t.jump(i):t.hasAnimated||t.set(i)}else{let t=e.getStaticValue(n);e.addValue(n,cj(void 0!==t?t:i,{owner:e}))}}for(let n in r)void 0===t[n]&&e.removeValue(n);return t}(this,this.scrapeMotionValuesFromProps(e,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(e){let t=this.getClosestVariantNode();if(t)return t.variantChildren&&t.variantChildren.add(e),()=>t.variantChildren.delete(e)}addValue(e,t){let r=this.values.get(e);t!==r&&(r&&this.removeValue(e),this.bindToMotionValue(e,t),this.values.set(e,t),this.latestValues[e]=t.get())}removeValue(e){this.values.delete(e);let t=this.valueSubscriptions.get(e);t&&(t(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,t){if(this.props.values&&this.props.values[e])return this.props.values[e];let r=this.values.get(e);return void 0===r&&void 0!==t&&(r=cj(null===t?void 0:t,{owner:this}),this.addValue(e,r)),r}readValue(e,t){let r=void 0===this.latestValues[e]&&this.current?this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options):this.latestValues[e];if(null!=r){let n,i;if("string"==typeof r&&(n=r,/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(n)||(i=r,/^0[^.\s]+$/u.test(i))))r=parseFloat(r);else{let n;n=r,!cS.find(lD(n))&&lw.test(t)&&(r=cp(e,t))}this.setBaseTarget(e,lL(r)?r.get():r)}return lL(r)?r.get():r}setBaseTarget(e,t){this.baseTarget[e]=t}getBaseTarget(e){let t,{initial:r}=this.props;if("string"==typeof r||"object"==typeof r){let n=cD(this.props,r,this.presenceContext?.custom);n&&(t=n[e])}if(r&&void 0!==t)return t;let n=this.getBaseTargetFromProps(this.props,e);return void 0===n||lL(n)?void 0!==this.initialValues[e]&&void 0===t?void 0:this.baseTarget[e]:n}on(e,t){return this.events[e]||(this.events[e]=new cx),this.events[e].add(t)}notify(e,...t){this.events[e]&&this.events[e].notify(...t)}scheduleRenderMicrotask(){cv.render(this.render)}}class cz extends cF{constructor(){super(...arguments),this.KeyframeResolver=cf}sortInstanceNodePosition(e,t){return 2&e.compareDocumentPosition(t)?1:-1}getBaseTargetFromProps(e,t){let r=e.style;return r?r[t]:void 0}removeValueFromRenderState(e,{vars:t,style:r}){delete t[e],delete r[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);let{children:e}=this.props;lL(e)&&(this.childSubscription=e.on("change",e=>{this.current&&(this.current.textContent=`${e}`)}))}}function c$(e){return e.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`)}let cV=(e,t)=>t&&"number"==typeof e?t.transform(e):e,cU={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},cW=o0.length;function cG(e,t,r){let{style:n,vars:i,transformOrigin:s}=e,a=!1,o=!1;for(let e in t){let r=t[e];if(o1.has(e)){a=!0;continue}if(lV(e)){i[e]=r;continue}{let t=cV(r,lC[e]);e.startsWith("origin")?(o=!0,s[e]=t):n[e]=t}}if(!t.transform&&(a||r?n.transform=function(e,t,r){let n="",i=!0;for(let s=0;s<cW;s++){let a=o0[s],o=e[a];if(void 0===o)continue;let l=!0;if("number"==typeof o)l=o===+!!a.startsWith("scale");else{let e=parseFloat(o);l=a.startsWith("scale")?1===e:0===e}if(!l||r){let e=cV(o,lC[a]);if(!l){i=!1;let t=cU[a]||a;n+=`${t}(${e}) `}r&&(t[a]=e)}}return n=n.trim(),r?n=r(t,i?"":n):i&&(n="none"),n}(t,e.transform,r):n.transform&&(n.transform="none")),o){let{originX:e="50%",originY:t="50%",originZ:r=0}=s;n.transformOrigin=`${e} ${t} ${r}`}}let cH={offset:"stroke-dashoffset",array:"stroke-dasharray"},cq={offset:"strokeDashoffset",array:"strokeDasharray"},cK=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function cY(e,{attrX:t,attrY:r,attrScale:n,pathLength:i,pathSpacing:s=1,pathOffset:a=0,...o},l,c,u){if(cG(e,o,c),l){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};let{attrs:d,style:h}=e;for(let e of(d.transform&&(h.transform=d.transform,delete d.transform),(h.transform||d.transformOrigin)&&(h.transformOrigin=d.transformOrigin??"50% 50%",delete d.transformOrigin),h.transform&&(h.transformBox=u?.transformBox??"fill-box",delete d.transformBox),cK))void 0!==d[e]&&(h[e]=d[e],delete d[e]);void 0!==t&&(d.x=t),void 0!==r&&(d.y=r),void 0!==n&&(d.scale=n),void 0!==i&&function(e,t,r=1,n=0,i=!0){e.pathLength=1;let s=i?cH:cq;e[s.offset]=`${-n}`,e[s.array]=`${t} ${r}`}(d,i,s,a,!1)}let cX=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]),cJ=e=>"string"==typeof e&&"svg"===e.toLowerCase();function cZ(e,{style:t,vars:r},n,i){let s,a=e.style;for(s in t)a[s]=t[s];for(s in i?.applyProjectionStyles(a,n),r)a.setProperty(s,r[s])}function cQ(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}let c0={correct:(e,t)=>{if(!t.target)return e;if("string"==typeof e)if(!lo.test(e))return e;else e=parseFloat(e);let r=cQ(e,t.target.x),n=cQ(e,t.target.y);return`${r}% ${n}%`}},c1=(e,t,r)=>e+(t-e)*r,c2={borderRadius:{...c0,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:c0,borderTopRightRadius:c0,borderBottomLeftRadius:c0,borderBottomRightRadius:c0,boxShadow:{correct:(e,{treeScale:t,projectionDelta:r})=>{let n=lw.parse(e);if(n.length>5)return e;let i=lw.createTransformer(e),s=+("number"!=typeof n[0]),a=r.x.scale*t.x,o=r.y.scale*t.y;n[0+s]/=a,n[1+s]/=o;let l=c1(a,o,.5);return"number"==typeof n[2+s]&&(n[2+s]/=l),"number"==typeof n[3+s]&&(n[3+s]/=l),i(n)}}};function c5(e,{layout:t,layoutId:r}){return o1.has(e)||e.startsWith("origin")||(t||void 0!==r)&&(!!c2[e]||"opacity"===e)}function c3(e,t,r){let n=e.style,i=t?.style,s={};if(!n)return s;for(let t in n)(lL(n[t])||i&&lL(i[t])||c5(t,e)||r?.getValue(t)?.liveStyle!==void 0)&&(s[t]=n[t]);return s}function c6(e,t,r){let n=c3(e,t,r);for(let r in e)(lL(e[r])||lL(t[r]))&&(n[-1!==o0.indexOf(r)?"attr"+r.charAt(0).toUpperCase()+r.substring(1):r]=e[r]);return n}class c4 extends cz{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=lM}getBaseTargetFromProps(e,t){return e[t]}readValueFromInstance(e,t){if(o1.has(t)){let e=lT(t);return e&&e.default||0}return t=cX.has(t)?t:c$(t),e.getAttribute(t)}scrapeMotionValuesFromProps(e,t,r){return c6(e,t,r)}build(e,t,r){cY(e,t,this.isSVGTag,r.transformTemplate,r.style)}renderInstance(e,t,r,n){for(let r in cZ(e,t,void 0,n),t.attrs)e.setAttribute(cX.has(r)?r:c$(r),t.attrs[r])}mount(e){this.isSVGTag=cJ(e.tagName),super.mount(e)}}function c8({top:e,left:t,right:r,bottom:n}){return{x:{min:t,max:r},y:{min:e,max:n}}}function c9(e){return void 0===e||1===e}function c7({scale:e,scaleX:t,scaleY:r}){return!c9(e)||!c9(t)||!c9(r)}function ue(e){return c7(e)||ut(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function ut(e){var t,r;return(t=e.x)&&"0%"!==t||(r=e.y)&&"0%"!==r}function ur(e,t,r,n,i){return void 0!==i&&(e=n+i*(e-n)),n+r*(e-n)+t}function un(e,t=0,r=1,n,i){e.min=ur(e.min,t,r,n,i),e.max=ur(e.max,t,r,n,i)}function ui(e,{x:t,y:r}){un(e.x,t.translate,t.scale,t.originPoint),un(e.y,r.translate,r.scale,r.originPoint)}function us(e,t){e.min=e.min+t,e.max=e.max+t}function ua(e,t,r,n,i=.5){let s=c1(e.min,e.max,i);un(e,t,r,s,n)}function uo(e,t){ua(e.x,t.x,t.scaleX,t.scale,t.originX),ua(e.y,t.y,t.scaleY,t.scale,t.originY)}function ul(e,t){return c8(function(e,t){if(!t)return e;let r=t({x:e.left,y:e.top}),n=t({x:e.right,y:e.bottom});return{top:r.y,left:r.x,bottom:n.y,right:n.x}}(e.getBoundingClientRect(),t))}class uc extends cz{constructor(){super(...arguments),this.type="html",this.renderInstance=cZ}readValueFromInstance(e,t){if(o1.has(t))return this.projection?.isProjecting?l1(t):((e,t)=>{let{transform:r="none"}=getComputedStyle(e);return l2(r,t)})(e,t);{let r=window.getComputedStyle(e),n=(lV(t)?r.getPropertyValue(t):r[t])||0;return"string"==typeof n?n.trim():n}}measureInstanceViewportBox(e,{transformPagePoint:t}){return ul(e,t)}build(e,t,r){cG(e,t,r.transformTemplate)}scrapeMotionValuesFromProps(e,t,r){return c3(e,t,r)}}let uu=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function ud(e){if("string"!=typeof e||e.includes("-"));else if(uu.indexOf(e)>-1||/[A-Z]/u.test(e))return!0;return!1}let uh=(0,b.createContext)({}),up=(0,b.createContext)({strict:!1}),um=(0,b.createContext)({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"}),uf=(0,b.createContext)({});function ug(e){return Array.isArray(e)?e.join(" "):e}let uy=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function ux(e,t,r){for(let n in t)lL(t[n])||c5(n,r)||(e[n]=t[n])}let uv=()=>({...uy(),attrs:{}}),ub=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function uw(e){return e.startsWith("while")||e.startsWith("drag")&&"draggable"!==e||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||ub.has(e)}let uk=e=>!uw(e);try{g=(()=>{let e=Error("Cannot find module '@emotion/is-prop-valid'");throw e.code="MODULE_NOT_FOUND",e})().default,"function"==typeof g&&(uk=e=>e.startsWith("on")?!uw(e):g(e))}catch{}function uj(e){return lL(e)?e.get():e}let uS=(0,b.createContext)(null),uN=e=>(t,r)=>{let n,i=(0,b.useContext)(uf),s=(0,b.useContext)(uS),a=()=>(function({scrapeMotionValuesFromProps:e,createRenderState:t},r,n,i){return{latestValues:function(e,t,r,n){let i={},s=n(e,{});for(let e in s)i[e]=uj(s[e]);let{initial:a,animate:o}=e,l=cM(e),c=cL(e);t&&c&&!l&&!1!==e.inherit&&(void 0===a&&(a=t.initial),void 0===o&&(o=t.animate));let u=!!r&&!1===r.initial,d=(u=u||!1===a)?o:a;if(d&&"boolean"!=typeof d&&!cT(d)){let t=Array.isArray(d)?d:[d];for(let r=0;r<t.length;r++){let n=cD(e,t[r]);if(n){let{transitionEnd:e,transition:t,...r}=n;for(let e in r){let t=r[e];if(Array.isArray(t)){let e=u?t.length-1:0;t=t[e]}null!==t&&(i[e]=t)}for(let t in e)i[t]=e[t]}}}return i}(r,n,i,e),renderState:t()}})(e,t,i,s);return r?a():(null===(n=(0,b.useRef)(null)).current&&(n.current=a()),n.current)},uA=uN({scrapeMotionValuesFromProps:c3,createRenderState:uy}),uC=uN({scrapeMotionValuesFromProps:c6,createRenderState:uv}),u_="u">typeof window,uT={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},uE=!1;function uP(){return!function(){if(uE)return;let e={};for(let t in uT)e[t]={isEnabled:e=>uT[t].some(t=>!!e[t])};cB=e,uE=!0}(),cB}let uR=Symbol.for("motionComponentSymbol"),uM="data-"+c$("framerAppearId"),uL=(0,b.createContext)({});function uI(e){return e&&"object"==typeof e&&Object.prototype.hasOwnProperty.call(e,"current")}let uD=u_?b.useLayoutEffect:b.useEffect;function uO(e,{forwardMotionProps:t=!1,type:r}={},n,i){n&&function(e){let t=uP();for(let r in e)t[r]={...t[r],...e[r]};cB=t}(n);let s=r?"svg"===r:ud(e),a=s?uC:uA;function o(r,n){var o;let l,c,u,d={...(0,b.useContext)(um),...r,layoutId:function({layoutId:e}){let t=(0,b.useContext)(uh).id;return t&&void 0!==e?t+"-"+e:e}(r)},{isStatic:h}=d,p=function(e){let{initial:t,animate:r}=function(e,t){if(cM(e)){let{initial:t,animate:r}=e;return{initial:!1===t||cE(t)?t:void 0,animate:cE(r)?r:void 0}}return!1!==e.inherit?t:{}}(e,(0,b.useContext)(uf));return(0,b.useMemo)(()=>({initial:t,animate:r}),[ug(t),ug(r)])}(r),m=a(r,h);if(!h&&u_){(0,b.useContext)(up).strict;let t=function(e){let{drag:t,layout:r}=uP();if(!t&&!r)return{};let n={...t,...r};return{MeasureLayout:t?.isEnabled(e)||r?.isEnabled(e)?n.MeasureLayout:void 0,ProjectionNode:n.ProjectionNode}}(d);l=t.MeasureLayout,p.visualElement=function(e,t,r,n,i,s){let{visualElement:a}=(0,b.useContext)(uf),o=(0,b.useContext)(up),l=(0,b.useContext)(uS),c=(0,b.useContext)(um).reducedMotion,u=(0,b.useRef)(null),d=(0,b.useRef)(!1);n=n||o.renderer,!u.current&&n&&(u.current=n(e,{visualState:t,parent:a,props:r,presenceContext:l,blockInitialAnimation:!!l&&!1===l.initial,reducedMotionConfig:c,isSVG:s}),d.current&&u.current&&(u.current.manuallyAnimateOnMount=!0));let h=u.current,p=(0,b.useContext)(uL);h&&!h.projection&&i&&("html"===h.type||"svg"===h.type)&&function(e,t,r,n){let{layoutId:i,layout:s,drag:a,dragConstraints:o,layoutScroll:l,layoutRoot:c,layoutCrossfade:u}=t;e.projection=new r(e.latestValues,t["data-framer-portal-id"]?void 0:function e(t){if(t)return!1!==t.options.allowProjection?t.projection:e(t.parent)}(e.parent)),e.projection.setOptions({layoutId:i,layout:s,alwaysMeasureLayout:!!a||o&&uI(o),visualElement:e,animationType:"string"==typeof s?s:"both",initialPromotionConfig:n,crossfade:u,layoutScroll:l,layoutRoot:c})}(u.current,r,i,p);let m=(0,b.useRef)(!1);(0,b.useInsertionEffect)(()=>{h&&m.current&&h.update(r,l)});let f=r[uM],g=(0,b.useRef)(!!f&&!window.MotionHandoffIsComplete?.(f)&&window.MotionHasOptimisedAnimation?.(f));return uD(()=>{d.current=!0,h&&(m.current=!0,window.MotionIsMounted=!0,h.updateFeatures(),h.scheduleRenderMicrotask(),g.current&&h.animationState&&h.animationState.animateChanges())}),(0,b.useEffect)(()=>{h&&(!g.current&&h.animationState&&h.animationState.animateChanges(),g.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(f)}),g.current=!1),h.enteringChildren=void 0)}),h}(e,m,d,i,t.ProjectionNode,s)}return(0,v.jsxs)(uf.Provider,{value:p,children:[l&&p.visualElement?(0,v.jsx)(l,{visualElement:p.visualElement,...d}):null,function(e,t,r,{latestValues:n},i,s=!1,a){let o=(a??ud(e)?function(e,t,r,n){let i=(0,b.useMemo)(()=>{let r=uv();return cY(r,t,cJ(n),e.transformTemplate,e.style),{...r.attrs,style:{...r.style}}},[t]);if(e.style){let t={};ux(t,e.style,e),i.style={...t,...i.style}}return i}:function(e,t){let r,n,i={},s=(r=e.style||{},ux(n={},r,e),Object.assign(n,function({transformTemplate:e},t){return(0,b.useMemo)(()=>{let r=uy();return cG(r,t,e),Object.assign({},r.vars,r.style)},[t])}(e,t)),n);return e.drag&&!1!==e.dragListener&&(i.draggable=!1,s.userSelect=s.WebkitUserSelect=s.WebkitTouchCallout="none",s.touchAction=!0===e.drag?"none":`pan-${"x"===e.drag?"y":"x"}`),void 0===e.tabIndex&&(e.onTap||e.onTapStart||e.whileTap)&&(i.tabIndex=0),i.style=s,i})(t,n,i,e),l=function(e,t,r){let n={};for(let i in e)("values"!==i||"object"!=typeof e.values)&&(uk(i)||!0===r&&uw(i)||!t&&!uw(i)||e.draggable&&i.startsWith("onDrag"))&&(n[i]=e[i]);return n}(t,"string"==typeof e,s),c=e!==b.Fragment?{...l,...o,ref:r}:{},{children:u}=t,d=(0,b.useMemo)(()=>lL(u)?u.get():u,[u]);return(0,b.createElement)(e,{...c,children:d})}(e,r,(o=p.visualElement,c=(0,b.useRef)(n),(0,b.useInsertionEffect)(()=>{c.current=n}),u=(0,b.useRef)(null),(0,b.useCallback)(e=>{e&&m.onMount?.(e),o&&(e?o.mount(e):o.unmount());let t=c.current;if("function"==typeof t)if(e){let r=t(e);"function"==typeof r&&(u.current=r)}else u.current?(u.current(),u.current=null):t(e);else t&&(t.current=e)},[o])),m,h,t,s)]})}o.displayName=`motion.${"string"==typeof e?e:`create(${e.displayName??e.name??""})`}`;let l=(0,b.forwardRef)(o);return l[uR]=e,l}class uB{constructor(e){this.isMounted=!1,this.node=e}update(){}}function uF(e,t,r){let n=e.getProps();return cD(n,t,void 0!==r?r:n.custom,e)}function uz(e,t){return e?.[t]??e?.default??e}let u$=e=>Array.isArray(e);function uV(e,t){let r=e.getValue("willChange");if(lL(r)&&r.add)return r.add(t);if(!r&&l7.WillChange){let r=new l7.WillChange("auto");e.addValue("willChange",r),r.add(t)}}let uU=e=>1e3*e,uW=(e,t)=>r=>t(e(r)),uG=(...e)=>e.reduce(uW),uH={layout:0,mainThread:0,waapi:0};function uq(e,t,r){return(r<0&&(r+=1),r>1&&(r-=1),r<1/6)?e+(t-e)*6*r:r<.5?t:r<2/3?e+(t-e)*(2/3-r)*6:e}function uK(e,t){return r=>r>0?t:e}let uY=(e,t,r)=>{let n=e*e,i=r*(t*t-n)+n;return i<0?0:Math.sqrt(i)},uX=[ln,lr,ld];function uJ(e){let t=uX.find(t=>t.test(e));if(lF(!!t,`'${e}' is not an animatable color. Use the equivalent color code instead.`,"color-not-animatable"),!t)return!1;let r=t.parse(e);return t===ld&&(r=function({hue:e,saturation:t,lightness:r,alpha:n}){e/=360,r/=100;let i=0,s=0,a=0;if(t/=100){let n=r<.5?r*(1+t):r+t-r*t,o=2*r-n;i=uq(o,n,e+1/3),s=uq(o,n,e),a=uq(o,n,e-1/3)}else i=s=a=r;return{red:Math.round(255*i),green:Math.round(255*s),blue:Math.round(255*a),alpha:n}}(r)),r}let uZ=(e,t)=>{let r=uJ(e),n=uJ(t);if(!r||!n)return uK(e,t);let i={...r};return e=>(i.red=uY(r.red,n.red,e),i.green=uY(r.green,n.green,e),i.blue=uY(r.blue,n.blue,e),i.alpha=c1(r.alpha,n.alpha,e),lr.transform(i))},uQ=new Set(["none","hidden"]);function u0(e,t){return r=>c1(e,t,r)}function u1(e){return"number"==typeof e?u0:"string"==typeof e?lW(e)?uK:lh.test(e)?uZ:u3:Array.isArray(e)?u2:"object"==typeof e?lh.test(e)?uZ:u5:uK}function u2(e,t){let r=[...e],n=r.length,i=e.map((e,r)=>u1(e)(e,t[r]));return e=>{for(let t=0;t<n;t++)r[t]=i[t](e);return r}}function u5(e,t){let r={...e,...t},n={};for(let i in r)void 0!==e[i]&&void 0!==t[i]&&(n[i]=u1(e[i])(e[i],t[i]));return e=>{for(let t in n)r[t]=n[t](e);return r}}let u3=(e,t)=>{let r=lw.createTransformer(t),n=ly(e),i=ly(t);if(!(n.indexes.var.length===i.indexes.var.length&&n.indexes.color.length===i.indexes.color.length&&n.indexes.number.length>=i.indexes.number.length))return lF(!0,`Complex values '${e}' and '${t}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`,"complex-values-different"),uK(e,t);if(uQ.has(e)&&!i.values.length||uQ.has(t)&&!n.values.length)return uQ.has(e)?r=>r<=0?e:t:r=>r>=1?t:e;return uG(u2(function(e,t){let r=[],n={color:0,var:0,number:0};for(let i=0;i<t.values.length;i++){let s=t.types[i],a=e.indexes[s][n[s]],o=e.values[a]??0;r[i]=o,n[s]++}return r}(n,i),i.values),r)};function u6(e,t,r){return"number"==typeof e&&"number"==typeof t&&"number"==typeof r?c1(e,t,r):u1(e)(e,t)}let u4=e=>{let t=({timestamp:t})=>e(t);return{start:(e=!0)=>cr.update(t,e),stop:()=>cn(t),now:()=>ci.isProcessing?ci.timestamp:cw.now()}},u8=(e,t,r=10)=>{let n="",i=Math.max(Math.round(t/r),2);for(let t=0;t<i;t++)n+=Math.round(1e4*e(t/(i-1)))/1e4+", ";return`linear(${n.substring(0,n.length-2)})`};function u9(e){let t=0,r=e.next(t);for(;!r.done&&t<2e4;)t+=50,r=e.next(t);return t>=2e4?1/0:t}function u7(e,t,r){var n,i;let s=Math.max(t-5,0);return n=r-e(s),(i=t-s)?1e3/i*n:0}let de=.01,dt=2,dr=.005,dn=.5;function di(e,t){return e*Math.sqrt(1-t*t)}let ds=["duration","bounce"],da=["stiffness","damping","mass"];function dl(e,t){return t.some(t=>void 0!==e[t])}function dc(e=.3,t=.3){let r,n="object"!=typeof e?{visualDuration:e,keyframes:[0,1],bounce:t}:e,{restSpeed:i,restDelta:s}=n,a=n.keyframes[0],o=n.keyframes[n.keyframes.length-1],l={done:!1,value:a},{stiffness:c,damping:u,mass:d,duration:h,velocity:p,isResolvedFromDuration:m}=function(e){let t={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...e};if(!dl(e,da)&&dl(e,ds))if(e.visualDuration){let r=2*Math.PI/(1.2*e.visualDuration),n=r*r,i=2*o2(.05,1,1-(e.bounce||0))*Math.sqrt(n);t={...t,mass:1,stiffness:n,damping:i}}else{let r=function({duration:e=800,bounce:t=.3,velocity:r=0,mass:n=1}){let i,s;lF(e<=uU(10),"Spring duration must be 10 seconds or less","spring-duration-limit");let a=1-t;a=o2(.05,1,a),e=o2(.01,10,e/1e3),a<1?(i=t=>{let n=t*a,i=n*e;return .001-(n-r)/di(t,a)*Math.exp(-i)},s=t=>{let n=t*a*e,s=Math.pow(a,2)*Math.pow(t,2)*e,o=Math.exp(-n),l=di(Math.pow(t,2),a);return(n*r+r-s)*o*(-i(t)+.001>0?-1:1)/l}):(i=t=>-.001+Math.exp(-t*e)*((t-r)*e+1),s=t=>e*e*(r-t)*Math.exp(-t*e));let o=function(e,t,r){let n=r;for(let r=1;r<12;r++)n-=e(n)/t(n);return n}(i,s,5/e);if(e=uU(e),isNaN(o))return{stiffness:100,damping:10,duration:e};{let t=Math.pow(o,2)*n;return{stiffness:t,damping:2*a*Math.sqrt(n*t),duration:e}}}(e);(t={...t,...r,mass:1}).isResolvedFromDuration=!0}return t}({...n,velocity:-((n.velocity||0)/1e3)}),f=p||0,g=u/(2*Math.sqrt(c*d)),y=o-a,x=Math.sqrt(c/d)/1e3,v=5>Math.abs(y);if(i||(i=v?de:dt),s||(s=v?dr:dn),g<1){let e=di(x,g);r=t=>o-Math.exp(-g*x*t)*((f+g*x*y)/e*Math.sin(e*t)+y*Math.cos(e*t))}else if(1===g)r=e=>o-Math.exp(-x*e)*(y+(f+x*y)*e);else{let e=x*Math.sqrt(g*g-1);r=t=>{let r=Math.exp(-g*x*t),n=Math.min(e*t,300);return o-r*((f+g*x*y)*Math.sinh(n)+e*y*Math.cosh(n))/e}}let b={calculatedDuration:m&&h||null,next:e=>{let t=r(e);if(m)l.done=e>=h;else{let n=0===e?f:0;g<1&&(n=0===e?uU(f):u7(r,e,t));let a=Math.abs(o-t)<=s;l.done=Math.abs(n)<=i&&a}return l.value=l.done?o:t,l},toString:()=>{let e=Math.min(u9(b),2e4),t=u8(t=>b.next(e*t).value,e,30);return e+"ms "+t},toTransition:()=>{}};return b}function du({keyframes:e,velocity:t=0,power:r=.8,timeConstant:n=325,bounceDamping:i=10,bounceStiffness:s=500,modifyTarget:a,min:o,max:l,restDelta:c=.5,restSpeed:u}){let d,h,p=e[0],m={done:!1,value:p},f=r*t,g=p+f,y=void 0===a?g:a(g);y!==g&&(f=y-p);let x=e=>-f*Math.exp(-e/n),v=e=>y+x(e),b=e=>{let t=x(e),r=v(e);m.done=Math.abs(t)<=c,m.value=m.done?y:r},w=e=>{let t;if(t=m.value,void 0!==o&&t<o||void 0!==l&&t>l){var r;d=e,h=dc({keyframes:[m.value,(r=m.value,void 0===o?l:void 0===l||Math.abs(o-r)<Math.abs(l-r)?o:l)],velocity:u7(v,e,m.value),damping:i,stiffness:s,restDelta:c,restSpeed:u})}};return w(0),{calculatedDuration:null,next:e=>{let t=!1;return(h||void 0!==d||(t=!0,b(e),w(e)),void 0!==d&&e>=d)?h.next(e-d):(t||b(e),m)}}}dc.applyToOptions=e=>{let t=function(e,t=100,r){let n=r({...e,keyframes:[0,t]}),i=Math.min(u9(n),2e4);return{type:"keyframes",ease:e=>n.next(i*e).value/t,duration:i/1e3}}(e,100,dc);return e.ease=t.ease,e.duration=uU(t.duration),e.type="keyframes",e};let dd=(e,t,r)=>(((1-3*r+3*t)*e+(3*r-6*t))*e+3*t)*e;function dh(e,t,r,n){return e===t&&r===n?l9:i=>0===i||1===i?i:dd(function(e,t,r,n,i){let s,a,o=0;do(s=dd(a=t+(r-t)/2,n,i)-e)>0?r=a:t=a;while(Math.abs(s)>1e-7&&++o<12)return a}(i,0,1,e,r),t,n)}let dp=dh(.42,0,1,1),dm=dh(0,0,.58,1),df=dh(.42,0,.58,1),dg=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,dy=e=>t=>1-e(1-t),dx=dh(.33,1.53,.69,.99),dv=dy(dx),db=dg(dv),dw=e=>(e*=2)<1?.5*dv(e):.5*(2-Math.pow(2,-10*(e-1))),dk=e=>1-Math.sin(Math.acos(e)),dj=dy(dk),dS=dg(dk),dN=e=>Array.isArray(e)&&"number"==typeof e[0],dA={linear:l9,easeIn:dp,easeInOut:df,easeOut:dm,circIn:dk,circInOut:dS,circOut:dj,backIn:dv,backInOut:db,backOut:dx,anticipate:dw},dC=e=>{if(dN(e)){lz(4===e.length,"Cubic bezier arrays must contain four numerical values.","cubic-bezier-length");let[t,r,n,i]=e;return dh(t,r,n,i)}return"string"==typeof e?(lz(void 0!==dA[e],`Invalid easing type '${e}'`,"invalid-easing-type"),dA[e]):e},d_=(e,t,r)=>{let n=t-e;return 0===n?1:(r-e)/n};function dT({duration:e=300,keyframes:t,times:r,ease:n="easeInOut"}){var i;let s,a=Array.isArray(n)&&"number"!=typeof n[0]?n.map(dC):dC(n),o={done:!1,value:t[0]},l=function(e,t,{clamp:r=!0,ease:n,mixer:i}={}){let s=e.length;if(lz(s===t.length,"Both input and output ranges must be the same length","range-length"),1===s)return()=>t[0];if(2===s&&t[0]===t[1])return()=>t[1];let a=e[0]===e[1];e[0]>e[s-1]&&(e=[...e].reverse(),t=[...t].reverse());let o=function(e,t,r){let n=[],i=r||l7.mix||u6,s=e.length-1;for(let r=0;r<s;r++){let s=i(e[r],e[r+1]);t&&(s=uG(Array.isArray(t)?t[r]||l9:t,s)),n.push(s)}return n}(t,n,i),l=o.length,c=r=>{if(a&&r<e[0])return t[0];let n=0;if(l>1)for(;n<e.length-2&&!(r<e[n+1]);n++);let i=d_(e[n],e[n+1],r);return o[n](i)};return r?t=>c(o2(e[0],e[s-1],t)):c}((i=r&&r.length===t.length?r:(!function(e,t){let r=e[e.length-1];for(let n=1;n<=t;n++){let i=d_(0,t,n);e.push(c1(r,1,i))}}(s=[0],t.length-1),s),i.map(t=>t*e)),t,{ease:Array.isArray(a)?a:t.map(()=>a||df).splice(0,t.length-1)});return{calculatedDuration:e,next:t=>(o.value=l(t),o.done=t>=e,o)}}let dE=e=>null!==e;function dP(e,{repeat:t,repeatType:r="loop"},n,i=1){let s=e.filter(dE),a=i<0||t&&"loop"!==r&&t%2==1?0:s.length-1;return a&&void 0!==n?n:s[a]}let dR={decay:du,inertia:du,tween:dT,keyframes:dT,spring:dc};function dM(e){"string"==typeof e.type&&(e.type=dR[e.type])}class dL{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,t){return this.finished.then(e,t)}}let dI=e=>e/100;class dD extends dL{constructor(e){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{let{motionValue:e}=this.options;e&&e.updatedAt!==cw.now()&&this.tick(cw.now()),this.isStopped=!0,"idle"!==this.state&&(this.teardown(),this.options.onStop?.())},uH.mainThread++,this.options=e,this.initAnimation(),this.play(),!1===e.autoplay&&this.pause()}initAnimation(){let{options:e}=this;dM(e);let{type:t=dT,repeat:r=0,repeatDelay:n=0,repeatType:i,velocity:s=0}=e,{keyframes:a}=e,o=t||dT;o!==dT&&"number"!=typeof a[0]&&(this.mixKeyframes=uG(dI,u6(a[0],a[1])),a=[0,100]);let l=o({...e,keyframes:a});"mirror"===i&&(this.mirroredGenerator=o({...e,keyframes:[...a].reverse(),velocity:-s})),null===l.calculatedDuration&&(l.calculatedDuration=u9(l));let{calculatedDuration:c}=l;this.calculatedDuration=c,this.resolvedDuration=c+n,this.totalDuration=this.resolvedDuration*(r+1)-n,this.generator=l}updateTime(e){let t=Math.round(e-this.startTime)*this.playbackSpeed;null!==this.holdTime?this.currentTime=this.holdTime:this.currentTime=t}tick(e,t=!1){let{generator:r,totalDuration:n,mixKeyframes:i,mirroredGenerator:s,resolvedDuration:a,calculatedDuration:o}=this;if(null===this.startTime)return r.next(0);let{delay:l=0,keyframes:c,repeat:u,repeatType:d,repeatDelay:h,type:p,onUpdate:m,finalKeyframe:f}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-n/this.speed,this.startTime)),t?this.currentTime=e:this.updateTime(e);let g=this.currentTime-l*(this.playbackSpeed>=0?1:-1),y=this.playbackSpeed>=0?g<0:g>n;this.currentTime=Math.max(g,0),"finished"===this.state&&null===this.holdTime&&(this.currentTime=n);let x=this.currentTime,v=r;if(u){let e=Math.min(this.currentTime,n)/a,t=Math.floor(e),r=e%1;!r&&e>=1&&(r=1),1===r&&t--,(t=Math.min(t,u+1))%2&&("reverse"===d?(r=1-r,h&&(r-=h/a)):"mirror"===d&&(v=s)),x=o2(0,1,r)*a}let b=y?{done:!1,value:c[0]}:v.next(x);i&&(b.value=i(b.value));let{done:w}=b;y||null===o||(w=this.playbackSpeed>=0?this.currentTime>=n:this.currentTime<=0);let k=null===this.holdTime&&("finished"===this.state||"running"===this.state&&w);return k&&p!==du&&(b.value=dP(c,this.options,f,this.speed)),m&&m(b.value),k&&this.finish(),b}then(e,t){return this.finished.then(e,t)}get duration(){return this.calculatedDuration/1e3}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+e/1e3}get time(){return this.currentTime/1e3}set time(e){e=uU(e),this.currentTime=e,null===this.startTime||null!==this.holdTime||0===this.playbackSpeed?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?.start(!1)}get speed(){return this.playbackSpeed}set speed(e){this.updateTime(cw.now());let t=this.playbackSpeed!==e;this.playbackSpeed=e,t&&(this.time=this.currentTime/1e3)}play(){if(this.isStopped)return;let{driver:e=u4,startTime:t}=this.options;this.driver||(this.driver=e(e=>this.tick(e))),this.options.onPlay?.();let r=this.driver.now();"finished"===this.state?(this.updateFinished(),this.startTime=r):null!==this.holdTime?this.startTime=r-this.holdTime:this.startTime||(this.startTime=t??r),"finished"===this.state&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(cw.now()),this.holdTime=this.currentTime}complete(){"running"!==this.state&&this.play(),this.state="finished",this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state="finished",this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null,uH.mainThread--}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),this.driver?.stop(),e.observe(this)}}function dO(e){let t;return()=>(void 0===t&&(t=e()),t)}let dB=dO(()=>void 0!==window.ScrollTimeline),dF={},dz=(u=dO(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(e){return!1}return!0}),()=>dF.linearEasing??u()),d$=([e,t,r,n])=>`cubic-bezier(${e}, ${t}, ${r}, ${n})`,dV={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:d$([0,.65,.55,1]),circOut:d$([.55,0,1,.45]),backIn:d$([.31,.01,.66,-.59]),backOut:d$([.33,1.53,.69,.99])};function dU(e){return"function"==typeof e&&"applyToOptions"in e}class dW extends dL{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!e)return;const{element:t,name:r,keyframes:n,pseudoElement:i,allowFlatten:s=!1,finalKeyframe:a,onComplete:o}=e;this.isPseudoElement=!!i,this.allowFlatten=s,this.options=e,lz("string"!=typeof e.type,'Mini animate() doesn\'t support "type" as a string.',"mini-spring");const l=function({type:e,...t}){return dU(e)&&dz()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}(e);this.animation=function(e,t,r,{delay:n=0,duration:i=300,repeat:s=0,repeatType:a="loop",ease:o="easeOut",times:l}={},c){let u={[t]:r};l&&(u.offset=l);let d=function e(t,r){if(t)return"function"==typeof t?dz()?u8(t,r):"ease-out":dN(t)?d$(t):Array.isArray(t)?t.map(t=>e(t,r)||dV.easeOut):dV[t]}(o,i);Array.isArray(d)&&(u.easing=d);let h={delay:n,duration:i,easing:Array.isArray(d)?"linear":d,fill:"both",iterations:s+1,direction:"reverse"===a?"alternate":"normal"};c&&(h.pseudoElement=c);let p=e.animate(u,h);return p}(t,r,n,l,i),!1===l.autoplay&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!i){let e=dP(n,this.options,a,this.speed);this.updateMotionValue?this.updateMotionValue(e):r.startsWith("--")?t.style.setProperty(r,e):t.style[r]=e,this.animation.cancel()}o?.(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),"finished"===this.state&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch(e){}}stop(){if(this.isStopped)return;this.isStopped=!0;let{state:e}=this;"idle"!==e&&"finished"!==e&&(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){this.isPseudoElement||this.animation.commitStyles?.()}get duration(){return Number(this.animation.effect?.getComputedTiming?.().duration||0)/1e3}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+e/1e3}get time(){return(Number(this.animation.currentTime)||0)/1e3}set time(e){this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=uU(e)}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return null!==this.finishedTime?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(e){this.manualStartTime=this.animation.startTime=e}attachTimeline({timeline:e,observe:t}){return(this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,e&&dB())?(this.animation.timeline=e,l9):t(this)}}let dG={anticipate:dw,backInOut:db,circInOut:dS};class dH extends dW{constructor(e){!function(e){"string"==typeof e.ease&&e.ease in dG&&(e.ease=dG[e.ease])}(e),dM(e),super(e),void 0!==e.startTime&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){let{motionValue:t,onUpdate:r,onComplete:n,element:i,...s}=this.options;if(!t)return;if(void 0!==e)return void t.set(e);let a=new dD({...s,autoplay:!1}),o=Math.max(10,cw.now()-this.startTime),l=o2(0,10,o-10);t.setWithVelocity(a.sample(Math.max(0,o-l)).value,a.sample(o).value,l),a.stop()}}let dq=(e,t)=>"zIndex"!==t&&!!("number"==typeof e||Array.isArray(e)||"string"==typeof e&&(lw.test(e)||"0"===e)&&!e.startsWith("url("));function dK(e){e.duration=0,e.type="keyframes"}let dY=new Set(["opacity","clipPath","filter","transform"]),dX=dO(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));class dJ extends dL{constructor({autoplay:e=!0,delay:t=0,type:r="keyframes",repeat:n=0,repeatDelay:i=0,repeatType:s="loop",keyframes:a,name:o,motionValue:l,element:c,...u}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=cw.now();const d={autoplay:e,delay:t,type:r,repeat:n,repeatDelay:i,repeatType:s,name:o,motionValue:l,element:c,...u},h=c?.KeyframeResolver||ch;this.keyframeResolver=new h(a,(e,t,r)=>this.onKeyframesResolved(e,t,d,!r),o,l,c),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,t,r,n){this.keyframeResolver=void 0;let{name:i,type:s,velocity:a,delay:o,isHandoff:l,onUpdate:c}=r;this.resolvedAt=cw.now(),!function(e,t,r,n){let i=e[0];if(null===i)return!1;if("display"===t||"visibility"===t)return!0;let s=e[e.length-1],a=dq(i,t),o=dq(s,t);return lF(a===o,`You are trying to animate ${t} from "${i}" to "${s}". "${a?s:i}" is not an animatable value.`,"value-not-animatable"),!!a&&!!o&&(function(e){let t=e[0];if(1===e.length)return!0;for(let r=0;r<e.length;r++)if(e[r]!==t)return!0}(e)||("spring"===r||dU(r))&&n)}(e,i,s,a)&&((l7.instantAnimations||!o)&&c?.(dP(e,r,t)),e[0]=e[e.length-1],dK(r),r.repeat=0);let u={startTime:n?this.resolvedAt&&this.resolvedAt-this.createdAt>40?this.resolvedAt:this.createdAt:void 0,finalKeyframe:t,...r,keyframes:e},d=!l&&function(e){let{motionValue:t,name:r,repeatDelay:n,repeatType:i,damping:s,type:a}=e;if(!(t?.owner?.current instanceof HTMLElement))return!1;let{onUpdate:o,transformTemplate:l}=t.owner.getProps();return dX()&&r&&dY.has(r)&&("transform"!==r||!l)&&!o&&!n&&"mirror"!==i&&0!==s&&"inertia"!==a}(u),h=u.motionValue?.owner?.current,p=d?new dH({...u,element:h}):new dD(u);p.finished.then(()=>{this.notifyFinished()}).catch(l9),this.pendingTimeline&&(this.stopTimeline=p.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=p}get finished(){return this._animation?this.animation.finished:this._finished}then(e,t){return this.finished.finally(e).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),cc=!0,cd(),cu(),cc=!1),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}}let dZ={type:"spring",stiffness:500,damping:25,restSpeed:10},dQ={type:"keyframes",duration:.8},d0={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},d1=e=>null!==e,d2=(e,t,r,n={},i,s)=>a=>{let o=uz(n,e)||{},l=o.delay||n.delay||0,{elapsed:c=0}=n;c-=uU(l);let u={keyframes:Array.isArray(r)?r:[null,r],ease:"easeOut",velocity:t.getVelocity(),...o,delay:-c,onUpdate:e=>{t.set(e),o.onUpdate&&o.onUpdate(e)},onComplete:()=>{a(),o.onComplete&&o.onComplete()},name:e,motionValue:t,element:s?void 0:i};!function({when:e,delay:t,delayChildren:r,staggerChildren:n,staggerDirection:i,repeat:s,repeatType:a,repeatDelay:o,from:l,elapsed:c,...u}){return!!Object.keys(u).length}(o)&&Object.assign(u,((e,{keyframes:t})=>t.length>2?dQ:o1.has(e)?e.startsWith("scale")?{type:"spring",stiffness:550,damping:0===t[1]?2*Math.sqrt(550):30,restSpeed:10}:dZ:d0)(e,u)),u.duration&&(u.duration=uU(u.duration)),u.repeatDelay&&(u.repeatDelay=uU(u.repeatDelay)),void 0!==u.from&&(u.keyframes[0]=u.from);let d=!1;if(!1!==u.type&&(0!==u.duration||u.repeatDelay)||(dK(u),0===u.delay&&(d=!0)),(l7.instantAnimations||l7.skipAnimations)&&(d=!0,dK(u),u.delay=0),u.allowFlatten=!o.type&&!o.ease,d&&!s&&void 0!==t.get()){let e=function(e,{repeat:t,repeatType:r="loop"},n){let i=e.filter(d1),s=t&&"loop"!==r&&t%2==1?0:i.length-1;return i[s]}(u.keyframes,o);if(void 0!==e)return void cr.update(()=>{u.onUpdate(e),u.onComplete()})}return o.isSync?new dD(u):new dJ(u)};function d5(e,t,{delay:r=0,transitionOverride:n,type:i}={}){let{transition:s=e.getDefaultTransition(),transitionEnd:a,...o}=t;n&&(s=n);let l=[],c=i&&e.animationState&&e.animationState.getState()[i];for(let t in o){let n=e.getValue(t,e.latestValues[t]??null),i=o[t];if(void 0===i||c&&function({protectedKeys:e,needsAnimating:t},r){let n=e.hasOwnProperty(r)&&!0!==t[r];return t[r]=!1,n}(c,t))continue;let a={delay:r,...uz(s||{},t)},u=n.get();if(void 0!==u&&!n.isAnimating&&!Array.isArray(i)&&i===u&&!a.velocity)continue;let d=!1;if(window.MotionHandoffAnimation){let r=e.props[uM];if(r){let e=window.MotionHandoffAnimation(r,t,cr);null!==e&&(a.startTime=e,d=!0)}}uV(e,t),n.start(d2(t,n,i,e.shouldReduceMotion&&lI.has(t)?{type:!1}:a,e,d));let h=n.animation;h&&l.push(h)}return a&&Promise.all(l).then(()=>{cr.update(()=>{a&&function(e,t){let{transitionEnd:r={},transition:n={},...i}=uF(e,t)||{};for(let t in i={...i,...r}){var s;let r=u$(s=i[t])?s[s.length-1]||0:s;e.hasValue(t)?e.getValue(t).set(r):e.addValue(t,cj(r))}}(e,a)})}),l}function d3(e,t,r,n=0,i=1){let s=Array.from(e).sort((e,t)=>e.sortNodePosition(t)).indexOf(t),a=e.size,o=(a-1)*n;return"function"==typeof r?r(s,a):1===i?s*n:o-s*n}function d6(e,t,r={}){let n=uF(e,t,"exit"===r.type?e.presenceContext?.custom:void 0),{transition:i=e.getDefaultTransition()||{}}=n||{};r.transitionOverride&&(i=r.transitionOverride);let s=n?()=>Promise.all(d5(e,n,r)):()=>Promise.resolve(),a=e.variantChildren&&e.variantChildren.size?(n=0)=>{let{delayChildren:s=0,staggerChildren:a,staggerDirection:o}=i;return function(e,t,r=0,n=0,i=0,s=1,a){let o=[];for(let l of e.variantChildren)l.notify("AnimationStart",t),o.push(d6(l,t,{...a,delay:r+("function"==typeof n?0:n)+d3(e.variantChildren,l,n,i,s)}).then(()=>l.notify("AnimationComplete",t)));return Promise.all(o)}(e,t,n,s,a,o,r)}:()=>Promise.resolve(),{when:o}=i;if(!o)return Promise.all([s(),a(r.delay)]);{let[e,t]="beforeChildren"===o?[s,a]:[a,s];return e().then(()=>t())}}let d4=cR.length;function d8(e,t){if(!Array.isArray(t))return!1;let r=t.length;if(r!==e.length)return!1;for(let n=0;n<r;n++)if(t[n]!==e[n])return!1;return!0}let d9=[...cP].reverse(),d7=cP.length;function he(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function ht(){return{animate:he(!0),whileInView:he(),whileHover:he(),whileTap:he(),whileDrag:he(),whileFocus:he(),exit:he()}}let hr=0;function hn(e){return[e("x"),e("y")]}let hi=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function hs(e){return hi.has(e.tagName)||!0===e.isContentEditable}function ha(e,t,r,n={passive:!0}){return e.addEventListener(t,r,n),()=>e.removeEventListener(t,r)}let ho={x:!1,y:!1};function hl(e){return e.max-e.min}function hc(e,t,r,n=.5){e.origin=n,e.originPoint=c1(t.min,t.max,e.origin),e.scale=hl(r)/hl(t),e.translate=c1(r.min,r.max,e.origin)-e.originPoint,(e.scale>=.9999&&e.scale<=1.0001||isNaN(e.scale))&&(e.scale=1),(e.translate>=-.01&&e.translate<=.01||isNaN(e.translate))&&(e.translate=0)}function hu(e,t,r,n){hc(e.x,t.x,r.x,n?n.originX:void 0),hc(e.y,t.y,r.y,n?n.originY:void 0)}function hd(e,t,r){e.min=r.min+t.min,e.max=e.min+hl(t)}function hh(e,t,r){e.min=t.min-r.min,e.max=e.min+hl(t)}function hp(e,t,r){hh(e.x,t.x,r.x),hh(e.y,t.y,r.y)}let hm=e=>"mouse"===e.pointerType?"number"!=typeof e.button||e.button<=0:!1!==e.isPrimary;function hf(e){return{point:{x:e.pageX,y:e.pageY}}}function hg(e,t,r,n){return ha(e,t,e=>hm(e)&&r(e,hf(e)),n)}let hy=({current:e})=>e?e.ownerDocument.defaultView:null,hx=(e,t)=>Math.abs(e-t),hv=new Set(["auto","scroll"]);class hb{constructor(e,t,{transformPagePoint:r,contextWindow:n=window,dragSnapToOrigin:i=!1,distanceThreshold:s=3,element:a}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=e=>{this.handleScroll(e.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{var e,t;if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;let r=hj(this.lastMoveEventInfo,this.history),n=null!==this.startEvent,i=(e=r.offset,t={x:0,y:0},Math.sqrt(hx(e.x,t.x)**2+hx(e.y,t.y)**2)>=this.distanceThreshold);if(!n&&!i)return;let{point:s}=r,{timestamp:a}=ci;this.history.push({...s,timestamp:a});let{onStart:o,onMove:l}=this.handlers;n||(o&&o(this.lastMoveEvent,r),this.startEvent=this.lastMoveEvent),l&&l(this.lastMoveEvent,r)},this.handlePointerMove=(e,t)=>{this.lastMoveEvent=e,this.lastMoveEventInfo=hw(t,this.transformPagePoint),cr.update(this.updatePoint,!0)},this.handlePointerUp=(e,t)=>{this.end();let{onEnd:r,onSessionEnd:n,resumeAnimation:i}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&i&&i(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;let s=hj("pointercancel"===e.type?this.lastMoveEventInfo:hw(t,this.transformPagePoint),this.history);this.startEvent&&r&&r(e,s),n&&n(e,s)},!hm(e))return;this.dragSnapToOrigin=i,this.handlers=t,this.transformPagePoint=r,this.distanceThreshold=s,this.contextWindow=n||window;const o=hw(hf(e),this.transformPagePoint),{point:l}=o,{timestamp:c}=ci;this.history=[{...l,timestamp:c}];const{onSessionStart:u}=t;u&&u(e,hj(o,this.history)),this.removeListeners=uG(hg(this.contextWindow,"pointermove",this.handlePointerMove),hg(this.contextWindow,"pointerup",this.handlePointerUp),hg(this.contextWindow,"pointercancel",this.handlePointerUp)),a&&this.startScrollTracking(a)}startScrollTracking(e){let t=e.parentElement;for(;t;){let e=getComputedStyle(t);(hv.has(e.overflowX)||hv.has(e.overflowY))&&this.scrollPositions.set(t,{x:t.scrollLeft,y:t.scrollTop}),t=t.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0,passive:!0}),window.addEventListener("scroll",this.onWindowScroll,{passive:!0}),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(e){let t=this.scrollPositions.get(e);if(!t)return;let r=e===window,n=r?{x:window.scrollX,y:window.scrollY}:{x:e.scrollLeft,y:e.scrollTop},i={x:n.x-t.x,y:n.y-t.y};(0!==i.x||0!==i.y)&&(r?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=i.x,this.lastMoveEventInfo.point.y+=i.y):this.history.length>0&&(this.history[0].x-=i.x,this.history[0].y-=i.y),this.scrollPositions.set(e,n),cr.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),cn(this.updatePoint)}}function hw(e,t){return t?{point:t(e.point)}:e}function hk(e,t){return{x:e.x-t.x,y:e.y-t.y}}function hj({point:e},t){return{point:e,delta:hk(e,hS(t)),offset:hk(e,t[0]),velocity:function(e,t){if(e.length<2)return{x:0,y:0};let r=e.length-1,n=null,i=hS(e);for(;r>=0&&(n=e[r],!(i.timestamp-n.timestamp>uU(.1)));)r--;if(!n)return{x:0,y:0};let s=(i.timestamp-n.timestamp)/1e3;if(0===s)return{x:0,y:0};let a={x:(i.x-n.x)/s,y:(i.y-n.y)/s};return a.x===1/0&&(a.x=0),a.y===1/0&&(a.y=0),a}(t,.1)}}function hS(e){return e[e.length-1]}function hN(e,t,r){return{min:void 0!==t?e.min+t:void 0,max:void 0!==r?e.max+r-(e.max-e.min):void 0}}function hA(e,t){let r=t.min-e.min,n=t.max-e.max;return t.max-t.min<e.max-e.min&&([r,n]=[n,r]),{min:r,max:n}}function hC(e,t,r){return{min:h_(e,t),max:h_(e,r)}}function h_(e,t){return"number"==typeof e?e:e[t]||0}let hT=new WeakMap;class hE{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=lM(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:t=!1,distanceThreshold:r}={}){let{presenceContext:n}=this.visualElement;if(n&&!1===n.isPresent)return;let i=e=>{t?(this.stopAnimation(),this.snapToCursor(hf(e).point)):this.pauseAnimation()},s=(e,t)=>{this.stopAnimation();let{drag:r,dragPropagation:n,onDragStart:i}=this.getProps();if(r&&!n&&(this.openDragLock&&this.openDragLock(),this.openDragLock=function(e){if("x"===e||"y"===e)if(ho[e])return null;else return ho[e]=!0,()=>{ho[e]=!1};return ho.x||ho.y?null:(ho.x=ho.y=!0,()=>{ho.x=ho.y=!1})}(r),!this.openDragLock))return;this.latestPointerEvent=e,this.latestPanInfo=t,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),hn(e=>{let t=this.getAxisMotionValue(e).get()||0;if(la.test(t)){let{projection:r}=this.visualElement;if(r&&r.layout){let n=r.layout.layoutBox[e];n&&(t=hl(n)*(parseFloat(t)/100))}}this.originPoint[e]=t}),i&&cr.postRender(()=>i(e,t)),uV(this.visualElement,"transform");let{animationState:s}=this.visualElement;s&&s.setActive("whileDrag",!0)},a=(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t;let{dragPropagation:r,dragDirectionLock:n,onDirectionLock:i,onDrag:s}=this.getProps();if(!r&&!this.openDragLock)return;let{offset:a}=t;if(n&&null===this.currentDirection){this.currentDirection=function(e,t=10){let r=null;return Math.abs(e.y)>t?r="y":Math.abs(e.x)>t&&(r="x"),r}(a),null!==this.currentDirection&&i&&i(this.currentDirection);return}this.updateAxis("x",t.point,a),this.updateAxis("y",t.point,a),this.visualElement.render(),s&&s(e,t)},o=(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t,this.stop(e,t),this.latestPointerEvent=null,this.latestPanInfo=null},l=()=>hn(e=>"paused"===this.getAnimationState(e)&&this.getAxisMotionValue(e).animation?.play()),{dragSnapToOrigin:c}=this.getProps();this.panSession=new hb(e,{onSessionStart:i,onStart:s,onMove:a,onSessionEnd:o,resumeAnimation:l},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:c,distanceThreshold:r,contextWindow:hy(this.visualElement),element:this.visualElement.current})}stop(e,t){let r=e||this.latestPointerEvent,n=t||this.latestPanInfo,i=this.isDragging;if(this.cancel(),!i||!n||!r)return;let{velocity:s}=n;this.startAnimation(s);let{onDragEnd:a}=this.getProps();a&&cr.postRender(()=>a(r,n))}cancel(){this.isDragging=!1;let{projection:e,animationState:t}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.endPanSession();let{dragPropagation:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),t&&t.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(e,t,r){let{drag:n}=this.getProps();if(!r||!hP(e,n,this.currentDirection))return;let i=this.getAxisMotionValue(e),s=this.originPoint[e]+r[e];this.constraints&&this.constraints[e]&&(s=function(e,{min:t,max:r},n){return void 0!==t&&e<t?e=n?c1(t,e,n.min):Math.max(e,t):void 0!==r&&e>r&&(e=n?c1(r,e,n.max):Math.min(e,r)),e}(s,this.constraints[e],this.elastic[e])),i.set(s)}resolveConstraints(){let{dragConstraints:e,dragElastic:t}=this.getProps(),r=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,n=this.constraints;e&&uI(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&r?this.constraints=function(e,{top:t,left:r,bottom:n,right:i}){return{x:hN(e.x,r,i),y:hN(e.y,t,n)}}(r.layoutBox,e):this.constraints=!1,this.elastic=function(e=.35){return!1===e?e=0:!0===e&&(e=.35),{x:hC(e,"left","right"),y:hC(e,"top","bottom")}}(t),n!==this.constraints&&r&&this.constraints&&!this.hasMutatedConstraints&&hn(e=>{var t,n;let i;!1!==this.constraints&&this.getAxisMotionValue(e)&&(this.constraints[e]=(t=r.layoutBox[e],n=this.constraints[e],i={},void 0!==n.min&&(i.min=n.min-t.min),void 0!==n.max&&(i.max=n.max-t.min),i))})}resolveRefConstraints(){var e;let{dragConstraints:t,onMeasureDragConstraints:r}=this.getProps();if(!t||!uI(t))return!1;let n=t.current;lz(null!==n,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.","drag-constraints-ref");let{projection:i}=this.visualElement;if(!i||!i.layout)return!1;let s=function(e,t,r){let n=ul(e,r),{scroll:i}=t;return i&&(us(n.x,i.offset.x),us(n.y,i.offset.y)),n}(n,i.root,this.visualElement.getTransformPagePoint()),a=(e=i.layout.layoutBox,{x:hA(e.x,s.x),y:hA(e.y,s.y)});if(r){let e=r(function({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}(a));this.hasMutatedConstraints=!!e,e&&(a=c8(e))}return a}startAnimation(e){let{drag:t,dragMomentum:r,dragElastic:n,dragTransition:i,dragSnapToOrigin:s,onDragTransitionEnd:a}=this.getProps(),o=this.constraints||{};return Promise.all(hn(a=>{if(!hP(a,t,this.currentDirection))return;let l=o&&o[a]||{};s&&(l={min:0,max:0});let c={type:"inertia",velocity:r?e[a]:0,bounceStiffness:n?200:1e6,bounceDamping:n?40:1e7,timeConstant:750,restDelta:1,restSpeed:10,...i,...l};return this.startAxisValueAnimation(a,c)})).then(a)}startAxisValueAnimation(e,t){let r=this.getAxisMotionValue(e);return uV(this.visualElement,e),r.start(d2(e,r,0,t,this.visualElement,!1))}stopAnimation(){hn(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){hn(e=>this.getAxisMotionValue(e).animation?.pause())}getAnimationState(e){return this.getAxisMotionValue(e).animation?.state}getAxisMotionValue(e){let t=`_drag${e.toUpperCase()}`,r=this.visualElement.getProps();return r[t]||this.visualElement.getValue(e,(r.initial?r.initial[e]:void 0)||0)}snapToCursor(e){hn(t=>{let{drag:r}=this.getProps();if(!hP(t,r,this.currentDirection))return;let{projection:n}=this.visualElement,i=this.getAxisMotionValue(t);if(n&&n.layout){let{min:r,max:s}=n.layout.layoutBox[t],a=i.get()||0;i.set(e[t]-c1(r,s,.5)+a)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;let{drag:e,dragConstraints:t}=this.getProps(),{projection:r}=this.visualElement;if(!uI(t)||!r||!this.constraints)return;this.stopAnimation();let n={x:0,y:0};hn(e=>{let t=this.getAxisMotionValue(e);if(t&&!1!==this.constraints){var r,i;let s,a,o,l=t.get();n[e]=(r={min:l,max:l},i=this.constraints[e],s=.5,a=hl(r),(o=hl(i))>a?s=d_(i.min,i.max-a,r.min):a>o&&(s=d_(r.min,r.max-o,i.min)),o2(0,1,s))}});let{transformTemplate:i}=this.visualElement.getProps();this.visualElement.current.style.transform=i?i({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.resolveConstraints(),hn(t=>{if(!hP(t,e,null))return;let r=this.getAxisMotionValue(t),{min:i,max:s}=this.constraints[t];r.set(c1(i,s,n[t]))})}addListeners(){if(!this.visualElement.current)return;hT.set(this.visualElement,this);let e=this.visualElement.current,t=hg(e,"pointerdown",t=>{let{drag:r,dragListener:n=!0}=this.getProps(),i=t.target,s=i!==e&&hs(i);r&&n&&!s&&this.start(t)}),r=()=>{let{dragConstraints:e}=this.getProps();uI(e)&&e.current&&(this.constraints=this.resolveRefConstraints())},{projection:n}=this.visualElement,i=n.addEventListener("measure",r);n&&!n.layout&&(n.root&&n.root.updateScroll(),n.updateLayout()),cr.read(r);let s=ha(window,"resize",()=>this.scalePositionWithinConstraints()),a=n.addEventListener("didUpdate",({delta:e,hasLayoutChanged:t})=>{this.isDragging&&t&&(hn(t=>{let r=this.getAxisMotionValue(t);r&&(this.originPoint[t]+=e[t].translate,r.set(r.get()+e[t].translate))}),this.visualElement.render())});return()=>{s(),t(),i(),a&&a()}}getProps(){let e=this.visualElement.getProps(),{drag:t=!1,dragDirectionLock:r=!1,dragPropagation:n=!1,dragConstraints:i=!1,dragElastic:s=.35,dragMomentum:a=!0}=e;return{...e,drag:t,dragDirectionLock:r,dragPropagation:n,dragConstraints:i,dragElastic:s,dragMomentum:a}}}function hP(e,t,r){return(!0===t||t===e)&&(null===r||r===e)}let hR=e=>(t,r)=>{e&&cr.postRender(()=>e(t,r))},hM={hasAnimatedSinceResize:!0,hasEverUpdated:!1};var hL=b;let hI=!1;class hD extends hL.Component{componentDidMount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:r,layoutId:n}=this.props,{projection:i}=e;i&&(t.group&&t.group.add(i),r&&r.register&&n&&r.register(i),hI&&i.root.didUpdate(),i.addEventListener("animationComplete",()=>{this.safeToRemove()}),i.setOptions({...i.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),hM.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){let{layoutDependency:t,visualElement:r,drag:n,isPresent:i}=this.props,{projection:s}=r;return s&&(s.isPresent=i,e.layoutDependency!==t&&s.setOptions({...s.options,layoutDependency:t}),hI=!0,n||e.layoutDependency!==t||void 0===t||e.isPresent!==i?s.willUpdate():this.safeToRemove(),e.isPresent!==i&&(i?s.promote():s.relegate()||cr.postRender(()=>{let e=s.getStack();e&&e.members.length||this.safeToRemove()}))),null}componentDidUpdate(){let{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),cv.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:r}=this.props,{projection:n}=e;hI=!0,n&&(n.scheduleCheckAfterUnmount(),t&&t.group&&t.group.remove(n),r&&r.deregister&&r.deregister(n))}safeToRemove(){let{safeToRemove:e}=this.props;e&&e()}render(){return null}}function hO(e){let[t,r]=function(e=!0){let t=(0,b.useContext)(uS);if(null===t)return[!0,null];let{isPresent:r,onExitComplete:n,register:i}=t,s=(0,b.useId)();(0,b.useEffect)(()=>{if(e)return i(s)},[e]);let a=(0,b.useCallback)(()=>e&&n&&n(s),[s,n,e]);return!r&&n?[!1,a]:[!0]}(),n=(0,hL.useContext)(uh);return(0,v.jsx)(hD,{...e,layoutGroup:n,switchLayoutGroup:(0,hL.useContext)(uL),isPresent:t,safeToRemove:r})}function hB(e,t,r,n,i){return e-=t,e=n+1/r*(e-n),void 0!==i&&(e=n+1/i*(e-n)),e}function hF(e,t,[r,n,i],s,a){!function(e,t=0,r=1,n=.5,i,s=e,a=e){if(la.test(t)&&(t=parseFloat(t),t=c1(a.min,a.max,t/100)-a.min),"number"!=typeof t)return;let o=c1(s.min,s.max,n);e===s&&(o-=t),e.min=hB(e.min,t,r,o,i),e.max=hB(e.max,t,r,o,i)}(e,t[r],t[n],t[i],t.scale,s,a)}let hz=["x","scaleX","originX"],h$=["y","scaleY","originY"];function hV(e,t,r,n){hF(e.x,t,hz,r?r.x:void 0,n?n.x:void 0),hF(e.y,t,h$,r?r.y:void 0,n?n.y:void 0)}function hU(e,t){e.min=t.min,e.max=t.max}function hW(e,t){hU(e.x,t.x),hU(e.y,t.y)}function hG(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function hH(e){return 0===e.translate&&1===e.scale}function hq(e){return hH(e.x)&&hH(e.y)}function hK(e,t){return e.min===t.min&&e.max===t.max}function hY(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function hX(e,t){return hY(e.x,t.x)&&hY(e.y,t.y)}function hJ(e){return hl(e.x)/hl(e.y)}function hZ(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}let hQ=["TopLeft","TopRight","BottomLeft","BottomRight"],h0=hQ.length,h1=e=>"string"==typeof e?parseFloat(e):e,h2=e=>"number"==typeof e||lo.test(e);function h5(e,t){return void 0!==e[t]?e[t]:e.borderRadius}let h3=h4(0,.5,dj),h6=h4(.5,.95,l9);function h4(e,t,r){return n=>n<e?0:n>t?1:r(d_(e,t,n))}function h8(e){return"object"==typeof e&&null!==e}function h9(e){return h8(e)&&"ownerSVGElement"in e}let h7=(e,t)=>e.depth-t.depth;class pe{constructor(){this.children=[],this.isDirty=!1}add(e){cg(this.children,e),this.isDirty=!0}remove(e){cy(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(h7),this.isDirty=!1,this.children.forEach(e)}}class pt{constructor(){this.members=[]}add(e){cg(this.members,e),e.scheduleRender()}remove(e){if(cy(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){let e=this.members[this.members.length-1];e&&this.promote(e)}}relegate(e){let t,r=this.members.findIndex(t=>e===t);if(0===r)return!1;for(let e=r;e>=0;e--){let r=this.members[e];if(!1!==r.isPresent){t=r;break}}return!!t&&(this.promote(t),!0)}promote(e,t){let r=this.lead;if(e!==r&&(this.prevLead=r,this.lead=e,e.show(),r)){r.instance&&r.scheduleRender(),e.scheduleRender();let n=r.options.layoutDependency,i=e.options.layoutDependency;(void 0===n||void 0===i||n!==i)&&(e.resumeFrom=r,t&&(e.resumeFrom.preserveOpacity=!0),r.snapshot&&(e.snapshot=r.snapshot,e.snapshot.latestValues=r.animationValues||r.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0));let{crossfade:s}=e.options;!1===s&&r.hide()}}exitAnimationComplete(){this.members.forEach(e=>{let{options:t,resumingFrom:r}=e;t.onExitComplete&&t.onExitComplete(),r&&r.options.onExitComplete&&r.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}let pr=["","X","Y","Z"],pn=0;function pi(e,t,r,n){let{latestValues:i}=t;i[e]&&(r[e]=i[e],t.setStaticValue(e,0),n&&(n[e]=0))}function ps({attachResizeListener:e,defaultParent:t,measureScroll:r,checkIsScrollRoot:n,resetTransform:i}){return class{constructor(e={},r=t?.()){this.id=pn++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(pl),this.nodes.forEach(pf),this.nodes.forEach(pg),this.nodes.forEach(pc)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=e,this.root=r?r.root||r:this,this.path=r?[...r.path,r]:[],this.parent=r,this.depth=r?r.depth+1:0;for(let e=0;e<this.path.length;e++)this.path[e].shouldResetTransform=!0;this.root===this&&(this.nodes=new pe)}addEventListener(e,t){return this.eventHandlers.has(e)||this.eventHandlers.set(e,new cx),this.eventHandlers.get(e).add(t)}notifyListeners(e,...t){let r=this.eventHandlers.get(e);r&&r.notify(...t)}hasListeners(e){return this.eventHandlers.has(e)}mount(t){if(this.instance)return;this.isSVG=h9(t)&&!(h9(t)&&"svg"===t.tagName),this.instance=t;let{layoutId:r,layout:n,visualElement:i}=this.options;if(i&&!i.current&&i.mount(t),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(n||r)&&(this.isLayoutDirty=!0),e){let r,n=0,i=()=>this.root.updateBlockedByResize=!1;cr.read(()=>{n=window.innerWidth}),e(t,()=>{let e=window.innerWidth;if(e!==n){let t,s;n=e,this.root.updateBlockedByResize=!0,r&&r(),t=cw.now(),s=({timestamp:e})=>{let r=e-t;r>=250&&(cn(s),i(r-250))},cr.setup(s,!0),r=()=>cn(s),hM.hasAnimatedSinceResize&&(hM.hasAnimatedSinceResize=!1,this.nodes.forEach(pm))}})}r&&this.root.registerSharedNode(r,this),!1!==this.options.animate&&i&&(r||n)&&this.addEventListener("didUpdate",({delta:e,hasLayoutChanged:t,hasRelativeLayoutChanged:r,layout:n})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}let s=this.options.transition||i.getDefaultTransition()||pk,{onLayoutAnimationStart:a,onLayoutAnimationComplete:o}=i.getProps(),l=!this.targetLayout||!hX(this.targetLayout,n),c=!t&&r;if(this.options.layoutRoot||this.resumeFrom||c||t&&(l||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);let t={...uz(s,"layout"),onPlay:a,onComplete:o};(i.shouldReduceMotion||this.options.layoutRoot)&&(t.delay=0,t.type=!1),this.startAnimation(t),this.setAnimationOrigin(e,c)}else t||pm(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=n})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);let e=this.getStack();e&&e.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),cn(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){!this.isUpdateBlocked()&&(this.isUpdating=!0,this.nodes&&this.nodes.forEach(py),this.animationId++)}getTransformTemplate(){let{visualElement:e}=this.options;return e&&e.getProps().transformTemplate}willUpdate(e=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&function e(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;let{visualElement:r}=t.options;if(!r)return;let n=r.props[uM];if(window.MotionHasOptimisedAnimation(n,"transform")){let{layout:e,layoutId:r}=t.options;window.MotionCancelOptimisedAnimation(n,"transform",cr,!(e||r))}let{parent:i}=t;i&&!i.hasCheckedOptimisedAppear&&e(i)}(this),this.root.isUpdating||this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let e=0;e<this.path.length;e++){let t=this.path[e];t.shouldResetTransform=!0,t.updateScroll("snapshot"),t.options.layoutRoot&&t.willUpdate(!1)}let{layoutId:t,layout:r}=this.options;if(void 0===t&&!r)return;let n=this.getTransformTemplate();this.prevTransformTemplateValue=n?n(this.latestValues,""):void 0,this.updateSnapshot(),e&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(pd);return}if(this.animationId<=this.animationCommitId)return void this.nodes.forEach(ph);this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(pp),this.nodes.forEach(pa),this.nodes.forEach(po)):this.nodes.forEach(ph),this.clearAllSnapshots();let e=cw.now();ci.delta=o2(0,1e3/60,e-ci.timestamp),ci.timestamp=e,ci.isProcessing=!0,cs.update.process(ci),cs.preRender.process(ci),cs.render.process(ci),ci.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,cv.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(pu),this.sharedNodes.forEach(px)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,cr.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){cr.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){!this.snapshot&&this.instance&&(this.snapshot=this.measure(),!this.snapshot||hl(this.snapshot.measuredBox.x)||hl(this.snapshot.measuredBox.y)||(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let e=0;e<this.path.length;e++)this.path[e].updateScroll();let e=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected=lM(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);let{visualElement:t}=this.options;t&&t.notify("LayoutMeasure",this.layout.layoutBox,e?e.layoutBox:void 0)}updateScroll(e="measure"){let t=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===e&&(t=!1),t&&this.instance){let t=n(this.instance);this.scroll={animationId:this.root.animationId,phase:e,isRoot:t,offset:r(this.instance),wasRoot:this.scroll?this.scroll.isRoot:t}}}resetTransform(){if(!i)return;let e=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,t=this.projectionDelta&&!hq(this.projectionDelta),r=this.getTransformTemplate(),n=r?r(this.latestValues,""):void 0,s=n!==this.prevTransformTemplateValue;e&&this.instance&&(t||ue(this.latestValues)||s)&&(i(this.instance,n),this.shouldResetTransform=!1,this.scheduleRender())}measure(e=!0){var t;let r=this.measurePageBox(),n=this.removeElementScroll(r);return e&&(n=this.removeTransform(n)),pN((t=n).x),pN(t.y),{animationId:this.root.animationId,measuredBox:r,layoutBox:n,latestValues:{},source:this.id}}measurePageBox(){let{visualElement:e}=this.options;if(!e)return lM();let t=e.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(pC))){let{scroll:e}=this.root;e&&(us(t.x,e.offset.x),us(t.y,e.offset.y))}return t}removeElementScroll(e){let t=lM();if(hW(t,e),this.scroll?.wasRoot)return t;for(let r=0;r<this.path.length;r++){let n=this.path[r],{scroll:i,options:s}=n;n!==this.root&&i&&s.layoutScroll&&(i.wasRoot&&hW(t,e),us(t.x,i.offset.x),us(t.y,i.offset.y))}return t}applyTransform(e,t=!1){let r=lM();hW(r,e);for(let e=0;e<this.path.length;e++){let n=this.path[e];!t&&n.options.layoutScroll&&n.scroll&&n!==n.root&&uo(r,{x:-n.scroll.offset.x,y:-n.scroll.offset.y}),ue(n.latestValues)&&uo(r,n.latestValues)}return ue(this.latestValues)&&uo(r,this.latestValues),r}removeTransform(e){let t=lM();hW(t,e);for(let e=0;e<this.path.length;e++){let r=this.path[e];if(!r.instance||!ue(r.latestValues))continue;c7(r.latestValues)&&r.updateSnapshot();let n=lM();hW(n,r.measurePageBox()),hV(t,r.latestValues,r.snapshot?r.snapshot.layoutBox:void 0,n)}return ue(this.latestValues)&&hV(t,this.latestValues),t}setTargetDelta(e){this.targetDelta=e,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(e){this.options={...this.options,...e,crossfade:void 0===e.crossfade||e.crossfade}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==ci.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(e=!1){let t=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=t.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=t.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=t.isSharedProjectionDirty);let r=!!this.resumingFrom||this!==t;if(!(e||r&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;let{layout:n,layoutId:i}=this.options;if(!this.layout||!(n||i))return;this.resolvedRelativeTargetAt=ci.timestamp;let s=this.getClosestProjectingParent();if(s&&this.linkedParentVersion!==s.layoutVersion&&!s.options.layoutRoot&&this.removeRelativeTarget(),this.targetDelta||this.relativeTarget||(s&&s.layout?this.createRelativeTarget(s,this.layout.layoutBox,s.layout.layoutBox):this.removeRelativeTarget()),this.relativeTarget||this.targetDelta){if(this.target||(this.target=lM(),this.targetWithTransforms=lM()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target){var a,o,l;this.forceRelativeParentToResolveTarget(),a=this.target,o=this.relativeTarget,l=this.relativeParent.target,hd(a.x,o.x,l.x),hd(a.y,o.y,l.y)}else this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):hW(this.target,this.layout.layoutBox),ui(this.target,this.targetDelta)):hW(this.target,this.layout.layoutBox);this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,s&&!!s.resumingFrom==!!this.resumingFrom&&!s.options.layoutScroll&&s.target&&1!==this.animationProgress?this.createRelativeTarget(s,this.target,s.target):this.relativeParent=this.relativeTarget=void 0)}}getClosestProjectingParent(){if(!(!this.parent||c7(this.parent.latestValues)||ut(this.parent.latestValues)))if(this.parent.isProjecting())return this.parent;else return this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(e,t,r){this.relativeParent=e,this.linkedParentVersion=e.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=lM(),this.relativeTargetOrigin=lM(),hp(this.relativeTargetOrigin,t,r),hW(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){let e=this.getLead(),t=!!this.resumingFrom||this!==e,r=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(r=!1),t&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(r=!1),this.resolvedRelativeTargetAt===ci.timestamp&&(r=!1),r)return;let{layout:n,layoutId:i}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(n||i))return;hW(this.layoutCorrected,this.layout.layoutBox);let s=this.treeScale.x,a=this.treeScale.y;!function(e,t,r,n=!1){let i,s,a=r.length;if(a){t.x=t.y=1;for(let o=0;o<a;o++){s=(i=r[o]).projectionDelta;let{visualElement:a}=i.options;(!a||!a.props.style||"contents"!==a.props.style.display)&&(n&&i.options.layoutScroll&&i.scroll&&i!==i.root&&uo(e,{x:-i.scroll.offset.x,y:-i.scroll.offset.y}),s&&(t.x*=s.x.scale,t.y*=s.y.scale,ui(e,s)),n&&ue(i.latestValues)&&uo(e,i.latestValues))}t.x<1.0000000000001&&t.x>.999999999999&&(t.x=1),t.y<1.0000000000001&&t.y>.999999999999&&(t.y=1)}}(this.layoutCorrected,this.treeScale,this.path,t),e.layout&&!e.target&&(1!==this.treeScale.x||1!==this.treeScale.y)&&(e.target=e.layout.layoutBox,e.targetWithTransforms=lM());let{target:o}=e;if(!o){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}this.projectionDelta&&this.prevProjectionDelta?(hG(this.prevProjectionDelta.x,this.projectionDelta.x),hG(this.prevProjectionDelta.y,this.projectionDelta.y)):this.createProjectionDeltas(),hu(this.projectionDelta,this.layoutCorrected,o,this.latestValues),this.treeScale.x===s&&this.treeScale.y===a&&hZ(this.projectionDelta.x,this.prevProjectionDelta.x)&&hZ(this.projectionDelta.y,this.prevProjectionDelta.y)||(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",o))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(e=!0){if(this.options.visualElement?.scheduleRender(),e){let e=this.getStack();e&&e.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=lP(),this.projectionDelta=lP(),this.projectionDeltaWithTransform=lP()}setAnimationOrigin(e,t=!1){let r,n=this.snapshot,i=n?n.latestValues:{},s={...this.latestValues},a=lP();this.relativeParent&&this.relativeParent.options.layoutRoot||(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!t;let o=lM(),l=(n?n.source:void 0)!==(this.layout?this.layout.source:void 0),c=this.getStack(),u=!c||c.members.length<=1,d=!!(l&&!u&&!0===this.options.crossfade&&!this.path.some(pw));this.animationProgress=0,this.mixTargetDelta=t=>{let n=t/1e3;if(pv(a.x,e.x,n),pv(a.y,e.y,n),this.setTargetDelta(a),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout){var c,h,p,m,f,g;hp(o,this.layout.layoutBox,this.relativeParent.layout.layoutBox),p=this.relativeTarget,m=this.relativeTargetOrigin,f=o,g=n,pb(p.x,m.x,f.x,g),pb(p.y,m.y,f.y,g),r&&(c=this.relativeTarget,h=r,hK(c.x,h.x)&&hK(c.y,h.y))&&(this.isProjectionDirty=!1),r||(r=lM()),hW(r,this.relativeTarget)}l&&(this.animationValues=s,function(e,t,r,n,i,s){i?(e.opacity=c1(0,r.opacity??1,h3(n)),e.opacityExit=c1(t.opacity??1,0,h6(n))):s&&(e.opacity=c1(t.opacity??1,r.opacity??1,n));for(let i=0;i<h0;i++){let s=`border${hQ[i]}Radius`,a=h5(t,s),o=h5(r,s);(void 0!==a||void 0!==o)&&(a||(a=0),o||(o=0),0===a||0===o||h2(a)===h2(o)?(e[s]=Math.max(c1(h1(a),h1(o),n),0),(la.test(o)||la.test(a))&&(e[s]+="%")):e[s]=o)}(t.rotate||r.rotate)&&(e.rotate=c1(t.rotate||0,r.rotate||0,n))}(s,i,this.latestValues,n,d,u)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=n},this.mixTargetDelta(1e3*!!this.options.layoutRoot)}startAnimation(e){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(cn(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=cr.update(()=>{var t,r,n;let i;hM.hasAnimatedSinceResize=!0,uH.layout++,this.motionValue||(this.motionValue=cj(0)),this.currentAnimation=(t=this.motionValue,r=[0,1e3],n={...e,velocity:0,isSync:!0,onUpdate:t=>{this.mixTargetDelta(t),e.onUpdate&&e.onUpdate(t)},onStop:()=>{uH.layout--},onComplete:()=>{uH.layout--,e.onComplete&&e.onComplete(),this.completeAnimation()}},(i=lL(t)?t:cj(t)).start(d2("",i,r,n)),i.animation),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);let e=this.getStack();e&&e.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(1e3),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){let e=this.getLead(),{targetWithTransforms:t,target:r,layout:n,latestValues:i}=e;if(t&&r&&n){if(this!==e&&this.layout&&n&&pA(this.options.animationType,this.layout.layoutBox,n.layoutBox)){r=this.target||lM();let t=hl(this.layout.layoutBox.x);r.x.min=e.target.x.min,r.x.max=r.x.min+t;let n=hl(this.layout.layoutBox.y);r.y.min=e.target.y.min,r.y.max=r.y.min+n}hW(t,r),uo(t,i),hu(this.projectionDeltaWithTransform,this.layoutCorrected,t,i)}}registerSharedNode(e,t){this.sharedNodes.has(e)||this.sharedNodes.set(e,new pt),this.sharedNodes.get(e).add(t);let r=t.options.initialPromotionConfig;t.promote({transition:r?r.transition:void 0,preserveFollowOpacity:r&&r.shouldPreserveFollowOpacity?r.shouldPreserveFollowOpacity(t):void 0})}isLead(){let e=this.getStack();return!e||e.lead===this}getLead(){let{layoutId:e}=this.options;return e&&this.getStack()?.lead||this}getPrevLead(){let{layoutId:e}=this.options;return e?this.getStack()?.prevLead:void 0}getStack(){let{layoutId:e}=this.options;if(e)return this.root.sharedNodes.get(e)}promote({needsReset:e,transition:t,preserveFollowOpacity:r}={}){let n=this.getStack();n&&n.promote(this,r),e&&(this.projectionDelta=void 0,this.needsReset=!0),t&&this.setOptions({transition:t})}relegate(){let e=this.getStack();return!!e&&e.relegate(this)}resetSkewAndRotation(){let{visualElement:e}=this.options;if(!e)return;let t=!1,{latestValues:r}=e;if((r.z||r.rotate||r.rotateX||r.rotateY||r.rotateZ||r.skewX||r.skewY)&&(t=!0),!t)return;let n={};r.z&&pi("z",e,n,this.animationValues);for(let t=0;t<pr.length;t++)pi(`rotate${pr[t]}`,e,n,this.animationValues),pi(`skew${pr[t]}`,e,n,this.animationValues);for(let t in e.render(),n)e.setStaticValue(t,n[t]),this.animationValues&&(this.animationValues[t]=n[t]);e.scheduleRender()}applyProjectionStyles(e,t){if(!this.instance||this.isSVG)return;if(!this.isVisible){e.visibility="hidden";return}let r=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,e.visibility="",e.opacity="",e.pointerEvents=uj(t?.pointerEvents)||"",e.transform=r?r(this.latestValues,""):"none";return}let n=this.getLead();if(!this.projectionDelta||!this.layout||!n.target){this.options.layoutId&&(e.opacity=void 0!==this.latestValues.opacity?this.latestValues.opacity:1,e.pointerEvents=uj(t?.pointerEvents)||""),this.hasProjected&&!ue(this.latestValues)&&(e.transform=r?r({},""):"none",this.hasProjected=!1);return}e.visibility="";let i=n.animationValues||n.latestValues;this.applyTransformsToTarget();let s=function(e,t,r){let n="",i=e.x.translate/t.x,s=e.y.translate/t.y,a=r?.z||0;if((i||s||a)&&(n=`translate3d(${i}px, ${s}px, ${a}px) `),(1!==t.x||1!==t.y)&&(n+=`scale(${1/t.x}, ${1/t.y}) `),r){let{transformPerspective:e,rotate:t,rotateX:i,rotateY:s,skewX:a,skewY:o}=r;e&&(n=`perspective(${e}px) ${n}`),t&&(n+=`rotate(${t}deg) `),i&&(n+=`rotateX(${i}deg) `),s&&(n+=`rotateY(${s}deg) `),a&&(n+=`skewX(${a}deg) `),o&&(n+=`skewY(${o}deg) `)}let o=e.x.scale*t.x,l=e.y.scale*t.y;return(1!==o||1!==l)&&(n+=`scale(${o}, ${l})`),n||"none"}(this.projectionDeltaWithTransform,this.treeScale,i);r&&(s=r(i,s)),e.transform=s;let{x:a,y:o}=this.projectionDelta;for(let t in e.transformOrigin=`${100*a.origin}% ${100*o.origin}% 0`,n.animationValues?e.opacity=n===this?i.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:i.opacityExit:e.opacity=n===this?void 0!==i.opacity?i.opacity:"":void 0!==i.opacityExit?i.opacityExit:0,c2){if(void 0===i[t])continue;let{correct:r,applyTo:a,isCSSVariable:o}=c2[t],l="none"===s?i[t]:r(i[t],n);if(a){let t=a.length;for(let r=0;r<t;r++)e[a[r]]=l}else o?this.options.visualElement.renderState.vars[t]=l:e[t]=l}this.options.layoutId&&(e.pointerEvents=n===this?uj(t?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(e=>e.currentAnimation?.stop()),this.root.nodes.forEach(pd),this.root.sharedNodes.clear()}}}function pa(e){e.updateLayout()}function po(e){let t=e.resumeFrom?.snapshot||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners("didUpdate")){let{layoutBox:r,measuredBox:n}=e.layout,{animationType:i}=e.options,s=t.source!==e.layout.source;"size"===i?hn(e=>{let n=s?t.measuredBox[e]:t.layoutBox[e],i=hl(n);n.min=r[e].min,n.max=n.min+i}):pA(i,t.layoutBox,r)&&hn(n=>{let i=s?t.measuredBox[n]:t.layoutBox[n],a=hl(r[n]);i.max=i.min+a,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[n].max=e.relativeTarget[n].min+a)});let a=lP();hu(a,r,t.layoutBox);let o=lP();s?hu(o,e.applyTransform(n,!0),t.measuredBox):hu(o,r,t.layoutBox);let l=!hq(a),c=!1;if(!e.resumeFrom){let n=e.getClosestProjectingParent();if(n&&!n.resumeFrom){let{snapshot:i,layout:s}=n;if(i&&s){let a=lM();hp(a,t.layoutBox,i.layoutBox);let o=lM();hp(o,r,s.layoutBox),hX(a,o)||(c=!0),n.options.layoutRoot&&(e.relativeTarget=o,e.relativeTargetOrigin=a,e.relativeParent=n)}}}e.notifyListeners("didUpdate",{layout:r,snapshot:t,delta:o,layoutDelta:a,hasLayoutChanged:l,hasRelativeLayoutChanged:c})}else if(e.isLead()){let{onExitComplete:t}=e.options;t&&t()}e.options.transition=void 0}function pl(e){e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function pc(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function pu(e){e.clearSnapshot()}function pd(e){e.clearMeasurements()}function ph(e){e.isLayoutDirty=!1}function pp(e){let{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function pm(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function pf(e){e.resolveTargetDelta()}function pg(e){e.calcProjection()}function py(e){e.resetSkewAndRotation()}function px(e){e.removeLeadSnapshot()}function pv(e,t,r){e.translate=c1(t.translate,0,r),e.scale=c1(t.scale,1,r),e.origin=t.origin,e.originPoint=t.originPoint}function pb(e,t,r,n){e.min=c1(t.min,r.min,n),e.max=c1(t.max,r.max,n)}function pw(e){return e.animationValues&&void 0!==e.animationValues.opacityExit}let pk={duration:.45,ease:[.4,0,.1,1]},pj=e=>"u">typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),pS=pj("applewebkit/")&&!pj("chrome/")?Math.round:l9;function pN(e){e.min=pS(e.min),e.max=pS(e.max)}function pA(e,t,r){return"position"===e||"preserve-aspect"===e&&!(.2>=Math.abs(hJ(t)-hJ(r)))}function pC(e){return e!==e.root&&e.scroll?.wasRoot}let p_=ps({attachResizeListener:(e,t)=>ha(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),pT={current:void 0},pE=ps({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!pT.current){let e=new p_({});e.mount(window),e.setOptions({layoutScroll:!0}),pT.current=e}return pT.current},resetTransform:(e,t)=>{e.style.transform=void 0!==t?t:"none"},checkIsScrollRoot:e=>"fixed"===window.getComputedStyle(e).position});function pP(e,t){let r=function(e,t,r){if(null==e)return[];if(e instanceof EventTarget)return[e];if("string"==typeof e){let t=document,r=(void 0)??t.querySelectorAll(e);return r?Array.from(r):[]}return Array.from(e).filter(e=>null!=e)}(e),n=new AbortController;return[r,{passive:!0,...t,signal:n.signal},()=>n.abort()]}function pR(e){return!("touch"===e.pointerType||ho.x||ho.y)}function pM(e,t,r){let{props:n}=e;e.animationState&&n.whileHover&&e.animationState.setActive("whileHover","Start"===r);let i=n["onHover"+r];i&&cr.postRender(()=>i(t,hf(t)))}let pL=(e,t)=>!!t&&(e===t||pL(e,t.parentElement)),pI=new WeakSet;function pD(e){return t=>{"Enter"===t.key&&e(t)}}function pO(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}function pB(e){return hm(e)&&!(ho.x||ho.y)}function pF(e,t,r){let{props:n}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&n.whileTap&&e.animationState.setActive("whileTap","Start"===r);let i=n["onTap"+("End"===r?"":r)];i&&cr.postRender(()=>i(t,hf(t)))}let pz=new WeakMap,p$=new WeakMap,pV=e=>{let t=pz.get(e.target);t&&t(e)},pU=e=>{e.forEach(pV)},pW={some:0,all:1},pG=function(e,t){if("u"<typeof Proxy)return uO;let r=new Map,n=(r,n)=>uO(r,n,e,t);return new Proxy((e,t)=>n(e,t),{get:(i,s)=>"create"===s?n:(r.has(s)||r.set(s,uO(s,void 0,e,t)),r.get(s))})}({animation:{Feature:class extends uB{constructor(e){super(e),e.animationState||(e.animationState=function(e){let t=t=>Promise.all(t.map(({animation:t,options:r})=>(function(e,t,r={}){let n;if(e.notify("AnimationStart",t),Array.isArray(t))n=Promise.all(t.map(t=>d6(e,t,r)));else if("string"==typeof t)n=d6(e,t,r);else{let i="function"==typeof t?uF(e,t,r.custom):t;n=Promise.all(d5(e,i,r))}return n.then(()=>{e.notify("AnimationComplete",t)})})(e,t,r))),r=ht(),n=!0,i=t=>(r,n)=>{let i=uF(e,n,"exit"===t?e.presenceContext?.custom:void 0);if(i){let{transition:e,transitionEnd:t,...n}=i;r={...r,...n,...t}}return r};function s(s){let{props:a}=e,o=function e(t){if(!t)return;if(!t.isControllingVariants){let r=t.parent&&e(t.parent)||{};return void 0!==t.props.initial&&(r.initial=t.props.initial),r}let r={};for(let e=0;e<d4;e++){let n=cR[e],i=t.props[n];(cE(i)||!1===i)&&(r[n]=i)}return r}(e.parent)||{},l=[],c=new Set,u={},d=1/0;for(let t=0;t<d7;t++){var h,p;let m=d9[t],f=r[m],g=void 0!==a[m]?a[m]:o[m],y=cE(g),x=m===s?f.isActive:null;!1===x&&(d=t);let v=g===o[m]&&g!==a[m]&&y;if(v&&n&&e.manuallyAnimateOnMount&&(v=!1),f.protectedKeys={...u},!f.isActive&&null===x||!g&&!f.prevProp||cT(g)||"boolean"==typeof g)continue;let b=(h=f.prevProp,"string"==typeof(p=g)?p!==h:!!Array.isArray(p)&&!d8(p,h)),w=b||m===s&&f.isActive&&!v&&y||t>d&&y,k=!1,j=Array.isArray(g)?g:[g],S=j.reduce(i(m),{});!1===x&&(S={});let{prevResolvedValues:N={}}=f,A={...N,...S},C=t=>{w=!0,c.has(t)&&(k=!0,c.delete(t)),f.needsAnimating[t]=!0;let r=e.getValue(t);r&&(r.liveStyle=!1)};for(let e in A){let t=S[e],r=N[e];if(!u.hasOwnProperty(e))(u$(t)&&u$(r)?d8(t,r):t===r)?void 0!==t&&c.has(e)?C(e):f.protectedKeys[e]=!0:null!=t?C(e):c.add(e)}f.prevProp=g,f.prevResolvedValues=S,f.isActive&&(u={...u,...S}),n&&e.blockInitialAnimation&&(w=!1);let _=v&&b,T=!_||k;w&&T&&l.push(...j.map(t=>{let r={type:m};if("string"==typeof t&&n&&!_&&e.manuallyAnimateOnMount&&e.parent){let{parent:n}=e,i=uF(n,t);if(n.enteringChildren&&i){let{delayChildren:t}=i.transition||{};r.delay=d3(n.enteringChildren,e,t)}}return{animation:t,options:r}}))}if(c.size){let t={};if("boolean"!=typeof a.initial){let r=uF(e,Array.isArray(a.initial)?a.initial[0]:a.initial);r&&r.transition&&(t.transition=r.transition)}c.forEach(r=>{let n=e.getBaseTarget(r),i=e.getValue(r);i&&(i.liveStyle=!0),t[r]=n??null}),l.push({animation:t})}let m=!!l.length;return n&&(!1===a.initial||a.initial===a.animate)&&!e.manuallyAnimateOnMount&&(m=!1),n=!1,m?t(l):Promise.resolve()}return{animateChanges:s,setActive:function(t,n){if(r[t].isActive===n)return Promise.resolve();e.variantChildren?.forEach(e=>e.animationState?.setActive(t,n)),r[t].isActive=n;let i=s(t);for(let e in r)r[e].protectedKeys={};return i},setAnimateFunction:function(r){t=r(e)},getState:()=>r,reset:()=>{r=ht()}}}(e))}updateAnimationControlsSubscription(){let{animate:e}=this.node.getProps();cT(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){let{animate:e}=this.node.getProps(),{animate:t}=this.node.prevProps||{};e!==t&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}}},exit:{Feature:class extends uB{constructor(){super(...arguments),this.id=hr++}update(){if(!this.node.presenceContext)return;let{isPresent:e,onExitComplete:t}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===r)return;let n=this.node.animationState.setActive("exit",!e);t&&!e&&n.then(()=>{t(this.id)})}mount(){let{register:e,onExitComplete:t}=this.node.presenceContext||{};t&&t(this.id),e&&(this.unmount=e(this.id))}unmount(){}}},inView:{Feature:class extends uB{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){var e;let t;this.unmount();let{viewport:r={}}=this.node.getProps(),{root:n,margin:i,amount:s="some",once:a}=r,o={root:n?n.current:void 0,rootMargin:i,threshold:"number"==typeof s?s:pW[s]},l=e=>{let{isIntersecting:t}=e;if(this.isInView===t||(this.isInView=t,a&&!t&&this.hasEnteredView))return;t&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",t);let{onViewportEnter:r,onViewportLeave:n}=this.node.getProps(),i=t?r:n;i&&i(e)};return e=this.node.current,t=function({root:e,...t}){let r=e||document;p$.has(r)||p$.set(r,{});let n=p$.get(r),i=JSON.stringify(t);return n[i]||(n[i]=new IntersectionObserver(pU,{root:e,...t})),n[i]}(o),pz.set(e,l),t.observe(e),()=>{pz.delete(e),t.unobserve(e)}}mount(){this.startObserver()}update(){if("u"<typeof IntersectionObserver)return;let{props:e,prevProps:t}=this.node;["amount","margin","root"].some(function({viewport:e={}},{viewport:t={}}={}){return r=>e[r]!==t[r]}(e,t))&&this.startObserver()}unmount(){}}},tap:{Feature:class extends uB{mount(){let{current:e}=this.node;e&&(this.unmount=function(e,t,r={}){let[n,i,s]=pP(e,r),a=e=>{let n=e.currentTarget;if(!pB(e))return;pI.add(n);let s=t(n,e),a=(e,t)=>{window.removeEventListener("pointerup",o),window.removeEventListener("pointercancel",l),pI.has(n)&&pI.delete(n),pB(e)&&"function"==typeof s&&s(e,{success:t})},o=e=>{a(e,n===window||n===document||r.useGlobalTarget||pL(n,e.target))},l=e=>{a(e,!1)};window.addEventListener("pointerup",o,i),window.addEventListener("pointercancel",l,i)};return n.forEach(e=>{(r.useGlobalTarget?window:e).addEventListener("pointerdown",a,i),h8(e)&&"offsetHeight"in e&&(e.addEventListener("focus",e=>((e,t)=>{let r=e.currentTarget;if(!r)return;let n=pD(()=>{if(pI.has(r))return;pO(r,"down");let e=pD(()=>{pO(r,"up")});r.addEventListener("keyup",e,t),r.addEventListener("blur",()=>pO(r,"cancel"),t)});r.addEventListener("keydown",n,t),r.addEventListener("blur",()=>r.removeEventListener("keydown",n),t)})(e,i)),hs(e)||e.hasAttribute("tabindex")||(e.tabIndex=0))}),s}(e,(e,t)=>(pF(this.node,t,"Start"),(e,{success:t})=>pF(this.node,e,t?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}},focus:{Feature:class extends uB{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch(t){e=!0}e&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){this.isActive&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=uG(ha(this.node.current,"focus",()=>this.onFocus()),ha(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}},hover:{Feature:class extends uB{mount(){let{current:e}=this.node;e&&(this.unmount=function(e,t,r={}){let[n,i,s]=pP(e,r),a=e=>{if(!pR(e))return;let{target:r}=e,n=t(r,e);if("function"!=typeof n||!r)return;let s=e=>{pR(e)&&(n(e),r.removeEventListener("pointerleave",s))};r.addEventListener("pointerleave",s,i)};return n.forEach(e=>{e.addEventListener("pointerenter",a,i)}),s}(e,(e,t)=>(pM(this.node,t,"Start"),e=>pM(this.node,e,"End"))))}unmount(){}}},pan:{Feature:class extends uB{constructor(){super(...arguments),this.removePointerDownListener=l9}onPointerDown(e){this.session=new hb(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:hy(this.node)})}createPanHandlers(){let{onPanSessionStart:e,onPanStart:t,onPan:r,onPanEnd:n}=this.node.getProps();return{onSessionStart:hR(e),onStart:hR(t),onMove:r,onEnd:(e,t)=>{delete this.session,n&&cr.postRender(()=>n(e,t))}}}mount(){this.removePointerDownListener=hg(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}},drag:{Feature:class extends uB{constructor(e){super(e),this.removeGroupControls=l9,this.removeListeners=l9,this.controls=new hE(e)}mount(){let{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||l9}update(){let{dragControls:e}=this.node.getProps(),{dragControls:t}=this.node.prevProps||{};e!==t&&(this.removeGroupControls(),e&&(this.removeGroupControls=e.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}},ProjectionNode:pE,MeasureLayout:hO},layout:{ProjectionNode:pE,MeasureLayout:hO}},(e,t)=>t.isSVG??ud(e)?new c4(t):new uc(t,{allowProjection:e!==b.Fragment})),pH=(0,b.memo)(({children:e,as:t="p",className:r,duration:n=2,spread:i=2})=>{let s=pG.create(t),a=(0,b.useMemo)(()=>(e?.length??0)*i,[e,i]);return(0,v.jsx)(s,{animate:{backgroundPosition:"0% center"},className:(0,j.cn)("relative inline-block bg-[length:250%_100%,auto] bg-clip-text text-transparent","[--bg:linear-gradient(90deg,#0000_calc(50%-var(--spread)),var(--color-background),#0000_calc(50%+var(--spread)))] [background-repeat:no-repeat,padding-box]",r),initial:{backgroundPosition:"100% center"},style:{"--spread":`${a}px`,backgroundImage:"var(--bg), linear-gradient(var(--color-muted-foreground), var(--color-muted-foreground))"},transition:{repeat:1/0,duration:n,ease:"linear"},children:e})}),pq=(0,b.createContext)(null),pK=(0,b.memo)(({className:e,isStreaming:t=!1,open:r,defaultOpen:n=!0,onOpenChange:i,duration:s,children:a,...o})=>{let[l,c]=(0,aY.useControllableState)({prop:r,defaultProp:n,onChange:i}),[u,d]=(0,aY.useControllableState)({prop:s,defaultProp:void 0}),[h,p]=(0,b.useState)(!1),[m,f]=(0,b.useState)(null);return(0,b.useEffect)(()=>{t?null===m&&f(Date.now()):null!==m&&(d(Math.ceil((Date.now()-m)/1e3)),f(null))},[t,m,d]),(0,b.useEffect)(()=>{if(n&&!t&&l&&!h){let e=setTimeout(()=>{c(!1),p(!0)},1e3);return()=>clearTimeout(e)}},[t,l,n,c,h]),(0,v.jsx)(pq.Provider,{value:{isStreaming:t,isOpen:l,setIsOpen:c,duration:u},children:(0,v.jsx)(os,{className:(0,j.cn)("not-prose mb-4",e),onOpenChange:e=>{c(e)},open:l,...o,children:a})})}),pY=(e,t)=>e||0===t?(0,v.jsx)(pH,{duration:1,children:"Thinking..."}):void 0===t?(0,v.jsx)("p",{children:"Thought for a few seconds"}):(0,v.jsxs)("p",{children:["Thought for ",t," seconds"]}),pX=(0,b.memo)(({className:e,children:t,getThinkingMessage:r=pY,...n})=>{let{isStreaming:i,isOpen:s,duration:a}=(()=>{let e=(0,b.useContext)(pq);if(!e)throw Error("Reasoning components must be used within Reasoning");return e})();return(0,v.jsx)(oa,{className:(0,j.cn)("flex w-full items-center gap-2 text-muted-foreground text-sm transition-colors hover:text-foreground",e),...n,children:t??(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(oQ,{className:"size-4"}),r(i,a),(0,v.jsx)(oc.ChevronDownIcon,{className:(0,j.cn)("size-4 transition-transform",s?"rotate-180":"rotate-0")})]})})}),pJ=(0,b.memo)(({className:e,children:t,...r})=>(0,v.jsx)(oo,{className:(0,j.cn)("mt-4 text-sm","data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-muted-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in",e),...r,children:(0,v.jsx)(a$.j,{plugins:{code:ni,mermaid:aI,math:nB,cjk:ey},linkSafety:{enabled:!0,renderModal:aH},...r,children:t})}));pK.displayName="Reasoning",pX.displayName="ReasoningTrigger",pJ.displayName="ReasoningContent";var pZ=/[\\\/_+.#"@\[\(\{&]/,pQ=/[\\\/_+.#"@\[\(\{&]/g,p0=/[\s-]/,p1=/[\s-]/g;function p2(e){return e.toLowerCase().replace(p1," ")}var p5=e.i(7631),p3=e.i(408744),p6='[cmdk-group=""]',p4='[cmdk-group-items=""]',p8='[cmdk-item=""]',p9=`${p8}:not([aria-disabled="true"])`,p7="cmdk-item-select",me="data-value",mt=(e,t,r)=>{var n;return n=e,function e(t,r,n,i,s,a,o){if(a===r.length)return s===t.length?1:.99;var l=`${s},${a}`;if(void 0!==o[l])return o[l];for(var c,u,d,h,p=i.charAt(a),m=n.indexOf(p,s),f=0;m>=0;)(c=e(t,r,n,i,m+1,a+1,o))>f&&(m===s?c*=1:pZ.test(t.charAt(m-1))?(c*=.8,(d=t.slice(s,m-1).match(pQ))&&s>0&&(c*=Math.pow(.999,d.length))):p0.test(t.charAt(m-1))?(c*=.9,(h=t.slice(s,m-1).match(p1))&&s>0&&(c*=Math.pow(.999,h.length))):(c*=.17,s>0&&(c*=Math.pow(.999,m-s))),t.charAt(m)!==r.charAt(a)&&(c*=.9999)),(c<.1&&n.charAt(m-1)===i.charAt(a+1)||i.charAt(a+1)===i.charAt(a)&&n.charAt(m-1)!==i.charAt(a))&&.1*(u=e(t,r,n,i,m+1,a+2,o))>c&&(c=.1*u),c>f&&(f=c),m=n.indexOf(p,m+1);return o[l]=f,f}(n=r&&r.length>0?`${n+" "+r.join(" ")}`:n,t,p2(n),p2(t),0,0,{})},mr=b.createContext(void 0),mn=b.createContext(void 0),mi=b.createContext(void 0),ms=b.forwardRef((e,t)=>{let r=mm(()=>{var t,r;return{search:"",value:null!=(r=null!=(t=e.value)?t:e.defaultValue)?r:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),n=mm(()=>new Set),i=mm(()=>new Map),s=mm(()=>new Map),a=mm(()=>new Set),o=mh(e),{label:l,children:c,value:u,onValueChange:d,filter:h,shouldFilter:p,loop:m,disablePointerSelection:f=!1,vimBindings:g=!0,...y}=e,x=(0,a2.useId)(),v=(0,a2.useId)(),w=(0,a2.useId)(),k=b.useRef(null),j=my();mp(()=>{if(void 0!==u){let e=u.trim();r.current.value=e,S.emit()}},[u]),mp(()=>{j(6,E)},[]);let S=b.useMemo(()=>({subscribe:e=>(a.current.add(e),()=>a.current.delete(e)),snapshot:()=>r.current,setState:(e,t,n)=>{var i,s,a,l;if(!Object.is(r.current[e],t)){if(r.current[e]=t,"search"===e)T(),C(),j(1,_);else if("value"===e){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let e=document.getElementById(w);e?e.focus():null==(i=document.getElementById(x))||i.focus()}if(j(7,()=>{var e;r.current.selectedItemId=null==(e=P())?void 0:e.id,S.emit()}),n||j(5,E),(null==(s=o.current)?void 0:s.value)!==void 0){null==(l=(a=o.current).onValueChange)||l.call(a,null!=t?t:"");return}}S.emit()}},emit:()=>{a.current.forEach(e=>e())}}),[]),N=b.useMemo(()=>({value:(e,t,n)=>{var i;t!==(null==(i=s.current.get(e))?void 0:i.value)&&(s.current.set(e,{value:t,keywords:n}),r.current.filtered.items.set(e,A(t,n)),j(2,()=>{C(),S.emit()}))},item:(e,t)=>(n.current.add(e),t&&(i.current.has(t)?i.current.get(t).add(e):i.current.set(t,new Set([e]))),j(3,()=>{T(),C(),r.current.value||_(),S.emit()}),()=>{s.current.delete(e),n.current.delete(e),r.current.filtered.items.delete(e);let t=P();j(4,()=>{T(),(null==t?void 0:t.getAttribute("id"))===e&&_(),S.emit()})}),group:e=>(i.current.has(e)||i.current.set(e,new Set),()=>{s.current.delete(e),i.current.delete(e)}),filter:()=>o.current.shouldFilter,label:l||e["aria-label"],getDisablePointerSelection:()=>o.current.disablePointerSelection,listId:x,inputId:w,labelId:v,listInnerRef:k}),[]);function A(e,t){var n,i;let s=null!=(i=null==(n=o.current)?void 0:n.filter)?i:mt;return e?s(e,r.current.search,t):0}function C(){if(!r.current.search||!1===o.current.shouldFilter)return;let e=r.current.filtered.items,t=[];r.current.filtered.groups.forEach(r=>{let n=i.current.get(r),s=0;n.forEach(t=>{s=Math.max(e.get(t),s)}),t.push([r,s])});let n=k.current;R().sort((t,r)=>{var n,i;let s=t.getAttribute("id"),a=r.getAttribute("id");return(null!=(n=e.get(a))?n:0)-(null!=(i=e.get(s))?i:0)}).forEach(e=>{let t=e.closest(p4);t?t.appendChild(e.parentElement===t?e:e.closest(`${p4} > *`)):n.appendChild(e.parentElement===n?e:e.closest(`${p4} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{var t;let r=null==(t=k.current)?void 0:t.querySelector(`${p6}[${me}="${encodeURIComponent(e[0])}"]`);null==r||r.parentElement.appendChild(r)})}function _(){let e=R().find(e=>"true"!==e.getAttribute("aria-disabled")),t=null==e?void 0:e.getAttribute(me);S.setState("value",t||void 0)}function T(){var e,t,a,l;if(!r.current.search||!1===o.current.shouldFilter){r.current.filtered.count=n.current.size;return}r.current.filtered.groups=new Set;let c=0;for(let i of n.current){let n=A(null!=(t=null==(e=s.current.get(i))?void 0:e.value)?t:"",null!=(l=null==(a=s.current.get(i))?void 0:a.keywords)?l:[]);r.current.filtered.items.set(i,n),n>0&&c++}for(let[e,t]of i.current)for(let n of t)if(r.current.filtered.items.get(n)>0){r.current.filtered.groups.add(e);break}r.current.filtered.count=c}function E(){var e,t,r;let n=P();n&&((null==(e=n.parentElement)?void 0:e.firstChild)===n&&(null==(r=null==(t=n.closest(p6))?void 0:t.querySelector('[cmdk-group-heading=""]'))||r.scrollIntoView({block:"nearest"})),n.scrollIntoView({block:"nearest"}))}function P(){var e;return null==(e=k.current)?void 0:e.querySelector(`${p8}[aria-selected="true"]`)}function R(){var e;return Array.from((null==(e=k.current)?void 0:e.querySelectorAll(p9))||[])}function M(e){let t=R()[e];t&&S.setState("value",t.getAttribute(me))}function L(e){var t;let r=P(),n=R(),i=n.findIndex(e=>e===r),s=n[i+e];null!=(t=o.current)&&t.loop&&(s=i+e<0?n[n.length-1]:i+e===n.length?n[0]:n[i+e]),s&&S.setState("value",s.getAttribute(me))}function I(e){let t=P(),r=null==t?void 0:t.closest(p6),n;for(;r&&!n;)n=null==(r=e>0?function(e,t){let r=e.nextElementSibling;for(;r;){if(r.matches(t))return r;r=r.nextElementSibling}}(r,p6):function(e,t){let r=e.previousElementSibling;for(;r;){if(r.matches(t))return r;r=r.previousElementSibling}}(r,p6))?void 0:r.querySelector(p9);n?S.setState("value",n.getAttribute(me)):L(e)}let D=()=>M(R().length-1),O=e=>{e.preventDefault(),e.metaKey?D():e.altKey?I(1):L(1)},B=e=>{e.preventDefault(),e.metaKey?M(0):e.altKey?I(-1):L(-1)};return b.createElement(p3.Primitive.div,{ref:t,tabIndex:-1,...y,"cmdk-root":"",onKeyDown:e=>{var t;null==(t=y.onKeyDown)||t.call(y,e);let r=e.nativeEvent.isComposing||229===e.keyCode;if(!(e.defaultPrevented||r))switch(e.key){case"n":case"j":g&&e.ctrlKey&&O(e);break;case"ArrowDown":O(e);break;case"p":case"k":g&&e.ctrlKey&&B(e);break;case"ArrowUp":B(e);break;case"Home":e.preventDefault(),M(0);break;case"End":e.preventDefault(),D();break;case"Enter":{e.preventDefault();let t=P();if(t){let e=new Event(p7);t.dispatchEvent(e)}}}}},b.createElement("label",{"cmdk-label":"",htmlFor:N.inputId,id:N.labelId,style:mv},l),mx(e,e=>b.createElement(mn.Provider,{value:S},b.createElement(mr.Provider,{value:N},e))))}),ma=b.forwardRef((e,t)=>{var r,n;let i=(0,a2.useId)(),s=b.useRef(null),a=b.useContext(mi),o=b.useContext(mr),l=mh(e),c=null!=(n=null==(r=l.current)?void 0:r.forceMount)?n:null==a?void 0:a.forceMount;mp(()=>{if(!c)return o.item(i,null==a?void 0:a.id)},[c]);let u=mg(i,s,[e.value,e.children,s],e.keywords),d=b.useContext(mn),h=mf(e=>e.value&&e.value===u.current),p=mf(e=>!!c||!1===o.filter()||!e.search||e.filtered.items.get(i)>0);function m(){var e,t;f(),null==(t=(e=l.current).onSelect)||t.call(e,u.current)}function f(){d.setState("value",u.current,!0)}if(b.useEffect(()=>{let t=s.current;if(!(!t||e.disabled))return t.addEventListener(p7,m),()=>t.removeEventListener(p7,m)},[p,e.onSelect,e.disabled]),!p)return null;let{disabled:g,value:y,onSelect:x,forceMount:v,keywords:w,...k}=e;return b.createElement(p3.Primitive.div,{ref:(0,aJ.composeRefs)(s,t),...k,id:i,"cmdk-item":"",role:"option","aria-disabled":!!g,"aria-selected":!!h,"data-disabled":!!g,"data-selected":!!h,onPointerMove:g||o.getDisablePointerSelection()?void 0:f,onClick:g?void 0:m},e.children)}),mo=b.forwardRef((e,t)=>{let{heading:r,children:n,forceMount:i,...s}=e,a=(0,a2.useId)(),o=b.useRef(null),l=b.useRef(null),c=(0,a2.useId)(),u=b.useContext(mr),d=mf(e=>!!i||!1===u.filter()||!e.search||e.filtered.groups.has(a));mp(()=>u.group(a),[]),mg(a,o,[e.value,e.heading,l]);let h=b.useMemo(()=>({id:a,forceMount:i}),[i]);return b.createElement(p3.Primitive.div,{ref:(0,aJ.composeRefs)(o,t),...s,"cmdk-group":"",role:"presentation",hidden:!d||void 0},r&&b.createElement("div",{ref:l,"cmdk-group-heading":"","aria-hidden":!0,id:c},r),mx(e,e=>b.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?c:void 0},b.createElement(mi.Provider,{value:h},e))))}),ml=b.forwardRef((e,t)=>{let{alwaysRender:r,...n}=e,i=b.useRef(null),s=mf(e=>!e.search);return r||s?b.createElement(p3.Primitive.div,{ref:(0,aJ.composeRefs)(i,t),...n,"cmdk-separator":"",role:"separator"}):null}),mc=b.forwardRef((e,t)=>{let{onValueChange:r,...n}=e,i=null!=e.value,s=b.useContext(mn),a=mf(e=>e.search),o=mf(e=>e.selectedItemId),l=b.useContext(mr);return b.useEffect(()=>{null!=e.value&&s.setState("search",e.value)},[e.value]),b.createElement(p3.Primitive.input,{ref:t,...n,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":l.listId,"aria-labelledby":l.labelId,"aria-activedescendant":o,id:l.inputId,type:"text",value:i?e.value:a,onChange:e=>{i||s.setState("search",e.target.value),null==r||r(e.target.value)}})}),mu=b.forwardRef((e,t)=>{let{children:r,label:n="Suggestions",...i}=e,s=b.useRef(null),a=b.useRef(null),o=mf(e=>e.selectedItemId),l=b.useContext(mr);return b.useEffect(()=>{if(a.current&&s.current){let e=a.current,t=s.current,r,n=new ResizeObserver(()=>{r=requestAnimationFrame(()=>{let r=e.offsetHeight;t.style.setProperty("--cmdk-list-height",r.toFixed(1)+"px")})});return n.observe(e),()=>{cancelAnimationFrame(r),n.unobserve(e)}}},[]),b.createElement(p3.Primitive.div,{ref:(0,aJ.composeRefs)(s,t),...i,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":o,"aria-label":n,id:l.listId},mx(e,e=>b.createElement("div",{ref:(0,aJ.composeRefs)(a,l.listInnerRef),"cmdk-list-sizer":""},e)))}),md=b.forwardRef((e,t)=>{let{open:r,onOpenChange:n,overlayClassName:i,contentClassName:s,container:a,...o}=e;return b.createElement(p5.Root,{open:r,onOpenChange:n},b.createElement(p5.Portal,{container:a},b.createElement(p5.Overlay,{"cmdk-overlay":"",className:i}),b.createElement(p5.Content,{"aria-label":e.label,"cmdk-dialog":"",className:s},b.createElement(ms,{ref:t,...o}))))});function mh(e){let t=b.useRef(e);return mp(()=>{t.current=e}),t}Object.assign(ms,{List:mu,Item:ma,Input:mc,Group:mo,Separator:ml,Dialog:md,Empty:b.forwardRef((e,t)=>mf(e=>0===e.filtered.count)?b.createElement(p3.Primitive.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),Loading:b.forwardRef((e,t)=>{let{progress:r,children:n,label:i="Loading...",...s}=e;return b.createElement(p3.Primitive.div,{ref:t,...s,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},mx(e,e=>b.createElement("div",{"aria-hidden":!0},e)))})});var mp="u"<typeof window?b.useEffect:b.useLayoutEffect;function mm(e){let t=b.useRef();return void 0===t.current&&(t.current=e()),t}function mf(e){let t=b.useContext(mn),r=()=>e(t.snapshot());return b.useSyncExternalStore(t.subscribe,r,r)}function mg(e,t,r,n=[]){let i=b.useRef(),s=b.useContext(mr);return mp(()=>{var a;let o=(()=>{var e;for(let t of r){if("string"==typeof t)return t.trim();if("object"==typeof t&&"current"in t)return t.current?null==(e=t.current.textContent)?void 0:e.trim():i.current}})(),l=n.map(e=>e.trim());s.value(e,o,l),null==(a=t.current)||a.setAttribute(me,o),i.current=o}),i}var my=()=>{let[e,t]=b.useState(),r=mm(()=>new Map);return mp(()=>{r.current.forEach(e=>e()),r.current=new Map},[e]),(e,n)=>{r.current.set(e,n),t({})}};function mx({asChild:e,children:t},r){let n;return e&&b.isValidElement(t)?b.cloneElement("function"==typeof(n=t.type)?n(t.props):"render"in n?n.render(t.props):t,{ref:t.ref},r(t.props.children)):r(t)}var mv={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};(0,E.default)("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]);var mb=e.i(836191),mw=Symbol("radix.slottable");function mk(e){return b.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===mw}var mj=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{var r,n;let i,s,a,o=(n=r=`Primitive.${t}`,(i=b.forwardRef((e,t)=>{let{children:r,...n}=e;if(b.isValidElement(r)){var i;let e,s,a=(i=r,(s=(e=Object.getOwnPropertyDescriptor(i.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.ref:(s=(e=Object.getOwnPropertyDescriptor(i,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.props.ref:i.props.ref||i.ref),o=function(e,t){let r={...t};for(let n in t){let i=e[n],s=t[n];/^on[A-Z]/.test(n)?i&&s?r[n]=(...e)=>{let t=s(...e);return i(...e),t}:i&&(r[n]=i):"style"===n?r[n]={...i,...s}:"className"===n&&(r[n]=[i,s].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==b.Fragment&&(o.ref=t?(0,aJ.composeRefs)(t,a):a),b.cloneElement(r,o)}return b.Children.count(r)>1?b.Children.only(null):null})).displayName=`${n}.SlotClone`,s=i,(a=b.forwardRef((e,t)=>{let{children:r,...n}=e,i=b.Children.toArray(r),a=i.find(mk);if(a){let e=a.props.children,r=i.map(t=>t!==a?t:b.Children.count(e)>1?b.Children.only(null):b.isValidElement(e)?e.props.children:null);return(0,v.jsx)(s,{...n,ref:t,children:b.isValidElement(e)?b.cloneElement(e,void 0,r):null})}return(0,v.jsx)(s,{...n,ref:t,children:r})})).displayName=`${r}.Slot`,a),l=b.forwardRef((e,r)=>{let{asChild:n,...i}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,v.jsx)(n?o:t,{...i,ref:r})});return l.displayName=`Primitive.${t}`,{...e,[t]:l}},{}),mS=e.i(736180),mN=e.i(542899),mA=e.i(272741),mC=e.i(721648),m_=e.i(498101),mT=e.i(874057),mE=e.i(383044);function mP(e){var t;let r,n=(t=e,(r=b.forwardRef((e,t)=>{let{children:r,...n}=e;if(b.isValidElement(r)){var i;let e,s,a=(i=r,(s=(e=Object.getOwnPropertyDescriptor(i.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.ref:(s=(e=Object.getOwnPropertyDescriptor(i,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.props.ref:i.props.ref||i.ref),o=function(e,t){let r={...t};for(let n in t){let i=e[n],s=t[n];/^on[A-Z]/.test(n)?i&&s?r[n]=(...e)=>{let t=s(...e);return i(...e),t}:i&&(r[n]=i):"style"===n?r[n]={...i,...s}:"className"===n&&(r[n]=[i,s].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==b.Fragment&&(o.ref=t?(0,aJ.composeRefs)(t,a):a),b.cloneElement(r,o)}return b.Children.count(r)>1?b.Children.only(null):null})).displayName=`${t}.SlotClone`,r),i=b.forwardRef((e,t)=>{let{children:r,...i}=e,s=b.Children.toArray(r),a=s.find(mM);if(a){let e=a.props.children,r=s.map(t=>t!==a?t:b.Children.count(e)>1?b.Children.only(null):b.isValidElement(e)?e.props.children:null);return(0,v.jsx)(n,{...i,ref:t,children:b.isValidElement(e)?b.cloneElement(e,void 0,r):null})}return(0,v.jsx)(n,{...i,ref:t,children:r})});return i.displayName=`${e}.Slot`,i}var mR=Symbol("radix.slottable");function mM(e){return b.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===mR}var mL=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{let r=mP(`Primitive.${t}`),n=b.forwardRef((e,n)=>{let{asChild:i,...s}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,v.jsx)(i?r:t,{...s,ref:n})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),mI=Symbol("radix.slottable");function mD(e){return b.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===mI}var mO=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{var r,n;let i,s,a,o=(n=r=`Primitive.${t}`,(i=b.forwardRef((e,t)=>{let{children:r,...n}=e;if(b.isValidElement(r)){var i;let e,s,a=(i=r,(s=(e=Object.getOwnPropertyDescriptor(i.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.ref:(s=(e=Object.getOwnPropertyDescriptor(i,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.props.ref:i.props.ref||i.ref),o=function(e,t){let r={...t};for(let n in t){let i=e[n],s=t[n];/^on[A-Z]/.test(n)?i&&s?r[n]=(...e)=>{let t=s(...e);return i(...e),t}:i&&(r[n]=i):"style"===n?r[n]={...i,...s}:"className"===n&&(r[n]=[i,s].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==b.Fragment&&(o.ref=t?(0,aJ.composeRefs)(t,a):a),b.cloneElement(r,o)}return b.Children.count(r)>1?b.Children.only(null):null})).displayName=`${n}.SlotClone`,s=i,(a=b.forwardRef((e,t)=>{let{children:r,...n}=e,i=b.Children.toArray(r),a=i.find(mD);if(a){let e=a.props.children,r=i.map(t=>t!==a?t:b.Children.count(e)>1?b.Children.only(null):b.isValidElement(e)?e.props.children:null);return(0,v.jsx)(s,{...n,ref:t,children:b.isValidElement(e)?b.cloneElement(e,void 0,r):null})}return(0,v.jsx)(s,{...n,ref:t,children:r})})).displayName=`${r}.Slot`,a),l=b.forwardRef((e,r)=>{let{asChild:n,...i}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,v.jsx)(n?o:t,{...i,ref:r})});return l.displayName=`Primitive.${t}`,{...e,[t]:l}},{}),mB=e.i(897462),mF="rovingFocusGroup.onEntryFocus",mz={bubbles:!1,cancelable:!0},m$="RovingFocusGroup",[mV,mU,mW]=(0,mS.createCollection)(m$),[mG,mH]=function(e,t=[]){let r=[],n=()=>{let t=r.map(e=>b.createContext(e));return function(r){let n=r?.[e]||t;return b.useMemo(()=>({[`__scope${e}`]:{...r,[e]:n}}),[r,n])}};return n.scopeName=e,[function(t,n){let i=b.createContext(n),s=r.length;r=[...r,n];let a=t=>{let{scope:r,children:n,...a}=t,o=r?.[e]?.[s]||i,l=b.useMemo(()=>a,Object.values(a));return(0,v.jsx)(o.Provider,{value:l,children:n})};return a.displayName=t+"Provider",[a,function(r,a){let o=a?.[e]?.[s]||i,l=b.useContext(o);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 b.useMemo(()=>({[`__scope${t.scopeName}`]:n}),[n])}};return r.scopeName=t.scopeName,r}(n,...t)]}(m$,[mW]),[mq,mK]=mG(m$),mY=b.forwardRef((e,t)=>(0,v.jsx)(mV.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,v.jsx)(mV.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,v.jsx)(mX,{...e,ref:t})})}));mY.displayName=m$;var mX=b.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:r,orientation:n,loop:i=!1,dir:s,currentTabStopId:a,defaultCurrentTabStopId:o,onCurrentTabStopIdChange:l,onEntryFocus:c,preventScrollOnEntryFocus:u=!1,...d}=e,h=b.useRef(null),p=(0,aJ.useComposedRefs)(t,h),m=(0,mN.useDirection)(s),[f,g]=(0,aY.useControllableState)({prop:a,defaultProp:o??null,onChange:l,caller:m$}),[y,x]=b.useState(!1),w=(0,mB.useCallbackRef)(c),k=mU(r),j=b.useRef(!1),[S,N]=b.useState(0);return b.useEffect(()=>{let e=h.current;if(e)return e.addEventListener(mF,w),()=>e.removeEventListener(mF,w)},[w]),(0,v.jsx)(mq,{scope:r,orientation:n,dir:m,loop:i,currentTabStopId:f,onItemFocus:b.useCallback(e=>g(e),[g]),onItemShiftTab:b.useCallback(()=>x(!0),[]),onFocusableItemAdd:b.useCallback(()=>N(e=>e+1),[]),onFocusableItemRemove:b.useCallback(()=>N(e=>e-1),[]),children:(0,v.jsx)(mO.div,{tabIndex:y||0===S?-1:0,"data-orientation":n,...d,ref:p,style:{outline:"none",...e.style},onMouseDown:(0,aK.composeEventHandlers)(e.onMouseDown,()=>{j.current=!0}),onFocus:(0,aK.composeEventHandlers)(e.onFocus,e=>{let t=!j.current;if(e.target===e.currentTarget&&t&&!y){let t=new CustomEvent(mF,mz);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=k().filter(e=>e.focusable);m0([e.find(e=>e.active),e.find(e=>e.id===f),...e].filter(Boolean).map(e=>e.ref.current),u)}}j.current=!1}),onBlur:(0,aK.composeEventHandlers)(e.onBlur,()=>x(!1))})})}),mJ="RovingFocusGroupItem",mZ=b.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:r,focusable:n=!0,active:i=!1,tabStopId:s,children:a,...o}=e,l=(0,a2.useId)(),c=s||l,u=mK(mJ,r),d=u.currentTabStopId===c,h=mU(r),{onFocusableItemAdd:p,onFocusableItemRemove:m,currentTabStopId:f}=u;return b.useEffect(()=>{if(n)return p(),()=>m()},[n,p,m]),(0,v.jsx)(mV.ItemSlot,{scope:r,id:c,focusable:n,active:i,children:(0,v.jsx)(mO.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...o,ref:t,onMouseDown:(0,aK.composeEventHandlers)(e.onMouseDown,e=>{n?u.onItemFocus(c):e.preventDefault()}),onFocus:(0,aK.composeEventHandlers)(e.onFocus,()=>u.onItemFocus(c)),onKeyDown:(0,aK.composeEventHandlers)(e.onKeyDown,e=>{if("Tab"===e.key&&e.shiftKey)return void u.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 mQ[i]}(e,u.orientation,u.dir);if(void 0!==t){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let i=h().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 s=i.indexOf(e.currentTarget);i=u.loop?(r=i,n=s+1,r.map((e,t)=>r[(n+t)%r.length])):i.slice(s+1)}setTimeout(()=>m0(i))}}),children:"function"==typeof a?a({isCurrentTabStop:d,hasTabStop:null!=f}):a})})});mZ.displayName=mJ;var mQ={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function m0(e,t=!1){let r=document.activeElement;for(let n of e)if(n===r||(n.focus({preventScroll:t}),document.activeElement!==r))return}var m1=e.i(567706),m2=e.i(883944),m5=["Enter"," "],m3=["ArrowUp","PageDown","End"],m6=["ArrowDown","PageUp","Home",...m3],m4={ltr:[...m5,"ArrowRight"],rtl:[...m5,"ArrowLeft"]},m8={ltr:["ArrowLeft"],rtl:["ArrowRight"]},m9="Menu",[m7,fe,ft]=(0,mS.createCollection)(m9),[fr,fn]=function(e,t=[]){let r=[],n=()=>{let t=r.map(e=>b.createContext(e));return function(r){let n=r?.[e]||t;return b.useMemo(()=>({[`__scope${e}`]:{...r,[e]:n}}),[r,n])}};return n.scopeName=e,[function(t,n){let i=b.createContext(n),s=r.length;r=[...r,n];let a=t=>{let{scope:r,children:n,...a}=t,o=r?.[e]?.[s]||i,l=b.useMemo(()=>a,Object.values(a));return(0,v.jsx)(o.Provider,{value:l,children:n})};return a.displayName=t+"Provider",[a,function(r,a){let o=a?.[e]?.[s]||i,l=b.useContext(o);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 b.useMemo(()=>({[`__scope${t.scopeName}`]:n}),[n])}};return r.scopeName=t.scopeName,r}(n,...t)]}(m9,[ft,mT.createPopperScope,mH]),fi=(0,mT.createPopperScope)(),fs=mH(),[fa,fo]=fr(m9),[fl,fc]=fr(m9),fu=b.forwardRef((e,t)=>{let{__scopeMenu:r,...n}=e,i=fi(r);return(0,v.jsx)(mT.Anchor,{...i,...n,ref:t})});fu.displayName="MenuAnchor";var fd="MenuPortal",[fh,fp]=fr(fd,{forceMount:void 0}),fm="MenuContent",[ff,fg]=fr(fm),fy=b.forwardRef((e,t)=>{let r=fp(fm,e.__scopeMenu),{forceMount:n=r.forceMount,...i}=e,s=fo(fm,e.__scopeMenu),a=fc(fm,e.__scopeMenu);return(0,v.jsx)(m7.Provider,{scope:e.__scopeMenu,children:(0,v.jsx)(a1.Presence,{present:n||s.open,children:(0,v.jsx)(m7.Slot,{scope:e.__scopeMenu,children:a.modal?(0,v.jsx)(fx,{...i,ref:t}):(0,v.jsx)(fv,{...i,ref:t})})})})}),fx=b.forwardRef((e,t)=>{let r=fo(fm,e.__scopeMenu),n=b.useRef(null),i=(0,aJ.useComposedRefs)(t,n);return b.useEffect(()=>{let e=n.current;if(e)return(0,m1.hideOthers)(e)},[]),(0,v.jsx)(fw,{...e,ref:i,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:(0,aK.composeEventHandlers)(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),fv=b.forwardRef((e,t)=>{let r=fo(fm,e.__scopeMenu);return(0,v.jsx)(fw,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),fb=mP("MenuContent.ScrollLock"),fw=b.forwardRef((e,t)=>{let{__scopeMenu:r,loop:n=!1,trapFocus:i,onOpenAutoFocus:s,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEntryFocus:l,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:h,onDismiss:p,disableOutsideScroll:m,...f}=e,g=fo(fm,r),y=fc(fm,r),x=fi(r),w=fs(r),k=fe(r),[j,S]=b.useState(null),N=b.useRef(null),A=(0,aJ.useComposedRefs)(t,N,g.onContentChange),C=b.useRef(0),_=b.useRef(""),T=b.useRef(0),E=b.useRef(null),P=b.useRef("right"),R=b.useRef(0),M=m?m2.RemoveScroll:b.Fragment;b.useEffect(()=>()=>window.clearTimeout(C.current),[]),(0,mC.useFocusGuards)();let L=b.useCallback(e=>{var t,r;return P.current===E.current?.side&&(t=e,!!(r=E.current?.area)&&function(e,t){let{x:r,y:n}=e,i=!1;for(let e=0,s=t.length-1;e<t.length;s=e++){let a=t[e],o=t[s],l=a.x,c=a.y,u=o.x,d=o.y;c>n!=d>n&&r<(u-l)*(n-c)/(d-c)+l&&(i=!i)}return i}({x:t.clientX,y:t.clientY},r))},[]);return(0,v.jsx)(ff,{scope:r,searchRef:_,onItemEnter:b.useCallback(e=>{L(e)&&e.preventDefault()},[L]),onItemLeave:b.useCallback(e=>{L(e)||(N.current?.focus(),S(null))},[L]),onTriggerLeave:b.useCallback(e=>{L(e)&&e.preventDefault()},[L]),pointerGraceTimerRef:T,onPointerGraceIntentChange:b.useCallback(e=>{E.current=e},[]),children:(0,v.jsx)(M,{...m?{as:fb,allowPinchZoom:!0}:void 0,children:(0,v.jsx)(m_.FocusScope,{asChild:!0,trapped:i,onMountAutoFocus:(0,aK.composeEventHandlers)(s,e=>{e.preventDefault(),N.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:a,children:(0,v.jsx)(mA.DismissableLayer,{asChild:!0,disableOutsidePointerEvents:o,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:h,onDismiss:p,children:(0,v.jsx)(mY,{asChild:!0,...w,dir:y.dir,orientation:"vertical",loop:n,currentTabStopId:j,onCurrentTabStopIdChange:S,onEntryFocus:(0,aK.composeEventHandlers)(l,e=>{y.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,v.jsx)(mT.Content,{role:"menu","aria-orientation":"vertical","data-state":fq(g.open),"data-radix-menu-content":"",dir:y.dir,...x,...f,ref:A,style:{outline:"none",...f.style},onKeyDown:(0,aK.composeEventHandlers)(f.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,s,a,o,l,c;"Tab"===e.key&&e.preventDefault(),!r&&n&&(i=e.key,t=_.current+i,s=k().filter(e=>!e.disabled),a=document.activeElement,o=s.find(e=>e.ref.current===a)?.textValue,l=function(e,t,r){var n;let i=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,s=r?e.indexOf(r):-1,a=(n=Math.max(s,0),e.map((t,r)=>e[(n+r)%e.length]));1===i.length&&(a=a.filter(e=>e!==r));let o=a.find(e=>e.toLowerCase().startsWith(i.toLowerCase()));return o!==r?o:void 0}(s.map(e=>e.textValue),t,o),c=s.find(e=>e.textValue===l)?.ref.current,function e(t){_.current=t,window.clearTimeout(C.current),""!==t&&(C.current=window.setTimeout(()=>e(""),1e3))}(t),c&&setTimeout(()=>c.focus()))}let s=N.current;if(e.target!==s||!m6.includes(e.key))return;e.preventDefault();let a=k().filter(e=>!e.disabled).map(e=>e.ref.current);m3.includes(e.key)&&a.reverse(),function(e){let t=document.activeElement;for(let r of e)if(r===t||(r.focus(),document.activeElement!==t))return}(a)}),onBlur:(0,aK.composeEventHandlers)(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(C.current),_.current="")}),onPointerMove:(0,aK.composeEventHandlers)(e.onPointerMove,fX(e=>{let t=e.target,r=R.current!==e.clientX;e.currentTarget.contains(t)&&r&&(P.current=e.clientX>R.current?"right":"left",R.current=e.clientX)}))})})})})})})});fy.displayName=fm;var fk=b.forwardRef((e,t)=>{let{__scopeMenu:r,...n}=e;return(0,v.jsx)(mL.div,{role:"group",...n,ref:t})});fk.displayName="MenuGroup";var fj=b.forwardRef((e,t)=>{let{__scopeMenu:r,...n}=e;return(0,v.jsx)(mL.div,{...n,ref:t})});fj.displayName="MenuLabel";var fS="MenuItem",fN="menu.itemSelect",fA=b.forwardRef((e,t)=>{let{disabled:r=!1,onSelect:n,...i}=e,s=b.useRef(null),a=fc(fS,e.__scopeMenu),o=fg(fS,e.__scopeMenu),l=(0,aJ.useComposedRefs)(t,s),c=b.useRef(!1);return(0,v.jsx)(fC,{...i,ref:l,disabled:r,onClick:(0,aK.composeEventHandlers)(e.onClick,()=>{let e=s.current;if(!r&&e){let t=new CustomEvent(fN,{bubbles:!0,cancelable:!0});e.addEventListener(fN,e=>n?.(e),{once:!0}),e&&aF.flushSync(()=>e.dispatchEvent(t)),t.defaultPrevented?c.current=!1:a.onClose()}}),onPointerDown:t=>{e.onPointerDown?.(t),c.current=!0},onPointerUp:(0,aK.composeEventHandlers)(e.onPointerUp,e=>{c.current||e.currentTarget?.click()}),onKeyDown:(0,aK.composeEventHandlers)(e.onKeyDown,e=>{let t=""!==o.searchRef.current;r||t&&" "===e.key||m5.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});fA.displayName=fS;var fC=b.forwardRef((e,t)=>{let{__scopeMenu:r,disabled:n=!1,textValue:i,...s}=e,a=fg(fS,r),o=fs(r),l=b.useRef(null),c=(0,aJ.useComposedRefs)(t,l),[u,d]=b.useState(!1),[h,p]=b.useState("");return b.useEffect(()=>{let e=l.current;e&&p((e.textContent??"").trim())},[s.children]),(0,v.jsx)(m7.ItemSlot,{scope:r,disabled:n,textValue:i??h,children:(0,v.jsx)(mZ,{asChild:!0,...o,focusable:!n,children:(0,v.jsx)(mL.div,{role:"menuitem","data-highlighted":u?"":void 0,"aria-disabled":n||void 0,"data-disabled":n?"":void 0,...s,ref:c,onPointerMove:(0,aK.composeEventHandlers)(e.onPointerMove,fX(e=>{n?a.onItemLeave(e):(a.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:(0,aK.composeEventHandlers)(e.onPointerLeave,fX(e=>a.onItemLeave(e))),onFocus:(0,aK.composeEventHandlers)(e.onFocus,()=>d(!0)),onBlur:(0,aK.composeEventHandlers)(e.onBlur,()=>d(!1))})})})}),f_=b.forwardRef((e,t)=>{let{checked:r=!1,onCheckedChange:n,...i}=e;return(0,v.jsx)(fD,{scope:e.__scopeMenu,checked:r,children:(0,v.jsx)(fA,{role:"menuitemcheckbox","aria-checked":fK(r)?"mixed":r,...i,ref:t,"data-state":fY(r),onSelect:(0,aK.composeEventHandlers)(i.onSelect,()=>n?.(!!fK(r)||!r),{checkForDefaultPrevented:!1})})})});f_.displayName="MenuCheckboxItem";var fT="MenuRadioGroup",[fE,fP]=fr(fT,{value:void 0,onValueChange:()=>{}}),fR=b.forwardRef((e,t)=>{let{value:r,onValueChange:n,...i}=e,s=(0,mB.useCallbackRef)(n);return(0,v.jsx)(fE,{scope:e.__scopeMenu,value:r,onValueChange:s,children:(0,v.jsx)(fk,{...i,ref:t})})});fR.displayName=fT;var fM="MenuRadioItem",fL=b.forwardRef((e,t)=>{let{value:r,...n}=e,i=fP(fM,e.__scopeMenu),s=r===i.value;return(0,v.jsx)(fD,{scope:e.__scopeMenu,checked:s,children:(0,v.jsx)(fA,{role:"menuitemradio","aria-checked":s,...n,ref:t,"data-state":fY(s),onSelect:(0,aK.composeEventHandlers)(n.onSelect,()=>i.onValueChange?.(r),{checkForDefaultPrevented:!1})})})});fL.displayName=fM;var fI="MenuItemIndicator",[fD,fO]=fr(fI,{checked:!1}),fB=b.forwardRef((e,t)=>{let{__scopeMenu:r,forceMount:n,...i}=e,s=fO(fI,r);return(0,v.jsx)(a1.Presence,{present:n||fK(s.checked)||!0===s.checked,children:(0,v.jsx)(mL.span,{...i,ref:t,"data-state":fY(s.checked)})})});fB.displayName=fI;var fF=b.forwardRef((e,t)=>{let{__scopeMenu:r,...n}=e;return(0,v.jsx)(mL.div,{role:"separator","aria-orientation":"horizontal",...n,ref:t})});fF.displayName="MenuSeparator";var fz=b.forwardRef((e,t)=>{let{__scopeMenu:r,...n}=e,i=fi(r);return(0,v.jsx)(mT.Arrow,{...i,...n,ref:t})});fz.displayName="MenuArrow";var[f$,fV]=fr("MenuSub"),fU="MenuSubTrigger",fW=b.forwardRef((e,t)=>{let r=fo(fU,e.__scopeMenu),n=fc(fU,e.__scopeMenu),i=fV(fU,e.__scopeMenu),s=fg(fU,e.__scopeMenu),a=b.useRef(null),{pointerGraceTimerRef:o,onPointerGraceIntentChange:l}=s,c={__scopeMenu:e.__scopeMenu},u=b.useCallback(()=>{a.current&&window.clearTimeout(a.current),a.current=null},[]);return b.useEffect(()=>u,[u]),b.useEffect(()=>{let e=o.current;return()=>{window.clearTimeout(e),l(null)}},[o,l]),(0,v.jsx)(fu,{asChild:!0,...c,children:(0,v.jsx)(fC,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":i.contentId,"data-state":fq(r.open),...e,ref:(0,aJ.composeRefs)(t,i.onTriggerChange),onClick:t=>{e.onClick?.(t),e.disabled||t.defaultPrevented||(t.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:(0,aK.composeEventHandlers)(e.onPointerMove,fX(t=>{s.onItemEnter(t),!t.defaultPrevented&&(e.disabled||r.open||a.current||(s.onPointerGraceIntentChange(null),a.current=window.setTimeout(()=>{r.onOpenChange(!0),u()},100)))})),onPointerLeave:(0,aK.composeEventHandlers)(e.onPointerLeave,fX(e=>{u();let t=r.content?.getBoundingClientRect();if(t){let n=r.content?.dataset.side,i="right"===n,a=t[i?"left":"right"],l=t[i?"right":"left"];s.onPointerGraceIntentChange({area:[{x:e.clientX+(i?-5:5),y:e.clientY},{x:a,y:t.top},{x:l,y:t.top},{x:l,y:t.bottom},{x:a,y:t.bottom}],side:n}),window.clearTimeout(o.current),o.current=window.setTimeout(()=>s.onPointerGraceIntentChange(null),300)}else{if(s.onTriggerLeave(e),e.defaultPrevented)return;s.onPointerGraceIntentChange(null)}})),onKeyDown:(0,aK.composeEventHandlers)(e.onKeyDown,t=>{let i=""!==s.searchRef.current;e.disabled||i&&" "===t.key||m4[n.dir].includes(t.key)&&(r.onOpenChange(!0),r.content?.focus(),t.preventDefault())})})})});fW.displayName=fU;var fG="MenuSubContent",fH=b.forwardRef((e,t)=>{let r=fp(fm,e.__scopeMenu),{forceMount:n=r.forceMount,...i}=e,s=fo(fm,e.__scopeMenu),a=fc(fm,e.__scopeMenu),o=fV(fG,e.__scopeMenu),l=b.useRef(null),c=(0,aJ.useComposedRefs)(t,l);return(0,v.jsx)(m7.Provider,{scope:e.__scopeMenu,children:(0,v.jsx)(a1.Presence,{present:n||s.open,children:(0,v.jsx)(m7.Slot,{scope:e.__scopeMenu,children:(0,v.jsx)(fw,{id:o.contentId,"aria-labelledby":o.triggerId,...i,ref:c,align:"start",side:"rtl"===a.dir?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{a.isUsingKeyboardRef.current&&l.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:(0,aK.composeEventHandlers)(e.onFocusOutside,e=>{e.target!==o.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:(0,aK.composeEventHandlers)(e.onEscapeKeyDown,e=>{a.onClose(),e.preventDefault()}),onKeyDown:(0,aK.composeEventHandlers)(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),r=m8[a.dir].includes(e.key);t&&r&&(s.onOpenChange(!1),o.trigger?.focus(),e.preventDefault())})})})})})});function fq(e){return e?"open":"closed"}function fK(e){return"indeterminate"===e}function fY(e){return fK(e)?"indeterminate":e?"checked":"unchecked"}function fX(e){return t=>"mouse"===t.pointerType?e(t):void 0}fH.displayName=fG;var fJ="DropdownMenu",[fZ,fQ]=function(e,t=[]){let r=[],n=()=>{let t=r.map(e=>b.createContext(e));return function(r){let n=r?.[e]||t;return b.useMemo(()=>({[`__scope${e}`]:{...r,[e]:n}}),[r,n])}};return n.scopeName=e,[function(t,n){let i=b.createContext(n),s=r.length;r=[...r,n];let a=t=>{let{scope:r,children:n,...a}=t,o=r?.[e]?.[s]||i,l=b.useMemo(()=>a,Object.values(a));return(0,v.jsx)(o.Provider,{value:l,children:n})};return a.displayName=t+"Provider",[a,function(r,a){let o=a?.[e]?.[s]||i,l=b.useContext(o);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 b.useMemo(()=>({[`__scope${t.scopeName}`]:n}),[n])}};return r.scopeName=t.scopeName,r}(n,...t)]}(fJ,[fn]),f0=fn(),[f1,f2]=fZ(fJ),f5="DropdownMenuTrigger";b.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,disabled:n=!1,...i}=e,s=f2(f5,r),a=f0(r);return(0,v.jsx)(fu,{asChild:!0,...a,children:(0,v.jsx)(mj.button,{type:"button",id:s.triggerId,"aria-haspopup":"menu","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":s.open?"open":"closed","data-disabled":n?"":void 0,disabled:n,...i,ref:(0,aJ.composeRefs)(t,s.triggerRef),onPointerDown:(0,aK.composeEventHandlers)(e.onPointerDown,e=>{!n&&0===e.button&&!1===e.ctrlKey&&(s.onOpenToggle(),s.open||e.preventDefault())}),onKeyDown:(0,aK.composeEventHandlers)(e.onKeyDown,e=>{!n&&(["Enter"," "].includes(e.key)&&s.onOpenToggle(),"ArrowDown"===e.key&&s.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(e.key)&&e.preventDefault())})})})}).displayName=f5;var f3="DropdownMenuContent";b.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,i=f2(f3,r),s=f0(r),a=b.useRef(!1);return(0,v.jsx)(fy,{id:i.contentId,"aria-labelledby":i.triggerId,...s,...n,ref:t,onCloseAutoFocus:(0,aK.composeEventHandlers)(e.onCloseAutoFocus,e=>{a.current||i.triggerRef.current?.focus(),a.current=!1,e.preventDefault()}),onInteractOutside:(0,aK.composeEventHandlers)(e.onInteractOutside,e=>{let t=e.detail.originalEvent,r=0===t.button&&!0===t.ctrlKey,n=2===t.button||r;(!i.modal||n)&&(a.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)"}})}).displayName=f3,b.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,i=f0(r);return(0,v.jsx)(fk,{...i,...n,ref:t})}).displayName="DropdownMenuGroup",b.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,i=f0(r);return(0,v.jsx)(fj,{...i,...n,ref:t})}).displayName="DropdownMenuLabel",b.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,i=f0(r);return(0,v.jsx)(fA,{...i,...n,ref:t})}).displayName="DropdownMenuItem",b.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,i=f0(r);return(0,v.jsx)(f_,{...i,...n,ref:t})}).displayName="DropdownMenuCheckboxItem",b.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,i=f0(r);return(0,v.jsx)(fR,{...i,...n,ref:t})}).displayName="DropdownMenuRadioGroup",b.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,i=f0(r);return(0,v.jsx)(fL,{...i,...n,ref:t})}).displayName="DropdownMenuRadioItem",b.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,i=f0(r);return(0,v.jsx)(fB,{...i,...n,ref:t})}).displayName="DropdownMenuItemIndicator",b.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,i=f0(r);return(0,v.jsx)(fF,{...i,...n,ref:t})}).displayName="DropdownMenuSeparator",b.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,i=f0(r);return(0,v.jsx)(fz,{...i,...n,ref:t})}).displayName="DropdownMenuArrow",b.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,i=f0(r);return(0,v.jsx)(fW,{...i,...n,ref:t})}).displayName="DropdownMenuSubTrigger",b.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,i=f0(r);return(0,v.jsx)(fH,{...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)"}})}).displayName="DropdownMenuSubContent";var f6=Symbol("radix.slottable");function f4(e){return b.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===f6}var f8=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{var r,n;let i,s,a,o=(n=r=`Primitive.${t}`,(i=b.forwardRef((e,t)=>{let{children:r,...n}=e;if(b.isValidElement(r)){var i;let e,s,a=(i=r,(s=(e=Object.getOwnPropertyDescriptor(i.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.ref:(s=(e=Object.getOwnPropertyDescriptor(i,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.props.ref:i.props.ref||i.ref),o=function(e,t){let r={...t};for(let n in t){let i=e[n],s=t[n];/^on[A-Z]/.test(n)?i&&s?r[n]=(...e)=>{let t=s(...e);return i(...e),t}:i&&(r[n]=i):"style"===n?r[n]={...i,...s}:"className"===n&&(r[n]=[i,s].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==b.Fragment&&(o.ref=t?(0,aJ.composeRefs)(t,a):a),b.cloneElement(r,o)}return b.Children.count(r)>1?b.Children.only(null):null})).displayName=`${n}.SlotClone`,s=i,(a=b.forwardRef((e,t)=>{let{children:r,...n}=e,i=b.Children.toArray(r),a=i.find(f4);if(a){let e=a.props.children,r=i.map(t=>t!==a?t:b.Children.count(e)>1?b.Children.only(null):b.isValidElement(e)?e.props.children:null);return(0,v.jsx)(s,{...n,ref:t,children:b.isValidElement(e)?b.cloneElement(e,void 0,r):null})}return(0,v.jsx)(s,{...n,ref:t,children:r})})).displayName=`${r}.Slot`,a),l=b.forwardRef((e,r)=>{let{asChild:n,...i}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,v.jsx)(n?o:t,{...i,ref:r})});return l.displayName=`Primitive.${t}`,{...e,[t]:l}},{}),f9="HoverCard",[f7,ge]=function(e,t=[]){let r=[],n=()=>{let t=r.map(e=>b.createContext(e));return function(r){let n=r?.[e]||t;return b.useMemo(()=>({[`__scope${e}`]:{...r,[e]:n}}),[r,n])}};return n.scopeName=e,[function(t,n){let i=b.createContext(n),s=r.length;r=[...r,n];let a=t=>{let{scope:r,children:n,...a}=t,o=r?.[e]?.[s]||i,l=b.useMemo(()=>a,Object.values(a));return(0,v.jsx)(o.Provider,{value:l,children:n})};return a.displayName=t+"Provider",[a,function(r,a){let o=a?.[e]?.[s]||i,l=b.useContext(o);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 b.useMemo(()=>({[`__scope${t.scopeName}`]:n}),[n])}};return r.scopeName=t.scopeName,r}(n,...t)]}(f9,[mT.createPopperScope]),gt=(0,mT.createPopperScope)(),[gr,gn]=f7(f9),gi="HoverCardTrigger";b.forwardRef((e,t)=>{let{__scopeHoverCard:r,...n}=e,i=gn(gi,r),s=gt(r);return(0,v.jsx)(mT.Anchor,{asChild:!0,...s,children:(0,v.jsx)(f8.a,{"data-state":i.open?"open":"closed",...n,ref:t,onPointerEnter:(0,aK.composeEventHandlers)(e.onPointerEnter,gc(i.onOpen)),onPointerLeave:(0,aK.composeEventHandlers)(e.onPointerLeave,gc(i.onClose)),onFocus:(0,aK.composeEventHandlers)(e.onFocus,i.onOpen),onBlur:(0,aK.composeEventHandlers)(e.onBlur,i.onClose),onTouchStart:(0,aK.composeEventHandlers)(e.onTouchStart,e=>e.preventDefault())})})}).displayName=gi;var[gs,ga]=f7("HoverCardPortal",{forceMount:void 0}),go="HoverCardContent";b.forwardRef((e,t)=>{let r=ga(go,e.__scopeHoverCard),{forceMount:n=r.forceMount,...i}=e,s=gn(go,e.__scopeHoverCard);return(0,v.jsx)(a1.Presence,{present:n||s.open,children:(0,v.jsx)(gl,{"data-state":s.open?"open":"closed",...i,onPointerEnter:(0,aK.composeEventHandlers)(e.onPointerEnter,gc(s.onOpen)),onPointerLeave:(0,aK.composeEventHandlers)(e.onPointerLeave,gc(s.onClose)),ref:t})})}).displayName=go;var gl=b.forwardRef((e,t)=>{let{__scopeHoverCard:r,onEscapeKeyDown:n,onPointerDownOutside:i,onFocusOutside:s,onInteractOutside:a,...o}=e,l=gn(go,r),c=gt(r),u=b.useRef(null),d=(0,aJ.useComposedRefs)(t,u),[h,p]=b.useState(!1);return b.useEffect(()=>{if(h){let e=document.body;return x=e.style.userSelect||e.style.webkitUserSelect,e.style.userSelect="none",e.style.webkitUserSelect="none",()=>{e.style.userSelect=x,e.style.webkitUserSelect=x}}},[h]),b.useEffect(()=>{if(u.current){let e=()=>{p(!1),l.isPointerDownOnContentRef.current=!1,setTimeout(()=>{document.getSelection()?.toString()!==""&&(l.hasSelectionRef.current=!0)})};return document.addEventListener("pointerup",e),()=>{document.removeEventListener("pointerup",e),l.hasSelectionRef.current=!1,l.isPointerDownOnContentRef.current=!1}}},[l.isPointerDownOnContentRef,l.hasSelectionRef]),b.useEffect(()=>{u.current&&(function(e){let t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP});for(;r.nextNode();)t.push(r.currentNode);return t})(u.current).forEach(e=>e.setAttribute("tabindex","-1"))}),(0,v.jsx)(mA.DismissableLayer,{asChild:!0,disableOutsidePointerEvents:!1,onInteractOutside:a,onEscapeKeyDown:n,onPointerDownOutside:i,onFocusOutside:(0,aK.composeEventHandlers)(s,e=>{e.preventDefault()}),onDismiss:l.onDismiss,children:(0,v.jsx)(mT.Content,{...c,...o,onPointerDown:(0,aK.composeEventHandlers)(o.onPointerDown,e=>{e.currentTarget.contains(e.target)&&p(!0),l.hasSelectionRef.current=!1,l.isPointerDownOnContentRef.current=!0}),ref:d,style:{...o.style,userSelect:h?"text":void 0,WebkitUserSelect:h?"text":void 0,"--radix-hover-card-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-hover-card-content-available-width":"var(--radix-popper-available-width)","--radix-hover-card-content-available-height":"var(--radix-popper-available-height)","--radix-hover-card-trigger-width":"var(--radix-popper-anchor-width)","--radix-hover-card-trigger-height":"var(--radix-popper-anchor-height)"}})})});function gc(e){return t=>"touch"===t.pointerType?void 0:e()}b.forwardRef((e,t)=>{let{__scopeHoverCard:r,...n}=e,i=gt(r);return(0,v.jsx)(mT.Arrow,{...i,...n,ref:t})}).displayName="HoverCardArrow";var gu=e.i(77982);function gd({className:e,...t}){return(0,v.jsx)("textarea",{"data-slot":"textarea",className:(0,j.cn)("border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),...t})}function gh({className:e,...t}){return(0,v.jsx)("div",{"data-slot":"input-group",role:"group",className:(0,j.cn)("group/input-group border-input dark:bg-input/30 relative flex w-full items-center rounded-md border shadow-xs transition-[color,box-shadow] outline-none","h-9 min-w-0 has-[>textarea]:h-auto","has-[>[data-align=inline-start]]:[&>input]:pl-2","has-[>[data-align=inline-end]]:[&>input]:pr-2","has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>[data-align=block-start]]:[&>input]:pb-3","has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-end]]:[&>input]:pt-3","has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot=input-group-control]:focus-visible]:ring-[3px]","has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[[data-slot][aria-invalid=true]]:border-destructive dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40",e),...t})}let gp=(0,N.cva)("text-muted-foreground flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium select-none [&>svg:not([class*='size-'])]:size-4 [&>kbd]:rounded-[calc(var(--radius)-5px)] group-data-[disabled=true]/input-group:opacity-50",{variants:{align:{"inline-start":"order-first pl-3 has-[>button]:ml-[-0.45rem] has-[>kbd]:ml-[-0.35rem]","inline-end":"order-last pr-3 has-[>button]:mr-[-0.45rem] has-[>kbd]:mr-[-0.35rem]","block-start":"order-first w-full justify-start px-3 pt-3 [.border-b]:pb-3 group-has-[>input]/input-group:pt-2.5","block-end":"order-last w-full justify-start px-3 pb-3 [.border-t]:pt-3 group-has-[>input]/input-group:pb-2.5"}},defaultVariants:{align:"inline-start"}});function gm({className:e,align:t="inline-start",...r}){return(0,v.jsx)("div",{role:"group","data-slot":"input-group-addon","data-align":t,className:(0,j.cn)(gp({align:t}),e),onClick:e=>{e.target.closest("button")||e.currentTarget.parentElement?.querySelector("input")?.focus()},...r})}let gf=(0,N.cva)("text-sm shadow-none flex gap-2 items-center",{variants:{size:{xs:"h-6 gap-1 px-2 rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-3.5 has-[>svg]:px-2",sm:"h-8 px-2.5 gap-1.5 rounded-md has-[>svg]:px-2.5","icon-xs":"size-6 rounded-[calc(var(--radius)-5px)] p-0 has-[>svg]:p-0","icon-sm":"size-8 p-0 has-[>svg]:p-0"}},defaultVariants:{size:"xs"}});function gg({className:e,type:t="button",variant:r="ghost",size:n="xs",...i}){return(0,v.jsx)(_.Button,{type:t,"data-size":n,variant:r,className:(0,j.cn)(gf({size:n}),e),...i})}function gy({className:e,...t}){return(0,v.jsx)(gd,{"data-slot":"input-group-control",className:(0,j.cn)("flex-1 resize-none rounded-none border-0 bg-transparent py-3 shadow-none focus-visible:ring-0 dark:bg-transparent",e),...t})}let gx=(0,E.default)("corner-down-left",[["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}],["path",{d:"m9 10-5 5 5 5",key:"1kshq7"}]]),gv=(0,E.default)("image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);var gb=e.i(675182),gb=gb,gw=e.i(257868),gw=gw;let gk=(0,E.default)("square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]),gj=(e=21)=>{let t="",r=crypto.getRandomValues(new Uint8Array(e|=0));for(;e--;)t+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[63&r[e]];return t},gS=(0,b.createContext)(null),gN=(0,b.createContext)(null),gA=()=>(0,b.useContext)(gS),gC=(0,b.createContext)(null),g_=()=>{let e=(0,b.useContext)(gN),t=(0,b.useContext)(gC)??e;if(!t)throw Error("usePromptInputAttachments must be used within a PromptInput or PromptInputProvider");return t},gT=(0,b.createContext)(null),gE=({className:e,accept:t,multiple:r,globalDrop:n,syncHiddenInput:i,maxFiles:s,maxFileSize:a,onError:o,onSubmit:l,children:c,...u})=>{let d=gA(),h=!!d,p=(0,b.useRef)(null),m=(0,b.useRef)(null),[f,g]=(0,b.useState)([]),y=h?d.attachments.files:f,[x,w]=(0,b.useState)([]),k=(0,b.useRef)(y);k.current=y;let S=(0,b.useCallback)(()=>{p.current?.click()},[]),N=(0,b.useCallback)(e=>!t||""===t.trim()||t.split(",").map(e=>e.trim()).filter(Boolean).some(t=>{if(t.endsWith("/*")){let r=t.slice(0,-1);return e.type.startsWith(r)}return e.type===t}),[t]),A=(0,b.useCallback)(e=>{let t=Array.from(e),r=t.filter(e=>N(e));if(t.length&&0===r.length)return void o?.({code:"accept",message:"No files match the accepted types."});let n=r.filter(e=>!a||e.size<=a);r.length>0&&0===n.length?o?.({code:"max_file_size",message:"All files exceed the maximum size."}):g(e=>{let t="number"==typeof s?Math.max(0,s-e.length):void 0,r="number"==typeof t?n.slice(0,t):n;"number"==typeof t&&n.length>t&&o?.({code:"max_files",message:"Too many files. Some were not added."});let i=[];for(let e of r)i.push({id:gj(),type:"file",url:URL.createObjectURL(e),mediaType:e.type,filename:e.name});return e.concat(i)})},[N,s,a,o]),C=(0,b.useCallback)(e=>g(t=>{let r=t.find(t=>t.id===e);return r?.url&&URL.revokeObjectURL(r.url),t.filter(t=>t.id!==e)}),[]),_=(0,b.useCallback)(e=>{let t=Array.from(e),r=t.filter(e=>N(e));if(t.length&&0===r.length)return void o?.({code:"accept",message:"No files match the accepted types."});let n=r.filter(e=>!a||e.size<=a);if(r.length>0&&0===n.length)return void o?.({code:"max_file_size",message:"All files exceed the maximum size."});let i=y.length,l="number"==typeof s?Math.max(0,s-i):void 0,c="number"==typeof l?n.slice(0,l):n;"number"==typeof l&&n.length>l&&o?.({code:"max_files",message:"Too many files. Some were not added."}),c.length>0&&d?.attachments.add(c)},[N,a,s,o,y.length,d]),T=(0,b.useCallback)(()=>h?d?.attachments.clear():g(e=>{for(let t of e)t.url&&URL.revokeObjectURL(t.url);return[]}),[h,d]),E=(0,b.useCallback)(()=>w([]),[]),P=h?_:A,R=h?d.attachments.remove:C,M=h?d.attachments.openFileDialog:S,L=(0,b.useCallback)(()=>{T(),E()},[T,E]);(0,b.useEffect)(()=>{h&&d.__registerFileInput(p,()=>p.current?.click())},[h,d]),(0,b.useEffect)(()=>{i&&p.current&&0===y.length&&(p.current.value="")},[y,i]),(0,b.useEffect)(()=>{let e=m.current;if(!e||n)return;let t=e=>{e.dataTransfer?.types?.includes("Files")&&e.preventDefault()},r=e=>{e.dataTransfer?.types?.includes("Files")&&e.preventDefault(),e.dataTransfer?.files&&e.dataTransfer.files.length>0&&P(e.dataTransfer.files)};return e.addEventListener("dragover",t),e.addEventListener("drop",r),()=>{e.removeEventListener("dragover",t),e.removeEventListener("drop",r)}},[P,n]),(0,b.useEffect)(()=>{if(!n)return;let e=e=>{e.dataTransfer?.types?.includes("Files")&&e.preventDefault()},t=e=>{e.dataTransfer?.types?.includes("Files")&&e.preventDefault(),e.dataTransfer?.files&&e.dataTransfer.files.length>0&&P(e.dataTransfer.files)};return document.addEventListener("dragover",e),document.addEventListener("drop",t),()=>{document.removeEventListener("dragover",e),document.removeEventListener("drop",t)}},[P,n]),(0,b.useEffect)(()=>()=>{if(!h)for(let e of k.current)e.url&&URL.revokeObjectURL(e.url)},[h]);let I=async e=>{try{let t=await fetch(e),r=await t.blob();return new Promise(e=>{let t=new FileReader;t.onloadend=()=>e(t.result),t.onerror=()=>e(null),t.readAsDataURL(r)})}catch{return null}},D=(0,b.useMemo)(()=>({files:y.map(e=>({...e,id:e.id})),add:P,remove:R,clear:T,openFileDialog:M,fileInputRef:p}),[y,P,R,T,M]),O=(0,b.useMemo)(()=>({sources:x,add:e=>{let t=Array.isArray(e)?e:[e];w(e=>e.concat(t.map(e=>({...e,id:gj()}))))},remove:e=>{w(t=>t.filter(t=>t.id!==e))},clear:E}),[x,E]),B=(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)("input",{accept:t,"aria-label":"Upload files",className:"hidden",multiple:r,onChange:e=>{e.currentTarget.files&&P(e.currentTarget.files),e.currentTarget.value=""},ref:p,title:"Upload files",type:"file"}),(0,v.jsx)("form",{className:(0,j.cn)("w-full",e),onSubmit:e=>{e.preventDefault();let t=e.currentTarget,r=h?d.textInput.value:new FormData(t).get("message")||"";h||t.reset(),Promise.all(y.map(async({id:e,...t})=>{if(t.url?.startsWith("blob:")){let e=await I(t.url);return{...t,url:e??t.url}}return t})).then(t=>{try{let n=l({text:r,files:t},e);n instanceof Promise?n.then(()=>{L(),h&&d.textInput.clear()}).catch(()=>{}):(L(),h&&d.textInput.clear())}catch{}}).catch(()=>{})},ref:m,...u,children:(0,v.jsx)(gh,{className:"overflow-hidden",children:c})})]}),F=(0,v.jsx)(gT.Provider,{value:O,children:B});return(0,v.jsx)(gC.Provider,{value:D,children:F})},gP=({className:e,...t})=>(0,v.jsx)("div",{className:(0,j.cn)("contents",e),...t}),gR=({onChange:e,onKeyDown:t,className:r,placeholder:n="What would you like to know?",...i})=>{let s=gA(),a=g_(),[o,l]=(0,b.useState)(!1),c=s?{value:s.textInput.value,onChange:t=>{s.textInput.setInput(t.currentTarget.value),e?.(t)}}:{onChange:e};return(0,v.jsx)(gy,{className:(0,j.cn)("field-sizing-content max-h-48 min-h-10",r),name:"message",onCompositionEnd:()=>l(!1),onCompositionStart:()=>l(!0),onKeyDown:e=>{if(t?.(e),!e.defaultPrevented){if("Enter"===e.key){if(o||e.nativeEvent.isComposing||e.shiftKey)return;e.preventDefault();let t=e.currentTarget.form,r=t?.querySelector('button[type="submit"]');if(r?.disabled)return;t?.requestSubmit()}if("Backspace"===e.key&&""===e.currentTarget.value&&a.files.length>0){e.preventDefault();let t=a.files.at(-1);t&&a.remove(t.id)}}},onPaste:e=>{let t=e.clipboardData?.items;if(!t)return;let r=[];for(let e of t)if("file"===e.kind){let t=e.getAsFile();t&&r.push(t)}r.length>0&&(e.preventDefault(),a.add(r))},placeholder:n,...i,...c})},gM=({className:e,...t})=>(0,v.jsx)(gm,{align:"block-end",className:(0,j.cn)("order-first flex-wrap gap-1",e),...t}),gL=({className:e,...t})=>(0,v.jsx)(gm,{align:"block-end",className:(0,j.cn)("justify-between gap-1",e),...t}),gI=({className:e,variant:t="default",size:r="icon-sm",status:n,onStop:i,onClick:s,children:a,...o})=>{let l="submitted"===n||"streaming"===n,c=(0,v.jsx)(gx,{className:"size-4"});return"submitted"===n?c=(0,v.jsx)(gb.default,{className:"size-4 animate-spin"}):"streaming"===n?c=(0,v.jsx)(gk,{className:"size-4"}):"error"===n&&(c=(0,v.jsx)(aB.XIcon,{className:"size-4"})),(0,v.jsx)(gg,{"aria-label":l?"Stop":"Submit",className:(0,j.cn)(e),onClick:e=>{if(l&&i){e.preventDefault(),i();return}s?.(e)},size:r,type:l&&i?"button":"submit",variant:t,...o,children:a??c})},gD=(0,E.default)("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"}]]),gO=(0,E.default)("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"}]]),gB=(0,E.default)("music-2",[["circle",{cx:"8",cy:"18",r:"4",key:"1fc0mg"}],["path",{d:"M12 18V2l7 4",key:"g04rme"}]]),gF=(0,E.default)("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"}]]),gz=(0,E.default)("video",[["path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",key:"ftymec"}],["rect",{x:"2",y:"6",width:"14",height:"12",rx:"2",key:"158x01"}]]),g$=e=>{if("source-document"===e.type)return"source";let t=e.mediaType??"";return t.startsWith("image/")?"image":t.startsWith("video/")?"video":t.startsWith("audio/")?"audio":t.startsWith("application/")||t.startsWith("text/")?"document":"unknown"},gV=(0,b.createContext)(null),gU=(0,b.createContext)(null),gW=()=>{let e=(0,b.useContext)(gU);if(!e)throw Error("Attachment components must be used within <Attachment>");return e},gG=({variant:e="grid",className:t,children:r,...n})=>{let i=(0,b.useMemo)(()=>({variant:e}),[e]);return(0,v.jsx)(gV.Provider,{value:i,children:(0,v.jsx)("div",{className:(0,j.cn)("flex items-start","list"===e?"flex-col gap-2":"flex-wrap gap-2","grid"===e&&"ml-auto w-fit",t),...n,children:r})})},gH=({data:e,onRemove:t,className:r,children:n,...i})=>{let{variant:s}=(0,b.useContext)(gV)??{variant:"grid"},a=g$(e),o=(0,b.useMemo)(()=>({data:e,mediaCategory:a,onRemove:t,variant:s}),[e,a,t,s]);return(0,v.jsx)(gU.Provider,{value:o,children:(0,v.jsx)("div",{className:(0,j.cn)("group relative","grid"===s&&"size-24 overflow-hidden rounded-lg","inline"===s&&["flex h-8 cursor-pointer select-none items-center gap-1.5","rounded-md border border-border px-1.5","font-medium text-sm transition-all","hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50"],"list"===s&&["flex w-full items-center gap-3 rounded-lg border p-3","hover:bg-accent/50"],r),...i,children:n})})},gq=({fallbackIcon:e,className:t,...r})=>{let{data:n,mediaCategory:i,variant:s}=gW(),a="inline"===s?"size-3":"size-4";return(0,v.jsx)("div",{className:(0,j.cn)("flex shrink-0 items-center justify-center overflow-hidden","grid"===s&&"size-full bg-muted","inline"===s&&"size-5 rounded bg-background","list"===s&&"size-12 rounded bg-muted",t),...r,children:(()=>{let t;if("image"===i&&"file"===n.type&&n.url){let e,t;return e=n.url,t=n.filename,"grid"===s?(0,v.jsx)("img",{alt:t||"Image",className:"size-full object-cover",height:96,src:e,width:96}):(0,v.jsx)("img",{alt:t||"Image",className:"size-full rounded object-cover",height:20,src:e,width:20})}return"video"===i&&"file"===n.type&&n.url?(0,v.jsx)("video",{className:"size-full object-cover",muted:!0,src:n.url}):e??(t=({image:gv,video:gz,audio:gB,source:gO,document:gD,unknown:gF})[i],(0,v.jsx)(t,{className:(0,j.cn)(a,"text-muted-foreground")}))})()})},gK=({showMediaType:e=!1,className:t,...r})=>{let{data:n,variant:i}=gW(),s=(e=>{if("source-document"===e.type)return e.title||e.filename||"Source";let t=g$(e);return e.filename||("image"===t?"Image":"Attachment")})(n);return"grid"===i?null:(0,v.jsxs)("div",{className:(0,j.cn)("min-w-0 flex-1",t),...r,children:[(0,v.jsx)("span",{className:"block truncate",children:s}),e&&n.mediaType&&(0,v.jsx)("span",{className:"block truncate text-muted-foreground text-xs",children:n.mediaType})]})},gY=({label:e="Remove",className:t,children:r,...n})=>{let{onRemove:i,variant:s}=gW();return i?(0,v.jsxs)(_.Button,{"aria-label":e,className:(0,j.cn)("grid"===s&&["absolute top-2 right-2 size-6 rounded-full p-0","bg-background/80 backdrop-blur-sm","opacity-0 transition-opacity group-hover:opacity-100","hover:bg-background","[&>svg]:size-3"],"inline"===s&&["size-5 rounded p-0","opacity-0 transition-opacity group-hover:opacity-100","[&>svg]:size-2.5"],"list"===s&&["size-8 shrink-0 rounded p-0","[&>svg]:size-4"],t),onClick:e=>{e.stopPropagation(),i()},type:"button",variant:"ghost",...n,children:[r??(0,v.jsx)(aB.XIcon,{}),(0,v.jsx)("span",{className:"sr-only",children:e})]}):null};var gX=Symbol("radix.slottable");function gJ(e){return b.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===gX}var gZ=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{var r,n;let i,s,a,o=(n=r=`Primitive.${t}`,(i=b.forwardRef((e,t)=>{let{children:r,...n}=e;if(b.isValidElement(r)){var i;let e,s,a=(i=r,(s=(e=Object.getOwnPropertyDescriptor(i.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.ref:(s=(e=Object.getOwnPropertyDescriptor(i,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.props.ref:i.props.ref||i.ref),o=function(e,t){let r={...t};for(let n in t){let i=e[n],s=t[n];/^on[A-Z]/.test(n)?i&&s?r[n]=(...e)=>{let t=s(...e);return i(...e),t}:i&&(r[n]=i):"style"===n?r[n]={...i,...s}:"className"===n&&(r[n]=[i,s].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==b.Fragment&&(o.ref=t?(0,aJ.composeRefs)(t,a):a),b.cloneElement(r,o)}return b.Children.count(r)>1?b.Children.only(null):null})).displayName=`${n}.SlotClone`,s=i,(a=b.forwardRef((e,t)=>{let{children:r,...n}=e,i=b.Children.toArray(r),a=i.find(gJ);if(a){let e=a.props.children,r=i.map(t=>t!==a?t:b.Children.count(e)>1?b.Children.only(null):b.isValidElement(e)?e.props.children:null);return(0,v.jsx)(s,{...n,ref:t,children:b.isValidElement(e)?b.cloneElement(e,void 0,r):null})}return(0,v.jsx)(s,{...n,ref:t,children:r})})).displayName=`${r}.Slot`,a),l=b.forwardRef((e,r)=>{let{asChild:n,...i}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,v.jsx)(n?o:t,{...i,ref:r})});return l.displayName=`Primitive.${t}`,{...e,[t]:l}},{}),gQ=e.i(992421),g0="ScrollArea",[g1,g2]=function(e,t=[]){let r=[],n=()=>{let t=r.map(e=>b.createContext(e));return function(r){let n=r?.[e]||t;return b.useMemo(()=>({[`__scope${e}`]:{...r,[e]:n}}),[r,n])}};return n.scopeName=e,[function(t,n){let i=b.createContext(n),s=r.length;r=[...r,n];let a=t=>{let{scope:r,children:n,...a}=t,o=r?.[e]?.[s]||i,l=b.useMemo(()=>a,Object.values(a));return(0,v.jsx)(o.Provider,{value:l,children:n})};return a.displayName=t+"Provider",[a,function(r,a){let o=a?.[e]?.[s]||i,l=b.useContext(o);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 b.useMemo(()=>({[`__scope${t.scopeName}`]:n}),[n])}};return r.scopeName=t.scopeName,r}(n,...t)]}(g0),[g5,g3]=g1(g0),g6=b.forwardRef((e,t)=>{let{__scopeScrollArea:r,type:n="hover",dir:i,scrollHideDelay:s=600,...a}=e,[o,l]=b.useState(null),[c,u]=b.useState(null),[d,h]=b.useState(null),[p,m]=b.useState(null),[f,g]=b.useState(null),[y,x]=b.useState(0),[w,k]=b.useState(0),[j,S]=b.useState(!1),[N,A]=b.useState(!1),C=(0,aJ.useComposedRefs)(t,e=>l(e)),_=(0,mN.useDirection)(i);return(0,v.jsx)(g5,{scope:r,type:n,dir:_,scrollHideDelay:s,scrollArea:o,viewport:c,onViewportChange:u,content:d,onContentChange:h,scrollbarX:p,onScrollbarXChange:m,scrollbarXEnabled:j,onScrollbarXEnabledChange:S,scrollbarY:f,onScrollbarYChange:g,scrollbarYEnabled:N,onScrollbarYEnabledChange:A,onCornerWidthChange:x,onCornerHeightChange:k,children:(0,v.jsx)(gZ.div,{dir:_,...a,ref:C,style:{position:"relative","--radix-scroll-area-corner-width":y+"px","--radix-scroll-area-corner-height":w+"px",...e.style}})})});g6.displayName=g0;var g4="ScrollAreaViewport",g8=b.forwardRef((e,t)=>{let{__scopeScrollArea:r,children:n,nonce:i,...s}=e,a=g3(g4,r),o=b.useRef(null),l=(0,aJ.useComposedRefs)(t,o,a.onViewportChange);return(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:i}),(0,v.jsx)(gZ.div,{"data-radix-scroll-area-viewport":"",...s,ref:l,style:{overflowX:a.scrollbarXEnabled?"scroll":"hidden",overflowY:a.scrollbarYEnabled?"scroll":"hidden",...e.style},children:(0,v.jsx)("div",{ref:a.onContentChange,style:{minWidth:"100%",display:"table"},children:n})})]})});g8.displayName=g4;var g9="ScrollAreaScrollbar",g7=b.forwardRef((e,t)=>{let{forceMount:r,...n}=e,i=g3(g9,e.__scopeScrollArea),{onScrollbarXEnabledChange:s,onScrollbarYEnabledChange:a}=i,o="horizontal"===e.orientation;return b.useEffect(()=>(o?s(!0):a(!0),()=>{o?s(!1):a(!1)}),[o,s,a]),"hover"===i.type?(0,v.jsx)(ye,{...n,ref:t,forceMount:r}):"scroll"===i.type?(0,v.jsx)(yt,{...n,ref:t,forceMount:r}):"auto"===i.type?(0,v.jsx)(yr,{...n,ref:t,forceMount:r}):"always"===i.type?(0,v.jsx)(yn,{...n,ref:t}):null});g7.displayName=g9;var ye=b.forwardRef((e,t)=>{let{forceMount:r,...n}=e,i=g3(g9,e.__scopeScrollArea),[s,a]=b.useState(!1);return b.useEffect(()=>{let e=i.scrollArea,t=0;if(e){let r=()=>{window.clearTimeout(t),a(!0)},n=()=>{t=window.setTimeout(()=>a(!1),i.scrollHideDelay)};return e.addEventListener("pointerenter",r),e.addEventListener("pointerleave",n),()=>{window.clearTimeout(t),e.removeEventListener("pointerenter",r),e.removeEventListener("pointerleave",n)}}},[i.scrollArea,i.scrollHideDelay]),(0,v.jsx)(a1.Presence,{present:r||s,children:(0,v.jsx)(yr,{"data-state":s?"visible":"hidden",...n,ref:t})})}),yt=b.forwardRef((e,t)=>{var r;let{forceMount:n,...i}=e,s=g3(g9,e.__scopeScrollArea),a="horizontal"===e.orientation,o=yw(()=>c("SCROLL_END"),100),[l,c]=(r={hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}},b.useReducer((e,t)=>r[e][t]??e,"hidden"));return b.useEffect(()=>{if("idle"===l){let e=window.setTimeout(()=>c("HIDE"),s.scrollHideDelay);return()=>window.clearTimeout(e)}},[l,s.scrollHideDelay,c]),b.useEffect(()=>{let e=s.viewport,t=a?"scrollLeft":"scrollTop";if(e){let r=e[t],n=()=>{let n=e[t];r!==n&&(c("SCROLL"),o()),r=n};return e.addEventListener("scroll",n),()=>e.removeEventListener("scroll",n)}},[s.viewport,a,c,o]),(0,v.jsx)(a1.Presence,{present:n||"hidden"!==l,children:(0,v.jsx)(yn,{"data-state":"hidden"===l?"hidden":"visible",...i,ref:t,onPointerEnter:(0,aK.composeEventHandlers)(e.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:(0,aK.composeEventHandlers)(e.onPointerLeave,()=>c("POINTER_LEAVE"))})})}),yr=b.forwardRef((e,t)=>{let r=g3(g9,e.__scopeScrollArea),{forceMount:n,...i}=e,[s,a]=b.useState(!1),o="horizontal"===e.orientation,l=yw(()=>{if(r.viewport){let e=r.viewport.offsetWidth<r.viewport.scrollWidth,t=r.viewport.offsetHeight<r.viewport.scrollHeight;a(o?e:t)}},10);return yk(r.viewport,l),yk(r.content,l),(0,v.jsx)(a1.Presence,{present:n||s,children:(0,v.jsx)(yn,{"data-state":s?"visible":"hidden",...i,ref:t})})}),yn=b.forwardRef((e,t)=>{let{orientation:r="vertical",...n}=e,i=g3(g9,e.__scopeScrollArea),s=b.useRef(null),a=b.useRef(0),[o,l]=b.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),c=yg(o.viewport,o.content),u={...n,sizes:o,onSizesChange:l,hasThumb:!!(c>0&&c<1),onThumbChange:e=>s.current=e,onThumbPointerUp:()=>a.current=0,onThumbPointerDown:e=>a.current=e};function d(e,t){return function(e,t,r,n="ltr"){let i=yy(r),s=t||i/2,a=r.scrollbar.paddingStart+s,o=r.scrollbar.size-r.scrollbar.paddingEnd-(i-s),l=r.content-r.viewport;return yv([a,o],"ltr"===n?[0,l]:[-1*l,0])(e)}(e,a.current,o,t)}return"horizontal"===r?(0,v.jsx)(yi,{...u,ref:t,onThumbPositionChange:()=>{if(i.viewport&&s.current){let e=yx(i.viewport.scrollLeft,o,i.dir);s.current.style.transform=`translate3d(${e}px, 0, 0)`}},onWheelScroll:e=>{i.viewport&&(i.viewport.scrollLeft=e)},onDragScroll:e=>{i.viewport&&(i.viewport.scrollLeft=d(e,i.dir))}}):"vertical"===r?(0,v.jsx)(ys,{...u,ref:t,onThumbPositionChange:()=>{if(i.viewport&&s.current){let e=yx(i.viewport.scrollTop,o);s.current.style.transform=`translate3d(0, ${e}px, 0)`}},onWheelScroll:e=>{i.viewport&&(i.viewport.scrollTop=e)},onDragScroll:e=>{i.viewport&&(i.viewport.scrollTop=d(e))}}):null}),yi=b.forwardRef((e,t)=>{let{sizes:r,onSizesChange:n,...i}=e,s=g3(g9,e.__scopeScrollArea),[a,o]=b.useState(),l=b.useRef(null),c=(0,aJ.useComposedRefs)(t,l,s.onScrollbarXChange);return b.useEffect(()=>{l.current&&o(getComputedStyle(l.current))},[l]),(0,v.jsx)(yl,{"data-orientation":"horizontal",...i,ref:c,sizes:r,style:{bottom:0,left:"rtl"===s.dir?"var(--radix-scroll-area-corner-width)":0,right:"ltr"===s.dir?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":yy(r)+"px",...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.x),onDragScroll:t=>e.onDragScroll(t.x),onWheelScroll:(t,r)=>{if(s.viewport){var n,i;let a=s.viewport.scrollLeft+t.deltaX;e.onWheelScroll(a),n=a,i=r,n>0&&n<i&&t.preventDefault()}},onResize:()=>{l.current&&s.viewport&&a&&n({content:s.viewport.scrollWidth,viewport:s.viewport.offsetWidth,scrollbar:{size:l.current.clientWidth,paddingStart:yf(a.paddingLeft),paddingEnd:yf(a.paddingRight)}})}})}),ys=b.forwardRef((e,t)=>{let{sizes:r,onSizesChange:n,...i}=e,s=g3(g9,e.__scopeScrollArea),[a,o]=b.useState(),l=b.useRef(null),c=(0,aJ.useComposedRefs)(t,l,s.onScrollbarYChange);return b.useEffect(()=>{l.current&&o(getComputedStyle(l.current))},[l]),(0,v.jsx)(yl,{"data-orientation":"vertical",...i,ref:c,sizes:r,style:{top:0,right:"ltr"===s.dir?0:void 0,left:"rtl"===s.dir?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":yy(r)+"px",...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.y),onDragScroll:t=>e.onDragScroll(t.y),onWheelScroll:(t,r)=>{if(s.viewport){var n,i;let a=s.viewport.scrollTop+t.deltaY;e.onWheelScroll(a),n=a,i=r,n>0&&n<i&&t.preventDefault()}},onResize:()=>{l.current&&s.viewport&&a&&n({content:s.viewport.scrollHeight,viewport:s.viewport.offsetHeight,scrollbar:{size:l.current.clientHeight,paddingStart:yf(a.paddingTop),paddingEnd:yf(a.paddingBottom)}})}})}),[ya,yo]=g1(g9),yl=b.forwardRef((e,t)=>{let{__scopeScrollArea:r,sizes:n,hasThumb:i,onThumbChange:s,onThumbPointerUp:a,onThumbPointerDown:o,onThumbPositionChange:l,onDragScroll:c,onWheelScroll:u,onResize:d,...h}=e,p=g3(g9,r),[m,f]=b.useState(null),g=(0,aJ.useComposedRefs)(t,e=>f(e)),y=b.useRef(null),x=b.useRef(""),w=p.viewport,k=n.content-n.viewport,j=(0,mB.useCallbackRef)(u),S=(0,mB.useCallbackRef)(l),N=yw(d,10);function A(e){y.current&&c({x:e.clientX-y.current.left,y:e.clientY-y.current.top})}return b.useEffect(()=>{let e=e=>{let t=e.target;m?.contains(t)&&j(e,k)};return document.addEventListener("wheel",e,{passive:!1}),()=>document.removeEventListener("wheel",e,{passive:!1})},[w,m,k,j]),b.useEffect(S,[n,S]),yk(m,N),yk(p.content,N),(0,v.jsx)(ya,{scope:r,scrollbar:m,hasThumb:i,onThumbChange:(0,mB.useCallbackRef)(s),onThumbPointerUp:(0,mB.useCallbackRef)(a),onThumbPositionChange:S,onThumbPointerDown:(0,mB.useCallbackRef)(o),children:(0,v.jsx)(gZ.div,{...h,ref:g,style:{position:"absolute",...h.style},onPointerDown:(0,aK.composeEventHandlers)(e.onPointerDown,e=>{0===e.button&&(e.target.setPointerCapture(e.pointerId),y.current=m.getBoundingClientRect(),x.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",p.viewport&&(p.viewport.style.scrollBehavior="auto"),A(e))}),onPointerMove:(0,aK.composeEventHandlers)(e.onPointerMove,A),onPointerUp:(0,aK.composeEventHandlers)(e.onPointerUp,e=>{let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),document.body.style.webkitUserSelect=x.current,p.viewport&&(p.viewport.style.scrollBehavior=""),y.current=null})})})}),yc="ScrollAreaThumb",yu=b.forwardRef((e,t)=>{let{forceMount:r,...n}=e,i=yo(yc,e.__scopeScrollArea);return(0,v.jsx)(a1.Presence,{present:r||i.hasThumb,children:(0,v.jsx)(yd,{ref:t,...n})})}),yd=b.forwardRef((e,t)=>{let{__scopeScrollArea:r,style:n,...i}=e,s=g3(yc,r),a=yo(yc,r),{onThumbPositionChange:o}=a,l=(0,aJ.useComposedRefs)(t,e=>a.onThumbChange(e)),c=b.useRef(void 0),u=yw(()=>{c.current&&(c.current(),c.current=void 0)},100);return b.useEffect(()=>{let e=s.viewport;if(e){let t=()=>{u(),c.current||(c.current=yb(e,o),o())};return o(),e.addEventListener("scroll",t),()=>e.removeEventListener("scroll",t)}},[s.viewport,u,o]),(0,v.jsx)(gZ.div,{"data-state":a.hasThumb?"visible":"hidden",...i,ref:l,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...n},onPointerDownCapture:(0,aK.composeEventHandlers)(e.onPointerDownCapture,e=>{let t=e.target.getBoundingClientRect(),r=e.clientX-t.left,n=e.clientY-t.top;a.onThumbPointerDown({x:r,y:n})}),onPointerUp:(0,aK.composeEventHandlers)(e.onPointerUp,a.onThumbPointerUp)})});yu.displayName=yc;var yh="ScrollAreaCorner",yp=b.forwardRef((e,t)=>{let r=g3(yh,e.__scopeScrollArea),n=!!(r.scrollbarX&&r.scrollbarY);return"scroll"!==r.type&&n?(0,v.jsx)(ym,{...e,ref:t}):null});yp.displayName=yh;var ym=b.forwardRef((e,t)=>{let{__scopeScrollArea:r,...n}=e,i=g3(yh,r),[s,a]=b.useState(0),[o,l]=b.useState(0),c=!!(s&&o);return yk(i.scrollbarX,()=>{let e=i.scrollbarX?.offsetHeight||0;i.onCornerHeightChange(e),l(e)}),yk(i.scrollbarY,()=>{let e=i.scrollbarY?.offsetWidth||0;i.onCornerWidthChange(e),a(e)}),c?(0,v.jsx)(gZ.div,{...n,ref:t,style:{width:s,height:o,position:"absolute",right:"ltr"===i.dir?0:void 0,left:"rtl"===i.dir?0:void 0,bottom:0,...e.style}}):null});function yf(e){return e?parseInt(e,10):0}function yg(e,t){let r=e/t;return isNaN(r)?0:r}function yy(e){let t=yg(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd;return Math.max((e.scrollbar.size-r)*t,18)}function yx(e,t,r="ltr"){let n=yy(t),i=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,s=t.scrollbar.size-i,a=t.content-t.viewport,o=(0,gQ.clamp)(e,"ltr"===r?[0,a]:[-1*a,0]);return yv([0,a],[0,s-n])(o)}function yv(e,t){return r=>{if(e[0]===e[1]||t[0]===t[1])return t[0];let n=(t[1]-t[0])/(e[1]-e[0]);return t[0]+n*(r-e[0])}}var yb=(e,t=()=>{})=>{let r={left:e.scrollLeft,top:e.scrollTop},n=0;return!function i(){let s={left:e.scrollLeft,top:e.scrollTop},a=r.left!==s.left,o=r.top!==s.top;(a||o)&&t(),r=s,n=window.requestAnimationFrame(i)}(),()=>window.cancelAnimationFrame(n)};function yw(e,t){let r=(0,mB.useCallbackRef)(e),n=b.useRef(0);return b.useEffect(()=>()=>window.clearTimeout(n.current),[]),b.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(r,t)},[r,t])}function yk(e,t){let r=(0,mB.useCallbackRef)(t);(0,aX.useLayoutEffect)(()=>{let t=0;if(e){let n=new ResizeObserver(()=>{cancelAnimationFrame(t),t=window.requestAnimationFrame(r)});return n.observe(e),()=>{window.cancelAnimationFrame(t),n.unobserve(e)}}},[e,r])}function yj({className:e,children:t,...r}){return(0,v.jsxs)(g6,{"data-slot":"scroll-area",className:(0,j.cn)("relative",e),...r,children:[(0,v.jsx)(g8,{"data-slot":"scroll-area-viewport",className:"focus-visible:ring-ring/50 size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1",children:t}),(0,v.jsx)(yS,{}),(0,v.jsx)(yp,{})]})}function yS({className:e,orientation:t="vertical",...r}){return(0,v.jsx)(g7,{"data-slot":"scroll-area-scrollbar",orientation:t,className:(0,j.cn)("flex touch-none p-px transition-colors select-none","vertical"===t&&"h-full w-2.5 border-l border-l-transparent","horizontal"===t&&"h-2.5 flex-col border-t border-t-transparent",e),...r,children:(0,v.jsx)(yu,{"data-slot":"scroll-area-thumb",className:"bg-border relative flex-1 rounded-full"})})}let yN=({className:e,children:t,...r})=>(0,v.jsxs)(yj,{className:"w-full overflow-x-auto whitespace-nowrap",...r,children:[(0,v.jsx)("div",{className:(0,j.cn)("flex w-max flex-nowrap items-center gap-2",e),children:t}),(0,v.jsx)(yS,{className:"hidden",orientation:"horizontal"})]}),yA=({suggestion:e,onClick:t,className:r,variant:n="outline",size:i="sm",children:s,...a})=>(0,v.jsx)(_.Button,{className:(0,j.cn)("cursor-pointer rounded-full px-4 transition-all duration-200","hover:scale-[1.02] hover:shadow-md hover:border-primary/50",r),onClick:()=>{t?.(e)},size:i,type:"button",variant:n,...a,children:s||e});var yC=e.i(524741);let y_=(0,E.default)("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),yT=(0,E.default)("circle-dot",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]]),yE=(0,E.default)("list-todo",[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["rect",{x:"3",y:"4",width:"6",height:"6",rx:"1",key:"cif1o7"}]]),yP={pending:ou,in_progress:yT,completed:y_,cancelled:op},yR={pending:"text-muted-foreground",in_progress:"text-primary",completed:"text-green-500",cancelled:"text-muted-foreground/50"};function yM({todosData:e,isLoading:t,className:r}){let[n,i]=(0,b.useState)(!1);if(!e||0===e.todos.length)return null;let{todos:s,stats:a,nextTodo:o}=e,l=[...s].sort((e,t)=>{let r={in_progress:0,pending:1,completed:2,cancelled:3};return(r[e.status]??4)-(r[t.status]??4)}),c=a.total>0?Math.round(a.completed/a.total*100):0;return(0,v.jsxs)("div",{className:(0,j.cn)("rounded-lg border bg-card/50 backdrop-blur-sm overflow-hidden",r),children:[(0,v.jsxs)("button",{onClick:()=>i(!n),className:"flex items-center justify-between w-full px-3 py-2 hover:bg-muted/50 transition-colors",children:[(0,v.jsxs)("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[(0,v.jsx)(yE,{className:"size-4 text-primary shrink-0"}),!n&&o?(0,v.jsxs)("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[(0,v.jsx)(yT,{className:"size-3.5 text-primary shrink-0"}),(0,v.jsx)("span",{className:"text-sm truncate",children:o.content})]}):(0,v.jsx)("span",{className:"font-medium text-sm",children:"Tasks"}),(0,v.jsxs)("span",{className:"text-xs text-muted-foreground shrink-0",children:[a.completed,"/",a.total]})]}),(0,v.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[(0,v.jsx)("div",{className:"w-16 h-1.5 bg-muted rounded-full overflow-hidden",children:(0,v.jsx)("div",{className:"h-full bg-primary transition-all duration-300",style:{width:`${c}%`}})}),n?(0,v.jsx)(oc.ChevronDownIcon,{className:"size-4 text-muted-foreground"}):(0,v.jsx)(aD,{className:"size-4 text-muted-foreground"})]})]}),n&&(0,v.jsxs)("div",{className:"border-t",children:[o&&(0,v.jsxs)("div",{className:"px-3 py-2 bg-primary/5 border-b flex items-center gap-2",children:[(0,v.jsx)(yT,{className:"size-4 text-primary shrink-0"}),(0,v.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,v.jsx)("span",{className:"text-xs text-primary font-medium uppercase tracking-wide",children:"Current"}),(0,v.jsx)("p",{className:"text-sm font-medium truncate",children:o.content})]})]}),(0,v.jsx)("div",{className:"max-h-[200px] overflow-auto",children:l.map(e=>{let t=yP[e.status]||ou,r=yR[e.status]||"text-muted-foreground",n=e.id===o?.id;return(0,v.jsxs)(T.Tooltip,{children:[(0,v.jsx)(T.TooltipTrigger,{asChild:!0,children:(0,v.jsxs)("div",{className:(0,j.cn)("flex items-start gap-2 px-3 py-1.5 hover:bg-muted/30 transition-colors cursor-default",n&&"bg-primary/5"),children:[(0,v.jsx)(t,{className:(0,j.cn)("size-4 mt-0.5 shrink-0",r)}),(0,v.jsx)("span",{className:(0,j.cn)("text-sm flex-1 min-w-0 truncate","cancelled"===e.status&&"line-through text-muted-foreground/50","completed"===e.status&&"text-muted-foreground"),children:e.content})]})}),(0,v.jsxs)(T.TooltipContent,{side:"left",className:"max-w-xs",children:[(0,v.jsx)("p",{className:"text-sm",children:e.content}),(0,v.jsx)("p",{className:"text-xs text-muted-foreground capitalize mt-1",children:e.status.replace("_"," ")})]})]},e.id)})}),(0,v.jsxs)("div",{className:"px-3 py-1.5 border-t bg-muted/30 flex items-center gap-3 text-xs text-muted-foreground",children:[a.inProgress>0&&(0,v.jsxs)("span",{className:"flex items-center gap-1",children:[(0,v.jsx)(yT,{className:"size-3 text-primary"}),a.inProgress," active"]}),a.pending>0&&(0,v.jsxs)("span",{className:"flex items-center gap-1",children:[(0,v.jsx)(ou,{className:"size-3"}),a.pending," pending"]}),a.completed>0&&(0,v.jsxs)("span",{className:"flex items-center gap-1",children:[(0,v.jsx)(y_,{className:"size-3 text-green-500"}),a.completed," done"]})]})]})]})}var yL=e.i(739963),yI=e.i(300739);let yD=(0,E.default)("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),yO=(0,E.default)("file-code",[["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 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}]]),yB=(0,E.default)("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"}]]);var yF=e.i(719583),yz=e.i(816187);let y$=(0,E.default)("rotate-ccw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]),yV=(0,E.default)("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"}]]);var yU=e.i(220563);let yW=(0,E.default)("file",[["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"}]]);var yG=e.i(529757),yH=e.i(865259),yq=e.i(634066);let yK=(0,E.default)("file-plus",[["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:"M9 15h6",key:"cctwl0"}],["path",{d:"M12 18v-6",key:"17g6i2"}]]),yY=(0,b.memo)(({line:e,type:t})=>(0,v.jsxs)("div",{className:(0,j.cn)("font-mono text-xs leading-5 px-2","add"===t?"bg-green-500/10":"remove"===t?"bg-red-500/10":"","add"===t?"text-green-600 dark:text-green-400":"remove"===t?"text-red-600 dark:text-red-400":"text-muted-foreground"),children:[(0,v.jsx)("span",{className:"select-none w-4 inline-block",children:"add"===t?"+":"remove"===t?"-":" "}),(0,v.jsx)("span",{className:"whitespace-pre-wrap break-all",children:e||" "})]}));function yX({input:e,output:t,status:r,streamingArgsText:n,className:i}){let[s,a]=(0,b.useState)(!0),o=e?.path||"",l=o.split("/").pop()||"file",c=e?.mode||t?.mode||"full",u={ts:"typescript",tsx:"tsx",js:"javascript",jsx:"jsx",py:"python",rb:"ruby",go:"go",rs:"rust",java:"java",c:"c",cpp:"cpp",h:"c",hpp:"cpp",cs:"csharp",php:"php",swift:"swift",kt:"kotlin",scala:"scala",sh:"bash",bash:"bash",zsh:"bash",fish:"bash",ps1:"powershell",sql:"sql",html:"html",htm:"html",css:"css",scss:"scss",sass:"sass",less:"less",json:"json",yaml:"yaml",yml:"yaml",xml:"xml",md:"markdown",markdown:"markdown",txt:"plaintext",toml:"toml",ini:"ini",cfg:"ini",conf:"ini",dockerfile:"dockerfile",makefile:"makefile"}[o.split(".").pop()?.toLowerCase()||""]||"plaintext",d=(0,b.useMemo)(()=>{if(!n)return null;try{return JSON.parse(n)}catch{let e=n.match(/"content"\s*:\s*"((?:[^"\\]|\\[\s\S])*)(?:"|$)/);if(e)try{return{content:JSON.parse(`"${e[1]}"`)}}catch{return{content:e[1]}}let t=n.match(/"old_string"\s*:\s*"((?:[^"\\]|\\[\s\S])*)(?:"|$)/),r=n.match(/"new_string"\s*:\s*"((?:[^"\\]|\\[\s\S])*)(?:"|$)/);if(t||r)return{old_string:t?t[1]:void 0,new_string:r?r[1]:void 0};return null}},[n]),h=e?.content||d?.content||"",p=e?.old_string||d?.old_string||"",m=e?.new_string||d?.new_string||"",f="streaming"===r||"pending"===r,g="completed"===r,y="error"===r||t?.success===!1,x=g&&t?.success?ol:y?op:f?yO:yW,w=g&&t?.success?"text-green-600 dark:text-green-500":y?"text-red-600 dark:text-red-500":f?"text-blue-600 dark:text-blue-500":"text-muted-foreground",k="str_replace"===c?yB:t?.action==="created"?yK:yO;return(0,v.jsxs)("div",{className:(0,j.cn)("rounded-lg border overflow-hidden bg-background",i),children:[(0,v.jsxs)("button",{onClick:()=>a(!s),className:"flex items-center justify-between w-full px-3 py-2.5 bg-muted/50 hover:bg-muted/70 transition-colors",children:[(0,v.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,v.jsx)(x,{className:(0,j.cn)("size-4 shrink-0",w)}),(0,v.jsx)(k,{className:"size-3.5 text-muted-foreground shrink-0"}),(0,v.jsx)("span",{className:"font-medium text-sm truncate",children:l}),"str_replace"===c&&(0,v.jsx)(C,{variant:"secondary",className:"text-xs shrink-0",children:"edit"}),t?.action==="created"&&(0,v.jsx)(C,{variant:"secondary",className:"text-xs shrink-0",children:"new"}),f&&(0,v.jsx)("span",{className:"text-xs text-muted-foreground animate-pulse",children:"streaming..."})]}),(0,v.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[t?.success&&void 0!==t.lineDelta&&(0,v.jsxs)("span",{className:(0,j.cn)("text-xs font-mono",t.lineDelta>=0?"text-green-600 dark:text-green-400":"text-red-600 dark:text-red-400"),children:[t.lineDelta>=0?"+":"",t.lineDelta]}),s?(0,v.jsx)(oc.ChevronDownIcon,{className:"size-4 text-muted-foreground"}):(0,v.jsx)(aD,{className:"size-4 text-muted-foreground"})]})]}),s&&(0,v.jsxs)("div",{className:"border-t",children:[(0,v.jsxs)("div",{className:"px-3 py-1.5 bg-muted/30 border-b flex items-center justify-between",children:[(0,v.jsx)("span",{className:"text-xs text-muted-foreground font-mono truncate",children:o}),h&&(0,v.jsx)(_.Button,{variant:"ghost",size:"icon",className:"size-6",onClick:()=>navigator.clipboard.writeText(h),children:(0,v.jsx)(of,{className:"size-3"})})]}),"str_replace"===c?(0,v.jsxs)("div",{className:"max-h-[200px] overflow-auto",children:[p&&(0,v.jsxs)("div",{className:"border-b",children:[(0,v.jsx)("div",{className:"px-3 py-1 bg-red-500/5 border-b text-xs text-red-600 dark:text-red-400 font-medium",children:"Removed"}),(0,v.jsx)("div",{className:"py-1",children:p.split("\n").map((e,t)=>(0,v.jsx)(yY,{line:e,type:"remove"},`old-${t}`))})]}),m&&(0,v.jsxs)("div",{children:[(0,v.jsx)("div",{className:"px-3 py-1 bg-green-500/5 border-b text-xs text-green-600 dark:text-green-400 font-medium",children:"Added"}),(0,v.jsx)("div",{className:"py-1",children:m.split("\n").map((e,t)=>(0,v.jsx)(yY,{line:e,type:"add"},`new-${t}`))})]}),!p&&!m&&f&&(0,v.jsx)("div",{className:"px-3 py-4 text-center text-muted-foreground text-sm",children:(0,v.jsx)("span",{className:"animate-pulse",children:"Receiving changes..."})})]}):(0,v.jsx)("div",{className:"max-h-[200px] overflow-auto",children:h?(0,v.jsx)(oE,{code:h,language:u,showLineNumbers:!0}):f?(0,v.jsx)("div",{className:"px-3 py-4 text-center text-muted-foreground text-sm",children:(0,v.jsx)("span",{className:"animate-pulse",children:"Writing file..."})}):null}),(t?.success===!0||t?.success===!1||y)&&(0,v.jsx)("div",{className:(0,j.cn)("px-3 py-2 border-t text-xs flex items-center gap-2",t?.success===!0?"bg-green-500/5 text-green-600 dark:text-green-400":"bg-red-500/5 text-red-600 dark:text-red-400"),children:t?.success===!0?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(ol,{className:"size-3.5"}),(0,v.jsx)("span",{children:"str_replace"===c?`Replaced ${t.linesRemoved||0} → ${t.linesAdded||0} lines`:`${"created"===t.action?"Created":"Updated"} (${t.lineCount||0} lines)`})]}):(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(op,{className:"size-3.5"}),(0,v.jsx)("span",{children:t?.error||"Failed to write file"})]})})]})]})}yY.displayName="DiffLine";var yJ=e.i(416667),yJ=yJ;let yZ=(0,E.default)("scissors",[["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M8.12 8.12 12 12",key:"1alkpv"}],["path",{d:"M20 4 8.12 15.88",key:"xgtan2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M14.8 14.8 20 20",key:"ptml3r"}]]);function yQ({input:e,output:t,status:r,className:n}){var i;let[s,a]=(0,b.useState)(!0),o=e?.path||t?.relativePath||t?.path||"",l=o.split("/").pop()||"file",c={ts:"typescript",tsx:"tsx",js:"javascript",jsx:"jsx",py:"python",rb:"ruby",go:"go",rs:"rust",java:"java",c:"c",cpp:"cpp",h:"c",hpp:"cpp",cs:"csharp",php:"php",swift:"swift",kt:"kotlin",scala:"scala",sh:"bash",bash:"bash",zsh:"bash",fish:"bash",ps1:"powershell",sql:"sql",html:"html",htm:"html",css:"css",scss:"scss",sass:"sass",less:"less",json:"json",yaml:"yaml",yml:"yaml",xml:"xml",md:"markdown",markdown:"markdown",txt:"plaintext",toml:"toml",ini:"ini",cfg:"ini",conf:"ini",dockerfile:"dockerfile",makefile:"makefile"}[o.split(".").pop()?.toLowerCase()||""]||"plaintext",u=t?.content||"",d="pending"===r||"streaming"===r||"running"===r,h="completed"===r&&t?.success===!0,p="error"===r||t?.success===!1,m=(0,b.useMemo)(()=>e?.startLine&&e?.endLine?`lines ${e.startLine}-${e.endLine}`:e?.startLine?`from line ${e.startLine}`:e?.endLine?`to line ${e.endLine}`:null,[e?.startLine,e?.endLine]),f=h?ol:p?yJ.default:yW;return(0,v.jsxs)("div",{className:(0,j.cn)("rounded-lg border overflow-hidden bg-background",n),children:[(0,v.jsxs)("button",{onClick:()=>a(!s),className:"flex items-center justify-between w-full px-3 py-2.5 bg-muted/50 hover:bg-muted/70 transition-colors",children:[(0,v.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,v.jsx)(f,{className:(0,j.cn)("size-4 shrink-0",h?"text-green-600 dark:text-green-500":p?"text-red-600 dark:text-red-500":"text-muted-foreground")}),(0,v.jsx)(gD,{className:"size-3.5 text-muted-foreground shrink-0"}),(0,v.jsx)("span",{className:"font-medium text-sm truncate",children:l}),m&&(0,v.jsx)(C,{variant:"outline",className:"text-xs shrink-0",children:m}),t?.wasTruncated&&(0,v.jsxs)(C,{variant:"secondary",className:"text-xs shrink-0 gap-1",children:[(0,v.jsx)(yZ,{className:"size-3"}),"truncated"]}),d&&(0,v.jsx)("span",{className:"text-xs text-muted-foreground animate-pulse",children:"reading..."})]}),(0,v.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[t?.lineCount!==void 0&&(0,v.jsxs)("span",{className:"text-xs text-muted-foreground",children:[t.lineCount," lines"]}),s?(0,v.jsx)(oc.ChevronDownIcon,{className:"size-4 text-muted-foreground"}):(0,v.jsx)(aD,{className:"size-4 text-muted-foreground"})]})]}),s&&(0,v.jsxs)("div",{className:"border-t",children:[(0,v.jsxs)("div",{className:"px-3 py-1.5 bg-muted/30 border-b flex items-center justify-between",children:[(0,v.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,v.jsx)("span",{className:"text-xs text-muted-foreground font-mono truncate",children:o}),t?.sizeBytes!==void 0&&(0,v.jsxs)("span",{className:"text-xs text-muted-foreground/60 shrink-0",children:["(",(i=t.sizeBytes)<1024?`${i} B`:i<1048576?`${(i/1024).toFixed(1)} KB`:`${(i/1024/1024).toFixed(2)} MB`,")"]})]}),u&&(0,v.jsx)(_.Button,{variant:"ghost",size:"icon",className:"size-6",onClick:e=>{e.stopPropagation(),navigator.clipboard.writeText(u)},children:(0,v.jsx)(of,{className:"size-3"})})]}),(0,v.jsx)("div",{className:"max-h-[200px] overflow-auto",children:d?(0,v.jsx)("div",{className:"px-3 py-8 text-center text-muted-foreground text-sm",children:(0,v.jsx)("span",{className:"animate-pulse",children:"Reading file..."})}):p?(0,v.jsxs)("div",{className:"px-3 py-4 text-red-600 dark:text-red-400 text-sm flex items-start gap-2",children:[(0,v.jsx)(yJ.default,{className:"size-4 mt-0.5 shrink-0"}),(0,v.jsx)("span",{children:t?.error||"Failed to read file"})]}):u?(0,v.jsx)(oE,{code:u,language:c,showLineNumbers:!0}):(0,v.jsx)("div",{className:"px-3 py-4 text-muted-foreground text-sm italic",children:"File is empty"})}),t?.wasTruncated&&(0,v.jsxs)("div",{className:"px-3 py-2 border-t bg-amber-500/5 text-xs text-amber-600 dark:text-amber-400 flex items-center gap-2",children:[(0,v.jsx)(yZ,{className:"size-3.5"}),(0,v.jsx)("span",{children:"Content was truncated. Use startLine/endLine to read specific sections."})]})]})]})}let y0=(0,E.default)("terminal",[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]]),y1=(0,E.default)("radio",[["path",{d:"M16.247 7.761a6 6 0 0 1 0 8.478",key:"1fwjs5"}],["path",{d:"M19.075 4.933a10 10 0 0 1 0 14.134",key:"ehdyv1"}],["path",{d:"M4.925 19.067a10 10 0 0 1 0-14.134",key:"1q22gi"}],["path",{d:"M7.753 16.239a6 6 0 0 1 0-8.478",key:"r2q7qm"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]),y2=(0,E.default)("circle-stop",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]]);function y5({input:e,output:t,status:r,terminalId:n,liveOutput:i,className:s}){let[a,o]=(0,b.useState)(!0),l=(0,b.useRef)(null);(0,b.useEffect)(()=>{l.current&&(l.current.scrollTop=l.current.scrollHeight)},[i,t?.output]);let c=e?.command||"",u=e?.background||!1,d=e?.kill===!0,h=e?.id&&(e?.input!==void 0||e?.key!==void 0),p=e?.id&&!e?.command&&!e?.kill&&!h,m="pending"===r||"streaming"===r||"running"===r,f=m&&n&&void 0!==i,g="completed"===r,y="error"===r||t?.success===!1,x=t?.exitCode,w=(()=>{if(f)return i||"";if(t){let e=t.output||t.stdout||"",r=t.stderr||"";return r?e+(e?"\n":"")+r:e}return""})(),k=c.length>50?c.slice(0,50)+"...":c,{Icon:S,color:N,label:A}=(()=>{if(d)return{Icon:y2,color:"text-amber-600 dark:text-amber-500",label:t?.status==="stopped"?"Stopped":"Stopping..."};if(h){let t=e?.key?`key: ${e.key}`:`input: "${e?.input?.slice(0,20)}..."`;return{Icon:y0,color:"text-purple-600 dark:text-purple-500",label:m?"Sending...":t}}return p?{Icon:y0,color:"text-blue-600 dark:text-blue-500",label:"Logs"}:f?{Icon:y1,color:"text-green-600 dark:text-green-500 animate-pulse",label:"Live"}:m?{Icon:od,color:"text-muted-foreground animate-pulse",label:"Executing..."}:g&&0===x?{Icon:ol,color:"text-green-600 dark:text-green-500",label:"Completed"}:g&&0!==x?{Icon:op,color:"text-red-600 dark:text-red-500",label:`Exit ${x}`}:y?{Icon:op,color:"text-red-600 dark:text-red-500",label:"Error"}:{Icon:y0,color:"text-muted-foreground",label:""}})();return(0,v.jsxs)("div",{className:(0,j.cn)("rounded-lg border overflow-hidden bg-background",s),children:[(0,v.jsxs)("button",{onClick:()=>o(!a),className:"flex items-center justify-between w-full px-3 py-2.5 bg-muted/50 hover:bg-muted/70 transition-colors",children:[(0,v.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,v.jsx)(S,{className:(0,j.cn)("size-4 shrink-0",N)}),(0,v.jsx)(y0,{className:"size-3.5 text-muted-foreground shrink-0"}),(0,v.jsx)("code",{className:"font-mono text-sm truncate",title:c,children:k||(d?`kill ${e?.id}`:p?`logs ${e?.id}`:"bash")}),u&&(0,v.jsx)(C,{variant:"secondary",className:"text-xs shrink-0",children:"background"}),f&&(0,v.jsxs)(C,{variant:"secondary",className:"text-xs shrink-0 bg-green-500/10 text-green-600 dark:text-green-400 gap-1",children:[(0,v.jsx)(y1,{className:"size-2 animate-pulse"}),"live"]}),A&&!f&&(0,v.jsx)("span",{className:(0,j.cn)("text-xs shrink-0",N),children:A})]}),(0,v.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[void 0!==x&&g&&(0,v.jsxs)(C,{variant:0===x?"secondary":"destructive",className:(0,j.cn)("text-xs",0===x?"bg-green-500/10 text-green-600 dark:text-green-400":""),children:["exit ",x]}),a?(0,v.jsx)(oc.ChevronDownIcon,{className:"size-4 text-muted-foreground"}):(0,v.jsx)(aD,{className:"size-4 text-muted-foreground"})]})]}),a&&(0,v.jsxs)("div",{className:"border-t",children:[c&&(0,v.jsxs)("div",{className:"px-3 py-1.5 bg-muted/30 border-b flex items-center justify-between",children:[(0,v.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,v.jsx)("span",{className:"text-muted-foreground text-xs",children:"$"}),(0,v.jsx)("code",{className:"text-xs font-mono truncate",children:c})]}),(0,v.jsx)(_.Button,{variant:"ghost",size:"icon",className:"size-6",onClick:e=>{e.stopPropagation(),navigator.clipboard.writeText(c)},children:(0,v.jsx)(of,{className:"size-3"})})]}),(0,v.jsxs)("div",{ref:l,className:"bg-zinc-950 dark:bg-zinc-950 relative max-h-[300px] overflow-auto",children:[(0,v.jsxs)("pre",{className:"px-3 py-2 text-xs font-mono text-zinc-300 whitespace-pre-wrap break-all min-h-[40px]",children:[w||(0,v.jsx)("span",{className:"text-muted-foreground italic",children:m?"Waiting for output...":"(no output)"}),f&&(0,v.jsx)("span",{className:"inline-block w-2 h-4 bg-green-500 animate-pulse ml-0.5"})]}),w&&(0,v.jsx)(_.Button,{variant:"ghost",size:"icon",className:"absolute top-1 right-1 size-6 text-zinc-500 hover:text-zinc-300 bg-zinc-900/80",onClick:e=>{e.stopPropagation(),navigator.clipboard.writeText(w)},children:(0,v.jsx)(of,{className:"size-3"})})]}),t?.error&&(0,v.jsxs)("div",{className:"px-3 py-2 border-t bg-red-500/5 text-red-600 dark:text-red-400 text-xs flex items-start gap-2",children:[(0,v.jsx)(op,{className:"size-3.5 mt-0.5 shrink-0"}),(0,v.jsx)("span",{children:t.error})]}),t?.message&&!t?.error&&(0,v.jsx)("div",{className:"px-3 py-2 border-t bg-muted/30 text-muted-foreground text-xs",children:t.message})]})]})}var gw=gw;let y3=(0,E.default)("trash",[["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]),y6={pending:ou,in_progress:yT,completed:ol,cancelled:op},y4={pending:"text-muted-foreground",in_progress:"text-blue-600 dark:text-blue-400",completed:"text-green-600 dark:text-green-400",cancelled:"text-muted-foreground/50"},y8={add:"Add Tasks",list:"List Tasks",mark:"Update Task",clear:"Clear Tasks"},y9=({action:e})=>{switch(e){case"add":return(0,v.jsx)(gw.default,{className:"size-3.5"});case"list":default:return(0,v.jsx)(yE,{className:"size-3.5"});case"mark":return(0,v.jsx)(ol,{className:"size-3.5"});case"clear":return(0,v.jsx)(y3,{className:"size-3.5"})}};function y7({input:e,output:t,status:r,className:n}){let[i,s]=(0,b.useState)(!0),a=e?.action||"list",o="pending"===r||"streaming"===r||"running"===r,l="completed"===r,c="error"===r||t?.success===!1,u=l&&t?.success?ol:c?op:o?od:yE,d=l&&t?.success?"text-green-600 dark:text-green-500":c?"text-red-600 dark:text-red-500":o?"text-muted-foreground animate-pulse":"text-muted-foreground",h=e=>{let t=y6[e.status]||ou,r=y4[e.status]||"text-muted-foreground";return(0,v.jsxs)("div",{className:"flex items-start gap-2 py-1",children:[(0,v.jsx)(t,{className:(0,j.cn)("size-4 mt-0.5 shrink-0",r)}),(0,v.jsx)("span",{className:(0,j.cn)("text-sm","cancelled"===e.status&&"line-through text-muted-foreground/50","completed"===e.status&&"text-muted-foreground"),children:e.content})]},e.id)};return(0,v.jsxs)("div",{className:(0,j.cn)("rounded-lg border overflow-hidden bg-background",n),children:[(0,v.jsxs)("button",{onClick:()=>s(!i),className:"flex items-center justify-between w-full px-3 py-2.5 bg-muted/50 hover:bg-muted/70 transition-colors",children:[(0,v.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,v.jsx)(u,{className:(0,j.cn)("size-4 shrink-0",d)}),(0,v.jsx)(y9,{action:a}),(0,v.jsx)("span",{className:"font-medium text-sm",children:y8[a]||a}),o&&(0,v.jsx)("span",{className:"text-xs text-muted-foreground animate-pulse",children:"running..."})]}),(0,v.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[t?.stats&&(0,v.jsx)("div",{className:"flex items-center gap-1.5 text-xs",children:(0,v.jsxs)("span",{className:"text-muted-foreground",children:[t.stats.completed,"/",t.stats.total]})}),t?.itemsAdded!==void 0&&(0,v.jsxs)(C,{variant:"secondary",className:"text-xs bg-green-500/10 text-green-600 dark:text-green-400",children:["+",t.itemsAdded]}),t?.itemsRemoved!==void 0&&(0,v.jsxs)(C,{variant:"secondary",className:"text-xs",children:["cleared ",t.itemsRemoved]}),i?(0,v.jsx)(oc.ChevronDownIcon,{className:"size-4 text-muted-foreground"}):(0,v.jsx)(aD,{className:"size-4 text-muted-foreground"})]})]}),i&&(0,v.jsxs)("div",{className:"border-t",children:[t?.stats&&(0,v.jsxs)("div",{className:"px-3 py-2 bg-muted/30 border-b flex items-center gap-4 text-xs",children:[(0,v.jsxs)("div",{className:"flex items-center gap-1",children:[(0,v.jsx)(ou,{className:"size-3 text-muted-foreground"}),(0,v.jsxs)("span",{children:[t.stats.pending," pending"]})]}),(0,v.jsxs)("div",{className:"flex items-center gap-1",children:[(0,v.jsx)(yT,{className:"size-3 text-blue-500"}),(0,v.jsxs)("span",{children:[t.stats.inProgress," active"]})]}),(0,v.jsxs)("div",{className:"flex items-center gap-1",children:[(0,v.jsx)(ol,{className:"size-3 text-green-500"}),(0,v.jsxs)("span",{children:[t.stats.completed," done"]})]})]}),t?.items&&t.items.length>0&&(0,v.jsx)("div",{className:"px-3 py-2 max-h-[200px] overflow-auto",children:t.items.map(h)}),t?.item&&!t.items&&(0,v.jsx)("div",{className:"px-3 py-2",children:h(t.item)}),"add"===a&&e?.items&&!t?.items&&(0,v.jsx)("div",{className:"px-3 py-2 max-h-[200px] overflow-auto",children:e.items.map((e,t)=>(0,v.jsxs)("div",{className:"flex items-start gap-2 py-1 text-muted-foreground",children:[(0,v.jsx)(ou,{className:"size-4 mt-0.5 shrink-0"}),(0,v.jsx)("span",{className:"text-sm",children:e.content})]},t))}),"list"===a&&t?.items?.length===0&&(0,v.jsx)("div",{className:"px-3 py-4 text-center text-muted-foreground text-sm",children:"No tasks yet"}),t?.error&&(0,v.jsxs)("div",{className:"px-3 py-2 border-t bg-red-500/5 text-red-600 dark:text-red-400 text-xs flex items-start gap-2",children:[(0,v.jsx)(op,{className:"size-3.5 mt-0.5 shrink-0"}),(0,v.jsx)("span",{children:t.error})]})]})]})}let xe=(0,E.default)("book-open",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]),xt=(0,E.default)("list",[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]]),xr=(0,E.default)("sparkles",[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]]);function xn({input:e,output:t,status:r,className:n}){let[i,s]=(0,b.useState)(!0),a=e?.action||"list",o=e?.skillName||t?.skillName,l="pending"===r||"streaming"===r||"running"===r,c="completed"===r,u="error"===r||t?.success===!1,d=c&&t?.success?ol:u?op:l?od:xe,h=c&&t?.success?"text-green-600 dark:text-green-500":u?"text-red-600 dark:text-red-500":l?"text-muted-foreground animate-pulse":"text-muted-foreground",p="load"===a?o?`Load: ${o}`:"Load Skill":"List Skills";return(0,v.jsxs)("div",{className:(0,j.cn)("rounded-lg border overflow-hidden bg-background",n),children:[(0,v.jsxs)("button",{onClick:()=>s(!i),className:"flex items-center justify-between w-full px-3 py-2.5 bg-muted/50 hover:bg-muted/70 transition-colors",children:[(0,v.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,v.jsx)(d,{className:(0,j.cn)("size-4 shrink-0",h)}),"list"===a?(0,v.jsx)(xt,{className:"size-3.5 text-muted-foreground"}):(0,v.jsx)(xr,{className:"size-3.5 text-muted-foreground"}),(0,v.jsx)("span",{className:"font-medium text-sm truncate",children:p}),l&&(0,v.jsx)("span",{className:"text-xs text-muted-foreground animate-pulse",children:"loading..."})]}),(0,v.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[t?.skillCount!==void 0&&(0,v.jsxs)(C,{variant:"secondary",className:"text-xs",children:[t.skillCount," skills"]}),t?.contentLength!==void 0&&(0,v.jsxs)(C,{variant:"secondary",className:"text-xs",children:[Math.round(t.contentLength/1e3),"k chars"]}),i?(0,v.jsx)(oc.ChevronDownIcon,{className:"size-4 text-muted-foreground"}):(0,v.jsx)(aD,{className:"size-4 text-muted-foreground"})]})]}),i&&(0,v.jsxs)("div",{className:"border-t",children:[t?.skills&&t.skills.length>0&&(0,v.jsx)("div",{className:"max-h-[200px] overflow-auto",children:t.skills.map((e,r)=>(0,v.jsxs)("div",{className:(0,j.cn)("px-3 py-2 flex items-start gap-2",r<t.skills.length-1&&"border-b"),children:[(0,v.jsx)(xe,{className:"size-4 mt-0.5 shrink-0 text-muted-foreground"}),(0,v.jsxs)("div",{className:"min-w-0",children:[(0,v.jsx)("div",{className:"font-medium text-sm",children:e.name}),e.description&&(0,v.jsx)("div",{className:"text-xs text-muted-foreground truncate",children:e.description})]})]},e.name))}),"load"===a&&t?.success&&t.skillName&&(0,v.jsxs)("div",{className:"px-3 py-2 bg-muted/30",children:[(0,v.jsxs)("div",{className:"flex items-center justify-between",children:[(0,v.jsxs)("div",{className:"flex items-center gap-2",children:[(0,v.jsx)(xr,{className:"size-4 text-green-600 dark:text-green-400"}),(0,v.jsx)("span",{className:"font-medium text-sm",children:t.skillName})]}),t.content&&(0,v.jsx)(_.Button,{variant:"ghost",size:"icon",className:"size-6",onClick:e=>{e.stopPropagation(),navigator.clipboard.writeText(t.content)},children:(0,v.jsx)(of,{className:"size-3"})})]}),t.description&&(0,v.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:t.description})]}),t?.content&&(0,v.jsx)("div",{className:"max-h-[150px] overflow-auto border-t",children:(0,v.jsxs)("pre",{className:"px-3 py-2 text-xs font-mono text-muted-foreground whitespace-pre-wrap",children:[t.content.slice(0,500),t.content.length>500&&"..."]})}),t?.availableSkills&&t.availableSkills.length>0&&(0,v.jsx)("div",{className:"px-3 py-2 bg-muted/30 border-t",children:(0,v.jsxs)("div",{className:"text-xs text-muted-foreground",children:["Available: ",t.availableSkills.join(", ")]})}),"list"===a&&t?.skills?.length===0&&(0,v.jsx)("div",{className:"px-3 py-4 text-center text-muted-foreground text-sm",children:"No skills available"}),t?.error&&(0,v.jsxs)("div",{className:"px-3 py-2 border-t bg-red-500/5 text-red-600 dark:text-red-400 text-xs flex items-start gap-2",children:[(0,v.jsx)(op,{className:"size-3.5 mt-0.5 shrink-0"}),(0,v.jsx)("span",{children:t.error})]})]})]})}var yJ=yJ;let xi=(0,E.default)("info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]),xs=(0,E.default)("search-code",[["path",{d:"m13 13.5 2-2.5-2-2.5",key:"1rvxrh"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}],["path",{d:"M9 8.5 7 11l2 2.5",key:"6ffwbx"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]);function xa({severity:e,className:t}){switch(e){case"error":return(0,v.jsx)(yJ.default,{className:(0,j.cn)("text-red-500",t)});case"warning":return(0,v.jsx)(yD,{className:(0,j.cn)("text-yellow-500",t)});case"info":return(0,v.jsx)(xi,{className:(0,j.cn)("text-blue-500",t)});default:return(0,v.jsx)(xi,{className:(0,j.cn)("text-muted-foreground",t)})}}function xo({file:e,isExpanded:t,onToggle:r}){let n=e.errors>0,i=e.warnings>0;return(0,v.jsxs)("div",{className:"border-b last:border-b-0",children:[(0,v.jsxs)("button",{onClick:r,className:"flex items-center justify-between w-full px-3 py-2 hover:bg-muted/50 transition-colors text-left",children:[(0,v.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,v.jsx)(yW,{className:"size-3.5 text-muted-foreground shrink-0"}),(0,v.jsx)("span",{className:"font-mono text-sm truncate",children:e.relativePath}),n&&(0,v.jsxs)(C,{variant:"destructive",className:"text-xs gap-1",children:[(0,v.jsx)(yJ.default,{className:"size-3"}),e.errors]}),i&&(0,v.jsxs)(C,{variant:"secondary",className:"text-xs gap-1 bg-yellow-500/10 text-yellow-600 dark:text-yellow-400",children:[(0,v.jsx)(yD,{className:"size-3"}),e.warnings]})]}),t?(0,v.jsx)(oc.ChevronDownIcon,{className:"size-4 text-muted-foreground shrink-0"}):(0,v.jsx)(aD,{className:"size-4 text-muted-foreground shrink-0"})]}),t&&e.diagnostics.length>0&&(0,v.jsx)("div",{className:"bg-muted/30 px-3 py-2 space-y-1",children:e.diagnostics.map((e,t)=>(0,v.jsxs)("div",{className:(0,j.cn)("flex items-start gap-2 px-2 py-1.5 rounded text-sm","error"===e.severity&&"bg-red-500/5","warning"===e.severity&&"bg-yellow-500/5"),children:[(0,v.jsx)(xa,{severity:e.severity,className:"size-4 mt-0.5 shrink-0"}),(0,v.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,v.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,v.jsxs)("span",{className:"font-mono text-xs text-muted-foreground shrink-0",children:[e.line,":",e.column]}),e.source&&(0,v.jsx)(C,{variant:"outline",className:"text-xs",children:e.source}),e.code&&(0,v.jsxs)("span",{className:"text-xs text-muted-foreground font-mono",children:["[",e.code,"]"]})]}),(0,v.jsx)("p",{className:"text-sm mt-0.5 break-words",children:e.message})]})]},t))})]})}function xl({input:e,output:t,status:r,className:n}){let[i,s]=(0,b.useState)(!0),[a,o]=(0,b.useState)(new Set),l="pending"===r||"streaming"===r||"running"===r||"completed"===r&&!t,c="completed"===r&&t?.success===!0,u="error"===r||t?.success===!1,d=t?.totalErrors??0,h=t?.totalWarnings??0,p=d>0||h>0,m=t?.files?.length??0,f=(0,b.useMemo)(()=>e.paths&&0!==e.paths.length?1===e.paths.length?e.paths[0]:`${e.paths.length} paths`:"all files",[e.paths]),g=(0,b.useMemo)(()=>t?.files?.filter(e=>e.errors>0)||[],[t?.files]);(0,b.useMemo)(()=>{g.length>0&&0===a.size&&o(new Set(g.slice(0,5).map(e=>e.path)))},[g]);let y=p?yJ.default:c?ol:u?yJ.default:xs,x=p?"text-red-500":c?"text-green-500":u?"text-red-500":"text-muted-foreground";return(0,v.jsxs)("div",{className:(0,j.cn)("rounded-lg border overflow-hidden bg-background",n),children:[(0,v.jsxs)("button",{onClick:()=>s(!i),className:"flex items-center justify-between w-full px-3 py-2.5 bg-muted/50 hover:bg-muted/70 transition-colors",children:[(0,v.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,v.jsx)(y,{className:(0,j.cn)("size-4 shrink-0",x)}),(0,v.jsx)("span",{className:"font-medium text-sm",children:"Linter"}),(0,v.jsxs)("span",{className:"text-xs text-muted-foreground truncate",children:[c?"checked":"checking"," ",f]}),l&&(0,v.jsx)("span",{className:"text-xs text-muted-foreground animate-pulse",children:"analyzing..."})]}),(0,v.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[c&&(0,v.jsxs)(v.Fragment,{children:[d>0&&(0,v.jsxs)(C,{variant:"destructive",className:"text-xs gap-1",children:[(0,v.jsx)(yJ.default,{className:"size-3"}),d," error",1!==d?"s":""]}),h>0&&(0,v.jsxs)(C,{variant:"secondary",className:"text-xs gap-1 bg-yellow-500/10 text-yellow-600 dark:text-yellow-400",children:[(0,v.jsx)(yD,{className:"size-3"}),h," warning",1!==h?"s":""]}),!p&&(0,v.jsxs)(C,{variant:"secondary",className:"text-xs gap-1 bg-green-500/10 text-green-600 dark:text-green-400",children:[(0,v.jsx)(ol,{className:"size-3"}),"No issues"]})]}),i?(0,v.jsx)(oc.ChevronDownIcon,{className:"size-4 text-muted-foreground"}):(0,v.jsx)(aD,{className:"size-4 text-muted-foreground"})]})]}),i&&(0,v.jsxs)("div",{className:"border-t",children:[l?(0,v.jsxs)("div",{className:"px-3 py-8 text-center text-muted-foreground text-sm",children:[(0,v.jsx)(xs,{className:"size-6 mx-auto mb-2 animate-pulse"}),(0,v.jsx)("span",{children:"Analyzing files for lint errors..."})]}):u&&t?.error?(0,v.jsxs)("div",{className:"px-3 py-4 text-red-600 dark:text-red-400 text-sm flex items-start gap-2",children:[(0,v.jsx)(yJ.default,{className:"size-4 mt-0.5 shrink-0"}),(0,v.jsx)("span",{children:t.error})]}):t?.files&&t.files.length>0?(0,v.jsx)("div",{className:"max-h-[400px] overflow-y-auto",children:t.files.map(e=>(0,v.jsx)(xo,{file:e,isExpanded:a.has(e.path),onToggle:()=>{var t;return t=e.path,void o(e=>{let r=new Set(e);return r.has(t)?r.delete(t):r.add(t),r})}},e.path))}):(0,v.jsx)("div",{className:"px-3 py-4 text-sm",children:t?.message?(0,v.jsxs)("div",{className:"flex items-center gap-2 text-green-600 dark:text-green-400",children:[(0,v.jsx)(ol,{className:"size-4"}),(0,v.jsx)("span",{children:t.message})]}):(0,v.jsx)("div",{className:"text-muted-foreground italic",children:"No files analyzed yet."})}),c&&m>0&&(0,v.jsxs)("div",{className:"px-3 py-2 border-t bg-muted/30 text-xs text-muted-foreground",children:["Checked ",m," file",1!==m?"s":"",p&&(0,v.jsxs)("span",{children:[" • ",(0,v.jsxs)("span",{className:d>0?"text-red-500":"",children:[d," error",1!==d?"s":""]})," • ",(0,v.jsxs)("span",{className:h>0?"text-yellow-500":"",children:[h," warning",1!==h?"s":""]})]})]})]})]})}let xc=(0,E.default)("loader",[["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m16.2 7.8 2.9-2.9",key:"r700ao"}],["path",{d:"M18 12h4",key:"wj9ykh"}],["path",{d:"m16.2 16.2 2.9 2.9",key:"1bxg5t"}],["path",{d:"M12 18v4",key:"jadmvz"}],["path",{d:"m4.9 19.1 2.9-2.9",key:"bwix9q"}],["path",{d:"M2 12h4",key:"j09sii"}],["path",{d:"m4.9 4.9 2.9 2.9",key:"giyufr"}]]),xu=(0,E.default)("mic",[["path",{d:"M12 19v3",key:"npa21l"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["rect",{x:"9",y:"2",width:"6",height:"13",rx:"3",key:"s6n7sd"}]]),xd=(0,E.default)("mic-off",[["path",{d:"M12 19v3",key:"npa21l"}],["path",{d:"M15 9.34V5a3 3 0 0 0-5.68-1.33",key:"1gzdoj"}],["path",{d:"M16.95 16.95A7 7 0 0 1 5 12v-2",key:"cqa7eg"}],["path",{d:"M18.89 13.23A7 7 0 0 0 19 12v-2",key:"16hl24"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M9 9v3a3 3 0 0 0 5.12 2.12",key:"r2i35w"}]]),xh=({className:e,onTranscriptionChange:t,onInterimTranscription:r,onAudioRecorded:n,lang:i="en-US",disabled:s,...a})=>{let[o,l]=(0,b.useState)(!1),[c,u]=(0,b.useState)(!1),[d,h]=(0,b.useState)("none"),p=(0,b.useRef)(null),m=(0,b.useRef)(null),f=(0,b.useRef)([]),g=(0,b.useRef)("");(0,b.useEffect)(()=>{h("SpeechRecognition"in window||"webkitSpeechRecognition"in window?"speech-recognition":"MediaRecorder"in window&&"mediaDevices"in navigator?"media-recorder":"none")},[]),(0,b.useEffect)(()=>{if("speech-recognition"!==d)return;let e=new(window.SpeechRecognition||window.webkitSpeechRecognition);return e.continuous=!0,e.interimResults=!0,e.lang=i,e.onstart=()=>{l(!0),g.current=""},e.onend=()=>{l(!1),r?.("")},e.onresult=e=>{let n="",i="";for(let t=e.resultIndex;t<e.results.length;t++){let r=e.results[t],s=r[0]?.transcript??"";r.isFinal?i+=s:n+=s}i&&(g.current+=i,t?.(i),r?.("")),n&&r?.(n)},e.onerror=e=>{console.error("Speech recognition error:",e.error),l(!1),r?.("")},p.current=e,()=>{p.current&&p.current.abort()}},[d,i,t,r]);let y=(0,b.useCallback)(async()=>{if(!n)return void console.warn("SpeechInput: onAudioRecorded callback is required for MediaRecorder fallback");try{let e=await navigator.mediaDevices.getUserMedia({audio:!0}),r=new MediaRecorder(e);f.current=[],r.ondataavailable=e=>{e.data.size>0&&f.current.push(e.data)},r.onstop=async()=>{for(let t of e.getTracks())t.stop();let r=new Blob(f.current,{type:"audio/webm"});if(r.size>0){u(!0);try{let e=await n(r);e&&t?.(e)}catch(e){console.error("Transcription error:",e)}finally{u(!1)}}},r.onerror=t=>{for(let r of(console.error("MediaRecorder error:",t),l(!1),e.getTracks()))r.stop()},m.current=r,r.start(),l(!0)}catch(e){console.error("Failed to start MediaRecorder:",e),l(!1)}},[n,t]),x=(0,b.useCallback)(()=>{m.current?.state==="recording"&&m.current.stop(),l(!1)},[]),w=(0,b.useCallback)(()=>{if("speech-recognition"===d&&p.current)if(o)p.current.stop();else try{p.current.start()}catch(e){console.warn("Speech recognition start error:",e)}else"media-recorder"===d&&(o?x():y())},[d,o,y,x]),k=s||"none"===d||"speech-recognition"===d&&!p.current||"media-recorder"===d&&!n||c;return"none"===d?(0,v.jsx)(_.Button,{type:"button",className:(0,j.cn)("relative rounded-full opacity-50 cursor-not-allowed",e),disabled:!0,title:"Speech recognition not supported in this browser",...a,children:(0,v.jsx)(xd,{className:"size-4"})}):(0,v.jsxs)("div",{className:"relative inline-flex items-center justify-center",children:[o&&(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)("span",{className:"absolute inset-0 rounded-full bg-red-500/20 animate-ping"}),(0,v.jsx)("span",{className:"absolute inset-0 rounded-full bg-red-500/10 animate-ping",style:{animationDelay:"0.2s"}})]}),(0,v.jsxs)(_.Button,{type:"button",className:(0,j.cn)("relative z-10 rounded-full transition-all duration-200",o?"bg-red-500 text-white hover:bg-red-600 shadow-lg shadow-red-500/25":"hover:bg-muted",e),disabled:k,onClick:w,title:o?"Stop recording":"Start voice input",variant:o?"default":"ghost",...a,children:[c&&(0,v.jsx)(xc,{className:"size-4 animate-spin"}),!c&&o&&(0,v.jsxs)("div",{className:"relative",children:[(0,v.jsx)(xu,{className:"size-4"}),(0,v.jsx)("span",{className:"absolute -top-0.5 -right-0.5 size-2 bg-white rounded-full animate-pulse"})]}),!(c||o)&&(0,v.jsx)(xu,{className:"size-4"})]})]})};function xp(){let{toggleSidebar:e,isMobile:t}=(0,yG.useSidebar)();return t?(0,v.jsxs)(_.Button,{size:"icon",variant:"ghost",onClick:e,className:"size-7 shrink-0",children:[(0,v.jsx)(yU.PanelLeft,{className:"size-4"}),(0,v.jsx)("span",{className:"sr-only",children:"Toggle sidebar"})]}):null}function xm(){let e=g_();return 0===e.files.length?null:(0,v.jsx)(gG,{variant:"inline",children:e.files.map(t=>(0,v.jsxs)(gH,{data:t,onRemove:()=>e.remove(t.id),children:[(0,v.jsx)(gq,{}),(0,v.jsx)(gK,{}),(0,v.jsx)(gY,{})]},t.id))})}function xf({input:e,isRunning:t,onStop:r}){let n=g_(),i=e.trim()||n.files.length>0;return(0,v.jsx)(gI,{disabled:!t&&!i,status:t?"streaming":"ready",onStop:r,className:"bg-primary hover:bg-primary/90 transition-colors"})}function xg({session:e}){let[t,r]=(0,b.useState)([]),[n,i]=(0,b.useState)(""),[s,a]=(0,b.useState)(""),[o,l]=(0,b.useState)(!1),[c,u]=(0,b.useState)(!1),[d,h]=(0,b.useState)(null),[p,m]=(0,b.useState)(""),[f,g]=(0,b.useState)(""),[y,x]=(0,b.useState)(!1),[w,S]=(0,b.useState)([]),[N,A]=(0,b.useState)([]),[E,P]=(0,b.useState)(null),[R,M]=(0,b.useState)([]),[L,I]=(0,b.useState)(!1),D=(0,b.useRef)(""),O=(0,b.useRef)(""),B=(0,b.useRef)([]),[F,z]=(0,b.useState)(!1),$=(0,b.useRef)(null),H=(0,b.useRef)(null),q=(0,b.useRef)(!1),K=(0,b.useRef)(!1),Y=(0,b.useRef)(new Map),[X,J]=(0,b.useState)(e.model),[Z,Q]=(0,b.useState)(e.name||""),[ee,et]=(0,b.useState)(!1),[er,en]=(0,b.useState)(null),[ei,es]=(0,b.useState)(e.config||{}),[ea,eo]=(0,b.useState)(!1),el=(0,b.useRef)(null);(0,b.useEffect)(()=>{(0,yL.getConfig)().then(en)},[]),(0,b.useEffect)(()=>{J(e.model),Q(e.name||""),es(e.config||{})},[e.id,e.model,e.name,e.config]),(0,b.useEffect)(()=>{ee&&el.current&&(el.current.focus(),el.current.select())},[ee]);let ec=async t=>{J(t);try{await (0,yC.updateSession)(e.id,{model:t}),(0,yI.mutateSessions)()}catch(t){console.error("Failed to update model:",t),J(e.model)}},eu=async()=>{et(!1);let t=Z.trim()||"Session";if(t!==e.name)try{await (0,yC.updateSession)(e.id,{name:t}),(0,yI.mutateSessions)()}catch(t){console.error("Failed to update name:",t),Q(e.name||"")}},ed=e=>e&&"object"==typeof e&&"type"in e&&"value"in e&&("json"===e.type||"text"===e.type)?e.value:e,eh=e=>{let t=[],r=new Map;for(let t of e)if("tool"===t.role&&Array.isArray(t.content)){for(let e of t.content)if("tool-result"===e.type){let t=e.output??e.result;r.set(e.toolCallId,ed(t))}}let n=0;for(let i of e){if("user"===i.role){let e="",r=[];if("string"==typeof i.content)e=i.content;else if(Array.isArray(i.content))for(let t of i.content)"text"===t.type&&"text"in t?e+=t.text:"image"===t.type&&"image"in t?r.push({type:"image",data:t.image,mediaType:t.mediaType}):"file"===t.type&&"data"in t&&r.push({type:"file",data:t.data,mediaType:t.mediaType});t.push({id:i.id,type:"user-message",content:e,messageSequence:n,attachments:r.length>0?r:void 0})}else if("assistant"===i.role){if("string"==typeof i.content)i.content.trim()&&t.push({id:i.id,type:"assistant-text",content:i.content});else if(Array.isArray(i.content))for(let e=0;e<i.content.length;e++){let n=i.content[e];if("reasoning"===n.type&&n.text?.trim())t.push({id:`${i.id}-reasoning-${e}`,type:"reasoning",content:n.text});else if("text"===n.type&&n.text?.trim())t.push({id:`${i.id}-text-${e}`,type:"assistant-text",content:n.text});else if("tool-call"===n.type){let s=r.get(n.toolCallId),a=s?.rejected===!0||s?.status==="rejected";t.push({id:`${i.id}-tool-${e}`,type:"tool-call",toolCall:{toolCallId:n.toolCallId,toolName:n.toolName,input:n.input??n.args,output:s,status:a?"rejected":void 0!==s?"completed":"pending"}})}}}n++}return t},ep=async(t,n)=>{let s=R.find(e=>e.messageSequence===t);if(!s)return void console.error("No checkpoint found for message sequence:",t);if(window.confirm("Revert to before this message? This will undo all file changes and delete messages from this point.")){I(!0);try{await (0,yC.revertToCheckpoint)(e.id,s.id);let[t,a]=await Promise.all([(0,yC.getSessionMessages)(e.id),(0,yC.getSessionCheckpoints)(e.id).catch(()=>({checkpoints:[]}))]),o=[...t].sort((e,t)=>new Date(e.createdAt).getTime()-new Date(t.createdAt).getTime()),l=eh(o);r(l),M(a.checkpoints||[]),m(""),g(""),S([]),D.current="",O.current="",B.current=[],n&&i(n)}catch(e){console.error("Failed to revert:",e),alert("Failed to revert: "+(e instanceof Error?e.message:"Unknown error"))}finally{I(!1)}}},em=t=>{if("tool-progress"===t.type){if("bash"===t.toolName&&"started"===t.data.status){let e=t.data.terminalId;if(B.current=B.current.map(t=>"bash"!==t.toolName||t.terminalId||"running"!==t.status&&"streaming"!==t.status?t:{...t,terminalId:e,liveOutput:""}),S([...B.current]),!Y.current.has(e)){let t=(0,yC.streamTerminal)(e,t=>{B.current=B.current.map(r=>r.terminalId===e?{...r,liveOutput:(r.liveOutput||"")+t}:r),S([...B.current])},()=>{Y.current.delete(e)});Y.current.set(e,t)}}return}switch(t.type){case"start":case"data-session":case"text-start":case"text-end":break;case"data-stream-id":h(t.streamId),H.current=t.streamId;break;case"data-user-message":t.data?.content&&!K.current&&r(e=>{let r="",n=[],i=t.data.content;if("string"==typeof i)r=i;else if(Array.isArray(i))for(let e of i)"text"===e.type&&e.text?r+=e.text:"image"===e.type&&e.image?n.push({type:"image",data:e.image,mediaType:e.mediaType}):"file"===e.type&&e.data&&n.push({type:"file",data:e.data,mediaType:e.mediaType});return e.some(e=>"user-message"===e.type&&e.content===r)?e:[...e,{id:t.data.id||`user-${Date.now()}`,type:"user-message",content:r,attachments:n.length>0?n:void 0}]});break;case"text-delta":D.current+=t.delta,m(D.current);break;case"reasoning-start":x(!0),O.current="",g("");break;case"reasoning-delta":O.current+=t.delta,g(O.current);break;case"reasoning-end":if(x(!1),O.current.trim()){let e={id:`reasoning-${Date.now()}`,type:"reasoning",content:O.current};r(t=>[...t,e])}O.current="",g("");break;case"tool-input-start":if(D.current.trim()){let e={id:`text-${Date.now()}`,type:"assistant-text",content:D.current};r(t=>[...t,e]),D.current="",m("")}let n={toolCallId:t.toolCallId,toolName:t.toolName,input:{},status:"streaming",streamingArgsText:""};B.current=[...B.current,n],S([...B.current]);break;case"tool-input-delta":B.current=B.current.map(e=>e.toolCallId!==t.toolCallId?e:{...e,streamingArgsText:(e.streamingArgsText||"")+t.argsTextDelta}),S([...B.current]);break;case"tool-input-available":let i=B.current.find(e=>e.toolCallId===t.toolCallId);if(D.current.trim()){let e={id:`text-${Date.now()}`,type:"assistant-text",content:D.current};r(t=>[...t,e]),D.current="",m("")}let s={toolCallId:t.toolCallId,toolName:t.toolName,input:t.input,status:"running",streamingArgsText:i?.streamingArgsText};i?B.current=B.current.map(e=>e.toolCallId!==t.toolCallId?e:s):B.current=[...B.current,s],S([...B.current]);break;case"tool-output-available":let a=B.current.find(e=>e.toolCallId===t.toolCallId);if(a?.terminalId){let e=Y.current.get(a.terminalId);e&&(e(),Y.current.delete(a.terminalId))}let o=ed(t.output),c=o?.rejected===!0||o?.status==="rejected",d=B.current.find(e=>e.toolCallId===t.toolCallId);B.current=B.current.filter(e=>e.toolCallId!==t.toolCallId),S([...B.current]);let p={id:`tool-${t.toolCallId}`,type:"tool-call",toolCall:{toolCallId:t.toolCallId,toolName:d?.toolName||"unknown",input:d?.input||{},output:o,status:c?"rejected":"completed"}};r(e=>{let r=e.findIndex(e=>"tool-call"===e.type&&e.toolCall?.toolCallId===t.toolCallId);if(r>=0){let t=[...e];return t[r]=p,t}return[...e,p]});break;case"data-approval-required":A(e=>e.some(e=>e.id===t.data.id)?e:[...e,t.data]);break;case"finish-step":if(D.current.trim()){let e={id:`text-${Date.now()}`,type:"assistant-text",content:D.current};r(t=>[...t,e]),D.current="",m("")}break;case"finish":m(""),g(""),x(!1),S([]),h(null),D.current="",O.current="",B.current=[],$.current=null,q.current=!1,K.current=!1,l(!1),u(!1),Promise.all([(0,yC.getSessionMessages)(e.id),(0,yC.getSessionCheckpoints)(e.id).catch(()=>({checkpoints:[]}))]).then(([e,t])=>{r(eh([...e].sort((e,t)=>new Date(e.createdAt).getTime()-new Date(t.createdAt).getTime()))),M(t.checkpoints||[])}).catch(()=>{});break;case"abort":if(O.current.trim()){let e={id:`reasoning-${Date.now()}`,type:"reasoning",content:O.current};r(t=>[...t,e])}if(D.current.trim()){let e={id:`text-${Date.now()}`,type:"assistant-text",content:D.current+" [stopped]"};r(t=>[...t,e])}m(""),g(""),x(!1),S([]),h(null),D.current="",O.current="",B.current=[],$.current=null,q.current=!1,K.current=!1,l(!1),u(!1);break;case"error":console.error("Agent error:",t.errorText),$.current=null,l(!1),u(!1)}};(0,b.useEffect)(()=>{let t=!1;(async()=>{z(!0),r([]),m(""),g(""),S([]),A([]),l(!1),u(!1),h(null),D.current="",O.current="",B.current=[];try{let[n,i]=await Promise.all([(0,yC.getSessionMessages)(e.id),(0,yC.getSessionCheckpoints)(e.id).catch(()=>({checkpoints:[]}))]);if(t)return;let s=[...n].sort((e,t)=>new Date(e.createdAt).getTime()-new Date(t.createdAt).getTime()),a=eh(s);r(a),M(i.checkpoints||[]);let o=await (0,yC.getActiveStream)(e.id);if(t)return;o.hasActiveStream&&o.stream&&(console.log("Found active stream, connecting...",o.stream.streamId),K.current=!1,u(!0),l(!0),h(o.stream.streamId),$.current=(0,yC.watchStream)(e.id,em,{streamId:o.stream.streamId,onStreamId:e=>h(e)}))}catch(e){t||console.error("Failed to load messages:",e)}finally{t||z(!1)}})();let n=Y.current;return()=>{t=!0,$.current&&($.current(),$.current=null),n.forEach(e=>e()),n.clear()}},[e.id]),(0,b.useEffect)(()=>{let t=!1,r=e.id,n=async()=>{try{let e=await (0,yC.getPendingApprovals)(r);if(t)return;A(e)}catch{}};n();let i=setInterval(n,2e3);return()=>{t=!0,clearInterval(i)}},[e.id]),(0,b.useEffect)(()=>{let t=!1,r=e.id,n=async()=>{try{let e=await (0,yC.getSessionTodos)(r);if(t)return;P(e)}catch{}};n();let i=setInterval(n,o?1e3:5e3);return()=>{t=!0,clearInterval(i)}},[e.id,o]),(0,b.useEffect)(()=>{let t=!1,n=e.id,i=setInterval(async()=>{if(!o&&!q.current)try{let e=await (0,yC.getActiveStream)(n);if(t)return;if(e.hasActiveStream&&e.stream){let i=e.stream.streamId;if(i!==H.current){if(console.log("New active stream detected, connecting...",i),q.current=!0,K.current=!1,O.current.trim()){let e={id:`reasoning-${Date.now()}`,type:"reasoning",content:O.current};r(t=>[...t,e]),O.current="",g("")}if(D.current.trim()){let e={id:`text-${Date.now()}`,type:"assistant-text",content:D.current};r(t=>[...t,e]),D.current="",m("")}for(let e of B.current){let t={id:`tool-${e.toolCallId}`,type:"tool-call",toolCall:e};r(r=>r.some(t=>"tool-call"===t.type&&t.toolCall?.toolCallId===e.toolCallId)?r:[...r,t])}B.current=[],S([]),x(!1);try{let e=await (0,yC.getSessionMessages)(n);if(t){q.current=!1;return}let i=[...e].sort((e,t)=>new Date(e.createdAt).getTime()-new Date(t.createdAt).getTime()),s=eh(i);r(s)}catch(e){console.error("Failed to refresh messages:",e)}if(t){q.current=!1;return}u(!0),l(!0),h(i),H.current=i,$.current=(0,yC.watchStream)(n,em,{streamId:i,onStreamId:e=>{h(e),H.current=e}}),q.current=!1}}}catch(e){console.error("Failed to check for new stream:",e),q.current=!1}},1e3);return()=>{t=!0,clearInterval(i)}},[e.id,o]);let ef=async t=>{if(o)return;let n=!!t.text?.trim(),s=!!t.files?.length;if(!n&&!s)return;let a=[];if(s&&t.files.length>0){for(let e of t.files)if(e.url)try{let t=await fetch(e.url),r=await t.blob(),n=await new Promise(e=>{let t=new FileReader;t.onloadend=()=>e(t.result),t.readAsDataURL(r)}),i=e.mediaType||r.type||"application/octet-stream",s=i.startsWith("image/");a.push({type:s?"image":"file",data:n,mediaType:i,filename:e.filename})}catch(e){console.error("Failed to process attachment:",e)}}((t,n)=>{if(!t.trim()&&(!n||0===n.length)||o)return;let s=n?.map(e=>({type:e.type,data:e.data,mediaType:e.mediaType,filename:e.filename})),a={id:`user-${Date.now()}`,type:"user-message",content:t||"",attachments:s};r(e=>[...e,a]),i(""),l(!0),u(!1),K.current=!0,m(""),g(""),x(!1),S([]),D.current="",O.current="",B.current=[],$.current=(0,yC.runAgent)(e.id,t||"Please analyze the attached files.",em,{onStreamId:e=>h(e),attachments:n})})(t.text||"",a.length>0?a:void 0)},eg=async()=>{try{await (0,yC.abortStream)(e.id)}catch(e){console.error("Failed to abort stream:",e)}if($.current&&($.current(),$.current=null),O.current.trim()){let e={id:`reasoning-${Date.now()}`,type:"reasoning",content:O.current};r(t=>[...t,e])}if(D.current.trim()){let e={id:`text-${Date.now()}`,type:"assistant-text",content:D.current+" [stopped]"};r(t=>[...t,e])}m(""),g(""),x(!1),S([]),h(null),D.current="",O.current="",B.current=[],q.current=!1,l(!1),u(!1)},ey=async t=>{A(e=>e.filter(e=>e.id!==t.id));try{await (0,yC.approveExecution)(e.id,t.toolCallId)}catch(e){console.error("Failed to approve:",e)}},ex=async t=>{A(e=>e.filter(e=>e.id!==t.id));try{await (0,yC.rejectExecution)(e.id,t.toolCallId,"User rejected")}catch(e){console.error("Failed to reject:",e)}},ev=async t=>{A(e=>e.filter(e=>e.id!==t.id));try{await (0,yC.approveExecution)(e.id,t.toolCallId);let r=await (0,yC.updateToolApproval)(e.id,t.toolName,!1,ei);es(r.config||{})}catch(e){console.error("Failed to approve and disable:",e)}},eb=async(t,r)=>{try{let n=await (0,yC.updateToolApproval)(e.id,t,!r,ei);es(n.config||{})}catch(e){console.error("Failed to update tool approval:",e)}},ew=e=>({ts:"typescript",tsx:"tsx",js:"javascript",jsx:"jsx",py:"python",rb:"ruby",go:"go",rs:"rust",java:"java",c:"c",cpp:"cpp",h:"c",hpp:"cpp",cs:"csharp",php:"php",swift:"swift",kt:"kotlin",scala:"scala",sh:"bash",bash:"bash",zsh:"bash",fish:"bash",ps1:"powershell",sql:"sql",html:"html",htm:"html",css:"css",scss:"scss",sass:"sass",less:"less",json:"json",yaml:"yaml",yml:"yaml",xml:"xml",md:"markdown",markdown:"markdown",txt:"plaintext",toml:"toml",ini:"ini",cfg:"ini",conf:"ini",dockerfile:"dockerfile",makefile:"makefile"})[e.split(".").pop()?.toLowerCase()||""]||"plaintext";return(0,v.jsxs)("div",{className:"flex flex-col h-full bg-background min-w-0 overflow-x-hidden",children:[(0,v.jsxs)("div",{className:"border-b border-border/50 px-3 sm:px-4 py-2 flex items-center justify-between bg-card/50 backdrop-blur-sm",children:[(0,v.jsxs)("div",{className:"min-w-0 flex items-center gap-2 sm:gap-3",children:[(0,v.jsx)(xp,{}),(0,v.jsx)("div",{className:"flex items-center gap-1.5",children:ee?(0,v.jsxs)("form",{onSubmit:e=>{e.preventDefault(),eu()},className:"flex items-center gap-1",children:[(0,v.jsx)(gu.Input,{ref:el,value:Z,onChange:e=>Q(e.target.value),onBlur:eu,className:"h-7 text-sm font-semibold w-40 px-2",placeholder:"Session name"}),(0,v.jsx)(_.Button,{type:"submit",size:"icon",variant:"ghost",className:"size-6 text-muted-foreground hover:text-foreground",children:(0,v.jsx)(yF.Check,{className:"size-3.5"})})]}):(0,v.jsx)(T.TooltipProvider,{children:(0,v.jsxs)(T.Tooltip,{children:[(0,v.jsx)(T.TooltipTrigger,{asChild:!0,children:(0,v.jsxs)("button",{onClick:()=>et(!0),className:"flex items-center gap-1.5 group hover:bg-muted/50 rounded px-1.5 py-0.5 -mx-1.5 transition-colors",children:[(0,v.jsx)("h2",{className:"font-semibold text-foreground truncate max-w-[200px]",children:Z||"Untitled Session"}),(0,v.jsx)(yB,{className:"size-3 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity"})]})}),(0,v.jsx)(T.TooltipContent,{children:"Click to rename"})]})})}),(0,v.jsx)(T.TooltipProvider,{children:(0,v.jsxs)(T.Tooltip,{children:[(0,v.jsx)(T.TooltipTrigger,{asChild:!0,children:(0,v.jsx)("div",{children:(0,v.jsxs)(om.Select,{value:X,onValueChange:ec,disabled:o,children:[(0,v.jsx)(om.SelectTrigger,{className:"h-7 text-xs border-border/50 bg-muted/30 hover:bg-muted/50 transition-colors min-w-[160px]",children:(0,v.jsx)(om.SelectValue,{placeholder:"Select model"})}),(0,v.jsx)(om.SelectContent,{children:er?.availableModels.map(e=>(0,v.jsx)(om.SelectItem,{value:e.id,className:"text-xs",children:(0,v.jsxs)("div",{className:"flex items-center gap-2",children:[(0,v.jsx)("span",{children:e.name}),(0,v.jsx)("span",{className:"text-[10px] text-muted-foreground",children:e.provider})]})},e.id))})]})})}),(0,v.jsx)(T.TooltipContent,{children:o?"Cannot change model while running":"Switch model for next message"})]})}),(0,v.jsx)(T.TooltipProvider,{children:(0,v.jsxs)(T.Tooltip,{children:[(0,v.jsx)(T.TooltipTrigger,{asChild:!0,children:(0,v.jsxs)("div",{className:"flex items-center gap-1.5 px-2 py-1 rounded-md bg-muted/30 text-xs text-muted-foreground max-w-[200px]",children:[(0,v.jsx)(yV,{className:"size-3.5 shrink-0"}),(0,v.jsx)("span",{className:"truncate font-mono",children:e.workingDirectory.split("/").pop()||e.workingDirectory})]})}),(0,v.jsx)(T.TooltipContent,{side:"bottom",className:"max-w-md",children:(0,v.jsx)("p",{className:"font-mono text-xs",children:e.workingDirectory})})]})})]}),(0,v.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[c&&(0,v.jsx)(T.TooltipProvider,{children:(0,v.jsxs)(T.Tooltip,{children:[(0,v.jsx)(T.TooltipTrigger,{asChild:!0,children:(0,v.jsxs)(C,{variant:"outline",className:"gap-1.5 text-xs border-emerald-500/30 bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 cursor-help",children:[(0,v.jsx)("span",{className:"size-1.5 rounded-full bg-current animate-pulse"}),"Watching"]})}),(0,v.jsx)(T.TooltipContent,{children:"Watching stream from another client"})]})}),(0,v.jsx)(T.TooltipProvider,{children:(0,v.jsxs)(T.Tooltip,{children:[(0,v.jsx)(T.TooltipTrigger,{asChild:!0,children:(0,v.jsx)(C,{variant:o?"default":"secondary",className:`cursor-help ${o?"bg-primary/90":""}`,children:o?c?"streaming":"running":e.status})}),(0,v.jsx)(T.TooltipContent,{children:o?c?"Receiving streamed response":"Agent is processing":`Session is ${e.status}`})]})}),(0,v.jsxs)(mb.Dialog,{open:ea,onOpenChange:eo,children:[(0,v.jsx)(T.TooltipProvider,{children:(0,v.jsxs)(T.Tooltip,{children:[(0,v.jsx)(T.TooltipTrigger,{asChild:!0,children:(0,v.jsx)(mb.DialogTrigger,{asChild:!0,children:(0,v.jsx)(_.Button,{size:"icon",variant:"ghost",className:"size-7 hover:bg-accent transition-colors",children:(0,v.jsx)(yz.Settings,{className:"size-4"})})})}),(0,v.jsx)(T.TooltipContent,{children:"Session Settings"})]})}),(0,v.jsxs)(mb.DialogContent,{className:"sm:max-w-md",children:[(0,v.jsx)(mb.DialogHeader,{children:(0,v.jsxs)(mb.DialogTitle,{className:"flex items-center gap-2",children:[(0,v.jsx)("div",{className:"size-8 rounded-lg bg-muted flex items-center justify-center",children:(0,v.jsx)(yz.Settings,{className:"size-4"})}),"Session Settings"]})}),(0,v.jsxs)("div",{className:"space-y-4 pt-2",children:[(0,v.jsxs)("div",{className:"space-y-2",children:[(0,v.jsx)(yq.Label,{className:"flex items-center gap-2 text-sm font-medium",children:"Tool Approvals"}),(0,v.jsx)("p",{className:"text-xs text-muted-foreground -mt-0.5",children:"Toggle on to require approval before tool executes"}),(0,v.jsx)("div",{className:"space-y-1 rounded-lg border p-2.5 bg-muted/30",children:er?.availableTools.map(e=>{var t;let r=(t=e.id,ei.toolApprovals?.[t]!==void 0?ei.toolApprovals[t]:"bash"===t);return(0,v.jsxs)("div",{className:"flex items-center justify-between py-1.5 hover:bg-muted/50 rounded px-2 -mx-1 transition-colors",children:[(0,v.jsxs)("div",{className:"space-y-0",children:[(0,v.jsxs)("div",{className:"flex items-center gap-2",children:[(0,v.jsx)("span",{className:"text-sm font-medium",children:e.name}),e.dangerous&&(0,v.jsx)("span",{className:"text-[10px] bg-amber-500/20 text-amber-600 dark:text-amber-400 px-1.5 py-0.5 rounded font-medium",children:"risky"})]}),(0,v.jsx)("p",{className:"text-[11px] text-muted-foreground",children:e.description})]}),(0,v.jsx)(yH.Switch,{checked:r,onCheckedChange:()=>eb(e.id,r)})]},e.id)})})]}),(0,v.jsx)("p",{className:"text-xs text-muted-foreground",children:"These settings only apply to this session. Changes take effect for future tool calls."})]})]})]})]})]}),E&&E.todos&&E.todos.length>0&&(0,v.jsx)("div",{className:"px-4 py-2 border-b border-border/50 bg-muted/20",children:(0,v.jsx)(yM,{todosData:E})}),N.length>0&&(0,v.jsx)("div",{className:"p-4 border-b border-border space-y-3",children:N.map(e=>{let t=e.input;return(0,v.jsxs)(oq,{approval:{id:e.id,approved:!1},state:"approval-requested",children:[(0,v.jsx)(oK,{children:(0,v.jsxs)("div",{className:"flex items-start gap-3",children:[(0,v.jsx)("div",{className:"size-8 rounded-lg bg-amber-500/20 flex items-center justify-center shrink-0",children:(0,v.jsx)(yD,{className:"size-4 text-amber-500"})}),(0,v.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,v.jsx)("p",{className:"font-medium text-sm",children:"Approval Required"}),(0,v.jsx)("p",{className:"text-sm text-muted-foreground mt-0.5",children:(0,v.jsx)("code",{className:"bg-muted px-1.5 py-0.5 rounded font-mono text-foreground",children:e.toolName})}),(0,v.jsx)("div",{className:"mt-3 rounded-lg border bg-muted/30 overflow-hidden",children:Object.entries(t).map(([e,t])=>(0,v.jsxs)("div",{className:"flex border-b border-border/50 last:border-b-0",children:[(0,v.jsx)("div",{className:"px-3 py-2 bg-muted/50 text-xs font-medium text-muted-foreground w-24 shrink-0",children:e}),(0,v.jsx)("div",{className:"px-3 py-2 text-xs font-mono flex-1 min-w-0 overflow-auto max-h-24",children:"string"==typeof t?(0,v.jsx)("span",{className:"whitespace-pre-wrap break-words",children:t}):(0,v.jsx)("span",{className:"text-muted-foreground",children:JSON.stringify(t)})})]},e))})]})]})}),(0,v.jsxs)(oY,{children:[(0,v.jsx)(oX,{variant:"outline",onClick:()=>ex(e),children:"Reject"}),(0,v.jsx)(oX,{variant:"ghost",onClick:()=>ev(e),className:"text-muted-foreground hover:text-foreground",children:"Don't ask again"}),(0,v.jsx)(oX,{variant:"default",onClick:()=>ey(e),children:"Approve"})]})]},e.id)})}),(0,v.jsxs)(V,{className:"flex-1 p-4",children:[(0,v.jsxs)(U,{className:"max-w-3xl mx-auto w-full",children:[F&&(0,v.jsx)("div",{className:"flex justify-center py-12",children:(0,v.jsx)(oZ,{size:24})}),!F&&0===t.length&&!p&&(0,v.jsx)(W,{icon:(0,v.jsxs)("div",{className:"relative overflow-hidden rounded-2xl size-16 shadow-lg ring-1 ring-white/10",children:[(0,v.jsx)(k.default,{src:"/sparke-coder.png",alt:"SparkECoder",width:64,height:64,className:"absolute inset-0 size-full object-cover",priority:!0}),o&&(0,v.jsx)("video",{src:"/sparkecode.mp4",autoPlay:!0,muted:!0,loop:!0,playsInline:!0,className:"absolute inset-0 size-full object-cover"})]}),title:"Start a conversation",description:"Ask SparkECoder to help you with coding tasks"}),t.filter(e=>!("tool-call"===e.type&&e.toolCall&&N.some(t=>t.toolCallId===e.toolCall?.toolCallId))&&!0).map(e=>{if("user-message"===e.type){let t=void 0!==e.messageSequence&&R.some(t=>t.messageSequence===e.messageSequence);return(0,v.jsxs)(aV,{from:"user",children:[(0,v.jsxs)(aU,{children:[e.attachments&&e.attachments.length>0&&(0,v.jsx)("div",{className:"flex flex-wrap gap-2 mb-2",children:e.attachments.map((e,t)=>(0,v.jsx)("div",{className:"relative",children:"image"===e.type?(0,v.jsx)("div",{className:"relative rounded-lg overflow-hidden border border-border/50 max-w-[200px]",children:(0,v.jsx)("img",{src:e.data.startsWith("data:")?e.data:`data:${e.mediaType||"image/png"};base64,${e.data}`,alt:e.filename||"Image attachment",className:"max-w-full h-auto max-h-[150px] object-contain"})}):(0,v.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-muted/50 border border-border/50",children:[(0,v.jsx)(yW,{className:"h-4 w-4 text-muted-foreground"}),(0,v.jsx)("span",{className:"text-sm text-muted-foreground truncate max-w-[150px]",children:e.filename||"File"})]})},t))}),e.content&&(0,v.jsx)("p",{className:"whitespace-pre-wrap",children:e.content})]}),t&&!o&&(0,v.jsx)(aW,{className:"justify-end mt-1",children:(0,v.jsx)(T.TooltipProvider,{children:(0,v.jsxs)(T.Tooltip,{children:[(0,v.jsx)(T.TooltipTrigger,{asChild:!0,children:(0,v.jsxs)(_.Button,{variant:"ghost",size:"sm",onClick:()=>ep(e.messageSequence,e.content),disabled:L,className:"h-6 px-2 text-xs text-muted-foreground hover:text-destructive gap-1",children:[(0,v.jsx)(y$,{className:"h-3 w-3"}),"Revert"]})}),(0,v.jsx)(T.TooltipContent,{children:(0,v.jsx)("p",{children:"Revert to before this message (undo all changes after)"})})]})})})]},e.id)}if("reasoning"===e.type)return(0,v.jsxs)(pK,{isStreaming:!1,defaultOpen:!1,children:[(0,v.jsx)(pX,{}),(0,v.jsx)(pJ,{children:e.content||""})]},e.id);if("assistant-text"===e.type)return(0,v.jsx)(aV,{from:"assistant",children:(0,v.jsxs)("div",{className:"flex gap-3",children:[(0,v.jsx)("div",{className:"relative overflow-hidden rounded-lg size-8 shadow-sm ring-1 ring-white/10 shrink-0",children:(0,v.jsx)(k.default,{src:"/sparke-coder.png",alt:"SparkECoder",width:32,height:32,className:"absolute inset-0 size-full object-cover"})}),(0,v.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,v.jsx)(aU,{children:(0,v.jsx)(aq,{children:e.content||""})}),(0,v.jsx)(aW,{children:(0,v.jsx)(aG,{label:"Copy",onClick:()=>navigator.clipboard.writeText(e.content||""),children:(0,v.jsx)(of,{className:"size-3"})})})]})]})},e.id);if("tool-call"===e.type&&e.toolCall){let t=e.toolCall,r=`tool-${t.toolName}`;if("write_file"===t.toolName)return(0,v.jsx)(yX,{input:t.input,output:t.output,status:t.status,streamingArgsText:t.streamingArgsText},e.id);if("read_file"===t.toolName)return(0,v.jsx)(yQ,{input:t.input,output:t.output,status:t.status},e.id);if("bash"===t.toolName)return(0,v.jsx)(y5,{input:t.input,output:t.output,status:t.status,terminalId:t.terminalId,liveOutput:t.liveOutput},e.id);if("todo"===t.toolName)return(0,v.jsx)(y7,{input:t.input,output:t.output,status:t.status},e.id);if("load_skill"===t.toolName)return(0,v.jsx)(xn,{input:t.input,output:t.output,status:t.status},e.id);if("linter"===t.toolName)return(0,v.jsx)(xl,{input:t.input,output:t.output,status:t.status},e.id);let n="completed"!==t.status;return(0,v.jsxs)(oP,{defaultOpen:n,children:[(0,v.jsx)(oR,{type:r,state:function(e){switch(e){case"pending":case"streaming":default:return"input-streaming";case"running":return"input-available";case"completed":return"output-available";case"rejected":return"output-denied";case"error":return"output-error"}}(t.status),title:t.toolName}),(0,v.jsxs)(oM,{children:[(0,v.jsx)(oL,{input:t.input}),(e=>{let t=e.output,r=e.input;if("bash"===e.toolName)return(0,v.jsx)(y5,{input:e.input,output:e.output,status:e.status,terminalId:e.terminalId,liveOutput:e.liveOutput,className:"mt-2"});if("todo"===e.toolName)return(0,v.jsx)(y7,{input:e.input,output:e.output,status:e.status,className:"mt-2"});if("load_skill"===e.toolName)return(0,v.jsx)(xn,{input:e.input,output:e.output,status:e.status,className:"mt-2"});if("write_file"===e.toolName&&r){let e=r.path||"file",n=r.mode||"full",i=e.split("/").pop()||"file",s=ew(e);if("str_replace"===n){let e=r.old_string||"",n=r.new_string||"";return(0,v.jsxs)("div",{className:"mt-2 max-w-full overflow-hidden space-y-2",children:[(0,v.jsxs)("div",{className:"flex items-center gap-2 text-sm",children:[(0,v.jsx)(yO,{className:"size-4 text-muted-foreground"}),(0,v.jsx)("span",{className:"font-medium",children:i}),(0,v.jsx)(C,{variant:"secondary",className:"text-xs",children:"str_replace"})]}),(0,v.jsxs)("div",{className:"rounded-md border overflow-hidden",children:[(0,v.jsxs)("div",{className:"bg-red-500/10 border-b p-2",children:[(0,v.jsx)("div",{className:"text-xs text-red-500 mb-1",children:"- Remove:"}),(0,v.jsx)("pre",{className:"text-xs overflow-x-auto whitespace-pre-wrap break-words text-red-400",children:e.length>500?e.slice(0,500)+"...":e})]}),(0,v.jsxs)("div",{className:"bg-green-500/10 p-2",children:[(0,v.jsx)("div",{className:"text-xs text-green-500 mb-1",children:"+ Add:"}),(0,v.jsx)("pre",{className:"text-xs overflow-x-auto whitespace-pre-wrap break-words text-green-400",children:n.length>500?n.slice(0,500)+"...":n})]})]}),t&&(0,v.jsxs)("div",{className:`text-xs flex items-center gap-1 ${t.success?"text-green-600 dark:text-green-400":"text-red-600 dark:text-red-400"}`,children:[(0,v.jsx)("span",{children:t.success?"✓":"✗"}),(0,v.jsx)("span",{children:t.success?`Replaced (${void 0!==t.lineDelta?(t.lineDelta>=0?"+":"")+t.lineDelta+" lines":"done"})`:t.error||"Failed"})]})]})}let a=r.content||"";return(0,v.jsxs)("div",{className:"mt-2 max-w-full overflow-hidden",children:[(0,v.jsxs)(oD,{children:[(0,v.jsxs)(oO,{children:[(0,v.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,v.jsx)(yO,{className:"size-4 text-muted-foreground shrink-0"}),(0,v.jsx)(oB,{className:"truncate",children:i}),(0,v.jsx)(oF,{className:"truncate text-xs hidden sm:block",children:e})]}),(0,v.jsx)(oz,{children:(0,v.jsx)(o$,{icon:of,label:"Copy",onClick:()=>navigator.clipboard.writeText(a)})})]}),a&&(0,v.jsx)(oV,{className:"p-0 max-h-[300px] overflow-auto",children:(0,v.jsx)(oE,{code:a,language:s,showLineNumbers:!0,children:(0,v.jsx)(oA,{className:"sr-only",children:(0,v.jsx)(oC,{children:(0,v.jsx)(o_,{children:i})})})})})]}),t&&(0,v.jsxs)("div",{className:`mt-2 text-xs flex items-center gap-1 ${t.success?"text-green-600 dark:text-green-400":"text-red-600 dark:text-red-400"}`,children:[(0,v.jsx)("span",{children:t.success?"✓":"✗"}),(0,v.jsx)("span",{children:t.success?`File ${t.action||"written"} successfully`:t.error||"Failed"})]})]})}if("read_file"===e.toolName&&t){let e=r?.path||"file",n=t.content||JSON.stringify(t,null,2),i=e.split("/").pop()||"file",s=ew(e);return(0,v.jsx)("div",{className:"mt-2 max-w-full overflow-hidden",children:(0,v.jsxs)(oD,{children:[(0,v.jsxs)(oO,{children:[(0,v.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,v.jsx)(yO,{className:"size-4 text-muted-foreground shrink-0"}),(0,v.jsx)(oB,{className:"truncate",children:i}),(0,v.jsx)(oF,{className:"truncate text-xs hidden sm:block",children:e})]}),(0,v.jsx)(oz,{children:(0,v.jsx)(o$,{icon:of,label:"Copy",onClick:()=>navigator.clipboard.writeText(n)})})]}),(0,v.jsx)(oV,{className:"p-0 max-h-[300px] overflow-auto",children:(0,v.jsx)(oE,{code:n,language:s,showLineNumbers:!0,children:(0,v.jsx)(oA,{className:"sr-only",children:(0,v.jsx)(oC,{children:(0,v.jsx)(o_,{children:i})})})})})]})})}return t?(0,v.jsx)(oI,{output:(0,v.jsxs)("pre",{className:"text-xs overflow-x-auto max-w-full whitespace-pre-wrap break-words",children:[JSON.stringify(t,null,2).slice(0,500),JSON.stringify(t).length>500?"...":""]}),errorText:"error"===e.status?"Tool execution failed":void 0}):null})(t)]})]},e.id)}return null}),o&&!p&&!f&&0===w.length&&(0,v.jsxs)("div",{className:"flex gap-3 items-center",children:[(0,v.jsx)("div",{className:"relative overflow-hidden rounded-lg size-8 shadow-sm ring-1 ring-white/10 shrink-0",children:(0,v.jsx)("video",{src:"/sparkecode.mp4",autoPlay:!0,muted:!0,loop:!0,playsInline:!0,className:"absolute inset-0 size-full object-cover"})}),(0,v.jsx)("span",{className:"text-sm text-muted-foreground",children:"Thinking..."})]}),o&&(y||f)&&(0,v.jsxs)(pK,{isStreaming:y,defaultOpen:!0,children:[(0,v.jsx)(pX,{}),(0,v.jsx)(pJ,{children:f})]}),o&&p&&(0,v.jsx)(aV,{from:"assistant",children:(0,v.jsxs)("div",{className:"flex gap-3",children:[(0,v.jsx)("div",{className:"relative overflow-hidden rounded-lg size-8 shadow-sm ring-1 ring-white/10 shrink-0",children:(0,v.jsx)("video",{src:"/sparkecode.mp4",autoPlay:!0,muted:!0,loop:!0,playsInline:!0,className:"absolute inset-0 size-full object-cover"})}),(0,v.jsx)("div",{className:"flex-1 min-w-0",children:(0,v.jsxs)(aU,{children:[(0,v.jsx)(aq,{children:p}),(0,v.jsx)("span",{className:"inline-block w-2 h-4 bg-primary animate-pulse ml-1"})]})})]})}),o&&w.map(e=>"write_file"===e.toolName?(0,v.jsx)(yX,{input:e.input,output:e.output,status:e.status,streamingArgsText:e.streamingArgsText},e.toolCallId):"read_file"===e.toolName?(0,v.jsx)(yQ,{input:e.input,output:e.output,status:e.status},e.toolCallId):"bash"===e.toolName?(0,v.jsx)(y5,{input:e.input,output:e.output,status:e.status,terminalId:e.terminalId,liveOutput:e.liveOutput},e.toolCallId):"todo"===e.toolName?(0,v.jsx)(y7,{input:e.input,output:e.output,status:e.status},e.toolCallId):"load_skill"===e.toolName?(0,v.jsx)(xn,{input:e.input,output:e.output,status:e.status},e.toolCallId):"linter"===e.toolName?(0,v.jsx)(xl,{input:e.input,output:e.output,status:e.status},e.toolCallId):(0,v.jsxs)(oP,{defaultOpen:!0,children:[(0,v.jsx)(oR,{type:`tool-${e.toolName}`,state:"streaming"===e.status?"input-streaming":"input-available",title:e.toolName}),(0,v.jsxs)(oM,{children:[(0,v.jsx)(oL,{input:e.input}),(0,v.jsxs)("div",{className:"flex items-center gap-2 p-3 text-muted-foreground",children:[(0,v.jsx)(oZ,{size:14}),(0,v.jsx)("span",{className:"text-sm",children:"streaming"===e.status?"Receiving...":"Executing..."})]})]})]},e.toolCallId)),o&&!p&&0===w.length&&(0,v.jsxs)("div",{className:"flex items-center gap-2 text-muted-foreground",children:[(0,v.jsx)(oZ,{size:16}),(0,v.jsx)("span",{className:"text-sm",children:"Thinking..."})]})]}),(0,v.jsx)(G,{})]}),(0,v.jsx)("div",{className:"border-t border-border/50 p-4 pb-6 bg-card/30",children:(0,v.jsxs)("div",{className:"max-w-3xl mx-auto",children:[!F&&0===t.length&&!p&&!o&&(0,v.jsx)(yN,{className:"mb-3",children:['Create a hello.txt file with "Hello, World!"',"List files in the current directory","Show the current git status"].map(e=>(0,v.jsx)(yA,{suggestion:e,onClick:e=>{i(e)}},e))}),(0,v.jsxs)(gE,{onSubmit:ef,className:"shadow-sm",globalDrop:!0,multiple:!0,children:[(0,v.jsx)(gM,{children:(0,v.jsx)(xm,{})}),(0,v.jsx)(gP,{children:(0,v.jsxs)("div",{className:"relative w-full",children:[(0,v.jsx)(gR,{value:n+(s?(!n||n.endsWith(" ")||n.endsWith("\n")?"":" ")+s:""),onChange:e=>{s&&a(""),i(e.target.value)},placeholder:"Ask SparkECoder to help... (drag & drop files/images here)",disabled:o,autoFocus:!0,className:(0,j.cn)("min-h-[80px] focus:ring-2 focus:ring-primary/20 transition-all",s&&"caret-red-500")}),s&&(0,v.jsxs)("div",{className:"absolute bottom-2 right-2 flex items-center gap-1.5 text-xs text-red-500 bg-background/80 backdrop-blur-sm px-2 py-1 rounded-full",children:[(0,v.jsx)("span",{className:"size-2 bg-red-500 rounded-full animate-pulse"}),"Listening..."]})]})}),(0,v.jsxs)(gL,{children:[(0,v.jsx)("div",{className:"flex-1"}),(0,v.jsxs)("div",{className:"flex items-center gap-2",children:[(0,v.jsx)(xh,{size:"icon",className:"size-9",onTranscriptionChange:e=>{i(t=>{let r=t&&!t.endsWith(" ")&&!t.endsWith("\n");return t+(r?" ":"")+e})},onInterimTranscription:e=>{a(e)},disabled:o}),(0,v.jsx)(xf,{input:n+s,isRunning:o,onStop:eg})]})]})]})]})})]})}var xy=e.i(461957);function xx({params:e}){let{id:t}=(0,b.use)(e),r=(0,w.useRouter)(),[n,i]=(0,b.useState)(null),[s,a]=(0,b.useState)(!0),[o,l]=(0,b.useState)(null);return((0,b.useEffect)(()=>{!async function(){try{let e=await (0,yC.getSession)(t);if(!e)return void l("Session not found");i(e)}catch(e){console.error("Failed to load session:",e),l("Failed to load session")}finally{a(!1)}}()},[t]),s)?(0,v.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,v.jsx)(xy.Loader2,{className:"size-8 animate-spin text-muted-foreground"})}):o||!n?(0,v.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,v.jsxs)("div",{className:"text-center",children:[(0,v.jsx)("p",{className:"text-muted-foreground mb-4",children:o||"Session not found"}),(0,v.jsx)("button",{onClick:()=>r.push("/"),className:"text-primary hover:underline",children:"Go back home"})]})}):(0,v.jsx)(xg,{session:n})}e.s(["default",()=>xx],330460)}]);